diff --git "a/data/train/javascript-001.jsonl" "b/data/train/javascript-001.jsonl" new file mode 100644--- /dev/null +++ "b/data/train/javascript-001.jsonl" @@ -0,0 +1,525 @@ +{"question_id": 540, "task_id": "single-element-in-a-sorted-array", "difficulty": "Medium", "problem_description": "You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once.\nReturn the single element that appears only once.\nYour solution must run in O(log n) time and O(1) space.\n \nExample 1:\nInput: nums = [1,1,2,3,3,4,4,8,8]\nOutput: 2\nExample 2:\nInput: nums = [3,3,7,7,10,11,11]\nOutput: 10\n\n \nConstraints:\n\n1 <= nums.length <= 105\n0 <= nums[i] <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [5, 5, 6, 6, 7, 8, 8]) == 7\n assert candidate(nums = [0, 0, 1, 1, 2]) == 2\n assert candidate(nums = [2, 2, 3, 3, 4, 4, 5, 6, 6]) == 5\n assert candidate(nums = [10, 10, 20, 20, 30, 30, 40, 40, 50]) == 50\n assert candidate(nums = [1, 1, 2, 2, 3]) == 3\n assert candidate(nums = [10, 10, 11, 11, 12, 13, 13, 14, 14]) == 12\n assert candidate(nums = [1]) == 1\n assert candidate(nums = [1, 1, 2, 2, 3, 4, 4]) == 3\n assert candidate(nums = [1, 2, 2]) == 1\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3]) == 3\n assert candidate(nums = [1, 1, 2, 3, 3, 4, 4, 8, 8]) == 2\n assert candidate(nums = [1, 1, 2]) == 2\n assert candidate(nums = [3, 3, 7, 7, 10, 11, 11]) == 10\n assert candidate(nums = [10, 10, 22, 22, 44, 55, 55, 66, 66, 77, 77]) == 44\n assert candidate(nums = [0, 0, 1, 1, 2, 3, 3]) == 2\n assert candidate(nums = [1, 1, 10, 10, 6, 7, 7, 8, 8]) == 6\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 5, 5]) == 4\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5]) == 1\n assert candidate(nums = [5]) == 5\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5]) == 5\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 4, 4]) == 3\n assert candidate(nums = [1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14]) == 10\n assert candidate(nums = [100, 100, 200, 200, 300, 300, 400, 400, 500, 500, 600, 600, 700, 700, 800, 800, 900, 900, 1000]) == 1000\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16]) == 1\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30]) == 1\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16]) == 16\n assert candidate(nums = [10, 10, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == 11\n assert candidate(nums = [0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 18, 18, 20, 20, 22, 22, 24, 24]) == 16\n assert candidate(nums = [3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 21, 23, 23, 25]) == 25\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14]) == 1\n assert candidate(nums = [1000, 1000, 2000, 2000, 3000, 3000, 4000, 4000, 5000, 5000, 6000, 6000, 7000, 7000, 8000, 8000, 9000, 9000, 10000, 10000, 11000, 11000, 12000, 12000, 13000, 13000, 14000, 14000, 15000, 15000, 16000, 16000, 17000, 17000, 18000, 18000, 19000, 19000, 20000, 20000, 21000, 21000, 22000, 22000, 23000, 23000, 24000, 24000, 25000]) == 25000\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19]) == 19\n assert candidate(nums = [100, 100, 102, 102, 104, 104, 106, 106, 108, 108, 110, 110, 112, 112, 114, 116, 116, 118, 118, 120, 120]) == 114\n assert candidate(nums = [1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 12, 12, 14, 14, 16, 16]) == 11\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32]) == 32\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25]) == 25\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20]) == 9\n assert candidate(nums = [10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20]) == 20\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28]) == 28\n assert candidate(nums = [2, 2, 4, 4, 6, 6, 8, 8, 10, 11, 11, 13, 13, 15, 15]) == 10\n assert candidate(nums = [10, 10, 20, 20, 30, 30, 40, 40, 50, 50, 60, 60, 70, 70, 80, 80, 90]) == 90\n assert candidate(nums = [2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 26, 28, 28, 30, 30, 32, 32, 34]) == 34\n assert candidate(nums = [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19]) == 19\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31]) == 31\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11]) == 4\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25]) == 18\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26]) == 26\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10]) == 1\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33]) == 33\n assert candidate(nums = [1000, 1000, 1002, 1002, 1004, 1004, 1006, 1006, 1008, 1008, 1010, 1010, 1012, 1012, 1014, 1014, 1016, 1016, 1018, 1018, 1020, 1020, 1022, 1022, 1024, 1024, 1025]) == 1025\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9]) == 8\n assert candidate(nums = [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 12]) == 11\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9]) == 7\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11]) == 11\n assert candidate(nums = [3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20]) == 20\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19]) == 18\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17]) == 1\n assert candidate(nums = [0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7]) == 1\n assert candidate(nums = [1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15]) == 14\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 10, 11]) == 9\n assert candidate(nums = [1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 25, 25, 26, 26, 27]) == 27\n assert candidate(nums = [25, 25, 30, 30, 35, 35, 40, 40, 45, 45, 50, 50, 55, 55, 60, 60, 65, 66, 66, 70, 70, 75, 75, 80, 80, 85, 85, 90, 90]) == 65\n assert candidate(nums = [0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8]) == 1\n assert candidate(nums = [0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11]) == 2\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11]) == 8\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18]) == 18\n assert candidate(nums = [1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 16, 16, 18, 18, 20, 20]) == 15\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 12]) == 11\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11]) == 1\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29]) == 29\n assert candidate(nums = [10, 10, 20, 20, 30, 30, 40, 40, 50, 50, 60, 60, 70, 70, 80, 80, 90, 90, 100, 100, 110, 110, 120, 120, 130, 130, 140, 141, 141]) == 140\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8]) == 6\n assert candidate(nums = [2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 21]) == 21\n assert candidate(nums = [2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 19, 19]) == 18\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 16]) == 15\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 1\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11]) == 1\n assert candidate(nums = [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11]) == 11\n assert candidate(nums = [1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13]) == 2\n assert candidate(nums = [2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 26, 28, 29, 29]) == 28\n assert candidate(nums = [1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 2\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20]) == 20\n assert candidate(nums = [50000, 50000, 50001, 50001, 50002, 50002, 50003, 50003, 50004, 50004, 50005, 50005, 50006, 50006, 50007, 50007, 50008, 50008, 50009, 50009, 50010, 50010, 50011, 50011, 50012, 50012, 50013, 50013, 50014, 50014, 50015, 50015, 50016, 50016, 50017, 50017, 50018, 50018, 50019, 50019, 50020]) == 50020\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27]) == 27\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30]) == 30\n assert candidate(nums = [1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11]) == 2\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21]) == 21\n assert candidate(nums = [100, 100, 200, 200, 300, 300, 400, 400, 500, 500, 600, 600, 700, 700, 800, 800, 900, 901, 901]) == 900\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10]) == 9\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 10]) == 7\n assert candidate(nums = [1, 1, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9]) == 9\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14]) == 9\n assert candidate(nums = [1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 21, 23, 23, 25, 25, 27, 27, 29, 29, 31, 31, 33, 33, 35, 35, 37, 37, 39, 39, 41, 41, 43, 43, 45, 45, 47, 47, 49, 49, 51, 51, 53]) == 53\n assert candidate(nums = [1, 1, 2, 2, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 10, 10, 11, 11, 12, 12, 13]) == 13\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9]) == 9\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24]) == 24\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 5\n assert candidate(nums = [1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21]) == 21\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 17, 17]) == 1\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 6\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 5\n assert candidate(nums = [3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 21, 23, 23, 25, 25, 27, 27, 29, 29, 31]) == 31\n assert candidate(nums = [1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 10]) == 3\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9]) == 9\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22]) == 22\n assert candidate(nums = [1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17]) == 2\n assert candidate(nums = [100000, 100000, 200000, 200000, 300000, 300000, 400000, 400000, 500000, 500000, 600000, 600000, 700000, 700000, 800000, 800000, 900000, 900000, 1000000]) == 1000000\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 10]) == 8\n assert candidate(nums = [10, 10, 20, 20, 30, 30, 40, 40, 50, 51, 51, 60, 60, 70, 70, 80, 80, 90, 90]) == 50\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15]) == 15\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8]) == 5\n assert candidate(nums = [10, 10, 20, 20, 30, 30, 40, 40, 50, 51, 51, 60, 60, 70, 70, 80, 80]) == 50\n assert candidate(nums = [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 18, 18]) == 17\n assert candidate(nums = [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18]) == 18\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 4\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 13]) == 12\n assert candidate(nums = [1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 21, 23, 23, 25, 25, 27, 27, 29, 29, 31, 31, 33, 33, 35, 35, 37, 37, 39, 39, 41, 41, 43]) == 43\n assert candidate(nums = [10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17]) == 14\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11]) == 6\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23]) == 23\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 5\n assert candidate(nums = [10, 10, 20, 20, 30, 40, 40, 50, 50, 60, 60, 70, 70, 80, 80, 90, 90, 100, 100, 110]) == 30\n assert candidate(nums = [1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10]) == 2\n assert candidate(nums = [3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 21, 21]) == 19\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17]) == 17\n assert candidate(nums = [100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 108, 108, 109, 109, 110, 110]) == 107\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 10, 11, 11, 12, 12]) == 9\n assert candidate(nums = [10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 27, 28, 28, 30, 30]) == 26\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12]) == 12\n assert candidate(nums = [3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13]) == 13\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14]) == 14\n assert candidate(nums = [2, 2, 4, 4, 6, 6, 8, 8, 10, 11, 11, 12, 12, 14, 14, 16, 16, 18, 18]) == 10\n assert candidate(nums = [100, 100, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117]) == 101\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().singleNonDuplicate", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var singleNonDuplicate = function(nums) {", "container": null, "callable": "singleNonDuplicate", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 541, "task_id": "reverse-string-ii", "difficulty": "Easy", "problem_description": "Given a string s and an integer k, reverse the first k characters for every 2k characters counting from the start of the string.\nIf there are fewer than k characters left, reverse all of them. If there are less than 2k but greater than or equal to k characters, then reverse the first k characters and leave the other as original.\n \nExample 1:\nInput: s = \"abcdefg\", k = 2\nOutput: \"bacdfeg\"\nExample 2:\nInput: s = \"abcd\", k = 2\nOutput: \"bacd\"\n\n \nConstraints:\n\n1 <= s.length <= 104\ns consists of only lowercase English letters.\n1 <= k <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"\",k = 5) == \"\"\n assert candidate(s = \"abcdefgh\",k = 3) == \"cbadefhg\"\n assert candidate(s = \"abcdefg\",k = 1) == \"abcdefg\"\n assert candidate(s = \"abcdef\",k = 6) == \"fedcba\"\n assert candidate(s = \"a\",k = 1) == \"a\"\n assert candidate(s = \"abcdefghijk\",k = 4) == \"dcbaefghkji\"\n assert candidate(s = \"abcd\",k = 2) == \"bacd\"\n assert candidate(s = \"abcdefg\",k = 2) == \"bacdfeg\"\n assert candidate(s = \"abcdefg\",k = 10) == \"gfedcba\"\n assert candidate(s = \"ab\",k = 10) == \"ba\"\n assert candidate(s = \"mississippiississippiississippi\",k = 6) == \"sissimsippiiississppiissppissii\"\n assert candidate(s = \"abcdefghijklmnopqrs\",k = 1) == \"abcdefghijklmnopqrs\"\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",k = 5) == \"vwxyzutsrqlmnopkjihgbcdefa\"\n assert candidate(s = \"mississippi\",k = 4) == \"ssimissiipp\"\n assert candidate(s = \"abcdefghij\",k = 7) == \"gfedcbahij\"\n assert candidate(s = \"reverseeverysinglekcharachters\",k = 8) == \"eesreververysingarahckelchters\"\n assert candidate(s = \"abcdefghijklmnopqrstu\",k = 1) == \"abcdefghijklmnopqrstu\"\n assert candidate(s = \"thisisaverylongstringforchecking\",k = 6) == \"sisihtaverylrtsgnoingforikcehcng\"\n assert candidate(s = \"abcd\",k = 1) == \"abcd\"\n assert candidate(s = \"zxcvbnmlkjhgfdsapoiuytrewq\",k = 9) == \"klmnbvcxzjhgfdsapoqwertyui\"\n assert candidate(s = \"abcdefghijklmn\",k = 1) == \"abcdefghijklmn\"\n assert candidate(s = \"abcdefghijklmnopq\",k = 1) == \"abcdefghijklmnopq\"\n assert candidate(s = \"reversemeplease\",k = 7) == \"esrevermeplease\"\n assert candidate(s = \"abcdefghij\",k = 2) == \"bacdfeghji\"\n assert candidate(s = \"thisisaverylongstringthatweneedtoreversesomeparts\",k = 5) == \"isihtsavergnolystrintahtgweneeerotdversepemosarts\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxy\",k = 1) == \"abcdefghijklmnopqrstuvwxy\"\n assert candidate(s = \"abcdefghij\",k = 8) == \"hgfedcbaij\"\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",k = 1) == \"zyxwvutsrqponmlkjihgfedcba\"\n assert candidate(s = \"abcdefghij\",k = 10) == \"jihgfedcba\"\n assert candidate(s = \"onetwothreefourfivesixseveneightnine\",k = 10) == \"erhtowtenoefourfivesgienevesxihtnine\"\n assert candidate(s = \"almostthere\",k = 10) == \"rehttsomlae\"\n assert candidate(s = \"abcdefghijabcdefghij\",k = 11) == \"ajihgfedcbabcdefghij\"\n assert candidate(s = \"reverseme\",k = 5) == \"reverseme\"\n assert candidate(s = \"reverseevery2kcharacters\",k = 5) == \"reverseeveck2yrharacsret\"\n assert candidate(s = \"pythonprogramming\",k = 2) == \"ypthnoprgoramming\"\n assert candidate(s = \"oddnumberofchar\",k = 4) == \"nddoumbecforhar\"\n assert candidate(s = \"abcdefghijklmnop\",k = 1) == \"abcdefghijklmnop\"\n assert candidate(s = \"abcdefghij\",k = 4) == \"dcbaefghji\"\n assert candidate(s = \"abcdefghij\",k = 9) == \"ihgfedcbaj\"\n assert candidate(s = \"abc\",k = 1) == \"abc\"\n assert candidate(s = \"abcdefghij\",k = 11) == \"jihgfedcba\"\n assert candidate(s = \"abcdefgh\",k = 9) == \"hgfedcba\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",k = 5) == \"cbbaacddeehggffhiijjmllkkmnnoorqqpprssttwvvuuwxxyyzz\"\n assert candidate(s = \"abcdef\",k = 5) == \"edcbaf\"\n assert candidate(s = \"abcdefghijklnopqrstuvwxyz\",k = 26) == \"zyxwvutsrqponlkjihgfedcba\"\n assert candidate(s = \"pythonprogramminglanguage\",k = 8) == \"rpnohtypogrammingaugnalge\"\n assert candidate(s = \"reverseeveryotherchunk\",k = 3) == \"verersveeeryhtoercnuhk\"\n assert candidate(s = \"abcdefghijklmnopqrst\",k = 1) == \"abcdefghijklmnopqrst\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",k = 7) == \"dccbbaadeeffggkjjiihhkllmmnnrqqppoorssttuuyxxwwvvyzz\"\n assert candidate(s = \"abcdefgh\",k = 1) == \"abcdefgh\"\n assert candidate(s = \"abcde\",k = 10) == \"edcba\"\n assert candidate(s = \"aabbccddeeffgghhiijj\",k = 1) == \"aabbccddeeffgghhiijj\"\n assert candidate(s = \"reversemeplease\",k = 1) == \"reversemeplease\"\n assert candidate(s = \"abcdefghijklmnopqr\",k = 1) == \"abcdefghijklmnopqr\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",k = 5) == \"edcbafghijonmlkpqrstyxwvuz\"\n assert candidate(s = \"abcdef\",k = 7) == \"fedcba\"\n assert candidate(s = \"abcdefghij\",k = 5) == \"edcbafghij\"\n assert candidate(s = \"abcdefghijklnopqrstuvwxyz\",k = 13) == \"nlkjihgfedcbaopqrstuvwxyz\"\n assert candidate(s = \"abcdefghijklmnopqrstuv\",k = 1) == \"abcdefghijklmnopqrstuv\"\n assert candidate(s = \"abcdefghijkl\",k = 1) == \"abcdefghijkl\"\n assert candidate(s = \"abcdefghijklnmopqrstuvwxyz\",k = 5) == \"edcbafghijomnlkpqrstyxwvuz\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",k = 8) == \"ddccbbaaeeffgghhllkkjjiimmnnooppttssrrqquuvvwwxxzzyy\"\n assert candidate(s = \"thisisaverylongstringtotestthealgorithm\",k = 6) == \"sisihtaverylrtsgnoingtotehttsealgorimht\"\n assert candidate(s = \"abcdefghij\",k = 3) == \"cbadefihgj\"\n assert candidate(s = \"onemoretest\",k = 15) == \"tseteromeno\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",k = 3) == \"cbadefihgjklonmpqrutsvwxzy\"\n assert candidate(s = \"quickbrownfoxjumpsoverthelazydog\",k = 8) == \"orbkciuqwnfoxjumhtrevospelazydog\"\n assert candidate(s = \"reverseeverytwochars\",k = 2) == \"ervesreeevrywtocahrs\"\n assert candidate(s = \"thisisaverylongstringthatweneedtoreversethosegmentscorrectly\",k = 8) == \"vasisihterylongsahtgnirttweneedtesreverothosegmeerrocstnctly\"\n assert candidate(s = \"abcde\",k = 1) == \"abcde\"\n assert candidate(s = \"aaaaaabbbbbbcccccc\",k = 6) == \"aaaaaabbbbbbcccccc\"\n assert candidate(s = \"abcdefghij\",k = 20) == \"jihgfedcba\"\n assert candidate(s = \"partialreverse\",k = 7) == \"laitrapreverse\"\n assert candidate(s = \"abcdef\",k = 1) == \"abcdef\"\n assert candidate(s = \"abcdefghij\",k = 1) == \"abcdefghij\"\n assert candidate(s = \"abcdefgh\",k = 8) == \"hgfedcba\"\n assert candidate(s = \"a\",k = 10) == \"a\"\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",k = 4) == \"wxyzvutsopqrnmlkghijfedcab\"\n assert candidate(s = \"abcdefghij\",k = 6) == \"fedcbaghij\"\n assert candidate(s = \"thisisaverylongstringthatwilltestthefunctiontoseehowitbehaves\",k = 15) == \"gnolyrevasisihtstringthatwillttnoitcnufehttseoseehowitbehaves\"\n assert candidate(s = \"shortstring\",k = 15) == \"gnirtstrohs\"\n assert candidate(s = \"thisisaverylongstringthatweneedtotest\",k = 7) == \"asisihtverylongnirtsgthatwenetotdeest\"\n assert candidate(s = \"aaaaabbbbbaaaaabbbbb\",k = 5) == \"aaaaabbbbbaaaaabbbbb\"\n assert candidate(s = \"ababababababababababababab\",k = 2) == \"baabbaabbaabbaabbaabbaabba\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",k = 1) == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"abcdefghijabcdefghij\",k = 7) == \"gfedcbahijabcdjihgfe\"\n assert candidate(s = \"abcdefghijk\",k = 1) == \"abcdefghijk\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",k = 3) == \"baabcceddeffhgghiikjjkllnmmnooqppqrrtsstuuwvvwxxzyyz\"\n assert candidate(s = \"onetwothreefourfive\",k = 1) == \"onetwothreefourfive\"\n assert candidate(s = \"ab\",k = 2) == \"ba\"\n assert candidate(s = \"pythonprogramminglanguage\",k = 1) == \"pythonprogramminglanguage\"\n assert candidate(s = \"one\",k = 10) == \"eno\"\n assert candidate(s = \"abcdabcdabcd\",k = 2) == \"bacdbacdbacd\"\n assert candidate(s = \"thisisaverylongstringtocheckthebehaviorofthefunction\",k = 8) == \"vasisihterylongscotgnirthecktheboroivahefthefuncnoit\"\n assert candidate(s = \"letsreverseeveryothersegment\",k = 6) == \"erstelverseetoyrevhersegtnem\"\n assert candidate(s = \"abababababababab\",k = 2) == \"baabbaabbaabbaab\"\n assert candidate(s = \"abcdefghijabcdefghijabcdefghij\",k = 12) == \"bajihgfedcbacdefghijabcdjihgfe\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwx\",k = 1) == \"abcdefghijklmnopqrstuvwx\"\n assert candidate(s = \"ab\",k = 1) == \"ab\"\n assert candidate(s = \"abcdefghijklm\",k = 1) == \"abcdefghijklm\"\n assert candidate(s = \"twowords\",k = 2) == \"wtowrods\"\n assert candidate(s = \"abcdefghijklmnopqrstuvw\",k = 1) == \"abcdefghijklmnopqrstuvw\"\n assert candidate(s = \"reverseeveryotherblock\",k = 7) == \"esrevereveryotcolbrehk\"\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",k = 26) == \"abcdefghijklmnopqrstuvwxyz\"\n"}, "metadata": {"canonical_parameter_names": ["s", "k"], "leetcode_dataset_entry_point": "Solution().reverseStr", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var reverseStr = function(s, k) {", "container": null, "callable": "reverseStr", "parameters": [{"name": "s", "type": "string"}, {"name": "k", "type": "number"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 542, "task_id": "01-matrix", "difficulty": "Medium", "problem_description": "Given an m x n binary matrix mat, return the distance of the nearest 0 for each cell.\nThe distance between two cells sharing a common edge is 1.\n \nExample 1:\n\n\nInput: mat = [[0,0,0],[0,1,0],[0,0,0]]\nOutput: [[0,0,0],[0,1,0],[0,0,0]]\n\nExample 2:\n\n\nInput: mat = [[0,0,0],[0,1,0],[1,1,1]]\nOutput: [[0,0,0],[0,1,0],[1,2,1]]\n\n \nConstraints:\n\nm == mat.length\nn == mat[i].length\n1 <= m, n <= 104\n1 <= m * n <= 104\nmat[i][j] is either 0 or 1.\nThere is at least one 0 in mat.\n\n \nNote: This question is the same as 1765: https://leetcode.com/problems/map-of-highest-peak/\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(mat = [[1, 0, 1, 1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 1, 0, 1, 1], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 1, 1, 1, 0, 1, 0], [1, 0, 1, 1, 0, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 1, 0, 0, 1, 1], [1, 0, 0, 0, 1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 0, 1, 0], [1, 1, 1, 1, 0, 1, 0, 0, 1, 1]]) == [[1, 0, 1, 1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 1, 0, 1, 1], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 1, 2, 1, 0, 1, 0], [1, 0, 1, 1, 0, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 1, 0, 0, 1, 2], [1, 0, 0, 0, 1, 2, 1, 1, 0, 1], [2, 1, 1, 1, 1, 2, 1, 0, 1, 0], [3, 2, 2, 1, 0, 1, 0, 0, 1, 1]]\n assert candidate(mat = [[0, 1, 0], [0, 1, 0], [0, 1, 0]]) == [[0, 1, 0], [0, 1, 0], [0, 1, 0]]\n assert candidate(mat = [[1, 1, 1], [1, 1, 1], [1, 0, 1]]) == [[3, 2, 3], [2, 1, 2], [1, 0, 1]]\n assert candidate(mat = [[0, 1, 0, 1, 1], [1, 1, 0, 0, 1], [0, 0, 0, 1, 0], [1, 0, 1, 1, 1], [1, 1, 1, 0, 0]]) == [[0, 1, 0, 1, 2], [1, 1, 0, 0, 1], [0, 0, 0, 1, 0], [1, 0, 1, 1, 1], [2, 1, 1, 0, 0]]\n assert candidate(mat = [[0, 0, 0], [0, 1, 0], [0, 0, 0]]) == [[0, 0, 0], [0, 1, 0], [0, 0, 0]]\n assert candidate(mat = [[0, 0, 0], [0, 1, 0], [1, 1, 1]]) == [[0, 0, 0], [0, 1, 0], [1, 2, 1]]\n assert candidate(mat = [[0, 1, 0, 1, 1], [1, 1, 0, 1, 1], [1, 1, 1, 1, 1], [1, 0, 0, 1, 0]]) == [[0, 1, 0, 1, 2], [1, 1, 0, 1, 2], [2, 1, 1, 2, 1], [1, 0, 0, 1, 0]]\n assert candidate(mat = [[0, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 0]]) == [[0, 1, 2, 3], [1, 2, 3, 2], [2, 3, 2, 1], [3, 2, 1, 0]]\n assert candidate(mat = [[1, 1, 1], [1, 1, 1], [1, 1, 0]]) == [[4, 3, 2], [3, 2, 1], [2, 1, 0]]\n assert candidate(mat = [[1, 0, 1], [1, 1, 0], [1, 1, 1]]) == [[1, 0, 1], [2, 1, 0], [3, 2, 1]]\n assert candidate(mat = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == [[0, 0, 0], [0, 0, 0], [0, 0, 0]]\n assert candidate(mat = [[0, 1, 0, 1, 1], [1, 1, 0, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 0]]) == [[0, 1, 0, 1, 2], [1, 1, 0, 1, 2], [2, 2, 1, 2, 1], [3, 3, 2, 1, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 0]]) == [[2, 1, 2, 3, 4, 5, 6], [1, 0, 1, 2, 3, 4, 5], [2, 1, 2, 1, 2, 3, 4], [3, 2, 1, 0, 1, 2, 3], [4, 3, 2, 1, 2, 3, 2], [5, 4, 3, 2, 3, 2, 1], [6, 5, 4, 3, 2, 1, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == [[4, 3, 2, 3, 4], [3, 2, 1, 2, 3], [2, 1, 0, 1, 2], [3, 2, 1, 2, 3], [4, 3, 2, 3, 4]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == [[6, 5, 4, 3, 3, 4, 5, 6], [5, 4, 3, 2, 2, 3, 4, 5], [4, 3, 2, 1, 1, 2, 3, 4], [3, 2, 1, 0, 0, 1, 2, 3], [3, 2, 1, 0, 0, 1, 2, 3], [4, 3, 2, 1, 1, 2, 3, 4], [5, 4, 3, 2, 2, 3, 4, 5], [6, 5, 4, 3, 3, 4, 5, 6]]\n assert candidate(mat = [[0, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 0]]) == [[0, 1, 2, 3, 4, 5, 6, 7, 7], [1, 2, 3, 4, 3, 4, 5, 6, 6], [2, 3, 4, 3, 2, 3, 4, 5, 5], [3, 4, 3, 2, 1, 2, 3, 4, 4], [4, 3, 2, 1, 0, 1, 2, 3, 3], [5, 4, 3, 2, 1, 2, 3, 3, 2], [6, 5, 4, 3, 2, 3, 3, 2, 1], [7, 6, 5, 4, 3, 3, 2, 1, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == [[2, 1, 1, 2, 2, 1, 2], [1, 0, 0, 1, 1, 0, 1], [1, 0, 1, 2, 1, 0, 1], [1, 0, 1, 2, 1, 0, 1], [1, 0, 0, 1, 1, 0, 1], [2, 1, 1, 2, 2, 1, 2]]\n assert candidate(mat = [[0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 0, 0]]) == [[0, 0, 0, 0, 1, 2, 3], [0, 0, 0, 1, 2, 3, 4], [0, 0, 1, 2, 3, 4, 3], [0, 1, 2, 3, 4, 3, 2], [1, 2, 3, 4, 3, 2, 1], [2, 3, 4, 3, 2, 1, 0], [3, 4, 3, 2, 1, 0, 0]]\n assert candidate(mat = [[0, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 0]]) == [[0, 1, 2, 3, 4, 5, 6, 7, 7], [1, 2, 3, 4, 5, 6, 7, 7, 6], [2, 3, 4, 5, 6, 7, 7, 6, 5], [3, 4, 5, 6, 7, 7, 6, 5, 4], [4, 5, 6, 7, 7, 6, 5, 4, 3], [5, 6, 7, 7, 6, 5, 4, 3, 2], [6, 7, 7, 6, 5, 4, 3, 2, 1], [7, 7, 6, 5, 4, 3, 2, 1, 0]]\n assert candidate(mat = [[0, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0]]) == [[0, 1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7, 6], [2, 3, 4, 5, 6, 7, 6, 5], [3, 4, 5, 6, 7, 6, 5, 4], [4, 5, 6, 7, 6, 5, 4, 3], [5, 6, 7, 6, 5, 4, 3, 2], [6, 7, 6, 5, 4, 3, 2, 1], [7, 6, 5, 4, 3, 2, 1, 0]]\n assert candidate(mat = [[0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0]]) == [[0, 1, 2, 3, 4, 4, 3, 2, 1, 0], [1, 2, 3, 4, 5, 5, 4, 3, 2, 1], [2, 3, 4, 5, 6, 6, 5, 4, 3, 2], [3, 4, 5, 6, 7, 7, 6, 5, 4, 3], [3, 4, 5, 6, 7, 7, 6, 5, 4, 3], [2, 3, 4, 5, 6, 6, 5, 4, 3, 2], [1, 2, 3, 4, 5, 5, 4, 3, 2, 1], [0, 1, 2, 3, 4, 4, 3, 2, 1, 0]]\n assert candidate(mat = [[0, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 0]]) == [[0, 1, 2, 3, 4, 5, 6], [1, 2, 3, 2, 3, 4, 5], [2, 3, 2, 1, 2, 3, 4], [3, 2, 1, 0, 1, 2, 3], [4, 3, 2, 1, 2, 3, 2], [5, 4, 3, 2, 3, 2, 1], [6, 5, 4, 3, 2, 1, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1, 1, 0]]) == [[4, 5, 5, 4, 3, 2, 1, 0], [3, 4, 5, 5, 4, 3, 2, 1], [2, 3, 4, 5, 5, 4, 3, 2], [1, 2, 3, 4, 4, 3, 2, 1], [0, 1, 2, 3, 3, 2, 1, 0]]\n assert candidate(mat = [[1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1]]) == [[1, 0, 1, 2, 3, 4], [2, 1, 1, 2, 3, 4], [2, 1, 0, 1, 2, 3], [3, 2, 1, 2, 1, 2], [4, 3, 2, 1, 0, 1]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == [[2, 1, 1, 1, 1, 1, 2], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [2, 1, 1, 1, 1, 1, 2]]\n assert candidate(mat = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0]]) == [[2, 1, 2, 3, 4, 5, 6, 7], [1, 0, 1, 2, 3, 4, 5, 6], [2, 1, 2, 3, 2, 3, 4, 5], [3, 2, 3, 2, 1, 2, 3, 4], [4, 3, 2, 1, 0, 1, 2, 3], [5, 4, 3, 2, 1, 2, 3, 2], [6, 5, 4, 3, 2, 3, 2, 1], [7, 6, 5, 4, 3, 2, 1, 0]]\n assert candidate(mat = [[0, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 0, 0, 0]]) == [[0, 1, 2, 3, 4, 5, 6, 5], [1, 2, 3, 4, 5, 6, 5, 4], [2, 3, 4, 5, 6, 5, 4, 3], [3, 4, 5, 6, 5, 4, 3, 2], [4, 5, 6, 5, 4, 3, 2, 1], [5, 6, 5, 4, 3, 2, 1, 0], [6, 5, 4, 3, 2, 1, 0, 0], [5, 4, 3, 2, 1, 0, 0, 0]]\n assert candidate(mat = [[1, 1, 1, 1], [1, 0, 1, 1], [1, 1, 0, 1], [1, 1, 1, 0]]) == [[2, 1, 2, 3], [1, 0, 1, 2], [2, 1, 0, 1], [3, 2, 1, 0]]\n assert candidate(mat = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0]]) == [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0]]\n assert candidate(mat = [[0, 0, 0, 1, 1, 1], [0, 0, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 0]]) == [[0, 0, 0, 1, 2, 3], [0, 0, 1, 2, 3, 3], [0, 1, 2, 3, 3, 2], [1, 2, 3, 3, 2, 1], [2, 3, 3, 2, 1, 0], [3, 3, 2, 1, 0, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0, 1]]) == [[2, 1, 2, 3, 4, 5, 6, 7, 8], [1, 0, 1, 2, 3, 4, 5, 6, 7], [2, 1, 2, 3, 2, 3, 4, 5, 6], [3, 2, 3, 2, 1, 2, 3, 4, 5], [4, 3, 2, 1, 0, 1, 2, 3, 4], [5, 4, 3, 2, 1, 2, 3, 2, 3], [6, 5, 4, 3, 2, 3, 2, 1, 2], [7, 6, 5, 4, 3, 2, 1, 0, 1]]\n assert candidate(mat = [[0, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 0]]) == [[0, 1, 2, 3, 4], [1, 2, 3, 4, 3], [2, 3, 4, 3, 2], [3, 4, 3, 2, 1], [4, 3, 2, 1, 0]]\n assert candidate(mat = [[0, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 0]]) == [[0, 1, 2, 3, 4, 5, 4], [1, 2, 3, 4, 5, 4, 3], [2, 3, 4, 5, 4, 3, 2], [3, 4, 5, 4, 3, 2, 1], [4, 5, 4, 3, 2, 1, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 1, 1, 0, 1], [1, 0, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 0, 1]]) == [[2, 1, 1, 2, 2, 1, 2], [1, 0, 0, 1, 1, 0, 1], [1, 0, 1, 1, 0, 1, 2], [2, 1, 2, 2, 1, 2, 1], [1, 0, 1, 1, 0, 1, 0], [2, 1, 1, 2, 1, 1, 1], [2, 1, 0, 1, 1, 0, 1]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == [[2, 1, 2, 1, 2, 1, 2], [1, 0, 1, 0, 1, 0, 1], [2, 1, 2, 1, 2, 1, 2], [1, 0, 1, 0, 1, 0, 1], [2, 1, 2, 1, 2, 1, 2]]\n assert candidate(mat = [[0, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 1], [1, 0, 1, 0]]) == [[0, 1, 1, 0], [1, 2, 2, 1], [2, 1, 2, 1], [1, 0, 1, 0]]\n assert candidate(mat = [[0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == [[0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]\n assert candidate(mat = [[0, 0, 1, 0, 1], [0, 1, 1, 0, 1], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 0, 0]]) == [[0, 0, 1, 0, 1], [0, 1, 1, 0, 1], [1, 1, 2, 1, 2], [1, 0, 1, 0, 1], [2, 1, 1, 0, 0]]\n assert candidate(mat = [[1, 1, 0, 1, 1], [1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [1, 1, 0, 1, 1], [1, 1, 1, 1, 1]]) == [[2, 1, 0, 1, 2], [2, 1, 0, 1, 2], [1, 0, 0, 0, 1], [2, 1, 0, 1, 2], [3, 2, 1, 2, 3]]\n assert candidate(mat = [[0, 0, 1, 1, 1], [0, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 0], [1, 1, 1, 0, 0]]) == [[0, 0, 1, 2, 3], [0, 1, 2, 3, 2], [1, 2, 3, 2, 1], [2, 3, 2, 1, 0], [3, 2, 1, 0, 0]]\n assert candidate(mat = [[0, 0, 0, 1, 1, 1], [0, 0, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 0], [1, 1, 1, 0, 0, 0]]) == [[0, 0, 0, 1, 2, 3], [0, 0, 1, 2, 3, 2], [0, 1, 2, 3, 2, 1], [1, 2, 3, 2, 1, 0], [2, 3, 2, 1, 0, 0], [3, 2, 1, 0, 0, 0]]\n assert candidate(mat = [[0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == [[0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 2], [0, 1, 2, 2, 2, 3], [0, 1, 2, 3, 3, 4], [0, 1, 2, 3, 4, 5], [1, 2, 3, 4, 5, 6]]\n assert candidate(mat = [[0, 0, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 0]]) == [[0, 0, 1, 2, 3, 4], [0, 1, 2, 3, 4, 3], [1, 2, 3, 4, 3, 2], [2, 3, 4, 3, 2, 1], [3, 4, 3, 2, 1, 0], [4, 3, 2, 1, 0, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0]]) == [[6, 5, 4, 3, 4, 5, 6, 6], [5, 4, 3, 2, 3, 4, 5, 5], [4, 3, 2, 1, 2, 3, 4, 4], [3, 2, 1, 0, 1, 2, 3, 3], [4, 3, 2, 1, 2, 3, 3, 2], [5, 4, 3, 2, 3, 3, 2, 1], [6, 5, 4, 3, 3, 2, 1, 0]]\n assert candidate(mat = [[0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1]]) == [[0, 1, 0, 1, 0, 1], [1, 2, 1, 2, 1, 2], [0, 1, 0, 1, 0, 1], [1, 2, 1, 2, 1, 2], [0, 1, 0, 1, 0, 1]]\n assert candidate(mat = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 0]]) == [[4, 3, 2, 3, 4], [3, 2, 1, 2, 3], [2, 1, 0, 1, 2], [3, 2, 1, 2, 1], [4, 3, 2, 1, 0]]\n assert candidate(mat = [[0, 1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1, 0]]) == [[0, 1, 2, 3, 2, 1, 0], [1, 2, 3, 4, 3, 2, 1], [2, 3, 4, 5, 4, 3, 2], [1, 2, 3, 4, 3, 2, 1], [0, 1, 2, 3, 2, 1, 0]]\n assert candidate(mat = [[1, 0, 1, 1, 0, 0, 1], [0, 1, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 0]]) == [[1, 0, 1, 1, 0, 0, 1], [0, 1, 2, 1, 0, 1, 2], [1, 2, 1, 2, 1, 2, 3], [2, 1, 0, 1, 2, 1, 2], [1, 0, 1, 0, 1, 0, 1], [2, 1, 2, 1, 2, 1, 0]]\n assert candidate(mat = [[0, 0, 1, 1, 1], [0, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 0]]) == [[0, 0, 1, 2, 3], [0, 1, 2, 3, 3], [1, 2, 3, 3, 2], [2, 3, 3, 2, 1], [3, 3, 2, 1, 0]]\n assert candidate(mat = [[0, 1, 0, 1, 0], [1, 1, 1, 1, 1], [0, 1, 0, 1, 0], [1, 1, 1, 1, 1], [0, 1, 0, 1, 0]]) == [[0, 1, 0, 1, 0], [1, 2, 1, 2, 1], [0, 1, 0, 1, 0], [1, 2, 1, 2, 1], [0, 1, 0, 1, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]) == [[2, 1, 2, 1, 2], [1, 0, 1, 0, 1], [2, 1, 2, 1, 2], [1, 0, 1, 0, 1], [2, 1, 2, 1, 2]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == [[5, 4, 3, 2, 1, 0], [6, 5, 4, 3, 2, 1], [7, 6, 5, 4, 3, 2], [8, 7, 6, 5, 4, 3], [9, 8, 7, 6, 5, 4]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0]]) == [[11, 10, 9, 8, 7, 7, 7, 7, 7, 7], [10, 9, 8, 7, 6, 6, 6, 6, 6, 6], [9, 8, 7, 6, 5, 5, 5, 5, 5, 5], [8, 7, 6, 5, 4, 4, 4, 4, 4, 4], [7, 6, 5, 4, 3, 3, 3, 3, 3, 3], [6, 5, 4, 3, 2, 2, 2, 2, 2, 2], [5, 4, 3, 2, 1, 1, 1, 1, 1, 1], [4, 3, 2, 1, 0, 0, 0, 0, 0, 0], [4, 3, 2, 1, 0, 0, 0, 0, 0, 0], [4, 3, 2, 1, 0, 0, 0, 0, 0, 0]]\n assert candidate(mat = [[0, 0, 0, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 0]]) == [[0, 0, 0, 1, 2], [1, 1, 1, 2, 3], [2, 2, 2, 3, 2], [3, 3, 3, 2, 1], [4, 3, 2, 1, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == [[2, 1, 1, 1, 2], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [2, 1, 1, 1, 2]]\n assert candidate(mat = [[0, 0, 0, 1, 1, 0, 1, 1, 1, 1], [0, 1, 0, 1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 1, 1, 0, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 0, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == [[0, 0, 0, 1, 1, 0, 1, 2, 3, 4], [0, 1, 0, 1, 1, 0, 1, 2, 3, 4], [1, 0, 0, 1, 1, 0, 1, 2, 2, 3], [2, 1, 1, 0, 0, 0, 1, 1, 1, 2], [3, 2, 2, 1, 1, 1, 0, 0, 0, 1], [4, 3, 3, 2, 2, 1, 0, 0, 1, 2], [5, 4, 4, 3, 3, 2, 1, 1, 2, 3], [6, 5, 5, 4, 4, 3, 2, 2, 3, 4]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 0]]) == [[6, 5, 4, 3, 4, 5, 6], [5, 4, 3, 2, 3, 4, 5], [4, 3, 2, 1, 2, 3, 4], [3, 2, 1, 0, 1, 2, 3], [4, 3, 2, 1, 2, 3, 2], [5, 4, 3, 2, 3, 2, 1], [6, 5, 4, 3, 2, 1, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0]]) == [[5, 4, 3, 2, 3, 4], [4, 3, 2, 1, 2, 3], [3, 2, 1, 0, 1, 2], [4, 3, 2, 1, 2, 2], [5, 4, 3, 2, 2, 1], [5, 4, 3, 2, 1, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 0, 0]]) == [[13, 12, 11, 10, 9, 8, 7, 7], [12, 11, 10, 9, 8, 7, 6, 6], [11, 10, 9, 8, 7, 6, 5, 5], [10, 9, 8, 7, 6, 5, 4, 4], [9, 8, 7, 6, 5, 4, 3, 3], [8, 7, 6, 5, 4, 3, 2, 2], [7, 6, 5, 4, 3, 2, 1, 1], [6, 5, 4, 3, 2, 1, 0, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 0], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0]]) == [[4, 3, 2, 1, 0], [3, 4, 3, 2, 1], [2, 3, 4, 3, 2], [1, 2, 3, 2, 1], [0, 1, 2, 1, 0]]\n assert candidate(mat = [[0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0]]) == [[0, 1, 2, 3, 4, 5], [1, 2, 3, 4, 5, 4], [2, 3, 4, 5, 4, 3], [3, 4, 5, 4, 3, 2], [4, 5, 4, 3, 2, 1], [5, 4, 3, 2, 1, 0]]\n assert candidate(mat = [[0, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 0]]) == [[0, 1, 2, 2, 1, 0], [1, 2, 3, 3, 2, 1], [2, 3, 4, 4, 3, 2], [1, 2, 3, 3, 2, 1], [0, 1, 2, 2, 1, 0]]\n assert candidate(mat = [[0, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 0], [1, 1, 1, 0, 1]]) == [[0, 1, 2, 3, 3], [1, 2, 3, 3, 2], [2, 3, 3, 2, 1], [3, 3, 2, 1, 0], [3, 2, 1, 0, 1]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 1, 0, 0, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == [[7, 6, 5, 4, 4, 4, 5, 6, 7], [6, 5, 4, 3, 3, 3, 4, 5, 6], [5, 4, 3, 2, 2, 2, 3, 4, 5], [4, 3, 2, 1, 1, 1, 2, 3, 4], [3, 2, 1, 0, 0, 0, 1, 2, 3], [2, 1, 0, 0, 0, 0, 0, 1, 2], [1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]\n assert candidate(mat = [[0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 0, 0]]) == [[0, 0, 0, 0, 1, 2, 3, 4], [0, 0, 0, 1, 2, 3, 4, 5], [0, 0, 1, 2, 3, 4, 5, 5], [0, 1, 2, 3, 4, 5, 4, 4], [1, 2, 3, 4, 5, 4, 3, 3], [2, 3, 4, 5, 4, 3, 2, 2], [3, 4, 5, 4, 3, 2, 1, 1], [4, 5, 4, 3, 2, 1, 0, 0]]\n assert candidate(mat = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0]]) == [[4, 3, 2, 3, 4, 5], [3, 2, 1, 2, 3, 4], [2, 1, 0, 1, 2, 3], [3, 2, 1, 2, 3, 2], [4, 3, 2, 3, 2, 1], [5, 4, 3, 2, 1, 0]]\n"}, "metadata": {"canonical_parameter_names": ["mat"], "leetcode_dataset_entry_point": "Solution().updateMatrix", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var updateMatrix = function(mat) {", "container": null, "callable": "updateMatrix", "parameters": [{"name": "mat", "type": "number[][]"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 543, "task_id": "diameter-of-binary-tree", "difficulty": "Easy", "problem_description": "Given the root of a binary tree, return the length of the diameter of the tree.\nThe diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root.\nThe length of a path between two nodes is represented by the number of edges between them.\n \nExample 1:\n\n\nInput: root = [1,2,3,4,5]\nOutput: 3\nExplanation: 3 is the length of the path [4,2,1,3] or [5,2,1,3].\n\nExample 2:\n\nInput: root = [1,2]\nOutput: 1\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 104].\n-100 <= Node.val <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7])) == 4\n assert candidate(root = tree_node([4, -7, -3, None, None, -9, -3, 9, -7, -4, None, 6, None, -6, -6, None, None, 0, 6, 5, None, 9, None, None, -1, -4, None, None, None, -2])) == 8\n assert candidate(root = tree_node([1, 2, 3, 4, 5])) == 3\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5])) == 4\n assert candidate(root = tree_node([3, 1, 4, None, 2])) == 3\n assert candidate(root = tree_node([1, 2, 3])) == 2\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5])) == 4\n assert candidate(root = tree_node([1, 2, None, 4, 5])) == 2\n assert candidate(root = tree_node([1, 2])) == 1\n assert candidate(root = tree_node([4, -7, -3, None, None, -9, -3, 9, -4, None, 6, None, -6, -6, None, None, 0, 6, 5, None, 9, None, None, -1, -4, None, None, None, -2])) == 8\n assert candidate(root = tree_node([4, 2, None, 3, None, 1])) == 3\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5])) == 3\n assert candidate(root = tree_node([3, 1, 2])) == 2\n assert candidate(root = tree_node([1])) == 0\n assert candidate(root = tree_node([1, None, 2, None, 3])) == 2\n assert candidate(root = tree_node([1, None, 2, None, None, 3, None, None, 4, None, None, 5])) == 1\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == 9\n assert candidate(root = tree_node([1, None, 2, 3, None, None, 4, 5, None, None, 6, None, 7, None, 8])) == 7\n assert candidate(root = tree_node([1, None, 2, 3, None, None, 4, 5, None, None, None, None, None, None, 6])) == 4\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == 8\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, 6, None, None, 7])) == 6\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 8, None, 9, None, 10, None, 11])) == 6\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, 10, 11, 12, 13, 14, 15, None, None, None, None, 16])) == 8\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 14\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, None, None, 8, 9, None, None, None, None, 10])) == 6\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == 8\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, 6, 7, None, None, 8, 9])) == 6\n assert candidate(root = tree_node([1, None, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == 8\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8])) == 7\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])) == 8\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11])) == 10\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8])) == 6\n assert candidate(root = tree_node([1, 2, 3, None, None, None, 4, None, None, None, None, None, 5, None, None, None, None, 6])) == 3\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, 6, None, None, 7, None, None, 8])) == 6\n assert candidate(root = tree_node([1, None, 2, None, None, None, 3, None, None, None, None, 4, None, None, None, None, 5])) == 1\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == 8\n assert candidate(root = tree_node([1, 2, None, 4, None, 6, 7, 8, 9])) == 4\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, None, None, 6, 7, None, None, 8, None, None, 9])) == 4\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, None, 10, 11, None, None, 12, 13])) == 7\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, 7, 8, None, None, 9, None, None, 10, 11])) == 7\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9, None, None, None, None, 10, 11])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, 6, None, 7, None, 8, None, 9])) == 8\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == 8\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == 7\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == 6\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 8, None, None, None, 9, None, None, None, None, 10, None, None, None, None, 11])) == 7\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, 11, None, None, 12, None, None, 13, None, None, 14])) == 8\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5, 6])) == 4\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5])) == 4\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, None, None, 10, 11])) == 6\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, None, None, None, None, 7, None, None, 8, None, None, None, None, None, None, 9, None, None, 10])) == 6\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11])) == 6\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, None, 6, 7, None, 8, None, None, 9])) == 8\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5, None, None, 6])) == 5\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, 6, 7, 8, 9, 10, None, None, 11, 12])) == 7\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == 8\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, 6, None, None, 7, None, 8])) == 7\n assert candidate(root = tree_node([1, 2, 3, None, None, None, None, None, None, None, 4, None, None, None, None, 5])) == 2\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, None, None, 5, None, 6, None, None, 7, None, None, 8, None, 9])) == 5\n assert candidate(root = tree_node([1, 2, None, None, 3, None, None, None, 4, None, None, None, None, 5, None, None, None, None, None, 6])) == 2\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 14\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, None, None, 9, None, None, 10, None, None, 11, None, None, 12, None, None, 13])) == 10\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, 9, None, 10, None, 11, None, 12])) == 7\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, None, None, 12, 13])) == 7\n assert candidate(root = tree_node([1, 2, None, None, 3, None, None, 4, None, None, 5, None, None, 6, None, None, 7])) == 2\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7])) == 6\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 14\n assert candidate(root = tree_node([1, 2, None, 3, 4, None, None, 5, 6, None, None, 7, 8, None, None, 9, 10])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 7\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, None, None, 7, 8, None, None, None, None, 9])) == 6\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, 6, 7, None, None, None, None, 8, 9])) == 5\n assert candidate(root = tree_node([1, 2, None, None, 3, None, None, 4, None, None, 5, None, None, 6, None, None, 7, None, None, 8, None, None, 9, None, None, 10])) == 2\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, 6, 7])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9, None, None, None, 10, None, None, 11, None, None, 12])) == 7\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6])) == 5\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == 8\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, 8, None, None, None, 9, 10, 11])) == 7\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == 8\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, 6, 7, 8, 9, None, None, 10])) == 7\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == 7\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == 9\n assert candidate(root = tree_node([1, 2, None, 3, 4, 5, None, None, 6, 7, None, None, 8, 9])) == 7\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12])) == 11\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, None, None, None, None, None, 12, 13])) == 8\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, None, 6, 7])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9, 10, 11, 12, 13])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, None, None, 10, 11, 12])) == 6\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13])) == 11\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, 10, 11, 12, 13, 14, 15])) == 7\n assert candidate(root = tree_node([1, None, 2, 3, None, 4, None, 5, None, 6, None, 7])) == 6\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().diameterOfBinaryTree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var diameterOfBinaryTree = function(root) {", "container": null, "callable": "diameterOfBinaryTree", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 546, "task_id": "remove-boxes", "difficulty": "Hard", "problem_description": "You are given several boxes with different colors represented by different positive numbers.\nYou may experience several rounds to remove boxes until there is no box left. Each time you can choose some continuous boxes with the same color (i.e., composed of k boxes, k >= 1), remove them and get k * k points.\nReturn the maximum points you can get.\n \nExample 1:\n\nInput: boxes = [1,3,2,2,2,3,4,3,1]\nOutput: 23\nExplanation:\n[1, 3, 2, 2, 2, 3, 4, 3, 1] \n----> [1, 3, 3, 4, 3, 1] (3*3=9 points) \n----> [1, 3, 3, 3, 1] (1*1=1 points) \n----> [1, 1] (3*3=9 points) \n----> [] (2*2=4 points)\n\nExample 2:\n\nInput: boxes = [1,1,1]\nOutput: 9\n\nExample 3:\n\nInput: boxes = [1]\nOutput: 1\n\n \nConstraints:\n\n1 <= boxes.length <= 100\n1 <= boxes[i] <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(boxes = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == 54\n assert candidate(boxes = [1, 1, 2, 2, 1, 1]) == 20\n assert candidate(boxes = [1, 2, 2, 1, 3, 3, 3, 4, 4, 4, 4, 5]) == 34\n assert candidate(boxes = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4]) == 36\n assert candidate(boxes = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 30\n assert candidate(boxes = [1, 2, 3, 2, 1, 2, 3, 2, 1]) == 23\n assert candidate(boxes = [1, 2, 3, 4, 5]) == 5\n assert candidate(boxes = [1, 1, 2, 3, 2, 2, 3, 3, 3]) == 25\n assert candidate(boxes = [1, 2, 3, 4, 5, 5, 4, 3, 2, 1]) == 20\n assert candidate(boxes = [2, 1, 2, 1, 2]) == 11\n assert candidate(boxes = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 30\n assert candidate(boxes = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 100\n assert candidate(boxes = [1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 42\n assert candidate(boxes = [1, 1, 1]) == 9\n assert candidate(boxes = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 20\n assert candidate(boxes = [5, 5, 5, 5, 1, 1, 1, 2, 2, 3, 3, 3, 3]) == 45\n assert candidate(boxes = [5, 5, 5, 5, 5]) == 25\n assert candidate(boxes = [100, 100, 100, 99, 99, 98, 98, 98, 98]) == 29\n assert candidate(boxes = [1, 2, 2, 1, 2, 2, 1]) == 21\n assert candidate(boxes = [1]) == 1\n assert candidate(boxes = [2, 2, 2, 3, 3, 3, 4, 4, 4]) == 27\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(boxes = [10, 10, 10, 1, 1, 1, 10, 10, 10]) == 45\n assert candidate(boxes = [1, 3, 2, 2, 2, 3, 4, 3, 1]) == 23\n assert candidate(boxes = [10, 20, 30, 40, 50, 40, 30, 20, 10]) == 17\n assert candidate(boxes = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 100\n assert candidate(boxes = [9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7]) == 43\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 1, 2, 2, 2, 3, 3, 3]) == 80\n assert candidate(boxes = [5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 2, 2, 1, 1, 1]) == 74\n assert candidate(boxes = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 32\n assert candidate(boxes = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 1, 1, 1, 2, 2, 2, 3, 3]) == 76\n assert candidate(boxes = [1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8]) == 168\n assert candidate(boxes = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2]) == 62\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 40\n assert candidate(boxes = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4]) == 64\n assert candidate(boxes = [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]) == 40\n assert candidate(boxes = [27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31]) == 95\n assert candidate(boxes = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 39\n assert candidate(boxes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 3249\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 51\n assert candidate(boxes = [9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12]) == 106\n assert candidate(boxes = [1, 2, 2, 1, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8]) == 64\n assert candidate(boxes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 400\n assert candidate(boxes = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 256\n assert candidate(boxes = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7]) == 63\n assert candidate(boxes = [5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8]) == 135\n assert candidate(boxes = [1, 2, 3, 2, 1, 4, 5, 4, 3, 2, 1, 6, 7, 6, 5, 4, 3, 2, 1, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 76\n assert candidate(boxes = [1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3]) == 110\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 43\n assert candidate(boxes = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 40\n assert candidate(boxes = [1, 2, 2, 3, 3, 3, 2, 2, 1, 1, 1, 4, 4, 4, 4]) == 57\n assert candidate(boxes = [1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1]) == 131\n assert candidate(boxes = [1, 2, 3, 2, 1, 3, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 2, 1]) == 66\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 36\n assert candidate(boxes = [10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == 40\n assert candidate(boxes = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 37\n assert candidate(boxes = [1, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1]) == 49\n assert candidate(boxes = [1, 2, 3, 4, 5, 5, 5, 4, 3, 2, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4]) == 78\n assert candidate(boxes = [2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8]) == 77\n assert candidate(boxes = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9]) == 144\n assert candidate(boxes = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 92\n assert candidate(boxes = [9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 1]) == 57\n assert candidate(boxes = [9, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15]) == 92\n assert candidate(boxes = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6]) == 125\n assert candidate(boxes = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 324\n assert candidate(boxes = [1, 2, 2, 1, 3, 3, 3, 2, 2, 1, 4, 4, 4, 4, 1, 5, 5, 5, 5, 5, 1, 6, 6, 6, 6, 6, 6, 1]) == 130\n assert candidate(boxes = [13, 13, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17]) == 90\n assert candidate(boxes = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5]) == 83\n assert candidate(boxes = [5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2]) == 75\n assert candidate(boxes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 625\n assert candidate(boxes = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 36\n assert candidate(boxes = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 1, 1]) == 48\n assert candidate(boxes = [18, 19, 20, 21, 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26]) == 62\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 37\n assert candidate(boxes = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4]) == 99\n assert candidate(boxes = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6]) == 96\n assert candidate(boxes = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2]) == 110\n assert candidate(boxes = [1, 2, 1, 3, 2, 1, 4, 3, 2, 1, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2]) == 40\n assert candidate(boxes = [16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19]) == 142\n assert candidate(boxes = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 85\n assert candidate(boxes = [1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4]) == 87\n assert candidate(boxes = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 110\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 1, 2, 2]) == 51\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3]) == 27\n assert candidate(boxes = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1]) == 275\n assert candidate(boxes = [9, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 9, 9]) == 57\n assert candidate(boxes = [1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1]) == 45\n assert candidate(boxes = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10]) == 250\n assert candidate(boxes = [1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == 84\n assert candidate(boxes = [4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1]) == 59\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 20\n assert candidate(boxes = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 55\n assert candidate(boxes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1024\n assert candidate(boxes = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 400\n assert candidate(boxes = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 48\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2]) == 44\n assert candidate(boxes = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 200\n assert candidate(boxes = [20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23]) == 151\n assert candidate(boxes = [9, 9, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 5, 5, 5]) == 63\n assert candidate(boxes = [24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26]) == 243\n assert candidate(boxes = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 40\n assert candidate(boxes = [1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8]) == 142\n assert candidate(boxes = [1, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2]) == 62\n assert candidate(boxes = [1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4]) == 74\n assert candidate(boxes = [1, 2, 2, 3, 3, 3, 2, 2, 2, 3, 3, 3, 2, 2, 2, 3, 3, 3]) == 104\n assert candidate(boxes = [1, 1, 2, 2, 3, 3, 4, 4, 1, 1, 2, 2, 3, 3, 4, 4, 1, 1, 2, 2]) == 64\n assert candidate(boxes = [1, 1, 2, 3, 2, 1, 1, 1, 1, 1, 2, 3, 2, 1, 1, 1, 1, 1, 2, 3]) == 156\n assert candidate(boxes = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9]) == 189\n assert candidate(boxes = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(boxes = [1, 1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 54\n assert candidate(boxes = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5]) == 80\n assert candidate(boxes = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1]) == 41\n assert candidate(boxes = [1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1]) == 155\n assert candidate(boxes = [1, 2, 2, 1, 2, 3, 3, 2, 3, 4, 4, 3, 4, 5, 5, 4, 5]) == 45\n assert candidate(boxes = [1, 2, 2, 2, 3, 3, 3, 2, 2, 1, 1, 1, 1]) == 59\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(boxes = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1]) == 57\n assert candidate(boxes = [5, 5, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1]) == 61\n assert candidate(boxes = [1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == 84\n assert candidate(boxes = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9]) == 324\n assert candidate(boxes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 22\n assert candidate(boxes = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 37\n"}, "metadata": {"canonical_parameter_names": ["boxes"], "leetcode_dataset_entry_point": "Solution().removeBoxes", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var removeBoxes = function(boxes) {", "container": null, "callable": "removeBoxes", "parameters": [{"name": "boxes", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 547, "task_id": "number-of-provinces", "difficulty": "Medium", "problem_description": "There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected directly with city c, then city a is connected indirectly with city c.\nA province is a group of directly or indirectly connected cities and no other cities outside of the group.\nYou are given an n x n matrix isConnected where isConnected[i][j] = 1 if the ith city and the jth city are directly connected, and isConnected[i][j] = 0 otherwise.\nReturn the total number of provinces.\n \nExample 1:\n\n\nInput: isConnected = [[1,1,0],[1,1,0],[0,0,1]]\nOutput: 2\n\nExample 2:\n\n\nInput: isConnected = [[1,0,0],[0,1,0],[0,0,1]]\nOutput: 3\n\n \nConstraints:\n\n1 <= n <= 200\nn == isConnected.length\nn == isConnected[i].length\nisConnected[i][j] is 1 or 0.\nisConnected[i][i] == 1\nisConnected[i][j] == isConnected[j][i]\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(isConnected = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 1], [1, 0, 1, 1]]) == 1\n assert candidate(isConnected = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 1, 0], [1, 1, 0], [0, 0, 1]]) == 2\n assert candidate(isConnected = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) == 4\n assert candidate(isConnected = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == 1\n assert candidate(isConnected = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == 2\n assert candidate(isConnected = [[1, 0, 1, 0], [0, 1, 0, 0], [1, 0, 1, 0], [0, 0, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 1, 1, 1, 1, 1], [1, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0], [1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1]]) == 1\n assert candidate(isConnected = [[1, 0, 1, 0, 0], [0, 1, 1, 0, 0], [1, 1, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 1, 1, 0, 0, 0], [1, 1, 0, 1, 0, 0], [1, 0, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 1, 1, 0, 0], [1, 1, 0, 0, 0], [1, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]]) == 3\n assert candidate(isConnected = [[1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 1, 0, 0], [1, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 1, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1]]) == 2\n assert candidate(isConnected = [[1, 0, 0, 1, 0], [0, 1, 1, 0, 1], [0, 1, 1, 0, 0], [1, 0, 0, 1, 0], [0, 1, 0, 0, 1]]) == 2\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1]]) == 4\n assert candidate(isConnected = [[1, 0, 0, 0, 0], [0, 1, 0, 1, 1], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [0, 1, 0, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) == 5\n assert candidate(isConnected = [[1, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1]]) == 2\n assert candidate(isConnected = [[1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1, 1, 0], [0, 0, 1, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]]) == 1\n assert candidate(isConnected = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 2\n assert candidate(isConnected = [[1, 1, 0, 1, 0, 0], [1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1], [1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0], [0, 0, 1, 0, 0, 1]]) == 2\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1]]) == 4\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1]]) == 1\n assert candidate(isConnected = [[1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0], [1, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 1, 0, 0, 0], [1, 1, 1, 0, 0], [0, 1, 1, 1, 0], [0, 0, 1, 1, 0], [0, 0, 0, 0, 1]]) == 2\n assert candidate(isConnected = [[1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0], [1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1]]) == 4\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]]) == 6\n assert candidate(isConnected = [[1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1]]) == 3\n assert candidate(isConnected = [[1, 0, 0, 1, 0, 0], [0, 1, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0], [1, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 1, 0, 0, 0], [1, 1, 1, 0, 0], [0, 1, 1, 1, 0], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1]]) == 1\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]]) == 4\n assert candidate(isConnected = [[1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]]) == 4\n assert candidate(isConnected = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 1, 0, 0, 0], [1, 1, 1, 0, 0], [0, 1, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0], [0, 1, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 1], [0, 0, 0, 1, 1, 1]]) == 2\n assert candidate(isConnected = [[1, 1, 0, 1, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 1, 0, 1, 0], [1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [1, 0, 1, 1, 0], [0, 1, 0, 0, 1]]) == 1\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 1, 0, 1], [1, 1, 0, 0], [0, 0, 1, 1], [1, 0, 1, 1]]) == 1\n assert candidate(isConnected = [[1, 1, 1, 0, 0], [1, 1, 0, 0, 0], [1, 0, 1, 1, 0], [0, 0, 1, 1, 0], [0, 0, 0, 0, 1]]) == 2\n assert candidate(isConnected = [[1, 1, 1, 0, 0], [1, 1, 0, 1, 0], [1, 0, 1, 0, 0], [0, 1, 0, 1, 1], [0, 0, 0, 1, 1]]) == 1\n assert candidate(isConnected = [[1, 1, 0, 0, 1], [1, 1, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 1, 1, 0], [1, 0, 0, 0, 1]]) == 2\n assert candidate(isConnected = [[1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 1, 0, 1, 1], [0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 1, 1, 1, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]]) == 1\n assert candidate(isConnected = [[1, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 1, 0, 0], [0, 0, 1, 1, 0, 1, 0], [0, 0, 1, 1, 0, 1, 0], [1, 1, 0, 0, 1, 0, 0], [0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1]]) == 3\n"}, "metadata": {"canonical_parameter_names": ["isConnected"], "leetcode_dataset_entry_point": "Solution().findCircleNum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findCircleNum = function(isConnected) {", "container": null, "callable": "findCircleNum", "parameters": [{"name": "isConnected", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 551, "task_id": "student-attendance-record-i", "difficulty": "Easy", "problem_description": "You are given a string s representing an attendance record for a student where each character signifies whether the student was absent, late, or present on that day. The record only contains the following three characters:\n\n'A': Absent.\n'L': Late.\n'P': Present.\n\nThe student is eligible for an attendance award if they meet both of the following criteria:\n\nThe student was absent ('A') for strictly fewer than 2 days total.\nThe student was never late ('L') for 3 or more consecutive days.\n\nReturn true if the student is eligible for an attendance award, or false otherwise.\n \nExample 1:\n\nInput: s = \"PPALLP\"\nOutput: true\nExplanation: The student has fewer than 2 absences and was never late 3 or more consecutive days.\n\nExample 2:\n\nInput: s = \"PPALLL\"\nOutput: false\nExplanation: The student was late 3 consecutive days in the last 3 days, so is not eligible for the award.\n\n \nConstraints:\n\n1 <= s.length <= 1000\ns[i] is either 'A', 'L', or 'P'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"AALL\") == False\n assert candidate(s = \"LLA\") == True\n assert candidate(s = \"PPALLPLL\") == True\n assert candidate(s = \"PLPLPL\") == True\n assert candidate(s = \"PA\") == True\n assert candidate(s = \"LLLLL\") == False\n assert candidate(s = \"LPPALLP\") == True\n assert candidate(s = \"PPALLP\") == True\n assert candidate(s = \"PPALLL\") == False\n assert candidate(s = \"ALPALP\") == False\n assert candidate(s = \"LLLP\") == False\n assert candidate(s = \"ALP\") == True\n assert candidate(s = \"AA\") == False\n assert candidate(s = \"PLLPLL\") == True\n assert candidate(s = \"PPPLLL\") == False\n assert candidate(s = \"LLL\") == False\n assert candidate(s = \"ALLL\") == False\n assert candidate(s = \"AAA\") == False\n assert candidate(s = \"A\") == True\n assert candidate(s = \"PPPPPPP\") == True\n assert candidate(s = \"LL\") == True\n assert candidate(s = \"ALPLL\") == True\n assert candidate(s = \"PPPPPP\") == True\n assert candidate(s = \"AALLPPP\") == False\n assert candidate(s = \"AALPLL\") == False\n assert candidate(s = \"PL\") == True\n assert candidate(s = \"PLLPLP\") == True\n assert candidate(s = \"PPALLAP\") == False\n assert candidate(s = \"ALLAPL\") == False\n assert candidate(s = \"PPALLAPA\") == False\n assert candidate(s = \"PPA\") == True\n assert candidate(s = \"AAAA\") == False\n assert candidate(s = \"AP\") == True\n assert candidate(s = \"APLLAA\") == False\n assert candidate(s = \"L\") == True\n assert candidate(s = \"PPLLP\") == True\n assert candidate(s = \"PPAALP\") == False\n assert candidate(s = \"P\") == True\n assert candidate(s = \"PPPP\") == True\n assert candidate(s = \"APLPALPPAL\") == False\n assert candidate(s = \"PPALLAPLPP\") == False\n assert candidate(s = \"AAPAAPA\") == False\n assert candidate(s = \"PPPPLLLPPP\") == False\n assert candidate(s = \"APLLPPPPPPPLL\") == True\n assert candidate(s = \"ALLPPAAPLPLP\") == False\n assert candidate(s = \"PLLLPLPLLPLLPPP\") == False\n assert candidate(s = \"APLPLPALPLPALPPPP\") == False\n assert candidate(s = \"AALLPPAPLALLPP\") == False\n assert candidate(s = \"APLLLLP\") == False\n assert candidate(s = \"APLPLPALPLPALPP\") == False\n assert candidate(s = \"LLLLPPPAPPLPPP\") == False\n assert candidate(s = \"ALALALAL\") == False\n assert candidate(s = \"APALLPAPL\") == False\n assert candidate(s = \"PPPPPPPPPPPP\") == True\n assert candidate(s = \"AAPALLPPALL\") == False\n assert candidate(s = \"PPPLLLLPP\") == False\n assert candidate(s = \"ALPPALP\") == False\n assert candidate(s = \"PPLPPPLLPPA\") == True\n assert candidate(s = \"PLLPLLPLLPLLPLLPLLPLL\") == True\n assert candidate(s = \"ALPLLPLLPLLPLLPLLPLLPLLPLL\") == True\n assert candidate(s = \"LPLPLPLPLPLPLP\") == True\n assert candidate(s = \"PPLPPPLPPLLPPP\") == True\n assert candidate(s = \"LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLP\") == False\n assert candidate(s = \"AALPLPLLPLL\") == False\n assert candidate(s = \"PLPPPLPPPL\") == True\n assert candidate(s = \"PPLPPLPLL\") == True\n assert candidate(s = \"PPPPPPLPPPP\") == True\n assert candidate(s = \"PPALLPALPPALLP\") == False\n assert candidate(s = \"LPLLPLLPLLPLLPLLPLLPLLPLL\") == True\n assert candidate(s = \"PPLPPPLPPPLPPPLPPPLPPPLPPPLPPPLPPPLPPPLPPPLPPPLPPPLPPPLPPP\") == True\n assert candidate(s = \"PLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLLPLP\") == True\n assert candidate(s = \"PPALPPALPP\") == False\n assert candidate(s = \"PLPLPLPLPLPL\") == True\n assert candidate(s = \"PLAPLLPLPAL\") == False\n assert candidate(s = \"LLPALPALPALP\") == False\n assert candidate(s = \"LLLLLPLPPPPP\") == False\n assert candidate(s = \"AAPAPAPAPAPAPAPAPAPAPAPAPAPAPAPAPAPA\") == False\n assert candidate(s = \"APLALPALPALP\") == False\n assert candidate(s = \"PLLPPLPLLPLLPPP\") == True\n assert candidate(s = \"ALLPPAPL\") == False\n assert candidate(s = \"PPLPPPLPPLLPPPPP\") == True\n assert candidate(s = \"PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\") == True\n assert candidate(s = \"APLPLPLLAPA\") == False\n assert candidate(s = \"PLLPLLPLLPLL\") == True\n assert candidate(s = \"AAPLAPPLAPLPPP\") == False\n assert candidate(s = \"PLPLPLPLPLLPPPLP\") == True\n assert candidate(s = \"LPLLPLLPLL\") == True\n assert candidate(s = \"PPPPPPPPLLLPPPPP\") == False\n assert candidate(s = \"APALPPALPPAL\") == False\n assert candidate(s = \"PLLAPLLP\") == True\n assert candidate(s = \"ALALALALALALAL\") == False\n assert candidate(s = \"ALALALALALAL\") == False\n assert candidate(s = \"APLPLPALPLPA\") == False\n assert candidate(s = \"PLLPPLLPLPLL\") == True\n assert candidate(s = \"LLAALLLLPLLPPP\") == False\n assert candidate(s = \"LLPPPPPPPPPPPPPPPPPPPPPPPPPPPPLLPPPPPP\") == True\n assert candidate(s = \"PPALLPA\") == False\n assert candidate(s = \"PPPPPPPPPPPPLL\") == True\n assert candidate(s = \"PLPLPLPLPLLPPPA\") == True\n assert candidate(s = \"PLLALPPLPLL\") == True\n assert candidate(s = \"APAPAPAPAP\") == False\n assert candidate(s = \"PPALLLPPALLP\") == False\n assert candidate(s = \"LLPLLLP\") == False\n assert candidate(s = \"LLPPPPPPPPPP\") == True\n assert candidate(s = \"PPAPAPAP\") == False\n assert candidate(s = \"PPALLPLPA\") == False\n assert candidate(s = \"PLPLPLPLPL\") == True\n assert candidate(s = \"PPALLPLLALLPP\") == False\n assert candidate(s = \"PPLPPPPPLP\") == True\n assert candidate(s = \"AAPPPPPPPPPPPPPPPPPPPPPPPPPPPPPLLPPPPPP\") == False\n assert candidate(s = \"PPPPPPPPPPPPPPPPPPPPPPP\") == True\n assert candidate(s = \"PLPLLPLLPLLAP\") == True\n assert candidate(s = \"AAAAAAAA\") == False\n assert candidate(s = \"LLAALLAALLAALLAALLAALLAALLAALLAALLAALLAALLAALLAALLAALLAALL\") == False\n assert candidate(s = \"PALPALPALP\") == False\n assert candidate(s = \"ALLPLALPA\") == False\n assert candidate(s = \"PPPPPLPPPPLL\") == True\n assert candidate(s = \"PAPAPAPAPA\") == False\n assert candidate(s = \"PPPLAPLLPA\") == False\n assert candidate(s = \"PLPPPPLPPPLPPP\") == True\n assert candidate(s = \"PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPLLL\") == False\n assert candidate(s = \"PALLPLLP\") == True\n assert candidate(s = \"LLPPLLPLP\") == True\n assert candidate(s = \"LLPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\") == True\n assert candidate(s = \"PPALLPLLPLPPP\") == True\n assert candidate(s = \"PPPPPPPPPPPPPPPPPPPPPPPPPPPPPAL\") == True\n assert candidate(s = \"PLALLAPLLP\") == False\n assert candidate(s = \"LLAAPLLAALLP\") == False\n assert candidate(s = \"ALPLPALPALLP\") == False\n assert candidate(s = \"PPPPPPPPPPPPPPPPPPPPPPPPPPPPP\") == True\n assert candidate(s = \"PPALPLPLPLPA\") == False\n assert candidate(s = \"PLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLL\") == True\n assert candidate(s = \"PPPLLPPPLLPPPLL\") == True\n assert candidate(s = \"AAAAAAAAAAPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\") == False\n assert candidate(s = \"AAAAA\") == False\n assert candidate(s = \"PPPLAALLPPPL\") == False\n assert candidate(s = \"LPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLLPLP\") == True\n assert candidate(s = \"PALPALPALPAL\") == False\n assert candidate(s = \"PAALPAALPPA\") == False\n assert candidate(s = \"ALALALALAL\") == False\n assert candidate(s = \"LLALALALALL\") == False\n assert candidate(s = \"PLLPPPLLPPPPPPLL\") == True\n assert candidate(s = \"LLLL\") == False\n assert candidate(s = \"PLPLLPLLPLLPLLPLLPL\") == True\n assert candidate(s = \"PPPPPLPPPPLP\") == True\n assert candidate(s = \"LLLPLLPPP\") == False\n assert candidate(s = \"PLLPLLPLL\") == True\n assert candidate(s = \"PPALLPLLPA\") == False\n assert candidate(s = \"PPPPPPPPPPPPPPLL\") == True\n assert candidate(s = \"PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPLL\") == True\n assert candidate(s = \"PLPPPPLPPPPPP\") == True\n assert candidate(s = \"AAPAAPAAPAAPAP\") == False\n assert candidate(s = \"APAPAPAPAPAP\") == False\n assert candidate(s = \"AAPPLL\") == False\n assert candidate(s = \"PPAALLL\") == False\n assert candidate(s = \"PPAPLPLAPL\") == False\n assert candidate(s = \"LLLLPPLP\") == False\n assert candidate(s = \"PPALLPLLAP\") == False\n assert candidate(s = \"PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\") == True\n assert candidate(s = \"PPPLLLPPPLLPP\") == False\n assert candidate(s = \"ALLPPLLAPL\") == False\n assert candidate(s = \"PPALLPLLALLL\") == False\n assert candidate(s = \"PLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLPLP\") == True\n assert candidate(s = \"PPPPPPPPPPLL\") == True\n assert candidate(s = \"PPLPALPALPAL\") == False\n assert candidate(s = \"PPALLLL\") == False\n assert candidate(s = \"LLPLLLPLL\") == False\n assert candidate(s = \"PPAALPPALLP\") == False\n assert candidate(s = \"PLAPLLPLPAPL\") == False\n assert candidate(s = \"LLPPLLPLPLLPLL\") == True\n assert candidate(s = \"PLLAPPPALPLL\") == False\n assert candidate(s = \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALLL\") == False\n assert candidate(s = \"PAPAPAPAPAPAPAPAPAPA\") == False\n assert candidate(s = \"LLPPALLPLL\") == True\n assert candidate(s = \"LLLLPPL\") == False\n assert candidate(s = \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\") == False\n assert candidate(s = \"PPPLPPPPLLPPPLL\") == True\n assert candidate(s = \"PPALLALPLAL\") == False\n assert candidate(s = \"PPALLPLLALLP\") == False\n assert candidate(s = \"LLPPLLPLL\") == True\n assert candidate(s = \"LLPLLPALL\") == True\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().checkRecord", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var checkRecord = function(s) {", "container": null, "callable": "checkRecord", "parameters": [{"name": "s", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 552, "task_id": "student-attendance-record-ii", "difficulty": "Hard", "problem_description": "An attendance record for a student can be represented as a string where each character signifies whether the student was absent, late, or present on that day. The record only contains the following three characters:\n\n'A': Absent.\n'L': Late.\n'P': Present.\n\nAny student is eligible for an attendance award if they meet both of the following criteria:\n\nThe student was absent ('A') for strictly fewer than 2 days total.\nThe student was never late ('L') for 3 or more consecutive days.\n\nGiven an integer n, return the number of possible attendance records of length n that make a student eligible for an attendance award. The answer may be very large, so return it modulo 109 + 7.\n \nExample 1:\n\nInput: n = 2\nOutput: 8\nExplanation: There are 8 records with length 2 that are eligible for an award:\n\"PP\", \"AP\", \"PA\", \"LP\", \"PL\", \"AL\", \"LA\", \"LL\"\nOnly \"AA\" is not eligible because there are 2 absences (there need to be fewer than 2).\n\nExample 2:\n\nInput: n = 1\nOutput: 3\n\nExample 3:\n\nInput: n = 10101\nOutput: 183236316\n\n \nConstraints:\n\n1 <= n <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 3) == 19\n assert candidate(n = 100) == 985598218\n assert candidate(n = 2) == 8\n assert candidate(n = 1) == 3\n assert candidate(n = 10) == 3536\n assert candidate(n = 5) == 94\n assert candidate(n = 50) == 100469819\n assert candidate(n = 300) == 921822362\n assert candidate(n = 4) == 43\n assert candidate(n = 20) == 2947811\n assert candidate(n = 200) == 110821862\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().checkRecord", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var checkRecord = function(n) {", "container": null, "callable": "checkRecord", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 553, "task_id": "optimal-division", "difficulty": "Medium", "problem_description": "You are given an integer array nums. The adjacent integers in nums will perform the float division.\n\nFor example, for nums = [2,3,4], we will evaluate the expression \"2/3/4\".\n\nHowever, you can add any number of parenthesis at any position to change the priority of operations. You want to add these parentheses such the value of the expression after the evaluation is maximum.\nReturn the corresponding expression that has the maximum value in string format.\nNote: your expression should not contain redundant parenthesis.\n \nExample 1:\n\nInput: nums = [1000,100,10,2]\nOutput: \"1000/(100/10/2)\"\nExplanation: 1000/(100/10/2) = 1000/((100/10)/2) = 200\nHowever, the bold parenthesis in \"1000/((100/10)/2)\" are redundant since they do not influence the operation priority.\nSo you should return \"1000/(100/10/2)\".\nOther cases:\n1000/(100/10)/2 = 50\n1000/(100/(10/2)) = 50\n1000/100/10/2 = 0.5\n1000/100/(10/2) = 2\n\nExample 2:\n\nInput: nums = [2,3,4]\nOutput: \"2/(3/4)\"\nExplanation: (2/(3/4)) = 8/3 = 2.667\nIt can be shown that after trying all possibilities, we cannot get an expression with evaluation greater than 2.667\n\n \nConstraints:\n\n1 <= nums.length <= 10\n2 <= nums[i] <= 1000\nThere is only one optimal division for the given input.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 20, 30]) == \"10/(20/30)\"\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == \"2/(2/2/2/2/2/2/2/2/2)\"\n assert candidate(nums = [3, 100, 100, 100, 100, 100, 100, 100, 100, 100]) == \"3/(100/100/100/100/100/100/100/100/100)\"\n assert candidate(nums = [2, 3, 5, 7, 11]) == \"2/(3/5/7/11)\"\n assert candidate(nums = [3, 2]) == \"3/2\"\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == \"10/(9/8/7/6/5/4/3/2/1)\"\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == \"9/(8/7/6/5/4/3/2/1)\"\n assert candidate(nums = [10]) == \"10\"\n assert candidate(nums = [9, 8, 7, 6, 5]) == \"9/(8/7/6/5)\"\n assert candidate(nums = [2, 3]) == \"2/3\"\n assert candidate(nums = [5, 6, 7]) == \"5/(6/7)\"\n assert candidate(nums = [5, 5, 5, 5]) == \"5/(5/5/5)\"\n assert candidate(nums = [5, 6, 7, 8]) == \"5/(6/7/8)\"\n assert candidate(nums = [10, 2]) == \"10/2\"\n assert candidate(nums = [3, 4, 5, 6, 7, 8, 9, 10]) == \"3/(4/5/6/7/8/9/10)\"\n assert candidate(nums = [2, 3, 4]) == \"2/(3/4)\"\n assert candidate(nums = [20, 10, 5, 2]) == \"20/(10/5/2)\"\n assert candidate(nums = [100, 50, 25, 10]) == \"100/(50/25/10)\"\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2]) == \"10/(9/8/7/6/5/4/3/2)\"\n assert candidate(nums = [100, 50, 25, 12, 6, 3, 1]) == \"100/(50/25/12/6/3/1)\"\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == \"100/(200/300/400/500/600/700/800/900/1000)\"\n assert candidate(nums = [10, 5]) == \"10/5\"\n assert candidate(nums = [1000, 100, 10, 2]) == \"1000/(100/10/2)\"\n assert candidate(nums = [10, 20, 30, 40]) == \"10/(20/30/40)\"\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40]) == \"100/(90/80/70/60/50/40)\"\n assert candidate(nums = [101, 202, 303, 404, 505]) == \"101/(202/303/404/505)\"\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == \"100/(200/300/400/500/600/700/800/900/1000)\"\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == \"3/(3/3/3/3/3/3/3/3/3)\"\n assert candidate(nums = [10, 5, 2, 6, 3]) == \"10/(5/2/6/3)\"\n assert candidate(nums = [10, 20, 30, 40, 50, 60]) == \"10/(20/30/40/50/60)\"\n assert candidate(nums = [8, 16, 32, 64, 128, 256]) == \"8/(16/32/64/128/256)\"\n assert candidate(nums = [3, 1000, 2, 5, 10]) == \"3/(1000/2/5/10)\"\n assert candidate(nums = [1024, 512, 256, 128, 64, 32, 16, 8, 4, 2]) == \"1024/(512/256/128/64/32/16/8/4/2)\"\n assert candidate(nums = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == \"99/(98/97/96/95/94/93/92/91/90)\"\n assert candidate(nums = [25, 50, 75, 100, 125]) == \"25/(50/75/100/125)\"\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == \"9/(8/7/6/5/4/3/2/1)\"\n assert candidate(nums = [11, 22, 33, 44, 55, 66, 77, 88, 99]) == \"11/(22/33/44/55/66/77/88/99)\"\n assert candidate(nums = [12, 15, 18, 21, 24, 27, 30]) == \"12/(15/18/21/24/27/30)\"\n assert candidate(nums = [5, 9, 12, 18, 24, 30, 36]) == \"5/(9/12/18/24/30/36)\"\n assert candidate(nums = [1000, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == \"1000/(2/3/4/5/6/7/8/9/10)\"\n assert candidate(nums = [10, 200, 3000, 40000, 500000]) == \"10/(200/3000/40000/500000)\"\n assert candidate(nums = [1000, 500, 250, 125, 62, 31]) == \"1000/(500/250/125/62/31)\"\n assert candidate(nums = [2, 5, 10, 20, 50, 100]) == \"2/(5/10/20/50/100)\"\n assert candidate(nums = [500, 250, 125, 62, 31, 15, 7]) == \"500/(250/125/62/31/15/7)\"\n assert candidate(nums = [7, 11, 13, 17, 19, 23, 29, 31, 37, 41]) == \"7/(11/13/17/19/23/29/31/37/41)\"\n assert candidate(nums = [11, 13, 17, 19, 23, 29]) == \"11/(13/17/19/23/29)\"\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == \"2/(2/2/2/2/2/2/2/2/2/2)\"\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49]) == \"7/(14/21/28/35/42/49)\"\n assert candidate(nums = [5, 10, 15, 20, 25]) == \"5/(10/15/20/25)\"\n assert candidate(nums = [999, 998, 997, 996, 995]) == \"999/(998/997/996/995)\"\n assert candidate(nums = [15, 25, 35, 45, 55, 65, 75, 85, 95]) == \"15/(25/35/45/55/65/75/85/95)\"\n assert candidate(nums = [8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096]) == \"8/(16/32/64/128/256/512/1024/2048/4096)\"\n assert candidate(nums = [10, 5, 2, 8, 3, 7, 4, 6]) == \"10/(5/2/8/3/7/4/6)\"\n assert candidate(nums = [8, 16, 24, 32, 40, 48, 56, 64, 72, 80]) == \"8/(16/24/32/40/48/56/64/72/80)\"\n assert candidate(nums = [30, 20, 10, 5, 1]) == \"30/(20/10/5/1)\"\n assert candidate(nums = [12, 15, 20, 25, 30, 35, 40, 45, 50, 55]) == \"12/(15/20/25/30/35/40/45/50/55)\"\n assert candidate(nums = [7, 11, 13, 17, 19, 23, 29, 31]) == \"7/(11/13/17/19/23/29/31)\"\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == \"2/(2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2)\"\n assert candidate(nums = [8, 6, 4, 2]) == \"8/(6/4/2)\"\n assert candidate(nums = [15, 10, 20, 30, 40, 50]) == \"15/(10/20/30/40/50)\"\n assert candidate(nums = [150, 200, 250, 300, 350, 400, 450]) == \"150/(200/250/300/350/400/450)\"\n assert candidate(nums = [42, 84, 126, 168, 210, 252, 294, 336]) == \"42/(84/126/168/210/252/294/336)\"\n assert candidate(nums = [3, 12, 3, 12, 3, 12]) == \"3/(12/3/12/3/12)\"\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900]) == \"100/(200/300/400/500/600/700/800/900)\"\n assert candidate(nums = [100, 20, 4, 2, 1]) == \"100/(20/4/2/1)\"\n assert candidate(nums = [6, 12, 18, 24, 30, 36, 42, 48, 54, 60]) == \"6/(12/18/24/30/36/42/48/54/60)\"\n assert candidate(nums = [10, 20, 30, 40, 50, 60]) == \"10/(20/30/40/50/60)\"\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800]) == \"100/(200/300/400/500/600/700/800)\"\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == \"100/(90/80/70/60/50/40/30/20/10)\"\n assert candidate(nums = [12, 6, 3, 1, 2, 4, 8]) == \"12/(6/3/1/2/4/8)\"\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27]) == \"3/(6/9/12/15/18/21/24/27)\"\n assert candidate(nums = [5, 8, 12, 15, 20]) == \"5/(8/12/15/20)\"\n assert candidate(nums = [12, 14, 16, 18, 20, 22, 24, 26, 28]) == \"12/(14/16/18/20/22/24/26/28)\"\n assert candidate(nums = [2, 2, 4, 8, 16, 32, 64, 128, 256, 512]) == \"2/(2/4/8/16/32/64/128/256/512)\"\n assert candidate(nums = [10, 5, 2, 8, 6, 3, 4, 7]) == \"10/(5/2/8/6/3/4/7)\"\n assert candidate(nums = [25, 30, 35, 40, 45, 50, 55, 60, 65, 70]) == \"25/(30/35/40/45/50/55/60/65/70)\"\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == \"10/(20/30/40/50/60/70/80/90/100)\"\n assert candidate(nums = [2, 5, 3, 4, 6, 7, 8, 9, 10]) == \"2/(5/3/4/6/7/8/9/10)\"\n assert candidate(nums = [5, 10, 15, 20, 25, 30]) == \"5/(10/15/20/25/30)\"\n assert candidate(nums = [3, 5, 8, 2, 6, 4]) == \"3/(5/8/2/6/4)\"\n assert candidate(nums = [8, 12, 4, 7, 9, 2]) == \"8/(12/4/7/9/2)\"\n assert candidate(nums = [33, 66, 99, 132, 165, 198]) == \"33/(66/99/132/165/198)\"\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]) == \"2/(3/5/7/11/13/17/19/23/29)\"\n assert candidate(nums = [3, 5, 7, 11, 13, 17, 19, 23, 29]) == \"3/(5/7/11/13/17/19/23/29)\"\n assert candidate(nums = [3, 9, 3, 9, 3, 9, 3]) == \"3/(9/3/9/3/9/3)\"\n assert candidate(nums = [500, 250, 125, 62, 31]) == \"500/(250/125/62/31)\"\n assert candidate(nums = [50, 10, 5, 2, 1]) == \"50/(10/5/2/1)\"\n assert candidate(nums = [10, 5, 2, 8, 4, 1]) == \"10/(5/2/8/4/1)\"\n assert candidate(nums = [100, 50, 20, 10, 5]) == \"100/(50/20/10/5)\"\n assert candidate(nums = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55]) == \"10/(15/20/25/30/35/40/45/50/55)\"\n assert candidate(nums = [97, 89, 83, 79, 73, 71, 67, 61, 59, 53]) == \"97/(89/83/79/73/71/67/61/59/53)\"\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23]) == \"2/(3/5/7/11/13/17/19/23)\"\n assert candidate(nums = [12, 14, 16, 18, 20, 22]) == \"12/(14/16/18/20/22)\"\n assert candidate(nums = [9, 18, 27, 36, 45, 54, 63, 72, 81, 90]) == \"9/(18/27/36/45/54/63/72/81/90)\"\n assert candidate(nums = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990]) == \"999/(998/997/996/995/994/993/992/991/990)\"\n assert candidate(nums = [2, 5, 7, 11, 13, 17, 19]) == \"2/(5/7/11/13/17/19)\"\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2]) == \"9/(8/7/6/5/4/3/2)\"\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == \"10/(20/30/40/50/60/70/80/90/100)\"\n assert candidate(nums = [500, 100, 10, 2, 5, 4, 3, 2, 1]) == \"500/(100/10/2/5/4/3/2/1)\"\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == \"2/(4/6/8/10/12/14/16/18/20)\"\n assert candidate(nums = [3, 5, 7, 9, 11, 13, 15, 17]) == \"3/(5/7/9/11/13/15/17)\"\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45]) == \"5/(10/15/20/25/30/35/40/45)\"\n assert candidate(nums = [4, 3, 2, 1, 5, 6, 7, 8, 9, 10]) == \"4/(3/2/1/5/6/7/8/9/10)\"\n assert candidate(nums = [10, 5, 2, 1, 2, 5, 10]) == \"10/(5/2/1/2/5/10)\"\n assert candidate(nums = [3, 13, 5, 4, 17, 6, 7, 8]) == \"3/(13/5/4/17/6/7/8)\"\n assert candidate(nums = [3, 11, 19, 27, 35, 43, 51, 59, 67, 75]) == \"3/(11/19/27/35/43/51/59/67/75)\"\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]) == \"2/(3/5/7/11/13/17/19/23/29)\"\n assert candidate(nums = [1000, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == \"1000/(2/3/4/5/6/7/8/9/10/11)\"\n assert candidate(nums = [500, 3, 2, 4, 10, 8, 6, 7]) == \"500/(3/2/4/10/8/6/7)\"\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == \"3/(3/3/3/3/3/3/3/3/3/3/3/3)\"\n assert candidate(nums = [3, 5, 9, 12, 15, 18]) == \"3/(5/9/12/15/18)\"\n assert candidate(nums = [18, 6, 3, 2]) == \"18/(6/3/2)\"\n assert candidate(nums = [7, 5, 3, 2]) == \"7/(5/3/2)\"\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49, 56, 63]) == \"7/(14/21/28/35/42/49/56/63)\"\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().optimalDivision", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var optimalDivision = function(nums) {", "container": null, "callable": "optimalDivision", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 554, "task_id": "brick-wall", "difficulty": "Medium", "problem_description": "There is a rectangular brick wall in front of you with n rows of bricks. The ith row has some number of bricks each of the same height (i.e., one unit) but they can be of different widths. The total width of each row is the same.\nDraw a vertical line from the top to the bottom and cross the least bricks. If your line goes through the edge of a brick, then the brick is not considered as crossed. You cannot draw a line just along one of the two vertical edges of the wall, in which case the line will obviously cross no bricks.\nGiven the 2D array wall that contains the information about the wall, return the minimum number of crossed bricks after drawing such a vertical line.\n \nExample 1:\n\n\nInput: wall = [[1,2,2,1],[3,1,2],[1,3,2],[2,4],[3,1,2],[1,3,1,1]]\nOutput: 2\n\nExample 2:\n\nInput: wall = [[1],[1],[1]]\nOutput: 3\n\n \nConstraints:\n\nn == wall.length\n1 <= n <= 104\n1 <= wall[i].length <= 104\n1 <= sum(wall[i].length) <= 2 * 104\nsum(wall[i]) is the same for each row i.\n1 <= wall[i][j] <= 231 - 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(wall = [[2], [2, 2], [2, 2, 2]]) == 1\n assert candidate(wall = [[2, 2, 2, 2], [2, 2, 2, 2], [2, 2, 2, 2]]) == 0\n assert candidate(wall = [[7], [8, 5, 7], [9, 1, 7, 5], [9, 3], [1, 5, 4], [2, 8, 2, 2], [1, 9, 1, 1, 1], [3, 5, 1, 2], [3, 1, 2, 1, 5], [3, 2, 5, 1]]) == 6\n assert candidate(wall = [[3, 5, 1, 1], [2, 3, 1, 4], [3, 1, 2, 1], [1, 3, 3, 1], [2, 4, 1, 1], [3, 1, 3, 1], [1, 2, 3, 4], [1, 1, 2, 4], [1, 1, 1, 6]]) == 4\n assert candidate(wall = [[1], [1], [1]]) == 3\n assert candidate(wall = [[1, 2, 2, 1], [3, 1, 2], [1, 3, 2], [2, 4], [3, 1, 2], [1, 3, 1, 1]]) == 2\n assert candidate(wall = [[3], [3], [3]]) == 3\n assert candidate(wall = [[1, 2, 3], [3, 2, 1], [1, 1, 2, 1]]) == 1\n assert candidate(wall = [[7], [7], [7], [7]]) == 4\n assert candidate(wall = [[1, 2, 2], [2, 2, 1], [2, 1, 2]]) == 1\n assert candidate(wall = [[2, 1, 2], [1, 2, 2], [2, 2, 1]]) == 1\n assert candidate(wall = [[2, 1, 1], [1, 2, 1], [1, 1, 2]]) == 1\n assert candidate(wall = [[1, 2], [2, 1], [3]]) == 2\n assert candidate(wall = [[10, 20, 30], [10, 30, 20], [20, 10, 30], [20, 30, 10], [30, 10, 20]]) == 2\n assert candidate(wall = [[1, 1, 1, 1, 1, 1], [1, 2, 1, 1, 1], [1, 1, 2, 1, 1], [1, 1, 1, 2, 1], [1, 1, 1, 1, 2]]) == 0\n assert candidate(wall = [[10, 20], [20, 10], [10, 20], [20, 10], [10, 20], [20, 10]]) == 3\n assert candidate(wall = [[5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5]]) == 0\n assert candidate(wall = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [4, 4, 4, 4, 4, 4], [8, 8, 8, 8], [16, 16], [32]]) == 1\n assert candidate(wall = [[7, 1, 2], [1, 2, 7], [2, 7, 1], [1, 7, 2], [7, 2, 1], [2, 1, 7]]) == 4\n assert candidate(wall = [[50, 50, 50, 50], [50, 100, 100], [100, 50, 100], [100, 100, 50], [50, 100, 50, 50], [50, 50, 50, 50, 50, 50, 50, 50, 50, 50]]) == 1\n assert candidate(wall = [[2, 2, 2, 2, 2, 2, 2], [2, 4, 4, 2], [4, 2, 4, 2], [2, 4, 2, 4], [2, 2, 2, 2, 2, 2, 2]]) == 0\n assert candidate(wall = [[1, 2, 3], [4, 5], [6, 7], [1, 2, 3], [4, 5], [6, 7]]) == 4\n assert candidate(wall = [[1, 1, 1, 1, 1], [1, 1, 1, 2], [1, 1, 3], [1, 4], [5]]) == 1\n assert candidate(wall = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(wall = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 39], [39, 1, 1, 1, 1, 1, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(wall = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]) == 0\n assert candidate(wall = [[5, 3, 2, 1, 1], [1, 1, 5, 3, 2], [2, 1, 1, 5, 3], [3, 2, 1, 1, 5], [5, 1, 2, 1, 3]]) == 2\n assert candidate(wall = [[100], [25, 25, 25, 25], [100], [50, 50], [100], [25, 75], [75, 25]]) == 5\n assert candidate(wall = [[3, 1, 1, 1], [1, 3, 1, 1], [1, 1, 3, 1], [1, 1, 1, 3], [3, 1, 1, 1], [1, 3, 1, 1]]) == 1\n assert candidate(wall = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 9, 8, 7, 6, 5, 4, 3, 2], [2, 1, 9, 8, 7, 6, 5, 4, 3], [3, 2, 1, 9, 8, 7, 6, 5, 4], [4, 3, 2, 1, 9, 8, 7, 6, 5], [5, 4, 3, 2, 1, 9, 8, 7, 6], [6, 5, 4, 3, 2, 1, 9, 8, 7], [7, 6, 5, 4, 3, 2, 1, 9, 8], [8, 7, 6, 5, 4, 3, 2, 1, 9]]) == 5\n assert candidate(wall = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(wall = [[10, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 10], [10, 10], [10, 10], [10, 10], [10, 10], [10, 10], [10, 10], [10, 10]]) == 0\n assert candidate(wall = [[100], [100], [100], [100], [100]]) == 5\n assert candidate(wall = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 1], [3, 4, 5, 1, 2], [4, 5, 1, 2, 3], [5, 1, 2, 3, 4]]) == 3\n assert candidate(wall = [[1, 1, 1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 1, 1, 1], [1, 2, 1, 1, 1, 1, 1], [1, 1, 2, 1, 1, 1, 1], [1, 1, 1, 2, 1, 1, 1], [1, 1, 1, 1, 2, 1, 1], [1, 1, 1, 1, 1, 2, 1], [1, 1, 1, 1, 1, 1, 2]]) == 1\n assert candidate(wall = [[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2]]) == 0\n assert candidate(wall = [[5, 1, 2], [1, 1, 1, 1, 1, 2, 2], [3, 3, 1], [2, 2, 1, 1, 1, 1], [2, 3, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1]]) == 1\n assert candidate(wall = [[3, 2, 1, 2, 3], [1, 1, 3, 2, 3], [2, 3, 1, 3, 1], [1, 2, 3, 2, 1], [3, 1, 2, 1, 2]]) == 1\n assert candidate(wall = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 1, 1, 1, 1, 1], [3, 1, 1, 1, 1, 1, 1, 1], [4, 1, 1, 1, 1, 1, 1], [5, 1, 1, 1, 1, 1], [6, 1, 1, 1, 1], [7, 1, 1, 1], [8, 1, 1], [9, 1], [10]]) == 1\n assert candidate(wall = [[7, 5], [5, 7], [7, 5], [5, 7], [7, 5], [5, 7]]) == 3\n assert candidate(wall = [[7, 1, 3], [2, 2, 2, 2, 2], [4, 5, 1], [3, 1, 5, 1], [1, 1, 7, 1], [1, 3, 1, 5]]) == 2\n assert candidate(wall = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(wall = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 2, 1, 1], [1, 1, 2, 1, 1, 1, 1, 1, 1], [1, 2, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 2, 1, 1, 1, 1], [2, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 2, 1], [1, 1, 1, 2, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 2], [2, 2, 2, 2, 2, 2, 2, 2, 2]]) == 0\n assert candidate(wall = [[10, 10, 10, 10, 10], [10, 10, 10, 20], [10, 20, 10, 10], [20, 10, 10, 10], [10, 10, 20, 10]]) == 1\n assert candidate(wall = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]) == 1\n assert candidate(wall = [[5, 3, 1, 1], [4, 5, 2], [1, 1, 2, 5, 3], [3, 2, 3, 2], [5, 1, 1, 1, 2], [4, 3, 1, 2]]) == 2\n assert candidate(wall = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 2, 4, 5], [5, 2, 4, 3, 1], [1, 4, 5, 2, 3]]) == 2\n assert candidate(wall = [[1, 2, 3, 4], [2, 3, 4, 1], [3, 4, 1, 2], [4, 1, 2, 3]]) == 2\n assert candidate(wall = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 2], [2, 2, 2], [1, 1, 2, 2, 1], [1, 2, 2, 1, 1], [2, 1, 1, 2, 1]]) == 1\n assert candidate(wall = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(wall = [[10], [10], [10], [10], [10], [10]]) == 6\n assert candidate(wall = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(wall = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(wall = [[10, 20, 30], [30, 10, 20], [20, 30, 10], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]]) == 1\n assert candidate(wall = [[5, 2, 3], [2, 5, 3], [3, 5, 2], [5, 3, 2], [3, 2, 5]]) == 2\n assert candidate(wall = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [2, 3, 4, 5, 1], [1, 5, 4, 3, 2], [3, 1, 2, 5, 4]]) == 2\n assert candidate(wall = [[1000000000], [1000000000], [1000000000]]) == 3\n assert candidate(wall = [[1, 99], [99, 1], [1, 1, 98], [98, 1, 1], [1, 98, 1]]) == 2\n assert candidate(wall = [[2, 3, 2, 3, 2, 3, 2, 3, 2, 3], [3, 2, 3, 2, 3, 2, 3, 2, 3, 2], [2, 2, 3, 3, 2, 2, 3, 3, 2, 2], [3, 3, 2, 2, 3, 3, 2, 2, 3, 3], [2, 3, 3, 2, 3, 3, 2, 3, 3, 2]]) == 0\n assert candidate(wall = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(wall = [[3, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 3], [1, 1, 3, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 3, 1, 1, 1, 1], [3, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 3, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 3, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 3], [1, 1, 1, 1, 1, 1, 1, 3, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 3]]) == 1\n assert candidate(wall = [[7, 1], [1, 7], [2, 2, 3], [3, 2, 2], [1, 2, 2, 2], [2, 2, 1, 2], [2, 1, 2, 2], [1, 2, 2, 2, 2], [2, 2, 2, 1], [1, 1, 2, 2, 1]]) == 5\n assert candidate(wall = [[10], [10], [10], [10], [10], [10], [10], [10], [10], [10]]) == 10\n"}, "metadata": {"canonical_parameter_names": ["wall"], "leetcode_dataset_entry_point": "Solution().leastBricks", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var leastBricks = function(wall) {", "container": null, "callable": "leastBricks", "parameters": [{"name": "wall", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 556, "task_id": "next-greater-element-iii", "difficulty": "Medium", "problem_description": "Given a positive integer n, find the smallest integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such positive integer exists, return -1.\nNote that the returned integer should fit in 32-bit integer, if there is a valid answer but it does not fit in 32-bit integer, return -1.\n \nExample 1:\nInput: n = 12\nOutput: 21\nExample 2:\nInput: n = 21\nOutput: -1\n\n \nConstraints:\n\n1 <= n <= 231 - 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 987654321) == -1\n assert candidate(n = 230241) == 230412\n assert candidate(n = 2147483476) == 2147483647\n assert candidate(n = 12) == 21\n assert candidate(n = 21) == -1\n assert candidate(n = 1234) == 1243\n assert candidate(n = 2147483647) == -1\n assert candidate(n = 2147483486) == -1\n assert candidate(n = 534976) == 536479\n assert candidate(n = 111) == -1\n assert candidate(n = 1999999999) == -1\n assert candidate(n = 1) == -1\n assert candidate(n = 4321) == -1\n assert candidate(n = 1010101010) == 1010101100\n assert candidate(n = 43214321) == 43221134\n assert candidate(n = 123456789876543210) == -1\n assert candidate(n = 567898765) == 567956788\n assert candidate(n = 2147483646) == -1\n assert candidate(n = 999999999) == -1\n assert candidate(n = 5432109876) == -1\n assert candidate(n = 1234567890123456789) == -1\n assert candidate(n = 321321321) == 321322113\n assert candidate(n = 12345678987654321) == -1\n assert candidate(n = 123456789123456789) == -1\n assert candidate(n = 4321098765) == -1\n assert candidate(n = 223344556677889900) == -1\n assert candidate(n = 1225444333111) == -1\n assert candidate(n = 543212345) == 543212354\n assert candidate(n = 432143214321) == -1\n assert candidate(n = 111122223333) == -1\n assert candidate(n = 999999998) == -1\n assert candidate(n = 531) == -1\n assert candidate(n = 2233445566778899) == -1\n assert candidate(n = 1098765432) == 1203456789\n assert candidate(n = 11111111111111111111) == -1\n assert candidate(n = 5364768910) == -1\n assert candidate(n = 5432109876543210) == -1\n assert candidate(n = 2147483645) == -1\n assert candidate(n = 2100000000) == -1\n assert candidate(n = 450210) == 451002\n assert candidate(n = 101010101) == 101010110\n assert candidate(n = 2121212121) == 2121212211\n assert candidate(n = 11223344556677889900) == -1\n assert candidate(n = 898989898) == 898989988\n assert candidate(n = 536421) == 541236\n assert candidate(n = 12341234) == 12341243\n assert candidate(n = 12344321) == 12412334\n assert candidate(n = 333333333) == -1\n assert candidate(n = 9876543210) == -1\n assert candidate(n = 33333333333333333333) == -1\n assert candidate(n = 3456789012) == -1\n assert candidate(n = 3214321) == 3221134\n assert candidate(n = 112233445566778899) == -1\n assert candidate(n = 123456789987654321) == -1\n assert candidate(n = 432123456789) == -1\n assert candidate(n = 3333333333) == -1\n assert candidate(n = 1000000000) == -1\n assert candidate(n = 1099999999) == 1909999999\n assert candidate(n = 12345678901234567890) == -1\n assert candidate(n = 111111111) == -1\n assert candidate(n = 1234567890) == 1234567908\n assert candidate(n = 2222222222) == -1\n assert candidate(n = 43212341) == 43212413\n assert candidate(n = 499999999) == 949999999\n assert candidate(n = 1121121121) == 1121121211\n assert candidate(n = 1221) == 2112\n assert candidate(n = 123454321) == 123512344\n assert candidate(n = 8999999999999999999999999999999999) == -1\n assert candidate(n = 543210) == -1\n assert candidate(n = 8765432109) == -1\n assert candidate(n = 543210987654321) == -1\n assert candidate(n = 98765) == -1\n assert candidate(n = 999999999999999999) == -1\n assert candidate(n = 123456789) == 123456798\n assert candidate(n = 1112111111) == 1121111111\n assert candidate(n = 98765432109876543210) == -1\n assert candidate(n = 987654321123456789) == -1\n assert candidate(n = 1111111111) == -1\n assert candidate(n = 54321) == -1\n assert candidate(n = 450340561) == 450340615\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().nextGreaterElement", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var nextGreaterElement = function(n) {", "container": null, "callable": "nextGreaterElement", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 557, "task_id": "reverse-words-in-a-string-iii", "difficulty": "Easy", "problem_description": "Given a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.\n \nExample 1:\n\nInput: s = \"Let's take LeetCode contest\"\nOutput: \"s'teL ekat edoCteeL tsetnoc\"\n\nExample 2:\n\nInput: s = \"Mr Ding\"\nOutput: \"rM gniD\"\n\n \nConstraints:\n\n1 <= s.length <= 5 * 104\ns contains printable ASCII characters.\ns does not contain any leading or trailing spaces.\nThere is at least one word in s.\nAll the words in s are separated by a single space.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"Reverse each word\") == \"esreveR hcae drow\"\n assert candidate(s = \"Python Programming\") == \"nohtyP gnimmargorP\"\n assert candidate(s = \"Python is fun\") == \"nohtyP si nuf\"\n assert candidate(s = \"reverse each word\") == \"esrever hcae drow\"\n assert candidate(s = \"Mr Ding\") == \"rM gniD\"\n assert candidate(s = \"Hello World\") == \"olleH dlroW\"\n assert candidate(s = \"Let's take LeetCode contest\") == \"s'teL ekat edoCteeL tsetnoc\"\n assert candidate(s = \"a b c d e\") == \"a b c d e\"\n assert candidate(s = \"a long sentence with multiple words to reverse each one\") == \"a gnol ecnetnes htiw elpitlum sdrow ot esrever hcae eno\"\n assert candidate(s = \"spaces at the end of the sentence \") == \"secaps ta eht dne fo eht ecnetnes\"\n assert candidate(s = \"longwordswithoutspaces\") == \"secapstuohtiwsdrowgnol\"\n assert candidate(s = \"!@#$%^ &*()\") == \"^%$#@! )(*&\"\n assert candidate(s = \"longwordthatdoesnotcontainanywhitespace\") == \"ecapsetihwynaniatnoctonseodtahtdrowgnol\"\n assert candidate(s = \"Able was I ere I saw Elba\") == \"elbA saw I ere I was ablE\"\n assert candidate(s = \"a quick brown fox jumps over the lazy dog\") == \"a kciuq nworb xof spmuj revo eht yzal god\"\n assert candidate(s = \"Qwen AI assistant\") == \"newQ IA tnatsissa\"\n assert candidate(s = \"multiple spaces between words\") == \"elpitlum secaps neewteb sdrow\"\n assert candidate(s = \"123 abc 456 def 789 ghi\") == \"321 cba 654 fed 987 ihg\"\n assert candidate(s = \"Was it a car or a cat I saw\") == \"saW ti a rac ro a tac I was\"\n assert candidate(s = \"Eva can I see bees in a cave\") == \"avE nac I ees seeb ni a evac\"\n assert candidate(s = \"racecar level kayak deed civic\") == \"racecar level kayak deed civic\"\n assert candidate(s = \"A quick brown fox jumps over the lazy dog\") == \"A kciuq nworb xof spmuj revo eht yzal god\"\n assert candidate(s = \"Do geese see God\") == \"oD eseeg ees doG\"\n assert candidate(s = \"singleword\") == \"drowelgnis\"\n assert candidate(s = \"very long string with multiple words to ensure the solution handles large inputs efficiently\") == \"yrev gnol gnirts htiw elpitlum sdrow ot erusne eht noitulos seldnah egral stupni yltneiciffe\"\n assert candidate(s = \"The quick brown fox jumps over the lazy dog\") == \"ehT kciuq nworb xof spmuj revo eht yzal god\"\n assert candidate(s = \"EdgeCase\") == \"esaCegdE\"\n assert candidate(s = \"!@#$% ^&*()\") == \"%$#@! )(*&^\"\n assert candidate(s = \"A B C D E F G H I J K L M N O P Q R S T U V W X Y Z\") == \"A B C D E F G H I J K L M N O P Q R S T U V W X Y Z\"\n assert candidate(s = \"abcdef ghijklm nopqrst uvwxyz\") == \"fedcba mlkjihg tsrqpon zyxwvu\"\n assert candidate(s = \"123 456 789\") == \"321 654 987\"\n assert candidate(s = \"123abc def456 ghi789\") == \"cba321 654fed 987ihg\"\n assert candidate(s = \"SingleWord\") == \"droWelgniS\"\n assert candidate(s = \"12345 67890 111213\") == \"54321 09876 312111\"\n assert candidate(s = \"12345 67890 09876 54321\") == \"54321 09876 67890 12345\"\n assert candidate(s = \"Debugging is twice as hard as writing the code in the first place\") == \"gniggubeD si eciwt sa drah sa gnitirw eht edoc ni eht tsrif ecalp\"\n assert candidate(s = \"Palindrome level deed civic radar rotor kayak\") == \"emordnilaP level deed civic radar rotor kayak\"\n assert candidate(s = \"Special $characters #are &important\") == \"laicepS sretcarahc$ era# tnatropmi&\"\n assert candidate(s = \"a1 b2 c3 d4 e5 f6 g7 h8 i9 j0\") == \"1a 2b 3c 4d 5e 6f 7g 8h 9i 0j\"\n assert candidate(s = \"Programming challenges are great\") == \"gnimmargorP segnellahc era taerg\"\n assert candidate(s = \"No lemon no melon\") == \"oN nomel on nolem\"\n assert candidate(s = \"Python is fun to learn\") == \"nohtyP si nuf ot nrael\"\n assert candidate(s = \"Desperation is the true mark of weakness\") == \"noitarepseD si eht eurt kram fo ssenkaew\"\n assert candidate(s = \"The quick brown fox\") == \"ehT kciuq nworb xof\"\n assert candidate(s = \"Multiple spaces in between\") == \"elpitluM secaps ni neewteb\"\n assert candidate(s = \"special!@# characters $%^&* should be reversed\") == \"#@!laiceps sretcarahc *&^%$ dluohs eb desrever\"\n assert candidate(s = \"123abc def456 ghi789 jkl012\") == \"cba321 654fed 987ihg 210lkj\"\n assert candidate(s = \"special!@# $%^&*() characters\") == \"#@!laiceps )(*&^%$ sretcarahc\"\n assert candidate(s = \"Very long sentence with multiple words to test the implementation correctly\") == \"yreV gnol ecnetnes htiw elpitlum sdrow ot tset eht noitatnemelpmi yltcerroc\"\n assert candidate(s = \"Mixed CASE with UPPER and lower\") == \"dexiM ESAC htiw REPPU dna rewol\"\n assert candidate(s = \"Reverse each word in this sentence\") == \"esreveR hcae drow ni siht ecnetnes\"\n assert candidate(s = \"Alibaba Cloud Services\") == \"ababilA duolC secivreS\"\n assert candidate(s = \"multiple spaces between words\") == \"elpitlum secaps neewteb sdrow\"\n assert candidate(s = \"Step on no pets\") == \"petS no on step\"\n assert candidate(s = \"Special!@# $%^&*() Characters\") == \"#@!laicepS )(*&^%$ sretcarahC\"\n assert candidate(s = \"OpenAI GPT-4\") == \"IAnepO 4-TPG\"\n assert candidate(s = \"Never odd or even\") == \"reveN ddo ro neve\"\n assert candidate(s = \"Keep calm and code on\") == \"peeK mlac dna edoc no\"\n assert candidate(s = \"OneLongWordWithoutSpaces\") == \"secapStuohtiWdroWgnoLenO\"\n assert candidate(s = \"Python is fun and challenging\") == \"nohtyP si nuf dna gnignellahc\"\n assert candidate(s = \"1234567890 0987654321 1122334455 5544332211\") == \"0987654321 1234567890 5544332211 1122334455\"\n assert candidate(s = \"Mickey Mouse\") == \"yekciM esuoM\"\n assert candidate(s = \"Reverse each word but not the sentence order\") == \"esreveR hcae drow tub ton eht ecnetnes redro\"\n assert candidate(s = \"Programming Challenges\") == \"gnimmargorP segnellahC\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == \"zzyyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbbaa\"\n assert candidate(s = \"12345 67890 54321 09876\") == \"54321 09876 12345 67890\"\n assert candidate(s = \"verylongwordwithoutspaces\") == \"secapstuohtiwdrowgnolyrev\"\n assert candidate(s = \"CASE SENSITIVE or NOT\") == \"ESAC EVITISNES ro TON\"\n assert candidate(s = \"reverse this sentence please\") == \"esrever siht ecnetnes esaelp\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\") == \"zyxwvutsrqponmlkjihgfedcba\"\n assert candidate(s = \"1a2b3c4d5e 6f7g8h9i0j\") == \"e5d4c3b2a1 j0i9h8g7f6\"\n assert candidate(s = \"spaces between words\") == \"secaps neewteb sdrow\"\n assert candidate(s = \"reversed words in this sentence should be flipped\") == \"desrever sdrow ni siht ecnetnes dluohs eb deppilf\"\n assert candidate(s = \"Multiple spaces between words\") == \"elpitluM secaps neewteb sdrow\"\n assert candidate(s = \"1234567890\") == \"0987654321\"\n assert candidate(s = \"a\") == \"a\"\n assert candidate(s = \"Try your best and you will succeed\") == \"yrT ruoy tseb dna uoy lliw deeccus\"\n assert candidate(s = \"Data structures and algorithms\") == \"ataD serutcurts dna smhtirogla\"\n assert candidate(s = \"This is a test for the reverseWords function\") == \"sihT si a tset rof eht sdroWesrever noitcnuf\"\n assert candidate(s = \"12345 67890\") == \"54321 09876\"\n assert candidate(s = \"This is a test of the reverseWords function\") == \"sihT si a tset fo eht sdroWesrever noitcnuf\"\n assert candidate(s = \"Python is an awesome programming language\") == \"nohtyP si na emosewa gnimmargorp egaugnal\"\n assert candidate(s = \"MixedCASE Words\") == \"ESACdexiM sdroW\"\n assert candidate(s = \"aBcDeFg HiJkLmNoP QrStUvWxYz\") == \"gFeDcBa PoNmLkJiH zYxWvUtSrQ\"\n assert candidate(s = \"racecar level kayak rotator\") == \"racecar level kayak rotator\"\n assert candidate(s = \"123 456 789 0\") == \"321 654 987 0\"\n assert candidate(s = \"Madam Arora teaches malayalam\") == \"madaM arorA sehcaet malayalam\"\n assert candidate(s = \"Palindrome madam racecar\") == \"emordnilaP madam racecar\"\n assert candidate(s = \"Another EdgeCase!\") == \"rehtonA !esaCegdE\"\n assert candidate(s = \"Multiple spaces between words\") == \"elpitluM secaps neewteb sdrow\"\n assert candidate(s = \"multiple spaces between words should be preserved\") == \"elpitlum secaps neewteb sdrow dluohs eb devreserp\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().reverseWords", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var reverseWords = function(s) {", "container": null, "callable": "reverseWords", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 560, "task_id": "subarray-sum-equals-k", "difficulty": "Medium", "problem_description": "Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k.\nA subarray is a contiguous non-empty sequence of elements within an array.\n \nExample 1:\nInput: nums = [1,1,1], k = 2\nOutput: 2\nExample 2:\nInput: nums = [1,2,3], k = 3\nOutput: 2\n\n \nConstraints:\n\n1 <= nums.length <= 2 * 104\n-1000 <= nums[i] <= 1000\n-107 <= k <= 107\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [2, 2, 2, 2, 2],k = 4) == 4\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 15) == 8\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 0) == 55\n assert candidate(nums = [1, 2, 1, 2, 1],k = 3) == 4\n assert candidate(nums = [100, 200, 300, 400, 500],k = 1500) == 1\n assert candidate(nums = [1000, -1000, 1000, -1000, 1000],k = 0) == 6\n assert candidate(nums = [1, 2, 3, 4, 5],k = 9) == 2\n assert candidate(nums = [1],k = 1) == 1\n assert candidate(nums = [1, 1, 1],k = 2) == 2\n assert candidate(nums = [100, -100, 200, -200, 300, -300],k = 0) == 6\n assert candidate(nums = [-1, -1, 1],k = 0) == 1\n assert candidate(nums = [10, 20, 30, 40, 50],k = 100) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 15) == 3\n assert candidate(nums = [1, -1, 5, -2, 3],k = 3) == 3\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4],k = 0) == 10\n assert candidate(nums = [1, 0, -1, 0, -1, 0, 1],k = 0) == 8\n assert candidate(nums = [10, 20, 30, 40, 50],k = 150) == 1\n assert candidate(nums = [3, 4, 7, 2, -3, 1, 4, 2],k = 7) == 4\n assert candidate(nums = [1, -1, 0],k = 0) == 3\n assert candidate(nums = [-1, -2, -3],k = -6) == 1\n assert candidate(nums = [-1, -1, 1, 1, 0],k = 0) == 4\n assert candidate(nums = [1, 2, 3],k = 3) == 2\n assert candidate(nums = [-1, -1, 2],k = 1) == 1\n assert candidate(nums = [1000, -1000, 1000, -1000, 1000],k = 0) == 6\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 25) == 16\n assert candidate(nums = [1000, -1000, 2000, -2000, 3000],k = 0) == 3\n assert candidate(nums = [1, -1, 0, 1, -1, 1, -1],k = 0) == 13\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000],k = 10000) == 1\n assert candidate(nums = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50],k = 1000) == 1\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1],k = 0) == 16\n assert candidate(nums = [1, 3, -2, 5, 6, -4, 2, 3],k = 5) == 3\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 25) == 6\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 15) == 8\n assert candidate(nums = [10, 20, 30, -10, -20, -30, 40, 50, -40, -50],k = 30) == 5\n assert candidate(nums = [1, -1, 0, 1, -1, 2],k = 0) == 7\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5],k = 10) == 6\n assert candidate(nums = [100, -100, 50, 50, -50, 50, -100, 100],k = 0) == 10\n assert candidate(nums = [-10, 0, 10, -10, 0, 10],k = 0) == 9\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 5000) == 0\n assert candidate(nums = [10, -5, 10, -5, 10],k = 5) == 4\n assert candidate(nums = [1, -1, 1, -1, 1, -1],k = 0) == 9\n assert candidate(nums = [100, 200, 300, 400, 500],k = 1000) == 1\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0],k = 0) == 28\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10],k = -15) == 3\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 100) == 1\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 1500) == 3\n assert candidate(nums = [1, -2, 1, 2, -1, 2, 3, 4, -2, 1],k = 3) == 5\n assert candidate(nums = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10],k = -3) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, -5, -4, -3, -2, -1],k = 5) == 3\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 16\n assert candidate(nums = [1000, 1000, 1000, 1000, 1000, 1000, 1000],k = 3000) == 5\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2],k = 3) == 9\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 0) == 55\n assert candidate(nums = [0, 0, 0, 0, 0],k = 0) == 15\n assert candidate(nums = [-10, -20, -30, -40, -50],k = -70) == 1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 6\n assert candidate(nums = [1, 3, 4, 5, 7, 8, 10, 11, 12, 13],k = 20) == 2\n assert candidate(nums = [1, -1, 0, 0, 1, -1],k = 0) == 11\n assert candidate(nums = [10, -5, 2, -3, 1, 5, -2],k = 7) == 1\n assert candidate(nums = [1, -1, 0, 0, 1],k = 0) == 7\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 2500) == 1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 6\n assert candidate(nums = [10, -10, 10, -10, 10, -10, 10, -10, 10, -10],k = 0) == 25\n assert candidate(nums = [-10, 100, -100, 50, -50, 25, -25],k = 0) == 6\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5],k = 0) == 15\n assert candidate(nums = [1, 2, 3, -6, 2, 3, 4, -10, 2, 3, 4, 5],k = 5) == 6\n assert candidate(nums = [-10, -20, 10, 20, 10, -10, -20, 10, 20],k = 0) == 6\n assert candidate(nums = [1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000],k = 0) == 16\n assert candidate(nums = [10, 20, 30, 40, 50],k = 70) == 1\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 150) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9],k = 15) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 15) == 3\n assert candidate(nums = [-100, -200, -300, -400, -500, -600, -700, -800, -900, -1000],k = -5000) == 0\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 0) == 25\n assert candidate(nums = [1, -1, 5, -2, 3],k = 3) == 3\n assert candidate(nums = [1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000],k = 0) == 25\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 50) == 2\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1],k = 0) == 12\n assert candidate(nums = [100, 200, 300, 400, 500, 600],k = 1500) == 2\n assert candidate(nums = [5, 5, 5, 5, 5],k = 15) == 3\n assert candidate(nums = [0, 0, 0, 0, 0],k = 0) == 15\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 2) == 0\n assert candidate(nums = [1, 2, -1, 2, -1, 1],k = 2) == 5\n assert candidate(nums = [-1, 2, -3, 4, -5, 6, -7, 8, -9],k = -5) == 3\n assert candidate(nums = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10],k = 5) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 30) == 2\n assert candidate(nums = [1, 2, 3, 4, 5],k = 9) == 2\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 25) == 6\n assert candidate(nums = [-1000, 1000, -1000, 1000, -1000, 1000],k = 0) == 9\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 50) == 1\n assert candidate(nums = [1, 2, 1, 2, 1],k = 3) == 4\n assert candidate(nums = [3, 4, 7, 2, -3, 1, 4, 2, 0, 1],k = 7) == 7\n assert candidate(nums = [10, 2, -2, -20, 10],k = -10) == 3\n assert candidate(nums = [0, 0, 0, 0, 0, 0],k = 0) == 21\n assert candidate(nums = [1000, -1000, 1000, -1000, 1000, -1000],k = 0) == 9\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],k = 30) == 3\n assert candidate(nums = [1, 2, 3, 4, 5],k = 15) == 1\n assert candidate(nums = [-10, -20, -30, -40, -50, -60, -70, -80, -90, -100],k = -150) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 100) == 1\n assert candidate(nums = [-1, 0, 1, -1, 0, 1],k = 0) == 9\n assert candidate(nums = [5, -5, 5, -5, 5, -5, 5],k = 5) == 10\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().subarraySum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var subarraySum = function(nums, k) {", "container": null, "callable": "subarraySum", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 561, "task_id": "array-partition", "difficulty": "Easy", "problem_description": "Given an integer array nums of 2n integers, group these integers into n pairs (a1, b1), (a2, b2), ..., (an, bn) such that the sum of min(ai, bi) for all i is maximized. Return the maximized sum.\n \nExample 1:\n\nInput: nums = [1,4,3,2]\nOutput: 4\nExplanation: All possible pairings (ignoring the ordering of elements) are:\n1. (1, 4), (2, 3) -> min(1, 4) + min(2, 3) = 1 + 2 = 3\n2. (1, 3), (2, 4) -> min(1, 3) + min(2, 4) = 1 + 2 = 3\n3. (1, 2), (3, 4) -> min(1, 2) + min(3, 4) = 1 + 3 = 4\nSo the maximum possible sum is 4.\nExample 2:\n\nInput: nums = [6,2,6,5,1,2]\nOutput: 9\nExplanation: The optimal pairing is (2, 1), (2, 5), (6, 6). min(2, 1) + min(2, 5) + min(6, 6) = 1 + 2 + 6 = 9.\n\n \nConstraints:\n\n1 <= n <= 104\nnums.length == 2 * n\n-104 <= nums[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15]) == 28\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5]) == 20\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993]) == -39988\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 25\n assert candidate(nums = [1, 4, 3, 2]) == 4\n assert candidate(nums = [-2, -1, 0, 1, 2, 3, 4, 5]) == 4\n assert candidate(nums = [6, 2, 6, 5, 1, 2]) == 9\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 250\n assert candidate(nums = [1, 3, 5, 7, 9, 11]) == 15\n assert candidate(nums = [-2, -1, -3, -4, -5, -6, -7, -8]) == -20\n assert candidate(nums = [2, 2, 2, 2, 2, 2]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6]) == 9\n assert candidate(nums = [10000, -10000, 10000, -10000]) == 0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1]) == 4\n assert candidate(nums = [-100, -200, -300, -400, -500, -600]) == -1200\n assert candidate(nums = [0, 0, 0, 0]) == 0\n assert candidate(nums = [100, 200, 300, 400, 500, 600]) == 900\n assert candidate(nums = [-1, 2, 3, -4]) == -2\n assert candidate(nums = [-1, 2, -3, 4, -5, 6]) == -2\n assert candidate(nums = [5, 5, 5, 5, 5, 5]) == 15\n assert candidate(nums = [-1, 4, -3, 2]) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8]) == 16\n assert candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1]) == 16\n assert candidate(nums = [-2, -4, -6, -8, -10, -12]) == -24\n assert candidate(nums = [-10000, 10000, -9999, 9999, -9998, 9998]) == -9999\n assert candidate(nums = [-1, 0, -3, 2, 5, -4]) == -3\n assert candidate(nums = [-1, -2, -3, -4, -5, -6]) == -12\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 625\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]) == 120\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, -10, -20, -30, -40, -50, -60, -70, -80, -90, -100]) == -50\n assert candidate(nums = [1000, -1000, 500, -500, 250, -250, 750, -750, 125, -125, 625, -625]) == -500\n assert candidate(nums = [100, 200, 100, 200, 100, 200, 100, 200, 100, 200, 100, 200, 100, 200, 100, 200]) == 1200\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20]) == -110\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 2500\n assert candidate(nums = [5, 8, 12, 19, 23, 35, 48, 67, 88, 99, 101, 102, 103, 104, 105, 106]) == 485\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]) == 12\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 100\n assert candidate(nums = [100, -200, 300, -400, 500, -600, 700, -800, 900, -1000]) == -800\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 64\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5]) == 30\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7]) == 44\n assert candidate(nums = [10000, -10000, 5000, -5000, 2500, -2500, 1250, -1250]) == -6250\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == 435\n assert candidate(nums = [-1, 1, -2, 2, -3, 3, -4, 4, -5, 5, -6, 6, -7, 7, -8, 8, -9, 9, -10, 10]) == -5\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, -1000, -2000, -3000, -4000, -5000, -6000, -7000, -8000, -9000, -10000]) == -5000\n assert candidate(nums = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81]) == 900\n assert candidate(nums = [10, 10, 20, 20, 30, 30, 40, 40, 50, 50, 60, 60, 70, 70, 80, 80, 90, 90, 100, 100]) == 550\n assert candidate(nums = [-10, 10, -20, 20, -30, 30, -40, 40, -50, 50, -60, 60, -70, 70, -80, 80]) == -40\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [10000, -10000, 9999, -9999, 9998, -9998]) == -9999\n assert candidate(nums = [100, -100, 200, -200, 300, -300, 400, -400, 500, -500]) == -300\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 12\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == -10\n assert candidate(nums = [-5000, -4000, -3000, -2000, -1000, 0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]) == 16000\n assert candidate(nums = [1000, -1000, 500, -500, 250, -250, 125, -125, 625, -625, 312, -312, 156, -156, 78, -78]) == -704\n assert candidate(nums = [-1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0]) == -1\n assert candidate(nums = [-10, -20, -30, -40, -50, -60, -70, -80, -90, -100, -110, -120, -130, -140, -150, -160]) == -720\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 55\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]) == 256\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16]) == -72\n assert candidate(nums = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981]) == 9900\n assert candidate(nums = [-10, -20, -30, -40, -50, -60, -70, -80, -90, -100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == -275\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12]) == -42\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 6\n assert candidate(nums = [-5000, -4999, -4998, -4997, -4996, -4995, -4994, -4993, -4992, -4991, -4990, -4989, -4988, -4987, -4986, -4985]) == -39944\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991]) == -49980\n assert candidate(nums = [100, 200, 300, 400, 500, 150, 250, 350, 450, 550]) == 1500\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600]) == 6400\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]) == 200\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993]) == -39988\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 100\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010]) == 7525\n assert candidate(nums = [-10, -20, -30, -40, -50, -60, -70, -80, -90, -100, -110, -120, -130, -140, -150, -160]) == -720\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 100\n assert candidate(nums = [100, -100, 200, -200, 300, -300, 400, -400, 500, -500]) == -300\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 225\n assert candidate(nums = [-5000, 5000, -4999, 4999, -4998, 4998, -4997, 4997, -4996, 4996]) == -4998\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 50\n assert candidate(nums = [10000, -10000, 5000, -5000, 7500, -7500, 2500, -2500]) == -5000\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9, 10, -10]) == -5\n assert candidate(nums = [1, 10, 100, 1000, 10000, -1, -10, -100, -1000, -10000, 2, 20, 200, 2000, 20000, 3, 30, 300, 3000, 30000]) == 14141\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8]) == -4\n assert candidate(nums = [1, 10000, 2, 9999, 3, 9998, 4, 9997, 5, 9996]) == 20005\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 1000\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]) == 640\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [10000, -10000, 9999, -9999, 9998, -9998, 9997, -9997, 9996, -9996]) == -9998\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 100\n assert candidate(nums = [10000, -10000, 9999, -9999, 9998, -9998, 1, 2, 3, 4]) == -9993\n assert candidate(nums = [500, 400, 300, 200, 100, 0, -100, -200, -300, -400, -500, -600, -700, -800, -900]) == -1600\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000]) == 36000\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == 16\n assert candidate(nums = [9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989]) == 49965\n assert candidate(nums = [-10, 10, -20, 20, -30, 30, -40, 40, -50, 50, -60, 60]) == -30\n assert candidate(nums = [10000, -10000, 5000, -5000, 2500, -2500]) == -7500\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]) == 640\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000]) == 80000\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5]) == -3\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == 500\n assert candidate(nums = [-1000, -900, -800, -700, -600, -500, -400, -300, -200, -100]) == -3000\n assert candidate(nums = [-10000, 10000, -9999, 9999, -9998, 9998, -9997, 9997, -9996, 9996, -9995, 9995, -9994, 9994, -9993, 9993]) == -4\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80]) == 320\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 275\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 20\n assert candidate(nums = [10000, -10000, 5000, -5000, 2500, -2500, 1250, -1250, 625, -625]) == -6875\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, -10, -20, -30, -40, -50, -60]) == 130\n assert candidate(nums = [100, 100, 90, 90, 80, 80, 70, 70, 60, 60, 50, 50, 40, 40, 30, 30]) == 520\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2525\n assert candidate(nums = [10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000]) == 0\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().arrayPairSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var arrayPairSum = function(nums) {", "container": null, "callable": "arrayPairSum", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 563, "task_id": "binary-tree-tilt", "difficulty": "Easy", "problem_description": "Given the root of a binary tree, return the sum of every tree node's tilt.\nThe tilt of a tree node is the absolute difference between the sum of all left subtree node values and all right subtree node values. If a node does not have a left child, then the sum of the left subtree node values is treated as 0. The rule is similar if the node does not have a right child.\n \nExample 1:\n\n\nInput: root = [1,2,3]\nOutput: 1\nExplanation: \nTilt of node 2 : |0-0| = 0 (no children)\nTilt of node 3 : |0-0| = 0 (no children)\nTilt of node 1 : |2-3| = 1 (left subtree is just left child, so sum is 2; right subtree is just right child, so sum is 3)\nSum of every tilt : 0 + 0 + 1 = 1\n\nExample 2:\n\n\nInput: root = [4,2,9,3,5,null,7]\nOutput: 15\nExplanation: \nTilt of node 3 : |0-0| = 0 (no children)\nTilt of node 5 : |0-0| = 0 (no children)\nTilt of node 7 : |0-0| = 0 (no children)\nTilt of node 2 : |3-5| = 2 (left subtree is just left child, so sum is 3; right subtree is just right child, so sum is 5)\nTilt of node 9 : |0-7| = 7 (no left child, so sum is 0; right subtree is just right child, so sum is 7)\nTilt of node 4 : |(3+5+2)-(9+7)| = |10-16| = 6 (left subtree values are 3, 5, and 2, which sums to 10; right subtree values are 9 and 7, which sums to 16)\nSum of every tilt : 0 + 0 + 0 + 2 + 7 + 6 = 15\n\nExample 3:\n\n\nInput: root = [21,7,14,1,1,2,2,3,3]\nOutput: 9\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [0, 104].\n-1000 <= Node.val <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3])) == 1\n assert candidate(root = tree_node([21, 7, 14, 1, 1, 2, 2, 3, 3])) == 9\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18])) == 40\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, None, 7, None, 8, 9])) == 55\n assert candidate(root = tree_node([4, 2, 9, 3, 5, None, 7])) == 15\n assert candidate(root = tree_node([1, 2])) == 2\n assert candidate(root = tree_node([1, None, 2, None, 3])) == 8\n assert candidate(root = tree_node([1, None, 2])) == 2\n assert candidate(root = tree_node([1, None, 2, None, 3])) == 8\n assert candidate(root = tree_node([0])) == 0\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4])) == 20\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7])) == 41\n assert candidate(root = tree_node([1])) == 0\n assert candidate(root = tree_node([])) == 0\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, None, None, 5, 6, None, 7, None, None, 8])) == 131\n assert candidate(root = tree_node([1000, -1000, 500, None, None, -250, 250])) == 2000\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == 330\n assert candidate(root = tree_node([5, 3, 9, 1, 4, 8, 10, 0, 2, None, None, None, None, 6, 11])) == 61\n assert candidate(root = tree_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1])) == 19\n assert candidate(root = tree_node([1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000, 1000])) == 14000\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])) == 35\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == 441\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])) == 647\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, None, None, 6, 7, 8, 9])) == 11\n assert candidate(root = tree_node([1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1])) == 14\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])) == 167\n assert candidate(root = tree_node([1, 2, 2, 3, 3, None, None, 4, 4, 5, 5, None, None, 6, 6, 7, 7, None, None, 8, 8, 9, 9, None, None, 10, 10])) == 216\n assert candidate(root = tree_node([100, -50, 50, 25, -25, 25, -25, 12, -12, 12, -12, 12, -12, 12, -12])) == 296\n assert candidate(root = tree_node([1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6])) == 114\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, None, None, 6, 9])) == 43\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, 8, None, 10, None, 12, None, 14])) == 97\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 1120\n assert candidate(root = tree_node([50, 25, 75, 10, 40, 60, 90, 5, 15, 30, 45, 55, 65, 80, 100])) == 585\n assert candidate(root = tree_node([0, 1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7])) == 56\n assert candidate(root = tree_node([1, None, None, 2, None, None, 3, None, None, 4, None, None, 5, None, None, 6])) == 0\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, None, 16, None, 17])) == 109\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11])) == 440\n assert candidate(root = tree_node([10, 5, -3, 3, 2, None, 11, 3, -2, None, 1, None, None, -1, None, None, None, None, None])) == 20\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, 16])) == 57\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == 35\n assert candidate(root = tree_node([100, -50, -50, 30, 20, 10, -10, 2, 8, -2, -8, 1, -1, 0, 0])) == 114\n assert candidate(root = tree_node([0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3])) == 0\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, -1, 3, 8, 18, 23, 27, 32, 38])) == 240\n assert candidate(root = tree_node([100, 90, 90, 80, None, None, 80, 70, None, None, 70, 60, None, None, 60, 50, None, None, 50, 40, None, None, 40, 30, None, None, 30, 20, None, None, 20, 10, None, None, 10])) == 2400\n assert candidate(root = tree_node([-10, 15, -3, 7, -8, None, None, 6, 4])) == 54\n assert candidate(root = tree_node([1000, -1000, 500, 250, -250, 0, 0, 125, -125, 62, -62, 31, -31, 15, -15, 7, -7, 3, -3, 1, -1])) == 2488\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 0\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15])) == 87\n assert candidate(root = tree_node([20, 15, 25, 10, 17, 22, 30, None, None, 13, 19, None, None, 21, 24, 27, 33])) == 227\n assert candidate(root = tree_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, -1, -2, -3, -4, -5])) == 40\n assert candidate(root = tree_node([1000, -500, -500, 250, 250, -250, -250, 125, 125, 125, 125, -125, -125, -125, -125])) == 2000\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8, 9, 10])) == 94\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == 163\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == 167\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == 35\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1])) == 533\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == 215\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50])) == 928\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 0\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, None, 1, None, None, None, None, None, None, 8])) == 6\n assert candidate(root = tree_node([-10, -20, -30, -40, None, -50, -60, -70, None, -80, -90])) == 530\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, 1, 2, 3, 4, 5, 6, 7, 8])) == 107\n assert candidate(root = tree_node([20, -10, 10, None, 5, 5, None, 3, None, 2])) == 39\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, 26, 27, 28, 29, 30, -1])) == 35\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1])) == 155\n assert candidate(root = tree_node([-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15])) == 35\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == 159\n assert candidate(root = tree_node([1, -2, -3, 1, 3, -2, None, -1, None, None, -1])) == 11\n assert candidate(root = tree_node([9, 4, 20, None, None, 15, 17, 12, None, 6, 18, None, 13, 7, None, None, None, None, None, None])) == 162\n assert candidate(root = tree_node([1, 2, 2, 3, None, 3, None, 4, None, 4, None, 5, None, 5, None, 6, None, 6, None, 7, None, 7, None, 8, None, 8, None, 9, None, 9, None, 10, None, 10])) == 552\n assert candidate(root = tree_node([1000, -1000, 1000, -1000, 1000, -1000, 1000])) == 6000\n assert candidate(root = tree_node([100, -100, 200, -200, 300, -300, 400])) == 1500\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, None, None, 25, 15, None, None, None, None, 30, None])) == 115\n assert candidate(root = tree_node([1, -2, -3, -4, -5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13])) == 45\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 301\n assert candidate(root = tree_node([5, 3, 8, 1, 4, 7, 9, None, 2, None, None, None, None, None, 6])) == 37\n assert candidate(root = tree_node([5, 14, 3, 7, 13, None, None, 5, 9, None, None, 4, 10, None, None, 2, 8, 11, 12])) == 216\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == 132\n assert candidate(root = tree_node([15, 10, 20, 8, 12, 16, 25, 4, 9, 11, 13, 17, 21, 24, 27])) == 134\n assert candidate(root = tree_node([-1, -2, -3, -4, None, -5, -6, -7, None, -8, None, -9, None, -10])) == 75\n assert candidate(root = tree_node([10, 5, -3, 3, 2, None, 11, 3, -2, None, 1])) == 22\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, None, 1, None, None, None, None, 7])) == 32\n assert candidate(root = tree_node([100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10, -20, -30, -40, -50, -60, -70, -80, -90, -100])) == 590\n assert candidate(root = tree_node([1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])) == 20\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])) == 20\n assert candidate(root = tree_node([10, 5, -3, 3, 2, None, 11, 3, -2, None, 1, None, None, None, None, 8])) == 44\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 0\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19])) == 2280\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, 7, 8, None, 9, 10, 11, None, 12, None, 13, 14, None, 15, 16, 17, None, 18, None, 19])) == 437\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().findTilt", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findTilt = function(root) {", "container": null, "callable": "findTilt", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 564, "task_id": "find-the-closest-palindrome", "difficulty": "Hard", "problem_description": "Given a string n representing an integer, return the closest integer (not including itself), which is a palindrome. If there is a tie, return the smaller one.\nThe closest is defined as the absolute difference minimized between two integers.\n \nExample 1:\n\nInput: n = \"123\"\nOutput: \"121\"\n\nExample 2:\n\nInput: n = \"1\"\nOutput: \"0\"\nExplanation: 0 and 2 are the closest palindromes but we return the smallest which is 0.\n\n \nConstraints:\n\n1 <= n.length <= 18\nn consists of only digits.\nn does not have leading zeros.\nn is representing an integer in the range [1, 1018 - 1].\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = \"10\") == \"9\"\n assert candidate(n = \"1001\") == \"999\"\n assert candidate(n = \"1234\") == \"1221\"\n assert candidate(n = \"123321\") == \"122221\"\n assert candidate(n = \"999999999\") == \"1000000001\"\n assert candidate(n = \"11\") == \"9\"\n assert candidate(n = \"9999\") == \"10001\"\n assert candidate(n = \"111111111\") == \"111101111\"\n assert candidate(n = \"9\") == \"8\"\n assert candidate(n = \"111111111111111111\") == \"111111110011111111\"\n assert candidate(n = \"10001\") == \"9999\"\n assert candidate(n = \"1000000000\") == \"999999999\"\n assert candidate(n = \"233\") == \"232\"\n assert candidate(n = \"987654321\") == \"987656789\"\n assert candidate(n = \"1221\") == \"1111\"\n assert candidate(n = \"123456789\") == \"123454321\"\n assert candidate(n = \"101\") == \"99\"\n assert candidate(n = \"1\") == \"0\"\n assert candidate(n = \"10000\") == \"9999\"\n assert candidate(n = \"123454321\") == \"123444321\"\n assert candidate(n = \"1000000001\") == \"999999999\"\n assert candidate(n = \"12321\") == \"12221\"\n assert candidate(n = \"99\") == \"101\"\n assert candidate(n = \"999999999999999999\") == \"1000000000000000001\"\n assert candidate(n = \"1000\") == \"999\"\n assert candidate(n = \"1000001\") == \"999999\"\n assert candidate(n = \"123\") == \"121\"\n assert candidate(n = \"1234321\") == \"1233321\"\n assert candidate(n = \"999\") == \"1001\"\n assert candidate(n = \"123456\") == \"123321\"\n assert candidate(n = \"1000000000000000000\") == \"999999999999999999\"\n assert candidate(n = \"100\") == \"99\"\n assert candidate(n = \"9223372036854775807\") == \"9223372037302733229\"\n assert candidate(n = \"923429\") == \"923329\"\n assert candidate(n = \"1234567887654321\") == \"1234567777654321\"\n assert candidate(n = \"2345678987654321\") == \"2345678998765432\"\n assert candidate(n = \"1000000000000000000000000001\") == \"999999999999999999999999999\"\n assert candidate(n = \"123456789876543210\") == \"123456789987654321\"\n assert candidate(n = \"10000000000000000100\") == \"10000000000000000001\"\n assert candidate(n = \"99999999999999999999\") == \"100000000000000000001\"\n assert candidate(n = \"9999999999\") == \"10000000001\"\n assert candidate(n = \"10000000000\") == \"9999999999\"\n assert candidate(n = \"2000002\") == \"1999991\"\n assert candidate(n = \"100001\") == \"99999\"\n assert candidate(n = \"101010101010101010\") == \"101010101101010101\"\n assert candidate(n = \"112233445566778899\") == \"112233445544332211\"\n assert candidate(n = \"200000000000000000001\") == \"200000000000000000002\"\n assert candidate(n = \"12345678987654322\") == \"12345678987654321\"\n assert candidate(n = \"888888888\") == \"888878888\"\n assert candidate(n = \"221122\") == \"220022\"\n assert candidate(n = \"222222222222222222\") == \"222222221122222222\"\n assert candidate(n = \"99999999999999999999999999\") == \"100000000000000000000000001\"\n assert candidate(n = \"1234567890123456789\") == \"1234567889887654321\"\n assert candidate(n = \"98765432123456789\") == \"98765432023456789\"\n assert candidate(n = \"10000000000000000000\") == \"9999999999999999999\"\n assert candidate(n = \"123456789876543221\") == \"123456789987654321\"\n assert candidate(n = \"5555555555555555\") == \"5555555445555555\"\n assert candidate(n = \"1111111111\") == \"1111001111\"\n assert candidate(n = \"12345678987654321\") == \"12345678887654321\"\n assert candidate(n = \"10000000000000000000001\") == \"9999999999999999999999\"\n assert candidate(n = \"1111\") == \"1001\"\n assert candidate(n = \"111\") == \"101\"\n assert candidate(n = \"9998\") == \"9999\"\n assert candidate(n = \"100000000001\") == \"99999999999\"\n assert candidate(n = \"8888888888\") == \"8888778888\"\n assert candidate(n = \"11111111111111111\") == \"11111111011111111\"\n assert candidate(n = \"888888888888888888\") == \"888888887788888888\"\n assert candidate(n = \"135797531\") == \"135787531\"\n assert candidate(n = \"123456789012345678901234567890123456789\") == \"123456789012345678898876543210987654321\"\n assert candidate(n = \"9876543210123456789\") == \"9876543211123456789\"\n assert candidate(n = \"11122111\") == \"11111111\"\n assert candidate(n = \"100000000000000000000000001\") == \"99999999999999999999999999\"\n assert candidate(n = \"100010001\") == \"100000001\"\n assert candidate(n = \"1000000000000000000000000000000\") == \"999999999999999999999999999999\"\n assert candidate(n = \"12344321\") == \"12333321\"\n assert candidate(n = \"12345678900987654321\") == \"12345678899887654321\"\n assert candidate(n = \"2147483647\") == \"2147447412\"\n assert candidate(n = \"1800000000\") == \"1799999971\"\n assert candidate(n = \"100000000000000000\") == \"99999999999999999\"\n assert candidate(n = \"9999999999999999999999999\") == \"10000000000000000000000001\"\n assert candidate(n = \"9999999999999999999\") == \"10000000000000000001\"\n assert candidate(n = \"9876543210\") == \"9876556789\"\n assert candidate(n = \"99999\") == \"100001\"\n assert candidate(n = \"1111111111111111111\") == \"1111111110111111111\"\n assert candidate(n = \"987654321098765432109876543210987654321\") == \"987654321098765432111234567890123456789\"\n assert candidate(n = \"112233445544332211\") == \"112233444444332211\"\n assert candidate(n = \"9999999999999999\") == \"10000000000000001\"\n assert candidate(n = \"9999999999999999999999\") == \"10000000000000000000001\"\n assert candidate(n = \"10000000001\") == \"9999999999\"\n assert candidate(n = \"999999999999999999999\") == \"1000000000000000000001\"\n assert candidate(n = \"999999999999999998\") == \"999999999999999999\"\n assert candidate(n = \"1000000000000000000000000\") == \"999999999999999999999999\"\n assert candidate(n = \"100000000000000000001\") == \"99999999999999999999\"\n assert candidate(n = \"2000000000000000000\") == \"2000000000000000002\"\n assert candidate(n = \"1234567898765432\") == \"1234567887654321\"\n assert candidate(n = \"100000000000000000000000000000000000000001\") == \"99999999999999999999999999999999999999999\"\n assert candidate(n = \"1000000000000000000001\") == \"999999999999999999999\"\n assert candidate(n = \"11111111111111111111\") == \"11111111100111111111\"\n assert candidate(n = \"999999999999999999999999\") == \"1000000000000000000000001\"\n assert candidate(n = \"987654321123456789\") == \"987654320023456789\"\n assert candidate(n = \"876543210\") == \"876545678\"\n assert candidate(n = \"1234567890987654321\") == \"1234567891987654321\"\n assert candidate(n = \"1001001001001\") == \"1001000001001\"\n assert candidate(n = \"99999999999999999\") == \"100000000000000001\"\n assert candidate(n = \"98765432109876543210\") == \"98765432111123456789\"\n assert candidate(n = \"111111111111111110\") == \"111111111111111111\"\n assert candidate(n = \"92345678987654322\") == \"92345678987654329\"\n assert candidate(n = \"1000000000000000001\") == \"999999999999999999\"\n assert candidate(n = \"111111111111111111111\") == \"111111111101111111111\"\n assert candidate(n = \"8000000000000000000\") == \"7999999999999999997\"\n assert candidate(n = \"100000000000000001\") == \"99999999999999999\"\n assert candidate(n = \"10000000000000000\") == \"9999999999999999\"\n assert candidate(n = \"10000000000000000001\") == \"9999999999999999999\"\n assert candidate(n = \"246808642\") == \"246818642\"\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().nearestPalindromic", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var nearestPalindromic = function(n) {", "container": null, "callable": "nearestPalindromic", "parameters": [{"name": "n", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 565, "task_id": "array-nesting", "difficulty": "Medium", "problem_description": "You are given an integer array nums of length n where nums is a permutation of the numbers in the range [0, n - 1].\nYou should build a set s[k] = {nums[k], nums[nums[k]], nums[nums[nums[k]]], ... } subjected to the following rule:\n\nThe first element in s[k] starts with the selection of the element nums[k] of index = k.\nThe next element in s[k] should be nums[nums[k]], and then nums[nums[nums[k]]], and so on.\nWe stop adding right before a duplicate element occurs in s[k].\n\nReturn the longest length of a set s[k].\n \nExample 1:\n\nInput: nums = [5,4,0,3,1,6,2]\nOutput: 4\nExplanation: \nnums[0] = 5, nums[1] = 4, nums[2] = 0, nums[3] = 3, nums[4] = 1, nums[5] = 6, nums[6] = 2.\nOne of the longest sets s[k]:\ns[0] = {nums[0], nums[5], nums[6], nums[2]} = {5, 6, 2, 0}\n\nExample 2:\n\nInput: nums = [0,1,2]\nOutput: 1\n\n \nConstraints:\n\n1 <= nums.length <= 105\n0 <= nums[i] < nums.length\nAll the values of nums are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 0, 3, 4, 2]) == 3\n assert candidate(nums = [5, 1, 4, 2, 0, 6, 3]) == 6\n assert candidate(nums = [3, 2, 1, 0]) == 2\n assert candidate(nums = [1, 2, 0, 3]) == 3\n assert candidate(nums = [0, 2, 1]) == 2\n assert candidate(nums = [0, 2, 1, 3]) == 2\n assert candidate(nums = [0, 2, 1, 5, 3, 4]) == 3\n assert candidate(nums = [10, 5, 3, 4, 8, 6, 1, 7, 9, 2, 0]) == 5\n assert candidate(nums = [0, 1, 2]) == 1\n assert candidate(nums = [3, 0, 1, 2]) == 4\n assert candidate(nums = [5, 0, 1, 4, 3, 2]) == 4\n assert candidate(nums = [3, 0, 2, 1]) == 3\n assert candidate(nums = [5, 4, 0, 3, 1, 6, 2]) == 4\n assert candidate(nums = [1, 2, 0]) == 3\n assert candidate(nums = [1, 0]) == 2\n assert candidate(nums = [0, 2, 1, 4, 3, 5, 7, 6]) == 2\n assert candidate(nums = [2, 3, 1, 0, 5, 6, 4]) == 4\n assert candidate(nums = [1, 3, 0, 2]) == 4\n assert candidate(nums = [9, 5, 4, 0, 8, 1, 6, 3, 7, 2]) == 7\n assert candidate(nums = [0, 2, 1, 4, 3, 5, 6, 7, 8, 9]) == 2\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 2\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 2\n assert candidate(nums = [7, 6, 5, 4, 3, 2, 1, 0]) == 2\n assert candidate(nums = [3, 2, 1, 0, 7, 6, 5, 4]) == 2\n assert candidate(nums = [10, 6, 3, 8, 2, 5, 1, 4, 9, 7, 0]) == 6\n assert candidate(nums = [1, 3, 5, 7, 9, 0, 2, 4, 6, 8]) == 10\n assert candidate(nums = [2, 3, 4, 5, 0, 1]) == 3\n assert candidate(nums = [2, 0, 1, 4, 3, 5, 7, 6, 8, 9, 11, 10, 13, 12, 15, 14]) == 3\n assert candidate(nums = [15, 13, 12, 1, 9, 14, 10, 0, 8, 5, 11, 4, 7, 3, 2, 6]) == 12\n assert candidate(nums = [5, 6, 4, 3, 0, 2, 1]) == 4\n assert candidate(nums = [1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 2\n assert candidate(nums = [4, 0, 2, 5, 3, 6, 1, 7]) == 6\n assert candidate(nums = [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9]) == 2\n assert candidate(nums = [1, 2, 3, 4, 0, 6, 5]) == 5\n assert candidate(nums = [1, 0, 3, 5, 4, 2]) == 3\n assert candidate(nums = [15, 13, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 12, 14]) == 6\n assert candidate(nums = [8, 2, 3, 1, 5, 6, 7, 0, 4]) == 6\n assert candidate(nums = [9, 7, 5, 3, 1, 8, 6, 4, 2, 0]) == 3\n assert candidate(nums = [4, 0, 2, 6, 7, 3, 1, 5]) == 7\n assert candidate(nums = [1, 6, 3, 7, 8, 0, 5, 4, 2, 9]) == 5\n assert candidate(nums = [4, 5, 6, 7, 8, 9, 3, 0, 1, 2]) == 10\n assert candidate(nums = [1, 0, 3, 2, 5, 4, 7, 6, 9, 8]) == 2\n assert candidate(nums = [1, 4, 3, 0, 2]) == 5\n assert candidate(nums = [6, 2, 4, 5, 3, 0, 1]) == 7\n assert candidate(nums = [0, 2, 1, 3, 5, 4, 7, 6, 8, 10, 9]) == 2\n assert candidate(nums = [0, 3, 1, 4, 5, 2, 6, 7, 8, 9]) == 5\n assert candidate(nums = [4, 0, 3, 5, 7, 2, 6, 1, 8, 9, 10, 11, 12, 13, 14]) == 4\n assert candidate(nums = [2, 0, 1, 3, 5, 4, 6, 8, 7, 10, 9, 12, 11, 14, 13]) == 3\n assert candidate(nums = [3, 6, 0, 1, 2, 5, 4, 8, 7]) == 6\n assert candidate(nums = [2, 3, 1, 0]) == 4\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == 1\n assert candidate(nums = [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 2\n assert candidate(nums = [2, 0, 1, 4, 5, 3, 7, 6, 9, 8]) == 3\n assert candidate(nums = [12, 0, 9, 6, 1, 10, 11, 13, 8, 7, 5, 2, 4, 3]) == 7\n assert candidate(nums = [7, 5, 4, 1, 0, 6, 2, 3]) == 8\n assert candidate(nums = [0, 3, 1, 6, 2, 5, 4, 7]) == 5\n assert candidate(nums = [0, 4, 3, 1, 2]) == 4\n assert candidate(nums = [7, 0, 1, 2, 3, 4, 5, 6, 13, 8, 9, 10, 11, 12, 14]) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) == 10\n assert candidate(nums = [6, 2, 1, 5, 4, 0, 3, 7, 11, 8, 10, 9]) == 4\n assert candidate(nums = [8, 2, 0, 7, 3, 1, 6, 5, 4]) == 8\n assert candidate(nums = [7, 1, 5, 3, 6, 4, 0, 2]) == 6\n assert candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1, 0, 9]) == 2\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 1\n assert candidate(nums = [8, 2, 4, 6, 0, 3, 5, 7, 1]) == 5\n assert candidate(nums = [7, 0, 1, 3, 6, 2, 8, 5, 4, 9]) == 5\n assert candidate(nums = [1, 5, 0, 4, 2, 3]) == 6\n assert candidate(nums = [7, 5, 6, 4, 1, 0, 2, 3]) == 6\n assert candidate(nums = [8, 2, 3, 1, 4, 5, 7, 6, 0]) == 3\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 2\n assert candidate(nums = [2, 0, 3, 5, 1, 8, 7, 6, 4]) == 7\n assert candidate(nums = [1, 0, 3, 5, 2, 4, 7, 6, 8]) == 4\n assert candidate(nums = [12, 13, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 4\n assert candidate(nums = [4, 0, 2, 6, 1, 5, 3, 7]) == 3\n assert candidate(nums = [2, 0, 1, 4, 5, 3, 6, 7]) == 3\n assert candidate(nums = [4, 5, 6, 7, 0, 1, 2, 3]) == 2\n assert candidate(nums = [9, 3, 2, 1, 4, 5, 0, 6, 8, 7]) == 4\n assert candidate(nums = [6, 2, 8, 5, 1, 9, 4, 3, 0, 7]) == 6\n assert candidate(nums = [6, 2, 4, 3, 5, 0, 1]) == 6\n assert candidate(nums = [6, 2, 3, 4, 5, 1, 0]) == 5\n assert candidate(nums = [3, 1, 2, 0, 6, 5, 4, 9, 8, 7]) == 2\n assert candidate(nums = [3, 5, 4, 2, 0, 1]) == 4\n assert candidate(nums = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]) == 7\n assert candidate(nums = [4, 0, 5, 1, 3, 2, 6]) == 4\n assert candidate(nums = [0, 2, 1, 4, 3, 6, 5, 8, 7]) == 2\n assert candidate(nums = [2, 0, 1, 4, 3, 6, 8, 5, 7, 9, 11, 10]) == 4\n assert candidate(nums = [1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10]) == 2\n assert candidate(nums = [8, 2, 4, 1, 3, 6, 7, 0, 5]) == 5\n assert candidate(nums = [0, 2, 1, 4, 5, 3]) == 3\n assert candidate(nums = [1, 0, 3, 2, 5, 4, 7, 6]) == 2\n assert candidate(nums = [4, 3, 2, 1, 0]) == 2\n assert candidate(nums = [0, 1, 3, 2, 6, 5, 4, 7, 9, 8, 11, 10, 13, 12, 15, 14]) == 2\n assert candidate(nums = [0, 3, 2, 1, 6, 5, 4, 9, 8, 7]) == 2\n assert candidate(nums = [2, 0, 1, 4, 3, 5]) == 3\n assert candidate(nums = [6, 3, 5, 1, 4, 0, 2]) == 4\n assert candidate(nums = [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 2\n assert candidate(nums = [9, 7, 8, 3, 10, 2, 6, 11, 4, 0, 5, 1]) == 5\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().arrayNesting", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var arrayNesting = function(nums) {", "container": null, "callable": "arrayNesting", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 566, "task_id": "reshape-the-matrix", "difficulty": "Easy", "problem_description": "In MATLAB, there is a handy function called reshape which can reshape an m x n matrix into a new one with a different size r x c keeping its original data.\nYou are given an m x n matrix mat and two integers r and c representing the number of rows and the number of columns of the wanted reshaped matrix.\nThe reshaped matrix should be filled with all the elements of the original matrix in the same row-traversing order as they were.\nIf the reshape operation with given parameters is possible and legal, output the new reshaped matrix; Otherwise, output the original matrix.\n \nExample 1:\n\n\nInput: mat = [[1,2],[3,4]], r = 1, c = 4\nOutput: [[1,2,3,4]]\n\nExample 2:\n\n\nInput: mat = [[1,2],[3,4]], r = 2, c = 4\nOutput: [[1,2],[3,4]]\n\n \nConstraints:\n\nm == mat.length\nn == mat[i].length\n1 <= m, n <= 100\n-1000 <= mat[i][j] <= 1000\n1 <= r, c <= 300\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(mat = [[1, 2, 3], [4, 5, 6]],r = 1,c = 6) == [[1, 2, 3, 4, 5, 6]]\n assert candidate(mat = [[1, 2], [3, 4]],r = 1,c = 4) == [[1, 2, 3, 4]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6]],r = 3,c = 2) == [[1, 2], [3, 4], [5, 6]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6]],r = 3,c = 1) == [[1, 2, 3], [4, 5, 6]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6]],r = 1,c = 3) == [[1, 2, 3], [4, 5, 6]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6]],r = 3,c = 3) == [[1, 2, 3], [4, 5, 6]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6]],r = 1,c = 1) == [[1, 2, 3], [4, 5, 6]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],r = 1,c = 9) == [[1, 2, 3, 4, 5, 6, 7, 8, 9]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8]],r = 1,c = 8) == [[1, 2, 3, 4, 5, 6, 7, 8]]\n assert candidate(mat = [[1, 2], [3, 4]],r = 2,c = 2) == [[1, 2], [3, 4]]\n assert candidate(mat = [[1, 2], [3, 4]],r = 2,c = 4) == [[1, 2], [3, 4]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8]],r = 4,c = 2) == [[1, 2], [3, 4], [5, 6], [7, 8]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8]],r = 8,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],r = 9,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8], [9]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8]],r = 2,c = 4) == [[1, 2, 3, 4], [5, 6, 7, 8]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6]],r = 2,c = 2) == [[1, 2, 3], [4, 5, 6]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6]],r = 6,c = 1) == [[1], [2], [3], [4], [5], [6]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],r = 3,c = 3) == [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n assert candidate(mat = [[1, 2], [3, 4]],r = 4,c = 1) == [[1], [2], [3], [4]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6]],r = 2,c = 3) == [[1, 2, 3], [4, 5, 6]]\n assert candidate(mat = [[10, 20, 30], [40, 50, 60], [70, 80, 90], [100, 110, 120]],r = 2,c = 6) == [[10, 20, 30, 40, 50, 60], [70, 80, 90, 100, 110, 120]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]],r = 20,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20]]\n assert candidate(mat = [[5, 6, 7], [8, 9, 10]],r = 6,c = 1) == [[5], [6], [7], [8], [9], [10]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]],r = 6,c = 2) == [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]],r = 3,c = 4) == [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]],r = 12,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12]]\n assert candidate(mat = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]],r = 20,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20]]\n assert candidate(mat = [[1, 2], [3, 4], [5, 6], [7, 8]],r = 8,c = 2) == [[1, 2], [3, 4], [5, 6], [7, 8]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]],r = 12,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12]]\n assert candidate(mat = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]],r = 1,c = 16) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8]],r = 4,c = 1) == [[1, 2, 3, 4], [5, 6, 7, 8]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]],r = 4,c = 3) == [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]\n assert candidate(mat = [[10, 20, 30], [40, 50, 60], [70, 80, 90]],r = 9,c = 1) == [[10], [20], [30], [40], [50], [60], [70], [80], [90]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]],r = 2,c = 5) == [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18]],r = 18,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]],r = 16,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16]]\n assert candidate(mat = [[1, 2], [3, 4], [5, 6], [7, 8]],r = 2,c = 8) == [[1, 2], [3, 4], [5, 6], [7, 8]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]],r = 4,c = 2) == [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]\n assert candidate(mat = [[1000, -1000, 500], [-500, 1000, -1000], [0, 0, 0]],r = 3,c = 3) == [[1000, -1000, 500], [-500, 1000, -1000], [0, 0, 0]]\n assert candidate(mat = [[-1, 2, -3], [4, -5, 6], [-7, 8, -9]],r = 3,c = 3) == [[-1, 2, -3], [4, -5, 6], [-7, 8, -9]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]],r = 1,c = 20) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]],r = 6,c = 2) == [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]]\n assert candidate(mat = [[1, 2], [3, 4]],r = 4,c = 1) == [[1], [2], [3], [4]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]],r = 1,c = 15) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]]\n assert candidate(mat = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]],r = 3,c = 5) == [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]]\n assert candidate(mat = [[0, 0, 0], [0, 0, 0], [0, 0, 0]],r = 9,c = 1) == [[0], [0], [0], [0], [0], [0], [0], [0], [0]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18]],r = 6,c = 3) == [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18]]\n assert candidate(mat = [[1, 2], [3, 4], [5, 6], [7, 8]],r = 1,c = 8) == [[1, 2, 3, 4, 5, 6, 7, 8]]\n assert candidate(mat = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]],r = 5,c = 3) == [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]],r = 8,c = 2) == [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]]\n assert candidate(mat = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]],r = 5,c = 3) == [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]\n assert candidate(mat = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]],r = 1,c = 9) == [[-1, -2, -3, -4, -5, -6, -7, -8, -9]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]],r = 2,c = 5) == [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]],r = 3,c = 7) == [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]\n assert candidate(mat = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12]],r = 6,c = 2) == [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]]\n assert candidate(mat = [[1, 2], [3, 4], [5, 6], [7, 8]],r = 2,c = 4) == [[1, 2, 3, 4], [5, 6, 7, 8]]\n assert candidate(mat = [[1, 2], [3, 4], [5, 6], [7, 8]],r = 8,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]],r = 5,c = 3) == [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],r = 2,c = 5) == [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]],r = 3,c = 4) == [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18]],r = 9,c = 2) == [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18]]\n assert candidate(mat = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]],r = 1,c = 15) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]]\n assert candidate(mat = [[1, 2], [3, 4], [5, 6], [7, 8]],r = 2,c = 4) == [[1, 2, 3, 4], [5, 6, 7, 8]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]],r = 3,c = 4) == [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]],r = 4,c = 3) == [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]],r = 4,c = 3) == [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]\n assert candidate(mat = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]],r = 3,c = 4) == [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]\n assert candidate(mat = [[1, 2], [3, 4], [5, 6], [7, 8]],r = 4,c = 2) == [[1, 2], [3, 4], [5, 6], [7, 8]]\n assert candidate(mat = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]],r = 15,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]],r = 3,c = 4) == [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]\n assert candidate(mat = [[-1, 2, -3, 4], [-5, 6, -7, 8], [-9, 10, -11, 12]],r = 2,c = 6) == [[-1, 2, -3, 4, -5, 6], [-7, 8, -9, 10, -11, 12]]\n assert candidate(mat = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]],r = 3,c = 3) == [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18]],r = 1,c = 18) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]],r = 2,c = 10) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]],r = 1,c = 12) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]],r = 5,c = 2) == [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]],r = 15,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]],r = 4,c = 5) == [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6]],r = 3,c = 2) == [[1, 2], [3, 4], [5, 6]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]],r = 4,c = 4) == [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]\n assert candidate(mat = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]],r = 2,c = 6) == [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]],r = 2,c = 6) == [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]],r = 10,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]],r = 1,c = 19) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]]\n assert candidate(mat = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],r = 5,c = 2) == [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]\n assert candidate(mat = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]],r = 4,c = 5) == [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]],r = 2,c = 8) == [[1, 2, 3, 4, 5, 6, 7, 8], [9, 10, 11, 12, 13, 14, 15, 16]]\n assert candidate(mat = [[1, 2], [3, 4], [5, 6]],r = 1,c = 3) == [[1, 2], [3, 4], [5, 6]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18]],r = 2,c = 9) == [[1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16, 17, 18]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]],r = 1,c = 12) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]\n assert candidate(mat = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]],r = 5,c = 4) == [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16], [17, 18, 19, 20]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]],r = 16,c = 1) == [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16]]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]],r = 1,c = 16) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],r = 1,c = 3) == [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n assert candidate(mat = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18]],r = 3,c = 6) == [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]],r = 3,c = 5) == [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]]\n assert candidate(mat = [[10, 20, 30, 40, 50], [60, 70, 80, 90, 100], [110, 120, 130, 140, 150]],r = 5,c = 3) == [[10, 20, 30], [40, 50, 60], [70, 80, 90], [100, 110, 120], [130, 140, 150]]\n"}, "metadata": {"canonical_parameter_names": ["mat", "r", "c"], "leetcode_dataset_entry_point": "Solution().matrixReshape", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var matrixReshape = function(mat, r, c) {", "container": null, "callable": "matrixReshape", "parameters": [{"name": "mat", "type": "number[][]"}, {"name": "r", "type": "number"}, {"name": "c", "type": "number"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 567, "task_id": "permutation-in-string", "difficulty": "Medium", "problem_description": "Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise.\nIn other words, return true if one of s1's permutations is the substring of s2.\n \nExample 1:\n\nInput: s1 = \"ab\", s2 = \"eidbaooo\"\nOutput: true\nExplanation: s2 contains one permutation of s1 (\"ba\").\n\nExample 2:\n\nInput: s1 = \"ab\", s2 = \"eidboaoo\"\nOutput: false\n\n \nConstraints:\n\n1 <= s1.length, s2.length <= 104\ns1 and s2 consist of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s1 = \"abc\",s2 = \"bbbccca\") == False\n assert candidate(s1 = \"adc\",s2 = \"dcda\") == True\n assert candidate(s1 = \"abc\",s2 = \"bbbccba\") == True\n assert candidate(s1 = \"abcde\",s2 = \"adecb\") == True\n assert candidate(s1 = \"test\",s2 = \"ttewest\") == False\n assert candidate(s1 = \"abc\",s2 = \"cbadef\") == True\n assert candidate(s1 = \"abc\",s2 = \"defabc\") == True\n assert candidate(s1 = \"xyz\",s2 = \"zyxwvut\") == True\n assert candidate(s1 = \"hello\",s2 = \"ooollehed\") == True\n assert candidate(s1 = \"ab\",s2 = \"eidboaoo\") == False\n assert candidate(s1 = \"aabbcc\",s2 = \"abcabc\") == True\n assert candidate(s1 = \"hello\",s2 = \"ooolleoooleh\") == False\n assert candidate(s1 = \"xyz\",s2 = \"ayzxbcd\") == True\n assert candidate(s1 = \"hello\",s2 = \"ooollehdl\") == True\n assert candidate(s1 = \"a\",s2 = \"ab\") == True\n assert candidate(s1 = \"z\",s2 = \"abcz\") == True\n assert candidate(s1 = \"a\",s2 = \"b\") == False\n assert candidate(s1 = \"abcd\",s2 = \"dcba\") == True\n assert candidate(s1 = \"ab\",s2 = \"eidbaooo\") == True\n assert candidate(s1 = \"abcd\",s2 = \"dcbaefg\") == True\n assert candidate(s1 = \"abc\",s2 = \"cccccbabb\") == True\n assert candidate(s1 = \"aaaa\",s2 = \"aaabaaaa\") == True\n assert candidate(s1 = \"abcd\",s2 = \"abcdxzyw\") == True\n assert candidate(s1 = \"a\",s2 = \"a\") == True\n assert candidate(s1 = \"abracadabra\",s2 = \"cadabraabra\") == True\n assert candidate(s1 = \"unique\",s2 = \"enquci\") == False\n assert candidate(s1 = \"complexity\",s2 = \"itpelxcmoytz\") == True\n assert candidate(s1 = \"python\",s2 = \"nothpy\") == True\n assert candidate(s1 = \"permutation\",s2 = \"aeronpmutitno\") == True\n assert candidate(s1 = \"pqrstuvw\",s2 = \"stuvwpqrxyz\") == True\n assert candidate(s1 = \"zzzzz\",s2 = \"zzzzzzzzzzzzzzzzzzzzzz\") == True\n assert candidate(s1 = \"aabbccddeeff\",s2 = \"bbccddeeffaabb\") == True\n assert candidate(s1 = \"xyz\",s2 = \"zyxabcdef\") == True\n assert candidate(s1 = \"permutation\",s2 = \"terumtnipxo\") == False\n assert candidate(s1 = \"characters\",s2 = \"trchaesrhc\") == False\n assert candidate(s1 = \"aabbcc\",s2 = \"baccabdefg\") == True\n assert candidate(s1 = \"algorithm\",s2 = \"logarithma\") == True\n assert candidate(s1 = \"abcdef\",s2 = \"fedcba\") == True\n assert candidate(s1 = \"substring\",s2 = \"tstringsub\") == True\n assert candidate(s1 = \"mnopqr\",s2 = \"qrstuvwxyzmnopqr\") == True\n assert candidate(s1 = \"aabbccddeeff\",s2 = \"fedcbazyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(s1 = \"unique\",s2 = \"eniquu\") == True\n assert candidate(s1 = \"abcdefghij\",s2 = \"abcdefghijabcdefghij\") == True\n assert candidate(s1 = \"xyz\",s2 = \"axbyczd\") == False\n assert candidate(s1 = \"abcdefghij\",s2 = \"jihgfedcbaefghijkl\") == True\n assert candidate(s1 = \"hello\",s2 = \"ohellonow\") == True\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"zyxwvutsrqponmlkjihgfedcbaabcde\") == True\n assert candidate(s1 = \"substring\",s2 = \"stringgnusbs\") == False\n assert candidate(s1 = \"permutation\",s2 = \"tnuatipremot\") == True\n assert candidate(s1 = \"testcase\",s2 = \"stceatcases\") == False\n assert candidate(s1 = \"unique\",s2 = \"euqnieabcd\") == False\n assert candidate(s1 = \"longstring\",s2 = \"gnirtsolongstring\") == True\n assert candidate(s1 = \"abcdabcd\",s2 = \"dcbaabcd\") == True\n assert candidate(s1 = \"mississippi\",s2 = \"isppiimsss\") == False\n assert candidate(s1 = \"abcdef\",s2 = \"ghfedcbijklm\") == False\n assert candidate(s1 = \"substringpermutation\",s2 = \"permutationsubstring\") == True\n assert candidate(s1 = \"variation\",s2 = \"atinoriva\") == True\n assert candidate(s1 = \"abcdefghijk\",s2 = \"jihgfedcbaklmnopqrs\") == True\n assert candidate(s1 = \"abcd\",s2 = \"dcbaefghijklmnopqrstuvwxyz\") == True\n assert candidate(s1 = \"permutation\",s2 = \"tporemutani\") == True\n assert candidate(s1 = \"complexity\",s2 = \"xxlpeicmtostiy\") == False\n assert candidate(s1 = \"unique\",s2 = \"ueiqnunc\") == True\n assert candidate(s1 = \"aabbcc\",s2 = \"cbacbacbacbacbacbacbacbacb\") == True\n assert candidate(s1 = \"abcdefg\",s2 = \"ghijklmnopabcdefg\") == True\n assert candidate(s1 = \"abcdefghiklmnopqrstuvwxyz\",s2 = \"zyxwvutsrqponmlkjihgfedcbaabcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(s1 = \"aabbccddeeff\",s2 = \"fedcbafedcbafedcba\") == True\n assert candidate(s1 = \"challenge\",s2 = \"hgelangecllon\") == False\n assert candidate(s1 = \"abcdefg\",s2 = \"gfedcbahijklmnopqrstuvwxyz\") == True\n assert candidate(s1 = \"permutation\",s2 = \"tpremnoiuat\") == True\n assert candidate(s1 = \"hello\",s2 = \"oellhworld\") == True\n assert candidate(s1 = \"test\",s2 = \"tsetabcd\") == True\n assert candidate(s1 = \"abcdefghijk\",s2 = \"kljihgfedcbazyxwvutsrqponml\") == False\n assert candidate(s1 = \"abcdef\",s2 = \"fedcbaxyzabcdef\") == True\n assert candidate(s1 = \"example\",s2 = \"melpaxe\") == True\n assert candidate(s1 = \"interview\",s2 = \"wterevinirt\") == True\n assert candidate(s1 = \"zyxw\",s2 = \"wxyzabcd\") == True\n assert candidate(s1 = \"permutation\",s2 = \"ttnremuapoi\") == True\n assert candidate(s1 = \"xyzz\",s2 = \"zzzyxzzzzzyx\") == True\n assert candidate(s1 = \"hello\",s2 = \"ohellworld\") == True\n assert candidate(s1 = \"longstring\",s2 = \"tgnirlongs\") == True\n assert candidate(s1 = \"aabbcc\",s2 = \"bbccaaabcdef\") == True\n assert candidate(s1 = \"aaaaabbbbb\",s2 = \"ababababab\") == True\n assert candidate(s1 = \"complexpermutation\",s2 = \"xmplxcmpotrenuati\") == False\n assert candidate(s1 = \"xyz\",s2 = \"zyxzyxzyxzyxzyx\") == True\n assert candidate(s1 = \"mississippi\",s2 = \"ssippiimis\") == False\n assert candidate(s1 = \"aabbbccc\",s2 = \"cccbbbaaabbbcccaabb\") == True\n assert candidate(s1 = \"xyz\",s2 = \"zyxwvutsrqponmlkjihgfedcba\") == True\n assert candidate(s1 = \"abcdefg\",s2 = \"zyxwvutsrqponmlkjihgfedcba\") == True\n assert candidate(s1 = \"permutationexample\",s2 = \"xamplepermutation\") == False\n assert candidate(s1 = \"substring\",s2 = \"ggnirtsabcd\") == False\n assert candidate(s1 = \"abcdefgh\",s2 = \"hgfedcbaijkl\") == True\n assert candidate(s1 = \"abacabadabacaba\",s2 = \"badacababacabadaba\") == True\n assert candidate(s1 = \"characters\",s2 = \"tcsrhaec\") == False\n assert candidate(s1 = \"longerstring\",s2 = \"stringlongeron\") == True\n assert candidate(s1 = \"aabbcc\",s2 = \"baccab\") == True\n"}, "metadata": {"canonical_parameter_names": ["s1", "s2"], "leetcode_dataset_entry_point": "Solution().checkInclusion", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var checkInclusion = function(s1, s2) {", "container": null, "callable": "checkInclusion", "parameters": [{"name": "s1", "type": "string"}, {"name": "s2", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 572, "task_id": "subtree-of-another-tree", "difficulty": "Easy", "problem_description": "Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise.\nA subtree of a binary tree tree is a tree that consists of a node in tree and all of this node's descendants. The tree tree could also be considered as a subtree of itself.\n \nExample 1:\n\n\nInput: root = [3,4,5,1,2], subRoot = [4,1,2]\nOutput: true\n\nExample 2:\n\n\nInput: root = [3,4,5,1,2,null,null,null,null,0], subRoot = [4,1,2]\nOutput: false\n\n \nConstraints:\n\nThe number of nodes in the root tree is in the range [1, 2000].\nThe number of nodes in the subRoot tree is in the range [1, 1000].\n-104 <= root.val <= 104\n-104 <= subRoot.val <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([3, 4, 5, 1, 2]),subRoot = tree_node([4, 1, 2])) == True\n assert candidate(root = tree_node([1, 2, 3]),subRoot = tree_node([1, 2])) == False\n assert candidate(root = tree_node([3, 4, 5, 1, 2, None, None, None, None, 0]),subRoot = tree_node([4, 1, 2])) == False\n assert candidate(root = tree_node([1, None, 2, None, 3]),subRoot = tree_node([2, None, 3])) == True\n assert candidate(root = tree_node([1]),subRoot = tree_node([1])) == True\n assert candidate(root = tree_node([1]),subRoot = tree_node([2])) == False\n assert candidate(root = tree_node([1, 2, 1]),subRoot = tree_node([2])) == True\n assert candidate(root = tree_node([1, 2, 3]),subRoot = tree_node([2])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([2, 4, 5, 8, 9, 10, 11])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),subRoot = tree_node([10, 16, 17])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([5, 10, 11])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([9, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([13])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([3, 7, 10])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([1, None, 2, None, 3, None, 4, None, 5])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([3, 6, 7])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]),subRoot = tree_node([3, 6, 9, 12, 15, 18, 21, 24, 27, 30])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, None, None, 11, 12, None, None, 13, None, 14, None, 15, 16, 17, None, None, 18, None, None, 19, None, None, 20]),subRoot = tree_node([10, 11, 12, 13, 14, None, 15, 16, 17, None, None, 18, None, None, 19, None, None, 20])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([15])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([5, 9, 12])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, 16, 17]),subRoot = tree_node([12, 16, 17])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, None, None, 31, 32]),subRoot = tree_node([31, 32])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([7, 11, 14])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([2, 5])) == False\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8]),subRoot = tree_node([3, None, 5, None, 7, None, 8])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, None, 7, 8, 9, 10]),subRoot = tree_node([5, 7, 8])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([1, 2])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),subRoot = tree_node([8, 16, 17])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7]),subRoot = tree_node([4, 6, 7])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([7, 14, 15])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]),subRoot = tree_node([13, 25, 26, 29, 30])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, None, 12, None, None, 13]),subRoot = tree_node([6, 7, None, 12])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([6, 12, 13])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]),subRoot = tree_node([1, None, 2, None, 3, None, 4])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([4, 8, 9])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]),subRoot = tree_node([3, 4, 5])) == False\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8]),subRoot = tree_node([2, None, 3, None, 4, None, 5])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([10, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([6, 10, 13])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]),subRoot = tree_node([32])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),subRoot = tree_node([10, 11, 12])) == False\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),subRoot = tree_node([5, 3, 7])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, 7, None, None, None, None, None, 8]),subRoot = tree_node([4, 7, 8])) == False\n assert candidate(root = tree_node([3, 4, 5, 1, 2, None, None, None, None, 0, 0]),subRoot = tree_node([4, 1, 2, None, 0])) == False\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),subRoot = tree_node([15, None, 18])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([1, 2, 3, 4, 5, 6, 7])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, None, None, 11, 12, None, None, 13, None, 14, None, 15]),subRoot = tree_node([3, 6, 7, 11, 12, None, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9]),subRoot = tree_node([3, 6, 7, None, None, 8, 9])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, 8, 9, 10, 11]),subRoot = tree_node([4, None, None, 8, 9])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([3, 6, 7, 12, 13, 14, 15])) == True\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5]),subRoot = tree_node([3, None, 4])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([4, 8, 9, 10, 11])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, 8, 9, 10, None, None, None, None, 11, 12, 13, 14, None, None, None, None, 15]),subRoot = tree_node([6, 10, 11, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, None, None, 11, 12, None, None, 13, None, 14, None, 15, 16, 17, None, None, 18, None, None, 19, None, None, 20]),subRoot = tree_node([4, 8, 9, 10, 11, None, None, 12, 13, None, 14])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),subRoot = tree_node([21])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, None, None, 11, 12, None, None, 13, None, 14, None, 15, 16, 17, None, None, 18, None, None, 19, None, None, 20]),subRoot = tree_node([16, 18, 19])) == False\n assert candidate(root = tree_node([1, 2, 1, 3, None, None, 1, 4, None, None, 5]),subRoot = tree_node([1, 4, None, None, 5])) == False\n assert candidate(root = tree_node([3, 4, 5, 1, 2, 6, 7, 8, 9, 10, 11, None, None, 12, 13, None, None, 14, None, 15]),subRoot = tree_node([1, 8, 9, 14])) == False\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9]),subRoot = tree_node([3, None, 4, None, 5])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]),subRoot = tree_node([2, 5, 8, 11, 14, 17, 20, 23, 26, 29])) == False\n assert candidate(root = tree_node([3, 4, 5, 1, 2, None, None, None, None, 0, -1]),subRoot = tree_node([4, 1, 2, None, None, 0])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([11])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([16, 17, 18])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([10])) == True\n assert candidate(root = tree_node([5, 1, 4, None, None, 3, 6]),subRoot = tree_node([4, 3, 6])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]),subRoot = tree_node([6, 12, 13])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([8])) == True\n assert candidate(root = tree_node([10, 1, 10, 1, None, 10, None, 1, None, 1, 1, None, 1, None, None, 1]),subRoot = tree_node([10, 1, 1])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([7])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, None, None, None, None, None, 28, 29]),subRoot = tree_node([14, 28, 29])) == False\n assert candidate(root = tree_node([10, 11, 12, 13, 14, 15, 16, None, None, None, None, 17, 18, 19, 20]),subRoot = tree_node([15, 17, 18])) == True\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8]),subRoot = tree_node([3, None, 4, None, 5])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]),subRoot = tree_node([5, 10, 11, 20, 21])) == False\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10]),subRoot = tree_node([5, None, 6, None, 7, None, 8, None, 9])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([3])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([2, 4, 5, 8, 9])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, 8, 9, 10, None, None, 11, 12]),subRoot = tree_node([7, 11, 12])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]),subRoot = tree_node([15, 26, 27, 28, 29, 30])) == False\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6]),subRoot = tree_node([10, 15, 18])) == False\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),subRoot = tree_node([1, 1, 1, 1, 1])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([3, 6, 7, 12, 13])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([12])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([2, 4, 5])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([5])) == False\n assert candidate(root = tree_node([1, 2, 1, 2, None, 2, None, 2]),subRoot = tree_node([2, 2])) == True\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),subRoot = tree_node([3, 7])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]),subRoot = tree_node([5, 8, 11, 14, 17, 20, 23, 26, 29, 32])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),subRoot = tree_node([3, 6, 7])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, None, 7, 8]),subRoot = tree_node([4, None, 5])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([10, 20, 30])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, None, None, None, None, 26, 27]),subRoot = tree_node([10, 20, None, 26, 27])) == False\n assert candidate(root = tree_node([1, 2, 1, None, 2, None, 2, 2, None, 2]),subRoot = tree_node([2, 2, 2])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),subRoot = tree_node([15, 16, 17, 18, 19, 20])) == False\n assert candidate(root = tree_node([10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]),subRoot = tree_node([15, 21, 22])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),subRoot = tree_node([1])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([1])) == False\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),subRoot = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([3, 6, 8])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]),subRoot = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([9])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, 16, 17, 18, 19, 20]),subRoot = tree_node([2, None, 3])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([2, 4])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([2, 3])) == False\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6]),subRoot = tree_node([3, None, 4])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([1, 2, 3])) == False\n assert candidate(root = tree_node([5, 4, 5, 4, 5, 4, 5, None, None, None, None, None, None, 4, 5]),subRoot = tree_node([4, 5])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),subRoot = tree_node([15, 16, 17, 18, 19])) == False\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7]),subRoot = tree_node([3, None, 4])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([8, 12, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, None, None, None, None, None, 21, 22]),subRoot = tree_node([21, 22])) == False\n assert candidate(root = tree_node([3, 4, 5, 1, 2, None, None, 0, 1, None, None, None, 2]),subRoot = tree_node([4, 0, 1, None, None, 2])) == False\n assert candidate(root = tree_node([5, 1, 4, None, None, 3, 6, 2]),subRoot = tree_node([3, 2])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]),subRoot = tree_node([4, 7, 10, 13, 16, 19, 22, 25, 28, 31])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([3, 6, 9])) == False\n assert candidate(root = tree_node([10, 20, 30, 40, 50, 60, 70, None, 80, 90, None, 100, None, 110, 120]),subRoot = tree_node([20, 40, 50, None, 80, 90])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([6, 12, 13, 14])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([14])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, 7, None, None, 8, 9]),subRoot = tree_node([4, 7])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([4, 8, 11])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, None, 12, None, None, 13, 14, 15]),subRoot = tree_node([4, 8, 9, 10, 11])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),subRoot = tree_node([4, 8, 9, 16, 17])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),subRoot = tree_node([5, 10, 11])) == False\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5]),subRoot = tree_node([3, None, 5])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, 8, 9]),subRoot = tree_node([4, 8, 9])) == True\n assert candidate(root = tree_node([5, 1, 5, None, None, 5, 5, None, None, 5, 5, None, None, 5]),subRoot = tree_node([5, 5])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, None, None, 11, 12, None, None, 13, None, 14, None, 15, 16, 17, None, None, 18, None, None, 19, None, None, 20]),subRoot = tree_node([6, 12, 15, 18, 20])) == False\n"}, "metadata": {"canonical_parameter_names": ["root", "subRoot"], "leetcode_dataset_entry_point": "Solution().isSubtree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isSubtree = function(root, subRoot) {", "container": null, "callable": "isSubtree", "parameters": [{"name": "root", "type": "TreeNode"}, {"name": "subRoot", "type": "TreeNode"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 575, "task_id": "distribute-candies", "difficulty": "Easy", "problem_description": "Alice has n candies, where the ith candy is of type candyType[i]. Alice noticed that she started to gain weight, so she visited a doctor.\nThe doctor advised Alice to only eat n / 2 of the candies she has (n is always even). Alice likes her candies very much, and she wants to eat the maximum number of different types of candies while still following the doctor's advice.\nGiven the integer array candyType of length n, return the maximum number of different types of candies she can eat if she only eats n / 2 of them.\n \nExample 1:\n\nInput: candyType = [1,1,2,2,3,3]\nOutput: 3\nExplanation: Alice can only eat 6 / 2 = 3 candies. Since there are only 3 types, she can eat one of each type.\n\nExample 2:\n\nInput: candyType = [1,1,2,3]\nOutput: 2\nExplanation: Alice can only eat 4 / 2 = 2 candies. Whether she eats types [1,2], [1,3], or [2,3], she still can only eat 2 different types.\n\nExample 3:\n\nInput: candyType = [6,6,6,6]\nOutput: 1\nExplanation: Alice can only eat 4 / 2 = 2 candies. Even though she can eat 2 candies, she only has 1 type.\n\n \nConstraints:\n\nn == candyType.length\n2 <= n <= 104\nn is even.\n-105 <= candyType[i] <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(candyType = [1, 2, 1, 3, 1, 2, 1, 3, 1, 2]) == 3\n assert candidate(candyType = [1, 1, 2, 3]) == 2\n assert candidate(candyType = [1, 1, 1, 2, 2, 2]) == 2\n assert candidate(candyType = [0, 0, 0, 0, 0, 0]) == 1\n assert candidate(candyType = [100000, 100000, -100000, -100000, 50000, 50000]) == 3\n assert candidate(candyType = [-1, -2, -3, -1, -2, -3]) == 3\n assert candidate(candyType = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1]) == 3\n assert candidate(candyType = [1, 2, 3, 1, 2, 3]) == 3\n assert candidate(candyType = [-1, -1, 0, 0, 1, 1]) == 3\n assert candidate(candyType = [100000, -100000, 100000, -100000, 100000, -100000]) == 2\n assert candidate(candyType = [1, 2, 3, 4]) == 2\n assert candidate(candyType = [1, 2, 3, 4, 5, 6]) == 3\n assert candidate(candyType = [1, 2, 1, 2, 1, 2]) == 2\n assert candidate(candyType = [-1, -2, -3, -4, -5, -6]) == 3\n assert candidate(candyType = [1, 1, 2, 2, 3, 3]) == 3\n assert candidate(candyType = [100000, -100000, 100000, -100000, 0, 0]) == 3\n assert candidate(candyType = [6, 6, 6, 6]) == 1\n assert candidate(candyType = [1, 1, 1, 1, 2, 2, 2, 2]) == 2\n assert candidate(candyType = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4]) == 4\n assert candidate(candyType = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11]) == 11\n assert candidate(candyType = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 25\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 1, 1, 1, 2, 2, 2]) == 20\n assert candidate(candyType = [-1, -2, -2, -3, -3, -4, -4, -4, -5, -5, -5, -5, -6, -6, -7, -7, -7, -7, -8, -8]) == 8\n assert candidate(candyType = [-100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 2\n assert candidate(candyType = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20]) == 20\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 15\n assert candidate(candyType = [-50000, 50000, -49999, 49999, -49998, 49998, -49997, 49997, -49996, 49996, -49995, 49995, -49994, 49994, -49993, 49993, -49992, 49992, -49991, 49991]) == 10\n assert candidate(candyType = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 2\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(candyType = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 2\n assert candidate(candyType = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4]) == 4\n assert candidate(candyType = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 1, 1, 1, 2, 2, 2, 3, 3, 3]) == 10\n assert candidate(candyType = [-50000, -49999, -49998, -49997, -49996, -49995, -49994, -49993, -49992, -49991, 50000, 49999, 49998, 49997, 49996, 49995, 49994, 49993, 49992, 49991]) == 10\n assert candidate(candyType = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 10\n assert candidate(candyType = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18]) == 18\n assert candidate(candyType = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 2\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(candyType = [-50000, 50000, -40000, 40000, -30000, 30000, -20000, 20000, -10000, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 10\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 15\n assert candidate(candyType = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(candyType = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 12\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11]) == 11\n assert candidate(candyType = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 1\n assert candidate(candyType = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 20000, 20000, 20000, 20000, 20000, 20000, 20000, 20000, 20000, 20000]) == 2\n assert candidate(candyType = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19]) == 19\n assert candidate(candyType = [-50000, -49999, -49998, -49997, 49998, 49999, 50000, 50001, 50002, 50003]) == 5\n assert candidate(candyType = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 15\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(candyType = [10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 50, 50, 50, 50, 50, 50]) == 5\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2]) == 10\n assert candidate(candyType = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == 6\n assert candidate(candyType = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19]) == 19\n assert candidate(candyType = [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4]) == 4\n assert candidate(candyType = [100, 200, 300, 400, 500, 100, 200, 300, 400, 500, 100, 200, 300, 400, 500, 100, 200, 300, 400, 500, 100, 200, 300, 400, 500, 100, 200, 300, 400, 500, 100, 200, 300, 400, 500]) == 5\n assert candidate(candyType = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8]) == 8\n assert candidate(candyType = [100000, 99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(candyType = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 25\n assert candidate(candyType = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 2\n assert candidate(candyType = [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 2\n assert candidate(candyType = [10000, 20000, 30000, 40000, 50000, 10000, 20000, 30000, 40000, 50000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 15\n assert candidate(candyType = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40]) == 4\n assert candidate(candyType = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16]) == 16\n assert candidate(candyType = [-50000, -40000, -30000, -20000, -10000, 0, 10000, 20000, 30000, 40000, 50000, -50000, -40000, -30000, -20000, -10000, 0, 10000, 20000, 30000, 40000]) == 10\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == 20\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 10\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20]) == 18\n assert candidate(candyType = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30]) == 30\n assert candidate(candyType = [50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000, 50001, 50001, 50001, 50001, 50001, 50001, 50001, 50001, 50001, 50001]) == 2\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(candyType = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == 4\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]) == 16\n assert candidate(candyType = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6]) == 7\n assert candidate(candyType = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 4\n assert candidate(candyType = [-1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6, -7, -7, -8, -8, -9, -9, -10, -10, -11, -11, -12, -12, -13, -13, -14, -15]) == 14\n assert candidate(candyType = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]) == 15\n assert candidate(candyType = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5]) == 5\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 15\n assert candidate(candyType = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8]) == 8\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 20\n assert candidate(candyType = [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 12\n assert candidate(candyType = [-100000, -99999, -99998, -99997, -99996, -99995, -99994, -99993, -99992, -99991, -99990, -99989, -99988, -99987, -99986, -99985, -99984, -99983, -99982, -99981, -99980, -99979, -99978, -99977, -99976, -99975, -99974, -99973, -99972, -99971, -99970, -99969, -99968, -99967, -99966, -99965]) == 18\n assert candidate(candyType = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8]) == 8\n assert candidate(candyType = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10]) == 10\n assert candidate(candyType = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15]) == 14\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(candyType = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 2\n assert candidate(candyType = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6]) == 6\n assert candidate(candyType = [99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991, 99990, 99989, 99988, 99987, 99986, 99985, 99984, 99983, 99982, 99981, 99980, 99979, 99978, 99977, 99976, 99975, 99974, 99973, 99972, 99971, 99970]) == 15\n assert candidate(candyType = [1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8]) == 8\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 10\n assert candidate(candyType = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15]) == 15\n assert candidate(candyType = [-50000, -50000, -50000, -50000, -50000, -50000, -50000, -50000, -50000, -50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000]) == 2\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 20\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 15\n assert candidate(candyType = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 2\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(candyType = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 3\n assert candidate(candyType = [10, 10, 10, 10, 20, 20, 20, 20, 30, 30, 30, 30, 40, 40, 40, 40, 50, 50, 50, 50, 60, 60, 60, 60, 70, 70, 70, 70, 80, 80, 80, 80, 90, 90, 90, 90]) == 9\n assert candidate(candyType = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14]) == 14\n assert candidate(candyType = [10000, 10000, 9999, 9999, 8888, 8888, 7777, 7777, 6666, 6666, 5555, 5555, 4444, 4444, 3333, 3333, 2222, 2222, 1111, 1111]) == 10\n assert candidate(candyType = [1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 9\n assert candidate(candyType = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 5\n assert candidate(candyType = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8]) == 8\n assert candidate(candyType = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 15\n assert candidate(candyType = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 3\n"}, "metadata": {"canonical_parameter_names": ["candyType"], "leetcode_dataset_entry_point": "Solution().distributeCandies", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var distributeCandies = function(candyType) {", "container": null, "callable": "distributeCandies", "parameters": [{"name": "candyType", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 576, "task_id": "out-of-boundary-paths", "difficulty": "Medium", "problem_description": "There is an m x n grid with a ball. The ball is initially at the position [startRow, startColumn]. You are allowed to move the ball to one of the four adjacent cells in the grid (possibly out of the grid crossing the grid boundary). You can apply at most maxMove moves to the ball.\nGiven the five integers m, n, maxMove, startRow, startColumn, return the number of paths to move the ball out of the grid boundary. Since the answer can be very large, return it modulo 109 + 7.\n \nExample 1:\n\n\nInput: m = 2, n = 2, maxMove = 2, startRow = 0, startColumn = 0\nOutput: 6\n\nExample 2:\n\n\nInput: m = 1, n = 3, maxMove = 3, startRow = 0, startColumn = 1\nOutput: 12\n\n \nConstraints:\n\n1 <= m, n <= 50\n0 <= maxMove <= 50\n0 <= startRow < m\n0 <= startColumn < n\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(m = 3,n = 3,maxMove = 1,startRow = 1,startColumn = 1) == 0\n assert candidate(m = 5,n = 5,maxMove = 50,startRow = 0,startColumn = 0) == 101070018\n assert candidate(m = 2,n = 2,maxMove = 2,startRow = 0,startColumn = 0) == 6\n assert candidate(m = 3,n = 3,maxMove = 0,startRow = 1,startColumn = 1) == 0\n assert candidate(m = 4,n = 4,maxMove = 0,startRow = 2,startColumn = 2) == 0\n assert candidate(m = 50,n = 50,maxMove = 0,startRow = 25,startColumn = 25) == 0\n assert candidate(m = 5,n = 5,maxMove = 0,startRow = 2,startColumn = 2) == 0\n assert candidate(m = 5,n = 5,maxMove = 10,startRow = 3,startColumn = 3) == 60322\n assert candidate(m = 50,n = 50,maxMove = 50,startRow = 25,startColumn = 25) == 276775132\n assert candidate(m = 5,n = 5,maxMove = 10,startRow = 2,startColumn = 2) == 79840\n assert candidate(m = 4,n = 4,maxMove = 1,startRow = 3,startColumn = 3) == 2\n assert candidate(m = 50,n = 50,maxMove = 50,startRow = 0,startColumn = 0) == 678188903\n assert candidate(m = 1,n = 3,maxMove = 3,startRow = 0,startColumn = 1) == 12\n assert candidate(m = 35,n = 35,maxMove = 35,startRow = 0,startColumn = 0) == 358207093\n assert candidate(m = 1,n = 1,maxMove = 50,startRow = 0,startColumn = 0) == 4\n assert candidate(m = 50,n = 50,maxMove = 20,startRow = 49,startColumn = 49) == 333389522\n assert candidate(m = 50,n = 50,maxMove = 1,startRow = 0,startColumn = 49) == 2\n assert candidate(m = 20,n = 20,maxMove = 10,startRow = 19,startColumn = 19) == 15604\n assert candidate(m = 25,n = 15,maxMove = 20,startRow = 12,startColumn = 7) == 799973369\n assert candidate(m = 25,n = 25,maxMove = 0,startRow = 12,startColumn = 12) == 0\n assert candidate(m = 30,n = 25,maxMove = 40,startRow = 5,startColumn = 10) == 292121032\n assert candidate(m = 10,n = 10,maxMove = 50,startRow = 9,startColumn = 9) == 788744843\n assert candidate(m = 50,n = 50,maxMove = 1,startRow = 49,startColumn = 0) == 2\n assert candidate(m = 40,n = 35,maxMove = 40,startRow = 20,startColumn = 17) == 678045061\n assert candidate(m = 30,n = 30,maxMove = 30,startRow = 15,startColumn = 15) == 358636530\n assert candidate(m = 35,n = 40,maxMove = 35,startRow = 17,startColumn = 20) == 82874982\n assert candidate(m = 40,n = 40,maxMove = 40,startRow = 35,startColumn = 35) == 925966983\n assert candidate(m = 50,n = 50,maxMove = 50,startRow = 48,startColumn = 48) == 33289482\n assert candidate(m = 30,n = 30,maxMove = 25,startRow = 15,startColumn = 15) == 620611776\n assert candidate(m = 20,n = 20,maxMove = 30,startRow = 0,startColumn = 0) == 698347833\n assert candidate(m = 25,n = 15,maxMove = 35,startRow = 12,startColumn = 7) == 700136042\n assert candidate(m = 45,n = 50,maxMove = 35,startRow = 20,startColumn = 25) == 165784279\n assert candidate(m = 30,n = 30,maxMove = 40,startRow = 10,startColumn = 10) == 10338089\n assert candidate(m = 25,n = 25,maxMove = 50,startRow = 10,startColumn = 10) == 763033703\n assert candidate(m = 1,n = 10,maxMove = 20,startRow = 0,startColumn = 5) == 1298133\n assert candidate(m = 10,n = 10,maxMove = 30,startRow = 9,startColumn = 0) == 362344847\n assert candidate(m = 35,n = 25,maxMove = 50,startRow = 17,startColumn = 12) == 801609655\n assert candidate(m = 10,n = 10,maxMove = 1,startRow = 9,startColumn = 0) == 2\n assert candidate(m = 49,n = 49,maxMove = 49,startRow = 24,startColumn = 24) == 205299836\n assert candidate(m = 40,n = 40,maxMove = 15,startRow = 39,startColumn = 39) == 7622962\n assert candidate(m = 30,n = 30,maxMove = 25,startRow = 10,startColumn = 15) == 789398028\n assert candidate(m = 10,n = 10,maxMove = 50,startRow = 0,startColumn = 0) == 788744843\n assert candidate(m = 40,n = 30,maxMove = 45,startRow = 15,startColumn = 10) == 919089617\n assert candidate(m = 45,n = 45,maxMove = 45,startRow = 22,startColumn = 22) == 988297120\n assert candidate(m = 30,n = 30,maxMove = 30,startRow = 0,startColumn = 29) == 30862686\n assert candidate(m = 40,n = 40,maxMove = 30,startRow = 0,startColumn = 0) == 30862684\n assert candidate(m = 20,n = 20,maxMove = 49,startRow = 19,startColumn = 19) == 935890565\n assert candidate(m = 20,n = 20,maxMove = 30,startRow = 5,startColumn = 10) == 952018589\n assert candidate(m = 25,n = 25,maxMove = 25,startRow = 0,startColumn = 12) == 973636948\n assert candidate(m = 45,n = 45,maxMove = 20,startRow = 0,startColumn = 0) == 333389522\n assert candidate(m = 10,n = 10,maxMove = 50,startRow = 5,startColumn = 5) == 910802827\n assert candidate(m = 35,n = 45,maxMove = 20,startRow = 15,startColumn = 20) == 80810\n assert candidate(m = 50,n = 50,maxMove = 2,startRow = 48,startColumn = 48) == 2\n assert candidate(m = 50,n = 1,maxMove = 25,startRow = 25,startColumn = 0) == 67108863\n assert candidate(m = 45,n = 45,maxMove = 20,startRow = 35,startColumn = 35) == 60375025\n assert candidate(m = 30,n = 30,maxMove = 30,startRow = 5,startColumn = 5) == 571485704\n assert candidate(m = 20,n = 40,maxMove = 40,startRow = 5,startColumn = 20) == 992621451\n assert candidate(m = 50,n = 50,maxMove = 50,startRow = 1,startColumn = 1) == 33289482\n assert candidate(m = 50,n = 45,maxMove = 40,startRow = 25,startColumn = 20) == 461095502\n assert candidate(m = 40,n = 40,maxMove = 40,startRow = 10,startColumn = 10) == 119337015\n assert candidate(m = 20,n = 20,maxMove = 10,startRow = 0,startColumn = 0) == 15604\n assert candidate(m = 10,n = 10,maxMove = 45,startRow = 0,startColumn = 5) == 633319298\n assert candidate(m = 35,n = 35,maxMove = 20,startRow = 17,startColumn = 17) == 2956\n assert candidate(m = 20,n = 10,maxMove = 30,startRow = 10,startColumn = 5) == 233153742\n assert candidate(m = 15,n = 15,maxMove = 20,startRow = 0,startColumn = 14) == 333735544\n assert candidate(m = 20,n = 20,maxMove = 1,startRow = 10,startColumn = 10) == 0\n assert candidate(m = 30,n = 30,maxMove = 40,startRow = 5,startColumn = 5) == 232430931\n assert candidate(m = 20,n = 20,maxMove = 15,startRow = 10,startColumn = 10) == 269698\n assert candidate(m = 50,n = 50,maxMove = 0,startRow = 0,startColumn = 0) == 0\n assert candidate(m = 25,n = 20,maxMove = 40,startRow = 12,startColumn = 8) == 753298275\n assert candidate(m = 10,n = 10,maxMove = 0,startRow = 5,startColumn = 5) == 0\n assert candidate(m = 25,n = 25,maxMove = 50,startRow = 24,startColumn = 24) == 310332047\n assert candidate(m = 25,n = 25,maxMove = 25,startRow = 12,startColumn = 12) == 708832804\n assert candidate(m = 40,n = 40,maxMove = 30,startRow = 20,startColumn = 20) == 405303029\n assert candidate(m = 40,n = 50,maxMove = 20,startRow = 20,startColumn = 30) == 2\n assert candidate(m = 10,n = 10,maxMove = 1,startRow = 0,startColumn = 0) == 2\n assert candidate(m = 15,n = 25,maxMove = 20,startRow = 7,startColumn = 12) == 799973369\n assert candidate(m = 50,n = 50,maxMove = 1,startRow = 0,startColumn = 0) == 2\n assert candidate(m = 50,n = 50,maxMove = 1,startRow = 25,startColumn = 25) == 0\n assert candidate(m = 30,n = 30,maxMove = 15,startRow = 15,startColumn = 15) == 2\n assert candidate(m = 10,n = 10,maxMove = 45,startRow = 0,startColumn = 0) == 200206745\n assert candidate(m = 20,n = 20,maxMove = 10,startRow = 0,startColumn = 19) == 15604\n assert candidate(m = 15,n = 20,maxMove = 25,startRow = 7,startColumn = 10) == 525013044\n assert candidate(m = 50,n = 1,maxMove = 50,startRow = 25,startColumn = 0) == 163591967\n assert candidate(m = 25,n = 25,maxMove = 50,startRow = 12,startColumn = 12) == 15238035\n assert candidate(m = 35,n = 40,maxMove = 30,startRow = 0,startColumn = 0) == 30862684\n assert candidate(m = 10,n = 1,maxMove = 20,startRow = 5,startColumn = 0) == 1298133\n assert candidate(m = 10,n = 20,maxMove = 25,startRow = 5,startColumn = 10) == 642758144\n assert candidate(m = 20,n = 20,maxMove = 50,startRow = 10,startColumn = 10) == 46531996\n assert candidate(m = 50,n = 50,maxMove = 50,startRow = 49,startColumn = 49) == 678188903\n assert candidate(m = 40,n = 40,maxMove = 40,startRow = 15,startColumn = 15) == 199335553\n assert candidate(m = 40,n = 40,maxMove = 50,startRow = 0,startColumn = 0) == 945208311\n assert candidate(m = 45,n = 45,maxMove = 30,startRow = 20,startColumn = 20) == 875006271\n assert candidate(m = 40,n = 15,maxMove = 40,startRow = 39,startColumn = 7) == 407032675\n assert candidate(m = 15,n = 25,maxMove = 35,startRow = 7,startColumn = 17) == 582434371\n assert candidate(m = 20,n = 20,maxMove = 10,startRow = 19,startColumn = 0) == 15604\n assert candidate(m = 10,n = 10,maxMove = 1,startRow = 0,startColumn = 9) == 2\n assert candidate(m = 1,n = 50,maxMove = 50,startRow = 0,startColumn = 25) == 163591967\n assert candidate(m = 2,n = 2,maxMove = 5,startRow = 1,startColumn = 1) == 62\n assert candidate(m = 45,n = 45,maxMove = 45,startRow = 0,startColumn = 0) == 731907496\n assert candidate(m = 30,n = 30,maxMove = 30,startRow = 10,startColumn = 10) == 131872750\n assert candidate(m = 25,n = 30,maxMove = 35,startRow = 12,startColumn = 15) == 262708332\n assert candidate(m = 30,n = 30,maxMove = 1,startRow = 15,startColumn = 15) == 0\n assert candidate(m = 40,n = 40,maxMove = 40,startRow = 19,startColumn = 19) == 751858492\n assert candidate(m = 45,n = 45,maxMove = 25,startRow = 22,startColumn = 22) == 4696\n assert candidate(m = 45,n = 35,maxMove = 20,startRow = 20,startColumn = 15) == 80810\n assert candidate(m = 40,n = 20,maxMove = 45,startRow = 10,startColumn = 10) == 157535529\n assert candidate(m = 50,n = 50,maxMove = 40,startRow = 25,startColumn = 25) == 783748412\n assert candidate(m = 50,n = 50,maxMove = 20,startRow = 45,startColumn = 45) == 888027161\n assert candidate(m = 40,n = 40,maxMove = 50,startRow = 39,startColumn = 39) == 945208311\n assert candidate(m = 1,n = 50,maxMove = 25,startRow = 0,startColumn = 25) == 67108863\n assert candidate(m = 10,n = 10,maxMove = 1,startRow = 9,startColumn = 9) == 2\n assert candidate(m = 10,n = 10,maxMove = 20,startRow = 5,startColumn = 5) == 277211170\n assert candidate(m = 50,n = 50,maxMove = 1,startRow = 49,startColumn = 49) == 2\n assert candidate(m = 45,n = 45,maxMove = 10,startRow = 22,startColumn = 22) == 0\n assert candidate(m = 45,n = 45,maxMove = 45,startRow = 44,startColumn = 44) == 731907496\n assert candidate(m = 35,n = 35,maxMove = 50,startRow = 17,startColumn = 17) == 350241059\n"}, "metadata": {"canonical_parameter_names": ["m", "n", "maxMove", "startRow", "startColumn"], "leetcode_dataset_entry_point": "Solution().findPaths", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findPaths = function(m, n, maxMove, startRow, startColumn) {", "container": null, "callable": "findPaths", "parameters": [{"name": "m", "type": "number"}, {"name": "n", "type": "number"}, {"name": "maxMove", "type": "number"}, {"name": "startRow", "type": "number"}, {"name": "startColumn", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 581, "task_id": "shortest-unsorted-continuous-subarray", "difficulty": "Medium", "problem_description": "Given an integer array nums, you need to find one continuous subarray such that if you only sort this subarray in non-decreasing order, then the whole array will be sorted in non-decreasing order.\nReturn the shortest such subarray and output its length.\n \nExample 1:\n\nInput: nums = [2,6,4,8,10,9,15]\nOutput: 5\nExplanation: You need to sort [6, 4, 8, 10, 9] in ascending order to make the whole array sorted in ascending order.\n\nExample 2:\n\nInput: nums = [1,2,3,4]\nOutput: 0\n\nExample 3:\n\nInput: nums = [1]\nOutput: 0\n\n \nConstraints:\n\n1 <= nums.length <= 104\n-105 <= nums[i] <= 105\n\n \nFollow up: Can you solve it in O(n) time complexity?", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 2, 4, 5]) == 2\n assert candidate(nums = [1, 2, 3, 5, 4]) == 2\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(nums = [1]) == 0\n assert candidate(nums = [1, 2, 3, 4, 3, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(nums = [1, 2, 3, 4]) == 0\n assert candidate(nums = [1, 3, 5, 2, 4, 6, 7]) == 4\n assert candidate(nums = [1, 2, 5, 4, 3]) == 3\n assert candidate(nums = [1, 2, 4, 3, 5]) == 2\n assert candidate(nums = [1, 3, 2, 2, 2]) == 4\n assert candidate(nums = [1, 3, 5, 4, 2, 6]) == 4\n assert candidate(nums = [1, 3, 2, 0, 5]) == 4\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 11\n assert candidate(nums = [10, 9, 8, 7, 6]) == 5\n assert candidate(nums = [2, 6, 4, 8, 10, 9, 15]) == 5\n assert candidate(nums = [1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1]) == 13\n assert candidate(nums = [5, 6, 3, 4, 8]) == 4\n assert candidate(nums = [2, 3, 3, 2, 4]) == 3\n assert candidate(nums = [2, 1, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(nums = [1, 3, 5, 4, 2]) == 4\n assert candidate(nums = [3, 2, 1]) == 3\n assert candidate(nums = [1, 3, 2, 3, 3]) == 2\n assert candidate(nums = [5, 4, 3, 2, 1]) == 5\n assert candidate(nums = [1, 2, 4, 3, 5, 6, 7]) == 2\n assert candidate(nums = [1, 3, 5, 2, 4]) == 4\n assert candidate(nums = [1, 2, 3, 3, 3]) == 0\n assert candidate(nums = [1, 2, 0, 4, 5]) == 3\n assert candidate(nums = [1, 2, 4, 5, 3]) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 16\n assert candidate(nums = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 17]) == 16\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 1]) == 11\n assert candidate(nums = [1, 2, 3, 10, 5, 6, 7, 8, 9, 4]) == 7\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4]) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 1]) == 23\n assert candidate(nums = [1, 9, 10, 3, 4, 5, 2, 7, 6, 8]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 21, 22]) == 20\n assert candidate(nums = [1, 9, 10, 3, 4, 5, 2, 6, 7, 8]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 18\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 9, 8, 10]) == 2\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(nums = [1, 9, 10, 3, 4, 2, 6, 5, 7, 8]) == 9\n assert candidate(nums = [1, 3, 5, 4, 2, 6, 7, 8, 9, 10, 11, 12]) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 3\n assert candidate(nums = [1, 2, 10, 9, 8, 7, 6, 5, 4, 3, 2]) == 9\n assert candidate(nums = [1, 3, 5, 2, 4, 6, 8, 7, 10, 9, 11]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 10, 9, 8, 3]) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 10, 9, 8, 7, 11]) == 4\n assert candidate(nums = [100, 200, 300, 400, 10, 50, 60, 70, 80, 90]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 1]) == 28\n assert candidate(nums = [1, 3, 2, 5, 4, 6, 8, 7, 9, 11, 10]) == 10\n assert candidate(nums = [1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(nums = [1, 9, 10, 3, 5, 4, 6, 7, 2, 9]) == 9\n assert candidate(nums = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11]) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 18\n assert candidate(nums = [1, 9, 10, 7, 6, 5, 4, 3, 2, 9]) == 9\n assert candidate(nums = [1, 10, 9, 8, 7, 6, 5, 4, 3, 2]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 1]) == 27\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 29\n assert candidate(nums = [1, 9, 2, 8, 3, 7, 4, 6, 5, 10]) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 10]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 25\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3, 2, 1]) == 12\n assert candidate(nums = [1, 9, 10, 3, 4, 5, 7, 6, 2, 9]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 10, 8, 9]) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 10, 9, 2]) == 9\n assert candidate(nums = [1, 9, 10, 5, 4, 3, 6, 7, 2, 9]) == 9\n assert candidate(nums = [1, 2, 3, 10, 9, 8, 7, 6, 5, 4, 11, 12]) == 7\n assert candidate(nums = [1, 9, 10, 3, 4, 6, 5, 7, 2, 9]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 1]) == 24\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 19]) == 2\n assert candidate(nums = [3, 2, 3, 2, 1]) == 5\n assert candidate(nums = [1, 9, 10, 3, 4, 5, 6, 2, 8, 7]) == 9\n assert candidate(nums = [1, 10, 9, 2, 3, 4, 5, 6, 7, 8]) == 9\n assert candidate(nums = [1, 5, 4, 3, 2, 6, 7, 8, 9, 10, 11]) == 4\n assert candidate(nums = [1, 2, 3, 3, 3, 3, 4, 5, 5, 6, 7, 8, 9, 10, 10, 10, 11, 10, 12]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1]) == 10\n assert candidate(nums = [1, 5, 3, 4, 2, 6, 7, 8, 9, 10]) == 4\n assert candidate(nums = [1, 9, 10, 2, 3, 5, 4, 6, 7, 8]) == 9\n assert candidate(nums = [5, 6, 3, 2, 4, 7, 8, 9, 10, 11, 12, 13]) == 5\n assert candidate(nums = [1, 9, 10, 2, 3, 4, 5, 6, 8, 7]) == 9\n assert candidate(nums = [2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 1]) == 26\n assert candidate(nums = [1, 9, 10, 6, 5, 4, 3, 7, 2, 9]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11]) == 10\n assert candidate(nums = [1, 9, 10, 3, 2, 4, 5, 6, 7, 8]) == 9\n assert candidate(nums = [5, 4, 3, 2, 1, 0]) == 6\n assert candidate(nums = [1, 9, 10, 4, 3, 5, 6, 8, 2, 9]) == 9\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 27\n assert candidate(nums = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 10\n assert candidate(nums = [1, 2, 3, 4, 10, 9, 8, 7, 6, 5, 4]) == 7\n assert candidate(nums = [5, 6, 3, 7, 8, 2, 9, 10, 11, 12]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 16]) == 15\n assert candidate(nums = [1, 2, 3, 4, 9, 10, 5, 6, 7, 8]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 16\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 29\n assert candidate(nums = [3, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 3\n assert candidate(nums = [1, 9, 10, 3, 4, 5, 6, 7, 2, 8]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 9, 10, 6, 7, 8]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5]) == 12\n assert candidate(nums = [1, 2, 3, 4, 5, 10, 9, 8, 7, 6, 5]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 1]) == 21\n assert candidate(nums = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(nums = [1, 3, 5, 4, 2, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 10, 9]) == 2\n assert candidate(nums = [1, 2, 9, 10, 3, 4, 5, 6, 7, 8]) == 8\n assert candidate(nums = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 18, 20]) == 2\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 16, 18, 19, 20]) == 2\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 21]) == 20\n assert candidate(nums = [1, 2, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(nums = [1, 9, 10, 4, 3, 5, 6, 7, 2, 9]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 14, 16, 17, 18, 19, 20]) == 2\n assert candidate(nums = [1, 3, 2, 2, 2, 5, 4, 4, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 11, 14, 13, 16, 15]) == 6\n assert candidate(nums = [1, 9, 10, 3, 4, 5, 2, 8, 7, 6]) == 9\n assert candidate(nums = [1, 2, 3, 5, 4, 6, 7, 8, 9, 10, 11, 12]) == 2\n assert candidate(nums = [1, 9, 10, 3, 4, 5, 6, 7, 2, 9]) == 9\n assert candidate(nums = [1, 9, 10, 3, 4, 5, 6, 2, 7, 8]) == 9\n assert candidate(nums = [2, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(nums = [1, 9, 10, 2, 3, 4, 5, 7, 6, 8]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3]) == 22\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 16\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 1]) == 22\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 10, 12, 13, 14, 15, 16]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [1, 9, 10, 2, 4, 3, 5, 6, 7, 8]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3]) == 12\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 28\n assert candidate(nums = [1, 2, 3, 9, 10, 4, 5, 6, 7, 8]) == 7\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 15, 17, 18, 19, 20]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 10, 9, 8, 7, 6]) == 5\n assert candidate(nums = [1, 9, 10, 3, 4, 2, 5, 6, 7, 8]) == 9\n assert candidate(nums = [1, 9, 10, 3, 2, 5, 4, 6, 7, 8]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 4, 3, 2, 1]) == 13\n assert candidate(nums = [1, 9, 10, 2, 3, 4, 5, 6, 7, 8]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 10, 9, 8, 7, 4]) == 7\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 17, 20, 21]) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 5, 4, 3, 2, 1]) == 14\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 1]) == 25\n assert candidate(nums = [1, 9, 10, 3, 4, 5, 6, 8, 2, 9]) == 9\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(nums = [1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10]) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 1]) == 29\n assert candidate(nums = [5, 6, 3, 4, 3, 8, 9, 10, 1, 12]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 17, 20]) == 3\n assert candidate(nums = [1, 2, 3, 10, 9, 8, 7, 6, 5, 4, 3]) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1]) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 9, 10, 8, 7]) == 4\n assert candidate(nums = [1, 9, 10, 2, 3, 4, 6, 5, 7, 8]) == 9\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().findUnsortedSubarray", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findUnsortedSubarray = function(nums) {", "container": null, "callable": "findUnsortedSubarray", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 583, "task_id": "delete-operation-for-two-strings", "difficulty": "Medium", "problem_description": "Given two strings word1 and word2, return the minimum number of steps required to make word1 and word2 the same.\nIn one step, you can delete exactly one character in either string.\n \nExample 1:\n\nInput: word1 = \"sea\", word2 = \"eat\"\nOutput: 2\nExplanation: You need one step to make \"sea\" to \"ea\" and another step to make \"eat\" to \"ea\".\n\nExample 2:\n\nInput: word1 = \"leetcode\", word2 = \"etco\"\nOutput: 4\n\n \nConstraints:\n\n1 <= word1.length, word2.length <= 500\nword1 and word2 consist of only lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(word1 = \"abc\",word2 = \"def\") == 6\n assert candidate(word1 = \"abcde\",word2 = \"fghij\") == 10\n assert candidate(word1 = \"abcdefghijklmnopqrstuvwxyz\",word2 = \"zyxwvutsrqponmlkjihgfedcba\") == 50\n assert candidate(word1 = \"sea\",word2 = \"eat\") == 2\n assert candidate(word1 = \"abcd\",word2 = \"dcba\") == 6\n assert candidate(word1 = \"leetcode\",word2 = \"etco\") == 4\n assert candidate(word1 = \"abc\",word2 = \"abc\") == 0\n assert candidate(word1 = \"a\",word2 = \"b\") == 2\n assert candidate(word1 = \"park\",word2 = \"spake\") == 3\n assert candidate(word1 = \"flaw\",word2 = \"lawn\") == 2\n assert candidate(word1 = \"leetcode\",word2 = \"etco\") == 4\n assert candidate(word1 = \"abcde\",word2 = \"ace\") == 2\n assert candidate(word1 = \"pneumonoultramicroscopicsilicovolcanoconiosis\",word2 = \"ultramicroscopicsilicovolcanoconiosis\") == 8\n assert candidate(word1 = \"qwertyuiop\",word2 = \"asdfghjklzxcvbnm\") == 26\n assert candidate(word1 = \"a\",word2 = \"b\") == 2\n assert candidate(word1 = \"abc\",word2 = \"abc\") == 0\n assert candidate(word1 = \"sea\",word2 = \"eat\") == 2\n assert candidate(word1 = \"a\",word2 = \"a\") == 0\n assert candidate(word1 = \"intention\",word2 = \"execution\") == 8\n assert candidate(word1 = \"abcd\",word2 = \"dcba\") == 6\n assert candidate(word1 = \"abc\",word2 = \"def\") == 6\n assert candidate(word1 = \"aabbccdd\",word2 = \"ddccbbaa\") == 12\n assert candidate(word1 = \"algorithm\",word2 = \"alligator\") == 8\n assert candidate(word1 = \"abcdabcdeabc\",word2 = \"abcdeabcdeabcd\") == 2\n assert candidate(word1 = \"mississippi\",word2 = \"pississippi\") == 2\n assert candidate(word1 = \"abcdefgh\",word2 = \"hgfedcba\") == 14\n assert candidate(word1 = \"pneumonoultramicroscopicsilicovolcanoconiosis\",word2 = \"pseudopseudohypoparathyroidism\") == 49\n assert candidate(word1 = \"interstellar\",word2 = \"interplanetary\") == 10\n assert candidate(word1 = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",word2 = \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\") == 808\n assert candidate(word1 = \"thisisalongstring\",word2 = \"thisisanotherrandomstring\") == 12\n assert candidate(word1 = \"dynamic\",word2 = \"programming\") == 12\n assert candidate(word1 = \"karolin\",word2 = \"kathrin\") == 4\n assert candidate(word1 = \"mississippi\",word2 = \"mississipi\") == 1\n assert candidate(word1 = \"abcdabcdefabcde\",word2 = \"abcde\") == 10\n assert candidate(word1 = \"hippopotomonstrosesquippedaliophobia\",word2 = \"supercalifragilisticexpialidocious\") == 50\n assert candidate(word1 = \"algorithm\",word2 = \"rhythm\") == 7\n assert candidate(word1 = \"ababababab\",word2 = \"bababababa\") == 2\n assert candidate(word1 = \"programming\",word2 = \"program\") == 4\n assert candidate(word1 = \"abacaxabayabacaxabay\",word2 = \"abayabacaxabayabacaxab\") == 6\n assert candidate(word1 = \"flibbertigibbet\",word2 = \"fribblegibbet\") == 6\n assert candidate(word1 = \"longest\",word2 = \"substring\") == 12\n assert candidate(word1 = \"flaw\",word2 = \"lawn\") == 2\n assert candidate(word1 = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",word2 = \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\") == 120\n assert candidate(word1 = \"flower\",word2 = \"flow\") == 2\n assert candidate(word1 = \"xyzxyz\",word2 = \"zyxzyx\") == 6\n assert candidate(word1 = \"abracadabra\",word2 = \"abrakadabradabra\") == 7\n assert candidate(word1 = \"aaaaa\",word2 = \"bbbbb\") == 10\n assert candidate(word1 = \"pneumonoultramicroscopicsilicovolcanoconiosis\",word2 = \"pneumonoultramicroscopicsilicovolcanoconiosisxyz\") == 3\n assert candidate(word1 = \"evaporate\",word2 = \"volatile\") == 7\n assert candidate(word1 = \"racecar\",word2 = \"civic\") == 8\n assert candidate(word1 = \"abacabadabacaba\",word2 = \"abacabadabacabax\") == 1\n assert candidate(word1 = \"longest\",word2 = \"shortest\") == 7\n assert candidate(word1 = \"abcd\",word2 = \"abef\") == 4\n assert candidate(word1 = \"algorithm\",word2 = \"altruistic\") == 9\n assert candidate(word1 = \"mississippi\",word2 = \"missisippi\") == 1\n assert candidate(word1 = \"longestcommonsubsequence\",word2 = \"longestcommonsubstring\") == 10\n assert candidate(word1 = \"kittens\",word2 = \"sitting\") == 6\n assert candidate(word1 = \"aaaaaaaaaaaaaa\",word2 = \"bbbbbbbbbbbbbb\") == 28\n assert candidate(word1 = \"abcdefghijklmnopqrstuvwxyz\",word2 = \"zyxwvutsrqponmlkjihgfedcba\") == 50\n assert candidate(word1 = \"thequickbrownfoxjumpsoverthelazydog\",word2 = \"packmyboxwithfivedozenliquorjugs\") == 43\n assert candidate(word1 = \"aaaaaa\",word2 = \"bbbbbb\") == 12\n assert candidate(word1 = \"abracadabra\",word2 = \"abacaxabay\") == 5\n assert candidate(word1 = \"racecar\",word2 = \"racecar\") == 0\n assert candidate(word1 = \"abcdxyz\",word2 = \"xyzabcd\") == 6\n assert candidate(word1 = \"palindrome\",word2 = \"madam\") == 9\n assert candidate(word1 = \"mississippi\",word2 = \"missisipi\") == 2\n assert candidate(word1 = \"programming\",word2 = \"prognosis\") == 10\n assert candidate(word1 = \"sequence\",word2 = \"subsequence\") == 3\n assert candidate(word1 = \"floccinaucinihilipilification\",word2 = \"antidisestablishmentarianism\") == 39\n assert candidate(word1 = \"abracadabra\",word2 = \"avadakedavra\") == 9\n assert candidate(word1 = \"programming\",word2 = \"programmer\") == 5\n assert candidate(word1 = \"mississippi\",word2 = \"misisippi\") == 2\n assert candidate(word1 = \"aaaaaabbbbb\",word2 = \"bbbbbbaaaaa\") == 12\n assert candidate(word1 = \"dissimilar\",word2 = \"similarly\") == 5\n assert candidate(word1 = \"kitten\",word2 = \"sitting\") == 5\n assert candidate(word1 = \"mississippi\",word2 = \"mississsippi\") == 1\n assert candidate(word1 = \"abc\",word2 = \"xyz\") == 6\n assert candidate(word1 = \"gumbo\",word2 = \"gambol\") == 3\n assert candidate(word1 = \"elephant\",word2 = \"relevant\") == 4\n assert candidate(word1 = \"abcde\",word2 = \"fghij\") == 10\n assert candidate(word1 = \"supercalifragilisticexpialidocious\",word2 = \"pneumonoultramicroscopicsilicovolcanoconiosis\") == 45\n assert candidate(word1 = \"palindrome\",word2 = \"emordnilap\") == 18\n assert candidate(word1 = \"dynamicprogramming\",word2 = \"dynamicprogram\") == 4\n assert candidate(word1 = \"abacaxi\",word2 = \"bacana\") == 5\n assert candidate(word1 = \"abcd\",word2 = \"abcde\") == 1\n assert candidate(word1 = \"abracadabra\",word2 = \"abracadabrac\") == 1\n assert candidate(word1 = \"abcdefgh\",word2 = \"efghijkl\") == 8\n assert candidate(word1 = \"abacaxi\",word2 = \"bacaxia\") == 2\n assert candidate(word1 = \"abcdefgh\",word2 = \"fghijklm\") == 10\n assert candidate(word1 = \"abcd\",word2 = \"abcd\") == 0\n assert candidate(word1 = \"qwertyuiopasdfghjklzxcvbnm\",word2 = \"mnbvcxzlkjhgfdsapoiuytrewq\") == 50\n assert candidate(word1 = \"xylophone\",word2 = \"balalaika\") == 16\n assert candidate(word1 = \"abcdefghijk\",word2 = \"kjihgfedcba\") == 20\n assert candidate(word1 = \"transformation\",word2 = \"transfigure\") == 11\n assert candidate(word1 = \"abacaxi\",word2 = \"abacaxi\") == 0\n assert candidate(word1 = \"similarities\",word2 = \"dissimilarities\") == 3\n assert candidate(word1 = \"characters\",word2 = \"chartreuse\") == 6\n assert candidate(word1 = \"floccinaucinihilipilification\",word2 = \"supercalifragilisticexpialidocious\") == 37\n assert candidate(word1 = \"deleting\",word2 = \"leting\") == 2\n assert candidate(word1 = \"abcabcabc\",word2 = \"cbacbacba\") == 8\n assert candidate(word1 = \"pneumonoultramicroscopicsilicovolcanoconiosis\",word2 = \"supercalifragilisticexpialidocious\") == 45\n assert candidate(word1 = \"ababababababababababababababababababababababababab\",word2 = \"bababababababababababababababababababababababababa\") == 2\n assert candidate(word1 = \"dynamic\",word2 = \"algorithm\") == 12\n assert candidate(word1 = \"dabc\",word2 = \"dcba\") == 4\n"}, "metadata": {"canonical_parameter_names": ["word1", "word2"], "leetcode_dataset_entry_point": "Solution().minDistance", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minDistance = function(word1, word2) {", "container": null, "callable": "minDistance", "parameters": [{"name": "word1", "type": "string"}, {"name": "word2", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 587, "task_id": "erect-the-fence", "difficulty": "Hard", "problem_description": "You are given an array trees where trees[i] = [xi, yi] represents the location of a tree in the garden.\nFence the entire garden using the minimum length of rope, as it is expensive. The garden is well-fenced only if all the trees are enclosed.\nReturn the coordinates of trees that are exactly located on the fence perimeter. You may return the answer in any order.\n \nExample 1:\n\n\nInput: trees = [[1,1],[2,2],[2,0],[2,4],[3,3],[4,2]]\nOutput: [[1,1],[2,0],[4,2],[3,3],[2,4]]\nExplanation: All the trees will be on the perimeter of the fence except the tree at [2, 2], which will be inside the fence.\n\nExample 2:\n\n\nInput: trees = [[1,2],[2,2],[4,2]]\nOutput: [[4,2],[2,2],[1,2]]\nExplanation: The fence forms a line that passes through all the trees.\n\n \nConstraints:\n\n1 <= trees.length <= 3000\ntrees[i].length == 2\n0 <= xi, yi <= 100\nAll the given positions are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(trees = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]\n assert candidate(trees = [[1, 1], [2, 1], [3, 1], [2, 2], [1, 2], [3, 2], [2, 3]]) == [[1, 1], [2, 1], [3, 1], [3, 2], [2, 3], [1, 2]]\n assert candidate(trees = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]) == [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]\n assert candidate(trees = [[1, 2], [2, 2], [4, 2]]) == [[1, 2], [2, 2], [4, 2]]\n assert candidate(trees = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4]]) == [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4]]\n assert candidate(trees = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]\n assert candidate(trees = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]\n assert candidate(trees = [[8, 2], [5, 2], [9, 4], [6, 2], [9, 2], [4, 4], [7, 3], [8, 4], [6, 1], [8, 3], [3, 3], [9, 0], [1, 0], [4, 2], [3, 4], [5, 3], [6, 3], [1, 2], [4, 0], [3, 0]]) == [[1, 0], [3, 0], [4, 0], [9, 0], [9, 2], [9, 4], [8, 4], [4, 4], [3, 4], [1, 2]]\n assert candidate(trees = [[3, 0], [4, 0], [5, 0], [6, 1], [7, 2], [7, 3], [7, 4], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [1, 4], [1, 3], [1, 2], [2, 1]]) == [[1, 2], [2, 1], [3, 0], [4, 0], [5, 0], [6, 1], [7, 2], [7, 3], [7, 4], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [1, 4], [1, 3]]\n assert candidate(trees = [[0, 0], [0, 1], [0, 2], [1, 2], [2, 2], [3, 2], [4, 2], [4, 1], [4, 0], [3, 0], [2, 0], [1, 0]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [4, 1], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [0, 1]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]]) == [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 2], [4, 2], [5, 2], [1, 3], [5, 3], [1, 4], [5, 4], [1, 5], [5, 5]]) == [[1, 1], [5, 2], [5, 3], [5, 4], [5, 5], [1, 5], [1, 4], [1, 3]]\n assert candidate(trees = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0]]\n assert candidate(trees = [[0, 0], [1, 1], [2, 2], [3, 1], [2, 0]]) == [[0, 0], [2, 0], [3, 1], [2, 2], [1, 1]]\n assert candidate(trees = [[1, 1], [2, 1], [3, 1], [1, 2], [2, 2], [3, 2], [1, 3], [2, 3], [3, 3]]) == [[1, 1], [2, 1], [3, 1], [3, 2], [3, 3], [2, 3], [1, 3], [1, 2]]\n assert candidate(trees = [[1, 2], [3, 2], [5, 2], [7, 2], [9, 2], [11, 2]]) == [[1, 2], [3, 2], [5, 2], [7, 2], [9, 2], [11, 2]]\n assert candidate(trees = [[1, 1], [2, 2], [2, 0], [2, 4], [3, 3], [4, 2]]) == [[1, 1], [2, 0], [4, 2], [3, 3], [2, 4]]\n assert candidate(trees = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]\n assert candidate(trees = [[1, 1], [2, 1], [3, 1], [2, 2], [3, 2], [4, 2], [3, 3]]) == [[1, 1], [2, 1], [3, 1], [4, 2], [3, 3], [2, 2]]\n assert candidate(trees = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3], [4, 1], [4, 2], [4, 3], [5, 1], [5, 2], [5, 3], [6, 1], [6, 2], [6, 3]]) == [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [6, 2], [6, 3], [5, 3], [4, 3], [3, 3], [2, 3], [1, 3], [1, 2]]\n assert candidate(trees = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [0, 1], [5, 1], [0, 2], [5, 2], [0, 3], [5, 3]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [5, 1], [5, 2], [5, 3], [0, 3], [0, 2], [0, 1]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 3], [4, 2], [5, 1], [4, 5], [3, 5], [2, 5], [1, 5], [3, 1], [5, 3]]) == [[1, 1], [3, 1], [5, 1], [5, 3], [4, 5], [3, 5], [2, 5], [1, 5]]\n assert candidate(trees = [[1, 1], [2, 3], [3, 3], [4, 3], [5, 3], [6, 3], [7, 3], [8, 1], [8, 2], [8, 3], [8, 4], [8, 5]]) == [[1, 1], [8, 1], [8, 2], [8, 3], [8, 4], [8, 5], [2, 3]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [5, 5], [4, 4], [6, 6], [7, 7], [8, 8]]) == [[1, 1], [2, 2], [3, 3], [4, 4], [4, 4], [5, 5], [5, 5], [6, 6], [6, 6], [7, 7], [7, 7], [8, 8], [8, 8], [9, 9], [10, 10]]\n assert candidate(trees = [[0, 0], [5, 0], [0, 5], [5, 5], [2, 2], [3, 3], [1, 4], [4, 1], [2, 5], [5, 2], [3, 1], [1, 3]]) == [[0, 0], [5, 0], [5, 2], [5, 5], [2, 5], [0, 5]]\n assert candidate(trees = [[1, 1], [1, 5], [5, 5], [5, 1], [3, 3], [2, 2], [4, 4], [3, 2], [3, 4], [2, 3], [4, 3]]) == [[1, 1], [5, 1], [5, 5], [1, 5]]\n assert candidate(trees = [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1], [5, 2]]) == [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1], [5, 2]]\n assert candidate(trees = [[0, 0], [10, 0], [0, 10], [10, 10], [5, 5], [2, 2], [8, 8], [3, 3], [7, 7], [4, 4]]) == [[0, 0], [10, 0], [10, 10], [0, 10]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 1], [4, 2], [5, 1], [6, 2], [7, 1], [8, 2], [9, 1]]) == [[1, 1], [3, 1], [5, 1], [7, 1], [9, 1], [8, 2], [6, 2], [4, 2], [2, 2]]\n assert candidate(trees = [[1, 3], [2, 1], [2, 5], [3, 2], [3, 4], [4, 1], [4, 5], [5, 2], [5, 4], [6, 3]]) == [[1, 3], [2, 1], [4, 1], [5, 2], [6, 3], [5, 4], [4, 5], [2, 5]]\n assert candidate(trees = [[1, 1], [2, 5], [3, 2], [4, 4], [5, 1], [6, 5], [7, 3], [8, 2], [9, 4], [10, 1], [11, 5]]) == [[1, 1], [5, 1], [10, 1], [11, 5], [6, 5], [2, 5]]\n assert candidate(trees = [[1, 1], [2, 3], [3, 2], [4, 4], [5, 3], [6, 1], [6, 5], [7, 2], [8, 4]]) == [[1, 1], [6, 1], [7, 2], [8, 4], [6, 5], [4, 4], [2, 3]]\n assert candidate(trees = [[1, 1], [1, 5], [5, 1], [5, 5], [2, 2], [2, 4], [4, 2], [4, 4], [3, 3]]) == [[1, 1], [5, 1], [5, 5], [1, 5]]\n assert candidate(trees = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 1], [3, 2], [4, 1], [4, 2], [1, 3], [4, 3]]) == [[1, 1], [2, 1], [3, 1], [4, 1], [4, 2], [4, 3], [1, 3], [1, 2]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 9], [9, 8], [8, 7], [7, 6], [6, 5], [5, 4], [4, 3], [3, 2], [2, 1]]) == [[1, 1], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 8], [10, 9], [10, 10], [9, 10], [8, 9], [7, 8], [6, 7], [5, 6], [4, 5], [3, 4], [2, 3], [1, 2]]\n assert candidate(trees = [[1, 2], [2, 3], [3, 2], [4, 3], [5, 2], [6, 3], [7, 2], [8, 3], [9, 2], [10, 3]]) == [[1, 2], [3, 2], [5, 2], [7, 2], [9, 2], [10, 3], [8, 3], [6, 3], [4, 3], [2, 3]]\n assert candidate(trees = [[1, 1], [1, 2], [2, 1], [3, 1], [2, 2], [3, 2], [1, 3], [2, 3], [3, 3], [1, 4], [2, 4], [3, 4], [2, 5]]) == [[1, 1], [2, 1], [3, 1], [3, 2], [3, 3], [3, 4], [2, 5], [1, 4], [1, 3], [1, 2]]\n assert candidate(trees = [[1, 1], [2, 5], [3, 3], [5, 3], [5, 5], [3, 1], [3, 2], [3, 4], [5, 4], [4, 4], [4, 5]]) == [[1, 1], [3, 1], [5, 3], [5, 4], [5, 5], [4, 5], [2, 5]]\n assert candidate(trees = [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2], [8, 2], [9, 2], [10, 2], [5, 3]]) == [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1], [10, 2], [5, 3], [1, 2]]\n assert candidate(trees = [[0, 0], [0, 1], [1, 1], [1, 0], [2, 0], [2, 1], [1, 2], [0, 2], [3, 3], [4, 4], [3, 4], [4, 3]]) == [[0, 0], [1, 0], [2, 0], [4, 3], [4, 4], [3, 4], [0, 2], [0, 1]]\n assert candidate(trees = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]\n assert candidate(trees = [[1, 2], [2, 1], [3, 2], [2, 3], [1, 4], [4, 1], [4, 4], [2, 2], [3, 3], [1, 3], [3, 1]]) == [[1, 2], [2, 1], [3, 1], [4, 1], [4, 4], [1, 4], [1, 3]]\n assert candidate(trees = [[1, 3], [2, 2], [2, 4], [3, 1], [3, 5], [4, 3], [5, 2], [5, 4], [6, 3]]) == [[1, 3], [2, 2], [3, 1], [5, 2], [6, 3], [5, 4], [3, 5], [2, 4]]\n assert candidate(trees = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [3, 1], [3, 2], [2, 2], [1, 2], [0, 2], [0, 1]]\n assert candidate(trees = [[1, 1], [1, 3], [3, 1], [3, 3], [2, 2], [2, 4], [4, 2], [4, 4], [3, 2], [2, 3], [3, 4]]) == [[1, 1], [3, 1], [4, 2], [4, 4], [3, 4], [2, 4], [1, 3]]\n assert candidate(trees = [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4]]) == [[1, 0], [2, 0], [3, 0], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [3, 4], [2, 4], [1, 4], [1, 3], [1, 2], [1, 1]]\n assert candidate(trees = [[1, 1], [1, 5], [2, 2], [2, 4], [3, 3], [3, 1], [3, 5], [4, 2], [4, 4], [5, 1], [5, 5]]) == [[1, 1], [3, 1], [5, 1], [5, 5], [3, 5], [1, 5]]\n assert candidate(trees = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [3, 4], [2, 4], [1, 4], [0, 4], [0, 3], [0, 2], [0, 1]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [3, 4], [2, 4], [1, 4], [0, 4], [0, 3], [0, 2], [0, 1]]\n assert candidate(trees = [[1, 1], [2, 1], [1, 2], [3, 2], [2, 3], [4, 3], [3, 4], [4, 4], [1, 5], [2, 5], [4, 5], [5, 5], [3, 6], [4, 7], [1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [2, 4], [3, 5], [2, 5], [3, 7], [4, 6], [6, 6], [7, 6], [8, 6], [5, 7]]) == [[1, 1], [2, 1], [2, 3], [2, 3], [2, 4], [2, 5], [2, 5], [3, 2], [4, 3], [4, 3], [5, 3], [8, 6], [5, 7], [4, 7], [3, 7], [1, 5], [1, 3], [1, 2]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 2], [4, 2], [5, 3], [3, 3], [2, 4], [4, 4], [1, 5], [2, 5], [4, 5], [5, 5], [3, 6], [4, 7]]) == [[1, 1], [4, 2], [5, 3], [5, 5], [4, 7], [1, 5]]\n assert candidate(trees = [[0, 0], [1, 1], [2, 2], [2, 0], [3, 0], [3, 3], [4, 1], [4, 3]]) == [[0, 0], [2, 0], [3, 0], [4, 1], [4, 3], [3, 3], [2, 2], [1, 1]]\n assert candidate(trees = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1], [9, 0], [8, 1], [7, 2], [6, 3], [5, 4], [4, 5], [3, 6], [2, 7], [1, 8], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2]]) == [[1, 8], [2, 7], [2, 9], [2, 9], [3, 6], [3, 8], [3, 8], [4, 5], [4, 7], [4, 7], [5, 4], [5, 6], [5, 6], [6, 3], [6, 5], [6, 5], [7, 2], [7, 4], [7, 4], [8, 1], [8, 3], [8, 3], [9, 0], [9, 2], [9, 2], [10, 1], [1, 10]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [5, 1], [5, 3], [5, 2], [4, 3], [3, 4], [2, 3], [1, 2]]) == [[1, 1], [5, 1], [5, 2], [5, 3], [5, 5], [3, 4], [2, 3], [1, 2]]\n assert candidate(trees = [[1, 1], [2, 2], [2, 0], [3, 1], [3, 3], [4, 2], [4, 4], [5, 3], [5, 5], [6, 4], [6, 2], [7, 3], [8, 4], [9, 3], [9, 5], [10, 4]]) == [[1, 1], [2, 0], [9, 3], [10, 4], [9, 5], [5, 5], [4, 4], [3, 3], [2, 2]]\n assert candidate(trees = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [4, 3], [3, 2], [2, 1], [1, 0]]) == [[0, 0], [1, 0], [2, 1], [3, 2], [4, 3], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1]]\n assert candidate(trees = [[1, 1], [1, 4], [4, 1], [4, 4], [2, 2], [3, 3], [2, 3], [3, 2]]) == [[1, 1], [4, 1], [4, 4], [1, 4]]\n assert candidate(trees = [[0, 0], [0, 2], [1, 1], [2, 2], [2, 0], [3, 0], [3, 2], [4, 1]]) == [[0, 0], [2, 0], [3, 0], [4, 1], [3, 2], [2, 2], [0, 2]]\n assert candidate(trees = [[4, 0], [5, 0], [2, 0], [6, 1], [1, 2], [5, 3], [2, 3], [6, 5], [5, 5], [4, 5], [2, 5], [0, 6], [1, 6], [5, 6], [3, 7]]) == [[0, 6], [1, 2], [2, 0], [4, 0], [5, 0], [6, 1], [6, 5], [5, 6], [3, 7]]\n assert candidate(trees = [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10]]) == [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1], [5, 10]]\n assert candidate(trees = [[10, 0], [0, 0], [0, 10], [10, 10], [5, 5], [2, 5], [5, 2], [8, 5], [5, 8]]) == [[0, 0], [10, 0], [10, 10], [0, 10]]\n assert candidate(trees = [[1, 1], [2, 1], [1, 2], [2, 2], [1, 3], [2, 3], [1, 4], [2, 4], [3, 1], [3, 2], [3, 3], [3, 4]]) == [[1, 1], [2, 1], [3, 1], [3, 2], [3, 3], [3, 4], [2, 4], [1, 4], [1, 3], [1, 2]]\n assert candidate(trees = [[1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2], [8, 2], [9, 2], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1]]) == [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2]]\n assert candidate(trees = [[1, 1], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 3], [8, 5], [9, 4], [10, 2], [11, 3]]) == [[1, 1], [6, 1], [10, 2], [11, 3], [8, 5], [2, 5]]\n assert candidate(trees = [[3, 3], [1, 1], [2, 2], [4, 4], [5, 5], [3, 5], [5, 3], [3, 1], [1, 3]]) == [[1, 1], [3, 1], [5, 3], [5, 5], [3, 5], [1, 3]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 1], [4, 2], [5, 1], [6, 2], [7, 1], [8, 2], [9, 1], [10, 2]]) == [[1, 1], [3, 1], [5, 1], [7, 1], [9, 1], [10, 2], [8, 2], [6, 2], [4, 2], [2, 2]]\n assert candidate(trees = [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [1, 4], [2, 4], [3, 4], [4, 4], [5, 4]]) == [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [5, 2], [5, 3], [5, 4], [4, 4], [3, 4], [2, 4], [1, 4], [1, 3], [1, 2]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0]]) == [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0], [10, 10], [9, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1]]\n assert candidate(trees = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2], [3, 3], [2, 2]]) == [[1, 1], [2, 1], [3, 1], [3, 2], [3, 3], [2, 3], [1, 3], [1, 2]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5]]) == [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5]]\n assert candidate(trees = [[0, 0], [1, 0], [1, 1], [0, 1], [2, 0], [2, 1], [2, 2], [1, 2], [0, 2], [3, 0], [3, 1], [3, 2], [3, 3], [2, 3], [1, 3], [0, 3]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [3, 1], [3, 2], [3, 3], [2, 3], [1, 3], [0, 3], [0, 2], [0, 1]]\n assert candidate(trees = [[1, 1], [2, 2], [2, 0], [2, 4], [3, 3], [4, 2], [5, 2], [6, 2], [7, 2], [8, 2], [9, 2], [10, 2]]) == [[1, 1], [2, 0], [10, 2], [2, 4]]\n assert candidate(trees = [[2, 3], [3, 2], [4, 3], [5, 2], [6, 3], [7, 2], [8, 3], [9, 2], [10, 3], [11, 2], [12, 3]]) == [[2, 3], [3, 2], [5, 2], [7, 2], [9, 2], [11, 2], [12, 3], [10, 3], [8, 3], [6, 3], [4, 3]]\n assert candidate(trees = [[5, 5], [7, 7], [6, 6], [8, 8], [9, 9], [10, 10], [8, 10], [10, 8], [9, 8], [8, 9]]) == [[5, 5], [10, 8], [10, 10], [8, 10]]\n assert candidate(trees = [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [1, 2], [5, 2], [1, 3], [5, 3], [1, 4], [5, 4], [1, 5], [5, 5], [3, 3]]) == [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [1, 5], [1, 4], [1, 3], [1, 2]]\n assert candidate(trees = [[3, 0], [4, 0], [5, 0], [6, 1], [7, 2], [7, 3], [7, 4], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [1, 4], [1, 3], [1, 2], [2, 2], [4, 2], [0, 3]]) == [[0, 3], [1, 2], [3, 0], [4, 0], [5, 0], [6, 1], [7, 2], [7, 3], [7, 4], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [1, 4]]\n assert candidate(trees = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [0, 5], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [2, 2], [3, 2], [2, 3], [3, 3], [1, 1], [4, 4], [1, 4], [4, 1]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5], [0, 5]]\n assert candidate(trees = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5], [0, 5], [6, 5], [7, 5], [8, 5], [9, 5]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5], [0, 5]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [10, 0], [9, 1], [8, 2], [7, 3], [6, 4], [5, 5], [4, 6], [3, 7], [2, 8], [1, 9]]) == [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [5, 5], [6, 4], [7, 3], [8, 2], [9, 1], [10, 0], [10, 10], [1, 9]]\n assert candidate(trees = [[5, 0], [5, 5], [0, 5], [5, 10], [10, 5], [0, 0], [1, 1], [4, 4], [6, 6], [9, 9], [2, 2], [8, 8], [3, 3], [7, 7]]) == [[0, 0], [5, 0], [10, 5], [9, 9], [5, 10], [0, 5]]\n assert candidate(trees = [[0, 0], [1, 1], [2, 2], [2, 3], [3, 4], [4, 3], [4, 2], [3, 1]]) == [[0, 0], [3, 1], [4, 2], [4, 3], [3, 4], [2, 3]]\n assert candidate(trees = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0], [5, 10]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [5, 1]]) == [[1, 1], [5, 1], [10, 10], [9, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2]]\n assert candidate(trees = [[0, 0], [1, 1], [2, 2], [3, 3], [2, 4], [1, 2], [2, 0], [3, 2], [4, 0], [5, 1], [5, 2], [5, 3]]) == [[0, 0], [2, 0], [4, 0], [5, 1], [5, 2], [5, 3], [2, 4], [1, 2]]\n assert candidate(trees = [[0, 0], [1, 0], [2, 0], [3, 0], [2, 1], [1, 1], [0, 1], [2, 2], [1, 2], [3, 1]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [3, 1], [2, 2], [1, 2], [0, 1]]\n assert candidate(trees = [[1, 2], [1, 4], [2, 1], [2, 3], [2, 5], [3, 2], [3, 4], [4, 1], [4, 3], [4, 5], [5, 2], [5, 4]]) == [[1, 2], [2, 1], [4, 1], [5, 2], [5, 4], [4, 5], [2, 5], [1, 4]]\n assert candidate(trees = [[1, 1], [1, 3], [2, 2], [2, 4], [3, 1], [3, 3], [4, 2], [4, 4]]) == [[1, 1], [3, 1], [4, 2], [4, 4], [2, 4], [1, 3]]\n assert candidate(trees = [[1, 1], [1, 5], [2, 3], [3, 1], [4, 5], [5, 3], [6, 1], [7, 5], [8, 3], [9, 1]]) == [[1, 1], [3, 1], [6, 1], [9, 1], [8, 3], [7, 5], [4, 5], [1, 5]]\n assert candidate(trees = [[10, 0], [0, 10], [10, 10], [0, 0], [5, 5], [3, 3], [7, 7], [4, 6], [6, 4]]) == [[0, 0], [10, 0], [10, 10], [0, 10]]\n assert candidate(trees = [[1, 2], [2, 1], [2, 3], [3, 1], [3, 3], [4, 2], [4, 3], [3, 4], [2, 4]]) == [[1, 2], [2, 1], [3, 1], [4, 2], [4, 3], [3, 4], [2, 4]]\n assert candidate(trees = [[1, 1], [2, 1], [1, 2], [2, 2], [1, 3], [2, 3], [3, 1], [3, 2], [3, 3]]) == [[1, 1], [2, 1], [3, 1], [3, 2], [3, 3], [2, 3], [1, 3], [1, 2]]\n assert candidate(trees = [[1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2], [8, 2], [9, 2], [10, 2], [5, 1], [5, 3]]) == [[1, 2], [5, 1], [10, 2], [5, 3]]\n assert candidate(trees = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [5, 4], [4, 3], [3, 2], [2, 1], [1, 0], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5]]) == [[0, 0], [1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [5, 5], [4, 5], [3, 4], [2, 3], [1, 2], [0, 1]]\n assert candidate(trees = [[1, 1], [2, 2], [2, 0], [3, 0], [3, 3], [4, 3], [5, 2], [5, 0]]) == [[1, 1], [2, 0], [3, 0], [5, 0], [5, 2], [4, 3], [3, 3], [2, 2]]\n assert candidate(trees = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [0, 2], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2], [8, 2], [9, 2]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [9, 1], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [0, 1]]\n assert candidate(trees = [[0, 0], [0, 5], [5, 0], [5, 5], [1, 1], [1, 2], [1, 3], [1, 4], [2, 1], [2, 2], [2, 3], [2, 4], [3, 1], [3, 2], [3, 3], [3, 4], [4, 1], [4, 2], [4, 3], [4, 4]]) == [[0, 0], [5, 0], [5, 5], [0, 5]]\n assert candidate(trees = [[1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2], [8, 2], [9, 2], [10, 2], [2, 1], [8, 1], [5, 3]]) == [[1, 2], [2, 1], [8, 1], [10, 2], [5, 3]]\n assert candidate(trees = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [4, 1], [3, 1], [2, 1]]) == [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5], [1, 4], [1, 3], [1, 2]]\n assert candidate(trees = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [9, 8], [8, 6], [7, 4], [6, 2], [5, 0], [4, 2], [3, 4], [2, 6], [1, 8]]) == [[0, 0], [5, 0], [6, 2], [7, 4], [8, 6], [9, 8], [10, 10], [1, 8]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 1], [4, 2], [5, 1], [6, 2], [7, 1], [8, 2]]) == [[1, 1], [3, 1], [5, 1], [7, 1], [8, 2], [6, 2], [4, 2], [2, 2]]\n assert candidate(trees = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]) == [[1, 1], [2, 1], [3, 1], [3, 2], [3, 3], [2, 3], [1, 3], [1, 2]]\n assert candidate(trees = [[1, 2], [2, 1], [3, 2], [2, 3], [4, 4], [5, 3], [4, 2], [3, 1], [2, 2], [5, 1], [6, 0], [5, 0], [4, 1], [3, 0]]) == [[1, 2], [2, 1], [3, 0], [5, 0], [6, 0], [5, 3], [4, 4], [2, 3]]\n assert candidate(trees = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 6], [10, 7], [10, 8], [10, 9], [10, 10], [9, 10], [8, 10], [7, 10], [6, 10], [5, 10], [4, 10], [3, 10], [2, 10], [1, 10], [0, 10], [0, 9], [0, 8], [0, 7], [0, 6], [0, 5], [0, 4], [0, 3], [0, 2], [0, 1]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 6], [10, 7], [10, 8], [10, 9], [10, 10], [9, 10], [8, 10], [7, 10], [6, 10], [5, 10], [4, 10], [3, 10], [2, 10], [1, 10], [0, 10], [0, 9], [0, 8], [0, 7], [0, 6], [0, 5], [0, 4], [0, 3], [0, 2], [0, 1]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 1], [5, 3], [6, 2], [7, 4], [8, 3], [9, 5], [10, 4], [11, 5]]) == [[1, 1], [3, 1], [6, 2], [8, 3], [10, 4], [11, 5], [9, 5], [2, 2]]\n assert candidate(trees = [[2, 2], [2, 4], [3, 3], [4, 4], [4, 2], [5, 2], [5, 4], [3, 4]]) == [[2, 2], [4, 2], [5, 2], [5, 4], [4, 4], [3, 4], [2, 4]]\n assert candidate(trees = [[1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [2, 1], [3, 1], [4, 1], [2, 3], [3, 3], [4, 3]]) == [[1, 2], [2, 1], [3, 1], [4, 1], [5, 2], [4, 3], [3, 3], [2, 3]]\n assert candidate(trees = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [0, 1], [5, 1], [0, 2], [5, 2], [0, 3], [5, 3], [0, 4], [5, 4], [0, 5], [5, 5]]) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [0, 5], [0, 4], [0, 3], [0, 2], [0, 1]]\n assert candidate(trees = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [6, 5]]) == [[1, 1], [6, 5], [10, 10], [9, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2]]\n assert candidate(trees = [[1, 1], [2, 5], [3, 3], [5, 3], [5, 5], [3, 5], [4, 4]]) == [[1, 1], [5, 3], [5, 5], [3, 5], [2, 5]]\n assert candidate(trees = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9]]) == [[0, 0], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [5, 9]]\n assert candidate(trees = [[3, 0], [4, 0], [5, 0], [4, 1], [3, 2], [4, 2], [5, 2], [4, 3]]) == [[3, 0], [4, 0], [5, 0], [5, 2], [4, 3], [3, 2]]\n assert candidate(trees = [[0, 0], [1, 1], [2, 2], [3, 3], [2, 0], [0, 3]]) == [[0, 0], [2, 0], [3, 3], [0, 3]]\n assert candidate(trees = [[1, 1], [2, 5], [3, 1], [3, 4], [4, 2], [5, 1], [5, 5], [6, 2]]) == [[1, 1], [3, 1], [5, 1], [6, 2], [5, 5], [2, 5]]\n assert candidate(trees = [[1, 1], [2, 5], [3, 1], [4, 5], [5, 1], [6, 5], [7, 1], [8, 5], [9, 1]]) == [[1, 1], [3, 1], [5, 1], [7, 1], [9, 1], [8, 5], [6, 5], [4, 5], [2, 5]]\n"}, "metadata": {"canonical_parameter_names": ["trees"], "leetcode_dataset_entry_point": "Solution().outerTrees", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var outerTrees = function(trees) {", "container": null, "callable": "outerTrees", "parameters": [{"name": "trees", "type": "number[][]"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 591, "task_id": "tag-validator", "difficulty": "Hard", "problem_description": "Given a string representing a code snippet, implement a tag validator to parse the code and return whether it is valid.\nA code snippet is valid if all the following rules hold:\n\nThe code must be wrapped in a valid closed tag. Otherwise, the code is invalid.\nA closed tag (not necessarily valid) has exactly the following format : TAG_CONTENT. Among them, is the start tag, and is the end tag. The TAG_NAME in start and end tags should be the same. A closed tag is valid if and only if the TAG_NAME and TAG_CONTENT are valid.\nA valid TAG_NAME only contain upper-case letters, and has length in range [1,9]. Otherwise, the TAG_NAME is invalid.\nA valid TAG_CONTENT may contain other valid closed tags, cdata and any characters (see note1) EXCEPT unmatched <, unmatched start and end tag, and unmatched or closed tags with invalid TAG_NAME. Otherwise, the TAG_CONTENT is invalid.\nA start tag is unmatched if no end tag exists with the same TAG_NAME, and vice versa. However, you also need to consider the issue of unbalanced when tags are nested.\nA < is unmatched if you cannot find a subsequent >. And when you find a < or , all the subsequent characters until the next > should be parsed as TAG_NAME (not necessarily valid).\nThe cdata has the following format : CDATA_CONTENT. The range of CDATA_CONTENT is defined as the characters between and the first subsequent .\nCDATA_CONTENT may contain any characters. The function of cdata is to forbid the validator to parse CDATA_CONTENT, so even it has some characters that can be parsed as tag (no matter valid or invalid), you should treat it as regular characters.\n\n \nExample 1:\n\nInput: code = \"This is the first line
\"\nOutput: true\nExplanation: \nThe code is wrapped in a closed tag : and . \nThe TAG_NAME is valid, the TAG_CONTENT consists of some characters and cdata. \nAlthough CDATA_CONTENT has an unmatched start tag with invalid TAG_NAME, it should be considered as plain text, not parsed as a tag.\nSo TAG_CONTENT is valid, and then the code is valid. Thus return true.\n\nExample 2:\n\nInput: code = \">> ![cdata[]]
]>]]>>]\"\nOutput: true\nExplanation:\nWe first separate the code into : start_tag|tag_content|end_tag.\nstart_tag -> \"\"\nend_tag -> \"\"\ntag_content could also be separated into : text1|cdata|text2.\ntext1 -> \">> ![cdata[]] \"\ncdata -> \"
]>\", where the CDATA_CONTENT is \"]>\"\ntext2 -> \"]]>>]\"\nThe reason why start_tag is NOT \">>\" is because of the rule 6.\nThe reason why cdata is NOT \"
]>]]>\" is because of the rule 7.\n\nExample 3:\n\nInput: code = \" \"\nOutput: false\nExplanation: Unbalanced. If \"\" is closed, then \"\" must be unmatched, and vice versa.\n\n \nConstraints:\n\n1 <= code.length <= 500\ncode consists of English letters, digits, '<', '>', '/', '!', '[', ']', '.', and ' '.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(code = \"abc\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"This is the first line
\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \" \") == True\n assert candidate(code = \"This is the first line
[CDATA[CDATA_CONTENT]]
\") == False\n assert candidate(code = \">> ![cdata[]]
]>]]>>]\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"This is the first line
\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"456 123 123 \") == False\n assert candidate(code = \"
\") == False\n assert candidate(code = \" \") == False\n assert candidate(code = \"text \") == True\n assert candidate(code = \" ]]>\") == True\n assert candidate(code = \"abcdef\") == True\n assert candidate(code = \"sometext\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"sometext\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"abc\") == True\n assert candidate(code = \" ]]>\") == False\n assert candidate(code = \"sometext\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"contentcontent]]>content\") == False\n assert candidate(code = \" here]]>\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"

many

]]>

\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \">\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \" here]]>\") == True\n assert candidate(code = \"content]]>content\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"data]]>\") == True\n assert candidate(code = \"content]]>contentcontent]]>\") == False\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"
\") == True\n assert candidate(code = \"content]]>content]]>\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"deep]]>\") == True\n assert candidate(code = \"invalid\") == True\n assert candidate(code = \" inside CDATA]]>\") == False\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"Some text more text]]> even more text\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \" here]]>]]>\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \" here]]>\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"content]]>content\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"contentcontent
]]>content\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"content]]>\") == True\n assert candidate(code = \"INNER]]>\") == True\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"]]>]\") == False\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"ghi]]>\") == False\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"contentcontent]]>\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \">\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"ghi]]>\") == True\n assert candidate(code = \"]]>]]>\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"content\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"data\") == False\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \" \") == False\n assert candidate(code = \"![CDATA[wahaha]]]>]]>\") == True\n assert candidate(code = \"content\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \">\") == True\n assert candidate(code = \"CDATA]]>\") == True\n assert candidate(code = \" here]]>\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \" here]]>\") == True\n assert candidate(code = \" here]]>\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"some nested tags\") == True\n assert candidate(code = \"content]]>content\") == False\n assert candidate(code = \"
data
\") == False\n assert candidate(code = \"content]]>]]>\") == False\n assert candidate(code = \">\") == True\n assert candidate(code = \">\") == False\n assert candidate(code = \" CDATA_CONTENT]]> \") == True\n assert candidate(code = \"CONTENT\") == True\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \"unparsed
]]>\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \">\") == False\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \"]]>]>\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"TEXT\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"
\") == False\n assert candidate(code = \"content\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \" and here]]>\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"

]]>text

\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"CONTENT\") == False\n assert candidate(code = \"CDATA]]>\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"]]>]]>\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"INNER]]>\") == True\n assert candidate(code = \" here]]>\") == True\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \"world]]>\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \">\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"

\") == True\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"contentcontent]]>\") == True\n assert candidate(code = \"data]]>\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"CDATA_CONTENT]]> \") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \"content]]>content\") == False\n assert candidate(code = \"TEXT \") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"content]]>\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"deep]]>\") == False\n assert candidate(code = \"content\") == True\n assert candidate(code = \" here]]>\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \" test]]>\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"CDATA]]>\") == True\n assert candidate(code = \" tags ]]>\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \"\") == True\n assert candidate(code = \" here]]>\") == False\n assert candidate(code = \"]]>]]>\") == True\n assert candidate(code = \"]]>\") == False\n assert candidate(code = \"\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \" with CDATA]]>\") == True\n assert candidate(code = \"\") == False\n assert candidate(code = \"]]>]]>\") == False\n assert candidate(code = \"contentcontent]]>\") == True\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \">\") == False\n assert candidate(code = \"\") == False\n assert candidate(code = \"]]>\") == True\n assert candidate(code = \">\") == True\n assert candidate(code = \"contentcontent]]>\") == True\n assert candidate(code = \"]]>\") == False\n"}, "metadata": {"canonical_parameter_names": ["code"], "leetcode_dataset_entry_point": "Solution().isValid", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isValid = function(code) {", "container": null, "callable": "isValid", "parameters": [{"name": "code", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 592, "task_id": "fraction-addition-and-subtraction", "difficulty": "Medium", "problem_description": "Given a string expression representing an expression of fraction addition and subtraction, return the calculation result in string format.\nThe final result should be an irreducible fraction. If your final result is an integer, change it to the format of a fraction that has a denominator 1. So in this case, 2 should be converted to 2/1.\n \nExample 1:\n\nInput: expression = \"-1/2+1/2\"\nOutput: \"0/1\"\n\nExample 2:\n\nInput: expression = \"-1/2+1/2+1/3\"\nOutput: \"1/3\"\n\nExample 3:\n\nInput: expression = \"1/3-1/2\"\nOutput: \"-1/6\"\n\n \nConstraints:\n\nThe input string only contains '0' to '9', '/', '+' and '-'. So does the output.\nEach fraction (input and output) has the format ±numerator/denominator. If the first input fraction or the output is positive, then '+' will be omitted.\nThe input only contains valid irreducible fractions, where the numerator and denominator of each fraction will always be in the range [1, 10]. If the denominator is 1, it means this fraction is actually an integer in a fraction format defined above.\nThe number of given fractions will be in the range [1, 10].\nThe numerator and denominator of the final result are guaranteed to be valid and in the range of 32-bit int.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(expression = \"9/10-1/5\") == \"7/10\"\n assert candidate(expression = \"5/6-1/3\") == \"1/2\"\n assert candidate(expression = \"-1/10-2/10-3/10-4/10\") == \"-1/1\"\n assert candidate(expression = \"3/4+1/4-1/2\") == \"1/2\"\n assert candidate(expression = \"1/5+2/5+3/5\") == \"6/5\"\n assert candidate(expression = \"7/10-3/5+1/2\") == \"3/5\"\n assert candidate(expression = \"1/1-1/1+1/1\") == \"1/1\"\n assert candidate(expression = \"1/10+1/10+1/10+1/10+1/10+1/10+1/10+1/10+1/10+1/10\") == \"1/1\"\n assert candidate(expression = \"1/3-1/2\") == \"-1/6\"\n assert candidate(expression = \"7/10+1/5\") == \"9/10\"\n assert candidate(expression = \"1/2-1/3+1/4-1/5+1/6\") == \"23/60\"\n assert candidate(expression = \"7/8-3/4+1/2\") == \"5/8\"\n assert candidate(expression = \"9/10-1/10-3/10\") == \"1/2\"\n assert candidate(expression = \"1/5-1/5-1/5+1/5\") == \"0/1\"\n assert candidate(expression = \"1/9+2/9+3/9+4/9+5/9+6/9+7/9+8/9+1/9\") == \"37/9\"\n assert candidate(expression = \"5/6-1/3+1/2\") == \"1/1\"\n assert candidate(expression = \"1/10+2/10+3/10+4/10\") == \"1/1\"\n assert candidate(expression = \"7/8+1/8\") == \"1/1\"\n assert candidate(expression = \"1/4-1/4+1/4\") == \"1/4\"\n assert candidate(expression = \"1/1-1/1\") == \"0/1\"\n assert candidate(expression = \"2/5+3/10\") == \"7/10\"\n assert candidate(expression = \"1/9+1/9+1/9+1/9+1/9+1/9+1/9+1/9+1/9\") == \"1/1\"\n assert candidate(expression = \"-1/3-1/3-1/3\") == \"-1/1\"\n assert candidate(expression = \"1/1-1/2-1/3\") == \"1/6\"\n assert candidate(expression = \"1/4+1/4+1/4+1/4\") == \"1/1\"\n assert candidate(expression = \"5/6+1/3\") == \"7/6\"\n assert candidate(expression = \"1/10-1/10\") == \"0/1\"\n assert candidate(expression = \"-1/2+1/2+1/3\") == \"1/3\"\n assert candidate(expression = \"-1/2+1/2\") == \"0/1\"\n assert candidate(expression = \"2/3+3/4-1/6\") == \"5/4\"\n assert candidate(expression = \"3/5-2/5+1/5-4/5+2/5\") == \"0/1\"\n assert candidate(expression = \"-7/8+5/6-1/4+3/5\") == \"37/120\"\n assert candidate(expression = \"-1/2+1/2-1/3+1/3-1/4+1/4-1/5+1/5-1/6+1/6\") == \"0/1\"\n assert candidate(expression = \"1/10-2/9+3/8-4/7+5/6-6/5+7/4-8/3+9/2-10/1\") == \"-17897/2520\"\n assert candidate(expression = \"-5/6+3/4-2/3+1/2-1/8\") == \"-3/8\"\n assert candidate(expression = \"-1/2-2/3-3/4-4/5-5/6-6/7-7/8-8/9-9/10\") == \"-17819/2520\"\n assert candidate(expression = \"1/7+1/11+1/13+1/17+1/19\") == \"3191/7560\"\n assert candidate(expression = \"-1/10-2/9-3/8-4/7-5/6-6/5-7/4-8/3-9/2-10/1\") == \"-55991/2520\"\n assert candidate(expression = \"7/9-5/6+11/12-3/4+2/3\") == \"7/9\"\n assert candidate(expression = \"1/3-1/4+1/5-1/6+1/7-1/8+1/9-1/10+1/2\") == \"1627/2520\"\n assert candidate(expression = \"-1/2+1/3-1/4+1/5-1/6\") == \"-23/60\"\n assert candidate(expression = \"-1/2+2/3-3/4+4/5-5/6+6/7-7/8+8/9-9/10\") == \"-1627/2520\"\n assert candidate(expression = \"1/10-2/15+3/20-4/25+5/30\") == \"1243/10080\"\n assert candidate(expression = \"10/1-9/2+8/3-7/4+6/5-5/6+4/7-3/8+2/9-1/10\") == \"17897/2520\"\n assert candidate(expression = \"-1/2+2/3-3/4+4/5-5/6+6/7-7/8+8/9-9/10+10/11-11/12\") == \"-1411/2160\"\n assert candidate(expression = \"1/2+1/4+1/6+1/8+1/10+1/12+1/14+1/16+1/18+1/20\") == \"7381/5040\"\n assert candidate(expression = \"1/3-1/6+1/9-1/12+1/15-1/18+1/21-1/24+1/27-1/30\") == \"1627/7560\"\n assert candidate(expression = \"1/9+1/8+1/7+1/6+1/5+1/4+1/3+1/2+1/1\") == \"7129/2520\"\n assert candidate(expression = \"-1/2+1/3-1/4+1/5-1/6+1/7-1/8+1/9-1/10\") == \"-893/2520\"\n assert candidate(expression = \"-1/8+1/4-3/8+5/8-7/8+9/8-11/8\") == \"-3/4\"\n assert candidate(expression = \"7/10-3/5+2/4-1/2+1/1-9/10+5/6\") == \"31/30\"\n assert candidate(expression = \"1/1+1/2+1/3+1/4+1/5+1/6+1/7+1/8+1/9+1/10+1/11+1/12\") == \"93841/30240\"\n assert candidate(expression = \"5/10+15/20-25/30+35/40-45/50+55/60-65/70+75/80-85/90+95/100\") == \"6667/5040\"\n assert candidate(expression = \"1/10+2/15+3/20+4/25+5/30+6/35+7/40\") == \"15973/15120\"\n assert candidate(expression = \"1/9-1/10+1/11-1/12+1/13\") == \"413/4320\"\n assert candidate(expression = \"1/2+1/4+1/8+1/16+1/32+1/64+1/128+1/256\") == \"4303/4320\"\n assert candidate(expression = \"10/9-9/8+8/7-7/6+6/5-5/4+4/3-3/2+2/1\") == \"4399/2520\"\n assert candidate(expression = \"5/9-3/8+7/6-2/5+1/4\") == \"431/360\"\n assert candidate(expression = \"-1/2+1/3-1/5+1/7-1/9+1/11-1/13+1/15-1/17+1/19\") == \"-1313/5040\"\n assert candidate(expression = \"7/8-5/6+1/4-1/2+3/7\") == \"37/168\"\n assert candidate(expression = \"1/1-2/1+3/1-4/1+5/1-6/1+7/1-8/1+9/1-10/1\") == \"-5/1\"\n assert candidate(expression = \"9/10+1/10-1/5+3/20-1/4\") == \"7/10\"\n assert candidate(expression = \"-1/10+2/9-3/8+4/7-5/6+6/5-7/4+8/3-9/2+10/1\") == \"17897/2520\"\n assert candidate(expression = \"1/5-2/5+3/5-4/5+5/5-6/5+7/5-8/5+9/5-10/5\") == \"-1/1\"\n assert candidate(expression = \"1/9+1/18+1/27+1/36+1/45+1/54+1/63+1/72+1/81+1/90\") == \"9841/30240\"\n assert candidate(expression = \"1/2+1/3+1/4+1/5+1/6+1/7+1/8+1/9+1/10\") == \"4861/2520\"\n assert candidate(expression = \"-1/2-1/3-1/4-1/5-1/6-1/7-1/8-1/9-1/10\") == \"-4861/2520\"\n assert candidate(expression = \"1/10-1/20+1/30-1/40+1/50\") == \"74/945\"\n assert candidate(expression = \"7/8-1/2+3/4-1/4+2/5\") == \"51/40\"\n assert candidate(expression = \"3/5-2/7+1/9-1/11+1/13-1/15+1/17\") == \"6101/15120\"\n assert candidate(expression = \"-1/10+2/10-3/10+4/10-5/10+6/10-7/10+8/10-9/10+10/10\") == \"1/2\"\n assert candidate(expression = \"1/2-1/2+1/2-1/2+1/2-1/2+1/2-1/2+1/2\") == \"1/2\"\n assert candidate(expression = \"-5/6+3/4-2/3+1/2\") == \"-1/4\"\n assert candidate(expression = \"10/10-9/10+8/10-7/10+6/10-5/10+4/10-3/10+2/10-1/10\") == \"1/2\"\n assert candidate(expression = \"1/7-2/7+3/7-4/7+5/7-6/7+8/7\") == \"5/7\"\n assert candidate(expression = \"1/1-1/2+1/3-1/4+1/5-1/6+1/7-1/8+1/9-1/10+1/11-1/12\") == \"19753/30240\"\n assert candidate(expression = \"10/9-9/8+8/7-7/6+6/5-5/4+4/3-3/2+2/1-1/1\") == \"1879/2520\"\n assert candidate(expression = \"1/2+1/3+1/5+1/7+1/11+1/13+1/17+1/19\") == \"11003/7560\"\n assert candidate(expression = \"11/12-10/11+9/10-8/9+7/8-6/7+5/6-4/5+3/4-2/3+1/2\") == \"19753/30240\"\n assert candidate(expression = \"1/10+1/9+1/8+1/7+1/6+1/5+1/4+1/3+1/2+1/1\") == \"7381/2520\"\n assert candidate(expression = \"-1/10-1/9-1/8-1/7-1/6-1/5-1/4-1/3-1/2-1/1\") == \"-7381/2520\"\n assert candidate(expression = \"-1/10+2/9-3/8+4/7-5/6+6/5-7/4+8/3-9/2\") == \"-7303/2520\"\n assert candidate(expression = \"1/2+2/3+3/4+4/5+5/6+6/7+7/8+8/9+9/10\") == \"17819/2520\"\n assert candidate(expression = \"-5/6+2/3-1/4+1/2+3/8-7/10\") == \"-29/120\"\n assert candidate(expression = \"1/10+2/9+3/8+4/7+5/6+6/5+7/4+8/3+9/2+10/1\") == \"55991/2520\"\n assert candidate(expression = \"-1/3+1/6-1/9+1/12-1/15+1/18-1/21+1/24-1/27+1/30\") == \"-1627/7560\"\n assert candidate(expression = \"1/3+2/5-3/7+4/9-5/11+6/13-7/15+8/17-9/19\") == \"1237/4320\"\n assert candidate(expression = \"7/8-3/4+5/6-1/3\") == \"5/8\"\n assert candidate(expression = \"-1/1+1/2-1/3+1/4-1/5+1/6-1/7+1/8-1/9+1/10\") == \"-1627/2520\"\n assert candidate(expression = \"9/10-8/9+7/8-6/7+5/6-4/5+3/4-2/3+1/2\") == \"1627/2520\"\n assert candidate(expression = \"5/9-2/3+1/6-1/12+1/18\") == \"1/36\"\n assert candidate(expression = \"-9/10+8/9-7/8+6/7-5/6+4/5-3/4+2/3-1/2\") == \"-1627/2520\"\n assert candidate(expression = \"1/5+2/5+3/5-4/5-3/5-2/5-1/5\") == \"-4/5\"\n assert candidate(expression = \"1/2+1/2+1/3+1/4+1/5+1/6+1/7+1/8+1/9+1/10\") == \"6121/2520\"\n assert candidate(expression = \"1/10+2/9-3/8+4/7-5/6+6/5-7/4+8/3-9/2+10/1\") == \"18401/2520\"\n assert candidate(expression = \"2/1-1/2+2/3-1/4+2/5-1/6+2/7-1/8+2/9-1/10\") == \"6131/2520\"\n assert candidate(expression = \"1/10+2/10+3/10+4/10+5/10+6/10+7/10+8/10+9/10\") == \"9/2\"\n assert candidate(expression = \"1/10+2/9+3/8+4/7+5/6+6/5+7/4+8/3+9/2+1/1\") == \"33311/2520\"\n assert candidate(expression = \"-1/2+3/4-5/6+7/8-9/10+11/12-13/14+15/16-17/18\") == \"-3161/5040\"\n assert candidate(expression = \"-1/10-1/9-1/8-1/7-1/6-1/5-1/4-1/3-1/2\") == \"-4861/2520\"\n assert candidate(expression = \"-1/3+2/5-3/7+4/9-5/11+6/13-7/15\") == \"-1901/5040\"\n assert candidate(expression = \"-1/2+1/3-1/4+1/5-1/6+1/7-1/8+1/9-1/10+1/11\") == \"-7967/30240\"\n assert candidate(expression = \"7/8-5/12+1/16-3/32\") == \"41/96\"\n assert candidate(expression = \"7/8-3/4+5/6-2/3+1/2\") == \"19/24\"\n assert candidate(expression = \"1/5-1/5+1/5-1/5+1/5-1/5+1/5-1/5+1/5-1/5+1/5\") == \"1/5\"\n assert candidate(expression = \"-1/2+1/3-1/4+1/5-1/6+1/7\") == \"-101/420\"\n assert candidate(expression = \"3/4+2/3-5/6+7/8-9/10+11/12\") == \"59/40\"\n assert candidate(expression = \"1/2+1/2+1/2+1/2+1/2+1/2+1/2+1/2+1/2+1/2\") == \"5/1\"\n assert candidate(expression = \"-1/2+3/4-5/6+7/8-9/10+11/12-13/14+15/16-17/18+19/20\") == \"1627/5040\"\n assert candidate(expression = \"1/1-1/2+1/3-1/4+1/5-1/6+1/7-1/8+1/9-1/10\") == \"1627/2520\"\n assert candidate(expression = \"1/10+2/9-3/8+4/7-5/6\") == \"-793/2520\"\n assert candidate(expression = \"9/10-7/8+5/6-3/4+1/2\") == \"73/120\"\n assert candidate(expression = \"-1/3+1/4-1/5+1/6-1/7+1/8-1/9+1/10-1/2\") == \"-1627/2520\"\n assert candidate(expression = \"-1/2+1/2-1/3+1/3-1/4+1/4-1/5+1/5\") == \"0/1\"\n assert candidate(expression = \"-3/5+2/5-1/5+4/5-3/5+2/5-1/5\") == \"0/1\"\n assert candidate(expression = \"10/1-9/1+8/1-7/1+6/1-5/1+4/1-3/1+2/1-1/1\") == \"5/1\"\n assert candidate(expression = \"1/7+2/7-3/7+4/7-5/7+6/7-1/7\") == \"4/7\"\n assert candidate(expression = \"-1/9+2/7-3/11+4/13-5/17+6/19\") == \"233/1008\"\n assert candidate(expression = \"1/2-1/3+1/4-1/5+1/6-1/7+1/8-1/9+1/10\") == \"893/2520\"\n assert candidate(expression = \"5/6-3/4+7/8-1/2+9/10\") == \"163/120\"\n assert candidate(expression = \"5/9-2/3+4/5-6/7+8/9-10/11\") == \"-5699/30240\"\n assert candidate(expression = \"5/8+7/9-2/5+3/4-1/6\") == \"571/360\"\n assert candidate(expression = \"-5/6+3/4-1/2+7/8\") == \"7/24\"\n assert candidate(expression = \"3/8+5/12-7/15+9/20-11/25+13/30\") == \"11617/15120\"\n assert candidate(expression = \"3/5-1/2+1/3-2/4+5/6-7/8+9/10\") == \"19/24\"\n assert candidate(expression = \"7/8-3/4+2/5-1/6\") == \"43/120\"\n"}, "metadata": {"canonical_parameter_names": ["expression"], "leetcode_dataset_entry_point": "Solution().fractionAddition", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var fractionAddition = function(expression) {", "container": null, "callable": "fractionAddition", "parameters": [{"name": "expression", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 593, "task_id": "valid-square", "difficulty": "Medium", "problem_description": "Given the coordinates of four points in 2D space p1, p2, p3 and p4, return true if the four points construct a square.\nThe coordinate of a point pi is represented as [xi, yi]. The input is not given in any order.\nA valid square has four equal sides with positive length and four equal angles (90-degree angles).\n \nExample 1:\n\nInput: p1 = [0,0], p2 = [1,1], p3 = [1,0], p4 = [0,1]\nOutput: true\n\nExample 2:\n\nInput: p1 = [0,0], p2 = [1,1], p3 = [1,0], p4 = [0,12]\nOutput: false\n\nExample 3:\n\nInput: p1 = [1,0], p2 = [-1,0], p3 = [0,1], p4 = [0,-1]\nOutput: true\n\n \nConstraints:\n\np1.length == p2.length == p3.length == p4.length == 2\n-104 <= xi, yi <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(p1 = [-1, -1],p2 = [-1, 1],p3 = [1, 1],p4 = [1, -1]) == True\n assert candidate(p1 = [1, 2],p2 = [3, 4],p3 = [5, 6],p4 = [7, 8]) == False\n assert candidate(p1 = [2, 2],p2 = [3, 3],p3 = [4, 4],p4 = [5, 5]) == False\n assert candidate(p1 = [0, 0],p2 = [0, 0],p3 = [0, 0],p4 = [0, 0]) == False\n assert candidate(p1 = [1, 0],p2 = [-1, 0],p3 = [0, 1],p4 = [0, -1]) == True\n assert candidate(p1 = [0, 0],p2 = [1, 1],p3 = [1, 0],p4 = [0, 12]) == False\n assert candidate(p1 = [1, 1],p2 = [1, 2],p3 = [2, 1],p4 = [2, 2]) == True\n assert candidate(p1 = [5, 5],p2 = [5, 6],p3 = [6, 6],p4 = [6, 5]) == True\n assert candidate(p1 = [0, 0],p2 = [1, 0],p3 = [1, 1],p4 = [0, 1]) == True\n assert candidate(p1 = [0, 0],p2 = [1, 2],p3 = [3, 2],p4 = [2, 0]) == False\n assert candidate(p1 = [0, 0],p2 = [1, 1],p3 = [2, 2],p4 = [3, 3]) == False\n assert candidate(p1 = [0, 0],p2 = [1, 1],p3 = [1, 2],p4 = [2, 1]) == False\n assert candidate(p1 = [1, 1],p2 = [2, 2],p3 = [3, 3],p4 = [4, 5]) == False\n assert candidate(p1 = [0, 0],p2 = [0, 1],p3 = [1, 1],p4 = [1, 0]) == True\n assert candidate(p1 = [0, 0],p2 = [1, 1],p3 = [1, 0],p4 = [0, 1]) == True\n assert candidate(p1 = [0, 0],p2 = [2, 0],p3 = [2, 2],p4 = [0, 2]) == True\n assert candidate(p1 = [0, 0],p2 = [5, 0],p3 = [5, 5],p4 = [0, 5]) == True\n assert candidate(p1 = [1, 1],p2 = [1, 1],p3 = [1, 1],p4 = [1, 1]) == False\n assert candidate(p1 = [2, 2],p2 = [3, 3],p3 = [3, 2],p4 = [2, 3]) == True\n assert candidate(p1 = [1, 1],p2 = [1, 2],p3 = [2, 2],p4 = [2, 1]) == True\n assert candidate(p1 = [1, 2],p2 = [4, 5],p3 = [7, 8],p4 = [10, 11]) == False\n assert candidate(p1 = [0, 0],p2 = [1, 0],p3 = [0, 1],p4 = [1, 1]) == True\n assert candidate(p1 = [-2, -2],p2 = [-2, 2],p3 = [2, 2],p4 = [2, -2]) == True\n assert candidate(p1 = [0, 1],p2 = [1, 0],p3 = [0, -1],p4 = [-1, 0]) == True\n assert candidate(p1 = [-1, -1],p2 = [1, 1],p3 = [0, 0],p4 = [2, 2]) == False\n assert candidate(p1 = [1, 1],p2 = [2, 2],p3 = [2, 3],p4 = [3, 2]) == False\n assert candidate(p1 = [-3, -3],p2 = [-2, -2],p3 = [-2, -1],p4 = [-1, -2]) == False\n assert candidate(p1 = [0, 0],p2 = [1, 1],p3 = [2, 0],p4 = [1, 2]) == False\n assert candidate(p1 = [1000, -1000],p2 = [-1000, 1000],p3 = [1000, 1000],p4 = [-1000, -1000]) == True\n assert candidate(p1 = [-3, -3],p2 = [-3, 0],p3 = [0, -3],p4 = [0, 0]) == True\n assert candidate(p1 = [1, 0],p2 = [0, 1],p3 = [-1, 0],p4 = [0, -1]) == True\n assert candidate(p1 = [-3, -3],p2 = [-3, -2],p3 = [-2, -2],p4 = [-2, -3]) == True\n assert candidate(p1 = [10, 0],p2 = [0, 10],p3 = [-10, 0],p4 = [0, -10]) == True\n assert candidate(p1 = [1, 1],p2 = [1, 3],p3 = [3, 1],p4 = [3, 3]) == True\n assert candidate(p1 = [-5, 2],p2 = [-2, 5],p3 = [1, 2],p4 = [-2, -1]) == True\n assert candidate(p1 = [1, 2],p2 = [3, 4],p3 = [2, 1],p4 = [0, -1]) == False\n assert candidate(p1 = [-1, -1],p2 = [-1, 0],p3 = [0, -1],p4 = [0, 0]) == True\n assert candidate(p1 = [0, 1],p2 = [1, 0],p3 = [1, 2],p4 = [2, 1]) == True\n assert candidate(p1 = [1, 1],p2 = [2, 1],p3 = [2, 2],p4 = [1, 2]) == True\n assert candidate(p1 = [-2, -2],p2 = [-2, 2],p3 = [2, -2],p4 = [2, 2]) == True\n assert candidate(p1 = [1, 0],p2 = [0, 1],p3 = [-1, 0],p4 = [0, -1]) == True\n assert candidate(p1 = [-1, -1],p2 = [0, 0],p3 = [1, -1],p4 = [0, -2]) == True\n assert candidate(p1 = [1000, 1000],p2 = [1001, 1001],p3 = [1001, 1000],p4 = [1000, 1001]) == True\n assert candidate(p1 = [5, 5],p2 = [6, 5],p3 = [6, 6],p4 = [5, 6]) == True\n assert candidate(p1 = [7, 7],p2 = [7, 9],p3 = [9, 7],p4 = [9, 9]) == True\n assert candidate(p1 = [5, 5],p2 = [5, 10],p3 = [10, 10],p4 = [10, 5]) == True\n assert candidate(p1 = [0, 0],p2 = [0, 3],p3 = [3, 3],p4 = [3, 0]) == True\n assert candidate(p1 = [1, 1],p2 = [1, 2],p3 = [2, 1],p4 = [2, 3]) == False\n assert candidate(p1 = [0, 0],p2 = [0, 5],p3 = [5, 5],p4 = [5, 0]) == True\n assert candidate(p1 = [0, 0],p2 = [0, 2],p3 = [2, 0],p4 = [2, 2]) == True\n assert candidate(p1 = [0, 0],p2 = [0, 2],p3 = [2, 2],p4 = [2, 0]) == True\n assert candidate(p1 = [0, 0],p2 = [1, 1],p3 = [1, 0],p4 = [0, -1]) == False\n assert candidate(p1 = [10, 10],p2 = [14, 14],p3 = [14, 10],p4 = [10, 14]) == True\n assert candidate(p1 = [-100, -100],p2 = [-99, -99],p3 = [-99, -100],p4 = [-100, -99]) == True\n assert candidate(p1 = [1, 0],p2 = [0, 1],p3 = [1, 2],p4 = [2, 1]) == True\n assert candidate(p1 = [-1000, -1000],p2 = [-999, -999],p3 = [-999, -1000],p4 = [-1000, -999]) == True\n assert candidate(p1 = [1, 1],p2 = [1, 3],p3 = [3, 1],p4 = [3, 3]) == True\n assert candidate(p1 = [1, 1],p2 = [2, 2],p3 = [3, 3],p4 = [4, 4]) == False\n assert candidate(p1 = [0, 0],p2 = [0, 0],p3 = [0, 0],p4 = [0, 0]) == False\n assert candidate(p1 = [-10000, -10000],p2 = [-10000, -9999],p3 = [-9999, -10000],p4 = [-9999, -9999]) == True\n assert candidate(p1 = [5, 5],p2 = [6, 6],p3 = [7, 7],p4 = [8, 8]) == False\n assert candidate(p1 = [3, 3],p2 = [6, 6],p3 = [6, 3],p4 = [3, 6]) == True\n assert candidate(p1 = [-5, -5],p2 = [-10, -5],p3 = [-10, -10],p4 = [-5, -10]) == True\n assert candidate(p1 = [0, 0],p2 = [1, 1],p3 = [1, 0],p4 = [0, -1]) == False\n assert candidate(p1 = [3, 3],p2 = [6, 3],p3 = [6, 6],p4 = [3, 6]) == True\n assert candidate(p1 = [-2, -2],p2 = [-1, -1],p3 = [1, 1],p4 = [2, 2]) == False\n assert candidate(p1 = [10, 10],p2 = [10, 20],p3 = [20, 10],p4 = [20, 20]) == True\n assert candidate(p1 = [1, 1],p2 = [1, 3],p3 = [3, 3],p4 = [3, 1]) == True\n assert candidate(p1 = [-1, -1],p2 = [1, 1],p3 = [1, -1],p4 = [-1, 1]) == True\n assert candidate(p1 = [1000, 1000],p2 = [1001, 1001],p3 = [1001, 1000],p4 = [1000, 1001]) == True\n assert candidate(p1 = [0, 0],p2 = [1, 1],p3 = [2, 2],p4 = [3, 3]) == False\n assert candidate(p1 = [5, 5],p2 = [6, 6],p3 = [6, 5],p4 = [5, 6]) == True\n assert candidate(p1 = [1, 2],p2 = [3, 4],p3 = [5, 6],p4 = [7, 8]) == False\n assert candidate(p1 = [1, 2],p2 = [4, 5],p3 = [7, 2],p4 = [4, -1]) == True\n assert candidate(p1 = [0, 0],p2 = [0, 1],p3 = [1, 0],p4 = [2, 1]) == False\n assert candidate(p1 = [-2, -2],p2 = [-2, -3],p3 = [-3, -3],p4 = [-3, -2]) == True\n assert candidate(p1 = [1, 1],p2 = [4, 5],p3 = [5, 4],p4 = [8, 8]) == False\n assert candidate(p1 = [100, 100],p2 = [101, 101],p3 = [101, 100],p4 = [100, 101]) == True\n assert candidate(p1 = [0, 0],p2 = [0, 10000],p3 = [10000, 0],p4 = [10000, 10000]) == True\n assert candidate(p1 = [5, 5],p2 = [5, 10],p3 = [10, 5],p4 = [10, 10]) == True\n assert candidate(p1 = [1000, 1000],p2 = [1000, 2000],p3 = [2000, 2000],p4 = [2000, 1000]) == True\n assert candidate(p1 = [1, 1],p2 = [2, 2],p3 = [3, 3],p4 = [4, 4]) == False\n assert candidate(p1 = [0, 1],p2 = [1, 0],p3 = [0, -1],p4 = [-1, 0]) == True\n assert candidate(p1 = [3, 4],p2 = [6, 8],p3 = [9, 5],p4 = [6, 1]) == False\n assert candidate(p1 = [-2, -2],p2 = [-1, -1],p3 = [-2, -1],p4 = [-1, -2]) == True\n assert candidate(p1 = [5, 5],p2 = [8, 5],p3 = [8, 8],p4 = [5, 8]) == True\n assert candidate(p1 = [10000, 10000],p2 = [10001, 10001],p3 = [10001, 10000],p4 = [10000, 9999]) == False\n assert candidate(p1 = [-5, 5],p2 = [-4, 4],p3 = [-4, 5],p4 = [-5, 4]) == True\n assert candidate(p1 = [0, 0],p2 = [0, 4],p3 = [4, 4],p4 = [4, 0]) == True\n"}, "metadata": {"canonical_parameter_names": ["p1", "p2", "p3", "p4"], "leetcode_dataset_entry_point": "Solution().validSquare", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var validSquare = function(p1, p2, p3, p4) {", "container": null, "callable": "validSquare", "parameters": [{"name": "p1", "type": "number[]"}, {"name": "p2", "type": "number[]"}, {"name": "p3", "type": "number[]"}, {"name": "p4", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 594, "task_id": "longest-harmonious-subsequence", "difficulty": "Easy", "problem_description": "We define a harmonious array as an array where the difference between its maximum value and its minimum value is exactly 1.\nGiven an integer array nums, return the length of its longest harmonious subsequence among all its possible subsequences.\n \nExample 1:\n\nInput: nums = [1,3,2,2,5,2,3,7]\nOutput: 5\nExplanation:\nThe longest harmonious subsequence is [3,2,2,2,3].\n\nExample 2:\n\nInput: nums = [1,2,3,4]\nOutput: 2\nExplanation:\nThe longest harmonious subsequences are [1,2], [2,3], and [3,4], all of which have a length of 2.\n\nExample 3:\n\nInput: nums = [1,1,1,1]\nOutput: 0\nExplanation:\nNo harmonic subsequence exists.\n\n \nConstraints:\n\n1 <= nums.length <= 2 * 104\n-109 <= nums[i] <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [5, 5, 5, 6]) == 4\n assert candidate(nums = [-1, 0, -1, 0, -1, 0, -1]) == 7\n assert candidate(nums = [1, 1, 1, 1]) == 0\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 9\n assert candidate(nums = [2, 1]) == 2\n assert candidate(nums = [1, 2, 2, 1]) == 4\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 2\n assert candidate(nums = [5, 5, 5, 6, 6, 7, 7, 7, 7, 8]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(nums = [1000000000, 1000000001, 1000000000, 1000000001, 1000000000]) == 5\n assert candidate(nums = [1]) == 0\n assert candidate(nums = [1, 2, 3, 4]) == 2\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5]) == 7\n assert candidate(nums = [0, 0, 0, 1, 1, 2, 2, 2, 2, 2]) == 7\n assert candidate(nums = [0, -1, -2, -3, 1, 2, 3]) == 2\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1]) == 2\n assert candidate(nums = [1000000000, -1000000000]) == 0\n assert candidate(nums = [-1, 0, -1, 0, -1, 0, 0]) == 7\n assert candidate(nums = [1, 3, 2, 2, 5, 2, 3, 7]) == 5\n assert candidate(nums = [5, 5, 5, 6, 6, 7]) == 5\n assert candidate(nums = [-1, -1, -1, 0, 0, 1, 1, 1, 2]) == 5\n assert candidate(nums = [1, 2, 3, 2, 1, 2, 3, 4, 5, 4, 5, 6, 5, 6, 7]) == 5\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 7\n assert candidate(nums = [-1, 0, -1, 1, 0, 0, 1, 1]) == 6\n assert candidate(nums = [10, 9, 9, 8, 8, 11, 11]) == 4\n assert candidate(nums = [5, 4, 2, 3, 3, 4, 5, 6]) == 4\n assert candidate(nums = [1, 2]) == 2\n assert candidate(nums = [5, 5, 5, 6, 6, 7, 8, 8, 8, 9, 9]) == 5\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5]) == 4\n assert candidate(nums = [0, 0, 0, 1, 1, 1, 2, 2, 2]) == 6\n assert candidate(nums = [10, 9, 9, 8, 7, 6, 6, 6, 5, 4, 3, 2, 1]) == 4\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == 11\n assert candidate(nums = [1000000000, 999999999, 1000000000, 1000000001, 999999998, 1000000002, 1000000000]) == 4\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 2\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 20\n assert candidate(nums = [-10, -9, -9, -8, -8, -7, -6, -5, -4, -4, -4, -3, -2, -1, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6]) == 10\n assert candidate(nums = [100, 101, 100, 101, 100, 101, 100, 101, 100, 101, 100, 101, 100, 101, 100, 101, 100, 101, 100, 101]) == 20\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 39\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == 4\n assert candidate(nums = [100, 101, 100, 100, 99, 101, 102, 103, 98, 99, 100, 101, 102]) == 7\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12]) == 4\n assert candidate(nums = [5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 5, 5, 6, 6, 5, 5, 5, 5, 6, 6, 6, 6, 5, 5, 5, 6, 6, 6, 6, 6, 5, 5, 5, 5]) == 34\n assert candidate(nums = [-5, -4, -4, -3, -3, -2, -2, -1, -1, 0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 8, 8, 9, 9, 9, 10]) == 6\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == 11\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 2\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 22\n assert candidate(nums = [1000000000, -999999999, 1000000000, -999999999, 1000000000, -999999999]) == 0\n assert candidate(nums = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11, 13, 12, 14, 13, 15, 14, 16, 15, 17, 16, 18, 17, 19, 18]) == 4\n assert candidate(nums = [5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 40\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == 6\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(nums = [20, 19, 21, 18, 22, 17, 23, 16, 24, 15, 25, 14, 26, 13, 27, 12, 28, 11, 29, 10, 30, 9, 31, 8, 32, 7, 33, 6, 34, 5, 35, 4, 36, 3]) == 2\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 2\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5]) == 11\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 1, 2, 2]) == 8\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == 4\n assert candidate(nums = [100, 101, 99, 100, 101, 102, 98, 99, 100, 101, 102, 103, 97, 98, 99]) == 6\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]) == 2\n assert candidate(nums = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3]) == 0\n assert candidate(nums = [50, 49, 51, 48, 52, 47, 53, 46, 54, 45, 55, 44, 56, 43, 57, 42, 58, 41, 59, 40, 60, 39, 61, 38, 62, 37, 63, 36, 64, 35]) == 2\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 30\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 39\n assert candidate(nums = [5, 6, 5, 6, 6, 7, 8, 5, 6, 7, 7, 7, 8, 8, 8, 8]) == 9\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 44\n assert candidate(nums = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 2\n assert candidate(nums = [3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 3, 4, 5, 3, 4, 5, 3, 4, 5, 3, 4, 5]) == 18\n assert candidate(nums = [1000000000, 999999999, 1000000000, 999999999, 1000000000, 999999999, 1000000000, 999999999, 1000000000, 999999999]) == 10\n assert candidate(nums = [-2, -1, -1, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4]) == 7\n assert candidate(nums = [-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 6\n assert candidate(nums = [10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9]) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(nums = [10, 10, 10, 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 5, 5, 4, 4, 4, 3, 3, 2, 2, 1, 1]) == 6\n assert candidate(nums = [-5, -6, -4, -5, -5, -5, -6, -6, -4, -4, -4, -3, -3, -2, -2, -1, -1, 0, 0]) == 8\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 44\n assert candidate(nums = [10, 9, 9, 8, 7, 6, 6, 5, 4, 4, 4, 3, 3, 2, 2, 1, 0, -1, -2, -2, -2]) == 5\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 3\n assert candidate(nums = [5, 4, 5, 6, 7, 8, 5, 6, 5, 6, 5]) == 8\n assert candidate(nums = [5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 8]) == 6\n assert candidate(nums = [5, 6, 5, 7, 8, 6, 6, 7, 7, 8, 9, 9, 10, 10, 10, 9]) == 6\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 41\n assert candidate(nums = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 4\n assert candidate(nums = [10, 10, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 6, 6, 5]) == 11\n assert candidate(nums = [1, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11, 13, 12, 14, 13, 15, 14, 16, 15, 17, 16, 18, 17, 19, 18, 20]) == 4\n assert candidate(nums = [1000000000, 999999999, 1000000001, 1000000000, 999999999, 1000000001, 1000000000, 999999999, 1000000001]) == 6\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 6\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == 19\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]) == 6\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 20\n assert candidate(nums = [5, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8]) == 9\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 6\n assert candidate(nums = [10, 9, 10, 8, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -1, 0]) == 5\n assert candidate(nums = [-1000000000, -999999999, -1000000000, -999999999, -1000000000, -999999999, -1000000000, -999999999]) == 8\n assert candidate(nums = [1000000000, 999999999, 1000000000, 999999999, 1000000000, 999999999, 1000000000, 999999999]) == 8\n assert candidate(nums = [500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471]) == 2\n assert candidate(nums = [42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23]) == 2\n assert candidate(nums = [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79]) == 2\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == 11\n assert candidate(nums = [1000000000, 999999999, 1000000001, 1000000000, 999999999, 1000000001, 1000000000]) == 5\n assert candidate(nums = [-100, -99, -98, -97, -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, -86, -85, -84, -83, -82, -81, -80, -79, -78, -77, -76, -75, -74, -73, -72, -71, -70, -69, -68, -67, -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53, -52, -51, -50, -49, -48, -47, -46, -45, -44, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(nums = [1, 3, 2, 2, 5, 2, 3, 7, 1, 3, 2, 2, 5, 2, 3, 7, 1, 3, 2, 2, 5, 2, 3, 7, 1, 3, 2, 2, 5, 2, 3, 7]) == 20\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 20\n assert candidate(nums = [1000000000, -1000000000, 1000000000, -1000000000, 1000000000, -1000000000]) == 0\n assert candidate(nums = [1000000000, 999999999, 1000000000, 999999999, 1000000000]) == 5\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10]) == 8\n assert candidate(nums = [100, 99, 101, 98, 102, 97, 103, 96, 104, 95, 105, 94, 106, 93, 107, 92, 108, 91, 109, 90]) == 2\n assert candidate(nums = [5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9]) == 9\n assert candidate(nums = [0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 16\n assert candidate(nums = [-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(nums = [42, 41, 42, 41, 42, 41, 42, 41, 42, 41, 42, 41, 42, 41, 42, 41, 42, 41, 42, 41, 42, 41, 42, 41, 42, 41, 42, 41]) == 28\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().findLHS", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findLHS = function(nums) {", "container": null, "callable": "findLHS", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 598, "task_id": "range-addition-ii", "difficulty": "Easy", "problem_description": "You are given an m x n matrix M initialized with all 0's and an array of operations ops, where ops[i] = [ai, bi] means M[x][y] should be incremented by one for all 0 <= x < ai and 0 <= y < bi.\nCount and return the number of maximum integers in the matrix after performing all the operations.\n \nExample 1:\n\n\nInput: m = 3, n = 3, ops = [[2,2],[3,3]]\nOutput: 4\nExplanation: The maximum integer in M is 2, and there are four of it in M. So return 4.\n\nExample 2:\n\nInput: m = 3, n = 3, ops = [[2,2],[3,3],[3,3],[3,3],[2,2],[3,3],[3,3],[3,3],[2,2],[3,3],[3,3],[3,3]]\nOutput: 4\n\nExample 3:\n\nInput: m = 3, n = 3, ops = []\nOutput: 9\n\n \nConstraints:\n\n1 <= m, n <= 4 * 104\n0 <= ops.length <= 104\nops[i].length == 2\n1 <= ai <= m\n1 <= bi <= n\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(m = 5,n = 4,ops = [[2, 2]]) == 4\n assert candidate(m = 1,n = 1,ops = []) == 1\n assert candidate(m = 2,n = 2,ops = [[2, 2], [1, 1], [2, 2]]) == 1\n assert candidate(m = 1,n = 1,ops = [[1, 1]]) == 1\n assert candidate(m = 4,n = 5,ops = [[1, 1], [2, 2], [3, 3]]) == 1\n assert candidate(m = 1,n = 1,ops = [[1, 1], [1, 1], [1, 1]]) == 1\n assert candidate(m = 4,n = 5,ops = [[2, 3], [3, 4]]) == 6\n assert candidate(m = 5,n = 5,ops = [[4, 4], [3, 3], [2, 2], [1, 1]]) == 1\n assert candidate(m = 3,n = 3,ops = [[2, 2], [3, 3]]) == 4\n assert candidate(m = 3,n = 3,ops = [[2, 2], [3, 3], [3, 3], [3, 3], [2, 2], [3, 3], [3, 3], [3, 3], [2, 2], [3, 3], [3, 3], [3, 3]]) == 4\n assert candidate(m = 2,n = 2,ops = [[2, 1], [1, 2]]) == 1\n assert candidate(m = 10000,n = 10000,ops = [[10000, 10000], [5000, 5000]]) == 25000000\n assert candidate(m = 2,n = 2,ops = [[1, 2], [2, 1]]) == 1\n assert candidate(m = 5,n = 5,ops = [[5, 5], [4, 4], [3, 3], [2, 2], [1, 1]]) == 1\n assert candidate(m = 3,n = 3,ops = []) == 9\n assert candidate(m = 12,n = 14,ops = [[6, 7], [9, 10], [4, 5], [11, 12], [3, 4]]) == 12\n assert candidate(m = 6,n = 6,ops = [[3, 3], [3, 3], [3, 3], [3, 3]]) == 9\n assert candidate(m = 6,n = 6,ops = [[2, 3], [3, 4], [4, 5], [5, 6]]) == 6\n assert candidate(m = 12,n = 12,ops = [[4, 4], [8, 8], [6, 6], [12, 12], [2, 2], [10, 10]]) == 4\n assert candidate(m = 9,n = 11,ops = [[6, 7], [3, 4], [8, 9], [2, 2], [5, 5]]) == 4\n assert candidate(m = 10,n = 10,ops = [[5, 5], [3, 3], [8, 8]]) == 9\n assert candidate(m = 3,n = 6,ops = [[1, 2], [2, 3], [3, 4], [2, 5], [1, 6]]) == 2\n assert candidate(m = 7,n = 6,ops = [[5, 5], [3, 3], [2, 2], [4, 4], [6, 6]]) == 4\n assert candidate(m = 4,n = 7,ops = [[2, 3], [3, 4], [1, 2], [4, 5]]) == 2\n assert candidate(m = 7,n = 5,ops = [[3, 3], [5, 4], [2, 2], [4, 3], [3, 3], [5, 5]]) == 4\n assert candidate(m = 5000,n = 5000,ops = [[2500, 2500], [2500, 2500], [2500, 2500], [2500, 2500], [2500, 2500]]) == 6250000\n assert candidate(m = 7,n = 3,ops = [[5, 2], [6, 1], [7, 3], [4, 3]]) == 4\n assert candidate(m = 12,n = 8,ops = [[8, 6], [6, 4], [4, 2], [2, 1]]) == 2\n assert candidate(m = 6,n = 5,ops = [[5, 5], [4, 4], [3, 3], [2, 2], [1, 1]]) == 1\n assert candidate(m = 7,n = 5,ops = [[4, 3], [6, 2], [7, 5]]) == 8\n assert candidate(m = 8,n = 7,ops = [[6, 6], [4, 5], [2, 3], [1, 1]]) == 1\n assert candidate(m = 15,n = 10,ops = [[5, 5], [10, 10], [3, 3], [1, 1], [7, 7], [8, 8]]) == 1\n assert candidate(m = 5,n = 5,ops = [[1, 5], [2, 4], [3, 3], [4, 2], [5, 1]]) == 1\n assert candidate(m = 10,n = 1,ops = [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1]]) == 1\n assert candidate(m = 6,n = 6,ops = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]) == 1\n assert candidate(m = 40000,n = 40000,ops = [[20000, 20000], [15000, 15000], [10000, 10000]]) == 100000000\n assert candidate(m = 20,n = 15,ops = [[10, 10], [5, 5], [15, 15], [8, 8], [12, 12], [7, 7]]) == 25\n assert candidate(m = 9,n = 6,ops = [[4, 4], [5, 5], [6, 6], [3, 3], [2, 2], [1, 1]]) == 1\n assert candidate(m = 10,n = 10,ops = [[5, 5], [7, 7], [3, 3], [2, 2]]) == 4\n assert candidate(m = 4000,n = 4000,ops = [[2000, 2000], [1000, 1000], [3000, 3000], [500, 500]]) == 250000\n assert candidate(m = 8,n = 6,ops = [[2, 3], [4, 4], [3, 5], [5, 6]]) == 6\n assert candidate(m = 9,n = 9,ops = [[9, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1]]) == 1\n assert candidate(m = 50,n = 50,ops = [[25, 25], [20, 20], [15, 15], [10, 10], [5, 5]]) == 25\n assert candidate(m = 15,n = 10,ops = [[5, 5], [5, 10], [10, 5], [10, 10]]) == 25\n assert candidate(m = 2000,n = 3000,ops = [[1000, 1500], [500, 1000], [1500, 2000], [750, 1250]]) == 500000\n assert candidate(m = 20,n = 10,ops = [[10, 5], [9, 4], [8, 3], [7, 2], [6, 1]]) == 6\n assert candidate(m = 8,n = 8,ops = [[8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1]]) == 1\n assert candidate(m = 20,n = 10,ops = [[10, 5], [15, 3], [20, 10]]) == 30\n assert candidate(m = 8,n = 8,ops = [[2, 2], [4, 4], [6, 6], [8, 8], [4, 4], [6, 6], [2, 2]]) == 4\n assert candidate(m = 7,n = 7,ops = [[7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1]]) == 1\n assert candidate(m = 10,n = 10,ops = [[5, 5], [4, 4], [6, 6], [7, 7]]) == 16\n assert candidate(m = 5,n = 6,ops = [[3, 3], [4, 4], [2, 2]]) == 4\n assert candidate(m = 12,n = 9,ops = [[3, 3], [6, 6], [9, 9], [4, 4], [7, 7], [5, 5]]) == 9\n assert candidate(m = 16,n = 10,ops = [[10, 8], [8, 6], [6, 4], [4, 2], [2, 1]]) == 2\n assert candidate(m = 10,n = 15,ops = [[5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 25\n assert candidate(m = 10000,n = 10000,ops = [[9000, 9000], [8000, 8000], [7000, 7000]]) == 49000000\n assert candidate(m = 9,n = 10,ops = [[3, 5], [6, 7], [2, 4], [8, 9], [5, 6], [4, 8], [7, 10]]) == 8\n assert candidate(m = 100,n = 100,ops = [[50, 50], [75, 75], [25, 25], [100, 100]]) == 625\n assert candidate(m = 10000,n = 10000,ops = [[5000, 5000], [2500, 2500], [7500, 7500]]) == 6250000\n assert candidate(m = 8,n = 6,ops = [[6, 5], [5, 4], [4, 3], [3, 2], [2, 1]]) == 2\n assert candidate(m = 7,n = 8,ops = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]]) == 1\n assert candidate(m = 8,n = 8,ops = [[2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]]) == 4\n assert candidate(m = 20,n = 20,ops = [[10, 10], [15, 15], [5, 5], [12, 12], [18, 18], [8, 8]]) == 25\n assert candidate(m = 2,n = 4,ops = [[1, 1], [2, 2], [1, 4], [2, 1]]) == 1\n assert candidate(m = 4,n = 5,ops = [[1, 1], [2, 2], [3, 3], [4, 4], [1, 1], [2, 2], [3, 3]]) == 1\n assert candidate(m = 20,n = 10,ops = [[5, 3], [10, 5], [15, 7], [20, 9]]) == 15\n assert candidate(m = 40000,n = 40000,ops = [[20000, 20000], [30000, 30000]]) == 400000000\n assert candidate(m = 5,n = 6,ops = [[3, 4], [2, 3], [4, 5]]) == 6\n assert candidate(m = 3000,n = 2000,ops = [[1000, 1000], [2000, 1500], [500, 500], [1500, 1000]]) == 250000\n assert candidate(m = 5,n = 5,ops = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) == 1\n assert candidate(m = 5,n = 5,ops = [[3, 4], [4, 3], [2, 5], [5, 2], [1, 1]]) == 1\n assert candidate(m = 6,n = 3,ops = [[2, 1], [3, 2], [4, 3]]) == 2\n assert candidate(m = 4000,n = 4000,ops = [[2000, 2000], [3000, 3000], [1000, 1000], [4000, 4000]]) == 1000000\n assert candidate(m = 6,n = 6,ops = [[3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3]]) == 9\n assert candidate(m = 5000,n = 4000,ops = [[4000, 3000], [3500, 2500], [3000, 2000], [2500, 1500], [2000, 1000]]) == 2000000\n assert candidate(m = 40000,n = 40000,ops = [[20000, 20000], [30000, 30000], [40000, 40000]]) == 400000000\n assert candidate(m = 10000,n = 10000,ops = [[9000, 9000], [8000, 8000], [7000, 7000], [6000, 6000]]) == 36000000\n assert candidate(m = 3000,n = 2000,ops = [[1500, 1000], [2500, 1500], [500, 500], [3000, 2000]]) == 250000\n assert candidate(m = 8,n = 8,ops = [[6, 6], [7, 7], [4, 4], [5, 5], [3, 3]]) == 9\n assert candidate(m = 20,n = 20,ops = [[10, 10], [15, 15], [5, 5], [20, 20], [8, 8]]) == 25\n assert candidate(m = 5000,n = 3000,ops = [[2500, 1500], [4000, 2500], [1000, 500], [5000, 3000]]) == 500000\n assert candidate(m = 6,n = 6,ops = [[3, 4], [4, 5], [5, 6], [2, 3]]) == 6\n assert candidate(m = 8,n = 6,ops = [[3, 3], [5, 4], [7, 6]]) == 9\n assert candidate(m = 4,n = 4,ops = [[4, 4], [3, 3], [2, 2], [1, 1]]) == 1\n assert candidate(m = 6,n = 4,ops = [[2, 3], [4, 2], [5, 1]]) == 2\n assert candidate(m = 10,n = 10,ops = [[5, 5], [4, 4], [3, 3], [2, 2], [1, 1]]) == 1\n assert candidate(m = 8,n = 8,ops = [[6, 7], [7, 8], [4, 5], [5, 6], [3, 4], [4, 5], [2, 3], [3, 4]]) == 6\n assert candidate(m = 10,n = 10,ops = [[5, 5], [7, 7], [9, 9], [8, 8]]) == 25\n assert candidate(m = 2000,n = 1000,ops = [[1000, 500], [1500, 750], [500, 250], [2000, 1000]]) == 125000\n assert candidate(m = 10,n = 10,ops = [[5, 5], [7, 7], [8, 8], [9, 9], [10, 10]]) == 25\n assert candidate(m = 8,n = 5,ops = [[2, 3], [4, 5], [6, 4], [7, 3], [5, 2]]) == 4\n assert candidate(m = 15,n = 15,ops = [[10, 10], [12, 12], [14, 14], [15, 15], [1, 1], [2, 2], [3, 3]]) == 1\n assert candidate(m = 15,n = 15,ops = [[10, 10], [5, 5], [12, 12], [7, 7], [8, 8]]) == 25\n assert candidate(m = 1,n = 10,ops = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10]]) == 1\n assert candidate(m = 2,n = 2,ops = [[1, 1], [1, 2], [2, 1], [2, 2]]) == 1\n assert candidate(m = 100,n = 100,ops = [[50, 50], [25, 25], [75, 75], [90, 90]]) == 625\n assert candidate(m = 15,n = 10,ops = [[3, 5], [4, 6], [10, 8], [15, 10]]) == 15\n assert candidate(m = 5,n = 4,ops = [[2, 3], [3, 4], [4, 5]]) == 6\n assert candidate(m = 10,n = 10,ops = [[5, 5], [3, 3], [7, 7], [2, 2], [8, 8]]) == 4\n assert candidate(m = 10,n = 10,ops = [[9, 9], [8, 8], [7, 7], [6, 6], [5, 5]]) == 25\n assert candidate(m = 5,n = 5,ops = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 1\n assert candidate(m = 10,n = 15,ops = [[5, 5], [7, 7], [3, 3]]) == 9\n assert candidate(m = 20,n = 15,ops = [[10, 10], [5, 5], [15, 15], [12, 12]]) == 25\n assert candidate(m = 5,n = 4,ops = [[3, 2], [4, 3], [2, 4]]) == 4\n assert candidate(m = 1,n = 10000,ops = [[1, 1], [1, 1], [1, 1], [1, 1]]) == 1\n assert candidate(m = 1000,n = 1000,ops = [[500, 500], [999, 999], [1, 1], [500, 500]]) == 1\n assert candidate(m = 12,n = 15,ops = [[6, 6], [5, 5], [7, 7], [8, 8], [9, 9], [10, 10]]) == 25\n assert candidate(m = 15,n = 20,ops = [[10, 15], [12, 18], [5, 10], [3, 4]]) == 12\n assert candidate(m = 10000,n = 1,ops = [[1, 1], [1, 1], [1, 1], [1, 1]]) == 1\n assert candidate(m = 100,n = 100,ops = [[50, 50], [75, 75], [25, 25]]) == 625\n assert candidate(m = 5,n = 4,ops = [[2, 2], [3, 3], [1, 4]]) == 2\n assert candidate(m = 5,n = 4,ops = [[2, 2], [3, 3], [4, 4], [1, 1]]) == 1\n"}, "metadata": {"canonical_parameter_names": ["m", "n", "ops"], "leetcode_dataset_entry_point": "Solution().maxCount", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxCount = function(m, n, ops) {", "container": null, "callable": "maxCount", "parameters": [{"name": "m", "type": "number"}, {"name": "n", "type": "number"}, {"name": "ops", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 599, "task_id": "minimum-index-sum-of-two-lists", "difficulty": "Easy", "problem_description": "Given two arrays of strings list1 and list2, find the common strings with the least index sum.\nA common string is a string that appeared in both list1 and list2.\nA common string with the least index sum is a common string such that if it appeared at list1[i] and list2[j] then i + j should be the minimum value among all the other common strings.\nReturn all the common strings with the least index sum. Return the answer in any order.\n \nExample 1:\n\nInput: list1 = [\"Shogun\",\"Tapioca Express\",\"Burger King\",\"KFC\"], list2 = [\"Piatti\",\"The Grill at Torrey Pines\",\"Hungry Hunter Steakhouse\",\"Shogun\"]\nOutput: [\"Shogun\"]\nExplanation: The only common string is \"Shogun\".\n\nExample 2:\n\nInput: list1 = [\"Shogun\",\"Tapioca Express\",\"Burger King\",\"KFC\"], list2 = [\"KFC\",\"Shogun\",\"Burger King\"]\nOutput: [\"Shogun\"]\nExplanation: The common string with the least index sum is \"Shogun\" with index sum = (0 + 1) = 1.\n\nExample 3:\n\nInput: list1 = [\"happy\",\"sad\",\"good\"], list2 = [\"sad\",\"happy\",\"good\"]\nOutput: [\"sad\",\"happy\"]\nExplanation: There are three common strings:\n\"happy\" with index sum = (0 + 1) = 1.\n\"sad\" with index sum = (1 + 0) = 1.\n\"good\" with index sum = (2 + 2) = 4.\nThe strings with the least index sum are \"sad\" and \"happy\".\n\n \nConstraints:\n\n1 <= list1.length, list2.length <= 1000\n1 <= list1[i].length, list2[i].length <= 30\nlist1[i] and list2[i] consist of spaces ' ' and English letters.\nAll the strings of list1 are unique.\nAll the strings of list2 are unique.\nThere is at least a common string between list1 and list2.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(list1 = ['a', 'b', 'c', 'd', 'e'],list2 = ['e', 'd', 'c', 'b', 'a']) == ['a', 'b', 'c', 'd', 'e']\n assert candidate(list1 = ['happy', 'sad', 'good'],list2 = ['sad', 'happy', 'good']) == ['happy', 'sad']\n assert candidate(list1 = ['apple', 'banana'],list2 = ['banana', 'apple']) == ['apple', 'banana']\n assert candidate(list1 = ['Shogun', 'Tapioca Express', 'Burger King', 'KFC'],list2 = ['Piatti', 'The Grill at Torrey Pines', 'Hungry Hunter Steakhouse', 'Shogun']) == ['Shogun']\n assert candidate(list1 = ['Shogun', 'Tapioca Express', 'Burger King', 'KFC'],list2 = ['KFC', 'Shogun', 'Burger King']) == ['Shogun']\n assert candidate(list1 = ['carrot', 'apple', 'banana', 'date'],list2 = ['banana', 'date', 'apple', 'fig', 'carrot']) == ['banana']\n assert candidate(list1 = ['x', 'y', 'z'],list2 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == ['x']\n assert candidate(list1 = ['Hotel California', 'Fever Tree', 'Hotel Armenia', 'Hotel Greece'],list2 = ['Hotel Greece', 'Hotel Armenia', 'Fever Tree', 'Hotel California']) == ['Hotel California', 'Fever Tree', 'Hotel Armenia', 'Hotel Greece']\n assert candidate(list1 = ['dog', 'cat', 'bird', 'fish'],list2 = ['fish', 'bird', 'cat', 'dog', 'ant', 'bee', 'fly', 'spider']) == ['dog', 'cat', 'bird', 'fish']\n assert candidate(list1 = ['Quickly', 'Brown', 'Fox', 'Jumps', 'Over', 'Lazy', 'Dog'],list2 = ['Dog', 'Lazy', 'Over', 'Jumps', 'Fox', 'Brown', 'Quickly']) == ['Quickly', 'Brown', 'Fox', 'Jumps', 'Over', 'Lazy', 'Dog']\n assert candidate(list1 = ['RestaurantA', 'RestaurantB', 'RestaurantC'],list2 = ['RestaurantD', 'RestaurantB', 'RestaurantE', 'RestaurantA']) == ['RestaurantB']\n assert candidate(list1 = ['Alpha', 'Bravo', 'Charlie', 'Delta'],list2 = ['Echo', 'Delta', 'Bravo', 'Alpha']) == ['Alpha', 'Bravo']\n assert candidate(list1 = ['Shogun', 'Tapioca Express', 'Burger King', 'KFC', 'Pizza Hut'],list2 = ['Pizza Hut', 'KFC', 'Burger King', 'Tapioca Express', 'Shogun']) == ['Shogun', 'Tapioca Express', 'Burger King', 'KFC', 'Pizza Hut']\n assert candidate(list1 = ['restaurant1', 'restaurant2', 'restaurant3', 'restaurant4', 'restaurant5'],list2 = ['restaurant5', 'restaurant4', 'restaurant3', 'restaurant2', 'restaurant1']) == ['restaurant1', 'restaurant2', 'restaurant3', 'restaurant4', 'restaurant5']\n assert candidate(list1 = ['one', 'two', 'three', 'four', 'five'],list2 = ['six', 'seven', 'eight', 'nine', 'one', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen']) == ['one']\n assert candidate(list1 = ['Fast Food', 'Quick Eats', 'Snack Bar', 'Food Truck'],list2 = ['Food Truck', 'Quick Eats', 'Snack Bar', 'Fast Food']) == ['Quick Eats']\n assert candidate(list1 = ['starbucks', 'costa', 'dunkin', 'tim hortons'],list2 = ['tim hortons', 'dunkin', 'costa', 'starbucks']) == ['starbucks', 'costa', 'dunkin', 'tim hortons']\n assert candidate(list1 = ['pancakes', 'waffles', 'omelette'],list2 = ['omelette', 'pancakes', 'waffles', 'french toast']) == ['pancakes']\n assert candidate(list1 = ['Steakhouse', 'Seafood Grill', 'Wine Bar'],list2 = ['Wine Bar', 'Seafood Grill', 'Steakhouse']) == ['Steakhouse', 'Seafood Grill', 'Wine Bar']\n assert candidate(list1 = ['Poke Bar', 'Sushi Spot', 'Tataki House'],list2 = ['Tataki House', 'Poke Bar', 'Sushi Spot']) == ['Poke Bar']\n assert candidate(list1 = ['laptop', 'phone', 'tablet', 'monitor'],list2 = ['monitor', 'tablet', 'phone', 'laptop']) == ['laptop', 'phone', 'tablet', 'monitor']\n assert candidate(list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g'],list2 = ['g', 'f', 'e', 'd', 'c', 'b', 'a']) == ['a', 'b', 'c', 'd', 'e', 'f', 'g']\n assert candidate(list1 = ['coffee', 'tea', 'soda', 'juice'],list2 = ['juice', 'soda', 'coffee', 'tea']) == ['coffee']\n assert candidate(list1 = ['Pasta Palace', 'Dumplings Galore', 'Steakhouse', 'Soup Kitchen'],list2 = ['Soup Kitchen', 'Steakhouse', 'Dumplings Galore', 'Pasta Palace']) == ['Pasta Palace', 'Dumplings Galore', 'Steakhouse', 'Soup Kitchen']\n assert candidate(list1 = ['one', 'two', 'three', 'four', 'five', 'six'],list2 = ['six', 'five', 'four', 'three', 'two', 'one']) == ['one', 'two', 'three', 'four', 'five', 'six']\n assert candidate(list1 = ['X', 'Y', 'Z', 'W', 'V'],list2 = ['V', 'W', 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'E']) == ['X']\n assert candidate(list1 = ['One', 'Two', 'Three', 'Four', 'Five'],list2 = ['Six', 'Seven', 'Eight', 'One', 'Five']) == ['One']\n assert candidate(list1 = ['Red', 'Blue', 'Green', 'Yellow', 'Black'],list2 = ['Orange', 'Black', 'Pink', 'Green', 'Purple', 'Red']) == ['Red', 'Green', 'Black']\n assert candidate(list1 = ['Shogun', 'Tapioca Express', 'Burger King', 'KFC'],list2 = ['KFC', 'Burger King', 'Tapioca Express', 'Shogun']) == ['Shogun', 'Tapioca Express', 'Burger King', 'KFC']\n assert candidate(list1 = ['Paris', 'Lyon', 'Marseille', 'Toulouse'],list2 = ['Lyon', 'Toulouse', 'Marseille', 'Paris']) == ['Lyon']\n assert candidate(list1 = ['apple', 'banana', 'cherry', 'date', 'elderberry'],list2 = ['elderberry', 'date', 'cherry', 'banana', 'apple']) == ['apple', 'banana', 'cherry', 'date', 'elderberry']\n assert candidate(list1 = ['coke', 'pepsi', 'sprite', 'fanta'],list2 = ['fanta', 'sprite', 'pepsi', 'coke']) == ['coke', 'pepsi', 'sprite', 'fanta']\n assert candidate(list1 = ['French Laundry', 'California Bistro', 'New England Clam Chowder', 'Texas BBQ'],list2 = ['Texas BBQ', 'New England Clam Chowder', 'California Bistro', 'French Laundry']) == ['French Laundry', 'California Bistro', 'New England Clam Chowder', 'Texas BBQ']\n assert candidate(list1 = ['happy', 'joy', 'sad', 'angry'],list2 = ['sad', 'happy', 'angry', 'joy']) == ['happy']\n assert candidate(list1 = ['XYZ', 'ABC', 'DEF', 'GHI'],list2 = ['JKL', 'MNO', 'XYZ', 'PQR']) == ['XYZ']\n assert candidate(list1 = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'],list2 = ['J', 'I', 'H', 'G', 'F', 'E', 'D', 'C', 'B', 'A']) == ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']\n assert candidate(list1 = ['Pizza Palace', 'Pasta House', 'Taco Bistro'],list2 = ['Taco Bistro', 'Pizza Palace', 'Pasta House']) == ['Pizza Palace']\n assert candidate(list1 = ['mexican', 'italian', 'japanese', 'chinese'],list2 = ['thai', 'japanese', 'italian', 'mexican', 'indian']) == ['mexican', 'italian', 'japanese']\n assert candidate(list1 = ['coffee', 'tea', 'soda', 'water'],list2 = ['water', 'soda', 'coffee', 'tea']) == ['coffee']\n assert candidate(list1 = ['pizza', 'burger', 'sushi', 'taco'],list2 = ['taco', 'burger', 'pizza', 'ramen']) == ['pizza', 'burger']\n assert candidate(list1 = ['Central Perk', 'The Beanery', 'Mocha Cafe'],list2 = ['Latte Lounge', 'The Beanery', 'Central Perk', 'Espresso Bar']) == ['Central Perk', 'The Beanery']\n assert candidate(list1 = ['hello', 'world', 'python', 'programming'],list2 = ['java', 'programming', 'python', 'world', 'hello']) == ['hello', 'world', 'python', 'programming']\n assert candidate(list1 = ['cat cafe', 'dog cafe', 'parrot cafe'],list2 = ['parrot cafe', 'dog cafe', 'cat cafe', 'rabbit cafe']) == ['cat cafe', 'dog cafe', 'parrot cafe']\n assert candidate(list1 = ['India Gate', 'Great Wall', 'Berlin Wall', 'Eiffel Tower'],list2 = ['Eiffel Tower', 'Berlin Wall', 'Great Wall', 'India Gate']) == ['India Gate', 'Great Wall', 'Berlin Wall', 'Eiffel Tower']\n assert candidate(list1 = ['Los Angeles', 'New York', 'Chicago'],list2 = ['Chicago', 'Los Angeles', 'Houston', 'New York']) == ['Los Angeles']\n assert candidate(list1 = ['pasta', 'pizza', 'lasagna'],list2 = ['pizza', 'lasagna', 'pasta', 'ravioli']) == ['pizza']\n assert candidate(list1 = ['Fast', 'Food', 'Place', 'Awesome'],list2 = ['Awesome', 'Place', 'Food', 'Fast']) == ['Fast', 'Food', 'Place', 'Awesome']\n assert candidate(list1 = ['x', 'y', 'z'],list2 = ['a', 'b', 'c', 'd', 'x', 'y', 'z']) == ['x']\n assert candidate(list1 = ['red', 'blue', 'green', 'yellow'],list2 = ['yellow', 'green', 'blue', 'red']) == ['red', 'blue', 'green', 'yellow']\n assert candidate(list1 = ['X', 'Y', 'Z'],list2 = ['W', 'V', 'U', 'X', 'T', 'S', 'R', 'Q', 'P', 'O', 'N', 'M', 'L', 'K', 'J', 'I', 'H', 'G', 'F', 'E', 'D', 'C', 'B', 'A', 'Z']) == ['X']\n assert candidate(list1 = ['apple pie', 'cherry pie', 'blueberry pie'],list2 = ['blueberry pie', 'cherry pie', 'apple pie', 'pumpkin pie']) == ['apple pie', 'cherry pie', 'blueberry pie']\n assert candidate(list1 = ['x', 'y', 'z'],list2 = ['z', 'x', 'y', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w']) == ['x']\n assert candidate(list1 = ['taco', 'burrito', 'nachos', 'enchilada'],list2 = ['enchilada', 'taco', 'nachos', 'burrito']) == ['taco']\n assert candidate(list1 = ['mango', 'pineapple', 'kiwi', 'grapefruit'],list2 = ['grapefruit', 'kiwi', 'pineapple', 'mango']) == ['mango', 'pineapple', 'kiwi', 'grapefruit']\n assert candidate(list1 = ['red', 'blue', 'green', 'yellow'],list2 = ['yellow', 'green', 'blue', 'red', 'purple', 'orange', 'pink', 'brown']) == ['red', 'blue', 'green', 'yellow']\n assert candidate(list1 = ['orange', 'grape', 'melon', 'kiwi'],list2 = ['kiwi', 'melon', 'grape', 'orange', 'pineapple', 'mango']) == ['orange', 'grape', 'melon', 'kiwi']\n assert candidate(list1 = ['A', 'B', 'C', 'D', 'E', 'F'],list2 = ['F', 'E', 'D', 'C', 'B', 'A']) == ['A', 'B', 'C', 'D', 'E', 'F']\n assert candidate(list1 = ['FastFood', 'Italian', 'Chinese', 'American', 'Mexican'],list2 = ['Thai', 'Indian', 'American', 'Chinese', 'Japanese']) == ['Chinese', 'American']\n assert candidate(list1 = ['apple', 'orange', 'banana', 'grape'],list2 = ['grape', 'orange', 'banana', 'apple']) == ['orange']\n assert candidate(list1 = ['Sushi Spot', 'Ramen Joint', 'BBQ Pit', 'Pizza Place'],list2 = ['Pizza Place', 'BBQ Pit', 'Ramen Joint', 'Sushi Spot']) == ['Sushi Spot', 'Ramen Joint', 'BBQ Pit', 'Pizza Place']\n assert candidate(list1 = ['M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V'],list2 = ['W', 'X', 'Y', 'Z', 'V', 'U', 'T', 'S', 'R', 'Q', 'P', 'O', 'N', 'M']) == ['M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V']\n assert candidate(list1 = ['bread', 'butter', 'jam', 'cheese'],list2 = ['cheese', 'jam', 'butter', 'bread']) == ['bread', 'butter', 'jam', 'cheese']\n assert candidate(list1 = ['A', 'B', 'C', 'D', 'E', 'F', 'G'],list2 = ['H', 'I', 'J', 'K', 'A', 'L', 'M', 'F', 'N']) == ['A']\n assert candidate(list1 = ['Savory Bites', 'Italian Delight', 'Vegan Cafe', 'Bakery'],list2 = ['Bakery', 'Vegan Cafe', 'Italian Delight', 'Savory Bites']) == ['Savory Bites', 'Italian Delight', 'Vegan Cafe', 'Bakery']\n assert candidate(list1 = ['XYZ', 'ABC', 'DEF', 'GHI', 'JKL'],list2 = ['JKL', 'GHI', 'DEF', 'ABC', 'XYZ']) == ['XYZ', 'ABC', 'DEF', 'GHI', 'JKL']\n assert candidate(list1 = ['salad', 'steak', 'soup', 'chicken'],list2 = ['chicken', 'salad', 'soup', 'steak']) == ['salad']\n assert candidate(list1 = ['pizza', 'burger', 'sushi', 'taco'],list2 = ['salad', 'burger', 'taco', 'pizza']) == ['burger']\n assert candidate(list1 = ['Unique', 'String', 'Here', 'Now'],list2 = ['Not', 'Here', 'Unique', 'String']) == ['Unique']\n assert candidate(list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'],list2 = ['j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a']) == ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']\n assert candidate(list1 = ['Pizza', 'Burger', 'Pasta'],list2 = ['Sushi', 'Pizza', 'Pasta', 'Burger']) == ['Pizza']\n assert candidate(list1 = ['Java Hut', 'Code Brew', 'Data Cafe'],list2 = ['Algo Eatery', 'Data Cafe', 'Java Hut', 'Code Brew']) == ['Java Hut']\n assert candidate(list1 = ['Foo Bar', 'Foo Baz', 'Bar Baz', 'Foo Bar Baz'],list2 = ['Bar Baz', 'Foo Baz', 'Foo Bar', 'Foo Bar Baz', 'Baz Bar']) == ['Foo Bar', 'Foo Baz', 'Bar Baz']\n assert candidate(list1 = ['Burger King', 'Shogun', 'KFC', 'Tapioca Express'],list2 = ['KFC', 'Tapioca Express', 'Shogun', 'Burger King', 'Sushi']) == ['KFC']\n assert candidate(list1 = ['Breakfast', 'Lunch', 'Dinner'],list2 = ['Dinner', 'Breakfast', 'Lunch']) == ['Breakfast']\n assert candidate(list1 = ['x', 'y', 'z', 'a', 'b', 'c'],list2 = ['c', 'b', 'a', 'z', 'y', 'x']) == ['x', 'y', 'z', 'a', 'b', 'c']\n assert candidate(list1 = ['pizza', 'burger', 'sushi', 'taco'],list2 = ['salad', 'taco', 'pizza', 'burger']) == ['pizza']\n assert candidate(list1 = ['Cafe 99', 'Mediterranean Grill', 'Taco Joint', 'BBQ Pit'],list2 = ['BBQ Pit', 'Taco Joint', 'Mediterranean Grill', 'Cafe 99']) == ['Cafe 99', 'Mediterranean Grill', 'Taco Joint', 'BBQ Pit']\n assert candidate(list1 = ['alpha', 'beta', 'gamma', 'delta', 'epsilon'],list2 = ['epsilon', 'delta', 'gamma', 'beta', 'alpha', 'omega', 'psi']) == ['alpha', 'beta', 'gamma', 'delta', 'epsilon']\n assert candidate(list1 = ['One', 'Two', 'Three', 'Four', 'Five'],list2 = ['Five', 'Four', 'Three', 'Two', 'One']) == ['One', 'Two', 'Three', 'Four', 'Five']\n assert candidate(list1 = ['Coffee Spot', 'Deluxe Lounge', 'Burger Spot', 'Pancake House'],list2 = ['Pancake House', 'Burger Spot', 'Deluxe Lounge', 'Coffee Spot']) == ['Coffee Spot', 'Deluxe Lounge', 'Burger Spot', 'Pancake House']\n assert candidate(list1 = ['hello', 'world', 'python', 'programming'],list2 = ['java', 'c++', 'programming', 'hello', 'ruby', 'go', 'swift']) == ['hello']\n assert candidate(list1 = ['X', 'Y', 'Z', 'W'],list2 = ['W', 'V', 'U', 'X', 'Y', 'Z']) == ['X', 'W']\n assert candidate(list1 = ['Restaurant1', 'Restaurant2', 'Restaurant3', 'Restaurant4'],list2 = ['Restaurant5', 'Restaurant6', 'Restaurant7', 'Restaurant1', 'Restaurant8']) == ['Restaurant1']\n assert candidate(list1 = ['restaurant1', 'restaurant2', 'restaurant3', 'restaurant4', 'restaurant5'],list2 = ['restaurant6', 'restaurant5', 'restaurant4', 'restaurant3', 'restaurant2', 'restaurant1']) == ['restaurant1', 'restaurant2', 'restaurant3', 'restaurant4', 'restaurant5']\n assert candidate(list1 = ['Alpha', 'Beta', 'Gamma', 'Delta'],list2 = ['Epsilon', 'Zeta', 'Delta', 'Alpha', 'Eta', 'Theta']) == ['Alpha']\n assert candidate(list1 = ['Paris Bistro', 'La Belle Vie', 'Sushi Place', 'Taco Bell'],list2 = ['Taco Bell', 'Sushi Place', 'La Belle Vie', 'Pizza Hut']) == ['La Belle Vie', 'Sushi Place', 'Taco Bell']\n assert candidate(list1 = ['m', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],list2 = ['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm']) == ['m', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n assert candidate(list1 = ['New York', 'Los Angeles', 'Chicago', 'Houston'],list2 = ['Phoenix', 'San Antonio', 'Houston', 'San Diego', 'Dallas', 'San Jose', 'Austin', 'Jacksonville', 'Fort Worth', 'Columbus', 'Charlotte', 'San Francisco', 'Indianapolis', 'Seattle', 'Denver', 'Washington', 'Boston', 'El Paso', 'Nashville', 'Detroit', 'Oklahoma City', 'Portland', 'Las Vegas', 'Memphis', 'Louisville', 'Milwaukee', 'Albuquerque', 'Tucson', 'Fresno', 'Sacramento', 'Long Beach', 'Kansas City', 'Mesa', 'Virginia Beach', 'Atlanta', 'Colorado Springs', 'Omaha', 'Raleigh', 'Miami', 'Oakland', 'Tulsa', 'Orlando', 'Minneapolis', 'Wichita', 'Arlington', 'New Orleans', 'Baltimore', 'Honolulu', 'Fort Wayne', 'Cincinnati', 'Alexandria', 'Tampa', 'Buffalo', 'Greensboro', 'Shreveport', 'Akron', 'Tacoma', 'Grand Rapids', 'Dayton', 'Henderson', 'Newark', 'Anchorage', 'Oxnard', 'Santa Ana', 'Riverside', 'Moreno Valley', 'Chesapeake', 'Garland', 'Irving', 'Huntington Beach', 'Santa Clarita', 'Fremont', 'Providence', 'Glendale', 'Oceanside', 'Longview', 'Knoxville', 'Aurora', 'Rockford', 'Spokane', 'Tacoma', 'Modesto', 'Fontana', 'Columbus', 'Springfield', 'Ogdensburg', 'Anaheim']) == ['Houston']\n assert candidate(list1 = ['Alice', 'Bob', 'Charlie', 'David'],list2 = ['David', 'Charlie', 'Bob', 'Alice']) == ['Alice', 'Bob', 'Charlie', 'David']\n assert candidate(list1 = ['apple', 'banana', 'cherry', 'date', 'elderberry'],list2 = ['elderberry', 'date', 'cherry', 'banana', 'apple', 'fig', 'grape']) == ['apple', 'banana', 'cherry', 'date', 'elderberry']\n assert candidate(list1 = ['Grill Room', 'BBQ Joint', 'Smokers Bar'],list2 = ['Smokers Bar', 'Grill Room', 'BBQ Joint']) == ['Grill Room']\n assert candidate(list1 = ['pasta', 'burger', 'pizza', 'sushi'],list2 = ['pizza', 'sushi', 'burger', 'pasta']) == ['pizza']\n assert candidate(list1 = ['Sushi Bar', 'Pasta Place', 'Taco Stand', 'Burger Joint'],list2 = ['Steak House', 'Taco Stand', 'Pasta Place', 'Sushi Bar']) == ['Sushi Bar', 'Pasta Place', 'Taco Stand']\n"}, "metadata": {"canonical_parameter_names": ["list1", "list2"], "leetcode_dataset_entry_point": "Solution().findRestaurant", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findRestaurant = function(list1, list2) {", "container": null, "callable": "findRestaurant", "parameters": [{"name": "list1", "type": "string[]"}, {"name": "list2", "type": "string[]"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 600, "task_id": "non-negative-integers-without-consecutive-ones", "difficulty": "Hard", "problem_description": "Given a positive integer n, return the number of the integers in the range [0, n] whose binary representations do not contain consecutive ones.\n \nExample 1:\n\nInput: n = 5\nOutput: 5\nExplanation:\nHere are the non-negative integers <= 5 with their corresponding binary representations:\n0 : 0\n1 : 1\n2 : 10\n3 : 11\n4 : 100\n5 : 101\nAmong them, only integer 3 disobeys the rule (two consecutive ones) and the other 5 satisfy the rule. \n\nExample 2:\n\nInput: n = 1\nOutput: 2\n\nExample 3:\n\nInput: n = 2\nOutput: 3\n\n \nConstraints:\n\n1 <= n <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 100) == 34\n assert candidate(n = 15) == 8\n assert candidate(n = 1000000) == 17711\n assert candidate(n = 32) == 14\n assert candidate(n = 2) == 3\n assert candidate(n = 1) == 2\n assert candidate(n = 1000000000) == 2178309\n assert candidate(n = 1000) == 144\n assert candidate(n = 10) == 8\n assert candidate(n = 5) == 5\n assert candidate(n = 987654321) == 2178309\n assert candidate(n = 888888888) == 2178309\n assert candidate(n = 333333333) == 1149851\n assert candidate(n = 777777777) == 2178309\n assert candidate(n = 999999999) == 2178309\n assert candidate(n = 110011001) == 514229\n assert candidate(n = 314159265) == 1149851\n assert candidate(n = 500000000) == 1346269\n assert candidate(n = 2147483647) == 3524578\n assert candidate(n = 123456789) == 514229\n assert candidate(n = 555555555) == 1496319\n assert candidate(n = 101010101) == 514229\n assert candidate(n = 1000000001) == 2178309\n assert candidate(n = 100000000) == 514229\n assert candidate(n = 111111111) == 514229\n assert candidate(n = 800000000) == 2178309\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().findIntegers", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findIntegers = function(n) {", "container": null, "callable": "findIntegers", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 605, "task_id": "can-place-flowers", "difficulty": "Easy", "problem_description": "You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots.\nGiven an integer array flowerbed containing 0's and 1's, where 0 means empty and 1 means not empty, and an integer n, return true if n new flowers can be planted in the flowerbed without violating the no-adjacent-flowers rule and false otherwise.\n \nExample 1:\nInput: flowerbed = [1,0,0,0,1], n = 1\nOutput: true\nExample 2:\nInput: flowerbed = [1,0,0,0,1], n = 2\nOutput: false\n\n \nConstraints:\n\n1 <= flowerbed.length <= 2 * 104\nflowerbed[i] is 0 or 1.\nThere are no two adjacent flowers in flowerbed.\n0 <= n <= flowerbed.length\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 1],n = 2) == False\n assert candidate(flowerbed = [1, 0, 1, 0, 1],n = 0) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 1],n = 1) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 1],n = 2) == False\n assert candidate(flowerbed = [1, 0, 0, 1, 0, 0, 1],n = 1) == False\n assert candidate(flowerbed = [0, 0, 0, 1, 0, 0, 0],n = 2) == True\n assert candidate(flowerbed = [0],n = 1) == True\n assert candidate(flowerbed = [1, 0, 0, 1, 0, 0, 1, 0, 0],n = 2) == False\n assert candidate(flowerbed = [0, 1, 0, 1, 0],n = 1) == False\n assert candidate(flowerbed = [0, 1, 0, 0, 1, 0, 0, 1, 0],n = 0) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 0],n = 3) == True\n assert candidate(flowerbed = [0, 0, 1, 0, 0],n = 1) == True\n assert candidate(flowerbed = [0, 0],n = 1) == True\n assert candidate(flowerbed = [1],n = 0) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 1],n = 2) == True\n assert candidate(flowerbed = [1, 1],n = 0) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],n = 10) == False\n assert candidate(flowerbed = [0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],n = 2) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],n = 5) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],n = 4) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0],n = 2) == True\n assert candidate(flowerbed = [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],n = 4) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],n = 3) == False\n assert candidate(flowerbed = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],n = 4) == True\n assert candidate(flowerbed = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],n = 0) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0],n = 3) == True\n assert candidate(flowerbed = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],n = 2) == False\n assert candidate(flowerbed = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],n = 0) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],n = 5) == True\n assert candidate(flowerbed = [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0],n = 3) == False\n assert candidate(flowerbed = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0],n = 2) == True\n assert candidate(flowerbed = [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0],n = 6) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],n = 4) == False\n assert candidate(flowerbed = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1],n = 3) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],n = 7) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],n = 6) == True\n assert candidate(flowerbed = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],n = 5) == False\n assert candidate(flowerbed = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],n = 5) == True\n assert candidate(flowerbed = [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0],n = 3) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],n = 4) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],n = 5) == False\n assert candidate(flowerbed = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0],n = 3) == False\n assert candidate(flowerbed = [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],n = 3) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],n = 3) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],n = 2) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0],n = 5) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],n = 15) == False\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],n = 8) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],n = 4) == True\n assert candidate(flowerbed = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],n = 2) == False\n assert candidate(flowerbed = [1, 0, 1, 0, 1, 0, 1, 0, 1],n = 0) == True\n assert candidate(flowerbed = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],n = 4) == True\n assert candidate(flowerbed = [0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],n = 2) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],n = 5) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0],n = 3) == True\n assert candidate(flowerbed = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],n = 2) == False\n assert candidate(flowerbed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],n = 8) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1],n = 4) == True\n assert candidate(flowerbed = [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0],n = 3) == True\n assert candidate(flowerbed = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],n = 3) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],n = 6) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],n = 6) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],n = 3) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],n = 4) == True\n assert candidate(flowerbed = [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],n = 3) == True\n assert candidate(flowerbed = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1],n = 2) == False\n assert candidate(flowerbed = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],n = 0) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],n = 10) == True\n assert candidate(flowerbed = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],n = 0) == True\n assert candidate(flowerbed = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1],n = 2) == False\n assert candidate(flowerbed = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],n = 0) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1],n = 4) == True\n assert candidate(flowerbed = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],n = 0) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],n = 13) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0],n = 4) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0],n = 3) == True\n assert candidate(flowerbed = [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1],n = 0) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 0, 1],n = 3) == False\n assert candidate(flowerbed = [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],n = 4) == False\n assert candidate(flowerbed = [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],n = 3) == True\n assert candidate(flowerbed = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],n = 0) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1],n = 5) == True\n assert candidate(flowerbed = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],n = 0) == True\n assert candidate(flowerbed = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],n = 0) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],n = 5) == True\n assert candidate(flowerbed = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],n = 0) == True\n assert candidate(flowerbed = [1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],n = 3) == False\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1],n = 3) == True\n assert candidate(flowerbed = [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0],n = 5) == True\n assert candidate(flowerbed = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],n = 5) == True\n assert candidate(flowerbed = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1],n = 3) == False\n assert candidate(flowerbed = [0, 0, 1, 0, 1, 0, 1, 0, 0],n = 1) == True\n assert candidate(flowerbed = [1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0],n = 2) == True\n assert candidate(flowerbed = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],n = 0) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0],n = 3) == True\n assert candidate(flowerbed = [0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1],n = 4) == True\n assert candidate(flowerbed = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],n = 0) == True\n assert candidate(flowerbed = [1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],n = 2) == False\n assert candidate(flowerbed = [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0],n = 3) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],n = 15) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],n = 5) == True\n assert candidate(flowerbed = [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0],n = 4) == True\n assert candidate(flowerbed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],n = 10) == True\n assert candidate(flowerbed = [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0],n = 3) == True\n assert candidate(flowerbed = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],n = 0) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0],n = 3) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],n = 6) == True\n"}, "metadata": {"canonical_parameter_names": ["flowerbed", "n"], "leetcode_dataset_entry_point": "Solution().canPlaceFlowers", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var canPlaceFlowers = function(flowerbed, n) {", "container": null, "callable": "canPlaceFlowers", "parameters": [{"name": "flowerbed", "type": "number[]"}, {"name": "n", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 606, "task_id": "construct-string-from-binary-tree", "difficulty": "Medium", "problem_description": "Given the root node of a binary tree, your task is to create a string representation of the tree following a specific set of formatting rules. The representation should be based on a preorder traversal of the binary tree and must adhere to the following guidelines:\n\n\nNode Representation: Each node in the tree should be represented by its integer value.\n\n\nParentheses for Children: If a node has at least one child (either left or right), its children should be represented inside parentheses. Specifically:\n\nIf a node has a left child, the value of the left child should be enclosed in parentheses immediately following the node's value.\nIf a node has a right child, the value of the right child should also be enclosed in parentheses. The parentheses for the right child should follow those of the left child.\n\n\n\nOmitting Empty Parentheses: Any empty parentheses pairs (i.e., ()) should be omitted from the final string representation of the tree, with one specific exception: when a node has a right child but no left child. In such cases, you must include an empty pair of parentheses to indicate the absence of the left child. This ensures that the one-to-one mapping between the string representation and the original binary tree structure is maintained.\nIn summary, empty parentheses pairs should be omitted when a node has only a left child or no children. However, when a node has a right child but no left child, an empty pair of parentheses must precede the representation of the right child to reflect the tree's structure accurately.\n\n\n \nExample 1:\n\n\nInput: root = [1,2,3,4]\nOutput: \"1(2(4))(3)\"\nExplanation: Originally, it needs to be \"1(2(4)())(3()())\", but you need to omit all the empty parenthesis pairs. And it will be \"1(2(4))(3)\".\n\nExample 2:\n\n\nInput: root = [1,2,3,null,4]\nOutput: \"1(2()(4))(3)\"\nExplanation: Almost the same as the first example, except the () after 2 is necessary to indicate the absence of a left child for 2 and the presence of a right child.\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 104].\n-1000 <= Node.val <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7])) == \"1(2(4)(5))(3(6)(7))\"\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5])) == \"1()(2()(3()(4()(5))))\"\n assert candidate(root = tree_node([1, 2, 3, None, None, 6, 7])) == \"1(2)(3(6)(7))\"\n assert candidate(root = tree_node([1, 2, 3, 4])) == \"1(2(4))(3)\"\n assert candidate(root = tree_node([1, 2, 3, None, 4])) == \"1(2()(4))(3)\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7])) == \"1(2(4)(5))(3()(7))\"\n assert candidate(root = tree_node([1, 2])) == \"1(2)\"\n assert candidate(root = tree_node([1, None, 2])) == \"1()(2)\"\n assert candidate(root = tree_node([1, 2, None, 3])) == \"1(2(3))\"\n assert candidate(root = tree_node([1])) == \"1\"\n assert candidate(root = tree_node([1, None, 2, None, 3])) == \"1()(2()(3))\"\n assert candidate(root = tree_node([3, 1, 4, None, None, 2])) == \"3(1)(4(2))\"\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == \"1()(2()(3()(4()(5()(6()(7()(8()(9()(10)))))))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, 7, 8, 9, None, None, 10, None, 11, 12, 13, None, 14, 15, None, None, None, None, None, 16, 17, 18, 19])) == \"1(2(4()(7(10(14(17)(18))(15(19))))))(3(5(8(11)(12))(9(13()(16))))(6))\"\n assert candidate(root = tree_node([10, 5, 15, None, None, 6, 20])) == \"10(5)(15(6)(20))\"\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, 7, None, None, 8, 9, None, None, 10, 11, None, None, 12, 13, None, None, None, None, None, 14, 15, None, None, 16, 17, 18, 19])) == \"1(2)(3(4)(5(6)(7(8)(9(10)(11(12)(13))))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, 11, 12])) == \"1(2(4(6(8(10)(11)))))(3(5(7(9(12)))))\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, 6, None, None, 7, 8, 9, 10])) == \"1(2()(4))(3(5(7)(8))(6(9)(10)))\"\n assert candidate(root = tree_node([1, None, 2, None, None, 3, None, 4, None, None, 5])) == \"1()(2)\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, None, 6, None, None, 7, None, None, 8, None, 9])) == \"1(2()(4))(3()(5(6()(7))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, 7, None, None, None, None, 8])) == \"1(2(4(7)))(3(5)(6()(8)))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, None, 11, None, None, 12])) == \"1(2(4)(5(8(11))(9()(12))))(3(6)(7(10)))\"\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == \"1()(2()(3()(4()(5()(6()(7()(8()(9()(10()(11()(12()(13()(14()(15))))))))))))))\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, 6, None, 7])) == \"1(2()(4(6)))(3(5(7)))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, 6, None, 7, 8, 9, None, None, 10, 11, None, None, 12, 13])) == \"1(2(4(6(9()(12)))))(3()(5(7()(10(13)))(8(11))))\"\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8])) == \"1()(2()(3()(4()(5()(6()(7()(8)))))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, None, 13, None, None, 14, None, 15, None, 16])) == \"1(2(4(8(14))(9(15)))(5(10(16))(11)))(3(6()(13))(7))\"\n assert candidate(root = tree_node([1, None, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == \"1()(2(3(4(5(6(7(8(9))))))))\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16])) == \"1(2()(4()(6()(8()(10()(12()(14()(16))))))))(3()(5()(7()(9()(11()(13()(15)))))))\"\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8])) == \"1(2(3(4(5(6(7(8)))))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, None, None, None, None, None, 6])) == \"1(2(4))(3(5))\"\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, 7, None, None, 8, 9])) == \"1(2)(3(4)(5(6)(7(8)(9))))\"\n assert candidate(root = tree_node([1, 2, None, 3, 4, None, 5, None, 6, None, 7, 8, 9])) == \"1(2(3()(5()(7)))(4()(6(8)(9))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, 6, 7, None, None, None, 8, 9, 10, None, None, None, None, None, 11, 12, None, None, 13, 14, 15])) == \"1(2(4(6()(8))(7(9)(10()(11(12()(13(14)(15))))))))(3()(5))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, None, 15, None, None, 16])) == \"1(2(4(8(15))(9()(16)))(5(10)(11)))(3(6(12)(13))(7(14)))\"\n assert candidate(root = tree_node([1, None, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])) == \"1()(2(3(5(9)(10))(6(11)(12)))(4(7(13)(14))(8)))\"\n assert candidate(root = tree_node([1, None, 2, None, None, None, 3, None, None, None, 4, None, None, None, 5])) == \"1()(2)\"\n assert candidate(root = tree_node([5, 2, 3, None, None, 1, 6, None, None, None, 8])) == \"5(2)(3(1)(6()(8)))\"\n assert candidate(root = tree_node([1, None, 2, 3, None, 4, None, 5, 6, None, 7, 8, None, 9, 10])) == \"1()(2(3(4(5()(7(9)(10)))(6(8)))))\"\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11])) == \"1(2(3(4(5(6(7(8(9(10(11))))))))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, 7, None, None, 8, 9])) == \"1(2(4()(7)))(3(5)(6(8)(9)))\"\n assert candidate(root = tree_node([1, None, 2, 3, None, 4, 5, 6, None, None, 7, 8, None, 9, None, 10])) == \"1()(2(3(4(6(8(10))))(5()(7(9)))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, 6, None, None, 7, None, 8, None, 9])) == \"1(2(4()(6(7(8(9))))))(3()(5))\"\n assert candidate(root = tree_node([1, 2, None, 3, 4, None, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == \"1(2(3)(4(5(6(7(8(9(10))))))))\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, 6, None, 7, 8, None, 9, 10, 11])) == \"1(2()(4(6()(9))))(3(5(7(10)(11))(8)))\"\n assert candidate(root = tree_node([1, None, 2, None, None, 3, None, None, 4, None, None, 5, None, None, 6, None, None, 7, None, None, 8, None, None, 9, None, None, 10])) == \"1()(2)\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, None, None, None, None, 6, 7, None, 8, None, 9])) == \"1(2(4))(3(5()(6(7(8(9))))))\"\n assert candidate(root = tree_node([1, 2, None, 3, 4, None, None, 5, None, 6, None, 7])) == \"1(2(3)(4(5(6(7)))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == \"1(2(4(6(8))))(3(5(7(9))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, None, 7, None, 8, None, 9, None, 10])) == \"1(2(4(7(9))))(3(6(8(10))))\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, 6, 7, None, 8, 9, 10, None, None, 11, 12, None, 13, 14, None, None, 15, 16, 17, 18, 19, None, 20, 21, 22, 23, None, None, 24, 25])) == \"1(2()(4(6(9()(13(18(25))(19)))(10(14()(20))))(7)))(3(5()(8(11()(15(21)(22)))(12(16(23))(17()(24))))))\"\n assert candidate(root = tree_node([1, None, 2, 3, 4, None, 5, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == \"1()(2(3()(5(7(9(11(13(15)))))))(4(6(8(10(12(14)))))))\"\n assert candidate(root = tree_node([20, 10, 30, 5, 15, None, None, 3, 7, None, 12, None, None, None, None, 6, 9])) == \"20(10(5(3)(7))(15()(12(6)(9))))(30)\"\n assert candidate(root = tree_node([0, -1, 1, -2, 2, -3, 3, -4, 4])) == \"0(-1(-2(-4)(4))(2))(1(-3)(3))\"\n assert candidate(root = tree_node([5, 3, 7, 2, 4, 6, 8, 1, None, None, None, None, None, 9, 10])) == \"5(3(2(1))(4))(7(6)(8(9)(10)))\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, 6, None, 7, 8, None, 9, None, 10, None, 11, None, 12, None, 13])) == \"1(2()(4(6()(9()(12)))))(3()(5(7()(10()(13)))(8()(11))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, 6, None, 7, 8, None, 9, None, 10])) == \"1(2(4(6()(9))))(3()(5(7()(10))(8)))\"\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, 6, 7, 8, 9, None, None, 10, 11])) == \"1(2)(3(4(6)(7(10)(11)))(5(8)(9)))\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, None, 6, 7, 8, 9, 10, 11, None, None, None, None, None, None, 12, 13, 14, 15])) == \"1(2()(4()(6(9)(10()(12(15))))))(3(5(7(11(13)(14)))(8)))\"\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5])) == \"1(2)(3(4)(5))\"\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, 7, None, None, 8, 9, None, None, 10, 11, None, None, 12, 13])) == \"1(2)(3(4)(5(6)(7(8)(9(10)(11(12)(13))))))\"\n assert candidate(root = tree_node([1, -2, 3, 4, None, -5, None, 6, None, 7])) == \"1(-2(4(6)))(3(-5(7)))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, 14, None, 16, 17, 18, 19, None, None, 22, 23, None, 25, None, 27])) == \"1(2(4(8(16(22)(23))(17()(25)))(9(18()(27))(19)))(5))(3(6)(7(14)))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == \"1(2(4(8)(9))(5(10)(11)))(3(6(12)(13))(7(14)(15)))\"\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, None, None, 6, 7, None, None, None, None, None, 8, 9, None, None, None, None, None, 10, 11, 12, 13, None, None, 14, 15])) == \"1(2)(3(4)(5))\"\n assert candidate(root = tree_node([1, 2, 3, None, None, 6, 7, None, None, 10, 11, None, None, 14, 15])) == \"1(2)(3(6)(7(10)(11(14)(15))))\"\n assert candidate(root = tree_node([1, None, 2, None, None, 3, None, None, 4, None, None, 5, None, None, 6])) == \"1()(2)\"\n assert candidate(root = tree_node([1, None, 2, None, None, 3, 4, None, None, 5, 6, None, None, 7, 8, None, None, 9, 10])) == \"1()(2)\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5, 6])) == \"1(2()(4(5)(6)))(3)\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == \"1(2(4()(7()(10)))(5()(8)))(3()(6()(9)))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, 8, 9, None, None, 10])) == \"1(2(4(7(10)))(5(8)(9)))(3()(6))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, None, None, None, 10, None, None, None, 11, None, None, None, 12, None, None, None, 13])) == \"1(2(4(8()(10()(11)))(9))(5))(3(6)(7))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == \"1(2(4(8(16)(17))(9(18)(19)))(5(10(20)(21))(11(22)(23))))(3(6(12(24)(25))(13))(7(14)(15)))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9, None, 10, None, None, None, None, None, 11, 12, 13, None, None, None, 14, 15])) == \"1(2(4(6()(10(12()(14))(13(15))))(7))(5(8)(9()(11))))(3)\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, 10, 11, None, 12])) == \"1(2(4(8)(9))(5))(3(6(10)(11))(7()(12)))\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == \"1(2()(4()(6()(8()(10()(12()(14)))))))(3()(5()(7()(9()(11()(13()(15)))))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, None, 6, None, 7, None, 8, None, None, 9])) == \"1(2(4(6(8))))(3(5(7()(9))))\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, None, 6, 7, None, 8, 9, None, None, None, 10])) == \"1(2()(4()(6(8()(10))(9))))(3(5(7)))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == \"1(2(4()(6()(8()(10)))))(3()(5()(7()(9))))\"\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7])) == \"1()(2()(3()(4()(5()(6()(7))))))\"\n assert candidate(root = tree_node([1, None, 2, 3, None, None, 4, 5, 6, None, None, None, None, 7])) == \"1()(2(3()(4(5)(6))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, None, None, 6, 7, 8, None, None, 9, None, 10, None, 11])) == \"1(2(4()(6)))(3(5(7(9(11)))(8(10))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, 12, 13])) == \"1(2(4)(5(8)(9)))(3(6(10)(11))(7(12)(13)))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, 10, None, None, 11, None, 12])) == \"1(2(4(8(12))(9))(5()(10)))(3(6)(7(11)))\"\n assert candidate(root = tree_node([1, 2, None, None, 3, None, None, 4, None, None, 5, None, None, 6, None, None, 7, None, None, 8, None, None, 9, None, None, 10])) == \"1(2()(3))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, 7, None, 8, 9, None, None, 10, None, 11, 12])) == \"1(2(4(7(10))))(3(5(8(11)(12))(9))(6))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9, None, None, 10, 11, None, None, 12, 13])) == \"1(2(4(6(8(10(12)(13))(11))(9))(7))(5))(3)\"\n assert candidate(root = tree_node([1, 2, 3, None, 5, 6, 7, None, None, 8, 9, 10, 11, None, None, None, None, 12])) == \"1(2()(5))(3(6(8)(9))(7(10(12))(11)))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, 8, None, 9])) == \"1(2(4(7))(5(8)))(3()(6(9)))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, None, None, 8])) == \"1(2(4)(5))(3(6)(7))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, 8, 9])) == \"1(2(4(7))(5(8)(9)))(3()(6))\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == \"1(2()(4()(6()(8()(10)))))(3()(5()(7()(9))))\"\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12])) == \"1(2(3(4(5(6(7(8(9(10(11(12)))))))))))\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, None, 6, None, None, 7, None, None, 8, None, None, 9, None, None, 10, None, None, 11, None, None, 12])) == \"1(2()(4()(6(7()(8)))))(3(5))\"\n assert candidate(root = tree_node([1, None, 2, 3, 4, None, 5, 6, None, 7, None, None, 8, 9, 10, None, None, None, None, 11])) == \"1()(2(3()(5(7(9)(10(11)))))(4(6()(8))))\"\n assert candidate(root = tree_node([1, 2, None, None, 3, None, None, 4, None, None, 5, None, None, 6])) == \"1(2()(3))\"\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, 6, 7, None, None, 8, 9, None, None, 10, 11])) == \"1(2(4))(3()(5(6)(7(8)(9(10)(11)))))\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 8, 9, None, None, None, None, 10])) == \"1(2(4()(8))(5(9)))(3(6)(7()(10)))\"\n assert candidate(root = tree_node([3, 1, 2, 6, None, None, 4, 5])) == \"3(1(6(5)))(2()(4))\"\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == \"1(2(3(4(5(6(7(8(9))))))))\"\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11])) == \"1()(2()(3()(4()(5()(6()(7()(8()(9()(10()(11))))))))))\"\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, 6, None, 7, 8, 9, None, None, 10, None, None, 11, 12, None, None, 13, 14])) == \"1(2)(3(4(6(9(11(13)(14))(12))))(5(7()(10))(8)))\"\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == \"1(2(3(4(5(6(7(8(9(10)))))))))\"\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7])) == \"1(2()(4()(6)))(3()(5()(7)))\"\n assert candidate(root = tree_node([1, 2, None, 3, 4, None, None, 5, 6, 7, None, None, 8, 9, None, None, 10, 11, None, None, 12, 13, None, None, 14, 15])) == \"1(2(3)(4(5(7(9(11(13(15))))))(6()(8()(10()(12()(14)))))))\"\n assert candidate(root = tree_node([1, None, 2, 3, None, 4, None, 5, None, 6, None, 7])) == \"1()(2(3(4(5(6(7))))))\"\n assert candidate(root = tree_node([1, 2, None, 3, 4, None, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11])) == \"1(2(3)(4(5(6(7(8(9(10(11)))))))))\"\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().tree2str", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var tree2str = function(root) {", "container": null, "callable": "tree2str", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 609, "task_id": "find-duplicate-file-in-system", "difficulty": "Medium", "problem_description": "Given a list paths of directory info, including the directory path, and all the files with contents in this directory, return all the duplicate files in the file system in terms of their paths. You may return the answer in any order.\nA group of duplicate files consists of at least two files that have the same content.\nA single directory info string in the input list has the following format:\n\n\"root/d1/d2/.../dm f1.txt(f1_content) f2.txt(f2_content) ... fn.txt(fn_content)\"\n\nIt means there are n files (f1.txt, f2.txt ... fn.txt) with content (f1_content, f2_content ... fn_content) respectively in the directory \"root/d1/d2/.../dm\". Note that n >= 1 and m >= 0. If m = 0, it means the directory is just the root directory.\nThe output is a list of groups of duplicate file paths. For each group, it contains all the file paths of the files that have the same content. A file path is a string that has the following format:\n\n\"directory_path/file_name.txt\"\n\n \nExample 1:\nInput: paths = [\"root/a 1.txt(abcd) 2.txt(efgh)\",\"root/c 3.txt(abcd)\",\"root/c/d 4.txt(efgh)\",\"root 4.txt(efgh)\"]\nOutput: [[\"root/a/2.txt\",\"root/c/d/4.txt\",\"root/4.txt\"],[\"root/a/1.txt\",\"root/c/3.txt\"]]\nExample 2:\nInput: paths = [\"root/a 1.txt(abcd) 2.txt(efgh)\",\"root/c 3.txt(abcd)\",\"root/c/d 4.txt(efgh)\"]\nOutput: [[\"root/a/2.txt\",\"root/c/d/4.txt\"],[\"root/a/1.txt\",\"root/c/3.txt\"]]\n\n \nConstraints:\n\n1 <= paths.length <= 2 * 104\n1 <= paths[i].length <= 3000\n1 <= sum(paths[i].length) <= 5 * 105\npaths[i] consist of English letters, digits, '/', '.', '(', ')', and ' '.\nYou may assume no files or directories share the same name in the same directory.\nYou may assume each given directory info represents a unique directory. A single blank space separates the directory path and file info.\n\n \nFollow up:\n\nImagine you are given a real file system, how will you search files? DFS or BFS?\nIf the file content is very large (GB level), how will you modify your solution?\nIf you can only read the file by 1kb each time, how will you modify your solution?\nWhat is the time complexity of your modified solution? What is the most time-consuming part and memory-consuming part of it? How to optimize?\nHow to make sure the duplicated files you find are not false positive?\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(paths = ['root/a 1.txt(abcd)', 'root/b 2.txt(efgh)', 'root/c 3.txt(efgh)', 'root/d 4.txt(abcd)']) == [['root/a/1.txt', 'root/d/4.txt'], ['root/b/2.txt', 'root/c/3.txt']]\n assert candidate(paths = ['root 1.txt(abcd) 2.txt(efgh)', 'root/c 3.txt(abcd)', 'root/c/d 4.txt(efgh)', 'root/e 5.txt(efgh)']) == [['root/1.txt', 'root/c/3.txt'], ['root/2.txt', 'root/c/d/4.txt', 'root/e/5.txt']]\n assert candidate(paths = ['root/a 1.txt(abcd) 2.txt(efgh)', 'root/c 3.txt(abcd)', 'root/c/d 4.txt(efgh)']) == [['root/a/1.txt', 'root/c/3.txt'], ['root/a/2.txt', 'root/c/d/4.txt']]\n assert candidate(paths = ['root/a 1.txt(abcd)', 'root/b 2.txt(efgh)', 'root/c 3.txt(efgh)', 'root/d 4.txt(efgh)']) == [['root/b/2.txt', 'root/c/3.txt', 'root/d/4.txt']]\n assert candidate(paths = ['root/a 1.txt(abcd) 2.txt(efgh)', 'root/c 3.txt(abcd)', 'root/c/d 4.txt(efgh)', 'root 4.txt(efgh)']) == [['root/a/1.txt', 'root/c/3.txt'], ['root/a/2.txt', 'root/c/d/4.txt', 'root/4.txt']]\n assert candidate(paths = ['root 1.txt(abcd)', 'root/c 2.txt(efgh)', 'root/c/d 3.txt(ghij)', 'root/c/d/e 4.txt(klmn)']) == []\n assert candidate(paths = ['root/a 1.txt(abcd) 2.txt(efsfgh)', 'root/c 3.txt(abdfcd)', 'root/c/d 4.txt(efggdfh)', 'root 4.txt(efggdfh)']) == [['root/c/d/4.txt', 'root/4.txt']]\n assert candidate(paths = ['root 1.txt(a) 2.txt(ab) 3.txt(abc) 4.txt(abcd)']) == []\n assert candidate(paths = ['root/a 1.txt(abcd) 2.txt(efsfgh)', 'root/b 3.txt(efsfgh) 4.txt(efgh)']) == [['root/a/2.txt', 'root/b/3.txt']]\n assert candidate(paths = ['root/a 1.txt(abcd) 2.txt(efgh)', 'root/a 3.txt(abcd)', 'root/b 4.txt(efgh) 5.txt(abcd)']) == [['root/a/1.txt', 'root/a/3.txt', 'root/b/5.txt'], ['root/a/2.txt', 'root/b/4.txt']]\n assert candidate(paths = ['root 1.txt(abcd) 2.txt(efgh)', 'root 3.txt(abcd)', 'root 4.txt(efgh)', 'root 5.txt(abcd)', 'root 6.txt(efgh)']) == [['root/1.txt', 'root/3.txt', 'root/5.txt'], ['root/2.txt', 'root/4.txt', 'root/6.txt']]\n assert candidate(paths = ['root/a 1.txt(abcd) 2.txt(efgh)', 'root/c 3.txt(abcd)', 'root/c/d 4.txt(efgh)', 'root 4.txt(efgh)']) == [['root/a/1.txt', 'root/c/3.txt'], ['root/a/2.txt', 'root/c/d/4.txt', 'root/4.txt']]\n assert candidate(paths = ['root/a 1.txt(abcd) 2.txt(efgh)', 'root/a 3.txt(abcd) 4.txt(efgh)']) == [['root/a/1.txt', 'root/a/3.txt'], ['root/a/2.txt', 'root/a/4.txt']]\n assert candidate(paths = ['root 1.txt(abcd) 2.txt(efsfgh)', 'root/c 3.txt(abdfcd)', 'root/c/d 4.txt(efggdfh)']) == []\n assert candidate(paths = ['root/a 1.txt(abcd) 2.txt(efgh)', 'root/c 3.txt(abcd)', 'root/c/d 4.txt(efgh)']) == [['root/a/1.txt', 'root/c/3.txt'], ['root/a/2.txt', 'root/c/d/4.txt']]\n assert candidate(paths = ['root 1.txt(abc)', 'root/c 2.txt(abc)', 'root/c/d 3.txt(abc)', 'root/c/d/e 4.txt(abc)']) == [['root/1.txt', 'root/c/2.txt', 'root/c/d/3.txt', 'root/c/d/e/4.txt']]\n assert candidate(paths = ['root/a 1.txt(abcd) 2.txt(efgh)', 'root/c 3.txt(abcd)', 'root/c/d 4.txt(efgh)', 'root 4.txt(efasdfgh)']) == [['root/a/1.txt', 'root/c/3.txt'], ['root/a/2.txt', 'root/c/d/4.txt']]\n assert candidate(paths = ['root/a 1.txt(abcd)', 'root/b 2.txt(efgh)', 'root/c 3.txt(efgh)']) == [['root/b/2.txt', 'root/c/3.txt']]\n assert candidate(paths = ['root/a 1.txt(abcd)', 'root/b 1.txt(efgh)', 'root/c 1.txt(abcd)']) == [['root/a/1.txt', 'root/c/1.txt']]\n assert candidate(paths = ['dir1 1.txt(xyz) 2.txt(abc)', 'dir1/subdir1 3.txt(abc)', 'dir1/subdir2 4.txt(xyz) 5.txt(ghi)', 'dir1/subdir2/subsubdir 6.txt(ghi) 7.txt(jkl)']) == [['dir1/1.txt', 'dir1/subdir2/4.txt'], ['dir1/2.txt', 'dir1/subdir1/3.txt'], ['dir1/subdir2/5.txt', 'dir1/subdir2/subsubdir/6.txt']]\n assert candidate(paths = ['root/source/file1.txt(largeContentX)', 'root/source/file2.txt(largeContentY)', 'root/source/file3.txt(largeContentZ)', 'root/source/file4.txt(largeContentX)', 'root/source/file5.txt(largeContentY)', 'root/source/file6.txt(largeContentZ)', 'root/source/file7.txt(largeContentW)']) == []\n assert candidate(paths = ['root/a/b/c/d/e/f/g 1.txt(abcd) 2.txt(efgh)', 'root/a/b/c/d/e/f 3.txt(abcd)', 'root/a/b/c/d/e 4.txt(efgh)', 'root/a/b/c/d 5.txt(efgh)', 'root/a/b/c 6.txt(abcd)']) == [['root/a/b/c/d/e/f/g/1.txt', 'root/a/b/c/d/e/f/3.txt', 'root/a/b/c/6.txt'], ['root/a/b/c/d/e/f/g/2.txt', 'root/a/b/c/d/e/4.txt', 'root/a/b/c/d/5.txt']]\n assert candidate(paths = ['root/user/docs 1.pdf(abcdef)', 'root/user/downloads 2.pdf(abcdef)', 'root/user/music 3.mp3(ghijkl)', 'root/user/music 4.mp3(ghijkl)', 'root/user/photos 5.jpg(mnopqr)', 'root/user/photos 6.jpg(mnopqr)']) == [['root/user/docs/1.pdf', 'root/user/downloads/2.pdf'], ['root/user/music/3.mp3', 'root/user/music/4.mp3'], ['root/user/photos/5.jpg', 'root/user/photos/6.jpg']]\n assert candidate(paths = ['app/assets 1.css(abc) 2.js(def)', 'app/assets/css 3.css(abc)', 'app/assets/js 4.js(def) 5.js(ghi)', 'app/assets/js/libs 6.js(ghi)', 'app/assets/images 7.png(xyz)', 'app/assets/images/icons 8.png(xyz) 9.png(wxyz)']) == [['app/assets/1.css', 'app/assets/css/3.css'], ['app/assets/2.js', 'app/assets/js/4.js'], ['app/assets/js/5.js', 'app/assets/js/libs/6.js'], ['app/assets/images/7.png', 'app/assets/images/icons/8.png']]\n assert candidate(paths = ['root/user1/docs/file1.txt(contentA)', 'root/user1/docs/file2.txt(contentB)', 'root/user2/docs/file1.txt(contentA)', 'root/user2/docs/file3.txt(contentC)', 'root/user3/docs/file4.txt(contentB)', 'root/user3/docs/file5.txt(contentD)']) == []\n assert candidate(paths = ['root/a/b/c 1.txt(abcd123) 2.txt(efgh456)', 'root/a/b/d 3.txt(abcd123) 4.txt(efgh456)', 'root/e/f/g 5.txt(abcd123) 6.txt(efgh456)', 'root/h/i/j 7.txt(abcd123) 8.txt(efgh456)', 'root/k/l/m/n/o 9.txt(abcd123) 10.txt(efgh456)', 'root/p/q/r/s/t/u/v/w 11.txt(abcd123) 12.txt(efgh456)', 'root/x/y/z 13.txt(abcd123) 14.txt(efgh456)', 'root 15.txt(abcd123) 16.txt(efgh456)']) == [['root/a/b/c/1.txt', 'root/a/b/d/3.txt', 'root/e/f/g/5.txt', 'root/h/i/j/7.txt', 'root/k/l/m/n/o/9.txt', 'root/p/q/r/s/t/u/v/w/11.txt', 'root/x/y/z/13.txt', 'root/15.txt'], ['root/a/b/c/2.txt', 'root/a/b/d/4.txt', 'root/e/f/g/6.txt', 'root/h/i/j/8.txt', 'root/k/l/m/n/o/10.txt', 'root/p/q/r/s/t/u/v/w/12.txt', 'root/x/y/z/14.txt', 'root/16.txt']]\n assert candidate(paths = ['root/x 6.txt(ijkl) 7.txt(mnop)', 'root/y 8.txt(ijkl)', 'root/z 9.txt(mnop) 10.txt(ijkl)', 'root/a 11.txt(mnop)']) == [['root/x/6.txt', 'root/y/8.txt', 'root/z/10.txt'], ['root/x/7.txt', 'root/z/9.txt', 'root/a/11.txt']]\n assert candidate(paths = ['deep/nested/folder1/1.txt(x)', 'deep/nested/folder1/2.txt(y)', 'deep/nested/folder2/3.txt(x)', 'deep/nested/folder2/4.txt(z)', 'deep/nested/folder3/5.txt(y)', 'deep/nested/folder3/6.txt(x)', 'deep/nested/folder4/7.txt(z)']) == []\n assert candidate(paths = ['root/1/2/3 1.file(a)', 'root/1/2 2.file(a)', 'root/1 3.file(a)', 'root/1/2/3/4 4.file(a)', 'root/5 5.file(b)', 'root/5/6 6.file(b)', 'root/5/6/7 7.file(b)']) == [['root/1/2/3/1.file', 'root/1/2/2.file', 'root/1/3.file', 'root/1/2/3/4/4.file'], ['root/5/5.file', 'root/5/6/6.file', 'root/5/6/7/7.file']]\n assert candidate(paths = ['root/dir1/file1.txt(abc) file2.txt(def)', 'root/dir2/file3.txt(ghi)', 'root/dir3/file4.txt(abc) file5.txt(def)', 'root/dir4/file6.txt(ghi) file7.txt(jkl)', 'root/dir5/file8.txt(abc)']) == [['root/dir1/file1.txt(abc)/file2.txt', 'root/dir3/file4.txt(abc)/file5.txt']]\n assert candidate(paths = ['folder1/subfolder1/1.txt(xyz) folder1/subfolder1/2.txt(abc)', 'folder1/subfolder2/3.txt(xyz) folder1/subfolder2/4.txt(def)', 'folder2/subfolder1/5.txt(abc) folder2/subfolder1/6.txt(xyz)', 'folder2/subfolder2/7.txt(def) folder2/subfolder2/8.txt(ghi)']) == []\n assert candidate(paths = ['root/subdir1/subsubdir1/0.txt(aaaaa) subsubdir2/b.txt(aaaaa)', 'root/subdir1/subsubdir2/c.txt(bbbbb)', 'root/subdir2/1.txt(bbbbb)', 'root/subdir3/2.txt(ccccc)', 'root/subdir4/3.txt(ddddd)', 'root/subdir5/4.txt(ccccc)', 'root/subdir6/5.txt(ddddd)', 'root/subdir7/6.txt(aaaaa)']) == []\n assert candidate(paths = ['root 1.txt(xyz) 2.txt(abc) 3.txt(def)', 'root/x 4.txt(xyz)', 'root/y 5.txt(abc)', 'root/z 6.txt(def)', 'root/a/b 7.txt(xyz) 8.txt(abc)', 'root/c/d 9.txt(def)', 'root/e/f 10.txt(xyz)', 'root/g/h 11.txt(abc)', 'root/i/j 12.txt(def)']) == [['root/1.txt', 'root/x/4.txt', 'root/a/b/7.txt', 'root/e/f/10.txt'], ['root/2.txt', 'root/y/5.txt', 'root/a/b/8.txt', 'root/g/h/11.txt'], ['root/3.txt', 'root/z/6.txt', 'root/c/d/9.txt', 'root/i/j/12.txt']]\n assert candidate(paths = ['base 20.txt(stu) 21.txt(vwx)', 'base/sub1 22.txt(yza) 23.txt(stu)', 'base/sub2 24.txt(vwx) 25.txt(yza)', 'base/sub3 26.txt(yza)']) == [['base/20.txt', 'base/sub1/23.txt'], ['base/21.txt', 'base/sub2/24.txt'], ['base/sub1/22.txt', 'base/sub2/25.txt', 'base/sub3/26.txt']]\n assert candidate(paths = ['root/a/b/c 1.txt(abcd123) 2.txt(efgh456)', 'root/a/b/d 3.txt(abcd123)', 'root/a/b/e 4.txt(efgh456)', 'root/a/b/f 5.txt(abcd123)', 'root/a/b/g 6.txt(efgh456)', 'root/a/b/h 7.txt(abcd123)', 'root/a/b/i 8.txt(efgh456)']) == [['root/a/b/c/1.txt', 'root/a/b/d/3.txt', 'root/a/b/f/5.txt', 'root/a/b/h/7.txt'], ['root/a/b/c/2.txt', 'root/a/b/e/4.txt', 'root/a/b/g/6.txt', 'root/a/b/i/8.txt']]\n assert candidate(paths = ['root/a 1.txt(abcd)', 'root/b 2.txt(abcd)', 'root/c 3.txt(abcd)', 'root/d 4.txt(abcd)', 'root/e 5.txt(abcd)', 'root/f 6.txt(abcd)', 'root/g 7.txt(abcd)', 'root/h 8.txt(abcd)', 'root/i 9.txt(abcd)', 'root/j 10.txt(abcd)', 'root/k 11.txt(abcd)', 'root/l 12.txt(abcd)', 'root/m 13.txt(abcd)', 'root/n 14.txt(abcd)', 'root/o 15.txt(abcd)', 'root/p 16.txt(abcd)', 'root/q 17.txt(abcd)', 'root/r 18.txt(abcd)', 'root/s 19.txt(abcd)', 'root/t 20.txt(abcd)']) == [['root/a/1.txt', 'root/b/2.txt', 'root/c/3.txt', 'root/d/4.txt', 'root/e/5.txt', 'root/f/6.txt', 'root/g/7.txt', 'root/h/8.txt', 'root/i/9.txt', 'root/j/10.txt', 'root/k/11.txt', 'root/l/12.txt', 'root/m/13.txt', 'root/n/14.txt', 'root/o/15.txt', 'root/p/16.txt', 'root/q/17.txt', 'root/r/18.txt', 'root/s/19.txt', 'root/t/20.txt']]\n assert candidate(paths = ['root 1.txt(abcd) 2.txt(efgh) 3.txt(ijkl)', 'root/d 4.txt(efgh) 5.txt(mnop)', 'root/e 6.txt(abcd) 7.txt(efgh)', 'root/f 8.txt(mnop)']) == [['root/1.txt', 'root/e/6.txt'], ['root/2.txt', 'root/d/4.txt', 'root/e/7.txt'], ['root/d/5.txt', 'root/f/8.txt']]\n assert candidate(paths = ['root/data/logs/error.log(log1)', 'root/data/logs/access.log(log2)', 'root/data/backup/error.log(log1)', 'root/data/backup/access.log(log2)', 'root/data/temp/error.log(log1)']) == []\n assert candidate(paths = ['root 1.txt(abc) 2.txt(def) 3.txt(ghi)', 'root 4.txt(abc) 5.txt(jkl)', 'root 6.txt(mno) 7.txt(def)', 'root 8.txt(pqr) 9.txt(ghi)', 'root 10.txt(stu) 11.txt(vwx)', 'root 12.txt(yza) 13.txt(abc)', 'root 14.txt(mno) 15.txt(def)', 'root 16.txt(ghi) 17.txt(jkl)', 'root 18.txt(stu) 19.txt(vwx)', 'root 20.txt(yza) 21.txt(abc)', 'root 22.txt(mno) 23.txt(def)', 'root 24.txt(ghi) 25.txt(jkl)', 'root 26.txt(stu) 27.txt(vwx)', 'root 28.txt(yza) 29.txt(abc)', 'root 30.txt(mno) 31.txt(def)']) == [['root/1.txt', 'root/4.txt', 'root/13.txt', 'root/21.txt', 'root/29.txt'], ['root/2.txt', 'root/7.txt', 'root/15.txt', 'root/23.txt', 'root/31.txt'], ['root/3.txt', 'root/9.txt', 'root/16.txt', 'root/24.txt'], ['root/5.txt', 'root/17.txt', 'root/25.txt'], ['root/6.txt', 'root/14.txt', 'root/22.txt', 'root/30.txt'], ['root/10.txt', 'root/18.txt', 'root/26.txt'], ['root/11.txt', 'root/19.txt', 'root/27.txt'], ['root/12.txt', 'root/20.txt', 'root/28.txt']]\n assert candidate(paths = ['root/project1/src/main.py(code123)', 'root/project2/src/main.py(code456)', 'root/project3/src/main.py(code123)', 'root/project4/src/main.py(code789)', 'root/project5/src/main.py(code456)']) == []\n assert candidate(paths = ['root/a/b 1.txt(abcd) 2.txt(efgh)', 'root/a/b/c 3.txt(abcd)', 'root/a/b/c/d 4.txt(efgh)', 'root/a/b/e 5.txt(efgh)', 'root/f/g 6.txt(abcd)']) == [['root/a/b/1.txt', 'root/a/b/c/3.txt', 'root/f/g/6.txt'], ['root/a/b/2.txt', 'root/a/b/c/d/4.txt', 'root/a/b/e/5.txt']]\n assert candidate(paths = ['root/complex/structure/with/different/contents/1.txt(abc)', 'root/complex/structure/with/different/contents/2.txt(def)', 'root/complex/structure/with/3.txt(ghi)', 'root/complex/structure/with/4.txt(jkl)', 'root/complex/structure/5.txt(mno)', 'root/complex/structure/with/different/contents/6.txt(abc)', 'root/complex/structure/with/different/contents/7.txt(def)', 'root/complex/structure/with/different/contents/8.txt(ghi)', 'root/complex/structure/with/different/contents/9.txt(jkl)', 'root/complex/structure/with/different/contents/10.txt(mno)', 'root/complex/structure/with/different/contents/11.txt(abc)', 'root/complex/structure/with/different/contents/12.txt(def)', 'root/complex/structure/with/different/contents/13.txt(ghi)', 'root/complex/structure/with/different/contents/14.txt(jkl)', 'root/complex/structure/with/different/contents/15.txt(mno)']) == []\n assert candidate(paths = ['root/a/b/c 1.txt(abcd) 2.txt(efgh) 3.txt(ijkl)', 'root/d/e/f 4.txt(abcd) 5.txt(mnop) 6.txt(ijkl)', 'root/g/h 7.txt(efgh) 8.txt(mnop) 9.txt(pqrs)', 'root/i/j/k/l 10.txt(abcd) 11.txt(ijkl) 12.txt(mnop)']) == [['root/a/b/c/1.txt', 'root/d/e/f/4.txt', 'root/i/j/k/l/10.txt'], ['root/a/b/c/2.txt', 'root/g/h/7.txt'], ['root/a/b/c/3.txt', 'root/d/e/f/6.txt', 'root/i/j/k/l/11.txt'], ['root/d/e/f/5.txt', 'root/g/h/8.txt', 'root/i/j/k/l/12.txt']]\n assert candidate(paths = ['dir1 12.txt(abc) 13.txt(def)', 'dir2 14.txt(ghi) 15.txt(jkl)', 'dir3 16.txt(mno) 17.txt(pqr)', 'dir4 18.txt(abc) 19.txt(def)']) == [['dir1/12.txt', 'dir4/18.txt'], ['dir1/13.txt', 'dir4/19.txt']]\n assert candidate(paths = ['root/logs/2023/01/01/log1.log(logdata1)', 'root/logs/2023/01/02/log2.log(logdata2)', 'root/logs/2023/01/03/log3.log(logdata1)', 'root/logs/2023/01/04/log4.log(logdata2)', 'root/logs/2023/01/05/log5.log(logdata3)', 'root/logs/2023/01/06/log6.log(logdata1)', 'root/logs/2023/01/07/log7.log(logdata2)']) == []\n assert candidate(paths = ['root/a/b/c 1.txt(abcd123) 2.txt(efgh456)', 'root/a/b/d 3.txt(abcd123)', 'root/e/f/g 4.txt(efgh456)', 'root/h 5.txt(abcd123)', 'root/i/j 6.txt(efgh456)', 'root/k/l/m 7.txt(abcd123)']) == [['root/a/b/c/1.txt', 'root/a/b/d/3.txt', 'root/h/5.txt', 'root/k/l/m/7.txt'], ['root/a/b/c/2.txt', 'root/e/f/g/4.txt', 'root/i/j/6.txt']]\n assert candidate(paths = ['root/project/src/main.java(code1)', 'root/project/src/test.java(code2)', 'root/project/docs/requirements.txt(code1)', 'root/project/docs/design.txt(code2)', 'root/project/bin/main.java(code1)']) == []\n assert candidate(paths = ['root/a/b 1.txt(abcd) 2.txt(efgh)', 'root/a/b/c 3.txt(abcd)', 'root/a/b/d 4.txt(efgh)', 'root/e/f/g 5.txt(efgh)', 'root/e/f/g 6.txt(abcd)']) == [['root/a/b/1.txt', 'root/a/b/c/3.txt', 'root/e/f/g/6.txt'], ['root/a/b/2.txt', 'root/a/b/d/4.txt', 'root/e/f/g/5.txt']]\n assert candidate(paths = ['root/d1 1.txt(abcd123) 2.txt(efgh456)', 'root/d2 3.txt(abcd123)', 'root/d3 4.txt(efgh456)', 'root/d4 5.txt(abcd123)', 'root/d5 6.txt(efgh456)']) == [['root/d1/1.txt', 'root/d2/3.txt', 'root/d4/5.txt'], ['root/d1/2.txt', 'root/d3/4.txt', 'root/d5/6.txt']]\n assert candidate(paths = ['root 1.txt(12345678901234567890)', 'root/a 2.txt(12345678901234567890)', 'root/b 3.txt(09876543210987654321)', 'root/b/c 4.txt(09876543210987654321)', 'root/d 5.txt(12345678901234567890)']) == [['root/1.txt', 'root/a/2.txt', 'root/d/5.txt'], ['root/b/3.txt', 'root/b/c/4.txt']]\n assert candidate(paths = ['root 1.txt(a)', 'root 2.txt(a)', 'root 3.txt(a)', 'root 4.txt(a)', 'root 5.txt(a)', 'root 6.txt(a)', 'root 7.txt(a)', 'root 8.txt(a)', 'root 9.txt(a)', 'root 10.txt(a)', 'root 11.txt(a)', 'root 12.txt(a)', 'root 13.txt(a)', 'root 14.txt(a)', 'root 15.txt(a)']) == [['root/1.txt', 'root/2.txt', 'root/3.txt', 'root/4.txt', 'root/5.txt', 'root/6.txt', 'root/7.txt', 'root/8.txt', 'root/9.txt', 'root/10.txt', 'root/11.txt', 'root/12.txt', 'root/13.txt', 'root/14.txt', 'root/15.txt']]\n assert candidate(paths = ['home/user/documents 1.docx(abcdefg) 2.txt(hijklm)', 'home/user/downloads 3.txt(abcdefg)', 'home/user/pictures 4.txt(hijklm) 5.txt(opqrstu)', 'home/user/videos 6.txt(opqrstu) 7.txt(vwxyz)']) == [['home/user/documents/1.docx', 'home/user/downloads/3.txt'], ['home/user/documents/2.txt', 'home/user/pictures/4.txt'], ['home/user/pictures/5.txt', 'home/user/videos/6.txt']]\n assert candidate(paths = ['root/user/documents/report.txt(data123) notes.txt(data123)', 'root/user/photos/vacation.jpg(data456)', 'root/user/backup/report.txt(data123)', 'root/user/music/song.mp3(data789)', 'root/user/videos/trip.mp4(data456)']) == []\n assert candidate(paths = ['root/level1/level2/level3/1.txt(a)', 'root/level1/level2/2.txt(b)', 'root/level1/3.txt(a)', 'root/level1/4.txt(b)', 'root/5.txt(a)', 'root/6.txt(b)', 'root/7.txt(c)', 'root/8.txt(d)', 'root/level2/9.txt(c)', 'root/level2/level3/10.txt(d)']) == []\n assert candidate(paths = ['root/folder1/subfolder1/file1.txt(data123)', 'root/folder2/subfolder2/file2.txt(data456)', 'root/folder1/subfolder1/file3.txt(data789)', 'root/folder2/subfolder2/file4.txt(data123)', 'root/folder1/subfolder1/file5.txt(data456)']) == []\n assert candidate(paths = ['root 1.txt(abcd) 2.txt(efgh)', 'root/c 3.txt(abcd) 4.txt(efgh)', 'root/c/d 5.txt(abcd) 6.txt(efgh)', 'root/e 7.txt(abcd) 8.txt(efgh)', 'root/e/f 9.txt(abcd) 10.txt(efgh)', 'root/e/f/g 11.txt(abcd) 12.txt(efgh)', 'root/e/f/g/h 13.txt(abcd) 14.txt(efgh)', 'root/e/f/g/h/i 15.txt(abcd) 16.txt(efgh)']) == [['root/1.txt', 'root/c/3.txt', 'root/c/d/5.txt', 'root/e/7.txt', 'root/e/f/9.txt', 'root/e/f/g/11.txt', 'root/e/f/g/h/13.txt', 'root/e/f/g/h/i/15.txt'], ['root/2.txt', 'root/c/4.txt', 'root/c/d/6.txt', 'root/e/8.txt', 'root/e/f/10.txt', 'root/e/f/g/12.txt', 'root/e/f/g/h/14.txt', 'root/e/f/g/h/i/16.txt']]\n assert candidate(paths = ['root/a/b/c 1.txt(abcd) 2.txt(efgh)', 'root/a/b/d 3.txt(abcd)', 'root/a/b/e 4.txt(efgh) 5.txt(abcd)', 'root/a/b/f 6.txt(ghij)']) == [['root/a/b/c/1.txt', 'root/a/b/d/3.txt', 'root/a/b/e/5.txt'], ['root/a/b/c/2.txt', 'root/a/b/e/4.txt']]\n assert candidate(paths = ['root/a 1.txt(abcd) 2.txt(efgh) 3.txt(ijkl)', 'root/b 4.txt(mnop) 5.txt(abcd)', 'root/c 6.txt(efgh) 7.txt(mnop)', 'root/d 8.txt(ijkl)']) == [['root/a/1.txt', 'root/b/5.txt'], ['root/a/2.txt', 'root/c/6.txt'], ['root/a/3.txt', 'root/d/8.txt'], ['root/b/4.txt', 'root/c/7.txt']]\n assert candidate(paths = ['server/logs 1.log(err) 2.log(warn)', 'server/data 3.log(info) 4.log(err)', 'server/data/cache 5.log(warn) 6.log(info)', 'server/data/cache/temp 7.log(err) 8.log(info) 9.log(warn)']) == [['server/logs/1.log', 'server/data/4.log', 'server/data/cache/temp/7.log'], ['server/logs/2.log', 'server/data/cache/5.log', 'server/data/cache/temp/9.log'], ['server/data/3.log', 'server/data/cache/6.log', 'server/data/cache/temp/8.log']]\n assert candidate(paths = ['customer/profiles 1.json(abc) 2.json(def)', 'customer/orders 3.json(abc) 4.json(ghi)', 'customer/orders/2022 5.json(def)', 'customer/orders/2022/01 6.json(ghi) 7.json(jkl)', 'customer/orders/2022/02 8.json(abc) 9.json(jkl)']) == [['customer/profiles/1.json', 'customer/orders/3.json', 'customer/orders/2022/02/8.json'], ['customer/profiles/2.json', 'customer/orders/2022/5.json'], ['customer/orders/4.json', 'customer/orders/2022/01/6.json'], ['customer/orders/2022/01/7.json', 'customer/orders/2022/02/9.json']]\n assert candidate(paths = ['projects/code 1.py(def) 2.py(abc)', 'projects/docs 3.txt(abc)', 'projects/tests 4.py(def) 5.py(ghi)', 'projects/tests/unit 6.py(ghi)', 'projects/tests/integration 7.py(ghi)']) == [['projects/code/1.py', 'projects/tests/4.py'], ['projects/code/2.py', 'projects/docs/3.txt'], ['projects/tests/5.py', 'projects/tests/unit/6.py', 'projects/tests/integration/7.py']]\n assert candidate(paths = ['dir1/subdir1/file1.txt(aaa) dir1/subdir2/file2.txt(bbb)', 'dir2/subdir1/file3.txt(aaa) dir2/subdir2/file4.txt(ccc)', 'dir3/subdir1/file5.txt(bbb) dir3/subdir2/file6.txt(aaa)']) == []\n assert candidate(paths = ['root/user/john/docs/report.docx(abc123def456)', 'root/user/jane/docs/report.docx(abc123def456)', 'root/user/john/pics/photo.png(gif789)', 'root/user/jane/pics/photo.png(gif789)']) == []\n assert candidate(paths = ['projects/1/src/main.java(code)', 'projects/2/src/main.java(code)', 'projects/1/docs/report.pdf(doc)', 'projects/3/src/main.java(code)', 'projects/3/docs/report.pdf(doc)', 'projects/4/src/main.java(code)']) == []\n assert candidate(paths = ['root/test/folder1/file1.txt(a)', 'root/test/folder1/file2.txt(b)', 'root/test/folder2/file3.txt(a)', 'root/test/folder2/file4.txt(b)', 'root/test/folder3/file5.txt(a)', 'root/test/folder3/file6.txt(b)', 'root/test/folder4/file7.txt(a)', 'root/test/folder4/file8.txt(b)', 'root/test/folder5/file9.txt(a)', 'root/test/folder5/file10.txt(b)', 'root/test/folder6/file11.txt(a)', 'root/test/folder6/file12.txt(b)', 'root/test/folder7/file13.txt(a)', 'root/test/folder7/file14.txt(b)']) == []\n assert candidate(paths = ['root/x/y/z 1.txt(1234) 2.txt(5678)', 'root/x/y/z 3.txt(1234)', 'root/x/y 4.txt(5678)', 'root/w 5.txt(1234)', 'root/v 6.txt(5678)', 'root/u 7.txt(9012)']) == [['root/x/y/z/1.txt', 'root/x/y/z/3.txt', 'root/w/5.txt'], ['root/x/y/z/2.txt', 'root/x/y/4.txt', 'root/v/6.txt']]\n assert candidate(paths = ['root/2023/01/01/file1.txt(content1)', 'root/2023/01/02/file2.txt(content2)', 'root/2023/01/03/file3.txt(content1)', 'root/2023/01/04/file4.txt(content2)', 'root/2023/01/05/file5.txt(content3)']) == []\n assert candidate(paths = ['root/subdir1 0001.txt(a)', 'root/subdir1 0002.txt(b)', 'root/subdir1 0003.txt(c)', 'root/subdir2 0001.txt(d)', 'root/subdir3 0001.txt(a)', 'root/subdir5 0001.txt(e)', 'root/subdir5 0002.txt(f)', 'root/subdir5 0003.txt(g)', 'root/subdir5 0004.txt(a)']) == [['root/subdir1/0001.txt', 'root/subdir3/0001.txt', 'root/subdir5/0004.txt']]\n assert candidate(paths = ['root 1.txt(a) 2.txt(b) 3.txt(c)', 'root 4.txt(a) 5.txt(b) 6.txt(c)', 'root 7.txt(d) 8.txt(e) 9.txt(f)', 'root 10.txt(d) 11.txt(e) 12.txt(f)']) == [['root/1.txt', 'root/4.txt'], ['root/2.txt', 'root/5.txt'], ['root/3.txt', 'root/6.txt'], ['root/7.txt', 'root/10.txt'], ['root/8.txt', 'root/11.txt'], ['root/9.txt', 'root/12.txt']]\n assert candidate(paths = ['user/documents/1.txt(A)', 'user/documents/2.txt(B)', 'user/downloads/3.txt(A)', 'user/photos/4.txt(C)', 'user/photos/5.txt(A)', 'user/videos/6.txt(B)', 'user/videos/7.txt(A)', 'user/music/8.txt(C)']) == []\n assert candidate(paths = ['root/0 0.file(a)', 'root/1 1.file(b)', 'root/2 2.file(c)', 'root/3 3.file(d)', 'root/4 4.file(e)', 'root/5 5.file(f)', 'root/6 6.file(g)', 'root/7 7.file(h)', 'root/8 8.file(i)', 'root/9 9.file(j)', 'root/0/1 01.file(a)', 'root/0/1/2 012.file(b)', 'root/0/1/2/3 0123.file(c)']) == [['root/0/0.file', 'root/0/1/01.file'], ['root/1/1.file', 'root/0/1/2/012.file'], ['root/2/2.file', 'root/0/1/2/3/0123.file']]\n assert candidate(paths = ['root/folder1/1.txt(abcdefg) 2.txt(hijklmno)', 'root/folder1/3.txt(abcdefg)', 'root/folder2/4.txt(hijklmno)', 'root/folder3/5.txt(pqrst)', 'root/folder3/6.txt(pqrst)', 'root/folder3/7.txt(abcdefg)', 'root/folder4/8.txt(hijklmno)', 'root/folder4/9.txt(pqrst)', 'root/folder5/10.txt(pqrst)', 'root/folder5/11.txt(hijklmno)', 'root/folder5/12.txt(abcdefg)']) == []\n assert candidate(paths = ['root/a/b/c 1.txt(abcd) 2.txt(efgh)', 'root/d/e/f 3.txt(abcd) 4.txt(efgh)', 'root/g/h/i 5.txt(abcd) 6.txt(efgh)', 'root/j/k/l 7.txt(abcd) 8.txt(efgh)', 'root/m/n/o 9.txt(abcd) 10.txt(efgh)', 'root/p/q/r 11.txt(abcd) 12.txt(efgh)', 'root/s/t/u 13.txt(abcd) 14.txt(efgh)', 'root/v/w/x 15.txt(abcd) 16.txt(efgh)', 'root/y/z 17.txt(abcd) 18.txt(efgh)', 'root 19.txt(abcd) 20.txt(efgh)', 'root/a 21.txt(abcd)', 'root/a/b 22.txt(abcd)', 'root/a/b/c/d 23.txt(abcd)', 'root/d 24.txt(abcd)', 'root/d/e 25.txt(abcd)', 'root/d/e/f/g 26.txt(abcd)', 'root/g 27.txt(abcd)', 'root/g/h 28.txt(abcd)', 'root/g/h/i/j 29.txt(abcd)', 'root/j 30.txt(abcd)', 'root/j/k 31.txt(abcd)', 'root/j/k/l/m 32.txt(abcd)', 'root/m 33.txt(abcd)', 'root/m/n 34.txt(abcd)', 'root/m/n/o/p 35.txt(abcd)', 'root/p 36.txt(abcd)', 'root/p/q 37.txt(abcd)', 'root/p/q/r/s 38.txt(abcd)', 'root/s 39.txt(abcd)', 'root/s/t 40.txt(abcd)', 'root/s/t/u/v 41.txt(abcd)', 'root/v 42.txt(abcd)', 'root/v/w 43.txt(abcd)', 'root/v/w/x/y 44.txt(abcd)', 'root/y 45.txt(abcd)', 'root/y/z/a 46.txt(abcd)']) == [['root/a/b/c/1.txt', 'root/d/e/f/3.txt', 'root/g/h/i/5.txt', 'root/j/k/l/7.txt', 'root/m/n/o/9.txt', 'root/p/q/r/11.txt', 'root/s/t/u/13.txt', 'root/v/w/x/15.txt', 'root/y/z/17.txt', 'root/19.txt', 'root/a/21.txt', 'root/a/b/22.txt', 'root/a/b/c/d/23.txt', 'root/d/24.txt', 'root/d/e/25.txt', 'root/d/e/f/g/26.txt', 'root/g/27.txt', 'root/g/h/28.txt', 'root/g/h/i/j/29.txt', 'root/j/30.txt', 'root/j/k/31.txt', 'root/j/k/l/m/32.txt', 'root/m/33.txt', 'root/m/n/34.txt', 'root/m/n/o/p/35.txt', 'root/p/36.txt', 'root/p/q/37.txt', 'root/p/q/r/s/38.txt', 'root/s/39.txt', 'root/s/t/40.txt', 'root/s/t/u/v/41.txt', 'root/v/42.txt', 'root/v/w/43.txt', 'root/v/w/x/y/44.txt', 'root/y/45.txt', 'root/y/z/a/46.txt'], ['root/a/b/c/2.txt', 'root/d/e/f/4.txt', 'root/g/h/i/6.txt', 'root/j/k/l/8.txt', 'root/m/n/o/10.txt', 'root/p/q/r/12.txt', 'root/s/t/u/14.txt', 'root/v/w/x/16.txt', 'root/y/z/18.txt', 'root/20.txt']]\n assert candidate(paths = ['root/a/b/c/d 1.txt(xyz) 2.txt(mnop)', 'root/a/b/c 3.txt(xyz)', 'root/a/b 4.txt(mnop)', 'root/a 5.txt(pqrs)', 'root 6.txt(pqrs)']) == [['root/a/b/c/d/1.txt', 'root/a/b/c/3.txt'], ['root/a/b/c/d/2.txt', 'root/a/b/4.txt'], ['root/a/5.txt', 'root/6.txt']]\n assert candidate(paths = ['root/x/y/z 1.txt(abcd) 2.txt(efgh)', 'root/x/y/z 3.txt(abcd) 4.txt(efgh)', 'root/x/y 5.txt(abcd)', 'root/x 6.txt(efgh)', 'root 7.txt(abcd) 8.txt(efgh)', 'root/a/b/c 9.txt(efgh)', 'root/a/b 10.txt(abcd)', 'root/a 11.txt(efgh)']) == [['root/x/y/z/1.txt', 'root/x/y/z/3.txt', 'root/x/y/5.txt', 'root/7.txt', 'root/a/b/10.txt'], ['root/x/y/z/2.txt', 'root/x/y/z/4.txt', 'root/x/6.txt', 'root/8.txt', 'root/a/b/c/9.txt', 'root/a/11.txt']]\n assert candidate(paths = ['root 1.txt(a) 2.txt(b) 3.txt(c)', 'root/a 4.txt(a) 5.txt(b)', 'root/a/b 6.txt(c) 7.txt(d)', 'root/a/b/c 8.txt(e) 9.txt(f)', 'root/a/b/c/d 10.txt(e)']) == [['root/1.txt', 'root/a/4.txt'], ['root/2.txt', 'root/a/5.txt'], ['root/3.txt', 'root/a/b/6.txt'], ['root/a/b/c/8.txt', 'root/a/b/c/d/10.txt']]\n assert candidate(paths = ['home/user/documents/report.txt(secret) home/user/backup/report.txt(secret)', 'home/user/photos/photo1.jpg(data) home/user/album/photo2.jpg(data)', 'home/user/downloads/photo3.jpg(data) home/user/trash/photo4.jpg(data)', 'home/user/videos/video1.mp4(movie) home/user/backup/video2.mp4(movie)']) == [['home/user/photos/photo1.jpg(data)/home/user/album/photo2.jpg', 'home/user/downloads/photo3.jpg(data)/home/user/trash/photo4.jpg']]\n assert candidate(paths = ['root/a 1.txt(abcd) 2.txt(efgh)', 'root/a 3.txt(abcd) 4.txt(efgh)', 'root/b 5.txt(abcd) 6.txt(efgh)', 'root/c 7.txt(abcd) 8.txt(efgh)', 'root/d 9.txt(abcd) 10.txt(efgh)']) == [['root/a/1.txt', 'root/a/3.txt', 'root/b/5.txt', 'root/c/7.txt', 'root/d/9.txt'], ['root/a/2.txt', 'root/a/4.txt', 'root/b/6.txt', 'root/c/8.txt', 'root/d/10.txt']]\n assert candidate(paths = ['/ 36.txt(ab) 37.txt(cd)', '/a 38.txt(cd) 39.txt(ab)', '/b 40.txt(ab) 41.txt(cd)', '/c 42.txt(cd) 43.txt(ab) 44.txt(ab)', '/d 45.txt(cd) 46.txt(cd)']) == [['//36.txt', '/a/39.txt', '/b/40.txt', '/c/43.txt', '/c/44.txt'], ['//37.txt', '/a/38.txt', '/b/41.txt', '/c/42.txt', '/d/45.txt', '/d/46.txt']]\n assert candidate(paths = ['a/b/c 27.txt(pqr) 28.txt(stu)', 'a/b 29.txt(pqr)', 'a/b/d 30.txt(stu) 31.txt(vwx)', 'a/b/e 32.txt(vwx) 33.txt(yza)', 'a/b/f 34.txt(yza) 35.txt(pqr)']) == [['a/b/c/27.txt', 'a/b/29.txt', 'a/b/f/35.txt'], ['a/b/c/28.txt', 'a/b/d/30.txt'], ['a/b/d/31.txt', 'a/b/e/32.txt'], ['a/b/e/33.txt', 'a/b/f/34.txt']]\n assert candidate(paths = ['root/very/deep/folder/structure/here/and/now/1.txt(xyz)', 'root/very/deep/folder/structure/here/and/now/2.txt(xyz)', 'root/very/deep/folder/structure/here/and/3.txt(xyz)', 'root/very/deep/folder/structure/here/4.txt(xyz)', 'root/very/deep/folder/structure/5.txt(xyz)', 'root/very/deep/folder/6.txt(xyz)', 'root/very/deep/folder/7.txt(xyz)', 'root/very/deep/folder/8.txt(xyz)', 'root/very/deep/folder/9.txt(xyz)', 'root/very/deep/folder/10.txt(xyz)', 'root/very/deep/11.txt(xyz)', 'root/very/deep/12.txt(xyz)', 'root/very/13.txt(xyz)', 'root/14.txt(xyz)']) == []\n assert candidate(paths = ['root/data/batch1/data1.csv(csvdata1)', 'root/data/batch1/data2.csv(csvdata2)', 'root/data/batch1/data3.csv(csvdata1)', 'root/data/batch2/data4.csv(csvdata2)', 'root/data/batch2/data5.csv(csvdata3)', 'root/data/batch2/data6.csv(csvdata1)']) == []\n assert candidate(paths = ['root/project/src 1.java(abcd)', 'root/project/src 2.java(abcd)', 'root/project/src 3.java(abcd)', 'root/project/tests 4.java(abcd)', 'root/project/tests 5.java(efgh)', 'root/project/tests 6.java(efgh)', 'root/project/docs 7.java(efgh)', 'root/project/docs 8.java(ijkl)']) == [['root/project/src/1.java', 'root/project/src/2.java', 'root/project/src/3.java', 'root/project/tests/4.java'], ['root/project/tests/5.java', 'root/project/tests/6.java', 'root/project/docs/7.java']]\n"}, "metadata": {"canonical_parameter_names": ["paths"], "leetcode_dataset_entry_point": "Solution().findDuplicate", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findDuplicate = function(paths) {", "container": null, "callable": "findDuplicate", "parameters": [{"name": "paths", "type": "string[]"}], "return_type": "string[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 611, "task_id": "valid-triangle-number", "difficulty": "Medium", "problem_description": "Given an integer array nums, return the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle.\n \nExample 1:\n\nInput: nums = [2,2,3,4]\nOutput: 3\nExplanation: Valid combinations are: \n2,3,4 (using the first 2)\n2,3,4 (using the second 2)\n2,2,3\n\nExample 2:\n\nInput: nums = [4,2,3,4]\nOutput: 4\n\n \nConstraints:\n\n1 <= nums.length <= 1000\n0 <= nums[i] <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 2, 3, 4, 5]) == 7\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15]) == 22\n assert candidate(nums = [1, 1, 1, 1]) == 4\n assert candidate(nums = [4, 2, 3, 4]) == 4\n assert candidate(nums = [0, 1, 0, 1]) == 0\n assert candidate(nums = [10, 21, 32, 43, 54, 65]) == 7\n assert candidate(nums = [1, 1, 1, 2, 3, 5, 8, 13, 21, 34]) == 1\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 52\n assert candidate(nums = [10, 20, 30, 40, 50]) == 3\n assert candidate(nums = [5, 5, 5, 5]) == 4\n assert candidate(nums = [2, 2, 3, 4]) == 3\n assert candidate(nums = [1, 2, 3, 4, 5]) == 3\n assert candidate(nums = [0, 1, 1, 1]) == 1\n assert candidate(nums = [10, 21, 22, 100, 101, 200, 300]) == 6\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 120\n assert candidate(nums = [0, 0, 0]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6]) == 7\n assert candidate(nums = [0, 0, 0, 0]) == 0\n assert candidate(nums = [5, 10, 15, 20, 25]) == 3\n assert candidate(nums = [1, 2, 2, 3, 4]) == 4\n assert candidate(nums = [1000, 1000, 1000, 1000]) == 4\n assert candidate(nums = [1, 2, 2, 3, 4, 6]) == 5\n assert candidate(nums = [1, 2, 3]) == 0\n assert candidate(nums = [0, 0, 0, 1, 1, 1, 1, 1, 2]) == 10\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == 1028\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000]) == 0\n assert candidate(nums = [1, 2, 2, 3, 4, 4, 5, 5, 5, 6, 7, 8, 8, 9, 10, 10, 11]) == 333\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99]) == 9500\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]) == 252\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10]) == 150\n assert candidate(nums = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515]) == 560\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 50\n assert candidate(nums = [3, 4, 5, 6, 7, 8]) == 17\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36]) == 372\n assert candidate(nums = [5, 6, 7, 8, 9, 10]) == 20\n assert candidate(nums = [0, 0, 0, 0, 1, 2, 3, 4, 5]) == 3\n assert candidate(nums = [10, 21, 31, 41, 51, 61, 71, 81, 91, 101]) == 62\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9]) == 1370\n assert candidate(nums = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3]) == 230\n assert candidate(nums = [1, 2, 2, 3, 4, 5]) == 7\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1140\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 525\n assert candidate(nums = [990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000]) == 165\n assert candidate(nums = [5, 10, 25, 50, 100]) == 0\n assert candidate(nums = [5, 4, 3, 2, 1]) == 3\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9]) == 1395\n assert candidate(nums = [1, 2, 2, 3, 4, 4, 5, 6, 7, 8]) == 48\n assert candidate(nums = [3, 3, 3, 3, 3]) == 10\n assert candidate(nums = [1, 3, 3, 4, 5, 6, 7, 8, 9]) == 40\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 203\n assert candidate(nums = [1, 3, 5, 7, 9, 11]) == 7\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]) == 156\n assert candidate(nums = [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 512\n assert candidate(nums = [1, 1000, 500, 300, 200, 100, 50, 25, 10, 5, 1]) == 0\n assert candidate(nums = [0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4]) == 24\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 486\n assert candidate(nums = [250, 500, 750, 1000, 250, 500, 750, 1000, 250, 500]) == 45\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 530\n assert candidate(nums = [1, 3, 5, 7, 9, 11]) == 7\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]) == 367\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40]) == 22\n assert candidate(nums = [1, 2, 3, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]) == 602\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 4, 5]) == 31\n assert candidate(nums = [10, 20, 25, 30, 35, 40, 50, 60, 70, 80, 90, 100]) == 94\n assert candidate(nums = [0, 1, 1, 1, 1, 1]) == 10\n assert candidate(nums = [100, 150, 200, 250, 300, 350, 400, 450, 500]) == 50\n assert candidate(nums = [33, 33, 33, 66, 66, 66, 99, 99, 99, 132, 132, 132]) == 103\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900]) == 34\n assert candidate(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110]) == 165\n assert candidate(nums = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77]) == 525\n assert candidate(nums = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190]) == 444\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35]) == 372\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 120\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90]) == 372\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == 444\n assert candidate(nums = [0, 0, 0, 1, 1, 1, 2, 2, 2]) == 11\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 525\n assert candidate(nums = [5, 25, 45, 65, 85, 105, 125, 145, 165, 185, 205]) == 70\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4]) == 24\n assert candidate(nums = [998, 999, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000]) == 220\n assert candidate(nums = [333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333]) == 286\n assert candidate(nums = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == 1945\n assert candidate(nums = [2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 325\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 1078\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 50\n assert candidate(nums = [8, 15, 17, 10, 12, 6, 9, 11, 7, 4, 3, 2, 1]) == 108\n assert candidate(nums = [10, 20, 20, 20, 30, 30, 40, 50, 60]) == 35\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1]) == 56\n assert candidate(nums = [10, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 283\n assert candidate(nums = [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]) == 1140\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6]) == 7\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 203\n assert candidate(nums = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 508\n assert candidate(nums = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 1140\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128]) == 0\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]) == 24\n assert candidate(nums = [3, 3, 3, 3, 3, 3]) == 20\n assert candidate(nums = [2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8]) == 898\n assert candidate(nums = [2, 3, 3, 4, 5, 6, 7, 8, 9, 10]) == 65\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 525\n assert candidate(nums = [1000, 0, 500, 500, 0, 500, 500, 0, 500, 500]) == 20\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1]) == 420\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 1140\n assert candidate(nums = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210]) == 211\n assert candidate(nums = [5, 6, 7, 8, 9]) == 10\n assert candidate(nums = [1, 10, 100, 1000, 2, 20, 200, 2000, 3, 30, 300, 3000, 4, 40, 400, 4000]) == 4\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 50\n assert candidate(nums = [300, 200, 100, 400, 500, 600, 700, 800, 900, 1000]) == 50\n assert candidate(nums = [1, 1, 1, 2, 2, 3, 4, 5]) == 10\n assert candidate(nums = [1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == 1591\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 50\n assert candidate(nums = [999, 1000, 1000, 1000, 1000, 999, 999, 999, 999, 998, 998, 998, 998]) == 286\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 455\n assert candidate(nums = [1, 10, 100, 1000, 10, 100, 1000, 10, 100, 1000]) == 39\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().triangleNumber", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var triangleNumber = function(nums) {", "container": null, "callable": "triangleNumber", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 617, "task_id": "merge-two-binary-trees", "difficulty": "Easy", "problem_description": "You are given two binary trees root1 and root2.\nImagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge the two trees into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new value of the merged node. Otherwise, the NOT null node will be used as the node of the new tree.\nReturn the merged tree.\nNote: The merging process must start from the root nodes of both trees.\n \nExample 1:\n\n\nInput: root1 = [1,3,2,5], root2 = [2,1,3,null,4,null,7]\nOutput: [3,4,5,5,4,null,7]\n\nExample 2:\n\nInput: root1 = [1], root2 = [1,2]\nOutput: [2,2]\n\n \nConstraints:\n\nThe number of nodes in both trees is in the range [0, 2000].\n-104 <= Node.val <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(root1 = tree_node([5, 3, 2, 1]),root2 = tree_node([2, 4, 6, 8])), tree_node([7, 7, 8, 9]))\n assert is_same_tree(candidate(root1 = tree_node([3, 4, 5, 1, 2]),root2 = tree_node([4, 5, 6])), tree_node([7, 9, 11, 1, 2]))\n assert is_same_tree(candidate(root1 = tree_node([5, 3, 6, 2, 4, None, None, 1, None, None, None, None, None, None, 8]),root2 = tree_node([7, 4, 5, None, None, None, None, 3, 6, 9])), tree_node([12, 7, 11, 2, 4, None, None, 1]))\n assert is_same_tree(candidate(root1 = tree_node([3, 4, 5, 1, 2]),root2 = tree_node([0, -1, -2, -3, -4])), tree_node([3, 3, 3, -2, -2]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2, None, 3]),root2 = tree_node([1, None, 2, None, 3])), tree_node([2, 2, 2, 3, None, None, 3]))\n assert is_same_tree(candidate(root1 = tree_node([1, -2, 3]),root2 = tree_node([-4, 5, -6])), tree_node([-3, 3, -3]))\n assert is_same_tree(candidate(root1 = tree_node([]),root2 = tree_node([1])), tree_node([1]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7]),root2 = tree_node([7, 6, 5, 4, 3, 2, 1])), tree_node([8, 8, 8, 8, 8, 8, 8]))\n assert is_same_tree(candidate(root1 = tree_node([5, 3, 2, 1]),root2 = tree_node([2, 1, 3])), tree_node([7, 4, 5, 1]))\n assert is_same_tree(candidate(root1 = tree_node([5, 3, 6, 2, 4, None, 7]),root2 = tree_node([1, 2, None, 3, None, 6, 8])), tree_node([6, 5, 6, 5, 4, None, 7, 6, 8]))\n assert is_same_tree(candidate(root1 = tree_node([5, 15, 50, 10, 20]),root2 = tree_node([10, 20, 60, 5, 15, 55, 65])), tree_node([15, 35, 110, 15, 35, 55, 65]))\n assert is_same_tree(candidate(root1 = tree_node([1, None, 2, None, 3]),root2 = tree_node([2, None, 3, None, 4])), tree_node([3, None, 5, None, 7]))\n assert is_same_tree(candidate(root1 = tree_node([-1, -2, -3]),root2 = tree_node([-4, -5, -6])), tree_node([-5, -7, -9]))\n assert is_same_tree(candidate(root1 = tree_node([5, 3, 2, 1]),root2 = tree_node([1, 2, 3, 4])), tree_node([6, 5, 5, 5]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7])), tree_node([2, 4, 6, 8, 10, 12, 14]))\n assert candidate(root1 = tree_node([]),root2 = tree_node([])) == None\n assert is_same_tree(candidate(root1 = tree_node([1, None, 2, None, 3]),root2 = tree_node([2, 1, None, 3, None])), tree_node([3, 1, 2, 3, None, None, 3]))\n assert is_same_tree(candidate(root1 = tree_node([1]),root2 = tree_node([1, 2])), tree_node([2, 2]))\n assert is_same_tree(candidate(root1 = tree_node([4, 3, None, 1, 2]),root2 = tree_node([4, 3, None, 2, 1])), tree_node([8, 6, None, 3, 3]))\n assert is_same_tree(candidate(root1 = tree_node([5, 10, 15]),root2 = tree_node([3, 6, 9, 12, 15, 18, 21])), tree_node([8, 16, 24, 12, 15, 18, 21]))\n assert is_same_tree(candidate(root1 = tree_node([3, 4, 5, 1, 2]),root2 = tree_node([4, 1, 2])), tree_node([7, 5, 7, 1, 2]))\n assert is_same_tree(candidate(root1 = tree_node([1, None, 2, None, 3, None, 4, None, 5]),root2 = tree_node([5, None, 4, None, 3, None, 2, None, 1])), tree_node([6, None, 6, None, 6, None, 6, None, 6]))\n assert is_same_tree(candidate(root1 = tree_node([1, None, 2, None, 3]),root2 = tree_node([4, 5, 6, 7, 8, 9, 10])), tree_node([5, 5, 8, 7, 8, 9, 13]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2]),root2 = tree_node([3])), tree_node([4, 2]))\n assert is_same_tree(candidate(root1 = tree_node([5, 3, 8]),root2 = tree_node([1, 2, 3])), tree_node([6, 5, 11]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2]),root2 = tree_node([3, 4, 5, 6])), tree_node([4, 6, 5, 6]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2]),root2 = tree_node([])), tree_node([1, 2]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7]),root2 = tree_node([8, 9, 10, 11, 12, 13, 14])), tree_node([9, 11, 13, 15, 17, 19, 21]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2, 3]),root2 = tree_node([4, 5, 6])), tree_node([5, 7, 9]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2]),root2 = tree_node([3, 4, 5])), tree_node([4, 6, 5]))\n assert is_same_tree(candidate(root1 = tree_node([1, None, 2]),root2 = tree_node([3, 4])), tree_node([4, 4, 2]))\n assert is_same_tree(candidate(root1 = tree_node([10, 15, 12, 8, None, 9, 10]),root2 = tree_node([12, 13, 10, 9, None, 10, 11])), tree_node([22, 28, 22, 17, None, 19, 21]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2, 3, 4, 5]),root2 = tree_node([5, 4, 3, 2, 1])), tree_node([6, 6, 6, 6, 6]))\n assert is_same_tree(candidate(root1 = tree_node([1, None, 2, None, 3]),root2 = tree_node([4, None, 5, None, 6])), tree_node([5, None, 7, None, 9]))\n assert is_same_tree(candidate(root1 = tree_node([1, None, 2, None, 3]),root2 = tree_node([3, None, 2, None, 1])), tree_node([4, None, 4, None, 4]))\n assert is_same_tree(candidate(root1 = tree_node([1, 3, None, 5, 3]),root2 = tree_node([2, 1, 3, None, 4, None, 7])), tree_node([3, 4, 3, 5, 7, None, 7]))\n assert is_same_tree(candidate(root1 = tree_node([3, 5, 2, 6, 7]),root2 = tree_node([4, 1, 2, None, None, 3, 8])), tree_node([7, 6, 4, 6, 7, 3, 8]))\n assert is_same_tree(candidate(root1 = tree_node([3, 4, 5, 1, 2]),root2 = tree_node([2, 4, 6])), tree_node([5, 8, 11, 1, 2]))\n assert is_same_tree(candidate(root1 = tree_node([1, None, 2, None, 3, None, 4, None, 5]),root2 = tree_node([1, None, 2, None, 3, None, 4, None, 5])), tree_node([2, None, 4, None, 6, None, 8, None, 10]))\n assert is_same_tree(candidate(root1 = tree_node([3, 4, 5, 1, 2]),root2 = tree_node([6, 7, 8, 9, 10])), tree_node([9, 11, 13, 10, 12]))\n assert is_same_tree(candidate(root1 = tree_node([5, 3, 8]),root2 = tree_node([6, 2, 4])), tree_node([11, 5, 12]))\n assert is_same_tree(candidate(root1 = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6]),root2 = tree_node([6, 5, 4, 3, 2, 1])), tree_node([7, 5, 6, 3, 2, 1, 3, None, None, None, None, None, None, None, 4, None, 5, None, 6]))\n assert is_same_tree(candidate(root1 = tree_node([1]),root2 = tree_node([])), tree_node([1]))\n assert is_same_tree(candidate(root1 = tree_node([5, 3, 8, 1, 4, None, 9, None, None, 2, 6, None, None, None, None, None, 7]),root2 = tree_node([5, 3, 8, 1, None, None, 9, None, 4, None, 7, None, None, 2, 6])), tree_node([10, 6, 16, 2, 4, None, 18, None, 4, 2, 6, None, 7, None, None, None, None, None, 7, 2, 6]))\n assert is_same_tree(candidate(root1 = tree_node([5, 3, 8, 1, 4, 7, 10]),root2 = tree_node([3, 2, 5, None, 4, None, 6])), tree_node([8, 5, 13, 1, 8, 7, 16]))\n assert is_same_tree(candidate(root1 = tree_node([5, 3, 8, 1, 4, None, 9]),root2 = tree_node([7, 2, 10, None, None, 6, None])), tree_node([12, 5, 18, 1, 4, 6, 9]))\n assert is_same_tree(candidate(root1 = tree_node([100, -99, 98]),root2 = tree_node([99, 100, -99])), tree_node([199, 1, -1]))\n assert is_same_tree(candidate(root1 = tree_node([5, 3, 2, 1]),root2 = tree_node([3, 4, 6])), tree_node([8, 7, 8, 1]))\n assert is_same_tree(candidate(root1 = tree_node([1, None, 3]),root2 = tree_node([2, 4])), tree_node([3, 4, 3]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2, 3]),root2 = tree_node([])), tree_node([1, 2, 3]))\n assert is_same_tree(candidate(root1 = tree_node([]),root2 = tree_node([1, 2, 3])), tree_node([1, 2, 3]))\n assert is_same_tree(candidate(root1 = tree_node([1, 3, None, None, 2]),root2 = tree_node([2, None, 3, None, 4])), tree_node([3, 3, 3, None, 2, None, 4]))\n assert is_same_tree(candidate(root1 = tree_node([1]),root2 = tree_node([2, None, 3])), tree_node([3, None, 3]))\n assert is_same_tree(candidate(root1 = tree_node([10, 15, 20]),root2 = tree_node([20, 15, 10])), tree_node([30, 30, 30]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7]),root2 = tree_node([])), tree_node([1, 2, 3, 4, 5, 6, 7]))\n assert is_same_tree(candidate(root1 = tree_node([1, 3, 2, 5]),root2 = tree_node([2, 1, 3, None, 4, None, 7])), tree_node([3, 4, 5, 5, 4, None, 7]))\n assert is_same_tree(candidate(root1 = tree_node([]),root2 = tree_node([2, 1, 3])), tree_node([2, 1, 3]))\n assert is_same_tree(candidate(root1 = tree_node([1, 2, 3, 4, 5]),root2 = tree_node([6, 7, 8, 9, 10])), tree_node([7, 9, 11, 13, 15]))\n"}, "metadata": {"canonical_parameter_names": ["root1", "root2"], "leetcode_dataset_entry_point": "Solution().mergeTrees", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var mergeTrees = function(root1, root2) {", "container": null, "callable": "mergeTrees", "parameters": [{"name": "root1", "type": "TreeNode"}, {"name": "root2", "type": "TreeNode"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 621, "task_id": "task-scheduler", "difficulty": "Medium", "problem_description": "You are given an array of CPU tasks, each labeled with a letter from A to Z, and a number n. Each CPU interval can be idle or allow the completion of one task. Tasks can be completed in any order, but there's a constraint: there has to be a gap of at least n intervals between two tasks with the same label.\nReturn the minimum number of CPU intervals required to complete all tasks.\n \nExample 1:\n\nInput: tasks = [\"A\",\"A\",\"A\",\"B\",\"B\",\"B\"], n = 2\nOutput: 8\nExplanation: A possible sequence is: A -> B -> idle -> A -> B -> idle -> A -> B.\nAfter completing task A, you must wait two intervals before doing A again. The same applies to task B. In the 3rd interval, neither A nor B can be done, so you idle. By the 4th interval, you can do A again as 2 intervals have passed.\n\nExample 2:\n\nInput: tasks = [\"A\",\"C\",\"A\",\"B\",\"D\",\"B\"], n = 1\nOutput: 6\nExplanation: A possible sequence is: A -> B -> C -> D -> A -> B.\nWith a cooling interval of 1, you can repeat a task after just one other task.\n\nExample 3:\n\nInput: tasks = [\"A\",\"A\",\"A\", \"B\",\"B\",\"B\"], n = 3\nOutput: 10\nExplanation: A possible sequence is: A -> B -> idle -> idle -> A -> B -> idle -> idle -> A -> B.\nThere are only two types of tasks, A and B, which need to be separated by 3 intervals. This leads to idling twice between repetitions of these tasks.\n\n \nConstraints:\n\n1 <= tasks.length <= 104\ntasks[i] is an uppercase English letter.\n0 <= n <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(tasks = ['A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D'],n = 3) == 13\n assert candidate(tasks = ['A', 'B', 'C', 'D'],n = 0) == 4\n assert candidate(tasks = ['A', 'B', 'C', 'D', 'E', 'F', 'G'],n = 2) == 7\n assert candidate(tasks = ['A'],n = 5) == 1\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'B', 'C', 'D'],n = 2) == 16\n assert candidate(tasks = ['A', 'A', 'B', 'B'],n = 0) == 4\n assert candidate(tasks = ['A', 'B', 'C', 'D', 'E', 'F', 'G'],n = 0) == 7\n assert candidate(tasks = ['A'],n = 0) == 1\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B'],n = 2) == 8\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B'],n = 3) == 10\n assert candidate(tasks = ['A', 'B', 'C', 'D', 'E', 'F'],n = 0) == 6\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C'],n = 2) == 13\n assert candidate(tasks = ['A', 'B', 'A', 'B', 'A', 'B'],n = 2) == 8\n assert candidate(tasks = ['A', 'C', 'A', 'B', 'D', 'B'],n = 1) == 6\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D'],n = 4) == 14\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'B', 'C', 'D', 'E', 'F', 'G'],n = 2) == 16\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D'],n = 2) == 20\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'C'],n = 6) == 45\n assert candidate(tasks = ['X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z'],n = 3) == 35\n assert candidate(tasks = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],n = 10) == 52\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E'],n = 3) == 20\n assert candidate(tasks = ['A', 'A', 'B', 'B', 'C', 'C', 'D', 'D', 'E', 'E', 'F', 'F', 'G', 'G', 'H', 'H', 'I', 'I', 'J', 'J', 'K', 'K', 'L', 'L', 'M', 'M', 'N', 'N', 'O', 'O', 'P', 'P', 'Q', 'Q', 'R', 'R', 'S', 'S', 'T', 'T', 'U', 'U', 'V', 'V', 'W', 'W', 'X', 'X', 'Y', 'Y', 'Z', 'Z'],n = 1) == 52\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D', 'E', 'E', 'E', 'F', 'F', 'F', 'G', 'G', 'G', 'H', 'H', 'H', 'I', 'I', 'I', 'J', 'J', 'J', 'K', 'K', 'K', 'L', 'L', 'L'],n = 10) == 36\n assert candidate(tasks = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],n = 5) == 52\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'D', 'D', 'E', 'E', 'E', 'E', 'E', 'E'],n = 4) == 27\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'E'],n = 4) == 25\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D'],n = 5) == 58\n assert candidate(tasks = ['X', 'X', 'X', 'Y', 'Y', 'Y', 'Z', 'Z', 'W', 'W', 'W', 'W', 'W', 'V', 'V', 'V', 'V', 'V'],n = 5) == 26\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B'],n = 2) == 35\n assert candidate(tasks = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],n = 0) == 26\n assert candidate(tasks = ['X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z', 'X', 'Y', 'Z'],n = 2) == 24\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D', 'E', 'E', 'E', 'F', 'F', 'F', 'G', 'G', 'G', 'H', 'H', 'H', 'I', 'I', 'I', 'J', 'J', 'J', 'K', 'K', 'K', 'L', 'L', 'L', 'M', 'M', 'M', 'N', 'N', 'N', 'O', 'O', 'O', 'P', 'P', 'P', 'Q', 'Q', 'Q', 'R', 'R', 'R', 'S', 'S', 'S', 'T', 'T', 'T', 'U', 'U', 'U', 'V', 'V', 'V', 'W', 'W', 'W', 'X', 'X', 'X', 'Y', 'Y', 'Y', 'Z', 'Z', 'Z'],n = 10) == 78\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'D', 'D', 'E', 'E', 'F', 'F', 'G', 'G'],n = 3) == 17\n assert candidate(tasks = ['P', 'P', 'P', 'P', 'P', 'Q', 'Q', 'Q', 'Q', 'Q', 'R', 'R', 'R', 'R', 'S', 'S', 'S', 'S', 'T', 'T', 'T', 'T', 'U', 'U', 'U', 'U'],n = 4) == 26\n assert candidate(tasks = ['X', 'X', 'X', 'X', 'Y', 'Y', 'Y', 'Y', 'Z', 'Z', 'Z', 'Z', 'Z', 'W', 'W', 'W', 'W', 'W', 'W'],n = 6) == 36\n assert candidate(tasks = ['A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C'],n = 2) == 24\n assert candidate(tasks = ['X', 'X', 'X', 'X', 'X', 'Y', 'Y', 'Y', 'Y', 'Y', 'Z', 'Z', 'Z', 'Z', 'Z', 'W', 'W', 'W', 'W', 'W'],n = 5) == 28\n assert candidate(tasks = ['X', 'X', 'X', 'Y', 'Y', 'Y', 'Z', 'Z', 'Z', 'Z', 'Z'],n = 5) == 25\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D', 'E', 'E', 'E', 'F', 'F', 'F', 'G', 'G', 'G', 'H', 'H', 'H', 'I', 'I', 'I', 'J', 'J', 'J'],n = 7) == 30\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D', 'E', 'E', 'E', 'F', 'F', 'F', 'G', 'G', 'G', 'H', 'H', 'H', 'I', 'I', 'I', 'J', 'J', 'J', 'K', 'K', 'K'],n = 2) == 33\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'G', 'G', 'G', 'G', 'G', 'G', 'G', 'G', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H'],n = 7) == 64\n assert candidate(tasks = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],n = 7) == 78\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C'],n = 5) == 33\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'E', 'E', 'E'],n = 5) == 31\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D'],n = 4) == 19\n assert candidate(tasks = ['X', 'Y', 'X', 'Y', 'X', 'Y', 'X', 'Y', 'X', 'Y', 'Z', 'Z', 'Z', 'Z', 'Z', 'W', 'W', 'W', 'W', 'W'],n = 3) == 20\n assert candidate(tasks = ['A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B'],n = 1) == 62\n assert candidate(tasks = ['F', 'G', 'H', 'F', 'G', 'H', 'F', 'G', 'H', 'F', 'G', 'H', 'F', 'G', 'H', 'F', 'G', 'H', 'F', 'G', 'H', 'F', 'G', 'H', 'F', 'G', 'H'],n = 2) == 27\n assert candidate(tasks = ['A', 'A', 'B', 'B', 'C', 'C', 'D', 'D', 'E', 'E', 'F', 'F', 'G', 'G', 'H', 'H', 'I', 'I', 'J', 'J', 'K', 'K', 'L', 'L', 'M', 'M', 'N', 'N', 'O', 'O', 'P', 'P', 'Q', 'Q', 'R', 'R', 'S', 'S', 'T', 'T', 'U', 'U', 'V', 'V', 'W', 'W', 'X', 'X', 'Y', 'Y', 'Z', 'Z'],n = 10) == 52\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D', 'E', 'E', 'E', 'F', 'F', 'F', 'G', 'G', 'G', 'H', 'H', 'H', 'I', 'I', 'I', 'J', 'J', 'J', 'K', 'K', 'K'],n = 4) == 33\n assert candidate(tasks = ['Q', 'Q', 'Q', 'R', 'R', 'R', 'S', 'S', 'T', 'T', 'U', 'U', 'V', 'V', 'W', 'W', 'X', 'X', 'Y', 'Y', 'Z', 'Z'],n = 7) == 22\n assert candidate(tasks = ['P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O'],n = 25) == 26\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'D', 'D'],n = 8) == 58\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'],n = 0) == 68\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'G', 'G', 'G', 'G', 'G', 'G', 'G', 'G'],n = 15) == 119\n assert candidate(tasks = ['A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C'],n = 1) == 30\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D', 'E', 'E', 'E', 'F', 'F', 'F'],n = 3) == 18\n assert candidate(tasks = ['A', 'B', 'A', 'C', 'A', 'D', 'A', 'E', 'A', 'F', 'A', 'G', 'A', 'H', 'A', 'I', 'A', 'J', 'A'],n = 5) == 55\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'D', 'D', 'D', 'E', 'E', 'E', 'E'],n = 4) == 17\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C'],n = 5) == 27\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D', 'E', 'E', 'E', 'F', 'F', 'F', 'G', 'G', 'G', 'H', 'H', 'H', 'I', 'I', 'I', 'J', 'J', 'J', 'K', 'K', 'K', 'L', 'L', 'L', 'M', 'M', 'M', 'N', 'N', 'N', 'O', 'O', 'O', 'P', 'P', 'P', 'Q', 'Q', 'Q', 'R', 'R', 'R', 'S', 'S', 'S', 'T', 'T', 'T', 'U', 'U', 'U', 'V', 'V', 'V', 'W', 'W', 'W', 'X', 'X', 'X', 'Y', 'Y', 'Y', 'Z', 'Z', 'Z'],n = 2) == 78\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C'],n = 1) == 27\n assert candidate(tasks = ['U', 'V', 'W', 'X', 'Y', 'Z', 'U', 'V', 'W', 'X', 'Y', 'Z', 'U', 'V', 'W', 'X', 'Y', 'Z', 'U', 'V', 'W', 'X', 'Y', 'Z'],n = 6) == 27\n assert candidate(tasks = ['X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z'],n = 6) == 52\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D', 'E', 'E', 'E', 'F', 'F', 'F', 'G', 'G', 'G', 'H', 'H', 'H', 'I', 'I', 'I', 'J', 'J', 'J'],n = 2) == 31\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C'],n = 4) == 23\n assert candidate(tasks = ['M', 'M', 'M', 'M', 'M', 'M', 'N', 'N', 'N', 'N', 'N', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'P', 'P', 'P', 'P', 'P', 'P'],n = 6) == 39\n assert candidate(tasks = ['M', 'M', 'M', 'N', 'N', 'N', 'N', 'N', 'O', 'O', 'O', 'O', 'O', 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'Q', 'Q', 'Q', 'Q', 'Q', 'Q', 'Q'],n = 5) == 38\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'G', 'G', 'G', 'G', 'G', 'G', 'G', 'G', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H'],n = 6) == 59\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D'],n = 3) == 32\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'F', 'F', 'F', 'F', 'G', 'G', 'G', 'G', 'H', 'H', 'H', 'H'],n = 7) == 32\n assert candidate(tasks = ['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D', 'E', 'E', 'E', 'F', 'F', 'F', 'G', 'G', 'G', 'H', 'H', 'H'],n = 2) == 24\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D'],n = 5) == 28\n assert candidate(tasks = ['Q', 'Q', 'Q', 'Q', 'Q', 'R', 'R', 'R', 'R', 'R', 'R', 'S', 'S', 'S', 'S', 'S', 'T', 'T', 'T', 'T', 'T'],n = 5) == 31\n assert candidate(tasks = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],n = 10) == 26\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'D', 'D'],n = 6) == 45\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'F', 'F', 'F', 'F', 'G', 'G', 'G', 'G', 'H', 'H', 'H', 'H'],n = 8) == 37\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'F', 'F', 'F', 'F', 'G', 'G', 'G', 'G', 'H', 'H', 'H', 'H', 'I', 'I', 'I', 'I'],n = 10) == 42\n assert candidate(tasks = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],n = 25) == 26\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'D', 'E', 'E', 'F', 'F', 'F'],n = 4) == 16\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D', 'E', 'E'],n = 4) == 26\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'F', 'F', 'F', 'F'],n = 3) == 24\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C'],n = 5) == 45\n assert candidate(tasks = ['A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B'],n = 0) == 20\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D'],n = 6) == 50\n assert candidate(tasks = ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'D', 'D'],n = 3) == 25\n"}, "metadata": {"canonical_parameter_names": ["tasks", "n"], "leetcode_dataset_entry_point": "Solution().leastInterval", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var leastInterval = function(tasks, n) {", "container": null, "callable": "leastInterval", "parameters": [{"name": "tasks", "type": "character[]"}, {"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 623, "task_id": "add-one-row-to-tree", "difficulty": "Medium", "problem_description": "Given the root of a binary tree and two integers val and depth, add a row of nodes with value val at the given depth depth.\nNote that the root node is at depth 1.\nThe adding rule is:\n\nGiven the integer depth, for each not null tree node cur at the depth depth - 1, create two tree nodes with value val as cur's left subtree root and right subtree root.\ncur's original left subtree should be the left subtree of the new left subtree root.\ncur's original right subtree should be the right subtree of the new right subtree root.\nIf depth == 1 that means there is no depth depth - 1 at all, then create a tree node with value val as the new root of the whole original tree, and the original tree is the new root's left subtree.\n\n \nExample 1:\n\n\nInput: root = [4,2,6,3,1,5], val = 1, depth = 2\nOutput: [4,1,1,2,null,null,6,3,1,5]\n\nExample 2:\n\n\nInput: root = [4,2,null,3,1], val = 1, depth = 3\nOutput: [4,2,null,1,1,3,null,null,1]\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 104].\nThe depth of the tree is in the range [1, 104].\n-100 <= Node.val <= 100\n-105 <= val <= 105\n1 <= depth <= the depth of tree + 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),val = 0,depth = 2), tree_node([1, 0, 0, 2, None, None, 3, 4, 5, 6, 7]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),val = 0,depth = 4), tree_node([1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4]),val = 5,depth = 5), tree_node([1, 2, 3, 4]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),val = 10,depth = 4), tree_node([1, 2, 3, 4, 5, 6, 7, 10, 10, 10, 10, 10, 10, 10, 10]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),val = 1,depth = 3), tree_node([1, 2, 3, 1, 1, 1, 1, 4, None, None, 5, 6, None, None, 7, 8, 9, 10, 11, 12, 13, 14, 15]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3]),val = 4,depth = 4), tree_node([1, None, 2, None, 3, 4, 4]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4]),val = 5,depth = 5), tree_node([1, None, 2, None, 3, None, 4, 5, 5]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3]),val = 4,depth = 4), tree_node([1, 2, 3]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4]),val = 5,depth = 4), tree_node([1, None, 2, None, 3, 5, 5, None, None, None, 4]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3]),val = 5,depth = 4), tree_node([1, 2, 3]))\n assert is_same_tree(candidate(root = tree_node([5, 4, 8, 11, None, 17, 4, 7, 1, None, None, 5, 3]),val = 1,depth = 3), tree_node([5, 4, 8, 1, 1, 1, 1, 11, None, None, None, 17, None, None, 4, 7, 1, None, None, 5, 3]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),val = 1,depth = 1), tree_node([1, 1, None, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),val = 0,depth = 3), tree_node([1, 2, 3, 0, 0, 0, 0, 4, None, None, 5, 6, None, None, 7]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),val = 8,depth = 1), tree_node([8, 1, None, 2, 3, 4, 5, 6, 7]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),val = 8,depth = 4), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8]))\n assert is_same_tree(candidate(root = tree_node([1]),val = 2,depth = 1), tree_node([2, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),val = 3,depth = 3), tree_node([1, 2, 3, 3, 3, 3, 3, 4, None, None, 5, 6, None, None, 7]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4]),val = 5,depth = 4), tree_node([1, 2, 3, 4, None, None, None, 5, 5]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5]),val = 2,depth = 3), tree_node([1, None, 2, 2, 2, None, None, None, 3, None, 4, None, 5]))\n assert is_same_tree(candidate(root = tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, None, 1]),val = 3,depth = 3), tree_node([5, 4, 8, 3, 3, 3, 3, 11, None, None, None, 13, None, None, 4, 7, 2, None, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4]),val = 5,depth = 3), tree_node([1, None, 2, 5, 5, None, None, None, 3, None, 4]))\n assert is_same_tree(candidate(root = tree_node([4, 2, 6, 3, 1, 5]),val = 1,depth = 2), tree_node([4, 1, 1, 2, None, None, 6, 3, 1, 5]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3]),val = 4,depth = 5), tree_node([1, 2, 3]))\n assert is_same_tree(candidate(root = tree_node([4, 2, None, 3, 1]),val = 1,depth = 3), tree_node([4, 2, None, 1, 1, 3, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2]),val = 3,depth = 2), tree_node([1, 3, 3, None, None, None, 2]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9]),val = 6,depth = 2), tree_node([1, 6, 6, 2, None, None, 3, 4, 5, 6, 7, 8, 9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5]),val = -1,depth = 2), tree_node([1, -1, -1, 2, None, None, 3, 4, 5]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4]),val = 5,depth = 3), tree_node([1, 2, 3, 5, 5, 5, 5, None, None, None, 4]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4]),val = 5,depth = 2), tree_node([1, 5, 5, 2, None, None, 3, 4]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3]),val = 4,depth = 2), tree_node([1, 4, 4, 2, None, None, 3]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),val = 3,depth = 4), tree_node([1, 2, 3, 4, 5, 6, 7, 3, 3, 3, 3, 3, 3, 3, 3]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5]),val = 0,depth = 4), tree_node([1, 2, 3, 4, 5, None, None, 0, 0, 0, 0]))\n assert is_same_tree(candidate(root = tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1]),val = 1,depth = 2), tree_node([5, 1, 1, 4, None, None, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3]),val = 0,depth = 2), tree_node([1, 0, 0, 2, None, None, 3]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5]),val = 1,depth = 3), tree_node([1, None, 2, 1, 1, None, None, None, 3, None, 4, None, 5]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3]),val = 4,depth = 2), tree_node([1, 4, 4, None, None, None, 2, None, 3]))\n assert is_same_tree(candidate(root = tree_node([5, 4, 8, 11, None, 17, 4, 7, 1, 5, 3]),val = 2,depth = 3), tree_node([5, 4, 8, 2, 2, 2, 2, 11, None, None, None, 17, None, None, 4, 7, 1, 5, 3]))\n"}, "metadata": {"canonical_parameter_names": ["root", "val", "depth"], "leetcode_dataset_entry_point": "Solution().addOneRow", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var addOneRow = function(root, val, depth) {", "container": null, "callable": "addOneRow", "parameters": [{"name": "root", "type": "TreeNode"}, {"name": "val", "type": "number"}, {"name": "depth", "type": "number"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 624, "task_id": "maximum-distance-in-arrays", "difficulty": "Medium", "problem_description": "You are given m arrays, where each array is sorted in ascending order.\nYou can pick up two integers from two different arrays (each array picks one) and calculate the distance. We define the distance between two integers a and b to be their absolute difference |a - b|.\nReturn the maximum distance.\n \nExample 1:\n\nInput: arrays = [[1,2,3],[4,5],[1,2,3]]\nOutput: 4\nExplanation: One way to reach the maximum distance 4 is to pick 1 in the first or third array and pick 5 in the second array.\n\nExample 2:\n\nInput: arrays = [[1],[1]]\nOutput: 0\n\n \nConstraints:\n\nm == arrays.length\n2 <= m <= 105\n1 <= arrays[i].length <= 500\n-104 <= arrays[i][j] <= 104\narrays[i] is sorted in ascending order.\nThere will be at most 105 integers in all the arrays.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arrays = [[1, 2], [3, 4], [5, 6], [7, 8]]) == 7\n assert candidate(arrays = [[1, 2, 3], [4, 5], [1, 2, 3]]) == 4\n assert candidate(arrays = [[1, 3, 5], [2, 4, 6], [0, 7, 9]]) == 8\n assert candidate(arrays = [[-10000, 10000], [-10000, 10000], [-10000, 10000]]) == 20000\n assert candidate(arrays = [[10, 20, 30], [15, 25, 35], [20, 30, 40]]) == 30\n assert candidate(arrays = [[-10, -5, -1], [0, 3, 5], [10, 20, 30]]) == 40\n assert candidate(arrays = [[-10000, 10000], [5000, 15000], [-5000, 5000]]) == 25000\n assert candidate(arrays = [[1, 2], [3, 4], [5, 6], [7, 8]]) == 7\n assert candidate(arrays = [[-1], [-2], [-3], [-4], [-5]]) == 4\n assert candidate(arrays = [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [0, 1, 2, 3, 4]]) == 10\n assert candidate(arrays = [[100], [200], [300], [400], [500]]) == 400\n assert candidate(arrays = [[-10, -5, -2], [0, 2, 5], [10, 15, 20]]) == 30\n assert candidate(arrays = [[1], [1]]) == 0\n assert candidate(arrays = [[1], [2, 3, 4], [5, 6, 7, 8], [9, 10]]) == 9\n assert candidate(arrays = [[-1, -2, -3], [-4, -5], [-1, -2, -3]]) == 4\n assert candidate(arrays = [[-10, 0, 10], [5, 6, 7], [1, 2, 3]]) == 17\n assert candidate(arrays = [[-10000, 10000], [-5000, 5000]]) == 15000\n assert candidate(arrays = [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10]]) == 9\n assert candidate(arrays = [[-10000, 10000], [-9999, 9999], [1, 10000]]) == 20000\n assert candidate(arrays = [[1, 2, 3, 4, 5], [-5, -4, -3, -2, -1], [6, 7, 8, 9, 10], [-10, -9, -8, -7, -6], [11, 12, 13, 14, 15], [-15, -14, -13, -12, -11]]) == 30\n assert candidate(arrays = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]) == 19\n assert candidate(arrays = [[-20000, -19000], [-18000, -17000], [-16000, -15000], [-14000, -13000], [-12000, -11000], [-10000, -9000], [-8000, -7000], [-6000, -5000], [-4000, -3000], [-2000, -1000], [0, 1000], [2000, 3000], [4000, 5000], [6000, 7000], [8000, 9000], [10000, 11000], [12000, 13000], [14000, 15000], [16000, 17000], [18000, 19000], [20000, 21000]]) == 41000\n assert candidate(arrays = [[-100, -90, -80], [-70, -60, -50], [-40, -30, -20], [-10, 0, 10], [20, 30, 40], [50, 60, 70], [80, 90, 100]]) == 200\n assert candidate(arrays = [[-5000, -4999], [-4998, -4997], [-4996, -4995], [-4994, -4993], [-4992, -4991], [-4990, -4989], [-4988, -4987], [-4986, -4985], [-4984, -4983], [-4982, -4981], [-4980, -4979], [-4978, -4977], [-4976, -4975], [-4974, -4973], [-4972, -4971], [-4970, -4969], [-4968, -4967], [-4966, -4965], [-4964, -4963], [-4962, -4961], [-4960, -4959], [-4958, -4957], [-4956, -4955], [-4954, -4953], [-4952, -4951], [-4950, -4949], [-4948, -4947], [-4946, -4945], [-4944, -4943], [-4942, -4941], [-4940, -4939], [-4938, -4937], [-4936, -4935]]) == 65\n assert candidate(arrays = [[-10000], [-9999], [-9998], [-9997], [-9996]]) == 4\n assert candidate(arrays = [[1], [1, 1, 1, 1, 1], [1], [1, 1, 1, 1], [1]]) == 0\n assert candidate(arrays = [[10000], [9999], [9998], [9997], [9996]]) == 4\n assert candidate(arrays = [[1, 1000], [2, 999], [3, 998], [4, 997], [5, 996], [6, 995], [7, 994], [8, 993], [9, 992], [10, 991], [11, 990], [12, 989], [13, 988], [14, 987], [15, 986], [16, 985], [17, 984], [18, 983], [19, 982], [20, 981]]) == 998\n assert candidate(arrays = [[-1000], [-900, -800, -700], [-600, -500, -400], [-300, -200, -100], [0, 100, 200], [300, 400, 500], [600, 700, 800], [900], [1000]]) == 2000\n assert candidate(arrays = [[-1000, -500, 0, 500, 1000], [-900, -400, 100, 600, 1100], [-800, -300, 200, 700, 1200], [-700, -200, 300, 800, 1300]]) == 2300\n assert candidate(arrays = [[-1000, -500, -100], [-900, -800, -700], [1000, 1100, 1200], [1300, 1400, 1500]]) == 2500\n assert candidate(arrays = [[-5, -4, -3, -2, -1], [0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [20, 21, 22, 23, 24], [25, 26, 27, 28, 29]]) == 34\n assert candidate(arrays = [[-10000, -9000, -8000], [10000], [5000, 6000, 7000], [1000, 2000, 3000, 4000]]) == 20000\n assert candidate(arrays = [[1, 2, 3, 4, 5], [-5, -4, -3, -2, -1], [6, 7, 8, 9, 10], [-10, -9, -8, -7, -6], [11, 12, 13, 14, 15]]) == 25\n assert candidate(arrays = [[-500], [-400], [-300], [-200], [-100], [0], [100], [200], [300], [400], [500]]) == 1000\n assert candidate(arrays = [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [3, 6, 9, 12, 15], [4, 8, 12, 16, 20], [5, 10, 15, 20, 25]]) == 24\n assert candidate(arrays = [[1, 2], [1, 2, 3], [1, 2, 3, 4], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6, 7]]) == 6\n assert candidate(arrays = [[-1, 0, 1], [2, 3, 4, 5], [-5, -4, -3, -2], [6, 7, 8], [-8, -7, -6, -5], [9, 10, 11], [-11, -10, -9, -8]]) == 22\n assert candidate(arrays = [[1, 2, 3, 4, 5], [10, 11, 12, 13, 14], [20, 21, 22, 23, 24], [30, 31, 32, 33, 34], [40, 41, 42, 43, 44], [50, 51, 52, 53, 54], [60, 61, 62, 63, 64]]) == 63\n assert candidate(arrays = [[-10000, -9000, -8000], [-7000, -6000, -5000], [-4000, -3000, -2000], [-1000, 0, 1000], [2000, 3000, 4000]]) == 14000\n assert candidate(arrays = [[-5, -3, -1], [-2, 0, 2], [1, 3, 5], [4, 6, 8], [7, 9, 11]]) == 16\n assert candidate(arrays = [[-10000], [-9000], [-8000], [-7000], [-6000], [-5000], [-4000], [-3000], [-2000], [-1000]]) == 9000\n assert candidate(arrays = [[-10, -5, -1], [0, 0, 0], [1, 1, 1], [5, 5, 5], [10, 10, 10]]) == 20\n assert candidate(arrays = [[-1000], [-500], [0], [500], [1000], [-1001], [-501], [-1], [1], [501], [1001], [-1002], [-502], [-2], [2], [502], [1002]]) == 2004\n assert candidate(arrays = [[-1, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0]]) == 1\n assert candidate(arrays = [[-500, -400, -300], [-200, -100, 0], [100, 200, 300], [400, 500, 600], [700, 800, 900], [1000]]) == 1500\n assert candidate(arrays = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]]) == 29\n assert candidate(arrays = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]]) == 19\n assert candidate(arrays = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]) == 24\n assert candidate(arrays = [[-100, 0, 100], [-99, -1, 99], [-98, -2, 98], [-97, -3, 97], [-96, -4, 96]]) == 199\n assert candidate(arrays = [[-1], [-1], [0], [0], [1], [1]]) == 2\n assert candidate(arrays = [[-100, -90, -80], [-70, -60, -50], [-40, -30, -20], [-10, 0, 10], [20, 30, 40]]) == 140\n assert candidate(arrays = [[-100, -50, 0], [50, 100, 150], [-200, -150, -100], [200, 250, 300], [-300, -250, -200]]) == 600\n assert candidate(arrays = [[-10000], [-9999, -9998, -9997], [-9996, -9995, -9994], [-9993, -9992, -9991], [-9990], [9990], [9991, 9992, 9993], [9994, 9995, 9996], [9997, 9998, 9999], [10000]]) == 20000\n assert candidate(arrays = [[1, 100], [2, 99], [3, 98], [4, 97], [5, 96]]) == 98\n assert candidate(arrays = [[-1, 0, 1, 2, 3], [100, 101, 102, 103, 104], [200, 201, 202, 203, 204], [300, 301, 302, 303, 304], [400, 401, 402, 403, 404], [500, 501, 502, 503, 504]]) == 505\n assert candidate(arrays = [[-10, -9, -8, -7, -6], [-5, -4, -3, -2, -1], [0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14]]) == 24\n assert candidate(arrays = [[-5, 5], [-4, 4], [-3, 3], [-2, 2], [-1, 1], [0, 0]]) == 9\n assert candidate(arrays = [[1, 1000], [1001, 2000], [2001, 3000], [3001, 4000], [4001, 5000]]) == 4999\n assert candidate(arrays = [[-1000, -500, -200], [100, 200, 300], [500, 600, 700, 800], [900, 1000]]) == 2000\n assert candidate(arrays = [[-1, 0, 1], [-2, -1, 0], [0, 1, 2], [1, 2, 3], [2, 3, 4]]) == 6\n assert candidate(arrays = [[1], [1, 1, 1, 1], [1, 1, 1, 1], [1000]]) == 999\n assert candidate(arrays = [[1, 2, 3, 4, 5], [-5, -4, -3, -2, -1], [0], [6, 7, 8, 9, 10]]) == 15\n assert candidate(arrays = [[-1, 0, 1], [-2, -1, 0, 1, 2], [-3, -2, -1, 0, 1, 2, 3], [-4, -3, -2, -1, 0, 1, 2, 3, 4], [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]]) == 9\n assert candidate(arrays = [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(arrays = [[-100], [-99], [-98], [-97], [-96], [-95], [-94], [-93], [-92], [-91], [-90], [-89], [-88], [-87], [-86], [-85], [-84], [-83], [-82], [-81]]) == 19\n assert candidate(arrays = [[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4], [5, 5, 5, 5, 5], [6, 6, 6, 6, 6], [7, 7, 7, 7, 7], [8, 8, 8, 8, 8], [9, 9, 9, 9, 9], [10, 10, 10, 10, 10]]) == 9\n assert candidate(arrays = [[-1], [0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20]]) == 21\n assert candidate(arrays = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 20, 30, 40, 50, 60, 70, 80, 90, 100], [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]]) == 999\n assert candidate(arrays = [[-1000, -900, -800], [-700, -600], [-500, -400, -300, -200], [-100, 0, 100], [200, 300, 400], [500, 600, 700, 800], [900, 1000]]) == 2000\n assert candidate(arrays = [[-10], [-9, -8, -7, -6, -5, -4, -3, -2, -1], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25], [26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36], [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]]) == 60\n assert candidate(arrays = [[-10, -9, -8, -7, -6, -5, -4, -3, -2, -1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [-100, -90, -80, -70, -60, -50, -40, -30, -20, -10], [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]]) == 1100\n assert candidate(arrays = [[-1000], [-900], [-800], [-700], [-600], [-500], [-400], [-300], [-200], [-100], [0], [100], [200], [300], [400], [500], [600], [700], [800], [900], [1000]]) == 2000\n assert candidate(arrays = [[-10000], [-9000], [-8000], [-7000], [-6000], [-5000], [-4000], [-3000], [-2000], [-1000], [0], [1000], [2000], [3000], [4000], [5000], [6000], [7000], [8000], [9000], [10000]]) == 20000\n assert candidate(arrays = [[-5000, -4000], [-3000, -2000], [-1000, 0], [1000, 2000], [3000, 4000], [5000, 6000], [7000, 8000], [9000, 10000]]) == 15000\n assert candidate(arrays = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20]]) == 19\n assert candidate(arrays = [[-1, 0, 1], [-2, -1, 0], [-3, -2, -1, 0], [-4, -3, -2, -1], [-5, -4, -3, -2, -1], [-6, -5, -4, -3, -2]]) == 7\n assert candidate(arrays = [[-10000, -9999, -9998], [10000], [-5000, -4999, -4998], [9999]]) == 20000\n assert candidate(arrays = [[-5000], [-4900], [-4800], [-4700], [-4600], [-4500], [-4400], [-4300], [-4200], [-4100], [-4000]]) == 1000\n assert candidate(arrays = [[-1, -2, -3, -4, -5], [-6, -7, -8, -9, -10], [-11, -12, -13, -14, -15], [-16, -17, -18, -19, -20]]) == 11\n assert candidate(arrays = [[-5000, -4000, -3000], [-2000, -1000, 0], [1000, 2000, 3000], [4000, 5000, 6000]]) == 11000\n assert candidate(arrays = [[-1000, -900, -800], [-700, -600, -500], [-400, -300, -200], [-100, 0, 100], [200, 300, 400], [500, 600, 700], [800, 900, 1000]]) == 2000\n assert candidate(arrays = [[-5, -4, -3], [-2, -1, 0, 1, 2], [3, 4, 5, 6], [7, 8, 9], [10]]) == 15\n assert candidate(arrays = [[-10000, -9999], [9998, 9999, 10000], [-5000, -4000, -3000, -2000]]) == 20000\n assert candidate(arrays = [[-1, 0, 1], [-2, 0, 2], [-3, 0, 3], [-4, 0, 4], [-5, 0, 5], [-6, 0, 6], [-7, 0, 7], [-8, 0, 8], [-9, 0, 9], [-10, 0, 10]]) == 19\n assert candidate(arrays = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31], [32], [33], [34], [35], [36], [37], [38], [39], [40], [41], [42], [43], [44], [45], [46], [47], [48], [49], [50]]) == 49\n assert candidate(arrays = [[-10, -9], [-8, -7], [-6, -5], [-4, -3], [-2, -1], [0], [1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == 20\n assert candidate(arrays = [[-1000, -999, -998], [-997, -996, -995], [-994, -993, -992], [-991, -990, -989], [-988, -987, 1000]]) == 2000\n assert candidate(arrays = [[-50, -40, -30, -20, -10], [-9, -8, -7, -6, -5], [-4, -3, -2, -1, 0], [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]) == 70\n assert candidate(arrays = [[-10, -5, 0, 5, 10], [-9, -4, 1, 6, 11], [-8, -3, 2, 7, 12], [-7, -2, 3, 8, 13], [-6, -1, 4, 9, 14]]) == 24\n assert candidate(arrays = [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]]) == 4\n assert candidate(arrays = [[-10000, -9999, -9998], [0, 1, 2], [9998, 9999, 10000]]) == 20000\n assert candidate(arrays = [[1000], [999, 1001], [998, 999, 1002], [997, 998, 999, 1003], [996, 997, 998, 999, 1004]]) == 7\n assert candidate(arrays = [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 100]]) == 99\n assert candidate(arrays = [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [11, 13, 15, 17, 19], [20, 22, 24, 26, 28]]) == 27\n assert candidate(arrays = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]]) == 21\n assert candidate(arrays = [[-9999], [-9998], [-9997], [-9996], [-9995], [-9994], [-9993], [-9992], [-9991], [-9990], [9990], [9991], [9992], [9993], [9994], [9995], [9996], [9997], [9998], [9999]]) == 19998\n assert candidate(arrays = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], [26, 27, 28, 29, 30]]) == 29\n assert candidate(arrays = [[-10000], [-9999], [-9998], [-9997], [-9996], [-9995], [-9994], [-9993], [-9992], [-9991]]) == 9\n assert candidate(arrays = [[-100, -50, -10], [-8, -4, -1], [-5, 0, 5], [10, 20, 30], [40, 50, 60]]) == 160\n"}, "metadata": {"canonical_parameter_names": ["arrays"], "leetcode_dataset_entry_point": "Solution().maxDistance", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxDistance = function(arrays) {", "container": null, "callable": "maxDistance", "parameters": [{"name": "arrays", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 628, "task_id": "maximum-product-of-three-numbers", "difficulty": "Easy", "problem_description": "Given an integer array nums, find three numbers whose product is maximum and return the maximum product.\n \nExample 1:\nInput: nums = [1,2,3]\nOutput: 6\nExample 2:\nInput: nums = [1,2,3,4]\nOutput: 24\nExample 3:\nInput: nums = [-1,-2,-3]\nOutput: -6\n\n \nConstraints:\n\n3 <= nums.length <= 104\n-1000 <= nums[i] <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [-10, -10, 5, 2]) == 500\n assert candidate(nums = [1, 2, 3, 4]) == 24\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 99]) == 99\n assert candidate(nums = [0, 2, 3, 5]) == 30\n assert candidate(nums = [0, 2, 3, -1, 5]) == 30\n assert candidate(nums = [1, 2, 3]) == 6\n assert candidate(nums = [-10, -10, 5, 2]) == 500\n assert candidate(nums = [0, 2, 3, 5, 7]) == 105\n assert candidate(nums = [1, 2, 3, 0, -1, -2, -3, -4]) == 36\n assert candidate(nums = [-1, -2, -3, -4, -5]) == -6\n assert candidate(nums = [-1, -2, -3, -4]) == -6\n assert candidate(nums = [1, 10, -5, 1, -100]) == 5000\n assert candidate(nums = [0, 2, 3, 5, 9]) == 135\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 720\n assert candidate(nums = [-1, -2, -3]) == -6\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]) == 24273\n assert candidate(nums = [-1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 1]) == 1\n assert candidate(nums = [-10, 1, 2, 3, 100, 200]) == 60000\n assert candidate(nums = [0, 0, 0, 0, 0, 1, -1]) == 0\n assert candidate(nums = [-10, -20, 0, 5, 15, 25]) == 5000\n assert candidate(nums = [-1000, 1000, 500, -500, 250, -250, 125, -125]) == 500000000\n assert candidate(nums = [10, -10, 20, -20, 30, -30]) == 18000\n assert candidate(nums = [-1000, -999, -998, -997, -996, -995]) == -988046940\n assert candidate(nums = [-5, -5, -5, -5, -5, 5, 5, 5, 5, 5]) == 125\n assert candidate(nums = [-10, -20, -30, 1, 2, 3]) == 1800\n assert candidate(nums = [-5, -6, -7, 1, 2, 3]) == 126\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums = [-1000, 1000, 500, -500, 0, 1, -1]) == 500000000\n assert candidate(nums = [-1000, -900, -800, -700, -600, -500, 400, 300, 200, 100, 0]) == 360000000\n assert candidate(nums = [1000, -1000, 500, -500, 250, -250, 125, -125]) == 500000000\n assert candidate(nums = [1, 2, 3, 4, 5, -1000, -1000, -1000]) == 5000000\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4]) == 48\n assert candidate(nums = [-5, -4, -3, -2, -1]) == -6\n assert candidate(nums = [100, 200, 300, -100, -200, -300]) == 18000000\n assert candidate(nums = [-1, 0, 1]) == 0\n assert candidate(nums = [0, 0, 0, 0, 0, 1, 2, 3]) == 6\n assert candidate(nums = [-1, 0, 1, 2, -2, -3, 3]) == 18\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]) == 100\n assert candidate(nums = [100, 200, 300, 400, 500]) == 60000000\n assert candidate(nums = [-1, -2, 0, 2, 1]) == 4\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 0\n assert candidate(nums = [-10, 0, 10, 20, -30, 40]) == 12000\n assert candidate(nums = [0, 0, 0, 0, 1]) == 0\n assert candidate(nums = [-1, -2, 3, 4, -5, 6, -7, 8, 9, -10]) == 630\n assert candidate(nums = [0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [-1000, -999, -998, 0, 1, 2]) == 1998000\n assert candidate(nums = [-1, -1, -1, 1000, 1000, 1000]) == 1000000000\n assert candidate(nums = [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]) == 27\n assert candidate(nums = [-100, 0, 50, 100]) == 0\n assert candidate(nums = [1, 3, 5, 7, 9, -11, -13]) == 1287\n assert candidate(nums = [1, 2, 3, 4, 5, -1, -2, -3, -4, -5]) == 100\n assert candidate(nums = [1000, 999, 998, 997, 996, 995]) == 997002000\n assert candidate(nums = [1, 10, -5, 1, -100]) == 5000\n assert candidate(nums = [0, 0, 0, -1, -2, -3]) == 0\n assert candidate(nums = [-10, -20, 5, 6, 2]) == 1200\n assert candidate(nums = [1, 1, 1, 1000, 1000, 1000]) == 1000000000\n assert candidate(nums = [-10, -20, -30, 1, 2]) == 1200\n assert candidate(nums = [-100, 0, 100]) == 0\n assert candidate(nums = [1000, 999, 998, 1, 2, 3]) == 997002000\n assert candidate(nums = [-1, -2, -3, -4, -5]) == -6\n assert candidate(nums = [-1, -2, -3, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [1, 1, 1, 1, 1, 1000]) == 1000\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 2\n assert candidate(nums = [-1, -2, 3, 4, 5, 6]) == 120\n assert candidate(nums = [-999, -998, -997, 997, 998, 999]) == 996004998\n assert candidate(nums = [1000, 500, 200, 100, 50, 25]) == 100000000\n assert candidate(nums = [10, 20, 30, -1, -2, -3]) == 6000\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 720\n assert candidate(nums = [1, 2, 3, 4, 5, -6, -7, -8]) == 280\n assert candidate(nums = [-10, 20, -30, 40, -50, 60, -70, 80]) == 280000\n assert candidate(nums = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10]) == 720\n assert candidate(nums = [-1000, -999, -998, -1, -2, -3]) == -6\n assert candidate(nums = [10, 20, 30, 40, 50, -10, -20, -30, -40, -50]) == 100000\n assert candidate(nums = [-10, -20, 5, 6, 7]) == 1400\n assert candidate(nums = [100, 200, 300, 400, 500, -100, -200]) == 60000000\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]) == 100\n assert candidate(nums = [-10, -20, 5, 10, 15]) == 3000\n assert candidate(nums = [-1000, -1000, -1000, 1, 2, 3]) == 3000000\n assert candidate(nums = [1, 2, 3, -1, -2, -3, 4, 5, 6, 7, 8, 9]) == 504\n assert candidate(nums = [500, 400, 300, 200, 100, 0, -100, -200, -300, -400, -500]) == 100000000\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5]) == 125\n assert candidate(nums = [1000, 999, 998, 1, 2, 3]) == 997002000\n assert candidate(nums = [-5, -6, -7, -8, -9]) == -210\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4]) == 64\n assert candidate(nums = [-1000, 1000, 500, -500, 250, -250, 125, -125, 62, -62, 31, -31]) == 500000000\n assert candidate(nums = [1000, 999, 998, -1000]) == 997002000\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums = [-1000, 1000, 500, -500, 200, -200]) == 500000000\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums = [0, 0, 0, 1, 2, 3]) == 6\n assert candidate(nums = [-10, 20, 30, -40, 50]) == 30000\n assert candidate(nums = [-10, -5, -2, 0, 2, 5, 10]) == 500\n assert candidate(nums = [-5, -5, -5, -5, -5, -5, -5]) == -125\n assert candidate(nums = [10, 20, -30, -40, 50, 60]) == 72000\n assert candidate(nums = [-5, -6, 2, 3, 4]) == 120\n assert candidate(nums = [1, 2, 3, -4, -5, -6]) == 90\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == -6\n assert candidate(nums = [-100, -90, -80, 70, 60, 50, 40, 30, 20, 10]) == 630000\n assert candidate(nums = [-10, -9, -8, -7, -6, -5]) == -210\n assert candidate(nums = [0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [-1, 0, 1, 2, 3, 4, 5]) == 60\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums = [-1000, -999, -998, 998, 999, 1000]) == 999000000\n assert candidate(nums = [100, 90, 80, -100, -90]) == 900000\n assert candidate(nums = [-1000, -999, -998, 1000, 999, 998]) == 999000000\n assert candidate(nums = [-1, -2, -3, 4, 5, 6, 7, 8, 9]) == 504\n assert candidate(nums = [-10, -20, -30, -40, 100]) == 120000\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 1]) == 0\n assert candidate(nums = [-5, -4, -3, 1, 2, 3]) == 60\n assert candidate(nums = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990]) == 997002000\n assert candidate(nums = [1, 2, -3, 4, -5, 6]) == 90\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().maximumProduct", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maximumProduct = function(nums) {", "container": null, "callable": "maximumProduct", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 629, "task_id": "k-inverse-pairs-array", "difficulty": "Hard", "problem_description": "For an integer array nums, an inverse pair is a pair of integers [i, j] where 0 <= i < j < nums.length and nums[i] > nums[j].\nGiven two integers n and k, return the number of different arrays consisting of numbers from 1 to n such that there are exactly k inverse pairs. Since the answer can be huge, return it modulo 109 + 7.\n \nExample 1:\n\nInput: n = 3, k = 0\nOutput: 1\nExplanation: Only the array [1,2,3] which consists of numbers from 1 to 3 has exactly 0 inverse pairs.\n\nExample 2:\n\nInput: n = 3, k = 1\nOutput: 2\nExplanation: The array [1,3,2] and [2,1,3] have exactly 1 inverse pair.\n\n \nConstraints:\n\n1 <= n <= 1000\n0 <= k <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 1000,k = 500) == 955735232\n assert candidate(n = 100,k = 0) == 1\n assert candidate(n = 20,k = 50) == 788876615\n assert candidate(n = 1000,k = 0) == 1\n assert candidate(n = 10,k = 10) == 21670\n assert candidate(n = 3,k = 0) == 1\n assert candidate(n = 100,k = 50) == 445329159\n assert candidate(n = 10,k = 20) == 230131\n assert candidate(n = 10,k = 5) == 1068\n assert candidate(n = 6,k = 4) == 49\n assert candidate(n = 500,k = 500) == 334048938\n assert candidate(n = 4,k = 2) == 5\n assert candidate(n = 5,k = 3) == 15\n assert candidate(n = 3,k = 1) == 2\n assert candidate(n = 1000,k = 1000) == 663677020\n assert candidate(n = 7,k = 10) == 573\n assert candidate(n = 6,k = 5) == 71\n assert candidate(n = 100,k = 100) == 959322173\n assert candidate(n = 500,k = 250) == 340232605\n assert candidate(n = 400,k = 200) == 155930478\n assert candidate(n = 300,k = 150) == 954108341\n assert candidate(n = 250,k = 125) == 963392607\n assert candidate(n = 450,k = 350) == 817469743\n assert candidate(n = 550,k = 350) == 753008434\n assert candidate(n = 200,k = 100) == 372936062\n assert candidate(n = 900,k = 700) == 867124875\n assert candidate(n = 950,k = 600) == 304125714\n assert candidate(n = 650,k = 325) == 651704209\n assert candidate(n = 750,k = 300) == 319486156\n assert candidate(n = 500,k = 1) == 499\n assert candidate(n = 750,k = 200) == 784163913\n assert candidate(n = 500,k = 600) == 423901727\n assert candidate(n = 800,k = 350) == 167531348\n assert candidate(n = 800,k = 600) == 545089101\n assert candidate(n = 200,k = 199) == 113707737\n assert candidate(n = 350,k = 100) == 882052434\n assert candidate(n = 800,k = 500) == 237860861\n assert candidate(n = 200,k = 150) == 691281198\n assert candidate(n = 850,k = 750) == 613893680\n assert candidate(n = 550,k = 275) == 829312124\n assert candidate(n = 750,k = 250) == 998393645\n assert candidate(n = 700,k = 250) == 533593353\n assert candidate(n = 750,k = 700) == 199653602\n assert candidate(n = 200,k = 300) == 818876359\n assert candidate(n = 100,k = 75) == 472228743\n assert candidate(n = 999,k = 999) == 570203540\n assert candidate(n = 700,k = 350) == 622326263\n assert candidate(n = 825,k = 412) == 680368220\n assert candidate(n = 900,k = 450) == 610615323\n assert candidate(n = 300,k = 299) == 425310890\n assert candidate(n = 900,k = 900) == 218855132\n assert candidate(n = 400,k = 399) == 759251773\n assert candidate(n = 990,k = 500) == 863155312\n assert candidate(n = 600,k = 100) == 777381270\n assert candidate(n = 600,k = 800) == 139677600\n assert candidate(n = 150,k = 75) == 532579469\n assert candidate(n = 750,k = 600) == 37939667\n assert candidate(n = 800,k = 750) == 420581417\n assert candidate(n = 120,k = 119) == 156717557\n assert candidate(n = 500,k = 0) == 1\n assert candidate(n = 900,k = 100) == 68842652\n assert candidate(n = 800,k = 0) == 1\n assert candidate(n = 250,k = 250) == 946579835\n assert candidate(n = 850,k = 700) == 259344610\n assert candidate(n = 950,k = 900) == 333369296\n assert candidate(n = 950,k = 450) == 946420580\n assert candidate(n = 650,k = 400) == 449625333\n assert candidate(n = 150,k = 149) == 480922327\n assert candidate(n = 900,k = 300) == 64634329\n assert candidate(n = 300,k = 100) == 86577949\n assert candidate(n = 600,k = 300) == 537290507\n assert candidate(n = 998,k = 0) == 1\n assert candidate(n = 350,k = 150) == 604337481\n assert candidate(n = 800,k = 400) == 628007887\n assert candidate(n = 750,k = 500) == 620935219\n assert candidate(n = 400,k = 150) == 958391787\n assert candidate(n = 500,k = 100) == 725526442\n assert candidate(n = 600,k = 200) == 785265253\n assert candidate(n = 50,k = 25) == 913564693\n assert candidate(n = 600,k = 550) == 430003494\n"}, "metadata": {"canonical_parameter_names": ["n", "k"], "leetcode_dataset_entry_point": "Solution().kInversePairs", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var kInversePairs = function(n, k) {", "container": null, "callable": "kInversePairs", "parameters": [{"name": "n", "type": "number"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 630, "task_id": "course-schedule-iii", "difficulty": "Hard", "problem_description": "There are n different online courses numbered from 1 to n. You are given an array courses where courses[i] = [durationi, lastDayi] indicate that the ith course should be taken continuously for durationi days and must be finished before or on lastDayi.\nYou will start on the 1st day and you cannot take two or more courses simultaneously.\nReturn the maximum number of courses that you can take.\n \nExample 1:\n\nInput: courses = [[100,200],[200,1300],[1000,1250],[2000,3200]]\nOutput: 3\nExplanation: \nThere are totally 4 courses, but you can take 3 courses at most:\nFirst, take the 1st course, it costs 100 days so you will finish it on the 100th day, and ready to take the next course on the 101st day.\nSecond, take the 3rd course, it costs 1000 days so you will finish it on the 1100th day, and ready to take the next course on the 1101st day. \nThird, take the 2nd course, it costs 200 days so you will finish it on the 1300th day. \nThe 4th course cannot be taken now, since you will finish it on the 3300th day, which exceeds the closed date.\n\nExample 2:\n\nInput: courses = [[1,2]]\nOutput: 1\n\nExample 3:\n\nInput: courses = [[3,2],[4,3]]\nOutput: 0\n\n \nConstraints:\n\n1 <= courses.length <= 104\n1 <= durationi, lastDayi <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(courses = [[7, 17], [3, 12], [10, 20], [9, 10], [11, 15], [11, 16], [8, 13], [11, 17], [4, 11], [2, 12]]) == 4\n assert candidate(courses = [[100, 200], [200, 1300], [1000, 1250], [300, 3100]]) == 4\n assert candidate(courses = [[10, 100], [10, 100], [10, 100], [10, 100], [10, 100]]) == 5\n assert candidate(courses = [[5, 5], [3, 6], [7, 8], [2, 4]]) == 2\n assert candidate(courses = [[5, 5], [2, 5], [4, 6]]) == 2\n assert candidate(courses = [[7, 17], [3, 12], [10, 20], [9, 10], [5, 16], [8, 14]]) == 3\n assert candidate(courses = [[10, 15], [20, 30], [10, 25]]) == 2\n assert candidate(courses = [[1, 2]]) == 1\n assert candidate(courses = [[100, 100], [200, 200], [300, 300]]) == 1\n assert candidate(courses = [[3, 7], [4, 9], [4, 10], [2, 5]]) == 3\n assert candidate(courses = [[3, 2], [4, 3]]) == 0\n assert candidate(courses = [[100, 200], [200, 1300], [1000, 1250], [2000, 3200]]) == 3\n assert candidate(courses = [[10, 100], [20, 200], [30, 300], [40, 400]]) == 4\n assert candidate(courses = [[100, 200], [200, 1000], [500, 1500]]) == 3\n assert candidate(courses = [[9, 14], [2, 11], [8, 12], [8, 13], [10, 14], [2, 4]]) == 3\n assert candidate(courses = [[7, 16], [2, 3], [3, 12], [3, 14], [10, 19], [10, 16], [6, 10], [4, 8]]) == 4\n assert candidate(courses = [[5, 5], [5, 6], [6, 10]]) == 1\n assert candidate(courses = [[5, 20], [10, 25], [15, 30]]) == 3\n assert candidate(courses = [[4, 7], [2, 10], [3, 10]]) == 3\n assert candidate(courses = [[5, 5], [4, 6], [2, 6]]) == 2\n assert candidate(courses = [[1, 3], [2, 5], [3, 7], [4, 9]]) == 3\n assert candidate(courses = [[1, 2], [2, 3], [3, 4], [4, 5]]) == 2\n assert candidate(courses = [[5, 15], [3, 19], [6, 7], [2, 10], [5, 16], [8, 14], [10, 11], [2, 19]]) == 5\n assert candidate(courses = [[2, 5], [2, 7], [2, 10], [3, 15]]) == 4\n assert candidate(courses = [[7, 17], [3, 12], [10, 20], [9, 10], [5, 16], [8, 14], [10, 16], [4, 8]]) == 3\n assert candidate(courses = [[5, 15], [10, 20], [15, 30]]) == 3\n assert candidate(courses = [[1, 2], [2, 5], [4, 6], [7, 8]]) == 2\n assert candidate(courses = [[1, 20], [2, 30], [3, 40], [4, 50]]) == 4\n assert candidate(courses = [[10, 20], [20, 40], [30, 60]]) == 3\n assert candidate(courses = [[1, 100], [2, 101], [3, 102], [4, 103], [5, 104]]) == 5\n assert candidate(courses = [[1, 10000], [2, 9999], [3, 9998], [4, 9997], [5, 9996]]) == 5\n assert candidate(courses = [[10, 100], [10, 200], [10, 300], [10, 400], [10, 500], [10, 600], [10, 700], [10, 800], [10, 900], [10, 1000], [10, 1100], [10, 1200]]) == 12\n assert candidate(courses = [[100, 200], [150, 300], [50, 250], [200, 500], [100, 400]]) == 4\n assert candidate(courses = [[1, 100], [2, 200], [3, 300], [4, 400], [5, 500], [6, 600], [7, 700], [8, 800], [9, 900], [10, 1000], [11, 1100], [12, 1200], [13, 1300], [14, 1400], [15, 1500]]) == 15\n assert candidate(courses = [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10], [6, 12], [7, 14], [8, 16], [9, 18], [10, 20], [1, 3], [2, 5], [3, 7], [4, 9], [5, 11], [6, 13], [7, 15], [8, 17], [9, 19], [10, 21]]) == 5\n assert candidate(courses = [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100], [100, 110], [110, 120], [120, 130], [130, 140], [140, 150], [150, 160]]) == 2\n assert candidate(courses = [[300, 500], [200, 400], [100, 300], [200, 500], [100, 400], [300, 600]]) == 3\n assert candidate(courses = [[100, 500], [50, 250], [200, 600], [300, 900], [100, 400], [250, 700]]) == 5\n assert candidate(courses = [[5, 10], [10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100]]) == 2\n assert candidate(courses = [[1, 3], [2, 5], [3, 7], [4, 9], [5, 11], [6, 13], [7, 15], [8, 17], [9, 19], [10, 21], [11, 23], [12, 25], [13, 27], [14, 29], [15, 31]]) == 5\n assert candidate(courses = [[100, 300], [200, 700], [100, 500], [200, 800], [100, 600], [200, 900], [100, 700], [200, 1000]]) == 7\n assert candidate(courses = [[10000, 10001], [10000, 10002], [10000, 10003], [10000, 10004], [10000, 10005]]) == 1\n assert candidate(courses = [[5, 5], [10, 10], [15, 15], [20, 20], [25, 25], [30, 30], [35, 35], [40, 40]]) == 1\n assert candidate(courses = [[100, 250], [100, 300], [100, 350], [100, 400], [100, 450], [100, 500], [100, 550], [100, 600]]) == 6\n assert candidate(courses = [[100, 300], [200, 500], [100, 400], [200, 600], [300, 800], [100, 500], [200, 700]]) == 5\n assert candidate(courses = [[100, 200], [200, 400], [300, 600], [400, 800], [500, 1000], [600, 1200], [700, 1400], [800, 1600], [900, 1800]]) == 4\n assert candidate(courses = [[5, 5], [3, 6], [2, 10], [10, 12], [4, 8]]) == 3\n assert candidate(courses = [[500, 1000], [1000, 2000], [500, 1500], [1000, 2500], [500, 2000], [1000, 3000], [500, 2500], [1000, 3500], [500, 3000], [1000, 4000]]) == 6\n assert candidate(courses = [[100, 200], [50, 150], [30, 100], [200, 300], [10, 50]]) == 4\n assert candidate(courses = [[100, 300], [200, 400], [300, 500], [400, 600], [500, 700], [600, 800], [700, 900], [800, 1000]]) == 2\n assert candidate(courses = [[1, 10000], [2, 9999], [3, 9998], [4, 9997], [5, 9996], [6, 9995], [7, 9994], [8, 9993], [9, 9992], [10, 9991]]) == 10\n assert candidate(courses = [[5, 10], [3, 8], [4, 9], [2, 6], [7, 12], [1, 5], [6, 11], [8, 13], [9, 14], [10, 15]]) == 3\n assert candidate(courses = [[10, 20], [9, 19], [8, 18], [7, 17], [6, 16], [5, 15], [4, 14], [3, 13], [2, 12], [1, 11], [11, 21], [12, 22], [13, 23], [14, 24], [15, 25]]) == 5\n assert candidate(courses = [[1, 1000], [2, 999], [3, 998], [4, 997], [5, 996], [6, 995], [7, 994], [8, 993], [9, 992], [10, 991]]) == 10\n assert candidate(courses = [[100, 200], [200, 300], [300, 400], [400, 500], [500, 600], [600, 700], [700, 800], [800, 900], [900, 1000]]) == 2\n assert candidate(courses = [[100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300]]) == 3\n assert candidate(courses = [[100, 50], [200, 150], [300, 250], [400, 350], [500, 450], [600, 550]]) == 0\n assert candidate(courses = [[1000, 1000], [900, 900], [800, 800], [700, 700], [600, 600], [500, 500]]) == 1\n assert candidate(courses = [[300, 600], [200, 500], [100, 400], [50, 300], [25, 250], [10, 200], [5, 150], [2, 100]]) == 7\n assert candidate(courses = [[10, 15], [20, 20], [30, 25], [40, 30], [50, 35], [60, 40], [70, 45], [80, 50], [90, 55], [100, 60]]) == 1\n assert candidate(courses = [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100], [100, 110], [110, 120], [120, 130], [130, 140], [140, 150], [150, 160], [160, 170], [170, 180], [180, 190], [190, 200]]) == 2\n assert candidate(courses = [[1000, 2000], [500, 1500], [250, 1000], [125, 500], [62, 250], [31, 125], [15, 62], [7, 31], [3, 15], [1, 7]]) == 10\n assert candidate(courses = [[1, 10000], [2, 9999], [3, 9998], [4, 9997], [5, 9996], [6, 9995], [7, 9994], [8, 9993], [9, 9992], [10, 9991]]) == 10\n assert candidate(courses = [[100, 100], [200, 200], [300, 300], [400, 400], [500, 500], [600, 600], [700, 700], [800, 800], [900, 900], [1000, 1000], [100, 200], [200, 300], [300, 400], [400, 500], [500, 600], [600, 700], [700, 800], [800, 900], [900, 1000], [1000, 1100]]) == 2\n assert candidate(courses = [[500, 1000], [100, 1000], [500, 2000], [100, 3000], [500, 2500]]) == 5\n assert candidate(courses = [[10, 20], [10, 30], [10, 40], [10, 50], [10, 60], [10, 70], [10, 80], [10, 90], [10, 100], [10, 110], [10, 120], [10, 130], [10, 140], [10, 150], [10, 160], [10, 170], [10, 180], [10, 190], [10, 200], [10, 210], [10, 220], [10, 230], [10, 240], [10, 250], [10, 260], [10, 270], [10, 280], [10, 290], [10, 300]]) == 29\n assert candidate(courses = [[1, 1], [2, 3], [3, 6], [4, 10], [5, 15], [6, 21]]) == 6\n assert candidate(courses = [[5, 10], [4, 15], [6, 20], [3, 25], [7, 30], [2, 35], [8, 40], [1, 45]]) == 8\n assert candidate(courses = [[500, 600], [500, 700], [500, 800], [500, 900], [500, 1000], [500, 1100]]) == 2\n assert candidate(courses = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70], [80, 80], [90, 90], [100, 100]]) == 1\n assert candidate(courses = [[10, 20], [40, 50], [20, 100], [10, 11], [5, 6]]) == 3\n assert candidate(courses = [[200, 500], [100, 400], [150, 300], [50, 200], [300, 700], [400, 800]]) == 4\n assert candidate(courses = [[1000, 2000], [500, 1500], [300, 1000], [100, 400], [50, 300]]) == 5\n assert candidate(courses = [[500, 1000], [200, 500], [300, 800], [400, 1200], [100, 300]]) == 4\n assert candidate(courses = [[1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 13], [10, 14]]) == 3\n assert candidate(courses = [[1000, 2000], [1500, 2500], [2000, 3000], [500, 1500], [1000, 2500], [1500, 3000], [2000, 3500], [500, 2000], [1000, 3000], [1500, 3500]]) == 4\n assert candidate(courses = [[100, 200], [200, 1300], [1000, 1250], [2000, 3200], [500, 2500], [800, 3000], [1500, 4000]]) == 5\n assert candidate(courses = [[1000, 1200], [500, 700], [250, 400], [125, 200], [62, 100], [31, 50], [15, 25], [7, 12], [3, 6], [1, 3]]) == 6\n assert candidate(courses = [[100, 200], [200, 300], [300, 400], [400, 500], [500, 600], [600, 700], [700, 800], [800, 900], [900, 1000], [1000, 1100]]) == 2\n assert candidate(courses = [[50, 100], [10, 20], [40, 150], [30, 120], [15, 80]]) == 5\n assert candidate(courses = [[1000, 1500], [2000, 2500], [3000, 3500], [4000, 4500], [5000, 5500]]) == 1\n assert candidate(courses = [[1000, 2000], [900, 1900], [800, 1800], [700, 1700], [600, 1600], [500, 1500], [400, 1400], [300, 1300], [200, 1200], [100, 1100]]) == 5\n assert candidate(courses = [[10, 11], [10, 12], [10, 13], [10, 14], [10, 15], [10, 16], [10, 17], [10, 18], [10, 19], [10, 20], [10, 21], [10, 22], [10, 23], [10, 24], [10, 25], [10, 26], [10, 27], [10, 28], [10, 29], [10, 30]]) == 3\n assert candidate(courses = [[50, 100], [25, 100], [75, 150], [50, 150], [25, 150], [100, 200], [75, 200], [125, 250]]) == 4\n assert candidate(courses = [[10, 30], [20, 50], [30, 70], [40, 90], [50, 110], [60, 130], [70, 150]]) == 4\n assert candidate(courses = [[300, 400], [200, 300], [100, 200], [50, 150], [10, 100]]) == 3\n assert candidate(courses = [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100]]) == 2\n assert candidate(courses = [[50, 100], [50, 150], [50, 200], [50, 250], [50, 300], [50, 350], [50, 400]]) == 7\n assert candidate(courses = [[150, 300], [100, 450], [50, 300], [200, 600], [250, 750], [100, 500], [50, 350], [300, 800]]) == 6\n assert candidate(courses = [[100, 200], [200, 300], [300, 400], [400, 500], [500, 600], [600, 700], [700, 800]]) == 2\n assert candidate(courses = [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100], [60, 120], [70, 140], [80, 160], [90, 180], [100, 200]]) == 4\n assert candidate(courses = [[500, 700], [600, 1200], [100, 600], [400, 900], [300, 800], [200, 500]]) == 4\n assert candidate(courses = [[1000, 1000], [2000, 2000], [3000, 3000], [4000, 4000], [5000, 5000], [6000, 6000], [7000, 7000], [8000, 8000], [9000, 9000], [10000, 10000]]) == 1\n assert candidate(courses = [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100]]) == 2\n assert candidate(courses = [[300, 600], [500, 900], [200, 500], [400, 800], [600, 1200], [100, 400], [700, 1100]]) == 4\n assert candidate(courses = [[1, 1000], [1, 999], [1, 998], [1, 997], [1, 996], [1, 995], [1, 994], [1, 993], [1, 992], [1, 991]]) == 10\n assert candidate(courses = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10]]) == 2\n assert candidate(courses = [[50, 200], [100, 250], [150, 300], [200, 350], [250, 400], [300, 450], [350, 500], [400, 550], [450, 600]]) == 3\n assert candidate(courses = [[500, 900], [200, 1000], [300, 1200], [400, 1500], [100, 600], [200, 800]]) == 5\n assert candidate(courses = [[5, 10], [10, 15], [15, 20], [20, 25], [25, 30], [30, 35], [35, 40], [40, 45], [45, 50], [50, 55]]) == 2\n assert candidate(courses = [[100, 200], [200, 1300], [1000, 1250], [2000, 3200], [500, 2500]]) == 4\n assert candidate(courses = [[500, 800], [200, 600], [400, 1000], [300, 750], [100, 500]]) == 4\n assert candidate(courses = [[100, 200], [50, 250], [200, 400], [150, 350], [50, 200]]) == 4\n assert candidate(courses = [[50, 150], [100, 250], [150, 350], [200, 450], [250, 550], [300, 650], [350, 750], [400, 850]]) == 4\n assert candidate(courses = [[100, 500], [100, 1000], [100, 1500], [100, 2000], [100, 2500], [100, 3000]]) == 6\n assert candidate(courses = [[10, 50], [20, 60], [30, 70], [40, 80], [50, 90], [60, 100], [70, 110], [80, 120], [90, 130], [100, 140]]) == 3\n assert candidate(courses = [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100], [10, 110], [20, 120], [30, 130], [40, 140], [50, 150], [60, 160], [70, 170], [80, 180], [90, 190], [100, 200]]) == 6\n assert candidate(courses = [[1000, 2000], [500, 1500], [200, 500], [100, 300], [50, 250]]) == 5\n assert candidate(courses = [[300, 500], [300, 400], [200, 300], [400, 600], [100, 200]]) == 2\n assert candidate(courses = [[5, 5], [10, 10], [15, 15], [20, 20], [25, 25], [30, 30], [35, 35], [40, 40], [45, 45], [50, 50]]) == 1\n assert candidate(courses = [[500, 1000], [1000, 2000], [1500, 2500], [2000, 3000], [2500, 3500]]) == 2\n assert candidate(courses = [[5, 10], [1, 2], [3, 7], [1, 5], [2, 4]]) == 4\n assert candidate(courses = [[7, 10], [3, 9], [2, 5], [4, 11], [6, 12]]) == 3\n assert candidate(courses = [[5, 5], [6, 10], [7, 12], [2, 3], [3, 8], [1, 4]]) == 3\n assert candidate(courses = [[1000, 2000], [1000, 3000], [1000, 4000], [1000, 5000], [1000, 6000]]) == 5\n assert candidate(courses = [[100, 100], [200, 200], [300, 300], [400, 400], [500, 500], [600, 600], [700, 700], [800, 800], [900, 900], [1000, 1000]]) == 1\n assert candidate(courses = [[500, 1000], [1000, 2000], [1500, 3000], [2000, 4000], [2500, 5000], [3000, 6000]]) == 4\n assert candidate(courses = [[100, 200], [200, 1300], [1000, 1250], [2000, 3200], [50, 100], [150, 400]]) == 5\n assert candidate(courses = [[100, 150], [100, 100], [100, 250], [100, 300], [100, 350]]) == 3\n assert candidate(courses = [[100, 200], [100, 200], [100, 200], [100, 200], [100, 200], [100, 200], [100, 200], [100, 200], [100, 200], [100, 200]]) == 2\n assert candidate(courses = [[5, 10], [10, 20], [15, 30], [20, 40], [25, 50], [30, 60], [35, 70], [40, 80], [45, 90], [50, 100], [55, 110], [60, 120], [65, 130], [70, 140], [75, 150], [80, 160], [85, 170], [90, 180], [95, 190], [100, 200]]) == 5\n assert candidate(courses = [[500, 1000], [300, 600], [200, 1000], [100, 1200], [400, 800], [600, 1200]]) == 4\n assert candidate(courses = [[100, 200], [100, 250], [100, 300], [100, 350], [100, 400], [100, 450], [100, 500], [100, 550], [100, 600], [100, 650], [100, 700]]) == 7\n assert candidate(courses = [[1000, 2000], [500, 1000], [250, 750], [125, 500], [63, 350], [32, 250], [16, 175], [8, 125], [4, 80], [2, 50]]) == 10\n assert candidate(courses = [[100, 250], [200, 500], [300, 750], [400, 1000], [500, 1250], [600, 1500], [700, 1750], [800, 2000]]) == 5\n assert candidate(courses = [[2000, 3000], [1000, 2500], [500, 1500], [250, 1000], [125, 500], [62, 250], [31, 125], [15, 62], [7, 31]]) == 8\n assert candidate(courses = [[1, 10], [2, 20], [3, 30], [4, 40], [5, 50], [6, 60], [7, 70], [8, 80], [9, 90], [10, 100]]) == 10\n assert candidate(courses = [[500, 1000], [300, 600], [200, 800], [400, 900], [100, 500], [700, 1200]]) == 3\n assert candidate(courses = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12]]) == 2\n assert candidate(courses = [[300, 500], [200, 400], [100, 300], [50, 200], [25, 100], [12, 50], [6, 25], [3, 12], [1, 6]]) == 8\n"}, "metadata": {"canonical_parameter_names": ["courses"], "leetcode_dataset_entry_point": "Solution().scheduleCourse", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var scheduleCourse = function(courses) {", "container": null, "callable": "scheduleCourse", "parameters": [{"name": "courses", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 632, "task_id": "smallest-range-covering-elements-from-k-lists", "difficulty": "Hard", "problem_description": "You have k lists of sorted integers in non-decreasing order. Find the smallest range that includes at least one number from each of the k lists.\nWe define the range [a, b] is smaller than range [c, d] if b - a < d - c or a < c if b - a == d - c.\n \nExample 1:\n\nInput: nums = [[4,10,15,24,26],[0,9,12,20],[5,18,22,30]]\nOutput: [20,24]\nExplanation: \nList 1: [4, 10, 15, 24,26], 24 is in range [20,24].\nList 2: [0, 9, 12, 20], 20 is in range [20,24].\nList 3: [5, 18, 22, 30], 22 is in range [20,24].\n\nExample 2:\n\nInput: nums = [[1,2,3],[1,2,3],[1,2,3]]\nOutput: [1,1]\n\n \nConstraints:\n\nnums.length == k\n1 <= k <= 3500\n1 <= nums[i].length <= 50\n-105 <= nums[i][j] <= 105\nnums[i] is sorted in non-decreasing order.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [[-10, -5, -3, -1], [0, 2, 4, 6], [5, 10, 15, 20]]) == [-1, 5]\n assert candidate(nums = [[1, 2, 3], [1, 2, 3], [1, 2, 3]]) == [1, 1]\n assert candidate(nums = [[1, 5, 9], [2, 6, 10], [3, 7, 11]]) == [1, 3]\n assert candidate(nums = [[5, 10, 15], [3, 6, 9], [12, 14, 18]]) == [9, 12]\n assert candidate(nums = [[-10, -9, -8], [-7, -6, -5], [-4, -3, -2]]) == [-8, -4]\n assert candidate(nums = [[-10, -9, -8], [-4, -3, -2], [-1, 0, 1]]) == [-8, -1]\n assert candidate(nums = [[-10, -5, 0, 5, 10], [-5, 0, 5, 10, 15], [0, 5, 10, 15, 20]]) == [0, 0]\n assert candidate(nums = [[1, 5, 9], [0, 6, 8], [2, 3, 7]]) == [0, 2]\n assert candidate(nums = [[-5, -3], [-1, -2], [4, 5, 6]]) == [-3, 4]\n assert candidate(nums = [[10, 10, 10], [10, 10, 10], [10, 10, 10]]) == [10, 10]\n assert candidate(nums = [[4, 10, 15, 24, 26], [0, 9, 12, 20], [5, 18, 22, 30]]) == [20, 24]\n assert candidate(nums = [[1, 3, 5, 7], [2, 4, 6, 8], [0, 9, 10, 11]]) == [0, 2]\n assert candidate(nums = [[-10, -8, -6], [-6, -4, -2], [0, 2, 4]]) == [-6, 0]\n assert candidate(nums = [[1], [2], [3], [4], [5]]) == [1, 5]\n assert candidate(nums = [[5, 10, 15], [3, 6, 9], [12, 18, 24]]) == [9, 12]\n assert candidate(nums = [[1, 4, 7, 10, 13], [2, 5, 8, 11, 14], [3, 6, 9, 12, 15], [0, 16, 17, 18, 19]]) == [0, 3]\n assert candidate(nums = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]]) == [2, 19]\n assert candidate(nums = [[-5, -4, -3, -2, -1], [0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19]]) == [-1, 15]\n assert candidate(nums = [[1000, 2000, 3000], [500, 1500, 2500, 3500], [-1000, 0, 1000, 2000]]) == [500, 1000]\n assert candidate(nums = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [3, 3, 3, 3, 3, 3, 3, 3, 3, 3], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4]]) == [1, 4]\n assert candidate(nums = [[1], [2], [3], [4], [5]]) == [1, 5]\n assert candidate(nums = [[-1000, -900, -800, -700, -600, -500], [-950, -850, -750, -650, -550, -450], [-900, -800, -700, -600, -500, -400], [-850, -750, -650, -550, -450, -350]]) == [-900, -850]\n assert candidate(nums = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36, 37, 38, 39, 40]]) == [10, 31]\n assert candidate(nums = [[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20], [0, 10, 20, 30, 40, 50, 60, 70, 80, 90]]) == [9, 10]\n assert candidate(nums = [[5], [10], [15], [20], [25], [30], [35], [40], [45], [50]]) == [5, 50]\n assert candidate(nums = [[-100, -99, -98], [-97, -96, -95], [-94, -93, -92], [-91, -90, -89], [-88, -87, -86]]) == [-98, -88]\n assert candidate(nums = [[-1, -2, -3, -4, -5], [-10, -20, -30, -40, -50], [-100, -200, -300, -400, -500], [-1000, -2000, -3000, -4000, -5000]]) == [-1000, -5]\n assert candidate(nums = [[1000, 2000, 3000, 4000, 5000], [1500, 2500, 3500, 4500, 5500], [2000, 3000, 4000, 5000, 6000], [2500, 3500, 4500, 5500, 6500]]) == [2000, 2500]\n assert candidate(nums = [[-1, 0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6, 7], [2, 3, 4, 5, 6, 7, 8], [3, 4, 5, 6, 7, 8, 9]]) == [3, 3]\n assert candidate(nums = [[-10, -5, 0], [0, 5, 10], [10, 15, 20], [20, 25, 30], [30, 35, 40]]) == [0, 30]\n assert candidate(nums = [[-100, -90, -80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100], [-95, -85, -75, -65, -55, -45, -35, -25, -15, -5, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105]]) == [-100, -95]\n assert candidate(nums = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20], [3, 6, 9, 12, 15, 18, 21, 24, 27, 30]]) == [6, 6]\n assert candidate(nums = [[1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20], [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105]]) == [1, 5]\n assert candidate(nums = [[10, 20, 30, 40, 50], [15, 25, 35, 45, 55], [20, 30, 40, 50, 60], [25, 35, 45, 55, 65]]) == [20, 25]\n assert candidate(nums = [[5, 10, 15, 20, 25, 30, 35, 40, 45, 50], [1, 6, 11, 16, 21, 26, 31, 36, 41, 46], [2, 7, 12, 17, 22, 27, 32, 37, 42, 47]]) == [5, 7]\n assert candidate(nums = [[-100, -50, 0, 50, 100], [-200, -150, -100, -50, 0], [50, 100, 150, 200, 250]]) == [0, 50]\n assert candidate(nums = [[-100, -50, -25, 0, 25, 50, 100], [5, 15, 25, 35, 45, 55, 65], [10, 20, 30, 40, 50, 60, 70]]) == [20, 25]\n assert candidate(nums = [[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]]) == [1, 2]\n assert candidate(nums = [[1, 5, 9, 13, 17], [2, 6, 10, 14, 18], [3, 7, 11, 15, 19], [4, 8, 12, 16, 20]]) == [1, 4]\n assert candidate(nums = [[-5, -3, -1], [-4, -2, 0], [-3, -1, 1], [-2, 0, 2], [-1, 1, 3], [0, 2, 4], [1, 3, 5], [2, 4, 6], [3, 5, 7], [4, 6, 8]]) == [-1, 4]\n assert candidate(nums = [[-100, -90, -80, -70, -60], [-50, -40, -30, -20, -10], [0, 10, 20, 30, 40], [50, 60, 70, 80, 90], [100, 110, 120, 130, 140]]) == [-60, 100]\n assert candidate(nums = [[-100, 0, 100], [50, 60, 70], [90, 100, 110], [200, 210, 220]]) == [70, 200]\n assert candidate(nums = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 20, 30, 40, 50], [1, 11, 21, 31, 41, 51]]) == [10, 11]\n assert candidate(nums = [[-1, -2, -3, -4, -5], [-5, -4, -3, -2, -1], [-3, -2, -1, 0, 1, 2, 3], [1, 2, 3, 4, 5, 6, 7]]) == [-1, 1]\n assert candidate(nums = [[-10, -5, -1], [0, 1, 5], [10, 15, 20], [25, 30, 35], [40, 45, 50]]) == [-1, 40]\n assert candidate(nums = [[-10, -5, 0, 5, 10], [0, 2, 4, 6, 8], [3, 7, 11, 15, 19], [1, 3, 5, 7, 9]]) == [3, 5]\n assert candidate(nums = [[-10, -5, -1], [0, 1, 5, 10, 15], [20, 25, 30, 35, 40], [45, 50, 55, 60, 65]]) == [-1, 45]\n assert candidate(nums = [[1, 100000], [2, 99999], [3, 99998], [4, 99997], [5, 99996], [6, 99995], [7, 99994], [8, 99993], [9, 99992], [10, 99991]]) == [1, 10]\n assert candidate(nums = [[-100, -50, 0, 50, 100], [-90, -40, -10, 40, 90], [-80, -30, -20, 30, 80]]) == [-100, -80]\n assert candidate(nums = [[-100, -50, -25, -10, 0, 10, 25, 50, 100], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 20, 30, 40, 50, 60, 70, 80, 90, 100], [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]]) == [5, 10]\n assert candidate(nums = [[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20], [0, 21, 22, 23, 24, 25, 26, 27, 28, 29]]) == [0, 2]\n assert candidate(nums = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]) == [5, 21]\n assert candidate(nums = [[10, 20, 30, 40, 50], [11, 21, 31, 41, 51], [12, 22, 32, 42, 52], [13, 23, 33, 43, 53], [14, 24, 34, 44, 54]]) == [10, 14]\n assert candidate(nums = [[-10, 0, 10, 20], [0, 1, 2, 3], [5, 6, 7, 8, 9]]) == [0, 5]\n assert candidate(nums = [[-1, -2, -3, -4, -5], [-10, -20, -30, -40, -50], [-100, -200, -300, -400, -500]]) == [-100, -5]\n assert candidate(nums = [[1, 10, 20, 30, 40], [2, 12, 22, 32, 42], [3, 13, 23, 33, 43]]) == [1, 3]\n assert candidate(nums = [[1, 3, 5, 7, 9, 11], [2, 4, 6, 8, 10, 12], [0, 9, 12, 20, 24, 26], [5, 18, 22, 30, 35, 40]]) == [5, 9]\n assert candidate(nums = [[-1000, -500, -250, -100, -50, -25, -10, -5, -2, -1, 0, 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000], [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]]) == [1000, 1000]\n assert candidate(nums = [[-1000, -500, -250, -100, -50, -25, 0, 25, 50, 100, 250, 500, 1000], [500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000], [0, 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500]]) == [500, 500]\n assert candidate(nums = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]]) == [1, 10]\n assert candidate(nums = [[1, 20, 30], [2, 25, 35], [3, 30, 40], [4, 35, 45], [5, 40, 50]]) == [1, 5]\n assert candidate(nums = [[100, 200, 300, 400, 500], [50, 150, 250, 350, 450], [25, 75, 125, 175, 225]]) == [50, 100]\n assert candidate(nums = [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [3, 5, 7, 9, 11], [4, 6, 8, 10, 12]]) == [3, 4]\n assert candidate(nums = [[1, 4, 10, 14], [0, 9, 10, 20, 24], [5, 18, 22, 30], [3, 13, 15, 17]]) == [0, 5]\n assert candidate(nums = [[1, 4, 7, 10, 13], [2, 5, 8, 11, 14], [3, 6, 9, 12, 15]]) == [1, 3]\n assert candidate(nums = [[-1000, -900, -800, -700, -600, -500, -400, -300, -200, -100], [0, 100, 200, 300, 400, 500, 600, 700, 800, 900], [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]]) == [-100, 1000]\n assert candidate(nums = [[1, 10, 19, 28, 37], [2, 11, 20, 29, 38], [3, 12, 21, 30, 39], [4, 13, 22, 31, 40], [5, 14, 23, 32, 41]]) == [1, 5]\n assert candidate(nums = [[-10, -5, 0, 5, 10], [-20, -15, -10, -5, 0], [1, 6, 11, 16, 21]]) == [0, 1]\n assert candidate(nums = [[10, 20, 30, 40, 50], [15, 25, 35, 45, 55], [20, 30, 40, 50, 60], [5, 10, 15, 20, 25]]) == [15, 20]\n assert candidate(nums = [[-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5], [-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4], [-7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3]]) == [-5, -5]\n assert candidate(nums = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20], [3, 6, 9, 12, 15, 18, 21, 24, 27, 30]]) == [6, 6]\n assert candidate(nums = [[100, 200, 300, 400], [50, 150, 250, 350], [25, 125, 225, 325, 425]]) == [100, 150]\n assert candidate(nums = [[1, 4, 7, 10, 13, 16, 19, 22, 25, 28], [2, 5, 8, 11, 14, 17, 20, 23, 26, 29], [3, 6, 9, 12, 15, 18, 21, 24, 27, 30]]) == [1, 3]\n assert candidate(nums = [[-100000, 0, 100000], [-99999, 99999], [-99998, 99998], [-99997, 99997]]) == [-100000, -99997]\n assert candidate(nums = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], [51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]]) == [50, 51]\n assert candidate(nums = [[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20], [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100], [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105]]) == [0, 5]\n assert candidate(nums = [[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4], [5, 5, 5, 5, 5]]) == [1, 5]\n assert candidate(nums = [[1, 100000], [2, 99999], [3, 99998], [4, 99997], [5, 99996]]) == [1, 5]\n assert candidate(nums = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == [1, 1]\n assert candidate(nums = [[-100, -50, 0, 50, 100], [5, 15, 25, 35, 45], [1, 2, 3, 4, 5], [0, 0, 0, 0, 0]]) == [0, 5]\n assert candidate(nums = [[-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5], [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]) == [0, 0]\n assert candidate(nums = [[-1, -2, -3, -4, -5], [-6, -7, -8, -9, -10], [-11, -12, -13, -14, -15], [-16, -17, -18, -19, -20]]) == [-16, -5]\n assert candidate(nums = [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3], [4, 4, 4, 4], [5, 5, 5, 5]]) == [1, 5]\n assert candidate(nums = [[1, 10, 20, 30, 40], [5, 15, 25, 35, 45], [10, 20, 30, 40, 50], [5, 15, 25, 35, 45]]) == [5, 10]\n assert candidate(nums = [[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]) == [1, 2]\n assert candidate(nums = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]) == [3, 3]\n assert candidate(nums = [[10, 20, 30], [11, 21, 31], [12, 22, 32], [13, 23, 33], [14, 24, 34], [15, 25, 35], [16, 26, 36], [17, 27, 37], [18, 28, 38], [19, 29, 39]]) == [10, 19]\n assert candidate(nums = [[1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100], [2, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101], [3, 12, 22, 32, 42, 52, 62, 72, 82, 92, 102], [4, 13, 23, 33, 43, 53, 63, 73, 83, 93, 103], [5, 14, 24, 34, 44, 54, 64, 74, 84, 94, 104]]) == [1, 5]\n assert candidate(nums = [[-1, 0, 1], [-2, -1, 0, 1, 2], [-3, -2, -1, 0, 1, 2, 3]]) == [-1, -1]\n assert candidate(nums = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]) == [5, 21]\n assert candidate(nums = [[-100, -90, -80, -70, -60], [-95, -85, -75, -65, -55], [-90, -80, -70, -60, -50], [-85, -75, -65, -55, -45]]) == [-90, -85]\n assert candidate(nums = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]]) == [10, 21]\n assert candidate(nums = [[-10, -5, 0, 5, 10], [1, 3, 6, 9, 12], [2, 4, 7, 11, 13], [0, 8, 16, 24, 32]]) == [0, 2]\n assert candidate(nums = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]]) == [1, 10]\n assert candidate(nums = [[100, 200, 300], [150, 250, 350], [200, 250, 300, 350]]) == [150, 200]\n assert candidate(nums = [[-100000, 100000], [-90000, 90000], [-80000, 80000], [-70000, 70000], [-60000, 60000]]) == [-100000, -60000]\n assert candidate(nums = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15]]) == [1, 15]\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().smallestRange", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var smallestRange = function(nums) {", "container": null, "callable": "smallestRange", "parameters": [{"name": "nums", "type": "number[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 633, "task_id": "sum-of-square-numbers", "difficulty": "Medium", "problem_description": "Given a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c.\n \nExample 1:\n\nInput: c = 5\nOutput: true\nExplanation: 1 * 1 + 2 * 2 = 5\n\nExample 2:\n\nInput: c = 3\nOutput: false\n\n \nConstraints:\n\n0 <= c <= 231 - 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(c = 0) == True\n assert candidate(c = 1000000001) == False\n assert candidate(c = 25) == True\n assert candidate(c = 2) == True\n assert candidate(c = 3) == False\n assert candidate(c = 5) == True\n assert candidate(c = 1) == True\n assert candidate(c = 2147483647) == False\n assert candidate(c = 4) == True\n assert candidate(c = 1000000000) == True\n assert candidate(c = 999999999) == False\n assert candidate(c = 500000000) == True\n assert candidate(c = 100000000000) == True\n assert candidate(c = 846625) == True\n assert candidate(c = 314159265) == False\n assert candidate(c = 840000000) == False\n assert candidate(c = 80779853361) == False\n assert candidate(c = 16777217) == True\n assert candidate(c = 1000000) == True\n assert candidate(c = 1215436930) == False\n assert candidate(c = 999999999999) == False\n assert candidate(c = 16777216) == True\n assert candidate(c = 100) == True\n assert candidate(c = 10000) == True\n assert candidate(c = 325) == True\n assert candidate(c = 1805306457) == False\n assert candidate(c = 1000000003) == False\n assert candidate(c = 2147483600) == True\n assert candidate(c = 2000000000) == True\n assert candidate(c = 10000000000) == True\n assert candidate(c = 4294967296) == True\n assert candidate(c = 1800000000) == True\n assert candidate(c = 250000000) == True\n assert candidate(c = 1000000002) == False\n assert candidate(c = 846456943) == False\n assert candidate(c = 3249000000) == True\n assert candidate(c = 13) == True\n assert candidate(c = 846269696200635625) == True\n assert candidate(c = 18014398509481984) == True\n assert candidate(c = 123456789) == False\n assert candidate(c = 1805355528) == False\n assert candidate(c = 675) == False\n assert candidate(c = 4294967295) == False\n assert candidate(c = 65535) == False\n assert candidate(c = 50) == True\n assert candidate(c = 1600000000) == True\n assert candidate(c = 500) == True\n assert candidate(c = 1234567890) == False\n assert candidate(c = 10001) == True\n assert candidate(c = 9876543210) == True\n assert candidate(c = 82) == True\n assert candidate(c = 67280421310721) == True\n"}, "metadata": {"canonical_parameter_names": ["c"], "leetcode_dataset_entry_point": "Solution().judgeSquareSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var judgeSquareSum = function(c) {", "container": null, "callable": "judgeSquareSum", "parameters": [{"name": "c", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 636, "task_id": "exclusive-time-of-functions", "difficulty": "Medium", "problem_description": "On a single-threaded CPU, we execute a program containing n functions. Each function has a unique ID between 0 and n-1.\nFunction calls are stored in a call stack: when a function call starts, its ID is pushed onto the stack, and when a function call ends, its ID is popped off the stack. The function whose ID is at the top of the stack is the current function being executed. Each time a function starts or ends, we write a log with the ID, whether it started or ended, and the timestamp.\nYou are given a list logs, where logs[i] represents the ith log message formatted as a string \"{function_id}:{\"start\" | \"end\"}:{timestamp}\". For example, \"0:start:3\" means a function call with function ID 0 started at the beginning of timestamp 3, and \"1:end:2\" means a function call with function ID 1 ended at the end of timestamp 2. Note that a function can be called multiple times, possibly recursively.\nA function's exclusive time is the sum of execution times for all function calls in the program. For example, if a function is called twice, one call executing for 2 time units and another call executing for 1 time unit, the exclusive time is 2 + 1 = 3.\nReturn the exclusive time of each function in an array, where the value at the ith index represents the exclusive time for the function with ID i.\n \nExample 1:\n\n\nInput: n = 2, logs = [\"0:start:0\",\"1:start:2\",\"1:end:5\",\"0:end:6\"]\nOutput: [3,4]\nExplanation:\nFunction 0 starts at the beginning of time 0, then it executes 2 for units of time and reaches the end of time 1.\nFunction 1 starts at the beginning of time 2, executes for 4 units of time, and ends at the end of time 5.\nFunction 0 resumes execution at the beginning of time 6 and executes for 1 unit of time.\nSo function 0 spends 2 + 1 = 3 units of total time executing, and function 1 spends 4 units of total time executing.\n\nExample 2:\n\nInput: n = 1, logs = [\"0:start:0\",\"0:start:2\",\"0:end:5\",\"0:start:6\",\"0:end:6\",\"0:end:7\"]\nOutput: [8]\nExplanation:\nFunction 0 starts at the beginning of time 0, executes for 2 units of time, and recursively calls itself.\nFunction 0 (recursive call) starts at the beginning of time 2 and executes for 4 units of time.\nFunction 0 (initial call) resumes execution then immediately calls itself again.\nFunction 0 (2nd recursive call) starts at the beginning of time 6 and executes for 1 unit of time.\nFunction 0 (initial call) resumes execution at the beginning of time 7 and executes for 1 unit of time.\nSo function 0 spends 2 + 4 + 1 + 1 = 8 units of total time executing.\n\nExample 3:\n\nInput: n = 2, logs = [\"0:start:0\",\"0:start:2\",\"0:end:5\",\"1:start:6\",\"1:end:6\",\"0:end:7\"]\nOutput: [7,1]\nExplanation:\nFunction 0 starts at the beginning of time 0, executes for 2 units of time, and recursively calls itself.\nFunction 0 (recursive call) starts at the beginning of time 2 and executes for 4 units of time.\nFunction 0 (initial call) resumes execution then immediately calls function 1.\nFunction 1 starts at the beginning of time 6, executes 1 unit of time, and ends at the end of time 6.\nFunction 0 resumes execution at the beginning of time 6 and executes for 2 units of time.\nSo function 0 spends 2 + 4 + 1 = 7 units of total time executing, and function 1 spends 1 unit of total time executing.\n\n \nConstraints:\n\n1 <= n <= 100\n1 <= logs.length <= 500\n0 <= function_id < n\n0 <= timestamp <= 109\nNo two start events will happen at the same timestamp.\nNo two end events will happen at the same timestamp.\nEach function has an \"end\" log for each \"start\" log.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 1,logs = ['0:start:0', '0:end:1']) == [2]\n assert candidate(n = 4,logs = ['0:start:0', '1:start:1', '2:start:2', '2:end:3', '1:end:4', '0:end:5', '3:start:6', '3:end:7']) == [2, 2, 2, 2]\n assert candidate(n = 4,logs = ['0:start:0', '1:start:1', '1:end:2', '2:start:3', '2:end:4', '3:start:5', '3:end:6', '0:end:7']) == [2, 2, 2, 2]\n assert candidate(n = 2,logs = ['0:start:0', '1:start:1', '1:end:2', '0:end:3']) == [2, 2]\n assert candidate(n = 1,logs = ['0:start:0', '0:start:2', '0:end:5', '0:start:6', '0:end:6', '0:end:7']) == [8]\n assert candidate(n = 2,logs = ['0:start:0', '0:start:2', '0:end:5', '1:start:6', '1:end:6', '0:end:7']) == [7, 1]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:2', '0:end:5', '1:start:6', '1:end:9', '2:start:10', '2:end:12', '0:end:13']) == [7, 4, 3]\n assert candidate(n = 2,logs = ['0:start:0', '1:start:2', '1:end:5', '0:end:6']) == [3, 4]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:2', '1:start:3', '1:end:4', '0:end:5', '2:start:6', '2:end:7']) == [4, 2, 2]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:2', '1:start:3', '1:end:5', '0:end:6', '2:start:7', '2:end:8']) == [4, 3, 2]\n assert candidate(n = 3,logs = ['0:start:0', '1:start:1', '2:start:2', '2:end:3', '1:end:4', '0:end:5', '0:start:6', '1:start:7', '2:start:8', '2:end:9', '1:end:10', '0:end:11', '0:start:12', '1:start:13', '2:start:14', '2:end:15', '1:end:16', '0:end:17']) == [6, 6, 6]\n assert candidate(n = 5,logs = ['0:start:0', '0:start:1', '1:start:2', '1:start:3', '1:end:4', '2:start:5', '2:end:6', '1:end:7', '0:end:8', '4:start:9', '4:end:10']) == [3, 4, 2, 0, 2]\n assert candidate(n = 6,logs = ['0:start:0', '1:start:1', '2:start:2', '3:start:3', '4:start:4', '5:start:5', '5:end:6', '4:end:7', '3:end:8', '2:end:9', '1:end:10', '0:end:11']) == [2, 2, 2, 2, 2, 2]\n assert candidate(n = 4,logs = ['0:start:0', '0:start:1', '1:start:2', '1:start:3', '1:end:4', '0:end:5', '2:start:6', '2:end:7', '3:start:8', '3:start:9', '3:end:10', '3:end:11', '2:end:12', '0:end:13']) == [4, 4, 2, 4]\n assert candidate(n = 7,logs = ['0:start:0', '1:start:1', '2:start:2', '3:start:3', '4:start:4', '5:start:5', '6:start:6', '6:end:7', '5:end:8', '4:end:9', '3:end:10', '2:end:11', '1:end:12', '0:end:13']) == [2, 2, 2, 2, 2, 2, 2]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:1', '0:start:2', '0:end:3', '0:end:4', '0:end:5', '1:start:6', '1:end:7', '2:start:8', '2:end:9']) == [6, 2, 2]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:1', '0:start:2', '0:start:3', '0:end:4', '0:end:5', '0:end:6', '0:end:7', '1:start:8', '1:start:9', '1:end:10', '1:end:11', '2:start:12', '2:end:13']) == [8, 4, 2]\n assert candidate(n = 5,logs = ['0:start:0', '1:start:1', '1:start:2', '1:end:3', '1:start:4', '1:end:5', '2:start:6', '2:end:7', '3:start:8', '3:end:9', '4:start:10', '4:end:11']) == [1, 5, 2, 2, 2]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:2', '0:start:4', '0:end:5', '0:end:7', '0:end:9', '1:start:10', '1:end:11', '2:start:12', '2:end:13']) == [10, 2, 2]\n assert candidate(n = 3,logs = ['0:start:0', '1:start:1', '1:start:2', '1:start:3', '1:end:4', '1:end:5', '1:end:6', '0:end:7', '2:start:8', '2:start:9', '2:end:10', '2:end:11', '0:start:12', '0:end:13']) == [4, 6, 4]\n assert candidate(n = 2,logs = ['0:start:0', '0:start:1', '0:start:2', '0:start:3', '0:end:4', '0:end:5', '0:end:6', '0:end:7', '1:start:8', '1:end:9']) == [8, 2]\n assert candidate(n = 4,logs = ['0:start:0', '0:start:1', '1:start:2', '1:end:3', '0:end:4', '0:start:5', '0:start:6', '2:start:7', '2:end:8', '0:end:9', '0:end:10', '3:start:11', '3:end:12', '0:start:13', '0:end:14']) == [9, 2, 2, 2]\n assert candidate(n = 4,logs = ['0:start:0', '0:start:1', '1:start:2', '1:end:3', '1:start:4', '1:end:5', '0:end:6', '2:start:7', '2:end:8', '3:start:9', '3:end:10']) == [3, 4, 2, 2]\n assert candidate(n = 5,logs = ['0:start:0', '0:start:2', '1:start:3', '1:end:5', '2:start:6', '2:end:9', '0:end:10', '3:start:11', '4:start:12', '4:end:14', '3:end:15']) == [4, 3, 4, 2, 3]\n assert candidate(n = 4,logs = ['0:start:0', '1:start:1', '2:start:2', '1:start:3', '2:end:4', '1:end:5', '0:end:6', '3:start:7', '3:start:8', '3:end:9', '3:end:10']) == [1, 4, 2, 4]\n assert candidate(n = 10,logs = ['0:start:0', '1:start:1', '2:start:2', '3:start:3', '4:start:4', '5:start:5', '6:start:6', '7:start:7', '8:start:8', '9:start:9', '9:end:11', '8:end:12', '7:end:13', '6:end:14', '5:end:15', '4:end:16', '3:end:17', '2:end:18', '1:end:19', '0:end:20']) == [2, 2, 2, 2, 2, 2, 2, 2, 2, 3]\n assert candidate(n = 6,logs = ['0:start:0', '0:start:2', '1:start:3', '1:end:4', '0:end:5', '2:start:6', '2:start:7', '3:start:8', '3:end:9', '2:end:10', '2:end:11', '0:end:12', '4:start:13', '4:end:14', '5:start:15', '5:end:16']) == [5, 2, 4, 2, 2, 2]\n assert candidate(n = 3,logs = ['0:start:0', '1:start:1', '1:start:2', '1:start:3', '1:end:4', '1:end:5', '1:end:6', '2:start:7', '2:start:8', '2:end:9', '2:end:10']) == [1, 6, 4]\n assert candidate(n = 4,logs = ['0:start:0', '1:start:1', '2:start:2', '2:end:3', '2:start:4', '3:start:5', '3:end:6', '2:end:7', '1:end:8', '0:end:9', '0:start:10', '0:end:11']) == [4, 2, 4, 2]\n assert candidate(n = 6,logs = ['0:start:0', '0:start:2', '0:end:3', '1:start:4', '1:start:6', '1:end:7', '1:end:9', '0:end:10']) == [5, 6, 0, 0, 0, 0]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:1', '1:start:2', '1:start:3', '1:end:4', '1:end:5', '0:end:6', '0:end:7', '2:start:8', '2:start:9', '2:start:10', '2:end:11', '2:end:12', '2:end:13', '0:start:14', '0:end:15']) == [6, 4, 6]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:2', '0:start:4', '0:end:5', '0:end:6', '0:end:7']) == [8, 0, 0]\n assert candidate(n = 7,logs = ['0:start:0', '0:start:1', '0:start:2', '1:start:3', '1:start:4', '1:start:5', '2:start:6', '2:start:7', '2:end:8', '2:end:9', '1:end:10', '1:end:11', '1:end:12', '0:end:13', '0:end:14', '0:end:15', '3:start:16', '3:end:17', '4:start:18', '4:end:19', '5:start:20', '5:end:21', '6:start:22', '6:end:23']) == [6, 6, 4, 2, 2, 2, 2]\n assert candidate(n = 2,logs = ['0:start:0', '1:start:1', '1:start:2', '1:end:3', '1:start:4', '1:end:5', '0:end:6']) == [1, 6]\n assert candidate(n = 4,logs = ['0:start:0', '0:start:1', '0:start:2', '0:end:3', '0:end:4', '0:end:5', '1:start:6', '1:start:7', '1:start:8', '1:end:9', '1:end:10', '1:end:11', '2:start:12', '2:start:13', '2:start:14', '2:end:15', '2:end:16', '2:end:17', '3:start:18', '3:start:19', '3:start:20', '3:end:21', '3:end:22', '3:end:23']) == [6, 6, 6, 6]\n assert candidate(n = 5,logs = ['0:start:0', '1:start:1', '2:start:2', '3:start:3', '4:start:4', '4:end:5', '3:end:6', '2:end:7', '1:end:8', '0:end:9']) == [2, 2, 2, 2, 2]\n assert candidate(n = 5,logs = ['0:start:0', '1:start:1', '1:start:2', '1:end:3', '2:start:4', '2:end:5', '3:start:6', '3:end:7', '4:start:8', '4:end:9', '1:start:10', '1:end:11', '0:end:12']) == [1, 6, 2, 2, 2]\n assert candidate(n = 3,logs = ['0:start:0', '1:start:1', '2:start:2', '2:end:3', '1:end:4', '1:start:5', '1:end:6', '0:end:7', '0:start:8', '2:start:9', '2:end:10', '0:end:11']) == [4, 4, 4]\n assert candidate(n = 4,logs = ['0:start:0', '1:start:1', '2:start:2', '3:start:3', '3:end:4', '3:start:5', '3:end:6', '2:end:7', '1:end:8', '0:end:9']) == [2, 2, 2, 4]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:1', '1:start:2', '1:end:3', '2:start:4', '2:end:5', '0:end:6']) == [3, 2, 2]\n assert candidate(n = 5,logs = ['0:start:0', '1:start:2', '2:start:4', '3:start:6', '3:end:8', '2:end:10', '1:end:12', '0:end:14']) == [4, 4, 4, 3, 0]\n assert candidate(n = 4,logs = ['0:start:0', '1:start:1', '2:start:2', '2:end:3', '1:end:4', '0:end:5', '3:start:6', '3:start:7', '3:end:8', '3:end:9']) == [2, 2, 2, 4]\n assert candidate(n = 5,logs = ['0:start:0', '1:start:1', '2:start:2', '3:start:3', '4:start:4', '4:end:5', '3:end:6', '2:end:7', '1:end:8', '0:end:9', '0:start:10', '1:start:11', '2:start:12', '3:start:13', '4:start:14', '4:end:15', '3:end:16', '2:end:17', '1:end:18', '0:end:19']) == [4, 4, 4, 4, 4]\n assert candidate(n = 2,logs = ['0:start:0', '1:start:1', '1:start:2', '1:start:3', '1:end:4', '1:end:5', '1:end:6', '0:end:7']) == [2, 6]\n assert candidate(n = 5,logs = ['0:start:0', '0:start:2', '1:start:3', '1:end:4', '2:start:5', '2:end:6', '0:end:7', '3:start:8', '4:start:9', '4:end:10', '3:end:11', '0:start:12', '0:end:13']) == [6, 2, 2, 2, 2]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:2', '1:start:3', '1:start:4', '1:end:5', '1:end:6', '0:end:7', '0:end:8', '2:start:9', '2:end:10']) == [5, 4, 2]\n assert candidate(n = 2,logs = ['0:start:0', '0:start:1', '0:start:2', '0:end:3', '0:end:4', '0:end:5', '0:start:6', '0:start:7', '0:end:8', '0:end:9']) == [10, 0]\n assert candidate(n = 6,logs = ['0:start:0', '1:start:1', '1:start:2', '2:start:3', '2:end:5', '1:end:6', '0:end:7', '3:start:8', '3:start:9', '4:start:10', '4:end:12', '3:end:13', '5:start:14', '5:end:16']) == [1, 4, 3, 3, 3, 3]\n assert candidate(n = 3,logs = ['0:start:0', '1:start:1', '1:start:2', '1:start:3', '1:end:4', '1:end:5', '1:end:6', '2:start:7', '2:end:8', '0:end:9']) == [2, 6, 2]\n assert candidate(n = 3,logs = ['0:start:0', '1:start:1', '2:start:2', '1:end:3', '2:end:4', '0:end:5', '0:start:6', '1:start:7', '2:start:8', '2:end:9', '1:end:10', '0:end:11', '0:start:12', '1:start:13', '2:start:14', '2:end:15', '1:end:16', '0:end:17']) == [6, 6, 6]\n assert candidate(n = 4,logs = ['0:start:0', '1:start:1', '2:start:2', '3:start:3', '2:end:4', '1:end:5', '0:end:6', '3:start:7', '3:end:8', '2:start:9', '2:end:10', '1:start:11', '1:end:12', '0:start:13', '0:end:14']) == [3, 4, 4, 4]\n assert candidate(n = 5,logs = ['0:start:0', '0:start:1', '1:start:2', '1:start:3', '2:start:4', '2:end:5', '1:end:6', '1:end:7', '0:end:8', '3:start:9', '3:end:10', '4:start:11', '4:end:12']) == [3, 4, 2, 2, 2]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:1', '1:start:2', '1:end:3', '2:start:4', '2:start:5', '2:end:6', '1:start:7', '1:end:8', '0:end:9']) == [2, 4, 4]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:1', '0:start:2', '0:end:3', '0:end:4', '0:end:5', '1:start:6', '1:start:7', '1:end:8', '1:end:9', '2:start:10', '2:end:11']) == [6, 4, 2]\n assert candidate(n = 4,logs = ['0:start:0', '1:start:1', '2:start:2', '3:start:3', '3:end:4', '2:end:5', '1:end:6', '0:end:7', '0:start:8', '0:end:9']) == [4, 2, 2, 2]\n assert candidate(n = 6,logs = ['0:start:0', '0:start:1', '1:start:2', '1:end:3', '0:end:4', '0:start:5', '2:start:6', '2:end:7', '3:start:8', '3:end:9', '0:end:10', '4:start:11', '4:end:12', '5:start:13', '5:end:14']) == [5, 2, 2, 2, 2, 2]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:2', '1:start:3', '1:start:4', '1:end:5', '0:end:6', '2:start:7', '2:end:8']) == [3, 4, 2]\n assert candidate(n = 5,logs = ['0:start:0', '1:start:1', '2:start:2', '2:end:3', '1:end:4', '0:end:5', '3:start:6', '4:start:7', '4:end:8', '3:end:9', '0:start:10', '0:end:11']) == [4, 2, 2, 2, 2]\n assert candidate(n = 7,logs = ['0:start:0', '0:start:2', '1:start:3', '1:end:5', '0:end:6', '2:start:7', '2:start:8', '3:start:9', '3:end:11', '2:end:12', '2:end:13', '4:start:14', '4:end:16', '5:start:17', '5:end:19', '6:start:20', '6:end:22']) == [4, 3, 4, 3, 3, 3, 3]\n assert candidate(n = 5,logs = ['0:start:0', '1:start:1', '2:start:2', '2:start:3', '3:start:4', '3:end:5', '2:end:6', '2:end:7', '1:end:8', '0:end:9', '4:start:10', '4:end:11']) == [2, 2, 4, 2, 2]\n assert candidate(n = 4,logs = ['0:start:0', '1:start:1', '2:start:2', '3:start:3', '3:end:4', '2:end:5', '1:end:6', '0:end:7']) == [2, 2, 2, 2]\n assert candidate(n = 5,logs = ['0:start:0', '1:start:1', '1:start:2', '2:start:3', '2:end:4', '1:end:5', '0:end:6', '3:start:7', '4:start:8', '4:end:9', '3:end:10', '0:start:11', '1:start:12', '2:start:13', '2:end:14', '1:end:15', '0:end:16']) == [3, 6, 4, 2, 2]\n assert candidate(n = 4,logs = ['0:start:0', '0:start:1', '0:end:2', '1:start:3', '1:end:4', '0:start:5', '0:end:6', '2:start:7', '2:end:8', '3:start:9', '3:end:10']) == [5, 2, 2, 2]\n assert candidate(n = 5,logs = ['0:start:0', '0:start:1', '0:start:2', '1:start:3', '1:end:4', '0:end:5', '0:end:6', '2:start:7', '2:start:8', '2:end:9', '2:end:10', '3:start:11', '3:end:12', '4:start:13', '4:end:14']) == [5, 2, 4, 2, 2]\n assert candidate(n = 4,logs = ['0:start:0', '1:start:1', '1:end:2', '0:start:3', '2:start:4', '2:end:5', '0:start:6', '3:start:7', '3:end:8', '0:start:9', '2:start:10', '2:end:11', '0:start:12', '1:start:13', '1:end:14', '0:end:15', '0:start:16', '2:start:17', '2:end:18', '0:end:19']) == [8, 4, 6, 2]\n assert candidate(n = 3,logs = ['0:start:0', '0:start:2', '1:start:3', '1:end:4', '1:start:5', '1:end:6', '0:end:7', '0:start:8', '0:end:9']) == [6, 4, 0]\n assert candidate(n = 4,logs = ['0:start:0', '1:start:1', '1:start:2', '1:end:3', '2:start:4', '2:end:5', '3:start:6', '3:end:7', '1:start:8', '1:end:9', '0:end:10']) == [1, 6, 2, 2]\n assert candidate(n = 5,logs = ['0:start:0', '1:start:2', '2:start:3', '2:end:4', '1:end:5', '3:start:6', '4:start:7', '4:end:8', '3:end:9', '0:end:10']) == [3, 2, 2, 2, 2]\n assert candidate(n = 5,logs = ['0:start:0', '1:start:1', '2:start:2', '3:start:3', '3:end:4', '2:end:5', '1:end:6', '0:end:7']) == [2, 2, 2, 2, 0]\n"}, "metadata": {"canonical_parameter_names": ["n", "logs"], "leetcode_dataset_entry_point": "Solution().exclusiveTime", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var exclusiveTime = function(n, logs) {", "container": null, "callable": "exclusiveTime", "parameters": [{"name": "n", "type": "number"}, {"name": "logs", "type": "string[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 637, "task_id": "average-of-levels-in-binary-tree", "difficulty": "Easy", "problem_description": "Given the root of a binary tree, return the average value of the nodes on each level in the form of an array. Answers within 10-5 of the actual answer will be accepted.\n \nExample 1:\n\n\nInput: root = [3,9,20,null,null,15,7]\nOutput: [3.00000,14.50000,11.00000]\nExplanation: The average value of nodes on level 0 is 3, on level 1 is 14.5, and on level 2 is 11.\nHence return [3, 14.5, 11].\n\nExample 2:\n\n\nInput: root = [3,9,20,15,7]\nOutput: [3.00000,14.50000,11.00000]\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 104].\n-231 <= Node.val <= 231 - 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([3, 9, 20, 15, 7])) == [3.0, 14.5, 11.0]\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, None, None, 25, 30])) == [3.0, 14.5, 11.0, 27.5]\n assert candidate(root = tree_node([3, 9, 20, 15, 7, None, None, 1, 2, None, None, 3, 4])) == [3.0, 14.5, 11.0, 1.5, 3.5]\n assert candidate(root = tree_node([3, 9, 20, 15, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) == [3.0, 14.5, 6.25, 6.5]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == [1.0, 2.5, 5.5, 11.5]\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, None, None, None, None, None, 8])) == [3.0, 14.5, 11.0]\n assert candidate(root = tree_node([3, 1, 5, 0, 2, 4, 6])) == [3.0, 3.0, 3.0]\n assert candidate(root = tree_node([3, 9, 20, 15, 7, 1, 2])) == [3.0, 14.5, 6.25]\n assert candidate(root = tree_node([3, 9, 20, 15, 7, None, None, 1, 2])) == [3.0, 14.5, 11.0, 1.5]\n assert candidate(root = tree_node([1, 2])) == [1.0, 2.0]\n assert candidate(root = tree_node([1, None, 2])) == [1.0, 2.0]\n assert candidate(root = tree_node([3, 9, 20, 15, 7, None, None, None, 8])) == [3.0, 14.5, 11.0, 8.0]\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7])) == [3.0, 14.5, 11.0]\n assert candidate(root = tree_node([1])) == [1.0]\n assert candidate(root = tree_node([10, -5, 15, 3, -7, None, 18, -1, None, 6, 8, None, None, 4, None])) == [10.0, 5.0, 4.666666666666667, 4.333333333333333, 4.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, 8, 9, 10, 11, 12, 13, 14, 15])) == [1.0, 2.5, 5.5, 8.5, 11.5, 14.5]\n assert candidate(root = tree_node([100, 50, 200, None, 75, 125, 300, None, 87, None, 150, None, 350])) == [100.0, 125.0, 166.66666666666666, 195.66666666666666]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])) == [1.0, 2.5, 5.5, 11.5, 23.5, 36.0]\n assert candidate(root = tree_node([10, 5, 15, None, None, 6, 20])) == [10.0, 10.0, 13.0]\n assert candidate(root = tree_node([2147483647, 2147483647, None, -2147483648, None, -2147483648, None, 2147483647, None, 2147483647, None, -2147483648])) == [2147483647.0, 2147483647.0, -2147483648.0, -2147483648.0, 2147483647.0, 2147483647.0, -2147483648.0]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18])) == [10.0, 10.0, 9.333333333333334]\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 190])) == [100.0, 100.0, 100.0, 97.5]\n assert candidate(root = tree_node([5, 3, 8, 1, 4, 7, 9, 0, 2, 6, None, None, None, None, None, 10, None, None, 11])) == [5.0, 5.5, 5.25, 2.6666666666666665, 10.5]\n assert candidate(root = tree_node([1, 2, 3, None, 5, 6, 7, None, None, None, 11, 12, None, None, 15])) == [1.0, 2.5, 6.0, 11.5, 15.0]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, None, 6, 8, 14, 16, 19, 20, 21])) == [10.0, 10.0, 9.333333333333334, 12.6, 20.5]\n assert candidate(root = tree_node([1, -2, -3, 4, 5, -6, -7, 8, 9, -10, -11, -12, -13, -14, -15])) == [1.0, -2.5, -1.0, -7.25]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0]\n assert candidate(root = tree_node([100, None, 200, None, 300, None, 400, None, 500, None, 600, None, 700, None, 800, None, 900])) == [100.0, 200.0, 300.0, 400.0, 500.0, 600.0, 700.0, 800.0, 900.0]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8])) == [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20, None, 21, None, 22, None, 23, None, 24, None, 25, None, 26, None, 27, None, 28, None, 29, None, 30, None, 31])) == [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, 12, 13, None, None, 16, 17])) == [1.0, 2.5, 5.5, 10.4, 16.5]\n assert candidate(root = tree_node([5, 3, 8, 1, 4, 7, 10, 0, 2, 6, 9])) == [5.0, 5.5, 5.5, 4.25]\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, 7, None, None, 8, 9])) == [1.0, 2.5, 4.5, 6.5, 8.5]\n assert candidate(root = tree_node([2147483647, None, 2147483647])) == [2147483647.0, 2147483647.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, 16])) == [1.0, 2.5, 5.5, 11.5, 16.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, 16, 17, 18, None, None, 21, 22])) == [1.0, 2.5, 5.5, 10.5, 18.8]\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 40, 60, 90, 110, 140, 160, 190])) == [100.0, 100.0, 100.0, 100.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])) == [1.0, 2.5, 5.5, 11.5, 23.5]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8])) == [1.0, 2.5, 5.0, 7.5]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7, 8, None, 10, 11, 12, None, 14, None, 16, None, 18])) == [1.0, 2.5, 5.333333333333333, 10.25, 16.0]\n assert candidate(root = tree_node([5, 3, 8, 1, 4, 7, 9, None, None, 2, None, None, None, None, 10])) == [5.0, 5.5, 5.25, 6.0]\n assert candidate(root = tree_node([2147483647, -2147483648, 2147483647, -2147483648, None, None, 2147483647])) == [2147483647.0, -0.5, -0.5]\n assert candidate(root = tree_node([1, None, None, None, None])) == [1.0]\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, 0, 4, 8, 7, None, None, None, 2, 5])) == [1.0, 2.5, 5.666666666666667, 4.75, 3.5]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20, None, 21, None, 22, None, 23, None, 24, None, 25, None, 26, None, 27, None, 28, None, 29, None, 30])) == [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, None, None, None, None, 9])) == [1.0, 2.5, 5.5, 8.5]\n assert candidate(root = tree_node([30, 25, 35, 20, 27, 32, 37, 18, 23, 26, 29, 31, 34, 36, 39])) == [30.0, 30.0, 29.0, 29.5]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == [1.0, 2.5, 5.5, 11.5, 23.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == [1.0, 2.5, 5.5, 11.5, 18.0]\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5])) == [1.0, 2.0, 3.0, 4.0, 5.0]\n assert candidate(root = tree_node([10, 5, 15, None, 7, None, 18])) == [10.0, 10.0, 12.5]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6])) == [10.0, 10.0, 9.333333333333334, 3.5]\n assert candidate(root = tree_node([5, 3, 8, 1, 4, 7, 9, 0, 2, 6, None, 10])) == [5.0, 5.5, 5.25, 4.5]\n assert candidate(root = tree_node([1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])) == [1.0, 2.0, 3.0, 4.0, 5.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == [1.0, 2.5, 5.5, 11.5, 20.5]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50])) == [1.0, 2.5, 5.5, 11.5, 23.5, 41.0]\n assert candidate(root = tree_node([-2147483648, None, 2147483647])) == [-2147483648.0, 2147483647.0]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, 4, 6, 8, 12, 14, 17, 19])) == [10.0, 10.0, 10.25, 10.125]\n assert candidate(root = tree_node([5, 3, 8, 1, 4, 7, 10, None, None, 2, 6, 9, 11])) == [5.0, 5.5, 5.5, 7.0]\n assert candidate(root = tree_node([3, 9, 20, 15, 7, None, 21, 14, None, 13, 16, None, None, None, None, None, 22])) == [3.0, 14.5, 14.333333333333334, 14.333333333333334, 22.0]\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 40, 60, 90, 110, 140, 160, 190, 5, 15, 30, 45, 55, 65, 85, 95, 105, 135, 145, 155, 170, 180, 185, 195, 200, 205, 210])) == [100.0, 100.0, 100.0, 100.0, 104.0625, 205.0]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == [1.0, 2.5, 4.5, 6.5, 8.5, 10.5, 12.5, 14.5]\n assert candidate(root = tree_node([3, 9, 20, 15, 7, None, 21, 14, None, 13, 16, None, None, None, None, None, 22, None, 23, None, 24, None, 25, None, 26, None, 27, None, 28, None, 29, None, 30, None, 31, None, 32])) == [3.0, 14.5, 14.333333333333334, 14.333333333333334, 22.5, 24.5, 26.5, 28.5, 30.5, 32.0]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7])) == [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]\n assert candidate(root = tree_node([5, 3, 8, 1, 4, 7, 9, 0, 2, None, None, None, None, None, 10])) == [5.0, 5.5, 5.25, 4.0]\n assert candidate(root = tree_node([5, 1, 4, None, None, 3, 6])) == [5.0, 2.5, 4.5]\n assert candidate(root = tree_node([5, 10, None, 15, 20, 25, 30, 35, 40, None, 45, 50, None, None, 55, 60, 65, None, None, None, None, 70, 75])) == [5.0, 10.0, 17.5, 32.5, 55.0, 72.5]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, None, None, None, 10])) == [1.0, 2.5, 5.5, 8.5, 10.0]\n assert candidate(root = tree_node([5, 3, 8, 1, 4, 7, 10, 0, 2, 6, 9, 11, 12, 13, 14])) == [5.0, 5.5, 5.5, 8.375]\n assert candidate(root = tree_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59])) == [1.0, 4.0, 10.0, 22.0, 45.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, None])) == [1.0, 2.5, 5.5, 11.5, 23.0]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20])) == [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0]\n assert candidate(root = tree_node([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, None, None, 110, None, 120, 130, None, 140, None, None, None, None, 150])) == [10.0, 25.0, 55.0, 100.0, 140.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])) == [1.0, 2.5, 5.5, 8.5, 11.5, 17.5, 26.5]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, 16, None, None, 17, None, 18, None, 19, None, None, None, None, 20])) == [1.0, 2.5, 5.5, 11.5, 17.5, 20.0]\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, 6, None, None, 7, None, None, 8, None, 9])) == [1.0, 2.5, 4.5, 6.5, 8.0, 9.0]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == [1.0, 2.5, 4.5, 6.5, 8.5, 10.0]\n assert candidate(root = tree_node([1000000000, 500000000, 1500000000, 250000000, 750000000, 1250000000, 1750000000, 125000000, 375000000, 625000000, 875000000, 1125000000, 1375000000, 1625000000, 1875000000])) == [1000000000.0, 1000000000.0, 1000000000.0, 1000000000.0]\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180, 5, 15, 20, 35, 65, 70, 85, 105, 135, 145, 155, 175, 185, 195])) == [100.0, 100.0, 100.0, 96.25, 99.28571428571429]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16])) == [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])) == [1.0, 2.5, 5.5, 11.5]\n assert candidate(root = tree_node([1000, 500, None, 250, None, 125, None, 62.5, None, 31.25, None, 15.625])) == [1000.0, 500.0, 250.0, 125.0, 62.5, 31.25, 15.625]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20, None, 21, None, 22, None, 23, None, 24, None, 25])) == [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0]\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == [1.0, 2.5, 5.5, 10.0, 17.5, 24.0]\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, 0, 8, None, 6, None, None, None, 4, None, None, 7, None, None, None, 10, None, None, None, None, None, 11, None, None, None, None, None, None, 12])) == [1.0, 2.5, 5.666666666666667, 4.666666666666667, 5.5, 10.0]\n assert candidate(root = tree_node([7, 10, None, 4, 6, None, None, 3, None, None, 11, None, None, None, 8])) == [7.0, 10.0, 5.0, 3.0, 11.0]\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180])) == [100.0, 100.0, 100.0, 96.25]\n assert candidate(root = tree_node([1, None, 3, None, 5, None, 7, None, 9, None, 11, None, 13, None, 15])) == [1.0, 3.0, 5.0, 7.0, 9.0, 11.0, 13.0, 15.0]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, 15, None, 17, None, 19])) == [1.0, 2.5, 5.5, 11.142857142857142, 18.0]\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == [0.0, 0.0, 0.0, 0.0]\n assert candidate(root = tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1])) == [5.0, 6.0, 9.333333333333334, 3.75]\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().averageOfLevels", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var averageOfLevels = function(root) {", "container": null, "callable": "averageOfLevels", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 638, "task_id": "shopping-offers", "difficulty": "Medium", "problem_description": "In LeetCode Store, there are n items to sell. Each item has a price. However, there are some special offers, and a special offer consists of one or more different kinds of items with a sale price.\nYou are given an integer array price where price[i] is the price of the ith item, and an integer array needs where needs[i] is the number of pieces of the ith item you want to buy.\nYou are also given an array special where special[i] is of size n + 1 where special[i][j] is the number of pieces of the jth item in the ith offer and special[i][n] (i.e., the last integer in the array) is the price of the ith offer.\nReturn the lowest price you have to pay for exactly certain items as given, where you could make optimal use of the special offers. You are not allowed to buy more items than you want, even if that would lower the overall price. You could use any of the special offers as many times as you want.\n \nExample 1:\n\nInput: price = [2,5], special = [[3,0,5],[1,2,10]], needs = [3,2]\nOutput: 14\nExplanation: There are two kinds of items, A and B. Their prices are $2 and $5 respectively. \nIn special offer 1, you can pay $5 for 3A and 0B\nIn special offer 2, you can pay $10 for 1A and 2B. \nYou need to buy 3A and 2B, so you may pay $10 for 1A and 2B (special offer #2), and $4 for 2A.\n\nExample 2:\n\nInput: price = [2,3,4], special = [[1,1,0,4],[2,2,1,9]], needs = [1,2,1]\nOutput: 11\nExplanation: The price of A is $2, and $3 for B, $4 for C. \nYou may pay $4 for 1A and 1B, and $9 for 2A ,2B and 1C. \nYou need to buy 1A ,2B and 1C, so you may pay $4 for 1A and 1B (special offer #1), and $3 for 1B, $4 for 1C. \nYou cannot add more items, though only $9 for 2A ,2B and 1C.\n\n \nConstraints:\n\nn == price.length == needs.length\n1 <= n <= 6\n0 <= price[i], needs[i] <= 10\n1 <= special.length <= 100\nspecial[i].length == n + 1\n0 <= special[i][j] <= 50\nThe input is generated that at least one of special[i][j] is non-zero for 0 <= j <= n - 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(price = [10, 10, 10],special = [[3, 1, 0, 10], [1, 2, 1, 15]],needs = [2, 2, 1]) == 25\n assert candidate(price = [4, 10, 1, 1, 1],special = [[1, 1, 1, 1, 1, 7]],needs = [4, 10, 1, 1, 1]) == 109\n assert candidate(price = [6, 5, 7, 11, 6],special = [[1, 0, 0, 0, 1, 4], [0, 0, 1, 0, 0, 5]],needs = [0, 0, 1, 0, 0]) == 5\n assert candidate(price = [10, 10, 10],special = [[3, 3, 3, 15]],needs = [9, 9, 9]) == 45\n assert candidate(price = [5, 5],special = [[1, 0, 5], [0, 1, 5]],needs = [10, 10]) == 100\n assert candidate(price = [1, 2, 3],special = [[2, 2, 2, 3]],needs = [1, 1, 1]) == 6\n assert candidate(price = [5, 4, 3, 2, 1],special = [[1, 1, 1, 1, 1, 10], [0, 1, 0, 1, 0, 8]],needs = [1, 1, 1, 1, 1]) == 10\n assert candidate(price = [2, 5],special = [[3, 0, 5], [1, 2, 10]],needs = [3, 2]) == 14\n assert candidate(price = [1, 2, 3, 4, 5, 6],special = [[1, 1, 1, 1, 1, 1, 10], [2, 2, 2, 2, 2, 2, 15]],needs = [1, 2, 3, 4, 5, 6]) == 80\n assert candidate(price = [4, 10, 1],special = [[1, 1, 0, 4], [2, 2, 1, 9]],needs = [1, 2, 1]) == 15\n assert candidate(price = [1, 2, 3],special = [[1, 1, 0, 3], [2, 2, 1, 10]],needs = [2, 2, 1]) == 9\n assert candidate(price = [5, 5],special = [[2, 2, 9]],needs = [1, 1]) == 10\n assert candidate(price = [1, 2, 3, 4, 5, 6],special = [[1, 1, 1, 1, 1, 1, 10]],needs = [5, 5, 5, 5, 5, 5]) == 50\n assert candidate(price = [2, 3, 4],special = [[1, 1, 0, 4], [2, 2, 1, 9]],needs = [1, 2, 1]) == 11\n assert candidate(price = [5, 4, 3, 2, 1],special = [[1, 1, 1, 1, 1, 6], [2, 2, 2, 2, 2, 11]],needs = [3, 3, 3, 3, 3]) == 17\n assert candidate(price = [5, 4, 2, 7],special = [[1, 0, 0, 0, 1], [0, 1, 0, 1, 2], [0, 0, 1, 0, 3]],needs = [0, 2, 3, 1]) == 12\n assert candidate(price = [1, 2],special = [[0, 1, 1], [1, 0, 2], [1, 1, 3]],needs = [1, 1]) == 2\n assert candidate(price = [1, 2, 3],special = [[1, 1, 1, 3]],needs = [2, 2, 2]) == 6\n assert candidate(price = [1, 1, 1, 1, 1, 1],special = [[1, 1, 1, 1, 1, 1, 0]],needs = [0, 0, 0, 0, 0, 0]) == 0\n assert candidate(price = [1, 2, 3, 4],special = [[1, 1, 1, 0, 5], [2, 2, 2, 1, 15]],needs = [2, 2, 2, 1]) == 14\n assert candidate(price = [10, 20, 30, 40, 50, 60],special = [[1, 0, 1, 0, 1, 0, 90], [0, 1, 0, 1, 0, 1, 80], [1, 1, 1, 1, 1, 1, 200]],needs = [2, 2, 2, 2, 2, 2]) == 340\n assert candidate(price = [8, 6, 4, 2],special = [[2, 0, 1, 0, 12], [0, 3, 0, 1, 15], [1, 1, 1, 1, 10]],needs = [4, 6, 3, 2]) == 56\n assert candidate(price = [3, 5, 7, 9, 11, 13],special = [[1, 2, 3, 0, 0, 0, 30], [0, 0, 0, 1, 1, 1, 25], [2, 2, 2, 2, 2, 2, 60]],needs = [4, 5, 6, 3, 4, 5]) == 167\n assert candidate(price = [1, 3, 5, 7, 9],special = [[2, 1, 1, 0, 0, 15], [1, 1, 2, 0, 0, 12], [0, 0, 0, 2, 1, 10], [1, 1, 0, 1, 1, 18], [3, 0, 0, 0, 0, 5]],needs = [4, 5, 6, 3, 4]) == 85\n assert candidate(price = [5, 7, 3, 4, 2],special = [[3, 1, 2, 0, 0, 12], [1, 2, 1, 1, 0, 15], [0, 0, 1, 2, 2, 10]],needs = [5, 4, 3, 2, 1]) == 45\n assert candidate(price = [5, 10, 15, 20, 25],special = [[1, 2, 1, 0, 0, 35], [0, 1, 0, 2, 1, 40], [1, 1, 1, 1, 1, 50]],needs = [2, 4, 2, 3, 2]) == 125\n assert candidate(price = [1, 1, 1, 1, 1, 1],special = [[1, 1, 1, 1, 1, 0, 4], [0, 0, 0, 0, 0, 1, 1]],needs = [5, 5, 5, 5, 5, 5]) == 25\n assert candidate(price = [2, 4, 6, 8, 10],special = [[1, 1, 1, 1, 1, 25], [2, 2, 2, 2, 2, 40], [3, 0, 0, 0, 0, 30]],needs = [6, 6, 6, 6, 6]) == 120\n assert candidate(price = [1, 1, 1, 1, 1, 1],special = [[1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 1]],needs = [6, 6, 6, 6, 6, 6]) == 36\n assert candidate(price = [1, 1, 1, 1, 1, 1],special = [[1, 1, 1, 1, 1, 1, 5], [2, 2, 2, 2, 2, 2, 10], [1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 1]],needs = [6, 6, 6, 6, 6, 6]) == 30\n assert candidate(price = [2, 4, 6, 8],special = [[2, 2, 0, 0, 15], [1, 1, 2, 2, 20], [0, 0, 3, 3, 25]],needs = [6, 6, 6, 6]) == 78\n assert candidate(price = [2, 3, 5, 7],special = [[1, 1, 0, 1, 12], [2, 0, 1, 0, 10], [0, 2, 1, 1, 18]],needs = [3, 3, 2, 3]) == 46\n assert candidate(price = [3, 5, 7, 9, 11],special = [[1, 0, 1, 0, 1, 15], [2, 2, 1, 0, 0, 20], [0, 0, 2, 2, 0, 18]],needs = [2, 2, 3, 1, 2]) == 56\n assert candidate(price = [5, 10, 15, 20, 25],special = [[1, 0, 0, 0, 0, 5], [0, 1, 0, 0, 0, 10], [0, 0, 1, 0, 0, 15], [0, 0, 0, 1, 0, 20], [0, 0, 0, 0, 1, 25], [2, 2, 1, 1, 0, 40], [1, 2, 2, 2, 2, 80]],needs = [3, 4, 2, 1, 1]) == 105\n assert candidate(price = [9, 8, 7, 6, 5, 4],special = [[2, 2, 2, 2, 2, 2, 40], [1, 1, 1, 1, 1, 1, 20], [3, 3, 3, 3, 3, 3, 60], [1, 2, 3, 4, 5, 6, 100]],needs = [5, 4, 3, 2, 1, 0]) == 115\n assert candidate(price = [1, 1, 1, 1, 1, 1],special = [[1, 1, 1, 1, 1, 0, 5], [2, 2, 2, 2, 2, 2, 10], [1, 0, 1, 0, 1, 0, 7]],needs = [6, 6, 6, 6, 6, 6]) == 30\n assert candidate(price = [7, 5, 3, 1, 2, 4],special = [[1, 1, 0, 0, 0, 0, 12], [0, 1, 1, 0, 0, 0, 15], [0, 0, 1, 1, 1, 1, 20], [1, 0, 1, 0, 1, 0, 18]],needs = [6, 5, 4, 3, 2, 1]) == 90\n assert candidate(price = [9, 5, 1, 8, 6],special = [[1, 0, 2, 1, 0, 13], [2, 2, 0, 0, 1, 20], [0, 1, 1, 1, 0, 12]],needs = [5, 4, 7, 3, 2]) == 74\n assert candidate(price = [1, 1, 1, 1, 1, 1],special = [[2, 2, 2, 2, 2, 2, 10], [1, 0, 1, 0, 1, 0, 5], [0, 1, 0, 1, 0, 1, 5]],needs = [5, 5, 5, 5, 5, 5]) == 26\n assert candidate(price = [10, 20, 30, 40, 50, 60],special = [[1, 0, 0, 0, 0, 0, 10], [0, 1, 0, 0, 0, 0, 20], [0, 0, 1, 0, 0, 0, 30], [0, 0, 0, 1, 0, 0, 40], [0, 0, 0, 0, 1, 0, 50], [0, 0, 0, 0, 0, 1, 60], [3, 2, 1, 1, 1, 1, 150]],needs = [3, 3, 3, 3, 3, 3]) == 530\n assert candidate(price = [1, 2, 3, 4, 5],special = [[2, 2, 2, 2, 2, 20], [1, 1, 1, 1, 1, 10], [3, 3, 3, 3, 3, 30], [0, 0, 0, 0, 1, 5], [0, 0, 0, 1, 0, 4], [0, 0, 1, 0, 0, 3], [0, 1, 0, 0, 0, 2]],needs = [3, 4, 2, 1, 0]) == 21\n assert candidate(price = [1, 1, 1, 1, 1, 1],special = [[1, 1, 1, 1, 1, 1, 6], [2, 2, 2, 2, 2, 2, 12], [3, 3, 3, 3, 3, 3, 18]],needs = [6, 6, 6, 6, 6, 6]) == 36\n assert candidate(price = [1, 3, 5, 7, 9, 11],special = [[2, 1, 0, 0, 0, 0, 5], [0, 0, 2, 1, 0, 0, 8], [0, 0, 0, 0, 2, 1, 10], [1, 1, 1, 1, 1, 1, 15]],needs = [10, 10, 10, 10, 10, 10]) == 150\n assert candidate(price = [2, 3, 4, 5, 6, 7],special = [[1, 1, 1, 1, 1, 0, 20], [2, 2, 2, 2, 2, 1, 40], [0, 0, 0, 0, 0, 5, 30]],needs = [2, 3, 4, 5, 6, 5]) == 118\n assert candidate(price = [2, 3, 5, 7, 11],special = [[1, 1, 1, 1, 1, 15], [2, 0, 0, 1, 1, 20], [0, 2, 2, 0, 0, 25], [1, 0, 0, 0, 0, 5]],needs = [4, 5, 6, 7, 8]) == 138\n assert candidate(price = [1, 2, 3, 4, 5, 6],special = [[1, 0, 1, 0, 1, 0, 10], [0, 1, 0, 1, 0, 1, 11], [1, 1, 1, 1, 1, 1, 15]],needs = [4, 4, 4, 4, 4, 4]) == 60\n assert candidate(price = [7, 6, 5, 4, 3, 2],special = [[2, 1, 1, 1, 0, 0, 12], [1, 2, 1, 0, 1, 0, 13], [1, 1, 2, 0, 0, 1, 14], [1, 0, 1, 2, 1, 1, 15]],needs = [4, 5, 6, 3, 2, 1]) == 63\n assert candidate(price = [3, 5, 7, 9, 11],special = [[1, 1, 1, 1, 0, 25], [0, 1, 1, 1, 1, 30], [1, 0, 0, 0, 1, 15], [1, 2, 1, 0, 2, 45]],needs = [2, 3, 4, 5, 3]) == 121\n assert candidate(price = [5, 7, 3, 11],special = [[2, 1, 0, 0, 15], [1, 1, 1, 0, 12], [0, 0, 1, 1, 7]],needs = [4, 5, 3, 2]) == 67\n assert candidate(price = [10, 20, 30, 40, 50, 60],special = [[1, 1, 1, 1, 1, 1, 150], [2, 0, 1, 1, 0, 1, 120], [0, 2, 0, 2, 0, 2, 180]],needs = [5, 4, 3, 2, 1, 0]) == 350\n assert candidate(price = [1, 1, 1, 1, 1, 1, 1, 1, 1],special = [[1, 1, 1, 1, 1, 1, 1, 1, 0, 8], [2, 2, 2, 2, 2, 2, 2, 2, 0, 14], [3, 3, 3, 3, 3, 3, 3, 3, 0, 18]],needs = [9, 9, 9, 9, 9, 9, 9, 9, 9]) == 63\n assert candidate(price = [3, 6, 5, 4, 3, 2, 1],special = [[1, 1, 1, 1, 1, 1, 1, 15], [2, 2, 2, 2, 2, 2, 2, 25], [3, 3, 3, 3, 3, 3, 3, 30]],needs = [1, 2, 3, 4, 5, 6, 7]) == 71\n assert candidate(price = [5, 3, 2, 6, 7],special = [[2, 1, 1, 0, 0, 15], [0, 3, 0, 1, 1, 18], [1, 2, 3, 0, 0, 20]],needs = [3, 6, 5, 2, 2]) == 61\n assert candidate(price = [4, 4, 4, 4, 4, 4],special = [[1, 1, 1, 1, 1, 1, 20], [2, 2, 2, 2, 2, 2, 40], [3, 3, 3, 3, 3, 3, 60], [4, 4, 4, 4, 4, 4, 80]],needs = [12, 12, 12, 12, 12, 12]) == 240\n assert candidate(price = [4, 8, 1, 2, 9, 3],special = [[2, 4, 1, 0, 2, 1, 10], [1, 0, 0, 0, 1, 0, 7], [0, 0, 3, 1, 0, 0, 5], [0, 0, 0, 0, 0, 2, 2]],needs = [5, 8, 2, 2, 9, 4]) == 69\n assert candidate(price = [3, 6, 9, 12, 15, 18],special = [[1, 1, 1, 1, 1, 1, 10], [2, 2, 2, 2, 2, 2, 20], [0, 3, 0, 3, 0, 3, 30]],needs = [3, 6, 9, 12, 15, 18]) == 425\n assert candidate(price = [1, 3, 5, 7, 9],special = [[1, 1, 1, 1, 1, 10], [2, 2, 2, 2, 2, 20], [3, 3, 3, 3, 3, 30]],needs = [4, 4, 4, 4, 4]) == 40\n assert candidate(price = [5, 7, 9, 11, 13],special = [[2, 0, 1, 0, 0, 22], [1, 2, 0, 1, 1, 30], [0, 0, 3, 0, 2, 40]],needs = [3, 4, 3, 2, 1]) == 92\n assert candidate(price = [2, 4, 6, 8, 10, 12],special = [[1, 1, 1, 1, 1, 1, 30], [2, 2, 2, 2, 2, 2, 50], [0, 0, 1, 0, 0, 0, 6]],needs = [1, 2, 3, 4, 5, 6]) == 170\n assert candidate(price = [5, 5, 5, 5, 5, 5],special = [[1, 1, 1, 1, 1, 0, 25], [2, 2, 2, 2, 2, 0, 45], [3, 3, 3, 3, 3, 0, 60]],needs = [5, 5, 5, 5, 5]) == 105\n assert candidate(price = [2, 4, 6, 8, 10, 12],special = [[1, 0, 0, 0, 0, 0, 2], [0, 1, 0, 0, 0, 0, 4], [0, 0, 1, 0, 0, 0, 6], [0, 0, 0, 1, 0, 0, 8], [0, 0, 0, 0, 1, 0, 10], [0, 0, 0, 0, 0, 1, 12], [3, 0, 0, 0, 0, 0, 5], [0, 3, 0, 0, 0, 0, 12], [0, 0, 3, 0, 0, 0, 18], [0, 0, 0, 3, 0, 0, 24], [0, 0, 0, 0, 3, 0, 30], [0, 0, 0, 0, 0, 3, 36]],needs = [5, 5, 5, 5, 5, 5]) == 209\n assert candidate(price = [1, 1, 1, 1, 1, 1],special = [[1, 1, 1, 1, 1, 1, 5], [2, 2, 2, 2, 2, 2, 10], [3, 3, 3, 3, 3, 3, 15]],needs = [6, 6, 6, 6, 6, 6]) == 30\n assert candidate(price = [5, 5, 5, 5, 5, 5],special = [[3, 3, 3, 3, 3, 3, 15], [2, 2, 2, 2, 2, 2, 10], [1, 1, 1, 1, 1, 1, 5]],needs = [10, 10, 10, 10, 10, 10]) == 50\n assert candidate(price = [3, 5, 7],special = [[1, 0, 2, 10], [0, 2, 1, 12], [3, 1, 1, 20]],needs = [5, 4, 4]) == 46\n assert candidate(price = [1, 3, 5, 7, 9, 11],special = [[1, 2, 3, 4, 5, 6, 50], [2, 3, 4, 5, 6, 7, 90], [3, 4, 5, 6, 7, 8, 120]],needs = [10, 12, 14, 16, 18, 20]) == 198\n assert candidate(price = [2, 3, 4, 5, 6],special = [[1, 1, 1, 0, 0, 6], [0, 2, 2, 1, 1, 10], [2, 0, 0, 2, 1, 14]],needs = [3, 4, 5, 3, 2]) == 35\n assert candidate(price = [1, 2, 3, 4, 5, 6],special = [[1, 1, 1, 1, 1, 1, 25], [3, 3, 3, 3, 3, 3, 75], [2, 0, 0, 0, 0, 0, 20], [0, 2, 0, 0, 0, 0, 22]],needs = [5, 5, 5, 5, 5, 5]) == 105\n assert candidate(price = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],special = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 50], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 90]],needs = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 450\n assert candidate(price = [10, 20, 30, 40, 50, 60],special = [[2, 0, 0, 0, 0, 0, 20], [0, 2, 0, 0, 0, 0, 40], [0, 0, 2, 0, 0, 0, 60], [1, 1, 1, 1, 1, 1, 200], [3, 3, 3, 3, 3, 3, 500]],needs = [3, 3, 3, 3, 3, 3]) == 500\n assert candidate(price = [7, 5, 3, 1],special = [[1, 1, 1, 1, 15], [0, 2, 2, 0, 15], [2, 0, 0, 2, 15]],needs = [5, 5, 5, 5]) == 75\n assert candidate(price = [15, 10, 5, 3, 8],special = [[2, 1, 1, 0, 1, 35], [1, 2, 0, 1, 0, 30], [0, 0, 1, 1, 1, 25]],needs = [4, 5, 6, 3, 7]) == 169\n assert candidate(price = [6, 3, 7, 2, 9],special = [[1, 0, 0, 0, 0, 3], [0, 1, 0, 0, 0, 2], [0, 0, 1, 0, 0, 4], [0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 5], [2, 1, 1, 1, 1, 20]],needs = [6, 6, 6, 6, 6]) == 90\n assert candidate(price = [4, 8, 12, 16, 20, 24, 28],special = [[1, 1, 1, 0, 0, 0, 0, 40], [0, 0, 0, 1, 1, 1, 0, 40], [0, 0, 0, 0, 0, 0, 1, 28], [2, 2, 2, 0, 0, 0, 0, 60], [1, 2, 3, 1, 2, 3, 1, 100]],needs = [10, 10, 10, 10, 10, 10, 10]) == 764\n assert candidate(price = [1, 2, 3, 4, 5, 6],special = [[1, 1, 0, 0, 0, 0, 6], [0, 1, 1, 0, 0, 0, 8], [0, 0, 1, 1, 0, 0, 10], [0, 0, 0, 1, 1, 0, 12], [0, 0, 0, 0, 1, 1, 14], [1, 0, 1, 0, 1, 0, 20]],needs = [3, 3, 3, 3, 3, 3]) == 63\n assert candidate(price = [3, 5, 7, 9, 11, 13],special = [[1, 1, 1, 0, 0, 0, 20], [2, 2, 2, 1, 1, 1, 40], [3, 3, 3, 2, 2, 2, 60]],needs = [9, 8, 7, 6, 5, 4]) == 175\n assert candidate(price = [1, 2, 3, 4, 5, 6, 7],special = [[1, 1, 1, 1, 1, 1, 0, 14], [2, 2, 2, 2, 2, 2, 0, 26], [3, 3, 3, 3, 3, 3, 0, 38]],needs = [7, 7, 7, 7, 7, 7, 7]) == 139\n assert candidate(price = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],special = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 20], [2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 30], [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 45]],needs = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 357\n assert candidate(price = [2, 3, 4, 5, 6],special = [[1, 0, 1, 1, 0, 12], [0, 2, 0, 0, 1, 15], [1, 2, 1, 0, 2, 30], [2, 1, 0, 2, 1, 40]],needs = [4, 3, 2, 5, 2]) == 62\n assert candidate(price = [3, 6, 9, 12, 15, 18],special = [[1, 1, 1, 0, 0, 0, 30], [0, 0, 0, 1, 1, 1, 30], [2, 2, 2, 0, 0, 0, 50], [0, 0, 0, 2, 2, 2, 50], [1, 0, 0, 1, 0, 0, 20], [0, 1, 0, 0, 1, 0, 20], [0, 0, 1, 0, 0, 1, 20], [3, 3, 3, 3, 3, 3, 150]],needs = [6, 6, 6, 6, 6, 6]) == 258\n assert candidate(price = [3, 2, 5, 7, 1, 4],special = [[2, 1, 1, 0, 0, 1, 10], [0, 2, 0, 1, 1, 0, 12], [1, 0, 1, 1, 0, 1, 14]],needs = [3, 4, 6, 5, 3, 2]) == 81\n assert candidate(price = [8, 6, 7, 3, 5],special = [[2, 2, 0, 1, 1, 16], [0, 2, 2, 0, 1, 18], [1, 1, 0, 0, 0, 9], [0, 0, 0, 2, 2, 15], [1, 0, 1, 1, 0, 13]],needs = [8, 6, 7, 3, 5]) == 123\n assert candidate(price = [10, 20, 30, 40, 50, 60],special = [[1, 1, 1, 1, 1, 1, 220], [2, 2, 2, 2, 2, 2, 400], [3, 3, 3, 3, 3, 3, 550]],needs = [1, 2, 3, 4, 5, 6]) == 910\n assert candidate(price = [5, 7, 3, 2, 6],special = [[2, 3, 1, 0, 0, 15], [1, 1, 2, 0, 1, 10], [0, 0, 0, 3, 3, 20]],needs = [3, 6, 2, 1, 4]) == 70\n assert candidate(price = [1, 1, 1, 1, 1, 1],special = [[1, 1, 1, 1, 1, 1, 5], [2, 2, 2, 2, 2, 2, 10], [1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 1]],needs = [5, 5, 5, 5, 5, 5]) == 25\n assert candidate(price = [2, 3, 4, 5, 6],special = [[1, 1, 0, 0, 0, 10], [0, 0, 1, 1, 0, 12], [1, 0, 1, 0, 1, 15], [0, 1, 0, 1, 1, 17]],needs = [5, 5, 5, 5, 5]) == 100\n assert candidate(price = [3, 6, 7, 8, 9, 10],special = [[3, 3, 3, 3, 3, 3, 100], [1, 2, 1, 2, 1, 2, 60], [2, 1, 2, 1, 2, 1, 70]],needs = [6, 6, 6, 6, 6, 6]) == 200\n assert candidate(price = [1, 1, 1, 1, 1, 1],special = [[1, 1, 1, 1, 1, 1, 6], [2, 2, 2, 2, 2, 2, 10], [3, 3, 3, 3, 3, 3, 12]],needs = [6, 6, 6, 6, 6, 6]) == 24\n assert candidate(price = [5, 10, 15, 20, 25],special = [[1, 2, 0, 1, 0, 20], [0, 1, 2, 1, 1, 25], [3, 1, 3, 0, 2, 35]],needs = [4, 5, 6, 7, 8]) == 295\n assert candidate(price = [5, 5, 5, 5, 5, 5],special = [[1, 1, 1, 1, 1, 1, 25], [2, 2, 2, 2, 2, 2, 50], [3, 3, 3, 3, 3, 3, 75]],needs = [6, 6, 6, 6, 6, 6]) == 150\n assert candidate(price = [5, 10, 15, 20, 25, 30],special = [[1, 2, 3, 4, 5, 6, 55], [2, 3, 4, 5, 6, 7, 95], [3, 4, 5, 6, 7, 8, 135]],needs = [6, 12, 18, 24, 30, 36]) == 885\n"}, "metadata": {"canonical_parameter_names": ["price", "special", "needs"], "leetcode_dataset_entry_point": "Solution().shoppingOffers", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shoppingOffers = function(price, special, needs) {", "container": null, "callable": "shoppingOffers", "parameters": [{"name": "price", "type": "number[]"}, {"name": "special", "type": "number[][]"}, {"name": "needs", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 639, "task_id": "decode-ways-ii", "difficulty": "Hard", "problem_description": "A message containing letters from A-Z can be encoded into numbers using the following mapping:\n\n'A' -> \"1\"\n'B' -> \"2\"\n...\n'Z' -> \"26\"\n\nTo decode an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For example, \"11106\" can be mapped into:\n\n\"AAJF\" with the grouping (1 1 10 6)\n\"KJF\" with the grouping (11 10 6)\n\nNote that the grouping (1 11 06) is invalid because \"06\" cannot be mapped into 'F' since \"6\" is different from \"06\".\nIn addition to the mapping above, an encoded message may contain the '*' character, which can represent any digit from '1' to '9' ('0' is excluded). For example, the encoded message \"1*\" may represent any of the encoded messages \"11\", \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", or \"19\". Decoding \"1*\" is equivalent to decoding any of the encoded messages it can represent.\nGiven a string s consisting of digits and '*' characters, return the number of ways to decode it.\nSince the answer may be very large, return it modulo 109 + 7.\n \nExample 1:\n\nInput: s = \"*\"\nOutput: 9\nExplanation: The encoded message can represent any of the encoded messages \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", or \"9\".\nEach of these can be decoded to the strings \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", and \"I\" respectively.\nHence, there are a total of 9 ways to decode \"*\".\n\nExample 2:\n\nInput: s = \"1*\"\nOutput: 18\nExplanation: The encoded message can represent any of the encoded messages \"11\", \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", or \"19\".\nEach of these encoded messages have 2 ways to be decoded (e.g. \"11\" can be decoded to \"AA\" or \"K\").\nHence, there are a total of 9 * 2 = 18 ways to decode \"1*\".\n\nExample 3:\n\nInput: s = \"2*\"\nOutput: 15\nExplanation: The encoded message can represent any of the encoded messages \"21\", \"22\", \"23\", \"24\", \"25\", \"26\", \"27\", \"28\", or \"29\".\n\"21\", \"22\", \"23\", \"24\", \"25\", and \"26\" have 2 ways of being decoded, but \"27\", \"28\", and \"29\" only have 1 way.\nHence, there are a total of (6 * 2) + (3 * 1) = 12 + 3 = 15 ways to decode \"2*\".\n\n \nConstraints:\n\n1 <= s.length <= 105\ns[i] is a digit or '*'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"*1*2*3*4*5*6*7*8*9*\") == 554657727\n assert candidate(s = \"26\") == 2\n assert candidate(s = \"2*\") == 15\n assert candidate(s = \"11106\") == 2\n assert candidate(s = \"210\") == 1\n assert candidate(s = \"**********\") == 483456820\n assert candidate(s = \"*0*0*0*0*0\") == 32\n assert candidate(s = \"111\") == 3\n assert candidate(s = \"2626262626\") == 32\n assert candidate(s = \"10*\") == 9\n assert candidate(s = \"26262626262626262626262626262626262626262626262626262626262626262626262626262626262626\") == 92960636\n assert candidate(s = \"1234567890\") == 0\n assert candidate(s = \"27272727272727272727272727272727272727272727272727272727272727272727272727272727272727\") == 1\n assert candidate(s = \"0\") == 0\n assert candidate(s = \"*9*\") == 90\n assert candidate(s = \"9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\") == 1\n assert candidate(s = \"1111111111\") == 89\n assert candidate(s = \"*0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\") == 0\n assert candidate(s = \"2929292929\") == 1\n assert candidate(s = \"1*2*3*4*5*6*7*8*9*\") == 929111979\n assert candidate(s = \"1*1*1*1*1*1*1*1*1*\") == 949421471\n assert candidate(s = \"2*2*2*2*2*2*2*2*2*\") == 73712584\n assert candidate(s = \"12*\") == 24\n assert candidate(s = \"1*\") == 18\n assert candidate(s = \"1*2*3*4*5*6*7*8*9*0*1*2*3*4*5*6*7*8*9*0*\") == 463661243\n assert candidate(s = \"1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1\") == 100804801\n assert candidate(s = \"*1*\") == 180\n assert candidate(s = \"*\") == 9\n assert candidate(s = \"10\") == 1\n assert candidate(s = \"*0*\") == 18\n assert candidate(s = \"***************************\") == 928290058\n assert candidate(s = \"*1\") == 11\n assert candidate(s = \"2**\") == 150\n assert candidate(s = \"12\") == 2\n assert candidate(s = \"1010101010\") == 1\n assert candidate(s = \"*123\") == 31\n assert candidate(s = \"2101010101\") == 1\n assert candidate(s = \"12121212121212121212121212\") == 196418\n assert candidate(s = \"*0\") == 2\n assert candidate(s = \"**************************************************\") == 362622276\n assert candidate(s = \"1*2*3*4*5*6*7*8*9*0\") == 873136000\n assert candidate(s = \"2727272727\") == 1\n assert candidate(s = \"*1*2*3*4*5*6*7*8*9*0*\") == 109315447\n assert candidate(s = \"*************************\") == 714729152\n assert candidate(s = \"**\") == 96\n assert candidate(s = \"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\") == 0\n assert candidate(s = \"*2*\") == 153\n assert candidate(s = \"00000\") == 0\n assert candidate(s = \"2222222222\") == 89\n assert candidate(s = \"*10\") == 9\n assert candidate(s = \"*19*\") == 180\n assert candidate(s = \"222222222222222222222222222222\") == 1346269\n assert candidate(s = \"210*12\") == 20\n assert candidate(s = \"*27*28*29*\") == 11979\n assert candidate(s = \"*27\") == 11\n assert candidate(s = \"*0*1*2*3*4*5*6*7*8*9*\") == 109315447\n assert candidate(s = \"*11*\") == 279\n assert candidate(s = \"98765432101234567890\") == 0\n assert candidate(s = \"*10*\") == 81\n assert candidate(s = \"*26*26*26*26*26*26*26*26*26*26*\") == 999354887\n assert candidate(s = \"*9*8*7*6*5*4*3*2*1*0*\") == 119149678\n assert candidate(s = \"1*0*0*0*0*0*0*0*0*0*\") == 4608\n assert candidate(s = \"26262626262626262626\") == 1024\n assert candidate(s = \"**11**22**33**44**55**66**77**88**99**\") == 379740674\n assert candidate(s = \"*1*1*1*1*1*1*1*1*1*\") == 771576448\n assert candidate(s = \"2*2*2*2*2*2*2*2*2*2*\") == 331096887\n assert candidate(s = \"111111111111111111111\") == 17711\n assert candidate(s = \"123456789*\") == 27\n assert candidate(s = \"21*21*21*21*21*21*\") == 615528657\n assert candidate(s = \"*29*\") == 99\n assert candidate(s = \"*2*2*2*\") == 40545\n assert candidate(s = \"27*28*29*\") == 1089\n assert candidate(s = \"1*2*1*2*\") == 89064\n assert candidate(s = \"********\") == 123775776\n assert candidate(s = \"11111111111111111111*\") == 159399\n assert candidate(s = \"1*9*8*7*6*5*4*3*2*1*0*9876543210\") == 362649321\n assert candidate(s = \"9*8*7*6*5*4*3*2*1*\") == 322023172\n assert candidate(s = \"11111111112222222222\") == 10946\n assert candidate(s = \"*0*0*\") == 36\n assert candidate(s = \"1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*\") == 309857393\n assert candidate(s = \"1*2*3*\") == 2952\n assert candidate(s = \"*1*2*3*4*5*6*7*8*9*0123456789\") == 369771818\n assert candidate(s = \"11111111111111111111\") == 10946\n assert candidate(s = \"10*20*30*40*50*60*70*80*90*\") == 0\n assert candidate(s = \"12*12*12*12*12*\") == 11773344\n assert candidate(s = \"1*2*3*4*5*6*7*8*9*0*\") == 858223951\n assert candidate(s = \"1*1*1*1*1*1*1*1*1*1*\") == 316369624\n assert candidate(s = \"*27*\") == 99\n assert candidate(s = \"1*9*8*7*6*5*4*3*2*1*\") == 118440226\n assert candidate(s = \"2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*\") == 962879550\n assert candidate(s = \"22222222222222222222*\") == 139104\n assert candidate(s = \"123*56*78*90*\") == 0\n assert candidate(s = \"9876543210\") == 1\n assert candidate(s = \"*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*\") == 305358957\n assert candidate(s = \"1*2*3*4*5*6*7*8*9*0*1*2*3*4*5*6*7*8*9*0*1*2*3*4*5*6*7*8*9*0*\") == 186702587\n assert candidate(s = \"12*23*34*45*56*67*78*89*\") == 685198800\n assert candidate(s = \"227*227*227*\") == 7200\n assert candidate(s = \"121212121212121212121212121212121212121212121212\") == 778742000\n assert candidate(s = \"*1*1*1*1*1*1*1*1*1*1*1*1*1*\") == 331004313\n assert candidate(s = \"26*3*1\") == 242\n assert candidate(s = \"3*5*7*9*1*\") == 198000\n assert candidate(s = \"1111111111111111111111111111\") == 514229\n assert candidate(s = \"0123456789\") == 0\n assert candidate(s = \"*1*2*\") == 2898\n assert candidate(s = \"*123*\") == 279\n assert candidate(s = \"2*********\") == 34523561\n assert candidate(s = \"*1*2*3*4*5*6*7*8*9*0*1*2*3*4*5*6*7*8*9*0*\") == 429906752\n assert candidate(s = \"0123456789*\") == 0\n assert candidate(s = \"9*9*9*9*9*9*9*9*9*\") == 900000000\n assert candidate(s = \"*27624*1*2*\") == 63756\n assert candidate(s = \"12*34*56*78*90*12*34*56*78*90*\") == 0\n assert candidate(s = \"26*26*26*26*26*26*26*26*26*26*\") == 999935495\n assert candidate(s = \"*0*12*\") == 492\n assert candidate(s = \"1*9*\") == 171\n assert candidate(s = \"2626262626262626262626262626\") == 16384\n assert candidate(s = \"00000000000000000000\") == 0\n assert candidate(s = \"123123123123123123\") == 729\n assert candidate(s = \"*0123456789*\") == 54\n assert candidate(s = \"123456789012345678901234567890\") == 0\n assert candidate(s = \"111111111111111111111111111111\") == 1346269\n assert candidate(s = \"*0*0*0*0*0*0*0*0*0*\") == 4608\n assert candidate(s = \"12*12*12*12*12*12*\") == 311447616\n assert candidate(s = \"***\") == 999\n assert candidate(s = \"*12*21*3*\") == 75834\n assert candidate(s = \"262*1*\") == 576\n assert candidate(s = \"*26*\") == 180\n assert candidate(s = \"1234567890*1234567890\") == 0\n assert candidate(s = \"*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*\") == 824428070\n assert candidate(s = \"*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*\") == 443646845\n assert candidate(s = \"262626262626262626\") == 512\n assert candidate(s = \"*1*2*3*4*5*6*7*8*9*0*1*2*3*4*5*6*7*8*9*0*1*2*3*4*5*6*7*8*9*0*1*2*3*4*5*6*7*8*9*0*\") == 13494534\n assert candidate(s = \"21*21*21\") == 1718\n assert candidate(s = \"1*9*8*7*6*5*4*3*2*1*0*\") == 626384391\n assert candidate(s = \"1*1*1*1*1*1*1*1*1*1*1*\") == 237806079\n assert candidate(s = \"1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*\") == 276158816\n assert candidate(s = \"*20*\") == 81\n assert candidate(s = \"11111*11111*11111*11111*\") == 238835889\n assert candidate(s = \"*9*2\") == 110\n assert candidate(s = \"11*11*11*11*11*11*11*11*11*\") == 184486483\n assert candidate(s = \"*12*\") == 246\n assert candidate(s = \"2*6*2*\") == 2601\n assert candidate(s = \"*30*\") == 0\n assert candidate(s = \"1*9*3*\") == 1881\n assert candidate(s = \"**2*2*2*2*2*2*2*2*\") == 416857892\n assert candidate(s = \"*12*34*56*78*90\") == 0\n assert candidate(s = \"27272727272727272727\") == 1\n assert candidate(s = \"**1**\") == 18720\n assert candidate(s = \"10101010101010101010\") == 1\n assert candidate(s = \"1*2*\") == 288\n assert candidate(s = \"26*12\") == 40\n assert candidate(s = \"*9*8*7*6*5*4*3*2*1*0*9*8*7*6*5*4*3*2*1*0*\") == 185347464\n assert candidate(s = \"*1*1*1*\") == 65520\n assert candidate(s = \"*28*\") == 99\n assert candidate(s = \"22222222222222222222\") == 10946\n assert candidate(s = \"*2*2*2*2*2*2*2*2*2*2*\") == 757514735\n assert candidate(s = \"*26*26*26*26*26*26*26*26*26*\") == 999967751\n assert candidate(s = \"27*\") == 9\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().numDecodings", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numDecodings = function(s) {", "container": null, "callable": "numDecodings", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 640, "task_id": "solve-the-equation", "difficulty": "Medium", "problem_description": "Solve a given equation and return the value of 'x' in the form of a string \"x=#value\". The equation contains only '+', '-' operation, the variable 'x' and its coefficient. You should return \"No solution\" if there is no solution for the equation, or \"Infinite solutions\" if there are infinite solutions for the equation.\nIf there is exactly one solution for the equation, we ensure that the value of 'x' is an integer.\n \nExample 1:\n\nInput: equation = \"x+5-3+x=6+x-2\"\nOutput: \"x=2\"\n\nExample 2:\n\nInput: equation = \"x=x\"\nOutput: \"Infinite solutions\"\n\nExample 3:\n\nInput: equation = \"2x=x\"\nOutput: \"x=0\"\n\n \nConstraints:\n\n3 <= equation.length <= 1000\nequation has exactly one '='.\nequation consists of integers with an absolute value in the range [0, 100] without any leading zeros, and the variable 'x'.\nThe input is generated that if there is a single solution, it will be an integer.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(equation = \"-x=x\") == \"x=0\"\n assert candidate(equation = \"0x=0\") == \"Infinite solutions\"\n assert candidate(equation = \"x+3x=4x\") == \"Infinite solutions\"\n assert candidate(equation = \"2x+3=3x+1\") == \"x=2\"\n assert candidate(equation = \"3x+2=5x-4\") == \"x=3\"\n assert candidate(equation = \"2x-2=2x+2\") == \"No solution\"\n assert candidate(equation = \"3x+2=2x+3\") == \"x=1\"\n assert candidate(equation = \"x=x\") == \"Infinite solutions\"\n assert candidate(equation = \"2x-2x=0\") == \"Infinite solutions\"\n assert candidate(equation = \"-x=-1\") == \"x=1\"\n assert candidate(equation = \"2x+3x-6x=x+2\") == \"x=-1\"\n assert candidate(equation = \"x=2x\") == \"x=0\"\n assert candidate(equation = \"x+3x=3x+1\") == \"x=1\"\n assert candidate(equation = \"x+3x=2x+2x\") == \"Infinite solutions\"\n assert candidate(equation = \"3x=3x\") == \"Infinite solutions\"\n assert candidate(equation = \"4x+3=4x+3\") == \"Infinite solutions\"\n assert candidate(equation = \"2x+3=5\") == \"x=1\"\n assert candidate(equation = \"x+5-3+x=6+x-2\") == \"x=2\"\n assert candidate(equation = \"3x+1=2x+2\") == \"x=1\"\n assert candidate(equation = \"0=0x+0\") == \"Infinite solutions\"\n assert candidate(equation = \"3x+5-2=7x-3\") == \"x=1\"\n assert candidate(equation = \"2x+3=2x+3\") == \"Infinite solutions\"\n assert candidate(equation = \"4x=4x\") == \"Infinite solutions\"\n assert candidate(equation = \"x+x+x+x=4\") == \"x=1\"\n assert candidate(equation = \"x+2=2+x\") == \"Infinite solutions\"\n assert candidate(equation = \"x-1=x+1\") == \"No solution\"\n assert candidate(equation = \"x-1=0\") == \"x=1\"\n assert candidate(equation = \"x+2x+3x=6\") == \"x=1\"\n assert candidate(equation = \"0=0\") == \"Infinite solutions\"\n assert candidate(equation = \"-x=-2x+1\") == \"x=1\"\n assert candidate(equation = \"5-3x=2x+1\") == \"x=0\"\n assert candidate(equation = \"3x+3=3\") == \"x=0\"\n assert candidate(equation = \"3x+2=5x-8\") == \"x=5\"\n assert candidate(equation = \"1=0\") == \"No solution\"\n assert candidate(equation = \"1=1\") == \"Infinite solutions\"\n assert candidate(equation = \"-2x=-2\") == \"x=1\"\n assert candidate(equation = \"5=5x\") == \"x=1\"\n assert candidate(equation = \"2x+3x-5x=0\") == \"Infinite solutions\"\n assert candidate(equation = \"2x=x\") == \"x=0\"\n assert candidate(equation = \"x=0\") == \"x=0\"\n assert candidate(equation = \"x=-x\") == \"x=0\"\n assert candidate(equation = \"1=2\") == \"No solution\"\n assert candidate(equation = \"2x+3=3x+2\") == \"x=1\"\n assert candidate(equation = \"x+0=0x\") == \"x=0\"\n assert candidate(equation = \"-x+2=3x-1\") == \"x=0\"\n assert candidate(equation = \"5x-2x+1=3x-2+4\") == \"No solution\"\n assert candidate(equation = \"-x+5=-2x+10\") == \"x=5\"\n assert candidate(equation = \"7x+3=3x+7\") == \"x=1\"\n assert candidate(equation = \"5x=10x+5\") == \"x=-1\"\n assert candidate(equation = \"-2x+3=4-3x\") == \"x=1\"\n assert candidate(equation = \"x+x+x=3x\") == \"Infinite solutions\"\n assert candidate(equation = \"0=3x\") == \"x=0\"\n assert candidate(equation = \"2x-3=5x+7\") == \"x=-4\"\n assert candidate(equation = \"-3x=-3x\") == \"Infinite solutions\"\n assert candidate(equation = \"x-1=2x-3\") == \"x=2\"\n assert candidate(equation = \"x+3=3x+1\") == \"x=1\"\n assert candidate(equation = \"0x+1=0x+2\") == \"No solution\"\n assert candidate(equation = \"x-2x+3x-4x+5x=6x-7x+8x-9x\") == \"x=0\"\n assert candidate(equation = \"-x+2x-3=4-5x\") == \"x=1\"\n assert candidate(equation = \"7x-3=3x-7\") == \"x=-1\"\n assert candidate(equation = \"x-5x+2=7-3x\") == \"x=-5\"\n assert candidate(equation = \"-100x+50=50x-100\") == \"x=1\"\n assert candidate(equation = \"-1x-2x-3x-4x-5x=-15x\") == \"Infinite solutions\"\n assert candidate(equation = \"-3x+2x-5=4x-3+2x\") == \"x=-1\"\n assert candidate(equation = \"-x=-x+0\") == \"Infinite solutions\"\n assert candidate(equation = \"x+5=5x-5-3x\") == \"x=10\"\n assert candidate(equation = \"0=x\") == \"x=0\"\n assert candidate(equation = \"x-2x+3x=4\") == \"x=2\"\n assert candidate(equation = \"-x-2x-3x=-6\") == \"x=1\"\n assert candidate(equation = \"-x+3=5-2x\") == \"x=2\"\n assert candidate(equation = \"x-1x=0\") == \"Infinite solutions\"\n assert candidate(equation = \"2x+3-4x=5x-6+7x\") == \"x=0\"\n assert candidate(equation = \"2x+2x+2x+2x+2x=10\") == \"x=1\"\n assert candidate(equation = \"-3x+5=2x-10\") == \"x=3\"\n assert candidate(equation = \"-10x+20-30x+40=50x-60+70x-80\") == \"x=1\"\n assert candidate(equation = \"7x-2x-5=5-3x\") == \"x=1\"\n assert candidate(equation = \"10x-9x+8x-7x+6x-5x+4x-3x+2x-x=0\") == \"x=0\"\n assert candidate(equation = \"0x+0=0\") == \"Infinite solutions\"\n assert candidate(equation = \"x=0x\") == \"x=0\"\n assert candidate(equation = \"x+1=1-x\") == \"x=0\"\n assert candidate(equation = \"x-2x+3x-4x+5x=0\") == \"x=0\"\n assert candidate(equation = \"2x+2x+2x=6x\") == \"Infinite solutions\"\n assert candidate(equation = \"-3x+9x=9x-3x\") == \"Infinite solutions\"\n assert candidate(equation = \"10x+5=10x+5\") == \"Infinite solutions\"\n assert candidate(equation = \"x-10000=10000x-10000\") == \"x=0\"\n assert candidate(equation = \"-3x+2=7x-8\") == \"x=1\"\n assert candidate(equation = \"100x-50=50x+100\") == \"x=3\"\n assert candidate(equation = \"5x+10=5x+10\") == \"Infinite solutions\"\n assert candidate(equation = \"20x-15=15-20x\") == \"x=0\"\n assert candidate(equation = \"10x-5=5x+10\") == \"x=3\"\n assert candidate(equation = \"1x+2x+3x+4x+5x=0\") == \"x=0\"\n assert candidate(equation = \"2x+3x+4x=9x\") == \"Infinite solutions\"\n assert candidate(equation = \"2x=4x-2x\") == \"Infinite solutions\"\n assert candidate(equation = \"-2x+3x-4x=-3x\") == \"Infinite solutions\"\n assert candidate(equation = \"x-2x+3x-4x+5x-6x+7x-8x+9x=9x-8x+7x-6x+5x-4x+3x-2x+x\") == \"Infinite solutions\"\n assert candidate(equation = \"2x+3-4x=5x-2+3x\") == \"x=0\"\n assert candidate(equation = \"5=5\") == \"Infinite solutions\"\n assert candidate(equation = \"x=1x\") == \"Infinite solutions\"\n assert candidate(equation = \"5x+10=3x+20\") == \"x=5\"\n assert candidate(equation = \"-2x+4x-3=5x-4+2x\") == \"x=0\"\n assert candidate(equation = \"x+2x+3x+4x+5x=6x+5x+4x+3x+2x+x\") == \"x=0\"\n assert candidate(equation = \"2x+3x-5=4x-2\") == \"x=3\"\n assert candidate(equation = \"2x-3x+4x-5x+6x=6x-5x+4x-3x+2x\") == \"Infinite solutions\"\n assert candidate(equation = \"-1000x+1000=1000x-1000\") == \"x=1\"\n assert candidate(equation = \"x+x+x+x+x+x+x+x+x+x=10\") == \"x=1\"\n assert candidate(equation = \"x+2x+3x=6x\") == \"Infinite solutions\"\n assert candidate(equation = \"2x+5x=5+2x-2x\") == \"x=0\"\n assert candidate(equation = \"x+0=0+x\") == \"Infinite solutions\"\n assert candidate(equation = \"-100x+100=100x-100\") == \"x=1\"\n assert candidate(equation = \"2x+4x-5=3x-2x+4\") == \"x=1\"\n assert candidate(equation = \"-x=-2x\") == \"x=0\"\n assert candidate(equation = \"10x-20=5x-5+3x\") == \"x=7\"\n assert candidate(equation = \"x+x+x+x+x+x=x+x+x+x+x\") == \"x=0\"\n assert candidate(equation = \"x+5=2x+3\") == \"x=2\"\n assert candidate(equation = \"1=x\") == \"x=1\"\n assert candidate(equation = \"2x+3x-4x=5x+6x-7x\") == \"x=0\"\n assert candidate(equation = \"5x-5=5x+5\") == \"No solution\"\n assert candidate(equation = \"3x+5=2x+10-3\") == \"x=2\"\n assert candidate(equation = \"100x-100=100x-100\") == \"Infinite solutions\"\n assert candidate(equation = \"-x-x-x-x-x=-5x\") == \"Infinite solutions\"\n assert candidate(equation = \"10x+20x+30x=30x+20x+10x\") == \"Infinite solutions\"\n assert candidate(equation = \"10x+20-30x+40=50x-60+70x-80\") == \"x=1\"\n assert candidate(equation = \"2x+3-4x=5x-2x+3\") == \"x=0\"\n assert candidate(equation = \"10x+5-2x=8x-3+5x\") == \"x=1\"\n assert candidate(equation = \"x+1000=1000\") == \"x=0\"\n assert candidate(equation = \"-2x-3+5x=3x-2+4\") == \"No solution\"\n assert candidate(equation = \"-3x+2x+5=4x-3x+2\") == \"x=1\"\n assert candidate(equation = \"-2x-3=-5x+2\") == \"x=1\"\n assert candidate(equation = \"-3x+7=7-3x\") == \"Infinite solutions\"\n assert candidate(equation = \"-3x+4x-5x+6x=7x-8x+9x\") == \"x=0\"\n assert candidate(equation = \"-x+2x-3x+4x-5x=5x-4x+3x-2x+x\") == \"x=0\"\n assert candidate(equation = \"100x-99x+98x=100\") == \"x=1\"\n assert candidate(equation = \"10x-5x+2x=7x\") == \"Infinite solutions\"\n assert candidate(equation = \"-5x+10=2x-8+3x\") == \"x=1\"\n assert candidate(equation = \"-5x+10=15x-20\") == \"x=1\"\n assert candidate(equation = \"-x-2x-3x=-6x\") == \"Infinite solutions\"\n assert candidate(equation = \"x-2x+3x-4x+5x=x\") == \"x=0\"\n assert candidate(equation = \"0x+1=0\") == \"No solution\"\n assert candidate(equation = \"10x-20x=5x-5x+3x\") == \"x=0\"\n assert candidate(equation = \"2x-4x+5=3x-2x+4\") == \"x=0\"\n assert candidate(equation = \"-x=-x\") == \"Infinite solutions\"\n assert candidate(equation = \"6x+7x+8x=11x+12x\") == \"x=0\"\n assert candidate(equation = \"x-2x+3x-4x=0x\") == \"x=0\"\n assert candidate(equation = \"100x-200=200x-100\") == \"x=-1\"\n assert candidate(equation = \"5x-5=5x-5\") == \"Infinite solutions\"\n assert candidate(equation = \"x+x+x+x+x=5x\") == \"Infinite solutions\"\n assert candidate(equation = \"x+x+x+x+x=5x+5x-5x\") == \"Infinite solutions\"\n assert candidate(equation = \"5x-3x+2=3x-2x+5\") == \"x=3\"\n assert candidate(equation = \"x-1=-1+x\") == \"Infinite solutions\"\n assert candidate(equation = \"10=10\") == \"Infinite solutions\"\n assert candidate(equation = \"10x+20+30x-40=50x-60+70x-80\") == \"x=1\"\n assert candidate(equation = \"2x-3x+4x=3x-2x+x\") == \"x=0\"\n assert candidate(equation = \"2x=4x-2\") == \"x=1\"\n assert candidate(equation = \"2x-3x+5=5x-10\") == \"x=2\"\n assert candidate(equation = \"-x+2x-3x+4x=5-6+7-8\") == \"x=-1\"\n assert candidate(equation = \"10x+20=20x-10\") == \"x=3\"\n assert candidate(equation = \"5x-3x+2x=4x\") == \"Infinite solutions\"\n assert candidate(equation = \"-1x-2x-3x-4x-5x=0\") == \"x=0\"\n assert candidate(equation = \"2x+5=5+2x\") == \"Infinite solutions\"\n assert candidate(equation = \"3x-2x+5=2x-3x+4\") == \"x=-1\"\n assert candidate(equation = \"3x+5-2x=4x-1+2\") == \"x=1\"\n assert candidate(equation = \"-x+2-3x=4-5x+6\") == \"x=8\"\n assert candidate(equation = \"3x-3=6-3x\") == \"x=1\"\n assert candidate(equation = \"-3x+7x=7-3x+3x\") == \"x=1\"\n assert candidate(equation = \"10x+20=30x-40\") == \"x=3\"\n assert candidate(equation = \"3x-2x+4=2x-4x+3\") == \"x=-1\"\n assert candidate(equation = \"10x+20x+30x+40x+50x=150x\") == \"Infinite solutions\"\n assert candidate(equation = \"10x-10=10x-10\") == \"Infinite solutions\"\n assert candidate(equation = \"-3x+2x+4=5x-2x+3\") == \"x=0\"\n assert candidate(equation = \"x+1=1+x\") == \"Infinite solutions\"\n assert candidate(equation = \"3x+3x+3x=3x+3x+3x\") == \"Infinite solutions\"\n assert candidate(equation = \"x-x+x-x=0\") == \"Infinite solutions\"\n assert candidate(equation = \"100x-50=50x+50\") == \"x=2\"\n assert candidate(equation = \"x+2x+3x+4x+5x=15x\") == \"Infinite solutions\"\n assert candidate(equation = \"-10x+5x-2x=-7x\") == \"Infinite solutions\"\n assert candidate(equation = \"x+2x+3x+4x+5x=5+4+3+2+1\") == \"x=1\"\n assert candidate(equation = \"5x+3x-2=4x-3x+5\") == \"x=1\"\n assert candidate(equation = \"1x+2x+3x+4x+5x=15\") == \"x=1\"\n assert candidate(equation = \"3x-2x+4x=5x-2x+2\") == \"x=1\"\n assert candidate(equation = \"0x+5=0x+5\") == \"Infinite solutions\"\n assert candidate(equation = \"x+2-3x+4=5x-6+7\") == \"x=0\"\n assert candidate(equation = \"-5x+10x=2x-8x+3x\") == \"x=0\"\n assert candidate(equation = \"1000x-500=500x+500\") == \"x=2\"\n assert candidate(equation = \"x+2+3x+4=4x+5-6x\") == \"x=-1\"\n assert candidate(equation = \"0x+5x=5x\") == \"Infinite solutions\"\n assert candidate(equation = \"3x+1=2x-2x+x+1\") == \"x=0\"\n assert candidate(equation = \"10x-5=15-5x\") == \"x=1\"\n assert candidate(equation = \"-2=-1\") == \"No solution\"\n assert candidate(equation = \"15x+20=20x-10\") == \"x=6\"\n assert candidate(equation = \"-1x-2x-3x-4x-5x=-15\") == \"x=1\"\n assert candidate(equation = \"x-2x+3x-4x+5x=6x-7x+8x\") == \"x=0\"\n assert candidate(equation = \"-2x+5=5-2x\") == \"Infinite solutions\"\n assert candidate(equation = \"x+2x-3x=0\") == \"Infinite solutions\"\n assert candidate(equation = \"2x+3x-5=7x-10\") == \"x=2\"\n assert candidate(equation = \"-3x+9=9-3x\") == \"Infinite solutions\"\n assert candidate(equation = \"12x-4x+5=8x+3\") == \"No solution\"\n assert candidate(equation = \"0x+5=5\") == \"Infinite solutions\"\n assert candidate(equation = \"-x+3x-4=2x-5+3x\") == \"x=0\"\n assert candidate(equation = \"5x-3x+2=2x-3x+5\") == \"x=1\"\n assert candidate(equation = \"x+1=2x-1\") == \"x=2\"\n assert candidate(equation = \"-5x+10=-10+5x\") == \"x=2\"\n assert candidate(equation = \"x-2+3x=4-2x+6x\") == \"No solution\"\n assert candidate(equation = \"x+2x+3x+4x+5x=5x+5x-5x+5x\") == \"x=0\"\n assert candidate(equation = \"3x+5x-7x=10\") == \"x=10\"\n assert candidate(equation = \"100x-50x+25x=75x\") == \"Infinite solutions\"\n assert candidate(equation = \"-5x+10=5x-10\") == \"x=2\"\n assert candidate(equation = \"5x+5x+5x+5x+5x=25\") == \"x=1\"\n assert candidate(equation = \"3x=0\") == \"x=0\"\n assert candidate(equation = \"x-0=0\") == \"x=0\"\n assert candidate(equation = \"-x+2=3x-4\") == \"x=1\"\n assert candidate(equation = \"-x+2x-3x=-4\") == \"x=2\"\n assert candidate(equation = \"-x+2x-3x+4x-5x+6x=6x-5x+4x-3x+2x-1x\") == \"Infinite solutions\"\n assert candidate(equation = \"x+2x+3x-4x+5x=5x+5x-5x\") == \"x=0\"\n assert candidate(equation = \"x-2x+3x-4x+5x-6x=6x-5x+4x-3x+2x-x\") == \"x=0\"\n assert candidate(equation = \"x=1\") == \"x=1\"\n assert candidate(equation = \"3x-2x+5=2x-4x+3\") == \"x=-1\"\n assert candidate(equation = \"-5x+2x+3=4x-3x+5\") == \"x=-1\"\n assert candidate(equation = \"-x+2x-3=5-2x\") == \"x=2\"\n assert candidate(equation = \"5-2x=3x+6\") == \"x=-1\"\n assert candidate(equation = \"x+3=2x+2\") == \"x=1\"\n assert candidate(equation = \"-x+2x-3x=4x-5x+6x\") == \"x=0\"\n assert candidate(equation = \"5x-5-3x+2=2x+3-4x\") == \"x=1\"\n assert candidate(equation = \"x=2x-3x+4x-5x+6x\") == \"x=0\"\n assert candidate(equation = \"-x+1=2x+3\") == \"x=-1\"\n assert candidate(equation = \"5x+7=3x-2\") == \"x=-5\"\n assert candidate(equation = \"x+x+x+x+x=x+x+x+x\") == \"x=0\"\n assert candidate(equation = \"10x+5-3x=7x+2-5x\") == \"x=-1\"\n assert candidate(equation = \"10x-5+3x=2x-4+5x\") == \"x=0\"\n assert candidate(equation = \"-10x+20=10x-20\") == \"x=2\"\n assert candidate(equation = \"x+3=3x+3\") == \"x=0\"\n assert candidate(equation = \"-2x+5=10-3x\") == \"x=5\"\n assert candidate(equation = \"2x+3x-5=4x+2\") == \"x=7\"\n assert candidate(equation = \"x+2x+3x+4x+5x=5x+4x+3x+2x+x\") == \"Infinite solutions\"\n assert candidate(equation = \"x-2x+3x-4x=0\") == \"x=0\"\n assert candidate(equation = \"5x-2+3x=4x-5+2x\") == \"x=-2\"\n assert candidate(equation = \"5-5x=5-5x\") == \"Infinite solutions\"\n assert candidate(equation = \"-5x+10-3x=2x-3+4x\") == \"x=0\"\n assert candidate(equation = \"6x+4-2x=3x+1\") == \"x=-3\"\n assert candidate(equation = \"-1=-1\") == \"Infinite solutions\"\n assert candidate(equation = \"100x-100=100x-101\") == \"No solution\"\n assert candidate(equation = \"2x-3=5x+4\") == \"x=-3\"\n assert candidate(equation = \"20x-10x+5x=5x+5x+5x\") == \"Infinite solutions\"\n assert candidate(equation = \"10x-5=2x-3+8x\") == \"No solution\"\n assert candidate(equation = \"x=2x-3+4x-5\") == \"x=1\"\n assert candidate(equation = \"3x+4-5x+6=2x-8+9\") == \"x=2\"\n assert candidate(equation = \"x-5+2x=3x-5\") == \"Infinite solutions\"\n assert candidate(equation = \"x-2x+3x-4x+5x-6x=6x-5x+4x-3x+2x-1x\") == \"x=0\"\n assert candidate(equation = \"x+5x=5x+5-3x\") == \"x=1\"\n assert candidate(equation = \"x+2-3x+4-5x+6=6x-5+4x-3+2x-1\") == \"x=1\"\n assert candidate(equation = \"5x-10+2x=7x-20+3x\") == \"x=3\"\n assert candidate(equation = \"3x-2x+4x=5x-3x+2\") == \"x=0\"\n assert candidate(equation = \"-2x+3x-4=5x-6x+7\") == \"x=5\"\n assert candidate(equation = \"x+2x+3x=4x+5x\") == \"x=0\"\n"}, "metadata": {"canonical_parameter_names": ["equation"], "leetcode_dataset_entry_point": "Solution().solveEquation", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var solveEquation = function(equation) {", "container": null, "callable": "solveEquation", "parameters": [{"name": "equation", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 643, "task_id": "maximum-average-subarray-i", "difficulty": "Easy", "problem_description": "You are given an integer array nums consisting of n elements, and an integer k.\nFind a contiguous subarray whose length is equal to k that has the maximum average value and return this value. Any answer with a calculation error less than 10-5 will be accepted.\n \nExample 1:\n\nInput: nums = [1,12,-5,-6,50,3], k = 4\nOutput: 12.75000\nExplanation: Maximum average is (12 - 5 - 6 + 50) / 4 = 51 / 4 = 12.75\n\nExample 2:\n\nInput: nums = [5], k = 1\nOutput: 5.00000\n\n \nConstraints:\n\nn == nums.length\n1 <= k <= n <= 105\n-104 <= nums[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 8.0\n assert candidate(nums = [0, 0, 0, 0, 0],k = 5) == 0.0\n assert candidate(nums = [1, 2, 3, 4, 5],k = 2) == 4.5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3) == 9.0\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 2) == 0.5\n assert candidate(nums = [10000, -10000, 10000, -10000, 10000],k = 5) == 2000.0\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10],k = 5) == -3.0\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10],k = 3) == -2.0\n assert candidate(nums = [1, 12, -5, -6, 50, 3],k = 4) == 12.75\n assert candidate(nums = [5],k = 1) == 5.0\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 2) == 0.0\n assert candidate(nums = [-1, -2, -3, -4, -5],k = 3) == -2.0\n assert candidate(nums = [0, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16, 17, -18, 19],k = 10) == 0.5\n assert candidate(nums = [-10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000],k = 20) == -10000.0\n assert candidate(nums = [100, -100, 200, -200, 300, -300, 400, -400, 500, -500],k = 4) == 50.0\n assert candidate(nums = [100, -50, 200, -300, 400, -500, 600, -700, 800, -900],k = 4) == 62.5\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 20) == 1.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 19) == 11.0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500],k = 12) == 950.0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1) == 1.0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 1.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 8.0\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],k = 10) == 30.0\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 3) == 0.6666666666666666\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991],k = 5) == -9993.0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1) == 1.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],k = 15) == 18.0\n assert candidate(nums = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 0, -100, -200, -300, -400],k = 7) == 700.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],k = 7) == 22.0\n assert candidate(nums = [10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000],k = 5) == 2000.0\n assert candidate(nums = [10000, -9999, 20000, -19999, 30000, -29999, 40000, -39999, 50000, -49999],k = 5) == 10000.4\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 1.0\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991],k = 3) == -9992.0\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75],k = 10) == 52.5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 15) == 23.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 1) == 20.0\n assert candidate(nums = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14, -15, 16, -17, 18, -19, 20],k = 7) == 2.4285714285714284\n assert candidate(nums = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16, 17, -18, 19, -20],k = 6) == 0.5\n assert candidate(nums = [-9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, -9990],k = 4) == -9991.5\n assert candidate(nums = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],k = 15) == -1.0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],k = 20) == 105.0\n assert candidate(nums = [5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000],k = 12) == 5000.0\n assert candidate(nums = [5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000],k = 10) == 5000.0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500],k = 1) == 1500.0\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20],k = 15) == -8.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 7) == 12.0\n assert candidate(nums = [-10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000],k = 3) == 3333.3333333333335\n assert candidate(nums = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15],k = 6) == 0.5\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 2) == 10.0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 10) == 55.0\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000],k = 20) == 10000.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 1) == 20.0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 20) == 1.0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],k = 10) == 1550.0\n assert candidate(nums = [10000, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981],k = 15) == 9993.0\n assert candidate(nums = [100, -100, 50, -50, 25, -25, 125, -125, 625, -625],k = 4) == 150.0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 1.0\n assert candidate(nums = [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10, -20, 30, 40, 50, 60, 70, 80, 90, 100],k = 12) == 51.166666666666664\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 20) == 10.5\n assert candidate(nums = [-10000, -9000, -8000, -7000, -6000, -5000, -4000, -3000, -2000, -1000, 0, 1000, 2000, 3000, 4000],k = 15) == -3000.0\n assert candidate(nums = [-10000, -9000, -8000, -7000, -6000, -5000, -4000, -3000, -2000, -1000, 0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000],k = 5) == 7000.0\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20],k = 10) == -5.5\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 5) == 0.2\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15],k = 5) == -3.0\n assert candidate(nums = [5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000],k = 15) == 5000.0\n assert candidate(nums = [10000, -9999, 9999, -9998, 9998, -9997, 9997, -9996, 9996, -9995],k = 5) == 2000.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 7) == 17.0\n assert candidate(nums = [-1, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0],k = 6) == 0.0\n assert candidate(nums = [5, 8, 10, 12, 15, 18, 20, 22, 25, 28, 30, 32, 35, 38, 40, 42, 45, 48, 50, 52],k = 15) == 35.0\n assert candidate(nums = [5, 3, 8, 4, 2, 9, 1, 6, 7, 0, 11, 13, 12, 14, 15, 16, 17, 18, 19, 20],k = 5) == 18.0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 10) == 550.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 7) == 12.0\n assert candidate(nums = [-9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, -9990],k = 5) == -9992.0\n assert candidate(nums = [10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000],k = 3) == 3333.3333333333335\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 10) == 0.0\n assert candidate(nums = [10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000],k = 3) == 3333.3333333333335\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],k = 3) == 9000.0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 15) == 1.0\n assert candidate(nums = [10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 0, -1000, -2000, -3000, -4000],k = 8) == 6500.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 20) == 10.5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10) == 15.5\n assert candidate(nums = [-10, 20, -30, 40, -50, 60, -70, 80, -90, 100, -110],k = 5) == 16.0\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10],k = 9) == 5.0\n assert candidate(nums = [5, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 2.4\n assert candidate(nums = [5, -4, 3, -2, 1, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14, -15],k = 10) == 0.5\n assert candidate(nums = [9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999, 9999],k = 11) == 909.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10) == 15.5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],k = 25) == 38.0\n assert candidate(nums = [-5, 15, -25, 35, -45, 55, -65, 75, -85, 95, -105, 115, -125, 135, -145],k = 6) == 5.0\n assert candidate(nums = [10000, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991],k = 3) == 9999.0\n assert candidate(nums = [5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000],k = 5) == 5000.0\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 8) == 0.0\n assert candidate(nums = [-100, -200, -300, -400, -500, -600, -700, -800, -900, -1000, -1100, -1200, -1300, -1400, -1500],k = 10) == -550.0\n assert candidate(nums = [0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],k = 11) == 1500.0\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 3) == 0.3333333333333333\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().findMaxAverage", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findMaxAverage = function(nums, k) {", "container": null, "callable": "findMaxAverage", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 645, "task_id": "set-mismatch", "difficulty": "Easy", "problem_description": "You have a set of integers s, which originally contains all the numbers from 1 to n. Unfortunately, due to some error, one of the numbers in s got duplicated to another number in the set, which results in repetition of one number and loss of another number.\nYou are given an integer array nums representing the data status of this set after the error.\nFind the number that occurs twice and the number that is missing and return them in the form of an array.\n \nExample 1:\nInput: nums = [1,2,2,4]\nOutput: [2,3]\nExample 2:\nInput: nums = [1,1]\nOutput: [1,2]\n\n \nConstraints:\n\n2 <= nums.length <= 104\n1 <= nums[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [3, 1, 2, 5, 3]) == [3, 4]\n assert candidate(nums = [10, 2, 8, 2, 5, 3, 9, 1, 4, 7]) == [2, 6]\n assert candidate(nums = [9, 1, 8, 5, 6, 7, 9, 2, 4]) == [9, 3]\n assert candidate(nums = [1, 2, 4, 6, 6]) == [6, 2]\n assert candidate(nums = [4, 2, 2, 5, 3]) == [2, 1]\n assert candidate(nums = [5, 3, 2, 5, 1]) == [5, 4]\n assert candidate(nums = [5, 5, 3, 2, 1]) == [5, 4]\n assert candidate(nums = [8, 7, 3, 5, 3, 6, 4, 2]) == [3, 1]\n assert candidate(nums = [1, 2, 2, 4]) == [2, 3]\n assert candidate(nums = [1, 1]) == [1, 2]\n assert candidate(nums = [4, 3, 2, 7, 8, 2, 3, 1]) == [5, 11]\n assert candidate(nums = [6, 2, 3, 4, 5, 2]) == [2, 1]\n assert candidate(nums = [1, 5, 3, 2, 2]) == [2, 4]\n assert candidate(nums = [3, 3, 1, 4, 2]) == [3, 5]\n assert candidate(nums = [2, 2]) == [2, 1]\n assert candidate(nums = [5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5009, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [5009, -49880]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 20, 19]) == [20, 21]\n assert candidate(nums = [1, 3, 4, 5, 6, 7, 8, 9, 10, 1]) == [1, 2]\n assert candidate(nums = [1, 3, 4, 5, 6, 7, 8, 9, 10, 10]) == [10, 2]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 10]) == [0, 0]\n assert candidate(nums = [6, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1]) == [6, 11]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 2]) == [2, 101]\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 7, 8, 9, 10]) == [5, 6]\n assert candidate(nums = [10, 1, 2, 3, 4, 5, 6, 7, 8, 10]) == [10, 9]\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9990, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [9990, -99780]\n assert candidate(nums = [1, 3, 4, 2, 2, 5, 6, 8, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [2, 21]\n assert candidate(nums = [1, 2, 2, 4, 5, 6, 7, 8, 9, 10, 3]) == [2, 11]\n assert candidate(nums = [8, 7, 3, 5, 7, 1, 9, 2]) == [7, 1]\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 2]) == [2, 1]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1]) == [1, 10]\n assert candidate(nums = [1000, 2, 3, 4, 5, 6, 7, 8, 9, 1000]) == [1000, -989]\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10]) == [5, 11]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 5, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [5, 21]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10]) == [10, 11]\n assert candidate(nums = [5, 5, 3, 2, 1, 4, 6, 7, 8, 9, 10]) == [5, 11]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 5]) == [5, 11]\n assert candidate(nums = [1, 3, 4, 2, 5, 6, 7, 8, 9, 10, 10]) == [10, 11]\n assert candidate(nums = [1000, 1000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]) == [1000, -799]\n assert candidate(nums = [3, 3, 1, 4, 5, 6, 7, 8, 9, 10, 2]) == [3, 11]\n assert candidate(nums = [10, 5, 3, 4, 5, 6, 7, 8, 9, 1]) == [5, 2]\n assert candidate(nums = [7, 3, 1, 3, 5, 6, 4, 8, 2, 9]) == [3, 10]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 9]) == [9, 10]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1, 20, 21]) == [1, 22]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 4]) == [4, 11]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 8, 10, 9]) == [8, 11]\n assert candidate(nums = [10, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2]) == [2, 11]\n assert candidate(nums = [1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == [1, 2]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10]) == [9, 11]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 20, 20]) == [20, 22]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30]) == [30, 31]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 10, 10]) == [10, 9]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100]) == [100, 101]\n assert candidate(nums = [10, 4, 3, 2, 7, 10, 6, 5, 8, 1]) == [10, 9]\n assert candidate(nums = [4000, 4000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400]) == [4000, -3197]\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 9980, 9979, 9978, 9977, 9976, 9975, 9974, 9973, 9972, 9971, 9970, 9969, 9968, 9967, 9966, 9965, 9964, 9963, 9962, 9961, 9960, 9959, 9958, 9957, 9956, 9955, 9954, 9953, 9952, 9951, 9950, 9949, 9948, 9947, 9946, 9945, 9944, 9943, 9942, 9941, 9940, 9939, 9938, 9937, 9936, 9935, 9934, 9933, 9932, 9931, 9930, 9929, 9928, 9927, 9926, 9925, 9924, 9923, 9922, 9921, 9920, 9919, 9918, 9917, 9916, 9915, 9914, 9913, 9912, 9911, 9910, 9909, 9908, 9907, 9906, 9905, 9904, 9903, 9902, 9901, 9900, 9999]) == [9999, -989799]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 10]) == [5, 11]\n assert candidate(nums = [10, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [10, 1]\n assert candidate(nums = [7, 3, 4, 1, 6, 2, 5, 5, 9, 8]) == [5, 10]\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 20]) == [45, 135]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20]) == [30, 43]\n assert candidate(nums = [9999, 10000, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 9980, 9979, 9978, 9977, 9976, 9975, 9974, 9973, 9972, 9971, 9970, 9969, 9968, 9967, 9966, 9965, 9964, 9963, 9962, 9961, 9960, 9959, 9958, 9957, 9956, 9955, 9954, 9953, 9952, 9951, 9950, 9949, 9948, 9947, 9946, 9945, 9944, 9943, 9942, 9941, 9940, 9939, 9938, 9937, 9936, 9935, 9934, 9933, 9932, 9931, 9930, 9929, 9928, 9927, 9926, 9925, 9924, 9923, 9922, 9921, 9920, 9919, 9918, 9917, 9916, 9915, 9914, 9913, 9912, 9911, 9910, 9909, 9908, 9907, 9906, 9905, 9904, 9903, 9902, 9901, 9900, 9900]) == [9900, -999697]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 7, 9, 10, 8]) == [7, 11]\n assert candidate(nums = [6, 2, 3, 4, 5, 6, 7, 8, 9, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]) == [6, 22]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11]) == [10, 12]\n assert candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1, 2, 10]) == [2, 9]\n assert candidate(nums = [2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10]) == [2, 11]\n assert candidate(nums = [100, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100]) == [200, 102]\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 7, 8, 9, 10, 6]) == [5, 11]\n assert candidate(nums = [7, 3, 1, 5, 4, 6, 7]) == [7, 2]\n assert candidate(nums = [10000, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 9980, 9979, 9978, 9977, 9976, 9975, 9974, 9973, 9972, 9971, 9970, 9969, 9968, 9967, 9966, 9965, 9964, 9963, 9962, 9961, 9960, 9959, 9958, 9957, 9956, 9955, 9954, 9953, 9952, 9951, 9950, 9949, 9948, 9947, 9946, 9945, 9944, 9943, 9942, 9941, 9940, 9939, 9938, 9937, 9936, 9935, 9934, 9933, 9932, 9931, 9930, 9929, 9928, 9927, 9926, 9925, 9924, 9923, 9922, 9921, 9920, 9919, 9918, 9917, 9916, 9915, 9914, 9913, 9912, 9911, 9910, 9909, 9908, 9907, 9906, 9905, 9904, 9903, 9902, 9901, 9900, 9899, 9898, 9897, 9896, 9895, 9894, 9893, 9892, 9891, 9890, 9889, 9888, 9887, 9886, 9885, 9884, 9883, 9882, 9881, 9880, 9879, 9878, 9877, 9876, 9875, 9874, 9873, 9872, 9871, 9870, 9869, 9868, 9867, 9866, 9865, 9864, 9863, 9862, 9861, 9860, 9859, 9858, 9857, 9856, 9855, 9854, 9853, 9852, 9851, 9850, 9849, 9848, 9847, 9846, 9845, 9844, 9843, 9842, 9841, 9840, 9839, 9838, 9837, 9836, 9835, 9834, 9833, 9832, 9831, 9830, 9829, 9828, 9827, 9826, 9825, 9824, 9823, 9822, 9821, 9820, 9819, 9818, 9817, 9816, 9815, 9814, 9813, 9812, 9811, 9810, 9809, 9808, 9807, 9806, 9805, 9804, 9803, 9802, 9801, 9800, 9799, 9798, 9797, 9796, 9795, 9794, 9793, 9792, 9791, 9790, 9789, 9788, 9787, 9786, 9785, 9784, 9783, 9782, 9781, 9780, 9779, 9778, 9777, 9776, 9775, 9774, 9773, 9772, 9771, 9770, 9769, 9768, 9767, 9766, 9765, 9764, 9763, 9762, 9761, 9760, 9759, 9758, 9757, 9756, 9755, 9754, 9753, 9752, 9751, 9750, 9749, 9748, 9747, 9746, 9745, 9744, 9743, 9742, 9741, 9740, 9739, 9738, 9737, 9736, 9735, 9734, 9733, 9732, 9731, 9730, 9729, 9728, 9727, 9726, 9725, 9724, 9723, 9722, 9721, 9720, 9719, 9718, 9717, 9716, 9715, 9714, 9713, 9712, 9711, 9710, 9709, 9708, 9707, 9706, 9705, 9704, 9703, 9702, 9701, 9700]) == [0, -2919399]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 7, 9, 10]) == [7, 8]\n assert candidate(nums = [20, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [20, 21]\n assert candidate(nums = [10000, 9999, 9998, 9997, 9997, 9996, 9995, 9994, 9993, 9992, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [9997, -89809]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 6, 8, 9, 10, 7]) == [6, 11]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1]) == [1, 101]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 9]) == [9, 10]\n assert candidate(nums = [5000, 4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991, 4990, 4989, 4988, 4987, 4986, 4985, 4984, 4983, 4982, 4981, 4980, 4979, 4978, 4977, 4976, 4975, 4974, 4973, 4972, 4971, 4970, 4969, 4968, 4967, 4966, 4965, 4964, 4963, 4962, 4961, 4960, 4959, 4958, 4957, 4956, 4955, 4954, 4953, 4952, 4951, 4950, 4949, 4948, 4947, 4946, 4945, 4944, 4943, 4942, 4941, 4940, 4939, 4938, 4937, 4936, 4935, 4934, 4933, 4932, 4931, 4930, 4929, 4928, 4927, 4926, 4925, 4924, 4923, 4922, 4921, 4920, 4919, 4918, 4917, 4916, 4915, 4914, 4913, 4912, 4911, 4910, 4909, 4908, 4907, 4906, 4905, 4904, 4903, 4902, 4901, 4900, 4899, 4898, 4897, 4896, 4895, 4894, 4893, 4892, 4891, 4890, 4889, 4888, 4887, 4886, 4885, 4884, 4883, 4882, 4881, 4880, 4879, 4878, 4877, 4876, 4875, 4874, 4873, 4872, 4871, 4870, 4869, 4868, 4867, 4866, 4865, 4864, 4863, 4862, 4861, 4860, 4859, 4858, 4857, 4856, 4855, 4854, 4853, 4852, 4851, 4850, 4849, 4848, 4847, 4846, 4845, 4844, 4843, 4842, 4841, 4840, 4839, 4838, 4837, 4836, 4835, 4834, 4833, 4832, 4831, 4830, 4829, 4828, 4827, 4826, 4825, 4824, 4823, 4822, 4821, 4820, 4819, 4818, 4817, 4816, 4815, 4814, 4813, 4812, 4811, 4810, 4809, 4808, 4807, 4806, 4805, 4804, 4803, 4802, 4801, 4800, 4799, 4798, 4797, 4796, 4795, 4794, 4793, 4792, 4791, 4790, 4789, 4788, 4787, 4786, 4785, 4784, 4783, 4782, 4781, 4780, 4779, 4778, 4777, 4776, 4775, 4774, 4773, 4772, 4771, 4770, 4769, 4768, 4767, 4766, 4765, 4764, 4763, 4762, 4761, 4760, 4759, 4758, 4757, 4756, 4755, 4754, 4753, 4752, 4751, 4750, 4749, 4748, 4747, 4746, 4745, 4744, 4743, 4742, 4741, 4740, 4739, 4738, 4737, 4736, 4735, 4734, 4733, 4732, 4731, 4730, 4729, 4728, 4727, 4726, 4725, 4724, 4723, 4722, 4721, 4720, 4719, 4718, 4717, 4716, 4715, 4714, 4713, 4712, 4711, 4710, 4709, 4708, 4707, 4706, 4705, 4704, 4703, 4702, 4701, 4700]) == [0, -1414399]\n assert candidate(nums = [10, 2, 5, 3, 7, 8, 8, 1, 4, 6]) == [8, 9]\n assert candidate(nums = [1, 2, 2, 2, 5, 6, 7, 8, 9, 10]) == [4, 7]\n assert candidate(nums = [6, 3, 5, 4, 1, 2, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 5]) == [5, 20]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 12]) == [0, -2]\n assert candidate(nums = [10000, 2, 3, 4, 5, 6, 7, 8, 9, 10000]) == [10000, -9989]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 11]) == [11, 10]\n assert candidate(nums = [8, 1, 5, 3, 4, 2, 8, 6, 7]) == [8, 9]\n assert candidate(nums = [100, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]) == [0, -79]\n assert candidate(nums = [2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10]) == [2, 11]\n assert candidate(nums = [10, 2, 5, 3, 7, 8, 8, 1, 4, 6, 9]) == [8, 11]\n assert candidate(nums = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]) == [0, -99]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 3]) == [4, 23]\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().findErrorNums", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findErrorNums = function(nums) {", "container": null, "callable": "findErrorNums", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 646, "task_id": "maximum-length-of-pair-chain", "difficulty": "Medium", "problem_description": "You are given an array of n pairs pairs where pairs[i] = [lefti, righti] and lefti < righti.\nA pair p2 = [c, d] follows a pair p1 = [a, b] if b < c. A chain of pairs can be formed in this fashion.\nReturn the length longest chain which can be formed.\nYou do not need to use up all the given intervals. You can select pairs in any order.\n \nExample 1:\n\nInput: pairs = [[1,2],[2,3],[3,4]]\nOutput: 2\nExplanation: The longest chain is [1,2] -> [3,4].\n\nExample 2:\n\nInput: pairs = [[1,2],[7,8],[4,5]]\nOutput: 3\nExplanation: The longest chain is [1,2] -> [4,5] -> [7,8].\n\n \nConstraints:\n\nn == pairs.length\n1 <= n <= 1000\n-1000 <= lefti < righti <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(pairs = [[1, 20], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11]]) == 5\n assert candidate(pairs = [[-10, -5], [-3, -1], [0, 2], [5, 6]]) == 4\n assert candidate(pairs = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == 5\n assert candidate(pairs = [[1, 5], [2, 3], [4, 6], [5, 7], [6, 8]]) == 2\n assert candidate(pairs = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6]]) == 1\n assert candidate(pairs = [[1, 5], [2, 3], [4, 6], [7, 8]]) == 3\n assert candidate(pairs = [[-1, -2], [-3, -4], [-5, -6]]) == 3\n assert candidate(pairs = [[-1, 0], [0, 1], [1, 2], [2, 3]]) == 2\n assert candidate(pairs = [[7, 9], [4, 5], [2, 3]]) == 3\n assert candidate(pairs = [[-1000, 1000], [-999, 999], [0, 1], [2, 3], [4, 5]]) == 3\n assert candidate(pairs = [[1, 10], [2, 3], [4, 5], [6, 7], [8, 9]]) == 4\n assert candidate(pairs = [[1, 2], [7, 8], [4, 5]]) == 3\n assert candidate(pairs = [[-10, 10], [-20, -10], [0, 5]]) == 2\n assert candidate(pairs = [[1, 2], [2, 3], [3, 4]]) == 2\n assert candidate(pairs = [[1, 2], [2, 2], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8]]) == 4\n assert candidate(pairs = [[-1, 0], [0, 1], [1, 2]]) == 2\n assert candidate(pairs = [[-10, -9], [-8, -7], [-6, -5], [-4, -3], [-2, -1]]) == 5\n assert candidate(pairs = [[1, 5], [2, 3], [4, 7], [6, 8]]) == 2\n assert candidate(pairs = [[0, 3], [1, 2], [3, 4], [4, 5]]) == 2\n assert candidate(pairs = [[1, 3], [3, 5], [0, 6], [5, 7], [8, 10], [11, 13]]) == 4\n assert candidate(pairs = [[-1000, 1000], [0, 0], [1, 1]]) == 2\n assert candidate(pairs = [[1, 5], [2, 3], [4, 6], [7, 8], [8, 10]]) == 3\n assert candidate(pairs = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]]) == 3\n assert candidate(pairs = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10]]) == 1\n assert candidate(pairs = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [21, 22], [23, 24], [25, 26], [27, 28], [29, 30]]) == 15\n assert candidate(pairs = [[1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 13], [10, 14]]) == 2\n assert candidate(pairs = [[-5, -3], [-2, 0], [1, 3], [4, 6], [7, 9], [10, 12]]) == 6\n assert candidate(pairs = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15]]) == 7\n assert candidate(pairs = [[-5, -2], [-4, -1], [0, 3], [3, 7], [8, 10]]) == 3\n assert candidate(pairs = [[-1000, 1000], [-999, 999], [-998, 998], [-997, 997], [-996, 996], [-995, 995], [-994, 994], [-993, 993], [-992, 992], [-991, 991]]) == 1\n assert candidate(pairs = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]]) == 8\n assert candidate(pairs = [[-5, -1], [-2, -1], [0, 3], [1, 4], [2, 5], [3, 6], [4, 7]]) == 3\n assert candidate(pairs = [[1, 2], [1, 3], [1, 4], [1, 5], [2, 3], [2, 4], [2, 5], [3, 4], [3, 5], [4, 5]]) == 2\n assert candidate(pairs = [[1, 4], [2, 5], [3, 6], [0, 4], [1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10]]) == 2\n assert candidate(pairs = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10]]) == 3\n assert candidate(pairs = [[1, 4], [2, 5], [3, 6], [4, 7], [5, 8], [6, 9], [7, 10], [8, 11], [9, 12], [10, 13], [11, 14], [12, 15], [13, 16], [14, 17], [15, 18], [16, 19], [17, 20]]) == 5\n assert candidate(pairs = [[1, 50], [10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100]]) == 5\n assert candidate(pairs = [[1, 10], [2, 5], [3, 9], [4, 8], [5, 7], [6, 11]]) == 2\n assert candidate(pairs = [[-10, -1], [-9, 0], [-8, -2], [-7, -3], [-6, -4], [-5, -5], [0, 1], [1, 2], [2, 3], [3, 4]]) == 3\n assert candidate(pairs = [[-1, 5], [0, 6], [1, 7], [2, 8], [3, 9], [4, 10], [5, 11], [6, 12], [7, 13], [8, 14]]) == 2\n assert candidate(pairs = [[1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 13], [10, 14], [11, 15], [12, 16], [13, 17], [14, 18], [15, 19]]) == 3\n assert candidate(pairs = [[-5, 0], [-4, -3], [-2, 1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8]]) == 4\n assert candidate(pairs = [[-10, -5], [-5, 0], [0, 5], [5, 10], [10, 15], [15, 20], [20, 25], [25, 30], [30, 35], [35, 40]]) == 5\n assert candidate(pairs = [[-5, -4], [-4, -3], [-3, -2], [-2, -1], [-1, 0], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5]]) == 5\n assert candidate(pairs = [[-1, 1], [-2, 0], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9]]) == 4\n assert candidate(pairs = [[1, 100], [2, 99], [3, 98], [4, 97], [5, 96], [6, 95], [7, 94], [8, 93], [9, 92], [10, 91], [11, 90], [12, 89], [13, 88], [14, 87], [15, 86], [16, 85], [17, 84], [18, 83], [19, 82], [20, 81]]) == 1\n assert candidate(pairs = [[1, 5], [2, 3], [4, 6], [7, 8], [8, 10], [9, 11]]) == 4\n assert candidate(pairs = [[-100, 0], [-99, 1], [-98, 2], [-97, 3], [-96, 4], [-95, 5], [-94, 6], [-93, 7], [-92, 8], [-91, 9]]) == 1\n assert candidate(pairs = [[-10, -5], [-5, 0], [0, 5], [5, 10]]) == 2\n assert candidate(pairs = [[1, 3], [2, 4], [5, 7], [6, 8], [9, 11], [10, 12], [13, 15], [14, 16], [17, 19], [18, 20]]) == 5\n assert candidate(pairs = [[1, 100], [2, 99], [3, 98], [4, 97], [5, 96], [6, 95], [7, 94], [8, 93], [9, 92], [10, 91], [11, 90], [12, 89], [13, 88], [14, 87], [15, 86]]) == 1\n assert candidate(pairs = [[-10, -5], [-8, -3], [-6, -1], [-4, 0], [-2, 2], [0, 4], [2, 6], [4, 8], [6, 10]]) == 3\n assert candidate(pairs = [[-5, -3], [-2, -1], [0, 2], [3, 5], [6, 8], [9, 11], [12, 14], [15, 17], [18, 20]]) == 9\n assert candidate(pairs = [[1, 5], [2, 6], [3, 4], [4, 7], [5, 8], [6, 9], [7, 10]]) == 2\n assert candidate(pairs = [[-10, -2], [-5, 0], [0, 5], [3, 8], [6, 11], [8, 13], [10, 15]]) == 3\n assert candidate(pairs = [[-10, -9], [-8, -7], [-6, -5], [-4, -3], [-2, -1], [0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11]]) == 11\n assert candidate(pairs = [[1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2]]) == 1\n assert candidate(pairs = [[1, 20], [2, 19], [3, 18], [4, 17], [5, 16], [6, 15], [7, 14], [8, 13], [9, 12], [10, 11]]) == 1\n assert candidate(pairs = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16]]) == 8\n assert candidate(pairs = [[1, 100], [2, 99], [3, 98], [4, 97], [5, 96], [6, 95], [7, 94], [8, 93], [9, 92], [10, 91], [11, 90], [12, 89], [13, 88], [14, 87], [15, 86], [16, 85], [17, 84], [18, 83], [19, 82], [20, 81], [21, 80], [22, 79], [23, 78], [24, 77], [25, 76], [26, 75], [27, 74], [28, 73], [29, 72], [30, 71], [31, 70], [32, 69], [33, 68], [34, 67], [35, 66], [36, 65], [37, 64], [38, 63], [39, 62], [40, 61], [41, 60], [42, 59], [43, 58], [44, 57], [45, 56], [46, 55], [47, 54], [48, 53], [49, 52], [50, 51]]) == 1\n assert candidate(pairs = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 11], [7, 12]]) == 2\n assert candidate(pairs = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]]) == 10\n assert candidate(pairs = [[-10, -1], [-9, -2], [-8, -3], [-7, -4], [-6, -5], [-5, -6], [-4, -7], [-3, -8], [-2, -9], [-1, -10]]) == 5\n assert candidate(pairs = [[1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 13]]) == 2\n assert candidate(pairs = [[1, 10], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == 4\n assert candidate(pairs = [[-100, -50], [-50, 0], [0, 50], [50, 100], [100, 150], [150, 200], [200, 250], [250, 300], [300, 350], [350, 400]]) == 5\n assert candidate(pairs = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12]]) == 4\n assert candidate(pairs = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13]]) == 6\n assert candidate(pairs = [[-10, -1], [-9, -8], [-7, -6], [-5, -4], [-3, -2], [-1, 0], [1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == 10\n assert candidate(pairs = [[-10, -9], [-8, -7], [-6, -5], [-4, -3], [-2, -1], [0, 1], [2, 3], [4, 5], [6, 7], [8, 9]]) == 10\n assert candidate(pairs = [[1, 3], [2, 5], [4, 6], [5, 8], [6, 10], [7, 12]]) == 3\n assert candidate(pairs = [[-1, 1], [-2, 2], [-3, 3], [-4, 4], [-5, 5], [-6, 6], [-7, 7], [-8, 8], [-9, 9], [-10, 10], [-11, 11], [-12, 12], [-13, 13], [-14, 14], [-15, 15], [-16, 16], [-17, 17], [-18, 18], [-19, 19], [-20, 20]]) == 1\n assert candidate(pairs = [[-500, -250], [-250, 0], [0, 250], [250, 500], [500, 750], [750, 1000], [-499, -249], [-249, 1], [1, 251], [251, 501]]) == 4\n assert candidate(pairs = [[-50, -49], [-48, -47], [-46, -45], [-44, -43], [-42, -41], [-40, -39], [-38, -37], [-36, -35], [-34, -33], [-32, -31], [-30, -29], [-28, -27], [-26, -25], [-24, -23], [-22, -21], [-20, -19], [-18, -17], [-16, -15], [-14, -13], [-12, -11], [-10, -9], [-8, -7], [-6, -5], [-4, -3], [-2, -1], [0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19], [20, 21], [22, 23], [24, 25], [26, 27], [28, 29], [30, 31], [32, 33], [34, 35], [36, 37], [38, 39], [40, 41], [42, 43], [44, 45], [46, 47], [48, 49]]) == 50\n assert candidate(pairs = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11]]) == 5\n assert candidate(pairs = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]]) == 10\n assert candidate(pairs = [[1, 10], [11, 20], [21, 30], [12, 29], [13, 28], [14, 27], [15, 26], [16, 25], [17, 24], [18, 23], [19, 22], [20, 21]]) == 3\n assert candidate(pairs = [[-1000, -999], [-999, -998], [-998, -997], [-997, -996], [-996, -995], [-995, -994], [-994, -993], [-993, -992], [-992, -991], [-991, -990]]) == 5\n assert candidate(pairs = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 16], [15, 17], [16, 18], [17, 19], [18, 20], [19, 21], [20, 22]]) == 7\n assert candidate(pairs = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [11, 20], [12, 19], [13, 18], [14, 17], [15, 16]]) == 2\n assert candidate(pairs = [[1, 2], [3, 5], [4, 7], [6, 9], [8, 11], [10, 13], [12, 15]]) == 4\n assert candidate(pairs = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [21, 22], [23, 24], [25, 26], [27, 28], [29, 30], [31, 32], [33, 34], [35, 36], [37, 38], [39, 40], [41, 42], [43, 44], [45, 46], [47, 48], [49, 50]]) == 25\n assert candidate(pairs = [[-100, -90], [-95, -85], [-80, -70], [-75, -65], [-60, -50], [-55, -45], [-40, -30], [-35, -25], [-20, -10], [-15, -5]]) == 5\n assert candidate(pairs = [[1, 2], [3, 10], [4, 6], [6, 9], [8, 12], [10, 15], [13, 18], [16, 20]]) == 4\n assert candidate(pairs = [[-5, -3], [-2, -1], [0, 2], [3, 5], [6, 8]]) == 5\n assert candidate(pairs = [[-500, -200], [-300, -100], [-250, -50], [-200, 0], [-150, 50], [-100, 100], [-50, 150], [0, 200], [50, 250], [100, 300]]) == 3\n assert candidate(pairs = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1]]) == 5\n assert candidate(pairs = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 10\n assert candidate(pairs = [[-10, 10], [-9, 9], [-8, 8], [-7, 7], [-6, 6], [-5, 5], [-4, 4], [-3, 3], [-2, 2], [-1, 1]]) == 1\n assert candidate(pairs = [[1, 3], [2, 5], [4, 7], [5, 8], [6, 9], [7, 10], [8, 11], [9, 12], [10, 13], [11, 14]]) == 3\n assert candidate(pairs = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 16], [15, 17]]) == 5\n assert candidate(pairs = [[1, 5], [5, 10], [10, 15], [15, 20], [20, 25], [1, 25], [2, 26], [3, 27], [4, 28], [5, 29]]) == 3\n assert candidate(pairs = [[1, 100], [2, 99], [3, 98], [4, 97], [5, 96], [6, 95], [7, 94], [8, 93], [9, 92], [10, 91]]) == 1\n assert candidate(pairs = [[-10, -5], [-6, -2], [-3, -1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6]]) == 4\n assert candidate(pairs = [[-1000, -999], [-998, -997], [-996, -995], [-994, -993], [-992, -991], [-990, -989], [-988, -987], [-986, -985]]) == 8\n assert candidate(pairs = [[1, 100], [50, 150], [100, 200], [150, 250], [200, 300], [250, 350], [300, 400], [350, 450], [400, 500], [450, 550]]) == 4\n assert candidate(pairs = [[-5, -3], [-4, -2], [-3, -1], [-2, 0], [-1, 1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8]]) == 4\n assert candidate(pairs = [[-10, -5], [-4, -2], [0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11]]) == 8\n assert candidate(pairs = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1]]) == 5\n assert candidate(pairs = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [11, 20], [12, 19], [13, 18], [14, 17], [15, 16]]) == 2\n assert candidate(pairs = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [1, 11], [2, 12], [3, 13], [4, 14], [5, 15]]) == 5\n assert candidate(pairs = [[-10, -1], [-5, -2], [-3, 0], [0, 3], [2, 5], [4, 7], [6, 9], [8, 10]]) == 4\n assert candidate(pairs = [[-100, -50], [-75, -25], [-50, -10], [-25, 10], [0, 20], [10, 30], [20, 40], [30, 50], [40, 60], [50, 70]]) == 4\n assert candidate(pairs = [[-5, 0], [-3, -1], [0, 5], [2, 4], [3, 7], [5, 9]]) == 3\n assert candidate(pairs = [[-50, 0], [-40, 10], [-30, 20], [-20, 30], [-10, 40], [0, 50], [10, 60], [20, 70], [30, 80], [40, 90]]) == 2\n assert candidate(pairs = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15]]) == 5\n"}, "metadata": {"canonical_parameter_names": ["pairs"], "leetcode_dataset_entry_point": "Solution().findLongestChain", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findLongestChain = function(pairs) {", "container": null, "callable": "findLongestChain", "parameters": [{"name": "pairs", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 647, "task_id": "palindromic-substrings", "difficulty": "Medium", "problem_description": "Given a string s, return the number of palindromic substrings in it.\nA string is a palindrome when it reads the same backward as forward.\nA substring is a contiguous sequence of characters within the string.\n \nExample 1:\n\nInput: s = \"abc\"\nOutput: 3\nExplanation: Three palindromic strings: \"a\", \"b\", \"c\".\n\nExample 2:\n\nInput: s = \"aaa\"\nOutput: 6\nExplanation: Six palindromic strings: \"a\", \"a\", \"a\", \"aa\", \"aa\", \"aaa\".\n\n \nConstraints:\n\n1 <= s.length <= 1000\ns consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"abba\") == 6\n assert candidate(s = \"aaaaa\") == 15\n assert candidate(s = \"babad\") == 7\n assert candidate(s = \"noon\") == 6\n assert candidate(s = \"banana\") == 10\n assert candidate(s = \"aabbbaa\") == 14\n assert candidate(s = \"abc\") == 3\n assert candidate(s = \"level\") == 7\n assert candidate(s = \"\") == 0\n assert candidate(s = \"aaa\") == 6\n assert candidate(s = \"civic\") == 7\n assert candidate(s = \"rotor\") == 7\n assert candidate(s = \"racecar\") == 10\n assert candidate(s = \"a\") == 1\n assert candidate(s = \"abcdefg\") == 7\n assert candidate(s = \"zxcvbnmmlkjhgfdsapoiuytrewq\") == 28\n assert candidate(s = \"abcbaabccbaabcba\") == 34\n assert candidate(s = \"amoreinimorac\") == 14\n assert candidate(s = \"atoyota\") == 10\n assert candidate(s = \"aabbcccbbbaa\") == 23\n assert candidate(s = \"abccbaabcbaabc\") == 28\n assert candidate(s = \"rotorrotor\") == 19\n assert candidate(s = \"abracadabra\") == 13\n assert candidate(s = \"levelmadam\") == 14\n assert candidate(s = \"ab\") == 2\n assert candidate(s = \"steponnopets\") == 18\n assert candidate(s = \"noonnoon\") == 16\n assert candidate(s = \"aaaaabbbb\") == 25\n assert candidate(s = \"aaaaaaaaaa\") == 55\n assert candidate(s = \"abcddcbaabcddcba\") == 32\n assert candidate(s = \"racecarracecarracecarracecar\") == 82\n assert candidate(s = \"madaminnadammadam\") == 27\n assert candidate(s = \"xyxzyzyzyxzyzyxzyzyxzyx\") == 34\n assert candidate(s = \"noonabnoon\") == 14\n assert candidate(s = \"bbaabbccddeebbaabbccddee\") == 40\n assert candidate(s = \"qwertyuiopoiuytrewq\") == 28\n assert candidate(s = \"abccbaabccba\") == 24\n assert candidate(s = \"aba\") == 4\n assert candidate(s = \"xyzyzyzyzyzyzyzy\") == 65\n assert candidate(s = \"abacbacbacbacba\") == 16\n assert candidate(s = \"noonnoonnoonnoon\") == 48\n assert candidate(s = \"aabbccddeee\") == 18\n assert candidate(s = \"abacaba\") == 12\n assert candidate(s = \"madamracecar\") == 17\n assert candidate(s = \"rotorcarrot\") == 14\n assert candidate(s = \"abca\") == 4\n assert candidate(s = \"aabbcccbbbbaaa\") == 30\n assert candidate(s = \"aabbccddeeeeeddccbbaa\") == 47\n assert candidate(s = \"aaaaaabbbb\") == 31\n assert candidate(s = \"aabbabaabbaa\") == 23\n assert candidate(s = \"abcba\") == 7\n assert candidate(s = \"abcdcba\") == 10\n assert candidate(s = \"xyzzyxzyxzyzyxzyz\") == 23\n assert candidate(s = \"madaminnakayak\") == 20\n assert candidate(s = \"abccbaabccbaabccba\") == 45\n assert candidate(s = \"aabbccccbbaa\") == 26\n assert candidate(s = \"rotorcentralrotor\") == 21\n assert candidate(s = \"racecarracecarracecar\") == 51\n assert candidate(s = \"aabbbaaabbbaaa\") == 37\n assert candidate(s = \"xxyyyxyxx\") == 17\n assert candidate(s = \"aabbccddeeefffggghhhh\") == 40\n assert candidate(s = \"abacdfgdcabaabacdfgdcaba\") == 33\n assert candidate(s = \"racecarbanana\") == 20\n assert candidate(s = \"levelup\") == 9\n assert candidate(s = \"abcdeedcba\") == 15\n assert candidate(s = \"deeee\") == 11\n assert candidate(s = \"abaaabaaab\") == 24\n assert candidate(s = \"abbaabbaba\") == 20\n assert candidate(s = \"abcbaabcbaabcbaabcba\") == 58\n assert candidate(s = \"bcbcbcbcbcbcbc\") == 56\n assert candidate(s = \"abaaabbaaabaaa\") == 35\n assert candidate(s = \"abcababcababc\") == 17\n assert candidate(s = \"levellevel\") == 19\n assert candidate(s = \"abcdefedcba\") == 16\n assert candidate(s = \"abcdefgfedcbafedcbagfedcbafedcbagfedcba\") == 45\n assert candidate(s = \"acdcacdcacdc\") == 27\n assert candidate(s = \"zxcvbnmmnbvcxz\") == 21\n assert candidate(s = \"thisisnotapalindrome\") == 23\n assert candidate(s = \"abbaeae\") == 11\n assert candidate(s = \"aaaaaaa\") == 28\n assert candidate(s = \"levellevellevel\") == 36\n assert candidate(s = \"abcdcbaabcdcba\") == 27\n assert candidate(s = \"abccbaabc\") == 15\n assert candidate(s = \"xyzyzyxzyzyzyx\") == 25\n assert candidate(s = \"abacdfgdcabaabacdfgdcabaabacdfgdcaba\") == 52\n assert candidate(s = \"leveloneeleven\") == 19\n assert candidate(s = \"babcbabcba\") == 20\n assert candidate(s = \"zyzzyzzyzyzy\") == 29\n assert candidate(s = \"abababa\") == 16\n assert candidate(s = \"xyxzyxyzyx\") == 15\n assert candidate(s = \"abacabadabacaba\") == 32\n assert candidate(s = \"civicciviccivicciviccivic\") == 85\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzz\") == 210\n assert candidate(s = \"abcbaba\") == 11\n assert candidate(s = \"abcbabcba\") == 17\n assert candidate(s = \"deifiedrotor\") == 17\n assert candidate(s = \"noonracecarrace\") == 24\n assert candidate(s = \"civiccivic\") == 19\n assert candidate(s = \"aabbccddeeffgg\") == 21\n assert candidate(s = \"abccba\") == 9\n assert candidate(s = \"aabbccddeeff\") == 18\n assert candidate(s = \"madamimadam\") == 20\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == 78\n assert candidate(s = \"racecarannakayak\") == 25\n assert candidate(s = \"amanaplanacanalpanama\") == 37\n assert candidate(s = \"abbabababa\") == 24\n assert candidate(s = \"abcdefgfeijklmmlkjihgf\") == 29\n assert candidate(s = \"racecarracecar\") == 27\n assert candidate(s = \"noonnoonnoon\") == 30\n assert candidate(s = \"deified\") == 10\n assert candidate(s = \"bcbcbcbcb\") == 25\n assert candidate(s = \"abcdef\") == 6\n assert candidate(s = \"rotorrotorrotor\") == 36\n assert candidate(s = \"abcdedcba\") == 13\n assert candidate(s = \"noonhighnoon\") == 16\n assert candidate(s = \"abcbaabcbaabcba\") == 36\n assert candidate(s = \"rotorrotorrotorrotor\") == 58\n assert candidate(s = \"abacdfgdcaba\") == 14\n assert candidate(s = \"abbaabba\") == 16\n assert candidate(s = \"ababababab\") == 30\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzzzzzzzzz\") == 141\n assert candidate(s = \"abcddcba\") == 12\n assert candidate(s = \"aaaaabaaa\") == 25\n assert candidate(s = \"abcdefghihgfedcba\") == 25\n assert candidate(s = \"xyzyxzyzyx\") == 14\n assert candidate(s = \"xyxxyxyxxyxyxyx\") == 40\n assert candidate(s = \"xyzzzyzx\") == 13\n assert candidate(s = \"abcdefgfedcbafedcbagfedcba\") == 32\n assert candidate(s = \"aabbccddeeaabbccddee\") == 30\n assert candidate(s = \"abacdfgdcababa\") == 19\n assert candidate(s = \"civicciviccivic\") == 36\n assert candidate(s = \"aabbcc\") == 9\n assert candidate(s = \"mississippi\") == 20\n assert candidate(s = \"xyzyxyzyx\") == 17\n assert candidate(s = \"abbababaabbaba\") == 28\n assert candidate(s = \"xyxzyzyxzyzyzyxzyxzyzyzyxzyzyzyzyx\") == 61\n assert candidate(s = \"forgeeksskeegfor\") == 23\n assert candidate(s = \"bananaabababa\") == 27\n assert candidate(s = \"abcbba\") == 8\n assert candidate(s = \"zzzzzzzzzzz\") == 66\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().countSubstrings", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var countSubstrings = function(s) {", "container": null, "callable": "countSubstrings", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 648, "task_id": "replace-words", "difficulty": "Medium", "problem_description": "In English, we have a concept called root, which can be followed by some other word to form another longer word - let's call this word derivative. For example, when the root \"help\" is followed by the word \"ful\", we can form a derivative \"helpful\".\nGiven a dictionary consisting of many roots and a sentence consisting of words separated by spaces, replace all the derivatives in the sentence with the root forming it. If a derivative can be replaced by more than one root, replace it with the root that has the shortest length.\nReturn the sentence after the replacement.\n \nExample 1:\n\nInput: dictionary = [\"cat\",\"bat\",\"rat\"], sentence = \"the cattle was rattled by the battery\"\nOutput: \"the cat was rat by the bat\"\n\nExample 2:\n\nInput: dictionary = [\"a\",\"b\",\"c\"], sentence = \"aadsfasf absbs bbab cadsfafs\"\nOutput: \"a a b c\"\n\n \nConstraints:\n\n1 <= dictionary.length <= 1000\n1 <= dictionary[i].length <= 100\ndictionary[i] consists of only lower-case letters.\n1 <= sentence.length <= 106\nsentence consists of only lower-case letters and spaces.\nThe number of words in sentence is in the range [1, 1000]\nThe length of each word in sentence is in the range [1, 1000]\nEvery two consecutive words in sentence will be separated by exactly one space.\nsentence does not have leading or trailing spaces.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(dictionary = ['a', 'aa', 'aaa'],sentence = \"aaaa aaa aa a\") == \"a a a a\"\n assert candidate(dictionary = ['base', 'bat', 'ba'],sentence = \"baseball batman bat\") == \"ba ba ba\"\n assert candidate(dictionary = ['dog', 'cat'],sentence = \"dog cat\") == \"dog cat\"\n assert candidate(dictionary = ['hello', 'hell', 'he', 'h'],sentence = \"hello hello hello\") == \"h h h\"\n assert candidate(dictionary = ['base', 'bat'],sentence = \"baseball bat\") == \"base bat\"\n assert candidate(dictionary = ['appl', 'app', 'ap'],sentence = \"apple apples applying apply\") == \"ap ap ap ap\"\n assert candidate(dictionary = ['dog', 'cat'],sentence = \"cattledog\") == \"cat\"\n assert candidate(dictionary = ['hello'],sentence = \"hellonow\") == \"hello\"\n assert candidate(dictionary = ['dog', 'cat'],sentence = \"thecatwasadog\") == \"thecatwasadog\"\n assert candidate(dictionary = ['a', 'b', 'c'],sentence = \"aadsfasf absbs bbab cadsfafs\") == \"a a b c\"\n assert candidate(dictionary = ['car', 'card', 'care', 'cared'],sentence = \"car card care cared carding careds\") == \"car car car car car car\"\n assert candidate(dictionary = ['hello', 'hell', 'he'],sentence = \"hello there helpful helper\") == \"he there he he\"\n assert candidate(dictionary = ['zebra', 'dog'],sentence = \"dog zebra zoo\") == \"dog zebra zoo\"\n assert candidate(dictionary = ['base', 'bas', 'ba'],sentence = \"baseball basebasket baskeyball\") == \"ba ba ba\"\n assert candidate(dictionary = ['dog', 'cat'],sentence = \"caterpillar catalog dogmatic\") == \"cat cat dog\"\n assert candidate(dictionary = ['apple', 'app', 'ap'],sentence = \"apple app ap appleapp appapple\") == \"ap ap ap ap ap\"\n assert candidate(dictionary = ['hi', 'him', 'himself'],sentence = \"himself\") == \"hi\"\n assert candidate(dictionary = ['go', 'gone'],sentence = \"go going gone\") == \"go go go\"\n assert candidate(dictionary = ['quick', 'qui', 'q'],sentence = \"quick quietly quicking quiquick\") == \"q q q q\"\n assert candidate(dictionary = ['sun', 'sungod'],sentence = \"sunshine sungod solar system\") == \"sun sun solar system\"\n assert candidate(dictionary = ['hello', 'hell', 'he'],sentence = \"hello world hellish heaven\") == \"he world he he\"\n assert candidate(dictionary = ['a', 'aa', 'aaa'],sentence = \"aa aaa\") == \"a a\"\n assert candidate(dictionary = ['hello', 'hell', 'he'],sentence = \"hello hell\") == \"he he\"\n assert candidate(dictionary = ['c', 'cc'],sentence = \"c cc ccc cccc\") == \"c c c c\"\n assert candidate(dictionary = ['car', 'cat'],sentence = \"carmodel carshow cat\") == \"car car cat\"\n assert candidate(dictionary = ['baseball', 'bat', 'ba'],sentence = \"baseball bat ball baseball bat\") == \"ba ba ba ba ba\"\n assert candidate(dictionary = ['do', 'don', 'donate', 'donation'],sentence = \"donation do donate don\") == \"do do do do\"\n assert candidate(dictionary = ['tree', 'trie', 'tr'],sentence = \"the tree is an evergreen tree\") == \"the tr is an evergreen tr\"\n assert candidate(dictionary = ['a'],sentence = \"a aa aaa aaaa aaaaa\") == \"a a a a a\"\n assert candidate(dictionary = ['him', 'himm'],sentence = \"him\") == \"him\"\n assert candidate(dictionary = ['rat', 'cat', 'bat'],sentence = \"rat cat bat ratcatbat\") == \"rat cat bat rat\"\n assert candidate(dictionary = ['cat', 'bat', 'rat'],sentence = \"the cattle was rattled by the battery\") == \"the cat was rat by the bat\"\n assert candidate(dictionary = ['go', 'gone', 'going'],sentence = \"go going gone\") == \"go go go\"\n assert candidate(dictionary = ['go', 'gone', 'going'],sentence = \"going gone go\") == \"go go go\"\n assert candidate(dictionary = ['hi', 'him', 'hii'],sentence = \"him hii\") == \"hi hi\"\n assert candidate(dictionary = ['a', 'aa', 'aaa'],sentence = \"aa aaa aaaa\") == \"a a a\"\n assert candidate(dictionary = ['quest', 'questi', 'questio', 'questioo'],sentence = \"question questioo quest questio\") == \"quest quest quest quest\"\n assert candidate(dictionary = ['auto', 'automotive', 'automatic', 'autograph', 'automobile'],sentence = \"automobile automatic auto autograph automotive\") == \"auto auto auto auto auto\"\n assert candidate(dictionary = ['micro', 'mic', 'mi', 'm'],sentence = \"microscopic microscopic microscopy micro\") == \"m m m m\"\n assert candidate(dictionary = ['ab', 'abc', 'abcd', 'abcde'],sentence = \"ab abc abcd abcde abcdef\") == \"ab ab ab ab ab\"\n assert candidate(dictionary = ['in', 'int', 'inte', 'inter', 'intera', 'interac', 'interact', 'interactiv', 'interactive', 'interactivit'],sentence = \"interactive interact interactivit interactiv interac inter inte int in\") == \"in in in in in in in in in\"\n assert candidate(dictionary = ['eco', 'ec', 'e'],sentence = \"ecological ecofriendly ecosphere eco\") == \"e e e e\"\n assert candidate(dictionary = ['test', 'testing', 'tested'],sentence = \"testing tested test testable\") == \"test test test test\"\n assert candidate(dictionary = ['tech', 'techi', 'techno', 'technol', 'technolog'],sentence = \"technology technological technologist technologic\") == \"tech tech tech tech\"\n assert candidate(dictionary = ['trans', 'tran', 'tr', 't'],sentence = \"transmission transfer transmigration transmit\") == \"t t t t\"\n assert candidate(dictionary = ['quick', 'qui', 'qu', 'q'],sentence = \"quickly quitting qu quack quest\") == \"q q q q q\"\n assert candidate(dictionary = ['pro', 'progr', 'progra', 'progran', 'program', 'programm', 'programmi', 'programmin', 'programming'],sentence = \"programming programmatic programmer\") == \"pro pro pro\"\n assert candidate(dictionary = ['complex', 'comple', 'complx', 'compl', 'com'],sentence = \"complex comple complx compl com\") == \"com com com com com\"\n assert candidate(dictionary = ['hyper', 'hyp', 'hy', 'h'],sentence = \"hyperactive hyperbole hypercritical hyper\") == \"h h h h\"\n assert candidate(dictionary = ['app', 'appl', 'apple', 'applet'],sentence = \"apples apple applet application apparatus\") == \"app app app app app\"\n assert candidate(dictionary = ['micro', 'microwave', 'microchip', 'microphone', 'microscope'],sentence = \"microchip microphone microscope microwave\") == \"micro micro micro micro\"\n assert candidate(dictionary = ['pre', 'pres', 'presi', 'presid', 'preside'],sentence = \"presidential presidency preside presides president\") == \"pre pre pre pre pre\"\n assert candidate(dictionary = ['aardvark', 'aard', 'aardva', 'aardvar'],sentence = \"aardvark aard aardva aardvar aardvarcoal\") == \"aard aard aard aard aard\"\n assert candidate(dictionary = ['con', 'cons', 'consc', 'consci', 'conscio', 'consciou', 'conscious'],sentence = \"conscious conscience consciousless consciously\") == \"con con con con\"\n assert candidate(dictionary = ['tech', 'te', 'techno', 'television', 'techology'],sentence = \"technology television tech techology\") == \"te te te te\"\n assert candidate(dictionary = ['micro', 'microb', 'microbi', 'microbia', 'microbian', 'microbiana'],sentence = \"microbial microbials microbially\") == \"micro micro micro\"\n assert candidate(dictionary = ['fast', 'faster', 'fastest'],sentence = \"he runs fast but his friend runs faster and is the fastest\") == \"he runs fast but his friend runs fast and is the fast\"\n assert candidate(dictionary = ['pre', 'pres', 'presi', 'presid'],sentence = \"presidency president preside preside\") == \"pre pre pre pre\"\n assert candidate(dictionary = ['re', 'replay', 'rewrite', 'remark', 'remarkable'],sentence = \"after rewriting the script he gave a remarkable replay of his remarkable performance\") == \"after re the script he gave a re re of his re performance\"\n assert candidate(dictionary = ['macro', 'mac', 'ma', 'm'],sentence = \"macroeconomic macroeconomics macroscopic macro\") == \"m m m m\"\n assert candidate(dictionary = ['multi', 'mult', 'mul', 'mu'],sentence = \"multi mult mul mu\") == \"mu mu mu mu\"\n assert candidate(dictionary = ['qu', 'qui', 'quic', 'quick', 'quicks', 'quickly'],sentence = \"quick quicks quickness quickly quicker quickening\") == \"qu qu qu qu qu qu\"\n assert candidate(dictionary = ['photo', 'phot', 'photog', 'photogr'],sentence = \"photography photographer photograph photogenic\") == \"phot phot phot phot\"\n assert candidate(dictionary = ['tiny', 'tin', 'tinny'],sentence = \"tin tinny tiny tinnytin\") == \"tin tin tin tin\"\n assert candidate(dictionary = ['th', 'the', 'ther', 'therm', 'thermal'],sentence = \"thermal the thermals thermalize thermalization\") == \"th th th th th\"\n assert candidate(dictionary = ['un', 'un', 'un', 'un', 'un'],sentence = \"united unification uncomfortable underway undone\") == \"un un un un un\"\n assert candidate(dictionary = ['incredible', 'inc', 'incr', 'incredi', 'incredi', 'incredib'],sentence = \"incredible incr incredible incredi incredi incredib\") == \"inc inc inc inc inc inc\"\n assert candidate(dictionary = ['auto', 'autom', 'automobi', 'automobil', 'automobile', 'automobiles'],sentence = \"automobile automobile's\") == \"auto auto\"\n assert candidate(dictionary = ['pre', 'prefix', 'preprocessing', 'preprocessor'],sentence = \"preprocessing the prefix of a string using a preprocessor\") == \"pre the pre of a string using a pre\"\n assert candidate(dictionary = ['fast', 'faster', 'fastest'],sentence = \"fastest fast fasterr fastestest\") == \"fast fast fast fast\"\n assert candidate(dictionary = ['co', 'con', 'cons', 'const', 'consti', 'constit', 'constitu', 'constitue'],sentence = \"constituent constituents constitution constitutionalize constitutional\") == \"co co co co co\"\n assert candidate(dictionary = ['quick', 'qui', 'quit'],sentence = \"the quick brown fox quit quietly\") == \"the qui brown fox qui qui\"\n assert candidate(dictionary = ['inter', 'in', 'interac', 'interact'],sentence = \"interaction interactive intercept intercepting\") == \"in in in in\"\n assert candidate(dictionary = ['pre', 'prel', 'preli', 'prelim', 'prelimi', 'prelimin', 'prelimina', 'preliminar', 'preliminary'],sentence = \"preliminary preliminarys\") == \"pre pre\"\n assert candidate(dictionary = ['hello', 'hell', 'he', 'h'],sentence = \"hello helpful hercules\") == \"h h h\"\n assert candidate(dictionary = ['base', 'basic', 'basics', 'basis'],sentence = \"baseline base basic basics basis basket\") == \"base base basic basic basis basket\"\n assert candidate(dictionary = ['micro', 'microscope', 'microprocessor', 'microphone'],sentence = \"microscopy microprocessor microphone microscopic micro\") == \"micro micro micro micro micro\"\n assert candidate(dictionary = ['auto', 'autom', 'automat', 'automate', 'automation'],sentence = \"automotive automation automated automobile automatic\") == \"auto auto auto auto auto\"\n assert candidate(dictionary = ['graph', 'graphic', 'graphite', 'graphing', 'graphology'],sentence = \"graphology graphite graph graphic graphing\") == \"graph graph graph graph graph\"\n assert candidate(dictionary = ['cat', 'ca', 'bat', 'ba', 'rat'],sentence = \"the cattle was rattled by the battery\") == \"the ca was rat by the ba\"\n assert candidate(dictionary = ['ca', 'cat', 'catt', 'cattl', 'cattle'],sentence = \"cattle cattleshed\") == \"ca ca\"\n assert candidate(dictionary = ['pro', 'prom', 'promo'],sentence = \"promotional promising programmer promote\") == \"pro pro pro pro\"\n assert candidate(dictionary = ['a', 'aa', 'aaa', 'aaaa'],sentence = \"aaaaaaaaa abababab abab aa\") == \"a a a a\"\n assert candidate(dictionary = ['throne', 'thr', 'th'],sentence = \"throne thrilled thrush thorn thieves\") == \"th th th th th\"\n assert candidate(dictionary = ['bat', 'banana', 'band', 'bandana', 'bandwidth'],sentence = \"bandanna batman band bandana bandwidth\") == \"band bat band band band\"\n assert candidate(dictionary = ['super', 'superman', 'superhero', 'supervillain'],sentence = \"superman is a superhero but lex luthor is a supervillain\") == \"super is a super but lex luthor is a super\"\n assert candidate(dictionary = ['in', 'inn', 'inne', 'inner'],sentence = \"inner inne inn in\") == \"in in in in\"\n assert candidate(dictionary = ['superduper', 'super', 'superdup', 'superdu', 'superdupera'],sentence = \"superduper super superdup superdu superdupera\") == \"super super super super super\"\n assert candidate(dictionary = ['tr', 'tre', 'tree', 'treet', 'treeto'],sentence = \"tree treehouse treelike treetops\") == \"tr tr tr tr\"\n assert candidate(dictionary = ['sun', 'sunny', 'sunshine', 'sunbeam'],sentence = \"sunset sunny sunshine sunbeam\") == \"sun sun sun sun\"\n assert candidate(dictionary = ['nano', 'nanop', 'nanopo', 'nanopol', 'nanopoli', 'nanopolym', 'nanopolyme', 'nanopolymers'],sentence = \"nanopolymers nanoparticle nanoparticle's nanoparticle\") == \"nano nano nano nano\"\n assert candidate(dictionary = ['a', 'ab', 'abc', 'abcd'],sentence = \"abcd abc abc ab a\") == \"a a a a a\"\n assert candidate(dictionary = ['micro', 'microwave', 'microscope'],sentence = \"microscopy microwave microprocessor micro\") == \"micro micro micro micro\"\n assert candidate(dictionary = ['b', 'be', 'bee', 'been', 'beef'],sentence = \"beef bee been before being beefy\") == \"b b b b b b\"\n assert candidate(dictionary = ['rat', 'ratt', 'ratta', 'rattle'],sentence = \"rattling rattlesnake rattan ratter\") == \"rat rat rat rat\"\n assert candidate(dictionary = ['inter', 'inte', 'int', 'in', 'i'],sentence = \"inter integration interim interfere interfere\") == \"i i i i i\"\n assert candidate(dictionary = ['pre', 'prefix', 'preference', 'presume', 'presumably'],sentence = \"prefer prefix presumption presumably\") == \"pre pre pre pre\"\n assert candidate(dictionary = ['small', 'smal', 'sma', 'sm'],sentence = \"smaller small smallness sm\") == \"sm sm sm sm\"\n assert candidate(dictionary = ['nano', 'nanob', 'nanobo', 'nanobio', 'nanobiol', 'nanobiolo', 'nanobiolog', 'nanobiologi', 'nanobiologic', 'nanobiological'],sentence = \"nanobiological nanobiologicals\") == \"nano nano\"\n assert candidate(dictionary = ['over', 'overly', 'overall'],sentence = \"he was overly critical of the overall performance\") == \"he was over critical of the over performance\"\n assert candidate(dictionary = ['auto', 'autom', 'automat', 'automate'],sentence = \"automatic automobile automate automaton\") == \"auto auto auto auto\"\n assert candidate(dictionary = ['super', 'supera', 'superb', 'superba', 'superba', 'superba', 'superba'],sentence = \"superb superlative superabound superbest superbowl\") == \"super super super super super\"\n assert candidate(dictionary = ['a', 'an', 'and', 'ands'],sentence = \"and ands anding anderson\") == \"a a a a\"\n assert candidate(dictionary = ['elephant', 'ele', 'eleph', 'elepha', 'elephantastic'],sentence = \"elephant elephants eleph elepha elephantastic\") == \"ele ele ele ele ele\"\n assert candidate(dictionary = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg'],sentence = \"abcdefghi abcdefghij\") == \"a a\"\n assert candidate(dictionary = ['pro', 'pre', 'pros', 'pres', 'presi', 'presid'],sentence = \"president proportional prefix pseudoprefix preprocess\") == \"pre pro pre pseudoprefix pre\"\n assert candidate(dictionary = ['a', 'ab', 'abc', 'abcd', 'abcde'],sentence = \"abcdefgh abcdefg abcdef abcde abcd abc ab a\") == \"a a a a a a a a\"\n assert candidate(dictionary = ['edu', 'educ', 'educc', 'educat', 'educati', 'educatio', 'education'],sentence = \"educational education educations\") == \"edu edu edu\"\n assert candidate(dictionary = ['car', 'cart', 'card', 'cartographer'],sentence = \"car cartography card catalog carter\") == \"car car car catalog car\"\n assert candidate(dictionary = ['inter', 'in', 'i'],sentence = \"international intergalactic interconnected inter\") == \"i i i i\"\n assert candidate(dictionary = ['big', 'bigger', 'biggest'],sentence = \"bigger biggerest big biggger\") == \"big big big big\"\n assert candidate(dictionary = ['hello', 'hell', 'he', 'h'],sentence = \"hello hellish helper high heels\") == \"h h h h h\"\n assert candidate(dictionary = ['in', 'inside', 'into', 'input', 'insert'],sentence = \"he went inside the building and then into the room to insert an input\") == \"he went in the building and then in the room to in an in\"\n assert candidate(dictionary = ['bat', 'ba', 'batt'],sentence = \"battery batten batted\") == \"ba ba ba\"\n assert candidate(dictionary = ['prefix', 'prefixe', 'prefixes'],sentence = \"prefix prefixer prefixest prefixes\") == \"prefix prefix prefix prefix\"\n assert candidate(dictionary = ['micro', 'micr', 'micros', 'microso', 'microsof', 'microsoft'],sentence = \"microsoft microsofts microsof microso micros micr micro\") == \"micr micr micr micr micr micr micr\"\n assert candidate(dictionary = ['hello', 'hell', 'he', 'h'],sentence = \"hello hell he h\") == \"h h h h\"\n assert candidate(dictionary = ['geo', 'ge', 'g'],sentence = \"geography geological geomorphology geo\") == \"g g g g\"\n assert candidate(dictionary = ['quick', 'qui', 'quic'],sentence = \"quick quicky quic quickness\") == \"qui qui qui qui\"\n assert candidate(dictionary = ['mi', 'min', 'mine', 'minera', 'mineral', 'minerals'],sentence = \"minerals mineral mining mine\") == \"mi mi mi mi\"\n assert candidate(dictionary = ['re', 'rep', 'repl', 'repla'],sentence = \"replace replacement replacer replacable\") == \"re re re re\"\n assert candidate(dictionary = ['algorithm', 'algo', 'algori', 'algorit'],sentence = \"algorithm algorithms algo algori algorit\") == \"algo algo algo algo algo\"\n assert candidate(dictionary = ['un', 'unp', 'unpr', 'unpre'],sentence = \"unpredictable unpre un unpr\") == \"un un un un\"\n assert candidate(dictionary = ['hel', 'help', 'helpl'],sentence = \"helpful helpline helpless helper\") == \"hel hel hel hel\"\n assert candidate(dictionary = ['fast', 'faster', 'fastest'],sentence = \"fast fasters fastest\") == \"fast fast fast\"\n assert candidate(dictionary = ['sub', 'suba', 'subac', 'subact', 'subacti', 'subacti', 'subacti'],sentence = \"subact subact subact subactive subacted\") == \"sub sub sub sub sub\"\n assert candidate(dictionary = ['inter', 'intera', 'interac', 'interact', 'interacti', 'interacti', 'interacti'],sentence = \"interactive interact interaction intersect\") == \"inter inter inter inter\"\n assert candidate(dictionary = ['supercalifragilisticexpialidocious', 'supercalifragilisticexpi', 'supercali', 'super'],sentence = \"supercalifragilisticexpialidocious supercalifragilisticexpi supercali super\") == \"super super super super\"\n assert candidate(dictionary = ['root', 'rooting', 'roots', 'rooted'],sentence = \"rooting is a fundamental concept rooted in the roots of understanding\") == \"root is a fundamental concept root in the root of understanding\"\n assert candidate(dictionary = ['ba', 'bat', 'batt', 'batte', 'battea'],sentence = \"batman battled batted battle batt\") == \"ba ba ba ba ba\"\n assert candidate(dictionary = ['boundary', 'bound', 'bounda', 'boundar'],sentence = \"boundary boundaries bound bounda boundar\") == \"bound bound bound bound bound\"\n assert candidate(dictionary = ['tele', 'telev', 'telec', 'tel'],sentence = \"telephone telegraph telecommunication tele\") == \"tel tel tel tel\"\n assert candidate(dictionary = ['super', 'su', 's'],sentence = \"superhero superpower supernatural super\") == \"s s s s\"\n assert candidate(dictionary = ['tr', 'try', 'trie', 'tried'],sentence = \"trier tries trying triangle\") == \"tr tr tr tr\"\n assert candidate(dictionary = ['progr', 'progra', 'program', 'programm'],sentence = \"program programm programing programmer\") == \"progr progr progr progr\"\n assert candidate(dictionary = ['uni', 'univ', 'unive', 'univer', 'univers', 'universi', 'universit', 'universiti', 'university'],sentence = \"university universities\") == \"uni uni\"\n assert candidate(dictionary = ['ex', 'exa', 'exac', 'exact', 'exactly', 'exactly', 'exactly'],sentence = \"exactly exactly exact exactitude exacter\") == \"ex ex ex ex ex\"\n assert candidate(dictionary = ['rat', 'ratt', 'ratta', 'rattl', 'rattled'],sentence = \"rattled rattler rattlesnake\") == \"rat rat rat\"\n assert candidate(dictionary = ['mo', 'mon', 'mond', 'monde', 'monday'],sentence = \"monday mondo mondaying mondane\") == \"mo mo mo mo\"\n assert candidate(dictionary = ['a', 'ap', 'app', 'appl', 'apple'],sentence = \"apple app application apples\") == \"a a a a\"\n assert candidate(dictionary = ['un', 'uni', 'university', 'universe'],sentence = \"the university is in the universe\") == \"the un is in the un\"\n assert candidate(dictionary = ['a', 'an', 'and', 'andw', 'anda'],sentence = \"and andw anda andanda and wander andwind\") == \"a a a a a wander a\"\n assert candidate(dictionary = ['transformation', 'trans', 'tran', 'transfo', 'transfo', 'transformat', 'transforma', 'transfor'],sentence = \"transformation trans tran transfo transfo transformat transforma transfor\") == \"tran tran tran tran tran tran tran tran\"\n assert candidate(dictionary = ['dis', 'disa', 'disab', 'disabl'],sentence = \"disable disabling disabled disablity\") == \"dis dis dis dis\"\n assert candidate(dictionary = ['hel', 'help', 'helpl', 'helpf', 'helpfu', 'helpful'],sentence = \"helpful helpfulness\") == \"hel hel\"\n assert candidate(dictionary = ['fantastic', 'fant', 'fan', 'fantasy'],sentence = \"fantastic fantasies fanta fantasticastic\") == \"fan fan fan fan\"\n assert candidate(dictionary = ['re', 'rec', 'rece', 'recei', 'receiv', 'receiving'],sentence = \"receiving reception recipient receiver\") == \"re re re re\"\n assert candidate(dictionary = ['prefix', 'pre', 'pref', 'preference'],sentence = \"preference prefix prefixed prefixing\") == \"pre pre pre pre\"\n assert candidate(dictionary = ['a', 'ab', 'abc', 'abcd'],sentence = \"abc abd ab ac abcd\") == \"a a a a a\"\n assert candidate(dictionary = ['hel', 'help', 'helpl'],sentence = \"helpful helpline helps help\") == \"hel hel hel hel\"\n assert candidate(dictionary = ['prefix', 'pre', 'p'],sentence = \"prefix prediction preprint perimeter\") == \"p p p p\"\n assert candidate(dictionary = ['computer', 'com', 'co', 'c'],sentence = \"computer computing compute coherence\") == \"c c c c\"\n assert candidate(dictionary = ['con', 'cons', 'const', 'consti', 'constit'],sentence = \"con constitution constant consistency construct\") == \"con con con con con\"\n assert candidate(dictionary = ['micro', 'microscope', 'microorganism', 'micron'],sentence = \"microscopes are used to see microorganisms which are smaller than a micron\") == \"micro are used to see micro which are smaller than a micro\"\n assert candidate(dictionary = ['bio', 'biol', 'biolo', 'biolog', 'biologica', 'biological', 'biologically'],sentence = \"biological biologically biologicallys\") == \"bio bio bio\"\n assert candidate(dictionary = ['multi', 'multimedia', 'multiply', 'multiplication', 'multiplier'],sentence = \"multiply multiplication multimedia multiplier\") == \"multi multi multi multi\"\n assert candidate(dictionary = ['pro', 'prov', 'provi', 'provii', 'proviii'],sentence = \"providence provision providential\") == \"pro pro pro\"\n assert candidate(dictionary = ['re', 'republic', 'republican', 'reproduce', 'reproduction'],sentence = \"republic republican reproduce reproduction resentful\") == \"re re re re re\"\n assert candidate(dictionary = ['nano', 'nan', 'na', 'n'],sentence = \"nanometer nanotechnology nanobot nan\") == \"n n n n\"\n assert candidate(dictionary = ['hel', 'help', 'hell', 'helper'],sentence = \"helpful helpline helpfulness hellhole\") == \"hel hel hel hel\"\n assert candidate(dictionary = ['re', 'ref', 'refer', 'referen', 'referenc'],sentence = \"reference references referencing referential\") == \"re re re re\"\n assert candidate(dictionary = ['algorithm', 'algo', 'alg', 'a'],sentence = \"algorithm algorithms algorithmic algorithmically\") == \"a a a a\"\n assert candidate(dictionary = ['happy', 'happiness', 'hap', 'happily'],sentence = \"happily living a happy life brings much happiness\") == \"hap living a hap life brings much hap\"\n assert candidate(dictionary = ['ba', 'bat', 'batt', 'batta', 'battery'],sentence = \"batteries battery batty batting battled\") == \"ba ba ba ba ba\"\n assert candidate(dictionary = ['auto', 'automobile', 'automotive'],sentence = \"automobile automotives automatic automation\") == \"auto auto auto auto\"\n assert candidate(dictionary = ['hello', 'hell', 'he'],sentence = \"hello hell h ello he\") == \"he he h ello he\"\n assert candidate(dictionary = ['un', 'unp', 'unpr', 'unpre', 'unprem', 'unpreme', 'unpremier'],sentence = \"unpremier unprepared unpremeditated unpreventable\") == \"un un un un\"\n assert candidate(dictionary = ['nano', 'nanot', 'nanoto', 'nanoton', 'nanotube', 'nanotubes'],sentence = \"nanotube nanotubes\") == \"nano nano\"\n assert candidate(dictionary = ['inter', 'inte', 'int', 'in'],sentence = \"international integrate inter inter\") == \"in in in in\"\n assert candidate(dictionary = ['television', 'tele', 'telegraph', 'telecom'],sentence = \"telegraph telecommunication telescope television tele\") == \"tele tele tele tele tele\"\n assert candidate(dictionary = ['apple', 'app', 'bat', 'ba', 'batman'],sentence = \"apples are batman and batmen\") == \"app are ba and ba\"\n assert candidate(dictionary = ['un', 'uno', 'united'],sentence = \"united nations unification unstoppable\") == \"un nations un un\"\n assert candidate(dictionary = ['xylophone', 'xylo', 'xylop', 'xylopho'],sentence = \"xylophone xylo xylop xylopho xylophonic\") == \"xylo xylo xylo xylo xylo\"\n assert candidate(dictionary = ['com', 'comm', 'comma', 'commaa'],sentence = \"commas comma commaa communicate\") == \"com com com com\"\n assert candidate(dictionary = ['auto', 'autom', 'automat', 'automati', 'automati', 'automatiz', 'automatize'],sentence = \"automatically automatize automation automaton\") == \"auto auto auto auto\"\n assert candidate(dictionary = ['apple', 'app', 'application'],sentence = \"apples are appetizing and application development is fun\") == \"app are app and app development is fun\"\n assert candidate(dictionary = ['inter', 'internal', 'internet', 'interface'],sentence = \"internet interface internals interaction\") == \"inter inter inter inter\"\n assert candidate(dictionary = ['int', 'inte', 'integ', 'integri', 'integr', 'integrit', 'integriti', 'integrity'],sentence = \"integrity integritys\") == \"int int\"\n assert candidate(dictionary = ['ex', 'exa', 'exam', 'examp'],sentence = \"example examine examination exam\") == \"ex ex ex ex\"\n assert candidate(dictionary = ['unbelievable', 'un', 'unbe', 'unbeli', 'unbeliev'],sentence = \"unbelievable unbelieve unbeliev un unbe\") == \"un un un un un\"\n assert candidate(dictionary = ['hel', 'help', 'helpl'],sentence = \"helpful helpfulness helpfulhelper\") == \"hel hel hel\"\n assert candidate(dictionary = ['bio', 'bi', 'b'],sentence = \"biological biotechnology biochemistry bio\") == \"b b b b\"\n assert candidate(dictionary = ['micro', 'microc', 'microce', 'microcel', 'microcell', 'microcells'],sentence = \"microcell microcells microcellular microcellulars\") == \"micro micro micro micro\"\n assert candidate(dictionary = ['nano', 'nanos', 'nanoso', 'nanosol', 'nanosolu', 'nanosolut', 'nanosolute', 'nanosolutes'],sentence = \"nanosolute nanosolutes\") == \"nano nano\"\n"}, "metadata": {"canonical_parameter_names": ["dictionary", "sentence"], "leetcode_dataset_entry_point": "Solution().replaceWords", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var replaceWords = function(dictionary, sentence) {", "container": null, "callable": "replaceWords", "parameters": [{"name": "dictionary", "type": "string[]"}, {"name": "sentence", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 649, "task_id": "dota2-senate", "difficulty": "Medium", "problem_description": "In the world of Dota2, there are two parties: the Radiant and the Dire.\nThe Dota2 senate consists of senators coming from two parties. Now the Senate wants to decide on a change in the Dota2 game. The voting for this change is a round-based procedure. In each round, each senator can exercise one of the two rights:\n\nBan one senator's right: A senator can make another senator lose all his rights in this and all the following rounds.\nAnnounce the victory: If this senator found the senators who still have rights to vote are all from the same party, he can announce the victory and decide on the change in the game.\n\nGiven a string senate representing each senator's party belonging. The character 'R' and 'D' represent the Radiant party and the Dire party. Then if there are n senators, the size of the given string will be n.\nThe round-based procedure starts from the first senator to the last senator in the given order. This procedure will last until the end of voting. All the senators who have lost their rights will be skipped during the procedure.\nSuppose every senator is smart enough and will play the best strategy for his own party. Predict which party will finally announce the victory and change the Dota2 game. The output should be \"Radiant\" or \"Dire\".\n \nExample 1:\n\nInput: senate = \"RD\"\nOutput: \"Radiant\"\nExplanation: \nThe first senator comes from Radiant and he can just ban the next senator's right in round 1. \nAnd the second senator can't exercise any rights anymore since his right has been banned. \nAnd in round 2, the first senator can just announce the victory since he is the only guy in the senate who can vote.\n\nExample 2:\n\nInput: senate = \"RDD\"\nOutput: \"Dire\"\nExplanation: \nThe first senator comes from Radiant and he can just ban the next senator's right in round 1. \nAnd the second senator can't exercise any rights anymore since his right has been banned. \nAnd the third senator comes from Dire and he can ban the first senator's right in round 1. \nAnd in round 2, the third senator can just announce the victory since he is the only guy in the senate who can vote.\n\n \nConstraints:\n\nn == senate.length\n1 <= n <= 104\nsenate[i] is either 'R' or 'D'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(senate = \"RDDRDR\") == \"Dire\"\n assert candidate(senate = \"RDD\") == \"Dire\"\n assert candidate(senate = \"DDDARR\") == \"Dire\"\n assert candidate(senate = \"DRDR\") == \"Dire\"\n assert candidate(senate = \"RDDRRD\") == \"Radiant\"\n assert candidate(senate = \"RDRDRDRDRDRDRD\") == \"Radiant\"\n assert candidate(senate = \"RD\") == \"Radiant\"\n assert candidate(senate = \"DRDRDR\") == \"Dire\"\n assert candidate(senate = \"RRRDDD\") == \"Radiant\"\n assert candidate(senate = \"DDDD\") == \"Dire\"\n assert candidate(senate = \"RRDDRR\") == \"Radiant\"\n assert candidate(senate = \"DDDDRRRRRDDDDRRRR\") == \"Dire\"\n assert candidate(senate = \"RRDDDD\") == \"Dire\"\n assert candidate(senate = \"DDDDRRRR\") == \"Dire\"\n assert candidate(senate = \"RDRDRD\") == \"Radiant\"\n assert candidate(senate = \"DDRRR\") == \"Dire\"\n assert candidate(senate = \"DDDRRR\") == \"Dire\"\n assert candidate(senate = \"DDDDDDRRRRRR\") == \"Dire\"\n assert candidate(senate = \"RRDD\") == \"Radiant\"\n assert candidate(senate = \"RRRDDDDRRDDRR\") == \"Radiant\"\n assert candidate(senate = \"RRDDD\") == \"Radiant\"\n assert candidate(senate = \"DRDRDRDRDRDRDR\") == \"Dire\"\n assert candidate(senate = \"DRDRDRDR\") == \"Dire\"\n assert candidate(senate = \"DDRR\") == \"Dire\"\n assert candidate(senate = \"DDRDRR\") == \"Dire\"\n assert candidate(senate = \"RRRRDDDD\") == \"Radiant\"\n assert candidate(senate = \"RRRR\") == \"Radiant\"\n assert candidate(senate = \"RRRRRRRDDDDDDD\") == \"Radiant\"\n assert candidate(senate = \"RDRD\") == \"Radiant\"\n assert candidate(senate = \"DRDRDRDRDRDRDRDRDR\") == \"Dire\"\n assert candidate(senate = \"DRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRD\") == \"Dire\"\n assert candidate(senate = \"RRDDDRRRRDDDRRDD\") == \"Radiant\"\n assert candidate(senate = \"AAAAAAAAAAAAADDDDDDDDDDDAAAAAAAAAAAAADDDDDDDDDDDAAAAAAAAAAAAADDDDDDDDDDDAAAAAAAAAAAAADDDDDDDDDDD\") == \"Dire\"\n assert candidate(senate = \"RDRRDDRRDDRRDD\") == \"Radiant\"\n assert candidate(senate = \"DDDDDRRRRRRDDDDRRRRRRRRDDDRRR\") == \"Radiant\"\n assert candidate(senate = \"RDDDRDRDRRDDRR\") == \"Dire\"\n assert candidate(senate = \"DDDDDDDDRRRRRDDD\") == \"Dire\"\n assert candidate(senate = \"RRDDRRDDRRDDRRDD\") == \"Radiant\"\n assert candidate(senate = \"RRRRRDDDDD-DDRRR\") == \"Radiant\"\n assert candidate(senate = \"RRRRRRRRRRDDDDDDDDDD\") == \"Radiant\"\n assert candidate(senate = \"RDRDRDRDRDRDRDRD\") == \"Radiant\"\n assert candidate(senate = \"RRRDDDRRDDDRRDDDRRDDRRRRRR\") == \"Radiant\"\n assert candidate(senate = \"DDDRRDDDRRRDDDDD\") == \"Dire\"\n assert candidate(senate = \"DDDDDDDDRRRRRR\") == \"Dire\"\n assert candidate(senate = \"RDRRDDDRRDDDRRDDDRDD\") == \"Dire\"\n assert candidate(senate = \"RRDDDDRRRRDDDDRR\") == \"Radiant\"\n assert candidate(senate = \"DRRDDDDDDRRRRRDD\") == \"Dire\"\n assert candidate(senate = \"RRRRRRRRRRRDDDDDDDDDDDDDDDDD\") == \"Radiant\"\n assert candidate(senate = \"RRRDRRDDDRRDDDRRDDDRRDDDRRDDDR\") == \"Radiant\"\n assert candidate(senate = \"RDDDRRDDDRRDDDRRDDDRRDDDRRDD\") == \"Dire\"\n assert candidate(senate = \"RRRDDDDRRRDDDDRRRDDDDRRRDDDD\") == \"Dire\"\n assert candidate(senate = \"DDRDRDRDRDRDRDRDRDRD\") == \"Dire\"\n assert candidate(senate = \"RRDDDDDDRRRRRRDDDDDDRRRRRRDDDD\") == \"Dire\"\n assert candidate(senate = \"RRRRRRDDDDDDRRRRRRDDDDDDRRRRRRDD\") == \"Radiant\"\n assert candidate(senate = \"RRDDDDDRDDRRDDDR\") == \"Dire\"\n assert candidate(senate = \"DDDDDDRRRRRRRRRR\") == \"Radiant\"\n assert candidate(senate = \"RRRDDDRRDDDRRDDDRRDDRR\") == \"Radiant\"\n assert candidate(senate = \"RRDDDDDDRRRDDDRRRRDD\") == \"Dire\"\n assert candidate(senate = \"RDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRD\") == \"Radiant\"\n assert candidate(senate = \"DDDDRRRRRDRRDDDD\") == \"Dire\"\n assert candidate(senate = \"RDDDRRRRDDDDRRRR\") == \"Radiant\"\n assert candidate(senate = \"RRDRRDDDRRDDDRDD\") == \"Radiant\"\n assert candidate(senate = \"DDRDDRDDRDDRDDRDDRDDRDDRDDRDDRDDRDDRDDRDDRDDRDDRDDRDDRDDRDDRDD\") == \"Dire\"\n assert candidate(senate = \"DRDRDRDRDRDRDRDRDRDR\") == \"Dire\"\n assert candidate(senate = \"DDDDDDDDDDDDDDDDAAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDAAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDAAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDAAAAAAAAAAAAAAAAAAAAA\") == \"Dire\"\n assert candidate(senate = \"RRRRRRRDDDDDDDD\") == \"Radiant\"\n assert candidate(senate = \"DRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDR\") == \"Dire\"\n assert candidate(senate = \"RRRDDDDRRRRRDDDD\") == \"Radiant\"\n assert candidate(senate = \"RRRDDDRRDDDRRDDDRRDD\") == \"Radiant\"\n assert candidate(senate = \"DDDDDDDDDAAAAAAAAAAAADDDDDDDDDAAAAAAAAAAAADDDDDDDDDAAAAAAAAAAAA\") == \"Dire\"\n assert candidate(senate = \"RRRRRRRRDDDDDDDDD\") == \"Radiant\"\n assert candidate(senate = \"DRRDDDRRDDDRRDDDRRDDDDDDDD\") == \"Dire\"\n assert candidate(senate = \"RRRRRDDDDRRRRRDD\") == \"Radiant\"\n assert candidate(senate = \"RRRRRRRRRRDDDDDDDDDDDDDDDDDDDD\") == \"Dire\"\n assert candidate(senate = \"RRDDDDRRRRRDDDDRRRR\") == \"Radiant\"\n assert candidate(senate = \"AAAAAAAAAAADDDDDDDDDAAAAAAAAAAADDDDDDDDDAAAAAAAAAAADDDDDDDDDAAAAAAAAAAA\") == \"Dire\"\n assert candidate(senate = \"DDDDDDRRRRRRRRRRRRRR\") == \"Radiant\"\n assert candidate(senate = \"DDDDRRRRDDRRRDDRRRDD\") == \"Dire\"\n assert candidate(senate = \"RRRRDDDDDDRRRRRDDDDDDRRRRRDD\") == \"Radiant\"\n assert candidate(senate = \"RRDDRRRDRDDDRRDD\") == \"Radiant\"\n assert candidate(senate = \"RRDDDDRRDDDDRRDDDDRRDDDDRRDDDD\") == \"Dire\"\n assert candidate(senate = \"RRDDDRRDDDDDRRDD\") == \"Dire\"\n assert candidate(senate = \"RDDRRRDDDDRRRDDDDRRRDD\") == \"Dire\"\n assert candidate(senate = \"DRRDDDRRDDDRRDDDRRDDDDDD\") == \"Dire\"\n assert candidate(senate = \"DDDDRRRDDDDRRRDDDDRRRDDDDRRRDD\") == \"Dire\"\n assert candidate(senate = \"RRDRDRDRDRDRDRDRDRDR\") == \"Radiant\"\n assert candidate(senate = \"RRDDRRDDRRDDRRDDRRDDRRDDRRDDRRDD\") == \"Radiant\"\n assert candidate(senate = \"RRRDDDRRDDDRRDDDRRDDRRRDDDRRDDDRRDD\") == \"Dire\"\n assert candidate(senate = \"DDRRDDRRDDRRDDRRDDRRDDRRDDRRDDRRDDRRDDRRDD\") == \"Dire\"\n assert candidate(senate = \"DDDDDRRRDDDRRRDD\") == \"Dire\"\n assert candidate(senate = \"DRRRRRDDDDDDD\") == \"Dire\"\n assert candidate(senate = \"RDRDRDRDRDRDRDRDRDRDRDRDRDRDRD\") == \"Radiant\"\n assert candidate(senate = \"DDDDDDRRRRRRDDDDDDRRRRRRDDDDDD\") == \"Dire\"\n assert candidate(senate = \"RRRDDDDRRRDDRRRRRR\") == \"Radiant\"\n assert candidate(senate = \"DDRRDDRRDDRRDDRRDDRRDDRRDDRRDD\") == \"Dire\"\n assert candidate(senate = \"DRDDRRDDRRDDRRDD\") == \"Dire\"\n assert candidate(senate = \"RDDDRRDDDRRDDDRRDD\") == \"Dire\"\n assert candidate(senate = \"RRRRRRRDRDDDDDDD\") == \"Radiant\"\n assert candidate(senate = \"DDDRRRDDRRRDD\") == \"Dire\"\n assert candidate(senate = \"DDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRD\") == \"Dire\"\n assert candidate(senate = \"RRRRDDDDDDDDRRRRRRDDDD\") == \"Dire\"\n assert candidate(senate = \"DDRDRDRDRDRDRDRDRDRDRDRDRDRD\") == \"Dire\"\n assert candidate(senate = \"DRRDDDRRDDDRRDDDRRDDRRRDDDRRDDDRRDD\") == \"Dire\"\n assert candidate(senate = \"DDDDDDDDDDRRRRRRRRRR\") == \"Dire\"\n assert candidate(senate = \"DRDDRRDRDRDRDR\") == \"Dire\"\n assert candidate(senate = \"DDRRDDDDBBRRDDDDRRRRDDRRDDDDBB\") == \"Dire\"\n assert candidate(senate = \"RRRRDDDDDDDDRRRR\") == \"Radiant\"\n assert candidate(senate = \"AAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDAAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDAAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDAAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDAAAAAAAAAAAAAAAAAAAAA\") == \"Dire\"\n assert candidate(senate = \"DDDDRRRRDDD\") == \"Dire\"\n assert candidate(senate = \"DDRRRRRRRRDD\") == \"Radiant\"\n assert candidate(senate = \"DDDDRRRRRRRRRRRRRDDDDDDDD\") == \"Radiant\"\n assert candidate(senate = \"RRRDDDRDDRRRDDDD\") == \"Radiant\"\n assert candidate(senate = \"RRRRDDDSSSSSRRRRRR\") == \"Radiant\"\n assert candidate(senate = \"RRRRRRDDDDDDDDDDDD\") == \"Dire\"\n assert candidate(senate = \"RRRRRDDDDDRRRRDDDD\") == \"Radiant\"\n assert candidate(senate = \"DDDDRRRRRR\") == \"Dire\"\n assert candidate(senate = \"RRRRDDD-DDDDDDRRRR\") == \"Dire\"\n assert candidate(senate = \"RRRRRDDDDD\") == \"Radiant\"\n assert candidate(senate = \"RRDDDDRRDDRRDDRRDDRRDDRRDD\") == \"Dire\"\n assert candidate(senate = \"RRRRRRRRRRRRDDDDDD\") == \"Radiant\"\n assert candidate(senate = \"DRRDDDRRDDDRRDDDRRDDDRRDDDRRDD\") == \"Dire\"\n assert candidate(senate = \"RRRDDDDRRRDDDDRRRDDDDRRRDDDDRRRDDDD\") == \"Dire\"\n assert candidate(senate = \"DDDDDDDDRRRRRRRRDDDDDDDDRRRRRRRR\") == \"Dire\"\n assert candidate(senate = \"DDRRRRDDDDRRRRDD\") == \"Dire\"\n assert candidate(senate = \"RRRRRDDDRRDDDRRDDDRRDD\") == \"Radiant\"\n assert candidate(senate = \"RRDRRDDRRRDDRRDR\") == \"Radiant\"\n assert candidate(senate = \"RRRRRDDDDDRRRRDDDDDRRRRDDDDD\") == \"Radiant\"\n assert candidate(senate = \"DRRRRDDDDDDD\") == \"Dire\"\n assert candidate(senate = \"DDDDDDDDDDDDDDRRRRRRRRRRRRRR\") == \"Dire\"\n assert candidate(senate = \"RRRRRRRDDDDDDDDD\") == \"Radiant\"\n assert candidate(senate = \"RRRDRRDDDRRDRRDDDRRDRRDDDRRD\") == \"Radiant\"\n assert candidate(senate = \"DRRDDDRRDDDRRDDDRRDD\") == \"Dire\"\n assert candidate(senate = \"RDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDR\") == \"Radiant\"\n assert candidate(senate = \"RRRDDDDRRRDDDDRRRDDDDRRRDDDDRR\") == \"Dire\"\n assert candidate(senate = \"RDRDRDRDRDRDRDRDRDRD\") == \"Radiant\"\n assert candidate(senate = \"RRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDR\") == \"Radiant\"\n assert candidate(senate = \"DRDRDRDRDRDRDRDRDRDRDRDR\") == \"Dire\"\n assert candidate(senate = \"RRRDRDDDRRDD\") == \"Radiant\"\n assert candidate(senate = \"DRDRDRDRDRDRDRDRDRDRDRDRDRDRDR\") == \"Dire\"\n assert candidate(senate = \"DDDDDDRRRRDDDDDDRRRRDDDDDDRRRR\") == \"Dire\"\n assert candidate(senate = \"RRRRRDDDDDDRRRRRDDDDDDRRRRRDDDDD\") == \"Radiant\"\n assert candidate(senate = \"RRRRDDDDRRRRDDDD\") == \"Radiant\"\n assert candidate(senate = \"RRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDD\") == \"Radiant\"\n assert candidate(senate = \"RRDDRRDDRRDDRRDDRRDDRRDD\") == \"Radiant\"\n assert candidate(senate = \"RRDRDRDRDRDRDR\") == \"Radiant\"\n assert candidate(senate = \"DDDDDDDDDDDAAAAAAAAAAAAADDDDDDDDDAAAAAAAAAAAADDDDDDDDDAAAAAAAAAAADDDDDDDDDAAAAAAAAAAA\") == \"Dire\"\n assert candidate(senate = \"DRDDDRRDDDRRDDDRRDDDRRDDDRRDDDRRDD\") == \"Dire\"\n assert candidate(senate = \"DDDDDDRRRRRRDDDDDD\") == \"Dire\"\n assert candidate(senate = \"DDDDDDRRRRRRDDRRRRR\") == \"Dire\"\n assert candidate(senate = \"DDDRRRDDDDRRRRRDDDDDDRRRRRDDDDDDD\") == \"Dire\"\n assert candidate(senate = \"DDDDRRRRDDDDRRRRDDDDRRRRDDDDRRRRDDDDRRRR\") == \"Dire\"\n assert candidate(senate = \"RRDDRRDDRRDDRRDDRRDDRRDDRRDDRR\") == \"Radiant\"\n assert candidate(senate = \"DRRDDDRRDDDRRDDDRRDDDD\") == \"Dire\"\n assert candidate(senate = \"RRRRRDDDDDRRRRDDDDRRRRRDDDDDRR\") == \"Radiant\"\n assert candidate(senate = \"RRRRRDDDDDDDDDRRRRDDDDDDDDDRRRRDDDDDDDDDRRRRDDDDDDDDDRRRRDDDDDD\") == \"Dire\"\n assert candidate(senate = \"DDDDDDDDDDRRRRRRR\") == \"Dire\"\n assert candidate(senate = \"DDDDRRRRDDDDRRRR\") == \"Dire\"\n assert candidate(senate = \"DDDDRRDDDDRRDDDDRRDDDDRRDDDDRR\") == \"Dire\"\n assert candidate(senate = \"RRRRRDDDDDDDDDRRRDDDRRDDDD\") == \"Dire\"\n assert candidate(senate = \"RRRRDDDDRRRRDDDDRRRRDDDDRRRRDDDDRRRRDDDD\") == \"Radiant\"\n assert candidate(senate = \"RRRRRRRRRRRRRDDDDDDDDDDDDDRRRRRRRRRRRRDDDDDDDDDDDDDRRRRRRRRRRRRDDDDDDDDD\") == \"Radiant\"\n assert candidate(senate = \"DDDDDDDDRRRRRRRR\") == \"Dire\"\n assert candidate(senate = \"DDRRRDDDDRRRRDDDRRR\") == \"Dire\"\n assert candidate(senate = \"DDRRDDRRDDRRDDRR\") == \"Dire\"\n assert candidate(senate = \"RRDDDRRDDDRRDDDRRDDDRRDDDRRDDDRRDD\") == \"Dire\"\n assert candidate(senate = \"DDDDRRDDRRDDRRDDRRDD\") == \"Dire\"\n assert candidate(senate = \"DRDDRRDDRRDDRRDR\") == \"Dire\"\n assert candidate(senate = \"DRDRDRDRDRDRDRDR\") == \"Dire\"\n assert candidate(senate = \"RRRDDDDDRRRRDDDDDRRRRDDDDDRRRRDDDDDRRRRDDDD\") == \"Dire\"\n assert candidate(senate = \"RRRDDDDRRRDDDDRR\") == \"Radiant\"\n assert candidate(senate = \"RDDDRDDDRDDDRDDD\") == \"Dire\"\n assert candidate(senate = \"RRDRDRDRDRDRDRDRDRDRDRDRDRDR\") == \"Radiant\"\n assert candidate(senate = \"DDRRDDRRDDRRDDRRDDRRDDRRDDRRDDRR\") == \"Dire\"\n assert candidate(senate = \"DDRDRDRDRDRDRDRD\") == \"Dire\"\n assert candidate(senate = \"DDRDDDRRDDDRRDDDRRDDDRRDDDRRDDDR\") == \"Dire\"\n assert candidate(senate = \"RRRDDDRRDDDRRDDDRRDDRRRR\") == \"Radiant\"\n assert candidate(senate = \"RRRRRDDDDRRRDDDDRRRDDDDRRRDD\") == \"Radiant\"\n"}, "metadata": {"canonical_parameter_names": ["senate"], "leetcode_dataset_entry_point": "Solution().predictPartyVictory", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var predictPartyVictory = function(senate) {", "container": null, "callable": "predictPartyVictory", "parameters": [{"name": "senate", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 650, "task_id": "2-keys-keyboard", "difficulty": "Medium", "problem_description": "There is only one character 'A' on the screen of a notepad. You can perform one of two operations on this notepad for each step:\n\nCopy All: You can copy all the characters present on the screen (a partial copy is not allowed).\nPaste: You can paste the characters which are copied last time.\n\nGiven an integer n, return the minimum number of operations to get the character 'A' exactly n times on the screen.\n \nExample 1:\n\nInput: n = 3\nOutput: 3\nExplanation: Initially, we have one character 'A'.\nIn step 1, we use Copy All operation.\nIn step 2, we use Paste operation to get 'AA'.\nIn step 3, we use Paste operation to get 'AAA'.\n\nExample 2:\n\nInput: n = 1\nOutput: 0\n\n \nConstraints:\n\n1 <= n <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 3) == 3\n assert candidate(n = 12) == 7\n assert candidate(n = 100) == 14\n assert candidate(n = 10) == 7\n assert candidate(n = 1000) == 21\n assert candidate(n = 5) == 5\n assert candidate(n = 4) == 4\n assert candidate(n = 16) == 8\n assert candidate(n = 17) == 17\n assert candidate(n = 2) == 2\n assert candidate(n = 8) == 6\n assert candidate(n = 27) == 9\n assert candidate(n = 18) == 8\n assert candidate(n = 20) == 9\n assert candidate(n = 19) == 19\n assert candidate(n = 11) == 11\n assert candidate(n = 15) == 8\n assert candidate(n = 14) == 9\n assert candidate(n = 9) == 6\n assert candidate(n = 6) == 5\n assert candidate(n = 1) == 0\n assert candidate(n = 7) == 7\n assert candidate(n = 13) == 13\n assert candidate(n = 625) == 20\n assert candidate(n = 97) == 97\n assert candidate(n = 729) == 18\n assert candidate(n = 144) == 14\n assert candidate(n = 49) == 14\n assert candidate(n = 125) == 15\n assert candidate(n = 4096) == 24\n assert candidate(n = 300) == 17\n assert candidate(n = 841) == 58\n assert candidate(n = 60) == 12\n assert candidate(n = 30) == 10\n assert candidate(n = 600) == 19\n assert candidate(n = 64) == 12\n assert candidate(n = 72) == 12\n assert candidate(n = 99) == 17\n assert candidate(n = 343) == 21\n assert candidate(n = 225) == 16\n assert candidate(n = 819) == 26\n assert candidate(n = 1024) == 20\n assert candidate(n = 128) == 14\n assert candidate(n = 999) == 46\n assert candidate(n = 96) == 13\n assert candidate(n = 256) == 16\n assert candidate(n = 997) == 997\n assert candidate(n = 36) == 10\n assert candidate(n = 529) == 46\n assert candidate(n = 91) == 20\n assert candidate(n = 77) == 18\n assert candidate(n = 81) == 12\n assert candidate(n = 48) == 11\n assert candidate(n = 961) == 62\n assert candidate(n = 200) == 16\n assert candidate(n = 400) == 18\n assert candidate(n = 512) == 18\n assert candidate(n = 196) == 18\n assert candidate(n = 750) == 20\n assert candidate(n = 121) == 22\n assert candidate(n = 361) == 38\n assert candidate(n = 441) == 20\n assert candidate(n = 500) == 19\n assert candidate(n = 55) == 16\n assert candidate(n = 25) == 10\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().minSteps", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minSteps = function(n) {", "container": null, "callable": "minSteps", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 653, "task_id": "two-sum-iv-input-is-a-bst", "difficulty": "Easy", "problem_description": "Given the root of a binary search tree and an integer k, return true if there exist two elements in the BST such that their sum is equal to k, or false otherwise.\n \nExample 1:\n\n\nInput: root = [5,3,6,2,4,null,7], k = 9\nOutput: true\n\nExample 2:\n\n\nInput: root = [5,3,6,2,4,null,7], k = 28\nOutput: false\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 104].\n-104 <= Node.val <= 104\nroot is guaranteed to be a valid binary search tree.\n-105 <= k <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7]),k = 28) == False\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7]),k = 9) == True\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 180]),k = 150) == True\n assert candidate(root = tree_node([2, 0, 3, -4, 1]),k = 5) == True\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 190]),k = 500) == False\n assert candidate(root = tree_node([2, 1, 3]),k = 4) == True\n assert candidate(root = tree_node([8, 5, 10, 3, 7, 9, 12]),k = 14) == True\n assert candidate(root = tree_node([1, 0, 2]),k = 3) == True\n assert candidate(root = tree_node([7, 3, 9, 1, 5, None, 11, 0, 2, 4, 6, 8, 10, 12]),k = 19) == True\n assert candidate(root = tree_node([-10, -5, 0, -7, -8, 5, 7, 6, 8, None, None, 3, 1]),k = 10) == True\n assert candidate(root = tree_node([2, 0, 3, -4, 1]),k = -1) == True\n assert candidate(root = tree_node([50, 25, 75, 12, 37, 63, 87, 6, 18, 30, 45, 57, 70, 80, 90]),k = 500) == False\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, None, None, None, None, None, 8]),k = 14) == True\n assert candidate(root = tree_node([7, 3, 15, None, None, None, 20]),k = 17) == False\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6]),k = 18) == True\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7]),k = 11) == True\n assert candidate(root = tree_node([2, 0, 3, -4, 1]),k = 0) == False\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7]),k = 8) == True\n assert candidate(root = tree_node([15, 9, 20, 7, 11, 17, 22, 3, 8, 10, 12, 16, 18, 21, 23]),k = 25) == True\n assert candidate(root = tree_node([8, 5, 10, 3, 6, 9, 11]),k = 21) == True\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, 1]),k = 3) == True\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 190]),k = 200) == True\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, 1]),k = 8) == True\n assert candidate(root = tree_node([0, -1, 2, None, -2, None, 3]),k = 0) == True\n assert candidate(root = tree_node([5, 1, 8, None, 4, None, None, 3, None, 2, None, None, None, 0, None, -1]),k = 8) == True\n assert candidate(root = tree_node([1, 0, 2, -1, None, None, None, -2, None]),k = -1) == True\n assert candidate(root = tree_node([10000, 5000, 15000, 2500, 7500, 12500, 17500]),k = 20000) == True\n assert candidate(root = tree_node([1, 0, 2]),k = 1) == True\n assert candidate(root = tree_node([-10, -5, 0, -7, -8, 5, 7, 6, 8, None, None, 3, 1]),k = -5) == True\n assert candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15]),k = 29) == True\n assert candidate(root = tree_node([1, 0, 2, None, -1]),k = 1) == True\n assert candidate(root = tree_node([1, 0, 2, None, None, 2, None]),k = 2) == True\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18]),k = 27) == True\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35]),k = 30) == True\n assert candidate(root = tree_node([50, 25, 75, 12, 37, 63, 87, 6, 18, 30, 45, 57, 70, 80, 90]),k = 45) == False\n assert candidate(root = tree_node([-10, -5, 0, 1, None, -6, None, -8]),k = -16) == True\n assert candidate(root = tree_node([2, 0, 3, -4, 1]),k = 6) == False\n assert candidate(root = tree_node([1, 0, 2, -1, None, None, None]),k = -1) == True\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 190]),k = 125) == True\n assert candidate(root = tree_node([10, 1, None, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9]),k = 18) == True\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 180]),k = 200) == True\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, None, None, None, None, None, 8]),k = 15) == True\n assert candidate(root = tree_node([10000, 5000, 15000, 2500, 7500, 12500, 17500]),k = 25000) == True\n assert candidate(root = tree_node([2, 1, 3]),k = 5) == True\n assert candidate(root = tree_node([-10, -20, -5, -15, None, -30]),k = -30) == True\n assert candidate(root = tree_node([20, 15, 30, 10, 17, 25, 40, 5, 12, None, None, None, None, 35, 45]),k = 52) == True\n assert candidate(root = tree_node([20, 15, 25, 10, 18, 22, 30, 5, 13, None, None, 17, 19, None, None, 3, 8]),k = 25) == True\n assert candidate(root = tree_node([15, 10, 20, 8, 12, 17, 25, 6, 9, 11, 13, 16, 18, 22, 28]),k = 33) == True\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 35, 60, 90, 110, 140, 160, 190]),k = 200) == True\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18]),k = 25) == True\n assert candidate(root = tree_node([50, 25, 75, 12, 37, 63, 87, 6, 18, 30, 45, 57, 70, 80, 90]),k = 110) == True\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35]),k = 60) == True\n assert candidate(root = tree_node([-10, -5, 0, -7, -8, 5, 7, 6, 8, None, None, 3, 1]),k = 0) == True\n assert candidate(root = tree_node([-1, -2, -3, -4, -5]),k = -8) == True\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, 1, None, None, None, None, 8]),k = 15) == True\n assert candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15]),k = 27) == True\n assert candidate(root = tree_node([50, 25, 75, 12, 37, 63, 87, 6, 18, 30, 45, 57, 70, 80, 90]),k = 150) == True\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6]),k = 26) == False\n assert candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, None, 3, 5, 7, 9, 11, 13, 15]),k = 30) == False\n assert candidate(root = tree_node([10, 8, 12, 7, 9, 11, 13]),k = 21) == True\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 18, 23, 27, 32, 37]),k = 45) == True\n assert candidate(root = tree_node([7, 3, 15, None, None, 9, 20]),k = 22) == True\n assert candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, None, 5, 7, 9, 11, 13, 15]),k = 26) == True\n assert candidate(root = tree_node([3, 1, 4, None, 2]),k = 6) == True\n assert candidate(root = tree_node([2, 0, 3, -4, 1]),k = -3) == True\n assert candidate(root = tree_node([2, 0, 3, -4, 1]),k = 2) == True\n assert candidate(root = tree_node([3, 1, 4, None, 2]),k = 5) == True\n assert candidate(root = tree_node([1, 0, 2, None, -1]),k = -1) == True\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 190]),k = 200) == True\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),k = 17) == True\n assert candidate(root = tree_node([5, 4, 6, 3, None, 7]),k = 9) == True\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180]),k = 300) == True\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, None, None, None, 22]),k = 33) == True\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180]),k = 200) == True\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),k = 30) == False\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),k = 25) == True\n assert candidate(root = tree_node([2, 0, 3, -4, 1]),k = -2) == True\n assert candidate(root = tree_node([45, 30, 60, 20, 35, 50, 70, 10, 25, 32, 37, 48, 55, 65, 75, 5, 15, 22, 28, 33, 36, 42, 47, 52, 58, 62, 68, 72, 78, 80]),k = 85) == True\n assert candidate(root = tree_node([7, 3, 15, 1, 5, 9, 20, None, None, None, 6]),k = 11) == True\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7]),k = 5) == True\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),k = 18) == True\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18]),k = 15) == True\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180]),k = 250) == True\n assert candidate(root = tree_node([0, -1, 2, None, -3, None, 4]),k = -1) == True\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35]),k = 40) == True\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5]),k = 10) == True\n assert candidate(root = tree_node([3, 2, 4, None, 1]),k = 6) == True\n assert candidate(root = tree_node([1]),k = 2) == False\n assert candidate(root = tree_node([0, -1, 2, -2, None, None, 3, -3, None, None, None]),k = 0) == True\n"}, "metadata": {"canonical_parameter_names": ["root", "k"], "leetcode_dataset_entry_point": "Solution().findTarget", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findTarget = function(root, k) {", "container": null, "callable": "findTarget", "parameters": [{"name": "root", "type": "TreeNode"}, {"name": "k", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 654, "task_id": "maximum-binary-tree", "difficulty": "Medium", "problem_description": "You are given an integer array nums with no duplicates. A maximum binary tree can be built recursively from nums using the following algorithm:\n\nCreate a root node whose value is the maximum value in nums.\nRecursively build the left subtree on the subarray prefix to the left of the maximum value.\nRecursively build the right subtree on the subarray suffix to the right of the maximum value.\n\nReturn the maximum binary tree built from nums.\n \nExample 1:\n\n\nInput: nums = [3,2,1,6,0,5]\nOutput: [6,3,5,null,2,0,null,null,1]\nExplanation: The recursive calls are as follow:\n- The largest value in [3,2,1,6,0,5] is 6. Left prefix is [3,2,1] and right suffix is [0,5].\n - The largest value in [3,2,1] is 3. Left prefix is [] and right suffix is [2,1].\n - Empty array, so no child.\n - The largest value in [2,1] is 2. Left prefix is [] and right suffix is [1].\n - Empty array, so no child.\n - Only one element, so child is a node with value 1.\n - The largest value in [0,5] is 5. Left prefix is [0] and right suffix is [].\n - Only one element, so child is a node with value 0.\n - Empty array, so no child.\n\nExample 2:\n\n\nInput: nums = [3,2,1]\nOutput: [3,null,2,null,1]\n\n \nConstraints:\n\n1 <= nums.length <= 1000\n0 <= nums[i] <= 1000\nAll integers in nums are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(nums = [10, 5, 15, 2, 7, 12, 20]), tree_node([20, 15, None, 10, 12, None, 5, 7, None, None, None, 2]))\n assert is_same_tree(candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), tree_node([10, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [1]), tree_node([1]))\n assert is_same_tree(candidate(nums = [1, 3, 2, 6, 5, 7, 4]), tree_node([7, 6, 4, 3, 5, None, None, 1, 2]))\n assert is_same_tree(candidate(nums = [1000, 999, 998, 997, 996]), tree_node([1000, None, 999, None, 998, None, 997, None, 996]))\n assert is_same_tree(candidate(nums = [2, 1, 3]), tree_node([3, 2, None, None, 1]))\n assert is_same_tree(candidate(nums = [10, 20, 30, 40, 50]), tree_node([50, 40, None, 30, None, 20, None, 10]))\n assert is_same_tree(candidate(nums = [3, 2, 1, 6, 0, 5]), tree_node([6, 3, 5, None, 2, 0, None, None, 1]))\n assert is_same_tree(candidate(nums = [1, 2, 3, 4, 5]), tree_node([5, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [1, 3, 2, 5, 4, 7, 6]), tree_node([7, 5, 6, 3, 4, None, None, 1, 2]))\n assert is_same_tree(candidate(nums = [3, 2, 1, 6, 0, 5, 9, 8, 7]), tree_node([9, 6, 8, 3, 5, None, 7, None, 2, 0, None, None, None, None, 1]))\n assert is_same_tree(candidate(nums = [1, 3, 2]), tree_node([3, 1, 2]))\n assert is_same_tree(candidate(nums = [7, 5, 2, 6, 3, 1, 4]), tree_node([7, None, 6, 5, 4, None, 2, 3, None, None, None, None, 1]))\n assert is_same_tree(candidate(nums = [1, 2, 3, 6, 5, 4, 9, 8, 7]), tree_node([9, 6, 8, 3, 5, None, 7, 2, None, None, 4, None, None, 1]))\n assert is_same_tree(candidate(nums = [3, 2, 1]), tree_node([3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [3, 1, 4, 2]), tree_node([4, 3, 2, None, 1]))\n assert is_same_tree(candidate(nums = [5, 4, 3, 2, 1]), tree_node([5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [1, 2, 3]), tree_node([3, 2, None, 1]))\n assert is_same_tree(candidate(nums = [3, 1, 2]), tree_node([3, None, 2, 1]))\n assert is_same_tree(candidate(nums = [50, 40, 30, 20, 10]), tree_node([50, None, 40, None, 30, None, 20, None, 10]))\n assert is_same_tree(candidate(nums = [12, 24, 18, 15, 30, 28, 26, 25, 27, 35, 32, 31, 33, 34]), tree_node([35, 30, 34, 24, 28, 33, None, 12, 18, None, 27, 32, None, None, None, None, 15, 26, None, None, 31, None, None, None, 25]))\n assert is_same_tree(candidate(nums = [3, 1, 2, 6, 5, 4, 9, 8, 7, 12, 11, 10, 15, 14, 13, 18, 17, 16, 19, 20]), tree_node([20, 19, None, 18, None, 15, 17, 12, 14, None, 16, 9, 11, None, 13, None, None, 6, 8, None, 10, None, None, 3, 5, None, 7, None, None, None, 2, None, 4, None, None, 1]))\n assert is_same_tree(candidate(nums = [34, 2, 78, 56, 90, 12, 3, 8, 5]), tree_node([90, 78, 12, 34, 56, None, 8, None, 2, None, None, 3, 5]))\n assert is_same_tree(candidate(nums = [2, 7, 11, 15, 3, 6, 7, 10, 1, 5, 4, 8, 12, 9]), tree_node([15, 11, 12, 7, None, 10, 9, 2, None, 7, 8, None, None, None, None, 6, None, 5, None, 3, None, 1, 4]))\n assert is_same_tree(candidate(nums = [150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]), tree_node([150, None, 140, None, 130, None, 120, None, 110, None, 100, None, 90, None, 80, None, 70, None, 60, None, 50, None, 40, None, 30, None, 20, None, 10]))\n assert is_same_tree(candidate(nums = [5, 50, 95, 60, 80, 30, 40, 70, 20, 10, 15, 25, 35, 45, 55, 65, 75, 85, 90, 99]), tree_node([99, 95, None, 50, 90, 5, None, 85, None, None, None, 80, None, 60, 75, None, None, 70, None, 40, 65, 30, None, 55, None, None, None, 45, None, 35, None, 25, None, 20, None, None, 15, 10]))\n assert is_same_tree(candidate(nums = [2, 25, 1, 24, 3, 23, 4, 22, 5, 21, 6, 20, 7, 19, 8, 18, 9, 17, 10, 16, 11, 15, 12, 14, 13]), tree_node([25, 2, 24, None, None, 1, 23, None, None, 3, 22, None, None, 4, 21, None, None, 5, 20, None, None, 6, 19, None, None, 7, 18, None, None, 8, 17, None, None, 9, 16, None, None, 10, 15, None, None, 11, 14, None, None, 12, 13]))\n assert is_same_tree(candidate(nums = [42, 17, 13, 14, 35, 65, 23, 54, 78, 9, 11, 2, 3, 5, 7, 19, 21, 25, 30]), tree_node([78, 65, 30, 42, 54, 25, None, None, 35, 23, None, 21, None, 17, None, None, None, 19, None, None, 14, 11, None, 13, None, 9, 7, None, None, None, None, 5, None, 3, None, 2]))\n assert is_same_tree(candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]), tree_node([20, None, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [42, 53, 23, 78, 12, 34, 65, 89, 100, 56]), tree_node([100, 89, 56, 78, None, None, None, 53, 65, 42, 23, 34, None, None, None, None, None, 12]))\n assert is_same_tree(candidate(nums = [3, 5, 2, 4, 1, 6, 7, 8, 9, 10, 0]), tree_node([10, 9, 0, 8, None, None, None, 7, None, 6, None, 5, None, 3, 4, None, None, 2, 1]))\n assert is_same_tree(candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]), tree_node([15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1, None, 0]))\n assert is_same_tree(candidate(nums = [12, 5, 15, 3, 8, 18, 1, 4, 7, 11, 13, 17, 6, 2, 9, 14, 10, 16]), tree_node([18, 15, 17, 12, 8, 13, 16, None, 5, 3, None, 11, None, 14, None, None, None, None, None, 7, None, 9, 10, 4, None, 6, None, None, None, 1, None, None, 2]))\n assert is_same_tree(candidate(nums = [5, 8, 3, 9, 6, 2, 10, 7, 1, 4]), tree_node([10, 9, 7, 8, 6, None, 4, 5, 3, None, 2, 1]))\n assert is_same_tree(candidate(nums = [999, 800, 700, 600, 500, 400, 300, 200, 100, 50, 25]), tree_node([999, None, 800, None, 700, None, 600, None, 500, None, 400, None, 300, None, 200, None, 100, None, 50, None, 25]))\n assert is_same_tree(candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]), tree_node([15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [50, 30, 20, 40, 10, 60, 50, 70, 80, 15]), tree_node([80, 70, 15, 60, None, None, None, 50, 50, None, 40, None, None, 30, 10, None, 20]))\n assert is_same_tree(candidate(nums = [200, 100, 300, 50, 150, 250, 350, 25, 75, 125, 175, 225, 275, 325, 375, 10, 30, 60, 90, 110, 130, 160, 180, 210, 230, 260, 280, 310, 330, 360, 380]), tree_node([380, 375, None, 350, 360, 300, 325, 330, None, 200, 250, 275, None, 310, None, None, 100, 150, None, 225, None, 280, None, None, None, 50, None, 175, None, 260, None, None, None, 125, None, 230, None, 75, None, 210, None, 25, None, 180, None, None, None, 160, None, 130, None, 110, None, 90, None, 60, None, 30, None, 10]))\n assert is_same_tree(candidate(nums = [99, 23, 77, 45, 67, 89, 12, 34, 56, 78, 90, 100, 110, 120, 130, 140, 150]), tree_node([150, 140, None, 130, None, 120, None, 110, None, 100, None, 99, None, None, 90, 89, None, 77, 78, 23, 67, 56, None, None, None, 45, None, 34, None, None, None, 12]))\n assert is_same_tree(candidate(nums = [1000, 950, 900, 850, 800, 750, 700, 650, 600, 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 50, 1, 2, 3, 4, 5, 6, 7, 8, 9]), tree_node([1000, None, 950, None, 900, None, 850, None, 800, None, 750, None, 700, None, 650, None, 600, None, 550, None, 500, None, 450, None, 400, None, 350, None, 300, None, 250, None, 200, None, 150, None, 100, None, 50, None, 9, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]), tree_node([30, 29, None, 28, None, 27, None, 26, None, 25, None, 24, None, 23, None, 22, None, 21, None, 20, None, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [100, 20, 30, 40, 50, 60, 70, 80, 90, 10]), tree_node([100, None, 90, 80, 10, 70, None, None, None, 60, None, 50, None, 40, None, 30, None, 20]))\n assert is_same_tree(candidate(nums = [1, 6, 3, 5, 2, 4, 7, 10, 8, 9, 11, 12, 13, 14, 15]), tree_node([15, 14, None, 13, None, 12, None, 11, None, 10, None, 7, 9, 6, None, 8, None, 1, 5, None, None, None, None, 3, 4, None, None, 2]))\n assert is_same_tree(candidate(nums = [42, 17, 93, 31, 58, 72, 12, 67, 85, 29, 47, 63, 54, 81, 96, 50, 77, 21, 61, 88, 19, 35, 52, 69, 37, 74, 90, 24, 44, 59, 76, 40, 66, 84, 27, 48, 65, 82, 33, 49, 64, 83, 30, 45, 57, 73, 32, 43, 56, 71, 34, 46, 55, 70, 36, 41, 51, 68, 38, 39]), tree_node([96, 93, 90, 42, 85, 88, 84, None, 17, 72, 81, 77, 74, 76, 83, None, None, 58, 67, 63, None, 50, 61, 69, None, 59, 66, 82, 73, 31, None, 12, None, 47, 54, None, None, 21, None, 52, 37, 44, None, 40, None, 65, 64, 57, 71, None, None, None, None, 29, None, None, None, None, None, 35, None, None, None, 24, None, None, None, 48, None, 49, None, 45, None, 56, 70, None, None, 19, None, None, None, 27, None, 33, None, 30, None, 43, None, 55, 68, None, None, None, None, None, None, None, None, 32, None, 46, None, 51, 39, None, None, 34, None, 41, None, 38, None, None, None, 36]))\n assert is_same_tree(candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]), tree_node([10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1, None, 0, None, -1, None, -2, None, -3, None, -4, None, -5, None, -6, None, -7, None, -8, None, -9, None, -10]))\n assert is_same_tree(candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]), tree_node([15, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [8, 15, 3, 7, 9, 1, 20, 18, 17, 16, 14, 13]), tree_node([20, 15, 18, 8, 9, None, 17, None, None, 7, 1, None, 16, 3, None, None, None, None, 14, None, None, None, 13]))\n assert is_same_tree(candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 50, 25, 75, 125, 175, 225, 275, 325, 375, 425, 475, 525, 575, 625, 675, 725, 775, 825, 875, 925, 975]), tree_node([1000, 900, 975, 800, None, 925, None, 700, None, 875, None, 600, None, 825, None, 500, None, 775, None, 400, None, 725, None, 300, None, 675, None, 200, None, 625, None, 100, None, 575, None, None, None, 525, None, 475, None, 425, None, 375, None, 325, None, 275, None, 225, None, 175, None, 125, None, 75, None, 50, None, None, 25]))\n assert is_same_tree(candidate(nums = [7, 4, 9, 1, 3, 8, 2, 5, 6]), tree_node([9, 7, 8, None, 4, 3, 6, None, None, 1, None, 5, None, None, None, 2]))\n assert is_same_tree(candidate(nums = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9]), tree_node([9, 5, 9, 4, None, 6, None, 3, 1, 2, 5, None, 1, None, None, None, None, None, 5, None, None, 3]))\n assert is_same_tree(candidate(nums = [5, 8, 2, 1, 4, 6, 3, 9, 7, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]), tree_node([20, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, 7, 5, 6, None, 0, None, None, 4, 3, None, None, 2, None, None, None, None, 1]))\n assert is_same_tree(candidate(nums = [42, 3, 56, 23, 89, 12, 67, 45]), tree_node([89, 56, 67, 42, 23, 12, 45, None, 3]))\n assert is_same_tree(candidate(nums = [100, 90, 110, 80, 95, 105, 70, 85, 92, 98, 60, 75, 82, 88, 93, 97, 50, 65, 72, 78, 83, 87, 91, 94, 96, 40, 55, 62, 68, 73, 77, 81, 86, 90, 99, 30, 45, 52, 58, 63, 67, 71, 76, 84, 89, 20, 35, 42, 48, 53, 57, 61, 66, 74, 79, 85, 9, 18, 25, 32, 38, 43, 47, 51, 56, 60, 64, 69, 75, 80, 3, 12, 21, 27, 33, 37, 41, 46, 50, 55, 59, 63, 68, 72, 77, 82, 7, 15, 23, 29, 34, 38, 42, 45, 49, 54, 58, 62, 67, 71, 76, 1, 6, 11, 16, 22, 28, 32, 36, 40, 44, 48, 52, 57, 61, 66, 70, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70]), tree_node([110, 100, 105, None, 90, 95, 99, None, None, 80, None, 98, 89, None, None, 92, 97, 84, 85, 85, None, 93, 96, 76, None, 79, 82, 70, None, 88, None, 94, 90, 71, None, 74, None, 80, 76, None, None, 82, None, 91, None, 86, None, 67, None, 66, None, 75, 77, 71, 70, 75, None, 87, None, 81, None, 63, None, 61, None, 69, None, 72, None, 67, None, 66, 70, 60, None, 83, None, 77, None, 58, None, 57, None, 64, None, 68, None, 62, None, 61, None, 65, None, None, None, 78, None, 73, None, 52, None, 53, None, 60, None, 63, None, 58, None, 57, None, 60, None, 72, None, 68, None, 45, None, 48, None, 56, None, 59, None, 54, None, 52, None, 55, None, 65, None, 62, None, 30, None, 42, None, 51, None, 55, None, 49, None, 48, None, 50, None, 50, None, 55, None, None, None, 35, None, 47, None, 50, None, 45, None, 44, None, 45, None, None, None, 40, None, 20, None, 43, None, 46, None, 42, None, 40, None, 40, None, None, None, None, None, 38, None, 41, None, 38, None, 36, None, 35, None, 32, None, 37, None, 34, None, 32, None, 30, None, 25, None, 33, None, 29, None, 28, None, 25, None, 18, None, 27, None, 23, None, 22, None, 20, None, 9, None, 21, None, 15, None, 16, None, 15, None, None, None, 12, None, 7, None, 11, None, 10, None, 3, None, None, None, 6, None, 5, None, None, None, 1, None, 0]))\n assert is_same_tree(candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]), tree_node([20, None, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1, None, 0]))\n assert is_same_tree(candidate(nums = [7, 2, 9, 3, 5, 8, 1, 4, 6, 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]), tree_node([30, 29, None, 28, None, 27, None, 26, None, 25, None, 24, None, 23, None, 22, None, 21, None, 20, None, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 9, None, 7, 8, None, 2, 5, 6, None, None, 3, None, 4, 0, None, None, 1]))\n assert is_same_tree(candidate(nums = [1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 11, 20, 12, 19, 13, 18, 14, 17, 15, 16, 21, 30, 22, 29, 23, 28, 24, 27, 25, 26]), tree_node([30, 21, 29, 20, None, 22, 28, 11, 19, None, None, 23, 27, 10, None, 12, 18, None, None, 24, 26, 1, 9, None, None, 13, 17, None, None, 25, None, None, None, 2, 8, None, None, 14, 16, None, None, None, None, 3, 7, None, None, 15, None, None, None, 4, 6, None, None, None, None, 5]))\n assert is_same_tree(candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]), tree_node([29, 27, None, 25, None, 23, None, 21, None, 19, None, 17, None, 15, None, 13, None, 11, None, 9, None, 7, None, 5, None, 3, None, 1]))\n assert is_same_tree(candidate(nums = [8, 5, 12, 1, 10, 2, 9, 3, 7, 4, 6, 11]), tree_node([12, 8, 11, None, 5, 10, None, None, None, 1, 9, None, None, 2, 7, None, None, 3, 6, None, None, 4]))\n assert is_same_tree(candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]), tree_node([9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1, None, 0, None, -1, None, -2, None, -3, None, -4, None, -5, None, -6, None, -7, None, -8, None, -9, None, -10]))\n assert is_same_tree(candidate(nums = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989]), tree_node([999, None, 998, None, 997, None, 996, None, 995, None, 994, None, 993, None, 992, None, 991, None, 990, None, 989]))\n assert is_same_tree(candidate(nums = [50, 40, 30, 20, 10, 90, 80, 70, 60, 100]), tree_node([100, 90, None, 50, 80, None, 40, None, 70, None, 30, None, 60, None, 20, None, None, None, 10]))\n assert is_same_tree(candidate(nums = [5, 2, 7, 1, 8, 6, 4, 3, 9, 0, 11, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20]), tree_node([20, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 9, 10, 8, 0, None, None, 7, 6, None, None, 5, 1, None, 4, None, 2, None, None, None, 3]))\n assert is_same_tree(candidate(nums = [300, 200, 100, 250, 150, 50, 275, 225, 175, 125, 75, 325, 305, 255, 205, 155, 105, 350, 320, 290, 260, 230, 210, 180, 160, 130, 110, 80, 60, 40]), tree_node([350, 325, 320, 300, 305, None, 290, None, 275, None, 255, None, 260, 250, 225, None, 205, None, 230, 200, 150, None, 175, None, 155, None, 210, None, 100, None, 50, None, 125, None, 105, None, 180, None, None, None, None, None, 75, None, None, None, 160, None, None, None, 130, None, 110, None, 80, None, 60, None, 40]))\n assert is_same_tree(candidate(nums = [5, 9, 1, 8, 2, 7, 3, 6, 4]), tree_node([9, 5, 8, None, None, 1, 7, None, None, 2, 6, None, None, 3, 4]))\n assert is_same_tree(candidate(nums = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205, 215, 225, 235, 245, 255, 265, 275, 285, 295, 305]), tree_node([305, 295, None, 285, None, 275, None, 265, None, 255, None, 245, None, 235, None, 225, None, 215, None, 205, None, 195, None, 185, None, 175, None, 165, None, 155, None, 145, None, 135, None, 125, None, 115, None, 105, None, 95, None, 85, None, 75, None, 65, None, 55, None, 45, None, 35, None, 25, None, 15, None, 5]))\n assert is_same_tree(candidate(nums = [45, 67, 23, 89, 12, 34, 56, 78, 90]), tree_node([90, 89, None, 67, 78, 45, 23, 56, None, None, None, None, None, 34, None, 12]))\n assert is_same_tree(candidate(nums = [50, 90, 30, 70, 20, 80, 10, 60, 40]), tree_node([90, 50, 80, None, None, 70, 60, 30, 20, 10, 40]))\n assert is_same_tree(candidate(nums = [1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]), tree_node([30, 29, None, 28, None, 27, None, 26, None, 25, None, 24, None, 23, None, 22, None, 21, None, 20, None, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 1, 9, None, None, 2, 8, None, None, 3, 7, None, None, 4, 6, None, None, 5]))\n assert is_same_tree(candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]), tree_node([1024, 512, None, 256, None, 128, None, 64, None, 32, None, 16, None, 8, None, 4, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [7, 10, 4, 3, 20, 15, 9, 8, 6, 11, 18]), tree_node([20, 10, 18, 7, 4, 15, None, None, None, None, 3, None, 11, None, None, 9, None, None, 8, None, 6]))\n assert is_same_tree(candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]), tree_node([20, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [50, 90, 30, 40, 70, 80, 20, 60, 10]), tree_node([90, 50, 80, None, None, 70, 60, 40, None, 20, 10, 30]))\n assert is_same_tree(candidate(nums = [42, 27, 61, 30, 19, 7, 5, 66, 39, 21, 22]), tree_node([66, 61, 39, 42, 30, None, 22, None, 27, None, 19, 21, None, None, None, None, 7, None, None, None, 5]))\n assert is_same_tree(candidate(nums = [1, 2, 4, 3, 7, 6, 5, 8, 9, 10, 12, 11, 14, 13, 15]), tree_node([15, 14, None, 12, 13, 10, 11, None, None, 9, None, None, None, 8, None, 7, None, 4, 6, 2, 3, None, 5, 1]))\n assert is_same_tree(candidate(nums = [5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]), tree_node([5, None, 4, None, 3, None, 2, None, 1, None, 0, None, -1, None, -2, None, -3, None, -4, None, -5]))\n assert is_same_tree(candidate(nums = [20, 50, 40, 30, 60, 90, 80, 70, 100]), tree_node([100, 90, None, 60, 80, 50, None, None, 70, 20, 40, None, None, None, None, None, 30]))\n assert is_same_tree(candidate(nums = [100, 10, 90, 9, 80, 8, 70, 7, 60, 6, 50, 5, 40, 4, 30, 3, 20, 2, 10, 1]), tree_node([100, None, 90, 10, 80, None, None, 9, 70, None, None, 8, 60, None, None, 7, 50, None, None, 6, 40, None, None, 5, 30, None, None, 4, 20, None, None, 3, 10, None, None, 2, 1]))\n assert is_same_tree(candidate(nums = [2, 1, 3, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]), tree_node([15, 13, 14, 11, 12, None, None, 9, 10, None, None, 7, 8, None, None, 5, 6, None, None, 3, 4, None, None, 2, None, None, None, None, 1]))\n assert is_same_tree(candidate(nums = [1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15]), tree_node([15, 14, None, 12, 13, 10, 11, None, None, 8, 9, None, None, 6, 7, None, None, 4, 5, None, None, 2, 3, None, None, 1]))\n assert is_same_tree(candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1, 0, 9]), tree_node([9, 8, None, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1, None, 0]))\n assert is_same_tree(candidate(nums = [5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 15, 14, 13, 12, 11, 20, 19, 18, 17, 16]), tree_node([20, 15, 19, 10, 14, None, 18, 5, 9, None, 13, None, 17, None, 4, None, 8, None, 12, None, 16, None, 3, None, 7, None, 11, None, None, None, 2, None, 6, None, None, None, 1]))\n assert is_same_tree(candidate(nums = [10, 20, 30, 40, 50, 15, 25, 35, 45, 55, 5, 12, 22, 32, 42, 52, 60, 65, 70, 75, 80]), tree_node([80, 75, None, 70, None, 65, None, 60, None, 55, None, 50, 52, 40, 45, 42, None, 30, None, 35, None, 32, None, 20, None, 25, None, 22, None, 10, None, 15, None, 12, None, None, None, None, None, 5]))\n assert is_same_tree(candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]), tree_node([25, 24, None, 23, None, 22, None, 21, None, 20, None, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]), tree_node([100, 90, None, 80, None, 70, None, 60, None, 50, None, 40, None, 30, None, 20, None, 10]))\n assert is_same_tree(candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 50]), tree_node([50, 20, None, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [100, 200, 300, 400, 500, 50, 150, 250, 350, 450, 5, 25, 125, 175, 225, 275, 325, 375, 425, 475]), tree_node([500, 400, 475, 300, None, 450, None, 200, None, 350, 425, 100, None, 250, None, 375, None, None, None, 150, None, 325, None, 50, None, 275, None, None, None, 225, None, 175, None, 125, None, 25, None, 5]))\n assert is_same_tree(candidate(nums = [50, 25, 75, 12, 38, 62, 88, 6, 18, 32, 46, 58, 70, 82, 94, 3, 9, 15, 21, 28, 34, 41, 48, 54, 60, 66, 72, 78, 84, 90, 96]), tree_node([96, 94, None, 88, 90, 75, 82, 84, None, 50, 62, 70, None, 78, None, None, 25, 38, None, 58, None, 72, None, None, None, 12, None, 46, None, 66, None, None, None, 32, None, 60, None, 18, None, 54, None, 6, None, 48, None, None, None, 41, None, 34, None, 28, None, 21, None, 15, None, 9, None, 3]))\n assert is_same_tree(candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]), tree_node([30, 29, None, 28, None, 27, None, 26, None, 25, None, 24, None, 23, None, 22, None, 21, None, 20, None, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [5, 1, 9, 2, 8, 3, 7, 4, 6]), tree_node([9, 5, 8, None, 1, 2, 7, None, None, None, None, 3, 6, None, None, 4]))\n assert is_same_tree(candidate(nums = [50, 25, 75, 12, 37, 62, 87, 6, 18, 31, 43, 56, 70, 82, 93, 3, 9, 15, 21, 27, 34, 40, 49, 53, 61, 69, 76, 81, 88, 91, 95, 97]), tree_node([97, 95, None, 93, None, 87, 91, 75, 82, 88, None, 50, 62, 70, None, 81, None, None, 25, 37, None, 56, None, 76, None, None, None, 12, None, 43, None, 69, None, None, None, 31, None, 61, None, 18, None, 53, None, 6, None, 49, None, None, None, 40, None, 34, None, 27, None, 21, None, 15, None, 9, None, 3]))\n assert is_same_tree(candidate(nums = [8, 3, 10, 1, 6, 14, 4, 7, 13, 2, 9, 12, 11, 5]), tree_node([14, 10, 13, 8, 6, 7, 12, None, 3, 1, None, 4, None, 9, 11, None, None, None, None, None, None, 2, None, None, 5]))\n assert is_same_tree(candidate(nums = [15, 10, 18, 8, 12, 19, 13, 7, 9, 11, 14, 16, 17]), tree_node([19, 18, 17, 15, 12, 16, None, None, 10, 8, None, 14, None, None, None, None, None, 13, None, None, 11, 9, None, 7]))\n assert is_same_tree(candidate(nums = [1, 10, 2, 9, 3, 8, 4, 7, 5, 6]), tree_node([10, 1, 9, None, None, 2, 8, None, None, 3, 7, None, None, 4, 6, None, None, 5]))\n assert is_same_tree(candidate(nums = [1, 2, 4, 3, 7, 6, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]), tree_node([20, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 4, 6, 2, 3, None, 5, 1]))\n assert is_same_tree(candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]), tree_node([150, 140, None, 130, None, 120, None, 110, None, 100, None, 90, None, 80, None, 70, None, 60, None, 50, None, 40, None, 30, None, 20, None, 10]))\n assert is_same_tree(candidate(nums = [10, 5, 2, 3, 15, 12, 8, 7, 18, 17, 14]), tree_node([18, 15, 17, 10, 12, None, 14, None, 5, None, 8, None, None, None, 3, None, 7, 2]))\n assert is_same_tree(candidate(nums = [7, 5, 3, 2, 1, 0, 8, 6, 4]), tree_node([8, 7, 6, None, 5, None, 4, None, 3, None, None, None, 2, None, 1, None, 0]))\n assert is_same_tree(candidate(nums = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 5, 1, 0, 5, 8, 2, 0, 9, 7, 4, 9, 4, 4, 5, 9, 2, 3, 0, 7, 8, 1, 6, 4, 0, 6, 2, 8, 6, 2, 0, 4, 9, 0, 3, 0, 1, 4, 3, 3, 0, 9, 2, 6, 1, 4, 8, 6, 7, 0, 1, 0, 3, 2, 9, 6, 2, 9, 8, 9, 6, 5, 9, 8, 9, 3, 0, 9, 1, 6, 9, 8, 9, 8, 6, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 5, 1, 0, 5, 8, 2, 0, 9, 7, 4, 9, 4, 4, 5, 9]), tree_node([9, 5, 9, 4, None, 6, 9, 3, 1, 2, 5, 7, 9, None, 1, None, None, None, None, None, 5, None, None, 8, 9, None, None, 3, None, 3, 8, 8, 9, None, None, None, 3, 6, 7, 5, 8, 7, 9, 2, None, 4, 6, 3, None, None, 2, None, 4, None, 6, 3, 9, None, None, None, None, 2, 4, None, 2, 0, None, None, 1, 1, None, None, None, None, 9, None, None, None, 3, None, None, None, None, None, None, None, None, 8, 9, None, 3, 7, 2, 7, 9, None, None, 3, 5, None, 0, None, 4, 5, 9, None, None, None, 5, None, None, None, None, 4, None, 8, 9, 1, None, None, 4, 7, 8, 4, 9, None, 0, None, None, 3, None, 6, 6, 3, 3, 8, 9, None, None, 2, 0, 1, 6, None, 4, 0, 1, None, 3, 6, 7, 6, 9, None, None, None, None, None, None, 4, 2, 2, None, None, None, 0, None, None, 0, 2, 4, 6, 3, None, 2, 8, 9, None, 0, None, None, None, 0, None, None, None, None, None, None, 1, None, None, None, 1, 2, None, None, None, None, 6, 9, None, None, None, None, None, None, 0, 0, None, None, None, 5, 8, 9, None, None, None, None, None, None, None, None, 3, 9, None, 0, 6, 9, None, None, 1, None, 8, 9, None, None, None, None, 8, 9, None, 6, 7, 9, None, 5, None, None, 8, 9, None, None, 3, 8, 8, 9, None, 3, 6, 7, 5, 8, 7, 9, 2, None, 4, 6, 3, None, None, 2, None, 4, None, 6, 3, 9, None, None, None, None, 2, 4, None, 2, 0, None, None, 1, 1, None, None, None, None, 9, None, None, None, 3, None, None, None, None, None, None, None, None, 8, 9, None, 3, 7, 2, 7, 9, None, None, 3, 5, None, 0, None, 4, 5, None, None, None, None, 5, None, None, None, None, 4, None, 1, None, None, 4, None, 0]))\n assert is_same_tree(candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]), tree_node([100, None, 90, None, 80, None, 70, None, 60, None, 50, None, 40, None, 30, None, 20, None, 10]))\n assert is_same_tree(candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]), tree_node([50, 49, None, 48, None, 47, None, 46, None, 45, None, 44, None, 43, None, 42, None, 41, None, 40, None, 39, None, 38, None, 37, None, 36, None, 35, None, 34, None, 33, None, 32, None, 31, None, 30, None, 29, None, 28, None, 27, None, 26, None, 25, None, 24, None, 23, None, 22, None, 21, None, 20, None, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [8, 1, 5, 3, 7, 10, 2, 6, 4, 9]), tree_node([10, 8, 9, None, 7, 6, None, 5, None, 2, 4, 1, 3]))\n assert is_same_tree(candidate(nums = [10, 20, 15, 13, 18, 25, 22, 23, 24, 21, 19, 16, 17]), tree_node([25, 20, 24, 10, 18, 23, 21, None, None, 15, None, 22, None, None, 19, None, 13, None, None, None, 17, None, None, 16]))\n assert is_same_tree(candidate(nums = [7, 6, 5, 4, 3, 2, 1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]), tree_node([20, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [5, 15, 10, 20, 25, 18, 17, 16, 22, 21]), tree_node([25, 20, 22, 15, None, 18, 21, 5, 10, None, 17, None, None, None, None, None, None, None, 16]))\n assert is_same_tree(candidate(nums = [25, 15, 35, 10, 20, 30, 40, 5, 7, 12, 18, 22, 28, 32, 38, 1, 3, 6, 9, 11, 13, 17, 19, 21, 23, 27, 29, 31, 33, 37, 39]), tree_node([40, 35, 39, 25, 30, 38, None, None, 15, 20, None, 32, 37, None, None, 10, None, 28, None, 33, None, None, None, 22, None, 31, None, 18, None, 29, None, 12, None, 27, None, 7, None, 23, None, 5, None, 21, None, None, None, 19, None, 17, None, 13, None, 11, None, 9, None, 6, None, 3, None, 1]))\n assert is_same_tree(candidate(nums = [1, 5, 3, 4, 2, 6, 7, 8, 9, 0]), tree_node([9, 8, 0, 7, None, None, None, 6, None, 5, None, 1, 4, None, None, 3, 2]))\n assert is_same_tree(candidate(nums = [45, 30, 50, 20, 35, 40, 55, 25, 32, 37, 42, 52, 60, 28, 31, 33, 36, 39, 41, 43, 48, 51, 53, 58, 29, 34, 44, 46, 47, 54, 56, 57, 59]), tree_node([60, 55, 59, 50, 52, 58, None, 45, 40, 42, None, 53, 57, None, 30, 35, None, 37, None, 51, None, 56, None, None, None, 20, None, 32, None, 48, None, 54, None, None, None, 25, None, 43, None, 47, None, None, None, 41, None, 46, None, 39, None, 44, None, 36, None, 34, None, 33, None, 29, None, 31, None, None, None, 28]))\n assert is_same_tree(candidate(nums = [500, 400, 300, 200, 100, 150, 250, 350, 450, 550]), tree_node([550, 500, None, None, 450, 400, None, None, 350, 300, None, None, 250, 200, None, None, 150, 100]))\n assert is_same_tree(candidate(nums = [42, 41, 39, 40, 38, 37, 35, 36, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]), tree_node([42, None, 41, None, 40, 39, 38, None, None, None, 37, None, 36, 35, 34, None, None, None, 33, None, 32, None, 31, None, 30, None, 29, None, 28, None, 27, None, 26, None, 25, None, 24, None, 23, None, 22, None, 21, None, 20, None, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 950, 850, 750, 650, 550, 450, 350, 250, 150, 50]), tree_node([1000, 900, 950, 800, None, None, 850, 700, None, None, 750, 600, None, None, 650, 500, None, None, 550, 400, None, None, 450, 300, None, None, 350, 200, None, None, 250, 100, None, None, 150, None, None, None, 50]))\n assert is_same_tree(candidate(nums = [25, 15, 35, 10, 20, 30, 40, 5, 25, 18, 32, 45, 7, 12, 28, 38, 50]), tree_node([50, 45, None, 40, 38, 35, 32, 28, None, 25, 30, 25, None, 12, None, None, 15, 20, None, 5, 18, 7, None, None, None, 10]))\n assert is_same_tree(candidate(nums = [6, 2, 8, 1, 3, 7, 5, 4, 9, 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]), tree_node([20, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 9, None, 8, 0, 6, 7, None, None, None, 2, 3, 5, None, None, 1, None, None, 4]))\n assert is_same_tree(candidate(nums = [150, 120, 180, 110, 130, 160, 190, 90, 100, 140, 170, 200, 80, 70, 115, 125, 135, 145, 155, 165, 175, 185, 195, 60, 50, 40, 30, 20, 10, 105, 95, 85]), tree_node([200, 190, 195, 180, 170, 185, 105, 150, 160, 140, None, 175, None, 60, 95, None, 120, 130, None, 100, None, 165, None, None, 50, None, 85, None, None, 110, None, 90, None, 155, None, None, 40, None, None, None, None, None, None, 145, None, None, 30, 135, None, None, 20, 125, None, None, 10, 115, None, None, None, 80, None, None, 70]))\n assert is_same_tree(candidate(nums = [8, 1, 4, 3, 2, 6, 5, 7, 9, 0, 11, 12, 13, 14, 15]), tree_node([15, 14, None, 13, None, 12, None, 11, None, 9, None, 8, 0, None, 7, None, None, 6, None, 4, 5, 1, 3, None, None, None, None, None, 2]))\n assert is_same_tree(candidate(nums = [8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15]), tree_node([15, 14, None, 12, 13, 8, 10, 11, None, None, 4, 6, None, 9, None, None, None, 2, None, 7, None, None, None, 5, None, 3, None, 1]))\n assert is_same_tree(candidate(nums = [10, 15, 20, 25, 30, 5, 9, 14, 19, 24, 29]), tree_node([30, 25, 29, 20, None, 24, None, 15, None, 19, None, 10, None, 14, None, None, None, 9, None, 5]))\n assert is_same_tree(candidate(nums = [5, 10, 3, 8, 1, 4, 6, 9, 2, 7]), tree_node([10, 5, 9, None, None, 8, 7, 3, 6, 2, None, None, None, 4, None, None, None, 1]))\n assert is_same_tree(candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10, -20, -30, -40, -50, -60, -70, -80, -90, -100]), tree_node([100, None, 90, None, 80, None, 70, None, 60, None, 50, None, 40, None, 30, None, 20, None, 10, None, 0, None, -10, None, -20, None, -30, None, -40, None, -50, None, -60, None, -70, None, -80, None, -90, None, -100]))\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().constructMaximumBinaryTree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var constructMaximumBinaryTree = function(nums) {", "container": null, "callable": "constructMaximumBinaryTree", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 655, "task_id": "print-binary-tree", "difficulty": "Medium", "problem_description": "Given the root of a binary tree, construct a 0-indexed m x n string matrix res that represents a formatted layout of the tree. The formatted layout matrix should be constructed using the following rules:\n\nThe height of the tree is height and the number of rows m should be equal to height + 1.\nThe number of columns n should be equal to 2height+1 - 1.\nPlace the root node in the middle of the top row (more formally, at location res[0][(n-1)/2]).\nFor each node that has been placed in the matrix at position res[r][c], place its left child at res[r+1][c-2height-r-1] and its right child at res[r+1][c+2height-r-1].\nContinue this process until all the nodes in the tree have been placed.\nAny empty cells should contain the empty string \"\".\n\nReturn the constructed matrix res.\n \nExample 1:\n\n\nInput: root = [1,2]\nOutput: \n[[\"\",\"1\",\"\"],\n [\"2\",\"\",\"\"]]\n\nExample 2:\n\n\nInput: root = [1,2,3,null,4]\nOutput: \n[[\"\",\"\",\"\",\"1\",\"\",\"\",\"\"],\n [\"\",\"2\",\"\",\"\",\"\",\"3\",\"\"],\n [\"\",\"\",\"4\",\"\",\"\",\"\",\"\"]]\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 210].\n-99 <= Node.val <= 99\nThe depth of the tree will be in the range [1, 10].\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7])) == [['', '', '', '1', '', '', ''], ['', '2', '', '', '', '3', ''], ['4', '', '5', '', '6', '', '7']]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '4', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5']]\n assert candidate(root = tree_node([1, 2, 3, None, 4])) == [['', '', '', '1', '', '', ''], ['', '2', '', '', '', '3', ''], ['', '', '4', '', '', '', '']]\n assert candidate(root = tree_node([1, 2])) == [['', '1', ''], ['2', '', '']]\n assert candidate(root = tree_node([1])) == [['1']]\n assert candidate(root = tree_node([5, 4, 6, None, 3, None, 7, 2, None, None, None, None, None, 1])) == [['', '', '', '', '', '', '', '5', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '6', '', '', ''], ['', '', '', '', '', '3', '', '', '', '', '', '', '', '7', ''], ['', '', '', '', '2', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, 8, None, 9, None, 10])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '6', '', '', ''], ['', '7', '', '', '', '', '', '', '', '8', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '9', '', '', '', '', ''], ['10', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5, None, None, 6])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '4', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '6']]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, 6, None, 7])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '', '', '', '', '4', '', '', '', '', '', '', '', '5', ''], ['', '', '', '', '6', '', '', '', '', '', '', '', '7', '', '']]\n assert candidate(root = tree_node([1, None, 2, None, None, None, None, 3, None, None, None, None, None, None, 4, None, None, None, None, None, None, None, None, None, 5, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 6])) == [['', '1', ''], ['', '', '2']]\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5])) == [['', '', '', '1', '', '', ''], ['', '2', '', '', '', '3', ''], ['4', '', '', '', '', '', '5']]\n assert candidate(root = tree_node([1, None, 2, None, None, None, 3, None, None, None, None, 4])) == [['', '1', ''], ['', '', '2']]\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, 6, None, None, 7, None, None, 8])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '7', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '8', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, None, 2, None, None, 3, None, None, None, 4])) == [['', '1', ''], ['', '', '2']]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5, None, 6])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '2', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '3', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '4']]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, 7, None, None, None, 8, 9])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '4', '', '', '', '', '', '', '', '5', '', '', '', '6', ''], ['7', '', '', '', '', '', '', '', '', '', '', '', '8', '', '9']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, None, 8])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '6', '', '', ''], ['', '7', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['8', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '7', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '8', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '9', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '10', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7])) == [['', '', '', '3', '', '', ''], ['', '9', '', '', '', '20', ''], ['', '', '', '', '15', '', '7']]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, 8, None, 10, 11, 12, 13, None, None, 14])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '7', '', '', ''], ['', '8', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '10', '', '', '', '11', '', '', '', '12', '', '', '', '13', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '14', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, 16])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '7', '', '', ''], ['', '8', '', '', '', '9', '', '', '', '10', '', '', '', '11', '', '', '', '12', '', '', '', '13', '', '', '', '14', '', '', '', '15', ''], ['', '', '16', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, 6, None, 7, None, None, 8, 9])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '5', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '7', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '8', '', '', '', '', '', '9', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, None, None, None, 13, None, None, 14])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '7', '', '', ''], ['', '8', '', '', '', '9', '', '', '', '10', '', '', '', '11', '', '', '', '12', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['13', '', '', '', '', '', '14', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, None, 7, None, None, None, None, 8])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '6', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '7', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '8', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, 8, 9])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '4', '', '', '', '5', '', '', '', '6', '', '', '', '7', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '8', '', '9']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, 8, None, None, 9])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '6', '', '', '', '7', '', '', '', '', '', '', '', '8', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '9', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '3', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['6', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, None, None, 12, 13])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '7', '', '', ''], ['', '', '', '', '', '', '', '', '', '8', '', '', '', '9', '', '', '', '10', '', '', '', '11', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '12', '', '13', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '7', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '8', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['9', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([5, 3, 8, 2, 4, 7, 9, 1, None, None, 6, None, None, 10, 11])) == [['', '', '', '', '', '', '', '5', '', '', '', '', '', '', ''], ['', '', '', '3', '', '', '', '', '', '', '', '8', '', '', ''], ['', '2', '', '', '', '4', '', '', '', '7', '', '', '', '9', ''], ['1', '', '', '', '', '', '6', '', '', '', '', '', '10', '', '11']]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '4', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '6', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '7']]\n assert candidate(root = tree_node([1, 2, None, 4, 5, 6, 7, None, None, None, None, None, 8, 9, 10])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '6', '', '', '', '', '', '', '', '7', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '8', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '9', '', '10', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, 6, 7])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '', '', '', '', '4', '', '', '', '5', '', '', '', '', ''], ['', '', '', '', '6', '', '7', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, None, 7])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '4', '', '', '', '5', '', '', '', '', '', '', '', '6', ''], ['', '', '7', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, 11, None, None, None, None, 12, None, None, 13, None, None, None, None, None, None, 14])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '7', '', '', ''], ['', '8', '', '', '', '9', '', '', '', '10', '', '', '', '', '', '', '', '', '', '', '', '11', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '12', '', '', '', '', '', '13', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '7', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '8', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '9']]\n assert candidate(root = tree_node([1, None, 2, 3, None, None, 4, 5, 6])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '', '6', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None, 7, 8, 9, 10, 11, 12, 13, 14, None, 15])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '', '', '', ''], ['', '7', '', '', '', '8', '', '', '', '9', '', '', '', '10', '', '', '', '11', '', '', '', '12', '', '', '', '', '', '', '', '', ''], ['13', '', '14', '', '', '', '15', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, 7, None, None, 8, None, 9, None, 10])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '6', '', '', ''], ['', '7', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '8', '', '', '', '', '', '', '', '9', ''], ['', '', '10', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, 6, None, None, 7, None, None, 8, None, None, 9])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', ''], ['', '', '', '6', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '7', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '8', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '9', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, 8, 9, None, None, 10])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '4', '', '', '', '5', '', '', '', '', '', '', '', '6', ''], ['7', '', '8', '', '9', '', '', '', '', '', '', '', '', '', '10']]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '6', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '7', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '8']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, 14, 15])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '7', '', '', ''], ['', '8', '', '', '', '9', '', '', '', '10', '', '', '', '11', '', '', '', '12', '', '', '', '13', '', '', '', '', '', '', '', '', ''], ['14', '', '15', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5])) == [['', '', '', '1', '', '', ''], ['', '2', '', '', '', '3', ''], ['', '', '', '', '4', '', '5']]\n assert candidate(root = tree_node([1, None, 2, None, None, None, None, None, 3])) == [['', '1', ''], ['', '', '2']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, 12, 13])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '4', '', '', '', '5', '', '', '', '6', '', '', '', '7', ''], ['', '', '', '', '8', '', '9', '', '10', '', '11', '', '12', '', '13']]\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, None, None, None, 6])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '', '', '', '', '4', '', '', '', '5', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '6', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9, 10, 11])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '6', '', '', '', '7', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['8', '', '9', '', '10', '', '11', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, None, 3, 4, None, 5, None, None, 6, 7, None, None, None, None, 8, 9])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '3', '', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '6', '', '7', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, 6, None, 7, None, None, None, 8, 9, 10])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '6', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '7', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '8', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '9', '', '10', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, 6, 7])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '4', '', '', '', '', '', '', '', '', '', '', '', '5', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '6', '', '7']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '4', '', '', '', '5', '', '', '', '6', '', '', '', '7', ''], ['8', '', '9', '', '10', '', '11', '', '12', '', '13', '', '14', '', '15']]\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2', '', '', '', '', '', '', ''], ['', '', '', '3', '', '', '', '', '', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '6', '', '', ''], ['', '7', '', '', '', '8', '', '', '', '9', '', '', '', '10', '', '', '', '11', '', '', '', '12', '', '', '', '13', '', '', '', '14', ''], ['15', '', '16', '', '17', '', '18', '', '19', '', '20', '', '21', '', '22', '', '23', '', '24', '', '25', '', '26', '', '27', '', '28', '', '29', '', '30']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '4', '', '', '', '5', '', '', '', '', '', '', '', '', ''], ['6', '', '7', '', '8', '', '9', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '6', '', '', '', '', '', '', '', '7', '', '', ''], ['', '8', '', '', '', '9', '', '', '', '10', '', '', '', '11', '', '', '', '12', '', '', '', '13', '', '', '', '14', '', '', '', '15', ''], ['16', '', '17', '', '18', '', '19', '', '20', '', '21', '', '22', '', '23', '', '24', '', '25', '', '26', '', '27', '', '28', '', '29', '', '30', '', '31']]\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '3', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '4', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([-1, -2, -3, None, -4, None, -5])) == [['', '', '', '-1', '', '', ''], ['', '-2', '', '', '', '-3', ''], ['', '', '-4', '', '', '', '-5']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3', '', '', '', '', '', '', ''], ['', '', '', '4', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '6', '', '', '', '7', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['8', '', '9', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, None, 8])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '4', '', '', '', '5', '', '', '', '6', '', '', '', '7', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '8']]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6])) == [['', '', '', '', '', '', '', '10', '', '', '', '', '', '', ''], ['', '', '', '5', '', '', '', '', '', '', '', '15', '', '', ''], ['', '3', '', '', '', '7', '', '', '', '', '', '', '', '18', ''], ['1', '', '', '', '6', '', '', '', '', '', '', '', '', '', '']]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, 7, None, None, 8, 9])) == [['', '', '', '', '', '', '', '1', '', '', '', '', '', '', ''], ['', '', '', '2', '', '', '', '', '', '', '', '3', '', '', ''], ['', '4', '', '', '', '', '', '', '', '5', '', '', '', '6', ''], ['', '', '7', '', '', '', '', '', '', '', '', '', '8', '', '9']]\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().printTree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var printTree = function(root) {", "container": null, "callable": "printTree", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "string[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 657, "task_id": "robot-return-to-origin", "difficulty": "Easy", "problem_description": "There is a robot starting at the position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it completes its moves.\nYou are given a string moves that represents the move sequence of the robot where moves[i] represents its ith move. Valid moves are 'R' (right), 'L' (left), 'U' (up), and 'D' (down).\nReturn true if the robot returns to the origin after it finishes all of its moves, or false otherwise.\nNote: The way that the robot is \"facing\" is irrelevant. 'R' will always make the robot move to the right once, 'L' will always make it move left, etc. Also, assume that the magnitude of the robot's movement is the same for each move.\n \nExample 1:\n\nInput: moves = \"UD\"\nOutput: true\nExplanation: The robot moves up once, and then down once. All moves have the same magnitude, so it ended up at the origin where it started. Therefore, we return true.\n\nExample 2:\n\nInput: moves = \"LL\"\nOutput: false\nExplanation: The robot moves left twice. It ends up two \"moves\" to the left of the origin. We return false because it is not at the origin at the end of its moves.\n\n \nConstraints:\n\n1 <= moves.length <= 2 * 104\nmoves only contains the characters 'U', 'D', 'L' and 'R'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(moves = \"LULLDDRRUURRDDLL\") == False\n assert candidate(moves = \"UUUUUUUUUUDDDDDDDDDDLLLLRRRR\") == True\n assert candidate(moves = \"UDLR\") == True\n assert candidate(moves = \"UUDDRRLL\") == True\n assert candidate(moves = \"LUDD\") == False\n assert candidate(moves = \"RLUD\") == True\n assert candidate(moves = \"RRDDLLUURR\") == False\n assert candidate(moves = \"LRLRLRLR\") == True\n assert candidate(moves = \"ULDRULDRULDR\") == True\n assert candidate(moves = \"LDRU\") == True\n assert candidate(moves = \"UDLRUDLRUDLR\") == True\n assert candidate(moves = \"UUUUUUUUUUUUUUDDDDDDDDDDDDDDLLLLLLLLRRRRRRRRRRRR\") == False\n assert candidate(moves = \"LDRRLU\") == True\n assert candidate(moves = \"UUDDLLRR\") == True\n assert candidate(moves = \"RLUDRLUD\") == True\n assert candidate(moves = \"LLLLRRRR\") == True\n assert candidate(moves = \"RULD\") == True\n assert candidate(moves = \"UUUUUUUUUUDDDDDDDDDDLLLLLLLLRRRRRRRR\") == True\n assert candidate(moves = \"UDUDUDUD\") == True\n assert candidate(moves = \"UUUUUUUUUUUUUUUUDDDDDDDDDDDDDDDDLLLLLLLLLLLLRRRRRRRRRRRRRR\") == False\n assert candidate(moves = \"RRDDLLUU\") == True\n assert candidate(moves = \"LL\") == False\n assert candidate(moves = \"UUUUDDDDLLLLRRRR\") == True\n assert candidate(moves = \"LRUD\") == True\n assert candidate(moves = \"UUDDLLRRUUDDLLRR\") == True\n assert candidate(moves = \"UUUUDDDD\") == True\n assert candidate(moves = \"RRDD\") == False\n assert candidate(moves = \"UUUUUUUUUUUUDDDDDDDDDDDDLLLLRRRRRRRRRRRR\") == False\n assert candidate(moves = \"RRRLLLDDDUUU\") == True\n assert candidate(moves = \"UD\") == True\n assert candidate(moves = \"UUUUUUUUUUUUUUUUUUDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLRRRRRRRRRRRRRRRR\") == True\n assert candidate(moves = \"UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR\") == True\n assert candidate(moves = \"LDDRUURLDDRUURLDDRUURLDDRUURLDDR\") == False\n assert candidate(moves = \"LLLLLRRRRRRLLLLRRRRRRLLL\") == True\n assert candidate(moves = \"UUDDDDUUUUUUUUUUDDDD\") == False\n assert candidate(moves = \"UDUDUDUDUDUDUDUDUDUDUDUDUDUD\") == True\n assert candidate(moves = \"UDUDUDUDUDUDUDUD\") == True\n assert candidate(moves = \"LLLLRRRRUUUUDDDDLRRRLLLLUUUUDDDD\") == False\n assert candidate(moves = \"RRDDLLUURRDDLLUURRDDLLUU\") == True\n assert candidate(moves = \"LRLRLRLRLRLRLRLR\") == True\n assert candidate(moves = \"LLRRLLRRLLRRLLRRLLRRLLRRLLRR\") == True\n assert candidate(moves = \"LDRULDRULDRU\") == True\n assert candidate(moves = \"LLLLRRRRLLLLRRRRLLLLRRRRLLLLRRRR\") == True\n assert candidate(moves = \"LLRRDDUULLRRDDUULLRRDDUULLRRDDUULL\") == False\n assert candidate(moves = \"RULLDDRRULLDDRRULLDDRR\") == False\n assert candidate(moves = \"LLLLUUUUUURRRRRRRRDDDDDD\") == False\n assert candidate(moves = \"RULLDRLDURDURLDLURDURLDLURDURLDL\") == False\n assert candidate(moves = \"UDLRUDLRUDLRUDLR\") == True\n assert candidate(moves = \"UUDDUUDDUUDDUUDDLLLLRRRRLLLLRRRR\") == True\n assert candidate(moves = \"RLRLRLRLRLRLRLRL\") == True\n assert candidate(moves = \"UUDDUUDDUUDDUUDDUUDDUUDD\") == True\n assert candidate(moves = \"UDLLRRUUDDLLRRUUDDLLRRUUDDLLRR\") == True\n assert candidate(moves = \"UUUDDDLLLRRR\") == True\n assert candidate(moves = \"UUUUDDDDLLLLRRRRUUUUDDDDLLLLRRRRUUUUDDDDLLLLRRRR\") == True\n assert candidate(moves = \"UUDDUUDDUUDDUUDDUUDDUUDDUUDD\") == True\n assert candidate(moves = \"UUUUDDDDLLLLRRRRUUUUDDDDLLLLRRRR\") == True\n assert candidate(moves = \"UUDDLLLLRRRRUUDDLLRR\") == True\n assert candidate(moves = \"UDUDUDUDUD\") == True\n assert candidate(moves = \"RLRLRLRLUDUDUDUD\") == True\n assert candidate(moves = \"URDLURDLURDLURDL\") == True\n assert candidate(moves = \"ULDRULDRLDURDLURDLURDLURDLURDL\") == False\n assert candidate(moves = \"RRDDLLUURRDDLLUURRDDLLUURRDDLLUU\") == True\n assert candidate(moves = \"LUDRLUDRLUDRLUDRLUDRLUDR\") == True\n assert candidate(moves = \"LRRLRLRLUDUDUDUD\") == True\n assert candidate(moves = \"UUDDUUDDUUDDUUDD\") == True\n assert candidate(moves = \"RRDDUULLRRDDUULL\") == True\n assert candidate(moves = \"LRUDLRUDLRUD\") == True\n assert candidate(moves = \"LURDLURDLURDLURD\") == True\n assert candidate(moves = \"LLLLRRRRUUDDUUDD\") == True\n assert candidate(moves = \"UDUDLRRLRLUDUDLR\") == True\n assert candidate(moves = \"LLLLLLLLRRRRRRRRUUUUUUUUDDDDDDDD\") == True\n assert candidate(moves = \"UDLRUDLRUDLRUDLRUDLRUDLR\") == True\n assert candidate(moves = \"UUDDDDUUDDDDUUDD\") == False\n assert candidate(moves = \"LLLLRRRRLLLLRRRR\") == True\n assert candidate(moves = \"ULLDRRDUULLDRRDU\") == True\n assert candidate(moves = \"UUDDUUDDUUDDUUDDUUDDUUDDUUDDUUDDUUDDUUDDUUDDUUDDUUDD\") == True\n assert candidate(moves = \"RRRRRRRRRRLLLLLLLLLLDDDDDDDDDDUUUUUUUUUU\") == True\n assert candidate(moves = \"RLRLRLRLRL\") == True\n assert candidate(moves = \"LLLLDDDDUUUURRRR\") == True\n assert candidate(moves = \"UUDDLLRRUUDDDDLLRRUUDDLLRR\") == False\n assert candidate(moves = \"LLRRUUDDUUDDLLRR\") == True\n assert candidate(moves = \"LRRLRLRLUDUDUDUDLRRLRLRLUDUDUDUD\") == True\n assert candidate(moves = \"RLRLRLRLRLRLRLRLRLRL\") == True\n assert candidate(moves = \"UUDDUURRDD\") == False\n assert candidate(moves = \"UUDDUULLRR\") == False\n assert candidate(moves = \"RRRRDDDDLLLLUUUU\") == True\n assert candidate(moves = \"UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR\") == True\n assert candidate(moves = \"LLLLRRRRUUUDDDUUUDDDLLLLRRRR\") == True\n assert candidate(moves = \"UUUUUUUUDDDDDDDDLLLLLLLLRRRRRRRRRRLLRRUUDDLL\") == True\n assert candidate(moves = \"DDUUUUDDLLRRRR\") == False\n assert candidate(moves = \"UUDDLLUURRDDDDLLRR\") == False\n assert candidate(moves = \"RURURURURURURULULULULULULULU\") == False\n assert candidate(moves = \"UUUUUUDDDDDDLLLLRRRRRR\") == False\n assert candidate(moves = \"UUDDDDLLLLRRRRUUDDDD\") == False\n assert candidate(moves = \"LLLLLLLLRRRRRRRRUUUUUUUUDDDDDDDDLLLLLLLLRRRRRRRRUUUUUUUUDDDDDDDD\") == True\n assert candidate(moves = \"RRRDDDLLLUUUUUDDDD\") == False\n assert candidate(moves = \"UUUUUUUUUUDDDDDDDDDDLLLLLLLLRRRRRRRRRR\") == False\n assert candidate(moves = \"RUDLRUDLRUDLRUDL\") == True\n assert candidate(moves = \"UUDDLLRRUUDDLLRRUUDDLLRR\") == True\n assert candidate(moves = \"RUDLRULDRLUDLRULDRLUDLRULDRL\") == False\n assert candidate(moves = \"UDUDUDUDUDUDUDUDUDUDUDUD\") == True\n assert candidate(moves = \"URDLURDLURDL\") == True\n assert candidate(moves = \"UUDDDDDDDLLLLRRRRUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUDDDDDDDLLLLRRRR\") == False\n assert candidate(moves = \"RRDDLLUURRDDLLUU\") == True\n assert candidate(moves = \"UUUUUUUUDDDDDDDDLLLLRRRR\") == True\n assert candidate(moves = \"RRRLLLLDDDUUUUUDDDLLLLURRRDDDDUUU\") == False\n assert candidate(moves = \"DDDDLLLLUUUUUUUUDDDDLLLLRRRRRRRR\") == True\n assert candidate(moves = \"UDUDUDUDLRRLRLRL\") == True\n assert candidate(moves = \"LURDLURDLURDLURDLURDLURDLURDLURDL\") == False\n assert candidate(moves = \"UUUUUUUUDDDDDDDDLLLLRRRRRRRR\") == False\n assert candidate(moves = \"RRUUDDLLDDUURLLR\") == True\n assert candidate(moves = \"ULURDLDRULURDLDRULURDLDRULURDLDR\") == True\n"}, "metadata": {"canonical_parameter_names": ["moves"], "leetcode_dataset_entry_point": "Solution().judgeCircle", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var judgeCircle = function(moves) {", "container": null, "callable": "judgeCircle", "parameters": [{"name": "moves", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 658, "task_id": "find-k-closest-elements", "difficulty": "Medium", "problem_description": "Given a sorted integer array arr, two integers k and x, return the k closest integers to x in the array. The result should also be sorted in ascending order.\nAn integer a is closer to x than an integer b if:\n\n|a - x| < |b - x|, or\n|a - x| == |b - x| and a < b\n\n \nExample 1:\n\nInput: arr = [1,2,3,4,5], k = 4, x = 3\nOutput: [1,2,3,4]\n\nExample 2:\n\nInput: arr = [1,1,2,3,4,5], k = 4, x = -1\nOutput: [1,1,2,3]\n\n \nConstraints:\n\n1 <= k <= arr.length\n1 <= arr.length <= 104\narr is sorted in ascending order.\n-104 <= arr[i], x <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 3, 5, 7, 9],k = 4,x = 6) == [3, 5, 7, 9]\n assert candidate(arr = [1, 3, 5, 7, 9],k = 2,x = 6) == [5, 7]\n assert candidate(arr = [1, 3, 5, 7, 9],k = 1,x = 6) == [5]\n assert candidate(arr = [1, 3, 5, 7, 9],k = 5,x = 6) == [1, 3, 5, 7, 9]\n assert candidate(arr = [1, 2, 3, 4, 5],k = 2,x = 3) == [2, 3]\n assert candidate(arr = [1, 1, 1, 1, 1],k = 3,x = 1) == [1, 1, 1]\n assert candidate(arr = [1, 3, 5, 7, 9],k = 5,x = 8) == [1, 3, 5, 7, 9]\n assert candidate(arr = [1, 2, 3, 4, 5],k = 4,x = 3) == [1, 2, 3, 4]\n assert candidate(arr = [1, 2, 2, 2, 3, 3, 4, 5],k = 4,x = 2) == [1, 2, 2, 2]\n assert candidate(arr = [1, 1, 2, 3, 4, 5],k = 4,x = -1) == [1, 1, 2, 3]\n assert candidate(arr = [1, 2, 3, 4, 5],k = 1,x = 2) == [2]\n assert candidate(arr = [1, 2, 3, 4, 5],k = 5,x = 3) == [1, 2, 3, 4, 5]\n assert candidate(arr = [1, 3, 5, 7, 9],k = 3,x = 6) == [3, 5, 7]\n assert candidate(arr = [1, 2, 3, 4, 5],k = 3,x = 6) == [3, 4, 5]\n assert candidate(arr = [0, 0, 1, 2, 3, 3, 4, 7, 7, 8],k = 3,x = 5) == [3, 3, 4]\n assert candidate(arr = [1, 2, 2, 2, 3, 4, 5],k = 3,x = 2) == [2, 2, 2]\n assert candidate(arr = [1, 2, 2, 2, 5, 5, 5, 8, 9],k = 3,x = 4) == [5, 5, 5]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 1,x = 5) == [5]\n assert candidate(arr = [0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6],k = 7,x = 3) == [2, 2, 2, 3, 3, 3, 4]\n assert candidate(arr = [1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],k = 7,x = 13) == [6, 8, 10, 12, 14, 16, 18]\n assert candidate(arr = [1, 2, 3, 100, 101, 102],k = 3,x = 99) == [100, 101, 102]\n assert candidate(arr = [-100, -99, -98, -97, -96, -95, -94, -93, -92, -91, -90],k = 5,x = -90) == [-94, -93, -92, -91, -90]\n assert candidate(arr = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109],k = 4,x = 90) == [100, 101, 102, 103]\n assert candidate(arr = [-10, -5, -2, 0, 3, 8, 12, 16, 20],k = 5,x = -1) == [-10, -5, -2, 0, 3]\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 4,x = 5) == [10, 10, 10, 10]\n assert candidate(arr = [-10, -5, 0, 5, 10],k = 3,x = -6) == [-10, -5, 0]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5,x = 5) == [3, 4, 5, 6, 7]\n assert candidate(arr = [1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10],k = 9,x = 4) == [3, 3, 3, 3, 4, 4, 4, 5, 5]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 4,x = 5) == [3, 4, 5, 6]\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5],k = 5,x = 6) == [4, 4, 5, 5, 5]\n assert candidate(arr = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10,x = 0) == [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 7,x = 15) == [4, 5, 6, 7, 8, 9, 10]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 20,x = 10) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21],k = 5,x = 10) == [5, 7, 9, 11, 13]\n assert candidate(arr = [-100, -50, -30, -20, -10, 0, 10, 20, 30, 50, 100],k = 5,x = -25) == [-50, -30, -20, -10, 0]\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],k = 4,x = 12) == [9, 11, 13, 15]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 7,x = 10) == [7, 8, 9, 10, 11, 12, 13]\n assert candidate(arr = [-100, -99, -98, -97, -96, -95, -94, -93, -92, -91, -90],k = 5,x = -99) == [-100, -99, -98, -97, -96]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5,x = 3) == [1, 2, 3, 4, 5]\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31],k = 5,x = 28) == [23, 25, 27, 29, 31]\n assert candidate(arr = [-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10],k = 5,x = 1) == [-4, -2, 0, 2, 4]\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],k = 4,x = 10) == [7, 9, 11, 13]\n assert candidate(arr = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2],k = 5,x = 1) == [1, 1, 1, 1, 1]\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 7,x = 0) == [5, 5, 5, 5, 5, 5, 5]\n assert candidate(arr = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1],k = 4,x = -5) == [-7, -6, -5, -4]\n assert candidate(arr = [1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3],k = 6,x = 1) == [1, 1, 1, 1, 1, 2]\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5],k = 5,x = 0) == [1, 1, 1, 2, 2]\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],k = 6,x = 14) == [9, 11, 13, 15, 17, 19]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 10,x = 8) == [3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10,x = 1) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5,x = 0) == [1, 2, 3, 4, 5]\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5],k = 5,x = 3) == [2, 2, 3, 3, 3]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 7,x = 0) == [1, 2, 3, 4, 5, 6, 7]\n assert candidate(arr = [1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9],k = 4,x = 1) == [1, 1, 1, 2]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5,x = 5) == [3, 4, 5, 6, 7]\n assert candidate(arr = [1, 2, 2, 2, 3, 3, 4, 5],k = 3,x = 5) == [3, 4, 5]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1],k = 4,x = 1) == [1, 1, 1, 1]\n assert candidate(arr = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0],k = 5,x = 0) == [-4, -3, -2, -1, 0]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 4,x = 11) == [7, 8, 9, 10]\n assert candidate(arr = [1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 8, 9, 9, 10],k = 8,x = 5) == [3, 4, 4, 5, 5, 5, 6, 6]\n assert candidate(arr = [0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6],k = 15,x = 3) == [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5,x = 1) == [1, 1, 1, 1, 1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5,x = 15) == [6, 7, 8, 9, 10]\n assert candidate(arr = [-10, -5, -3, -1, 0, 1, 3, 5, 7, 10],k = 4,x = 12) == [3, 5, 7, 10]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5,x = 0) == [1, 2, 3, 4, 5]\n assert candidate(arr = [1, 4, 6, 8, 10, 12, 14, 16, 18, 20],k = 4,x = 15) == [12, 14, 16, 18]\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10,x = 10) == [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n assert candidate(arr = [1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10],k = 10,x = 5) == [4, 4, 4, 4, 5, 5, 5, 5, 5, 6]\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 7],k = 8,x = 4) == [3, 3, 3, 4, 4, 5, 5, 5]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 8,x = 16) == [8, 9, 10, 11, 12, 13, 14, 15]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3,x = 0) == [1, 2, 3]\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 7,x = 5) == [2, 3, 4, 5, 6, 7, 8]\n assert candidate(arr = [-100, -90, -80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 10,x = 5) == [-40, -30, -20, -10, 0, 10, 20, 30, 40, 50]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3,x = 15) == [8, 9, 10]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5,x = 11) == [6, 7, 8, 9, 10]\n assert candidate(arr = [1, 2, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21],k = 5,x = 12) == [7, 9, 11, 13, 15]\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10,x = 15) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 3,x = 2) == [1, 1, 1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 4,x = 10) == [7, 8, 9, 10]\n assert candidate(arr = [1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9],k = 4,x = 4) == [3, 4, 5, 5]\n assert candidate(arr = [-10, -5, -3, -1, 0, 1, 2, 3, 5, 7],k = 3,x = -4) == [-5, -3, -1]\n assert candidate(arr = [1, 10, 100, 1000, 10000, 100000, 1000000],k = 2,x = 10000) == [1000, 10000]\n assert candidate(arr = [-10, -5, -2, 0, 1, 3, 5, 8, 12],k = 3,x = -3) == [-5, -2, 0]\n assert candidate(arr = [1, 2, 3, 3, 3, 3, 4, 5, 6],k = 4,x = 3) == [3, 3, 3, 3]\n assert candidate(arr = [1, 2, 2, 2, 3, 3, 4, 5],k = 3,x = 1) == [1, 2, 2]\n assert candidate(arr = [1, 1, 1, 2, 2, 3, 4, 5, 6, 7, 8],k = 5,x = 2) == [1, 1, 1, 2, 2]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3,x = 11) == [8, 9, 10]\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],k = 5,x = 10) == [5, 7, 9, 11, 13]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5,x = 1) == [1, 1, 1, 1, 1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3,x = 0) == [1, 2, 3]\n assert candidate(arr = [1, 2, 2, 2, 3, 4, 5, 5, 5, 6, 6, 7, 8, 8, 9],k = 6,x = 5) == [4, 5, 5, 5, 6, 6]\n assert candidate(arr = [-100, -99, -98, -97, -96, -95, -94, -93, -92, -91, -90],k = 5,x = -94) == [-96, -95, -94, -93, -92]\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21],k = 6,x = 10) == [5, 7, 9, 11, 13, 15]\n assert candidate(arr = [1, 2, 2, 2, 3, 3, 4, 5, 5, 5, 6, 7, 8, 9],k = 5,x = 4) == [3, 3, 4, 5, 5]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3,x = 12) == [8, 9, 10]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 6,x = 5.5) == [3, 4, 5, 6, 7, 8]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 7,x = 10) == [7, 8, 9, 10, 11, 12, 13]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 2,x = 5) == [4, 5]\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 3,x = 55) == [40, 50, 60]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 7,x = 7) == [4, 5, 6, 7, 8, 9, 10]\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25],k = 5,x = 12) == [7, 9, 11, 13, 15]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 6,x = 5) == [2, 3, 4, 5, 6, 7]\n assert candidate(arr = [-20, -15, -10, -5, 0, 5, 10, 15, 20],k = 4,x = 0) == [-10, -5, 0, 5]\n assert candidate(arr = [0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6],k = 10,x = 3) == [1, 2, 2, 2, 3, 3, 3, 4, 4, 4]\n assert candidate(arr = [0, 1, 1, 1, 1, 2, 3, 4, 4, 4, 5, 5, 6, 7, 8, 9],k = 6,x = 0) == [0, 1, 1, 1, 1, 2]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 15,x = 10) == [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]\n assert candidate(arr = [1, 2, 3, 6, 7, 8, 9, 10],k = 3,x = 5) == [3, 6, 7]\n assert candidate(arr = [-10, -5, -2, -1, 0, 1, 2, 3, 5, 6, 7, 10, 15],k = 5,x = -3) == [-5, -2, -1, 0, 1]\n assert candidate(arr = [0, 0, 1, 1, 1, 1, 2, 2, 3, 3],k = 5,x = 1) == [0, 1, 1, 1, 1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 7,x = 11) == [4, 5, 6, 7, 8, 9, 10]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3,x = -2) == [1, 2, 3]\n assert candidate(arr = [1, 2, 3, 6, 9, 12, 15, 18, 21, 24],k = 5,x = 16) == [9, 12, 15, 18, 21]\n assert candidate(arr = [-10, -5, -3, -1, 0, 1, 3, 5, 7, 10],k = 5,x = -2) == [-5, -3, -1, 0, 1]\n assert candidate(arr = [-10, -5, -1, 0, 1, 5, 10],k = 3,x = -3) == [-5, -1, 0]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5,x = 2) == [1, 1, 1, 1, 1]\n assert candidate(arr = [1, 3, 3, 3, 5, 5, 5, 7, 7, 9],k = 4,x = 6) == [5, 5, 5, 7]\n assert candidate(arr = [1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5],k = 7,x = 4) == [4, 4, 4, 4, 4, 4, 4]\n assert candidate(arr = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60],k = 5,x = 53) == [40, 45, 50, 55, 60]\n assert candidate(arr = [-5, -3, -2, -1, 0, 1, 2, 3, 4, 5],k = 6,x = -4) == [-5, -3, -2, -1, 0, 1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10,x = 5) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n assert candidate(arr = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5],k = 12,x = 2) == [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3]\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10,x = 5) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 6,x = 15) == [12, 13, 14, 15, 16, 17]\n assert candidate(arr = [-10, -5, 0, 3, 9, 12],k = 3,x = -7) == [-10, -5, 0]\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 5,x = 0) == [0, 0, 0, 0, 0]\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],k = 4,x = 10) == [7, 9, 11, 13]\n assert candidate(arr = [-50, -40, -30, -20, -10, 0, 10, 20, 30, 40, 50],k = 6,x = 15) == [-10, 0, 10, 20, 30, 40]\n assert candidate(arr = [1, 3, 4, 5, 8, 10, 15, 20, 30, 50, 100],k = 4,x = 12) == [5, 8, 10, 15]\n assert candidate(arr = [1, 3, 3, 4, 4, 4, 4, 5, 6, 8, 9],k = 5,x = 4) == [3, 4, 4, 4, 4]\n"}, "metadata": {"canonical_parameter_names": ["arr", "k", "x"], "leetcode_dataset_entry_point": "Solution().findClosestElements", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findClosestElements = function(arr, k, x) {", "container": null, "callable": "findClosestElements", "parameters": [{"name": "arr", "type": "number[]"}, {"name": "k", "type": "number"}, {"name": "x", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 659, "task_id": "split-array-into-consecutive-subsequences", "difficulty": "Medium", "problem_description": "You are given an integer array nums that is sorted in non-decreasing order.\nDetermine if it is possible to split nums into one or more subsequences such that both of the following conditions are true:\n\nEach subsequence is a consecutive increasing sequence (i.e. each integer is exactly one more than the previous integer).\nAll subsequences have a length of 3 or more.\n\nReturn true if you can split nums according to the above conditions, or false otherwise.\nA subsequence of an array is a new array that is formed from the original array by deleting some (can be none) of the elements without disturbing the relative positions of the remaining elements. (i.e., [1,3,5] is a subsequence of [1,2,3,4,5] while [1,3,2] is not).\n \nExample 1:\n\nInput: nums = [1,2,3,3,4,5]\nOutput: true\nExplanation: nums can be split into the following subsequences:\n[1,2,3,3,4,5] --> 1, 2, 3\n[1,2,3,3,4,5] --> 3, 4, 5\n\nExample 2:\n\nInput: nums = [1,2,3,3,4,4,5,5]\nOutput: true\nExplanation: nums can be split into the following subsequences:\n[1,2,3,3,4,4,5,5] --> 1, 2, 3, 4, 5\n[1,2,3,3,4,4,5,5] --> 3, 4, 5\n\nExample 3:\n\nInput: nums = [1,2,3,4,4,5]\nOutput: false\nExplanation: It is impossible to split nums into consecutive increasing subsequences of length 3 or more.\n\n \nConstraints:\n\n1 <= nums.length <= 104\n-1000 <= nums[i] <= 1000\nnums is sorted in non-decreasing order.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 4, 4, 5]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10]) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5]) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 5]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5]) == True\n assert candidate(nums = [1, 2, 3, 3, 3, 3, 4, 5, 6]) == False\n assert candidate(nums = [1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]) == True\n assert candidate(nums = [1, 2, 3, 4, 4, 5, 5, 5, 6, 7]) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 5]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [1, 2, 3, 3, 3, 4, 5, 5, 5, 6, 7, 7, 7, 8, 9, 9, 9, 10, 10, 10]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15]) == False\n assert candidate(nums = [1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 8, 9, 10, 10]) == False\n assert candidate(nums = [-1000, -999, -999, -998, -997, -996, -995, -994, -993, -992, -991, -990, -899, -898, -897, -896, -895, -894, -893, -892, -891, -890]) == False\n assert candidate(nums = [1, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 11, 12, 12, 13, 13, 14, 14, 15, 15, 15, 16]) == False\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 12]) == False\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6]) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 6, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 14, 15, 16, 16, 17, 18, 19]) == True\n assert candidate(nums = [1, 2, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 15, 15]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 11, 12, 13, 14, 15, 15, 15]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10]) == False\n assert candidate(nums = [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 5, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 6, 6, 6, 7, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20]) == True\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 8, 8, 9, 10, 10, 10, 11, 12, 13, 13, 13, 14, 15, 15, 16, 17, 18, 18, 18, 19, 20, 20, 21, 22, 23, 24, 25, 25]) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == True\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 15]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10, 10, 10, 11, 12, 13, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == False\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14]) == False\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11]) == False\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10]) == False\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, 25, 26, 26, 26, 27, 27, 28, 28, 29, 29, 30]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 11, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 6, 6, 6, 7, 8, 9, 9, 10, 10, 10, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16]) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 7, 7, 8, 9, 10, 10]) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9]) == False\n assert candidate(nums = [1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13]) == True\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == True\n assert candidate(nums = [-3, -2, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == True\n assert candidate(nums = [1, 2, 3, 3, 3, 4, 5, 5, 5, 6, 7, 8, 9, 10, 10, 10, 11, 12, 13, 13, 14, 15]) == False\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10]) == True\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6]) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 14, 15]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 11]) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12]) == True\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == False\n assert candidate(nums = [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 15, 15]) == False\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15]) == True\n assert candidate(nums = [-5, -4, -4, -3, -3, -2, -2, -1, -1, 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 10, 10, 10]) == False\n assert candidate(nums = [1, 2, 3, 3, 4, 5, 5, 6, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13]) == False\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17]) == True\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7]) == False\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13]) == False\n assert candidate(nums = [1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 10]) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 16, 17, 18, 19, 20, 20, 20, 20, 20]) == False\n assert candidate(nums = [1, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8]) == False\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 10, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 20]) == False\n assert candidate(nums = [-1, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10]) == True\n assert candidate(nums = [1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10]) == True\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 13, 14, 14, 15, 15, 16, 17, 17, 18, 19, 19, 20, 21, 22, 23, 24, 25, 25, 25]) == False\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12]) == True\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 10, 10, 11, 12, 13, 14, 15]) == False\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16]) == True\n assert candidate(nums = [1, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8]) == False\n assert candidate(nums = [5, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20]) == True\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 15, 15]) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 10, 11, 12, 13, 14, 15, 15, 16, 17, 18]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == True\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13]) == True\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().isPossible", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isPossible = function(nums) {", "container": null, "callable": "isPossible", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 661, "task_id": "image-smoother", "difficulty": "Easy", "problem_description": "An image smoother is a filter of the size 3 x 3 that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cells in the blue smoother). If one or more of the surrounding cells of a cell is not present, we do not consider it in the average (i.e., the average of the four cells in the red smoother).\n\nGiven an m x n integer matrix img representing the grayscale of an image, return the image after applying the smoother on each cell of it.\n \nExample 1:\n\n\nInput: img = [[1,1,1],[1,0,1],[1,1,1]]\nOutput: [[0,0,0],[0,0,0],[0,0,0]]\nExplanation:\nFor the points (0,0), (0,2), (2,0), (2,2): floor(3/4) = floor(0.75) = 0\nFor the points (0,1), (1,0), (1,2), (2,1): floor(5/6) = floor(0.83333333) = 0\nFor the point (1,1): floor(8/9) = floor(0.88888889) = 0\n\nExample 2:\n\n\nInput: img = [[100,200,100],[200,50,200],[100,200,100]]\nOutput: [[137,141,137],[141,138,141],[137,141,137]]\nExplanation:\nFor the points (0,0), (0,2), (2,0), (2,2): floor((100+200+200+50)/4) = floor(137.5) = 137\nFor the points (0,1), (1,0), (1,2), (2,1): floor((200+200+50+200+100+100)/6) = floor(141.666667) = 141\nFor the point (1,1): floor((50+200+200+200+200+100+100+100+100)/9) = floor(138.888889) = 138\n\n \nConstraints:\n\nm == img.length\nn == img[i].length\n1 <= m, n <= 200\n0 <= img[i][j] <= 255\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(img = [[100, 200, 100], [200, 50, 200], [100, 200, 100]]) == [[137, 141, 137], [141, 138, 141], [137, 141, 137]]\n assert candidate(img = [[10, 20, 30], [40, 50, 60], [70, 80, 90]]) == [[30, 35, 40], [45, 50, 55], [60, 65, 70]]\n assert candidate(img = [[1]]) == [[1]]\n assert candidate(img = [[255, 255, 255], [255, 255, 255], [255, 255, 255]]) == [[255, 255, 255], [255, 255, 255], [255, 255, 255]]\n assert candidate(img = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == [[3, 3, 4], [4, 5, 5], [6, 6, 7]]\n assert candidate(img = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == [[0, 0, 0], [0, 0, 0], [0, 0, 0]]\n assert candidate(img = [[1, 2], [3, 4]]) == [[2, 2], [2, 2]]\n assert candidate(img = [[1, 2, 3], [4, 5, 6]]) == [[3, 3, 4], [3, 3, 4]]\n assert candidate(img = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) == [[3, 4, 5, 5], [5, 6, 7, 7], [9, 10, 11, 11], [11, 12, 13, 13]]\n assert candidate(img = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == [[0, 0, 0], [0, 0, 0], [0, 0, 0]]\n assert candidate(img = [[255]]) == [[255]]\n assert candidate(img = [[1, 1], [1, 1]]) == [[1, 1], [1, 1]]\n assert candidate(img = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(img = [[255, 255, 255, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 255, 255, 255]]) == [[191, 170, 170, 191], [170, 141, 141, 170], [170, 141, 141, 170], [191, 170, 170, 191]]\n assert candidate(img = [[128, 64, 32, 16, 8], [8, 128, 64, 32, 16], [16, 8, 128, 64, 32], [32, 16, 8, 128, 64], [64, 32, 16, 8, 128]]) == [[82, 70, 56, 28, 18], [58, 64, 59, 43, 28], [34, 45, 64, 59, 56], [28, 35, 45, 64, 70], [36, 28, 34, 58, 82]]\n assert candidate(img = [[255, 0, 255], [0, 255, 0], [255, 0, 255]]) == [[127, 127, 127], [127, 141, 127], [127, 127, 127]]\n assert candidate(img = [[123, 45, 67], [89, 101, 113], [125, 137, 149], [161, 173, 185], [197, 209, 221]]) == [[89, 89, 81], [103, 105, 102], [131, 137, 143], [167, 173, 179], [185, 191, 197]]\n assert candidate(img = [[255, 0, 0], [0, 255, 0], [0, 0, 255]]) == [[127, 85, 63], [85, 85, 85], [63, 85, 127]]\n assert candidate(img = [[10, 20, 30, 40, 50], [60, 70, 80, 90, 100], [110, 120, 130, 140, 150], [160, 170, 180, 190, 200], [210, 220, 230, 240, 250]]) == [[40, 45, 55, 65, 70], [65, 70, 80, 90, 95], [115, 120, 130, 140, 145], [165, 170, 180, 190, 195], [190, 195, 205, 215, 220]]\n assert candidate(img = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(img = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30]]) == [[4, 5, 6, 7, 8, 8], [7, 8, 9, 10, 11, 11], [13, 14, 15, 16, 17, 17], [19, 20, 21, 22, 23, 23], [22, 23, 24, 25, 26, 26]]\n assert candidate(img = [[255, 127, 63, 31], [15, 7, 3, 1], [255, 255, 255, 255], [255, 255, 255, 255]]) == [[101, 78, 38, 24], [152, 137, 110, 101], [173, 172, 171, 170], [255, 255, 255, 255]]\n assert candidate(img = [[10, 20], [30, 40]]) == [[25, 25], [25, 25]]\n assert candidate(img = [[200, 150, 100], [50, 0, 50], [100, 150, 200]]) == [[100, 91, 75], [108, 111, 108], [75, 91, 100]]\n assert candidate(img = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]) == [[3, 3, 4], [4, 5, 5], [7, 8, 8], [10, 11, 11], [12, 12, 13]]\n assert candidate(img = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]\n assert candidate(img = [[123, 156, 189], [212, 245, 278], [311, 344, 377]]) == [[184, 200, 217], [231, 248, 264], [278, 294, 311]]\n assert candidate(img = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]\n assert candidate(img = [[255, 0, 0, 255], [0, 0, 0, 0], [0, 0, 0, 0], [255, 0, 0, 255]]) == [[63, 42, 42, 63], [42, 28, 28, 42], [42, 28, 28, 42], [63, 42, 42, 63]]\n assert candidate(img = [[50, 50, 50], [50, 50, 50], [50, 50, 50], [50, 50, 50]]) == [[50, 50, 50], [50, 50, 50], [50, 50, 50], [50, 50, 50]]\n assert candidate(img = [[255, 0, 255, 0, 255], [0, 255, 0, 255, 0], [255, 0, 255, 0, 255], [0, 255, 0, 255, 0], [255, 0, 255, 0, 255]]) == [[127, 127, 127, 127, 127], [127, 141, 113, 141, 127], [127, 113, 141, 113, 127], [127, 141, 113, 141, 127], [127, 127, 127, 127, 127]]\n assert candidate(img = [[255, 255, 255, 255, 255], [255, 255, 255, 255, 255], [255, 255, 255, 255, 255], [255, 255, 255, 255, 255], [255, 255, 255, 255, 255]]) == [[255, 255, 255, 255, 255], [255, 255, 255, 255, 255], [255, 255, 255, 255, 255], [255, 255, 255, 255, 255], [255, 255, 255, 255, 255]]\n assert candidate(img = [[200, 50, 50], [50, 200, 50], [50, 50, 200]]) == [[125, 100, 87], [100, 100, 100], [87, 100, 125]]\n assert candidate(img = [[0, 0, 0, 0], [0, 255, 255, 0], [0, 255, 255, 0], [0, 0, 0, 0]]) == [[63, 85, 85, 63], [85, 113, 113, 85], [85, 113, 113, 85], [63, 85, 85, 63]]\n assert candidate(img = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 255, 255, 255, 1, 0], [0, 1, 255, 0, 255, 1, 0], [0, 1, 255, 255, 255, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == [[0, 0, 0, 0, 0, 0, 0], [0, 28, 57, 85, 57, 28, 0], [0, 57, 85, 142, 85, 57, 0], [0, 85, 142, 226, 142, 85, 0], [0, 57, 85, 142, 85, 57, 0], [0, 28, 57, 85, 57, 28, 0], [0, 0, 0, 0, 0, 0, 0]]\n assert candidate(img = [[10, 20, 30], [40, 50, 60], [70, 80, 90], [100, 110, 120], [130, 140, 150]]) == [[30, 35, 40], [45, 50, 55], [75, 80, 85], [105, 110, 115], [120, 125, 130]]\n assert candidate(img = [[255, 0, 0, 0, 255], [0, 255, 255, 255, 0], [0, 255, 0, 255, 0], [0, 255, 255, 255, 0], [255, 0, 0, 0, 255]]) == [[127, 127, 127, 127, 127], [127, 113, 141, 113, 127], [127, 141, 226, 141, 127], [127, 113, 141, 113, 127], [127, 127, 127, 127, 127]]\n assert candidate(img = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 255, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == [[0, 0, 0, 0, 0], [0, 28, 28, 28, 0], [0, 28, 29, 28, 0], [0, 28, 28, 28, 0], [0, 0, 0, 0, 0]]\n assert candidate(img = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) == [[3, 4, 5, 5], [5, 6, 7, 7], [9, 10, 11, 11], [11, 12, 13, 13]]\n assert candidate(img = [[0, 1, 2, 3, 4, 5, 6, 7, 8], [9, 10, 11, 12, 13, 14, 15, 16, 17], [18, 19, 20, 21, 22, 23, 24, 25, 26]]) == [[5, 5, 6, 7, 8, 9, 10, 11, 12], [9, 10, 11, 12, 13, 14, 15, 16, 16], [14, 14, 15, 16, 17, 18, 19, 20, 21]]\n assert candidate(img = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]) == [[4, 4, 5, 6, 7], [6, 7, 8, 9, 9], [11, 12, 13, 14, 14], [14, 14, 15, 16, 17]]\n assert candidate(img = [[0, 1, 2, 3, 4, 5], [5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5], [5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5], [5, 4, 3, 2, 1, 0]]) == [[2, 2, 2, 2, 2, 2], [1, 2, 2, 2, 3, 3], [3, 3, 2, 2, 2, 1], [1, 2, 2, 2, 3, 3], [3, 3, 2, 2, 2, 1], [2, 2, 2, 2, 2, 2]]\n assert candidate(img = [[100, 200, 300, 400, 500], [600, 700, 800, 900, 1000], [1100, 1200, 1300, 1400, 1500], [1600, 1700, 1800, 1900, 2000], [2100, 2200, 2300, 2400, 2500]]) == [[400, 450, 550, 650, 700], [650, 700, 800, 900, 950], [1150, 1200, 1300, 1400, 1450], [1650, 1700, 1800, 1900, 1950], [1900, 1950, 2050, 2150, 2200]]\n assert candidate(img = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(img = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]\n assert candidate(img = [[10, 20, 30, 40], [50, 60, 70, 80], [90, 100, 110, 120], [130, 140, 150, 160], [170, 180, 190, 200]]) == [[35, 40, 50, 55], [55, 60, 70, 75], [95, 100, 110, 115], [135, 140, 150, 155], [155, 160, 170, 175]]\n assert candidate(img = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]\n assert candidate(img = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36]]) == [[4, 5, 6, 7, 8, 8], [7, 8, 9, 10, 11, 11], [13, 14, 15, 16, 17, 17], [19, 20, 21, 22, 23, 23], [25, 26, 27, 28, 29, 29], [28, 29, 30, 31, 32, 32]]\n assert candidate(img = [[255, 100, 50, 25, 0], [25, 50, 100, 255, 255], [0, 25, 50, 100, 255], [255, 255, 100, 50, 25], [25, 100, 255, 255, 0]]) == [[107, 96, 96, 114, 133], [75, 72, 83, 121, 148], [101, 95, 109, 132, 156], [110, 118, 132, 121, 114], [158, 165, 169, 114, 82]]\n assert candidate(img = [[50, 100, 150, 200], [250, 50, 100, 150], [200, 250, 50, 100], [100, 150, 200, 250]]) == [[112, 116, 125, 150], [150, 133, 127, 125], [166, 150, 144, 141], [175, 158, 166, 150]]\n assert candidate(img = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]) == [[4, 4, 5, 6, 7], [6, 7, 8, 9, 9], [11, 12, 13, 14, 14], [16, 17, 18, 19, 19], [19, 19, 20, 21, 22]]\n assert candidate(img = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]\n assert candidate(img = [[150, 160, 170, 180], [190, 200, 210, 220], [230, 240, 250, 260], [270, 280, 290, 300]]) == [[175, 180, 190, 195], [195, 200, 210, 215], [235, 240, 250, 255], [255, 260, 270, 275]]\n assert candidate(img = [[255, 255, 255, 255], [255, 0, 0, 255], [255, 0, 255, 255], [255, 255, 255, 255]]) == [[191, 170, 170, 191], [170, 170, 170, 212], [170, 170, 170, 212], [191, 212, 212, 255]]\n assert candidate(img = [[100, 100, 100, 100, 100], [100, 100, 100, 100, 100], [100, 100, 100, 100, 100], [100, 100, 100, 100, 100], [100, 100, 100, 100, 100]]) == [[100, 100, 100, 100, 100], [100, 100, 100, 100, 100], [100, 100, 100, 100, 100], [100, 100, 100, 100, 100], [100, 100, 100, 100, 100]]\n assert candidate(img = [[10, 10, 10], [10, 10, 10], [10, 10, 10], [10, 10, 10], [10, 10, 10]]) == [[10, 10, 10], [10, 10, 10], [10, 10, 10], [10, 10, 10], [10, 10, 10]]\n assert candidate(img = [[100, 150, 200, 250], [100, 150, 200, 250], [100, 150, 200, 250], [100, 150, 200, 250], [100, 150, 200, 250], [100, 150, 200, 250]]) == [[125, 150, 200, 225], [125, 150, 200, 225], [125, 150, 200, 225], [125, 150, 200, 225], [125, 150, 200, 225], [125, 150, 200, 225]]\n assert candidate(img = [[0, 255, 255], [255, 255, 0], [255, 0, 0]]) == [[191, 170, 191], [170, 141, 127], [191, 127, 63]]\n assert candidate(img = [[100, 200, 150], [175, 200, 125], [100, 150, 200]]) == [[168, 158, 168], [154, 155, 170], [156, 158, 168]]\n assert candidate(img = [[50, 50, 50, 50], [50, 50, 50, 50], [50, 50, 50, 50], [50, 50, 50, 50]]) == [[50, 50, 50, 50], [50, 50, 50, 50], [50, 50, 50, 50], [50, 50, 50, 50]]\n assert candidate(img = [[255, 255, 255], [255, 0, 255], [255, 255, 255]]) == [[191, 212, 191], [212, 226, 212], [191, 212, 191]]\n assert candidate(img = [[128, 64, 32], [16, 8, 4], [2, 1, 0]]) == [[54, 42, 27], [36, 28, 18], [6, 5, 3]]\n assert candidate(img = [[50, 100, 150, 200, 250], [250, 50, 100, 150, 200], [200, 250, 50, 100, 150], [150, 200, 250, 50, 100], [100, 150, 200, 250, 50]]) == [[112, 116, 125, 175, 200], [150, 133, 127, 150, 175], [183, 166, 133, 127, 125], [175, 172, 166, 133, 116], [150, 175, 183, 150, 112]]\n assert candidate(img = [[255, 0, 255, 0], [0, 255, 0, 255], [255, 0, 255, 0], [0, 255, 0, 255]]) == [[127, 127, 127, 127], [127, 141, 113, 127], [127, 113, 141, 127], [127, 127, 127, 127]]\n assert candidate(img = [[100, 200, 150, 125], [250, 50, 75, 200], [150, 250, 100, 50], [200, 100, 250, 150]]) == [[150, 137, 133, 137], [166, 147, 133, 116], [166, 158, 136, 137], [175, 175, 150, 137]]\n assert candidate(img = [[5, 10, 15, 20], [25, 30, 35, 40], [45, 50, 55, 60], [65, 70, 75, 80]]) == [[17, 20, 25, 27], [27, 30, 35, 37], [47, 50, 55, 57], [57, 60, 65, 67]]\n assert candidate(img = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18]]) == [[3, 3, 4], [4, 5, 5], [7, 8, 8], [10, 11, 11], [13, 14, 14], [15, 15, 16]]\n assert candidate(img = [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]]) == [[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]]\n assert candidate(img = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]) == [[3, 3, 4], [4, 5, 5], [7, 8, 8], [10, 11, 11], [12, 12, 13]]\n assert candidate(img = [[10, 20, 30, 40, 50], [20, 30, 40, 50, 60], [30, 40, 50, 60, 70], [40, 50, 60, 70, 80], [50, 60, 70, 80, 90]]) == [[20, 25, 35, 45, 50], [25, 30, 40, 50, 55], [35, 40, 50, 60, 65], [45, 50, 60, 70, 75], [50, 55, 65, 75, 80]]\n assert candidate(img = [[255, 255, 255, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 255, 255, 255]]) == [[191, 170, 170, 191], [170, 141, 141, 170], [170, 141, 141, 170], [191, 170, 170, 191]]\n assert candidate(img = [[50, 60, 70, 80], [40, 50, 60, 70], [30, 40, 50, 60], [20, 30, 40, 50]]) == [[50, 55, 65, 70], [45, 50, 60, 65], [35, 40, 50, 55], [30, 35, 45, 50]]\n assert candidate(img = [[128, 128, 128], [128, 128, 128], [128, 128, 128], [128, 128, 128], [128, 128, 128]]) == [[128, 128, 128], [128, 128, 128], [128, 128, 128], [128, 128, 128], [128, 128, 128]]\n assert candidate(img = [[0, 0, 0, 0, 0], [0, 255, 255, 255, 0], [0, 255, 255, 255, 0], [0, 255, 255, 255, 0], [0, 0, 0, 0, 0]]) == [[63, 85, 127, 85, 63], [85, 113, 170, 113, 85], [127, 170, 255, 170, 127], [85, 113, 170, 113, 85], [63, 85, 127, 85, 63]]\n assert candidate(img = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 7, 5, 3, 1], [2, 4, 6, 8, 10, 8, 6, 4, 2], [1, 1, 1, 1, 1, 1, 1, 1, 1], [2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2], [3, 2, 1, 4, 5, 6, 9, 8, 7], [7, 8, 9, 6, 5, 4, 1, 2, 3]]) == [[5, 5, 5, 5, 5, 5, 5, 5, 5], [4, 4, 5, 5, 5, 5, 5, 4, 4], [4, 5, 6, 7, 7, 6, 4, 3, 2], [2, 2, 4, 5, 5, 5, 4, 2, 2], [2, 2, 3, 4, 5, 5, 5, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 5, 5, 6, 6, 6, 6], [6, 6, 6, 5, 5, 5, 4, 4, 4], [5, 5, 5, 5, 5, 5, 5, 5, 5]]\n assert candidate(img = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]) == [[4, 4, 5, 6, 7], [6, 7, 8, 9, 9], [11, 12, 13, 14, 14], [16, 17, 18, 19, 19], [19, 19, 20, 21, 22]]\n assert candidate(img = [[0, 0, 0, 0, 0, 0], [0, 255, 255, 255, 255, 0], [0, 255, 0, 0, 255, 0], [0, 255, 0, 0, 255, 0], [0, 255, 255, 255, 255, 0], [0, 0, 0, 0, 0, 0]]) == [[63, 85, 127, 127, 85, 63], [85, 85, 113, 113, 85, 85], [127, 113, 141, 141, 113, 127], [127, 113, 141, 141, 113, 127], [85, 85, 113, 113, 85, 85], [63, 85, 127, 127, 85, 63]]\n assert candidate(img = [[255, 0, 0, 255, 0], [0, 255, 0, 255, 0], [0, 0, 255, 0, 0], [0, 255, 0, 255, 0], [255, 0, 0, 255, 0]]) == [[127, 85, 127, 85, 127], [85, 85, 113, 85, 85], [85, 85, 141, 85, 85], [85, 85, 113, 85, 85], [127, 85, 127, 85, 127]]\n assert candidate(img = [[255, 0, 255, 0], [0, 255, 0, 255], [255, 0, 255, 0], [0, 255, 0, 255]]) == [[127, 127, 127, 127], [127, 141, 113, 127], [127, 113, 141, 127], [127, 127, 127, 127]]\n assert candidate(img = [[255, 0, 0, 0], [0, 255, 0, 0], [0, 0, 255, 0], [0, 0, 0, 255]]) == [[127, 85, 42, 0], [85, 85, 56, 42], [42, 56, 85, 85], [0, 42, 85, 127]]\n assert candidate(img = [[200, 100, 150, 200, 50], [50, 100, 150, 200, 250], [250, 200, 150, 100, 50], [50, 100, 150, 200, 250], [250, 200, 150, 100, 50]]) == [[112, 125, 150, 166, 175], [150, 150, 150, 144, 141], [125, 133, 150, 166, 175], [175, 166, 150, 133, 125], [150, 150, 150, 150, 150]]\n"}, "metadata": {"canonical_parameter_names": ["img"], "leetcode_dataset_entry_point": "Solution().imageSmoother", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var imageSmoother = function(img) {", "container": null, "callable": "imageSmoother", "parameters": [{"name": "img", "type": "number[][]"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 662, "task_id": "maximum-width-of-binary-tree", "difficulty": "Medium", "problem_description": "Given the root of a binary tree, return the maximum width of the given tree.\nThe maximum width of a tree is the maximum width among all levels.\nThe width of one level is defined as the length between the end-nodes (the leftmost and rightmost non-null nodes), where the null nodes between the end-nodes that would be present in a complete binary tree extending down to that level are also counted into the length calculation.\nIt is guaranteed that the answer will in the range of a 32-bit signed integer.\n \nExample 1:\n\n\nInput: root = [1,3,2,5,3,null,9]\nOutput: 4\nExplanation: The maximum width exists in the third level with length 4 (5,3,null,9).\n\nExample 2:\n\n\nInput: root = [1,3,2,5,null,null,9,6,null,7]\nOutput: 7\nExplanation: The maximum width exists in the fourth level with length 7 (6,null,null,null,null,null,7).\n\nExample 3:\n\n\nInput: root = [1,3,2,5]\nOutput: 2\nExplanation: The maximum width exists in the second level with length 2 (3,2).\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 3000].\n-100 <= Node.val <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7])) == 7\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7])) == 5\n assert candidate(root = tree_node([1, 3, 2, 5])) == 2\n assert candidate(root = tree_node([1, None, 2])) == 1\n assert candidate(root = tree_node([1])) == 1\n assert candidate(root = tree_node([1, 3, None, None, 5])) == 1\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 49\n assert candidate(root = tree_node([1, 2, 3, None, 5, None, 7, 8, None, None, 9, None, None, 10])) == 6\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, None, None, None, 8])) == 7\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, None, None, 7, 8, 9, None, None, None, None, 10, None, None, 11])) == 2\n assert candidate(root = tree_node([1, 2, 2, 3, None, None, 3, 4, None, None, 4])) == 8\n assert candidate(root = tree_node([1, 3, None, 5, 3, None, 9, 6, 7, None, 8, None, None, None, 9, None, None, None, None, 10])) == 5\n assert candidate(root = tree_node([1, 3, None, 5, 3, None, 9])) == 2\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, 6, None, 7, 8, None, 10, None, None, 11, None, None, None, None, None, None, None, 12])) == 8\n assert candidate(root = tree_node([1, 3, 2, 5, None, 3, 9, 6, 7, None, None, None, None, 8, None, None, 10, None, None, None, 11, None, 12])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, 6, None, 7, None, None, 8, None, None, None, None, None, None, None, 17])) == 8\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, 6, None, 7, None, None, None, None, 8])) == 4\n assert candidate(root = tree_node([1, 2, None, 4, None, None, None, 8, None, None, None, None, None, None, None, 16])) == 1\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16])) == 65\n assert candidate(root = tree_node([1, 3, 2, None, 5, 6, None, 7, None, None, 8, None, 9, None, 10])) == 7\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, 6, None, None, 7, None, None, 8, 9])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, 10, None, None, 11, None, None, None, None, 12, None, None, 13, None, None, 14, None, None, 15])) == 14\n assert candidate(root = tree_node([1, None, 3, None, None, None, 9, 6, None, 7])) == 1\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8])) == 8\n assert candidate(root = tree_node([1, 3, 2, None, None, None, 9, 6, None, None, 7, None, None, None, None, None, 8, None, None, None, 10])) == 2\n assert candidate(root = tree_node([1, 3, 2, 5, 4, 6, 7, None, 9, 10, 11, None, None, 12, None, None, 13, None, None, None, None, 14, None, None, None, None, 15])) == 10\n assert candidate(root = tree_node([1, None, 2, None, None, None, 3, None, None, None, None, 4, None, None, None, None, 5])) == 1\n assert candidate(root = tree_node([1, None, 2, None, None, 3, None, None, None, None, 4])) == 1\n assert candidate(root = tree_node([1, 3, 2, 5, 3, 9, 6, 7, 8, 10, 11, 12, 13, 14, 15])) == 8\n assert candidate(root = tree_node([1, 3, 2, None, None, 5, 4, None, None, 8, None, None, 7, 9, 10])) == 2\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, None, None, None, None, 8])) == 7\n assert candidate(root = tree_node([1, 3, 2, 5, None, 9, 6, 7, None, None, None, 8])) == 7\n assert candidate(root = tree_node([1, 3, None, 5, 3, None, 9, 6, None, 7, None, None, 8])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, None, None, None, None, None, None, 6, None, 7])) == 4\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == 15\n assert candidate(root = tree_node([1, 3, 2, None, None, 5, None, 6])) == 2\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12])) == 2\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == 8\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, 10, None, None, 11, None, None, None, None, 12])) == 14\n assert candidate(root = tree_node([1, None, 2, None, None, 3, None, None, 4, None, None, 5, None, None, 6])) == 1\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, 7, None, None, None, None, None, 8, 9, 10])) == 4\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, None, 6, 7, None, None, None, None, None, None, 8, 9, None, None, None, None, 10, 11])) == 3\n assert candidate(root = tree_node([1, 3, 2, 5, None, 9, 6, None, 7, None, None, 8, None, None, None, 11, None, None, None, 12, None, None, None, 13])) == 6\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, None, None, 7, 8, None, None, None, None, 10, 11])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, 6, None, None, 7, None, 8, None, 9])) == 8\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5])) == 1\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, 6, None, 7, None, None, None, None, None, None, 8])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, None, None, None, None, 6, None, None, None, None, 7, None, None, None, None, 8])) == 4\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, 6, None, 7, None, 8, 9, 10, None, None, None, None, None, None, 11])) == 5\n assert candidate(root = tree_node([1, None, 2, 3, None, 4, 5, 6, None, 7, None, 8, None, 9, None, 10])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 13\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4])) == 1\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 65\n assert candidate(root = tree_node([1, 3, 2, 5, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == 8\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, 6, None, 7, None, None, None, None, None, 8, None, None, 11])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, 4, None, 9, None, None, 6, 7, 8, 9])) == 6\n assert candidate(root = tree_node([1, None, 3, 2, None, 4, None, 5, 6, None, 7, None, 8, None, 9, None, 10, None, 11])) == 5\n assert candidate(root = tree_node([1, 3, 2, 5, None, 9, 6, None, 7, 8, None, None, None, None, 10])) == 4\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, 6, 7, None, None, None, None, None, None, 8, 9])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, None, None, 6, None, None, None, None, 7, None, None, 8, None, None, None, None, 9, None, None, 10, None, None, 11, None, 12])) == 4\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 1\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, None, None, 6, None, None, None, None, 7, None, None, None, None, 8, None, None, None, None, 9])) == 4\n assert candidate(root = tree_node([1, 3, 2, None, 5, 6, None, 7, None, 8, 9])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, 6, None, 7, None, 8, None, 9])) == 7\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, None, None, 6, None, None, None, None, 7, None, None, None, None, 8, None, None, None, None, 9, None, None, None, None, 10])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, 3, 9, 8, 6, None, 7, None, None, None, 10, None, None, 11])) == 7\n assert candidate(root = tree_node([1, 3, 2, 5, 3, 9, 8, 6, None, None, None, None, 7, None, None, 10])) == 6\n assert candidate(root = tree_node([1, 3, 2, None, None, 5, 9, None, 6, 7, None, None, None, 8, 9])) == 2\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7])) == 1\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, 8, None, 9, None, 10])) == 13\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6])) == 1\n assert candidate(root = tree_node([1, 3, None, 5, 3])) == 2\n assert candidate(root = tree_node([1, 3, 2, 5, None, 9, 6, 7, 8, None, None, 10, None, None, None, 11, None, None, None, 12, None, None, None, 13, None, None, None, 14, None, None, None, 15])) == 7\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, 10, None, None, 11])) == 14\n assert candidate(root = tree_node([1, 3, 2, None, 3, None, 2, None, None, 5, 6, None, None, 7, 8, None, None, 9, None, None, None, None, None, 10])) == 3\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12])) == 1\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, None, 8, None, 7])) == 7\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, 6, None, 7, None, 8, None, 9])) == 5\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, None, None, None, None, 6, None, None, 7])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, None, None, None, None, None, 6, None, None, None, None, None, None, 7])) == 4\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13])) == 49\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14])) == 49\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12])) == 25\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])) == 8\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, None, None, 6, None, None, 7])) == 4\n assert candidate(root = tree_node([1, None, 2, 3, None, 4, None, None, 5])) == 1\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, None, 8, None, None, None, None, None, None, None, 17, None, None, None, None, None, None, None, None, None, None, None, None, None, 18])) == 7\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, 10, None, None, 11, None, None, None, None, 12, None, None, 13])) == 14\n assert candidate(root = tree_node([1, 3, None, None, 2])) == 1\n assert candidate(root = tree_node([1, 3, 2, None, None, 5, 9, None, None, None, 7, None, None, None, None, 8, 9])) == 2\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, None, None, 8, None, None, 10, 11, None, None, None, None, 12, None, 13])) == 7\n assert candidate(root = tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, 8, None, None, None, 9, None, None, None, 10])) == 7\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, None, None, 6, None, None, None, None, 7, None, None, None, None, 8, None, None, None, None, 9, None, None, None, None, 10, None, None, 11, None, 12, None, 13, None, 14, None, 15])) == 4\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().widthOfBinaryTree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var widthOfBinaryTree = function(root) {", "container": null, "callable": "widthOfBinaryTree", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 664, "task_id": "strange-printer", "difficulty": "Hard", "problem_description": "There is a strange printer with the following two special properties:\n\nThe printer can only print a sequence of the same character each time.\nAt each turn, the printer can print new characters starting from and ending at any place and will cover the original existing characters.\n\nGiven a string s, return the minimum number of turns the printer needed to print it.\n \nExample 1:\n\nInput: s = \"aaabbb\"\nOutput: 2\nExplanation: Print \"aaa\" first and then print \"bbb\".\n\nExample 2:\n\nInput: s = \"aba\"\nOutput: 2\nExplanation: Print \"aaa\" first and then print \"b\" from the second place of the string, which will cover the existing character 'a'.\n\n \nConstraints:\n\n1 <= s.length <= 100\ns consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"pppppppp\") == 1\n assert candidate(s = \"abcba\") == 3\n assert candidate(s = \"aabbaa\") == 2\n assert candidate(s = \"zzzzy\") == 2\n assert candidate(s = \"abababab\") == 5\n assert candidate(s = \"ppqpqr\") == 4\n assert candidate(s = \"a\") == 1\n assert candidate(s = \"abcabcabc\") == 7\n assert candidate(s = \"aabbc\") == 3\n assert candidate(s = \"aabaa\") == 2\n assert candidate(s = \"abcabc\") == 5\n assert candidate(s = \"abcdabcd\") == 7\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnm\") == 26\n assert candidate(s = \"abcdabcdabcd\") == 10\n assert candidate(s = \"abc\") == 3\n assert candidate(s = \"abcd\") == 4\n assert candidate(s = \"aaabbb\") == 2\n assert candidate(s = \"zzzzyyyxx\") == 3\n assert candidate(s = \"aabbccddeeff\") == 6\n assert candidate(s = \"aba\") == 2\n assert candidate(s = \"aabbcc\") == 3\n assert candidate(s = \"abacaba\") == 4\n assert candidate(s = \"abca\") == 3\n assert candidate(s = \"abacabadabacabadabacaba\") == 12\n assert candidate(s = \"aabbaabbaabb\") == 4\n assert candidate(s = \"abababababaabababa\") == 9\n assert candidate(s = \"abcabcabcabc\") == 9\n assert candidate(s = \"abacabadabacabadabacabadabacabad\") == 17\n assert candidate(s = \"abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefg\") == 43\n assert candidate(s = \"zzyzxzyzxzyzxzyzxzyzxzyzxzyz\") == 14\n assert candidate(s = \"aabbccddeeaabbccddeeaabbcc\") == 11\n assert candidate(s = \"aabbaaabbbaaa\") == 3\n assert candidate(s = \"abcdefghabcdeghijklmno\") == 21\n assert candidate(s = \"aaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbcccccccccccccccccc\") == 3\n assert candidate(s = \"aabbccddeeaabbccddeeaabbccddeeaabbcc\") == 15\n assert candidate(s = \"zzzzzyyyzzzzyyy\") == 3\n assert candidate(s = \"ababababababababababababababababababababababababababababababababababababababababababababa\") == 45\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabc\") == 21\n assert candidate(s = \"abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij\") == 46\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == 33\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\") == 26\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzz\") == 26\n assert candidate(s = \"abacabad\") == 5\n assert candidate(s = \"aaaabbbbccccddddeeeeaabbcc\") == 7\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == 1\n assert candidate(s = \"abcabcabcabcabcabc\") == 13\n assert candidate(s = \"zzzzzzzzzzzzzzy\") == 2\n assert candidate(s = \"aabbccddeeffgghhii\") == 9\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzy\") == 2\n assert candidate(s = \"abcdeffedcba\") == 6\n assert candidate(s = \"aaaaaaaaaabbbbbbbbccccccccddddddddeeeeeeeefffffffff\") == 6\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == 1\n assert candidate(s = \"abcdefedcba\") == 6\n assert candidate(s = \"aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabb\") == 13\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == 1\n assert candidate(s = \"abababababababababababababab\") == 15\n assert candidate(s = \"abcdeedcbaedcbaedcba\") == 13\n assert candidate(s = \"abacabadabacaba\") == 8\n assert candidate(s = \"abababababababababababababababababababababababab\") == 25\n assert candidate(s = \"aaaaaaaaaabbbbbbbbbbcccccccccc\") == 3\n assert candidate(s = \"aaabbbcccdddfffgggaaa\") == 6\n assert candidate(s = \"aaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbccccccccccccccccccccdddddddddddddddddd\") == 4\n assert candidate(s = \"zzyyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccba\") == 26\n assert candidate(s = \"aabbccddeeffaabbccddeeffaabbccddeeffaabbccddeeff\") == 21\n assert candidate(s = \"abcdefghijihgfedcba\") == 10\n assert candidate(s = \"aabbccddeeaabbccddeeaabbccddeeee\") == 13\n assert candidate(s = \"xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz\") == 33\n assert candidate(s = \"abacabadabacabadabacabadabacabadabacabad\") == 21\n assert candidate(s = \"aaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbccccccccccccccccccccddddddddddddddddddaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbcccccccccccccccccc\") == 6\n assert candidate(s = \"zzzyyxxwvvuuttrrqqppoonnmmllkkjjiihhggffeeddccbbaa\") == 25\n assert candidate(s = \"ababababababababababababab\") == 14\n assert candidate(s = \"aabbccddeeffgg\") == 7\n assert candidate(s = \"abacabadabacabadabacabadabacabadabacabadabacabadabacabad\") == 29\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == 26\n assert candidate(s = \"aabbccddeeffgghhiijj\") == 10\n assert candidate(s = \"abacabadabacabadabacabadabacabadabacabadabacabad\") == 25\n assert candidate(s = \"abcdefg\") == 7\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == 26\n assert candidate(s = \"abcabcabcabcabcabcabcabcaabbcc\") == 19\n assert candidate(s = \"abacabadabacabadabacabad\") == 13\n assert candidate(s = \"aaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaab\") == 13\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\") == 26\n assert candidate(s = \"abcbaabcbaabcba\") == 7\n assert candidate(s = \"aabbbcccdddaaabbccccddeee\") == 8\n assert candidate(s = \"aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllll\") == 12\n assert candidate(s = \"ababababab\") == 6\n assert candidate(s = \"abcddcba\") == 4\n assert candidate(s = \"aabbaabbccddeeffaabb\") == 8\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcd\") == 25\n assert candidate(s = \"abcdefghihgfedcba\") == 9\n assert candidate(s = \"abcabcabcabcabcabcabcabcabc\") == 19\n assert candidate(s = \"abcabcabcabcabcabcabcabc\") == 17\n assert candidate(s = \"abcdabcdbaba\") == 8\n assert candidate(s = \"xyzyxzyzyxzyzyxzyz\") == 11\n assert candidate(s = \"abcdefghijhgfedcba\") == 10\n assert candidate(s = \"mississippi\") == 5\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == 1\n assert candidate(s = \"ababababababababababababababababababababababababababa\") == 27\n assert candidate(s = \"abcabcabcabcabc\") == 11\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\") == 37\n assert candidate(s = \"aabbccddeeaabbcc\") == 7\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == 1\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().strangePrinter", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var strangePrinter = function(s) {", "container": null, "callable": "strangePrinter", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 665, "task_id": "non-decreasing-array", "difficulty": "Medium", "problem_description": "Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most one element.\nWe define an array is non-decreasing if nums[i] <= nums[i + 1] holds for every i (0-based) such that (0 <= i <= n - 2).\n \nExample 1:\n\nInput: nums = [4,2,3]\nOutput: true\nExplanation: You could modify the first 4 to 1 to get a non-decreasing array.\n\nExample 2:\n\nInput: nums = [4,2,1]\nOutput: false\nExplanation: You cannot get a non-decreasing array by modifying at most one element.\n\n \nConstraints:\n\nn == nums.length\n1 <= n <= 104\n-105 <= nums[i] <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 5, 4, 6]) == True\n assert candidate(nums = [10, 5, 7]) == True\n assert candidate(nums = [1, 2, 2, 3]) == True\n assert candidate(nums = [1, 2, 3, 5, 4]) == True\n assert candidate(nums = [1, 1, 1]) == True\n assert candidate(nums = [3, 3, 2, 2]) == False\n assert candidate(nums = [2, 2, 3, 2, 4]) == True\n assert candidate(nums = [1, 2, 4]) == True\n assert candidate(nums = [1]) == True\n assert candidate(nums = [2, 2, 2]) == True\n assert candidate(nums = [4, 2, 1]) == False\n assert candidate(nums = [3, 4, 2, 3]) == False\n assert candidate(nums = [1, 2, 3, 4, 5]) == True\n assert candidate(nums = [1, 3, 2]) == True\n assert candidate(nums = [4, 2, 3]) == True\n assert candidate(nums = [5, 7, 1, 8]) == True\n assert candidate(nums = [1, 3, 2, 4, 3]) == False\n assert candidate(nums = [1, 5, 4, 6]) == True\n assert candidate(nums = [1, 2]) == True\n assert candidate(nums = [1, 2, 3]) == True\n assert candidate(nums = [1, 2, 4, 5, 3]) == True\n assert candidate(nums = [1, 4, 5, 6, 3, 7]) == True\n assert candidate(nums = [2, 3, 3, 2, 4, 5]) == True\n assert candidate(nums = [1, 2, 3, 5, 4, 5, 6]) == True\n assert candidate(nums = [5, 6, 3, 4, 7]) == False\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == True\n assert candidate(nums = [1, 3, 2, 3, 2, 2, 3]) == False\n assert candidate(nums = [1, 3, 5, 4, 7, 6, 8]) == False\n assert candidate(nums = [1, 2, 3, 3, 3, 3, 3, 3]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1]) == True\n assert candidate(nums = [3, 3, 3, 3, 3, 3]) == True\n assert candidate(nums = [1, 3, 2, 4, 2, 5]) == False\n assert candidate(nums = [1, 2, 5, 4, 3, 5]) == False\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [1, 3, 2, 2, 2]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 3, 7, 8, 9, 10, 11, 12]) == True\n assert candidate(nums = [1, 5, 3, 5, 6]) == True\n assert candidate(nums = [1, 1, 1, 1, 1]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 10, 9, 11]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 10, 9, 12]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 10]) == True\n assert candidate(nums = [1, 3, 5, 4, 2]) == False\n assert candidate(nums = [1, 5, 3, 4, 5, 6, 2]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 3, 2, 1]) == False\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6]) == False\n assert candidate(nums = [3, 5, 2, 5, 1, 6, 7, 8, 9]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 5]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 2]) == True\n assert candidate(nums = [1, 4, 2, 3, 5]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 2, 3, 4, 5]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 5, 11]) == True\n assert candidate(nums = [1, 2, 4, 5, 3, 5]) == True\n assert candidate(nums = [1, 3, 2, 3, 5, 6, 4, 7, 8, 9, 10]) == False\n assert candidate(nums = [5, 1, 3, 4, 2]) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 0, 1]) == True\n assert candidate(nums = [1, 3, 2, 2, 5]) == True\n assert candidate(nums = [3, 3, 3, 3, 2, 3, 3, 3, 3]) == True\n assert candidate(nums = [1, 2, 3, 3, 3, 2, 4]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 6]) == True\n assert candidate(nums = [1, 2, 3, 4, 6, 5, 7, 8, 9]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 9, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 7, 8]) == True\n assert candidate(nums = [1, 5, 4, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [1, 2, 3, 5, 4, 6, 7, 8]) == True\n assert candidate(nums = [100000, -100000, 0, 100000, -100000]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 2, 1, 6, 7]) == False\n assert candidate(nums = [1, 3, 2, 3, 2, 3]) == False\n assert candidate(nums = [1, 3, 5, 7, 9, 8, 11, 13, 15, 17, 19]) == True\n assert candidate(nums = [1, 3, 2, 4, 3, 5]) == False\n assert candidate(nums = [1, 3, 2, 2, 5]) == True\n assert candidate(nums = [1, 3, 5, 4, 7]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 6, 7]) == True\n assert candidate(nums = [1, 3, 5, 4, 6, 7]) == True\n assert candidate(nums = [8, 9, 10, 2, 11, 12]) == True\n assert candidate(nums = [1, 5, 3, 5, 7, 9, 11, 10]) == False\n assert candidate(nums = [1, 2, 3, 2, 1, 4]) == False\n assert candidate(nums = [1, 2, 3, 3, 2, 2, 3, 4]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 3, 2, 1]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 10, 17]) == True\n assert candidate(nums = [3, 3, 3, 3, 2, 3, 3, 3]) == True\n assert candidate(nums = [1, 3, 2, 4, 5, 3, 6, 7, 8, 9, 10]) == False\n assert candidate(nums = [1, 3, 2, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [1, 2, 3, 4, 3, 3, 5]) == True\n assert candidate(nums = [5, 6, 3, 4, 7, 8, 9]) == False\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 6, 5, 7]) == True\n assert candidate(nums = [3, 5, 4, 5, 6]) == True\n assert candidate(nums = [1, 2, 4, 3, 6, 5, 7, 8]) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 2, 1, 1, 1]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [6, 5, 4, 3, 2, 1]) == False\n assert candidate(nums = [100, 200, 150, 250, 300, 350, 400, 450, 500, 550, 600]) == True\n assert candidate(nums = [-1, -3, -2, -4, 0]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 8, 11]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 7, 8, 9, 10, 11, 12, 10]) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 2, 4, 5]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 10]) == True\n assert candidate(nums = [100, 200, 150, 250, 300]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 7, 9]) == True\n assert candidate(nums = [1, 2, 3, 4, 3, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 5]) == True\n assert candidate(nums = [1, 2, 3, 4, 3, 3, 5]) == True\n assert candidate(nums = [1, 5, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [1, 2, 3, 2, 1, 4, 5, 6, 7, 8, 9]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 10]) == True\n assert candidate(nums = [5, 1, 3, 4, 5, 6, 7]) == True\n assert candidate(nums = [3, 3, 3, 2, 2, 2]) == False\n assert candidate(nums = [1, 3, 2, 3, 4, 5]) == True\n assert candidate(nums = [5, 1, 3, 4, 2, 5]) == False\n assert candidate(nums = [1, 2, 3, 5, 4, 6, 7, 8, 9]) == True\n assert candidate(nums = [1, 2, 4, 5, 3, 6]) == True\n assert candidate(nums = [-1, 4, 2, 3]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 8]) == True\n assert candidate(nums = [1, 2, 5, 4, 3, 6, 7, 8, 9]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 9]) == True\n assert candidate(nums = [5, 6, 2, 7, 8, 9]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1]) == True\n assert candidate(nums = [6, 2, 3, 4, 5, 6]) == True\n assert candidate(nums = [5, 7, 1, 8]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 7, 6, 8, 9, 10]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 3, 7, 8, 9, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 10]) == True\n assert candidate(nums = [1, 3, 2, 3, 5, 4]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 3, 8, 9, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 4, 5, 6]) == False\n assert candidate(nums = [1, 2, 3, 5, 4, 6, 5]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 10, 9, 10]) == True\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5]) == False\n assert candidate(nums = [10, 9, 2, 5, 7, 7, 8]) == False\n assert candidate(nums = [1, 2, 3, 5, 4, 7, 6]) == False\n assert candidate(nums = [3, 4, 2, 3]) == False\n assert candidate(nums = [1, 4, 5, 3, 5]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 7, 8, 6, 9, 10]) == False\n assert candidate(nums = [1, 2, 3, 2, 4, 5, 3]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 5]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 11]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 2, 3]) == True\n assert candidate(nums = [1, 3, 2, 3, 5, 3]) == False\n assert candidate(nums = [5, 1, 3, 2, 4]) == False\n assert candidate(nums = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19]) == False\n assert candidate(nums = [1, 2, 3, 5, 4, 7, 8, 6, 9]) == False\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 6, 7, 8]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 10]) == True\n assert candidate(nums = [1, 3, 2, 3, 3, 2, 4, 5]) == False\n assert candidate(nums = [1, 2, 3, 4, 3, 5, 6]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 6, 7, 8, 9, 10, 11]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 6, 5, 7, 6, 8]) == False\n assert candidate(nums = [3, 5, 4, 5, 6, 7]) == True\n assert candidate(nums = [3, 5, 6, 3, 4, 5]) == False\n assert candidate(nums = [1, 2, 3, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 2]) == False\n assert candidate(nums = [1, 2, 3, 2, 2, 3, 4]) == True\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().checkPossibility", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var checkPossibility = function(nums) {", "container": null, "callable": "checkPossibility", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 667, "task_id": "beautiful-arrangement-ii", "difficulty": "Medium", "problem_description": "Given two integers n and k, construct a list answer that contains n different positive integers ranging from 1 to n and obeys the following requirement:\n\nSuppose this list is answer = [a1, a2, a3, ... , an], then the list [|a1 - a2|, |a2 - a3|, |a3 - a4|, ... , |an-1 - an|] has exactly k distinct integers.\n\nReturn the list answer. If there multiple valid answers, return any of them.\n \nExample 1:\n\nInput: n = 3, k = 1\nOutput: [1,2,3]\nExplanation: The [1,2,3] has three different positive integers ranging from 1 to 3, and the [1,1] has exactly 1 distinct integer: 1\n\nExample 2:\n\nInput: n = 3, k = 2\nOutput: [1,3,2]\nExplanation: The [1,3,2] has three different positive integers ranging from 1 to 3, and the [2,1] has exactly 2 distinct integers: 1 and 2.\n\n \nConstraints:\n\n1 <= k < n <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 3,k = 1) == [1, 2, 3]\n assert candidate(n = 7,k = 4) == [1, 7, 2, 6, 5, 4, 3]\n assert candidate(n = 10,k = 5) == [1, 10, 2, 9, 3, 4, 5, 6, 7, 8]\n assert candidate(n = 5,k = 2) == [1, 5, 4, 3, 2]\n assert candidate(n = 3,k = 2) == [1, 3, 2]\n assert candidate(n = 100,k = 50) == [1, 100, 2, 99, 3, 98, 4, 97, 5, 96, 6, 95, 7, 94, 8, 93, 9, 92, 10, 91, 11, 90, 12, 89, 13, 88, 14, 87, 15, 86, 16, 85, 17, 84, 18, 83, 19, 82, 20, 81, 21, 80, 22, 79, 23, 78, 24, 77, 25, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26]\n assert candidate(n = 100,k = 99) == [1, 100, 2, 99, 3, 98, 4, 97, 5, 96, 6, 95, 7, 94, 8, 93, 9, 92, 10, 91, 11, 90, 12, 89, 13, 88, 14, 87, 15, 86, 16, 85, 17, 84, 18, 83, 19, 82, 20, 81, 21, 80, 22, 79, 23, 78, 24, 77, 25, 76, 26, 75, 27, 74, 28, 73, 29, 72, 30, 71, 31, 70, 32, 69, 33, 68, 34, 67, 35, 66, 36, 65, 37, 64, 38, 63, 39, 62, 40, 61, 41, 60, 42, 59, 43, 58, 44, 57, 45, 56, 46, 55, 47, 54, 48, 53, 49, 52, 50, 51]\n assert candidate(n = 5,k = 3) == [1, 5, 2, 3, 4]\n assert candidate(n = 5,k = 4) == [1, 5, 2, 4, 3]\n assert candidate(n = 1000,k = 500) == [1, 1000, 2, 999, 3, 998, 4, 997, 5, 996, 6, 995, 7, 994, 8, 993, 9, 992, 10, 991, 11, 990, 12, 989, 13, 988, 14, 987, 15, 986, 16, 985, 17, 984, 18, 983, 19, 982, 20, 981, 21, 980, 22, 979, 23, 978, 24, 977, 25, 976, 26, 975, 27, 974, 28, 973, 29, 972, 30, 971, 31, 970, 32, 969, 33, 968, 34, 967, 35, 966, 36, 965, 37, 964, 38, 963, 39, 962, 40, 961, 41, 960, 42, 959, 43, 958, 44, 957, 45, 956, 46, 955, 47, 954, 48, 953, 49, 952, 50, 951, 51, 950, 52, 949, 53, 948, 54, 947, 55, 946, 56, 945, 57, 944, 58, 943, 59, 942, 60, 941, 61, 940, 62, 939, 63, 938, 64, 937, 65, 936, 66, 935, 67, 934, 68, 933, 69, 932, 70, 931, 71, 930, 72, 929, 73, 928, 74, 927, 75, 926, 76, 925, 77, 924, 78, 923, 79, 922, 80, 921, 81, 920, 82, 919, 83, 918, 84, 917, 85, 916, 86, 915, 87, 914, 88, 913, 89, 912, 90, 911, 91, 910, 92, 909, 93, 908, 94, 907, 95, 906, 96, 905, 97, 904, 98, 903, 99, 902, 100, 901, 101, 900, 102, 899, 103, 898, 104, 897, 105, 896, 106, 895, 107, 894, 108, 893, 109, 892, 110, 891, 111, 890, 112, 889, 113, 888, 114, 887, 115, 886, 116, 885, 117, 884, 118, 883, 119, 882, 120, 881, 121, 880, 122, 879, 123, 878, 124, 877, 125, 876, 126, 875, 127, 874, 128, 873, 129, 872, 130, 871, 131, 870, 132, 869, 133, 868, 134, 867, 135, 866, 136, 865, 137, 864, 138, 863, 139, 862, 140, 861, 141, 860, 142, 859, 143, 858, 144, 857, 145, 856, 146, 855, 147, 854, 148, 853, 149, 852, 150, 851, 151, 850, 152, 849, 153, 848, 154, 847, 155, 846, 156, 845, 157, 844, 158, 843, 159, 842, 160, 841, 161, 840, 162, 839, 163, 838, 164, 837, 165, 836, 166, 835, 167, 834, 168, 833, 169, 832, 170, 831, 171, 830, 172, 829, 173, 828, 174, 827, 175, 826, 176, 825, 177, 824, 178, 823, 179, 822, 180, 821, 181, 820, 182, 819, 183, 818, 184, 817, 185, 816, 186, 815, 187, 814, 188, 813, 189, 812, 190, 811, 191, 810, 192, 809, 193, 808, 194, 807, 195, 806, 196, 805, 197, 804, 198, 803, 199, 802, 200, 801, 201, 800, 202, 799, 203, 798, 204, 797, 205, 796, 206, 795, 207, 794, 208, 793, 209, 792, 210, 791, 211, 790, 212, 789, 213, 788, 214, 787, 215, 786, 216, 785, 217, 784, 218, 783, 219, 782, 220, 781, 221, 780, 222, 779, 223, 778, 224, 777, 225, 776, 226, 775, 227, 774, 228, 773, 229, 772, 230, 771, 231, 770, 232, 769, 233, 768, 234, 767, 235, 766, 236, 765, 237, 764, 238, 763, 239, 762, 240, 761, 241, 760, 242, 759, 243, 758, 244, 757, 245, 756, 246, 755, 247, 754, 248, 753, 249, 752, 250, 751, 750, 749, 748, 747, 746, 745, 744, 743, 742, 741, 740, 739, 738, 737, 736, 735, 734, 733, 732, 731, 730, 729, 728, 727, 726, 725, 724, 723, 722, 721, 720, 719, 718, 717, 716, 715, 714, 713, 712, 711, 710, 709, 708, 707, 706, 705, 704, 703, 702, 701, 700, 699, 698, 697, 696, 695, 694, 693, 692, 691, 690, 689, 688, 687, 686, 685, 684, 683, 682, 681, 680, 679, 678, 677, 676, 675, 674, 673, 672, 671, 670, 669, 668, 667, 666, 665, 664, 663, 662, 661, 660, 659, 658, 657, 656, 655, 654, 653, 652, 651, 650, 649, 648, 647, 646, 645, 644, 643, 642, 641, 640, 639, 638, 637, 636, 635, 634, 633, 632, 631, 630, 629, 628, 627, 626, 625, 624, 623, 622, 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, 611, 610, 609, 608, 607, 606, 605, 604, 603, 602, 601, 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251]\n assert candidate(n = 400,k = 200) == [1, 400, 2, 399, 3, 398, 4, 397, 5, 396, 6, 395, 7, 394, 8, 393, 9, 392, 10, 391, 11, 390, 12, 389, 13, 388, 14, 387, 15, 386, 16, 385, 17, 384, 18, 383, 19, 382, 20, 381, 21, 380, 22, 379, 23, 378, 24, 377, 25, 376, 26, 375, 27, 374, 28, 373, 29, 372, 30, 371, 31, 370, 32, 369, 33, 368, 34, 367, 35, 366, 36, 365, 37, 364, 38, 363, 39, 362, 40, 361, 41, 360, 42, 359, 43, 358, 44, 357, 45, 356, 46, 355, 47, 354, 48, 353, 49, 352, 50, 351, 51, 350, 52, 349, 53, 348, 54, 347, 55, 346, 56, 345, 57, 344, 58, 343, 59, 342, 60, 341, 61, 340, 62, 339, 63, 338, 64, 337, 65, 336, 66, 335, 67, 334, 68, 333, 69, 332, 70, 331, 71, 330, 72, 329, 73, 328, 74, 327, 75, 326, 76, 325, 77, 324, 78, 323, 79, 322, 80, 321, 81, 320, 82, 319, 83, 318, 84, 317, 85, 316, 86, 315, 87, 314, 88, 313, 89, 312, 90, 311, 91, 310, 92, 309, 93, 308, 94, 307, 95, 306, 96, 305, 97, 304, 98, 303, 99, 302, 100, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101]\n assert candidate(n = 60,k = 50) == [1, 60, 2, 59, 3, 58, 4, 57, 5, 56, 6, 55, 7, 54, 8, 53, 9, 52, 10, 51, 11, 50, 12, 49, 13, 48, 14, 47, 15, 46, 16, 45, 17, 44, 18, 43, 19, 42, 20, 41, 21, 40, 22, 39, 23, 38, 24, 37, 25, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26]\n assert candidate(n = 9,k = 5) == [1, 9, 2, 8, 3, 4, 5, 6, 7]\n assert candidate(n = 200,k = 100) == [1, 200, 2, 199, 3, 198, 4, 197, 5, 196, 6, 195, 7, 194, 8, 193, 9, 192, 10, 191, 11, 190, 12, 189, 13, 188, 14, 187, 15, 186, 16, 185, 17, 184, 18, 183, 19, 182, 20, 181, 21, 180, 22, 179, 23, 178, 24, 177, 25, 176, 26, 175, 27, 174, 28, 173, 29, 172, 30, 171, 31, 170, 32, 169, 33, 168, 34, 167, 35, 166, 36, 165, 37, 164, 38, 163, 39, 162, 40, 161, 41, 160, 42, 159, 43, 158, 44, 157, 45, 156, 46, 155, 47, 154, 48, 153, 49, 152, 50, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51]\n assert candidate(n = 18,k = 13) == [1, 18, 2, 17, 3, 16, 4, 15, 5, 14, 6, 13, 7, 8, 9, 10, 11, 12]\n assert candidate(n = 100,k = 90) == [1, 100, 2, 99, 3, 98, 4, 97, 5, 96, 6, 95, 7, 94, 8, 93, 9, 92, 10, 91, 11, 90, 12, 89, 13, 88, 14, 87, 15, 86, 16, 85, 17, 84, 18, 83, 19, 82, 20, 81, 21, 80, 22, 79, 23, 78, 24, 77, 25, 76, 26, 75, 27, 74, 28, 73, 29, 72, 30, 71, 31, 70, 32, 69, 33, 68, 34, 67, 35, 66, 36, 65, 37, 64, 38, 63, 39, 62, 40, 61, 41, 60, 42, 59, 43, 58, 44, 57, 45, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46]\n assert candidate(n = 500,k = 249) == [1, 500, 2, 499, 3, 498, 4, 497, 5, 496, 6, 495, 7, 494, 8, 493, 9, 492, 10, 491, 11, 490, 12, 489, 13, 488, 14, 487, 15, 486, 16, 485, 17, 484, 18, 483, 19, 482, 20, 481, 21, 480, 22, 479, 23, 478, 24, 477, 25, 476, 26, 475, 27, 474, 28, 473, 29, 472, 30, 471, 31, 470, 32, 469, 33, 468, 34, 467, 35, 466, 36, 465, 37, 464, 38, 463, 39, 462, 40, 461, 41, 460, 42, 459, 43, 458, 44, 457, 45, 456, 46, 455, 47, 454, 48, 453, 49, 452, 50, 451, 51, 450, 52, 449, 53, 448, 54, 447, 55, 446, 56, 445, 57, 444, 58, 443, 59, 442, 60, 441, 61, 440, 62, 439, 63, 438, 64, 437, 65, 436, 66, 435, 67, 434, 68, 433, 69, 432, 70, 431, 71, 430, 72, 429, 73, 428, 74, 427, 75, 426, 76, 425, 77, 424, 78, 423, 79, 422, 80, 421, 81, 420, 82, 419, 83, 418, 84, 417, 85, 416, 86, 415, 87, 414, 88, 413, 89, 412, 90, 411, 91, 410, 92, 409, 93, 408, 94, 407, 95, 406, 96, 405, 97, 404, 98, 403, 99, 402, 100, 401, 101, 400, 102, 399, 103, 398, 104, 397, 105, 396, 106, 395, 107, 394, 108, 393, 109, 392, 110, 391, 111, 390, 112, 389, 113, 388, 114, 387, 115, 386, 116, 385, 117, 384, 118, 383, 119, 382, 120, 381, 121, 380, 122, 379, 123, 378, 124, 377, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376]\n assert candidate(n = 200,k = 99) == [1, 200, 2, 199, 3, 198, 4, 197, 5, 196, 6, 195, 7, 194, 8, 193, 9, 192, 10, 191, 11, 190, 12, 189, 13, 188, 14, 187, 15, 186, 16, 185, 17, 184, 18, 183, 19, 182, 20, 181, 21, 180, 22, 179, 23, 178, 24, 177, 25, 176, 26, 175, 27, 174, 28, 173, 29, 172, 30, 171, 31, 170, 32, 169, 33, 168, 34, 167, 35, 166, 36, 165, 37, 164, 38, 163, 39, 162, 40, 161, 41, 160, 42, 159, 43, 158, 44, 157, 45, 156, 46, 155, 47, 154, 48, 153, 49, 152, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151]\n assert candidate(n = 10,k = 8) == [1, 10, 2, 9, 3, 8, 4, 7, 6, 5]\n assert candidate(n = 7,k = 3) == [1, 7, 2, 3, 4, 5, 6]\n assert candidate(n = 9,k = 8) == [1, 9, 2, 8, 3, 7, 4, 6, 5]\n assert candidate(n = 12,k = 9) == [1, 12, 2, 11, 3, 10, 4, 9, 5, 6, 7, 8]\n assert candidate(n = 4999,k = 2499) == [1, 4999, 2, 4998, 3, 4997, 4, 4996, 5, 4995, 6, 4994, 7, 4993, 8, 4992, 9, 4991, 10, 4990, 11, 4989, 12, 4988, 13, 4987, 14, 4986, 15, 4985, 16, 4984, 17, 4983, 18, 4982, 19, 4981, 20, 4980, 21, 4979, 22, 4978, 23, 4977, 24, 4976, 25, 4975, 26, 4974, 27, 4973, 28, 4972, 29, 4971, 30, 4970, 31, 4969, 32, 4968, 33, 4967, 34, 4966, 35, 4965, 36, 4964, 37, 4963, 38, 4962, 39, 4961, 40, 4960, 41, 4959, 42, 4958, 43, 4957, 44, 4956, 45, 4955, 46, 4954, 47, 4953, 48, 4952, 49, 4951, 50, 4950, 51, 4949, 52, 4948, 53, 4947, 54, 4946, 55, 4945, 56, 4944, 57, 4943, 58, 4942, 59, 4941, 60, 4940, 61, 4939, 62, 4938, 63, 4937, 64, 4936, 65, 4935, 66, 4934, 67, 4933, 68, 4932, 69, 4931, 70, 4930, 71, 4929, 72, 4928, 73, 4927, 74, 4926, 75, 4925, 76, 4924, 77, 4923, 78, 4922, 79, 4921, 80, 4920, 81, 4919, 82, 4918, 83, 4917, 84, 4916, 85, 4915, 86, 4914, 87, 4913, 88, 4912, 89, 4911, 90, 4910, 91, 4909, 92, 4908, 93, 4907, 94, 4906, 95, 4905, 96, 4904, 97, 4903, 98, 4902, 99, 4901, 100, 4900, 101, 4899, 102, 4898, 103, 4897, 104, 4896, 105, 4895, 106, 4894, 107, 4893, 108, 4892, 109, 4891, 110, 4890, 111, 4889, 112, 4888, 113, 4887, 114, 4886, 115, 4885, 116, 4884, 117, 4883, 118, 4882, 119, 4881, 120, 4880, 121, 4879, 122, 4878, 123, 4877, 124, 4876, 125, 4875, 126, 4874, 127, 4873, 128, 4872, 129, 4871, 130, 4870, 131, 4869, 132, 4868, 133, 4867, 134, 4866, 135, 4865, 136, 4864, 137, 4863, 138, 4862, 139, 4861, 140, 4860, 141, 4859, 142, 4858, 143, 4857, 144, 4856, 145, 4855, 146, 4854, 147, 4853, 148, 4852, 149, 4851, 150, 4850, 151, 4849, 152, 4848, 153, 4847, 154, 4846, 155, 4845, 156, 4844, 157, 4843, 158, 4842, 159, 4841, 160, 4840, 161, 4839, 162, 4838, 163, 4837, 164, 4836, 165, 4835, 166, 4834, 167, 4833, 168, 4832, 169, 4831, 170, 4830, 171, 4829, 172, 4828, 173, 4827, 174, 4826, 175, 4825, 176, 4824, 177, 4823, 178, 4822, 179, 4821, 180, 4820, 181, 4819, 182, 4818, 183, 4817, 184, 4816, 185, 4815, 186, 4814, 187, 4813, 188, 4812, 189, 4811, 190, 4810, 191, 4809, 192, 4808, 193, 4807, 194, 4806, 195, 4805, 196, 4804, 197, 4803, 198, 4802, 199, 4801, 200, 4800, 201, 4799, 202, 4798, 203, 4797, 204, 4796, 205, 4795, 206, 4794, 207, 4793, 208, 4792, 209, 4791, 210, 4790, 211, 4789, 212, 4788, 213, 4787, 214, 4786, 215, 4785, 216, 4784, 217, 4783, 218, 4782, 219, 4781, 220, 4780, 221, 4779, 222, 4778, 223, 4777, 224, 4776, 225, 4775, 226, 4774, 227, 4773, 228, 4772, 229, 4771, 230, 4770, 231, 4769, 232, 4768, 233, 4767, 234, 4766, 235, 4765, 236, 4764, 237, 4763, 238, 4762, 239, 4761, 240, 4760, 241, 4759, 242, 4758, 243, 4757, 244, 4756, 245, 4755, 246, 4754, 247, 4753, 248, 4752, 249, 4751, 250, 4750, 251, 4749, 252, 4748, 253, 4747, 254, 4746, 255, 4745, 256, 4744, 257, 4743, 258, 4742, 259, 4741, 260, 4740, 261, 4739, 262, 4738, 263, 4737, 264, 4736, 265, 4735, 266, 4734, 267, 4733, 268, 4732, 269, 4731, 270, 4730, 271, 4729, 272, 4728, 273, 4727, 274, 4726, 275, 4725, 276, 4724, 277, 4723, 278, 4722, 279, 4721, 280, 4720, 281, 4719, 282, 4718, 283, 4717, 284, 4716, 285, 4715, 286, 4714, 287, 4713, 288, 4712, 289, 4711, 290, 4710, 291, 4709, 292, 4708, 293, 4707, 294, 4706, 295, 4705, 296, 4704, 297, 4703, 298, 4702, 299, 4701, 300, 4700, 301, 4699, 302, 4698, 303, 4697, 304, 4696, 305, 4695, 306, 4694, 307, 4693, 308, 4692, 309, 4691, 310, 4690, 311, 4689, 312, 4688, 313, 4687, 314, 4686, 315, 4685, 316, 4684, 317, 4683, 318, 4682, 319, 4681, 320, 4680, 321, 4679, 322, 4678, 323, 4677, 324, 4676, 325, 4675, 326, 4674, 327, 4673, 328, 4672, 329, 4671, 330, 4670, 331, 4669, 332, 4668, 333, 4667, 334, 4666, 335, 4665, 336, 4664, 337, 4663, 338, 4662, 339, 4661, 340, 4660, 341, 4659, 342, 4658, 343, 4657, 344, 4656, 345, 4655, 346, 4654, 347, 4653, 348, 4652, 349, 4651, 350, 4650, 351, 4649, 352, 4648, 353, 4647, 354, 4646, 355, 4645, 356, 4644, 357, 4643, 358, 4642, 359, 4641, 360, 4640, 361, 4639, 362, 4638, 363, 4637, 364, 4636, 365, 4635, 366, 4634, 367, 4633, 368, 4632, 369, 4631, 370, 4630, 371, 4629, 372, 4628, 373, 4627, 374, 4626, 375, 4625, 376, 4624, 377, 4623, 378, 4622, 379, 4621, 380, 4620, 381, 4619, 382, 4618, 383, 4617, 384, 4616, 385, 4615, 386, 4614, 387, 4613, 388, 4612, 389, 4611, 390, 4610, 391, 4609, 392, 4608, 393, 4607, 394, 4606, 395, 4605, 396, 4604, 397, 4603, 398, 4602, 399, 4601, 400, 4600, 401, 4599, 402, 4598, 403, 4597, 404, 4596, 405, 4595, 406, 4594, 407, 4593, 408, 4592, 409, 4591, 410, 4590, 411, 4589, 412, 4588, 413, 4587, 414, 4586, 415, 4585, 416, 4584, 417, 4583, 418, 4582, 419, 4581, 420, 4580, 421, 4579, 422, 4578, 423, 4577, 424, 4576, 425, 4575, 426, 4574, 427, 4573, 428, 4572, 429, 4571, 430, 4570, 431, 4569, 432, 4568, 433, 4567, 434, 4566, 435, 4565, 436, 4564, 437, 4563, 438, 4562, 439, 4561, 440, 4560, 441, 4559, 442, 4558, 443, 4557, 444, 4556, 445, 4555, 446, 4554, 447, 4553, 448, 4552, 449, 4551, 450, 4550, 451, 4549, 452, 4548, 453, 4547, 454, 4546, 455, 4545, 456, 4544, 457, 4543, 458, 4542, 459, 4541, 460, 4540, 461, 4539, 462, 4538, 463, 4537, 464, 4536, 465, 4535, 466, 4534, 467, 4533, 468, 4532, 469, 4531, 470, 4530, 471, 4529, 472, 4528, 473, 4527, 474, 4526, 475, 4525, 476, 4524, 477, 4523, 478, 4522, 479, 4521, 480, 4520, 481, 4519, 482, 4518, 483, 4517, 484, 4516, 485, 4515, 486, 4514, 487, 4513, 488, 4512, 489, 4511, 490, 4510, 491, 4509, 492, 4508, 493, 4507, 494, 4506, 495, 4505, 496, 4504, 497, 4503, 498, 4502, 499, 4501, 500, 4500, 501, 4499, 502, 4498, 503, 4497, 504, 4496, 505, 4495, 506, 4494, 507, 4493, 508, 4492, 509, 4491, 510, 4490, 511, 4489, 512, 4488, 513, 4487, 514, 4486, 515, 4485, 516, 4484, 517, 4483, 518, 4482, 519, 4481, 520, 4480, 521, 4479, 522, 4478, 523, 4477, 524, 4476, 525, 4475, 526, 4474, 527, 4473, 528, 4472, 529, 4471, 530, 4470, 531, 4469, 532, 4468, 533, 4467, 534, 4466, 535, 4465, 536, 4464, 537, 4463, 538, 4462, 539, 4461, 540, 4460, 541, 4459, 542, 4458, 543, 4457, 544, 4456, 545, 4455, 546, 4454, 547, 4453, 548, 4452, 549, 4451, 550, 4450, 551, 4449, 552, 4448, 553, 4447, 554, 4446, 555, 4445, 556, 4444, 557, 4443, 558, 4442, 559, 4441, 560, 4440, 561, 4439, 562, 4438, 563, 4437, 564, 4436, 565, 4435, 566, 4434, 567, 4433, 568, 4432, 569, 4431, 570, 4430, 571, 4429, 572, 4428, 573, 4427, 574, 4426, 575, 4425, 576, 4424, 577, 4423, 578, 4422, 579, 4421, 580, 4420, 581, 4419, 582, 4418, 583, 4417, 584, 4416, 585, 4415, 586, 4414, 587, 4413, 588, 4412, 589, 4411, 590, 4410, 591, 4409, 592, 4408, 593, 4407, 594, 4406, 595, 4405, 596, 4404, 597, 4403, 598, 4402, 599, 4401, 600, 4400, 601, 4399, 602, 4398, 603, 4397, 604, 4396, 605, 4395, 606, 4394, 607, 4393, 608, 4392, 609, 4391, 610, 4390, 611, 4389, 612, 4388, 613, 4387, 614, 4386, 615, 4385, 616, 4384, 617, 4383, 618, 4382, 619, 4381, 620, 4380, 621, 4379, 622, 4378, 623, 4377, 624, 4376, 625, 4375, 626, 4374, 627, 4373, 628, 4372, 629, 4371, 630, 4370, 631, 4369, 632, 4368, 633, 4367, 634, 4366, 635, 4365, 636, 4364, 637, 4363, 638, 4362, 639, 4361, 640, 4360, 641, 4359, 642, 4358, 643, 4357, 644, 4356, 645, 4355, 646, 4354, 647, 4353, 648, 4352, 649, 4351, 650, 4350, 651, 4349, 652, 4348, 653, 4347, 654, 4346, 655, 4345, 656, 4344, 657, 4343, 658, 4342, 659, 4341, 660, 4340, 661, 4339, 662, 4338, 663, 4337, 664, 4336, 665, 4335, 666, 4334, 667, 4333, 668, 4332, 669, 4331, 670, 4330, 671, 4329, 672, 4328, 673, 4327, 674, 4326, 675, 4325, 676, 4324, 677, 4323, 678, 4322, 679, 4321, 680, 4320, 681, 4319, 682, 4318, 683, 4317, 684, 4316, 685, 4315, 686, 4314, 687, 4313, 688, 4312, 689, 4311, 690, 4310, 691, 4309, 692, 4308, 693, 4307, 694, 4306, 695, 4305, 696, 4304, 697, 4303, 698, 4302, 699, 4301, 700, 4300, 701, 4299, 702, 4298, 703, 4297, 704, 4296, 705, 4295, 706, 4294, 707, 4293, 708, 4292, 709, 4291, 710, 4290, 711, 4289, 712, 4288, 713, 4287, 714, 4286, 715, 4285, 716, 4284, 717, 4283, 718, 4282, 719, 4281, 720, 4280, 721, 4279, 722, 4278, 723, 4277, 724, 4276, 725, 4275, 726, 4274, 727, 4273, 728, 4272, 729, 4271, 730, 4270, 731, 4269, 732, 4268, 733, 4267, 734, 4266, 735, 4265, 736, 4264, 737, 4263, 738, 4262, 739, 4261, 740, 4260, 741, 4259, 742, 4258, 743, 4257, 744, 4256, 745, 4255, 746, 4254, 747, 4253, 748, 4252, 749, 4251, 750, 4250, 751, 4249, 752, 4248, 753, 4247, 754, 4246, 755, 4245, 756, 4244, 757, 4243, 758, 4242, 759, 4241, 760, 4240, 761, 4239, 762, 4238, 763, 4237, 764, 4236, 765, 4235, 766, 4234, 767, 4233, 768, 4232, 769, 4231, 770, 4230, 771, 4229, 772, 4228, 773, 4227, 774, 4226, 775, 4225, 776, 4224, 777, 4223, 778, 4222, 779, 4221, 780, 4220, 781, 4219, 782, 4218, 783, 4217, 784, 4216, 785, 4215, 786, 4214, 787, 4213, 788, 4212, 789, 4211, 790, 4210, 791, 4209, 792, 4208, 793, 4207, 794, 4206, 795, 4205, 796, 4204, 797, 4203, 798, 4202, 799, 4201, 800, 4200, 801, 4199, 802, 4198, 803, 4197, 804, 4196, 805, 4195, 806, 4194, 807, 4193, 808, 4192, 809, 4191, 810, 4190, 811, 4189, 812, 4188, 813, 4187, 814, 4186, 815, 4185, 816, 4184, 817, 4183, 818, 4182, 819, 4181, 820, 4180, 821, 4179, 822, 4178, 823, 4177, 824, 4176, 825, 4175, 826, 4174, 827, 4173, 828, 4172, 829, 4171, 830, 4170, 831, 4169, 832, 4168, 833, 4167, 834, 4166, 835, 4165, 836, 4164, 837, 4163, 838, 4162, 839, 4161, 840, 4160, 841, 4159, 842, 4158, 843, 4157, 844, 4156, 845, 4155, 846, 4154, 847, 4153, 848, 4152, 849, 4151, 850, 4150, 851, 4149, 852, 4148, 853, 4147, 854, 4146, 855, 4145, 856, 4144, 857, 4143, 858, 4142, 859, 4141, 860, 4140, 861, 4139, 862, 4138, 863, 4137, 864, 4136, 865, 4135, 866, 4134, 867, 4133, 868, 4132, 869, 4131, 870, 4130, 871, 4129, 872, 4128, 873, 4127, 874, 4126, 875, 4125, 876, 4124, 877, 4123, 878, 4122, 879, 4121, 880, 4120, 881, 4119, 882, 4118, 883, 4117, 884, 4116, 885, 4115, 886, 4114, 887, 4113, 888, 4112, 889, 4111, 890, 4110, 891, 4109, 892, 4108, 893, 4107, 894, 4106, 895, 4105, 896, 4104, 897, 4103, 898, 4102, 899, 4101, 900, 4100, 901, 4099, 902, 4098, 903, 4097, 904, 4096, 905, 4095, 906, 4094, 907, 4093, 908, 4092, 909, 4091, 910, 4090, 911, 4089, 912, 4088, 913, 4087, 914, 4086, 915, 4085, 916, 4084, 917, 4083, 918, 4082, 919, 4081, 920, 4080, 921, 4079, 922, 4078, 923, 4077, 924, 4076, 925, 4075, 926, 4074, 927, 4073, 928, 4072, 929, 4071, 930, 4070, 931, 4069, 932, 4068, 933, 4067, 934, 4066, 935, 4065, 936, 4064, 937, 4063, 938, 4062, 939, 4061, 940, 4060, 941, 4059, 942, 4058, 943, 4057, 944, 4056, 945, 4055, 946, 4054, 947, 4053, 948, 4052, 949, 4051, 950, 4050, 951, 4049, 952, 4048, 953, 4047, 954, 4046, 955, 4045, 956, 4044, 957, 4043, 958, 4042, 959, 4041, 960, 4040, 961, 4039, 962, 4038, 963, 4037, 964, 4036, 965, 4035, 966, 4034, 967, 4033, 968, 4032, 969, 4031, 970, 4030, 971, 4029, 972, 4028, 973, 4027, 974, 4026, 975, 4025, 976, 4024, 977, 4023, 978, 4022, 979, 4021, 980, 4020, 981, 4019, 982, 4018, 983, 4017, 984, 4016, 985, 4015, 986, 4014, 987, 4013, 988, 4012, 989, 4011, 990, 4010, 991, 4009, 992, 4008, 993, 4007, 994, 4006, 995, 4005, 996, 4004, 997, 4003, 998, 4002, 999, 4001, 1000, 4000, 1001, 3999, 1002, 3998, 1003, 3997, 1004, 3996, 1005, 3995, 1006, 3994, 1007, 3993, 1008, 3992, 1009, 3991, 1010, 3990, 1011, 3989, 1012, 3988, 1013, 3987, 1014, 3986, 1015, 3985, 1016, 3984, 1017, 3983, 1018, 3982, 1019, 3981, 1020, 3980, 1021, 3979, 1022, 3978, 1023, 3977, 1024, 3976, 1025, 3975, 1026, 3974, 1027, 3973, 1028, 3972, 1029, 3971, 1030, 3970, 1031, 3969, 1032, 3968, 1033, 3967, 1034, 3966, 1035, 3965, 1036, 3964, 1037, 3963, 1038, 3962, 1039, 3961, 1040, 3960, 1041, 3959, 1042, 3958, 1043, 3957, 1044, 3956, 1045, 3955, 1046, 3954, 1047, 3953, 1048, 3952, 1049, 3951, 1050, 3950, 1051, 3949, 1052, 3948, 1053, 3947, 1054, 3946, 1055, 3945, 1056, 3944, 1057, 3943, 1058, 3942, 1059, 3941, 1060, 3940, 1061, 3939, 1062, 3938, 1063, 3937, 1064, 3936, 1065, 3935, 1066, 3934, 1067, 3933, 1068, 3932, 1069, 3931, 1070, 3930, 1071, 3929, 1072, 3928, 1073, 3927, 1074, 3926, 1075, 3925, 1076, 3924, 1077, 3923, 1078, 3922, 1079, 3921, 1080, 3920, 1081, 3919, 1082, 3918, 1083, 3917, 1084, 3916, 1085, 3915, 1086, 3914, 1087, 3913, 1088, 3912, 1089, 3911, 1090, 3910, 1091, 3909, 1092, 3908, 1093, 3907, 1094, 3906, 1095, 3905, 1096, 3904, 1097, 3903, 1098, 3902, 1099, 3901, 1100, 3900, 1101, 3899, 1102, 3898, 1103, 3897, 1104, 3896, 1105, 3895, 1106, 3894, 1107, 3893, 1108, 3892, 1109, 3891, 1110, 3890, 1111, 3889, 1112, 3888, 1113, 3887, 1114, 3886, 1115, 3885, 1116, 3884, 1117, 3883, 1118, 3882, 1119, 3881, 1120, 3880, 1121, 3879, 1122, 3878, 1123, 3877, 1124, 3876, 1125, 3875, 1126, 3874, 1127, 3873, 1128, 3872, 1129, 3871, 1130, 3870, 1131, 3869, 1132, 3868, 1133, 3867, 1134, 3866, 1135, 3865, 1136, 3864, 1137, 3863, 1138, 3862, 1139, 3861, 1140, 3860, 1141, 3859, 1142, 3858, 1143, 3857, 1144, 3856, 1145, 3855, 1146, 3854, 1147, 3853, 1148, 3852, 1149, 3851, 1150, 3850, 1151, 3849, 1152, 3848, 1153, 3847, 1154, 3846, 1155, 3845, 1156, 3844, 1157, 3843, 1158, 3842, 1159, 3841, 1160, 3840, 1161, 3839, 1162, 3838, 1163, 3837, 1164, 3836, 1165, 3835, 1166, 3834, 1167, 3833, 1168, 3832, 1169, 3831, 1170, 3830, 1171, 3829, 1172, 3828, 1173, 3827, 1174, 3826, 1175, 3825, 1176, 3824, 1177, 3823, 1178, 3822, 1179, 3821, 1180, 3820, 1181, 3819, 1182, 3818, 1183, 3817, 1184, 3816, 1185, 3815, 1186, 3814, 1187, 3813, 1188, 3812, 1189, 3811, 1190, 3810, 1191, 3809, 1192, 3808, 1193, 3807, 1194, 3806, 1195, 3805, 1196, 3804, 1197, 3803, 1198, 3802, 1199, 3801, 1200, 3800, 1201, 3799, 1202, 3798, 1203, 3797, 1204, 3796, 1205, 3795, 1206, 3794, 1207, 3793, 1208, 3792, 1209, 3791, 1210, 3790, 1211, 3789, 1212, 3788, 1213, 3787, 1214, 3786, 1215, 3785, 1216, 3784, 1217, 3783, 1218, 3782, 1219, 3781, 1220, 3780, 1221, 3779, 1222, 3778, 1223, 3777, 1224, 3776, 1225, 3775, 1226, 3774, 1227, 3773, 1228, 3772, 1229, 3771, 1230, 3770, 1231, 3769, 1232, 3768, 1233, 3767, 1234, 3766, 1235, 3765, 1236, 3764, 1237, 3763, 1238, 3762, 1239, 3761, 1240, 3760, 1241, 3759, 1242, 3758, 1243, 3757, 1244, 3756, 1245, 3755, 1246, 3754, 1247, 3753, 1248, 3752, 1249, 3751, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2416, 2417, 2418, 2419, 2420, 2421, 2422, 2423, 2424, 2425, 2426, 2427, 2428, 2429, 2430, 2431, 2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 2440, 2441, 2442, 2443, 2444, 2445, 2446, 2447, 2448, 2449, 2450, 2451, 2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2578, 2579, 2580, 2581, 2582, 2583, 2584, 2585, 2586, 2587, 2588, 2589, 2590, 2591, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2600, 2601, 2602, 2603, 2604, 2605, 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2616, 2617, 2618, 2619, 2620, 2621, 2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631, 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, 2640, 2641, 2642, 2643, 2644, 2645, 2646, 2647, 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, 2688, 2689, 2690, 2691, 2692, 2693, 2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708, 2709, 2710, 2711, 2712, 2713, 2714, 2715, 2716, 2717, 2718, 2719, 2720, 2721, 2722, 2723, 2724, 2725, 2726, 2727, 2728, 2729, 2730, 2731, 2732, 2733, 2734, 2735, 2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, 2747, 2748, 2749, 2750, 2751, 2752, 2753, 2754, 2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764, 2765, 2766, 2767, 2768, 2769, 2770, 2771, 2772, 2773, 2774, 2775, 2776, 2777, 2778, 2779, 2780, 2781, 2782, 2783, 2784, 2785, 2786, 2787, 2788, 2789, 2790, 2791, 2792, 2793, 2794, 2795, 2796, 2797, 2798, 2799, 2800, 2801, 2802, 2803, 2804, 2805, 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826, 2827, 2828, 2829, 2830, 2831, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2840, 2841, 2842, 2843, 2844, 2845, 2846, 2847, 2848, 2849, 2850, 2851, 2852, 2853, 2854, 2855, 2856, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, 2875, 2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, 2903, 2904, 2905, 2906, 2907, 2908, 2909, 2910, 2911, 2912, 2913, 2914, 2915, 2916, 2917, 2918, 2919, 2920, 2921, 2922, 2923, 2924, 2925, 2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, 2939, 2940, 2941, 2942, 2943, 2944, 2945, 2946, 2947, 2948, 2949, 2950, 2951, 2952, 2953, 2954, 2955, 2956, 2957, 2958, 2959, 2960, 2961, 2962, 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, 2991, 2992, 2993, 2994, 2995, 2996, 2997, 2998, 2999, 3000, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010, 3011, 3012, 3013, 3014, 3015, 3016, 3017, 3018, 3019, 3020, 3021, 3022, 3023, 3024, 3025, 3026, 3027, 3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750]\n assert candidate(n = 5000,k = 100) == [1, 5000, 2, 4999, 3, 4998, 4, 4997, 5, 4996, 6, 4995, 7, 4994, 8, 4993, 9, 4992, 10, 4991, 11, 4990, 12, 4989, 13, 4988, 14, 4987, 15, 4986, 16, 4985, 17, 4984, 18, 4983, 19, 4982, 20, 4981, 21, 4980, 22, 4979, 23, 4978, 24, 4977, 25, 4976, 26, 4975, 27, 4974, 28, 4973, 29, 4972, 30, 4971, 31, 4970, 32, 4969, 33, 4968, 34, 4967, 35, 4966, 36, 4965, 37, 4964, 38, 4963, 39, 4962, 40, 4961, 41, 4960, 42, 4959, 43, 4958, 44, 4957, 45, 4956, 46, 4955, 47, 4954, 48, 4953, 49, 4952, 50, 4951, 4950, 4949, 4948, 4947, 4946, 4945, 4944, 4943, 4942, 4941, 4940, 4939, 4938, 4937, 4936, 4935, 4934, 4933, 4932, 4931, 4930, 4929, 4928, 4927, 4926, 4925, 4924, 4923, 4922, 4921, 4920, 4919, 4918, 4917, 4916, 4915, 4914, 4913, 4912, 4911, 4910, 4909, 4908, 4907, 4906, 4905, 4904, 4903, 4902, 4901, 4900, 4899, 4898, 4897, 4896, 4895, 4894, 4893, 4892, 4891, 4890, 4889, 4888, 4887, 4886, 4885, 4884, 4883, 4882, 4881, 4880, 4879, 4878, 4877, 4876, 4875, 4874, 4873, 4872, 4871, 4870, 4869, 4868, 4867, 4866, 4865, 4864, 4863, 4862, 4861, 4860, 4859, 4858, 4857, 4856, 4855, 4854, 4853, 4852, 4851, 4850, 4849, 4848, 4847, 4846, 4845, 4844, 4843, 4842, 4841, 4840, 4839, 4838, 4837, 4836, 4835, 4834, 4833, 4832, 4831, 4830, 4829, 4828, 4827, 4826, 4825, 4824, 4823, 4822, 4821, 4820, 4819, 4818, 4817, 4816, 4815, 4814, 4813, 4812, 4811, 4810, 4809, 4808, 4807, 4806, 4805, 4804, 4803, 4802, 4801, 4800, 4799, 4798, 4797, 4796, 4795, 4794, 4793, 4792, 4791, 4790, 4789, 4788, 4787, 4786, 4785, 4784, 4783, 4782, 4781, 4780, 4779, 4778, 4777, 4776, 4775, 4774, 4773, 4772, 4771, 4770, 4769, 4768, 4767, 4766, 4765, 4764, 4763, 4762, 4761, 4760, 4759, 4758, 4757, 4756, 4755, 4754, 4753, 4752, 4751, 4750, 4749, 4748, 4747, 4746, 4745, 4744, 4743, 4742, 4741, 4740, 4739, 4738, 4737, 4736, 4735, 4734, 4733, 4732, 4731, 4730, 4729, 4728, 4727, 4726, 4725, 4724, 4723, 4722, 4721, 4720, 4719, 4718, 4717, 4716, 4715, 4714, 4713, 4712, 4711, 4710, 4709, 4708, 4707, 4706, 4705, 4704, 4703, 4702, 4701, 4700, 4699, 4698, 4697, 4696, 4695, 4694, 4693, 4692, 4691, 4690, 4689, 4688, 4687, 4686, 4685, 4684, 4683, 4682, 4681, 4680, 4679, 4678, 4677, 4676, 4675, 4674, 4673, 4672, 4671, 4670, 4669, 4668, 4667, 4666, 4665, 4664, 4663, 4662, 4661, 4660, 4659, 4658, 4657, 4656, 4655, 4654, 4653, 4652, 4651, 4650, 4649, 4648, 4647, 4646, 4645, 4644, 4643, 4642, 4641, 4640, 4639, 4638, 4637, 4636, 4635, 4634, 4633, 4632, 4631, 4630, 4629, 4628, 4627, 4626, 4625, 4624, 4623, 4622, 4621, 4620, 4619, 4618, 4617, 4616, 4615, 4614, 4613, 4612, 4611, 4610, 4609, 4608, 4607, 4606, 4605, 4604, 4603, 4602, 4601, 4600, 4599, 4598, 4597, 4596, 4595, 4594, 4593, 4592, 4591, 4590, 4589, 4588, 4587, 4586, 4585, 4584, 4583, 4582, 4581, 4580, 4579, 4578, 4577, 4576, 4575, 4574, 4573, 4572, 4571, 4570, 4569, 4568, 4567, 4566, 4565, 4564, 4563, 4562, 4561, 4560, 4559, 4558, 4557, 4556, 4555, 4554, 4553, 4552, 4551, 4550, 4549, 4548, 4547, 4546, 4545, 4544, 4543, 4542, 4541, 4540, 4539, 4538, 4537, 4536, 4535, 4534, 4533, 4532, 4531, 4530, 4529, 4528, 4527, 4526, 4525, 4524, 4523, 4522, 4521, 4520, 4519, 4518, 4517, 4516, 4515, 4514, 4513, 4512, 4511, 4510, 4509, 4508, 4507, 4506, 4505, 4504, 4503, 4502, 4501, 4500, 4499, 4498, 4497, 4496, 4495, 4494, 4493, 4492, 4491, 4490, 4489, 4488, 4487, 4486, 4485, 4484, 4483, 4482, 4481, 4480, 4479, 4478, 4477, 4476, 4475, 4474, 4473, 4472, 4471, 4470, 4469, 4468, 4467, 4466, 4465, 4464, 4463, 4462, 4461, 4460, 4459, 4458, 4457, 4456, 4455, 4454, 4453, 4452, 4451, 4450, 4449, 4448, 4447, 4446, 4445, 4444, 4443, 4442, 4441, 4440, 4439, 4438, 4437, 4436, 4435, 4434, 4433, 4432, 4431, 4430, 4429, 4428, 4427, 4426, 4425, 4424, 4423, 4422, 4421, 4420, 4419, 4418, 4417, 4416, 4415, 4414, 4413, 4412, 4411, 4410, 4409, 4408, 4407, 4406, 4405, 4404, 4403, 4402, 4401, 4400, 4399, 4398, 4397, 4396, 4395, 4394, 4393, 4392, 4391, 4390, 4389, 4388, 4387, 4386, 4385, 4384, 4383, 4382, 4381, 4380, 4379, 4378, 4377, 4376, 4375, 4374, 4373, 4372, 4371, 4370, 4369, 4368, 4367, 4366, 4365, 4364, 4363, 4362, 4361, 4360, 4359, 4358, 4357, 4356, 4355, 4354, 4353, 4352, 4351, 4350, 4349, 4348, 4347, 4346, 4345, 4344, 4343, 4342, 4341, 4340, 4339, 4338, 4337, 4336, 4335, 4334, 4333, 4332, 4331, 4330, 4329, 4328, 4327, 4326, 4325, 4324, 4323, 4322, 4321, 4320, 4319, 4318, 4317, 4316, 4315, 4314, 4313, 4312, 4311, 4310, 4309, 4308, 4307, 4306, 4305, 4304, 4303, 4302, 4301, 4300, 4299, 4298, 4297, 4296, 4295, 4294, 4293, 4292, 4291, 4290, 4289, 4288, 4287, 4286, 4285, 4284, 4283, 4282, 4281, 4280, 4279, 4278, 4277, 4276, 4275, 4274, 4273, 4272, 4271, 4270, 4269, 4268, 4267, 4266, 4265, 4264, 4263, 4262, 4261, 4260, 4259, 4258, 4257, 4256, 4255, 4254, 4253, 4252, 4251, 4250, 4249, 4248, 4247, 4246, 4245, 4244, 4243, 4242, 4241, 4240, 4239, 4238, 4237, 4236, 4235, 4234, 4233, 4232, 4231, 4230, 4229, 4228, 4227, 4226, 4225, 4224, 4223, 4222, 4221, 4220, 4219, 4218, 4217, 4216, 4215, 4214, 4213, 4212, 4211, 4210, 4209, 4208, 4207, 4206, 4205, 4204, 4203, 4202, 4201, 4200, 4199, 4198, 4197, 4196, 4195, 4194, 4193, 4192, 4191, 4190, 4189, 4188, 4187, 4186, 4185, 4184, 4183, 4182, 4181, 4180, 4179, 4178, 4177, 4176, 4175, 4174, 4173, 4172, 4171, 4170, 4169, 4168, 4167, 4166, 4165, 4164, 4163, 4162, 4161, 4160, 4159, 4158, 4157, 4156, 4155, 4154, 4153, 4152, 4151, 4150, 4149, 4148, 4147, 4146, 4145, 4144, 4143, 4142, 4141, 4140, 4139, 4138, 4137, 4136, 4135, 4134, 4133, 4132, 4131, 4130, 4129, 4128, 4127, 4126, 4125, 4124, 4123, 4122, 4121, 4120, 4119, 4118, 4117, 4116, 4115, 4114, 4113, 4112, 4111, 4110, 4109, 4108, 4107, 4106, 4105, 4104, 4103, 4102, 4101, 4100, 4099, 4098, 4097, 4096, 4095, 4094, 4093, 4092, 4091, 4090, 4089, 4088, 4087, 4086, 4085, 4084, 4083, 4082, 4081, 4080, 4079, 4078, 4077, 4076, 4075, 4074, 4073, 4072, 4071, 4070, 4069, 4068, 4067, 4066, 4065, 4064, 4063, 4062, 4061, 4060, 4059, 4058, 4057, 4056, 4055, 4054, 4053, 4052, 4051, 4050, 4049, 4048, 4047, 4046, 4045, 4044, 4043, 4042, 4041, 4040, 4039, 4038, 4037, 4036, 4035, 4034, 4033, 4032, 4031, 4030, 4029, 4028, 4027, 4026, 4025, 4024, 4023, 4022, 4021, 4020, 4019, 4018, 4017, 4016, 4015, 4014, 4013, 4012, 4011, 4010, 4009, 4008, 4007, 4006, 4005, 4004, 4003, 4002, 4001, 4000, 3999, 3998, 3997, 3996, 3995, 3994, 3993, 3992, 3991, 3990, 3989, 3988, 3987, 3986, 3985, 3984, 3983, 3982, 3981, 3980, 3979, 3978, 3977, 3976, 3975, 3974, 3973, 3972, 3971, 3970, 3969, 3968, 3967, 3966, 3965, 3964, 3963, 3962, 3961, 3960, 3959, 3958, 3957, 3956, 3955, 3954, 3953, 3952, 3951, 3950, 3949, 3948, 3947, 3946, 3945, 3944, 3943, 3942, 3941, 3940, 3939, 3938, 3937, 3936, 3935, 3934, 3933, 3932, 3931, 3930, 3929, 3928, 3927, 3926, 3925, 3924, 3923, 3922, 3921, 3920, 3919, 3918, 3917, 3916, 3915, 3914, 3913, 3912, 3911, 3910, 3909, 3908, 3907, 3906, 3905, 3904, 3903, 3902, 3901, 3900, 3899, 3898, 3897, 3896, 3895, 3894, 3893, 3892, 3891, 3890, 3889, 3888, 3887, 3886, 3885, 3884, 3883, 3882, 3881, 3880, 3879, 3878, 3877, 3876, 3875, 3874, 3873, 3872, 3871, 3870, 3869, 3868, 3867, 3866, 3865, 3864, 3863, 3862, 3861, 3860, 3859, 3858, 3857, 3856, 3855, 3854, 3853, 3852, 3851, 3850, 3849, 3848, 3847, 3846, 3845, 3844, 3843, 3842, 3841, 3840, 3839, 3838, 3837, 3836, 3835, 3834, 3833, 3832, 3831, 3830, 3829, 3828, 3827, 3826, 3825, 3824, 3823, 3822, 3821, 3820, 3819, 3818, 3817, 3816, 3815, 3814, 3813, 3812, 3811, 3810, 3809, 3808, 3807, 3806, 3805, 3804, 3803, 3802, 3801, 3800, 3799, 3798, 3797, 3796, 3795, 3794, 3793, 3792, 3791, 3790, 3789, 3788, 3787, 3786, 3785, 3784, 3783, 3782, 3781, 3780, 3779, 3778, 3777, 3776, 3775, 3774, 3773, 3772, 3771, 3770, 3769, 3768, 3767, 3766, 3765, 3764, 3763, 3762, 3761, 3760, 3759, 3758, 3757, 3756, 3755, 3754, 3753, 3752, 3751, 3750, 3749, 3748, 3747, 3746, 3745, 3744, 3743, 3742, 3741, 3740, 3739, 3738, 3737, 3736, 3735, 3734, 3733, 3732, 3731, 3730, 3729, 3728, 3727, 3726, 3725, 3724, 3723, 3722, 3721, 3720, 3719, 3718, 3717, 3716, 3715, 3714, 3713, 3712, 3711, 3710, 3709, 3708, 3707, 3706, 3705, 3704, 3703, 3702, 3701, 3700, 3699, 3698, 3697, 3696, 3695, 3694, 3693, 3692, 3691, 3690, 3689, 3688, 3687, 3686, 3685, 3684, 3683, 3682, 3681, 3680, 3679, 3678, 3677, 3676, 3675, 3674, 3673, 3672, 3671, 3670, 3669, 3668, 3667, 3666, 3665, 3664, 3663, 3662, 3661, 3660, 3659, 3658, 3657, 3656, 3655, 3654, 3653, 3652, 3651, 3650, 3649, 3648, 3647, 3646, 3645, 3644, 3643, 3642, 3641, 3640, 3639, 3638, 3637, 3636, 3635, 3634, 3633, 3632, 3631, 3630, 3629, 3628, 3627, 3626, 3625, 3624, 3623, 3622, 3621, 3620, 3619, 3618, 3617, 3616, 3615, 3614, 3613, 3612, 3611, 3610, 3609, 3608, 3607, 3606, 3605, 3604, 3603, 3602, 3601, 3600, 3599, 3598, 3597, 3596, 3595, 3594, 3593, 3592, 3591, 3590, 3589, 3588, 3587, 3586, 3585, 3584, 3583, 3582, 3581, 3580, 3579, 3578, 3577, 3576, 3575, 3574, 3573, 3572, 3571, 3570, 3569, 3568, 3567, 3566, 3565, 3564, 3563, 3562, 3561, 3560, 3559, 3558, 3557, 3556, 3555, 3554, 3553, 3552, 3551, 3550, 3549, 3548, 3547, 3546, 3545, 3544, 3543, 3542, 3541, 3540, 3539, 3538, 3537, 3536, 3535, 3534, 3533, 3532, 3531, 3530, 3529, 3528, 3527, 3526, 3525, 3524, 3523, 3522, 3521, 3520, 3519, 3518, 3517, 3516, 3515, 3514, 3513, 3512, 3511, 3510, 3509, 3508, 3507, 3506, 3505, 3504, 3503, 3502, 3501, 3500, 3499, 3498, 3497, 3496, 3495, 3494, 3493, 3492, 3491, 3490, 3489, 3488, 3487, 3486, 3485, 3484, 3483, 3482, 3481, 3480, 3479, 3478, 3477, 3476, 3475, 3474, 3473, 3472, 3471, 3470, 3469, 3468, 3467, 3466, 3465, 3464, 3463, 3462, 3461, 3460, 3459, 3458, 3457, 3456, 3455, 3454, 3453, 3452, 3451, 3450, 3449, 3448, 3447, 3446, 3445, 3444, 3443, 3442, 3441, 3440, 3439, 3438, 3437, 3436, 3435, 3434, 3433, 3432, 3431, 3430, 3429, 3428, 3427, 3426, 3425, 3424, 3423, 3422, 3421, 3420, 3419, 3418, 3417, 3416, 3415, 3414, 3413, 3412, 3411, 3410, 3409, 3408, 3407, 3406, 3405, 3404, 3403, 3402, 3401, 3400, 3399, 3398, 3397, 3396, 3395, 3394, 3393, 3392, 3391, 3390, 3389, 3388, 3387, 3386, 3385, 3384, 3383, 3382, 3381, 3380, 3379, 3378, 3377, 3376, 3375, 3374, 3373, 3372, 3371, 3370, 3369, 3368, 3367, 3366, 3365, 3364, 3363, 3362, 3361, 3360, 3359, 3358, 3357, 3356, 3355, 3354, 3353, 3352, 3351, 3350, 3349, 3348, 3347, 3346, 3345, 3344, 3343, 3342, 3341, 3340, 3339, 3338, 3337, 3336, 3335, 3334, 3333, 3332, 3331, 3330, 3329, 3328, 3327, 3326, 3325, 3324, 3323, 3322, 3321, 3320, 3319, 3318, 3317, 3316, 3315, 3314, 3313, 3312, 3311, 3310, 3309, 3308, 3307, 3306, 3305, 3304, 3303, 3302, 3301, 3300, 3299, 3298, 3297, 3296, 3295, 3294, 3293, 3292, 3291, 3290, 3289, 3288, 3287, 3286, 3285, 3284, 3283, 3282, 3281, 3280, 3279, 3278, 3277, 3276, 3275, 3274, 3273, 3272, 3271, 3270, 3269, 3268, 3267, 3266, 3265, 3264, 3263, 3262, 3261, 3260, 3259, 3258, 3257, 3256, 3255, 3254, 3253, 3252, 3251, 3250, 3249, 3248, 3247, 3246, 3245, 3244, 3243, 3242, 3241, 3240, 3239, 3238, 3237, 3236, 3235, 3234, 3233, 3232, 3231, 3230, 3229, 3228, 3227, 3226, 3225, 3224, 3223, 3222, 3221, 3220, 3219, 3218, 3217, 3216, 3215, 3214, 3213, 3212, 3211, 3210, 3209, 3208, 3207, 3206, 3205, 3204, 3203, 3202, 3201, 3200, 3199, 3198, 3197, 3196, 3195, 3194, 3193, 3192, 3191, 3190, 3189, 3188, 3187, 3186, 3185, 3184, 3183, 3182, 3181, 3180, 3179, 3178, 3177, 3176, 3175, 3174, 3173, 3172, 3171, 3170, 3169, 3168, 3167, 3166, 3165, 3164, 3163, 3162, 3161, 3160, 3159, 3158, 3157, 3156, 3155, 3154, 3153, 3152, 3151, 3150, 3149, 3148, 3147, 3146, 3145, 3144, 3143, 3142, 3141, 3140, 3139, 3138, 3137, 3136, 3135, 3134, 3133, 3132, 3131, 3130, 3129, 3128, 3127, 3126, 3125, 3124, 3123, 3122, 3121, 3120, 3119, 3118, 3117, 3116, 3115, 3114, 3113, 3112, 3111, 3110, 3109, 3108, 3107, 3106, 3105, 3104, 3103, 3102, 3101, 3100, 3099, 3098, 3097, 3096, 3095, 3094, 3093, 3092, 3091, 3090, 3089, 3088, 3087, 3086, 3085, 3084, 3083, 3082, 3081, 3080, 3079, 3078, 3077, 3076, 3075, 3074, 3073, 3072, 3071, 3070, 3069, 3068, 3067, 3066, 3065, 3064, 3063, 3062, 3061, 3060, 3059, 3058, 3057, 3056, 3055, 3054, 3053, 3052, 3051, 3050, 3049, 3048, 3047, 3046, 3045, 3044, 3043, 3042, 3041, 3040, 3039, 3038, 3037, 3036, 3035, 3034, 3033, 3032, 3031, 3030, 3029, 3028, 3027, 3026, 3025, 3024, 3023, 3022, 3021, 3020, 3019, 3018, 3017, 3016, 3015, 3014, 3013, 3012, 3011, 3010, 3009, 3008, 3007, 3006, 3005, 3004, 3003, 3002, 3001, 3000, 2999, 2998, 2997, 2996, 2995, 2994, 2993, 2992, 2991, 2990, 2989, 2988, 2987, 2986, 2985, 2984, 2983, 2982, 2981, 2980, 2979, 2978, 2977, 2976, 2975, 2974, 2973, 2972, 2971, 2970, 2969, 2968, 2967, 2966, 2965, 2964, 2963, 2962, 2961, 2960, 2959, 2958, 2957, 2956, 2955, 2954, 2953, 2952, 2951, 2950, 2949, 2948, 2947, 2946, 2945, 2944, 2943, 2942, 2941, 2940, 2939, 2938, 2937, 2936, 2935, 2934, 2933, 2932, 2931, 2930, 2929, 2928, 2927, 2926, 2925, 2924, 2923, 2922, 2921, 2920, 2919, 2918, 2917, 2916, 2915, 2914, 2913, 2912, 2911, 2910, 2909, 2908, 2907, 2906, 2905, 2904, 2903, 2902, 2901, 2900, 2899, 2898, 2897, 2896, 2895, 2894, 2893, 2892, 2891, 2890, 2889, 2888, 2887, 2886, 2885, 2884, 2883, 2882, 2881, 2880, 2879, 2878, 2877, 2876, 2875, 2874, 2873, 2872, 2871, 2870, 2869, 2868, 2867, 2866, 2865, 2864, 2863, 2862, 2861, 2860, 2859, 2858, 2857, 2856, 2855, 2854, 2853, 2852, 2851, 2850, 2849, 2848, 2847, 2846, 2845, 2844, 2843, 2842, 2841, 2840, 2839, 2838, 2837, 2836, 2835, 2834, 2833, 2832, 2831, 2830, 2829, 2828, 2827, 2826, 2825, 2824, 2823, 2822, 2821, 2820, 2819, 2818, 2817, 2816, 2815, 2814, 2813, 2812, 2811, 2810, 2809, 2808, 2807, 2806, 2805, 2804, 2803, 2802, 2801, 2800, 2799, 2798, 2797, 2796, 2795, 2794, 2793, 2792, 2791, 2790, 2789, 2788, 2787, 2786, 2785, 2784, 2783, 2782, 2781, 2780, 2779, 2778, 2777, 2776, 2775, 2774, 2773, 2772, 2771, 2770, 2769, 2768, 2767, 2766, 2765, 2764, 2763, 2762, 2761, 2760, 2759, 2758, 2757, 2756, 2755, 2754, 2753, 2752, 2751, 2750, 2749, 2748, 2747, 2746, 2745, 2744, 2743, 2742, 2741, 2740, 2739, 2738, 2737, 2736, 2735, 2734, 2733, 2732, 2731, 2730, 2729, 2728, 2727, 2726, 2725, 2724, 2723, 2722, 2721, 2720, 2719, 2718, 2717, 2716, 2715, 2714, 2713, 2712, 2711, 2710, 2709, 2708, 2707, 2706, 2705, 2704, 2703, 2702, 2701, 2700, 2699, 2698, 2697, 2696, 2695, 2694, 2693, 2692, 2691, 2690, 2689, 2688, 2687, 2686, 2685, 2684, 2683, 2682, 2681, 2680, 2679, 2678, 2677, 2676, 2675, 2674, 2673, 2672, 2671, 2670, 2669, 2668, 2667, 2666, 2665, 2664, 2663, 2662, 2661, 2660, 2659, 2658, 2657, 2656, 2655, 2654, 2653, 2652, 2651, 2650, 2649, 2648, 2647, 2646, 2645, 2644, 2643, 2642, 2641, 2640, 2639, 2638, 2637, 2636, 2635, 2634, 2633, 2632, 2631, 2630, 2629, 2628, 2627, 2626, 2625, 2624, 2623, 2622, 2621, 2620, 2619, 2618, 2617, 2616, 2615, 2614, 2613, 2612, 2611, 2610, 2609, 2608, 2607, 2606, 2605, 2604, 2603, 2602, 2601, 2600, 2599, 2598, 2597, 2596, 2595, 2594, 2593, 2592, 2591, 2590, 2589, 2588, 2587, 2586, 2585, 2584, 2583, 2582, 2581, 2580, 2579, 2578, 2577, 2576, 2575, 2574, 2573, 2572, 2571, 2570, 2569, 2568, 2567, 2566, 2565, 2564, 2563, 2562, 2561, 2560, 2559, 2558, 2557, 2556, 2555, 2554, 2553, 2552, 2551, 2550, 2549, 2548, 2547, 2546, 2545, 2544, 2543, 2542, 2541, 2540, 2539, 2538, 2537, 2536, 2535, 2534, 2533, 2532, 2531, 2530, 2529, 2528, 2527, 2526, 2525, 2524, 2523, 2522, 2521, 2520, 2519, 2518, 2517, 2516, 2515, 2514, 2513, 2512, 2511, 2510, 2509, 2508, 2507, 2506, 2505, 2504, 2503, 2502, 2501, 2500, 2499, 2498, 2497, 2496, 2495, 2494, 2493, 2492, 2491, 2490, 2489, 2488, 2487, 2486, 2485, 2484, 2483, 2482, 2481, 2480, 2479, 2478, 2477, 2476, 2475, 2474, 2473, 2472, 2471, 2470, 2469, 2468, 2467, 2466, 2465, 2464, 2463, 2462, 2461, 2460, 2459, 2458, 2457, 2456, 2455, 2454, 2453, 2452, 2451, 2450, 2449, 2448, 2447, 2446, 2445, 2444, 2443, 2442, 2441, 2440, 2439, 2438, 2437, 2436, 2435, 2434, 2433, 2432, 2431, 2430, 2429, 2428, 2427, 2426, 2425, 2424, 2423, 2422, 2421, 2420, 2419, 2418, 2417, 2416, 2415, 2414, 2413, 2412, 2411, 2410, 2409, 2408, 2407, 2406, 2405, 2404, 2403, 2402, 2401, 2400, 2399, 2398, 2397, 2396, 2395, 2394, 2393, 2392, 2391, 2390, 2389, 2388, 2387, 2386, 2385, 2384, 2383, 2382, 2381, 2380, 2379, 2378, 2377, 2376, 2375, 2374, 2373, 2372, 2371, 2370, 2369, 2368, 2367, 2366, 2365, 2364, 2363, 2362, 2361, 2360, 2359, 2358, 2357, 2356, 2355, 2354, 2353, 2352, 2351, 2350, 2349, 2348, 2347, 2346, 2345, 2344, 2343, 2342, 2341, 2340, 2339, 2338, 2337, 2336, 2335, 2334, 2333, 2332, 2331, 2330, 2329, 2328, 2327, 2326, 2325, 2324, 2323, 2322, 2321, 2320, 2319, 2318, 2317, 2316, 2315, 2314, 2313, 2312, 2311, 2310, 2309, 2308, 2307, 2306, 2305, 2304, 2303, 2302, 2301, 2300, 2299, 2298, 2297, 2296, 2295, 2294, 2293, 2292, 2291, 2290, 2289, 2288, 2287, 2286, 2285, 2284, 2283, 2282, 2281, 2280, 2279, 2278, 2277, 2276, 2275, 2274, 2273, 2272, 2271, 2270, 2269, 2268, 2267, 2266, 2265, 2264, 2263, 2262, 2261, 2260, 2259, 2258, 2257, 2256, 2255, 2254, 2253, 2252, 2251, 2250, 2249, 2248, 2247, 2246, 2245, 2244, 2243, 2242, 2241, 2240, 2239, 2238, 2237, 2236, 2235, 2234, 2233, 2232, 2231, 2230, 2229, 2228, 2227, 2226, 2225, 2224, 2223, 2222, 2221, 2220, 2219, 2218, 2217, 2216, 2215, 2214, 2213, 2212, 2211, 2210, 2209, 2208, 2207, 2206, 2205, 2204, 2203, 2202, 2201, 2200, 2199, 2198, 2197, 2196, 2195, 2194, 2193, 2192, 2191, 2190, 2189, 2188, 2187, 2186, 2185, 2184, 2183, 2182, 2181, 2180, 2179, 2178, 2177, 2176, 2175, 2174, 2173, 2172, 2171, 2170, 2169, 2168, 2167, 2166, 2165, 2164, 2163, 2162, 2161, 2160, 2159, 2158, 2157, 2156, 2155, 2154, 2153, 2152, 2151, 2150, 2149, 2148, 2147, 2146, 2145, 2144, 2143, 2142, 2141, 2140, 2139, 2138, 2137, 2136, 2135, 2134, 2133, 2132, 2131, 2130, 2129, 2128, 2127, 2126, 2125, 2124, 2123, 2122, 2121, 2120, 2119, 2118, 2117, 2116, 2115, 2114, 2113, 2112, 2111, 2110, 2109, 2108, 2107, 2106, 2105, 2104, 2103, 2102, 2101, 2100, 2099, 2098, 2097, 2096, 2095, 2094, 2093, 2092, 2091, 2090, 2089, 2088, 2087, 2086, 2085, 2084, 2083, 2082, 2081, 2080, 2079, 2078, 2077, 2076, 2075, 2074, 2073, 2072, 2071, 2070, 2069, 2068, 2067, 2066, 2065, 2064, 2063, 2062, 2061, 2060, 2059, 2058, 2057, 2056, 2055, 2054, 2053, 2052, 2051, 2050, 2049, 2048, 2047, 2046, 2045, 2044, 2043, 2042, 2041, 2040, 2039, 2038, 2037, 2036, 2035, 2034, 2033, 2032, 2031, 2030, 2029, 2028, 2027, 2026, 2025, 2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970, 1969, 1968, 1967, 1966, 1965, 1964, 1963, 1962, 1961, 1960, 1959, 1958, 1957, 1956, 1955, 1954, 1953, 1952, 1951, 1950, 1949, 1948, 1947, 1946, 1945, 1944, 1943, 1942, 1941, 1940, 1939, 1938, 1937, 1936, 1935, 1934, 1933, 1932, 1931, 1930, 1929, 1928, 1927, 1926, 1925, 1924, 1923, 1922, 1921, 1920, 1919, 1918, 1917, 1916, 1915, 1914, 1913, 1912, 1911, 1910, 1909, 1908, 1907, 1906, 1905, 1904, 1903, 1902, 1901, 1900, 1899, 1898, 1897, 1896, 1895, 1894, 1893, 1892, 1891, 1890, 1889, 1888, 1887, 1886, 1885, 1884, 1883, 1882, 1881, 1880, 1879, 1878, 1877, 1876, 1875, 1874, 1873, 1872, 1871, 1870, 1869, 1868, 1867, 1866, 1865, 1864, 1863, 1862, 1861, 1860, 1859, 1858, 1857, 1856, 1855, 1854, 1853, 1852, 1851, 1850, 1849, 1848, 1847, 1846, 1845, 1844, 1843, 1842, 1841, 1840, 1839, 1838, 1837, 1836, 1835, 1834, 1833, 1832, 1831, 1830, 1829, 1828, 1827, 1826, 1825, 1824, 1823, 1822, 1821, 1820, 1819, 1818, 1817, 1816, 1815, 1814, 1813, 1812, 1811, 1810, 1809, 1808, 1807, 1806, 1805, 1804, 1803, 1802, 1801, 1800, 1799, 1798, 1797, 1796, 1795, 1794, 1793, 1792, 1791, 1790, 1789, 1788, 1787, 1786, 1785, 1784, 1783, 1782, 1781, 1780, 1779, 1778, 1777, 1776, 1775, 1774, 1773, 1772, 1771, 1770, 1769, 1768, 1767, 1766, 1765, 1764, 1763, 1762, 1761, 1760, 1759, 1758, 1757, 1756, 1755, 1754, 1753, 1752, 1751, 1750, 1749, 1748, 1747, 1746, 1745, 1744, 1743, 1742, 1741, 1740, 1739, 1738, 1737, 1736, 1735, 1734, 1733, 1732, 1731, 1730, 1729, 1728, 1727, 1726, 1725, 1724, 1723, 1722, 1721, 1720, 1719, 1718, 1717, 1716, 1715, 1714, 1713, 1712, 1711, 1710, 1709, 1708, 1707, 1706, 1705, 1704, 1703, 1702, 1701, 1700, 1699, 1698, 1697, 1696, 1695, 1694, 1693, 1692, 1691, 1690, 1689, 1688, 1687, 1686, 1685, 1684, 1683, 1682, 1681, 1680, 1679, 1678, 1677, 1676, 1675, 1674, 1673, 1672, 1671, 1670, 1669, 1668, 1667, 1666, 1665, 1664, 1663, 1662, 1661, 1660, 1659, 1658, 1657, 1656, 1655, 1654, 1653, 1652, 1651, 1650, 1649, 1648, 1647, 1646, 1645, 1644, 1643, 1642, 1641, 1640, 1639, 1638, 1637, 1636, 1635, 1634, 1633, 1632, 1631, 1630, 1629, 1628, 1627, 1626, 1625, 1624, 1623, 1622, 1621, 1620, 1619, 1618, 1617, 1616, 1615, 1614, 1613, 1612, 1611, 1610, 1609, 1608, 1607, 1606, 1605, 1604, 1603, 1602, 1601, 1600, 1599, 1598, 1597, 1596, 1595, 1594, 1593, 1592, 1591, 1590, 1589, 1588, 1587, 1586, 1585, 1584, 1583, 1582, 1581, 1580, 1579, 1578, 1577, 1576, 1575, 1574, 1573, 1572, 1571, 1570, 1569, 1568, 1567, 1566, 1565, 1564, 1563, 1562, 1561, 1560, 1559, 1558, 1557, 1556, 1555, 1554, 1553, 1552, 1551, 1550, 1549, 1548, 1547, 1546, 1545, 1544, 1543, 1542, 1541, 1540, 1539, 1538, 1537, 1536, 1535, 1534, 1533, 1532, 1531, 1530, 1529, 1528, 1527, 1526, 1525, 1524, 1523, 1522, 1521, 1520, 1519, 1518, 1517, 1516, 1515, 1514, 1513, 1512, 1511, 1510, 1509, 1508, 1507, 1506, 1505, 1504, 1503, 1502, 1501, 1500, 1499, 1498, 1497, 1496, 1495, 1494, 1493, 1492, 1491, 1490, 1489, 1488, 1487, 1486, 1485, 1484, 1483, 1482, 1481, 1480, 1479, 1478, 1477, 1476, 1475, 1474, 1473, 1472, 1471, 1470, 1469, 1468, 1467, 1466, 1465, 1464, 1463, 1462, 1461, 1460, 1459, 1458, 1457, 1456, 1455, 1454, 1453, 1452, 1451, 1450, 1449, 1448, 1447, 1446, 1445, 1444, 1443, 1442, 1441, 1440, 1439, 1438, 1437, 1436, 1435, 1434, 1433, 1432, 1431, 1430, 1429, 1428, 1427, 1426, 1425, 1424, 1423, 1422, 1421, 1420, 1419, 1418, 1417, 1416, 1415, 1414, 1413, 1412, 1411, 1410, 1409, 1408, 1407, 1406, 1405, 1404, 1403, 1402, 1401, 1400, 1399, 1398, 1397, 1396, 1395, 1394, 1393, 1392, 1391, 1390, 1389, 1388, 1387, 1386, 1385, 1384, 1383, 1382, 1381, 1380, 1379, 1378, 1377, 1376, 1375, 1374, 1373, 1372, 1371, 1370, 1369, 1368, 1367, 1366, 1365, 1364, 1363, 1362, 1361, 1360, 1359, 1358, 1357, 1356, 1355, 1354, 1353, 1352, 1351, 1350, 1349, 1348, 1347, 1346, 1345, 1344, 1343, 1342, 1341, 1340, 1339, 1338, 1337, 1336, 1335, 1334, 1333, 1332, 1331, 1330, 1329, 1328, 1327, 1326, 1325, 1324, 1323, 1322, 1321, 1320, 1319, 1318, 1317, 1316, 1315, 1314, 1313, 1312, 1311, 1310, 1309, 1308, 1307, 1306, 1305, 1304, 1303, 1302, 1301, 1300, 1299, 1298, 1297, 1296, 1295, 1294, 1293, 1292, 1291, 1290, 1289, 1288, 1287, 1286, 1285, 1284, 1283, 1282, 1281, 1280, 1279, 1278, 1277, 1276, 1275, 1274, 1273, 1272, 1271, 1270, 1269, 1268, 1267, 1266, 1265, 1264, 1263, 1262, 1261, 1260, 1259, 1258, 1257, 1256, 1255, 1254, 1253, 1252, 1251, 1250, 1249, 1248, 1247, 1246, 1245, 1244, 1243, 1242, 1241, 1240, 1239, 1238, 1237, 1236, 1235, 1234, 1233, 1232, 1231, 1230, 1229, 1228, 1227, 1226, 1225, 1224, 1223, 1222, 1221, 1220, 1219, 1218, 1217, 1216, 1215, 1214, 1213, 1212, 1211, 1210, 1209, 1208, 1207, 1206, 1205, 1204, 1203, 1202, 1201, 1200, 1199, 1198, 1197, 1196, 1195, 1194, 1193, 1192, 1191, 1190, 1189, 1188, 1187, 1186, 1185, 1184, 1183, 1182, 1181, 1180, 1179, 1178, 1177, 1176, 1175, 1174, 1173, 1172, 1171, 1170, 1169, 1168, 1167, 1166, 1165, 1164, 1163, 1162, 1161, 1160, 1159, 1158, 1157, 1156, 1155, 1154, 1153, 1152, 1151, 1150, 1149, 1148, 1147, 1146, 1145, 1144, 1143, 1142, 1141, 1140, 1139, 1138, 1137, 1136, 1135, 1134, 1133, 1132, 1131, 1130, 1129, 1128, 1127, 1126, 1125, 1124, 1123, 1122, 1121, 1120, 1119, 1118, 1117, 1116, 1115, 1114, 1113, 1112, 1111, 1110, 1109, 1108, 1107, 1106, 1105, 1104, 1103, 1102, 1101, 1100, 1099, 1098, 1097, 1096, 1095, 1094, 1093, 1092, 1091, 1090, 1089, 1088, 1087, 1086, 1085, 1084, 1083, 1082, 1081, 1080, 1079, 1078, 1077, 1076, 1075, 1074, 1073, 1072, 1071, 1070, 1069, 1068, 1067, 1066, 1065, 1064, 1063, 1062, 1061, 1060, 1059, 1058, 1057, 1056, 1055, 1054, 1053, 1052, 1051, 1050, 1049, 1048, 1047, 1046, 1045, 1044, 1043, 1042, 1041, 1040, 1039, 1038, 1037, 1036, 1035, 1034, 1033, 1032, 1031, 1030, 1029, 1028, 1027, 1026, 1025, 1024, 1023, 1022, 1021, 1020, 1019, 1018, 1017, 1016, 1015, 1014, 1013, 1012, 1011, 1010, 1009, 1008, 1007, 1006, 1005, 1004, 1003, 1002, 1001, 1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970, 969, 968, 967, 966, 965, 964, 963, 962, 961, 960, 959, 958, 957, 956, 955, 954, 953, 952, 951, 950, 949, 948, 947, 946, 945, 944, 943, 942, 941, 940, 939, 938, 937, 936, 935, 934, 933, 932, 931, 930, 929, 928, 927, 926, 925, 924, 923, 922, 921, 920, 919, 918, 917, 916, 915, 914, 913, 912, 911, 910, 909, 908, 907, 906, 905, 904, 903, 902, 901, 900, 899, 898, 897, 896, 895, 894, 893, 892, 891, 890, 889, 888, 887, 886, 885, 884, 883, 882, 881, 880, 879, 878, 877, 876, 875, 874, 873, 872, 871, 870, 869, 868, 867, 866, 865, 864, 863, 862, 861, 860, 859, 858, 857, 856, 855, 854, 853, 852, 851, 850, 849, 848, 847, 846, 845, 844, 843, 842, 841, 840, 839, 838, 837, 836, 835, 834, 833, 832, 831, 830, 829, 828, 827, 826, 825, 824, 823, 822, 821, 820, 819, 818, 817, 816, 815, 814, 813, 812, 811, 810, 809, 808, 807, 806, 805, 804, 803, 802, 801, 800, 799, 798, 797, 796, 795, 794, 793, 792, 791, 790, 789, 788, 787, 786, 785, 784, 783, 782, 781, 780, 779, 778, 777, 776, 775, 774, 773, 772, 771, 770, 769, 768, 767, 766, 765, 764, 763, 762, 761, 760, 759, 758, 757, 756, 755, 754, 753, 752, 751, 750, 749, 748, 747, 746, 745, 744, 743, 742, 741, 740, 739, 738, 737, 736, 735, 734, 733, 732, 731, 730, 729, 728, 727, 726, 725, 724, 723, 722, 721, 720, 719, 718, 717, 716, 715, 714, 713, 712, 711, 710, 709, 708, 707, 706, 705, 704, 703, 702, 701, 700, 699, 698, 697, 696, 695, 694, 693, 692, 691, 690, 689, 688, 687, 686, 685, 684, 683, 682, 681, 680, 679, 678, 677, 676, 675, 674, 673, 672, 671, 670, 669, 668, 667, 666, 665, 664, 663, 662, 661, 660, 659, 658, 657, 656, 655, 654, 653, 652, 651, 650, 649, 648, 647, 646, 645, 644, 643, 642, 641, 640, 639, 638, 637, 636, 635, 634, 633, 632, 631, 630, 629, 628, 627, 626, 625, 624, 623, 622, 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, 611, 610, 609, 608, 607, 606, 605, 604, 603, 602, 601, 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51]\n assert candidate(n = 200,k = 199) == [1, 200, 2, 199, 3, 198, 4, 197, 5, 196, 6, 195, 7, 194, 8, 193, 9, 192, 10, 191, 11, 190, 12, 189, 13, 188, 14, 187, 15, 186, 16, 185, 17, 184, 18, 183, 19, 182, 20, 181, 21, 180, 22, 179, 23, 178, 24, 177, 25, 176, 26, 175, 27, 174, 28, 173, 29, 172, 30, 171, 31, 170, 32, 169, 33, 168, 34, 167, 35, 166, 36, 165, 37, 164, 38, 163, 39, 162, 40, 161, 41, 160, 42, 159, 43, 158, 44, 157, 45, 156, 46, 155, 47, 154, 48, 153, 49, 152, 50, 151, 51, 150, 52, 149, 53, 148, 54, 147, 55, 146, 56, 145, 57, 144, 58, 143, 59, 142, 60, 141, 61, 140, 62, 139, 63, 138, 64, 137, 65, 136, 66, 135, 67, 134, 68, 133, 69, 132, 70, 131, 71, 130, 72, 129, 73, 128, 74, 127, 75, 126, 76, 125, 77, 124, 78, 123, 79, 122, 80, 121, 81, 120, 82, 119, 83, 118, 84, 117, 85, 116, 86, 115, 87, 114, 88, 113, 89, 112, 90, 111, 91, 110, 92, 109, 93, 108, 94, 107, 95, 106, 96, 105, 97, 104, 98, 103, 99, 102, 100, 101]\n assert candidate(n = 8,k = 6) == [1, 8, 2, 7, 3, 6, 5, 4]\n assert candidate(n = 10,k = 3) == [1, 10, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(n = 10,k = 9) == [1, 10, 2, 9, 3, 8, 4, 7, 5, 6]\n assert candidate(n = 4000,k = 2000) == [1, 4000, 2, 3999, 3, 3998, 4, 3997, 5, 3996, 6, 3995, 7, 3994, 8, 3993, 9, 3992, 10, 3991, 11, 3990, 12, 3989, 13, 3988, 14, 3987, 15, 3986, 16, 3985, 17, 3984, 18, 3983, 19, 3982, 20, 3981, 21, 3980, 22, 3979, 23, 3978, 24, 3977, 25, 3976, 26, 3975, 27, 3974, 28, 3973, 29, 3972, 30, 3971, 31, 3970, 32, 3969, 33, 3968, 34, 3967, 35, 3966, 36, 3965, 37, 3964, 38, 3963, 39, 3962, 40, 3961, 41, 3960, 42, 3959, 43, 3958, 44, 3957, 45, 3956, 46, 3955, 47, 3954, 48, 3953, 49, 3952, 50, 3951, 51, 3950, 52, 3949, 53, 3948, 54, 3947, 55, 3946, 56, 3945, 57, 3944, 58, 3943, 59, 3942, 60, 3941, 61, 3940, 62, 3939, 63, 3938, 64, 3937, 65, 3936, 66, 3935, 67, 3934, 68, 3933, 69, 3932, 70, 3931, 71, 3930, 72, 3929, 73, 3928, 74, 3927, 75, 3926, 76, 3925, 77, 3924, 78, 3923, 79, 3922, 80, 3921, 81, 3920, 82, 3919, 83, 3918, 84, 3917, 85, 3916, 86, 3915, 87, 3914, 88, 3913, 89, 3912, 90, 3911, 91, 3910, 92, 3909, 93, 3908, 94, 3907, 95, 3906, 96, 3905, 97, 3904, 98, 3903, 99, 3902, 100, 3901, 101, 3900, 102, 3899, 103, 3898, 104, 3897, 105, 3896, 106, 3895, 107, 3894, 108, 3893, 109, 3892, 110, 3891, 111, 3890, 112, 3889, 113, 3888, 114, 3887, 115, 3886, 116, 3885, 117, 3884, 118, 3883, 119, 3882, 120, 3881, 121, 3880, 122, 3879, 123, 3878, 124, 3877, 125, 3876, 126, 3875, 127, 3874, 128, 3873, 129, 3872, 130, 3871, 131, 3870, 132, 3869, 133, 3868, 134, 3867, 135, 3866, 136, 3865, 137, 3864, 138, 3863, 139, 3862, 140, 3861, 141, 3860, 142, 3859, 143, 3858, 144, 3857, 145, 3856, 146, 3855, 147, 3854, 148, 3853, 149, 3852, 150, 3851, 151, 3850, 152, 3849, 153, 3848, 154, 3847, 155, 3846, 156, 3845, 157, 3844, 158, 3843, 159, 3842, 160, 3841, 161, 3840, 162, 3839, 163, 3838, 164, 3837, 165, 3836, 166, 3835, 167, 3834, 168, 3833, 169, 3832, 170, 3831, 171, 3830, 172, 3829, 173, 3828, 174, 3827, 175, 3826, 176, 3825, 177, 3824, 178, 3823, 179, 3822, 180, 3821, 181, 3820, 182, 3819, 183, 3818, 184, 3817, 185, 3816, 186, 3815, 187, 3814, 188, 3813, 189, 3812, 190, 3811, 191, 3810, 192, 3809, 193, 3808, 194, 3807, 195, 3806, 196, 3805, 197, 3804, 198, 3803, 199, 3802, 200, 3801, 201, 3800, 202, 3799, 203, 3798, 204, 3797, 205, 3796, 206, 3795, 207, 3794, 208, 3793, 209, 3792, 210, 3791, 211, 3790, 212, 3789, 213, 3788, 214, 3787, 215, 3786, 216, 3785, 217, 3784, 218, 3783, 219, 3782, 220, 3781, 221, 3780, 222, 3779, 223, 3778, 224, 3777, 225, 3776, 226, 3775, 227, 3774, 228, 3773, 229, 3772, 230, 3771, 231, 3770, 232, 3769, 233, 3768, 234, 3767, 235, 3766, 236, 3765, 237, 3764, 238, 3763, 239, 3762, 240, 3761, 241, 3760, 242, 3759, 243, 3758, 244, 3757, 245, 3756, 246, 3755, 247, 3754, 248, 3753, 249, 3752, 250, 3751, 251, 3750, 252, 3749, 253, 3748, 254, 3747, 255, 3746, 256, 3745, 257, 3744, 258, 3743, 259, 3742, 260, 3741, 261, 3740, 262, 3739, 263, 3738, 264, 3737, 265, 3736, 266, 3735, 267, 3734, 268, 3733, 269, 3732, 270, 3731, 271, 3730, 272, 3729, 273, 3728, 274, 3727, 275, 3726, 276, 3725, 277, 3724, 278, 3723, 279, 3722, 280, 3721, 281, 3720, 282, 3719, 283, 3718, 284, 3717, 285, 3716, 286, 3715, 287, 3714, 288, 3713, 289, 3712, 290, 3711, 291, 3710, 292, 3709, 293, 3708, 294, 3707, 295, 3706, 296, 3705, 297, 3704, 298, 3703, 299, 3702, 300, 3701, 301, 3700, 302, 3699, 303, 3698, 304, 3697, 305, 3696, 306, 3695, 307, 3694, 308, 3693, 309, 3692, 310, 3691, 311, 3690, 312, 3689, 313, 3688, 314, 3687, 315, 3686, 316, 3685, 317, 3684, 318, 3683, 319, 3682, 320, 3681, 321, 3680, 322, 3679, 323, 3678, 324, 3677, 325, 3676, 326, 3675, 327, 3674, 328, 3673, 329, 3672, 330, 3671, 331, 3670, 332, 3669, 333, 3668, 334, 3667, 335, 3666, 336, 3665, 337, 3664, 338, 3663, 339, 3662, 340, 3661, 341, 3660, 342, 3659, 343, 3658, 344, 3657, 345, 3656, 346, 3655, 347, 3654, 348, 3653, 349, 3652, 350, 3651, 351, 3650, 352, 3649, 353, 3648, 354, 3647, 355, 3646, 356, 3645, 357, 3644, 358, 3643, 359, 3642, 360, 3641, 361, 3640, 362, 3639, 363, 3638, 364, 3637, 365, 3636, 366, 3635, 367, 3634, 368, 3633, 369, 3632, 370, 3631, 371, 3630, 372, 3629, 373, 3628, 374, 3627, 375, 3626, 376, 3625, 377, 3624, 378, 3623, 379, 3622, 380, 3621, 381, 3620, 382, 3619, 383, 3618, 384, 3617, 385, 3616, 386, 3615, 387, 3614, 388, 3613, 389, 3612, 390, 3611, 391, 3610, 392, 3609, 393, 3608, 394, 3607, 395, 3606, 396, 3605, 397, 3604, 398, 3603, 399, 3602, 400, 3601, 401, 3600, 402, 3599, 403, 3598, 404, 3597, 405, 3596, 406, 3595, 407, 3594, 408, 3593, 409, 3592, 410, 3591, 411, 3590, 412, 3589, 413, 3588, 414, 3587, 415, 3586, 416, 3585, 417, 3584, 418, 3583, 419, 3582, 420, 3581, 421, 3580, 422, 3579, 423, 3578, 424, 3577, 425, 3576, 426, 3575, 427, 3574, 428, 3573, 429, 3572, 430, 3571, 431, 3570, 432, 3569, 433, 3568, 434, 3567, 435, 3566, 436, 3565, 437, 3564, 438, 3563, 439, 3562, 440, 3561, 441, 3560, 442, 3559, 443, 3558, 444, 3557, 445, 3556, 446, 3555, 447, 3554, 448, 3553, 449, 3552, 450, 3551, 451, 3550, 452, 3549, 453, 3548, 454, 3547, 455, 3546, 456, 3545, 457, 3544, 458, 3543, 459, 3542, 460, 3541, 461, 3540, 462, 3539, 463, 3538, 464, 3537, 465, 3536, 466, 3535, 467, 3534, 468, 3533, 469, 3532, 470, 3531, 471, 3530, 472, 3529, 473, 3528, 474, 3527, 475, 3526, 476, 3525, 477, 3524, 478, 3523, 479, 3522, 480, 3521, 481, 3520, 482, 3519, 483, 3518, 484, 3517, 485, 3516, 486, 3515, 487, 3514, 488, 3513, 489, 3512, 490, 3511, 491, 3510, 492, 3509, 493, 3508, 494, 3507, 495, 3506, 496, 3505, 497, 3504, 498, 3503, 499, 3502, 500, 3501, 501, 3500, 502, 3499, 503, 3498, 504, 3497, 505, 3496, 506, 3495, 507, 3494, 508, 3493, 509, 3492, 510, 3491, 511, 3490, 512, 3489, 513, 3488, 514, 3487, 515, 3486, 516, 3485, 517, 3484, 518, 3483, 519, 3482, 520, 3481, 521, 3480, 522, 3479, 523, 3478, 524, 3477, 525, 3476, 526, 3475, 527, 3474, 528, 3473, 529, 3472, 530, 3471, 531, 3470, 532, 3469, 533, 3468, 534, 3467, 535, 3466, 536, 3465, 537, 3464, 538, 3463, 539, 3462, 540, 3461, 541, 3460, 542, 3459, 543, 3458, 544, 3457, 545, 3456, 546, 3455, 547, 3454, 548, 3453, 549, 3452, 550, 3451, 551, 3450, 552, 3449, 553, 3448, 554, 3447, 555, 3446, 556, 3445, 557, 3444, 558, 3443, 559, 3442, 560, 3441, 561, 3440, 562, 3439, 563, 3438, 564, 3437, 565, 3436, 566, 3435, 567, 3434, 568, 3433, 569, 3432, 570, 3431, 571, 3430, 572, 3429, 573, 3428, 574, 3427, 575, 3426, 576, 3425, 577, 3424, 578, 3423, 579, 3422, 580, 3421, 581, 3420, 582, 3419, 583, 3418, 584, 3417, 585, 3416, 586, 3415, 587, 3414, 588, 3413, 589, 3412, 590, 3411, 591, 3410, 592, 3409, 593, 3408, 594, 3407, 595, 3406, 596, 3405, 597, 3404, 598, 3403, 599, 3402, 600, 3401, 601, 3400, 602, 3399, 603, 3398, 604, 3397, 605, 3396, 606, 3395, 607, 3394, 608, 3393, 609, 3392, 610, 3391, 611, 3390, 612, 3389, 613, 3388, 614, 3387, 615, 3386, 616, 3385, 617, 3384, 618, 3383, 619, 3382, 620, 3381, 621, 3380, 622, 3379, 623, 3378, 624, 3377, 625, 3376, 626, 3375, 627, 3374, 628, 3373, 629, 3372, 630, 3371, 631, 3370, 632, 3369, 633, 3368, 634, 3367, 635, 3366, 636, 3365, 637, 3364, 638, 3363, 639, 3362, 640, 3361, 641, 3360, 642, 3359, 643, 3358, 644, 3357, 645, 3356, 646, 3355, 647, 3354, 648, 3353, 649, 3352, 650, 3351, 651, 3350, 652, 3349, 653, 3348, 654, 3347, 655, 3346, 656, 3345, 657, 3344, 658, 3343, 659, 3342, 660, 3341, 661, 3340, 662, 3339, 663, 3338, 664, 3337, 665, 3336, 666, 3335, 667, 3334, 668, 3333, 669, 3332, 670, 3331, 671, 3330, 672, 3329, 673, 3328, 674, 3327, 675, 3326, 676, 3325, 677, 3324, 678, 3323, 679, 3322, 680, 3321, 681, 3320, 682, 3319, 683, 3318, 684, 3317, 685, 3316, 686, 3315, 687, 3314, 688, 3313, 689, 3312, 690, 3311, 691, 3310, 692, 3309, 693, 3308, 694, 3307, 695, 3306, 696, 3305, 697, 3304, 698, 3303, 699, 3302, 700, 3301, 701, 3300, 702, 3299, 703, 3298, 704, 3297, 705, 3296, 706, 3295, 707, 3294, 708, 3293, 709, 3292, 710, 3291, 711, 3290, 712, 3289, 713, 3288, 714, 3287, 715, 3286, 716, 3285, 717, 3284, 718, 3283, 719, 3282, 720, 3281, 721, 3280, 722, 3279, 723, 3278, 724, 3277, 725, 3276, 726, 3275, 727, 3274, 728, 3273, 729, 3272, 730, 3271, 731, 3270, 732, 3269, 733, 3268, 734, 3267, 735, 3266, 736, 3265, 737, 3264, 738, 3263, 739, 3262, 740, 3261, 741, 3260, 742, 3259, 743, 3258, 744, 3257, 745, 3256, 746, 3255, 747, 3254, 748, 3253, 749, 3252, 750, 3251, 751, 3250, 752, 3249, 753, 3248, 754, 3247, 755, 3246, 756, 3245, 757, 3244, 758, 3243, 759, 3242, 760, 3241, 761, 3240, 762, 3239, 763, 3238, 764, 3237, 765, 3236, 766, 3235, 767, 3234, 768, 3233, 769, 3232, 770, 3231, 771, 3230, 772, 3229, 773, 3228, 774, 3227, 775, 3226, 776, 3225, 777, 3224, 778, 3223, 779, 3222, 780, 3221, 781, 3220, 782, 3219, 783, 3218, 784, 3217, 785, 3216, 786, 3215, 787, 3214, 788, 3213, 789, 3212, 790, 3211, 791, 3210, 792, 3209, 793, 3208, 794, 3207, 795, 3206, 796, 3205, 797, 3204, 798, 3203, 799, 3202, 800, 3201, 801, 3200, 802, 3199, 803, 3198, 804, 3197, 805, 3196, 806, 3195, 807, 3194, 808, 3193, 809, 3192, 810, 3191, 811, 3190, 812, 3189, 813, 3188, 814, 3187, 815, 3186, 816, 3185, 817, 3184, 818, 3183, 819, 3182, 820, 3181, 821, 3180, 822, 3179, 823, 3178, 824, 3177, 825, 3176, 826, 3175, 827, 3174, 828, 3173, 829, 3172, 830, 3171, 831, 3170, 832, 3169, 833, 3168, 834, 3167, 835, 3166, 836, 3165, 837, 3164, 838, 3163, 839, 3162, 840, 3161, 841, 3160, 842, 3159, 843, 3158, 844, 3157, 845, 3156, 846, 3155, 847, 3154, 848, 3153, 849, 3152, 850, 3151, 851, 3150, 852, 3149, 853, 3148, 854, 3147, 855, 3146, 856, 3145, 857, 3144, 858, 3143, 859, 3142, 860, 3141, 861, 3140, 862, 3139, 863, 3138, 864, 3137, 865, 3136, 866, 3135, 867, 3134, 868, 3133, 869, 3132, 870, 3131, 871, 3130, 872, 3129, 873, 3128, 874, 3127, 875, 3126, 876, 3125, 877, 3124, 878, 3123, 879, 3122, 880, 3121, 881, 3120, 882, 3119, 883, 3118, 884, 3117, 885, 3116, 886, 3115, 887, 3114, 888, 3113, 889, 3112, 890, 3111, 891, 3110, 892, 3109, 893, 3108, 894, 3107, 895, 3106, 896, 3105, 897, 3104, 898, 3103, 899, 3102, 900, 3101, 901, 3100, 902, 3099, 903, 3098, 904, 3097, 905, 3096, 906, 3095, 907, 3094, 908, 3093, 909, 3092, 910, 3091, 911, 3090, 912, 3089, 913, 3088, 914, 3087, 915, 3086, 916, 3085, 917, 3084, 918, 3083, 919, 3082, 920, 3081, 921, 3080, 922, 3079, 923, 3078, 924, 3077, 925, 3076, 926, 3075, 927, 3074, 928, 3073, 929, 3072, 930, 3071, 931, 3070, 932, 3069, 933, 3068, 934, 3067, 935, 3066, 936, 3065, 937, 3064, 938, 3063, 939, 3062, 940, 3061, 941, 3060, 942, 3059, 943, 3058, 944, 3057, 945, 3056, 946, 3055, 947, 3054, 948, 3053, 949, 3052, 950, 3051, 951, 3050, 952, 3049, 953, 3048, 954, 3047, 955, 3046, 956, 3045, 957, 3044, 958, 3043, 959, 3042, 960, 3041, 961, 3040, 962, 3039, 963, 3038, 964, 3037, 965, 3036, 966, 3035, 967, 3034, 968, 3033, 969, 3032, 970, 3031, 971, 3030, 972, 3029, 973, 3028, 974, 3027, 975, 3026, 976, 3025, 977, 3024, 978, 3023, 979, 3022, 980, 3021, 981, 3020, 982, 3019, 983, 3018, 984, 3017, 985, 3016, 986, 3015, 987, 3014, 988, 3013, 989, 3012, 990, 3011, 991, 3010, 992, 3009, 993, 3008, 994, 3007, 995, 3006, 996, 3005, 997, 3004, 998, 3003, 999, 3002, 1000, 3001, 3000, 2999, 2998, 2997, 2996, 2995, 2994, 2993, 2992, 2991, 2990, 2989, 2988, 2987, 2986, 2985, 2984, 2983, 2982, 2981, 2980, 2979, 2978, 2977, 2976, 2975, 2974, 2973, 2972, 2971, 2970, 2969, 2968, 2967, 2966, 2965, 2964, 2963, 2962, 2961, 2960, 2959, 2958, 2957, 2956, 2955, 2954, 2953, 2952, 2951, 2950, 2949, 2948, 2947, 2946, 2945, 2944, 2943, 2942, 2941, 2940, 2939, 2938, 2937, 2936, 2935, 2934, 2933, 2932, 2931, 2930, 2929, 2928, 2927, 2926, 2925, 2924, 2923, 2922, 2921, 2920, 2919, 2918, 2917, 2916, 2915, 2914, 2913, 2912, 2911, 2910, 2909, 2908, 2907, 2906, 2905, 2904, 2903, 2902, 2901, 2900, 2899, 2898, 2897, 2896, 2895, 2894, 2893, 2892, 2891, 2890, 2889, 2888, 2887, 2886, 2885, 2884, 2883, 2882, 2881, 2880, 2879, 2878, 2877, 2876, 2875, 2874, 2873, 2872, 2871, 2870, 2869, 2868, 2867, 2866, 2865, 2864, 2863, 2862, 2861, 2860, 2859, 2858, 2857, 2856, 2855, 2854, 2853, 2852, 2851, 2850, 2849, 2848, 2847, 2846, 2845, 2844, 2843, 2842, 2841, 2840, 2839, 2838, 2837, 2836, 2835, 2834, 2833, 2832, 2831, 2830, 2829, 2828, 2827, 2826, 2825, 2824, 2823, 2822, 2821, 2820, 2819, 2818, 2817, 2816, 2815, 2814, 2813, 2812, 2811, 2810, 2809, 2808, 2807, 2806, 2805, 2804, 2803, 2802, 2801, 2800, 2799, 2798, 2797, 2796, 2795, 2794, 2793, 2792, 2791, 2790, 2789, 2788, 2787, 2786, 2785, 2784, 2783, 2782, 2781, 2780, 2779, 2778, 2777, 2776, 2775, 2774, 2773, 2772, 2771, 2770, 2769, 2768, 2767, 2766, 2765, 2764, 2763, 2762, 2761, 2760, 2759, 2758, 2757, 2756, 2755, 2754, 2753, 2752, 2751, 2750, 2749, 2748, 2747, 2746, 2745, 2744, 2743, 2742, 2741, 2740, 2739, 2738, 2737, 2736, 2735, 2734, 2733, 2732, 2731, 2730, 2729, 2728, 2727, 2726, 2725, 2724, 2723, 2722, 2721, 2720, 2719, 2718, 2717, 2716, 2715, 2714, 2713, 2712, 2711, 2710, 2709, 2708, 2707, 2706, 2705, 2704, 2703, 2702, 2701, 2700, 2699, 2698, 2697, 2696, 2695, 2694, 2693, 2692, 2691, 2690, 2689, 2688, 2687, 2686, 2685, 2684, 2683, 2682, 2681, 2680, 2679, 2678, 2677, 2676, 2675, 2674, 2673, 2672, 2671, 2670, 2669, 2668, 2667, 2666, 2665, 2664, 2663, 2662, 2661, 2660, 2659, 2658, 2657, 2656, 2655, 2654, 2653, 2652, 2651, 2650, 2649, 2648, 2647, 2646, 2645, 2644, 2643, 2642, 2641, 2640, 2639, 2638, 2637, 2636, 2635, 2634, 2633, 2632, 2631, 2630, 2629, 2628, 2627, 2626, 2625, 2624, 2623, 2622, 2621, 2620, 2619, 2618, 2617, 2616, 2615, 2614, 2613, 2612, 2611, 2610, 2609, 2608, 2607, 2606, 2605, 2604, 2603, 2602, 2601, 2600, 2599, 2598, 2597, 2596, 2595, 2594, 2593, 2592, 2591, 2590, 2589, 2588, 2587, 2586, 2585, 2584, 2583, 2582, 2581, 2580, 2579, 2578, 2577, 2576, 2575, 2574, 2573, 2572, 2571, 2570, 2569, 2568, 2567, 2566, 2565, 2564, 2563, 2562, 2561, 2560, 2559, 2558, 2557, 2556, 2555, 2554, 2553, 2552, 2551, 2550, 2549, 2548, 2547, 2546, 2545, 2544, 2543, 2542, 2541, 2540, 2539, 2538, 2537, 2536, 2535, 2534, 2533, 2532, 2531, 2530, 2529, 2528, 2527, 2526, 2525, 2524, 2523, 2522, 2521, 2520, 2519, 2518, 2517, 2516, 2515, 2514, 2513, 2512, 2511, 2510, 2509, 2508, 2507, 2506, 2505, 2504, 2503, 2502, 2501, 2500, 2499, 2498, 2497, 2496, 2495, 2494, 2493, 2492, 2491, 2490, 2489, 2488, 2487, 2486, 2485, 2484, 2483, 2482, 2481, 2480, 2479, 2478, 2477, 2476, 2475, 2474, 2473, 2472, 2471, 2470, 2469, 2468, 2467, 2466, 2465, 2464, 2463, 2462, 2461, 2460, 2459, 2458, 2457, 2456, 2455, 2454, 2453, 2452, 2451, 2450, 2449, 2448, 2447, 2446, 2445, 2444, 2443, 2442, 2441, 2440, 2439, 2438, 2437, 2436, 2435, 2434, 2433, 2432, 2431, 2430, 2429, 2428, 2427, 2426, 2425, 2424, 2423, 2422, 2421, 2420, 2419, 2418, 2417, 2416, 2415, 2414, 2413, 2412, 2411, 2410, 2409, 2408, 2407, 2406, 2405, 2404, 2403, 2402, 2401, 2400, 2399, 2398, 2397, 2396, 2395, 2394, 2393, 2392, 2391, 2390, 2389, 2388, 2387, 2386, 2385, 2384, 2383, 2382, 2381, 2380, 2379, 2378, 2377, 2376, 2375, 2374, 2373, 2372, 2371, 2370, 2369, 2368, 2367, 2366, 2365, 2364, 2363, 2362, 2361, 2360, 2359, 2358, 2357, 2356, 2355, 2354, 2353, 2352, 2351, 2350, 2349, 2348, 2347, 2346, 2345, 2344, 2343, 2342, 2341, 2340, 2339, 2338, 2337, 2336, 2335, 2334, 2333, 2332, 2331, 2330, 2329, 2328, 2327, 2326, 2325, 2324, 2323, 2322, 2321, 2320, 2319, 2318, 2317, 2316, 2315, 2314, 2313, 2312, 2311, 2310, 2309, 2308, 2307, 2306, 2305, 2304, 2303, 2302, 2301, 2300, 2299, 2298, 2297, 2296, 2295, 2294, 2293, 2292, 2291, 2290, 2289, 2288, 2287, 2286, 2285, 2284, 2283, 2282, 2281, 2280, 2279, 2278, 2277, 2276, 2275, 2274, 2273, 2272, 2271, 2270, 2269, 2268, 2267, 2266, 2265, 2264, 2263, 2262, 2261, 2260, 2259, 2258, 2257, 2256, 2255, 2254, 2253, 2252, 2251, 2250, 2249, 2248, 2247, 2246, 2245, 2244, 2243, 2242, 2241, 2240, 2239, 2238, 2237, 2236, 2235, 2234, 2233, 2232, 2231, 2230, 2229, 2228, 2227, 2226, 2225, 2224, 2223, 2222, 2221, 2220, 2219, 2218, 2217, 2216, 2215, 2214, 2213, 2212, 2211, 2210, 2209, 2208, 2207, 2206, 2205, 2204, 2203, 2202, 2201, 2200, 2199, 2198, 2197, 2196, 2195, 2194, 2193, 2192, 2191, 2190, 2189, 2188, 2187, 2186, 2185, 2184, 2183, 2182, 2181, 2180, 2179, 2178, 2177, 2176, 2175, 2174, 2173, 2172, 2171, 2170, 2169, 2168, 2167, 2166, 2165, 2164, 2163, 2162, 2161, 2160, 2159, 2158, 2157, 2156, 2155, 2154, 2153, 2152, 2151, 2150, 2149, 2148, 2147, 2146, 2145, 2144, 2143, 2142, 2141, 2140, 2139, 2138, 2137, 2136, 2135, 2134, 2133, 2132, 2131, 2130, 2129, 2128, 2127, 2126, 2125, 2124, 2123, 2122, 2121, 2120, 2119, 2118, 2117, 2116, 2115, 2114, 2113, 2112, 2111, 2110, 2109, 2108, 2107, 2106, 2105, 2104, 2103, 2102, 2101, 2100, 2099, 2098, 2097, 2096, 2095, 2094, 2093, 2092, 2091, 2090, 2089, 2088, 2087, 2086, 2085, 2084, 2083, 2082, 2081, 2080, 2079, 2078, 2077, 2076, 2075, 2074, 2073, 2072, 2071, 2070, 2069, 2068, 2067, 2066, 2065, 2064, 2063, 2062, 2061, 2060, 2059, 2058, 2057, 2056, 2055, 2054, 2053, 2052, 2051, 2050, 2049, 2048, 2047, 2046, 2045, 2044, 2043, 2042, 2041, 2040, 2039, 2038, 2037, 2036, 2035, 2034, 2033, 2032, 2031, 2030, 2029, 2028, 2027, 2026, 2025, 2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970, 1969, 1968, 1967, 1966, 1965, 1964, 1963, 1962, 1961, 1960, 1959, 1958, 1957, 1956, 1955, 1954, 1953, 1952, 1951, 1950, 1949, 1948, 1947, 1946, 1945, 1944, 1943, 1942, 1941, 1940, 1939, 1938, 1937, 1936, 1935, 1934, 1933, 1932, 1931, 1930, 1929, 1928, 1927, 1926, 1925, 1924, 1923, 1922, 1921, 1920, 1919, 1918, 1917, 1916, 1915, 1914, 1913, 1912, 1911, 1910, 1909, 1908, 1907, 1906, 1905, 1904, 1903, 1902, 1901, 1900, 1899, 1898, 1897, 1896, 1895, 1894, 1893, 1892, 1891, 1890, 1889, 1888, 1887, 1886, 1885, 1884, 1883, 1882, 1881, 1880, 1879, 1878, 1877, 1876, 1875, 1874, 1873, 1872, 1871, 1870, 1869, 1868, 1867, 1866, 1865, 1864, 1863, 1862, 1861, 1860, 1859, 1858, 1857, 1856, 1855, 1854, 1853, 1852, 1851, 1850, 1849, 1848, 1847, 1846, 1845, 1844, 1843, 1842, 1841, 1840, 1839, 1838, 1837, 1836, 1835, 1834, 1833, 1832, 1831, 1830, 1829, 1828, 1827, 1826, 1825, 1824, 1823, 1822, 1821, 1820, 1819, 1818, 1817, 1816, 1815, 1814, 1813, 1812, 1811, 1810, 1809, 1808, 1807, 1806, 1805, 1804, 1803, 1802, 1801, 1800, 1799, 1798, 1797, 1796, 1795, 1794, 1793, 1792, 1791, 1790, 1789, 1788, 1787, 1786, 1785, 1784, 1783, 1782, 1781, 1780, 1779, 1778, 1777, 1776, 1775, 1774, 1773, 1772, 1771, 1770, 1769, 1768, 1767, 1766, 1765, 1764, 1763, 1762, 1761, 1760, 1759, 1758, 1757, 1756, 1755, 1754, 1753, 1752, 1751, 1750, 1749, 1748, 1747, 1746, 1745, 1744, 1743, 1742, 1741, 1740, 1739, 1738, 1737, 1736, 1735, 1734, 1733, 1732, 1731, 1730, 1729, 1728, 1727, 1726, 1725, 1724, 1723, 1722, 1721, 1720, 1719, 1718, 1717, 1716, 1715, 1714, 1713, 1712, 1711, 1710, 1709, 1708, 1707, 1706, 1705, 1704, 1703, 1702, 1701, 1700, 1699, 1698, 1697, 1696, 1695, 1694, 1693, 1692, 1691, 1690, 1689, 1688, 1687, 1686, 1685, 1684, 1683, 1682, 1681, 1680, 1679, 1678, 1677, 1676, 1675, 1674, 1673, 1672, 1671, 1670, 1669, 1668, 1667, 1666, 1665, 1664, 1663, 1662, 1661, 1660, 1659, 1658, 1657, 1656, 1655, 1654, 1653, 1652, 1651, 1650, 1649, 1648, 1647, 1646, 1645, 1644, 1643, 1642, 1641, 1640, 1639, 1638, 1637, 1636, 1635, 1634, 1633, 1632, 1631, 1630, 1629, 1628, 1627, 1626, 1625, 1624, 1623, 1622, 1621, 1620, 1619, 1618, 1617, 1616, 1615, 1614, 1613, 1612, 1611, 1610, 1609, 1608, 1607, 1606, 1605, 1604, 1603, 1602, 1601, 1600, 1599, 1598, 1597, 1596, 1595, 1594, 1593, 1592, 1591, 1590, 1589, 1588, 1587, 1586, 1585, 1584, 1583, 1582, 1581, 1580, 1579, 1578, 1577, 1576, 1575, 1574, 1573, 1572, 1571, 1570, 1569, 1568, 1567, 1566, 1565, 1564, 1563, 1562, 1561, 1560, 1559, 1558, 1557, 1556, 1555, 1554, 1553, 1552, 1551, 1550, 1549, 1548, 1547, 1546, 1545, 1544, 1543, 1542, 1541, 1540, 1539, 1538, 1537, 1536, 1535, 1534, 1533, 1532, 1531, 1530, 1529, 1528, 1527, 1526, 1525, 1524, 1523, 1522, 1521, 1520, 1519, 1518, 1517, 1516, 1515, 1514, 1513, 1512, 1511, 1510, 1509, 1508, 1507, 1506, 1505, 1504, 1503, 1502, 1501, 1500, 1499, 1498, 1497, 1496, 1495, 1494, 1493, 1492, 1491, 1490, 1489, 1488, 1487, 1486, 1485, 1484, 1483, 1482, 1481, 1480, 1479, 1478, 1477, 1476, 1475, 1474, 1473, 1472, 1471, 1470, 1469, 1468, 1467, 1466, 1465, 1464, 1463, 1462, 1461, 1460, 1459, 1458, 1457, 1456, 1455, 1454, 1453, 1452, 1451, 1450, 1449, 1448, 1447, 1446, 1445, 1444, 1443, 1442, 1441, 1440, 1439, 1438, 1437, 1436, 1435, 1434, 1433, 1432, 1431, 1430, 1429, 1428, 1427, 1426, 1425, 1424, 1423, 1422, 1421, 1420, 1419, 1418, 1417, 1416, 1415, 1414, 1413, 1412, 1411, 1410, 1409, 1408, 1407, 1406, 1405, 1404, 1403, 1402, 1401, 1400, 1399, 1398, 1397, 1396, 1395, 1394, 1393, 1392, 1391, 1390, 1389, 1388, 1387, 1386, 1385, 1384, 1383, 1382, 1381, 1380, 1379, 1378, 1377, 1376, 1375, 1374, 1373, 1372, 1371, 1370, 1369, 1368, 1367, 1366, 1365, 1364, 1363, 1362, 1361, 1360, 1359, 1358, 1357, 1356, 1355, 1354, 1353, 1352, 1351, 1350, 1349, 1348, 1347, 1346, 1345, 1344, 1343, 1342, 1341, 1340, 1339, 1338, 1337, 1336, 1335, 1334, 1333, 1332, 1331, 1330, 1329, 1328, 1327, 1326, 1325, 1324, 1323, 1322, 1321, 1320, 1319, 1318, 1317, 1316, 1315, 1314, 1313, 1312, 1311, 1310, 1309, 1308, 1307, 1306, 1305, 1304, 1303, 1302, 1301, 1300, 1299, 1298, 1297, 1296, 1295, 1294, 1293, 1292, 1291, 1290, 1289, 1288, 1287, 1286, 1285, 1284, 1283, 1282, 1281, 1280, 1279, 1278, 1277, 1276, 1275, 1274, 1273, 1272, 1271, 1270, 1269, 1268, 1267, 1266, 1265, 1264, 1263, 1262, 1261, 1260, 1259, 1258, 1257, 1256, 1255, 1254, 1253, 1252, 1251, 1250, 1249, 1248, 1247, 1246, 1245, 1244, 1243, 1242, 1241, 1240, 1239, 1238, 1237, 1236, 1235, 1234, 1233, 1232, 1231, 1230, 1229, 1228, 1227, 1226, 1225, 1224, 1223, 1222, 1221, 1220, 1219, 1218, 1217, 1216, 1215, 1214, 1213, 1212, 1211, 1210, 1209, 1208, 1207, 1206, 1205, 1204, 1203, 1202, 1201, 1200, 1199, 1198, 1197, 1196, 1195, 1194, 1193, 1192, 1191, 1190, 1189, 1188, 1187, 1186, 1185, 1184, 1183, 1182, 1181, 1180, 1179, 1178, 1177, 1176, 1175, 1174, 1173, 1172, 1171, 1170, 1169, 1168, 1167, 1166, 1165, 1164, 1163, 1162, 1161, 1160, 1159, 1158, 1157, 1156, 1155, 1154, 1153, 1152, 1151, 1150, 1149, 1148, 1147, 1146, 1145, 1144, 1143, 1142, 1141, 1140, 1139, 1138, 1137, 1136, 1135, 1134, 1133, 1132, 1131, 1130, 1129, 1128, 1127, 1126, 1125, 1124, 1123, 1122, 1121, 1120, 1119, 1118, 1117, 1116, 1115, 1114, 1113, 1112, 1111, 1110, 1109, 1108, 1107, 1106, 1105, 1104, 1103, 1102, 1101, 1100, 1099, 1098, 1097, 1096, 1095, 1094, 1093, 1092, 1091, 1090, 1089, 1088, 1087, 1086, 1085, 1084, 1083, 1082, 1081, 1080, 1079, 1078, 1077, 1076, 1075, 1074, 1073, 1072, 1071, 1070, 1069, 1068, 1067, 1066, 1065, 1064, 1063, 1062, 1061, 1060, 1059, 1058, 1057, 1056, 1055, 1054, 1053, 1052, 1051, 1050, 1049, 1048, 1047, 1046, 1045, 1044, 1043, 1042, 1041, 1040, 1039, 1038, 1037, 1036, 1035, 1034, 1033, 1032, 1031, 1030, 1029, 1028, 1027, 1026, 1025, 1024, 1023, 1022, 1021, 1020, 1019, 1018, 1017, 1016, 1015, 1014, 1013, 1012, 1011, 1010, 1009, 1008, 1007, 1006, 1005, 1004, 1003, 1002, 1001]\n assert candidate(n = 30,k = 20) == [1, 30, 2, 29, 3, 28, 4, 27, 5, 26, 6, 25, 7, 24, 8, 23, 9, 22, 10, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11]\n assert candidate(n = 250,k = 120) == [1, 250, 2, 249, 3, 248, 4, 247, 5, 246, 6, 245, 7, 244, 8, 243, 9, 242, 10, 241, 11, 240, 12, 239, 13, 238, 14, 237, 15, 236, 16, 235, 17, 234, 18, 233, 19, 232, 20, 231, 21, 230, 22, 229, 23, 228, 24, 227, 25, 226, 26, 225, 27, 224, 28, 223, 29, 222, 30, 221, 31, 220, 32, 219, 33, 218, 34, 217, 35, 216, 36, 215, 37, 214, 38, 213, 39, 212, 40, 211, 41, 210, 42, 209, 43, 208, 44, 207, 45, 206, 46, 205, 47, 204, 48, 203, 49, 202, 50, 201, 51, 200, 52, 199, 53, 198, 54, 197, 55, 196, 56, 195, 57, 194, 58, 193, 59, 192, 60, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61]\n assert candidate(n = 950,k = 475) == [1, 950, 2, 949, 3, 948, 4, 947, 5, 946, 6, 945, 7, 944, 8, 943, 9, 942, 10, 941, 11, 940, 12, 939, 13, 938, 14, 937, 15, 936, 16, 935, 17, 934, 18, 933, 19, 932, 20, 931, 21, 930, 22, 929, 23, 928, 24, 927, 25, 926, 26, 925, 27, 924, 28, 923, 29, 922, 30, 921, 31, 920, 32, 919, 33, 918, 34, 917, 35, 916, 36, 915, 37, 914, 38, 913, 39, 912, 40, 911, 41, 910, 42, 909, 43, 908, 44, 907, 45, 906, 46, 905, 47, 904, 48, 903, 49, 902, 50, 901, 51, 900, 52, 899, 53, 898, 54, 897, 55, 896, 56, 895, 57, 894, 58, 893, 59, 892, 60, 891, 61, 890, 62, 889, 63, 888, 64, 887, 65, 886, 66, 885, 67, 884, 68, 883, 69, 882, 70, 881, 71, 880, 72, 879, 73, 878, 74, 877, 75, 876, 76, 875, 77, 874, 78, 873, 79, 872, 80, 871, 81, 870, 82, 869, 83, 868, 84, 867, 85, 866, 86, 865, 87, 864, 88, 863, 89, 862, 90, 861, 91, 860, 92, 859, 93, 858, 94, 857, 95, 856, 96, 855, 97, 854, 98, 853, 99, 852, 100, 851, 101, 850, 102, 849, 103, 848, 104, 847, 105, 846, 106, 845, 107, 844, 108, 843, 109, 842, 110, 841, 111, 840, 112, 839, 113, 838, 114, 837, 115, 836, 116, 835, 117, 834, 118, 833, 119, 832, 120, 831, 121, 830, 122, 829, 123, 828, 124, 827, 125, 826, 126, 825, 127, 824, 128, 823, 129, 822, 130, 821, 131, 820, 132, 819, 133, 818, 134, 817, 135, 816, 136, 815, 137, 814, 138, 813, 139, 812, 140, 811, 141, 810, 142, 809, 143, 808, 144, 807, 145, 806, 146, 805, 147, 804, 148, 803, 149, 802, 150, 801, 151, 800, 152, 799, 153, 798, 154, 797, 155, 796, 156, 795, 157, 794, 158, 793, 159, 792, 160, 791, 161, 790, 162, 789, 163, 788, 164, 787, 165, 786, 166, 785, 167, 784, 168, 783, 169, 782, 170, 781, 171, 780, 172, 779, 173, 778, 174, 777, 175, 776, 176, 775, 177, 774, 178, 773, 179, 772, 180, 771, 181, 770, 182, 769, 183, 768, 184, 767, 185, 766, 186, 765, 187, 764, 188, 763, 189, 762, 190, 761, 191, 760, 192, 759, 193, 758, 194, 757, 195, 756, 196, 755, 197, 754, 198, 753, 199, 752, 200, 751, 201, 750, 202, 749, 203, 748, 204, 747, 205, 746, 206, 745, 207, 744, 208, 743, 209, 742, 210, 741, 211, 740, 212, 739, 213, 738, 214, 737, 215, 736, 216, 735, 217, 734, 218, 733, 219, 732, 220, 731, 221, 730, 222, 729, 223, 728, 224, 727, 225, 726, 226, 725, 227, 724, 228, 723, 229, 722, 230, 721, 231, 720, 232, 719, 233, 718, 234, 717, 235, 716, 236, 715, 237, 714, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713]\n assert candidate(n = 25,k = 20) == [1, 25, 2, 24, 3, 23, 4, 22, 5, 21, 6, 20, 7, 19, 8, 18, 9, 17, 10, 16, 15, 14, 13, 12, 11]\n assert candidate(n = 499,k = 249) == [1, 499, 2, 498, 3, 497, 4, 496, 5, 495, 6, 494, 7, 493, 8, 492, 9, 491, 10, 490, 11, 489, 12, 488, 13, 487, 14, 486, 15, 485, 16, 484, 17, 483, 18, 482, 19, 481, 20, 480, 21, 479, 22, 478, 23, 477, 24, 476, 25, 475, 26, 474, 27, 473, 28, 472, 29, 471, 30, 470, 31, 469, 32, 468, 33, 467, 34, 466, 35, 465, 36, 464, 37, 463, 38, 462, 39, 461, 40, 460, 41, 459, 42, 458, 43, 457, 44, 456, 45, 455, 46, 454, 47, 453, 48, 452, 49, 451, 50, 450, 51, 449, 52, 448, 53, 447, 54, 446, 55, 445, 56, 444, 57, 443, 58, 442, 59, 441, 60, 440, 61, 439, 62, 438, 63, 437, 64, 436, 65, 435, 66, 434, 67, 433, 68, 432, 69, 431, 70, 430, 71, 429, 72, 428, 73, 427, 74, 426, 75, 425, 76, 424, 77, 423, 78, 422, 79, 421, 80, 420, 81, 419, 82, 418, 83, 417, 84, 416, 85, 415, 86, 414, 87, 413, 88, 412, 89, 411, 90, 410, 91, 409, 92, 408, 93, 407, 94, 406, 95, 405, 96, 404, 97, 403, 98, 402, 99, 401, 100, 400, 101, 399, 102, 398, 103, 397, 104, 396, 105, 395, 106, 394, 107, 393, 108, 392, 109, 391, 110, 390, 111, 389, 112, 388, 113, 387, 114, 386, 115, 385, 116, 384, 117, 383, 118, 382, 119, 381, 120, 380, 121, 379, 122, 378, 123, 377, 124, 376, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375]\n assert candidate(n = 100,k = 75) == [1, 100, 2, 99, 3, 98, 4, 97, 5, 96, 6, 95, 7, 94, 8, 93, 9, 92, 10, 91, 11, 90, 12, 89, 13, 88, 14, 87, 15, 86, 16, 85, 17, 84, 18, 83, 19, 82, 20, 81, 21, 80, 22, 79, 23, 78, 24, 77, 25, 76, 26, 75, 27, 74, 28, 73, 29, 72, 30, 71, 31, 70, 32, 69, 33, 68, 34, 67, 35, 66, 36, 65, 37, 64, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]\n assert candidate(n = 7,k = 6) == [1, 7, 2, 6, 3, 5, 4]\n assert candidate(n = 30,k = 25) == [1, 30, 2, 29, 3, 28, 4, 27, 5, 26, 6, 25, 7, 24, 8, 23, 9, 22, 10, 21, 11, 20, 12, 19, 13, 14, 15, 16, 17, 18]\n assert candidate(n = 900,k = 450) == [1, 900, 2, 899, 3, 898, 4, 897, 5, 896, 6, 895, 7, 894, 8, 893, 9, 892, 10, 891, 11, 890, 12, 889, 13, 888, 14, 887, 15, 886, 16, 885, 17, 884, 18, 883, 19, 882, 20, 881, 21, 880, 22, 879, 23, 878, 24, 877, 25, 876, 26, 875, 27, 874, 28, 873, 29, 872, 30, 871, 31, 870, 32, 869, 33, 868, 34, 867, 35, 866, 36, 865, 37, 864, 38, 863, 39, 862, 40, 861, 41, 860, 42, 859, 43, 858, 44, 857, 45, 856, 46, 855, 47, 854, 48, 853, 49, 852, 50, 851, 51, 850, 52, 849, 53, 848, 54, 847, 55, 846, 56, 845, 57, 844, 58, 843, 59, 842, 60, 841, 61, 840, 62, 839, 63, 838, 64, 837, 65, 836, 66, 835, 67, 834, 68, 833, 69, 832, 70, 831, 71, 830, 72, 829, 73, 828, 74, 827, 75, 826, 76, 825, 77, 824, 78, 823, 79, 822, 80, 821, 81, 820, 82, 819, 83, 818, 84, 817, 85, 816, 86, 815, 87, 814, 88, 813, 89, 812, 90, 811, 91, 810, 92, 809, 93, 808, 94, 807, 95, 806, 96, 805, 97, 804, 98, 803, 99, 802, 100, 801, 101, 800, 102, 799, 103, 798, 104, 797, 105, 796, 106, 795, 107, 794, 108, 793, 109, 792, 110, 791, 111, 790, 112, 789, 113, 788, 114, 787, 115, 786, 116, 785, 117, 784, 118, 783, 119, 782, 120, 781, 121, 780, 122, 779, 123, 778, 124, 777, 125, 776, 126, 775, 127, 774, 128, 773, 129, 772, 130, 771, 131, 770, 132, 769, 133, 768, 134, 767, 135, 766, 136, 765, 137, 764, 138, 763, 139, 762, 140, 761, 141, 760, 142, 759, 143, 758, 144, 757, 145, 756, 146, 755, 147, 754, 148, 753, 149, 752, 150, 751, 151, 750, 152, 749, 153, 748, 154, 747, 155, 746, 156, 745, 157, 744, 158, 743, 159, 742, 160, 741, 161, 740, 162, 739, 163, 738, 164, 737, 165, 736, 166, 735, 167, 734, 168, 733, 169, 732, 170, 731, 171, 730, 172, 729, 173, 728, 174, 727, 175, 726, 176, 725, 177, 724, 178, 723, 179, 722, 180, 721, 181, 720, 182, 719, 183, 718, 184, 717, 185, 716, 186, 715, 187, 714, 188, 713, 189, 712, 190, 711, 191, 710, 192, 709, 193, 708, 194, 707, 195, 706, 196, 705, 197, 704, 198, 703, 199, 702, 200, 701, 201, 700, 202, 699, 203, 698, 204, 697, 205, 696, 206, 695, 207, 694, 208, 693, 209, 692, 210, 691, 211, 690, 212, 689, 213, 688, 214, 687, 215, 686, 216, 685, 217, 684, 218, 683, 219, 682, 220, 681, 221, 680, 222, 679, 223, 678, 224, 677, 225, 676, 675, 674, 673, 672, 671, 670, 669, 668, 667, 666, 665, 664, 663, 662, 661, 660, 659, 658, 657, 656, 655, 654, 653, 652, 651, 650, 649, 648, 647, 646, 645, 644, 643, 642, 641, 640, 639, 638, 637, 636, 635, 634, 633, 632, 631, 630, 629, 628, 627, 626, 625, 624, 623, 622, 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, 611, 610, 609, 608, 607, 606, 605, 604, 603, 602, 601, 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226]\n assert candidate(n = 75,k = 50) == [1, 75, 2, 74, 3, 73, 4, 72, 5, 71, 6, 70, 7, 69, 8, 68, 9, 67, 10, 66, 11, 65, 12, 64, 13, 63, 14, 62, 15, 61, 16, 60, 17, 59, 18, 58, 19, 57, 20, 56, 21, 55, 22, 54, 23, 53, 24, 52, 25, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26]\n assert candidate(n = 999,k = 499) == [1, 999, 2, 998, 3, 997, 4, 996, 5, 995, 6, 994, 7, 993, 8, 992, 9, 991, 10, 990, 11, 989, 12, 988, 13, 987, 14, 986, 15, 985, 16, 984, 17, 983, 18, 982, 19, 981, 20, 980, 21, 979, 22, 978, 23, 977, 24, 976, 25, 975, 26, 974, 27, 973, 28, 972, 29, 971, 30, 970, 31, 969, 32, 968, 33, 967, 34, 966, 35, 965, 36, 964, 37, 963, 38, 962, 39, 961, 40, 960, 41, 959, 42, 958, 43, 957, 44, 956, 45, 955, 46, 954, 47, 953, 48, 952, 49, 951, 50, 950, 51, 949, 52, 948, 53, 947, 54, 946, 55, 945, 56, 944, 57, 943, 58, 942, 59, 941, 60, 940, 61, 939, 62, 938, 63, 937, 64, 936, 65, 935, 66, 934, 67, 933, 68, 932, 69, 931, 70, 930, 71, 929, 72, 928, 73, 927, 74, 926, 75, 925, 76, 924, 77, 923, 78, 922, 79, 921, 80, 920, 81, 919, 82, 918, 83, 917, 84, 916, 85, 915, 86, 914, 87, 913, 88, 912, 89, 911, 90, 910, 91, 909, 92, 908, 93, 907, 94, 906, 95, 905, 96, 904, 97, 903, 98, 902, 99, 901, 100, 900, 101, 899, 102, 898, 103, 897, 104, 896, 105, 895, 106, 894, 107, 893, 108, 892, 109, 891, 110, 890, 111, 889, 112, 888, 113, 887, 114, 886, 115, 885, 116, 884, 117, 883, 118, 882, 119, 881, 120, 880, 121, 879, 122, 878, 123, 877, 124, 876, 125, 875, 126, 874, 127, 873, 128, 872, 129, 871, 130, 870, 131, 869, 132, 868, 133, 867, 134, 866, 135, 865, 136, 864, 137, 863, 138, 862, 139, 861, 140, 860, 141, 859, 142, 858, 143, 857, 144, 856, 145, 855, 146, 854, 147, 853, 148, 852, 149, 851, 150, 850, 151, 849, 152, 848, 153, 847, 154, 846, 155, 845, 156, 844, 157, 843, 158, 842, 159, 841, 160, 840, 161, 839, 162, 838, 163, 837, 164, 836, 165, 835, 166, 834, 167, 833, 168, 832, 169, 831, 170, 830, 171, 829, 172, 828, 173, 827, 174, 826, 175, 825, 176, 824, 177, 823, 178, 822, 179, 821, 180, 820, 181, 819, 182, 818, 183, 817, 184, 816, 185, 815, 186, 814, 187, 813, 188, 812, 189, 811, 190, 810, 191, 809, 192, 808, 193, 807, 194, 806, 195, 805, 196, 804, 197, 803, 198, 802, 199, 801, 200, 800, 201, 799, 202, 798, 203, 797, 204, 796, 205, 795, 206, 794, 207, 793, 208, 792, 209, 791, 210, 790, 211, 789, 212, 788, 213, 787, 214, 786, 215, 785, 216, 784, 217, 783, 218, 782, 219, 781, 220, 780, 221, 779, 222, 778, 223, 777, 224, 776, 225, 775, 226, 774, 227, 773, 228, 772, 229, 771, 230, 770, 231, 769, 232, 768, 233, 767, 234, 766, 235, 765, 236, 764, 237, 763, 238, 762, 239, 761, 240, 760, 241, 759, 242, 758, 243, 757, 244, 756, 245, 755, 246, 754, 247, 753, 248, 752, 249, 751, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750]\n assert candidate(n = 2000,k = 1000) == [1, 2000, 2, 1999, 3, 1998, 4, 1997, 5, 1996, 6, 1995, 7, 1994, 8, 1993, 9, 1992, 10, 1991, 11, 1990, 12, 1989, 13, 1988, 14, 1987, 15, 1986, 16, 1985, 17, 1984, 18, 1983, 19, 1982, 20, 1981, 21, 1980, 22, 1979, 23, 1978, 24, 1977, 25, 1976, 26, 1975, 27, 1974, 28, 1973, 29, 1972, 30, 1971, 31, 1970, 32, 1969, 33, 1968, 34, 1967, 35, 1966, 36, 1965, 37, 1964, 38, 1963, 39, 1962, 40, 1961, 41, 1960, 42, 1959, 43, 1958, 44, 1957, 45, 1956, 46, 1955, 47, 1954, 48, 1953, 49, 1952, 50, 1951, 51, 1950, 52, 1949, 53, 1948, 54, 1947, 55, 1946, 56, 1945, 57, 1944, 58, 1943, 59, 1942, 60, 1941, 61, 1940, 62, 1939, 63, 1938, 64, 1937, 65, 1936, 66, 1935, 67, 1934, 68, 1933, 69, 1932, 70, 1931, 71, 1930, 72, 1929, 73, 1928, 74, 1927, 75, 1926, 76, 1925, 77, 1924, 78, 1923, 79, 1922, 80, 1921, 81, 1920, 82, 1919, 83, 1918, 84, 1917, 85, 1916, 86, 1915, 87, 1914, 88, 1913, 89, 1912, 90, 1911, 91, 1910, 92, 1909, 93, 1908, 94, 1907, 95, 1906, 96, 1905, 97, 1904, 98, 1903, 99, 1902, 100, 1901, 101, 1900, 102, 1899, 103, 1898, 104, 1897, 105, 1896, 106, 1895, 107, 1894, 108, 1893, 109, 1892, 110, 1891, 111, 1890, 112, 1889, 113, 1888, 114, 1887, 115, 1886, 116, 1885, 117, 1884, 118, 1883, 119, 1882, 120, 1881, 121, 1880, 122, 1879, 123, 1878, 124, 1877, 125, 1876, 126, 1875, 127, 1874, 128, 1873, 129, 1872, 130, 1871, 131, 1870, 132, 1869, 133, 1868, 134, 1867, 135, 1866, 136, 1865, 137, 1864, 138, 1863, 139, 1862, 140, 1861, 141, 1860, 142, 1859, 143, 1858, 144, 1857, 145, 1856, 146, 1855, 147, 1854, 148, 1853, 149, 1852, 150, 1851, 151, 1850, 152, 1849, 153, 1848, 154, 1847, 155, 1846, 156, 1845, 157, 1844, 158, 1843, 159, 1842, 160, 1841, 161, 1840, 162, 1839, 163, 1838, 164, 1837, 165, 1836, 166, 1835, 167, 1834, 168, 1833, 169, 1832, 170, 1831, 171, 1830, 172, 1829, 173, 1828, 174, 1827, 175, 1826, 176, 1825, 177, 1824, 178, 1823, 179, 1822, 180, 1821, 181, 1820, 182, 1819, 183, 1818, 184, 1817, 185, 1816, 186, 1815, 187, 1814, 188, 1813, 189, 1812, 190, 1811, 191, 1810, 192, 1809, 193, 1808, 194, 1807, 195, 1806, 196, 1805, 197, 1804, 198, 1803, 199, 1802, 200, 1801, 201, 1800, 202, 1799, 203, 1798, 204, 1797, 205, 1796, 206, 1795, 207, 1794, 208, 1793, 209, 1792, 210, 1791, 211, 1790, 212, 1789, 213, 1788, 214, 1787, 215, 1786, 216, 1785, 217, 1784, 218, 1783, 219, 1782, 220, 1781, 221, 1780, 222, 1779, 223, 1778, 224, 1777, 225, 1776, 226, 1775, 227, 1774, 228, 1773, 229, 1772, 230, 1771, 231, 1770, 232, 1769, 233, 1768, 234, 1767, 235, 1766, 236, 1765, 237, 1764, 238, 1763, 239, 1762, 240, 1761, 241, 1760, 242, 1759, 243, 1758, 244, 1757, 245, 1756, 246, 1755, 247, 1754, 248, 1753, 249, 1752, 250, 1751, 251, 1750, 252, 1749, 253, 1748, 254, 1747, 255, 1746, 256, 1745, 257, 1744, 258, 1743, 259, 1742, 260, 1741, 261, 1740, 262, 1739, 263, 1738, 264, 1737, 265, 1736, 266, 1735, 267, 1734, 268, 1733, 269, 1732, 270, 1731, 271, 1730, 272, 1729, 273, 1728, 274, 1727, 275, 1726, 276, 1725, 277, 1724, 278, 1723, 279, 1722, 280, 1721, 281, 1720, 282, 1719, 283, 1718, 284, 1717, 285, 1716, 286, 1715, 287, 1714, 288, 1713, 289, 1712, 290, 1711, 291, 1710, 292, 1709, 293, 1708, 294, 1707, 295, 1706, 296, 1705, 297, 1704, 298, 1703, 299, 1702, 300, 1701, 301, 1700, 302, 1699, 303, 1698, 304, 1697, 305, 1696, 306, 1695, 307, 1694, 308, 1693, 309, 1692, 310, 1691, 311, 1690, 312, 1689, 313, 1688, 314, 1687, 315, 1686, 316, 1685, 317, 1684, 318, 1683, 319, 1682, 320, 1681, 321, 1680, 322, 1679, 323, 1678, 324, 1677, 325, 1676, 326, 1675, 327, 1674, 328, 1673, 329, 1672, 330, 1671, 331, 1670, 332, 1669, 333, 1668, 334, 1667, 335, 1666, 336, 1665, 337, 1664, 338, 1663, 339, 1662, 340, 1661, 341, 1660, 342, 1659, 343, 1658, 344, 1657, 345, 1656, 346, 1655, 347, 1654, 348, 1653, 349, 1652, 350, 1651, 351, 1650, 352, 1649, 353, 1648, 354, 1647, 355, 1646, 356, 1645, 357, 1644, 358, 1643, 359, 1642, 360, 1641, 361, 1640, 362, 1639, 363, 1638, 364, 1637, 365, 1636, 366, 1635, 367, 1634, 368, 1633, 369, 1632, 370, 1631, 371, 1630, 372, 1629, 373, 1628, 374, 1627, 375, 1626, 376, 1625, 377, 1624, 378, 1623, 379, 1622, 380, 1621, 381, 1620, 382, 1619, 383, 1618, 384, 1617, 385, 1616, 386, 1615, 387, 1614, 388, 1613, 389, 1612, 390, 1611, 391, 1610, 392, 1609, 393, 1608, 394, 1607, 395, 1606, 396, 1605, 397, 1604, 398, 1603, 399, 1602, 400, 1601, 401, 1600, 402, 1599, 403, 1598, 404, 1597, 405, 1596, 406, 1595, 407, 1594, 408, 1593, 409, 1592, 410, 1591, 411, 1590, 412, 1589, 413, 1588, 414, 1587, 415, 1586, 416, 1585, 417, 1584, 418, 1583, 419, 1582, 420, 1581, 421, 1580, 422, 1579, 423, 1578, 424, 1577, 425, 1576, 426, 1575, 427, 1574, 428, 1573, 429, 1572, 430, 1571, 431, 1570, 432, 1569, 433, 1568, 434, 1567, 435, 1566, 436, 1565, 437, 1564, 438, 1563, 439, 1562, 440, 1561, 441, 1560, 442, 1559, 443, 1558, 444, 1557, 445, 1556, 446, 1555, 447, 1554, 448, 1553, 449, 1552, 450, 1551, 451, 1550, 452, 1549, 453, 1548, 454, 1547, 455, 1546, 456, 1545, 457, 1544, 458, 1543, 459, 1542, 460, 1541, 461, 1540, 462, 1539, 463, 1538, 464, 1537, 465, 1536, 466, 1535, 467, 1534, 468, 1533, 469, 1532, 470, 1531, 471, 1530, 472, 1529, 473, 1528, 474, 1527, 475, 1526, 476, 1525, 477, 1524, 478, 1523, 479, 1522, 480, 1521, 481, 1520, 482, 1519, 483, 1518, 484, 1517, 485, 1516, 486, 1515, 487, 1514, 488, 1513, 489, 1512, 490, 1511, 491, 1510, 492, 1509, 493, 1508, 494, 1507, 495, 1506, 496, 1505, 497, 1504, 498, 1503, 499, 1502, 500, 1501, 1500, 1499, 1498, 1497, 1496, 1495, 1494, 1493, 1492, 1491, 1490, 1489, 1488, 1487, 1486, 1485, 1484, 1483, 1482, 1481, 1480, 1479, 1478, 1477, 1476, 1475, 1474, 1473, 1472, 1471, 1470, 1469, 1468, 1467, 1466, 1465, 1464, 1463, 1462, 1461, 1460, 1459, 1458, 1457, 1456, 1455, 1454, 1453, 1452, 1451, 1450, 1449, 1448, 1447, 1446, 1445, 1444, 1443, 1442, 1441, 1440, 1439, 1438, 1437, 1436, 1435, 1434, 1433, 1432, 1431, 1430, 1429, 1428, 1427, 1426, 1425, 1424, 1423, 1422, 1421, 1420, 1419, 1418, 1417, 1416, 1415, 1414, 1413, 1412, 1411, 1410, 1409, 1408, 1407, 1406, 1405, 1404, 1403, 1402, 1401, 1400, 1399, 1398, 1397, 1396, 1395, 1394, 1393, 1392, 1391, 1390, 1389, 1388, 1387, 1386, 1385, 1384, 1383, 1382, 1381, 1380, 1379, 1378, 1377, 1376, 1375, 1374, 1373, 1372, 1371, 1370, 1369, 1368, 1367, 1366, 1365, 1364, 1363, 1362, 1361, 1360, 1359, 1358, 1357, 1356, 1355, 1354, 1353, 1352, 1351, 1350, 1349, 1348, 1347, 1346, 1345, 1344, 1343, 1342, 1341, 1340, 1339, 1338, 1337, 1336, 1335, 1334, 1333, 1332, 1331, 1330, 1329, 1328, 1327, 1326, 1325, 1324, 1323, 1322, 1321, 1320, 1319, 1318, 1317, 1316, 1315, 1314, 1313, 1312, 1311, 1310, 1309, 1308, 1307, 1306, 1305, 1304, 1303, 1302, 1301, 1300, 1299, 1298, 1297, 1296, 1295, 1294, 1293, 1292, 1291, 1290, 1289, 1288, 1287, 1286, 1285, 1284, 1283, 1282, 1281, 1280, 1279, 1278, 1277, 1276, 1275, 1274, 1273, 1272, 1271, 1270, 1269, 1268, 1267, 1266, 1265, 1264, 1263, 1262, 1261, 1260, 1259, 1258, 1257, 1256, 1255, 1254, 1253, 1252, 1251, 1250, 1249, 1248, 1247, 1246, 1245, 1244, 1243, 1242, 1241, 1240, 1239, 1238, 1237, 1236, 1235, 1234, 1233, 1232, 1231, 1230, 1229, 1228, 1227, 1226, 1225, 1224, 1223, 1222, 1221, 1220, 1219, 1218, 1217, 1216, 1215, 1214, 1213, 1212, 1211, 1210, 1209, 1208, 1207, 1206, 1205, 1204, 1203, 1202, 1201, 1200, 1199, 1198, 1197, 1196, 1195, 1194, 1193, 1192, 1191, 1190, 1189, 1188, 1187, 1186, 1185, 1184, 1183, 1182, 1181, 1180, 1179, 1178, 1177, 1176, 1175, 1174, 1173, 1172, 1171, 1170, 1169, 1168, 1167, 1166, 1165, 1164, 1163, 1162, 1161, 1160, 1159, 1158, 1157, 1156, 1155, 1154, 1153, 1152, 1151, 1150, 1149, 1148, 1147, 1146, 1145, 1144, 1143, 1142, 1141, 1140, 1139, 1138, 1137, 1136, 1135, 1134, 1133, 1132, 1131, 1130, 1129, 1128, 1127, 1126, 1125, 1124, 1123, 1122, 1121, 1120, 1119, 1118, 1117, 1116, 1115, 1114, 1113, 1112, 1111, 1110, 1109, 1108, 1107, 1106, 1105, 1104, 1103, 1102, 1101, 1100, 1099, 1098, 1097, 1096, 1095, 1094, 1093, 1092, 1091, 1090, 1089, 1088, 1087, 1086, 1085, 1084, 1083, 1082, 1081, 1080, 1079, 1078, 1077, 1076, 1075, 1074, 1073, 1072, 1071, 1070, 1069, 1068, 1067, 1066, 1065, 1064, 1063, 1062, 1061, 1060, 1059, 1058, 1057, 1056, 1055, 1054, 1053, 1052, 1051, 1050, 1049, 1048, 1047, 1046, 1045, 1044, 1043, 1042, 1041, 1040, 1039, 1038, 1037, 1036, 1035, 1034, 1033, 1032, 1031, 1030, 1029, 1028, 1027, 1026, 1025, 1024, 1023, 1022, 1021, 1020, 1019, 1018, 1017, 1016, 1015, 1014, 1013, 1012, 1011, 1010, 1009, 1008, 1007, 1006, 1005, 1004, 1003, 1002, 1001, 1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970, 969, 968, 967, 966, 965, 964, 963, 962, 961, 960, 959, 958, 957, 956, 955, 954, 953, 952, 951, 950, 949, 948, 947, 946, 945, 944, 943, 942, 941, 940, 939, 938, 937, 936, 935, 934, 933, 932, 931, 930, 929, 928, 927, 926, 925, 924, 923, 922, 921, 920, 919, 918, 917, 916, 915, 914, 913, 912, 911, 910, 909, 908, 907, 906, 905, 904, 903, 902, 901, 900, 899, 898, 897, 896, 895, 894, 893, 892, 891, 890, 889, 888, 887, 886, 885, 884, 883, 882, 881, 880, 879, 878, 877, 876, 875, 874, 873, 872, 871, 870, 869, 868, 867, 866, 865, 864, 863, 862, 861, 860, 859, 858, 857, 856, 855, 854, 853, 852, 851, 850, 849, 848, 847, 846, 845, 844, 843, 842, 841, 840, 839, 838, 837, 836, 835, 834, 833, 832, 831, 830, 829, 828, 827, 826, 825, 824, 823, 822, 821, 820, 819, 818, 817, 816, 815, 814, 813, 812, 811, 810, 809, 808, 807, 806, 805, 804, 803, 802, 801, 800, 799, 798, 797, 796, 795, 794, 793, 792, 791, 790, 789, 788, 787, 786, 785, 784, 783, 782, 781, 780, 779, 778, 777, 776, 775, 774, 773, 772, 771, 770, 769, 768, 767, 766, 765, 764, 763, 762, 761, 760, 759, 758, 757, 756, 755, 754, 753, 752, 751, 750, 749, 748, 747, 746, 745, 744, 743, 742, 741, 740, 739, 738, 737, 736, 735, 734, 733, 732, 731, 730, 729, 728, 727, 726, 725, 724, 723, 722, 721, 720, 719, 718, 717, 716, 715, 714, 713, 712, 711, 710, 709, 708, 707, 706, 705, 704, 703, 702, 701, 700, 699, 698, 697, 696, 695, 694, 693, 692, 691, 690, 689, 688, 687, 686, 685, 684, 683, 682, 681, 680, 679, 678, 677, 676, 675, 674, 673, 672, 671, 670, 669, 668, 667, 666, 665, 664, 663, 662, 661, 660, 659, 658, 657, 656, 655, 654, 653, 652, 651, 650, 649, 648, 647, 646, 645, 644, 643, 642, 641, 640, 639, 638, 637, 636, 635, 634, 633, 632, 631, 630, 629, 628, 627, 626, 625, 624, 623, 622, 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, 611, 610, 609, 608, 607, 606, 605, 604, 603, 602, 601, 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501]\n assert candidate(n = 8,k = 3) == [1, 8, 2, 3, 4, 5, 6, 7]\n assert candidate(n = 8,k = 4) == [1, 8, 2, 7, 6, 5, 4, 3]\n assert candidate(n = 15,k = 10) == [1, 15, 2, 14, 3, 13, 4, 12, 5, 11, 10, 9, 8, 7, 6]\n assert candidate(n = 150,k = 75) == [1, 150, 2, 149, 3, 148, 4, 147, 5, 146, 6, 145, 7, 144, 8, 143, 9, 142, 10, 141, 11, 140, 12, 139, 13, 138, 14, 137, 15, 136, 16, 135, 17, 134, 18, 133, 19, 132, 20, 131, 21, 130, 22, 129, 23, 128, 24, 127, 25, 126, 26, 125, 27, 124, 28, 123, 29, 122, 30, 121, 31, 120, 32, 119, 33, 118, 34, 117, 35, 116, 36, 115, 37, 114, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113]\n assert candidate(n = 18,k = 9) == [1, 18, 2, 17, 3, 16, 4, 15, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n assert candidate(n = 300,k = 199) == [1, 300, 2, 299, 3, 298, 4, 297, 5, 296, 6, 295, 7, 294, 8, 293, 9, 292, 10, 291, 11, 290, 12, 289, 13, 288, 14, 287, 15, 286, 16, 285, 17, 284, 18, 283, 19, 282, 20, 281, 21, 280, 22, 279, 23, 278, 24, 277, 25, 276, 26, 275, 27, 274, 28, 273, 29, 272, 30, 271, 31, 270, 32, 269, 33, 268, 34, 267, 35, 266, 36, 265, 37, 264, 38, 263, 39, 262, 40, 261, 41, 260, 42, 259, 43, 258, 44, 257, 45, 256, 46, 255, 47, 254, 48, 253, 49, 252, 50, 251, 51, 250, 52, 249, 53, 248, 54, 247, 55, 246, 56, 245, 57, 244, 58, 243, 59, 242, 60, 241, 61, 240, 62, 239, 63, 238, 64, 237, 65, 236, 66, 235, 67, 234, 68, 233, 69, 232, 70, 231, 71, 230, 72, 229, 73, 228, 74, 227, 75, 226, 76, 225, 77, 224, 78, 223, 79, 222, 80, 221, 81, 220, 82, 219, 83, 218, 84, 217, 85, 216, 86, 215, 87, 214, 88, 213, 89, 212, 90, 211, 91, 210, 92, 209, 93, 208, 94, 207, 95, 206, 96, 205, 97, 204, 98, 203, 99, 202, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201]\n assert candidate(n = 75,k = 60) == [1, 75, 2, 74, 3, 73, 4, 72, 5, 71, 6, 70, 7, 69, 8, 68, 9, 67, 10, 66, 11, 65, 12, 64, 13, 63, 14, 62, 15, 61, 16, 60, 17, 59, 18, 58, 19, 57, 20, 56, 21, 55, 22, 54, 23, 53, 24, 52, 25, 51, 26, 50, 27, 49, 28, 48, 29, 47, 30, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31]\n assert candidate(n = 2000,k = 1999) == [1, 2000, 2, 1999, 3, 1998, 4, 1997, 5, 1996, 6, 1995, 7, 1994, 8, 1993, 9, 1992, 10, 1991, 11, 1990, 12, 1989, 13, 1988, 14, 1987, 15, 1986, 16, 1985, 17, 1984, 18, 1983, 19, 1982, 20, 1981, 21, 1980, 22, 1979, 23, 1978, 24, 1977, 25, 1976, 26, 1975, 27, 1974, 28, 1973, 29, 1972, 30, 1971, 31, 1970, 32, 1969, 33, 1968, 34, 1967, 35, 1966, 36, 1965, 37, 1964, 38, 1963, 39, 1962, 40, 1961, 41, 1960, 42, 1959, 43, 1958, 44, 1957, 45, 1956, 46, 1955, 47, 1954, 48, 1953, 49, 1952, 50, 1951, 51, 1950, 52, 1949, 53, 1948, 54, 1947, 55, 1946, 56, 1945, 57, 1944, 58, 1943, 59, 1942, 60, 1941, 61, 1940, 62, 1939, 63, 1938, 64, 1937, 65, 1936, 66, 1935, 67, 1934, 68, 1933, 69, 1932, 70, 1931, 71, 1930, 72, 1929, 73, 1928, 74, 1927, 75, 1926, 76, 1925, 77, 1924, 78, 1923, 79, 1922, 80, 1921, 81, 1920, 82, 1919, 83, 1918, 84, 1917, 85, 1916, 86, 1915, 87, 1914, 88, 1913, 89, 1912, 90, 1911, 91, 1910, 92, 1909, 93, 1908, 94, 1907, 95, 1906, 96, 1905, 97, 1904, 98, 1903, 99, 1902, 100, 1901, 101, 1900, 102, 1899, 103, 1898, 104, 1897, 105, 1896, 106, 1895, 107, 1894, 108, 1893, 109, 1892, 110, 1891, 111, 1890, 112, 1889, 113, 1888, 114, 1887, 115, 1886, 116, 1885, 117, 1884, 118, 1883, 119, 1882, 120, 1881, 121, 1880, 122, 1879, 123, 1878, 124, 1877, 125, 1876, 126, 1875, 127, 1874, 128, 1873, 129, 1872, 130, 1871, 131, 1870, 132, 1869, 133, 1868, 134, 1867, 135, 1866, 136, 1865, 137, 1864, 138, 1863, 139, 1862, 140, 1861, 141, 1860, 142, 1859, 143, 1858, 144, 1857, 145, 1856, 146, 1855, 147, 1854, 148, 1853, 149, 1852, 150, 1851, 151, 1850, 152, 1849, 153, 1848, 154, 1847, 155, 1846, 156, 1845, 157, 1844, 158, 1843, 159, 1842, 160, 1841, 161, 1840, 162, 1839, 163, 1838, 164, 1837, 165, 1836, 166, 1835, 167, 1834, 168, 1833, 169, 1832, 170, 1831, 171, 1830, 172, 1829, 173, 1828, 174, 1827, 175, 1826, 176, 1825, 177, 1824, 178, 1823, 179, 1822, 180, 1821, 181, 1820, 182, 1819, 183, 1818, 184, 1817, 185, 1816, 186, 1815, 187, 1814, 188, 1813, 189, 1812, 190, 1811, 191, 1810, 192, 1809, 193, 1808, 194, 1807, 195, 1806, 196, 1805, 197, 1804, 198, 1803, 199, 1802, 200, 1801, 201, 1800, 202, 1799, 203, 1798, 204, 1797, 205, 1796, 206, 1795, 207, 1794, 208, 1793, 209, 1792, 210, 1791, 211, 1790, 212, 1789, 213, 1788, 214, 1787, 215, 1786, 216, 1785, 217, 1784, 218, 1783, 219, 1782, 220, 1781, 221, 1780, 222, 1779, 223, 1778, 224, 1777, 225, 1776, 226, 1775, 227, 1774, 228, 1773, 229, 1772, 230, 1771, 231, 1770, 232, 1769, 233, 1768, 234, 1767, 235, 1766, 236, 1765, 237, 1764, 238, 1763, 239, 1762, 240, 1761, 241, 1760, 242, 1759, 243, 1758, 244, 1757, 245, 1756, 246, 1755, 247, 1754, 248, 1753, 249, 1752, 250, 1751, 251, 1750, 252, 1749, 253, 1748, 254, 1747, 255, 1746, 256, 1745, 257, 1744, 258, 1743, 259, 1742, 260, 1741, 261, 1740, 262, 1739, 263, 1738, 264, 1737, 265, 1736, 266, 1735, 267, 1734, 268, 1733, 269, 1732, 270, 1731, 271, 1730, 272, 1729, 273, 1728, 274, 1727, 275, 1726, 276, 1725, 277, 1724, 278, 1723, 279, 1722, 280, 1721, 281, 1720, 282, 1719, 283, 1718, 284, 1717, 285, 1716, 286, 1715, 287, 1714, 288, 1713, 289, 1712, 290, 1711, 291, 1710, 292, 1709, 293, 1708, 294, 1707, 295, 1706, 296, 1705, 297, 1704, 298, 1703, 299, 1702, 300, 1701, 301, 1700, 302, 1699, 303, 1698, 304, 1697, 305, 1696, 306, 1695, 307, 1694, 308, 1693, 309, 1692, 310, 1691, 311, 1690, 312, 1689, 313, 1688, 314, 1687, 315, 1686, 316, 1685, 317, 1684, 318, 1683, 319, 1682, 320, 1681, 321, 1680, 322, 1679, 323, 1678, 324, 1677, 325, 1676, 326, 1675, 327, 1674, 328, 1673, 329, 1672, 330, 1671, 331, 1670, 332, 1669, 333, 1668, 334, 1667, 335, 1666, 336, 1665, 337, 1664, 338, 1663, 339, 1662, 340, 1661, 341, 1660, 342, 1659, 343, 1658, 344, 1657, 345, 1656, 346, 1655, 347, 1654, 348, 1653, 349, 1652, 350, 1651, 351, 1650, 352, 1649, 353, 1648, 354, 1647, 355, 1646, 356, 1645, 357, 1644, 358, 1643, 359, 1642, 360, 1641, 361, 1640, 362, 1639, 363, 1638, 364, 1637, 365, 1636, 366, 1635, 367, 1634, 368, 1633, 369, 1632, 370, 1631, 371, 1630, 372, 1629, 373, 1628, 374, 1627, 375, 1626, 376, 1625, 377, 1624, 378, 1623, 379, 1622, 380, 1621, 381, 1620, 382, 1619, 383, 1618, 384, 1617, 385, 1616, 386, 1615, 387, 1614, 388, 1613, 389, 1612, 390, 1611, 391, 1610, 392, 1609, 393, 1608, 394, 1607, 395, 1606, 396, 1605, 397, 1604, 398, 1603, 399, 1602, 400, 1601, 401, 1600, 402, 1599, 403, 1598, 404, 1597, 405, 1596, 406, 1595, 407, 1594, 408, 1593, 409, 1592, 410, 1591, 411, 1590, 412, 1589, 413, 1588, 414, 1587, 415, 1586, 416, 1585, 417, 1584, 418, 1583, 419, 1582, 420, 1581, 421, 1580, 422, 1579, 423, 1578, 424, 1577, 425, 1576, 426, 1575, 427, 1574, 428, 1573, 429, 1572, 430, 1571, 431, 1570, 432, 1569, 433, 1568, 434, 1567, 435, 1566, 436, 1565, 437, 1564, 438, 1563, 439, 1562, 440, 1561, 441, 1560, 442, 1559, 443, 1558, 444, 1557, 445, 1556, 446, 1555, 447, 1554, 448, 1553, 449, 1552, 450, 1551, 451, 1550, 452, 1549, 453, 1548, 454, 1547, 455, 1546, 456, 1545, 457, 1544, 458, 1543, 459, 1542, 460, 1541, 461, 1540, 462, 1539, 463, 1538, 464, 1537, 465, 1536, 466, 1535, 467, 1534, 468, 1533, 469, 1532, 470, 1531, 471, 1530, 472, 1529, 473, 1528, 474, 1527, 475, 1526, 476, 1525, 477, 1524, 478, 1523, 479, 1522, 480, 1521, 481, 1520, 482, 1519, 483, 1518, 484, 1517, 485, 1516, 486, 1515, 487, 1514, 488, 1513, 489, 1512, 490, 1511, 491, 1510, 492, 1509, 493, 1508, 494, 1507, 495, 1506, 496, 1505, 497, 1504, 498, 1503, 499, 1502, 500, 1501, 501, 1500, 502, 1499, 503, 1498, 504, 1497, 505, 1496, 506, 1495, 507, 1494, 508, 1493, 509, 1492, 510, 1491, 511, 1490, 512, 1489, 513, 1488, 514, 1487, 515, 1486, 516, 1485, 517, 1484, 518, 1483, 519, 1482, 520, 1481, 521, 1480, 522, 1479, 523, 1478, 524, 1477, 525, 1476, 526, 1475, 527, 1474, 528, 1473, 529, 1472, 530, 1471, 531, 1470, 532, 1469, 533, 1468, 534, 1467, 535, 1466, 536, 1465, 537, 1464, 538, 1463, 539, 1462, 540, 1461, 541, 1460, 542, 1459, 543, 1458, 544, 1457, 545, 1456, 546, 1455, 547, 1454, 548, 1453, 549, 1452, 550, 1451, 551, 1450, 552, 1449, 553, 1448, 554, 1447, 555, 1446, 556, 1445, 557, 1444, 558, 1443, 559, 1442, 560, 1441, 561, 1440, 562, 1439, 563, 1438, 564, 1437, 565, 1436, 566, 1435, 567, 1434, 568, 1433, 569, 1432, 570, 1431, 571, 1430, 572, 1429, 573, 1428, 574, 1427, 575, 1426, 576, 1425, 577, 1424, 578, 1423, 579, 1422, 580, 1421, 581, 1420, 582, 1419, 583, 1418, 584, 1417, 585, 1416, 586, 1415, 587, 1414, 588, 1413, 589, 1412, 590, 1411, 591, 1410, 592, 1409, 593, 1408, 594, 1407, 595, 1406, 596, 1405, 597, 1404, 598, 1403, 599, 1402, 600, 1401, 601, 1400, 602, 1399, 603, 1398, 604, 1397, 605, 1396, 606, 1395, 607, 1394, 608, 1393, 609, 1392, 610, 1391, 611, 1390, 612, 1389, 613, 1388, 614, 1387, 615, 1386, 616, 1385, 617, 1384, 618, 1383, 619, 1382, 620, 1381, 621, 1380, 622, 1379, 623, 1378, 624, 1377, 625, 1376, 626, 1375, 627, 1374, 628, 1373, 629, 1372, 630, 1371, 631, 1370, 632, 1369, 633, 1368, 634, 1367, 635, 1366, 636, 1365, 637, 1364, 638, 1363, 639, 1362, 640, 1361, 641, 1360, 642, 1359, 643, 1358, 644, 1357, 645, 1356, 646, 1355, 647, 1354, 648, 1353, 649, 1352, 650, 1351, 651, 1350, 652, 1349, 653, 1348, 654, 1347, 655, 1346, 656, 1345, 657, 1344, 658, 1343, 659, 1342, 660, 1341, 661, 1340, 662, 1339, 663, 1338, 664, 1337, 665, 1336, 666, 1335, 667, 1334, 668, 1333, 669, 1332, 670, 1331, 671, 1330, 672, 1329, 673, 1328, 674, 1327, 675, 1326, 676, 1325, 677, 1324, 678, 1323, 679, 1322, 680, 1321, 681, 1320, 682, 1319, 683, 1318, 684, 1317, 685, 1316, 686, 1315, 687, 1314, 688, 1313, 689, 1312, 690, 1311, 691, 1310, 692, 1309, 693, 1308, 694, 1307, 695, 1306, 696, 1305, 697, 1304, 698, 1303, 699, 1302, 700, 1301, 701, 1300, 702, 1299, 703, 1298, 704, 1297, 705, 1296, 706, 1295, 707, 1294, 708, 1293, 709, 1292, 710, 1291, 711, 1290, 712, 1289, 713, 1288, 714, 1287, 715, 1286, 716, 1285, 717, 1284, 718, 1283, 719, 1282, 720, 1281, 721, 1280, 722, 1279, 723, 1278, 724, 1277, 725, 1276, 726, 1275, 727, 1274, 728, 1273, 729, 1272, 730, 1271, 731, 1270, 732, 1269, 733, 1268, 734, 1267, 735, 1266, 736, 1265, 737, 1264, 738, 1263, 739, 1262, 740, 1261, 741, 1260, 742, 1259, 743, 1258, 744, 1257, 745, 1256, 746, 1255, 747, 1254, 748, 1253, 749, 1252, 750, 1251, 751, 1250, 752, 1249, 753, 1248, 754, 1247, 755, 1246, 756, 1245, 757, 1244, 758, 1243, 759, 1242, 760, 1241, 761, 1240, 762, 1239, 763, 1238, 764, 1237, 765, 1236, 766, 1235, 767, 1234, 768, 1233, 769, 1232, 770, 1231, 771, 1230, 772, 1229, 773, 1228, 774, 1227, 775, 1226, 776, 1225, 777, 1224, 778, 1223, 779, 1222, 780, 1221, 781, 1220, 782, 1219, 783, 1218, 784, 1217, 785, 1216, 786, 1215, 787, 1214, 788, 1213, 789, 1212, 790, 1211, 791, 1210, 792, 1209, 793, 1208, 794, 1207, 795, 1206, 796, 1205, 797, 1204, 798, 1203, 799, 1202, 800, 1201, 801, 1200, 802, 1199, 803, 1198, 804, 1197, 805, 1196, 806, 1195, 807, 1194, 808, 1193, 809, 1192, 810, 1191, 811, 1190, 812, 1189, 813, 1188, 814, 1187, 815, 1186, 816, 1185, 817, 1184, 818, 1183, 819, 1182, 820, 1181, 821, 1180, 822, 1179, 823, 1178, 824, 1177, 825, 1176, 826, 1175, 827, 1174, 828, 1173, 829, 1172, 830, 1171, 831, 1170, 832, 1169, 833, 1168, 834, 1167, 835, 1166, 836, 1165, 837, 1164, 838, 1163, 839, 1162, 840, 1161, 841, 1160, 842, 1159, 843, 1158, 844, 1157, 845, 1156, 846, 1155, 847, 1154, 848, 1153, 849, 1152, 850, 1151, 851, 1150, 852, 1149, 853, 1148, 854, 1147, 855, 1146, 856, 1145, 857, 1144, 858, 1143, 859, 1142, 860, 1141, 861, 1140, 862, 1139, 863, 1138, 864, 1137, 865, 1136, 866, 1135, 867, 1134, 868, 1133, 869, 1132, 870, 1131, 871, 1130, 872, 1129, 873, 1128, 874, 1127, 875, 1126, 876, 1125, 877, 1124, 878, 1123, 879, 1122, 880, 1121, 881, 1120, 882, 1119, 883, 1118, 884, 1117, 885, 1116, 886, 1115, 887, 1114, 888, 1113, 889, 1112, 890, 1111, 891, 1110, 892, 1109, 893, 1108, 894, 1107, 895, 1106, 896, 1105, 897, 1104, 898, 1103, 899, 1102, 900, 1101, 901, 1100, 902, 1099, 903, 1098, 904, 1097, 905, 1096, 906, 1095, 907, 1094, 908, 1093, 909, 1092, 910, 1091, 911, 1090, 912, 1089, 913, 1088, 914, 1087, 915, 1086, 916, 1085, 917, 1084, 918, 1083, 919, 1082, 920, 1081, 921, 1080, 922, 1079, 923, 1078, 924, 1077, 925, 1076, 926, 1075, 927, 1074, 928, 1073, 929, 1072, 930, 1071, 931, 1070, 932, 1069, 933, 1068, 934, 1067, 935, 1066, 936, 1065, 937, 1064, 938, 1063, 939, 1062, 940, 1061, 941, 1060, 942, 1059, 943, 1058, 944, 1057, 945, 1056, 946, 1055, 947, 1054, 948, 1053, 949, 1052, 950, 1051, 951, 1050, 952, 1049, 953, 1048, 954, 1047, 955, 1046, 956, 1045, 957, 1044, 958, 1043, 959, 1042, 960, 1041, 961, 1040, 962, 1039, 963, 1038, 964, 1037, 965, 1036, 966, 1035, 967, 1034, 968, 1033, 969, 1032, 970, 1031, 971, 1030, 972, 1029, 973, 1028, 974, 1027, 975, 1026, 976, 1025, 977, 1024, 978, 1023, 979, 1022, 980, 1021, 981, 1020, 982, 1019, 983, 1018, 984, 1017, 985, 1016, 986, 1015, 987, 1014, 988, 1013, 989, 1012, 990, 1011, 991, 1010, 992, 1009, 993, 1008, 994, 1007, 995, 1006, 996, 1005, 997, 1004, 998, 1003, 999, 1002, 1000, 1001]\n assert candidate(n = 20,k = 15) == [1, 20, 2, 19, 3, 18, 4, 17, 5, 16, 6, 15, 7, 14, 8, 9, 10, 11, 12, 13]\n assert candidate(n = 7,k = 5) == [1, 7, 2, 6, 3, 4, 5]\n assert candidate(n = 50,k = 30) == [1, 50, 2, 49, 3, 48, 4, 47, 5, 46, 6, 45, 7, 44, 8, 43, 9, 42, 10, 41, 11, 40, 12, 39, 13, 38, 14, 37, 15, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16]\n assert candidate(n = 60,k = 15) == [1, 60, 2, 59, 3, 58, 4, 57, 5, 56, 6, 55, 7, 54, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53]\n assert candidate(n = 3000,k = 1500) == [1, 3000, 2, 2999, 3, 2998, 4, 2997, 5, 2996, 6, 2995, 7, 2994, 8, 2993, 9, 2992, 10, 2991, 11, 2990, 12, 2989, 13, 2988, 14, 2987, 15, 2986, 16, 2985, 17, 2984, 18, 2983, 19, 2982, 20, 2981, 21, 2980, 22, 2979, 23, 2978, 24, 2977, 25, 2976, 26, 2975, 27, 2974, 28, 2973, 29, 2972, 30, 2971, 31, 2970, 32, 2969, 33, 2968, 34, 2967, 35, 2966, 36, 2965, 37, 2964, 38, 2963, 39, 2962, 40, 2961, 41, 2960, 42, 2959, 43, 2958, 44, 2957, 45, 2956, 46, 2955, 47, 2954, 48, 2953, 49, 2952, 50, 2951, 51, 2950, 52, 2949, 53, 2948, 54, 2947, 55, 2946, 56, 2945, 57, 2944, 58, 2943, 59, 2942, 60, 2941, 61, 2940, 62, 2939, 63, 2938, 64, 2937, 65, 2936, 66, 2935, 67, 2934, 68, 2933, 69, 2932, 70, 2931, 71, 2930, 72, 2929, 73, 2928, 74, 2927, 75, 2926, 76, 2925, 77, 2924, 78, 2923, 79, 2922, 80, 2921, 81, 2920, 82, 2919, 83, 2918, 84, 2917, 85, 2916, 86, 2915, 87, 2914, 88, 2913, 89, 2912, 90, 2911, 91, 2910, 92, 2909, 93, 2908, 94, 2907, 95, 2906, 96, 2905, 97, 2904, 98, 2903, 99, 2902, 100, 2901, 101, 2900, 102, 2899, 103, 2898, 104, 2897, 105, 2896, 106, 2895, 107, 2894, 108, 2893, 109, 2892, 110, 2891, 111, 2890, 112, 2889, 113, 2888, 114, 2887, 115, 2886, 116, 2885, 117, 2884, 118, 2883, 119, 2882, 120, 2881, 121, 2880, 122, 2879, 123, 2878, 124, 2877, 125, 2876, 126, 2875, 127, 2874, 128, 2873, 129, 2872, 130, 2871, 131, 2870, 132, 2869, 133, 2868, 134, 2867, 135, 2866, 136, 2865, 137, 2864, 138, 2863, 139, 2862, 140, 2861, 141, 2860, 142, 2859, 143, 2858, 144, 2857, 145, 2856, 146, 2855, 147, 2854, 148, 2853, 149, 2852, 150, 2851, 151, 2850, 152, 2849, 153, 2848, 154, 2847, 155, 2846, 156, 2845, 157, 2844, 158, 2843, 159, 2842, 160, 2841, 161, 2840, 162, 2839, 163, 2838, 164, 2837, 165, 2836, 166, 2835, 167, 2834, 168, 2833, 169, 2832, 170, 2831, 171, 2830, 172, 2829, 173, 2828, 174, 2827, 175, 2826, 176, 2825, 177, 2824, 178, 2823, 179, 2822, 180, 2821, 181, 2820, 182, 2819, 183, 2818, 184, 2817, 185, 2816, 186, 2815, 187, 2814, 188, 2813, 189, 2812, 190, 2811, 191, 2810, 192, 2809, 193, 2808, 194, 2807, 195, 2806, 196, 2805, 197, 2804, 198, 2803, 199, 2802, 200, 2801, 201, 2800, 202, 2799, 203, 2798, 204, 2797, 205, 2796, 206, 2795, 207, 2794, 208, 2793, 209, 2792, 210, 2791, 211, 2790, 212, 2789, 213, 2788, 214, 2787, 215, 2786, 216, 2785, 217, 2784, 218, 2783, 219, 2782, 220, 2781, 221, 2780, 222, 2779, 223, 2778, 224, 2777, 225, 2776, 226, 2775, 227, 2774, 228, 2773, 229, 2772, 230, 2771, 231, 2770, 232, 2769, 233, 2768, 234, 2767, 235, 2766, 236, 2765, 237, 2764, 238, 2763, 239, 2762, 240, 2761, 241, 2760, 242, 2759, 243, 2758, 244, 2757, 245, 2756, 246, 2755, 247, 2754, 248, 2753, 249, 2752, 250, 2751, 251, 2750, 252, 2749, 253, 2748, 254, 2747, 255, 2746, 256, 2745, 257, 2744, 258, 2743, 259, 2742, 260, 2741, 261, 2740, 262, 2739, 263, 2738, 264, 2737, 265, 2736, 266, 2735, 267, 2734, 268, 2733, 269, 2732, 270, 2731, 271, 2730, 272, 2729, 273, 2728, 274, 2727, 275, 2726, 276, 2725, 277, 2724, 278, 2723, 279, 2722, 280, 2721, 281, 2720, 282, 2719, 283, 2718, 284, 2717, 285, 2716, 286, 2715, 287, 2714, 288, 2713, 289, 2712, 290, 2711, 291, 2710, 292, 2709, 293, 2708, 294, 2707, 295, 2706, 296, 2705, 297, 2704, 298, 2703, 299, 2702, 300, 2701, 301, 2700, 302, 2699, 303, 2698, 304, 2697, 305, 2696, 306, 2695, 307, 2694, 308, 2693, 309, 2692, 310, 2691, 311, 2690, 312, 2689, 313, 2688, 314, 2687, 315, 2686, 316, 2685, 317, 2684, 318, 2683, 319, 2682, 320, 2681, 321, 2680, 322, 2679, 323, 2678, 324, 2677, 325, 2676, 326, 2675, 327, 2674, 328, 2673, 329, 2672, 330, 2671, 331, 2670, 332, 2669, 333, 2668, 334, 2667, 335, 2666, 336, 2665, 337, 2664, 338, 2663, 339, 2662, 340, 2661, 341, 2660, 342, 2659, 343, 2658, 344, 2657, 345, 2656, 346, 2655, 347, 2654, 348, 2653, 349, 2652, 350, 2651, 351, 2650, 352, 2649, 353, 2648, 354, 2647, 355, 2646, 356, 2645, 357, 2644, 358, 2643, 359, 2642, 360, 2641, 361, 2640, 362, 2639, 363, 2638, 364, 2637, 365, 2636, 366, 2635, 367, 2634, 368, 2633, 369, 2632, 370, 2631, 371, 2630, 372, 2629, 373, 2628, 374, 2627, 375, 2626, 376, 2625, 377, 2624, 378, 2623, 379, 2622, 380, 2621, 381, 2620, 382, 2619, 383, 2618, 384, 2617, 385, 2616, 386, 2615, 387, 2614, 388, 2613, 389, 2612, 390, 2611, 391, 2610, 392, 2609, 393, 2608, 394, 2607, 395, 2606, 396, 2605, 397, 2604, 398, 2603, 399, 2602, 400, 2601, 401, 2600, 402, 2599, 403, 2598, 404, 2597, 405, 2596, 406, 2595, 407, 2594, 408, 2593, 409, 2592, 410, 2591, 411, 2590, 412, 2589, 413, 2588, 414, 2587, 415, 2586, 416, 2585, 417, 2584, 418, 2583, 419, 2582, 420, 2581, 421, 2580, 422, 2579, 423, 2578, 424, 2577, 425, 2576, 426, 2575, 427, 2574, 428, 2573, 429, 2572, 430, 2571, 431, 2570, 432, 2569, 433, 2568, 434, 2567, 435, 2566, 436, 2565, 437, 2564, 438, 2563, 439, 2562, 440, 2561, 441, 2560, 442, 2559, 443, 2558, 444, 2557, 445, 2556, 446, 2555, 447, 2554, 448, 2553, 449, 2552, 450, 2551, 451, 2550, 452, 2549, 453, 2548, 454, 2547, 455, 2546, 456, 2545, 457, 2544, 458, 2543, 459, 2542, 460, 2541, 461, 2540, 462, 2539, 463, 2538, 464, 2537, 465, 2536, 466, 2535, 467, 2534, 468, 2533, 469, 2532, 470, 2531, 471, 2530, 472, 2529, 473, 2528, 474, 2527, 475, 2526, 476, 2525, 477, 2524, 478, 2523, 479, 2522, 480, 2521, 481, 2520, 482, 2519, 483, 2518, 484, 2517, 485, 2516, 486, 2515, 487, 2514, 488, 2513, 489, 2512, 490, 2511, 491, 2510, 492, 2509, 493, 2508, 494, 2507, 495, 2506, 496, 2505, 497, 2504, 498, 2503, 499, 2502, 500, 2501, 501, 2500, 502, 2499, 503, 2498, 504, 2497, 505, 2496, 506, 2495, 507, 2494, 508, 2493, 509, 2492, 510, 2491, 511, 2490, 512, 2489, 513, 2488, 514, 2487, 515, 2486, 516, 2485, 517, 2484, 518, 2483, 519, 2482, 520, 2481, 521, 2480, 522, 2479, 523, 2478, 524, 2477, 525, 2476, 526, 2475, 527, 2474, 528, 2473, 529, 2472, 530, 2471, 531, 2470, 532, 2469, 533, 2468, 534, 2467, 535, 2466, 536, 2465, 537, 2464, 538, 2463, 539, 2462, 540, 2461, 541, 2460, 542, 2459, 543, 2458, 544, 2457, 545, 2456, 546, 2455, 547, 2454, 548, 2453, 549, 2452, 550, 2451, 551, 2450, 552, 2449, 553, 2448, 554, 2447, 555, 2446, 556, 2445, 557, 2444, 558, 2443, 559, 2442, 560, 2441, 561, 2440, 562, 2439, 563, 2438, 564, 2437, 565, 2436, 566, 2435, 567, 2434, 568, 2433, 569, 2432, 570, 2431, 571, 2430, 572, 2429, 573, 2428, 574, 2427, 575, 2426, 576, 2425, 577, 2424, 578, 2423, 579, 2422, 580, 2421, 581, 2420, 582, 2419, 583, 2418, 584, 2417, 585, 2416, 586, 2415, 587, 2414, 588, 2413, 589, 2412, 590, 2411, 591, 2410, 592, 2409, 593, 2408, 594, 2407, 595, 2406, 596, 2405, 597, 2404, 598, 2403, 599, 2402, 600, 2401, 601, 2400, 602, 2399, 603, 2398, 604, 2397, 605, 2396, 606, 2395, 607, 2394, 608, 2393, 609, 2392, 610, 2391, 611, 2390, 612, 2389, 613, 2388, 614, 2387, 615, 2386, 616, 2385, 617, 2384, 618, 2383, 619, 2382, 620, 2381, 621, 2380, 622, 2379, 623, 2378, 624, 2377, 625, 2376, 626, 2375, 627, 2374, 628, 2373, 629, 2372, 630, 2371, 631, 2370, 632, 2369, 633, 2368, 634, 2367, 635, 2366, 636, 2365, 637, 2364, 638, 2363, 639, 2362, 640, 2361, 641, 2360, 642, 2359, 643, 2358, 644, 2357, 645, 2356, 646, 2355, 647, 2354, 648, 2353, 649, 2352, 650, 2351, 651, 2350, 652, 2349, 653, 2348, 654, 2347, 655, 2346, 656, 2345, 657, 2344, 658, 2343, 659, 2342, 660, 2341, 661, 2340, 662, 2339, 663, 2338, 664, 2337, 665, 2336, 666, 2335, 667, 2334, 668, 2333, 669, 2332, 670, 2331, 671, 2330, 672, 2329, 673, 2328, 674, 2327, 675, 2326, 676, 2325, 677, 2324, 678, 2323, 679, 2322, 680, 2321, 681, 2320, 682, 2319, 683, 2318, 684, 2317, 685, 2316, 686, 2315, 687, 2314, 688, 2313, 689, 2312, 690, 2311, 691, 2310, 692, 2309, 693, 2308, 694, 2307, 695, 2306, 696, 2305, 697, 2304, 698, 2303, 699, 2302, 700, 2301, 701, 2300, 702, 2299, 703, 2298, 704, 2297, 705, 2296, 706, 2295, 707, 2294, 708, 2293, 709, 2292, 710, 2291, 711, 2290, 712, 2289, 713, 2288, 714, 2287, 715, 2286, 716, 2285, 717, 2284, 718, 2283, 719, 2282, 720, 2281, 721, 2280, 722, 2279, 723, 2278, 724, 2277, 725, 2276, 726, 2275, 727, 2274, 728, 2273, 729, 2272, 730, 2271, 731, 2270, 732, 2269, 733, 2268, 734, 2267, 735, 2266, 736, 2265, 737, 2264, 738, 2263, 739, 2262, 740, 2261, 741, 2260, 742, 2259, 743, 2258, 744, 2257, 745, 2256, 746, 2255, 747, 2254, 748, 2253, 749, 2252, 750, 2251, 2250, 2249, 2248, 2247, 2246, 2245, 2244, 2243, 2242, 2241, 2240, 2239, 2238, 2237, 2236, 2235, 2234, 2233, 2232, 2231, 2230, 2229, 2228, 2227, 2226, 2225, 2224, 2223, 2222, 2221, 2220, 2219, 2218, 2217, 2216, 2215, 2214, 2213, 2212, 2211, 2210, 2209, 2208, 2207, 2206, 2205, 2204, 2203, 2202, 2201, 2200, 2199, 2198, 2197, 2196, 2195, 2194, 2193, 2192, 2191, 2190, 2189, 2188, 2187, 2186, 2185, 2184, 2183, 2182, 2181, 2180, 2179, 2178, 2177, 2176, 2175, 2174, 2173, 2172, 2171, 2170, 2169, 2168, 2167, 2166, 2165, 2164, 2163, 2162, 2161, 2160, 2159, 2158, 2157, 2156, 2155, 2154, 2153, 2152, 2151, 2150, 2149, 2148, 2147, 2146, 2145, 2144, 2143, 2142, 2141, 2140, 2139, 2138, 2137, 2136, 2135, 2134, 2133, 2132, 2131, 2130, 2129, 2128, 2127, 2126, 2125, 2124, 2123, 2122, 2121, 2120, 2119, 2118, 2117, 2116, 2115, 2114, 2113, 2112, 2111, 2110, 2109, 2108, 2107, 2106, 2105, 2104, 2103, 2102, 2101, 2100, 2099, 2098, 2097, 2096, 2095, 2094, 2093, 2092, 2091, 2090, 2089, 2088, 2087, 2086, 2085, 2084, 2083, 2082, 2081, 2080, 2079, 2078, 2077, 2076, 2075, 2074, 2073, 2072, 2071, 2070, 2069, 2068, 2067, 2066, 2065, 2064, 2063, 2062, 2061, 2060, 2059, 2058, 2057, 2056, 2055, 2054, 2053, 2052, 2051, 2050, 2049, 2048, 2047, 2046, 2045, 2044, 2043, 2042, 2041, 2040, 2039, 2038, 2037, 2036, 2035, 2034, 2033, 2032, 2031, 2030, 2029, 2028, 2027, 2026, 2025, 2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970, 1969, 1968, 1967, 1966, 1965, 1964, 1963, 1962, 1961, 1960, 1959, 1958, 1957, 1956, 1955, 1954, 1953, 1952, 1951, 1950, 1949, 1948, 1947, 1946, 1945, 1944, 1943, 1942, 1941, 1940, 1939, 1938, 1937, 1936, 1935, 1934, 1933, 1932, 1931, 1930, 1929, 1928, 1927, 1926, 1925, 1924, 1923, 1922, 1921, 1920, 1919, 1918, 1917, 1916, 1915, 1914, 1913, 1912, 1911, 1910, 1909, 1908, 1907, 1906, 1905, 1904, 1903, 1902, 1901, 1900, 1899, 1898, 1897, 1896, 1895, 1894, 1893, 1892, 1891, 1890, 1889, 1888, 1887, 1886, 1885, 1884, 1883, 1882, 1881, 1880, 1879, 1878, 1877, 1876, 1875, 1874, 1873, 1872, 1871, 1870, 1869, 1868, 1867, 1866, 1865, 1864, 1863, 1862, 1861, 1860, 1859, 1858, 1857, 1856, 1855, 1854, 1853, 1852, 1851, 1850, 1849, 1848, 1847, 1846, 1845, 1844, 1843, 1842, 1841, 1840, 1839, 1838, 1837, 1836, 1835, 1834, 1833, 1832, 1831, 1830, 1829, 1828, 1827, 1826, 1825, 1824, 1823, 1822, 1821, 1820, 1819, 1818, 1817, 1816, 1815, 1814, 1813, 1812, 1811, 1810, 1809, 1808, 1807, 1806, 1805, 1804, 1803, 1802, 1801, 1800, 1799, 1798, 1797, 1796, 1795, 1794, 1793, 1792, 1791, 1790, 1789, 1788, 1787, 1786, 1785, 1784, 1783, 1782, 1781, 1780, 1779, 1778, 1777, 1776, 1775, 1774, 1773, 1772, 1771, 1770, 1769, 1768, 1767, 1766, 1765, 1764, 1763, 1762, 1761, 1760, 1759, 1758, 1757, 1756, 1755, 1754, 1753, 1752, 1751, 1750, 1749, 1748, 1747, 1746, 1745, 1744, 1743, 1742, 1741, 1740, 1739, 1738, 1737, 1736, 1735, 1734, 1733, 1732, 1731, 1730, 1729, 1728, 1727, 1726, 1725, 1724, 1723, 1722, 1721, 1720, 1719, 1718, 1717, 1716, 1715, 1714, 1713, 1712, 1711, 1710, 1709, 1708, 1707, 1706, 1705, 1704, 1703, 1702, 1701, 1700, 1699, 1698, 1697, 1696, 1695, 1694, 1693, 1692, 1691, 1690, 1689, 1688, 1687, 1686, 1685, 1684, 1683, 1682, 1681, 1680, 1679, 1678, 1677, 1676, 1675, 1674, 1673, 1672, 1671, 1670, 1669, 1668, 1667, 1666, 1665, 1664, 1663, 1662, 1661, 1660, 1659, 1658, 1657, 1656, 1655, 1654, 1653, 1652, 1651, 1650, 1649, 1648, 1647, 1646, 1645, 1644, 1643, 1642, 1641, 1640, 1639, 1638, 1637, 1636, 1635, 1634, 1633, 1632, 1631, 1630, 1629, 1628, 1627, 1626, 1625, 1624, 1623, 1622, 1621, 1620, 1619, 1618, 1617, 1616, 1615, 1614, 1613, 1612, 1611, 1610, 1609, 1608, 1607, 1606, 1605, 1604, 1603, 1602, 1601, 1600, 1599, 1598, 1597, 1596, 1595, 1594, 1593, 1592, 1591, 1590, 1589, 1588, 1587, 1586, 1585, 1584, 1583, 1582, 1581, 1580, 1579, 1578, 1577, 1576, 1575, 1574, 1573, 1572, 1571, 1570, 1569, 1568, 1567, 1566, 1565, 1564, 1563, 1562, 1561, 1560, 1559, 1558, 1557, 1556, 1555, 1554, 1553, 1552, 1551, 1550, 1549, 1548, 1547, 1546, 1545, 1544, 1543, 1542, 1541, 1540, 1539, 1538, 1537, 1536, 1535, 1534, 1533, 1532, 1531, 1530, 1529, 1528, 1527, 1526, 1525, 1524, 1523, 1522, 1521, 1520, 1519, 1518, 1517, 1516, 1515, 1514, 1513, 1512, 1511, 1510, 1509, 1508, 1507, 1506, 1505, 1504, 1503, 1502, 1501, 1500, 1499, 1498, 1497, 1496, 1495, 1494, 1493, 1492, 1491, 1490, 1489, 1488, 1487, 1486, 1485, 1484, 1483, 1482, 1481, 1480, 1479, 1478, 1477, 1476, 1475, 1474, 1473, 1472, 1471, 1470, 1469, 1468, 1467, 1466, 1465, 1464, 1463, 1462, 1461, 1460, 1459, 1458, 1457, 1456, 1455, 1454, 1453, 1452, 1451, 1450, 1449, 1448, 1447, 1446, 1445, 1444, 1443, 1442, 1441, 1440, 1439, 1438, 1437, 1436, 1435, 1434, 1433, 1432, 1431, 1430, 1429, 1428, 1427, 1426, 1425, 1424, 1423, 1422, 1421, 1420, 1419, 1418, 1417, 1416, 1415, 1414, 1413, 1412, 1411, 1410, 1409, 1408, 1407, 1406, 1405, 1404, 1403, 1402, 1401, 1400, 1399, 1398, 1397, 1396, 1395, 1394, 1393, 1392, 1391, 1390, 1389, 1388, 1387, 1386, 1385, 1384, 1383, 1382, 1381, 1380, 1379, 1378, 1377, 1376, 1375, 1374, 1373, 1372, 1371, 1370, 1369, 1368, 1367, 1366, 1365, 1364, 1363, 1362, 1361, 1360, 1359, 1358, 1357, 1356, 1355, 1354, 1353, 1352, 1351, 1350, 1349, 1348, 1347, 1346, 1345, 1344, 1343, 1342, 1341, 1340, 1339, 1338, 1337, 1336, 1335, 1334, 1333, 1332, 1331, 1330, 1329, 1328, 1327, 1326, 1325, 1324, 1323, 1322, 1321, 1320, 1319, 1318, 1317, 1316, 1315, 1314, 1313, 1312, 1311, 1310, 1309, 1308, 1307, 1306, 1305, 1304, 1303, 1302, 1301, 1300, 1299, 1298, 1297, 1296, 1295, 1294, 1293, 1292, 1291, 1290, 1289, 1288, 1287, 1286, 1285, 1284, 1283, 1282, 1281, 1280, 1279, 1278, 1277, 1276, 1275, 1274, 1273, 1272, 1271, 1270, 1269, 1268, 1267, 1266, 1265, 1264, 1263, 1262, 1261, 1260, 1259, 1258, 1257, 1256, 1255, 1254, 1253, 1252, 1251, 1250, 1249, 1248, 1247, 1246, 1245, 1244, 1243, 1242, 1241, 1240, 1239, 1238, 1237, 1236, 1235, 1234, 1233, 1232, 1231, 1230, 1229, 1228, 1227, 1226, 1225, 1224, 1223, 1222, 1221, 1220, 1219, 1218, 1217, 1216, 1215, 1214, 1213, 1212, 1211, 1210, 1209, 1208, 1207, 1206, 1205, 1204, 1203, 1202, 1201, 1200, 1199, 1198, 1197, 1196, 1195, 1194, 1193, 1192, 1191, 1190, 1189, 1188, 1187, 1186, 1185, 1184, 1183, 1182, 1181, 1180, 1179, 1178, 1177, 1176, 1175, 1174, 1173, 1172, 1171, 1170, 1169, 1168, 1167, 1166, 1165, 1164, 1163, 1162, 1161, 1160, 1159, 1158, 1157, 1156, 1155, 1154, 1153, 1152, 1151, 1150, 1149, 1148, 1147, 1146, 1145, 1144, 1143, 1142, 1141, 1140, 1139, 1138, 1137, 1136, 1135, 1134, 1133, 1132, 1131, 1130, 1129, 1128, 1127, 1126, 1125, 1124, 1123, 1122, 1121, 1120, 1119, 1118, 1117, 1116, 1115, 1114, 1113, 1112, 1111, 1110, 1109, 1108, 1107, 1106, 1105, 1104, 1103, 1102, 1101, 1100, 1099, 1098, 1097, 1096, 1095, 1094, 1093, 1092, 1091, 1090, 1089, 1088, 1087, 1086, 1085, 1084, 1083, 1082, 1081, 1080, 1079, 1078, 1077, 1076, 1075, 1074, 1073, 1072, 1071, 1070, 1069, 1068, 1067, 1066, 1065, 1064, 1063, 1062, 1061, 1060, 1059, 1058, 1057, 1056, 1055, 1054, 1053, 1052, 1051, 1050, 1049, 1048, 1047, 1046, 1045, 1044, 1043, 1042, 1041, 1040, 1039, 1038, 1037, 1036, 1035, 1034, 1033, 1032, 1031, 1030, 1029, 1028, 1027, 1026, 1025, 1024, 1023, 1022, 1021, 1020, 1019, 1018, 1017, 1016, 1015, 1014, 1013, 1012, 1011, 1010, 1009, 1008, 1007, 1006, 1005, 1004, 1003, 1002, 1001, 1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970, 969, 968, 967, 966, 965, 964, 963, 962, 961, 960, 959, 958, 957, 956, 955, 954, 953, 952, 951, 950, 949, 948, 947, 946, 945, 944, 943, 942, 941, 940, 939, 938, 937, 936, 935, 934, 933, 932, 931, 930, 929, 928, 927, 926, 925, 924, 923, 922, 921, 920, 919, 918, 917, 916, 915, 914, 913, 912, 911, 910, 909, 908, 907, 906, 905, 904, 903, 902, 901, 900, 899, 898, 897, 896, 895, 894, 893, 892, 891, 890, 889, 888, 887, 886, 885, 884, 883, 882, 881, 880, 879, 878, 877, 876, 875, 874, 873, 872, 871, 870, 869, 868, 867, 866, 865, 864, 863, 862, 861, 860, 859, 858, 857, 856, 855, 854, 853, 852, 851, 850, 849, 848, 847, 846, 845, 844, 843, 842, 841, 840, 839, 838, 837, 836, 835, 834, 833, 832, 831, 830, 829, 828, 827, 826, 825, 824, 823, 822, 821, 820, 819, 818, 817, 816, 815, 814, 813, 812, 811, 810, 809, 808, 807, 806, 805, 804, 803, 802, 801, 800, 799, 798, 797, 796, 795, 794, 793, 792, 791, 790, 789, 788, 787, 786, 785, 784, 783, 782, 781, 780, 779, 778, 777, 776, 775, 774, 773, 772, 771, 770, 769, 768, 767, 766, 765, 764, 763, 762, 761, 760, 759, 758, 757, 756, 755, 754, 753, 752, 751]\n assert candidate(n = 12,k = 4) == [1, 12, 2, 11, 10, 9, 8, 7, 6, 5, 4, 3]\n assert candidate(n = 998,k = 498) == [1, 998, 2, 997, 3, 996, 4, 995, 5, 994, 6, 993, 7, 992, 8, 991, 9, 990, 10, 989, 11, 988, 12, 987, 13, 986, 14, 985, 15, 984, 16, 983, 17, 982, 18, 981, 19, 980, 20, 979, 21, 978, 22, 977, 23, 976, 24, 975, 25, 974, 26, 973, 27, 972, 28, 971, 29, 970, 30, 969, 31, 968, 32, 967, 33, 966, 34, 965, 35, 964, 36, 963, 37, 962, 38, 961, 39, 960, 40, 959, 41, 958, 42, 957, 43, 956, 44, 955, 45, 954, 46, 953, 47, 952, 48, 951, 49, 950, 50, 949, 51, 948, 52, 947, 53, 946, 54, 945, 55, 944, 56, 943, 57, 942, 58, 941, 59, 940, 60, 939, 61, 938, 62, 937, 63, 936, 64, 935, 65, 934, 66, 933, 67, 932, 68, 931, 69, 930, 70, 929, 71, 928, 72, 927, 73, 926, 74, 925, 75, 924, 76, 923, 77, 922, 78, 921, 79, 920, 80, 919, 81, 918, 82, 917, 83, 916, 84, 915, 85, 914, 86, 913, 87, 912, 88, 911, 89, 910, 90, 909, 91, 908, 92, 907, 93, 906, 94, 905, 95, 904, 96, 903, 97, 902, 98, 901, 99, 900, 100, 899, 101, 898, 102, 897, 103, 896, 104, 895, 105, 894, 106, 893, 107, 892, 108, 891, 109, 890, 110, 889, 111, 888, 112, 887, 113, 886, 114, 885, 115, 884, 116, 883, 117, 882, 118, 881, 119, 880, 120, 879, 121, 878, 122, 877, 123, 876, 124, 875, 125, 874, 126, 873, 127, 872, 128, 871, 129, 870, 130, 869, 131, 868, 132, 867, 133, 866, 134, 865, 135, 864, 136, 863, 137, 862, 138, 861, 139, 860, 140, 859, 141, 858, 142, 857, 143, 856, 144, 855, 145, 854, 146, 853, 147, 852, 148, 851, 149, 850, 150, 849, 151, 848, 152, 847, 153, 846, 154, 845, 155, 844, 156, 843, 157, 842, 158, 841, 159, 840, 160, 839, 161, 838, 162, 837, 163, 836, 164, 835, 165, 834, 166, 833, 167, 832, 168, 831, 169, 830, 170, 829, 171, 828, 172, 827, 173, 826, 174, 825, 175, 824, 176, 823, 177, 822, 178, 821, 179, 820, 180, 819, 181, 818, 182, 817, 183, 816, 184, 815, 185, 814, 186, 813, 187, 812, 188, 811, 189, 810, 190, 809, 191, 808, 192, 807, 193, 806, 194, 805, 195, 804, 196, 803, 197, 802, 198, 801, 199, 800, 200, 799, 201, 798, 202, 797, 203, 796, 204, 795, 205, 794, 206, 793, 207, 792, 208, 791, 209, 790, 210, 789, 211, 788, 212, 787, 213, 786, 214, 785, 215, 784, 216, 783, 217, 782, 218, 781, 219, 780, 220, 779, 221, 778, 222, 777, 223, 776, 224, 775, 225, 774, 226, 773, 227, 772, 228, 771, 229, 770, 230, 769, 231, 768, 232, 767, 233, 766, 234, 765, 235, 764, 236, 763, 237, 762, 238, 761, 239, 760, 240, 759, 241, 758, 242, 757, 243, 756, 244, 755, 245, 754, 246, 753, 247, 752, 248, 751, 249, 750, 749, 748, 747, 746, 745, 744, 743, 742, 741, 740, 739, 738, 737, 736, 735, 734, 733, 732, 731, 730, 729, 728, 727, 726, 725, 724, 723, 722, 721, 720, 719, 718, 717, 716, 715, 714, 713, 712, 711, 710, 709, 708, 707, 706, 705, 704, 703, 702, 701, 700, 699, 698, 697, 696, 695, 694, 693, 692, 691, 690, 689, 688, 687, 686, 685, 684, 683, 682, 681, 680, 679, 678, 677, 676, 675, 674, 673, 672, 671, 670, 669, 668, 667, 666, 665, 664, 663, 662, 661, 660, 659, 658, 657, 656, 655, 654, 653, 652, 651, 650, 649, 648, 647, 646, 645, 644, 643, 642, 641, 640, 639, 638, 637, 636, 635, 634, 633, 632, 631, 630, 629, 628, 627, 626, 625, 624, 623, 622, 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, 611, 610, 609, 608, 607, 606, 605, 604, 603, 602, 601, 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250]\n assert candidate(n = 15,k = 7) == [1, 15, 2, 14, 3, 13, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n assert candidate(n = 750,k = 375) == [1, 750, 2, 749, 3, 748, 4, 747, 5, 746, 6, 745, 7, 744, 8, 743, 9, 742, 10, 741, 11, 740, 12, 739, 13, 738, 14, 737, 15, 736, 16, 735, 17, 734, 18, 733, 19, 732, 20, 731, 21, 730, 22, 729, 23, 728, 24, 727, 25, 726, 26, 725, 27, 724, 28, 723, 29, 722, 30, 721, 31, 720, 32, 719, 33, 718, 34, 717, 35, 716, 36, 715, 37, 714, 38, 713, 39, 712, 40, 711, 41, 710, 42, 709, 43, 708, 44, 707, 45, 706, 46, 705, 47, 704, 48, 703, 49, 702, 50, 701, 51, 700, 52, 699, 53, 698, 54, 697, 55, 696, 56, 695, 57, 694, 58, 693, 59, 692, 60, 691, 61, 690, 62, 689, 63, 688, 64, 687, 65, 686, 66, 685, 67, 684, 68, 683, 69, 682, 70, 681, 71, 680, 72, 679, 73, 678, 74, 677, 75, 676, 76, 675, 77, 674, 78, 673, 79, 672, 80, 671, 81, 670, 82, 669, 83, 668, 84, 667, 85, 666, 86, 665, 87, 664, 88, 663, 89, 662, 90, 661, 91, 660, 92, 659, 93, 658, 94, 657, 95, 656, 96, 655, 97, 654, 98, 653, 99, 652, 100, 651, 101, 650, 102, 649, 103, 648, 104, 647, 105, 646, 106, 645, 107, 644, 108, 643, 109, 642, 110, 641, 111, 640, 112, 639, 113, 638, 114, 637, 115, 636, 116, 635, 117, 634, 118, 633, 119, 632, 120, 631, 121, 630, 122, 629, 123, 628, 124, 627, 125, 626, 126, 625, 127, 624, 128, 623, 129, 622, 130, 621, 131, 620, 132, 619, 133, 618, 134, 617, 135, 616, 136, 615, 137, 614, 138, 613, 139, 612, 140, 611, 141, 610, 142, 609, 143, 608, 144, 607, 145, 606, 146, 605, 147, 604, 148, 603, 149, 602, 150, 601, 151, 600, 152, 599, 153, 598, 154, 597, 155, 596, 156, 595, 157, 594, 158, 593, 159, 592, 160, 591, 161, 590, 162, 589, 163, 588, 164, 587, 165, 586, 166, 585, 167, 584, 168, 583, 169, 582, 170, 581, 171, 580, 172, 579, 173, 578, 174, 577, 175, 576, 176, 575, 177, 574, 178, 573, 179, 572, 180, 571, 181, 570, 182, 569, 183, 568, 184, 567, 185, 566, 186, 565, 187, 564, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563]\n assert candidate(n = 600,k = 300) == [1, 600, 2, 599, 3, 598, 4, 597, 5, 596, 6, 595, 7, 594, 8, 593, 9, 592, 10, 591, 11, 590, 12, 589, 13, 588, 14, 587, 15, 586, 16, 585, 17, 584, 18, 583, 19, 582, 20, 581, 21, 580, 22, 579, 23, 578, 24, 577, 25, 576, 26, 575, 27, 574, 28, 573, 29, 572, 30, 571, 31, 570, 32, 569, 33, 568, 34, 567, 35, 566, 36, 565, 37, 564, 38, 563, 39, 562, 40, 561, 41, 560, 42, 559, 43, 558, 44, 557, 45, 556, 46, 555, 47, 554, 48, 553, 49, 552, 50, 551, 51, 550, 52, 549, 53, 548, 54, 547, 55, 546, 56, 545, 57, 544, 58, 543, 59, 542, 60, 541, 61, 540, 62, 539, 63, 538, 64, 537, 65, 536, 66, 535, 67, 534, 68, 533, 69, 532, 70, 531, 71, 530, 72, 529, 73, 528, 74, 527, 75, 526, 76, 525, 77, 524, 78, 523, 79, 522, 80, 521, 81, 520, 82, 519, 83, 518, 84, 517, 85, 516, 86, 515, 87, 514, 88, 513, 89, 512, 90, 511, 91, 510, 92, 509, 93, 508, 94, 507, 95, 506, 96, 505, 97, 504, 98, 503, 99, 502, 100, 501, 101, 500, 102, 499, 103, 498, 104, 497, 105, 496, 106, 495, 107, 494, 108, 493, 109, 492, 110, 491, 111, 490, 112, 489, 113, 488, 114, 487, 115, 486, 116, 485, 117, 484, 118, 483, 119, 482, 120, 481, 121, 480, 122, 479, 123, 478, 124, 477, 125, 476, 126, 475, 127, 474, 128, 473, 129, 472, 130, 471, 131, 470, 132, 469, 133, 468, 134, 467, 135, 466, 136, 465, 137, 464, 138, 463, 139, 462, 140, 461, 141, 460, 142, 459, 143, 458, 144, 457, 145, 456, 146, 455, 147, 454, 148, 453, 149, 452, 150, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151]\n assert candidate(n = 40,k = 35) == [1, 40, 2, 39, 3, 38, 4, 37, 5, 36, 6, 35, 7, 34, 8, 33, 9, 32, 10, 31, 11, 30, 12, 29, 13, 28, 14, 27, 15, 26, 16, 25, 17, 24, 18, 19, 20, 21, 22, 23]\n assert candidate(n = 12,k = 10) == [1, 12, 2, 11, 3, 10, 4, 9, 5, 8, 7, 6]\n assert candidate(n = 40,k = 30) == [1, 40, 2, 39, 3, 38, 4, 37, 5, 36, 6, 35, 7, 34, 8, 33, 9, 32, 10, 31, 11, 30, 12, 29, 13, 28, 14, 27, 15, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16]\n assert candidate(n = 70,k = 40) == [1, 70, 2, 69, 3, 68, 4, 67, 5, 66, 6, 65, 7, 64, 8, 63, 9, 62, 10, 61, 11, 60, 12, 59, 13, 58, 14, 57, 15, 56, 16, 55, 17, 54, 18, 53, 19, 52, 20, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21]\n assert candidate(n = 5000,k = 2500) == [1, 5000, 2, 4999, 3, 4998, 4, 4997, 5, 4996, 6, 4995, 7, 4994, 8, 4993, 9, 4992, 10, 4991, 11, 4990, 12, 4989, 13, 4988, 14, 4987, 15, 4986, 16, 4985, 17, 4984, 18, 4983, 19, 4982, 20, 4981, 21, 4980, 22, 4979, 23, 4978, 24, 4977, 25, 4976, 26, 4975, 27, 4974, 28, 4973, 29, 4972, 30, 4971, 31, 4970, 32, 4969, 33, 4968, 34, 4967, 35, 4966, 36, 4965, 37, 4964, 38, 4963, 39, 4962, 40, 4961, 41, 4960, 42, 4959, 43, 4958, 44, 4957, 45, 4956, 46, 4955, 47, 4954, 48, 4953, 49, 4952, 50, 4951, 51, 4950, 52, 4949, 53, 4948, 54, 4947, 55, 4946, 56, 4945, 57, 4944, 58, 4943, 59, 4942, 60, 4941, 61, 4940, 62, 4939, 63, 4938, 64, 4937, 65, 4936, 66, 4935, 67, 4934, 68, 4933, 69, 4932, 70, 4931, 71, 4930, 72, 4929, 73, 4928, 74, 4927, 75, 4926, 76, 4925, 77, 4924, 78, 4923, 79, 4922, 80, 4921, 81, 4920, 82, 4919, 83, 4918, 84, 4917, 85, 4916, 86, 4915, 87, 4914, 88, 4913, 89, 4912, 90, 4911, 91, 4910, 92, 4909, 93, 4908, 94, 4907, 95, 4906, 96, 4905, 97, 4904, 98, 4903, 99, 4902, 100, 4901, 101, 4900, 102, 4899, 103, 4898, 104, 4897, 105, 4896, 106, 4895, 107, 4894, 108, 4893, 109, 4892, 110, 4891, 111, 4890, 112, 4889, 113, 4888, 114, 4887, 115, 4886, 116, 4885, 117, 4884, 118, 4883, 119, 4882, 120, 4881, 121, 4880, 122, 4879, 123, 4878, 124, 4877, 125, 4876, 126, 4875, 127, 4874, 128, 4873, 129, 4872, 130, 4871, 131, 4870, 132, 4869, 133, 4868, 134, 4867, 135, 4866, 136, 4865, 137, 4864, 138, 4863, 139, 4862, 140, 4861, 141, 4860, 142, 4859, 143, 4858, 144, 4857, 145, 4856, 146, 4855, 147, 4854, 148, 4853, 149, 4852, 150, 4851, 151, 4850, 152, 4849, 153, 4848, 154, 4847, 155, 4846, 156, 4845, 157, 4844, 158, 4843, 159, 4842, 160, 4841, 161, 4840, 162, 4839, 163, 4838, 164, 4837, 165, 4836, 166, 4835, 167, 4834, 168, 4833, 169, 4832, 170, 4831, 171, 4830, 172, 4829, 173, 4828, 174, 4827, 175, 4826, 176, 4825, 177, 4824, 178, 4823, 179, 4822, 180, 4821, 181, 4820, 182, 4819, 183, 4818, 184, 4817, 185, 4816, 186, 4815, 187, 4814, 188, 4813, 189, 4812, 190, 4811, 191, 4810, 192, 4809, 193, 4808, 194, 4807, 195, 4806, 196, 4805, 197, 4804, 198, 4803, 199, 4802, 200, 4801, 201, 4800, 202, 4799, 203, 4798, 204, 4797, 205, 4796, 206, 4795, 207, 4794, 208, 4793, 209, 4792, 210, 4791, 211, 4790, 212, 4789, 213, 4788, 214, 4787, 215, 4786, 216, 4785, 217, 4784, 218, 4783, 219, 4782, 220, 4781, 221, 4780, 222, 4779, 223, 4778, 224, 4777, 225, 4776, 226, 4775, 227, 4774, 228, 4773, 229, 4772, 230, 4771, 231, 4770, 232, 4769, 233, 4768, 234, 4767, 235, 4766, 236, 4765, 237, 4764, 238, 4763, 239, 4762, 240, 4761, 241, 4760, 242, 4759, 243, 4758, 244, 4757, 245, 4756, 246, 4755, 247, 4754, 248, 4753, 249, 4752, 250, 4751, 251, 4750, 252, 4749, 253, 4748, 254, 4747, 255, 4746, 256, 4745, 257, 4744, 258, 4743, 259, 4742, 260, 4741, 261, 4740, 262, 4739, 263, 4738, 264, 4737, 265, 4736, 266, 4735, 267, 4734, 268, 4733, 269, 4732, 270, 4731, 271, 4730, 272, 4729, 273, 4728, 274, 4727, 275, 4726, 276, 4725, 277, 4724, 278, 4723, 279, 4722, 280, 4721, 281, 4720, 282, 4719, 283, 4718, 284, 4717, 285, 4716, 286, 4715, 287, 4714, 288, 4713, 289, 4712, 290, 4711, 291, 4710, 292, 4709, 293, 4708, 294, 4707, 295, 4706, 296, 4705, 297, 4704, 298, 4703, 299, 4702, 300, 4701, 301, 4700, 302, 4699, 303, 4698, 304, 4697, 305, 4696, 306, 4695, 307, 4694, 308, 4693, 309, 4692, 310, 4691, 311, 4690, 312, 4689, 313, 4688, 314, 4687, 315, 4686, 316, 4685, 317, 4684, 318, 4683, 319, 4682, 320, 4681, 321, 4680, 322, 4679, 323, 4678, 324, 4677, 325, 4676, 326, 4675, 327, 4674, 328, 4673, 329, 4672, 330, 4671, 331, 4670, 332, 4669, 333, 4668, 334, 4667, 335, 4666, 336, 4665, 337, 4664, 338, 4663, 339, 4662, 340, 4661, 341, 4660, 342, 4659, 343, 4658, 344, 4657, 345, 4656, 346, 4655, 347, 4654, 348, 4653, 349, 4652, 350, 4651, 351, 4650, 352, 4649, 353, 4648, 354, 4647, 355, 4646, 356, 4645, 357, 4644, 358, 4643, 359, 4642, 360, 4641, 361, 4640, 362, 4639, 363, 4638, 364, 4637, 365, 4636, 366, 4635, 367, 4634, 368, 4633, 369, 4632, 370, 4631, 371, 4630, 372, 4629, 373, 4628, 374, 4627, 375, 4626, 376, 4625, 377, 4624, 378, 4623, 379, 4622, 380, 4621, 381, 4620, 382, 4619, 383, 4618, 384, 4617, 385, 4616, 386, 4615, 387, 4614, 388, 4613, 389, 4612, 390, 4611, 391, 4610, 392, 4609, 393, 4608, 394, 4607, 395, 4606, 396, 4605, 397, 4604, 398, 4603, 399, 4602, 400, 4601, 401, 4600, 402, 4599, 403, 4598, 404, 4597, 405, 4596, 406, 4595, 407, 4594, 408, 4593, 409, 4592, 410, 4591, 411, 4590, 412, 4589, 413, 4588, 414, 4587, 415, 4586, 416, 4585, 417, 4584, 418, 4583, 419, 4582, 420, 4581, 421, 4580, 422, 4579, 423, 4578, 424, 4577, 425, 4576, 426, 4575, 427, 4574, 428, 4573, 429, 4572, 430, 4571, 431, 4570, 432, 4569, 433, 4568, 434, 4567, 435, 4566, 436, 4565, 437, 4564, 438, 4563, 439, 4562, 440, 4561, 441, 4560, 442, 4559, 443, 4558, 444, 4557, 445, 4556, 446, 4555, 447, 4554, 448, 4553, 449, 4552, 450, 4551, 451, 4550, 452, 4549, 453, 4548, 454, 4547, 455, 4546, 456, 4545, 457, 4544, 458, 4543, 459, 4542, 460, 4541, 461, 4540, 462, 4539, 463, 4538, 464, 4537, 465, 4536, 466, 4535, 467, 4534, 468, 4533, 469, 4532, 470, 4531, 471, 4530, 472, 4529, 473, 4528, 474, 4527, 475, 4526, 476, 4525, 477, 4524, 478, 4523, 479, 4522, 480, 4521, 481, 4520, 482, 4519, 483, 4518, 484, 4517, 485, 4516, 486, 4515, 487, 4514, 488, 4513, 489, 4512, 490, 4511, 491, 4510, 492, 4509, 493, 4508, 494, 4507, 495, 4506, 496, 4505, 497, 4504, 498, 4503, 499, 4502, 500, 4501, 501, 4500, 502, 4499, 503, 4498, 504, 4497, 505, 4496, 506, 4495, 507, 4494, 508, 4493, 509, 4492, 510, 4491, 511, 4490, 512, 4489, 513, 4488, 514, 4487, 515, 4486, 516, 4485, 517, 4484, 518, 4483, 519, 4482, 520, 4481, 521, 4480, 522, 4479, 523, 4478, 524, 4477, 525, 4476, 526, 4475, 527, 4474, 528, 4473, 529, 4472, 530, 4471, 531, 4470, 532, 4469, 533, 4468, 534, 4467, 535, 4466, 536, 4465, 537, 4464, 538, 4463, 539, 4462, 540, 4461, 541, 4460, 542, 4459, 543, 4458, 544, 4457, 545, 4456, 546, 4455, 547, 4454, 548, 4453, 549, 4452, 550, 4451, 551, 4450, 552, 4449, 553, 4448, 554, 4447, 555, 4446, 556, 4445, 557, 4444, 558, 4443, 559, 4442, 560, 4441, 561, 4440, 562, 4439, 563, 4438, 564, 4437, 565, 4436, 566, 4435, 567, 4434, 568, 4433, 569, 4432, 570, 4431, 571, 4430, 572, 4429, 573, 4428, 574, 4427, 575, 4426, 576, 4425, 577, 4424, 578, 4423, 579, 4422, 580, 4421, 581, 4420, 582, 4419, 583, 4418, 584, 4417, 585, 4416, 586, 4415, 587, 4414, 588, 4413, 589, 4412, 590, 4411, 591, 4410, 592, 4409, 593, 4408, 594, 4407, 595, 4406, 596, 4405, 597, 4404, 598, 4403, 599, 4402, 600, 4401, 601, 4400, 602, 4399, 603, 4398, 604, 4397, 605, 4396, 606, 4395, 607, 4394, 608, 4393, 609, 4392, 610, 4391, 611, 4390, 612, 4389, 613, 4388, 614, 4387, 615, 4386, 616, 4385, 617, 4384, 618, 4383, 619, 4382, 620, 4381, 621, 4380, 622, 4379, 623, 4378, 624, 4377, 625, 4376, 626, 4375, 627, 4374, 628, 4373, 629, 4372, 630, 4371, 631, 4370, 632, 4369, 633, 4368, 634, 4367, 635, 4366, 636, 4365, 637, 4364, 638, 4363, 639, 4362, 640, 4361, 641, 4360, 642, 4359, 643, 4358, 644, 4357, 645, 4356, 646, 4355, 647, 4354, 648, 4353, 649, 4352, 650, 4351, 651, 4350, 652, 4349, 653, 4348, 654, 4347, 655, 4346, 656, 4345, 657, 4344, 658, 4343, 659, 4342, 660, 4341, 661, 4340, 662, 4339, 663, 4338, 664, 4337, 665, 4336, 666, 4335, 667, 4334, 668, 4333, 669, 4332, 670, 4331, 671, 4330, 672, 4329, 673, 4328, 674, 4327, 675, 4326, 676, 4325, 677, 4324, 678, 4323, 679, 4322, 680, 4321, 681, 4320, 682, 4319, 683, 4318, 684, 4317, 685, 4316, 686, 4315, 687, 4314, 688, 4313, 689, 4312, 690, 4311, 691, 4310, 692, 4309, 693, 4308, 694, 4307, 695, 4306, 696, 4305, 697, 4304, 698, 4303, 699, 4302, 700, 4301, 701, 4300, 702, 4299, 703, 4298, 704, 4297, 705, 4296, 706, 4295, 707, 4294, 708, 4293, 709, 4292, 710, 4291, 711, 4290, 712, 4289, 713, 4288, 714, 4287, 715, 4286, 716, 4285, 717, 4284, 718, 4283, 719, 4282, 720, 4281, 721, 4280, 722, 4279, 723, 4278, 724, 4277, 725, 4276, 726, 4275, 727, 4274, 728, 4273, 729, 4272, 730, 4271, 731, 4270, 732, 4269, 733, 4268, 734, 4267, 735, 4266, 736, 4265, 737, 4264, 738, 4263, 739, 4262, 740, 4261, 741, 4260, 742, 4259, 743, 4258, 744, 4257, 745, 4256, 746, 4255, 747, 4254, 748, 4253, 749, 4252, 750, 4251, 751, 4250, 752, 4249, 753, 4248, 754, 4247, 755, 4246, 756, 4245, 757, 4244, 758, 4243, 759, 4242, 760, 4241, 761, 4240, 762, 4239, 763, 4238, 764, 4237, 765, 4236, 766, 4235, 767, 4234, 768, 4233, 769, 4232, 770, 4231, 771, 4230, 772, 4229, 773, 4228, 774, 4227, 775, 4226, 776, 4225, 777, 4224, 778, 4223, 779, 4222, 780, 4221, 781, 4220, 782, 4219, 783, 4218, 784, 4217, 785, 4216, 786, 4215, 787, 4214, 788, 4213, 789, 4212, 790, 4211, 791, 4210, 792, 4209, 793, 4208, 794, 4207, 795, 4206, 796, 4205, 797, 4204, 798, 4203, 799, 4202, 800, 4201, 801, 4200, 802, 4199, 803, 4198, 804, 4197, 805, 4196, 806, 4195, 807, 4194, 808, 4193, 809, 4192, 810, 4191, 811, 4190, 812, 4189, 813, 4188, 814, 4187, 815, 4186, 816, 4185, 817, 4184, 818, 4183, 819, 4182, 820, 4181, 821, 4180, 822, 4179, 823, 4178, 824, 4177, 825, 4176, 826, 4175, 827, 4174, 828, 4173, 829, 4172, 830, 4171, 831, 4170, 832, 4169, 833, 4168, 834, 4167, 835, 4166, 836, 4165, 837, 4164, 838, 4163, 839, 4162, 840, 4161, 841, 4160, 842, 4159, 843, 4158, 844, 4157, 845, 4156, 846, 4155, 847, 4154, 848, 4153, 849, 4152, 850, 4151, 851, 4150, 852, 4149, 853, 4148, 854, 4147, 855, 4146, 856, 4145, 857, 4144, 858, 4143, 859, 4142, 860, 4141, 861, 4140, 862, 4139, 863, 4138, 864, 4137, 865, 4136, 866, 4135, 867, 4134, 868, 4133, 869, 4132, 870, 4131, 871, 4130, 872, 4129, 873, 4128, 874, 4127, 875, 4126, 876, 4125, 877, 4124, 878, 4123, 879, 4122, 880, 4121, 881, 4120, 882, 4119, 883, 4118, 884, 4117, 885, 4116, 886, 4115, 887, 4114, 888, 4113, 889, 4112, 890, 4111, 891, 4110, 892, 4109, 893, 4108, 894, 4107, 895, 4106, 896, 4105, 897, 4104, 898, 4103, 899, 4102, 900, 4101, 901, 4100, 902, 4099, 903, 4098, 904, 4097, 905, 4096, 906, 4095, 907, 4094, 908, 4093, 909, 4092, 910, 4091, 911, 4090, 912, 4089, 913, 4088, 914, 4087, 915, 4086, 916, 4085, 917, 4084, 918, 4083, 919, 4082, 920, 4081, 921, 4080, 922, 4079, 923, 4078, 924, 4077, 925, 4076, 926, 4075, 927, 4074, 928, 4073, 929, 4072, 930, 4071, 931, 4070, 932, 4069, 933, 4068, 934, 4067, 935, 4066, 936, 4065, 937, 4064, 938, 4063, 939, 4062, 940, 4061, 941, 4060, 942, 4059, 943, 4058, 944, 4057, 945, 4056, 946, 4055, 947, 4054, 948, 4053, 949, 4052, 950, 4051, 951, 4050, 952, 4049, 953, 4048, 954, 4047, 955, 4046, 956, 4045, 957, 4044, 958, 4043, 959, 4042, 960, 4041, 961, 4040, 962, 4039, 963, 4038, 964, 4037, 965, 4036, 966, 4035, 967, 4034, 968, 4033, 969, 4032, 970, 4031, 971, 4030, 972, 4029, 973, 4028, 974, 4027, 975, 4026, 976, 4025, 977, 4024, 978, 4023, 979, 4022, 980, 4021, 981, 4020, 982, 4019, 983, 4018, 984, 4017, 985, 4016, 986, 4015, 987, 4014, 988, 4013, 989, 4012, 990, 4011, 991, 4010, 992, 4009, 993, 4008, 994, 4007, 995, 4006, 996, 4005, 997, 4004, 998, 4003, 999, 4002, 1000, 4001, 1001, 4000, 1002, 3999, 1003, 3998, 1004, 3997, 1005, 3996, 1006, 3995, 1007, 3994, 1008, 3993, 1009, 3992, 1010, 3991, 1011, 3990, 1012, 3989, 1013, 3988, 1014, 3987, 1015, 3986, 1016, 3985, 1017, 3984, 1018, 3983, 1019, 3982, 1020, 3981, 1021, 3980, 1022, 3979, 1023, 3978, 1024, 3977, 1025, 3976, 1026, 3975, 1027, 3974, 1028, 3973, 1029, 3972, 1030, 3971, 1031, 3970, 1032, 3969, 1033, 3968, 1034, 3967, 1035, 3966, 1036, 3965, 1037, 3964, 1038, 3963, 1039, 3962, 1040, 3961, 1041, 3960, 1042, 3959, 1043, 3958, 1044, 3957, 1045, 3956, 1046, 3955, 1047, 3954, 1048, 3953, 1049, 3952, 1050, 3951, 1051, 3950, 1052, 3949, 1053, 3948, 1054, 3947, 1055, 3946, 1056, 3945, 1057, 3944, 1058, 3943, 1059, 3942, 1060, 3941, 1061, 3940, 1062, 3939, 1063, 3938, 1064, 3937, 1065, 3936, 1066, 3935, 1067, 3934, 1068, 3933, 1069, 3932, 1070, 3931, 1071, 3930, 1072, 3929, 1073, 3928, 1074, 3927, 1075, 3926, 1076, 3925, 1077, 3924, 1078, 3923, 1079, 3922, 1080, 3921, 1081, 3920, 1082, 3919, 1083, 3918, 1084, 3917, 1085, 3916, 1086, 3915, 1087, 3914, 1088, 3913, 1089, 3912, 1090, 3911, 1091, 3910, 1092, 3909, 1093, 3908, 1094, 3907, 1095, 3906, 1096, 3905, 1097, 3904, 1098, 3903, 1099, 3902, 1100, 3901, 1101, 3900, 1102, 3899, 1103, 3898, 1104, 3897, 1105, 3896, 1106, 3895, 1107, 3894, 1108, 3893, 1109, 3892, 1110, 3891, 1111, 3890, 1112, 3889, 1113, 3888, 1114, 3887, 1115, 3886, 1116, 3885, 1117, 3884, 1118, 3883, 1119, 3882, 1120, 3881, 1121, 3880, 1122, 3879, 1123, 3878, 1124, 3877, 1125, 3876, 1126, 3875, 1127, 3874, 1128, 3873, 1129, 3872, 1130, 3871, 1131, 3870, 1132, 3869, 1133, 3868, 1134, 3867, 1135, 3866, 1136, 3865, 1137, 3864, 1138, 3863, 1139, 3862, 1140, 3861, 1141, 3860, 1142, 3859, 1143, 3858, 1144, 3857, 1145, 3856, 1146, 3855, 1147, 3854, 1148, 3853, 1149, 3852, 1150, 3851, 1151, 3850, 1152, 3849, 1153, 3848, 1154, 3847, 1155, 3846, 1156, 3845, 1157, 3844, 1158, 3843, 1159, 3842, 1160, 3841, 1161, 3840, 1162, 3839, 1163, 3838, 1164, 3837, 1165, 3836, 1166, 3835, 1167, 3834, 1168, 3833, 1169, 3832, 1170, 3831, 1171, 3830, 1172, 3829, 1173, 3828, 1174, 3827, 1175, 3826, 1176, 3825, 1177, 3824, 1178, 3823, 1179, 3822, 1180, 3821, 1181, 3820, 1182, 3819, 1183, 3818, 1184, 3817, 1185, 3816, 1186, 3815, 1187, 3814, 1188, 3813, 1189, 3812, 1190, 3811, 1191, 3810, 1192, 3809, 1193, 3808, 1194, 3807, 1195, 3806, 1196, 3805, 1197, 3804, 1198, 3803, 1199, 3802, 1200, 3801, 1201, 3800, 1202, 3799, 1203, 3798, 1204, 3797, 1205, 3796, 1206, 3795, 1207, 3794, 1208, 3793, 1209, 3792, 1210, 3791, 1211, 3790, 1212, 3789, 1213, 3788, 1214, 3787, 1215, 3786, 1216, 3785, 1217, 3784, 1218, 3783, 1219, 3782, 1220, 3781, 1221, 3780, 1222, 3779, 1223, 3778, 1224, 3777, 1225, 3776, 1226, 3775, 1227, 3774, 1228, 3773, 1229, 3772, 1230, 3771, 1231, 3770, 1232, 3769, 1233, 3768, 1234, 3767, 1235, 3766, 1236, 3765, 1237, 3764, 1238, 3763, 1239, 3762, 1240, 3761, 1241, 3760, 1242, 3759, 1243, 3758, 1244, 3757, 1245, 3756, 1246, 3755, 1247, 3754, 1248, 3753, 1249, 3752, 1250, 3751, 3750, 3749, 3748, 3747, 3746, 3745, 3744, 3743, 3742, 3741, 3740, 3739, 3738, 3737, 3736, 3735, 3734, 3733, 3732, 3731, 3730, 3729, 3728, 3727, 3726, 3725, 3724, 3723, 3722, 3721, 3720, 3719, 3718, 3717, 3716, 3715, 3714, 3713, 3712, 3711, 3710, 3709, 3708, 3707, 3706, 3705, 3704, 3703, 3702, 3701, 3700, 3699, 3698, 3697, 3696, 3695, 3694, 3693, 3692, 3691, 3690, 3689, 3688, 3687, 3686, 3685, 3684, 3683, 3682, 3681, 3680, 3679, 3678, 3677, 3676, 3675, 3674, 3673, 3672, 3671, 3670, 3669, 3668, 3667, 3666, 3665, 3664, 3663, 3662, 3661, 3660, 3659, 3658, 3657, 3656, 3655, 3654, 3653, 3652, 3651, 3650, 3649, 3648, 3647, 3646, 3645, 3644, 3643, 3642, 3641, 3640, 3639, 3638, 3637, 3636, 3635, 3634, 3633, 3632, 3631, 3630, 3629, 3628, 3627, 3626, 3625, 3624, 3623, 3622, 3621, 3620, 3619, 3618, 3617, 3616, 3615, 3614, 3613, 3612, 3611, 3610, 3609, 3608, 3607, 3606, 3605, 3604, 3603, 3602, 3601, 3600, 3599, 3598, 3597, 3596, 3595, 3594, 3593, 3592, 3591, 3590, 3589, 3588, 3587, 3586, 3585, 3584, 3583, 3582, 3581, 3580, 3579, 3578, 3577, 3576, 3575, 3574, 3573, 3572, 3571, 3570, 3569, 3568, 3567, 3566, 3565, 3564, 3563, 3562, 3561, 3560, 3559, 3558, 3557, 3556, 3555, 3554, 3553, 3552, 3551, 3550, 3549, 3548, 3547, 3546, 3545, 3544, 3543, 3542, 3541, 3540, 3539, 3538, 3537, 3536, 3535, 3534, 3533, 3532, 3531, 3530, 3529, 3528, 3527, 3526, 3525, 3524, 3523, 3522, 3521, 3520, 3519, 3518, 3517, 3516, 3515, 3514, 3513, 3512, 3511, 3510, 3509, 3508, 3507, 3506, 3505, 3504, 3503, 3502, 3501, 3500, 3499, 3498, 3497, 3496, 3495, 3494, 3493, 3492, 3491, 3490, 3489, 3488, 3487, 3486, 3485, 3484, 3483, 3482, 3481, 3480, 3479, 3478, 3477, 3476, 3475, 3474, 3473, 3472, 3471, 3470, 3469, 3468, 3467, 3466, 3465, 3464, 3463, 3462, 3461, 3460, 3459, 3458, 3457, 3456, 3455, 3454, 3453, 3452, 3451, 3450, 3449, 3448, 3447, 3446, 3445, 3444, 3443, 3442, 3441, 3440, 3439, 3438, 3437, 3436, 3435, 3434, 3433, 3432, 3431, 3430, 3429, 3428, 3427, 3426, 3425, 3424, 3423, 3422, 3421, 3420, 3419, 3418, 3417, 3416, 3415, 3414, 3413, 3412, 3411, 3410, 3409, 3408, 3407, 3406, 3405, 3404, 3403, 3402, 3401, 3400, 3399, 3398, 3397, 3396, 3395, 3394, 3393, 3392, 3391, 3390, 3389, 3388, 3387, 3386, 3385, 3384, 3383, 3382, 3381, 3380, 3379, 3378, 3377, 3376, 3375, 3374, 3373, 3372, 3371, 3370, 3369, 3368, 3367, 3366, 3365, 3364, 3363, 3362, 3361, 3360, 3359, 3358, 3357, 3356, 3355, 3354, 3353, 3352, 3351, 3350, 3349, 3348, 3347, 3346, 3345, 3344, 3343, 3342, 3341, 3340, 3339, 3338, 3337, 3336, 3335, 3334, 3333, 3332, 3331, 3330, 3329, 3328, 3327, 3326, 3325, 3324, 3323, 3322, 3321, 3320, 3319, 3318, 3317, 3316, 3315, 3314, 3313, 3312, 3311, 3310, 3309, 3308, 3307, 3306, 3305, 3304, 3303, 3302, 3301, 3300, 3299, 3298, 3297, 3296, 3295, 3294, 3293, 3292, 3291, 3290, 3289, 3288, 3287, 3286, 3285, 3284, 3283, 3282, 3281, 3280, 3279, 3278, 3277, 3276, 3275, 3274, 3273, 3272, 3271, 3270, 3269, 3268, 3267, 3266, 3265, 3264, 3263, 3262, 3261, 3260, 3259, 3258, 3257, 3256, 3255, 3254, 3253, 3252, 3251, 3250, 3249, 3248, 3247, 3246, 3245, 3244, 3243, 3242, 3241, 3240, 3239, 3238, 3237, 3236, 3235, 3234, 3233, 3232, 3231, 3230, 3229, 3228, 3227, 3226, 3225, 3224, 3223, 3222, 3221, 3220, 3219, 3218, 3217, 3216, 3215, 3214, 3213, 3212, 3211, 3210, 3209, 3208, 3207, 3206, 3205, 3204, 3203, 3202, 3201, 3200, 3199, 3198, 3197, 3196, 3195, 3194, 3193, 3192, 3191, 3190, 3189, 3188, 3187, 3186, 3185, 3184, 3183, 3182, 3181, 3180, 3179, 3178, 3177, 3176, 3175, 3174, 3173, 3172, 3171, 3170, 3169, 3168, 3167, 3166, 3165, 3164, 3163, 3162, 3161, 3160, 3159, 3158, 3157, 3156, 3155, 3154, 3153, 3152, 3151, 3150, 3149, 3148, 3147, 3146, 3145, 3144, 3143, 3142, 3141, 3140, 3139, 3138, 3137, 3136, 3135, 3134, 3133, 3132, 3131, 3130, 3129, 3128, 3127, 3126, 3125, 3124, 3123, 3122, 3121, 3120, 3119, 3118, 3117, 3116, 3115, 3114, 3113, 3112, 3111, 3110, 3109, 3108, 3107, 3106, 3105, 3104, 3103, 3102, 3101, 3100, 3099, 3098, 3097, 3096, 3095, 3094, 3093, 3092, 3091, 3090, 3089, 3088, 3087, 3086, 3085, 3084, 3083, 3082, 3081, 3080, 3079, 3078, 3077, 3076, 3075, 3074, 3073, 3072, 3071, 3070, 3069, 3068, 3067, 3066, 3065, 3064, 3063, 3062, 3061, 3060, 3059, 3058, 3057, 3056, 3055, 3054, 3053, 3052, 3051, 3050, 3049, 3048, 3047, 3046, 3045, 3044, 3043, 3042, 3041, 3040, 3039, 3038, 3037, 3036, 3035, 3034, 3033, 3032, 3031, 3030, 3029, 3028, 3027, 3026, 3025, 3024, 3023, 3022, 3021, 3020, 3019, 3018, 3017, 3016, 3015, 3014, 3013, 3012, 3011, 3010, 3009, 3008, 3007, 3006, 3005, 3004, 3003, 3002, 3001, 3000, 2999, 2998, 2997, 2996, 2995, 2994, 2993, 2992, 2991, 2990, 2989, 2988, 2987, 2986, 2985, 2984, 2983, 2982, 2981, 2980, 2979, 2978, 2977, 2976, 2975, 2974, 2973, 2972, 2971, 2970, 2969, 2968, 2967, 2966, 2965, 2964, 2963, 2962, 2961, 2960, 2959, 2958, 2957, 2956, 2955, 2954, 2953, 2952, 2951, 2950, 2949, 2948, 2947, 2946, 2945, 2944, 2943, 2942, 2941, 2940, 2939, 2938, 2937, 2936, 2935, 2934, 2933, 2932, 2931, 2930, 2929, 2928, 2927, 2926, 2925, 2924, 2923, 2922, 2921, 2920, 2919, 2918, 2917, 2916, 2915, 2914, 2913, 2912, 2911, 2910, 2909, 2908, 2907, 2906, 2905, 2904, 2903, 2902, 2901, 2900, 2899, 2898, 2897, 2896, 2895, 2894, 2893, 2892, 2891, 2890, 2889, 2888, 2887, 2886, 2885, 2884, 2883, 2882, 2881, 2880, 2879, 2878, 2877, 2876, 2875, 2874, 2873, 2872, 2871, 2870, 2869, 2868, 2867, 2866, 2865, 2864, 2863, 2862, 2861, 2860, 2859, 2858, 2857, 2856, 2855, 2854, 2853, 2852, 2851, 2850, 2849, 2848, 2847, 2846, 2845, 2844, 2843, 2842, 2841, 2840, 2839, 2838, 2837, 2836, 2835, 2834, 2833, 2832, 2831, 2830, 2829, 2828, 2827, 2826, 2825, 2824, 2823, 2822, 2821, 2820, 2819, 2818, 2817, 2816, 2815, 2814, 2813, 2812, 2811, 2810, 2809, 2808, 2807, 2806, 2805, 2804, 2803, 2802, 2801, 2800, 2799, 2798, 2797, 2796, 2795, 2794, 2793, 2792, 2791, 2790, 2789, 2788, 2787, 2786, 2785, 2784, 2783, 2782, 2781, 2780, 2779, 2778, 2777, 2776, 2775, 2774, 2773, 2772, 2771, 2770, 2769, 2768, 2767, 2766, 2765, 2764, 2763, 2762, 2761, 2760, 2759, 2758, 2757, 2756, 2755, 2754, 2753, 2752, 2751, 2750, 2749, 2748, 2747, 2746, 2745, 2744, 2743, 2742, 2741, 2740, 2739, 2738, 2737, 2736, 2735, 2734, 2733, 2732, 2731, 2730, 2729, 2728, 2727, 2726, 2725, 2724, 2723, 2722, 2721, 2720, 2719, 2718, 2717, 2716, 2715, 2714, 2713, 2712, 2711, 2710, 2709, 2708, 2707, 2706, 2705, 2704, 2703, 2702, 2701, 2700, 2699, 2698, 2697, 2696, 2695, 2694, 2693, 2692, 2691, 2690, 2689, 2688, 2687, 2686, 2685, 2684, 2683, 2682, 2681, 2680, 2679, 2678, 2677, 2676, 2675, 2674, 2673, 2672, 2671, 2670, 2669, 2668, 2667, 2666, 2665, 2664, 2663, 2662, 2661, 2660, 2659, 2658, 2657, 2656, 2655, 2654, 2653, 2652, 2651, 2650, 2649, 2648, 2647, 2646, 2645, 2644, 2643, 2642, 2641, 2640, 2639, 2638, 2637, 2636, 2635, 2634, 2633, 2632, 2631, 2630, 2629, 2628, 2627, 2626, 2625, 2624, 2623, 2622, 2621, 2620, 2619, 2618, 2617, 2616, 2615, 2614, 2613, 2612, 2611, 2610, 2609, 2608, 2607, 2606, 2605, 2604, 2603, 2602, 2601, 2600, 2599, 2598, 2597, 2596, 2595, 2594, 2593, 2592, 2591, 2590, 2589, 2588, 2587, 2586, 2585, 2584, 2583, 2582, 2581, 2580, 2579, 2578, 2577, 2576, 2575, 2574, 2573, 2572, 2571, 2570, 2569, 2568, 2567, 2566, 2565, 2564, 2563, 2562, 2561, 2560, 2559, 2558, 2557, 2556, 2555, 2554, 2553, 2552, 2551, 2550, 2549, 2548, 2547, 2546, 2545, 2544, 2543, 2542, 2541, 2540, 2539, 2538, 2537, 2536, 2535, 2534, 2533, 2532, 2531, 2530, 2529, 2528, 2527, 2526, 2525, 2524, 2523, 2522, 2521, 2520, 2519, 2518, 2517, 2516, 2515, 2514, 2513, 2512, 2511, 2510, 2509, 2508, 2507, 2506, 2505, 2504, 2503, 2502, 2501, 2500, 2499, 2498, 2497, 2496, 2495, 2494, 2493, 2492, 2491, 2490, 2489, 2488, 2487, 2486, 2485, 2484, 2483, 2482, 2481, 2480, 2479, 2478, 2477, 2476, 2475, 2474, 2473, 2472, 2471, 2470, 2469, 2468, 2467, 2466, 2465, 2464, 2463, 2462, 2461, 2460, 2459, 2458, 2457, 2456, 2455, 2454, 2453, 2452, 2451, 2450, 2449, 2448, 2447, 2446, 2445, 2444, 2443, 2442, 2441, 2440, 2439, 2438, 2437, 2436, 2435, 2434, 2433, 2432, 2431, 2430, 2429, 2428, 2427, 2426, 2425, 2424, 2423, 2422, 2421, 2420, 2419, 2418, 2417, 2416, 2415, 2414, 2413, 2412, 2411, 2410, 2409, 2408, 2407, 2406, 2405, 2404, 2403, 2402, 2401, 2400, 2399, 2398, 2397, 2396, 2395, 2394, 2393, 2392, 2391, 2390, 2389, 2388, 2387, 2386, 2385, 2384, 2383, 2382, 2381, 2380, 2379, 2378, 2377, 2376, 2375, 2374, 2373, 2372, 2371, 2370, 2369, 2368, 2367, 2366, 2365, 2364, 2363, 2362, 2361, 2360, 2359, 2358, 2357, 2356, 2355, 2354, 2353, 2352, 2351, 2350, 2349, 2348, 2347, 2346, 2345, 2344, 2343, 2342, 2341, 2340, 2339, 2338, 2337, 2336, 2335, 2334, 2333, 2332, 2331, 2330, 2329, 2328, 2327, 2326, 2325, 2324, 2323, 2322, 2321, 2320, 2319, 2318, 2317, 2316, 2315, 2314, 2313, 2312, 2311, 2310, 2309, 2308, 2307, 2306, 2305, 2304, 2303, 2302, 2301, 2300, 2299, 2298, 2297, 2296, 2295, 2294, 2293, 2292, 2291, 2290, 2289, 2288, 2287, 2286, 2285, 2284, 2283, 2282, 2281, 2280, 2279, 2278, 2277, 2276, 2275, 2274, 2273, 2272, 2271, 2270, 2269, 2268, 2267, 2266, 2265, 2264, 2263, 2262, 2261, 2260, 2259, 2258, 2257, 2256, 2255, 2254, 2253, 2252, 2251, 2250, 2249, 2248, 2247, 2246, 2245, 2244, 2243, 2242, 2241, 2240, 2239, 2238, 2237, 2236, 2235, 2234, 2233, 2232, 2231, 2230, 2229, 2228, 2227, 2226, 2225, 2224, 2223, 2222, 2221, 2220, 2219, 2218, 2217, 2216, 2215, 2214, 2213, 2212, 2211, 2210, 2209, 2208, 2207, 2206, 2205, 2204, 2203, 2202, 2201, 2200, 2199, 2198, 2197, 2196, 2195, 2194, 2193, 2192, 2191, 2190, 2189, 2188, 2187, 2186, 2185, 2184, 2183, 2182, 2181, 2180, 2179, 2178, 2177, 2176, 2175, 2174, 2173, 2172, 2171, 2170, 2169, 2168, 2167, 2166, 2165, 2164, 2163, 2162, 2161, 2160, 2159, 2158, 2157, 2156, 2155, 2154, 2153, 2152, 2151, 2150, 2149, 2148, 2147, 2146, 2145, 2144, 2143, 2142, 2141, 2140, 2139, 2138, 2137, 2136, 2135, 2134, 2133, 2132, 2131, 2130, 2129, 2128, 2127, 2126, 2125, 2124, 2123, 2122, 2121, 2120, 2119, 2118, 2117, 2116, 2115, 2114, 2113, 2112, 2111, 2110, 2109, 2108, 2107, 2106, 2105, 2104, 2103, 2102, 2101, 2100, 2099, 2098, 2097, 2096, 2095, 2094, 2093, 2092, 2091, 2090, 2089, 2088, 2087, 2086, 2085, 2084, 2083, 2082, 2081, 2080, 2079, 2078, 2077, 2076, 2075, 2074, 2073, 2072, 2071, 2070, 2069, 2068, 2067, 2066, 2065, 2064, 2063, 2062, 2061, 2060, 2059, 2058, 2057, 2056, 2055, 2054, 2053, 2052, 2051, 2050, 2049, 2048, 2047, 2046, 2045, 2044, 2043, 2042, 2041, 2040, 2039, 2038, 2037, 2036, 2035, 2034, 2033, 2032, 2031, 2030, 2029, 2028, 2027, 2026, 2025, 2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970, 1969, 1968, 1967, 1966, 1965, 1964, 1963, 1962, 1961, 1960, 1959, 1958, 1957, 1956, 1955, 1954, 1953, 1952, 1951, 1950, 1949, 1948, 1947, 1946, 1945, 1944, 1943, 1942, 1941, 1940, 1939, 1938, 1937, 1936, 1935, 1934, 1933, 1932, 1931, 1930, 1929, 1928, 1927, 1926, 1925, 1924, 1923, 1922, 1921, 1920, 1919, 1918, 1917, 1916, 1915, 1914, 1913, 1912, 1911, 1910, 1909, 1908, 1907, 1906, 1905, 1904, 1903, 1902, 1901, 1900, 1899, 1898, 1897, 1896, 1895, 1894, 1893, 1892, 1891, 1890, 1889, 1888, 1887, 1886, 1885, 1884, 1883, 1882, 1881, 1880, 1879, 1878, 1877, 1876, 1875, 1874, 1873, 1872, 1871, 1870, 1869, 1868, 1867, 1866, 1865, 1864, 1863, 1862, 1861, 1860, 1859, 1858, 1857, 1856, 1855, 1854, 1853, 1852, 1851, 1850, 1849, 1848, 1847, 1846, 1845, 1844, 1843, 1842, 1841, 1840, 1839, 1838, 1837, 1836, 1835, 1834, 1833, 1832, 1831, 1830, 1829, 1828, 1827, 1826, 1825, 1824, 1823, 1822, 1821, 1820, 1819, 1818, 1817, 1816, 1815, 1814, 1813, 1812, 1811, 1810, 1809, 1808, 1807, 1806, 1805, 1804, 1803, 1802, 1801, 1800, 1799, 1798, 1797, 1796, 1795, 1794, 1793, 1792, 1791, 1790, 1789, 1788, 1787, 1786, 1785, 1784, 1783, 1782, 1781, 1780, 1779, 1778, 1777, 1776, 1775, 1774, 1773, 1772, 1771, 1770, 1769, 1768, 1767, 1766, 1765, 1764, 1763, 1762, 1761, 1760, 1759, 1758, 1757, 1756, 1755, 1754, 1753, 1752, 1751, 1750, 1749, 1748, 1747, 1746, 1745, 1744, 1743, 1742, 1741, 1740, 1739, 1738, 1737, 1736, 1735, 1734, 1733, 1732, 1731, 1730, 1729, 1728, 1727, 1726, 1725, 1724, 1723, 1722, 1721, 1720, 1719, 1718, 1717, 1716, 1715, 1714, 1713, 1712, 1711, 1710, 1709, 1708, 1707, 1706, 1705, 1704, 1703, 1702, 1701, 1700, 1699, 1698, 1697, 1696, 1695, 1694, 1693, 1692, 1691, 1690, 1689, 1688, 1687, 1686, 1685, 1684, 1683, 1682, 1681, 1680, 1679, 1678, 1677, 1676, 1675, 1674, 1673, 1672, 1671, 1670, 1669, 1668, 1667, 1666, 1665, 1664, 1663, 1662, 1661, 1660, 1659, 1658, 1657, 1656, 1655, 1654, 1653, 1652, 1651, 1650, 1649, 1648, 1647, 1646, 1645, 1644, 1643, 1642, 1641, 1640, 1639, 1638, 1637, 1636, 1635, 1634, 1633, 1632, 1631, 1630, 1629, 1628, 1627, 1626, 1625, 1624, 1623, 1622, 1621, 1620, 1619, 1618, 1617, 1616, 1615, 1614, 1613, 1612, 1611, 1610, 1609, 1608, 1607, 1606, 1605, 1604, 1603, 1602, 1601, 1600, 1599, 1598, 1597, 1596, 1595, 1594, 1593, 1592, 1591, 1590, 1589, 1588, 1587, 1586, 1585, 1584, 1583, 1582, 1581, 1580, 1579, 1578, 1577, 1576, 1575, 1574, 1573, 1572, 1571, 1570, 1569, 1568, 1567, 1566, 1565, 1564, 1563, 1562, 1561, 1560, 1559, 1558, 1557, 1556, 1555, 1554, 1553, 1552, 1551, 1550, 1549, 1548, 1547, 1546, 1545, 1544, 1543, 1542, 1541, 1540, 1539, 1538, 1537, 1536, 1535, 1534, 1533, 1532, 1531, 1530, 1529, 1528, 1527, 1526, 1525, 1524, 1523, 1522, 1521, 1520, 1519, 1518, 1517, 1516, 1515, 1514, 1513, 1512, 1511, 1510, 1509, 1508, 1507, 1506, 1505, 1504, 1503, 1502, 1501, 1500, 1499, 1498, 1497, 1496, 1495, 1494, 1493, 1492, 1491, 1490, 1489, 1488, 1487, 1486, 1485, 1484, 1483, 1482, 1481, 1480, 1479, 1478, 1477, 1476, 1475, 1474, 1473, 1472, 1471, 1470, 1469, 1468, 1467, 1466, 1465, 1464, 1463, 1462, 1461, 1460, 1459, 1458, 1457, 1456, 1455, 1454, 1453, 1452, 1451, 1450, 1449, 1448, 1447, 1446, 1445, 1444, 1443, 1442, 1441, 1440, 1439, 1438, 1437, 1436, 1435, 1434, 1433, 1432, 1431, 1430, 1429, 1428, 1427, 1426, 1425, 1424, 1423, 1422, 1421, 1420, 1419, 1418, 1417, 1416, 1415, 1414, 1413, 1412, 1411, 1410, 1409, 1408, 1407, 1406, 1405, 1404, 1403, 1402, 1401, 1400, 1399, 1398, 1397, 1396, 1395, 1394, 1393, 1392, 1391, 1390, 1389, 1388, 1387, 1386, 1385, 1384, 1383, 1382, 1381, 1380, 1379, 1378, 1377, 1376, 1375, 1374, 1373, 1372, 1371, 1370, 1369, 1368, 1367, 1366, 1365, 1364, 1363, 1362, 1361, 1360, 1359, 1358, 1357, 1356, 1355, 1354, 1353, 1352, 1351, 1350, 1349, 1348, 1347, 1346, 1345, 1344, 1343, 1342, 1341, 1340, 1339, 1338, 1337, 1336, 1335, 1334, 1333, 1332, 1331, 1330, 1329, 1328, 1327, 1326, 1325, 1324, 1323, 1322, 1321, 1320, 1319, 1318, 1317, 1316, 1315, 1314, 1313, 1312, 1311, 1310, 1309, 1308, 1307, 1306, 1305, 1304, 1303, 1302, 1301, 1300, 1299, 1298, 1297, 1296, 1295, 1294, 1293, 1292, 1291, 1290, 1289, 1288, 1287, 1286, 1285, 1284, 1283, 1282, 1281, 1280, 1279, 1278, 1277, 1276, 1275, 1274, 1273, 1272, 1271, 1270, 1269, 1268, 1267, 1266, 1265, 1264, 1263, 1262, 1261, 1260, 1259, 1258, 1257, 1256, 1255, 1254, 1253, 1252, 1251]\n assert candidate(n = 800,k = 400) == [1, 800, 2, 799, 3, 798, 4, 797, 5, 796, 6, 795, 7, 794, 8, 793, 9, 792, 10, 791, 11, 790, 12, 789, 13, 788, 14, 787, 15, 786, 16, 785, 17, 784, 18, 783, 19, 782, 20, 781, 21, 780, 22, 779, 23, 778, 24, 777, 25, 776, 26, 775, 27, 774, 28, 773, 29, 772, 30, 771, 31, 770, 32, 769, 33, 768, 34, 767, 35, 766, 36, 765, 37, 764, 38, 763, 39, 762, 40, 761, 41, 760, 42, 759, 43, 758, 44, 757, 45, 756, 46, 755, 47, 754, 48, 753, 49, 752, 50, 751, 51, 750, 52, 749, 53, 748, 54, 747, 55, 746, 56, 745, 57, 744, 58, 743, 59, 742, 60, 741, 61, 740, 62, 739, 63, 738, 64, 737, 65, 736, 66, 735, 67, 734, 68, 733, 69, 732, 70, 731, 71, 730, 72, 729, 73, 728, 74, 727, 75, 726, 76, 725, 77, 724, 78, 723, 79, 722, 80, 721, 81, 720, 82, 719, 83, 718, 84, 717, 85, 716, 86, 715, 87, 714, 88, 713, 89, 712, 90, 711, 91, 710, 92, 709, 93, 708, 94, 707, 95, 706, 96, 705, 97, 704, 98, 703, 99, 702, 100, 701, 101, 700, 102, 699, 103, 698, 104, 697, 105, 696, 106, 695, 107, 694, 108, 693, 109, 692, 110, 691, 111, 690, 112, 689, 113, 688, 114, 687, 115, 686, 116, 685, 117, 684, 118, 683, 119, 682, 120, 681, 121, 680, 122, 679, 123, 678, 124, 677, 125, 676, 126, 675, 127, 674, 128, 673, 129, 672, 130, 671, 131, 670, 132, 669, 133, 668, 134, 667, 135, 666, 136, 665, 137, 664, 138, 663, 139, 662, 140, 661, 141, 660, 142, 659, 143, 658, 144, 657, 145, 656, 146, 655, 147, 654, 148, 653, 149, 652, 150, 651, 151, 650, 152, 649, 153, 648, 154, 647, 155, 646, 156, 645, 157, 644, 158, 643, 159, 642, 160, 641, 161, 640, 162, 639, 163, 638, 164, 637, 165, 636, 166, 635, 167, 634, 168, 633, 169, 632, 170, 631, 171, 630, 172, 629, 173, 628, 174, 627, 175, 626, 176, 625, 177, 624, 178, 623, 179, 622, 180, 621, 181, 620, 182, 619, 183, 618, 184, 617, 185, 616, 186, 615, 187, 614, 188, 613, 189, 612, 190, 611, 191, 610, 192, 609, 193, 608, 194, 607, 195, 606, 196, 605, 197, 604, 198, 603, 199, 602, 200, 601, 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201]\n assert candidate(n = 50,k = 40) == [1, 50, 2, 49, 3, 48, 4, 47, 5, 46, 6, 45, 7, 44, 8, 43, 9, 42, 10, 41, 11, 40, 12, 39, 13, 38, 14, 37, 15, 36, 16, 35, 17, 34, 18, 33, 19, 32, 20, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21]\n assert candidate(n = 12,k = 6) == [1, 12, 2, 11, 3, 10, 9, 8, 7, 6, 5, 4]\n assert candidate(n = 99,k = 49) == [1, 99, 2, 98, 3, 97, 4, 96, 5, 95, 6, 94, 7, 93, 8, 92, 9, 91, 10, 90, 11, 89, 12, 88, 13, 87, 14, 86, 15, 85, 16, 84, 17, 83, 18, 82, 19, 81, 20, 80, 21, 79, 22, 78, 23, 77, 24, 76, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75]\n assert candidate(n = 20,k = 10) == [1, 20, 2, 19, 3, 18, 4, 17, 5, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6]\n assert candidate(n = 500,k = 250) == [1, 500, 2, 499, 3, 498, 4, 497, 5, 496, 6, 495, 7, 494, 8, 493, 9, 492, 10, 491, 11, 490, 12, 489, 13, 488, 14, 487, 15, 486, 16, 485, 17, 484, 18, 483, 19, 482, 20, 481, 21, 480, 22, 479, 23, 478, 24, 477, 25, 476, 26, 475, 27, 474, 28, 473, 29, 472, 30, 471, 31, 470, 32, 469, 33, 468, 34, 467, 35, 466, 36, 465, 37, 464, 38, 463, 39, 462, 40, 461, 41, 460, 42, 459, 43, 458, 44, 457, 45, 456, 46, 455, 47, 454, 48, 453, 49, 452, 50, 451, 51, 450, 52, 449, 53, 448, 54, 447, 55, 446, 56, 445, 57, 444, 58, 443, 59, 442, 60, 441, 61, 440, 62, 439, 63, 438, 64, 437, 65, 436, 66, 435, 67, 434, 68, 433, 69, 432, 70, 431, 71, 430, 72, 429, 73, 428, 74, 427, 75, 426, 76, 425, 77, 424, 78, 423, 79, 422, 80, 421, 81, 420, 82, 419, 83, 418, 84, 417, 85, 416, 86, 415, 87, 414, 88, 413, 89, 412, 90, 411, 91, 410, 92, 409, 93, 408, 94, 407, 95, 406, 96, 405, 97, 404, 98, 403, 99, 402, 100, 401, 101, 400, 102, 399, 103, 398, 104, 397, 105, 396, 106, 395, 107, 394, 108, 393, 109, 392, 110, 391, 111, 390, 112, 389, 113, 388, 114, 387, 115, 386, 116, 385, 117, 384, 118, 383, 119, 382, 120, 381, 121, 380, 122, 379, 123, 378, 124, 377, 125, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126]\n assert candidate(n = 50,k = 25) == [1, 50, 2, 49, 3, 48, 4, 47, 5, 46, 6, 45, 7, 44, 8, 43, 9, 42, 10, 41, 11, 40, 12, 39, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38]\n"}, "metadata": {"canonical_parameter_names": ["n", "k"], "leetcode_dataset_entry_point": "Solution().constructArray", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var constructArray = function(n, k) {", "container": null, "callable": "constructArray", "parameters": [{"name": "n", "type": "number"}, {"name": "k", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 668, "task_id": "kth-smallest-number-in-multiplication-table", "difficulty": "Hard", "problem_description": "Nearly everyone has used the Multiplication Table. The multiplication table of size m x n is an integer matrix mat where mat[i][j] == i * j (1-indexed).\nGiven three integers m, n, and k, return the kth smallest element in the m x n multiplication table.\n \nExample 1:\n\n\nInput: m = 3, n = 3, k = 5\nOutput: 3\nExplanation: The 5th smallest number is 3.\n\nExample 2:\n\n\nInput: m = 2, n = 3, k = 6\nOutput: 6\nExplanation: The 6th smallest number is 6.\n\n \nConstraints:\n\n1 <= m, n <= 3 * 104\n1 <= k <= m * n\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(m = 3,n = 3,k = 5) == 3\n assert candidate(m = 10,n = 10,k = 25) == 10\n assert candidate(m = 5,n = 5,k = 1) == 1\n assert candidate(m = 4,n = 4,k = 10) == 6\n assert candidate(m = 4,n = 4,k = 8) == 4\n assert candidate(m = 30000,n = 30000,k = 10000) == 1358\n assert candidate(m = 2,n = 3,k = 6) == 6\n assert candidate(m = 5,n = 6,k = 15) == 8\n assert candidate(m = 30000,n = 30000,k = 100) == 28\n assert candidate(m = 1,n = 1,k = 1) == 1\n assert candidate(m = 4,n = 4,k = 7) == 4\n assert candidate(m = 1,n = 30000,k = 15000) == 15000\n assert candidate(m = 1000,n = 1,k = 500) == 500\n assert candidate(m = 12345,n = 6789,k = 5000000) == 906384\n assert candidate(m = 12000,n = 12000,k = 71999999) == 26888084\n assert candidate(m = 9999,n = 9999,k = 99980001) == 99980001\n assert candidate(m = 10000,n = 10,k = 5000) == 1709\n assert candidate(m = 10,n = 1,k = 5) == 5\n assert candidate(m = 9999,n = 10000,k = 49995000) == 18671202\n assert candidate(m = 5000,n = 5000,k = 12500000) == 4669497\n assert candidate(m = 10,n = 10000,k = 5000) == 1709\n assert candidate(m = 15000,n = 15000,k = 11250000) == 1961750\n assert candidate(m = 10000,n = 10000,k = 50000000) == 18673076\n assert candidate(m = 8000,n = 8000,k = 39999999) == 17356893\n assert candidate(m = 7,n = 9,k = 45) == 27\n assert candidate(m = 10,n = 15,k = 45) == 18\n assert candidate(m = 25000,n = 25000,k = 6250000) == 821997\n assert candidate(m = 5000,n = 20000,k = 1000000) == 132820\n assert candidate(m = 10000,n = 15000,k = 2000000) == 275724\n assert candidate(m = 10000,n = 10000,k = 99999999) == 99990000\n assert candidate(m = 7,n = 7,k = 49) == 49\n assert candidate(m = 12345,n = 67890,k = 4567890) == 553668\n assert candidate(m = 300,n = 100,k = 28000) == 19899\n assert candidate(m = 7500,n = 2500,k = 18749999) == 18747500\n assert candidate(m = 1000,n = 30000,k = 2999900) == 617430\n assert candidate(m = 30000,n = 1,k = 29999) == 29999\n assert candidate(m = 200,n = 100,k = 19900) == 18145\n assert candidate(m = 250,n = 250,k = 12500) == 3210\n assert candidate(m = 1,n = 30000,k = 30000) == 30000\n assert candidate(m = 100,n = 50,k = 2500) == 969\n assert candidate(m = 30000,n = 1000,k = 2999900) == 617430\n assert candidate(m = 20000,n = 25000,k = 4000000) == 509960\n assert candidate(m = 30000,n = 25000,k = 7500000) == 986034\n assert candidate(m = 1,n = 10,k = 5) == 5\n assert candidate(m = 15000,n = 20000,k = 500000) == 53798\n assert candidate(m = 15000,n = 20000,k = 900000) == 102087\n assert candidate(m = 30000,n = 30000,k = 8999999) == 1182788\n assert candidate(m = 3000,n = 1000,k = 2999000) == 2925000\n assert candidate(m = 15000,n = 20000,k = 1500000) == 180253\n assert candidate(m = 8,n = 7,k = 28) == 14\n assert candidate(m = 2500,n = 2500,k = 3125000) == 1167987\n assert candidate(m = 10000,n = 10000,k = 100000000) == 100000000\n assert candidate(m = 30000,n = 1,k = 15000) == 15000\n assert candidate(m = 12345,n = 6789,k = 500000) == 62055\n assert candidate(m = 10000,n = 10000,k = 9999999) == 2047629\n assert candidate(m = 8000,n = 4000,k = 3199999) == 655946\n assert candidate(m = 30000,n = 15000,k = 449999999) == 449985000\n assert candidate(m = 7,n = 11,k = 45) == 24\n assert candidate(m = 15000,n = 15000,k = 5625000) == 858635\n assert candidate(m = 5000,n = 5000,k = 12345678) == 4578057\n assert candidate(m = 15000,n = 25000,k = 500000) == 52647\n assert candidate(m = 10,n = 10,k = 99) == 90\n assert candidate(m = 20000,n = 20000,k = 39999999) == 8185453\n assert candidate(m = 10000,n = 10000,k = 1) == 1\n assert candidate(m = 30,n = 30,k = 400) == 153\n assert candidate(m = 20000,n = 15000,k = 2999999) == 395392\n assert candidate(m = 20,n = 25,k = 400) == 234\n assert candidate(m = 2500,n = 7500,k = 9375000) == 3502712\n assert candidate(m = 5000,n = 5000,k = 1250000) == 218673\n assert candidate(m = 150,n = 200,k = 14999) == 5684\n assert candidate(m = 100,n = 50,k = 2499) == 968\n assert candidate(m = 12345,n = 6789,k = 83245678) == 74281625\n assert candidate(m = 100,n = 200,k = 10000) == 3807\n assert candidate(m = 25000,n = 25000,k = 12500000) == 1833387\n assert candidate(m = 7,n = 8,k = 28) == 14\n assert candidate(m = 7,n = 10,k = 50) == 30\n assert candidate(m = 10,n = 5,k = 20) == 10\n assert candidate(m = 50,n = 75,k = 2000) == 810\n assert candidate(m = 15000,n = 15000,k = 10000000) == 1701960\n assert candidate(m = 1,n = 30000,k = 25000) == 25000\n assert candidate(m = 1,n = 30000,k = 20000) == 20000\n assert candidate(m = 20000,n = 15000,k = 200000000) == 91383084\n assert candidate(m = 3000,n = 2500,k = 7499999) == 7497500\n assert candidate(m = 100,n = 100,k = 4950) == 1887\n assert candidate(m = 15,n = 20,k = 100) == 36\n assert candidate(m = 20000,n = 15000,k = 1000000) == 114741\n assert candidate(m = 15000,n = 15000,k = 1000000) == 118734\n assert candidate(m = 25000,n = 5000,k = 2000000) == 284382\n assert candidate(m = 30000,n = 30000,k = 9000000) == 1182788\n assert candidate(m = 30000,n = 1,k = 30000) == 30000\n assert candidate(m = 15000,n = 20000,k = 2999999) == 395392\n assert candidate(m = 500,n = 500,k = 125000) == 46917\n assert candidate(m = 100,n = 100,k = 5000) == 1917\n assert candidate(m = 100,n = 100,k = 4900) == 1856\n assert candidate(m = 1500,n = 2000,k = 1500000) == 560898\n"}, "metadata": {"canonical_parameter_names": ["m", "n", "k"], "leetcode_dataset_entry_point": "Solution().findKthNumber", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findKthNumber = function(m, n, k) {", "container": null, "callable": "findKthNumber", "parameters": [{"name": "m", "type": "number"}, {"name": "n", "type": "number"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 669, "task_id": "trim-a-binary-search-tree", "difficulty": "Medium", "problem_description": "Given the root of a binary search tree and the lowest and highest boundaries as low and high, trim the tree so that all its elements lies in [low, high]. Trimming the tree should not change the relative structure of the elements that will remain in the tree (i.e., any node's descendant should remain a descendant). It can be proven that there is a unique answer.\nReturn the root of the trimmed binary search tree. Note that the root may change depending on the given bounds.\n \nExample 1:\n\n\nInput: root = [1,0,2], low = 1, high = 2\nOutput: [1,null,2]\n\nExample 2:\n\n\nInput: root = [3,0,4,null,2,null,null,1], low = 1, high = 3\nOutput: [3,2,null,1]\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 104].\n0 <= Node.val <= 104\nThe value of each node in the tree is unique.\nroot is guaranteed to be a valid binary search tree.\n0 <= low <= high <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(root = tree_node([3, 1, 4, None, 2]),low = 1,high = 2), tree_node([1, None, 2]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, 8, 1, None, None, None, 7, 9]),low = 2,high = 8), tree_node([5, 3, 6, 2, 4, None, 8, None, None, None, None, 7]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, 7]),low = 3,high = 6), tree_node([5, 3, 6, None, 4]))\n assert is_same_tree(candidate(root = tree_node([3, 1, 4, None, 2]),low = 2,high = 4), tree_node([3, 2, 4]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, 7]),low = 2,high = 5), tree_node([5, 3, None, 2, 4]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4]),low = 3,high = 4), tree_node([3, None, 4]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13]),low = 5,high = 13), tree_node([8, 6, 10, None, 7, None, 13]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2]),low = 1,high = 1), tree_node([1]))\n assert candidate(root = tree_node([1, 2, None, 2, None, 3]),low = 2,high = 4) == None\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),low = 7,high = 15), tree_node([10, 7, 15]))\n assert is_same_tree(candidate(root = tree_node([1]),low = 1,high = 2), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 2, None, None, 0.5, 1.5]),low = 0.5,high = 1.5), tree_node([1, None, 0.5]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3]),low = 1,high = 2), tree_node([2, 1]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2]),low = 2,high = 2), tree_node([2]))\n assert is_same_tree(candidate(root = tree_node([3, 0, 4, None, 2, None, None, 1]),low = 1,high = 3), tree_node([3, 2, None, 1]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, 7]),low = 3,high = 5), tree_node([5, 3, None, None, 4]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 2]),low = 1,high = 2), tree_node([1, None, 2]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2]),low = 1,high = 3), tree_node([1, None, 2]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5]),low = 4,high = 5), tree_node([4, None, 5]))\n assert is_same_tree(candidate(root = tree_node([1, 3, 5, None, None, 2, 4]),low = 2,high = 4), tree_node([2]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, None, 1]),low = 2,high = 4), tree_node([3, 2, 4]))\n assert is_same_tree(candidate(root = tree_node([3, 1, 4, None, 2]),low = 3,high = 4), tree_node([3, None, 4]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3]),low = 3,high = 3), tree_node([3]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2]),low = 2,high = 4), tree_node([2]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 2, None, None, 1.5, 2.5]),low = 1,high = 2), tree_node([1, None, 2, 1.5]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 2, None, None, 1.5, 3]),low = 1,high = 2), tree_node([1, None, 2, 1.5]))\n assert is_same_tree(candidate(root = tree_node([2, None, 3]),low = 2,high = 2), tree_node([2]))\n assert candidate(root = tree_node([1, 2, 3, 4, 5]),low = 4,high = 5) == None\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4]),low = 3,high = 4), tree_node([3, None, 4]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5]),low = 3,high = 4), tree_node([3, None, 4]))\n assert candidate(root = tree_node([1]),low = 0,high = 0) == None\n"}, "metadata": {"canonical_parameter_names": ["root", "low", "high"], "leetcode_dataset_entry_point": "Solution().trimBST", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var trimBST = function(root, low, high) {", "container": null, "callable": "trimBST", "parameters": [{"name": "root", "type": "TreeNode"}, {"name": "low", "type": "number"}, {"name": "high", "type": "number"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 670, "task_id": "maximum-swap", "difficulty": "Medium", "problem_description": "You are given an integer num. You can swap two digits at most once to get the maximum valued number.\nReturn the maximum valued number you can get.\n \nExample 1:\n\nInput: num = 2736\nOutput: 7236\nExplanation: Swap the number 2 and the number 7.\n\nExample 2:\n\nInput: num = 9973\nOutput: 9973\nExplanation: No swap.\n\n \nConstraints:\n\n0 <= num <= 108\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(num = 9) == 9\n assert candidate(num = 987654321) == 987654321\n assert candidate(num = 123456789) == 923456781\n assert candidate(num = 12) == 21\n assert candidate(num = 21) == 21\n assert candidate(num = 0) == 0\n assert candidate(num = 98368) == 98863\n assert candidate(num = 1099511628) == 9091511628\n assert candidate(num = 11111) == 11111\n assert candidate(num = 1111) == 1111\n assert candidate(num = 9973) == 9973\n assert candidate(num = 1099511627776) == 9091511627776\n assert candidate(num = 1993) == 9913\n assert candidate(num = 100) == 100\n assert candidate(num = 2736) == 7236\n assert candidate(num = 1099511625) == 9091511625\n assert candidate(num = 567894321) == 967854321\n assert candidate(num = 654321789) == 954321786\n assert candidate(num = 33221100) == 33221100\n assert candidate(num = 98765456789) == 99765456788\n assert candidate(num = 1000000000) == 1000000000\n assert candidate(num = 199983) == 999183\n assert candidate(num = 5639953) == 9639553\n assert candidate(num = 123321321) == 323321121\n assert candidate(num = 9876554321) == 9876554321\n assert candidate(num = 12321) == 32121\n assert candidate(num = 101010101) == 111010100\n assert candidate(num = 900000000) == 900000000\n assert candidate(num = 109090909) == 909090901\n assert candidate(num = 222222221) == 222222221\n assert candidate(num = 9834321) == 9843321\n assert candidate(num = 199999) == 999991\n assert candidate(num = 98877665544332211) == 98877665544332211\n assert candidate(num = 4201) == 4210\n assert candidate(num = 111111119) == 911111111\n assert candidate(num = 32123) == 33122\n assert candidate(num = 583214769) == 983214765\n assert candidate(num = 319872654) == 913872654\n assert candidate(num = 333333) == 333333\n assert candidate(num = 891234567) == 981234567\n assert candidate(num = 22773388) == 82773382\n assert candidate(num = 111222333) == 311222331\n assert candidate(num = 98765) == 98765\n assert candidate(num = 1119111) == 9111111\n assert candidate(num = 111111112) == 211111111\n assert candidate(num = 999999990) == 999999990\n assert candidate(num = 2736589) == 9736582\n assert candidate(num = 109890) == 909810\n assert candidate(num = 432109876) == 932104876\n assert candidate(num = 983476521) == 987436521\n assert candidate(num = 34521) == 54321\n assert candidate(num = 33333333) == 33333333\n assert candidate(num = 1098765432) == 9018765432\n assert candidate(num = 239187654) == 932187654\n assert candidate(num = 987654321987654321) == 997654321887654321\n assert candidate(num = 227368) == 827362\n assert candidate(num = 1122334455) == 5122334451\n assert candidate(num = 999999999) == 999999999\n assert candidate(num = 564999) == 964995\n assert candidate(num = 1000000) == 1000000\n assert candidate(num = 898989898) == 998989888\n assert candidate(num = 983210987) == 993210887\n assert candidate(num = 98769876) == 99768876\n assert candidate(num = 765432198) == 965432178\n assert candidate(num = 222222222) == 222222222\n assert candidate(num = 199321123) == 991321123\n assert candidate(num = 100000000) == 100000000\n assert candidate(num = 819293818) == 919283818\n assert candidate(num = 9876543210) == 9876543210\n assert candidate(num = 1999991) == 9999911\n assert candidate(num = 333333333) == 333333333\n assert candidate(num = 323232323) == 333232322\n assert candidate(num = 53142) == 54132\n assert candidate(num = 100100) == 110000\n assert candidate(num = 1000) == 1000\n assert candidate(num = 100000001) == 110000000\n assert candidate(num = 3333333) == 3333333\n assert candidate(num = 3456432) == 6453432\n assert candidate(num = 543210) == 543210\n assert candidate(num = 99999999) == 99999999\n assert candidate(num = 54321) == 54321\n assert candidate(num = 11234321) == 41231321\n assert candidate(num = 333322221111) == 333322221111\n assert candidate(num = 999999991) == 999999991\n assert candidate(num = 333321) == 333321\n assert candidate(num = 112233445566778899) == 912233445566778891\n assert candidate(num = 199999999) == 999999991\n assert candidate(num = 111122223333) == 311122223331\n assert candidate(num = 987654321000) == 987654321000\n assert candidate(num = 9834765) == 9874365\n assert candidate(num = 6789876) == 9786876\n assert candidate(num = 599432187) == 995432187\n assert candidate(num = 888888888) == 888888888\n assert candidate(num = 1234321) == 4231321\n assert candidate(num = 1111111111) == 1111111111\n assert candidate(num = 63879456) == 93876456\n assert candidate(num = 1928374655) == 9128374655\n assert candidate(num = 2333333333) == 3333333332\n assert candidate(num = 123321) == 323121\n assert candidate(num = 387654321) == 837654321\n assert candidate(num = 227362) == 722362\n assert candidate(num = 983210) == 983210\n assert candidate(num = 67899876) == 97896876\n assert candidate(num = 2376) == 7326\n assert candidate(num = 1234567890) == 9234567810\n assert candidate(num = 2345321) == 5342321\n assert candidate(num = 892736) == 982736\n assert candidate(num = 983215) == 985213\n assert candidate(num = 1234567899) == 9234567891\n assert candidate(num = 3339333) == 9333333\n assert candidate(num = 88988) == 98888\n assert candidate(num = 1234554321) == 5234514321\n assert candidate(num = 371698542) == 971638542\n assert candidate(num = 98765432100) == 98765432100\n assert candidate(num = 19932) == 99132\n assert candidate(num = 1000001) == 1100000\n assert candidate(num = 9832109876) == 9932108876\n assert candidate(num = 987654320) == 987654320\n assert candidate(num = 227349) == 927342\n"}, "metadata": {"canonical_parameter_names": ["num"], "leetcode_dataset_entry_point": "Solution().maximumSwap", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maximumSwap = function(num) {", "container": null, "callable": "maximumSwap", "parameters": [{"name": "num", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 671, "task_id": "second-minimum-node-in-a-binary-tree", "difficulty": "Easy", "problem_description": "Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. If the node has two sub-nodes, then this node's value is the smaller value among its two sub-nodes. More formally, the property root.val = min(root.left.val, root.right.val) always holds.\nGiven such a binary tree, you need to output the second minimum value in the set made of all the nodes' value in the whole tree.\nIf no such second minimum value exists, output -1 instead.\n \n \nExample 1:\n\n\nInput: root = [2,2,5,null,null,5,7]\nOutput: 5\nExplanation: The smallest value is 2, the second smallest value is 5.\n\nExample 2:\n\n\nInput: root = [2,2,2]\nOutput: -1\nExplanation: The smallest value is 2, but there isn't any second smallest value.\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 25].\n1 <= Node.val <= 231 - 1\nroot.val == min(root.left.val, root.right.val) for each internal node of the tree.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3])) == -1\n assert candidate(root = tree_node([6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6])) == -1\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5])) == -1\n assert candidate(root = tree_node([2, 2, 5, None, None, 5, 7])) == 5\n assert candidate(root = tree_node([5, 5, 6, 5, 6])) == 6\n assert candidate(root = tree_node([3, 3, 4, 3, 3, None, None, 3, None, None, None])) == 4\n assert candidate(root = tree_node([1, 1, 3, 1, 1, 3, 4])) == 3\n assert candidate(root = tree_node([2, 2, 2])) == -1\n assert candidate(root = tree_node([7, 7, 8, 7, 7, 7, 9])) == 8\n assert candidate(root = tree_node([10, 10, 15, 10, None, 11, 15])) == 11\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5])) == 5\n assert candidate(root = tree_node([3, 3, 5, 3, 3, 6, 7])) == 5\n assert candidate(root = tree_node([1, 1, 3, 1, 1, 3, 4, 3, 1])) == 3\n assert candidate(root = tree_node([5, 5, 5, 5, 5])) == -1\n assert candidate(root = tree_node([1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 3])) == 2\n assert candidate(root = tree_node([8, 8, 9, 8, 8, 10, 11, 8, None, None, 8, 9, None, 9, None, 11])) == 9\n assert candidate(root = tree_node([1, 1, 3, 1, 1, 4, 6, 1, 1, 1, 1, 5, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 3\n assert candidate(root = tree_node([8, 8, 9, 8, 8, 8, 10, 8, 8, None, None, 8, None, None, None, None, None, 8, None, None, None])) == 9\n assert candidate(root = tree_node([15, 15, 16, 15, 15, 15, 17, 15, 15, 15, 15, 15, 15, 15, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 19])) == 16\n assert candidate(root = tree_node([2, 2, 2, 2, 2, 3, 4, 2, 2, None, None, 2, 5, 2, 6, 2, 2, None, None, None, None, 2, 2, None, None, None, None, None, 2])) == 3\n assert candidate(root = tree_node([15, 15, 20, 15, 15, 25, 30, 15, 15, 15, 15, 35, 40, 15, 45])) == 20\n assert candidate(root = tree_node([8, 8, 9, 8, 8, 9, 10, 8, 8, 8, 8, 9, 9, 10, 11, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10])) == 9\n assert candidate(root = tree_node([1, 1, 4, 1, 1, 2, 5, 1, 1, None, None, 1, None, None, None, None, None, 1, None, None, None])) == 2\n assert candidate(root = tree_node([6, 6, 7, 6, 6, 8, 9, 6, 6, None, None, 6, 10, 6, 11, 6, 6, None, None, None, None, 6, 6, None, None, None, None, None, 6])) == 7\n assert candidate(root = tree_node([5, 5, 7, 5, 5, 8, 9, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])) == 7\n assert candidate(root = tree_node([1, 1, 3, 1, 1, 5, 7, 1, 1, 9, 11, 1, 1, 1, 1])) == 3\n assert candidate(root = tree_node([4, 4, 6, 4, 4, 7, 9, 4, 4, 4, 4, 4, 4, 4, 4])) == 6\n assert candidate(root = tree_node([2, 2, 3, 2, 2, 4, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2])) == 3\n assert candidate(root = tree_node([1, 1, 2, 1, 1, 3, 4, 1, 1, 5, 6])) == 2\n assert candidate(root = tree_node([10, 10, 15, 10, 10, 12, 20, 10, 10, None, None, 12, 13, None, None, 14, None, None])) == 12\n assert candidate(root = tree_node([11, 11, 12, 11, 11, 13, 14, 11, None, 11, 11, None, None, 12, None])) == 12\n assert candidate(root = tree_node([7, 7, 8, 7, 7, 9, 10, 7, 7, 7, 7, 7, 7, 7, 7])) == 8\n assert candidate(root = tree_node([9, 9, 12, 9, 9, 15, 18, 9, 9, 9, 9, 21, 24, 9, 27])) == 12\n assert candidate(root = tree_node([5, 5, 6, 5, 5, None, 5, 5, 5, None, 5, 5, 5, None, 5])) == 6\n assert candidate(root = tree_node([2, 2, 3, 2, 2, 3, 4, 2, 2, 2, 2, 3, 3, 4, 5])) == 3\n assert candidate(root = tree_node([3, 3, 4, 3, 3, 5, 6, 3, 3, None, None, 3, None, None, None, None, None, 3, None, None, None])) == 4\n assert candidate(root = tree_node([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])) == 5\n assert candidate(root = tree_node([1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 1, 2, 2, 2, 4])) == 2\n assert candidate(root = tree_node([9, 9, 10, 9, 9, 11, 12, 9, None, 9, 9, None, None, 10, None])) == 10\n assert candidate(root = tree_node([12, 12, 13, 12, 12, 14, 15, 12, None, 12, 12, None, None, 13, None])) == 13\n assert candidate(root = tree_node([6, 6, 7, 6, 6, 8, 9, 6, None, None, 6, 7, None, 7, None, 9])) == 7\n assert candidate(root = tree_node([5, 5, 10, 5, 5, 10, 15, 5, 5, 10, 15, 20, None, None, None, None, None, None])) == 10\n assert candidate(root = tree_node([5, 5, 6, 5, 5, 6, 7])) == 6\n assert candidate(root = tree_node([10, 10, 10, 10, 10, 10, 11, 10, 10, None, None, 10, 12, 10, 13])) == 11\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4])) == 4\n assert candidate(root = tree_node([6, 6, 8, 6, 6, 9, 11, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6])) == 8\n assert candidate(root = tree_node([6, 6, 9, 6, 6, 8, 9, 6, 6, 7, 8, 9, 10, 6, None, None, 6, None, None, 7, None, None, 8, None, None, 9, None, None, None])) == 7\n assert candidate(root = tree_node([8, 8, 9, 8, 8, 10, 11, 8, None, 8, 8, None, None, 9, None])) == 9\n assert candidate(root = tree_node([6, 6, 7, 6, 6, 7, 8, 6, 6, 6, 6, 7, 7, 8, 9])) == 7\n assert candidate(root = tree_node([9, 9, 10, 9, 9, 11, 12, 9, None, None, 9, 10, None, 10, None, 12, 9, None, 10])) == 10\n assert candidate(root = tree_node([1, 1, 2, 1, 1, 3, 4, 1, 1, 1, 1, 5, 6, 1, 7])) == 2\n assert candidate(root = tree_node([4, 4, 8, 4, 4, 7, 10, 4, 4, 5, 7, 8, 10, 4, None, None, 4, None, None, 5, None, None, 7, None, None, 8, None, None, None])) == 5\n assert candidate(root = tree_node([7, 7, 8, 7, 7, 8, 9, 7, None, None, 7, 8, None, 8, None])) == 8\n assert candidate(root = tree_node([7, 7, 8, 7, 7, 9, 10, 7, 7, 7, 7, 7, 7, 11, 12])) == 8\n assert candidate(root = tree_node([3, 3, 6, 3, 3, 7, 8, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3])) == 6\n assert candidate(root = tree_node([6, 6, 8, 6, 6, 10, 12, 6, 6, 6, 6, 14, 16, 6, 18])) == 8\n assert candidate(root = tree_node([1, 1, 3, 1, 1, 4, 5, 1, 1, 1, 1, 2, 6])) == 2\n assert candidate(root = tree_node([10, 10, 11, 10, 10, 10, 12, 10, 10, 10, 10, 10, 10, 10, 13])) == 11\n assert candidate(root = tree_node([4, 4, 5, 4, 4, 5, 6])) == 5\n assert candidate(root = tree_node([2, 2, 3, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 5])) == 3\n assert candidate(root = tree_node([3, 3, 6, 3, 3, 9, 12, 3, 3, 3, 3, 15, 18, 3, 21])) == 6\n assert candidate(root = tree_node([1, 1, 3, 1, 1, 2, 4, 1, 1, None, None, 1, None, None, None, None, None, 1, None, None, None])) == 2\n assert candidate(root = tree_node([6, 6, 7, 6, 6, 8, 9, 6, 6, 6, 6, 7, 7, 8, 10])) == 7\n assert candidate(root = tree_node([4, 4, 5, 4, 4, 4, 6, 4, 4, None, None, 4, None, None, None, None, None, 4, None, None, None])) == 5\n assert candidate(root = tree_node([9, 9, 10, 9, 9, 11, 12, 9, 9, 9, 9, 9, 9, 9, 9])) == 10\n assert candidate(root = tree_node([4, 4, 5, 4, 4, 6, 7, 4, 4, 4, 4, 5, 5, 6, 8])) == 5\n assert candidate(root = tree_node([6, 6, 7, 6, 6, 6, 8, 6, 6, None, None, 6, None, None, None, None, None, 6, None, None, None])) == 7\n assert candidate(root = tree_node([7, 7, 8, 7, 7, 9, 10, 7, 7, None, None, 7, 11, 7, 12, 7, None, None, None, None, 7])) == 8\n assert candidate(root = tree_node([7, 7, 8, 7, 7, 8, 9, 7, None, 7, 7, None, None, 8, None])) == 8\n assert candidate(root = tree_node([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4])) == -1\n assert candidate(root = tree_node([2, 2, 3, 2, 2, 4, 5, 2, 2, 2, 2, 6, 7, 2, 8])) == 3\n assert candidate(root = tree_node([4, 4, 7, 4, 4, 10, 14, 4, 4, 4, 4, 16, 20, 4, 24])) == 7\n assert candidate(root = tree_node([9, 9, 10, 9, 9, 11, 12, 9, 9, None, None, 9, 13, 9, 14, 9, 9, None, None, None, None, 9, 9, None, None, None, None, None, 9])) == 10\n assert candidate(root = tree_node([9, 9, 11, 9, 9, 12, 13, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9])) == 11\n assert candidate(root = tree_node([7, 7, 8, 7, 7, 9, 9, 7, 7, 7, 7, 7, 7, 7, 7])) == 8\n assert candidate(root = tree_node([9, 9, 10, 9, 9, 11, 12, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9])) == 10\n assert candidate(root = tree_node([8, 8, 10, 8, 8, 11, 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])) == 10\n assert candidate(root = tree_node([2, 2, 3, 2, 2, 4, 5, 2, 2, 2, 2, 2, 2, 2, 6])) == 3\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])) == -1\n assert candidate(root = tree_node([5, 5, 6, 5, 5, 7, 8, 5, 5, 9, 10, 5, 5, 11, 12])) == 6\n assert candidate(root = tree_node([10, 10, 11, 10, 10, 12, 13, 10, 10, 10, 10, 10, 10, 10, 10])) == 11\n assert candidate(root = tree_node([12, 12, 14, 12, 12, 15, 16, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12])) == 14\n assert candidate(root = tree_node([12, 12, 13, 12, 12, 14, 15, 12, None, None, 12, 13, None, 13, None, 15, 12, None, 13])) == 13\n assert candidate(root = tree_node([6, 6, 7, 6, 6, 7, 8, 6, 6, 6, 6, 7, 7, 9, 10])) == 7\n assert candidate(root = tree_node([10, 10, 15, 10, 10, 20, 20, 10, 10, 10, 10, 25, 30, 10, 10])) == 15\n assert candidate(root = tree_node([11, 11, 12, 11, 11, 13, 14, 11, None, None, 11, 12, None, 12, None, 14, 11, None, 12])) == 12\n assert candidate(root = tree_node([7, 7, 8, 7, 7, 7, 9, 7, 7, None, None, 7, 7, 7, 10])) == 8\n assert candidate(root = tree_node([9, 9, 10, 9, 9, 9, 11, 9, 9, None, None, 9, None, None, None, None, None, 9, None, None, None])) == 10\n assert candidate(root = tree_node([1, 1, 2, 1, 1, 2, 3])) == 2\n assert candidate(root = tree_node([7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8])) == 8\n assert candidate(root = tree_node([9, 9, 10, 9, 9, 10, 11, 9, 9, 10, 10, 10, 11, 11, 12])) == 10\n assert candidate(root = tree_node([1, 1, 2, 1, 1, 3, 3, 1, 1, 1, 1, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 2\n assert candidate(root = tree_node([8, 8, 9, 8, 8, 10, 11, 8, 8, 8, 8, 8, 8, 8, 8])) == 9\n assert candidate(root = tree_node([2, 2, 6, 2, 2, 6, 10, 2, 2, 6, 10, 14, 18, 2, 2, 6, 10, 14, 18, 22, None, None, None, None, None, None, None, None, None, None])) == 6\n assert candidate(root = tree_node([8, 8, 9, 8, 8, 10, 11, 8, 8, 8, 8, 12, 13, 8, 14])) == 9\n assert candidate(root = tree_node([1, 1, 2, 1, 1, 1, 3])) == 2\n assert candidate(root = tree_node([1, 1, 3, 1, 1, 3, 4, 1, None, 1, None, None, None, None, None])) == 3\n assert candidate(root = tree_node([4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 6, 7])) == 5\n assert candidate(root = tree_node([7, 7, 8, 7, 7, 8, 9, 7, 7, 8, 8, 8, 9, None, 9])) == 8\n assert candidate(root = tree_node([1, 1, 2, 1, 1, 1, 3, 1, 1, None, None, 1, None, None, None, None, None, 1, None, None, None])) == 2\n assert candidate(root = tree_node([5, 5, 6, 5, 5, 5, 7, 5, None, 5, 5, None, None, 5, None])) == 6\n assert candidate(root = tree_node([2, 2, 3, 2, 2, 4, 4, 2, 2, 2, 2, 5, 5, 5, 5])) == 3\n assert candidate(root = tree_node([8, 8, 12, 8, 8, 12, 14, 8, 8, 12, 14, 16, 18, 8, None, None, 8, None, None, None, None, None, None])) == 12\n assert candidate(root = tree_node([7, 7, 11, 7, 7, 11, 13, 7, 7, 11, 13, 17, 19, 7, None, None, 7, None, None, None, None, None, None])) == 11\n assert candidate(root = tree_node([10, 10, 11, 10, 10, 12, 13, 10, None, None, 10, 11, None, 11, None, 13])) == 11\n assert candidate(root = tree_node([10, 10, 11, 10, 10, 12, 13, 10, 10, 10, 10, 11, 11, 12, 14])) == 11\n assert candidate(root = tree_node([5, 5, 6, 5, 5, 7, 8, 5, None, None, 9, 10, 11])) == 6\n assert candidate(root = tree_node([3, 3, 4, 3, 3, 5, 6, 3, 3, None, None, None, None, None, None, 5])) == 4\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6])) == 6\n assert candidate(root = tree_node([12, 12, 13, 12, 12, 14, 15, 12, 12, 12, 12, 16, 17, 12, 18])) == 13\n assert candidate(root = tree_node([10, 10, 20, 10, 10, 10, 30, 10, 10, 10, 10, 10, 10, 40, 50])) == 20\n assert candidate(root = tree_node([4, 4, 5, 4, 4, 5, 6, 4, 4, None, None, None, None, 5])) == 5\n assert candidate(root = tree_node([5, 5, 6, 5, 5, 6, 7, 5, None, None, 5, 6, None, 6, None])) == 6\n assert candidate(root = tree_node([6, 6, 7, 6, 6, 8, 9, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 10])) == 7\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().findSecondMinimumValue", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findSecondMinimumValue = function(root) {", "container": null, "callable": "findSecondMinimumValue", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 672, "task_id": "bulb-switcher-ii", "difficulty": "Medium", "problem_description": "There is a room with n bulbs labeled from 1 to n that all are turned on initially, and four buttons on the wall. Each of the four buttons has a different functionality where:\n\nButton 1: Flips the status of all the bulbs.\nButton 2: Flips the status of all the bulbs with even labels (i.e., 2, 4, ...).\nButton 3: Flips the status of all the bulbs with odd labels (i.e., 1, 3, ...).\nButton 4: Flips the status of all the bulbs with a label j = 3k + 1 where k = 0, 1, 2, ... (i.e., 1, 4, 7, 10, ...).\n\nYou must make exactly presses button presses in total. For each press, you may pick any of the four buttons to press.\nGiven the two integers n and presses, return the number of different possible statuses after performing all presses button presses.\n \nExample 1:\n\nInput: n = 1, presses = 1\nOutput: 2\nExplanation: Status can be:\n- [off] by pressing button 1\n- [on] by pressing button 2\n\nExample 2:\n\nInput: n = 2, presses = 1\nOutput: 3\nExplanation: Status can be:\n- [off, off] by pressing button 1\n- [on, off] by pressing button 2\n- [off, on] by pressing button 3\n\nExample 3:\n\nInput: n = 3, presses = 1\nOutput: 4\nExplanation: Status can be:\n- [off, off, off] by pressing button 1\n- [off, on, off] by pressing button 2\n- [on, off, on] by pressing button 3\n- [off, on, on] by pressing button 4\n\n \nConstraints:\n\n1 <= n <= 1000\n0 <= presses <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 1,presses = 1) == 2\n assert candidate(n = 5,presses = 3) == 8\n assert candidate(n = 1000,presses = 1000) == 8\n assert candidate(n = 4,presses = 2) == 7\n assert candidate(n = 2,presses = 1) == 3\n assert candidate(n = 10,presses = 4) == 8\n assert candidate(n = 4,presses = 3) == 8\n assert candidate(n = 100,presses = 0) == 1\n assert candidate(n = 3,presses = 3) == 8\n assert candidate(n = 3,presses = 1) == 4\n assert candidate(n = 4,presses = 1) == 4\n assert candidate(n = 5,presses = 0) == 1\n assert candidate(n = 3,presses = 2) == 7\n assert candidate(n = 10,presses = 5) == 8\n assert candidate(n = 1000,presses = 0) == 1\n assert candidate(n = 2,presses = 2) == 4\n assert candidate(n = 10,presses = 6) == 8\n assert candidate(n = 15,presses = 5) == 8\n assert candidate(n = 100,presses = 10) == 8\n assert candidate(n = 2,presses = 0) == 1\n assert candidate(n = 5,presses = 1) == 4\n assert candidate(n = 15,presses = 6) == 8\n assert candidate(n = 6,presses = 6) == 8\n assert candidate(n = 65,presses = 5) == 8\n assert candidate(n = 10,presses = 2) == 7\n assert candidate(n = 1000,presses = 100) == 8\n assert candidate(n = 8,presses = 3) == 8\n assert candidate(n = 8,presses = 8) == 8\n assert candidate(n = 7,presses = 3) == 8\n assert candidate(n = 100,presses = 5) == 8\n assert candidate(n = 9,presses = 3) == 8\n assert candidate(n = 9,presses = 1) == 4\n assert candidate(n = 60,presses = 8) == 8\n assert candidate(n = 90,presses = 6) == 8\n assert candidate(n = 12,presses = 5) == 8\n assert candidate(n = 10,presses = 3) == 8\n assert candidate(n = 3,presses = 10) == 8\n assert candidate(n = 45,presses = 6) == 8\n assert candidate(n = 1,presses = 10) == 2\n assert candidate(n = 9,presses = 8) == 8\n assert candidate(n = 8,presses = 2) == 7\n assert candidate(n = 3,presses = 5) == 8\n assert candidate(n = 20,presses = 3) == 8\n assert candidate(n = 20,presses = 7) == 8\n assert candidate(n = 6,presses = 2) == 7\n assert candidate(n = 10,presses = 1) == 4\n assert candidate(n = 5,presses = 4) == 8\n assert candidate(n = 4,presses = 4) == 8\n assert candidate(n = 15,presses = 3) == 8\n assert candidate(n = 14,presses = 3) == 8\n assert candidate(n = 60,presses = 6) == 8\n assert candidate(n = 2,presses = 5) == 4\n assert candidate(n = 500,presses = 15) == 8\n assert candidate(n = 1,presses = 0) == 1\n assert candidate(n = 100,presses = 7) == 8\n assert candidate(n = 20,presses = 6) == 8\n assert candidate(n = 6,presses = 1) == 4\n assert candidate(n = 50,presses = 4) == 8\n assert candidate(n = 15,presses = 7) == 8\n assert candidate(n = 25,presses = 10) == 8\n assert candidate(n = 15,presses = 4) == 8\n assert candidate(n = 8,presses = 5) == 8\n assert candidate(n = 5,presses = 5) == 8\n assert candidate(n = 8,presses = 7) == 8\n assert candidate(n = 7,presses = 0) == 1\n assert candidate(n = 20,presses = 0) == 1\n assert candidate(n = 1,presses = 2) == 2\n assert candidate(n = 12,presses = 1) == 4\n assert candidate(n = 7,presses = 6) == 8\n assert candidate(n = 70,presses = 9) == 8\n assert candidate(n = 80,presses = 10) == 8\n assert candidate(n = 7,presses = 5) == 8\n assert candidate(n = 35,presses = 7) == 8\n assert candidate(n = 30,presses = 3) == 8\n assert candidate(n = 50,presses = 5) == 8\n assert candidate(n = 4,presses = 0) == 1\n assert candidate(n = 500,presses = 10) == 8\n assert candidate(n = 7,presses = 2) == 7\n assert candidate(n = 30,presses = 5) == 8\n assert candidate(n = 2,presses = 10) == 4\n assert candidate(n = 40,presses = 3) == 8\n assert candidate(n = 40,presses = 4) == 8\n assert candidate(n = 15,presses = 2) == 7\n assert candidate(n = 12,presses = 9) == 8\n assert candidate(n = 6,presses = 3) == 8\n assert candidate(n = 1000,presses = 1) == 4\n assert candidate(n = 7,presses = 4) == 8\n assert candidate(n = 20,presses = 2) == 7\n assert candidate(n = 20,presses = 4) == 8\n assert candidate(n = 3,presses = 0) == 1\n"}, "metadata": {"canonical_parameter_names": ["n", "presses"], "leetcode_dataset_entry_point": "Solution().flipLights", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var flipLights = function(n, presses) {", "container": null, "callable": "flipLights", "parameters": [{"name": "n", "type": "number"}, {"name": "presses", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 673, "task_id": "number-of-longest-increasing-subsequence", "difficulty": "Medium", "problem_description": "Given an integer array nums, return the number of longest increasing subsequences.\nNotice that the sequence has to be strictly increasing.\n \nExample 1:\n\nInput: nums = [1,3,5,4,7]\nOutput: 2\nExplanation: The two longest increasing subsequences are [1, 3, 4, 7] and [1, 3, 5, 7].\n\nExample 2:\n\nInput: nums = [2,2,2,2,2]\nOutput: 5\nExplanation: The length of the longest increasing subsequence is 1, and there are 5 increasing subsequences of length 1, so output 5.\n\n \nConstraints:\n\n1 <= nums.length <= 2000\n-106 <= nums[i] <= 106\nThe answer is guaranteed to fit inside a 32-bit integer.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [5, 4, 3, 2, 1]) == 5\n assert candidate(nums = [1]) == 1\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7]) == 7\n assert candidate(nums = [1, 2, 4, 3, 5, 4, 7, 2]) == 3\n assert candidate(nums = [1, 2]) == 1\n assert candidate(nums = [10, 9, 2, 5, 3, 7, 101, 18, 4, 6, 8, 10, 12]) == 1\n assert candidate(nums = [0, 1, 0, 3, 2, 3]) == 1\n assert candidate(nums = [1, 3, 5, 4, 7]) == 2\n assert candidate(nums = [10, 9, 2, 5, 3, 7, 101, 18]) == 4\n assert candidate(nums = [2, 1]) == 2\n assert candidate(nums = [2, 2, 2, 2, 2]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15]) == 256\n assert candidate(nums = [1, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11, 13, 12, 14, 13, 15]) == 1\n assert candidate(nums = [20, 20, 20, 20, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 25\n assert candidate(nums = [1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 10, 11, 10, 11, 12, 13, 12, 13, 14]) == 729\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9]) == 1093\n assert candidate(nums = [4, 10, 4, 3, 8, 9, 3, 4, 2, 6, 5, 3, 7, 2, 9, 8, 10, 3, 5, 7, 1, 9, 8, 4, 6, 10]) == 4\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(nums = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2]) == 26\n assert candidate(nums = [3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]) == 1\n assert candidate(nums = [1, 3, 5, 4, 7, 11, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 4\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 20\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 66\n assert candidate(nums = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 50\n assert candidate(nums = [1, 3, 5, 4, 7, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 1\n assert candidate(nums = [5, 4, 3, 2, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 5\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10]) == 8\n assert candidate(nums = [3, 1, 2, 4, 5, 6, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 6\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]) == 1\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]) == 81\n assert candidate(nums = [3, 2, 1, 5, 6, 4, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 3\n assert candidate(nums = [3, 5, 10, 25, 50, 2, 45, 51, 26, 76, 90, 100, 101]) == 2\n assert candidate(nums = [19, 11, 13, 15, 14, 12, 10, 18, 16, 17, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 2\n assert candidate(nums = [5, 7, 8, 10, 12, 2, 4, 6, 9, 11, 3, 5, 7]) == 4\n assert candidate(nums = [10, 22, 9, 33, 21, 50, 41, 60, 80, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums = [10, 9, 2, 5, 3, 7, 101, 18, 4, 6, 8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 1\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]) == 220\n assert candidate(nums = [3, 5, 7, 2, 5, 3, 5, 7, 9, 10]) == 1\n assert candidate(nums = [1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6]) == 1024\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 21\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 231\n assert candidate(nums = [7, 7, 7, 7, 1, 1, 1, 2, 2, 2, 3, 3, 3]) == 27\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 380\n assert candidate(nums = [5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1]) == 5\n assert candidate(nums = [10, 22, 9, 33, 21, 50, 41, 60, 80, 1, 100, 200, 300]) == 2\n assert candidate(nums = [10, 9, 2, 5, 3, 7, 101, 18, 4, 6, 8, 10, 12, 14, 16, 18, 20, 15, 17, 19, 21]) == 4\n assert candidate(nums = [4, 3, 5, 4, 7, 9, 8, 10, 12, 11, 13, 14]) == 12\n assert candidate(nums = [18, 55, 66, 2, 3, 54, 6, 5, 7, 99, 23, 45, 67, 89, 12, 34, 56, 78, 90]) == 10\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 20, 19, 18, 17, 16]) == 85\n assert candidate(nums = [3, 1, 2, 4, 10, 1, 12, 2, 5, 4, 5, 5, 5, 5, 5]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 1\n assert candidate(nums = [1, 2, 2, 2, 3, 4, 5, 6, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13]) == 72\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 30\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 10\n assert candidate(nums = [100000, 99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991, 99990, 99989, 99988, 99987, 99986, 99985, 99984, 99983, 99982, 99981]) == 20\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 82\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 6\n assert candidate(nums = [15, 27, 14, 33, 27, 18, 26, 30, 19, 10, 10, 28, 33, 17, 23, 21, 18, 22, 30, 29]) == 4\n assert candidate(nums = [5, 1, 4, 2, 3, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 45\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 36\n assert candidate(nums = [100, 90, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 11\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 300\n assert candidate(nums = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]) == 11\n assert candidate(nums = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12]) == 10\n assert candidate(nums = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 4, 5, 6, 7, 5, 6, 7, 8, 9, 7, 8, 9, 10, 11, 9, 10, 11, 12, 13]) == 209\n assert candidate(nums = [3, 5, 6, 2, 5, 4, 19, 5, 6, 7, 12]) == 2\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 1\n assert candidate(nums = [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 9\n assert candidate(nums = [2, 1, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2]) == 39\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 45\n assert candidate(nums = [1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 8, 7, 8, 9, 10, 11, 12, 11, 12]) == 81\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 1\n assert candidate(nums = [3, 5, 6, 2, 5, 4, 19, 5, 6, 7, 12]) == 2\n assert candidate(nums = [2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10]) == 1953125\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 11\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 1\n assert candidate(nums = [1, 4, 3, 5, 2, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == 2\n assert candidate(nums = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 1\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 120\n assert candidate(nums = [10, 9, 2, 5, 3, 7, 101, 18, 4, 6, 8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 1\n assert candidate(nums = [1, 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 3\n assert candidate(nums = [4, 10, 4, 3, 8, 9]) == 3\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 15\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 1\n assert candidate(nums = [4, 10, 4, 3, 8, 9]) == 3\n assert candidate(nums = [10, 22, 9, 33, 21, 50, 41, 60, 80, 1]) == 2\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 20\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 3000\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 21\n assert candidate(nums = [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 9\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 1\n assert candidate(nums = [5, 14, 3, 5, 8, 7, 9, 4, 11, 13, 2, 15, 1, 17]) == 2\n assert candidate(nums = [10, 20, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180]) == 3\n assert candidate(nums = [5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5]) == 55\n assert candidate(nums = [3, 1, 2, 4, 3, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().findNumberOfLIS", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findNumberOfLIS = function(nums) {", "container": null, "callable": "findNumberOfLIS", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 674, "task_id": "longest-continuous-increasing-subsequence", "difficulty": "Easy", "problem_description": "Given an unsorted array of integers nums, return the length of the longest continuous increasing subsequence (i.e. subarray). The subsequence must be strictly increasing.\nA continuous increasing subsequence is defined by two indices l and r (l < r) such that it is [nums[l], nums[l + 1], ..., nums[r - 1], nums[r]] and for each l <= i < r, nums[i] < nums[i + 1].\n \nExample 1:\n\nInput: nums = [1,3,5,4,7]\nOutput: 3\nExplanation: The longest continuous increasing subsequence is [1,3,5] with length 3.\nEven though [1,3,5,7] is an increasing subsequence, it is not continuous as elements 5 and 7 are separated by element\n4.\n\nExample 2:\n\nInput: nums = [2,2,2,2,2]\nOutput: 1\nExplanation: The longest continuous increasing subsequence is [2] with length 1. Note that it must be strictly\nincreasing.\n\n \nConstraints:\n\n1 <= nums.length <= 104\n-109 <= nums[i] <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15]) == 8\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 4, 5, 6, 7, 8, 12]) == 6\n assert candidate(nums = [0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6]) == 7\n assert candidate(nums = [10, 9, 2, 5, 3, 7, 101, 18]) == 3\n assert candidate(nums = [1]) == 1\n assert candidate(nums = [1, 3, 2, 4, 3, 5, 4, 6]) == 2\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7]) == 1\n assert candidate(nums = [1, 2, 2]) == 2\n assert candidate(nums = [1, 3, 5, 4, 7]) == 3\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5]) == 5\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 5, 6, 7]) == 4\n assert candidate(nums = [1, 2, 0, 3, 4, 5, 6, 7]) == 6\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1]) == 10\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 5, 6]) == 4\n assert candidate(nums = [1, 3, 2, 2, 3, 4, 5, 4, 3, 2, 1]) == 4\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 4, 5, 6, 7, 8]) == 6\n assert candidate(nums = [1, 2, 0, 3, 4, 5, 6, 7, 8, 9, 10]) == 9\n assert candidate(nums = [5, 4, 3, 2, 1]) == 1\n assert candidate(nums = [-1, 3, 2, 4, 5, 6, 7, 8, 9]) == 7\n assert candidate(nums = [1, 2]) == 2\n assert candidate(nums = [0, 1, 2, 3, -1, -2, -1, 0, 1, 2]) == 5\n assert candidate(nums = [0, 1, 0, 3, 2, 3]) == 2\n assert candidate(nums = [1, 2, 2, 3, 4, 1, 2, 3, 4, 5]) == 5\n assert candidate(nums = [1, 2, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3]) == 6\n assert candidate(nums = [1, 2, 0, 4, 5, 3, 6, 7]) == 3\n assert candidate(nums = [2, 2, 2, 2, 2]) == 1\n assert candidate(nums = [1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 8]) == 8\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3]) == 5\n assert candidate(nums = [1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7]) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums = [-10, 0, 10, 20, 30, 40, 50, 60, 70, 80]) == 10\n assert candidate(nums = [2, 1]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 12\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 5\n assert candidate(nums = [5, 4, 3, 2, 1, 0, -1, -2, -3, -4]) == 1\n assert candidate(nums = [1, 3, 5, 4, 7, 9, 11, 13, 12, 15, 17, 19, 21, 20, 22]) == 5\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums = []) == 1\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]) == 3\n assert candidate(nums = [5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8]) == 1\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 20\n assert candidate(nums = [1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 20\n assert candidate(nums = [1, 2, 0, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(nums = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10]) == 2\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 21\n assert candidate(nums = [1, 2, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums = [73, 74, 75, 71, 69, 72, 76, 73]) == 3\n assert candidate(nums = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80]) == 1\n assert candidate(nums = [23, 11, 56, 57, 58, 23, 24, 25, 26, 27, 28]) == 6\n assert candidate(nums = [1, 3, 5, 4, 7, 8, 9, 10, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 11\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 2\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 1\n assert candidate(nums = [1, 2]) == 2\n assert candidate(nums = [5, 7, 7, 8, 8, 9, 10, 9, 10, 11, 12, 13, 14]) == 6\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums = [1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17]) == 6\n assert candidate(nums = [5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 9\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(nums = [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 2\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 2\n assert candidate(nums = [1, 2, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 9\n assert candidate(nums = [1, 2, 3, 4, 3, 4, 5, 6, 5, 6, 7, 8, 7, 8, 9, 10, 9, 10, 11, 12]) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 25\n assert candidate(nums = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 15\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 40\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 15]) == 4\n assert candidate(nums = [100, 4, 200, 1, 3, 2, 150, 151, 152, 153]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(nums = [-1, -2, -3, -2, -1, 0, 1, 2, 3, 4, 5]) == 9\n assert candidate(nums = [1, 2, 3, 2, 3, 4, 5, 6, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 12\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 2\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 1\n assert candidate(nums = [5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums = [1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12]) == 3\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4]) == 15\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 30\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2]) == 7\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 10\n assert candidate(nums = [1, 3, 2, 3, 4, 5, 4, 6, 7, 8, 7, 9, 10]) == 4\n assert candidate(nums = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 12\n assert candidate(nums = [1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9]) == 6\n assert candidate(nums = [100, 98, 96, 94, 92, 90, 88, 86, 84, 82, 80, 78, 76, 74, 72]) == 1\n assert candidate(nums = [3, 3, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 30\n assert candidate(nums = [10, 9, 2, 5, 3, 7, 8, 9, 10, 1, 2, 3, 4, 5]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 15\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums = [1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8]) == 4\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 1\n assert candidate(nums = [1, 2, 3, 4, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6]) == 6\n assert candidate(nums = [1, 2, 3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]) == 34\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 2\n assert candidate(nums = [3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 9\n assert candidate(nums = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 15\n assert candidate(nums = [1000000000, 999999999, 1000000001, 1000000002, 1000000003, 1000000002, 1000000003]) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 5\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5]) == 20\n assert candidate(nums = [10, 9, 2, 5, 3, 7, 101, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 13\n assert candidate(nums = [1, 3, 5, 4, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 15\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 1\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 20\n assert candidate(nums = [100, 98, 96, 97, 95, 93, 94, 92, 90, 91, 89, 87, 88, 86, 84, 85, 83, 82, 81]) == 2\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1]) == 1\n assert candidate(nums = [1, 11, 2, 10, 4, 5, 2, 1]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15]) == 20\n assert candidate(nums = [5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1]) == 1\n assert candidate(nums = [1, 2, 3, 2, 1, 2, 3, 4, 3, 4, 5, 6, 7, 8, 7, 8, 9, 10]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 30\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums = [99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123]) == 25\n assert candidate(nums = [4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 1\n assert candidate(nums = [1000000000, -1000000000, 1000000000, -1000000000, 1000000000, -1000000000]) == 2\n assert candidate(nums = [5, 4, 3, 2, 1, 0]) == 1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 1\n assert candidate(nums = [10, 9, 2, 5, 3, 7, 101, 18]) == 3\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().findLengthOfLCIS", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findLengthOfLCIS = function(nums) {", "container": null, "callable": "findLengthOfLCIS", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 675, "task_id": "cut-off-trees-for-golf-event", "difficulty": "Hard", "problem_description": "You are asked to cut off all the trees in a forest for a golf event. The forest is represented as an m x n matrix. In this matrix:\n\n0 means the cell cannot be walked through.\n1 represents an empty cell that can be walked through.\nA number greater than 1 represents a tree in a cell that can be walked through, and this number is the tree's height.\n\nIn one step, you can walk in any of the four directions: north, east, south, and west. If you are standing in a cell with a tree, you can choose whether to cut it off.\nYou must cut off the trees in order from shortest to tallest. When you cut off a tree, the value at its cell becomes 1 (an empty cell).\nStarting from the point (0, 0), return the minimum steps you need to walk to cut off all the trees. If you cannot cut off all the trees, return -1.\nNote: The input is generated such that no two trees have the same height, and there is at least one tree needs to be cut off.\n \nExample 1:\n\n\nInput: forest = [[1,2,3],[0,0,4],[7,6,5]]\nOutput: 6\nExplanation: Following the path above allows you to cut off the trees from shortest to tallest in 6 steps.\n\nExample 2:\n\n\nInput: forest = [[1,2,3],[0,0,0],[7,6,5]]\nOutput: -1\nExplanation: The trees in the bottom row cannot be accessed as the middle row is blocked.\n\nExample 3:\n\nInput: forest = [[2,3,4],[0,0,5],[8,7,6]]\nOutput: 6\nExplanation: You can follow the same path as Example 1 to cut off all the trees.\nNote that you can cut off the first tree at (0, 0) before making any steps.\n\n \nConstraints:\n\nm == forest.length\nn == forest[i].length\n1 <= m, n <= 50\n0 <= forest[i][j] <= 109\nHeights of all trees are distinct.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(forest = [[1, 2, 3, 4], [0, 0, 0, 0], [5, 6, 7, 8], [9, 10, 11, 12]]) == -1\n assert candidate(forest = [[1, 1, 1, 1], [1, 0, 1, 1], [1, 1, 1, 1]]) == 0\n assert candidate(forest = [[1, 2, 3], [0, 0, 4], [7, 6, 5]]) == 6\n assert candidate(forest = [[3, 0, 0], [1, 0, 0], [2, 0, 0]]) == 4\n assert candidate(forest = [[1, 1, 0], [0, 0, 0], [2, 0, 0]]) == -1\n assert candidate(forest = [[1, 0, 0], [0, 0, 0], [0, 0, 2]]) == -1\n assert candidate(forest = [[2, 3, 4], [0, 0, 5], [8, 7, 6]]) == 6\n assert candidate(forest = [[1, 2, 3], [0, 0, 0], [7, 6, 5]]) == -1\n assert candidate(forest = [[1, 1, 1], [1, 0, 1], [1, 1, 2]]) == 4\n assert candidate(forest = [[4, 2, 3], [0, 0, 5], [8, 7, 6]]) == 10\n assert candidate(forest = [[1, 2], [3, 4]]) == 4\n assert candidate(forest = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(forest = [[1, 0, 0, 0, 0], [1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1], [1, 0, 0, 0, 0]]) == 0\n assert candidate(forest = [[1, 0, 0, 0, 0], [1, 1, 1, 1, 0], [0, 0, 0, 1, 0], [0, 0, 0, 1, 2]]) == 7\n assert candidate(forest = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 2, 1]]) == 5\n assert candidate(forest = [[1, 1], [2, 0]]) == 1\n assert candidate(forest = [[1, 0, 0, 0, 0], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 9]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5], [0, 6, 0, 0, 7], [8, 0, 0, 0, 9], [0, 0, 0, 0, 0], [10, 11, 12, 13, 14]]) == -1\n assert candidate(forest = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 3, 4, 5, 6, 7, 8, 9, 10]]) == -1\n assert candidate(forest = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 2], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 3]]) == -1\n assert candidate(forest = [[1, 2, 0, 0, 3], [0, 0, 0, 0, 0], [0, 0, 4, 0, 0], [0, 0, 0, 0, 0], [5, 6, 0, 7, 8]]) == -1\n assert candidate(forest = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 0, 2, 0, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]) == 4\n assert candidate(forest = [[5, 4, 3, 2, 1], [0, 0, 0, 0, 0], [6, 7, 8, 9, 10], [0, 0, 0, 0, 0], [11, 12, 13, 14, 15]]) == -1\n assert candidate(forest = [[10, 1, 3, 0, 5], [9, 0, 0, 0, 4], [8, 6, 7, 0, 2], [0, 0, 0, 0, 0], [1, 0, 0, 0, 3]]) == -1\n assert candidate(forest = [[1, 3, 0, 0, 5], [0, 6, 7, 8, 0], [0, 0, 0, 0, 0], [9, 10, 11, 12, 4]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5, 6], [0, 0, 0, 0, 0, 0], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30]]) == -1\n assert candidate(forest = [[5, 4, 3, 2, 1], [0, 0, 0, 0, 0], [1, 2, 3, 4, 5], [0, 0, 0, 0, 0], [6, 7, 8, 9, 10]]) == -1\n assert candidate(forest = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 2, 3, 0, 1], [1, 0, 4, 5, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 6, 7, 8, 1]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5, 6, 7, 8], [9, 10, 11, 12, 13, 14, 15, 16], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [17, 18, 19, 20, 21, 22, 23, 24]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]) == 40\n assert candidate(forest = [[1, 0, 0, 0, 0, 0, 0, 2], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 3], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 4]]) == -1\n assert candidate(forest = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 2, 0, 3, 0, 4], [0, 0, 5, 0, 6, 7], [8, 9, 0, 0, 0, 0]]) == -1\n assert candidate(forest = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 3, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 4]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5, 6], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]]) == -1\n assert candidate(forest = [[1, 1, 1, 1, 0, 1, 1], [1, 1, 0, 1, 0, 1, 1], [0, 1, 0, 1, 0, 1, 0], [1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(forest = [[1, 2, 0, 4, 5], [0, 0, 0, 0, 0], [6, 7, 8, 9, 10], [0, 0, 0, 0, 0], [11, 12, 13, 14, 15]]) == -1\n assert candidate(forest = [[1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [2, 3, 4, 5, 6, 7, 8]]) == -1\n assert candidate(forest = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(forest = [[1, 3, 0, 5], [2, 0, 0, 0], [6, 7, 8, 0], [0, 9, 10, 4]]) == -1\n assert candidate(forest = [[1, 1, 1, 1, 1], [0, 2, 0, 3, 0], [1, 0, 4, 0, 5], [0, 6, 0, 7, 0], [1, 0, 0, 0, 8]]) == -1\n assert candidate(forest = [[1, 0, 0, 0, 2, 0], [0, 0, 0, 0, 0, 0], [3, 4, 0, 0, 5, 0], [0, 0, 0, 0, 0, 0], [6, 7, 0, 0, 8, 0], [0, 0, 9, 10, 0, 11]]) == -1\n assert candidate(forest = [[3, 0, 1], [0, 0, 0], [2, 0, 5]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 0, 0], [0, 0, 0, 0, 0], [14, 15, 16, 17, 18]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5, 6], [0, 0, 0, 0, 0, 0], [7, 8, 9, 10, 11, 12], [13, 0, 0, 0, 0, 0], [14, 15, 16, 17, 18, 19], [20, 21, 22, 23, 24, 25]]) == -1\n assert candidate(forest = [[1, 2, 3, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 4], [0, 0, 0, 0, 0, 5]]) == -1\n assert candidate(forest = [[5, 0, 3, 0, 1], [4, 0, 0, 0, 0], [6, 0, 7, 0, 0], [0, 0, 0, 0, 0], [8, 0, 9, 0, 2]]) == -1\n assert candidate(forest = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 0, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(forest = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 1, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(forest = [[5, 0, 0, 3], [1, 0, 0, 0], [0, 2, 0, 0], [4, 0, 0, 6]]) == -1\n assert candidate(forest = [[10, 11, 12, 13], [0, 0, 0, 0], [9, 8, 7, 6], [5, 4, 3, 2]]) == -1\n assert candidate(forest = [[3, 0, 1, 4, 5], [0, 0, 0, 0, 0], [1, 0, 2, 0, 0], [0, 0, 0, 0, 0], [7, 6, 0, 8, 9]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5, 6], [0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]]) == 5\n assert candidate(forest = [[1, 2, 0, 3, 4], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14]]) == -1\n assert candidate(forest = [[1, 2, 0, 0, 3], [0, 0, 0, 0, 0], [4, 5, 6, 7, 8], [9, 10, 11, 12, 13], [14, 15, 16, 17, 18]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5, 6, 7], [0, 0, 0, 0, 0, 0, 0], [0, 0, 8, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [9, 10, 11, 12, 13, 14, 15]]) == -1\n assert candidate(forest = [[1, 2, 3, 0, 0, 6], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(forest = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(forest = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 0, 0, 1, 1], [1, 0, 0, 0, 0, 1], [1, 1, 0, 0, 1, 1], [1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(forest = [[10, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) == -1\n assert candidate(forest = [[2, 1, 3, 4, 5], [0, 0, 0, 0, 0], [10, 9, 8, 7, 6], [0, 11, 12, 13, 14], [15, 16, 17, 18, 19]]) == -1\n assert candidate(forest = [[1, 2, 0, 0], [0, 3, 0, 4], [5, 6, 7, 8], [9, 0, 0, 10]]) == 22\n assert candidate(forest = [[9, 8, 7], [6, 5, 4], [3, 2, 1]]) == 14\n assert candidate(forest = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 0, 0, 0], [0, 0, 0, 0, 0, 0], [16, 17, 18, 19, 20, 21], [22, 23, 24, 25, 26, 27]]) == -1\n assert candidate(forest = [[1, 2, 0, 4, 5], [0, 0, 0, 0, 0], [6, 7, 0, 8, 9], [0, 0, 0, 0, 0], [10, 11, 12, 13, 14]]) == -1\n assert candidate(forest = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 2]]) == -1\n assert candidate(forest = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 3]]) == -1\n assert candidate(forest = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [2, 3, 4, 5, 6, 7, 8, 9]]) == -1\n assert candidate(forest = [[1, 1, 0, 0, 0], [0, 2, 0, 3, 0], [0, 0, 4, 0, 0], [0, 5, 0, 6, 0], [0, 0, 0, 7, 8]]) == -1\n assert candidate(forest = [[1, 2, 1, 1, 1, 1], [1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 3]]) == 14\n assert candidate(forest = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [23, 24, 25, 26, 27, 28, 29, 30, 31]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [10, 11, 12, 13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24, 25, 26, 27], [28, 29, 30, 31, 32, 33, 34, 35, 36]]) == -1\n assert candidate(forest = [[2, 3, 0, 4, 5], [0, 0, 0, 0, 0], [1, 6, 7, 8, 9], [0, 0, 0, 0, 0], [10, 11, 12, 13, 14]]) == -1\n assert candidate(forest = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 9]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36, 37, 38, 39, 40], [41, 42, 43, 44, 45, 46, 47, 48, 49, 50]]) == -1\n assert candidate(forest = [[1, 2, 0, 4], [1, 0, 0, 0], [3, 6, 7, 8], [0, 0, 0, 9]]) == -1\n assert candidate(forest = [[1, 1, 1, 1, 1], [0, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 9]]) == 8\n assert candidate(forest = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(forest = [[1, 2, 3, 4, 5, 6], [7, 0, 0, 0, 0, 0], [0, 8, 9, 10, 0, 0], [0, 0, 0, 0, 0, 0], [11, 12, 13, 0, 0, 0], [0, 0, 14, 15, 16, 17]]) == -1\n assert candidate(forest = [[1, 2, 0, 0, 3, 4], [5, 0, 0, 0, 0, 6], [7, 8, 0, 0, 0, 9], [0, 0, 10, 11, 0, 0], [12, 13, 0, 0, 14, 15], [16, 17, 18, 19, 0, 20]]) == -1\n assert candidate(forest = [[5, 4, 3, 2, 1], [0, 0, 0, 0, 0], [10, 9, 8, 7, 6], [15, 0, 0, 0, 11], [14, 13, 12, 0, 0]]) == -1\n assert candidate(forest = [[5, 1, 3, 2, 4], [0, 0, 0, 0, 0], [8, 6, 7, 9, 10]]) == -1\n assert candidate(forest = [[5, 1, 2, 3, 4], [0, 9, 10, 11, 0], [8, 7, 6, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 18\n assert candidate(forest = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [6, 7, 8, 9, 10]]) == -1\n assert candidate(forest = [[5, 4, 3, 2, 1], [10, 9, 8, 7, 6], [1, 0, 0, 0, 0], [2, 0, 0, 0, 3], [4, 0, 0, 0, 5]]) == -1\n assert candidate(forest = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 1], [1, 0, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(forest = [[3, 2, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 4, 5, 6], [0, 0, 7, 8, 9], [10, 11, 12, 13, 14]]) == -1\n assert candidate(forest = [[10, 1, 3, 12, 11], [0, 0, 0, 0, 0], [5, 4, 0, 0, 6], [0, 0, 0, 0, 0], [8, 9, 7, 13, 2]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5, 6, 7, 8], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [9, 10, 11, 12, 13, 14, 15, 16], [17, 18, 19, 20, 21, 22, 23, 24]]) == -1\n assert candidate(forest = [[2, 1, 0, 0, 5], [0, 0, 3, 0, 0], [0, 6, 0, 4, 0], [7, 0, 0, 0, 8]]) == -1\n assert candidate(forest = [[5, 1, 0, 0, 8], [0, 0, 0, 0, 0], [0, 2, 0, 3, 0], [0, 0, 4, 0, 0], [0, 0, 0, 0, 6], [0, 0, 0, 7, 0]]) == -1\n assert candidate(forest = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 2, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == -1\n assert candidate(forest = [[1, 3, 1, 0, 5], [1, 0, 1, 0, 1], [1, 0, 1, 0, 1], [1, 0, 1, 0, 1], [1, 0, 1, 0, 1]]) == -1\n assert candidate(forest = [[1, 2, 3, 0, 4, 5, 6, 0, 7, 8], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9, 10, 11, 12, 13, 14, 15, 16, 17, 18], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [19, 20, 21, 22, 23, 24, 25, 26, 27, 28], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [29, 30, 31, 32, 33, 34, 35, 36, 37, 38]]) == -1\n assert candidate(forest = [[2, 3, 0, 4], [1, 0, 0, 5], [8, 7, 6, 0], [0, 9, 10, 11]]) == -1\n assert candidate(forest = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22], [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33], [34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], [45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55], [56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66]]) == -1\n assert candidate(forest = [[1, 2, 3, 0, 0], [0, 0, 0, 0, 0], [4, 5, 6, 0, 0], [0, 0, 0, 0, 0], [7, 8, 9, 10, 11]]) == -1\n assert candidate(forest = [[1, 10, 3, 4, 5], [0, 9, 0, 0, 0], [6, 8, 7, 0, 1], [2, 0, 0, 0, 0], [11, 12, 13, 14, 15]]) == 32\n"}, "metadata": {"canonical_parameter_names": ["forest"], "leetcode_dataset_entry_point": "Solution().cutOffTree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var cutOffTree = function(forest) {", "container": null, "callable": "cutOffTree", "parameters": [{"name": "forest", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 678, "task_id": "valid-parenthesis-string", "difficulty": "Medium", "problem_description": "Given a string s containing only three types of characters: '(', ')' and '*', return true if s is valid.\nThe following rules define a valid string:\n\nAny left parenthesis '(' must have a corresponding right parenthesis ')'.\nAny right parenthesis ')' must have a corresponding left parenthesis '('.\nLeft parenthesis '(' must go before the corresponding right parenthesis ')'.\n'*' could be treated as a single right parenthesis ')' or a single left parenthesis '(' or an empty string \"\".\n\n \nExample 1:\nInput: s = \"()\"\nOutput: true\nExample 2:\nInput: s = \"(*)\"\nOutput: true\nExample 3:\nInput: s = \"(*))\"\nOutput: true\n\n \nConstraints:\n\n1 <= s.length <= 100\ns[i] is '(', ')' or '*'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"(())*\") == True\n assert candidate(s = \"((((((**))))))\") == True\n assert candidate(s = \"(()*\") == True\n assert candidate(s = \"****\") == True\n assert candidate(s = \"(()****)\") == True\n assert candidate(s = \"*()\") == True\n assert candidate(s = \"(()***)\") == True\n assert candidate(s = \"((*)*())\") == True\n assert candidate(s = \"())(*\") == False\n assert candidate(s = \"((*))\") == True\n assert candidate(s = \"(*)*\") == True\n assert candidate(s = \"(()))\") == False\n assert candidate(s = \"(()(()))\") == True\n assert candidate(s = \"(*))\") == True\n assert candidate(s = \"(**)\") == True\n assert candidate(s = \"(*)()\") == True\n assert candidate(s = \"()\") == True\n assert candidate(s = \"((()))\") == True\n assert candidate(s = \"(*)\") == True\n assert candidate(s = \"((*)\") == True\n assert candidate(s = \"()()\") == True\n assert candidate(s = \"(()*())\") == True\n assert candidate(s = \"(())))\") == False\n assert candidate(s = \"(***)\") == True\n assert candidate(s = \"(()*()*(*)*())\") == True\n assert candidate(s = \"(())*(())*\") == True\n assert candidate(s = \"((**))*((*))*(**)\") == True\n assert candidate(s = \"((((((()))))))***\") == True\n assert candidate(s = \"(((())))*(())\") == True\n assert candidate(s = \"(*(()*(())*))\") == True\n assert candidate(s = \"()***(())()\") == True\n assert candidate(s = \"((**(*)))\") == True\n assert candidate(s = \"(*)*(*)(*)*(*)(*)\") == True\n assert candidate(s = \"((((()))))))**(()((()))\") == False\n assert candidate(s = \"(()(()(()(*)))))\") == True\n assert candidate(s = \"(*((((**)))))\") == True\n assert candidate(s = \"((((**))))*(((**))))\") == True\n assert candidate(s = \"(*(*(*(*(*(*(*)))))****)\") == True\n assert candidate(s = \"(((((())))))\") == True\n assert candidate(s = \"(((((((*))))))\") == True\n assert candidate(s = \"((*)*(()))\") == True\n assert candidate(s = \"(**(())(*))\") == True\n assert candidate(s = \"(()**(**))\") == True\n assert candidate(s = \"((())((**)))\") == True\n assert candidate(s = \"((*)*)((**))\") == True\n assert candidate(s = \"(*(*(***))*))*\") == True\n assert candidate(s = \"(()*((*)))\") == True\n assert candidate(s = \"((*)*(*(*)))\") == True\n assert candidate(s = \"()**(((())))****\") == True\n assert candidate(s = \"(*)**(**)\") == True\n assert candidate(s = \"((*(**)))*(**)\") == True\n assert candidate(s = \"((*(**))*)*()\") == True\n assert candidate(s = \"((()))*(()**)**\") == True\n assert candidate(s = \"(())*(())*(())*((()))\") == True\n assert candidate(s = \"(*(*))**\") == True\n assert candidate(s = \"(**(**))\") == True\n assert candidate(s = \"((**))\") == True\n assert candidate(s = \"(()*())*()\") == True\n assert candidate(s = \"((*)()(**))\") == True\n assert candidate(s = \"(**((*)*))**\") == True\n assert candidate(s = \"(()***(())*)\") == True\n assert candidate(s = \"((*)(*(*)))\") == True\n assert candidate(s = \"(((())))*****\") == True\n assert candidate(s = \"((*)(*))(())((**))\") == True\n assert candidate(s = \"((*)(*)(*)(*))\") == True\n assert candidate(s = \"*(((******)))*\") == True\n assert candidate(s = \"((**)*))\") == True\n assert candidate(s = \"()(()(()(*)))\") == True\n assert candidate(s = \"(*)*(((**))*))\") == True\n assert candidate(s = \"(*(**))*((*)*)\") == True\n assert candidate(s = \"()(()())*\") == True\n assert candidate(s = \"(*(()*(()*)))\") == True\n assert candidate(s = \"(()*(()*(())))\") == True\n assert candidate(s = \"*(*(*(*)))**\") == True\n assert candidate(s = \"(())*()(())*()\") == True\n assert candidate(s = \"((((****))))\") == True\n assert candidate(s = \"((((())*)*))**\") == True\n assert candidate(s = \"((((((()))))))\") == True\n assert candidate(s = \"(((((**)))))\") == True\n assert candidate(s = \"(()*((())))\") == True\n assert candidate(s = \"(()(()))**\") == True\n assert candidate(s = \"(((()**)))(((()**)))\") == True\n assert candidate(s = \"(((()*****)****))\") == True\n assert candidate(s = \"(**)))(**(\") == False\n assert candidate(s = \"(())(())((**))\") == True\n assert candidate(s = \"(*(*(*(*(*)))))\") == True\n assert candidate(s = \"((((*))())*())\") == True\n assert candidate(s = \"(*(*(*)*))\") == True\n assert candidate(s = \"(((*)))((***))\") == True\n assert candidate(s = \"*(()*(())*(())**)\") == True\n assert candidate(s = \"(((***)))(((***)))\") == True\n assert candidate(s = \"*()**(**)()\") == True\n assert candidate(s = \"((*)(*))*\") == True\n assert candidate(s = \"(((*)**)*(***))\") == True\n assert candidate(s = \"((((*((*)))))\") == True\n assert candidate(s = \"**(()))*((***)**\") == True\n assert candidate(s = \"((((())))*)\") == True\n assert candidate(s = \"(*)*(*)\") == True\n assert candidate(s = \"((**)((()))*)**\") == True\n assert candidate(s = \"(()*()(*()*)*())\") == True\n assert candidate(s = \"(*(*))(*)\") == True\n assert candidate(s = \"(*)*(**(()**))\") == True\n assert candidate(s = \"((((**)))))\") == True\n assert candidate(s = \"(*())*()()*(())*\") == True\n assert candidate(s = \"((()))*(((**)))\") == True\n assert candidate(s = \"*(((*)*))\") == True\n assert candidate(s = \"(((****)))()\") == True\n assert candidate(s = \"((*)(*))(*)\") == True\n assert candidate(s = \"(**())((()))\") == True\n assert candidate(s = \"(((*))*)*(()))\") == True\n assert candidate(s = \"(((((******)))))\") == True\n assert candidate(s = \"(*(*(*)))\") == True\n assert candidate(s = \"(*(()*())*)\") == True\n assert candidate(s = \"(((((*)))))\") == True\n assert candidate(s = \"(***(**))\") == True\n assert candidate(s = \"(*(*(())))(((()))*)\") == True\n assert candidate(s = \"(()***)((()))\") == True\n assert candidate(s = \"((**())*(**))\") == True\n assert candidate(s = \"(())**(())\") == True\n assert candidate(s = \"((**)*)\") == True\n assert candidate(s = \"(()(**)()*)\") == True\n assert candidate(s = \"((*(())*)*)\") == True\n assert candidate(s = \"(*(*(*(*))))\") == True\n assert candidate(s = \"*(*(())*)*\") == True\n assert candidate(s = \"((()))(*(*)*())\") == True\n assert candidate(s = \"((*)(*)(*))((*)*)\") == True\n assert candidate(s = \"(*(*(*(*(*))))*\") == True\n assert candidate(s = \"(((())))**(**)***\") == True\n assert candidate(s = \"((**(())*(**)))\") == True\n assert candidate(s = \"(()(*(*)*))\") == True\n assert candidate(s = \"(()*(())**(())*(())*)\") == True\n assert candidate(s = \"(*((((())))))\") == True\n assert candidate(s = \"*()*(*)()\") == True\n assert candidate(s = \"(**((((**))))**\") == True\n assert candidate(s = \"(()*(()))\") == True\n assert candidate(s = \"(*(()*(()*(()*())))*)\") == True\n assert candidate(s = \"((***))((***))\") == True\n assert candidate(s = \"((*)*(*))\") == True\n assert candidate(s = \"((((*)))((**))((*))*)\") == True\n assert candidate(s = \"((((*)))()*)*\") == True\n assert candidate(s = \"**((**))**\") == True\n assert candidate(s = \"((((*)(*)(*))))****\") == True\n assert candidate(s = \"()**())((**))\") == True\n assert candidate(s = \"()**(**)()\") == True\n assert candidate(s = \"((**()))(*(()))\") == True\n assert candidate(s = \"((((()**))**))\") == True\n assert candidate(s = \"(*(*((())))**)\") == True\n assert candidate(s = \"(*(()))\") == True\n assert candidate(s = \"(()*(()**()))\") == True\n assert candidate(s = \"((((*))))(*)\") == True\n assert candidate(s = \"(**)(**)(**)\") == True\n assert candidate(s = \"(((*)))\") == True\n assert candidate(s = \"(()))(**(\") == False\n assert candidate(s = \"((*)((*)*))\") == True\n assert candidate(s = \"((*)(*)(*))\") == True\n assert candidate(s = \"(*()(*))**((*))**\") == True\n assert candidate(s = \"((*)(*))\") == True\n assert candidate(s = \"((***(****)))\") == True\n assert candidate(s = \"(((())))(*)(())\") == True\n assert candidate(s = \"((((**))))\") == True\n assert candidate(s = \"(**(*)*())(())**\") == True\n assert candidate(s = \"(***(())***)\") == True\n assert candidate(s = \"((())*(())*(())**)\") == True\n assert candidate(s = \"()(*(*(*())))\") == True\n assert candidate(s = \"(*(*)**(*)))\") == True\n assert candidate(s = \"((()))*()**\") == True\n assert candidate(s = \"(*)*(*(*)*(*))\") == True\n assert candidate(s = \"(())(((*)))\") == True\n assert candidate(s = \"(()*()(*))\") == True\n assert candidate(s = \"(()*(()*()**))\") == True\n assert candidate(s = \"((((*)**))***)\") == True\n assert candidate(s = \"((((()))))\") == True\n assert candidate(s = \"*(((****)(**))))\") == True\n assert candidate(s = \"(())((()))**\") == True\n assert candidate(s = \"**((((((()))))))**\") == True\n assert candidate(s = \"((**(**))**(**))\") == True\n assert candidate(s = \"(**(*)*)\") == True\n assert candidate(s = \"((((*))*)*))))\") == True\n assert candidate(s = \"(()***)()\") == True\n assert candidate(s = \"(())((()))***\") == True\n assert candidate(s = \"((()))(*)(((***)))*\") == True\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().checkValidString", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var checkValidString = function(s) {", "container": null, "callable": "checkValidString", "parameters": [{"name": "s", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 679, "task_id": "24-game", "difficulty": "Hard", "problem_description": "You are given an integer array cards of length 4. You have four cards, each containing a number in the range [1, 9]. You should arrange the numbers on these cards in a mathematical expression using the operators ['+', '-', '*', '/'] and the parentheses '(' and ')' to get the value 24.\nYou are restricted with the following rules:\n\nThe division operator '/' represents real division, not integer division.\n\n\t\nFor example, 4 / (1 - 2 / 3) = 4 / (1 / 3) = 12.\n\n\nEvery operation done is between two numbers. In particular, we cannot use '-' as a unary operator.\n\t\nFor example, if cards = [1, 1, 1, 1], the expression \"-1 - 1 - 1 - 1\" is not allowed.\n\n\nYou cannot concatenate numbers together\n\t\nFor example, if cards = [1, 2, 1, 2], the expression \"12 + 12\" is not valid.\n\n\n\nReturn true if you can get such expression that evaluates to 24, and false otherwise.\n \nExample 1:\n\nInput: cards = [4,1,8,7]\nOutput: true\nExplanation: (8-4) * (7-1) = 24\n\nExample 2:\n\nInput: cards = [1,2,1,2]\nOutput: false\n\n \nConstraints:\n\ncards.length == 4\n1 <= cards[i] <= 9\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(cards = [9, 9, 9, 9]) == False\n assert candidate(cards = [2, 8, 1, 4]) == True\n assert candidate(cards = [4, 4, 7, 7]) == True\n assert candidate(cards = [1, 10, 1, 10]) == False\n assert candidate(cards = [1, 3, 4, 6]) == True\n assert candidate(cards = [9, 5, 5, 1]) == True\n assert candidate(cards = [2, 3, 6, 9]) == True\n assert candidate(cards = [1, 1, 7, 7]) == False\n assert candidate(cards = [7, 3, 7, 2]) == True\n assert candidate(cards = [8, 1, 6, 3]) == True\n assert candidate(cards = [4, 1, 8, 7]) == True\n assert candidate(cards = [2, 2, 2, 2]) == False\n assert candidate(cards = [7, 7, 8, 9]) == False\n assert candidate(cards = [1, 2, 1, 2]) == False\n assert candidate(cards = [9, 5, 5, 6]) == False\n assert candidate(cards = [7, 3, 4, 7]) == True\n assert candidate(cards = [6, 6, 6, 6]) == True\n assert candidate(cards = [2, 3, 6, 6]) == True\n assert candidate(cards = [1, 5, 9, 1]) == False\n assert candidate(cards = [1, 1, 1, 1]) == False\n assert candidate(cards = [5, 5, 5, 5]) == True\n assert candidate(cards = [3, 3, 8, 8]) == True\n assert candidate(cards = [9, 5, 3, 2]) == True\n assert candidate(cards = [7, 8, 9, 1]) == True\n assert candidate(cards = [6, 1, 9, 4]) == True\n assert candidate(cards = [7, 2, 4, 6]) == True\n assert candidate(cards = [1, 2, 7, 7]) == True\n assert candidate(cards = [8, 3, 8, 3]) == True\n assert candidate(cards = [4, 6, 6, 6]) == True\n assert candidate(cards = [7, 8, 9, 6]) == True\n assert candidate(cards = [5, 5, 1, 9]) == True\n assert candidate(cards = [9, 7, 2, 5]) == True\n assert candidate(cards = [4, 6, 7, 1]) == True\n assert candidate(cards = [8, 1, 3, 4]) == True\n assert candidate(cards = [5, 3, 8, 1]) == True\n assert candidate(cards = [1, 2, 6, 7]) == True\n assert candidate(cards = [5, 3, 2, 7]) == True\n assert candidate(cards = [8, 5, 3, 1]) == True\n assert candidate(cards = [7, 9, 3, 1]) == True\n assert candidate(cards = [9, 2, 4, 5]) == True\n assert candidate(cards = [9, 5, 6, 3]) == True\n assert candidate(cards = [6, 4, 3, 2]) == True\n assert candidate(cards = [9, 1, 7, 3]) == True\n assert candidate(cards = [9, 1, 9, 1]) == False\n assert candidate(cards = [9, 7, 9, 7]) == False\n assert candidate(cards = [2, 7, 8, 1]) == True\n assert candidate(cards = [8, 8, 4, 4]) == True\n assert candidate(cards = [1, 9, 8, 7]) == True\n assert candidate(cards = [1, 6, 7, 8]) == False\n assert candidate(cards = [2, 5, 7, 10]) == True\n assert candidate(cards = [6, 6, 2, 4]) == True\n assert candidate(cards = [7, 2, 3, 4]) == True\n assert candidate(cards = [2, 8, 4, 1]) == True\n assert candidate(cards = [6, 6, 1, 9]) == True\n assert candidate(cards = [4, 4, 2, 2]) == True\n assert candidate(cards = [5, 5, 1, 1]) == True\n assert candidate(cards = [3, 9, 7, 2]) == True\n assert candidate(cards = [2, 8, 3, 7]) == True\n assert candidate(cards = [6, 5, 4, 3]) == True\n assert candidate(cards = [4, 7, 1, 6]) == True\n assert candidate(cards = [9, 7, 5, 3]) == True\n assert candidate(cards = [5, 5, 1, 5]) == True\n assert candidate(cards = [7, 3, 9, 2]) == True\n assert candidate(cards = [8, 1, 6, 3]) == True\n assert candidate(cards = [7, 8, 6, 2]) == True\n assert candidate(cards = [3, 3, 8, 8]) == True\n assert candidate(cards = [6, 7, 1, 3]) == True\n assert candidate(cards = [6, 7, 8, 9]) == True\n assert candidate(cards = [1, 6, 6, 6]) == True\n assert candidate(cards = [7, 7, 7, 7]) == False\n assert candidate(cards = [4, 4, 2, 8]) == True\n assert candidate(cards = [5, 5, 3, 5]) == False\n assert candidate(cards = [9, 7, 3, 2]) == True\n assert candidate(cards = [9, 5, 2, 7]) == True\n assert candidate(cards = [2, 8, 7, 9]) == True\n assert candidate(cards = [2, 3, 6, 1]) == True\n assert candidate(cards = [4, 9, 1, 8]) == True\n assert candidate(cards = [1, 9, 9, 1]) == False\n assert candidate(cards = [7, 2, 1, 10]) == True\n assert candidate(cards = [9, 3, 5, 7]) == True\n assert candidate(cards = [5, 3, 3, 9]) == True\n assert candidate(cards = [4, 6, 6, 2]) == True\n assert candidate(cards = [7, 7, 2, 2]) == True\n assert candidate(cards = [9, 9, 1, 1]) == False\n assert candidate(cards = [5, 7, 8, 2]) == True\n assert candidate(cards = [6, 1, 1, 1]) == False\n assert candidate(cards = [7, 5, 5, 2]) == True\n assert candidate(cards = [4, 4, 2, 9]) == True\n assert candidate(cards = [3, 3, 7, 13]) == True\n assert candidate(cards = [1, 2, 3, 4]) == True\n assert candidate(cards = [9, 5, 6, 1]) == True\n assert candidate(cards = [1, 2, 3, 6]) == True\n assert candidate(cards = [3, 9, 2, 6]) == True\n assert candidate(cards = [3, 6, 9, 2]) == True\n assert candidate(cards = [6, 1, 2, 6]) == True\n assert candidate(cards = [9, 5, 9, 5]) == True\n assert candidate(cards = [9, 7, 6, 9]) == True\n assert candidate(cards = [2, 3, 5, 7]) == True\n assert candidate(cards = [2, 9, 1, 6]) == True\n assert candidate(cards = [8, 8, 8, 1]) == True\n assert candidate(cards = [5, 5, 6, 6]) == True\n assert candidate(cards = [4, 5, 6, 7]) == True\n assert candidate(cards = [1, 1, 10, 10]) == False\n assert candidate(cards = [1, 3, 4, 6]) == True\n assert candidate(cards = [5, 5, 5, 1]) == True\n assert candidate(cards = [6, 3, 2, 9]) == True\n assert candidate(cards = [2, 3, 5, 7]) == True\n assert candidate(cards = [8, 1, 3, 7]) == True\n assert candidate(cards = [6, 1, 5, 1]) == True\n"}, "metadata": {"canonical_parameter_names": ["cards"], "leetcode_dataset_entry_point": "Solution().judgePoint24", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var judgePoint24 = function(cards) {", "container": null, "callable": "judgePoint24", "parameters": [{"name": "cards", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 680, "task_id": "valid-palindrome-ii", "difficulty": "Easy", "problem_description": "Given a string s, return true if the s can be palindrome after deleting at most one character from it.\n \nExample 1:\n\nInput: s = \"aba\"\nOutput: true\n\nExample 2:\n\nInput: s = \"abca\"\nOutput: true\nExplanation: You could delete the character 'c'.\n\nExample 3:\n\nInput: s = \"abc\"\nOutput: false\n\n \nConstraints:\n\n1 <= s.length <= 105\ns consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"raceecar\") == True\n assert candidate(s = \"abcba\") == True\n assert candidate(s = \"deeee\") == True\n assert candidate(s = \"ab\") == True\n assert candidate(s = \"abc\") == False\n assert candidate(s = \"racecarx\") == True\n assert candidate(s = \"abca\") == True\n assert candidate(s = \"abcdedcba\") == True\n assert candidate(s = \"abcdefgihgfedcba\") == True\n assert candidate(s = \"abcdefdba\") == False\n assert candidate(s = \"aabaa\") == True\n assert candidate(s = \"racecar\") == True\n assert candidate(s = \"a\") == True\n assert candidate(s = \"abcdefg\") == False\n assert candidate(s = \"aba\") == True\n assert candidate(s = \"aabbbbaaabbb\") == False\n assert candidate(s = \"abcdefghijklnkjihgfedcba\") == True\n assert candidate(s = \"abcdefghikjlmnopqrstuvutsrqponmlkjihgfedcba\") == False\n assert candidate(s = \"aabbaa\") == True\n assert candidate(s = \"noonappa\") == False\n assert candidate(s = \"zxcvbnmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(s = \"abcdexyzzyxedcba\") == True\n assert candidate(s = \"aaaabbbbccccddddcccccccddddbbbbbbaaaaa\") == False\n assert candidate(s = \"aabbcccbbbaa\") == True\n assert candidate(s = \"flgfgldad\") == False\n assert candidate(s = \"tattarrattat\") == True\n assert candidate(s = \"aabbccddeeeedcba\") == False\n assert candidate(s = \"aabbacdfgfddcabbaa\") == True\n assert candidate(s = \"zzzzzzzzzz\") == True\n assert candidate(s = \"aabbccddeeeffgggghhhiiiijjjjkkoollmmnnnnooppqqrrsstttuuuvvvvwwxxyyyzzzzyyyyxwvvvvuuutttsrrrqpnoonmlkkkiiihhhhggggfffeeedddccbbaa\") == False\n assert candidate(s = \"aabbccddeeeffgggihhii\") == False\n assert candidate(s = \"qwertyuiopoiuytrewq\") == True\n assert candidate(s = \"zxcvbnmasdfghjklqwertyuiopasdfghjklzxcvbnm\") == False\n assert candidate(s = \"aabbccddeeffgghhiaahhgffeeddccbbaa\") == False\n assert candidate(s = \"abcdefghihgfeddcba\") == True\n assert candidate(s = \"abcdabc\") == False\n assert candidate(s = \"aabbcddcbbbaa\") == True\n assert candidate(s = \"aabbbbbaaabbbb\") == False\n assert candidate(s = \"aabbaabbaa\") == True\n assert candidate(s = \"aabcaaba\") == False\n assert candidate(s = \"aabbccddeeffgghhijjihhgffeeddccbbaa\") == True\n assert candidate(s = \"aguokepatgbnvfqmgmlcupuufxoohdfpgjdmysgvhmvffcnqxjjxqncffvmhvgsymdjgpfdhooxfuupucmlmgqfvnbgtapekouga\") == False\n assert candidate(s = \"abcdcba\") == True\n assert candidate(s = \"abcdexyzxedcba\") == True\n assert candidate(s = \"aabbccddee\") == False\n assert candidate(s = \"abbaabbaabbaabba\") == True\n assert candidate(s = \"racecarwitharacecarinitt\") == False\n assert candidate(s = \"racecarxracecar\") == True\n assert candidate(s = \"aabbacdfgdcabbaa\") == True\n assert candidate(s = \"abbaaaabba\") == True\n assert candidate(s = \"aabbccddeedccbbaa\") == True\n assert candidate(s = \"aabbccddeeeffgggghhhhiiiijjjjkkkkllmmnnnnooppqqrrsstttuuuvvvvvwwxxyyyzzzzzzzyyyyxwvvvvuuutttsrrrqpnoonmlkkkiiihhhhggggfffeeedddccbbaa\") == False\n assert candidate(s = \"abcaabcba\") == True\n assert candidate(s = \"raceacar\") == True\n assert candidate(s = \"noon\") == True\n assert candidate(s = \"abcdeffedcba\") == True\n assert candidate(s = \"level\") == True\n assert candidate(s = \"aabbbbbbbaaabbbbbb\") == False\n assert candidate(s = \"aaaaabbaaaaa\") == True\n assert candidate(s = \"abcdefghhgfedcba\") == True\n assert candidate(s = \"aabbccddeeeffggghhiiii\") == False\n assert candidate(s = \"ababababababa\") == True\n assert candidate(s = \"zxcvbnmasdfghjklqwertyuiopplkjhgfdsazxcvbnm\") == False\n assert candidate(s = \"abcdefghijkjihgfedcba\") == True\n assert candidate(s = \"aabbccddeedcba\") == False\n assert candidate(s = \"aabbccddeeefffggg\") == False\n assert candidate(s = \"levelwithoneleveldropped\") == False\n assert candidate(s = \"noonwithanothernoon\") == False\n assert candidate(s = \"abzcdedcba\") == True\n assert candidate(s = \"acbbbca\") == True\n assert candidate(s = \"lcupuufxoohdfpgjdmysgvhmvffcnqxjjxqncffvmhvgsymdjgpfdhooxfuupuc\") == True\n assert candidate(s = \"abcbad\") == True\n assert candidate(s = \"abcdefghijkmlkjihgfedcba\") == True\n assert candidate(s = \"abcdexyzzyxdecba\") == False\n assert candidate(s = \"abccba\") == True\n assert candidate(s = \"abcdxzyxcba\") == False\n assert candidate(s = \"madamimadam\") == True\n assert candidate(s = \"aabbabba\") == True\n assert candidate(s = \"abcdefghihgfedcbai\") == True\n assert candidate(s = \"amanaplanacanalpanama\") == True\n assert candidate(s = \"aabbccddeedccbaa\") == False\n assert candidate(s = \"aebcbda\") == False\n assert candidate(s = \"deified\") == True\n assert candidate(s = \"repaper\") == True\n assert candidate(s = \"eedede\") == True\n assert candidate(s = \"abcdeffgedcba\") == True\n assert candidate(s = \"acbbcdcba\") == False\n assert candidate(s = \"aabbaaabbaa\") == True\n assert candidate(s = \"abcdefghijkllkjihgfedcba\") == True\n assert candidate(s = \"abacdfgdcaba\") == True\n assert candidate(s = \"abcdefghijklmnopqrrponmlkjihgfedcba\") == True\n assert candidate(s = \"abacdfgdfcba\") == False\n assert candidate(s = \"aabbccdddccbaa\") == True\n assert candidate(s = \"abcddcba\") == True\n assert candidate(s = \"aaaaabaaa\") == True\n assert candidate(s = \"rotor\") == True\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyz\") == False\n assert candidate(s = \"abcdefghihgfedcba\") == True\n assert candidate(s = \"aguokepatgbnvfqmgmlcupuufxoohdfpgjdmysgvhmvffcnqxjjxqncffvmhvgsymdjgpfdhooxfuupucmlgqfvnbgtapekouga\") == False\n assert candidate(s = \"detartratedwithanotherdetartrated\") == False\n assert candidate(s = \"aabbccddeeffggahhigghhffeeddccbbaa\") == False\n assert candidate(s = \"zzazz\") == True\n assert candidate(s = \"rotorwithatinyrotor\") == False\n assert candidate(s = \"mississippi\") == False\n assert candidate(s = \"e race car e\") == True\n assert candidate(s = \"abcdefghihgfedcbaj\") == True\n assert candidate(s = \"ebcbbececabbacecbbcbe\") == True\n assert candidate(s = \"acbbba\") == True\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().validPalindrome", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var validPalindrome = function(s) {", "container": null, "callable": "validPalindrome", "parameters": [{"name": "s", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 682, "task_id": "baseball-game", "difficulty": "Easy", "problem_description": "You are keeping the scores for a baseball game with strange rules. At the beginning of the game, you start with an empty record.\nYou are given a list of strings operations, where operations[i] is the ith operation you must apply to the record and is one of the following:\n\nAn integer x.\n\n\t\nRecord a new score of x.\n\n\n'+'.\n\t\nRecord a new score that is the sum of the previous two scores.\n\n\n'D'.\n\t\nRecord a new score that is the double of the previous score.\n\n\n'C'.\n\t\nInvalidate the previous score, removing it from the record.\n\n\n\nReturn the sum of all the scores on the record after applying all the operations.\nThe test cases are generated such that the answer and all intermediate calculations fit in a 32-bit integer and that all operations are valid.\n \nExample 1:\n\nInput: ops = [\"5\",\"2\",\"C\",\"D\",\"+\"]\nOutput: 30\nExplanation:\n\"5\" - Add 5 to the record, record is now [5].\n\"2\" - Add 2 to the record, record is now [5, 2].\n\"C\" - Invalidate and remove the previous score, record is now [5].\n\"D\" - Add 2 * 5 = 10 to the record, record is now [5, 10].\n\"+\" - Add 5 + 10 = 15 to the record, record is now [5, 10, 15].\nThe total sum is 5 + 10 + 15 = 30.\n\nExample 2:\n\nInput: ops = [\"5\",\"-2\",\"4\",\"C\",\"D\",\"9\",\"+\",\"+\"]\nOutput: 27\nExplanation:\n\"5\" - Add 5 to the record, record is now [5].\n\"-2\" - Add -2 to the record, record is now [5, -2].\n\"4\" - Add 4 to the record, record is now [5, -2, 4].\n\"C\" - Invalidate and remove the previous score, record is now [5, -2].\n\"D\" - Add 2 * -2 = -4 to the record, record is now [5, -2, -4].\n\"9\" - Add 9 to the record, record is now [5, -2, -4, 9].\n\"+\" - Add -4 + 9 = 5 to the record, record is now [5, -2, -4, 9, 5].\n\"+\" - Add 9 + 5 = 14 to the record, record is now [5, -2, -4, 9, 5, 14].\nThe total sum is 5 + -2 + -4 + 9 + 5 + 14 = 27.\n\nExample 3:\n\nInput: ops = [\"1\",\"C\"]\nOutput: 0\nExplanation:\n\"1\" - Add 1 to the record, record is now [1].\n\"C\" - Invalidate and remove the previous score, record is now [].\nSince the record is empty, the total sum is 0.\n\n \nConstraints:\n\n1 <= operations.length <= 1000\noperations[i] is \"C\", \"D\", \"+\", or a string representing an integer in the range [-3 * 104, 3 * 104].\nFor operation \"+\", there will always be at least two previous scores on the record.\nFor operations \"C\" and \"D\", there will always be at least one previous score on the record.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(operations = ['3', 'D', '+', '2', 'C', '+', '+', 'C', 'C', 'C']) == 9\n assert candidate(operations = ['10', '20', '30', 'D', '+']) == 210\n assert candidate(operations = ['3', '6', '+', 'D', 'C', '3', 'D', '+', '-2', 'D', '9', '+']) == 44\n assert candidate(operations = ['10', '20', '+', 'D', 'C', '5', 'D', '+']) == 90\n assert candidate(operations = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']) == 55\n assert candidate(operations = ['-1', '-2', '-3', 'C', 'D', '+', '-4', '-5', '+', '-6']) == -37\n assert candidate(operations = ['3', '8', '+', 'D', 'C', '2']) == 24\n assert candidate(operations = ['5', '-2', '4', 'C', 'D', '9', '+', '+']) == 27\n assert candidate(operations = ['10', 'D', 'D', '+', 'C', 'D', 'C', 'D', 'C', '+']) == 130\n assert candidate(operations = ['3', 'D', 'C', 'D', 'C', '10']) == 13\n assert candidate(operations = ['5', '2', 'C', 'D', '+']) == 30\n assert candidate(operations = ['1', 'D', 'C', '1', 'D', 'C', '1', 'D', 'C', '1']) == 4\n assert candidate(operations = ['10', '20', 'D', '+', 'C', '+', 'D', '+', '-10', 'C', '100']) == 530\n assert candidate(operations = ['10', 'D', '+', '5', 'C', 'D']) == 120\n assert candidate(operations = ['100', '200', '300', 'C', 'D', '+', 'C', '+', 'D', '+']) == 4300\n assert candidate(operations = ['100', '-50', 'D', 'C', '+']) == 100\n assert candidate(operations = ['1', 'C']) == 0\n assert candidate(operations = ['10000', '-10000', 'D', 'D', '+', 'C', 'D', '+', 'C', 'D']) == -300000\n assert candidate(operations = ['1000', '500', '250', 'D', 'C', 'D', 'C', '+', 'D', 'C', 'D', 'C', '+', 'D', 'C', 'D', 'C', '+', 'D', 'C', 'D', 'C', '+', 'D', 'C', 'D', 'C', '+', 'D', 'C', 'D', 'C']) == 12500\n assert candidate(operations = ['-1', '-2', '3', 'D', '+', 'C', 'D', '+']) == 36\n assert candidate(operations = ['1', 'C', '2', 'C', '3', 'C', '4', 'C', '5', 'C', '6', 'C', '7', 'C', '8', 'C', '9', 'C', '10', 'C', '11', 'C', '12', 'C', '13', 'C', '14', 'C', '15', 'C', '16', 'C', '17', 'C', '18', 'C', '19', 'C', '20', 'C']) == 0\n assert candidate(operations = ['50000', '-50000', '+', 'D', 'C', '25000', 'D', '+', '+', '-25000', 'D', '+']) == 125000\n assert candidate(operations = ['5', '-2', '4', 'C', 'D', '9', '+', '+', 'C', 'D', '+', 'C', 'D', '+']) == 73\n assert candidate(operations = ['30', '-10', 'C', 'D', 'D', '+', '+', '5', 'C', '+']) == 1170\n assert candidate(operations = ['1', '2', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == 61572651155455\n assert candidate(operations = ['-10', '-20', '+', 'C', '-30', 'D', '+', '-40', '+', 'D', 'C', 'C', '50', 'D', '+', '+']) == 300\n assert candidate(operations = ['1', 'D', 'D', 'D', 'C', 'C', 'C', 'D', 'D', 'D', '100', '200', '+', 'C', 'D', '+', '+', 'C', 'D', '+', '+', 'C', 'D', '+', '+', 'C', 'D', '+', '+', 'C', 'D', '1', '2', '3', '+', '+', 'C', 'D', '+', '+', 'C', 'D', '+', '+', 'C', 'D', '+', '+', 'C', 'D', '+', '+']) == 74401\n assert candidate(operations = ['5', '10', 'C', '20', 'D', '+', '30', 'C', '40', 'D', '+', '50']) == 415\n assert candidate(operations = ['100', '-100', 'D', 'D', '+', 'C', '+', 'D', 'C', '+']) == -2200\n assert candidate(operations = ['1', '2', '3', '4', '5', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D']) == 130\n assert candidate(operations = ['100', '50', '25', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', '-1', 'C', '-2', 'C', '-3', 'C', '-4', 'C', '-5', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == 82575490\n assert candidate(operations = ['5', 'C', '10', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == 550\n assert candidate(operations = ['5', 'C', '5', 'D', '+', 'C', 'D', '5', 'D', '+', 'C', 'D', '5', 'D', '+', 'C', 'D', '+']) == 135\n assert candidate(operations = ['10', 'C', '20', 'C', '30', 'C', '40', 'D', '+', 'C', '+', 'D', '+']) == 840\n assert candidate(operations = ['-32768', '32767', 'D', 'D', '+', 'C', 'D', '+', '-32768', '32767', 'D', 'D', '+', 'C', 'D', '+', '-32768', '32767', 'D', 'D', '+', 'C', 'D', '+']) == 2555823\n assert candidate(operations = ['3', '6', '+', 'D', 'C', '2', 'D', '+', '+', '-3', 'D', '+']) == 22\n assert candidate(operations = ['10', '-10', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == -73400300\n assert candidate(operations = ['1', '2', '3', '+', '+', 'C', 'D', '+', '+', 'C', 'D', '+', '+', 'C', 'D', '+', '+', 'C', 'D', '+', '+', 'C', 'D', '+', '+', 'C', 'D', '+', '+', 'C', 'D']) == 16401\n assert candidate(operations = ['10', '20', '30', '40', '50', 'C', 'D', '+', '60', '70', '80', '90', '100', 'C', 'D', '+', '110', '120', '130', '140', 'C', 'D', '+', '150']) == 2210\n assert candidate(operations = ['1', '2', 'C', '2', 'D', '+', 'D', '+', 'C', '+', 'D', 'C', 'D', '+', 'C', '+', 'D', 'C', 'D', '+', 'C', '+', 'D', 'C', 'D', '+', 'C', '+', 'D']) == 2185\n assert candidate(operations = ['100', '200', '300', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == 2202009600\n assert candidate(operations = ['1', '2', '3', '+', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == 2241\n assert candidate(operations = ['1', '2', 'C', 'D', '+', '100', '-100', 'C', 'D', '+']) == 606\n assert candidate(operations = ['100', '-50', 'D', '+', 'C', '25', 'D', '+', '150', 'C', '-200', 'D', '+']) == -1100\n assert candidate(operations = ['3', '-3', '5', '-5', 'D', 'C', '+', 'D', 'C', 'C', 'C']) == 5\n assert candidate(operations = ['1', '2', '3', 'C', 'D', '+', '4', '5', '6', 'C', 'D', '+', '7', '8', '9', 'C', 'D', '+', '10']) == 112\n assert candidate(operations = ['3', '6', '+', 'C', 'D', '12', '+', '-10', 'D', '+', '5', 'C', '+', '20']) == -33\n assert candidate(operations = ['-1', '-2', '-3', '-4', '-5', 'C', 'D', '+', '-6', '-7', '-8', '-9', '-10', 'C', 'D', '+', '-11', '-12', '-13', '-14', 'C', 'D', '+', '-15']) == -221\n assert candidate(operations = ['1', '2', '3', '+', 'D', 'C', '4', '5', '+', '6', 'D', 'C', '7', '8', '+', '9', 'D', 'C', '10', '11', '+', '12', 'D', 'C', '13', '14', '+', '15', 'D', 'C', '16', '17', '+', '18', 'D', 'C', '19', '20', '+', '21', 'D', 'C', '22', '23', '+', '24', 'D', 'C', '25', '26', '+', '27', 'D', 'C', '28', '29', '+', '30', 'D', 'C', '+', '-50']) == 804\n assert candidate(operations = ['3', '6', 'D', '+', '-2', 'D', 'C', '+', '5', 'D', '+']) == 83\n assert candidate(operations = ['1', '2', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == 55\n assert candidate(operations = ['100', 'C', '-100', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == -183500700\n assert candidate(operations = ['100', '200', '+', 'D', 'C', '100', 'D', '+', '+', 'C', '100', 'D', '+', '+', 'C', '100', 'D', '+']) == 2400\n assert candidate(operations = ['-100', 'C', '-50', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == -2750\n assert candidate(operations = ['100', '-50', 'D', 'C', 'D', '+', '20', '-20', 'C', '+', 'D', 'C', '1000', 'D', 'C', '+', '-500', '+', 'D', '+']) == 3280\n assert candidate(operations = ['5', '2', 'C', 'D', '+', '3', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == 1371\n assert candidate(operations = ['3', '-1', '-1', 'C', '2', 'D', '5', '+', '10', 'C', 'D', '+', '-5']) == 62\n assert candidate(operations = ['-1', '-2', '+', 'D', 'C', '-3', 'D', '+', '+', 'C', '-4', 'D', '+', '+', 'C', '-5', 'D', '+']) == -78\n assert candidate(operations = ['100', '200', 'C', 'D', '+', 'C', 'D', '+', '1000', '-1000', 'C', 'D', '+']) == 7300\n assert candidate(operations = ['1', 'C', '1', 'C', '1', 'C', '1', 'C', '1', 'C', '1', 'C', '1', 'C', '1', 'C', '1', 'C', '1', 'C', '1', 'C', '1', 'C']) == 0\n assert candidate(operations = ['-1', '-2', 'C', '-3', 'D', '+', '-4', 'C', '-5', 'D', '+', '-6']) == -55\n assert candidate(operations = ['3', '-1', '-4', 'D', '+', 'C', 'D', '+', '-5', 'D', 'C', '+']) == -84\n assert candidate(operations = ['1', 'C', '1', 'D', '+', -1, 'D', 'C', '+', 'D', '+', 'C', 'D', '+', '-10', 'C', '100', 'D', '+', 'C']) == 331\n assert candidate(operations = ['1000', '-1000', 'D', '+', 'C', '500', 'D', '+', '1500', 'C', '-2000', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == -3670013000\n assert candidate(operations = ['-5', 'D', '-10', '+', 'C', 'D', '+', '5', 'D', 'C', '+']) == -95\n assert candidate(operations = ['5', '2', '3', 'D', '+', 'C', '5', 'D', '+', '-5', 'C', '10', 'D', 'C', '+', '-10', 'D', '+', '-20', '+', '-30', 'D', 'C', '+', '-40', '+', '-50', 'D', 'C', '+']) == -539\n assert candidate(operations = ['10', '20', '+', '30', '+', 'C', '40', 'D', '+', '50', '+', '60', '+', 'C', '70', 'D', '+', '80', '+', '90']) == 1490\n assert candidate(operations = ['100', '50', 'D', '+', '-25', 'C', '75', 'D', '+', '25', 'C', '+', 'D']) == 1975\n assert candidate(operations = ['1', '2', '3', '4', '5', 'C', 'D', '+', '6', '7', '8', '9', '10', 'C', 'D', '+', '11', '12', '13', '14', 'C', 'D', '+', '15']) == 221\n assert candidate(operations = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '+', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == 2164\n assert candidate(operations = ['100', '50', '+', 'C', 'D', '20', 'D', '+', '10', 'C', '+']) == 470\n assert candidate(operations = ['1', '2', '3', '4', '5', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+', 'C', 'D', '+']) == 1794\n assert candidate(operations = ['10', '-10', 'D', '+', 'D', 'C', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C', 'D', '+', 'D', 'C', 'C', 'C']) == -20\n assert candidate(operations = ['1', 'C', '2', 'D', 'C', '3', 'D', 'C', '4', 'D', 'C', '5', 'D', 'C', '6', 'D', 'C', '7', 'D', '+']) == 62\n assert candidate(operations = ['5', '10', 'D', '+', 'C', '5', 'D', 'C', '+', '-5', 'D', '+']) == 35\n assert candidate(operations = ['1', 'D', '2', 'D', '3', 'D', '+', '+', '+', 'C', 'C', 'C']) == 18\n"}, "metadata": {"canonical_parameter_names": ["operations"], "leetcode_dataset_entry_point": "Solution().calPoints", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var calPoints = function(operations) {", "container": null, "callable": "calPoints", "parameters": [{"name": "operations", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 684, "task_id": "redundant-connection", "difficulty": "Medium", "problem_description": "In this problem, a tree is an undirected graph that is connected and has no cycles.\nYou are given a graph that started as a tree with n nodes labeled from 1 to n, with one additional edge added. The added edge has two different vertices chosen from 1 to n, and was not an edge that already existed. The graph is represented as an array edges of length n where edges[i] = [ai, bi] indicates that there is an edge between nodes ai and bi in the graph.\nReturn an edge that can be removed so that the resulting graph is a tree of n nodes. If there are multiple answers, return the answer that occurs last in the input.\n \nExample 1:\n\n\nInput: edges = [[1,2],[1,3],[2,3]]\nOutput: [2,3]\n\nExample 2:\n\n\nInput: edges = [[1,2],[2,3],[3,4],[1,4],[1,5]]\nOutput: [1,4]\n\n \nConstraints:\n\nn == edges.length\n3 <= n <= 1000\nedges[i].length == 2\n1 <= ai < bi <= edges.length\nai != bi\nThere are no repeated edges.\nThe given graph is connected.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [1, 4], [4, 5], [5, 1]]) == [1, 4]\n assert candidate(edges = [[3, 4], [1, 2], [2, 4], [3, 5], [2, 5]]) == [2, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 1]]) == [3, 1]\n assert candidate(edges = [[1, 2], [2, 3], [1, 3]]) == [1, 3]\n assert candidate(edges = [[1, 4], [3, 4], [1, 3], [1, 2], [4, 5]]) == [1, 3]\n assert candidate(edges = [[1, 2], [1, 3], [2, 3]]) == [2, 3]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [3, 5], [4, 5]]) == [4, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [1, 4], [1, 5]]) == [1, 4]\n assert candidate(edges = [[1, 2], [2, 3], [1, 3], [4, 5], [5, 6], [4, 6]]) == [1, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 3]]) == [5, 3]\n assert candidate(edges = [[1, 3], [3, 4], [1, 5], [3, 5], [2, 4]]) == [3, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [1, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 6], [1, 7], [2, 8], [3, 9], [4, 10], [5, 6], [7, 9], [8, 10], [1, 3], [2, 4], [5, 7], [6, 8], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 1], [15, 2]]) == [5, 1]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 9], [10, 11], [12, 13], [14, 15], [1, 8]]) == [8, 9]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 1], [1, 3]]) == [9, 1]\n assert candidate(edges = [[1, 2], [1, 3], [1, 4], [2, 4], [2, 5], [3, 5], [4, 6], [5, 6]]) == [2, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 5], [3, 6], [4, 7], [1, 8]]) == [10, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [2, 5], [3, 6]]) == [5, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [1, 20]]) == [1, 20]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 1], [1, 2]]) == [20, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 1]]) == [15, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 10], [5, 7]]) == [1, 10]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [5, 8]]) == [10, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [3, 6], [4, 7], [1, 8], [2, 9], [3, 10], [5, 8]]) == [10, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 10], [5, 10]]) == [1, 10]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 9], [10, 11], [12, 13], [14, 15], [9, 15], [1, 15], [2, 6], [3, 8], [4, 10], [5, 12], [6, 14], [7, 15]]) == [8, 9]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [5, 7]]) == [10, 1]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [4, 5], [5, 6]]) == [4, 5]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 16], [8, 17], [9, 18], [9, 19], [10, 20], [10, 21], [11, 22], [11, 23], [12, 24], [12, 25], [13, 26], [13, 27], [14, 28], [14, 29], [15, 30], [15, 31], [16, 17], [18, 19], [20, 21], [22, 23], [24, 25], [26, 27], [28, 29], [30, 31]]) == [16, 17]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 5]]) == [20, 5]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 4], [3, 5], [4, 5]]) == [3, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [1, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 1]]) == [1, 4]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 9], [10, 11], [12, 13], [14, 15], [15, 1]]) == [8, 9]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [2, 5]]) == [5, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 3], [5, 9]]) == [10, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [1, 3]]) == [5, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 5]]) == [10, 5]\n assert candidate(edges = [[1, 2], [1, 3], [1, 4], [1, 5], [2, 3], [2, 4], [2, 5], [3, 4], [3, 5], [4, 5], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6]]) == [2, 3]\n assert candidate(edges = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 10]]) == [5, 10]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 5], [3, 6], [4, 7], [1, 8], [2, 9]]) == [10, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 1], [1, 10]]) == [12, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 4], [6, 8]]) == [10, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 1]]) == [20, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [1, 3], [2, 4], [2, 5], [3, 5]]) == [5, 1]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [5, 7]]) == [5, 7]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 5], [3, 6], [4, 7], [1, 8], [2, 9], [3, 10]]) == [10, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 5]]) == [1, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [1, 4], [2, 4], [1, 3]]) == [1, 4]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 9], [10, 11], [12, 13], [14, 15], [9, 15], [1, 15]]) == [8, 9]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 1], [1, 3]]) == [6, 1]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 10]]) == [9, 10]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [1, 4], [4, 5], [5, 6], [6, 1]]) == [1, 4]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 16], [8, 17], [9, 18], [9, 19], [10, 20], [10, 21], [11, 22], [11, 23], [12, 24], [12, 25], [13, 26], [13, 27], [14, 28], [14, 29], [15, 30], [15, 31], [16, 32], [16, 33], [17, 34], [17, 35], [18, 36], [18, 37], [19, 38], [19, 39], [20, 40], [20, 41], [21, 42], [21, 43], [22, 44], [22, 45], [23, 46], [23, 47], [24, 48], [24, 49], [25, 50], [25, 51], [26, 52], [26, 53], [27, 54], [27, 55], [28, 56], [28, 57], [29, 58], [29, 59], [30, 60], [30, 61], [31, 62], [31, 63], [32, 64], [32, 65], [33, 66], [33, 67], [34, 68], [34, 69], [35, 70], [35, 71], [36, 72], [36, 73], [37, 74], [37, 75], [38, 76], [38, 77], [39, 78], [39, 79], [40, 80], [40, 81], [41, 82], [41, 83], [42, 84], [42, 85], [43, 86], [43, 87], [44, 88], [44, 89], [45, 90], [45, 91], [46, 92], [46, 93], [47, 94], [47, 95], [48, 96], [48, 97], [49, 98], [49, 99], [50, 100], [50, 1], [1, 50]]) == [50, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 1], [1, 3]]) == [16, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 10]]) == [1, 10]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [1, 11], [1, 3], [4, 7]]) == [1, 11]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 10], [4, 6], [7, 9]]) == [1, 10]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 1], [1, 10], [2, 11], [3, 12], [4, 13], [5, 14], [6, 15], [7, 1], [8, 2], [9, 3], [10, 4], [11, 5], [12, 6], [13, 7], [14, 8], [15, 9]]) == [15, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [1, 3], [3, 5], [5, 2]]) == [5, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 1], [2, 5]]) == [6, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1]]) == [10, 1]\n assert candidate(edges = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [1, 24], [1, 25], [1, 26], [1, 27], [1, 28], [1, 29], [1, 30], [1, 31], [1, 32], [1, 33], [1, 34], [1, 35], [1, 36], [1, 37], [1, 38], [1, 39], [1, 40], [1, 41], [1, 42], [1, 43], [1, 44], [1, 45], [1, 46], [1, 47], [1, 48], [1, 49], [1, 50], [1, 51], [1, 52], [1, 53], [1, 54], [1, 55], [1, 56], [1, 57], [1, 58], [1, 59], [1, 60], [1, 61], [1, 62], [1, 63], [1, 64], [1, 65], [1, 66], [1, 67], [1, 68], [1, 69], [1, 70], [1, 71], [1, 72], [1, 73], [1, 74], [1, 75], [1, 76], [1, 77], [1, 78], [1, 79], [1, 80], [1, 81], [1, 82], [1, 83], [1, 84], [1, 85], [1, 86], [1, 87], [1, 88], [1, 89], [1, 90], [1, 91], [1, 92], [1, 93], [1, 94], [1, 95], [1, 96], [1, 97], [1, 98], [1, 99], [1, 100], [2, 100]]) == [2, 100]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 1], [8, 2], [9, 3], [10, 4]]) == [10, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], [25, 26], [26, 27], [27, 28], [28, 29], [29, 30], [30, 31], [31, 32], [32, 33], [33, 34], [34, 35], [35, 36], [36, 37], [37, 38], [38, 39], [39, 40], [40, 1], [1, 3]]) == [40, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 10], [2, 4], [3, 5], [6, 8], [7, 9]]) == [1, 10]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 10]]) == [20, 10]\n assert candidate(edges = [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 5]]) == [2, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 10], [2, 5]]) == [1, 10]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [2, 4]]) == [5, 1]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 9], [10, 11], [12, 13], [14, 15], [1, 15]]) == [8, 9]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 5], [3, 6]]) == [10, 5]\n assert candidate(edges = [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4], [4, 5], [5, 6], [6, 1], [1, 5]]) == [2, 3]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 9], [10, 11], [12, 13], [14, 15], [9, 15]]) == [8, 9]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [6, 7], [7, 8], [8, 9], [9, 10], [10, 6]]) == [5, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 5], [3, 6], [4, 7]]) == [10, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 1], [1, 4]]) == [13, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [1, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 6], [1, 7], [2, 8], [3, 9], [4, 10], [5, 6], [7, 9], [8, 10]]) == [5, 1]\n"}, "metadata": {"canonical_parameter_names": ["edges"], "leetcode_dataset_entry_point": "Solution().findRedundantConnection", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findRedundantConnection = function(edges) {", "container": null, "callable": "findRedundantConnection", "parameters": [{"name": "edges", "type": "number[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 685, "task_id": "redundant-connection-ii", "difficulty": "Hard", "problem_description": "In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all other nodes are descendants of this node, plus every node has exactly one parent, except for the root node which has no parents.\nThe given input is a directed graph that started as a rooted tree with n nodes (with distinct values from 1 to n), with one additional directed edge added. The added edge has two different vertices chosen from 1 to n, and was not an edge that already existed.\nThe resulting graph is given as a 2D-array of edges. Each element of edges is a pair [ui, vi] that represents a directed edge connecting nodes ui and vi, where ui is a parent of child vi.\nReturn an edge that can be removed so that the resulting graph is a rooted tree of n nodes. If there are multiple answers, return the answer that occurs last in the given 2D-array.\n \nExample 1:\n\n\nInput: edges = [[1,2],[1,3],[2,3]]\nOutput: [2,3]\n\nExample 2:\n\n\nInput: edges = [[1,2],[2,3],[3,4],[4,1],[1,5]]\nOutput: [4,1]\n\n \nConstraints:\n\nn == edges.length\n3 <= n <= 1000\nedges[i].length == 2\n1 <= ui, vi <= n\nui != vi\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(edges = [[3, 1], [4, 1], [5, 2], [3, 2], [3, 5]]) == [3, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 1]]) == [3, 1]\n assert candidate(edges = [[3, 1], [4, 1], [5, 2], [3, 5], [4, 2]]) == [4, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 1], [4, 3]]) == [2, 3]\n assert candidate(edges = [[2, 1], [3, 1], [1, 4], [4, 3]]) == [3, 1]\n assert candidate(edges = [[1, 2], [1, 3], [2, 3]]) == [2, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 2], [1, 5], [5, 2]]) == [4, 2]\n assert candidate(edges = [[1, 2], [2, 3], [3, 1], [1, 4]]) == [3, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 2]]) == [3, 2]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 1], [1, 5]]) == [4, 1]\n assert candidate(edges = [[2, 1], [3, 1], [4, 2], [1, 4]]) == [2, 1]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [6, 11], [7, 12], [8, 13], [9, 14], [10, 15], [11, 16], [12, 17], [13, 18], [14, 19], [15, 20], [16, 21], [17, 22], [18, 23], [19, 24], [20, 25], [21, 26], [22, 27], [23, 28], [24, 29], [25, 30], [30, 1]]) == [30, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 3]]) == [12, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 4]]) == [12, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 8]]) == [14, 8]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 1]]) == [15, 1]\n assert candidate(edges = [[3, 1], [4, 1], [5, 1], [3, 2], [3, 4], [3, 5]]) == [3, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1], [11, 1], [12, 1], [13, 1], [14, 1], [15, 1], [16, 1], [17, 1], [18, 1], [19, 1], [20, 1]]) == [5, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 1], [1, 3], [2, 5], [3, 6]]) == [2, 3]\n assert candidate(edges = [[10, 1], [1, 2], [1, 3], [2, 4], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == [2, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [3, 6]]) == [5, 1]\n assert candidate(edges = [[5, 1], [1, 2], [2, 3], [3, 4], [4, 1], [1, 5]]) == [5, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 4]]) == [10, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 4], [7, 1]]) == [6, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 3], [3, 6], [6, 7]]) == [5, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1]]) == [10, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 1], [2, 4]]) == [3, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 6]]) == [11, 6]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [3, 4], [4, 5], [5, 1]]) == [2, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [1, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 11]]) == [1, 11]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 3], [1, 6]]) == [5, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 3]]) == [5, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], [25, 10]]) == [25, 10]\n assert candidate(edges = [[5, 2], [1, 5], [4, 1], [3, 5], [4, 3]]) == [3, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 1], [1, 3]]) == [2, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 1]]) == [9, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 3]]) == [9, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 5], [1, 5]]) == [10, 5]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 1], [12, 2]]) == [1, 2]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 5], [1, 9]]) == [8, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [1, 5]]) == [4, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 5], [5, 4], [4, 2], [1, 4]]) == [1, 2]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [3, 4], [4, 5], [5, 6], [6, 2]]) == [1, 2]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 1], [1, 8], [8, 9], [9, 10], [10, 7]]) == [6, 7]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 1]]) == [11, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [1, 3]]) == [2, 3]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [6, 11], [7, 12], [8, 13], [9, 14], [10, 15], [11, 16], [12, 17], [13, 18], [14, 19], [15, 20], [16, 21], [17, 22], [18, 23], [19, 24], [20, 25], [21, 26], [22, 27], [23, 28], [24, 29], [25, 30], [30, 15]]) == [30, 15]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 3]]) == [11, 3]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [3, 4], [4, 5], [5, 6], [6, 7], [7, 1]]) == [2, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 3], [2, 4]]) == [2, 3]\n assert candidate(edges = [[5, 3], [1, 5], [2, 3], [4, 1], [5, 2], [4, 5]]) == [5, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [1, 3], [2, 5]]) == [2, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 2]]) == [6, 2]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 2]]) == [10, 2]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 7]]) == [13, 7]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 3], [1, 6], [6, 7]]) == [5, 3]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 4]]) == [3, 4]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [6, 8], [7, 8], [8, 2]]) == [1, 2]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [3, 4], [4, 5], [5, 6], [6, 7], [7, 3]]) == [1, 3]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 5]]) == [2, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], [25, 26], [26, 27], [27, 28], [28, 29], [29, 30], [30, 15]]) == [30, 15]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 6]]) == [9, 6]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 5]]) == [12, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], [25, 26], [26, 27], [27, 28], [28, 29], [29, 30], [30, 1]]) == [30, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 2]]) == [5, 2]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 1], [20, 2]]) == [1, 2]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 4]]) == [6, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [2, 10], [3, 10], [5, 10]]) == [10, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 5]]) == [20, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 2]]) == [9, 2]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [6, 5], [7, 6], [8, 7], [9, 8], [10, 9], [11, 10], [12, 11], [13, 12], [1, 13]]) == [4, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 5]]) == [10, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 3]]) == [10, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 3], [1, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == [5, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 4], [1, 9], [9, 10], [10, 1]]) == [3, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [1, 3], [3, 5]]) == [2, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [4, 2]]) == [1, 2]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 5]]) == [9, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [2, 4]]) == [3, 4]\n assert candidate(edges = [[2, 3], [4, 3], [5, 3], [1, 4], [2, 5], [4, 5]]) == [2, 5]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 9]]) == [8, 9]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [2, 10], [5, 10]]) == [10, 1]\n assert candidate(edges = [[1, 3], [2, 3], [3, 4], [4, 5], [5, 1], [6, 1]]) == [1, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 5], [1, 10]]) == [4, 5]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 7]]) == [14, 7]\n assert candidate(edges = [[1, 2], [1, 3], [1, 4], [1, 5], [2, 6], [3, 6], [4, 6], [5, 6], [2, 3]]) == [1, 3]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 13]]) == [20, 13]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 4]]) == [8, 4]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 7]]) == [9, 7]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [3, 4], [4, 5], [5, 2]]) == [1, 2]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 4]]) == [9, 4]\n assert candidate(edges = [[1, 5], [2, 5], [3, 5], [4, 5], [5, 1]]) == [5, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 3], [6, 4]]) == [3, 4]\n assert candidate(edges = [[1, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [9, 5]]) == [9, 5]\n"}, "metadata": {"canonical_parameter_names": ["edges"], "leetcode_dataset_entry_point": "Solution().findRedundantDirectedConnection", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findRedundantDirectedConnection = function(edges) {", "container": null, "callable": "findRedundantDirectedConnection", "parameters": [{"name": "edges", "type": "number[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 686, "task_id": "repeated-string-match", "difficulty": "Medium", "problem_description": "Given two strings a and b, return the minimum number of times you should repeat string a so that string b is a substring of it. If it is impossible for b​​​​​​ to be a substring of a after repeating it, return -1.\nNotice: string \"abc\" repeated 0 times is \"\", repeated 1 time is \"abc\" and repeated 2 times is \"abcabc\".\n \nExample 1:\n\nInput: a = \"abcd\", b = \"cdabcdab\"\nOutput: 3\nExplanation: We return 3 because by repeating a three times \"abcdabcdabcd\", b is a substring of it.\n\nExample 2:\n\nInput: a = \"a\", b = \"aa\"\nOutput: 2\n\n \nConstraints:\n\n1 <= a.length, b.length <= 104\na and b consist of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(a = \"abab\",b = \"abababab\") == 2\n assert candidate(a = \"ab\",b = \"aba\") == 2\n assert candidate(a = \"abc\",b = \"def\") == -1\n assert candidate(a = \"abc\",b = \"abcabc\") == 2\n assert candidate(a = \"aaaaaaaaaaaaaaaaaaaaaab\",b = \"ba\") == 2\n assert candidate(a = \"abcd\",b = \"cdabcdab\") == 3\n assert candidate(a = \"abc\",b = \"ac\") == -1\n assert candidate(a = \"abcd\",b = \"abcdabcd\") == 2\n assert candidate(a = \"xyz\",b = \"xyzxyzxyz\") == 3\n assert candidate(a = \"abc\",b = \"abcabcabc\") == 3\n assert candidate(a = \"abc\",b = \"bca\") == 2\n assert candidate(a = \"abc\",b = \"cab\") == 2\n assert candidate(a = \"a\",b = \"a\") == 1\n assert candidate(a = \"a\",b = \"aa\") == 2\n assert candidate(a = \"abc\",b = \"acbac\") == -1\n assert candidate(a = \"aaaa\",b = \"aa\") == 1\n assert candidate(a = \"abcd\",b = \"dddd\") == -1\n assert candidate(a = \"hello\",b = \"ohell\") == 2\n assert candidate(a = \"abcd\",b = \"cabd\") == -1\n assert candidate(a = \"abcd\",b = \"dabcabcdabc\") == -1\n assert candidate(a = \"a\",b = \"b\") == -1\n assert candidate(a = \"xyz\",b = \"xyzyzyzx\") == -1\n assert candidate(a = \"abc\",b = \"cabcabca\") == 4\n assert candidate(a = \"abcd\",b = \"dabcdabcdabcdabc\") == 5\n assert candidate(a = \"qrstuv\",b = \"uvqrstuvqrstuv\") == 3\n assert candidate(a = \"abc\",b = \"abcabcabcabcabcabcabcabcabcabc\") == 10\n assert candidate(a = \"abcd\",b = \"dcba\") == -1\n assert candidate(a = \"sequence\",b = \"encesequ\") == 2\n assert candidate(a = \"hello\",b = \"lohellohel\") == 3\n assert candidate(a = \"abcabcabc\",b = \"cababcabcab\") == -1\n assert candidate(a = \"hello\",b = \"lohelohello\") == -1\n assert candidate(a = \"abcd\",b = \"cdabc\") == 2\n assert candidate(a = \"repeat\",b = \"peatreprea\") == -1\n assert candidate(a = \"ab\",b = \"babababababab\") == 7\n assert candidate(a = \"abcdefg\",b = \"efgabcdefgabc\") == 3\n assert candidate(a = \"abcde\",b = \"cdeabcd\") == 2\n assert candidate(a = \"aabb\",b = \"bbaabbaa\") == 3\n assert candidate(a = \"zzzz\",b = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == 11\n assert candidate(a = \"abcdefg\",b = \"efgabcdefgabcd\") == 3\n assert candidate(a = \"ab\",b = \"babababab\") == 5\n assert candidate(a = \"abcde\",b = \"cdeabcdeabcde\") == 3\n assert candidate(a = \"abcd\",b = \"abcdabcdabcdabcdabcdab\") == 6\n assert candidate(a = \"abcabc\",b = \"bcabcabc\") == 2\n assert candidate(a = \"algorithm\",b = \"rithmalgorith\") == 2\n assert candidate(a = \"unique\",b = \"queuniqueuni\") == 3\n assert candidate(a = \"xyz\",b = \"xyzxyzxyzxyzxyz\") == 5\n assert candidate(a = \"abcd\",b = \"dabcdabcdabc\") == 4\n assert candidate(a = \"zzz\",b = \"zzzzzzzz\") == 3\n assert candidate(a = \"xyz\",b = \"yzxyzxyzyx\") == -1\n assert candidate(a = \"aaa\",b = \"aaaaaaaaaaaa\") == 4\n assert candidate(a = \"abcdefg\",b = \"defgabcdefgab\") == 3\n assert candidate(a = \"aaaab\",b = \"babaaabaaaab\") == -1\n assert candidate(a = \"abcdefg\",b = \"fgabcdefgabc\") == 3\n assert candidate(a = \"repeat\",b = \"atrepeatrepeatrep\") == 4\n assert candidate(a = \"abcde\",b = \"cdeabcdea\") == 3\n assert candidate(a = \"uvwxy\",b = \"xyuvwxyuvwx\") == 3\n assert candidate(a = \"aaaa\",b = \"aaaaaaaaa\") == 3\n assert candidate(a = \"ab\",b = \"babababababababab\") == 9\n assert candidate(a = \"repeat\",b = \"atrepeatrep\") == 3\n assert candidate(a = \"aabbcc\",b = \"ccccaabbaabbcccc\") == -1\n assert candidate(a = \"test\",b = \"sttestte\") == 3\n assert candidate(a = \"ab\",b = \"bababababa\") == 6\n assert candidate(a = \"abcdef\",b = \"defabcdeabcf\") == -1\n assert candidate(a = \"zyxwv\",b = \"wvzyxwvzyxwv\") == 3\n assert candidate(a = \"abac\",b = \"acabacaba\") == 3\n assert candidate(a = \"abcdef\",b = \"defabcdefabc\") == 3\n assert candidate(a = \"ababab\",b = \"babababababab\") == 3\n assert candidate(a = \"aabb\",b = \"bbaabbbaab\") == -1\n assert candidate(a = \"zzz\",b = \"zzzzzzzzzzzzzzzzzzzz\") == 7\n assert candidate(a = \"complex\",b = \"lexcomplexc\") == 3\n assert candidate(a = \"abcde\",b = \"eabcdeabcdeabcd\") == 4\n assert candidate(a = \"abcd\",b = \"abcdabcdabcdabcdabcd\") == 5\n assert candidate(a = \"abcdefg\",b = \"fgabcdefgabcde\") == 3\n assert candidate(a = \"abcde\",b = \"cdecdecdec\") == -1\n assert candidate(a = \"pattern\",b = \"ternpatternpat\") == 3\n assert candidate(a = \"abcabc\",b = \"cabcabcabc\") == 2\n assert candidate(a = \"ab\",b = \"babababa\") == 5\n assert candidate(a = \"xyz\",b = \"zzzzxyzzz\") == -1\n assert candidate(a = \"abcd\",b = \"ddddddddddddddddddd\") == -1\n assert candidate(a = \"aabb\",b = \"bbaabbbaabb\") == -1\n assert candidate(a = \"abac\",b = \"cabacaba\") == 3\n assert candidate(a = \"xyz\",b = \"zyxzyxzyxzyx\") == -1\n assert candidate(a = \"pattern\",b = \"ternpatte\") == 2\n assert candidate(a = \"test\",b = \"sttesttest\") == 3\n assert candidate(a = \"abcd\",b = \"cdabcdabcdabcdab\") == 5\n assert candidate(a = \"abcabc\",b = \"cabcabcabcabcab\") == 3\n assert candidate(a = \"xyz\",b = \"xyzxyzxyzxyz\") == 4\n assert candidate(a = \"abcd\",b = \"dddddddd\") == -1\n assert candidate(a = \"abcd\",b = \"cdabcda\") == 3\n assert candidate(a = \"abc\",b = \"bcabcabc\") == 3\n assert candidate(a = \"ace\",b = \"aceaceaceace\") == 4\n assert candidate(a = \"xyzxyz\",b = \"zyxzyxzyxzyxzyxzyxzyx\") == -1\n assert candidate(a = \"abc\",b = \"cababc\") == -1\n assert candidate(a = \"abcdefgh\",b = \"habcdefghabc\") == 3\n assert candidate(a = \"a\",b = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == 40\n assert candidate(a = \"abcabcabc\",b = \"cccc\") == -1\n assert candidate(a = \"abcd\",b = \"dabcdabc\") == 3\n assert candidate(a = \"mnopqr\",b = \"qrmonpqrmon\") == -1\n assert candidate(a = \"xyzabc\",b = \"bcxyzabcxy\") == 3\n assert candidate(a = \"pattern\",b = \"ternpattern\") == 2\n assert candidate(a = \"abcabc\",b = \"cabcabcab\") == 2\n assert candidate(a = \"unique\",b = \"niqueuniq\") == 2\n assert candidate(a = \"substring\",b = \"stringsubstr\") == 2\n assert candidate(a = \"mnop\",b = \"onmnoponmnop\") == -1\n assert candidate(a = \"abcdefg\",b = \"efgabcdefgabcdefgabcdefg\") == 4\n assert candidate(a = \"abcdabcd\",b = \"cdabcdabcdabcd\") == 2\n assert candidate(a = \"ab\",b = \"bababababab\") == 6\n assert candidate(a = \"abcabc\",b = \"cabcabcabca\") == 3\n assert candidate(a = \"abcd\",b = \"dcbaabcdabcda\") == -1\n assert candidate(a = \"ab\",b = \"ababababab\") == 5\n assert candidate(a = \"abcdabcdabcd\",b = \"dabcdabcdabc\") == 2\n assert candidate(a = \"xyzyzyz\",b = \"zyzyzyzyzyzy\") == -1\n assert candidate(a = \"abcde\",b = \"eabcdeabcd\") == 3\n assert candidate(a = \"a\",b = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == 32\n assert candidate(a = \"a\",b = \"abababababababab\") == -1\n assert candidate(a = \"abcde\",b = \"deabcdeabcdeabcdeabcd\") == 5\n assert candidate(a = \"aaaa\",b = \"aaaaaaaaaa\") == 3\n assert candidate(a = \"pattern\",b = \"ernpatternpatt\") == 3\n assert candidate(a = \"abcdef\",b = \"defabcdeabc\") == -1\n assert candidate(a = \"abcdefabcdef\",b = \"defabcdefabc\") == 2\n assert candidate(a = \"abcdefgh\",b = \"fghabcdefgha\") == 3\n assert candidate(a = \"a\",b = \"aaaaaaaaaaaaa\") == 13\n assert candidate(a = \"abcdef\",b = \"defabcde\") == 2\n assert candidate(a = \"xy\",b = \"yxyxyxyxyxyxyx\") == 8\n assert candidate(a = \"abcdeabcde\",b = \"cdecdecdecdec\") == -1\n assert candidate(a = \"abcdefgabcdefg\",b = \"fgabcdefgabcdefgabc\") == 2\n assert candidate(a = \"ababab\",b = \"bababa\") == 2\n assert candidate(a = \"abcabcabc\",b = \"bcabcabcabcabc\") == 2\n assert candidate(a = \"abcde\",b = \"eabcdeabcdeabc\") == 4\n assert candidate(a = \"abcdef\",b = \"fedcbafedcba\") == -1\n assert candidate(a = \"aaa\",b = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == 19\n assert candidate(a = \"abababa\",b = \"babababababab\") == -1\n assert candidate(a = \"ab\",b = \"\") == 0\n assert candidate(a = \"abc\",b = \"cba\") == -1\n assert candidate(a = \"abcde\",b = \"deabcdeabc\") == 3\n assert candidate(a = \"abab\",b = \"babbababbababbababbababbababbaba\") == -1\n assert candidate(a = \"xyzxyz\",b = \"zyxzyxzyxzyxzyxzyx\") == -1\n assert candidate(a = \"abcabcabc\",b = \"abcabcabcabcabcabcabcabc\") == 3\n assert candidate(a = \"xy\",b = \"yxyxyxyx\") == 5\n assert candidate(a = \"repeat\",b = \"peatrepeatre\") == 3\n assert candidate(a = \"hello\",b = \"hellohellohello\") == 3\n assert candidate(a = \"abc\",b = \"cabcabcabcabcab\") == 6\n assert candidate(a = \"abc\",b = \"cbaabcab\") == -1\n assert candidate(a = \"xyz\",b = \"zyxzyxzyx\") == -1\n"}, "metadata": {"canonical_parameter_names": ["a", "b"], "leetcode_dataset_entry_point": "Solution().repeatedStringMatch", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var repeatedStringMatch = function(a, b) {", "container": null, "callable": "repeatedStringMatch", "parameters": [{"name": "a", "type": "string"}, {"name": "b", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 687, "task_id": "longest-univalue-path", "difficulty": "Medium", "problem_description": "Given the root of a binary tree, return the length of the longest path, where each node in the path has the same value. This path may or may not pass through the root.\nThe length of the path between two nodes is represented by the number of edges between them.\n \nExample 1:\n\n\nInput: root = [5,4,5,1,1,null,5]\nOutput: 2\nExplanation: The shown image shows that the longest path of the same value (i.e. 5).\n\nExample 2:\n\n\nInput: root = [1,4,5,4,4,null,5]\nOutput: 2\nExplanation: The shown image shows that the longest path of the same value (i.e. 4).\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [0, 104].\n-1000 <= Node.val <= 1000\nThe depth of the tree will not exceed 1000.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7])) == 0\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5])) == 0\n assert candidate(root = tree_node([5, 4, 5, 1, 1, None, 5])) == 2\n assert candidate(root = tree_node([1, 4, 5, 4, 4, None, 5])) == 2\n assert candidate(root = tree_node([1, None, 1, None, 1, 1, None])) == 3\n assert candidate(root = tree_node([1, 2])) == 0\n assert candidate(root = tree_node([1, 1, 1, 1])) == 3\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, 5])) == 5\n assert candidate(root = tree_node([])) == 0\n assert candidate(root = tree_node([1, 2, 2, None, None, 3, 3, 3, 3, None, None, None, None, 4, 4, 4, 4, None, None, None, None, None, None, 5, 5, 5, 5])) == 2\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == 0\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 10\n assert candidate(root = tree_node([5, 4, 5, 1, 1, 5, 5, 1, 1, None, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])) == 5\n assert candidate(root = tree_node([1, 2, 2, 2, 3, 3, 3, None, 3, None, None, 3, None, 3])) == 1\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, None, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1])) == 9\n assert candidate(root = tree_node([1, 2, 2, 3, 3, None, None, 3, 3])) == 2\n assert candidate(root = tree_node([1, 1, 1, 1, 1, None, 1, 1, None, 1, 1, None, 1, None, None, 1, None, 1])) == 7\n assert candidate(root = tree_node([5, 4, 5, 4, 4, None, 5, 4, 4, None, None, 5, 5, 5, 5, None, None, 5, 5, None, None, 5, 5, None, None, 5, 5])) == 5\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])) == 8\n assert candidate(root = tree_node([1, 4, 4, 4, 4, 1, 1, 4, None, None, None, None, None, None, 4])) == 3\n assert candidate(root = tree_node([1, 1, 2, 1, 1, 2, 2, 1, None, 1, None, 2, None, 2, None, 2])) == 4\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 11\n assert candidate(root = tree_node([4, 4, None, 4, 4, 4, None, None, 4, 4, None, 4, None, None, 4])) == 7\n assert candidate(root = tree_node([1, 1, 1, 1, 1, None, None, 1, 1, None, 1, 1, None, 1])) == 5\n assert candidate(root = tree_node([1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1])) == 8\n assert candidate(root = tree_node([2, 2, 2, None, 2, 2, None, 2, None, 2, None, 2, None, 2, None])) == 8\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2])) == 8\n assert candidate(root = tree_node([1, 4, 4, 4, 4, 1, 1, 4, 4, 4, 4, 2, 2, 2, 2])) == 4\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5])) == 5\n assert candidate(root = tree_node([1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1])) == 12\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, 5, 5])) == 5\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 11\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 8\n assert candidate(root = tree_node([1, 1, 1, 1, None, 1, None, 1, 1, None, 1, None, 1, None, 1])) == 7\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, None, None, 1, 1, 1, 1, None, None, None, None, 1, 1, 1, 1, 1, 1, 1])) == 9\n assert candidate(root = tree_node([1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4])) == 2\n assert candidate(root = tree_node([3, 3, None, 3, None, 3, None, 3, None, 3, None, 3, None, 3, None, 3])) == 8\n assert candidate(root = tree_node([1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3])) == 3\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, None, 3])) == 7\n assert candidate(root = tree_node([1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1])) == 4\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 9\n assert candidate(root = tree_node([7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7])) == 9\n assert candidate(root = tree_node([5, 4, 5, 4, 4, None, 5, 4, 4, None, None, 5, 5, 5, 5, None, None, 5, 5, 5, None, None, 5, 5, 5, None, None, 5, 5, 5, None, None, 5, 5, 5, None, None, 5, 5, 5, None, None, 5, 5, 5, None, None, 5])) == 8\n assert candidate(root = tree_node([1, 2, 2, 3, 3, 3, 3, None, None, None, None, None, None, 4, 4])) == 0\n assert candidate(root = tree_node([1, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2])) == 6\n assert candidate(root = tree_node([5, 5, 5, 1, 1, 5, 5, None, None, 5, 5, 5, None, None, 5])) == 4\n assert candidate(root = tree_node([1, 4, 5, 4, 4, None, 5, 1, 1, 1, 1, None, 5, 5, 5, 1, 1, 1, 1])) == 2\n assert candidate(root = tree_node([5, 4, 5, 4, 4, None, 5, 4, 4, None, 4, 5, 5, None, 5, 5, 5])) == 4\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == 0\n assert candidate(root = tree_node([2, 2, 2, 2, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2])) == 13\n assert candidate(root = tree_node([5, 4, 5, 4, 4, None, 5, 1, None, 2, None, 5, 5])) == 3\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == 0\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3, 3, None, None, 3, None, None, 3, None, None, 3, None, None, 3, None, None, 3, None, None, 3, None, None, 3])) == 11\n assert candidate(root = tree_node([1, 2, 2, 3, 3, 3, 3, None, None, 4, 4, None, None, 5, 5])) == 0\n assert candidate(root = tree_node([1, 2, 2, None, 2, 2, None, None, 2, 2, None, None, 2, 2, 2])) == 3\n assert candidate(root = tree_node([1, 2, 3, 2, 2, 3, 3, 2, 2, None, None, None, None, 3, None])) == 3\n assert candidate(root = tree_node([1, 1, 2, 1, None, 2, 1, None, None, None, 1, 1])) == 2\n assert candidate(root = tree_node([5, 5, 5, 5, 5, None, 5, None, None, 5, 5, 5, None, None, 5, 5, 5, 5, 5, 5, 5, 5, 5])) == 9\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, None, None, 5, 5, 5, 5, None, None, 5, 5, None, None, 5, 5, None, None, 5])) == 9\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == 0\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50])) == 0\n assert candidate(root = tree_node([5, 4, 5, 4, 4, None, 5, 1, 1, None, 1, 1, None, 1])) == 2\n assert candidate(root = tree_node([7, 7, 7, 7, 7, None, None, 7, 7, 7, None, None, 7, 7, 7, None, None, 7, 7, 7, None, None, 7, 7, 7, None, None, 7, 7, 7, None, None, 7, 7, 7, None, None, 7, 7, 7, None, None, 7, 7, 7])) == 11\n assert candidate(root = tree_node([5, 4, 5, 4, 4, None, 5, 4, None, None, None, None, 4, 4])) == 4\n assert candidate(root = tree_node([1, 2, 1, 1, 3, 1, 1, None, None, None, None, None, None, 1, 1, 1])) == 4\n assert candidate(root = tree_node([1, 1, 1, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1])) == 9\n assert candidate(root = tree_node([5, 4, 5, 4, 4, None, 5, None, None, None, None, 5, 5, None, None, 5, 5, None, None, 5, 5])) == 5\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])) == 11\n assert candidate(root = tree_node([1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1])) == 7\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 9\n assert candidate(root = tree_node([1, 2, 3, 2, 2, 3, 3, 2, 2, None, None, 3, None, 3, None, None, 3])) == 4\n assert candidate(root = tree_node([1, 1, 1, 1, None, None, 1, None, None, None, None, 1, None, None, None, 1])) == 4\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3, None, 3, 3, None, None, 3, 3, 3, None, None, 3, 3])) == 7\n assert candidate(root = tree_node([1, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2])) == 4\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 6\n assert candidate(root = tree_node([1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4])) == 2\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5])) == 4\n assert candidate(root = tree_node([1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4])) == 0\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, None, 5, 5, None, 5, None, 5, 5, None, 5, 5])) == 7\n assert candidate(root = tree_node([5, 4, 5, 4, 4, 5, 5, None, None, 4, 4, None, None, 4, 4])) == 3\n assert candidate(root = tree_node([5, 4, 5, 1, 1, 5, 5, None, None, None, None, 5, 5])) == 3\n assert candidate(root = tree_node([1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2])) == 6\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 9\n assert candidate(root = tree_node([1, 1, 1, 1, 1, None, 1, 1, None, 1, 1, None, 1])) == 6\n assert candidate(root = tree_node([1, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2])) == 12\n assert candidate(root = tree_node([1, 1, 1, 1, 1, None, None, 1, 1, None, None, 1, 1])) == 5\n assert candidate(root = tree_node([1, 1, 1, 1, None, 1, 1, 1, None, None, 1, 1, None, 1, 1, 1, None, 1])) == 8\n assert candidate(root = tree_node([2, 2, 2, None, 2, None, 2, 2, None, 2, 2, None, 2])) == 7\n assert candidate(root = tree_node([5, 5, 5, 5, 5, None, None, 5, 5, 5, 5, None, None, 5, 5, 5, 5])) == 6\n assert candidate(root = tree_node([1, 2, 2, None, 3, None, 3, 3, None, None, 3])) == 1\n assert candidate(root = tree_node([1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1])) == 9\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 10\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 8\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, None, None, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 11\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 8\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 9\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3])) == 7\n assert candidate(root = tree_node([1, 1, 1, None, 1, None, 1, 1, 1, None, 1, None, 1, 1, 1, None, 1, None, 1])) == 9\n assert candidate(root = tree_node([5, None, 5, 5, None, None, 5, None, 5, 5, None, 5, None, 5, None, 5])) == 8\n assert candidate(root = tree_node([1, None, 1, None, 1, None, 1, None, 1, None, 1, 1, 1, 1, 1])) == 7\n assert candidate(root = tree_node([1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7])) == 0\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, None, None, None, None, 5, 5, None, 5, 5, 5, None, 5, 5, None, 5])) == 7\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 7\n assert candidate(root = tree_node([1, 2, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3])) == 4\n assert candidate(root = tree_node([2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2])) == 8\n assert candidate(root = tree_node([2, 2, 2, 2, 2, 2, 2, None, 2, 2, None, 2, None, 2, 2, None, 2, 2])) == 7\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().longestUnivaluePath", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var longestUnivaluePath = function(root) {", "container": null, "callable": "longestUnivaluePath", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 688, "task_id": "knight-probability-in-chessboard", "difficulty": "Medium", "problem_description": "On an n x n chessboard, a knight starts at the cell (row, column) and attempts to make exactly k moves. The rows and columns are 0-indexed, so the top-left cell is (0, 0), and the bottom-right cell is (n - 1, n - 1).\nA chess knight has eight possible moves it can make, as illustrated below. Each move is two cells in a cardinal direction, then one cell in an orthogonal direction.\n\nEach time the knight is to move, it chooses one of eight possible moves uniformly at random (even if the piece would go off the chessboard) and moves there.\nThe knight continues moving until it has made exactly k moves or has moved off the chessboard.\nReturn the probability that the knight remains on the board after it has stopped moving.\n \nExample 1:\n\nInput: n = 3, k = 2, row = 0, column = 0\nOutput: 0.06250\nExplanation: There are two moves (to (1,2), (2,1)) that will keep the knight on the board.\nFrom each of those positions, there are also two moves that will keep the knight on the board.\nThe total probability the knight stays on the board is 0.0625.\n\nExample 2:\n\nInput: n = 1, k = 0, row = 0, column = 0\nOutput: 1.00000\n\n \nConstraints:\n\n1 <= n <= 25\n0 <= k <= 100\n0 <= row, column <= n - 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 3,k = 2,row = 0,column = 0) == 0.0625\n assert candidate(n = 5,k = 3,row = 2,column = 2) == 0.25\n assert candidate(n = 1,k = 0,row = 0,column = 0) == 1\n assert candidate(n = 25,k = 10,row = 5,column = 5) == 0.6104710195213556\n assert candidate(n = 8,k = 5,row = 3,column = 3) == 0.35565185546875\n assert candidate(n = 16,k = 4,row = 8,column = 8) == 0.9921875\n assert candidate(n = 20,k = 50,row = 0,column = 0) == 0.004271113933844097\n assert candidate(n = 10,k = 10,row = 3,column = 7) == 0.16516215726733208\n assert candidate(n = 18,k = 18,row = 9,column = 9) == 0.4891442786281308\n assert candidate(n = 7,k = 3,row = 3,column = 0) == 0.2578125\n assert candidate(n = 20,k = 30,row = 5,column = 5) == 0.20150920194594582\n assert candidate(n = 20,k = 30,row = 10,column = 10) == 0.3188507083330616\n assert candidate(n = 16,k = 10,row = 15,column = 0) == 0.04366329871118069\n assert candidate(n = 24,k = 8,row = 0,column = 23) == 0.054056644439697266\n assert candidate(n = 18,k = 40,row = 9,column = 9) == 0.11635625115510018\n assert candidate(n = 7,k = 7,row = 3,column = 3) == 0.1180572509765625\n assert candidate(n = 25,k = 100,row = 12,column = 12) == 0.04742876069380138\n assert candidate(n = 12,k = 25,row = 6,column = 6) == 0.04940514803013356\n assert candidate(n = 12,k = 10,row = 2,column = 2) == 0.1920044720172882\n assert candidate(n = 20,k = 5,row = 19,column = 19) == 0.0821533203125\n assert candidate(n = 15,k = 5,row = 7,column = 7) == 0.9296875\n assert candidate(n = 15,k = 20,row = 7,column = 7) == 0.25474967076243493\n assert candidate(n = 18,k = 40,row = 8,column = 8) == 0.11635625115510018\n assert candidate(n = 20,k = 5,row = 10,column = 10) == 0.998046875\n assert candidate(n = 15,k = 20,row = 14,column = 0) == 0.016829922789494044\n assert candidate(n = 10,k = 15,row = 5,column = 5) == 0.08643433569193348\n assert candidate(n = 20,k = 20,row = 10,column = 10) == 0.5426220046393063\n assert candidate(n = 10,k = 5,row = 7,column = 3) == 0.432373046875\n assert candidate(n = 12,k = 3,row = 0,column = 0) == 0.125\n assert candidate(n = 25,k = 10,row = 0,column = 0) == 0.04390144161880016\n assert candidate(n = 12,k = 4,row = 6,column = 6) == 0.86083984375\n assert candidate(n = 20,k = 30,row = 15,column = 15) == 0.1555184742490744\n assert candidate(n = 12,k = 40,row = 3,column = 3) == 0.004399547953837918\n assert candidate(n = 22,k = 80,row = 11,column = 11) == 0.044116795483744795\n assert candidate(n = 25,k = 75,row = 20,column = 20) == 0.03918538196240853\n assert candidate(n = 18,k = 60,row = 8,column = 8) == 0.03143644403748678\n assert candidate(n = 11,k = 10,row = 3,column = 3) == 0.2401371169835329\n assert candidate(n = 25,k = 50,row = 12,column = 12) == 0.2764224343078947\n assert candidate(n = 20,k = 5,row = 19,column = 0) == 0.0821533203125\n assert candidate(n = 25,k = 10,row = 10,column = 10) == 0.9512526337057352\n assert candidate(n = 10,k = 5,row = 0,column = 0) == 0.08154296875\n assert candidate(n = 25,k = 0,row = 24,column = 24) == 1\n assert candidate(n = 9,k = 15,row = 4,column = 4) == 0.04816485046694652\n assert candidate(n = 10,k = 10,row = 4,column = 5) == 0.22588835656642914\n assert candidate(n = 25,k = 1,row = 0,column = 0) == 0.25\n assert candidate(n = 15,k = 25,row = 7,column = 7) == 0.16093826349037266\n assert candidate(n = 25,k = 1,row = 24,column = 24) == 0.25\n assert candidate(n = 15,k = 5,row = 14,column = 14) == 0.0821533203125\n assert candidate(n = 20,k = 2,row = 19,column = 0) == 0.1875\n assert candidate(n = 12,k = 1,row = 11,column = 11) == 0.25\n assert candidate(n = 18,k = 15,row = 9,column = 9) == 0.5923417936583064\n assert candidate(n = 10,k = 5,row = 9,column = 9) == 0.08154296875\n assert candidate(n = 20,k = 2,row = 19,column = 19) == 0.1875\n assert candidate(n = 15,k = 10,row = 7,column = 7) == 0.6320731192827225\n assert candidate(n = 20,k = 25,row = 5,column = 5) == 0.2637784288176317\n assert candidate(n = 25,k = 50,row = 10,column = 10) == 0.26126116581179654\n assert candidate(n = 10,k = 5,row = 9,column = 0) == 0.08154296875\n assert candidate(n = 10,k = 10,row = 5,column = 5) == 0.22588835656642914\n assert candidate(n = 22,k = 25,row = 11,column = 11) == 0.5187071674337155\n assert candidate(n = 15,k = 20,row = 0,column = 14) == 0.016829922789494044\n assert candidate(n = 10,k = 50,row = 0,column = 0) == 1.4257173418698251e-05\n assert candidate(n = 15,k = 15,row = 14,column = 0) == 0.026700135945247894\n assert candidate(n = 20,k = 7,row = 19,column = 19) == 0.060955047607421875\n assert candidate(n = 10,k = 8,row = 9,column = 9) == 0.04556155204772949\n assert candidate(n = 20,k = 10,row = 0,column = 0) == 0.04390097223222256\n assert candidate(n = 12,k = 3,row = 11,column = 11) == 0.125\n assert candidate(n = 16,k = 8,row = 8,column = 8) == 0.8006306886672974\n assert candidate(n = 14,k = 25,row = 6,column = 6) == 0.11653890928316238\n assert candidate(n = 10,k = 5,row = 0,column = 9) == 0.08154296875\n assert candidate(n = 9,k = 4,row = 1,column = 1) == 0.232421875\n assert candidate(n = 23,k = 2,row = 22,column = 22) == 0.1875\n assert candidate(n = 12,k = 15,row = 3,column = 4) == 0.1568282853916969\n assert candidate(n = 12,k = 30,row = 6,column = 6) == 0.02475891397334001\n assert candidate(n = 8,k = 6,row = 1,column = 1) == 0.121978759765625\n assert candidate(n = 7,k = 25,row = 3,column = 3) == 0.0001764740896717054\n assert candidate(n = 20,k = 2,row = 0,column = 19) == 0.1875\n assert candidate(n = 15,k = 7,row = 7,column = 7) == 0.811187744140625\n assert candidate(n = 10,k = 0,row = 5,column = 5) == 1\n assert candidate(n = 12,k = 3,row = 0,column = 11) == 0.125\n"}, "metadata": {"canonical_parameter_names": ["n", "k", "row", "column"], "leetcode_dataset_entry_point": "Solution().knightProbability", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var knightProbability = function(n, k, row, column) {", "container": null, "callable": "knightProbability", "parameters": [{"name": "n", "type": "number"}, {"name": "k", "type": "number"}, {"name": "row", "type": "number"}, {"name": "column", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 689, "task_id": "maximum-sum-of-3-non-overlapping-subarrays", "difficulty": "Hard", "problem_description": "Given an integer array nums and an integer k, find three non-overlapping subarrays of length k with maximum sum and return them.\nReturn the result as a list of indices representing the starting position of each interval (0-indexed). If there are multiple answers, return the lexicographically smallest one.\n \nExample 1:\n\nInput: nums = [1,2,1,2,6,7,5,1], k = 2\nOutput: [0,3,5]\nExplanation: Subarrays [1, 2], [2, 6], [7, 5] correspond to the starting indices [0, 3, 5].\nWe could have also taken [2, 1], but an answer of [1, 3, 5] would be lexicographically smaller.\n\nExample 2:\n\nInput: nums = [1,2,1,2,1,2,1,2,1], k = 2\nOutput: [0,2,4]\n\n \nConstraints:\n\n1 <= nums.length <= 2 * 104\n1 <= nums[i] < 216\n1 <= k <= floor(nums.length / 3)\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 2) == [0, 2, 4]\n assert candidate(nums = [1, 2, 1, 2, 6, 7, 5, 1, 9, 7, 4, 6],k = 3) == [3, 6, 9]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == [0, 5, 10]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3) == [1, 4, 7]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 3) == [0, 3, 6]\n assert candidate(nums = [1, 2, 1, 2, 6, 7, 5, 1],k = 2) == [0, 3, 5]\n assert candidate(nums = [3, 5, 10, 7, 6, 2],k = 1) == [2, 3, 4]\n assert candidate(nums = [9, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1],k = 3) == [0, 4, 8]\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1],k = 2) == [0, 2, 4]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1) == [0, 1, 2]\n assert candidate(nums = [7, 13, 20, 19, 19, 2, 10, 1, 1, 1, 1, 100],k = 2) == [1, 3, 10]\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 2) == [0, 2, 4]\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 1) == [0, 1, 2]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9],k = 1) == [6, 7, 8]\n assert candidate(nums = [1, 2, 1, 2, 6, 7, 5, 1, 9, 8],k = 3) == [1, 4, 7]\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],k = 2) == [0, 2, 4]\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],k = 2) == [3, 8, 13]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],k = 4) == [28, 32, 36]\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 4) == []\n assert candidate(nums = [500, 400, 300, 200, 100, 50, 10, 5, 1, 0, 1, 5, 10, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 6) == [0, 12, 18]\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7],k = 6) == [0, 10, 17]\n assert candidate(nums = [1, 3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 3) == [22, 25, 28]\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],k = 3) == [0, 3, 6]\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 5) == [0, 5, 10]\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],k = 3) == [0, 3, 6]\n assert candidate(nums = [9, 1, 2, 3, 9, 1, 2, 3, 9, 1, 2, 3, 9, 1, 2, 3],k = 3) == [2, 6, 10]\n assert candidate(nums = [5, 1, 5, 1, 5, 1, 5, 1, 5, 1],k = 2) == [0, 2, 4]\n assert candidate(nums = [100, 200, 300, 100, 200, 300, 100, 200, 300, 100, 200, 300, 100, 200, 300],k = 5) == [0, 5, 10]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60],k = 10) == [30, 40, 50]\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == [0, 5, 10]\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 5) == [0, 5, 10]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 3) == [0, 3, 6]\n assert candidate(nums = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9],k = 3) == [35, 39, 42]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 4) == [8, 12, 16]\n assert candidate(nums = [5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5],k = 5) == [0, 15, 33]\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],k = 5) == [5, 10, 15]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],k = 10) == [10, 20, 30]\n assert candidate(nums = [5, 1, 3, 2, 6, 4, 5, 3, 7, 8, 1, 9, 2, 4, 6],k = 3) == [4, 7, 11]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],k = 5) == [25, 30, 35]\n assert candidate(nums = [1, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 4) == [0, 4, 8]\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7],k = 5) == [8, 13, 27]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 6) == [12, 18, 24]\n assert candidate(nums = [9, 4, 3, 7, 9, 1, 4, 7, 9, 7, 1, 8, 3, 1, 8, 1, 6, 8, 1, 8, 5, 9, 5, 7, 5, 8, 5, 8, 9, 3, 4, 8, 2, 7, 8, 3, 8, 4, 3, 7, 6, 9, 2, 4, 5, 8, 3, 7, 5, 9],k = 7) == [3, 17, 25]\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300],k = 5) == [15, 20, 25]\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],k = 3) == [0, 3, 6]\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],k = 5) == [0, 5, 10]\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 6) == [0, 14, 20]\n assert candidate(nums = [10, 4, 5, 1, 8, 9, 2, 6, 7, 3, 1, 5, 4, 8, 9, 1, 2, 3, 4, 5],k = 4) == [0, 4, 11]\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],k = 5) == [0, 5, 10]\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 5) == [0, 5, 10]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 4) == [8, 12, 16]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == [0, 2, 4]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 7) == [9, 16, 23]\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],k = 2) == [0, 2, 4]\n assert candidate(nums = [1, 3, 2, 5, 4, 7, 9, 8, 6, 5, 4, 3, 2, 1, 0, 12, 11, 10, 9, 8, 7],k = 3) == [5, 15, 18]\n assert candidate(nums = [9, 4, 3, 7, 6, 9, 8, 5, 2, 1, 10, 6, 7, 8, 9],k = 3) == [4, 9, 12]\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == [0, 5, 10]\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120],k = 5) == []\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == [0, 4, 8]\n assert candidate(nums = [8, 1, 9, 2, 4, 6, 3, 5, 7, 10, 1, 3, 5, 7, 9],k = 4) == [2, 6, 11]\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500],k = 5) == [0, 5, 10]\n assert candidate(nums = [1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9],k = 5) == [1, 7, 13]\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500],k = 3) == [6, 9, 12]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],k = 7) == [29, 36, 43]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 6) == [2, 8, 14]\n assert candidate(nums = [100000, 90000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000, 9000, 8000, 7000, 6000, 5000],k = 3) == [0, 3, 6]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == [0, 10, 20]\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == [0, 5, 10]\n assert candidate(nums = [3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1],k = 2) == [0, 3, 6]\n assert candidate(nums = [9, 4, 3, 7, 2, 5, 8, 1, 6, 3, 5, 7, 4, 8, 2],k = 3) == [0, 4, 11]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 4) == [18, 22, 26]\n assert candidate(nums = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100],k = 3) == [0, 3, 6]\n assert candidate(nums = [2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1],k = 2) == [1, 5, 9]\n assert candidate(nums = [5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1],k = 2) == [0, 5, 10]\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 3) == [0, 9, 18]\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250],k = 5) == [10, 15, 20]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 5) == [5, 10, 15]\n assert candidate(nums = [5, 4, 3, 2, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 4) == [3, 7, 11]\n assert candidate(nums = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == [0, 5, 10]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == [0, 5, 10]\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().maxSumOfThreeSubarrays", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxSumOfThreeSubarrays = function(nums, k) {", "container": null, "callable": "maxSumOfThreeSubarrays", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 691, "task_id": "stickers-to-spell-word", "difficulty": "Hard", "problem_description": "We are given n different types of stickers. Each sticker has a lowercase English word on it.\nYou would like to spell out the given string target by cutting individual letters from your collection of stickers and rearranging them. You can use each sticker more than once if you want, and you have infinite quantities of each sticker.\nReturn the minimum number of stickers that you need to spell out target. If the task is impossible, return -1.\nNote: In all test cases, all words were chosen randomly from the 1000 most common US English words, and target was chosen as a concatenation of two random words.\n \nExample 1:\n\nInput: stickers = [\"with\",\"example\",\"science\"], target = \"thehat\"\nOutput: 3\nExplanation:\nWe can use 2 \"with\" stickers, and 1 \"example\" sticker.\nAfter cutting and rearrange the letters of those stickers, we can form the target \"thehat\".\nAlso, this is the minimum number of stickers necessary to form the target string.\n\nExample 2:\n\nInput: stickers = [\"notice\",\"possible\"], target = \"basicbasic\"\nOutput: -1\nExplanation:\nWe cannot form the target \"basicbasic\" from cutting letters from the given stickers.\n\n \nConstraints:\n\nn == stickers.length\n1 <= n <= 50\n1 <= stickers[i].length <= 10\n1 <= target.length <= 15\nstickers[i] and target consist of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(stickers = ['aaa', 'bbb'],target = \"aabbbccc\") == -1\n assert candidate(stickers = ['a', 'b', 'c'],target = \"abc\") == 3\n assert candidate(stickers = ['abc', 'abc'],target = \"abcabc\") == 2\n assert candidate(stickers = ['abcd'],target = \"abcdabcd\") == 2\n assert candidate(stickers = ['abc'],target = \"d\") == -1\n assert candidate(stickers = ['notice', 'possible'],target = \"basicbasic\") == -1\n assert candidate(stickers = ['abc'],target = \"abcd\") == -1\n assert candidate(stickers = ['abc', 'ab', 'bc'],target = \"abc\") == 1\n assert candidate(stickers = ['abc', 'def'],target = \"abcdef\") == 2\n assert candidate(stickers = ['a'],target = \"a\") == 1\n assert candidate(stickers = ['aabbcc', 'abc'],target = \"aabbbccc\") == 2\n assert candidate(stickers = ['hello', 'world'],target = \"hold\") == 2\n assert candidate(stickers = ['abc', 'def', 'ghi'],target = \"adgbehcfi\") == 3\n assert candidate(stickers = ['aabb', 'ccdd'],target = \"abcd\") == 2\n assert candidate(stickers = ['with', 'example', 'science'],target = \"thehat\") == 3\n assert candidate(stickers = ['hello', 'world'],target = \"helloworld\") == 2\n assert candidate(stickers = ['aaa', 'aa', 'a'],target = \"aaaaaaaaa\") == 3\n assert candidate(stickers = ['xyz', 'zyx', 'yxz'],target = \"zyxyzyxyzyx\") == 5\n assert candidate(stickers = ['hello', 'world', 'again'],target = \"aginwodlloleh\") == 3\n assert candidate(stickers = ['abcdef', 'ghijkl', 'mnopqr'],target = \"abcdefghijklmnopqr\") == 3\n assert candidate(stickers = ['mississippi', 'helloworld'],target = \"mississippiworldhello\") == 2\n assert candidate(stickers = ['aabb', 'bbcc', 'cdda'],target = \"aabbccddaabb\") == 4\n assert candidate(stickers = ['sun', 'moon', 'star'],target = \"starstarsun\") == 3\n assert candidate(stickers = ['one', 'two', 'three', 'four', 'five'],target = \"onetwothreefourfive\") == 5\n assert candidate(stickers = ['mississippi', 'pennsylvania'],target = \"mississippipennsylvania\") == 2\n assert candidate(stickers = ['aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee'],target = \"abcdeabcde\") == 5\n assert candidate(stickers = ['flower', 'garden', 'sun', 'moon', 'star'],target = \"flowergardenstar\") == 3\n assert candidate(stickers = ['aabbcc', 'abcabc', 'aabbc'],target = \"abcabcabc\") == 2\n assert candidate(stickers = ['alphabet', 'soup', 'letters', 'words', 'sticker', 'pack'],target = \"alphabetwordsoupstickersoup\") == 5\n assert candidate(stickers = ['ab', 'bc', 'cd'],target = \"abcdabcd\") == 4\n assert candidate(stickers = ['quick', 'brown', 'fox'],target = \"quickbrownfox\") == 3\n assert candidate(stickers = ['abcd', 'efgh', 'ijkl'],target = \"dgheijlkfabci\") == 4\n assert candidate(stickers = ['apple', 'banana', 'cherry'],target = \"bananaapple\") == 2\n assert candidate(stickers = ['red', 'blue', 'green'],target = \"bluegreenred\") == 3\n assert candidate(stickers = ['abcd', 'dcba', 'abdc', 'bacd'],target = \"abcdabcd\") == 2\n assert candidate(stickers = ['zzz', 'zzzz', 'zzzzz'],target = \"zzzzzzzzzzzzzzz\") == 3\n assert candidate(stickers = ['programming', 'is', 'fun'],target = \"funisprogramming\") == 3\n assert candidate(stickers = ['leetcode', 'love', 'coding'],target = \"lovecodingleetcode\") == 3\n assert candidate(stickers = ['hello', 'world', 'python'],target = \"pythonhello\") == 2\n assert candidate(stickers = ['aabbcc', 'abc', 'abac'],target = \"aabbccabc\") == 2\n assert candidate(stickers = ['abacd', 'bdfgh', 'cdhij', 'efgik', 'ghklm'],target = \"abcdefghijklim\") == 4\n assert candidate(stickers = ['hello', 'world', 'again'],target = \"againhelloagainworld\") == 4\n assert candidate(stickers = ['puzzle', 'piece', 'fit'],target = \"fittingpuzzle\") == -1\n assert candidate(stickers = ['happy', 'birthday', 'friend'],target = \"happybirthdayfriend\") == 3\n assert candidate(stickers = ['aaa', 'bbb', 'ccc'],target = \"aabbbccc\") == 3\n assert candidate(stickers = ['hello', 'world', 'abc', 'def', 'ghi', 'jkl'],target = \"helloworldabcdefghijk\") == 6\n assert candidate(stickers = ['sunshine', 'rainbow', 'cloud'],target = \"sunshinecloud\") == 2\n assert candidate(stickers = ['xyz', 'abc', 'def', 'ghi'],target = \"zyxwvutsrqponmlkjihgfedcba\") == -1\n assert candidate(stickers = ['zoo', 'book', 'look'],target = \"bookzoolook\") == 3\n assert candidate(stickers = ['magic', 'wand', 'spell'],target = \"spellmagic\") == 2\n assert candidate(stickers = ['aabbcc', 'bbccdd', 'aaccdd'],target = \"aabbccddee\") == -1\n assert candidate(stickers = ['cat', 'dog', 'bird'],target = \"cattog\") == 3\n assert candidate(stickers = ['orange', 'juice', 'smoothie'],target = \"smoothieorangejuice\") == 3\n assert candidate(stickers = ['aabb', 'bbcc', 'ccdd'],target = \"bbaaccd\") == 2\n assert candidate(stickers = ['quick', 'brown', 'fox', 'jumps', 'over', 'lazy'],target = \"quickbrownfoxjumpsoveralazydog\") == -1\n assert candidate(stickers = ['algorithm', 'data', 'structure'],target = \"datadstructure\") == 3\n assert candidate(stickers = ['cat', 'bat', 'rat', 'car'],target = \"catabtar\") == 3\n assert candidate(stickers = ['zebra', 'lion', 'tiger'],target = \"tigerlionzebra\") == 3\n assert candidate(stickers = ['apple', 'banana', 'cherry'],target = \"bananaapplecherry\") == 3\n assert candidate(stickers = ['algorithm', 'data', 'structure'],target = \"algorithmdatastructure\") == 3\n assert candidate(stickers = ['repeat', 'again', 'once'],target = \"repeatagainonce\") == 3\n assert candidate(stickers = ['sticker', 'stamps', 'books'],target = \"tsickerbomskps\") == 3\n assert candidate(stickers = ['abcd', 'dcba', 'efgh', 'hgf', 'ijkl', 'lkji'],target = \"abcdefghijklij\") == 4\n assert candidate(stickers = ['abcdefg', 'ghijklm', 'nopqrstu', 'vwxyz'],target = \"abcdefghijklmnopqrstuvwxyz\") == 4\n assert candidate(stickers = ['aaaa', 'bbbb', 'cccc'],target = \"aabbcc\") == 3\n assert candidate(stickers = ['aabbccddeeff', 'bbccddeeffgghh', 'ccddeeffgghhiijj'],target = \"aabbccddeeffgghhiijj\") == 2\n assert candidate(stickers = ['sticker', 'book', 'a'],target = \"stickers\") == 2\n assert candidate(stickers = ['x', 'y', 'z'],target = \"zyxzyxzyx\") == 9\n assert candidate(stickers = ['abcd', 'efgh', 'ijkl'],target = \"ijklabcdeffgh\") == 4\n assert candidate(stickers = ['sticker', 'book', 'target'],target = \"booktarget\") == 2\n assert candidate(stickers = ['hello', 'world', 'python'],target = \"pythonworldhello\") == 3\n assert candidate(stickers = ['aabbcc', 'ddeeff', 'gghhii', 'jjkkll', 'mmnnoo'],target = \"aabbccddeeffgghhiijjkkllmmnnoo\") == 5\n assert candidate(stickers = ['jump', 'over', 'lazy'],target = \"jumplazyover\") == 3\n assert candidate(stickers = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yzabcd'],target = \"abcdefghijklmnopqrstuvwxyz\") == 5\n assert candidate(stickers = ['abcdefghij', 'klmnopqrst', 'uvwxyz', 'mnopqrstuv', 'wxyzabcde'],target = \"zyxwvutsrqponmlkjihgfedcba\") == 3\n assert candidate(stickers = ['hello', 'world', 'again'],target = \"helloworldhelloagainworld\") == 5\n assert candidate(stickers = ['unique', 'letters'],target = \"uniquelettersuniqueletters\") == 4\n assert candidate(stickers = ['cat', 'dog', 'bird'],target = \"birdcatdog\") == 3\n assert candidate(stickers = ['example', 'science', 'with'],target = \"thehatexample\") == 4\n assert candidate(stickers = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yz'],target = \"abcdefghijklmnopqrstuvwxyz\") == 5\n assert candidate(stickers = ['laptop', 'phone', 'tablet'],target = \"telephonetablet\") == 4\n assert candidate(stickers = ['abcd', 'efgh', 'ijkl'],target = \"abcdefghijlkl\") == 4\n assert candidate(stickers = ['abcdef', 'ghijkl', 'mnopqr'],target = \"mnopqrfedcba\") == 2\n assert candidate(stickers = ['overlap', 'partial', 'coverage'],target = \"overlappartialcoverage\") == 3\n assert candidate(stickers = ['aabb', 'bbcc', 'ccdd', 'ddeeff', 'ffgg'],target = \"aabbccddeeffgg\") == 4\n assert candidate(stickers = ['zzz', 'yyy', 'xxx', 'www'],target = \"zzzyyyxxxwww\") == 4\n assert candidate(stickers = ['coding', 'is', 'fun'],target = \"sindgnif\") == 3\n assert candidate(stickers = ['happy', 'birthday', 'party'],target = \"birthdaypartyparty\") == 3\n assert candidate(stickers = ['zzzz', 'yyyy', 'xxxx'],target = \"zyxwvutsrqponmlkjihgfedcba\") == -1\n assert candidate(stickers = ['pizza', 'pie', 'cake'],target = \"pizzacakepie\") == 3\n assert candidate(stickers = ['fox', 'quick', 'brown'],target = \"brownquickfox\") == 3\n assert candidate(stickers = ['sticky', 'loop', 'again'],target = \"programming\") == -1\n assert candidate(stickers = ['python', 'java', 'cplus'],target = \"javapythoncpluspython\") == 4\n assert candidate(stickers = ['steak', 'egg', 'bacon'],target = \"eggnestake\") == 4\n assert candidate(stickers = ['xy', 'yz', 'zx'],target = \"xyzyzxzyxzyzx\") == 7\n assert candidate(stickers = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yzabcd', 'efghij', 'klmnop', 'qrstuv', 'wxzyab'],target = \"abcdefghijklmnopqrstuvwxyzabc\") == 5\n assert candidate(stickers = ['one', 'two', 'three', 'four', 'five', 'six'],target = \"onetwothreefourfivesix\") == 6\n assert candidate(stickers = ['one', 'two', 'three'],target = \"onetwothreeonetwothree\") == 6\n assert candidate(stickers = ['dog', 'cat', 'bird'],target = \"catdogbird\") == 3\n assert candidate(stickers = ['one', 'two', 'three'],target = \"onetwothree\") == 3\n assert candidate(stickers = ['red', 'green', 'blue'],target = \"greenbluegreengreen\") == 4\n assert candidate(stickers = ['up', 'down', 'left', 'right'],target = \"rightleftdownup\") == 4\n assert candidate(stickers = ['red', 'blue', 'green', 'yellow', 'purple'],target = \"bluegreenyellowpurple\") == 4\n assert candidate(stickers = ['one', 'two', 'three'],target = \"threetwoone\") == 3\n assert candidate(stickers = ['quick', 'brown', 'fox'],target = \"uqcfkibrowno\") == 3\n assert candidate(stickers = ['a', 'ab', 'abc', 'abcd', 'abcde'],target = \"abcdeabcde\") == 2\n assert candidate(stickers = ['cat', 'dog', 'bird'],target = \"cogbat\") == 3\n assert candidate(stickers = ['programming', 'in', 'python'],target = \"grammipnnoingtih\") == 4\n assert candidate(stickers = ['aabbcc', 'bbccdd', 'ccddeeff', 'ddeeffgg'],target = \"aabbccddeeffgg\") == 2\n assert candidate(stickers = ['apple', 'banana', 'cherry', 'date'],target = \"abacaxibananacherry\") == -1\n assert candidate(stickers = ['abcdefgh', 'ijklmnop', 'qrstuvwx', 'yz'],target = \"abcdefghijklmnopqrstuvwxyz\") == 4\n assert candidate(stickers = ['abc', 'bcd', 'cde', 'def', 'efg'],target = \"abcdefg\") == 3\n assert candidate(stickers = ['red', 'blue', 'green'],target = \"greengreenblue\") == 3\n assert candidate(stickers = ['hello', 'world', 'python'],target = \"worldhellopython\") == 3\n assert candidate(stickers = ['zzz', 'yyy', 'xxx'],target = \"zzzyyyxxx\") == 3\n assert candidate(stickers = ['fast', 'food', 'truck'],target = \"truckfastfood\") == 3\n assert candidate(stickers = ['abcd', 'dcba', 'abcd'],target = \"abcdabcdabcd\") == 3\n assert candidate(stickers = ['aabbcc', 'ddeeff', 'gghhii'],target = \"abcdefghi\") == 3\n assert candidate(stickers = ['hello', 'world', 'foo', 'bar', 'baz'],target = \"helloworldfoobarbaz\") == 5\n assert candidate(stickers = ['hello', 'world', 'python', 'programming'],target = \"helloprogrammingworld\") == 3\n assert candidate(stickers = ['repeated', 'words', 'here'],target = \"repeatedwordshere\") == 3\n assert candidate(stickers = ['happy', 'new', 'year'],target = \"happynewyear\") == 3\n assert candidate(stickers = ['jump', 'high', 'long'],target = \"highjumplong\") == 3\n assert candidate(stickers = ['sticker', 'sticker', 'sticker'],target = \"stickers\") == 2\n assert candidate(stickers = ['ab', 'cd', 'ef', 'gh', 'ij', 'kl', 'mn', 'op', 'qr', 'st', 'uv', 'wx', 'yz'],target = \"abcdefghijklmnopqrstuvwxyz\") == 13\n assert candidate(stickers = ['ab', 'bc', 'ca'],target = \"abcabcabc\") == 5\n assert candidate(stickers = ['repeated', 'words', 'here', 'in', 'this', 'example'],target = \"repeatedwordshereinthisexample\") == 6\n assert candidate(stickers = ['abcd', 'efgh', 'ijkl'],target = \"fedcbahjiglke\") == 4\n assert candidate(stickers = ['hello', 'world', 'wide'],target = \"worldwide\") == 2\n assert candidate(stickers = ['abcdefg', 'hijklmn', 'opqrstu', 'vwxyz'],target = \"abcdefghijklmnopqrstuvwxyz\") == 4\n assert candidate(stickers = ['jump', 'over', 'lazy'],target = \"lazyjumpover\") == 3\n assert candidate(stickers = ['sun', 'moon', 'star'],target = \"moonstarsun\") == 3\n assert candidate(stickers = ['apple', 'orange', 'banana'],target = \"poeplange\") == 2\n assert candidate(stickers = ['one', 'two', 'three'],target = \"threethreetwoone\") == 4\n assert candidate(stickers = ['xylophone', 'piano', 'violin'],target = \"xylophonepianoviolin\") == 3\n assert candidate(stickers = ['aabbcc', 'bbccdd', 'ccddaa'],target = \"aabbccbbccddccddaa\") == 3\n assert candidate(stickers = ['abcdef', 'abcde', 'abcd'],target = \"abcdef\") == 1\n assert candidate(stickers = ['abcde', 'fghij', 'klmno'],target = \"ejihfckgmldnbaio\") == 4\n assert candidate(stickers = ['abcdef', 'ghijkl', 'mnopqr'],target = \"jklmnopqrfgedbica\") == 3\n assert candidate(stickers = ['abc', 'def', 'ghi', 'jkl'],target = \"abcdefghijkln\") == -1\n assert candidate(stickers = ['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy'],target = \"abcdefghijklmnopqrstuvwxyz\") == -1\n assert candidate(stickers = ['quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dog'],target = \"quickbrownfoxjumpsoverlazydog\") == 7\n assert candidate(stickers = ['race', 'car', 'seat'],target = \"crecarstae\") == 3\n assert candidate(stickers = ['xy', 'yx', 'zz'],target = \"zyxzyxzyx\") == 5\n assert candidate(stickers = ['xy', 'yz', 'za', 'ax'],target = \"xyzaxyzaxyza\") == 6\n assert candidate(stickers = ['cat', 'dog', 'bird'],target = \"birdcattwo\") == -1\n"}, "metadata": {"canonical_parameter_names": ["stickers", "target"], "leetcode_dataset_entry_point": "Solution().minStickers", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minStickers = function(stickers, target) {", "container": null, "callable": "minStickers", "parameters": [{"name": "stickers", "type": "string[]"}, {"name": "target", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 692, "task_id": "top-k-frequent-words", "difficulty": "Medium", "problem_description": "Given an array of strings words and an integer k, return the k most frequent strings.\nReturn the answer sorted by the frequency from highest to lowest. Sort the words with the same frequency by their lexicographical order.\n \nExample 1:\n\nInput: words = [\"i\",\"love\",\"leetcode\",\"i\",\"love\",\"coding\"], k = 2\nOutput: [\"i\",\"love\"]\nExplanation: \"i\" and \"love\" are the two most frequent words.\nNote that \"i\" comes before \"love\" due to a lower alphabetical order.\n\nExample 2:\n\nInput: words = [\"the\",\"day\",\"is\",\"sunny\",\"the\",\"the\",\"the\",\"sunny\",\"is\",\"is\"], k = 4\nOutput: [\"the\",\"is\",\"sunny\",\"day\"]\nExplanation: \"the\", \"is\", \"sunny\" and \"day\" are the four most frequent words, with the number of occurrence being 4, 3, 2 and 1 respectively.\n\n \nConstraints:\n\n1 <= words.length <= 500\n1 <= words[i].length <= 10\nwords[i] consists of lowercase English letters.\nk is in the range [1, The number of unique words[i]]\n\n \nFollow-up: Could you solve it in O(n log(k)) time and O(n) extra space?\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['a', 'aa', 'aaa'],k = 1) == ['a']\n assert candidate(words = ['a', 'aa', 'aaa'],k = 2) == ['a', 'aa']\n assert candidate(words = ['i', 'love', 'leetcode', 'i', 'love', 'coding'],k = 2) == ['i', 'love']\n assert candidate(words = ['the', 'day', 'is', 'sunny', 'the', 'the', 'the', 'sunny', 'is', 'is'],k = 4) == ['the', 'is', 'sunny', 'day']\n assert candidate(words = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple'],k = 3) == ['apple', 'banana', 'orange']\n assert candidate(words = ['zebra', 'dog', 'duck', 'dog', 'zebra', 'zebra'],k = 1) == ['zebra']\n assert candidate(words = ['hello', 'world', 'hello', 'world', 'hello'],k = 2) == ['hello', 'world']\n assert candidate(words = ['sun', 'moon', 'star', 'sun', 'moon', 'star', 'sun', 'moon', 'star', 'star', 'star', 'star'],k = 2) == ['star', 'moon']\n assert candidate(words = ['apple', 'orange', 'banana', 'grape', 'apple', 'orange', 'banana', 'grape', 'apple', 'orange', 'banana', 'grape', 'apple', 'orange', 'banana', 'grape'],k = 4) == ['apple', 'banana', 'grape', 'orange']\n assert candidate(words = ['quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dog', 'quick', 'fox', 'quick'],k = 2) == ['quick', 'fox']\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],k = 10) == ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']\n assert candidate(words = ['a', 'abc', 'abcd', 'abc', 'a', 'abcde', 'a', 'abcdef', 'a', 'abcde', 'a', 'abcdef', 'a'],k = 4) == ['a', 'abc', 'abcde', 'abcdef']\n assert candidate(words = ['quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dog', 'quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dog', 'quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dog', 'quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dog', 'quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dog'],k = 5) == ['brown', 'dog', 'fox', 'jumps', 'lazy']\n assert candidate(words = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve'],k = 5) == ['eight', 'eleven', 'five', 'four', 'nine']\n assert candidate(words = ['quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dog', 'quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dog', 'quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dog', 'quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dog'],k = 4) == ['brown', 'dog', 'fox', 'jumps']\n assert candidate(words = ['apple', 'banana', 'cherry', 'apple', 'banana', 'apple', 'cherry', 'cherry', 'banana'],k = 2) == ['apple', 'banana']\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'],k = 3) == ['a', 'aa', 'aaa']\n assert candidate(words = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple', 'kiwi', 'banana', 'kiwi', 'kiwi', 'kiwi'],k = 3) == ['kiwi', 'apple', 'banana']\n assert candidate(words = ['sun', 'moon', 'star', 'planet', 'sun', 'moon', 'star', 'moon', 'moon', 'sun', 'star', 'star', 'star', 'star'],k = 3) == ['star', 'moon', 'sun']\n assert candidate(words = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve'],k = 12) == ['eight', 'eleven', 'five', 'four', 'nine', 'one', 'seven', 'six', 'ten', 'three', 'twelve', 'two']\n assert candidate(words = ['zebra', 'dog', 'duck', 'dog', 'zebra', 'zebra', 'cat', 'cat', 'cat', 'dog', 'cat'],k = 3) == ['cat', 'dog', 'zebra']\n assert candidate(words = ['zebra', 'dog', 'duck', 'dog', 'zebra', 'zebra', 'dog', 'zebra', 'dog', 'duck', 'duck', 'zebra', 'dog', 'zebra', 'zebra', 'dog'],k = 3) == ['zebra', 'dog', 'duck']\n assert candidate(words = ['coding', 'programming', 'hacking', 'debugging', 'coding', 'programming', 'debugging', 'hacking', 'hacking', 'hacking'],k = 2) == ['hacking', 'coding']\n assert candidate(words = ['x', 'y', 'z', 'x', 'y', 'x', 'y', 'x', 'y', 'x', 'y', 'x', 'y', 'x', 'y', 'x', 'y', 'x', 'y', 'x', 'y', 'x', 'y', 'x', 'y', 'x', 'y'],k = 2) == ['x', 'y']\n assert candidate(words = ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'alpha', 'beta', 'gamma'],k = 5) == ['alpha', 'beta', 'gamma', 'delta', 'epsilon']\n assert candidate(words = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef'],k = 2) == ['a', 'ab']\n assert candidate(words = ['red', 'blue', 'green', 'red', 'blue', 'red', 'green', 'red', 'blue', 'green', 'red', 'red'],k = 3) == ['red', 'blue', 'green']\n assert candidate(words = ['a', 'abc', 'abcd', 'abc', 'a', 'abcde', 'abcd', 'abcde', 'a', 'abcd'],k = 3) == ['a', 'abcd', 'abc']\n assert candidate(words = ['red', 'blue', 'green', 'red', 'blue', 'green', 'red', 'blue', 'green', 'red', 'blue', 'green', 'red'],k = 2) == ['red', 'blue']\n assert candidate(words = ['cat', 'bat', 'rat', 'cat', 'bat', 'rat', 'rat', 'cat', 'bat', 'cat', 'bat', 'bat'],k = 3) == ['bat', 'cat', 'rat']\n assert candidate(words = ['leetcode', 'coding', 'interview', 'questions', 'leetcode', 'interview', 'coding', 'coding', 'leetcode', 'questions', 'questions'],k = 3) == ['coding', 'leetcode', 'questions']\n assert candidate(words = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen'],k = 5) == ['eight', 'eleven', 'five', 'four', 'nine']\n assert candidate(words = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple', 'kiwi', 'kiwi', 'kiwi', 'banana'],k = 2) == ['apple', 'banana']\n assert candidate(words = ['apple', 'banana', 'apple', 'orange', 'banana', 'banana', 'kiwi', 'kiwi', 'kiwi', 'kiwi'],k = 2) == ['kiwi', 'banana']\n assert candidate(words = ['apple', 'banana', 'cherry', 'date', 'elderberry', 'fig', 'grape', 'honeydew', 'kiwi', 'lemon', 'mango', 'nectarine', 'orange', 'papaya', 'quince', 'raspberry', 'strawberry', 'tangerine', 'ugli', 'vanilla', 'watermelon', 'xigua', 'yam', 'zucchini'],k = 10) == ['apple', 'banana', 'cherry', 'date', 'elderberry', 'fig', 'grape', 'honeydew', 'kiwi', 'lemon']\n assert candidate(words = ['zebra', 'dog', 'duck', 'dog', 'zebra', 'zebra', 'lion', 'tiger', 'lion', 'tiger', 'tiger', 'lion', 'zebra'],k = 3) == ['zebra', 'lion', 'tiger']\n assert candidate(words = ['x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z'],k = 3) == ['x', 'y', 'z']\n assert candidate(words = ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'],k = 1) == ['a']\n assert candidate(words = ['sun', 'moon', 'star', 'planet', 'moon', 'moon', 'sun', 'star', 'planet', 'planet', 'star'],k = 4) == ['moon', 'planet', 'star', 'sun']\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'a', 'aa', 'aaa', 'aaaa', 'a', 'aa', 'aaa', 'aaaa'],k = 4) == ['a', 'aa', 'aaa', 'aaaa']\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd'],k = 10) == ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']\n assert candidate(words = ['a', 'a', 'a', 'b', 'b', 'b', 'b', 'c', 'c', 'c', 'c', 'c', 'd', 'd', 'd', 'd', 'd', 'd', 'e', 'e', 'e', 'e', 'e', 'e', 'e'],k = 2) == ['e', 'd']\n assert candidate(words = ['leetcode', 'python', 'java', 'c', 'cpp', 'python', 'java', 'java', 'c', 'cpp', 'cpp', 'cpp', 'c', 'c', 'java', 'java', 'java', 'python'],k = 4) == ['java', 'c', 'cpp', 'python']\n assert candidate(words = ['sun', 'moon', 'star', 'sky', 'sun', 'moon', 'star', 'sky', 'sun', 'moon', 'star', 'sky', 'sun', 'moon', 'star', 'sky', 'sun', 'moon', 'star', 'sky', 'sun', 'moon', 'star', 'sky', 'sun', 'moon', 'star', 'sky'],k = 4) == ['moon', 'sky', 'star', 'sun']\n assert candidate(words = ['zebra', 'dog', 'duck', 'dog', 'zebra', 'zebra', 'cat', 'cat', 'dog', 'cat'],k = 3) == ['cat', 'dog', 'zebra']\n assert candidate(words = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'one', 'two', 'three', 'four', 'five'],k = 5) == ['five', 'four', 'one', 'three', 'two']\n assert candidate(words = ['frequency', 'of', 'words', 'frequency', 'in', 'a', 'sentence', 'frequency', 'sentence', 'frequency'],k = 3) == ['frequency', 'sentence', 'a']\n assert candidate(words = ['ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk'],k = 4) == ['ab', 'abc', 'abcd', 'abcde']\n assert candidate(words = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple', 'kiwi', 'kiwi', 'kiwi'],k = 3) == ['apple', 'kiwi', 'banana']\n assert candidate(words = ['aaa', 'bbb', 'ccc', 'aaa', 'bbb', 'aaa', 'bbb', 'ccc', 'aaa', 'bbb', 'ccc', 'ccc'],k = 2) == ['aaa', 'bbb']\n assert candidate(words = ['zebra', 'dog', 'duck', 'dog', 'zebra', 'zebra', 'cat', 'cat', 'cat', 'bird', 'bird', 'bird', 'bird'],k = 4) == ['bird', 'cat', 'zebra', 'dog']\n assert candidate(words = ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi'],k = 5) == ['alpha', 'beta', 'delta', 'epsilon', 'eta']\n assert candidate(words = ['zebra', 'dog', 'duck', 'dog', 'zebra', 'zebra', 'dog', 'dog', 'dog', 'zebra', 'zebra', 'zebra', 'zebra'],k = 2) == ['zebra', 'dog']\n assert candidate(words = ['cat', 'dog', 'cat', 'dog', 'cat', 'dog', 'cat', 'dog', 'cat', 'dog', 'cat', 'dog', 'cat', 'dog', 'cat', 'dog', 'cat', 'dog', 'cat', 'dog'],k = 2) == ['cat', 'dog']\n assert candidate(words = ['hello', 'world', 'hello', 'world', 'hello', 'world', 'hello', 'world', 'hello', 'world', 'hello', 'world'],k = 1) == ['hello']\n assert candidate(words = ['python', 'java', 'c', 'cpp', 'python', 'java', 'python', 'java', 'java', 'c', 'c', 'cpp', 'cpp', 'cpp', 'cpp'],k = 4) == ['cpp', 'java', 'c', 'python']\n assert candidate(words = ['algorithm', 'data', 'structure', 'algorithm', 'data', 'data', 'algorithm', 'algorithm', 'data', 'structure', 'structure', 'structure', 'structure'],k = 2) == ['structure', 'algorithm']\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'a', 'b', 'c', 'a', 'b', 'a', 'a', 'b', 'b', 'c', 'd', 'd', 'e', 'e', 'e', 'e'],k = 4) == ['a', 'b', 'e', 'c']\n assert candidate(words = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple', 'banana', 'kiwi', 'kiwi', 'kiwi', 'kiwi'],k = 3) == ['kiwi', 'apple', 'banana']\n assert candidate(words = ['panda', 'polar', 'bear', 'panda', 'polar', 'polar', 'polar', 'bear', 'bear', 'bear', 'bear', 'bear'],k = 3) == ['bear', 'polar', 'panda']\n assert candidate(words = ['flower', 'flow', 'flight', 'flow', 'flight', 'flow', 'flower', 'flight', 'flower', 'flower'],k = 4) == ['flower', 'flight', 'flow']\n assert candidate(words = ['zebra', 'dog', 'duck', 'dog', 'zebra', 'zebra', 'zebra', 'dog', 'dog', 'dog', 'duck', 'duck', 'duck', 'duck'],k = 2) == ['dog', 'duck']\n assert candidate(words = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'],k = 5) == ['eight', 'five', 'four', 'nine', 'one']\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],k = 5) == ['a', 'b', 'c', 'd', 'e']\n assert candidate(words = ['cat', 'bat', 'rat', 'cat', 'bat', 'rat', 'cat', 'bat', 'rat', 'cat'],k = 2) == ['cat', 'bat']\n assert candidate(words = ['cat', 'bat', 'rat', 'cat', 'bat', 'rat', 'cat', 'bat', 'rat', 'cat', 'bat', 'rat', 'cat', 'bat', 'rat', 'cat', 'bat', 'rat', 'cat', 'bat', 'rat', 'cat', 'bat', 'rat'],k = 2) == ['bat', 'cat']\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],k = 5) == ['a', 'b', 'c', 'd', 'e']\n assert candidate(words = ['red', 'blue', 'green', 'red', 'blue', 'red', 'blue', 'red', 'blue', 'red', 'blue', 'red', 'blue', 'red', 'blue', 'red', 'blue', 'red', 'blue', 'red', 'blue', 'red', 'blue', 'red', 'blue', 'red', 'blue', 'red', 'blue', 'red', 'blue'],k = 3) == ['blue', 'red', 'green']\n assert candidate(words = ['apple', 'banana', 'apple', 'orange', 'banana', 'banana', 'kiwi', 'kiwi', 'kiwi', 'kiwi'],k = 3) == ['kiwi', 'banana', 'apple']\n assert candidate(words = ['apple', 'banana', 'apple', 'orange', 'banana', 'banana', 'grape', 'grape', 'grape'],k = 3) == ['banana', 'grape', 'apple']\n assert candidate(words = ['x', 'y', 'z', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a'],k = 5) == ['a', 'b', 'c', 'd', 'e']\n assert candidate(words = ['aaaaa', 'aaa', 'aa', 'a', 'aaaaa', 'aaa', 'aa', 'a', 'aaaaa', 'aaa', 'aa', 'a', 'aaaaa', 'aaa', 'aa', 'a', 'aaaaa', 'aaa', 'aa', 'a'],k = 4) == ['a', 'aa', 'aaa', 'aaaaa']\n assert candidate(words = ['jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk', 'jump', 'run', 'walk'],k = 2) == ['jump', 'run']\n assert candidate(words = ['zebra', 'dog', 'duck', 'dog', 'zebra', 'zebra', 'zebra', 'dog', 'dog', 'dog', 'duck', 'duck', 'duck', 'duck', 'duck', 'zebra'],k = 3) == ['duck', 'dog', 'zebra']\n assert candidate(words = ['repeated', 'word', 'repeated', 'word', 'repeated', 'word', 'unique', 'unique', 'unique', 'unique', 'another', 'another', 'another', 'another', 'another'],k = 3) == ['another', 'unique', 'repeated']\n assert candidate(words = ['sun', 'moon', 'star', 'moon', 'sun', 'moon', 'star', 'sun', 'star', 'star', 'star', 'sun', 'moon', 'moon', 'moon'],k = 3) == ['moon', 'star', 'sun']\n assert candidate(words = ['car', 'bike', 'train', 'car', 'bike', 'car', 'bike', 'train', 'car', 'bike', 'car', 'bike', 'train', 'car', 'train', 'car', 'bike', 'train'],k = 3) == ['car', 'bike', 'train']\n assert candidate(words = ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'alpha', 'beta', 'gamma', 'delta', 'epsilon'],k = 3) == ['alpha', 'beta', 'delta']\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'a', 'aa', 'aaa', 'aaaa', 'a', 'aa', 'aaa', 'aaaa'],k = 3) == ['a', 'aa', 'aaa']\n assert candidate(words = ['cat', 'bat', 'rat', 'hat', 'mat', 'pat', 'sat', 'fat', 'tat', 'cat', 'bat', 'rat', 'hat', 'mat', 'pat', 'sat', 'fat', 'tat', 'cat', 'bat', 'rat', 'hat', 'mat', 'pat', 'sat', 'fat', 'tat'],k = 5) == ['bat', 'cat', 'fat', 'hat', 'mat']\n assert candidate(words = ['zebra', 'dog', 'duck', 'dog', 'zebra', 'zebra', 'lion', 'tiger', 'bear', 'zebra', 'dog', 'duck'],k = 4) == ['zebra', 'dog', 'duck', 'bear']\n assert candidate(words = ['elephant', 'giraffe', 'lion', 'tiger', 'elephant', 'lion', 'giraffe', 'tiger', 'elephant', 'lion', 'giraffe', 'tiger', 'lion', 'giraffe', 'tiger', 'elephant', 'tiger', 'giraffe', 'lion', 'tiger'],k = 4) == ['tiger', 'giraffe', 'lion', 'elephant']\n assert candidate(words = ['sunrise', 'sunset', 'midnight', 'noon', 'sunrise', 'sunset', 'midnight', 'noon', 'sunrise', 'sunset', 'midnight', 'noon', 'sunrise', 'sunset', 'midnight', 'noon', 'sunrise', 'sunset', 'midnight', 'noon', 'sunrise', 'sunset', 'midnight', 'noon', 'sunrise', 'sunset', 'midnight', 'noon', 'sunrise', 'sunset', 'midnight', 'noon', 'sunrise', 'sunset', 'midnight', 'noon', 'sunrise', 'sunset', 'midnight', 'noon'],k = 4) == ['midnight', 'noon', 'sunrise', 'sunset']\n assert candidate(words = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple', 'banana', 'banana'],k = 2) == ['banana', 'apple']\n assert candidate(words = ['flower', 'tree', 'bush', 'flower', 'tree', 'flower', 'bush', 'flower', 'tree', 'bush', 'flower', 'tree', 'bush', 'flower', 'tree', 'bush', 'flower', 'tree', 'bush', 'flower', 'tree', 'bush', 'flower', 'tree', 'bush', 'flower', 'tree', 'bush', 'flower', 'tree', 'bush'],k = 2) == ['flower', 'bush']\n assert candidate(words = ['apple', 'banana', 'apple', 'orange', 'banana', 'banana', 'kiwi', 'kiwi', 'kiwi'],k = 3) == ['banana', 'kiwi', 'apple']\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'a', 'aa', 'aaa', 'aaaa', 'a', 'aa', 'aaa', 'aaaa', 'a', 'aa', 'aaa'],k = 2) == ['a', 'aa']\n assert candidate(words = ['sun', 'moon', 'star', 'planet', 'galaxy', 'universe', 'sun', 'moon', 'star', 'planet', 'galaxy', 'universe', 'sun', 'moon', 'star', 'planet', 'galaxy', 'universe', 'sun', 'moon', 'star', 'planet', 'galaxy', 'universe'],k = 3) == ['galaxy', 'moon', 'planet']\n assert candidate(words = ['aaa', 'aa', 'a', 'aaaa', 'aa', 'a', 'aaa', 'aa', 'a', 'aaaa', 'aa', 'a', 'aaa', 'aa', 'a', 'aaaa', 'aa', 'a', 'aaa', 'aa', 'a'],k = 4) == ['a', 'aa', 'aaa', 'aaaa']\n assert candidate(words = ['cat', 'dog', 'cat', 'bird', 'dog', 'cat', 'dog', 'dog', 'dog', 'cat', 'cat', 'bird'],k = 3) == ['cat', 'dog', 'bird']\n assert candidate(words = ['sun', 'moon', 'star', 'sun', 'moon', 'star', 'sun', 'moon', 'star', 'moon', 'star', 'star', 'star'],k = 1) == ['star']\n assert candidate(words = ['red', 'blue', 'green', 'yellow', 'red', 'blue', 'green', 'yellow', 'red', 'blue', 'green', 'yellow', 'red', 'blue', 'green', 'yellow', 'red', 'blue', 'green', 'yellow', 'red', 'blue', 'green', 'yellow', 'red', 'blue', 'green', 'yellow', 'red', 'blue'],k = 2) == ['blue', 'red']\n"}, "metadata": {"canonical_parameter_names": ["words", "k"], "leetcode_dataset_entry_point": "Solution().topKFrequent", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var topKFrequent = function(words, k) {", "container": null, "callable": "topKFrequent", "parameters": [{"name": "words", "type": "string[]"}, {"name": "k", "type": "number"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 693, "task_id": "binary-number-with-alternating-bits", "difficulty": "Easy", "problem_description": "Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.\n \nExample 1:\n\nInput: n = 5\nOutput: true\nExplanation: The binary representation of 5 is: 101\n\nExample 2:\n\nInput: n = 7\nOutput: false\nExplanation: The binary representation of 7 is: 111.\nExample 3:\n\nInput: n = 11\nOutput: false\nExplanation: The binary representation of 11 is: 1011.\n \nConstraints:\n\n1 <= n <= 231 - 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 3) == False\n assert candidate(n = 11) == False\n assert candidate(n = 15) == False\n assert candidate(n = 2) == True\n assert candidate(n = 1) == True\n assert candidate(n = 7) == False\n assert candidate(n = 10) == True\n assert candidate(n = 5) == True\n assert candidate(n = 63) == False\n assert candidate(n = 33554431) == False\n assert candidate(n = 131071) == False\n assert candidate(n = 2147483646) == False\n assert candidate(n = 357913941) == True\n assert candidate(n = 21) == True\n assert candidate(n = 170) == True\n assert candidate(n = 178956970) == True\n assert candidate(n = 11184810) == True\n assert candidate(n = 2863311531) == False\n assert candidate(n = 341) == True\n assert candidate(n = 4294967295) == False\n assert candidate(n = 2147483647) == False\n assert candidate(n = 32767) == False\n assert candidate(n = 67108863) == False\n assert candidate(n = 100000001) == False\n assert candidate(n = 21845) == True\n assert candidate(n = 1010101010101010101010101010101) == False\n assert candidate(n = 2047) == False\n assert candidate(n = 262143) == False\n assert candidate(n = 16383) == False\n assert candidate(n = 524287) == False\n assert candidate(n = 268435455) == False\n assert candidate(n = 4194303) == False\n assert candidate(n = 2147483649) == False\n assert candidate(n = 1431655765) == True\n assert candidate(n = 4) == False\n assert candidate(n = 134217727) == False\n assert candidate(n = 715827882) == True\n assert candidate(n = 8388607) == False\n assert candidate(n = 134217728) == False\n assert candidate(n = 2097151) == False\n assert candidate(n = 1365) == True\n assert candidate(n = 33) == False\n assert candidate(n = 1073741823) == False\n assert candidate(n = 682) == True\n assert candidate(n = 101010101) == False\n assert candidate(n = 42) == True\n assert candidate(n = 16777215) == False\n assert candidate(n = 858993459) == False\n assert candidate(n = 4095) == False\n assert candidate(n = 8) == False\n assert candidate(n = 255) == False\n assert candidate(n = 22369621) == True\n assert candidate(n = 8191) == False\n assert candidate(n = 4294967294) == False\n assert candidate(n = 18) == False\n assert candidate(n = 44739242) == True\n assert candidate(n = 1023) == False\n assert candidate(n = 555555555) == False\n assert candidate(n = 20) == False\n assert candidate(n = 218) == False\n assert candidate(n = 65535) == False\n assert candidate(n = 1000000001) == False\n assert candidate(n = 1010101010) == False\n assert candidate(n = 286331153) == False\n assert candidate(n = 85) == True\n assert candidate(n = 517) == False\n assert candidate(n = 1048575) == False\n assert candidate(n = 89478485) == True\n assert candidate(n = 536870911) == False\n assert candidate(n = 31) == False\n assert candidate(n = 6) == False\n assert candidate(n = 3427813328) == False\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().hasAlternatingBits", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var hasAlternatingBits = function(n) {", "container": null, "callable": "hasAlternatingBits", "parameters": [{"name": "n", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 695, "task_id": "max-area-of-island", "difficulty": "Medium", "problem_description": "You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.\nThe area of an island is the number of cells with a value 1 in the island.\nReturn the maximum area of an island in grid. If there is no island, return 0.\n \nExample 1:\n\n\nInput: grid = [[0,0,1,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,1,1,0,1,0,0,0,0,0,0,0,0],[0,1,0,0,1,1,0,0,1,0,1,0,0],[0,1,0,0,1,1,0,0,1,1,1,0,0],[0,0,0,0,0,0,0,0,0,0,1,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,0,0,0,0,0,0,1,1,0,0,0,0]]\nOutput: 6\nExplanation: The answer is not 11, because the island must be connected 4-directionally.\n\nExample 2:\n\nInput: grid = [[0,0,0,0,0,0,0,0]]\nOutput: 0\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m, n <= 50\ngrid[i][j] is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[1]]) == 1\n assert candidate(grid = [[0]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 1, 1, 1], [1, 0, 1, 0, 1], [1, 0, 1, 1, 1], [1, 0, 0, 0, 0]]) == 8\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]]) == 4\n assert candidate(grid = [[0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0], [1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0], [1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0]]) == 8\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == 24\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 28\n assert candidate(grid = [[1, 1, 1, 1, 0], [1, 0, 0, 1, 0], [1, 0, 0, 1, 0], [1, 1, 1, 1, 0]]) == 12\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 0, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 0, 1, 0], [1, 0, 1, 1, 1, 0, 1], [0, 0, 0, 1, 0, 1, 0]]) == 4\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 10\n assert candidate(grid = [[1, 0, 1, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1], [0, 1, 0, 0, 0, 1, 1], [0, 1, 1, 0, 0, 0, 1]]) == 5\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0]]) == 9\n assert candidate(grid = [[0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1], [1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0], [1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1]]) == 6\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 16\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 48\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0]]) == 1\n assert candidate(grid = [[1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1], [0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]]) == 19\n assert candidate(grid = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 26\n assert candidate(grid = [[1, 0, 0, 1, 0, 0, 1], [0, 0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 1], [0, 0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0]]) == 12\n assert candidate(grid = [[1, 1, 0, 1, 1], [1, 0, 1, 0, 1], [1, 0, 1, 1, 0], [0, 1, 0, 1, 1], [1, 1, 1, 0, 1]]) == 6\n assert candidate(grid = [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 12\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 105\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 1, 1, 1], [0, 0, 1, 1, 1], [0, 0, 0, 0, 1]]) == 7\n assert candidate(grid = [[1, 1, 1, 1, 0], [1, 0, 0, 1, 0], [1, 0, 0, 0, 0], [0, 0, 0, 0, 1], [1, 1, 1, 0, 1]]) == 7\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 189\n assert candidate(grid = [[1, 1, 1, 1, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1]]) == 11\n assert candidate(grid = [[0, 1, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 9\n assert candidate(grid = [[1, 1, 0, 0, 1], [1, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 1, 1, 0], [1, 0, 0, 1, 1]]) == 5\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 12\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1]]) == 1\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 90\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 4\n assert candidate(grid = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0]]) == 8\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 36\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 14\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 28\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 30\n assert candidate(grid = [[1, 0, 0, 1, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 30\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 44\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]]) == 8\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 65\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0]]) == 1\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 0], [0, 1, 1, 1, 0]]) == 6\n assert candidate(grid = [[1, 1, 0, 1, 1], [1, 0, 0, 0, 0], [0, 0, 0, 0, 1], [1, 1, 0, 1, 1]]) == 3\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 36\n assert candidate(grid = [[1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 2\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().maxAreaOfIsland", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxAreaOfIsland = function(grid) {", "container": null, "callable": "maxAreaOfIsland", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 696, "task_id": "count-binary-substrings", "difficulty": "Easy", "problem_description": "Given a binary string s, return the number of non-empty substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutively.\nSubstrings that occur multiple times are counted the number of times they occur.\n \nExample 1:\n\nInput: s = \"00110011\"\nOutput: 6\nExplanation: There are 6 substrings that have equal number of consecutive 1's and 0's: \"0011\", \"01\", \"1100\", \"10\", \"0011\", and \"01\".\nNotice that some of these substrings repeat and are counted the number of times they occur.\nAlso, \"00110011\" is not a valid substring because all the 0's (and 1's) are not grouped together.\n\nExample 2:\n\nInput: s = \"10101\"\nOutput: 4\nExplanation: There are 4 substrings: \"10\", \"01\", \"10\", \"01\" that have equal number of consecutive 1's and 0's.\n\n \nConstraints:\n\n1 <= s.length <= 105\ns[i] is either '0' or '1'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"000111000111\") == 9\n assert candidate(s = \"01\") == 1\n assert candidate(s = \"110011\") == 4\n assert candidate(s = \"00110011\") == 6\n assert candidate(s = \"11110000\") == 4\n assert candidate(s = \"10101\") == 4\n assert candidate(s = \"1100\") == 2\n assert candidate(s = \"100011000110\") == 8\n assert candidate(s = \"10001111\") == 4\n assert candidate(s = \"00001111\") == 4\n assert candidate(s = \"000111\") == 3\n assert candidate(s = \"001100\") == 4\n assert candidate(s = \"10\") == 1\n assert candidate(s = \"01010101\") == 7\n assert candidate(s = \"10101010\") == 7\n assert candidate(s = \"1010101010\") == 9\n assert candidate(s = \"0000000000\") == 0\n assert candidate(s = \"1100110011\") == 8\n assert candidate(s = \"11001100\") == 6\n assert candidate(s = \"0011\") == 2\n assert candidate(s = \"0101010101\") == 9\n assert candidate(s = \"100000111111\") == 6\n assert candidate(s = \"000110011001100110011001\") == 21\n assert candidate(s = \"000000111111000000\") == 12\n assert candidate(s = \"00011000110001100011000110001100011000110001100011\") == 38\n assert candidate(s = \"0001111100001111000011110000\") == 23\n assert candidate(s = \"111000111000111000\") == 15\n assert candidate(s = \"010011001100110011001100\") == 22\n assert candidate(s = \"001100110011001100110011001100110011001100110011001100110011001100110011\") == 70\n assert candidate(s = \"000000111111000000111111\") == 18\n assert candidate(s = \"111001110011100111\") == 12\n assert candidate(s = \"110011001100110011001100\") == 22\n assert candidate(s = \"1100110011001100\") == 14\n assert candidate(s = \"00000000111111110000000011111111\") == 24\n assert candidate(s = \"10101010101010101010101010\") == 25\n assert candidate(s = \"111111111111000000000000111111111111000000000000111111111111\") == 48\n assert candidate(s = \"111111111100000000000000111111111100000000000000\") == 30\n assert candidate(s = \"001100110011001100110011\") == 22\n assert candidate(s = \"000110001100011000\") == 12\n assert candidate(s = \"000111000111000111\") == 15\n assert candidate(s = \"101010101010101010101010\") == 23\n assert candidate(s = \"1100110011001100110011001100110011001100110011001100\") == 50\n assert candidate(s = \"010101010101010101\") == 17\n assert candidate(s = \"1110000011100000111\") == 12\n assert candidate(s = \"111000111000111000111000111000\") == 27\n assert candidate(s = \"111111000000111111110000000011111111110000000000\") == 38\n assert candidate(s = \"0000111100001111000011110000111100001111000011110000\") == 48\n assert candidate(s = \"11001100110011001100110011001100\") == 30\n assert candidate(s = \"000111000111000111000111\") == 21\n assert candidate(s = \"100100100100100100100100100100\") == 19\n assert candidate(s = \"1100110011001100110011001100110011001100\") == 38\n assert candidate(s = \"1010101010101010\") == 15\n assert candidate(s = \"11001111000011110000\") == 16\n assert candidate(s = \"111111000000111111000000\") == 18\n assert candidate(s = \"111100001111000011110000\") == 20\n assert candidate(s = \"110011001100110011\") == 16\n assert candidate(s = \"0101010101010101010101\") == 21\n assert candidate(s = \"100100100100100100\") == 11\n assert candidate(s = \"0011001100110011\") == 14\n assert candidate(s = \"11110000111000111000111\") == 19\n assert candidate(s = \"11111000001111100000\") == 15\n assert candidate(s = \"000011110000111100001111000011110000\") == 32\n assert candidate(s = \"100100100100100100100100\") == 15\n assert candidate(s = \"0011001100110011001100110011001100110011001100110011001100110011\") == 62\n assert candidate(s = \"0011001100110011001100110011001100110011\") == 38\n assert candidate(s = \"110011001100110011001100110011001100110011001100110011001100110011001100\") == 70\n assert candidate(s = \"010101010101010101010101010\") == 26\n assert candidate(s = \"000000001111111100000000111111110000000011111111\") == 40\n assert candidate(s = \"1111000011001100\") == 12\n assert candidate(s = \"000000001111111100000000\") == 16\n assert candidate(s = \"101010101010\") == 11\n assert candidate(s = \"010101010101010101010101010101010101010101010101\") == 47\n assert candidate(s = \"111111111100000000001111111111\") == 20\n assert candidate(s = \"001100001111000011110000111100001111000011110000\") == 44\n assert candidate(s = \"111000111000111000111000111000111\") == 30\n assert candidate(s = \"0110110110110110110110\") == 14\n assert candidate(s = \"0001100110011001\") == 13\n assert candidate(s = \"0000000000000000000000000000000011111111111111111111111111111111\") == 32\n assert candidate(s = \"000011110000\") == 8\n assert candidate(s = \"11110000001111000000\") == 12\n assert candidate(s = \"11111111000000001111111100000000\") == 24\n assert candidate(s = \"1010101010101010101010101010101010\") == 33\n assert candidate(s = \"1010101010101010101010101010101010101010101010101010101010101010101010101010101010\") == 81\n assert candidate(s = \"001100110011\") == 10\n assert candidate(s = \"0000000011111111000000001111111100000000111111110000000011111111\") == 56\n assert candidate(s = \"011011011011011011011011\") == 15\n assert candidate(s = \"00000000001111111111\") == 10\n assert candidate(s = \"000000001111111111111111\") == 8\n assert candidate(s = \"010101010101010101010101010101\") == 29\n assert candidate(s = \"00000111110000011111\") == 15\n assert candidate(s = \"111100001111000011110000111100001111000011110000\") == 44\n assert candidate(s = \"11001100110011001100\") == 18\n assert candidate(s = \"01010101010101010101010101010101\") == 31\n assert candidate(s = \"000000000011111111111111000000000011111111111111\") == 30\n assert candidate(s = \"111111111111000000000000111111111111\") == 24\n assert candidate(s = \"1010101010101010101010101010\") == 27\n assert candidate(s = \"111110000011110000\") == 13\n assert candidate(s = \"1001001001001001001001\") == 14\n assert candidate(s = \"111000111000111000111000111\") == 24\n assert candidate(s = \"1110000011100000\") == 9\n assert candidate(s = \"111000111000\") == 9\n assert candidate(s = \"1111111100000000\") == 8\n assert candidate(s = \"11111100000011110000\") == 14\n assert candidate(s = \"11111111110000000000000000000000001111111111111111111111111111111\") == 34\n assert candidate(s = \"111111110000000011111111000000001111111100000000\") == 40\n assert candidate(s = \"11001100110011001100110011001100110011001100110011001100\") == 54\n assert candidate(s = \"1100111100001111000011110000111100001111000011110000\") == 48\n assert candidate(s = \"11110000111100001111000011110000\") == 28\n assert candidate(s = \"10100101100101\") == 11\n assert candidate(s = \"00000000001111111111111\") == 10\n assert candidate(s = \"111000111000111000111000111000111000111000111000111000\") == 51\n assert candidate(s = \"0101010101010101\") == 15\n assert candidate(s = \"100000111111000000111111\") == 18\n assert candidate(s = \"100000111111100000\") == 11\n assert candidate(s = \"100000000111111111\") == 9\n assert candidate(s = \"00110011001100110011001100110011001100110011001100110011\") == 54\n assert candidate(s = \"000111000111000111000111000111\") == 27\n assert candidate(s = \"000011110000111100001111\") == 20\n assert candidate(s = \"11111000001111110000011111000001111100000111110000011111\") == 50\n assert candidate(s = \"000000000011111111110000000000\") == 20\n assert candidate(s = \"1001001001001001001001001001001001\") == 22\n assert candidate(s = \"111111000000111111000000111111000000\") == 30\n assert candidate(s = \"00110011001100110011\") == 18\n assert candidate(s = \"001100110011001100110011001100110011001100110011001100110011\") == 58\n assert candidate(s = \"1111000011110000\") == 12\n assert candidate(s = \"00001111000011110000111100001111000011110000\") == 40\n assert candidate(s = \"101010101010101010101010101010101010101010101010\") == 47\n assert candidate(s = \"100000000011111111\") == 9\n assert candidate(s = \"1010101010101010101010\") == 21\n assert candidate(s = \"1010101010101010101010101010101010101010\") == 39\n assert candidate(s = \"1111100001111000011110000\") == 20\n assert candidate(s = \"000000000000111111111111000000000000111111111111000000000000\") == 48\n assert candidate(s = \"1100110011001100110011001100110011001100110011001100110011001100\") == 62\n assert candidate(s = \"1111100000000000000111111\") == 11\n assert candidate(s = \"1001100110011001\") == 14\n assert candidate(s = \"1100110011001100110011\") == 20\n assert candidate(s = \"0011001100110011001100110011\") == 26\n assert candidate(s = \"110011001100110011001100110011\") == 28\n assert candidate(s = \"01010101010101010101\") == 19\n assert candidate(s = \"11001100110011\") == 12\n assert candidate(s = \"11100000111000001110000011100000\") == 21\n assert candidate(s = \"110011001100110011001100110011001100110011\") == 40\n assert candidate(s = \"0000111100011100\") == 12\n assert candidate(s = \"101010101010101010101010101010101010\") == 35\n assert candidate(s = \"10000011111000001111110000011111111000000111111110\") == 39\n assert candidate(s = \"10101010101010101010\") == 19\n assert candidate(s = \"10101010101010\") == 13\n assert candidate(s = \"0011001100110011001100110011001100\") == 32\n assert candidate(s = \"111000111000111000111000\") == 21\n assert candidate(s = \"000000111111000000111111000000\") == 24\n assert candidate(s = \"010101010101010101010101010101010101010101\") == 41\n assert candidate(s = \"0000000000011111111111\") == 11\n assert candidate(s = \"11111110000000000000000\") == 7\n assert candidate(s = \"000000000000111111111111000000000000\") == 24\n assert candidate(s = \"111111000000000000000000111111\") == 12\n assert candidate(s = \"111111000000111111110000000011111111110000000000001111111111100000000000\") == 60\n assert candidate(s = \"1111100000000011111000000000\") == 15\n assert candidate(s = \"0000111100001111\") == 12\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().countBinarySubstrings", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var countBinarySubstrings = function(s) {", "container": null, "callable": "countBinarySubstrings", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 697, "task_id": "degree-of-an-array", "difficulty": "Easy", "problem_description": "Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.\nYour task is to find the smallest possible length of a (contiguous) subarray of nums, that has the same degree as nums.\n \nExample 1:\n\nInput: nums = [1,2,2,3,1]\nOutput: 2\nExplanation: \nThe input array has a degree of 2 because both elements 1 and 2 appear twice.\nOf the subarrays that have the same degree:\n[1, 2, 2, 3, 1], [1, 2, 2, 3], [2, 2, 3, 1], [1, 2, 2], [2, 2, 3], [2, 2]\nThe shortest length is 2. So return 2.\n\nExample 2:\n\nInput: nums = [1,2,2,3,1,4,2]\nOutput: 6\nExplanation: \nThe degree is 3 because the element 2 is repeated 3 times.\nSo [2,2,3,1,4,2] is the shortest subarray, therefore returning 6.\n\n \nConstraints:\n\nnums.length will be between 1 and 50,000.\nnums[i] will be an integer between 0 and 49,999.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 1, 2, 2, 2, 3]) == 3\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 10\n assert candidate(nums = [1, 2, 2, 3, 1]) == 2\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]) == 2\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 0, 0]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 11\n assert candidate(nums = [0, 1, 0, 1, 0, 1]) == 5\n assert candidate(nums = [0, 0, 1, 1, 1, 2, 2, 3, 3, 3]) == 3\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 5\n assert candidate(nums = [4, 4, 4, 4, 4]) == 5\n assert candidate(nums = [9, 9, 9, 10, 10, 11, 11, 11, 11, 11]) == 5\n assert candidate(nums = [4, 4, 3, 3, 2, 2, 1, 1, 0, 0]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums = [4, 5, 6, 7, 8, 9, 0, 0, 0, 0]) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1]) == 11\n assert candidate(nums = [1]) == 1\n assert candidate(nums = [1, 1, 1, 2, 2, 3]) == 3\n assert candidate(nums = [5, 5, 5, 5, 6, 6, 7, 8, 8, 8, 8]) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) == 21\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 20\n assert candidate(nums = [5, 5, 5, 5, 5]) == 5\n assert candidate(nums = [1, 2, 2, 3, 1, 4, 2]) == 6\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 2\n assert candidate(nums = [5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5]) == 1\n assert candidate(nums = [16, 17, 18, 18, 19, 19, 19, 20, 20, 20, 20]) == 4\n assert candidate(nums = [12, 12, 13, 13, 14, 14, 15, 15, 15, 15]) == 4\n assert candidate(nums = [1, 1, 1, 1, 1]) == 5\n assert candidate(nums = [5, 5, 1, 1, 1, 2, 2, 3, 3]) == 3\n assert candidate(nums = [49999, 49999, 49998, 49998, 49997]) == 2\n assert candidate(nums = [4, 1, 1, 2, 2, 1, 3]) == 5\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 4\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0]) == 12\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 1, 1]) == 13\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3]) == 3\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == 6\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 20\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 45\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1]) == 42\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10]) == 25\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5]) == 21\n assert candidate(nums = [47, 47, 47, 23, 23, 38, 38, 38, 38, 59, 59, 59, 59, 59, 10, 10, 10, 10, 10, 10]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]) == 21\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 2, 2]) == 22\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3]) == 10\n assert candidate(nums = [1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 1, 1, 1, 1, 1]) == 26\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 24\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 11\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 1, 1, 1, 1]) == 26\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 13\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 1, 1]) == 44\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 1, 2, 2, 3, 3, 4, 4]) == 22\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6]) == 21\n assert candidate(nums = [1, 2, 2, 3, 1, 4, 2, 5, 5, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 8\n assert candidate(nums = [10000, 20000, 30000, 40000, 50000, 10000, 20000, 30000, 40000, 50000, 10000, 10000]) == 12\n assert candidate(nums = [4, 3, 3, 4, 2, 1, 2, 3, 1, 4, 4, 4, 4, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 37\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 10\n assert candidate(nums = [1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 2, 2, 3, 3, 4, 4, 5, 5, 5, 5]) == 17\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 1, 1, 1, 1]) == 56\n assert candidate(nums = [1, 2, 2, 3, 1, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 22\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1, 1, 2, 2, 3, 3]) == 32\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 41\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5]) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 1]) == 26\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]) == 23\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == 10\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 22\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2]) == 25\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 1]) == 43\n assert candidate(nums = [2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 21\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 20\n assert candidate(nums = [9, 9, 9, 9, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 9, 9, 9, 9]) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 52\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5]) == 21\n assert candidate(nums = [3, 1, 4, 4, 5, 5, 5, 2, 2, 2, 2, 3, 3, 1, 1, 1, 1, 1, 1, 1]) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 42\n assert candidate(nums = [1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8]) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 10, 10, 10, 10]) == 16\n assert candidate(nums = [1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 22\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 1]) == 22\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 22\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1, 1, 1]) == 33\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 20\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7]) == 7\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 31\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5]) == 6\n assert candidate(nums = [1, 2, 2, 2, 3, 4, 5, 5, 5, 6, 7, 8, 9, 9, 9, 10, 10, 10, 1, 2, 3, 4, 5, 6, 7]) == 17\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().findShortestSubArray", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findShortestSubArray = function(nums) {", "container": null, "callable": "findShortestSubArray", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 698, "task_id": "partition-to-k-equal-sum-subsets", "difficulty": "Medium", "problem_description": "Given an integer array nums and an integer k, return true if it is possible to divide this array into k non-empty subsets whose sums are all equal.\n \nExample 1:\n\nInput: nums = [4,3,2,3,5,2,1], k = 4\nOutput: true\nExplanation: It is possible to divide it into 4 subsets (5), (1, 4), (2,3), (2,3) with equal sums.\n\nExample 2:\n\nInput: nums = [1,2,3,4], k = 3\nOutput: false\n\n \nConstraints:\n\n1 <= k <= nums.length <= 16\n1 <= nums[i] <= 104\nThe frequency of each element is in the range [1, 4].\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [2, 2, 2, 2, 3, 4, 5],k = 4) == False\n assert candidate(nums = [4, 4, 6, 2, 3, 8, 10, 2, 10, 7],k = 4) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1],k = 2) == True\n assert candidate(nums = [1, 2, 3, 4],k = 3) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1],k = 8) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8],k = 4) == True\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10],k = 4) == True\n assert candidate(nums = [4, 3, 2, 3, 5, 2, 1],k = 4) == True\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10],k = 8) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 16) == True\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600],k = 8) == True\n assert candidate(nums = [9, 4, 4, 9, 2, 4, 5, 4, 5, 3, 2, 9, 10, 7, 4, 7],k = 8) == False\n assert candidate(nums = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16],k = 4) == False\n assert candidate(nums = [2, 2, 2, 2, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7],k = 7) == False\n assert candidate(nums = [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27],k = 6) == False\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 16) == True\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 6) == False\n assert candidate(nums = [3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == False\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],k = 5) == True\n assert candidate(nums = [33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33],k = 12) == False\n assert candidate(nums = [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16],k = 8) == True\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9],k = 8) == False\n assert candidate(nums = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8],k = 12) == False\n assert candidate(nums = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8],k = 16) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],k = 16) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],k = 2) == True\n assert candidate(nums = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15],k = 12) == False\n assert candidate(nums = [8, 16, 32, 64, 128, 256, 512, 1024, 1, 2, 3, 4, 5, 6, 7, 8],k = 8) == False\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],k = 16) == True\n assert candidate(nums = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],k = 12) == False\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1],k = 8) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],k = 1) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160],k = 8) == True\n assert candidate(nums = [10, 10, 20, 20, 30, 30, 40, 40, 50, 50, 60, 60, 70, 70, 80, 80],k = 8) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6],k = 6) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8],k = 8) == True\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3],k = 8) == False\n assert candidate(nums = [9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99, 108, 117, 126, 135, 144],k = 9) == False\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000],k = 8) == True\n assert candidate(nums = [3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5],k = 8) == True\n assert candidate(nums = [16, 16, 16, 16, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],k = 8) == False\n assert candidate(nums = [7, 2, 1, 6, 3, 4, 3, 3, 1, 2, 1, 2, 2, 2, 3, 3],k = 6) == False\n assert candidate(nums = [9, 4, 5, 9, 8, 4, 5, 10, 3, 4, 6, 7, 1, 2, 8],k = 3) == False\n assert candidate(nums = [9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3],k = 8) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 15) == False\n assert candidate(nums = [16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8],k = 16) == False\n assert candidate(nums = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100],k = 8) == True\n assert candidate(nums = [1, 2, 3, 6, 9, 12, 18, 27, 54, 81, 162, 324, 648, 1296, 2592, 5184],k = 6) == False\n assert candidate(nums = [15, 15, 15, 15, 10, 10, 10, 10, 5, 5, 5, 5, 1, 1, 1, 1],k = 6) == False\n assert candidate(nums = [1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 16) == False\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600],k = 4) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],k = 8) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32],k = 16) == True\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 16) == True\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 15) == False\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],k = 7) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],k = 4) == True\n assert candidate(nums = [4, 1, 5, 3, 2, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 16],k = 8) == True\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 4) == True\n assert candidate(nums = [2, 2, 2, 2, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == False\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48],k = 16) == False\n assert candidate(nums = [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 6) == False\n assert candidate(nums = [1, 2, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42],k = 8) == False\n assert candidate(nums = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15],k = 15) == False\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],k = 8) == True\n assert candidate(nums = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15],k = 16) == True\n assert candidate(nums = [7, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36],k = 16) == False\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000],k = 8) == True\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 9) == False\n assert candidate(nums = [16, 8, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == False\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5],k = 8) == True\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 8) == True\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4],k = 4) == True\n assert candidate(nums = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8],k = 8) == True\n assert candidate(nums = [8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128],k = 16) == False\n assert candidate(nums = [5, 5, 10, 10, 15, 15, 20, 20, 25, 25, 30, 30, 35, 35, 40, 40],k = 8) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160],k = 16) == False\n assert candidate(nums = [2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5],k = 16) == False\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160],k = 4) == True\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600],k = 16) == False\n assert candidate(nums = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6],k = 3) == False\n assert candidate(nums = [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12],k = 6) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9],k = 6) == False\n assert candidate(nums = [3, 1, 2, 2, 3, 3, 2, 2, 1, 3, 3, 3, 2, 1, 2, 2],k = 6) == False\n assert candidate(nums = [3, 5, 1, 1, 3, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == False\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 10) == False\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().canPartitionKSubsets", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var canPartitionKSubsets = function(nums, k) {", "container": null, "callable": "canPartitionKSubsets", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 699, "task_id": "falling-squares", "difficulty": "Hard", "problem_description": "There are several squares being dropped onto the X-axis of a 2D plane.\nYou are given a 2D integer array positions where positions[i] = [lefti, sideLengthi] represents the ith square with a side length of sideLengthi that is dropped with its left edge aligned with X-coordinate lefti.\nEach square is dropped one at a time from a height above any landed squares. It then falls downward (negative Y direction) until it either lands on the top side of another square or on the X-axis. A square brushing the left/right side of another square does not count as landing on it. Once it lands, it freezes in place and cannot be moved.\nAfter each square is dropped, you must record the height of the current tallest stack of squares.\nReturn an integer array ans where ans[i] represents the height described above after dropping the ith square.\n \nExample 1:\n\n\nInput: positions = [[1,2],[2,3],[6,1]]\nOutput: [2,5,5]\nExplanation:\nAfter the first drop, the tallest stack is square 1 with a height of 2.\nAfter the second drop, the tallest stack is squares 1 and 2 with a height of 5.\nAfter the third drop, the tallest stack is still squares 1 and 2 with a height of 5.\nThus, we return an answer of [2, 5, 5].\n\nExample 2:\n\nInput: positions = [[100,100],[200,100]]\nOutput: [100,100]\nExplanation:\nAfter the first drop, the tallest stack is square 1 with a height of 100.\nAfter the second drop, the tallest stack is either square 1 or square 2, both with heights of 100.\nThus, we return an answer of [100, 100].\nNote that square 2 only brushes the right side of square 1, which does not count as landing on it.\n\n \nConstraints:\n\n1 <= positions.length <= 1000\n1 <= lefti <= 108\n1 <= sideLengthi <= 106\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(positions = [[4, 1], [2, 2], [1, 3], [3, 4]]) == [1, 2, 5, 9]\n assert candidate(positions = [[1, 5], [2, 2], [7, 3]]) == [5, 7, 7]\n assert candidate(positions = [[1, 3], [3, 2], [5, 1]]) == [3, 5, 5]\n assert candidate(positions = [[1, 3], [3, 3], [5, 3], [7, 3]]) == [3, 6, 9, 12]\n assert candidate(positions = [[100, 100], [200, 100]]) == [100, 100]\n assert candidate(positions = [[1, 2], [2, 3], [6, 1]]) == [2, 5, 5]\n assert candidate(positions = [[6, 1], [9, 2], [2, 3], [4, 4], [1, 5], [11, 5], [12, 3]]) == [1, 2, 3, 7, 12, 12, 12]\n assert candidate(positions = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == [1, 2, 5, 9, 14]\n assert candidate(positions = [[1, 10], [10, 10], [10, 1], [15, 10]]) == [10, 20, 21, 30]\n assert candidate(positions = [[1, 1], [2, 2], [3, 3], [4, 4]]) == [1, 2, 5, 9]\n assert candidate(positions = [[1, 10], [10, 10], [20, 10]]) == [10, 20, 20]\n assert candidate(positions = [[1, 1000000], [1000001, 1000000]]) == [1000000, 1000000]\n assert candidate(positions = [[5, 3], [1, 5], [4, 2], [6, 1]]) == [3, 8, 10, 10]\n assert candidate(positions = [[1, 3], [3, 3], [5, 3]]) == [3, 6, 9]\n assert candidate(positions = [[1, 5], [5, 5], [9, 5], [13, 5], [17, 5], [21, 5], [25, 5], [29, 5], [33, 5], [37, 5], [41, 5], [45, 5], [49, 5], [53, 5], [57, 5]]) == [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75]\n assert candidate(positions = [[100000, 100000], [200000, 200000], [300000, 300000], [400000, 400000], [500000, 500000], [600000, 600000]]) == [100000, 200000, 500000, 900000, 1400000, 2000000]\n assert candidate(positions = [[1, 1000000], [500001, 1000000], [1000002, 1000000], [1500003, 1000000], [2000004, 1000000]]) == [1000000, 2000000, 3000000, 4000000, 5000000]\n assert candidate(positions = [[50000000, 500000], [100000000, 1000000], [250000000, 250000], [400000000, 100000], [550000000, 200000]]) == [500000, 1000000, 1000000, 1000000, 1000000]\n assert candidate(positions = [[1, 50000], [50001, 50000], [100001, 50000], [150001, 50000], [200001, 50000], [250001, 50000], [300001, 50000], [350001, 50000], [400001, 50000]]) == [50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000]\n assert candidate(positions = [[1, 200], [200, 100], [150, 50], [50, 25], [250, 200]]) == [200, 300, 300, 300, 500]\n assert candidate(positions = [[1, 100000], [100001, 100000], [200001, 100000], [300001, 100000], [400001, 100000]]) == [100000, 100000, 100000, 100000, 100000]\n assert candidate(positions = [[1, 100], [50, 100], [100, 100], [150, 100], [200, 100], [250, 100], [300, 100], [350, 100], [400, 100], [450, 100]]) == [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]\n assert candidate(positions = [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1], [11, 1], [12, 1], [13, 1], [14, 1], [15, 1], [16, 1], [17, 1], [18, 1], [19, 1], [20, 1]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(positions = [[50000000, 1000000], [50000001, 1000000], [50000002, 1000000], [50000003, 1000000], [50000004, 1000000]]) == [1000000, 2000000, 3000000, 4000000, 5000000]\n assert candidate(positions = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]\n assert candidate(positions = [[1, 5], [3, 5], [5, 5], [7, 5], [9, 5], [11, 5], [13, 5], [15, 5], [17, 5], [19, 5], [21, 5], [23, 5], [25, 5], [27, 5], [29, 5], [31, 5]]) == [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80]\n assert candidate(positions = [[1, 100], [2, 100], [3, 100], [101, 100], [102, 100], [103, 100], [201, 100], [202, 100], [203, 100]]) == [100, 200, 300, 400, 500, 600, 700, 800, 900]\n assert candidate(positions = [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100], [100, 110]]) == [20, 50, 90, 140, 200, 270, 350, 440, 540, 650]\n assert candidate(positions = [[10, 5], [15, 5], [20, 5], [25, 5], [30, 5], [35, 5], [40, 5], [45, 5], [50, 5], [55, 5], [60, 5], [65, 5], [70, 5], [75, 5], [80, 5]]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]\n assert candidate(positions = [[1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2], [8, 2], [9, 2], [10, 2]]) == [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]\n assert candidate(positions = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15]]) == [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120]\n assert candidate(positions = [[1, 9], [10, 9], [19, 9], [28, 9], [37, 9], [46, 9], [55, 9], [64, 9], [73, 9], [82, 9], [91, 9], [100, 9]]) == [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]\n assert candidate(positions = [[10, 20], [15, 30], [20, 25], [25, 10], [30, 20], [35, 30], [40, 25], [45, 10]]) == [20, 50, 75, 85, 105, 135, 160, 170]\n assert candidate(positions = [[1, 1000000], [2, 999999], [3, 999998], [4, 999997], [5, 999996]]) == [1000000, 1999999, 2999997, 3999994, 4999990]\n assert candidate(positions = [[1, 500000], [500001, 500000], [1000001, 500000], [1500001, 500000], [2000001, 500000], [2500001, 500000], [3000001, 500000]]) == [500000, 500000, 500000, 500000, 500000, 500000, 500000]\n assert candidate(positions = [[5, 50], [15, 50], [25, 50], [35, 50], [45, 50], [55, 50], [65, 50], [75, 50], [85, 50], [95, 50], [105, 50]]) == [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550]\n assert candidate(positions = [[10, 20], [15, 30], [25, 15], [30, 25], [40, 10], [45, 20], [50, 30], [55, 15], [60, 25], [65, 10]]) == [20, 50, 65, 90, 100, 120, 150, 165, 190, 200]\n assert candidate(positions = [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(positions = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15]]) == [1, 2, 5, 9, 14, 20, 27, 35, 44, 54, 65, 77, 90, 104, 119]\n assert candidate(positions = [[5, 10], [10, 20], [15, 15], [25, 10], [30, 25], [35, 5], [40, 30]]) == [10, 30, 45, 55, 80, 85, 110]\n assert candidate(positions = [[1, 1000], [2, 1000], [3, 1000], [4, 1000], [5, 1000], [6, 1000], [7, 1000], [8, 1000], [9, 1000], [10, 1000]]) == [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]\n assert candidate(positions = [[1, 200], [100, 200], [200, 200], [300, 200], [400, 200], [500, 200], [600, 200], [700, 200], [800, 200], [900, 200]]) == [200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000]\n assert candidate(positions = [[5, 10], [15, 20], [10, 5], [25, 15], [30, 10], [20, 10]]) == [10, 20, 20, 35, 45, 45]\n assert candidate(positions = [[1, 1000], [2, 2000], [3, 3000], [4, 4000], [5, 5000], [6, 6000], [7, 7000], [8, 8000], [9, 9000], [10, 10000]]) == [1000, 3000, 6000, 10000, 15000, 21000, 28000, 36000, 45000, 55000]\n assert candidate(positions = [[1, 50], [51, 50], [101, 50], [151, 50], [201, 50], [251, 50], [301, 50], [351, 50], [401, 50], [451, 50]]) == [50, 50, 50, 50, 50, 50, 50, 50, 50, 50]\n assert candidate(positions = [[100, 200], [150, 300], [200, 100], [250, 400], [300, 500], [350, 600], [400, 700], [450, 800], [500, 900]]) == [200, 500, 600, 1000, 1500, 2100, 2800, 3600, 4500]\n assert candidate(positions = [[1, 5], [3, 5], [5, 5], [7, 5], [9, 5], [11, 5], [13, 5], [15, 5], [17, 5], [19, 5], [21, 5], [23, 5], [25, 5], [27, 5], [29, 5]]) == [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75]\n assert candidate(positions = [[1, 1000000], [500000, 500000], [250000, 250000], [750000, 750000]]) == [1000000, 1500000, 1500000, 2250000]\n assert candidate(positions = [[10, 5], [15, 3], [20, 7], [25, 2], [30, 4], [35, 6], [40, 8], [45, 1], [50, 9], [55, 10]]) == [5, 5, 7, 9, 9, 9, 14, 15, 15, 19]\n assert candidate(positions = [[1, 1000000], [1000001, 1000000], [2000001, 1000000], [3000001, 1000000], [4000001, 1000000]]) == [1000000, 1000000, 1000000, 1000000, 1000000]\n assert candidate(positions = [[1, 100], [101, 100], [201, 100], [301, 100], [401, 100], [501, 100]]) == [100, 100, 100, 100, 100, 100]\n assert candidate(positions = [[100, 100], [200, 200], [300, 300], [400, 400], [500, 500], [600, 600], [700, 700], [800, 800], [900, 900], [1000, 1000]]) == [100, 200, 500, 900, 1400, 2000, 2700, 3500, 4400, 5400]\n assert candidate(positions = [[1, 10], [11, 10], [21, 10], [31, 10], [41, 10], [51, 10], [61, 10]]) == [10, 10, 10, 10, 10, 10, 10]\n assert candidate(positions = [[1, 2], [3, 2], [5, 2], [7, 2], [9, 2], [11, 2], [13, 2], [15, 2], [17, 2], [19, 2], [21, 2], [23, 2], [25, 2]]) == [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]\n assert candidate(positions = [[1, 5], [3, 5], [5, 5], [7, 5], [9, 5], [11, 5], [13, 5], [15, 5], [17, 5], [19, 5]]) == [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]\n assert candidate(positions = [[5, 20], [25, 15], [10, 25], [40, 5], [30, 10]]) == [20, 20, 45, 45, 55]\n assert candidate(positions = [[100000000, 1], [99999999, 1], [99999998, 1], [99999997, 1], [99999996, 1]]) == [1, 1, 1, 1, 1]\n assert candidate(positions = [[10, 50], [20, 50], [15, 60], [35, 50], [50, 50], [40, 40]]) == [50, 100, 160, 210, 260, 300]\n assert candidate(positions = [[1, 1], [1000000, 1000000], [2, 2], [1000001, 1000000], [3, 3], [1000002, 1000000], [4, 4], [1000003, 1000000]]) == [1, 1000000, 1000000, 2000000, 2000000, 3000000, 3000000, 4000000]\n assert candidate(positions = [[10000000, 1000000], [9000000, 500000], [8000000, 250000], [7000000, 125000], [6000000, 62500], [5000000, 31250], [4000000, 15625]]) == [1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000]\n assert candidate(positions = [[1, 1], [1000000, 1], [2, 1], [999999, 1], [3, 1], [999998, 1], [4, 1], [999997, 1], [5, 1], [999996, 1]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(positions = [[10, 20], [20, 10], [30, 30], [40, 20], [50, 10], [60, 40], [70, 50], [80, 30], [90, 20]]) == [20, 30, 30, 50, 60, 60, 90, 120, 140]\n assert candidate(positions = [[1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2], [8, 2], [9, 2], [10, 2], [11, 2], [12, 2], [13, 2], [14, 2], [15, 2]]) == [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]\n assert candidate(positions = [[1, 1], [2, 2], [1, 1], [2, 2], [1, 1], [2, 2], [1, 1], [2, 2], [1, 1], [2, 2], [1, 1], [2, 2], [1, 1], [2, 2], [1, 1], [2, 2]]) == [1, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16]\n assert candidate(positions = [[1, 100], [2, 200], [3, 300], [4, 400], [5, 500], [6, 600], [7, 700], [8, 800], [9, 900], [10, 1000]]) == [100, 300, 600, 1000, 1500, 2100, 2800, 3600, 4500, 5500]\n assert candidate(positions = [[1, 200000], [199999, 1], [2, 199999], [199998, 2], [3, 199998], [199997, 3], [4, 199997]]) == [200000, 200001, 400000, 400002, 600000, 600003, 800000]\n assert candidate(positions = [[1, 1000000], [1000000, 1000000], [2000000, 1000000], [3000000, 1000000], [4000000, 1000000]]) == [1000000, 2000000, 2000000, 2000000, 2000000]\n assert candidate(positions = [[1, 10], [10, 10], [19, 10], [28, 10], [37, 10], [46, 10], [55, 10], [64, 10], [73, 10], [82, 10], [91, 10], [100, 10], [109, 10], [118, 10], [127, 10], [136, 10], [145, 10], [154, 10], [163, 10], [172, 10], [181, 10], [190, 10], [199, 10], [208, 10], [217, 10], [226, 10], [235, 10], [244, 10], [253, 10], [262, 10], [271, 10], [280, 10], [289, 10], [298, 10]]) == [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340]\n assert candidate(positions = [[5, 15], [15, 20], [10, 25], [25, 10], [40, 5]]) == [15, 35, 60, 70, 70]\n assert candidate(positions = [[1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [6, 5], [7, 5], [8, 5], [9, 5], [10, 5]]) == [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]\n assert candidate(positions = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == [1, 2, 5, 9, 14, 20, 27, 35, 44, 54]\n assert candidate(positions = [[1, 1000000], [1000000, 1000000], [2000000, 1000000], [3000000, 1000000]]) == [1000000, 2000000, 2000000, 2000000]\n assert candidate(positions = [[50, 100], [150, 200], [250, 150], [350, 250], [450, 300], [550, 200], [650, 100], [750, 150], [850, 200], [950, 250]]) == [100, 200, 350, 600, 900, 1100, 1200, 1200, 1200, 1200]\n assert candidate(positions = [[1, 2], [2, 3], [4, 4], [7, 5], [11, 6], [17, 7], [24, 8], [32, 9], [41, 10]]) == [2, 5, 9, 14, 20, 20, 20, 20, 20]\n assert candidate(positions = [[1, 100000], [100000, 100000], [200000, 100000], [300000, 100000], [400000, 100000]]) == [100000, 200000, 200000, 200000, 200000]\n assert candidate(positions = [[1, 100], [200, 200], [300, 300], [400, 400], [500, 500], [600, 600], [700, 700], [800, 800], [900, 900], [1000, 1000]]) == [100, 200, 500, 900, 1400, 2000, 2700, 3500, 4400, 5400]\n assert candidate(positions = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == [1, 2, 5, 9, 14, 20, 27, 35, 44, 54]\n assert candidate(positions = [[1, 1000000], [2, 1000000], [3, 1000000], [4, 1000000], [5, 1000000]]) == [1000000, 2000000, 3000000, 4000000, 5000000]\n assert candidate(positions = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n assert candidate(positions = [[50, 50], [50, 40], [50, 30], [50, 20], [50, 10], [60, 10], [70, 20], [80, 30], [90, 40], [100, 50]]) == [50, 90, 120, 140, 150, 150, 150, 170, 210, 260]\n assert candidate(positions = [[1, 2], [1, 2], [1, 2], [2, 2], [2, 2], [2, 2], [3, 2], [3, 2], [3, 2]]) == [2, 4, 6, 8, 10, 12, 14, 16, 18]\n assert candidate(positions = [[1, 20], [10, 30], [15, 10], [5, 25], [30, 5], [40, 15]]) == [20, 50, 60, 85, 85, 85]\n assert candidate(positions = [[10, 1], [20, 1], [15, 2], [25, 2], [30, 3], [35, 3], [40, 4], [45, 4], [50, 5], [55, 5]]) == [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]\n assert candidate(positions = [[1, 100000], [2, 99999], [3, 99998], [4, 99997], [5, 99996], [6, 99995], [7, 99994], [8, 99993], [9, 99992], [10, 99991]]) == [100000, 199999, 299997, 399994, 499990, 599985, 699979, 799972, 899964, 999955]\n assert candidate(positions = [[10, 20], [30, 40], [50, 60], [70, 80], [90, 100], [110, 120], [130, 140], [150, 160], [170, 180], [190, 200], [210, 220], [230, 240], [250, 260], [270, 280], [290, 300]]) == [20, 40, 100, 180, 280, 400, 540, 700, 880, 1080, 1300, 1540, 1800, 2080, 2380]\n assert candidate(positions = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15]]) == [1, 2, 5, 9, 14, 20, 27, 35, 44, 54, 65, 77, 90, 104, 119]\n assert candidate(positions = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15], [16, 16], [17, 17], [18, 18], [19, 19], [20, 20]]) == [1, 2, 5, 9, 14, 20, 27, 35, 44, 54, 65, 77, 90, 104, 119, 135, 152, 170, 189, 209]\n assert candidate(positions = [[1000000, 1000000], [900000, 1000000], [800000, 1000000], [700000, 1000000], [600000, 1000000]]) == [1000000, 2000000, 3000000, 4000000, 5000000]\n assert candidate(positions = [[10000, 5000], [15000, 10000], [20000, 15000], [25000, 20000], [30000, 25000], [35000, 30000], [40000, 35000], [45000, 40000], [50000, 45000], [55000, 50000]]) == [5000, 10000, 25000, 45000, 70000, 100000, 135000, 175000, 220000, 270000]\n assert candidate(positions = [[1, 100], [101, 100], [201, 100], [301, 100], [401, 100], [501, 100], [601, 100], [701, 100], [801, 100], [901, 100]]) == [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]\n assert candidate(positions = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70], [80, 80], [90, 90], [100, 100], [110, 110], [120, 120], [130, 130]]) == [10, 20, 50, 90, 140, 200, 270, 350, 440, 540, 650, 770, 900]\n assert candidate(positions = [[1000000, 1], [999999, 2], [999998, 3], [999997, 4], [999996, 5]]) == [1, 3, 6, 10, 15]\n assert candidate(positions = [[1000, 1000], [1500, 1000], [2000, 1000], [2500, 1000], [3000, 1000], [3500, 1000], [4000, 1000], [4500, 1000], [5000, 1000]]) == [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000]\n assert candidate(positions = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [21, 22], [23, 24], [25, 26], [27, 28], [29, 30]]) == [2, 4, 10, 18, 28, 40, 54, 70, 88, 108, 130, 154, 180, 208, 238]\n assert candidate(positions = [[100000, 100000], [200000, 100000], [300000, 100000], [400000, 100000], [500000, 100000], [600000, 100000], [700000, 100000], [800000, 100000], [900000, 100000], [1000000, 100000]]) == [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000]\n assert candidate(positions = [[1, 1], [2, 2], [1, 2], [2, 1], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]) == [1, 2, 4, 5, 5, 9, 14, 20, 27, 35]\n assert candidate(positions = [[1, 1000000], [500000, 1000000], [1000000, 1000000], [1500000, 1000000], [2000000, 1000000]]) == [1000000, 2000000, 3000000, 4000000, 5000000]\n assert candidate(positions = [[1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [6, 5], [7, 5], [8, 5], [9, 5], [10, 5], [11, 5], [12, 5], [13, 5], [14, 5], [15, 5], [16, 5], [17, 5], [18, 5], [19, 5], [20, 5]]) == [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]\n assert candidate(positions = [[1, 10], [11, 10], [21, 10], [31, 10], [41, 10], [51, 10], [61, 10], [71, 10], [81, 10], [91, 10]]) == [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]\n assert candidate(positions = [[1, 100], [101, 100], [201, 100], [301, 100], [401, 100], [501, 100], [601, 100], [701, 100], [801, 100], [901, 100]]) == [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]\n assert candidate(positions = [[1, 100000], [100000, 1], [200000, 100000], [300000, 100000], [400000, 100000]]) == [100000, 100001, 100001, 100001, 100001]\n assert candidate(positions = [[1, 500], [1, 500], [1, 500], [1, 500], [1, 500], [1, 500], [1, 500], [1, 500], [1, 500], [1, 500]]) == [500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000]\n assert candidate(positions = [[10000000, 1], [20000000, 2], [30000000, 3], [40000000, 4], [50000000, 5], [60000000, 6], [70000000, 7], [80000000, 8], [90000000, 9], [100000000, 10]]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n assert candidate(positions = [[1, 1000000], [1000001, 999999], [2000002, 999998], [3000003, 999997], [4000004, 999996]]) == [1000000, 1000000, 1000000, 1000000, 1000000]\n assert candidate(positions = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n"}, "metadata": {"canonical_parameter_names": ["positions"], "leetcode_dataset_entry_point": "Solution().fallingSquares", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var fallingSquares = function(positions) {", "container": null, "callable": "fallingSquares", "parameters": [{"name": "positions", "type": "number[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 700, "task_id": "search-in-a-binary-search-tree", "difficulty": "Easy", "problem_description": "You are given the root of a binary search tree (BST) and an integer val.\nFind the node in the BST that the node's value equals val and return the subtree rooted with that node. If such a node does not exist, return null.\n \nExample 1:\n\n\nInput: root = [4,2,7,1,3], val = 2\nOutput: [2,1,3]\n\nExample 2:\n\n\nInput: root = [4,2,7,1,3], val = 5\nOutput: []\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 5000].\n1 <= Node.val <= 107\nroot is a binary search tree.\n1 <= val <= 107\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),val = 8) == None\n assert candidate(root = tree_node([5]),val = 3) == None\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18]),val = 7), tree_node([7]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3]),val = 1), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, 7]),val = 6), tree_node([6, None, 7]))\n assert candidate(root = tree_node([1]),val = 2) == None\n assert candidate(root = tree_node([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5]),val = 10) == None\n assert is_same_tree(candidate(root = tree_node([25, 15, 50, 10, 22, 35, 70, 5, 12, 18, 24, 30, 40, 60, 80]),val = 35), tree_node([35, 30, 40]))\n assert candidate(root = tree_node([1, 0, 2]),val = 3) == None\n assert is_same_tree(candidate(root = tree_node([4, 2, 7, 1, 3]),val = 2), tree_node([2, 1, 3]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 2]),val = 1), tree_node([1, 0, 2]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),val = 7), tree_node([7]))\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18]),val = 20) == None\n assert is_same_tree(candidate(root = tree_node([2, 1, 3]),val = 2), tree_node([2, 1, 3]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18]),val = 10), tree_node([10, 5, 15, 3, 7, 12, 18]))\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),val = 4) == None\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, 4, 6, 8, 12, 14, 17, 19]),val = 13), tree_node([13, 12, 14]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 12, 18, 22, 28, 32, 38]),val = 28), tree_node([28]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, 7]),val = 3), tree_node([3, 2, 4]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, None, 1]),val = 4), tree_node([4]))\n assert candidate(root = tree_node([2, 1, 3]),val = 4) == None\n assert is_same_tree(candidate(root = tree_node([1, 0, 15, None, None, 14, 17]),val = 15), tree_node([15, 14, 17]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, None, 1]),val = 6), tree_node([6]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),val = 15), tree_node([15, None, 18]))\n assert candidate(root = tree_node([25, 15, 50, 10, 22, 35, 70, 5, 12, 18, 24, 30, 40, 60, 80]),val = 100) == None\n assert is_same_tree(candidate(root = tree_node([50, 25, 75, 10, 30, 60, 90, 5, 20, 28, 35, 55, 65, 85, 95]),val = 30), tree_node([30, 28, 35]))\n assert is_same_tree(candidate(root = tree_node([15, 9, 21, 7, 13, 18, 23, 5, None, 10, 14, None, None, None, None, 11, None]),val = 14), tree_node([14]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 12, 18, 22, 28, 32, 38]),val = 15), tree_node([15, 12, 18]))\n assert is_same_tree(candidate(root = tree_node([3, 1, 4, None, 2]),val = 2), tree_node([2]))\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7]),val = 1) == None\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, 4, 6, 8, 12, 14, 17, 19]),val = 20) == None\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 12, 18, 22, 28, 32, 38]),val = 29) == None\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, 4, None, None, 7]),val = 2), tree_node([2, 1, 3, 4, None, None, 7]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, None, 1]),val = 1), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 12, 18, 22, 28, 32, 38]),val = 30), tree_node([30, 25, 35, 22, 28, 32, 38]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 50, 10, 22, 35, 70, 5, 12, 18, 24, 30, 40, 60, 80]),val = 5), tree_node([5]))\n assert candidate(root = tree_node([8, 3, 10, None, 1, 6, None, 4, 7, 13, None, None, None, None, None, None]),val = 1) == None\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),val = 5) == None\n assert candidate(root = tree_node([4, 2, 7, 1, 3]),val = 5) == None\n assert candidate(root = tree_node([1, 2]),val = 2) == None\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7]),val = 8) == None\n assert is_same_tree(candidate(root = tree_node([1, None, 2]),val = 2), tree_node([2]))\n assert is_same_tree(candidate(root = tree_node([1]),val = 1), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([5]),val = 5), tree_node([5]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18]),val = 18), tree_node([18]))\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, None, 1]),val = 0) == None\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),val = 6) == None\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),val = 20) == None\n"}, "metadata": {"canonical_parameter_names": ["root", "val"], "leetcode_dataset_entry_point": "Solution().searchBST", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var searchBST = function(root, val) {", "container": null, "callable": "searchBST", "parameters": [{"name": "root", "type": "TreeNode"}, {"name": "val", "type": "number"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 701, "task_id": "insert-into-a-binary-search-tree", "difficulty": "Medium", "problem_description": "You are given the root node of a binary search tree (BST) and a value to insert into the tree. Return the root node of the BST after the insertion. It is guaranteed that the new value does not exist in the original BST.\nNotice that there may exist multiple valid ways for the insertion, as long as the tree remains a BST after insertion. You can return any of them.\n \nExample 1:\n\n\nInput: root = [4,2,7,1,3], val = 5\nOutput: [4,2,7,1,3,5]\nExplanation: Another accepted tree is:\n\n\nExample 2:\n\nInput: root = [40,20,60,10,30,50,70], val = 25\nOutput: [40,20,60,10,30,50,70,null,null,25]\n\nExample 3:\n\nInput: root = [4,2,7,1,3,null,null,null,null,null,null], val = 5\nOutput: [4,2,7,1,3,5]\n\n \nConstraints:\n\nThe number of nodes in the tree will be in the range [0, 104].\n-108 <= Node.val <= 108\nAll the values Node.val are unique.\n-108 <= val <= 108\nIt's guaranteed that val does not exist in the original BST.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(root = tree_node([1]),val = 2), tree_node([1, None, 2]))\n assert is_same_tree(candidate(root = tree_node([]),val = 5), tree_node([5]))\n assert is_same_tree(candidate(root = tree_node([4, 2, 7, 1, 3]),val = 5), tree_node([4, 2, 7, 1, 3, 5]))\n assert is_same_tree(candidate(root = tree_node([40, 20, 60, 10, 30, 50, 70]),val = 25), tree_node([40, 20, 60, 10, 30, 50, 70, None, None, 25]))\n assert is_same_tree(candidate(root = tree_node([]),val = 1), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([5, None, 14, 11, 15]),val = 12), tree_node([5, None, 14, 11, 15, None, 12]))\n assert is_same_tree(candidate(root = tree_node([1]),val = 0), tree_node([1, 0]))\n assert is_same_tree(candidate(root = tree_node([3, 1, 4, None, 2]),val = 5), tree_node([3, 1, 4, None, 2, None, 5]))\n assert is_same_tree(candidate(root = tree_node([5, 2, 7, 1, 3, 6, 8]),val = 4), tree_node([5, 2, 7, 1, 3, 6, 8, None, None, None, 4]))\n assert is_same_tree(candidate(root = tree_node([2, 1]),val = 3), tree_node([2, 1, 3]))\n assert is_same_tree(candidate(root = tree_node([4, 2, 7, 1, 3, None, None, None, None, None, None]),val = 5), tree_node([4, 2, 7, 1, 3, 5]))\n assert is_same_tree(candidate(root = tree_node([2, 2, None, 2, None, 2]),val = 3), tree_node([2, 2, 3, 2, None, None, None, 2]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 35, 60, 90, 110, 140, 160, None, 5, None, None, 30, 40, None, 65, 85, 105, 135, 155, 165]),val = 115), tree_node([100, 50, 150, 25, 75, 125, 175, 10, 35, 60, 90, 110, 140, 160, None, 5, None, None, 30, 40, None, 65, 85, 105, 135, 155, 165, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 115]))\n assert is_same_tree(candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15]),val = 16), tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 16]))\n assert is_same_tree(candidate(root = tree_node([60, 40, 80, 20, 50, 70, 90, 10, 30, 45, 55, 65, 75, 85, 95]),val = 66), tree_node([60, 40, 80, 20, 50, 70, 90, 10, 30, 45, 55, 65, 75, 85, 95, None, None, None, None, None, None, None, None, None, 66]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),val = 6), tree_node([10, 5, 15, 3, 7, None, 18, None, None, 6]))\n assert is_same_tree(candidate(root = tree_node([45, 30, 60, 10, 35, 50, 70, 5, 20, None, 40, None, None, 33, None]),val = 42), tree_node([45, 30, 60, 10, 35, 50, 70, 5, 20, None, 40, None, None, 33, None, None, None, None, None, None, 42]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, None, None, 2.5, 3.5]),val = 2.75), tree_node([2, 1, 3, None, None, 2.5, 3.5, None, 2.75]))\n assert is_same_tree(candidate(root = tree_node([10, None, 15, 12, 20, None, None, 13, 14, None, None, None, None]),val = 11), tree_node([10, None, 15, 12, 20, 11, None, 13, 14]))\n assert is_same_tree(candidate(root = tree_node([30, 20, 40, 10, 25, 35, 50, 5, None, 15, 28, None, None, 32, None, None, None, None, 33]),val = 26), tree_node([30, 20, 40, 10, 25, 35, 50, 5, None, 15, 28, None, None, 32, None, None, None, None, 33, 26]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 2, 7, None, 20, None, 6, None, None, None, 30]),val = 17), tree_node([10, 5, 15, 2, 7, None, 20, None, 6, None, None, 17, 30]))\n assert is_same_tree(candidate(root = tree_node([50, 25, 75, 10, 30, 60, 80, None, 20, 28, 35, None, 55, 70, 85, 5, None, 22, None, None, 33, None, None, 52, None, 65, None, 73, None, 82, None, 88]),val = 45), tree_node([50, 25, 75, 10, 30, 60, 80, None, 20, 28, 35, None, 55, 70, 85, 5, None, 22, None, None, 33, None, None, 52, None, 65, None, 73, None, 82, None, 88, 45]))\n assert is_same_tree(candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 15, 25, 35, 45, 55, 65, 75, 85]),val = 42), tree_node([50, 30, 70, 20, 40, 60, 80, 15, 25, 35, 45, 55, 65, 75, 85, None, None, None, None, None, None, 42]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 2, 7, None, 18]),val = 6), tree_node([10, 5, 15, 2, 7, None, 18, None, None, 6]))\n assert is_same_tree(candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, None, 18, 35, 48]),val = 14), tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, None, 18, 35, 48, None, None, None, None, None, 14]))\n assert is_same_tree(candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 10, 25, 35, 45, 55, 65, 75, 90]),val = 68), tree_node([50, 30, 70, 20, 40, 60, 80, 10, 25, 35, 45, 55, 65, 75, 90, None, None, None, None, None, None, None, None, None, None, None, 68]))\n assert is_same_tree(candidate(root = tree_node([1000, 500, 1500, 250, 750, 1250, 1750, 125, 375, 625, 875, 1125, 1375, 1625, 1875]),val = 1600), tree_node([1000, 500, 1500, 250, 750, 1250, 1750, 125, 375, 625, 875, 1125, 1375, 1625, 1875, None, None, None, None, None, None, None, None, None, None, None, None, 1600]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, None, None, 13, 18, 12, None, 14]),val = 11), tree_node([10, 5, 15, None, None, 13, 18, 12, None, 14, None, 11]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, None, 1, 6, None, 4, 7, 13, None, None, None, None, None, None, None, None]),val = 9), tree_node([8, 3, 10, None, 1, 6, None, 4, 7, 13, 9]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 130, 160, 180, 5, 15, 20, 28, 55, 65, 70, 85, 105, 115, 128, 135, 155, 165, 178, 190]),val = 140), tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 130, 160, 180, 5, 15, 20, 28, 55, 65, 70, 85, 105, 115, 128, 135, 155, 165, 178, 190, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 140]))\n assert is_same_tree(candidate(root = tree_node([3, 1, 4, None, 2, None, None]),val = 5), tree_node([3, 1, 4, None, 2, None, 5]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 130, 160, 180]),val = 140), tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 130, 160, 180, None, None, None, None, None, None, None, None, None, None, None, 140]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, None, None, None, None, None, None, None, None]),val = 11), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, None, None, 11]))\n assert is_same_tree(candidate(root = tree_node([4, 2, 7, 1, 3, None, None, None, None, None, None]),val = 10), tree_node([4, 2, 7, 1, 3, None, 10]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 130, 160, 180]),val = 115), tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 130, 160, 180, None, None, None, None, None, None, None, None, None, 115]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, None, None, 12, 20]),val = 13), tree_node([10, 5, 15, None, None, 12, 20, None, 13]))\n assert is_same_tree(candidate(root = tree_node([4, 2, 6, 1, 3, 5, 7]),val = 8), tree_node([4, 2, 6, 1, 3, 5, 7, None, None, None, None, None, None, None, 8]))\n assert is_same_tree(candidate(root = tree_node([5, 2, 8, None, None, 6, 10, None, None, None, 9]),val = 7), tree_node([5, 2, 8, None, None, 6, 10, None, 7, None, 9]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6]),val = 8), tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6, 8]))\n assert is_same_tree(candidate(root = tree_node([1, 3, None, None, 2]),val = 4), tree_node([1, 3, 4, None, 2]))\n assert is_same_tree(candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 17, 25, 35, 43, 48, 55]),val = 47), tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 17, 25, 35, 43, 48, 55, None, None, None, None, None, None, None, None, None, None, None, None, 47]))\n assert is_same_tree(candidate(root = tree_node([20, 15, 30, 10, 17, None, 35, None, None, 16, 19]),val = 22), tree_node([20, 15, 30, 10, 17, 22, 35, None, None, 16, 19]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, None, None, 2.5]),val = 2.2), tree_node([2, 1, 3, None, None, 2.5, None, 2.2]))\n assert is_same_tree(candidate(root = tree_node([50, 25, 75, 10, 35, 60, 85, None, 27, 30, 55, 65, 80, 90]),val = 70), tree_node([50, 25, 75, 10, 35, 60, 85, None, 27, 30, 55, 65, 80, 90, None, None, None, None, None, None, None, None, None, 70]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 7, 2, 4, 6, 8]),val = 1), tree_node([5, 3, 7, 2, 4, 6, 8, 1]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 85, 110, 140, 160, 180]),val = 105), tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 85, 110, 140, 160, 180, None, None, None, None, None, None, None, None, 105]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, None, None, 12, 20, None, None, 13, 14, 18, 22]),val = 16), tree_node([10, 5, 15, None, None, 12, 20, None, None, 13, 14, 18, 22, None, None, None, None, 16]))\n assert is_same_tree(candidate(root = tree_node([3, 1, 4, None, 2, None, None]),val = 0), tree_node([3, 1, 4, 0, 2]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 180, 5, None, None, 28, 40, None, 85, 100, 115, 130, None, None, 145, 155, 165, 175, None, 185]),val = 95), tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 180, 5, None, None, 28, 40, None, 85, 100, 115, 130, None, None, 145, 155, 165, 175, None, 185, None, None, None, None, None, None, 95]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, None, None, 2.5, None]),val = 2.3), tree_node([2, 1, 3, None, None, 2.5, None, 2.3]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, None, 1, None, None, None, None, None, None]),val = 8), tree_node([5, 3, 6, 2, 4, None, 7, None, 1, None, None, None, 8]))\n assert is_same_tree(candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 10, None, None, None, None, 65, 75, 85]),val = 72), tree_node([50, 30, 70, 20, 40, 60, 80, 10, None, None, None, None, 65, 75, 85, None, None, None, None, 72]))\n assert is_same_tree(candidate(root = tree_node([8, 5, 10, 3, 6, None, 12, None, None, None, 7, 11, 14]),val = 9), tree_node([8, 5, 10, 3, 6, 9, 12, None, None, None, 7, None, None, 11, 14]))\n assert is_same_tree(candidate(root = tree_node([7, 5, 9, 4, 6, 8, 10]),val = 11), tree_node([7, 5, 9, 4, 6, 8, 10, None, None, None, None, None, None, None, 11]))\n assert is_same_tree(candidate(root = tree_node([4, 2, 7, 1, 3, None, None, None, None, None, None]),val = 9), tree_node([4, 2, 7, 1, 3, None, 9]))\n assert is_same_tree(candidate(root = tree_node([8, 5, 15, 3, 6, 10, 18, 2, 4, 7, 9, 12, None, 16, None, None, None, None, None, None, 13, 14]),val = 17), tree_node([8, 5, 15, 3, 6, 10, 18, 2, 4, 7, 9, 12, None, 16, None, None, None, None, None, None, 13, 14, None, None, None, None, 17]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 7, 2, 4, 6, 8]),val = 9), tree_node([5, 3, 7, 2, 4, 6, 8, None, None, None, None, None, None, None, 9]))\n assert is_same_tree(candidate(root = tree_node([12, 7, 19, 5, 9, 13, 20, 3, 6, 8, 10, 11, 14, 18, None, None, None, None, None, None, None, None, 16, None, None, None, 17]),val = 12.5), tree_node([12, 7, 19, 5, 9, 13, 20, 3, 6, 8, 10, 11, 14, 18, None, None, None, None, None, None, None, None, 16, None, 12.5, None, 17]))\n assert is_same_tree(candidate(root = tree_node([4, 2, 7, 1, 3, None, None, 0, None, None, None, None, None]),val = -1), tree_node([4, 2, 7, 1, 3, None, None, 0, None, None, None, -1]))\n assert is_same_tree(candidate(root = tree_node([4, 2, 7, 1, 3, None, None, None, None, None, None]),val = 0), tree_node([4, 2, 7, 1, 3, None, None, 0]))\n assert is_same_tree(candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 10, 25, 35, 45, 55, 65, 75, 85]),val = 42), tree_node([50, 30, 70, 20, 40, 60, 80, 10, 25, 35, 45, 55, 65, 75, 85, None, None, None, None, None, None, 42]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, None, None, 12, 20, None, None, 11, 13, None, None, None, None]),val = 14), tree_node([10, 5, 15, None, None, 12, 20, None, 14, 11, 13]))\n assert is_same_tree(candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 10, None, None, 45, None, 65, None, None, 55]),val = 52), tree_node([50, 30, 70, 20, 40, 60, 80, 10, None, None, 45, 52, 65, None, None, 55]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, None, None, 3, 7, 12, 17, 25, 35, 11, 13, 23, 27, 32, 37]),val = 26), tree_node([20, 10, 30, 5, 15, 26, None, 3, 7, 12, 17, None, None, 25, 35, 11, 13, 23, 27, 32, 37]))\n assert is_same_tree(candidate(root = tree_node([1, None, 3, None, 5]),val = 4), tree_node([1, None, 3, None, 5, 4]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, 4]),val = 5), tree_node([2, 1, 3, 4, None, None, 5]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9]),val = 10), tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180]),val = 130), tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180, None, None, None, None, None, None, None, None, None, None, 130]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 8, 2, 4, None, None, 1]),val = 0), tree_node([5, 3, 8, 2, 4, None, None, 1, None, None, None, 0]))\n assert is_same_tree(candidate(root = tree_node([2147483647]),val = -2147483648), tree_node([2147483647, -2147483648]))\n assert is_same_tree(candidate(root = tree_node([3, 1, 4, None, 2, None, None, 1.5]),val = 1.7), tree_node([3, 1, 4, None, 2, None, None, 1.5, None, None, 1.7]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 13, 17, 23, 27, 33, 37]),val = 18), tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 13, 17, 23, 27, 33, 37, None, None, None, None, None, None, None, 18]))\n assert is_same_tree(candidate(root = tree_node([50, 25, 75, 10, 30, 60, 80, 5, 15, 27, 35, 55, 65, 77, 90]),val = 40), tree_node([50, 25, 75, 10, 30, 60, 80, 5, 15, 27, 35, 55, 65, 77, 90, None, None, None, None, None, None, None, 40]))\n assert is_same_tree(candidate(root = tree_node([30, 15, 70, 10, 20, 60, 80, 5, 12, 18, 25, 50, 65, 75, 85]),val = 35), tree_node([30, 15, 70, 10, 20, 60, 80, 5, 12, 18, 25, 50, 65, 75, 85, None, None, None, None, None, None, None, None, 35]))\n assert is_same_tree(candidate(root = tree_node([4, 2, 7, 1, 3]),val = 8), tree_node([4, 2, 7, 1, 3, None, 8]))\n assert is_same_tree(candidate(root = tree_node([4, 2, 7, 1, 3, None, None, 0]),val = -1), tree_node([4, 2, 7, 1, 3, None, None, 0, None, None, None, -1]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, None, None, None, None, None, None, None]),val = 11), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, None, None, 11]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 2, None, 12, 18, None, None, 11, 14, 17, 19]),val = 20), tree_node([10, 5, 15, 2, None, 12, 18, None, None, 11, 14, 17, 19, None, None, None, None, None, None, None, 20]))\n assert is_same_tree(candidate(root = tree_node([4, 2, 7, 1, 3, None, None, None, None, None, None]),val = 6), tree_node([4, 2, 7, 1, 3, 6]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 17, 22, 27, 32, 40]),val = 11), tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 17, 22, 27, 32, 40, None, None, None, None, 11]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, None, None, 12, 20, None, None, 11, 13, None, 18, 17, 22]),val = 9), tree_node([10, 5, 15, None, 9, 12, 20, None, None, None, None, 11, 13, None, 18, 17, 22]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, None, 5, 9, 12, None, None, 4, 6]),val = 7), tree_node([8, 3, 10, None, 5, 9, 12, None, 7, 4, 6]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 17, 22, 27, 32, 37]),val = 21), tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 17, 22, 27, 32, 37, None, None, None, None, None, None, None, None, 21]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, None, None, 18, None, 28, None, None, None, None]),val = 19), tree_node([25, 15, 35, 10, 20, 30, 40, 5, None, 19, 18, None, 28]))\n assert is_same_tree(candidate(root = tree_node([30, 20, 40, 10, 25, 35, 50, 5, None, None, 27, 32, 45, 55]),val = 28), tree_node([30, 20, 40, 10, 25, 35, 50, 5, None, None, 27, 32, 45, 55, None, None, None, None, 28]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, None, None, None, 4, None, None, None, 5]),val = 6), tree_node([2, 1, 3, None, None, None, 4, None, 6]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, None, None, 12, None, 22, 28, None, None, None, None, None, None, None, None]),val = 27), tree_node([20, 10, 30, 5, 15, 25, 35, None, None, 12, None, 22, 28, None, None, None, None, None, None, 27]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, None, None, 12, 17, 22, 27, None, None, None, None, None, None, None, None, None, None]),val = 19), tree_node([20, 10, 30, 5, 15, 25, 35, None, None, 12, 17, 22, 27, None, None, None, None, None, 19]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, None, None, None, None, None]),val = 6), tree_node([1, 2, 3, 4, 5, None, 6]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, 7, None, 17, 23, None, 21, 27, None, None, None, None, None, 22, None, None, None, 26]),val = 18), tree_node([20, 10, 30, 5, 15, 25, 35, 1, 7, None, 17, 23, None, 21, 27, None, None, None, None, None, 22, None, None, None, 26, None, None, 18]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 180]),val = 130), tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 180, None, None, None, None, None, None, None, None, None, None, 130]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180]),val = 90), tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180, None, None, None, None, None, None, None, 90]))\n assert is_same_tree(candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 10, None, 35, None, 55, None, None, None, None, None]),val = 25), tree_node([50, 30, 70, 20, 40, 60, 80, 10, 25, 35, None, 55]))\n assert is_same_tree(candidate(root = tree_node([40, 20, 60, 10, 30, 50, 70, 5, None, 25, None, 45, 55, None, None, None, None, None, 23, 35, None, 42, 48, None, None, None, None, None, 65, 75, 62, 68, None, None, 73, 77, None, None, None, None, None, None, None, None]),val = 74), tree_node([40, 20, 60, 10, 30, 50, 70, 5, None, 25, None, 45, 55, None, 74, None, None, None, 23, 35, None, 42, 48, None, None, None, None, None, None, None, 65, 75, 62, 68, None, None, 73, 77]))\n assert is_same_tree(candidate(root = tree_node([45, 25, 65, 15, 35, 55, 75, 10, None, 30, 40, 50, 60, 70, 80]),val = 27), tree_node([45, 25, 65, 15, 35, 55, 75, 10, None, 30, 40, 50, 60, 70, 80, None, None, 27]))\n"}, "metadata": {"canonical_parameter_names": ["root", "val"], "leetcode_dataset_entry_point": "Solution().insertIntoBST", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var insertIntoBST = function(root, val) {", "container": null, "callable": "insertIntoBST", "parameters": [{"name": "root", "type": "TreeNode"}, {"name": "val", "type": "number"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 704, "task_id": "binary-search", "difficulty": "Easy", "problem_description": "Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1.\nYou must write an algorithm with O(log n) runtime complexity.\n \nExample 1:\n\nInput: nums = [-1,0,3,5,9,12], target = 9\nOutput: 4\nExplanation: 9 exists in nums and its index is 4\n\nExample 2:\n\nInput: nums = [-1,0,3,5,9,12], target = 2\nOutput: -1\nExplanation: 2 does not exist in nums so return -1\n\n \nConstraints:\n\n1 <= nums.length <= 104\n-104 < nums[i], target < 104\nAll the integers in nums are unique.\nnums is sorted in ascending order.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [-10, 0, 10, 20, 30],target = -5) == -1\n assert candidate(nums = [1, 2, 3, 4, 5],target = 6) == -1\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1],target = 0) == -1\n assert candidate(nums = [1, 2, 3, 4, 5],target = 3) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 5) == 4\n assert candidate(nums = [-10, 0, 10, 20, 30],target = 0) == 1\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1],target = -5) == 5\n assert candidate(nums = [0],target = 0) == 0\n assert candidate(nums = [-1, 0, 3, 5, 9, 12],target = 9) == 4\n assert candidate(nums = [5],target = 5) == 0\n assert candidate(nums = [-10, -5, -3, -1, 0, 1, 3, 5, 8, 10],target = 10) == 9\n assert candidate(nums = [5],target = 4) == -1\n assert candidate(nums = [-1, 0, 3, 5, 9, 12],target = 2) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 11) == -1\n assert candidate(nums = [0],target = 1) == -1\n assert candidate(nums = [-10, -5, -3, -1, 0, 1, 3, 5, 8, 10],target = -5) == 1\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],target = 210) == -1\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024],target = 256) == 8\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],target = 15) == -1\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],target = 155) == -1\n assert candidate(nums = [-100, -50, -20, -10, -5, 0, 5, 10, 20, 50, 100],target = 0) == 5\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5],target = -6) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],target = 0) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],target = 15) == 14\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],target = 18) == -1\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],target = 19) == 9\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100],target = 99) == 104\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],target = 16) == -1\n assert candidate(nums = [-1000, -500, -250, -125, -63, -31, -15, -7, -3, -1, 1, 3, 7, 15, 31, 63, 125, 250, 500, 1000],target = -15) == 6\n assert candidate(nums = [10000],target = 10000) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 1) == 0\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991],target = -9995) == 5\n assert candidate(nums = [-1, 1, 3, 5, 7, 9, 11, 13, 15, 17],target = 0) == -1\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, -9990],target = -9995) == 5\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],target = 0) == -1\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5],target = -3) == 2\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],target = 64) == 6\n assert candidate(nums = [-5, -3, -1, 0, 1, 3, 5],target = -2) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 18) == 17\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],target = 37) == 18\n assert candidate(nums = [-9999, -9997, -9995, -9993, -9991, -9989, -9987, -9985, -9983, -9981],target = -9985) == 7\n assert candidate(nums = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49],target = 50) == -1\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5],target = 6) == -1\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000],target = 15000) == 14\n assert candidate(nums = [-50, -20, -10, 0, 10, 20, 30, 50, 60],target = 30) == 6\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99],target = 98) == -1\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],target = 15) == 7\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],target = 155) == -1\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = -10) == -1\n assert candidate(nums = [-10000, -5000, -2500, -1250, -625, 0, 625, 1250, 2500, 5000, 10000],target = -1250) == 3\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1],target = -5) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 10) == 9\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],target = 99) == -1\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],target = 1) == 0\n assert candidate(nums = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49],target = 49) == 16\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100],target = 50) == 50\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],target = 1) == 0\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288],target = 1) == 0\n assert candidate(nums = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100],target = 50) == -1\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],target = 26) == -1\n assert candidate(nums = [5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5020, 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029, 5030, 5031, 5032, 5033, 5034, 5035, 5036, 5037, 5038, 5039, 5040, 5041, 5042, 5043, 5044, 5045, 5046, 5047, 5048, 5049, 5050],target = 5005) == 5\n assert candidate(nums = [-1000, -900, -800, -700, -600, -500, -400, -300, -200, -100, 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],target = 500) == 15\n assert candidate(nums = [1],target = 0) == -1\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 0) == 10\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],target = 27) == 13\n assert candidate(nums = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145],target = 146) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 20) == 19\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384],target = 16384) == 14\n assert candidate(nums = [50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],target = 175) == -1\n assert candidate(nums = [-1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],target = 0) == -1\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],target = 30) == -1\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],target = 2001) == -1\n assert candidate(nums = [-1000, -900, -800, -700, -600, -500, -400, -300, -200, -100, 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],target = -550) == -1\n assert candidate(nums = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400],target = 225) == 14\n assert candidate(nums = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946],target = 610) == 13\n assert candidate(nums = [-9999, -9997, -9995, -9993, -9991, -9989, -9987, -9985, -9983, -9981, -9979, -9977, -9975, -9973, -9971, -9969, -9967, -9965, -9963, -9961],target = -9975) == 12\n assert candidate(nums = [-10000, -5000, 0, 5000, 10000],target = 5000) == 3\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150],target = 88) == -1\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384],target = 1024) == 10\n assert candidate(nums = [-10000, -9000, -8000, -7000, -6000, -5000, -4000, -3000, -2000, -1000],target = -5000) == 5\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],target = 5500) == -1\n assert candidate(nums = [-100, -99, -98, -97, -96, -95, -94, -93, -92, -91],target = -95) == 5\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],target = 5) == -1\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],target = 29) == 14\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],target = 1500) == 14\n assert candidate(nums = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49],target = 1) == 0\n assert candidate(nums = [1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019],target = 1005) == 5\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],target = 25) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],target = 8) == 7\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991],target = -9990) == -1\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50],target = 23) == -1\n assert candidate(nums = [-9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, -9990, -9989, -9988, -9987, -9986, -9985, -9984, -9983, -9982, -9981, -9980, -9979, -9978, -9977, -9976, -9975, -9974, -9973, -9972, -9971, -9970, -9969, -9968, -9967, -9966, -9965, -9964, -9963, -9962, -9961, -9960, -9959, -9958, -9957, -9956, -9955, -9954, -9953, -9952, -9951, -9950],target = -9952) == 47\n assert candidate(nums = [1],target = 2) == -1\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],target = 21) == -1\n assert candidate(nums = [-10000, -5000, -2500, -1000, -500, -250, -100, -50, -25, 0, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],target = 1500) == -1\n assert candidate(nums = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361],target = 144) == 12\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500],target = 950) == -1\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],target = 150) == 14\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],target = 550) == -1\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],target = 20) == -1\n assert candidate(nums = [-9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, -9990],target = -9995) == 4\n assert candidate(nums = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625],target = 289) == 16\n assert candidate(nums = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400],target = 196) == 13\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],target = 14) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 21) == -1\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],target = 39) == 19\n assert candidate(nums = [10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000],target = 55000) == -1\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000],target = 100000) == 5\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],target = 5000) == 4\n assert candidate(nums = [5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019],target = 5000) == 0\n assert candidate(nums = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49],target = 25) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 15) == 14\n assert candidate(nums = [1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019],target = 1000) == 0\n assert candidate(nums = [-10000, -9000, -8000, -7000, -6000, -5000, -4000, -3000, -2000, -1000],target = -5500) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],target = 15) == 14\n"}, "metadata": {"canonical_parameter_names": ["nums", "target"], "leetcode_dataset_entry_point": "Solution().search", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var search = function(nums, target) {", "container": null, "callable": "search", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "target", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 709, "task_id": "to-lower-case", "difficulty": "Easy", "problem_description": "Given a string s, return the string after replacing every uppercase letter with the same lowercase letter.\n \nExample 1:\n\nInput: s = \"Hello\"\nOutput: \"hello\"\n\nExample 2:\n\nInput: s = \"here\"\nOutput: \"here\"\n\nExample 3:\n\nInput: s = \"LOVELY\"\nOutput: \"lovely\"\n\n \nConstraints:\n\n1 <= s.length <= 100\ns consists of printable ASCII characters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"Hello\") == \"hello\"\n assert candidate(s = \"here\") == \"here\"\n assert candidate(s = \"LOVELY\") == \"lovely\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().toLowerCase", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var toLowerCase = function(s) {", "container": null, "callable": "toLowerCase", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 712, "task_id": "minimum-ascii-delete-sum-for-two-strings", "difficulty": "Medium", "problem_description": "Given two strings s1 and s2, return the lowest ASCII sum of deleted characters to make two strings equal.\n \nExample 1:\n\nInput: s1 = \"sea\", s2 = \"eat\"\nOutput: 231\nExplanation: Deleting \"s\" from \"sea\" adds the ASCII value of \"s\" (115) to the sum.\nDeleting \"t\" from \"eat\" adds 116 to the sum.\nAt the end, both strings are equal, and 115 + 116 = 231 is the minimum sum possible to achieve this.\n\nExample 2:\n\nInput: s1 = \"delete\", s2 = \"leet\"\nOutput: 403\nExplanation: Deleting \"dee\" from \"delete\" to turn the string into \"let\",\nadds 100[d] + 101[e] + 101[e] to the sum.\nDeleting \"e\" from \"leet\" adds 101[e] to the sum.\nAt the end, both strings are equal to \"let\", and the answer is 100+101+101+101 = 403.\nIf instead we turned both strings into \"lee\" or \"eet\", we would get answers of 433 or 417, which are higher.\n\n \nConstraints:\n\n1 <= s1.length, s2.length <= 1000\ns1 and s2 consist of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s1 = \"delete\",s2 = \"leet\") == 403\n assert candidate(s1 = \"aaa\",s2 = \"aa\") == 97\n assert candidate(s1 = \"abc\",s2 = \"abcde\") == 201\n assert candidate(s1 = \"\",s2 = \"abc\") == 294\n assert candidate(s1 = \"abc\",s2 = \"\") == 294\n assert candidate(s1 = \"abc\",s2 = \"def\") == 597\n assert candidate(s1 = \"pqr\",s2 = \"pqr\") == 0\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"zyxwvutsrqponmlkjihgfedcba\") == 5450\n assert candidate(s1 = \"aaa\",s2 = \"aaa\") == 0\n assert candidate(s1 = \"sea\",s2 = \"eat\") == 231\n assert candidate(s1 = \"a\",s2 = \"b\") == 195\n assert candidate(s1 = \"abcabcabc\",s2 = \"abc\") == 588\n assert candidate(s1 = \"abcdef\",s2 = \"fedcba\") == 990\n assert candidate(s1 = \"xyz\",s2 = \"zyxwv\") == 719\n assert candidate(s1 = \"a\",s2 = \"a\") == 0\n assert candidate(s1 = \"\",s2 = \"\") == 0\n assert candidate(s1 = \"algorithm\",s2 = \"rhythm\") == 749\n assert candidate(s1 = \"abcdefgh\",s2 = \"ijklmnop\") == 1672\n assert candidate(s1 = \"algorithm\",s2 = \"logarithm\") == 400\n assert candidate(s1 = \"abcdxyz\",s2 = \"xyzabcd\") == 726\n assert candidate(s1 = \"interview\",s2 = \"interference\") == 969\n assert candidate(s1 = \"sequencealignment\",s2 = \"simple\") == 1606\n assert candidate(s1 = \"abcdeabcdeabcde\",s2 = \"decadecadecade\") == 1077\n assert candidate(s1 = \"aaaaabbbb\",s2 = \"bbbbbbaaa\") == 972\n assert candidate(s1 = \"aaaabbbbccccdddd\",s2 = \"bbbbaaaaccccdddd\") == 776\n assert candidate(s1 = \"short\",s2 = \"longerstring\") == 1188\n assert candidate(s1 = \"abracadabra\",s2 = \"avocado\") == 1055\n assert candidate(s1 = \"aabbccddeeff\",s2 = \"ffeeddccba\") == 1785\n assert candidate(s1 = \"abcdabcdabcdabcdabcdabcdabcdabcd\",s2 = \"abcd\") == 2758\n assert candidate(s1 = \"supercalifragilisticexpialidocious\",s2 = \"supercalifragilistic\") == 1506\n assert candidate(s1 = \"abcdefg\",s2 = \"xyzabc\") == 769\n assert candidate(s1 = \"abcdefg\",s2 = \"gfedcba\") == 1194\n assert candidate(s1 = \"ababababab\",s2 = \"babababa\") == 195\n assert candidate(s1 = \"racecar\",s2 = \"carrace\") == 620\n assert candidate(s1 = \"programming\",s2 = \"algorithm\") == 1486\n assert candidate(s1 = \"longstringfortesting\",s2 = \"anotherlongstringfortesting\") == 753\n assert candidate(s1 = \"programming\",s2 = \"programmer\") == 533\n assert candidate(s1 = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",s2 = \"zzyyxxwwvvuuttssrrqqppoonnmmllkkiijjhhhgggffeeeeddccbbaa\") == 10953\n assert candidate(s1 = \"abcdabcdabcd\",s2 = \"dcba\") == 982\n assert candidate(s1 = \"ababcabcabc\",s2 = \"abcabcabc\") == 195\n assert candidate(s1 = \"elephant\",s2 = \"hippopotamus\") == 1714\n assert candidate(s1 = \"recursion\",s2 = \"iteration\") == 879\n assert candidate(s1 = \"aabbcc\",s2 = \"ababab\") == 393\n assert candidate(s1 = \"abacaxbab\",s2 = \"abcabc\") == 511\n assert candidate(s1 = \"abcde\",s2 = \"fghij\") == 1015\n assert candidate(s1 = \"dynamicprogramming\",s2 = \"dynamictimeprogramming\") == 431\n assert candidate(s1 = \"programming\",s2 = \"prognosis\") == 1083\n assert candidate(s1 = \"sunshine\",s2 = \"shinesun\") == 684\n assert candidate(s1 = \"interviewquestion\",s2 = \"interviewquery\") == 792\n assert candidate(s1 = \"aabbccddeeffgg\",s2 = \"abcdfg\") == 801\n assert candidate(s1 = \"mississippi\",s2 = \"missisipi\") == 227\n assert candidate(s1 = \"hello\",s2 = \"yellow\") == 344\n assert candidate(s1 = \"xylophone\",s2 = \"xylophone\") == 0\n assert candidate(s1 = \"aaaaabbbbbbbbaaa\",s2 = \"aaaaaaaaaabbbbbba\") == 875\n assert candidate(s1 = \"abcdexyz\",s2 = \"xyzabcd\") == 827\n assert candidate(s1 = \"abcd\",s2 = \"dcba\") == 588\n assert candidate(s1 = \"mississippi\",s2 = \"mississippi\") == 0\n assert candidate(s1 = \"xyzzxyzzxyzz\",s2 = \"zzxyzzxyzzxy\") == 482\n assert candidate(s1 = \"sequence\",s2 = \"subsequence\") == 330\n assert candidate(s1 = \"abcdabcdabcd\",s2 = \"abcabcabcabc\") == 594\n assert candidate(s1 = \"abcdefghikjlmnopqrstuvwxyz\",s2 = \"zyxwvutsrqponmlkjihgfedcba\") == 5268\n assert candidate(s1 = \"kitten\",s2 = \"sitting\") == 531\n assert candidate(s1 = \"abcdef\",s2 = \"ghijkl\") == 1230\n assert candidate(s1 = \"abcdexyz\",s2 = \"defghijk\") == 1284\n assert candidate(s1 = \"aaaaaaaaaaaaaaa\",s2 = \"bbbbbbbbbbbbbbb\") == 2925\n assert candidate(s1 = \"kshdfjkhewriukhweriukhweriukhwer\",s2 = \"wriukhweriukhwer\") == 1713\n assert candidate(s1 = \"aaaaabbbbb\",s2 = \"bbbbbcccc\") == 881\n assert candidate(s1 = \"abcdefg\",s2 = \"xyz\") == 1063\n assert candidate(s1 = \"aaaaaa\",s2 = \"bbbbbb\") == 1170\n assert candidate(s1 = \"programming\",s2 = \"remmargorp\") == 1401\n assert candidate(s1 = \"abcdefghij\",s2 = \"jihgfedcba\") == 1818\n assert candidate(s1 = \"programming\",s2 = \"program\") == 427\n assert candidate(s1 = \"leetcode\",s2 = \"codeleet\") == 822\n assert candidate(s1 = \"zzzzz\",s2 = \"zzzzzzzz\") == 366\n assert candidate(s1 = \"mississippi\",s2 = \"pississippi\") == 221\n assert candidate(s1 = \"samestring\",s2 = \"samestring\") == 0\n assert candidate(s1 = \"aabbccddeeffgghhii\",s2 = \"iihhggffeeddccbbaa\") == 3216\n assert candidate(s1 = \"mississippi\",s2 = \"missisippi\") == 115\n assert candidate(s1 = \"dynamicprogramming\",s2 = \"longestcommonsubsequence\") == 3232\n assert candidate(s1 = \"abcxyz\",s2 = \"xyzabc\") == 588\n assert candidate(s1 = \"abcdabcdabcd\",s2 = \"xyzxyzxyz\") == 2271\n assert candidate(s1 = \"qwertyuiopasdfghjklzxcvbnm\",s2 = \"mnbvcxzlkjhgfdsapoiuytrewq\") == 5450\n assert candidate(s1 = \"dynamicprogramming\",s2 = \"recursion\") == 2028\n assert candidate(s1 = \"ababababab\",s2 = \"bababababa\") == 194\n assert candidate(s1 = \"xyzzyxzyxzyxz\",s2 = \"zyxzyxzyxzyx\") == 604\n assert candidate(s1 = \"abcd\",s2 = \"efgh\") == 804\n assert candidate(s1 = \"xylophone\",s2 = \"polyphonexy\") == 911\n assert candidate(s1 = \"longstringwithvariouscharacters\",s2 = \"anotherstringwithdifferentcharacters\") == 2463\n assert candidate(s1 = \"repeatedcharacters\",s2 = \"repeatedcharactersrepeatedcharacters\") == 1898\n assert candidate(s1 = \"minimum\",s2 = \"maximum\") == 432\n assert candidate(s1 = \"abcde\",s2 = \"edcba\") == 788\n assert candidate(s1 = \"abcdefghij\",s2 = \"abcdefghijk\") == 107\n assert candidate(s1 = \"mississippi\",s2 = \"basketball\") == 2028\n assert candidate(s1 = \"mississippi\",s2 = \"pisissip\") == 553\n assert candidate(s1 = \"abcdabcdabcd\",s2 = \"abcd\") == 788\n assert candidate(s1 = \"aaaaabbbbb\",s2 = \"bbbbbbaaaa\") == 971\n assert candidate(s1 = \"abcdabcdabcd\",s2 = \"abc\") == 888\n assert candidate(s1 = \"ascii\",s2 = \"unicode\") == 1054\n assert candidate(s1 = \"supercalifragilisticexpialidocious\",s2 = \"supercalifragilisticexpialidocious\") == 0\n assert candidate(s1 = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",s2 = \"zzyyxxwwvvuuttsrrqqppoonnmlkkjjiihhggffeeeeddccbbaa\") == 10770\n assert candidate(s1 = \"interspecies\",s2 = \"interstellar\") == 1075\n assert candidate(s1 = \"waterbottle\",s2 = \"erbottlewat\") == 664\n assert candidate(s1 = \"lalalalala\",s2 = \"alalalalal\") == 194\n assert candidate(s1 = \"abracadabra\",s2 = \"avadakedavra\") == 953\n assert candidate(s1 = \"xyz\",s2 = \"zyxzyxzyx\") == 726\n assert candidate(s1 = \"longerstring\",s2 = \"short\") == 1188\n assert candidate(s1 = \"mississippi\",s2 = \"mississippimiss\") == 444\n assert candidate(s1 = \"elephant\",s2 = \"elephant\") == 0\n assert candidate(s1 = \"programming\",s2 = \"ogramming\") == 226\n assert candidate(s1 = \"abcdabcdabcd\",s2 = \"abcabcabc\") == 300\n assert candidate(s1 = \"longest\",s2 = \"commonsubsequence\") == 1928\n assert candidate(s1 = \"abcdefghijk\",s2 = \"fedcbaolmijkpqrstuvwxyz\") == 2812\n assert candidate(s1 = \"programming\",s2 = \"development\") == 1712\n assert candidate(s1 = \"transformation\",s2 = \"transformation\") == 0\n assert candidate(s1 = \"longestcommonsubsequence\",s2 = \"shortestcommonsubsequence\") == 770\n"}, "metadata": {"canonical_parameter_names": ["s1", "s2"], "leetcode_dataset_entry_point": "Solution().minimumDeleteSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minimumDeleteSum = function(s1, s2) {", "container": null, "callable": "minimumDeleteSum", "parameters": [{"name": "s1", "type": "string"}, {"name": "s2", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 713, "task_id": "subarray-product-less-than-k", "difficulty": "Medium", "problem_description": "Given an array of integers nums and an integer k, return the number of contiguous subarrays where the product of all the elements in the subarray is strictly less than k.\n \nExample 1:\n\nInput: nums = [10,5,2,6], k = 100\nOutput: 8\nExplanation: The 8 subarrays that have product less than 100 are:\n[10], [5], [2], [6], [10, 5], [5, 2], [2, 6], [5, 2, 6]\nNote that [10, 5, 2] is not included as the product of 100 is not strictly less than k.\n\nExample 2:\n\nInput: nums = [1,2,3], k = 0\nOutput: 0\n\n \nConstraints:\n\n1 <= nums.length <= 3 * 104\n1 <= nums[i] <= 1000\n0 <= k <= 106\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 2, 5, 6, 1],k = 100) == 12\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 50) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9],k = 100) == 21\n assert candidate(nums = [6, 5, 1, 2, 3],k = 100) == 14\n assert candidate(nums = [5, 5, 5, 5, 5],k = 20) == 5\n assert candidate(nums = [5, 5, 5, 5],k = 30) == 7\n assert candidate(nums = [7, 3, 4, 9, 1, 3, 6],k = 100) == 17\n assert candidate(nums = [2, 3, 4, 5],k = 1) == 0\n assert candidate(nums = [7, 3, 2, 2, 1],k = 12) == 9\n assert candidate(nums = [1, 2, 3],k = 0) == 0\n assert candidate(nums = [1, 3, 7, 5, 8, 9],k = 100) == 12\n assert candidate(nums = [1, 1, 1, 1],k = 1) == 0\n assert candidate(nums = [10, 2, 5, 1],k = 16) == 7\n assert candidate(nums = [2, 3, 4, 5],k = 10) == 5\n assert candidate(nums = [10, 2, 5, 3],k = 100) == 8\n assert candidate(nums = [1, 1, 1, 1],k = 2) == 10\n assert candidate(nums = [1, 2, 3, 4],k = 10) == 7\n assert candidate(nums = [9, 7, 3, 5],k = 25) == 6\n assert candidate(nums = [1, 1, 1],k = 1) == 0\n assert candidate(nums = [10, 20, 30, 40, 50],k = 10000) == 10\n assert candidate(nums = [6, 6, 6, 6],k = 100) == 7\n assert candidate(nums = [1000, 1000, 1000],k = 1000000) == 3\n assert candidate(nums = [10, 5, 2, 6],k = 100) == 8\n assert candidate(nums = [1, 1, 1, 1, 1],k = 1) == 0\n assert candidate(nums = [5, 5, 5, 5, 5],k = 30) == 9\n assert candidate(nums = [1000, 1000, 1000, 1000],k = 1000000000) == 7\n assert candidate(nums = [1, 2, 3, 4, 5],k = 10) == 8\n assert candidate(nums = [10, 2, 5, 6],k = 100) == 8\n assert candidate(nums = [10, 2, 5, 3, 8],k = 160) == 12\n assert candidate(nums = [2, 5, 6, 10],k = 100) == 8\n assert candidate(nums = [5, 5, 5, 5],k = 25) == 4\n assert candidate(nums = [10, 9, 10, 4, 3, 8, 3, 3, 6, 2, 10, 10, 9, 3],k = 19) == 18\n assert candidate(nums = [1, 2, 3, 4, 5],k = 1) == 0\n assert candidate(nums = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990],k = 1000000000) == 27\n assert candidate(nums = [1, 10, 100, 1000, 1, 10, 100, 1000],k = 500000) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10000) == 72\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 15625) == 40\n assert candidate(nums = [1000, 999, 998, 997, 996, 995],k = 1000000) == 11\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 1000) == 99\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1) == 0\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 3000) == 36\n assert candidate(nums = [2, 3, 6, 7, 9],k = 50) == 9\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 210\n assert candidate(nums = [2, 4, 8, 16, 32, 64, 128],k = 256) == 11\n assert candidate(nums = [1000, 999, 998, 997, 996],k = 1000000) == 9\n assert candidate(nums = [10, 5, 3, 2, 1],k = 20) == 9\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1) == 0\n assert candidate(nums = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 1000) == 26\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 1000000) == 174\n assert candidate(nums = [10, 2, 3, 5, 7, 11, 13, 17, 19, 23],k = 1000) == 25\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1) == 0\n assert candidate(nums = [3, 4, 5, 6, 7, 8, 9, 10],k = 500) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10000) == 72\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 500) == 29\n assert candidate(nums = [999, 999, 999, 999, 999, 999, 999, 999, 999, 999],k = 998001) == 10\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 100) == 105\n assert candidate(nums = [9, 73, 5, 26, 32, 8, 34, 61, 100],k = 10000) == 22\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 1) == 0\n assert candidate(nums = [10, 5, 2, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 100) == 192\n assert candidate(nums = [31, 37, 41, 43, 47, 53, 59, 61, 67, 71],k = 1000000) == 27\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1) == 0\n assert candidate(nums = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],k = 1000000) == 10\n assert candidate(nums = [500, 500, 500, 500, 500, 500, 500, 500, 500, 500],k = 1000000000) == 27\n assert candidate(nums = [10, 5, 2, 6, 1, 1, 1, 1, 1],k = 100) == 38\n assert candidate(nums = [999, 999, 999, 999, 999, 999, 999, 999, 999, 999],k = 1000000) == 19\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 10000) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 1000) == 45\n assert candidate(nums = [100, 50, 20, 60, 10, 30],k = 1000) == 8\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19],k = 200) == 15\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 27) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 15) == 14\n assert candidate(nums = [1000, 1000, 1000, 1000, 1000],k = 1000000) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 100000) == 88\n assert candidate(nums = [10, 5, 2, 6, 1, 3, 7, 5, 8, 9],k = 200) == 30\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 1000) == 75\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29],k = 10000) == 30\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],k = 100000) == 22\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128],k = 500) == 15\n assert candidate(nums = [10, 20, 30, 40, 50],k = 1000) == 7\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 10000) == 182\n assert candidate(nums = [10, 5, 2, 6, 1, 3, 7, 5, 8, 9],k = 100) == 25\n assert candidate(nums = [50, 40, 30, 20, 10, 5, 2, 1, 1, 2, 5, 10, 20, 30, 40, 50],k = 1000) == 45\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],k = 1000000) == 32\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71],k = 1000000000) == 106\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10000) == 41\n assert candidate(nums = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024],k = 1000000) == 28\n assert candidate(nums = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],k = 1000000000) == 34\n assert candidate(nums = [10, 5, 2, 6, 1, 3, 7, 5, 8, 9],k = 10) == 11\n assert candidate(nums = [10, 5, 2, 6, 3, 4, 1, 7],k = 150) == 25\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 1000) == 34\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 100) == 19\n assert candidate(nums = [8, 2, 6, 5, 1, 2, 3, 4, 5, 6, 7],k = 100) == 32\n assert candidate(nums = [10, 20, 30, 40, 50],k = 1000) == 7\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 1000) == 19\n assert candidate(nums = [10, 9, 10, 4, 3, 8, 3, 10, 26, 100, 8],k = 200) == 21\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 100000) == 155\n assert candidate(nums = [1000, 500, 250, 125, 62, 31, 15],k = 1000000) == 15\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 2000) == 58\n assert candidate(nums = [100, 10, 1, 0.1, 0.01],k = 1000) == 11\n assert candidate(nums = [999, 998, 997, 996, 995],k = 900000) == 5\n assert candidate(nums = [999, 999, 999, 999, 999],k = 1000000) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 500) == 61\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 1024) == 234\n assert candidate(nums = [10, 5, 2, 6, 1, 3],k = 100) == 16\n assert candidate(nums = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990],k = 1000000) == 19\n assert candidate(nums = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],k = 1000000) == 10\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 210\n assert candidate(nums = [10, 5, 2, 6, 1, 1],k = 100) == 17\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 50) == 19\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 1000000) == 174\n assert candidate(nums = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],k = 1000000000) == 19\n assert candidate(nums = [10, 5, 2, 6, 1, 3, 7, 5, 8, 9],k = 1) == 0\n assert candidate(nums = [10, 5, 2, 6, 3, 8, 1, 9, 4, 7],k = 100) == 24\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 243) == 74\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 25) == 10\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 100) == 52\n assert candidate(nums = [999, 999, 999, 999],k = 1000000) == 7\n assert candidate(nums = [10, 5, 2, 6, 1, 8, 9, 3, 7],k = 100) == 23\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5],k = 20) == 19\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 16) == 27\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 10000) == 212\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29],k = 500) == 22\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 27) == 29\n assert candidate(nums = [10, 20, 30, 40, 50],k = 500) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 1000) == 45\n assert candidate(nums = [1000, 500, 250, 125, 62, 31, 15, 7, 3, 1],k = 1000000) == 30\n assert candidate(nums = [9, 8, 7, 6, 5],k = 1000) == 12\n assert candidate(nums = [10, 10, 10, 10],k = 10000) == 9\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().numSubarrayProductLessThanK", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numSubarrayProductLessThanK = function(nums, k) {", "container": null, "callable": "numSubarrayProductLessThanK", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 714, "task_id": "best-time-to-buy-and-sell-stock-with-transaction-fee", "difficulty": "Medium", "problem_description": "You are given an array prices where prices[i] is the price of a given stock on the ith day, and an integer fee representing a transaction fee.\nFind the maximum profit you can achieve. You may complete as many transactions as you like, but you need to pay the transaction fee for each transaction.\nNote:\n\nYou may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).\nThe transaction fee is only charged once for each stock purchase and sale.\n\n \nExample 1:\n\nInput: prices = [1,3,2,8,4,9], fee = 2\nOutput: 8\nExplanation: The maximum profit can be achieved by:\n- Buying at prices[0] = 1\n- Selling at prices[3] = 8\n- Buying at prices[4] = 4\n- Selling at prices[5] = 9\nThe total profit is ((8 - 1) - 2) + ((9 - 4) - 2) = 8.\n\nExample 2:\n\nInput: prices = [1,3,7,5,10,3], fee = 3\nOutput: 6\n\n \nConstraints:\n\n1 <= prices.length <= 5 * 104\n1 <= prices[i] < 5 * 104\n0 <= fee < 5 * 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(prices = [10, 20, 30, 40, 50],fee = 5) == 35\n assert candidate(prices = [1, 3, 2, 8, 4, 9],fee = 2) == 8\n assert candidate(prices = [1, 2, 3, 4, 5],fee = 1) == 3\n assert candidate(prices = [50, 40, 30, 20, 10],fee = 5) == 0\n assert candidate(prices = [5, 4, 3, 2, 1],fee = 1) == 0\n assert candidate(prices = [1, 2, 3, 4, 5],fee = 0) == 4\n assert candidate(prices = [10, 22, 5, 75, 65, 80],fee = 3) == 88\n assert candidate(prices = [1, 5, 1, 5, 1, 5, 1, 5],fee = 2) == 8\n assert candidate(prices = [3, 3, 5, 0, 0, 3, 1, 4],fee = 2) == 2\n assert candidate(prices = [1, 2, 3, 4, 5, 0, 0, 0, 0, 6],fee = 3) == 4\n assert candidate(prices = [1, 3, 7, 5, 10, 3],fee = 3) == 6\n assert candidate(prices = [1, 3, 2, 1, 4, 5, 2, 11],fee = 1) == 12\n assert candidate(prices = [10, 5, 5, 5, 15, 5, 5, 20],fee = 3) == 19\n assert candidate(prices = [10, 10, 10, 10, 10],fee = 1) == 0\n assert candidate(prices = [1, 5, 1, 5, 1, 5, 1, 5, 1],fee = 2) == 8\n assert candidate(prices = [1, 3, 2, 4, 3, 5],fee = 1) == 3\n assert candidate(prices = [10, 1, 2, 7, 1, 3, 4, 10],fee = 2) == 11\n assert candidate(prices = [1, 5, 1, 5, 1, 5],fee = 2) == 6\n assert candidate(prices = [5, 4, 3, 2, 1],fee = 0) == 0\n assert candidate(prices = [1, 3, 2, 8, 4, 9, 2, 8, 4, 9, 2, 8, 4, 9],fee = 2) == 22\n assert candidate(prices = [100, 180, 260, 310, 40, 535, 695],fee = 100) == 665\n assert candidate(prices = [100, 180, 260, 310, 40, 535, 695, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],fee = 150) == 1325\n assert candidate(prices = [3, 15, 18, 14, 19, 20, 22, 17, 21, 23],fee = 5) == 15\n assert candidate(prices = [1, 2, 4, 2, 5, 7, 2, 4, 9, 0],fee = 2) == 9\n assert candidate(prices = [90, 80, 70, 60, 50, 40, 30, 20, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],fee = 5) == 10\n assert candidate(prices = [100, 98, 95, 97, 96, 99, 101, 102, 100, 104, 105, 107, 108, 105, 109],fee = 4) == 10\n assert candidate(prices = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1],fee = 1) == 6\n assert candidate(prices = [100, 90, 80, 70, 60, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],fee = 20) == 130\n assert candidate(prices = [10, 1, 10, 1, 10, 1, 10, 1],fee = 5) == 12\n assert candidate(prices = [10, 22, 5, 75, 65, 80],fee = 3) == 88\n assert candidate(prices = [10, 20, 15, 25, 10, 30, 5, 35, 40, 45],fee = 3) == 68\n assert candidate(prices = [1, 2, 5, 3, 8, 9, 2, 10, 3, 7, 15, 10, 20, 15, 25, 20, 30, 25, 35, 30],fee = 3) == 47\n assert candidate(prices = [1, 3, 7, 5, 10, 3, 15, 12, 18, 20, 5, 10, 15, 25, 30],fee = 4) == 39\n assert candidate(prices = [1, 2, 5, 3, 8, 9, 2, 10, 3, 7],fee = 2) == 14\n assert candidate(prices = [100, 180, 260, 40, 310, 535, 695],fee = 10) == 795\n assert candidate(prices = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],fee = 2) == 22\n assert candidate(prices = [10, 20, 30, 40, 50, 10, 20, 30, 40, 50],fee = 5) == 70\n assert candidate(prices = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10],fee = 0) == 16\n assert candidate(prices = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 10, 20, 30, 40, 50],fee = 10) == 30\n assert candidate(prices = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],fee = 1) == 0\n assert candidate(prices = [7, 9, 10, 11, 5, 3, 6, 8, 15, 20],fee = 2) == 17\n assert candidate(prices = [1, 2, 3, 4, 5, 4, 5, 4, 5, 4, 5],fee = 1) == 3\n assert candidate(prices = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],fee = 1) == 8\n assert candidate(prices = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4],fee = 1) == 4\n assert candidate(prices = [5, 3, 8, 12, 10, 14, 18, 15, 20, 25, 23, 28, 30],fee = 6) == 21\n assert candidate(prices = [8, 6, 4, 2, 10, 8, 6, 14, 12, 10, 18, 16, 14, 20, 18, 22],fee = 4) == 16\n assert candidate(prices = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],fee = 0) == 0\n assert candidate(prices = [7, 1, 5, 3, 6, 4, 8, 2, 1, 5, 3, 6, 4, 8, 2, 1, 5, 3, 6, 4, 8, 2, 1, 5, 3, 6, 4, 8, 2, 1],fee = 2) == 20\n assert candidate(prices = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],fee = 0) == 9\n assert candidate(prices = [1, 7, 4, 11, 8, 16, 13, 20, 17, 25, 22, 30],fee = 5) == 24\n assert candidate(prices = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],fee = 10) == 0\n assert candidate(prices = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],fee = 5) == 8\n assert candidate(prices = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],fee = 2) == 0\n assert candidate(prices = [10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1],fee = 5) == 24\n assert candidate(prices = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],fee = 5) == 24\n assert candidate(prices = [30, 50, 10, 5, 100, 50, 20, 10, 5, 30, 200, 150, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],fee = 30) == 1100\n assert candidate(prices = [1, 4, 3, 2, 5, 6, 3, 7, 8, 2, 4, 9],fee = 3) == 8\n assert candidate(prices = [1, 2, 3, 0, 100, 2, 100, 3],fee = 50) == 98\n assert candidate(prices = [30, 25, 28, 32, 27, 35, 40, 38, 42, 45, 48, 47, 49, 50, 51, 52, 50, 53],fee = 7) == 21\n assert candidate(prices = [30, 28, 25, 20, 15, 10, 5, 0, 5, 10, 15, 20, 25, 30, 35, 40],fee = 10) == 30\n assert candidate(prices = [1, 100, 2, 99, 3, 98, 4, 97, 5, 96],fee = 50) == 225\n assert candidate(prices = [7, 6, 4, 3, 1],fee = 1) == 0\n assert candidate(prices = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2],fee = 1) == 9\n assert candidate(prices = [10, 15, 12, 18, 14, 20, 16, 22, 18, 25],fee = 3) == 15\n assert candidate(prices = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 50, 40, 30, 20, 10, 50, 60, 70, 80, 90, 100, 50, 40, 30, 20, 10, 50],fee = 10) == 190\n assert candidate(prices = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],fee = 1) == 0\n assert candidate(prices = [3, 3, 5, 0, 0, 3, 1, 4],fee = 2) == 2\n assert candidate(prices = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9],fee = 0) == 8\n assert candidate(prices = [1, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9],fee = 2) == 6\n assert candidate(prices = [1, 7, 4, 11, 10, 5, 11, 5, 1, 5, 11, 5, 1, 5, 11, 5, 1, 5, 11, 5, 1, 5, 11, 5, 1, 5, 11, 5],fee = 5) == 31\n assert candidate(prices = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20],fee = 5) == 25\n assert candidate(prices = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],fee = 1) == 0\n assert candidate(prices = [100, 98, 102, 97, 99, 103, 101, 98, 104, 106],fee = 4) == 6\n assert candidate(prices = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],fee = 2) == 0\n assert candidate(prices = [10, 22, 5, 75, 65, 80, 100, 90, 110],fee = 3) == 125\n assert candidate(prices = [8, 12, 10, 15, 20, 17, 22, 25, 30, 35, 28, 33, 40],fee = 5) == 29\n assert candidate(prices = [3, 2, 6, 5, 0, 3, 1, 4],fee = 2) == 4\n assert candidate(prices = [1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1],fee = 2) == 0\n assert candidate(prices = [1, 1, 1, 1, 1, 1, 1, 1],fee = 1) == 0\n assert candidate(prices = [3, 2, 6, 5, 0, 3],fee = 2) == 3\n assert candidate(prices = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],fee = 1) == 13\n assert candidate(prices = [5, 2, 6, 1, 9, 4, 7, 3, 8, 5],fee = 3) == 8\n assert candidate(prices = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],fee = 1) == 0\n assert candidate(prices = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],fee = 10) == 0\n assert candidate(prices = [1, 2, 3, 10, 5, 6, 7, 100, 1, 2, 3, 10, 5, 6, 7, 100],fee = 10) == 178\n assert candidate(prices = [1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],fee = 6) == 10\n assert candidate(prices = [1, 10, 3, 100, 4, 101, 5, 102, 6, 103, 7, 104, 8, 105],fee = 5) == 556\n assert candidate(prices = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],fee = 5) == 85\n assert candidate(prices = [10, 11, 7, 10, 15, 10, 18, 20, 21, 10],fee = 4) == 11\n assert candidate(prices = [10, 15, 14, 20, 17, 22, 18, 25],fee = 5) == 10\n assert candidate(prices = [7, 6, 4, 3, 1, 8, 9, 10, 5, 4, 3, 2, 1, 10],fee = 2) == 14\n assert candidate(prices = [1, 4, 2, 6, 3, 7, 4, 8, 5, 9],fee = 2) == 9\n assert candidate(prices = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],fee = 1) == 24\n assert candidate(prices = [1, 4, 5, 6, 7, 8, 10, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],fee = 4) == 11\n assert candidate(prices = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],fee = 3) == 0\n assert candidate(prices = [10, 14, 13, 11, 5, 7, 9, 8, 10, 12, 15, 14, 20, 18],fee = 3) == 13\n assert candidate(prices = [8, 3, 6, 2, 8, 8, 8, 4, 2, 0, 4, 2, 2, 0, 0, 1, 8, 5, 5, 5, 0, 7, 7, 5, 0, 1, 1, 8, 5, 5, 6, 1, 1, 1, 0, 6, 5, 1, 1, 3, 5, 0, 0, 5, 3, 0, 6, 6, 6, 6, 5, 0, 4, 7, 0, 3, 1, 1, 7, 6, 6, 0, 1, 6, 5, 0, 1, 1, 7, 6, 1, 7, 0, 6, 5, 0, 1, 7, 5, 5, 6, 0, 0, 0, 1],fee = 4) == 36\n assert candidate(prices = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],fee = 1) == 13\n assert candidate(prices = [1, 10, 3, 15, 20, 18, 25, 27, 23, 30],fee = 7) == 22\n assert candidate(prices = [5, 2, 3, 7, 3, 9, 10, 4, 8, 10, 12, 15, 20, 18, 16, 14, 13, 11, 9, 7, 5, 3, 1],fee = 2) == 22\n assert candidate(prices = [1, 2, 5, 4, 8, 11, 10, 13, 12, 15, 18, 20],fee = 5) == 14\n assert candidate(prices = [10, 22, 5, 75, 65, 80, 90, 60, 70, 100, 110, 120, 130, 140, 150, 2, 3, 4, 5],fee = 10) == 157\n assert candidate(prices = [5, 10, 5, 10, 5, 10, 5, 10, 5, 10],fee = 4) == 5\n assert candidate(prices = [10, 1, 1, 1, 1, 1, 10],fee = 1) == 8\n assert candidate(prices = [2, 5, 1, 6, 3, 7, 4, 8, 5, 9],fee = 2) == 10\n assert candidate(prices = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],fee = 1) == 8\n assert candidate(prices = [80, 70, 60, 50, 40, 30, 20, 10],fee = 5) == 0\n"}, "metadata": {"canonical_parameter_names": ["prices", "fee"], "leetcode_dataset_entry_point": "Solution().maxProfit", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxProfit = function(prices, fee) {", "container": null, "callable": "maxProfit", "parameters": [{"name": "prices", "type": "number[]"}, {"name": "fee", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 717, "task_id": "1-bit-and-2-bit-characters", "difficulty": "Easy", "problem_description": "We have two special characters:\n\nThe first character can be represented by one bit 0.\nThe second character can be represented by two bits (10 or 11).\n\nGiven a binary array bits that ends with 0, return true if the last character must be a one-bit character.\n \nExample 1:\n\nInput: bits = [1,0,0]\nOutput: true\nExplanation: The only way to decode it is two-bit character and one-bit character.\nSo the last character is one-bit character.\n\nExample 2:\n\nInput: bits = [1,1,1,0]\nOutput: false\nExplanation: The only way to decode it is two-bit character and two-bit character.\nSo the last character is not one-bit character.\n\n \nConstraints:\n\n1 <= bits.length <= 1000\nbits[i] is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(bits = [1, 1, 1, 0]) == False\n assert candidate(bits = [0, 0, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0]) == True\n assert candidate(bits = [0]) == True\n assert candidate(bits = [1, 1, 1, 1, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 0]) == False\n assert candidate(bits = [1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 1, 0, 0, 0]) == True\n assert candidate(bits = [1, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 1, 1, 1, 0]) == False\n assert candidate(bits = [0, 0, 0, 0, 0]) == True\n assert candidate(bits = [1, 0, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 0, 1, 1, 0]) == True\n assert candidate(bits = [0, 1, 1, 0, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 1, 1, 1, 1, 1, 1, 0]) == True\n assert candidate(bits = [1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 0, 1, 1, 0, 0, 0]) == True\n assert candidate(bits = [1, 1, 0, 0, 1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 0, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 1, 1, 1, 0, 0]) == True\n assert candidate(bits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(bits = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 0, 1, 1, 0, 1, 0]) == False\n assert candidate(bits = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 0, 1, 0, 1, 1, 0]) == True\n assert candidate(bits = [1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 0, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 0, 0, 1, 0, 1]) == True\n assert candidate(bits = [0, 1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 1, 0]) == False\n assert candidate(bits = [1, 0, 0, 1, 1, 0, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 1, 0, 1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 0, 1, 0, 1, 0]) == False\n assert candidate(bits = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0]) == False\n assert candidate(bits = [0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 1, 0, 1, 0, 0, 1, 0]) == False\n assert candidate(bits = [1, 0, 1, 1, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 0, 1, 0, 0, 0, 0]) == True\n assert candidate(bits = [0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 0, 0, 1, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 0, 1, 1, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 1, 0, 1, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 0, 1, 0, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(bits = [0, 1, 1, 0, 1, 1, 0]) == True\n assert candidate(bits = [1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 1, 0, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 0, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]) == True\n assert candidate(bits = [1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0]) == True\n assert candidate(bits = [0, 1, 0, 1, 0, 1, 0]) == False\n assert candidate(bits = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0]) == False\n assert candidate(bits = [1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [0, 1, 1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 1, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0]) == True\n"}, "metadata": {"canonical_parameter_names": ["bits"], "leetcode_dataset_entry_point": "Solution().isOneBitCharacter", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isOneBitCharacter = function(bits) {", "container": null, "callable": "isOneBitCharacter", "parameters": [{"name": "bits", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 718, "task_id": "maximum-length-of-repeated-subarray", "difficulty": "Medium", "problem_description": "Given two integer arrays nums1 and nums2, return the maximum length of a subarray that appears in both arrays.\n \nExample 1:\n\nInput: nums1 = [1,2,3,2,1], nums2 = [3,2,1,4,7]\nOutput: 3\nExplanation: The repeated subarray with maximum length is [3,2,1].\n\nExample 2:\n\nInput: nums1 = [0,0,0,0,0], nums2 = [0,0,0,0,0]\nOutput: 5\nExplanation: The repeated subarray with maximum length is [0,0,0,0,0].\n\n \nConstraints:\n\n1 <= nums1.length, nums2.length <= 1000\n0 <= nums1[i], nums2[i] <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums1 = [1, 2, 3, 2, 1],nums2 = [3, 2, 1, 4, 7]) == 3\n assert candidate(nums1 = [1, 2, 3],nums2 = [3, 4, 5]) == 1\n assert candidate(nums1 = [1, 0, 0, 0, 1],nums2 = [1, 0, 0, 0, 1]) == 5\n assert candidate(nums1 = [1],nums2 = [2]) == 0\n assert candidate(nums1 = [1],nums2 = [1]) == 1\n assert candidate(nums1 = [1, 2, 3],nums2 = [3, 2, 1]) == 1\n assert candidate(nums1 = [100, 0, 100, 0, 100],nums2 = [100, 0, 100, 0, 100]) == 5\n assert candidate(nums1 = [1, 2, 3, 2, 1],nums2 = [1, 2, 3, 2, 1]) == 5\n assert candidate(nums1 = [1, 0, 1, 0, 1],nums2 = [1, 0, 1, 0, 1]) == 5\n assert candidate(nums1 = [1, 1, 1, 1, 1],nums2 = [2, 2, 2, 2, 2]) == 0\n assert candidate(nums1 = [1, 2, 3, 4, 5],nums2 = [5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [1, 2, 2, 1],nums2 = [2, 2]) == 2\n assert candidate(nums1 = [1, 2, 3, 2, 1],nums2 = [2, 1, 1, 2, 3]) == 3\n assert candidate(nums1 = [1, 0, 0, 0, 1],nums2 = [1, 0, 0, 1, 1]) == 3\n assert candidate(nums1 = [1, 2, 3, 4, 5],nums2 = [6, 7, 8, 9, 10]) == 0\n assert candidate(nums1 = [1, 2, 3],nums2 = [4, 5, 6]) == 0\n assert candidate(nums1 = [0, 0, 0, 0, 0],nums2 = [0, 0, 0, 0, 0]) == 5\n assert candidate(nums1 = [1, 2, 3, 2, 1, 4, 5, 6, 5, 4],nums2 = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10]) == 6\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],nums2 = [50, 60, 70, 80, 90, 100, 10, 20, 30, 40]) == 6\n assert candidate(nums1 = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],nums2 = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 20\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],nums2 = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]) == 11\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2],nums2 = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 9\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 6\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],nums2 = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums1 = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],nums2 = [3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2]) == 18\n assert candidate(nums1 = [1, 2, 3, 2, 1, 1, 2, 3, 2, 1],nums2 = [3, 2, 1, 4, 7, 3, 2, 1, 4, 7]) == 3\n assert candidate(nums1 = [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60],nums2 = [55, 56, 57, 58, 59, 60, 49, 48, 47, 46, 45]) == 6\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 15\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3],nums2 = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 10\n assert candidate(nums1 = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5],nums2 = [2, 3, 4, 5, 1, 2, 3, 4, 5, 6]) == 9\n assert candidate(nums1 = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1],nums2 = [3, 2, 1, 4, 7, 3, 2, 1, 4, 7, 3, 2, 1, 4, 7, 3, 2, 1, 4, 7]) == 3\n assert candidate(nums1 = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50],nums2 = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 10\n assert candidate(nums1 = [1, 3, 2, 4, 5, 6],nums2 = [4, 5, 6, 1, 3, 2]) == 3\n assert candidate(nums1 = [98, 99, 100, 98, 99, 100, 98, 99, 100],nums2 = [99, 100, 98, 99, 100, 98, 99, 100, 98]) == 8\n assert candidate(nums1 = [1, 2, 3, 2, 1, 4, 5, 6, 7, 8, 9, 0],nums2 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2]) == 3\n assert candidate(nums1 = [5, 0, 0, 0, 0, 0, 5],nums2 = [5, 0, 0, 0, 0, 0, 5]) == 7\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70],nums2 = [30, 40, 50, 60, 70, 10, 20]) == 5\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7]) == 8\n assert candidate(nums1 = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50],nums2 = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 10\n assert candidate(nums1 = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],nums2 = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 10\n assert candidate(nums1 = [9, 8, 7, 6, 5, 4, 3, 2, 1],nums2 = [5, 4, 3, 2, 1, 9, 8, 7, 6]) == 5\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4]) == 11\n assert candidate(nums1 = [1, 0, 1, 0, 1, 0, 1, 0, 1],nums2 = [0, 1, 0, 1, 0, 1, 0, 1, 0]) == 8\n assert candidate(nums1 = [2, 1, 4, 3, 5, 2, 3, 1],nums2 = [5, 2, 3, 1, 2, 1, 4, 3]) == 4\n assert candidate(nums1 = [1, 2, 2, 3, 3, 4, 4, 5, 5],nums2 = [5, 5, 4, 4, 3, 3, 2, 2, 1]) == 2\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],nums2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 0\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1]) == 9\n assert candidate(nums1 = [1, 2, 3, 2, 1, 4, 5, 6],nums2 = [5, 6, 7, 3, 2, 1, 8, 9]) == 3\n assert candidate(nums1 = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91],nums2 = [92, 91, 100, 99, 98, 97, 96, 95, 94, 93]) == 8\n assert candidate(nums1 = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],nums2 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == 19\n assert candidate(nums1 = [5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1],nums2 = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5]) == 15\n assert candidate(nums1 = [1, 2, 3, 2, 1, 4, 5, 6],nums2 = [6, 7, 8, 3, 2, 1, 4, 9]) == 4\n assert candidate(nums1 = [5, 4, 3, 2, 1],nums2 = [1, 2, 3, 4, 5]) == 1\n assert candidate(nums1 = [7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6],nums2 = [6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5]) == 19\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(nums1 = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],nums2 = [3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 7]) == 13\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(nums1 = [3, 5, 2, 4, 9, 1],nums2 = [9, 1, 3, 5, 2, 4]) == 4\n assert candidate(nums1 = [9, 8, 7, 6, 5, 4, 3, 2, 1],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 1\n assert candidate(nums1 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],nums2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) == 20\n assert candidate(nums1 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],nums2 = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 9\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 8\n assert candidate(nums1 = [3, 3, 3, 3, 3, 1, 2, 3, 4, 5],nums2 = [5, 4, 3, 2, 1, 3, 3, 3, 3, 3]) == 5\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [5, 4, 3, 2, 1, 10, 9, 8, 7, 6]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2]) == 13\n assert candidate(nums1 = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],nums2 = [5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == 2\n assert candidate(nums1 = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91],nums2 = [91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [1, 2, 3, 2, 1, 2, 3, 2, 1],nums2 = [2, 3, 2, 1, 2, 3, 2, 1, 2]) == 8\n assert candidate(nums1 = [5, 4, 3, 2, 1, 0],nums2 = [3, 2, 1, 0, 5, 4]) == 4\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums1 = [1, 0, 1, 0, 1, 0, 1, 0],nums2 = [0, 1, 0, 1, 0, 1, 0, 1]) == 7\n assert candidate(nums1 = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0],nums2 = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]) == 19\n assert candidate(nums1 = [1, 2, 3, 2, 1, 4, 5, 6],nums2 = [4, 5, 6, 1, 2, 3, 2, 1]) == 5\n assert candidate(nums1 = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2],nums2 = [2, 2, 2, 2, 2, 1, 1, 1, 1, 1]) == 5\n assert candidate(nums1 = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91],nums2 = [92, 93, 94, 95, 96, 97, 98, 99, 100, 90]) == 1\n assert candidate(nums1 = [98, 97, 96, 95, 94, 93, 92, 91, 90],nums2 = [88, 87, 86, 98, 97, 96, 95, 94, 93]) == 6\n assert candidate(nums1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],nums2 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],nums2 = [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34]) == 6\n assert candidate(nums1 = [1, 2, 3, 2, 1, 4, 5, 6, 7, 8],nums2 = [8, 7, 6, 5, 4, 3, 2, 1, 2, 3]) == 3\n assert candidate(nums1 = [4, 5, 6, 7, 8, 9, 10],nums2 = [1, 2, 3, 4, 5, 6, 7]) == 4\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 9\n assert candidate(nums1 = [10, 50, 20, 10, 30, 50, 10],nums2 = [50, 10, 30, 50, 10, 20, 10]) == 4\n assert candidate(nums1 = [0, 0, 1, 1, 0, 0, 1, 1],nums2 = [1, 1, 0, 0, 1, 1, 0, 0]) == 6\n assert candidate(nums1 = [5, 1, 3, 7, 9, 11, 13],nums2 = [3, 7, 9, 11, 13, 5, 1]) == 5\n assert candidate(nums1 = [1, 0, 1, 0, 1, 0],nums2 = [0, 1, 0, 1, 0, 1]) == 5\n assert candidate(nums1 = [7, 8, 9, 10, 11, 12, 13],nums2 = [10, 11, 12, 13, 7, 8, 9]) == 4\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13]) == 7\n assert candidate(nums1 = [5, 1, 2, 3, 4, 1, 2, 3, 4, 5],nums2 = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 5\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == 6\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [5, 4, 3, 2, 1, 10, 9, 8, 7, 6]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0],nums2 = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4]) == 16\n assert candidate(nums1 = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91],nums2 = [92, 93, 94, 95, 96, 97, 98, 99, 100, 101]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9],nums2 = [1, 3, 5, 7, 9, 11, 13, 15, 17]) == 1\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],nums2 = [19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [5, 6, 7, 8, 9, 10, 1, 2, 3, 4]) == 6\n assert candidate(nums1 = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],nums2 = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 20\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],nums2 = [50, 60, 70, 80, 90, 100, 110, 120, 130, 140]) == 6\n assert candidate(nums1 = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],nums2 = [2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1]) == 11\n assert candidate(nums1 = [5, 1, 3, 5, 1, 3, 5, 1, 3],nums2 = [3, 5, 1, 3, 5, 1, 3, 5, 1]) == 8\n assert candidate(nums1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5],nums2 = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 11\n assert candidate(nums1 = [100, 99, 98, 97, 96, 95],nums2 = [95, 96, 97, 98, 99, 100]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [5, 6, 7, 8, 9, 10, 1, 2, 3, 4]) == 6\n"}, "metadata": {"canonical_parameter_names": ["nums1", "nums2"], "leetcode_dataset_entry_point": "Solution().findLength", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findLength = function(nums1, nums2) {", "container": null, "callable": "findLength", "parameters": [{"name": "nums1", "type": "number[]"}, {"name": "nums2", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 719, "task_id": "find-k-th-smallest-pair-distance", "difficulty": "Hard", "problem_description": "The distance of a pair of integers a and b is defined as the absolute difference between a and b.\nGiven an integer array nums and an integer k, return the kth smallest distance among all the pairs nums[i] and nums[j] where 0 <= i < j < nums.length.\n \nExample 1:\n\nInput: nums = [1,3,1], k = 1\nOutput: 0\nExplanation: Here are all the pairs:\n(1,3) -> 2\n(1,1) -> 0\n(3,1) -> 2\nThen the 1st smallest distance pair is (1,1), and its distance is 0.\n\nExample 2:\n\nInput: nums = [1,1,1], k = 2\nOutput: 0\n\nExample 3:\n\nInput: nums = [1,6,1], k = 3\nOutput: 5\n\n \nConstraints:\n\nn == nums.length\n2 <= n <= 104\n0 <= nums[i] <= 106\n1 <= k <= n * (n - 1) / 2\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 4, 5],k = 10) == 4\n assert candidate(nums = [9, 10, 7, 10, 6, 1, 5, 4, 9, 8],k = 18) == 2\n assert candidate(nums = [62, 24, 6, 4, 40],k = 2) == 16\n assert candidate(nums = [5, 4, 3, 2, 1],k = 1) == 1\n assert candidate(nums = [1, 3, 1],k = 1) == 0\n assert candidate(nums = [5, 3, 8, 4, 2],k = 7) == 3\n assert candidate(nums = [10, 20, 30, 40, 50],k = 5) == 20\n assert candidate(nums = [4, 2, 1, 3],k = 5) == 2\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 1) == 0\n assert candidate(nums = [1, 6, 1],k = 3) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 45) == 9\n assert candidate(nums = [1, 1, 1],k = 2) == 0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 65) == 0\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],k = 100) == 24\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 190) == 0\n assert candidate(nums = [1, 3, 3, 1, 2, 2, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 171) == 7\n assert candidate(nums = [1, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400],k = 100) == 1199\n assert candidate(nums = [0, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19],k = 190) == 19\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 90) == 3\n assert candidate(nums = [1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],k = 190) == 74\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 180) == 15\n assert candidate(nums = [1, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 50) == 799\n assert candidate(nums = [3, 8, 15, 17, 9, 4, 2],k = 10) == 6\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],k = 105) == 140\n assert candidate(nums = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5],k = 250) == 2\n assert candidate(nums = [100000, 100000, 0, 100000, 50000, 50000, 50000, 50000],k = 28) == 100000\n assert candidate(nums = [1, 2, 3, 3, 3, 4, 5, 5, 5, 5, 6, 7, 8, 8, 9],k = 50) == 2\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 25) == 0\n assert candidate(nums = [5, 1, 4, 1, 2, 6, 7, 8, 3, 9],k = 20) == 3\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 45) == 900\n assert candidate(nums = [1, 3, 1, 5, 7, 9],k = 10) == 4\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 45) == 0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],k = 190) == 190\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],k = 190) == 38\n assert candidate(nums = [50, 40, 30, 20, 10, 0, -10, -20, -30, -40, -50],k = 55) == 100\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 435) == 29\n assert candidate(nums = [100, 150, 200, 250, 300, 350, 400, 450, 500],k = 30) == 250\n assert candidate(nums = [8, 1, 2, 2, 3],k = 3) == 1\n assert candidate(nums = [1000000, 999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991],k = 45) == 9\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000, 100000, 10000, 1000, 100, 10, 1],k = 66) == 99999\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5],k = 70) == 2\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21],k = 100) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],k = 1225) == 49\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5],k = 100) == 3\n assert candidate(nums = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],k = 25) == 40\n assert candidate(nums = [500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000],k = 100) == 0\n assert candidate(nums = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120],k = 105) == 119\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],k = 292) == 21\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 210) == 19\n assert candidate(nums = [1, 1000000, 2, 999999, 3, 999998, 4, 999997, 5, 999996],k = 15) == 3\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000, 1, 10, 100, 1000, 10000, 100000, 1000000, 1, 10, 100, 1000, 10000, 100000],k = 380) == 999999\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10],k = 270) == 4\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10],k = 190) == 15\n assert candidate(nums = [100000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 100) == 99999\n assert candidate(nums = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1, 2, 3, 4, 5],k = 100) == 999\n assert candidate(nums = [500000, 500001, 500002, 500003, 500004, 500005, 500006, 500007, 500008, 500009],k = 45) == 9\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],k = 189) == 180\n assert candidate(nums = [1, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119],k = 210) == 118\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 100) == 12\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49],k = 300) == 48\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6],k = 150) == 2\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 190) == 0\n assert candidate(nums = [3, 8, 15, 17, 9, 12, 20, 7, 5, 10],k = 15) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 190) == 19\n assert candidate(nums = [1, 1000000, 2, 999999, 3, 999998, 4, 999997, 5, 999996],k = 25) == 999993\n assert candidate(nums = [999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991, 999990, 999989],k = 55) == 10\n assert candidate(nums = [100, 100, 200, 200, 300, 300, 400, 400, 500, 500],k = 45) == 400\n assert candidate(nums = [100000, 99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991],k = 30) == 4\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],k = 100) == 45\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 190) == 19\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 190) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 190) == 9\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],k = 105) == 28\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 171) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 100) == 12\n assert candidate(nums = [100000, 50000, 25000, 12500, 6250, 3125, 1562, 781, 390, 195],k = 44) == 99610\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().smallestDistancePair", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var smallestDistancePair = function(nums, k) {", "container": null, "callable": "smallestDistancePair", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 720, "task_id": "longest-word-in-dictionary", "difficulty": "Medium", "problem_description": "Given an array of strings words representing an English Dictionary, return the longest word in words that can be built one character at a time by other words in words.\nIf there is more than one possible answer, return the longest word with the smallest lexicographical order. If there is no answer, return the empty string.\nNote that the word should be built from left to right with each additional character being added to the end of a previous word. \n \nExample 1:\n\nInput: words = [\"w\",\"wo\",\"wor\",\"worl\",\"world\"]\nOutput: \"world\"\nExplanation: The word \"world\" can be built one character at a time by \"w\", \"wo\", \"wor\", and \"worl\".\n\nExample 2:\n\nInput: words = [\"a\",\"banana\",\"app\",\"appl\",\"ap\",\"apply\",\"apple\"]\nOutput: \"apple\"\nExplanation: Both \"apply\" and \"apple\" can be built from other words in the dictionary. However, \"apple\" is lexicographically smaller than \"apply\".\n\n \nConstraints:\n\n1 <= words.length <= 1000\n1 <= words[i].length <= 30\nwords[i] consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh']) == \"abcdefgh\"\n assert candidate(words = ['a', 'b', 'c']) == \"a\"\n assert candidate(words = ['w', 'wo', 'wor', 'worl', 'world']) == \"world\"\n assert candidate(words = ['zebra', 'zeb', 'zebu', 'zebrae', 'zebraes', 'zebraest']) == \"\"\n assert candidate(words = ['car', 'cars', 'carp', 'card', 'care', 'career', 'caree', 'careerl', 'careerle', 'careerled']) == \"\"\n assert candidate(words = ['a', 'banana', 'app', 'appl', 'ap', 'apply', 'apple']) == \"apple\"\n assert candidate(words = ['hello', 'hell', 'he', 'h', 'hero', 'her', 'here', 'heroic']) == \"here\"\n assert candidate(words = ['ab', 'abc', 'bc', 'abcd']) == \"\"\n assert candidate(words = ['layer', 'layers', 'layered', 'layering', 'layerss']) == \"\"\n assert candidate(words = ['abcd', 'abc', 'ab', 'a']) == \"abcd\"\n assert candidate(words = ['cat', 'banana', 'dog', 'do', 'doge']) == \"\"\n assert candidate(words = ['apple', 'ape', 'app', 'appl', 'ap', 'application']) == \"\"\n assert candidate(words = ['yo', 'yolo', 'yell', 'yes', 'yellow', 'ye', 'yellower']) == \"\"\n assert candidate(words = ['sgz', 'sgzn', 'sgznwv', 'i', 'ksiaz', 'ksiazx', 'ksiazxp', 'iwc', 'iwcx', 'iwcxz', 'iwcxzo']) == \"i\"\n assert candidate(words = ['apple', 'app', 'ap', 'appl', 'apply']) == \"\"\n assert candidate(words = ['ab', 'abc', 'bcd', 'abcd', 'abcde']) == \"\"\n assert candidate(words = ['yo', 'yoyomo', 'yoymomo', 'yoyomomo']) == \"\"\n assert candidate(words = ['apple', 'ale', 'monkey', 'plea', 'pleas', 'please']) == \"\"\n assert candidate(words = ['m', 'mo', 'moc', 'moch', 'mocha', 'mochas', 'mochahu', 'mochahuu', 'mochahuuu']) == \"mochas\"\n assert candidate(words = ['m', 'mo', 'moc', 'moch', 'mocha', 'l', 'la', 'lat', 'latt', 'latte', 'c', 'ca', 'cat']) == \"latte\"\n assert candidate(words = ['b', 'br', 'bre', 'brea', 'break', 'breaks', 'breakin', 'breaks']) == \"breaks\"\n assert candidate(words = ['hello', 'hell', 'he', 'h']) == \"he\"\n assert candidate(words = ['b', 'br', 'bre', 'brea', 'break', 'breaks']) == \"breaks\"\n assert candidate(words = ['cat', 'cats', 'catsdogcats', 'dog', 'dogcatsdog', 'hippopotamuses', 'rat', 'ratcatdogcat']) == \"\"\n assert candidate(words = ['ab', 'abc', 'bcd', 'bc', 'cd']) == \"\"\n assert candidate(words = ['a', 'b', 'c', 'ab', 'bc', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh']) == \"abcdefgh\"\n assert candidate(words = ['cat', 'cats', 'dog', 'dogcatsdog', 'rat', 'catdog', 'dogdog', 'ratcatdog', 'catdogdog', 'dogratcat']) == \"\"\n assert candidate(words = ['ocean', 'oce', 'oc', 'oceanic', 'oceani', 'oceanicw', 'oceanicwa', 'oceanicwam', 'oceanicwama', 'oceanicwamal', 'oceanicwamali', 'oceanicwamalin', 'oceanicwamalinl']) == \"\"\n assert candidate(words = ['apple', 'apples', 'applesauce', 'applesauc', 'applesauced', 'applesauceme', 'applesaucemel', 'applesaucemell', 'applesaucemellu', 'applesaucemellus']) == \"\"\n assert candidate(words = ['j', 'ja', 'jav', 'java', 'javas', 'javasc', 'javascri', 'javascrip', 'javascrip', 'javascript', 'javascripte', 'javascripten', 'javascripteng', 'javascriptengi', 'javascriptengin', 'javascriptenging']) == \"javasc\"\n assert candidate(words = ['dog', 'doge', 'doged', 'dogedj', 'dogedju', 'dogedjud', 'dogedjudge', 'dogedjudges', 'dogedjudgese', 'dogedjudgeses']) == \"\"\n assert candidate(words = ['dog', 'dogs', 'dogss', 'dogsss', 'dogssss', 'dogsssss']) == \"\"\n assert candidate(words = ['z', 'zz', 'zzz', 'zzzz', 'zzzzz', 'zzzzzz', 'zzzzzzz']) == \"zzzzzzz\"\n assert candidate(words = ['p', 'pa', 'pan', 'pang', 'pange', 'pangea', 'pangean']) == \"pangean\"\n assert candidate(words = ['kangaroo', 'kangaro', 'kangaroos', 'kangar', 'kanga', 'kang', 'kan', 'ka', 'k']) == \"kangaroos\"\n assert candidate(words = ['hello', 'hell', 'he', 'h', 'world', 'wor', 'wo', 'w', 'python', 'pyth', 'pyt', 'py', 'p']) == \"pyth\"\n assert candidate(words = ['cat', 'bat', 'rat', 'car', 'catr', 'carr', 'cart', 'carth', 'carthe', 'carthes', 'carthesi', 'carthesis']) == \"\"\n assert candidate(words = ['elephant', 'eleph', 'elephas', 'elephan', 'elephanc', 'elephantc', 'elephantco', 'elephantcor', 'elephantcorn', 'elephantcorns']) == \"\"\n assert candidate(words = ['x', 'xy', 'xyz', 'xyza', 'xyzab', 'xyzabc', 'xyzabcd']) == \"xyzabcd\"\n assert candidate(words = ['happy', 'happ', 'hap', 'ha', 'happier', 'happie', 'happyland', 'happylan', 'happyla', 'happyl', 'happyl']) == \"\"\n assert candidate(words = ['xyz', 'xy', 'x', 'yz', 'y', 'z', 'xyzd', 'xyzde', 'xyzdef', 'xyzdefg']) == \"xyzdefg\"\n assert candidate(words = ['x', 'xy', 'xyz', 'xyzz', 'xyzzz', 'xyzzzz', 'xyzzzzz', 'xyzzzzzz', 'xyzzzzzzz', 'xyzzzzzzzz']) == \"xyzzzzzzzz\"\n assert candidate(words = ['elephant', 'eleph', 'elep', 'ele', 'el', 'e', 'elephantman', 'elephantwoman', 'elephantmanwoman', 'elephantwomanman']) == \"eleph\"\n assert candidate(words = ['a', 'abc', 'ab', 'abcd', 'abcde', 'abcdefg', 'abcdefgh']) == \"abcde\"\n assert candidate(words = ['hello', 'hell', 'hellp', 'hellpa', 'hellpad', 'hellpadd', 'hellpaddr', 'hellpaddre', 'hellpadder', 'hellpadding']) == \"\"\n assert candidate(words = ['m', 'ma', 'mat', 'math', 'maths', 'mathem', 'mathema', 'mathemat', 'mathemati', 'mathematis', 'mathematic', 'mathematica', 'mathematical', 'mathematicals']) == \"maths\"\n assert candidate(words = ['banana', 'bandana', 'band', 'bandanaa', 'bandanaaa', 'bandanaaaa', 'bandanaaaaa']) == \"\"\n assert candidate(words = ['m', 'mo', 'moc', 'moch', 'mocha', 'mochau', 'mochaus', 'mochause', 'mochauset', 'mochausett']) == \"mochausett\"\n assert candidate(words = ['programming', 'program', 'progra', 'programm', 'programmi', 'programmin', 'programmin', 'programmin', 'programmin', 'programmingl']) == \"\"\n assert candidate(words = ['w', 'wo', 'wor', 'worl', 'world', 'worls', 'worlsa', 'worlsas', 'worlsask', 'worlsaskp', 'worlsaskph', 'worlsaskphb', 'worlsaskphbr', 'worlsaskphbrn']) == \"worlsaskphbrn\"\n assert candidate(words = ['zebra', 'zebr', 'zeb', 'ze', 'z', 'zebrazebr', 'zebrzebr', 'zebzeb', 'zeze', 'zz', 'zzz', 'zzzz', 'zzzzz']) == \"zebra\"\n assert candidate(words = ['sun', 'sunny', 'sunnyd', 'sunnyda', 'sunnydar', 'sunnydark', 'sunnydarc', 'sunnydarck', 'sunnydarcks', 'sunnydarckso', 'sunnydarckson', 'sunnydarcksong']) == \"\"\n assert candidate(words = ['r', 'ra', 'ran', 'ranc', 'ranch', 'rancha', 'ranchai', 'ranchain', 'ranchaind', 'ranchainde', 'ranchainden', 'ranchaindent', 'ranchaindente', 'ranchaindentel', 'ranchaindentels']) == \"ranchaindentels\"\n assert candidate(words = ['abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk']) == \"\"\n assert candidate(words = ['x', 'xy', 'xyz', 'xyza', 'xyzab', 'xyzabc', 'xyzabcd', 'xyzabcde', 'xyzabcdef']) == \"xyzabcdef\"\n assert candidate(words = ['a', 'b', 'c', 'ab', 'bc', 'abc', 'abcd', 'abcde', 'abcdef']) == \"abcdef\"\n assert candidate(words = ['car', 'cards', 'carpet', 'cart', 'cat', 'cats', 'cattle', 'dog', 'dogs', 'doghouse', 'doghousee']) == \"\"\n assert candidate(words = ['cat', 'cats', 'catsd', 'catsdo', 'catsdog', 'catsdogw', 'catsdogwa', 'catsdogwar', 'catsdogwarm', 'catsdogwarms']) == \"\"\n assert candidate(words = ['banana', 'ban', 'band', 'bandi', 'bandit', 'bandits', 'bands', 'bandwidth', 'bandwidths', 'bandwidthing']) == \"\"\n assert candidate(words = ['sheep', 'she', 'sh', 's', 'shelter', 'shel', 'shele', 'sheleh', 'shelehi', 'shelehii']) == \"shelehii\"\n assert candidate(words = ['at', 'att', 'atti', 'attis', 'attire', 'attach', 'attachs', 'attaches', 'attaching']) == \"\"\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxy', 'abcdefghijklmnopqrstuvwx', 'abcdefghijklmnopqrstuvw', 'abcdefghijklmnopqrstu', 'abcdefghijklmnopqrst', 'abcdefghijklmnopqrs', 'abcdefghijklmnopqr', 'abcdefghijklmnopq', 'abcdefghijklmnop', 'abcdefghijklmno', 'abcdefghijklmn', 'abcdefghijklm', 'abcdefghijkl', 'abcdefghijk', 'abcdefghij', 'abcdefghi', 'abcdefgh', 'abcdefg', 'abcdef', 'abcde', 'abcd', 'abc', 'ab', 'a']) == \"abcdefghijklmnopqrstu\"\n assert candidate(words = ['m', 'mo', 'moc', 'moch', 'mocha', 'mochas', 'mochatel']) == \"mochas\"\n assert candidate(words = ['a', 'b', 'c', 'ab', 'bc', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg']) == \"abcdefg\"\n assert candidate(words = ['g', 'go', 'god', 'godd', 'godde', 'goddess', 'goddesss', 'goddessss', 'goddesssss', 'goddessssss', 'goddesssssss', 'goddessssssss']) == \"godde\"\n assert candidate(words = ['w', 'wo', 'wor', 'worl', 'world', 'worldly', 'worldlyy', 'worldlyyy', 'worldlyyyy', 'worldlyyyyy', 'worldlyyyyyy', 'worldlyyyyyyy', 'worldlyyyyyyyy', 'worldlyyyyyyyyy', 'worldlyyyyyyyyyy', 'worldlyyyyyyyyyyy', 'worldlyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyyyyyyyyyyyyy', 'worldlyyyyyyyyyyyyyyyyyyyyyyyyyy']) == \"world\"\n assert candidate(words = ['education', 'educati', 'educatio', 'educat', 'educati', 'educati', 'educati', 'educati', 'educati', 'educati']) == \"\"\n assert candidate(words = ['elephant', 'eleph', 'elep', 'ele', 'el', 'e', 'giraffe', 'gira', 'gir', 'gi', 'g', 'zebra', 'zeb', 'ze', 'z']) == \"eleph\"\n assert candidate(words = ['m', 'mo', 'mon', 'mond', 'mondo', 'mondoo', 'mondooo', 'mondooooo', 'mondoooooo', 'mondooooooo']) == \"mondooo\"\n assert candidate(words = ['ab', 'abc', 'abca', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn']) == \"\"\n assert candidate(words = ['word', 'wor', 'worl', 'world', 'worldd', 'worldde', 'worlddee', 'worlddeep', 'worlddeeper', 'worlddeepest', 'worlddeepestt', 'worlddeepesttt', 'worlddeepestttt', 'worlddeepesttttt', 'worlddeepesttttts', 'worlddeepesttttsss', 'worlddeepesttttssss', 'worlddeepesttttsssss', 'worlddeepesttttssssss']) == \"\"\n assert candidate(words = ['zebra', 'zebras', 'zebrass', 'zebrasss', 'zebrassss', 'zebrasssss', 'zebrassssss']) == \"\"\n assert candidate(words = ['a', 'b', 'c', 'ab', 'bc', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij']) == \"abcdefghij\"\n assert candidate(words = ['m', 'mo', 'moc', 'moch', 'mocha', 'mochaa', 'mochaaa', 'mochaaaa', 'mochaaaaa', 'mochaaaaaa', 'mochaaaaaab', 'mochaaaaaabc']) == \"mochaaaaaabc\"\n assert candidate(words = ['abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn', 'abcdefghijklmnop', 'abcdefghijklmnopq', 'abcdefghijklmnopqr', 'abcdefghijklmnopqrs', 'abcdefghijklmnopqrst', 'abcdefghijklmnopqrstu', 'abcdefghijklmnopqrstuv', 'abcdefghijklmnopqrstuvw', 'abcdefghijklmnopqrstuvwx', 'abcdefghijklmnopqrstuvwxy', 'abcdefghijklmnopqrstuvwxyz']) == \"\"\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aab', 'aabb', 'aaabb', 'aabbb', 'aabbbb', 'aabbbba', 'aabbbbac', 'aabbbbacc', 'aabbbbaccd', 'aabbbbaccde', 'aabbbbaccdef', 'aabbbbaccd', 'aabbbbacce', 'aabbbbaccf', 'aabbbbaccg']) == \"aabbbbaccdef\"\n assert candidate(words = ['cat', 'cats', 'catdog', 'dog', 'dogcat', 'dogdog', 'catcat', 'catdogcat']) == \"\"\n assert candidate(words = ['aardvark', 'aardva', 'aardv', 'aard', 'aarr', 'aar', 'aa', 'a', 'bark', 'bar', 'ba', 'b']) == \"aardva\"\n assert candidate(words = ['aaaaaa', 'aaaaab', 'aaaaac', 'aaaaad', 'aaaaae', 'aaaaaf', 'aaaaag', 'aaaaah', 'aaaaai', 'aaaaaj']) == \"\"\n assert candidate(words = ['t', 'to', 'too', 'tool', 'tools', 'tooool', 'toooln', 'tooolna', 'tooolnan', 'tooolnanc', 'tooolnance', 'tooolnances']) == \"tools\"\n assert candidate(words = ['x', 'xy', 'xyz', 'xyzz', 'xyzzz', 'xyzzzz']) == \"xyzzzz\"\n assert candidate(words = ['aabbcc', 'aabbc', 'aabb', 'aab', 'aa', 'a', 'aabbbccc', 'aabbbcc', 'aabbbc', 'aabbb', 'aabbccdd', 'aabbccd', 'aabbccdd', 'aabbccdde', 'aabbccddeff', 'aabbccddefff']) == \"aabbccdde\"\n assert candidate(words = ['x', 'xy', 'xyz', 'xyzz', 'xyzzz', 'xyzzzz', 'xyzzzzz', 'xyzzzzzz', 'xyzzzzzzz', 'xyzzzzzzzz']) == \"xyzzzzzzzz\"\n assert candidate(words = ['cat', 'cats', 'catsd', 'catsdo', 'catsdog', 'catsdogs']) == \"\"\n assert candidate(words = ['lion', 'lions', 'liones', 'lionesi', 'lionesis', 'lionesiss', 'lionesissi']) == \"\"\n assert candidate(words = ['m', 'mi', 'mic', 'mice', 'micem', 'micems', 'micemse', 'micemsen', 'micemsens', 'micemsense', 'micemsenses']) == \"micemsenses\"\n assert candidate(words = ['zebra', 'zeb', 'zebrai', 'zebraic', 'zebrain', 'zebrainc', 'zebrainco', 'zebraincor', 'zebraincorn', 'zebraincorns']) == \"\"\n assert candidate(words = ['dog', 'dogg', 'doggo', 'doggos', 'doggoes', 'doggoest', 'doggoesta', 'doggoestas', 'doggoestast', 'doggoestaste', 'doggoestastes', 'doggoestastesf', 'doggoestastesfi', 'doggoestastesfir']) == \"\"\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == \"a\"\n assert candidate(words = ['elephant', 'elephan', 'eleph', 'elep', 'ele', 'el', 'e']) == \"eleph\"\n assert candidate(words = ['x', 'y', 'z', 'xy', 'xz', 'yx', 'yz', 'zx', 'zy', 'xyz', 'xzy', 'yxz', 'yzx', 'zxy', 'zyx', 'xyzs', 'xzyt', 'yxzu', 'yzxv', 'zxwy', 'zyxw', 'xyzw']) == \"xyzs\"\n assert candidate(words = ['s', 'su', 'sun', 'sund', 'sunde', 'sunden', 'sundenw', 'sundenwe', 'sundenwet', 'sundenwete', 'sundenwetep', 'sundenweteps', 'sundenwetepsi', 'sundenwetepsir', 'sundenwetepsirc']) == \"sundenwetepsirc\"\n assert candidate(words = ['x', 'xy', 'xyz', 'xyzz', 'xyzzz', 'xyzzzz', 'xyzzzzz', 'xyzzzzzz', 'xyzzzzzzz', 'xyzzzzzzzz', 'xyzzzzzzzzz']) == \"xyzzzzzzzzz\"\n assert candidate(words = ['p', 'pa', 'par', 'para', 'paral', 'parale', 'paralle', 'paralle', 'parallel', 'parallell', 'parallellu', 'parallelly', 'parallellye', 'parallellyes', 'parallellyest', 'parallellyests']) == \"parale\"\n assert candidate(words = ['xyz', 'xy', 'x', 'xz', 'xzv', 'xzvc', 'xzvcd']) == \"xzvcd\"\n assert candidate(words = ['tiger', 'tig', 'ti', 't', 'lion', 'lio', 'li', 'l', 'bear', 'bea', 'be', 'b', 'wolf', 'wo', 'w', 'fox', 'fo', 'f']) == \"bear\"\n assert candidate(words = ['z', 'y', 'x', 'yz', 'xz', 'yx', 'xyz', 'yxz', 'zyx', 'zyxz', 'zyxw']) == \"yxz\"\n assert candidate(words = ['z', 'zz', 'zzz', 'zzzz', 'zzzzz', 'zzzzzz', 'zzzzzzz', 'zzzzzzzz', 'zzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzzz']) == \"zzzzzzzzzzz\"\n assert candidate(words = ['z', 'ze', 'zel', 'zela', 'zelat', 'zelato', 'zelaton', 'zelatona', 'zelatonam', 'zelatonami', 'zelatonamil', 'zelatonamilis', 'zelatonamilisa']) == \"zelatonamil\"\n assert candidate(words = ['b', 'ba', 'ban', 'band', 'bands', 'bandw', 'bandwi', 'bandwin', 'bandwind', 'bandwindy', 'bandwindyt', 'bandwindytr', 'bandwindytri', 'bandwindytrin', 'bandwindytrink', 'bandwindytrinkt', 'bandwindytrinkte', 'bandwindytrinktel', 'bandwindytrinkle', 'bandwindytrinklet', 'bandwindytrinklety', 'bandwindytrinkletys', 'bandwindytrinkletysi', 'bandwindytrinkletysin', 'bandwindytrinkletysinc']) == \"bandwindytrinktel\"\n assert candidate(words = ['zebra', 'zebr', 'zeb', 'z', 'appl', 'apply', 'apple', 'app', 'apples', 'applf', 'applfs', 'applfst', 'applfsth', 'applfstha', 'applfsthaw']) == \"z\"\n assert candidate(words = ['giraffe', 'giraff', 'gira', 'gir', 'gi', 'g']) == \"gira\"\n assert candidate(words = ['zebra', 'zeb', 'zebraa', 'zebraaa', 'zebraaaa', 'zebraaaaa', 'zebraaaaaa']) == \"\"\n assert candidate(words = ['aaa', 'aa', 'a', 'aaaa', 'aab', 'aabbb', 'aabbbb', 'aabbbbb', 'aabbbbbb', 'aabbbbbbb', 'aabbbbbbbb']) == \"aaaa\"\n assert candidate(words = ['a', 'apple', 'apply', 'apples', 'applesauce', 'applesauces']) == \"a\"\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa', 'aaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaaa']) == \"aaaaaaaaaa\"\n assert candidate(words = ['table', 'tab', 'tabl', 'tabli', 'tablir', 'tablirt', 'tablirte', 'tablirtet', 'tablirtete', 'tablirtetep', 'tablirtetepy', 'tablirtetepyv', 'tablirtetepyvu', 'tablirtetepyvul']) == \"\"\n assert candidate(words = ['cat', 'cats', 'catsd', 'catsdo', 'catsdog', 'catsdogs', 'catsdogsa', 'catsdogsau', 'catsdogsaus', 'catsdogsausa', 'catsdogsausag', 'catsdogsausag', 'catsdogsausage']) == \"\"\n assert candidate(words = ['hello', 'hell', 'hel', 'he', 'h', 'world', 'wor', 'wo', 'w', 'python', 'pytho', 'pyth', 'pyt', 'py', 'p', 'programming', 'programmin', 'programmi', 'programm', 'program', 'progra', 'progr', 'prog', 'pro', 'pr', 'p']) == \"programming\"\n assert candidate(words = ['a', 'b', 'ba', 'bca', 'bda', 'bdca']) == \"ba\"\n assert candidate(words = ['k', 'ka', 'kay', 'kaye', 'kayes', 'kayest', 'kayesta', 'kayestan', 'kayestana', 'kayestanap', 'kayestanapa', 'kayestanapal', 'kayestanapali', 'kayestanapaliu', 'kayestanapaliud', 'kayestanapaliude', 'kayestanapaliuder', 'kayestanapaliuderk', 'kayestanapaliuderks']) == \"kayestanapaliuderks\"\n assert candidate(words = ['umbrella', 'umbrell', 'umbrel', 'umbre', 'umbr', 'umb', 'um', 'u']) == \"umbrella\"\n assert candidate(words = ['apple', 'apples', 'banana', 'bananas', 'banan', 'bat', 'batman', 'batmans', 'batman', 'batman', 'batmans', 'batman']) == \"\"\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxy', 'abcdefghijklmnopqrstuvwx', 'abcdefghijklmnopqrstuvw', 'abcdefghijklmnopqrstu', 'abcdefghijklmnopqrst', 'abcdefghijklmnopqr', 'abcdefghijklmnopq', 'abcdefghijklmnop', 'abcdefghijklnmopqrstu', 'abcdefghijklnmopqrst', 'abcdefghijklnmopqr', 'abcdefghijklnmopq', 'abcdefghijklnmop', 'abcdefghijklnmo', 'abcdefghijklnm', 'abcdefghijkln', 'abcdefghijk', 'abcdefghij', 'abcdefghi', 'abcdefgh', 'abcdefg', 'abcdef', 'abcde', 'abcd', 'abc', 'ab', 'a']) == \"abcdefghijk\"\n assert candidate(words = ['one', 'only', 'onely', 'onelys', 'onelyso', 'onelysom', 'onelysome', 'onelysomeo', 'onelysomeon', 'onelysomeone', 'onelysomeonely', 'onelysomeonelys', 'onelysomeonelyso', 'onelysomeonelysom', 'onelysomeonelysome', 'onelysomeonelysomeo', 'onelysomeonelysomeon', 'onelysomeonelysomeone', 'onelysomeonelysomeonely', 'onelysomeonelysomeonelys', 'onelysomeonelysomeonelyso', 'onelysomeonelysomeonelysom', 'onelysomeonelysomeonelysome', 'onelysomeonelysomeonelysomeo', 'onelysomeonelysomeonelysomeon', 'onelysomeonelysomeonelysomeone', 'onelysomeonelysomeonelysomeonely', 'onelysomeonelysomeonelysomeonelys', 'onelysomeonelysomeonelysomeonelyso', 'onelysomeonelysomeonelysomeonelysom', 'onelysomeonelysomeonelysomeonelysome']) == \"\"\n assert candidate(words = ['p', 'pa', 'pac', 'pack', 'packe', 'packet', 'packeta', 'packetas', 'packetasi', 'packetasic', 'packetasics', 'packetasicsl', 'packetasicsli', 'packetasicslib', 'packetasicslibs']) == \"packetasicslibs\"\n"}, "metadata": {"canonical_parameter_names": ["words"], "leetcode_dataset_entry_point": "Solution().longestWord", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var longestWord = function(words) {", "container": null, "callable": "longestWord", "parameters": [{"name": "words", "type": "string[]"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 721, "task_id": "accounts-merge", "difficulty": "Medium", "problem_description": "Given a list of accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of the account.\nNow, we would like to merge these accounts. Two accounts definitely belong to the same person if there is some common email to both accounts. Note that even if two accounts have the same name, they may belong to different people as people could have the same name. A person can have any number of accounts initially, but all of their accounts definitely have the same name.\nAfter merging the accounts, return the accounts in the following format: the first element of each account is the name, and the rest of the elements are emails in sorted order. The accounts themselves can be returned in any order.\n \nExample 1:\n\nInput: accounts = [[\"John\",\"johnsmith@mail.com\",\"john_newyork@mail.com\"],[\"John\",\"johnsmith@mail.com\",\"john00@mail.com\"],[\"Mary\",\"mary@mail.com\"],[\"John\",\"johnnybravo@mail.com\"]]\nOutput: [[\"John\",\"john00@mail.com\",\"john_newyork@mail.com\",\"johnsmith@mail.com\"],[\"Mary\",\"mary@mail.com\"],[\"John\",\"johnnybravo@mail.com\"]]\nExplanation:\nThe first and second John's are the same person as they have the common email \"johnsmith@mail.com\".\nThe third John and Mary are different people as none of their email addresses are used by other accounts.\nWe could return these lists in any order, for example the answer [['Mary', 'mary@mail.com'], ['John', 'johnnybravo@mail.com'], \n['John', 'john00@mail.com', 'john_newyork@mail.com', 'johnsmith@mail.com']] would still be accepted.\n\nExample 2:\n\nInput: accounts = [[\"Gabe\",\"Gabe0@m.co\",\"Gabe3@m.co\",\"Gabe1@m.co\"],[\"Kevin\",\"Kevin3@m.co\",\"Kevin5@m.co\",\"Kevin0@m.co\"],[\"Ethan\",\"Ethan5@m.co\",\"Ethan4@m.co\",\"Ethan0@m.co\"],[\"Hanzo\",\"Hanzo3@m.co\",\"Hanzo1@m.co\",\"Hanzo0@m.co\"],[\"Fern\",\"Fern5@m.co\",\"Fern1@m.co\",\"Fern0@m.co\"]]\nOutput: [[\"Ethan\",\"Ethan0@m.co\",\"Ethan4@m.co\",\"Ethan5@m.co\"],[\"Gabe\",\"Gabe0@m.co\",\"Gabe1@m.co\",\"Gabe3@m.co\"],[\"Hanzo\",\"Hanzo0@m.co\",\"Hanzo1@m.co\",\"Hanzo3@m.co\"],[\"Kevin\",\"Kevin0@m.co\",\"Kevin3@m.co\",\"Kevin5@m.co\"],[\"Fern\",\"Fern0@m.co\",\"Fern1@m.co\",\"Fern5@m.co\"]]\n\n \nConstraints:\n\n1 <= accounts.length <= 1000\n2 <= accounts[i].length <= 10\n1 <= accounts[i][j].length <= 30\naccounts[i][0] consists of English letters.\naccounts[i][j] (for j > 0) is a valid email.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(accounts = [['Alex', 'alex@example.com'], ['Bob', 'bob@example.com'], ['Alex', 'alex2@example.com']]) == [['Alex', 'alex@example.com'], ['Bob', 'bob@example.com'], ['Alex', 'alex2@example.com']]\n assert candidate(accounts = [['David', 'david@example.com'], ['David', 'david1@example.com'], ['David', 'david2@example.com'], ['David', 'david3@example.com']]) == [['David', 'david@example.com'], ['David', 'david1@example.com'], ['David', 'david2@example.com'], ['David', 'david3@example.com']]\n assert candidate(accounts = [['Gabe', 'Gabe0@m.co', 'Gabe3@m.co', 'Gabe1@m.co'], ['Kevin', 'Kevin3@m.co', 'Kevin5@m.co', 'Kevin0@m.co'], ['Ethan', 'Ethan5@m.co', 'Ethan4@m.co', 'Ethan0@m.co'], ['Hanzo', 'Hanzo3@m.co', 'Hanzo1@m.co', 'Hanzo0@m.co'], ['Fern', 'Fern5@m.co', 'Fern1@m.co', 'Fern0@m.co']]) == [['Gabe', 'Gabe0@m.co', 'Gabe1@m.co', 'Gabe3@m.co'], ['Kevin', 'Kevin0@m.co', 'Kevin3@m.co', 'Kevin5@m.co'], ['Ethan', 'Ethan0@m.co', 'Ethan4@m.co', 'Ethan5@m.co'], ['Hanzo', 'Hanzo0@m.co', 'Hanzo1@m.co', 'Hanzo3@m.co'], ['Fern', 'Fern0@m.co', 'Fern1@m.co', 'Fern5@m.co']]\n assert candidate(accounts = [['John', 'johnsmith@mail.com', 'john_newyork@mail.com'], ['John', 'johnsmith@mail.com', 'john00@mail.com'], ['Mary', 'mary@mail.com'], ['John', 'johnnybravo@mail.com']]) == [['John', 'john00@mail.com', 'john_newyork@mail.com', 'johnsmith@mail.com'], ['Mary', 'mary@mail.com'], ['John', 'johnnybravo@mail.com']]\n assert candidate(accounts = [['Alice', 'alice1@example.com'], ['Bob', 'bob1@example.com'], ['Alice', 'alice2@example.com'], ['Alice', 'alice3@example.com'], ['Bob', 'bob2@example.com']]) == [['Alice', 'alice1@example.com'], ['Bob', 'bob1@example.com'], ['Alice', 'alice2@example.com'], ['Alice', 'alice3@example.com'], ['Bob', 'bob2@example.com']]\n assert candidate(accounts = [['Tom', 'tom1@example.com', 'tom2@example.com', 'tom3@example.com'], ['Jerry', 'jerry1@example.com'], ['Tom', 'tom4@example.com'], ['Jerry', 'jerry2@example.com'], ['Tom', 'tom5@example.com'], ['Jerry', 'jerry3@example.com', 'jerry4@example.com'], ['Tom', 'tom6@example.com'], ['Jerry', 'jerry5@example.com', 'jerry1@example.com'], ['Tom', 'tom2@example.com'], ['Jerry', 'jerry6@example.com'], ['Tom', 'tom3@example.com'], ['Jerry', 'jerry7@example.com'], ['Tom', 'tom4@example.com'], ['Jerry', 'jerry8@example.com'], ['Tom', 'tom5@example.com'], ['Jerry', 'jerry9@example.com'], ['Tom', 'tom6@example.com'], ['Jerry', 'jerry10@example.com'], ['Tom', 'tom1@example.com'], ['Jerry', 'jerry11@example.com'], ['Tom', 'tom7@example.com'], ['Jerry', 'jerry12@example.com'], ['Tom', 'tom8@example.com'], ['Jerry', 'jerry13@example.com'], ['Tom', 'tom9@example.com'], ['Jerry', 'jerry14@example.com'], ['Tom', 'tom10@example.com'], ['Jerry', 'jerry15@example.com'], ['Tom', 'tom11@example.com'], ['Jerry', 'jerry16@example.com'], ['Tom', 'tom12@example.com'], ['Jerry', 'jerry17@example.com'], ['Tom', 'tom13@example.com'], ['Jerry', 'jerry18@example.com'], ['Tom', 'tom14@example.com'], ['Jerry', 'jerry19@example.com'], ['Tom', 'tom15@example.com'], ['Jerry', 'jerry20@example.com']]) == [['Tom', 'tom1@example.com', 'tom2@example.com', 'tom3@example.com'], ['Jerry', 'jerry1@example.com', 'jerry5@example.com'], ['Tom', 'tom4@example.com'], ['Jerry', 'jerry2@example.com'], ['Tom', 'tom5@example.com'], ['Jerry', 'jerry3@example.com', 'jerry4@example.com'], ['Tom', 'tom6@example.com'], ['Jerry', 'jerry6@example.com'], ['Jerry', 'jerry7@example.com'], ['Jerry', 'jerry8@example.com'], ['Jerry', 'jerry9@example.com'], ['Jerry', 'jerry10@example.com'], ['Jerry', 'jerry11@example.com'], ['Tom', 'tom7@example.com'], ['Jerry', 'jerry12@example.com'], ['Tom', 'tom8@example.com'], ['Jerry', 'jerry13@example.com'], ['Tom', 'tom9@example.com'], ['Jerry', 'jerry14@example.com'], ['Tom', 'tom10@example.com'], ['Jerry', 'jerry15@example.com'], ['Tom', 'tom11@example.com'], ['Jerry', 'jerry16@example.com'], ['Tom', 'tom12@example.com'], ['Jerry', 'jerry17@example.com'], ['Tom', 'tom13@example.com'], ['Jerry', 'jerry18@example.com'], ['Tom', 'tom14@example.com'], ['Jerry', 'jerry19@example.com'], ['Tom', 'tom15@example.com'], ['Jerry', 'jerry20@example.com']]\n assert candidate(accounts = [['Alice', 'alice1@example.com', 'alice2@example.com'], ['Bob', 'bob1@example.com', 'bob2@example.com'], ['Charlie', 'charlie1@example.com', 'alice2@example.com'], ['David', 'david1@example.com', 'bob2@example.com', 'david2@example.com']]) == [['Alice', 'alice1@example.com', 'alice2@example.com', 'charlie1@example.com'], ['Bob', 'bob1@example.com', 'bob2@example.com', 'david1@example.com', 'david2@example.com']]\n assert candidate(accounts = [['Charlie', 'charlie1@example.com', 'charlie2@example.com'], ['Dave', 'dave1@example.com'], ['Charlie', 'charlie3@example.com'], ['Eve', 'eve1@example.com'], ['Charlie', 'charlie2@example.com'], ['Dave', 'dave2@example.com'], ['Eve', 'eve2@example.com', 'eve3@example.com']]) == [['Charlie', 'charlie1@example.com', 'charlie2@example.com'], ['Dave', 'dave1@example.com'], ['Charlie', 'charlie3@example.com'], ['Eve', 'eve1@example.com'], ['Dave', 'dave2@example.com'], ['Eve', 'eve2@example.com', 'eve3@example.com']]\n assert candidate(accounts = [['Anna', 'anna1@example.com'], ['Anna', 'anna2@example.com'], ['Anna', 'anna3@example.com'], ['Anna', 'anna4@example.com'], ['Anna', 'anna5@example.com'], ['Anna', 'anna6@example.com'], ['Anna', 'anna7@example.com'], ['Anna', 'anna8@example.com'], ['Anna', 'anna9@example.com']]) == [['Anna', 'anna1@example.com'], ['Anna', 'anna2@example.com'], ['Anna', 'anna3@example.com'], ['Anna', 'anna4@example.com'], ['Anna', 'anna5@example.com'], ['Anna', 'anna6@example.com'], ['Anna', 'anna7@example.com'], ['Anna', 'anna8@example.com'], ['Anna', 'anna9@example.com']]\n assert candidate(accounts = [['Alex', 'alex@example.com'], ['Alex', 'alex1@example.com'], ['Alex', 'alex2@example.com'], ['Alex', 'alex3@example.com'], ['Alex', 'alex4@example.com'], ['Alex', 'alex5@example.com']]) == [['Alex', 'alex@example.com'], ['Alex', 'alex1@example.com'], ['Alex', 'alex2@example.com'], ['Alex', 'alex3@example.com'], ['Alex', 'alex4@example.com'], ['Alex', 'alex5@example.com']]\n assert candidate(accounts = [['Eve', 'eve@example.com'], ['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com'], ['Eve', 'eve3@example.com'], ['Eve', 'eve4@example.com'], ['Eve', 'eve5@example.com'], ['Eve', 'eve6@example.com']]) == [['Eve', 'eve@example.com'], ['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com'], ['Eve', 'eve3@example.com'], ['Eve', 'eve4@example.com'], ['Eve', 'eve5@example.com'], ['Eve', 'eve6@example.com']]\n assert candidate(accounts = [['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com', 'eve3@example.com'], ['Eve', 'eve4@example.com', 'eve5@example.com'], ['Eve', 'eve6@example.com', 'eve7@example.com'], ['Eve', 'eve1@example.com', 'eve4@example.com']]) == [['Eve', 'eve1@example.com', 'eve4@example.com', 'eve5@example.com'], ['Eve', 'eve2@example.com', 'eve3@example.com'], ['Eve', 'eve6@example.com', 'eve7@example.com']]\n assert candidate(accounts = [['Will', 'will1@example.com'], ['Will', 'will2@example.com'], ['Will', 'will3@example.com'], ['Will', 'will4@example.com'], ['Will', 'will5@example.com'], ['Will', 'will6@example.com'], ['Will', 'will7@example.com'], ['Will', 'will8@example.com'], ['Will', 'will9@example.com'], ['Will', 'will10@example.com']]) == [['Will', 'will1@example.com'], ['Will', 'will2@example.com'], ['Will', 'will3@example.com'], ['Will', 'will4@example.com'], ['Will', 'will5@example.com'], ['Will', 'will6@example.com'], ['Will', 'will7@example.com'], ['Will', 'will8@example.com'], ['Will', 'will9@example.com'], ['Will', 'will10@example.com']]\n assert candidate(accounts = [['Frank', 'frank1@example.com'], ['Frank', 'frank2@example.com'], ['Grace', 'grace1@example.com'], ['Frank', 'frank3@example.com'], ['Grace', 'grace2@example.com'], ['Frank', 'frank4@example.com'], ['Grace', 'grace1@example.com'], ['Frank', 'frank5@example.com'], ['Grace', 'grace3@example.com'], ['Frank', 'frank6@example.com'], ['Grace', 'grace4@example.com'], ['Frank', 'frank1@example.com'], ['Grace', 'grace5@example.com'], ['Frank', 'frank7@example.com'], ['Grace', 'grace6@example.com']]) == [['Frank', 'frank1@example.com'], ['Frank', 'frank2@example.com'], ['Grace', 'grace1@example.com'], ['Frank', 'frank3@example.com'], ['Grace', 'grace2@example.com'], ['Frank', 'frank4@example.com'], ['Frank', 'frank5@example.com'], ['Grace', 'grace3@example.com'], ['Frank', 'frank6@example.com'], ['Grace', 'grace4@example.com'], ['Grace', 'grace5@example.com'], ['Frank', 'frank7@example.com'], ['Grace', 'grace6@example.com']]\n assert candidate(accounts = [['Mike', 'mike@example.com'], ['Nancy', 'nancy@example.com'], ['Mike', 'mike1@example.com'], ['Nancy', 'nancy1@example.com'], ['Mike', 'mike2@example.com'], ['Nancy', 'nancy2@example.com'], ['Mike', 'mike3@example.com'], ['Nancy', 'nancy3@example.com'], ['Nancy', 'mike3@example.com']]) == [['Mike', 'mike@example.com'], ['Nancy', 'nancy@example.com'], ['Mike', 'mike1@example.com'], ['Nancy', 'nancy1@example.com'], ['Mike', 'mike2@example.com'], ['Nancy', 'nancy2@example.com'], ['Mike', 'mike3@example.com'], ['Nancy', 'nancy3@example.com']]\n assert candidate(accounts = [['Frank', 'frank@example.com'], ['George', 'george@example.com'], ['Frank', 'frank1@example.com'], ['George', 'george1@example.com'], ['Frank', 'frank2@example.com'], ['George', 'george2@example.com'], ['Frank', 'george2@example.com'], ['George', 'frank2@example.com'], ['Frank', 'frank3@example.com'], ['George', 'george3@example.com']]) == [['Frank', 'frank@example.com'], ['George', 'george@example.com'], ['Frank', 'frank1@example.com'], ['George', 'george1@example.com'], ['Frank', 'frank2@example.com'], ['George', 'george2@example.com'], ['Frank', 'frank3@example.com'], ['George', 'george3@example.com']]\n assert candidate(accounts = [['Tom', 'tom1@example.com'], ['Jerry', 'jerry1@example.com'], ['Tom', 'tom2@example.com'], ['Jerry', 'jerry2@example.com'], ['Tom', 'tom3@example.com'], ['Jerry', 'jerry3@example.com'], ['Tom', 'jerry1@example.com']]) == [['Tom', 'tom1@example.com'], ['Jerry', 'jerry1@example.com'], ['Tom', 'tom2@example.com'], ['Jerry', 'jerry2@example.com'], ['Tom', 'tom3@example.com'], ['Jerry', 'jerry3@example.com']]\n assert candidate(accounts = [['Alex', 'alex@example.com', 'alex1@example.com', 'alex2@example.com'], ['Brian', 'brian@example.com', 'brian1@example.com'], ['Alex', 'alex1@example.com', 'alex3@example.com'], ['Chris', 'chris@example.com'], ['Alex', 'alex2@example.com', 'alex4@example.com'], ['Brian', 'brian2@example.com', 'alex1@example.com']]) == [['Alex', 'alex1@example.com', 'alex2@example.com', 'alex3@example.com', 'alex4@example.com', 'alex@example.com', 'brian2@example.com'], ['Brian', 'brian1@example.com', 'brian@example.com'], ['Chris', 'chris@example.com']]\n assert candidate(accounts = [['Alice', 'alice1@example.com'], ['Bob', 'bob1@example.com'], ['Alice', 'alice2@example.com'], ['Charlie', 'charlie1@example.com'], ['Alice', 'alice3@example.com'], ['Bob', 'bob2@example.com'], ['Charlie', 'charlie2@example.com']]) == [['Alice', 'alice1@example.com'], ['Bob', 'bob1@example.com'], ['Alice', 'alice2@example.com'], ['Charlie', 'charlie1@example.com'], ['Alice', 'alice3@example.com'], ['Bob', 'bob2@example.com'], ['Charlie', 'charlie2@example.com']]\n assert candidate(accounts = [['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com'], ['Eve', 'eve3@example.com'], ['Eve', 'eve4@example.com'], ['Eve', 'eve5@example.com'], ['Eve', 'eve6@example.com'], ['Eve', 'eve7@example.com'], ['Eve', 'eve8@example.com'], ['Eve', 'eve9@example.com'], ['Eve', 'eve10@example.com']]) == [['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com'], ['Eve', 'eve3@example.com'], ['Eve', 'eve4@example.com'], ['Eve', 'eve5@example.com'], ['Eve', 'eve6@example.com'], ['Eve', 'eve7@example.com'], ['Eve', 'eve8@example.com'], ['Eve', 'eve9@example.com'], ['Eve', 'eve10@example.com']]\n assert candidate(accounts = [['Sarah', 'sarah1@example.com'], ['Sarah', 'sarah2@example.com'], ['Michael', 'michael1@example.com', 'michael2@example.com'], ['Sarah', 'sarah3@example.com'], ['Michael', 'michael3@example.com'], ['Sarah', 'sarah1@example.com']]) == [['Sarah', 'sarah1@example.com'], ['Sarah', 'sarah2@example.com'], ['Michael', 'michael1@example.com', 'michael2@example.com'], ['Sarah', 'sarah3@example.com'], ['Michael', 'michael3@example.com']]\n assert candidate(accounts = [['Mike', 'mike1@example.com'], ['Mike', 'mike2@example.com'], ['Nina', 'nina1@example.com'], ['Nina', 'nina2@example.com'], ['Nina', 'mike2@example.com'], ['Nina', 'nina3@example.com'], ['Nina', 'mike1@example.com']]) == [['Mike', 'mike1@example.com'], ['Mike', 'mike2@example.com'], ['Nina', 'nina1@example.com'], ['Nina', 'nina2@example.com'], ['Nina', 'nina3@example.com']]\n assert candidate(accounts = [['Tom', 'tom1@example.com'], ['Jerry', 'jerry1@example.com'], ['Tom', 'tom2@example.com'], ['Jerry', 'jerry2@example.com'], ['Tom', 'tom1@example.com'], ['Jerry', 'jerry1@example.com'], ['Tom', 'tom3@example.com'], ['Jerry', 'jerry3@example.com']]) == [['Tom', 'tom1@example.com'], ['Jerry', 'jerry1@example.com'], ['Tom', 'tom2@example.com'], ['Jerry', 'jerry2@example.com'], ['Tom', 'tom3@example.com'], ['Jerry', 'jerry3@example.com']]\n assert candidate(accounts = [['Alex', 'alex1@example.com', 'alex2@example.com'], ['Bob', 'bob1@example.com'], ['Alex', 'alex3@example.com', 'alex4@example.com'], ['Charlie', 'charlie1@example.com'], ['Alex', 'alex1@example.com', 'alex5@example.com'], ['Bob', 'bob2@example.com', 'bob3@example.com']]) == [['Alex', 'alex1@example.com', 'alex2@example.com', 'alex5@example.com'], ['Bob', 'bob1@example.com'], ['Alex', 'alex3@example.com', 'alex4@example.com'], ['Charlie', 'charlie1@example.com'], ['Bob', 'bob2@example.com', 'bob3@example.com']]\n assert candidate(accounts = [['Sam', 'sam1@example.com'], ['Sam', 'sam2@example.com'], ['Max', 'max1@example.com'], ['Max', 'max2@example.com'], ['Max', 'sam1@example.com'], ['Sam', 'max3@example.com']]) == [['Sam', 'sam1@example.com'], ['Sam', 'sam2@example.com'], ['Max', 'max1@example.com'], ['Max', 'max2@example.com'], ['Sam', 'max3@example.com']]\n assert candidate(accounts = [['Leo', 'leo1@example.com'], ['Mike', 'mike1@example.com'], ['Leo', 'leo2@example.com'], ['Mike', 'mike2@example.com'], ['Leo', 'leo3@example.com'], ['Mike', 'mike3@example.com'], ['Leo', 'mike1@example.com'], ['Mike', 'leo2@example.com'], ['Leo', 'leo4@example.com'], ['Mike', 'mike4@example.com']]) == [['Leo', 'leo1@example.com'], ['Mike', 'mike1@example.com'], ['Leo', 'leo2@example.com'], ['Mike', 'mike2@example.com'], ['Leo', 'leo3@example.com'], ['Mike', 'mike3@example.com'], ['Leo', 'leo4@example.com'], ['Mike', 'mike4@example.com']]\n assert candidate(accounts = [['Frank', 'frank1@example.com'], ['George', 'george1@example.com'], ['Frank', 'frank2@example.com'], ['George', 'george2@example.com'], ['Frank', 'george1@example.com'], ['Hannah', 'hannah1@example.com'], ['Hannah', 'hannah2@example.com'], ['George', 'frank2@example.com']]) == [['Frank', 'frank1@example.com'], ['George', 'george1@example.com'], ['Frank', 'frank2@example.com'], ['George', 'george2@example.com'], ['Hannah', 'hannah1@example.com'], ['Hannah', 'hannah2@example.com']]\n assert candidate(accounts = [['David', 'david@example.com'], ['David', 'david1@example.com'], ['David', 'david2@example.com'], ['David', 'david3@example.com'], ['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com'], ['David', 'david4@example.com'], ['Eve', 'eve3@example.com'], ['David', 'david5@example.com'], ['Eve', 'eve4@example.com']]) == [['David', 'david@example.com'], ['David', 'david1@example.com'], ['David', 'david2@example.com'], ['David', 'david3@example.com'], ['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com'], ['David', 'david4@example.com'], ['Eve', 'eve3@example.com'], ['David', 'david5@example.com'], ['Eve', 'eve4@example.com']]\n assert candidate(accounts = [['Alex', 'alex1@leetcode.com', 'alex2@leetcode.com'], ['Ethan', 'ethan@leetcode.com'], ['Alex', 'alex1@leetcode.com', 'alex3@leetcode.com'], ['John', 'john@leetcode.com'], ['John', 'john1@leetcode.com', 'john2@leetcode.com'], ['Ethan', 'ethan1@leetcode.com', 'ethan@leetcode.com']]) == [['Alex', 'alex1@leetcode.com', 'alex2@leetcode.com', 'alex3@leetcode.com'], ['Ethan', 'ethan1@leetcode.com', 'ethan@leetcode.com'], ['John', 'john@leetcode.com'], ['John', 'john1@leetcode.com', 'john2@leetcode.com']]\n assert candidate(accounts = [['Alex', 'alex1@example.com', 'alex2@example.com'], ['Alex', 'alex3@example.com', 'alex4@example.com'], ['Alex', 'alex1@example.com', 'alex5@example.com'], ['Bob', 'bob1@example.com', 'bob2@example.com'], ['Bob', 'bob3@example.com', 'bob1@example.com'], ['Charlie', 'charlie1@example.com'], ['Charlie', 'charlie1@example.com', 'charlie2@example.com'], ['David', 'david1@example.com', 'david2@example.com'], ['David', 'david3@example.com', 'david1@example.com']]) == [['Alex', 'alex1@example.com', 'alex2@example.com', 'alex5@example.com'], ['Alex', 'alex3@example.com', 'alex4@example.com'], ['Bob', 'bob1@example.com', 'bob2@example.com', 'bob3@example.com'], ['Charlie', 'charlie1@example.com', 'charlie2@example.com'], ['David', 'david1@example.com', 'david2@example.com', 'david3@example.com']]\n assert candidate(accounts = [['Alice', 'alice1@example.com'], ['Bob', 'bob1@example.com'], ['Alice', 'alice2@example.com'], ['Alice', 'alice3@example.com'], ['Bob', 'bob2@example.com'], ['Charlie', 'charlie1@example.com'], ['Charlie', 'charlie2@example.com'], ['Bob', 'bob3@example.com'], ['Charlie', 'charlie3@example.com']]) == [['Alice', 'alice1@example.com'], ['Bob', 'bob1@example.com'], ['Alice', 'alice2@example.com'], ['Alice', 'alice3@example.com'], ['Bob', 'bob2@example.com'], ['Charlie', 'charlie1@example.com'], ['Charlie', 'charlie2@example.com'], ['Bob', 'bob3@example.com'], ['Charlie', 'charlie3@example.com']]\n assert candidate(accounts = [['Nina', 'nina1@example.com'], ['Oscar', 'oscar1@example.com'], ['Nina', 'nina2@example.com'], ['Oscar', 'oscar2@example.com'], ['Nina', 'nina3@example.com'], ['Oscar', 'oscar3@example.com'], ['Nina', 'oscar1@example.com'], ['Oscar', 'nina2@example.com'], ['Nina', 'nina4@example.com'], ['Oscar', 'oscar4@example.com'], ['Nina', 'nina5@example.com'], ['Oscar', 'oscar5@example.com']]) == [['Nina', 'nina1@example.com'], ['Oscar', 'oscar1@example.com'], ['Nina', 'nina2@example.com'], ['Oscar', 'oscar2@example.com'], ['Nina', 'nina3@example.com'], ['Oscar', 'oscar3@example.com'], ['Nina', 'nina4@example.com'], ['Oscar', 'oscar4@example.com'], ['Nina', 'nina5@example.com'], ['Oscar', 'oscar5@example.com']]\n assert candidate(accounts = [['Mike', 'mike1@example.com'], ['Mike', 'mike2@example.com'], ['Mike', 'mike3@example.com'], ['Nancy', 'nancy1@example.com'], ['Nancy', 'nancy2@example.com'], ['Nancy', 'nancy3@example.com'], ['Mike', 'mike4@example.com', 'nancy1@example.com'], ['Mike', 'mike5@example.com'], ['Nancy', 'nancy4@example.com']]) == [['Mike', 'mike1@example.com'], ['Mike', 'mike2@example.com'], ['Mike', 'mike3@example.com'], ['Nancy', 'mike4@example.com', 'nancy1@example.com'], ['Nancy', 'nancy2@example.com'], ['Nancy', 'nancy3@example.com'], ['Mike', 'mike5@example.com'], ['Nancy', 'nancy4@example.com']]\n assert candidate(accounts = [['Anna', 'anna1@example.com'], ['Anna', 'anna2@example.com'], ['Anna', 'anna3@example.com'], ['Tom', 'tom1@example.com'], ['Tom', 'tom2@example.com'], ['Anna', 'tom1@example.com'], ['Anna', 'tom2@example.com'], ['Tom', 'anna1@example.com'], ['Tom', 'anna2@example.com']]) == [['Anna', 'anna1@example.com'], ['Anna', 'anna2@example.com'], ['Anna', 'anna3@example.com'], ['Tom', 'tom1@example.com'], ['Tom', 'tom2@example.com']]\n assert candidate(accounts = [['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com'], ['Eve', 'eve3@example.com'], ['Frank', 'frank1@example.com'], ['Eve', 'frank1@example.com'], ['Eve', 'eve4@example.com']]) == [['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com'], ['Eve', 'eve3@example.com'], ['Frank', 'frank1@example.com'], ['Eve', 'eve4@example.com']]\n assert candidate(accounts = [['Amy', 'amy@uni.edu'], ['Dan', 'dan_jones@uni.edu', 'dan_thomas@uni.edu'], ['Mark', 'mark@uni.edu'], ['Amy', 'amy@uni.edu'], ['John', 'john@uni.edu', 'john_newyork@uni.edu'], ['Dan', 'dan_jones@uni.edu', 'dan@uni.edu']]) == [['Amy', 'amy@uni.edu'], ['Dan', 'dan@uni.edu', 'dan_jones@uni.edu', 'dan_thomas@uni.edu'], ['Mark', 'mark@uni.edu'], ['John', 'john@uni.edu', 'john_newyork@uni.edu']]\n assert candidate(accounts = [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris7@example.com'], ['Chris', 'chris8@example.com'], ['Chris', 'chris9@example.com'], ['Chris', 'chris10@example.com'], ['Chris', 'chris11@example.com'], ['Chris', 'chris12@example.com'], ['Chris', 'chris13@example.com'], ['Chris', 'chris14@example.com'], ['Chris', 'chris15@example.com']]) == [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris7@example.com'], ['Chris', 'chris8@example.com'], ['Chris', 'chris9@example.com'], ['Chris', 'chris10@example.com'], ['Chris', 'chris11@example.com'], ['Chris', 'chris12@example.com'], ['Chris', 'chris13@example.com'], ['Chris', 'chris14@example.com'], ['Chris', 'chris15@example.com']]\n assert candidate(accounts = [['Lisa', 'lisa1@example.com'], ['Lisa', 'lisa2@example.com', 'lisa3@example.com'], ['Lisa', 'lisa4@example.com', 'lisa5@example.com'], ['Lisa', 'lisa6@example.com', 'lisa7@example.com', 'lisa8@example.com'], ['Lisa', 'lisa9@example.com', 'lisa10@example.com', 'lisa11@example.com', 'lisa12@example.com'], ['Lisa', 'lisa13@example.com', 'lisa14@example.com', 'lisa15@example.com', 'lisa16@example.com', 'lisa17@example.com'], ['Lisa', 'lisa18@example.com', 'lisa19@example.com', 'lisa20@example.com', 'lisa21@example.com', 'lisa22@example.com', 'lisa23@example.com']]) == [['Lisa', 'lisa1@example.com'], ['Lisa', 'lisa2@example.com', 'lisa3@example.com'], ['Lisa', 'lisa4@example.com', 'lisa5@example.com'], ['Lisa', 'lisa6@example.com', 'lisa7@example.com', 'lisa8@example.com'], ['Lisa', 'lisa10@example.com', 'lisa11@example.com', 'lisa12@example.com', 'lisa9@example.com'], ['Lisa', 'lisa13@example.com', 'lisa14@example.com', 'lisa15@example.com', 'lisa16@example.com', 'lisa17@example.com'], ['Lisa', 'lisa18@example.com', 'lisa19@example.com', 'lisa20@example.com', 'lisa21@example.com', 'lisa22@example.com', 'lisa23@example.com']]\n assert candidate(accounts = [['Chris', 'chris1@example.com', 'chris2@example.com'], ['Chris', 'chris2@example.com', 'chris3@example.com'], ['Chris', 'chris4@example.com', 'chris5@example.com'], ['Chris', 'chris3@example.com', 'chris6@example.com']]) == [['Chris', 'chris1@example.com', 'chris2@example.com', 'chris3@example.com', 'chris6@example.com'], ['Chris', 'chris4@example.com', 'chris5@example.com']]\n assert candidate(accounts = [['Anna', 'anna1@example.com', 'anna2@example.com'], ['Bob', 'bob1@example.com', 'bob2@example.com'], ['Charlie', 'charlie1@example.com', 'bob2@example.com'], ['Anna', 'anna3@example.com'], ['David', 'david1@example.com', 'david2@example.com', 'anna2@example.com']]) == [['Anna', 'anna1@example.com', 'anna2@example.com', 'david1@example.com', 'david2@example.com'], ['Bob', 'bob1@example.com', 'bob2@example.com', 'charlie1@example.com'], ['Anna', 'anna3@example.com']]\n assert candidate(accounts = [['Tom', 'tom1@example.com', 'tom2@example.com'], ['Jerry', 'jerry1@example.com'], ['Spike', 'spike1@example.com'], ['Tyke', 'tyke1@example.com'], ['Tyke', 'tyke2@example.com', 'tyke3@example.com'], ['Tyke', 'tyke4@example.com'], ['Tyke', 'tyke5@example.com', 'tyke3@example.com'], ['Tyke', 'tyke6@example.com', 'tyke4@example.com'], ['Tom', 'tom3@example.com', 'tyke1@example.com'], ['Tom', 'tom4@example.com'], ['Jerry', 'jerry2@example.com', 'jerry3@example.com']]) == [['Tom', 'tom1@example.com', 'tom2@example.com'], ['Jerry', 'jerry1@example.com'], ['Spike', 'spike1@example.com'], ['Tyke', 'tom3@example.com', 'tyke1@example.com'], ['Tyke', 'tyke2@example.com', 'tyke3@example.com', 'tyke5@example.com'], ['Tyke', 'tyke4@example.com', 'tyke6@example.com'], ['Tom', 'tom4@example.com'], ['Jerry', 'jerry2@example.com', 'jerry3@example.com']]\n assert candidate(accounts = [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris7@example.com'], ['Chris', 'chris8@example.com'], ['Chris', 'chris9@example.com'], ['Chris', 'chris1@example.com'], ['Chris', 'chris11@example.com'], ['Chris', 'chris12@example.com'], ['Chris', 'chris13@example.com'], ['Chris', 'chris14@example.com'], ['Chris', 'chris15@example.com'], ['Chris', 'chris16@example.com'], ['Chris', 'chris17@example.com'], ['Chris', 'chris18@example.com'], ['Chris', 'chris19@example.com'], ['Chris', 'chris20@example.com']]) == [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris7@example.com'], ['Chris', 'chris8@example.com'], ['Chris', 'chris9@example.com'], ['Chris', 'chris11@example.com'], ['Chris', 'chris12@example.com'], ['Chris', 'chris13@example.com'], ['Chris', 'chris14@example.com'], ['Chris', 'chris15@example.com'], ['Chris', 'chris16@example.com'], ['Chris', 'chris17@example.com'], ['Chris', 'chris18@example.com'], ['Chris', 'chris19@example.com'], ['Chris', 'chris20@example.com']]\n assert candidate(accounts = [['Ivan', 'ivan1@example.com'], ['Jack', 'jack1@example.com'], ['Ivan', 'ivan2@example.com'], ['Jack', 'jack2@example.com'], ['Ivan', 'ivan3@example.com', 'jack1@example.com'], ['Jack', 'jack3@example.com'], ['Jack', 'ivan1@example.com'], ['Kate', 'kate1@example.com', 'kate2@example.com']]) == [['Ivan', 'ivan1@example.com'], ['Jack', 'ivan3@example.com', 'jack1@example.com'], ['Ivan', 'ivan2@example.com'], ['Jack', 'jack2@example.com'], ['Jack', 'jack3@example.com'], ['Kate', 'kate1@example.com', 'kate2@example.com']]\n assert candidate(accounts = [['Anna', 'anna1@example.com'], ['Anna', 'anna2@example.com'], ['Anna', 'anna3@example.com'], ['Anna', 'anna1@example.com'], ['Anna', 'anna4@example.com'], ['Anna', 'anna2@example.com'], ['Anna', 'anna5@example.com'], ['Anna', 'anna3@example.com'], ['Anna', 'anna6@example.com']]) == [['Anna', 'anna1@example.com'], ['Anna', 'anna2@example.com'], ['Anna', 'anna3@example.com'], ['Anna', 'anna4@example.com'], ['Anna', 'anna5@example.com'], ['Anna', 'anna6@example.com']]\n assert candidate(accounts = [['Alex', 'alex1@example.com', 'alex2@example.com'], ['Alex', 'alex3@example.com'], ['Brian', 'brian1@example.com'], ['Alex', 'alex2@example.com'], ['Brian', 'brian2@example.com'], ['Alex', 'alex4@example.com'], ['Brian', 'brian1@example.com', 'brian3@example.com']]) == [['Alex', 'alex1@example.com', 'alex2@example.com'], ['Alex', 'alex3@example.com'], ['Brian', 'brian1@example.com', 'brian3@example.com'], ['Brian', 'brian2@example.com'], ['Alex', 'alex4@example.com']]\n assert candidate(accounts = [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com']]) == [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com']]\n assert candidate(accounts = [['Charlie', 'charlie@example.com'], ['Charlie', 'charlie1@example.com'], ['Charlie', 'charlie2@example.com'], ['David', 'david@example.com'], ['David', 'charlie1@example.com'], ['David', 'david1@example.com']]) == [['Charlie', 'charlie@example.com'], ['Charlie', 'charlie1@example.com'], ['Charlie', 'charlie2@example.com'], ['David', 'david@example.com'], ['David', 'david1@example.com']]\n assert candidate(accounts = [['Alice', 'alice1@company.com'], ['Bob', 'bob1@company.com'], ['Alice', 'alice2@company.com'], ['Alice', 'alice3@company.com'], ['Bob', 'bob2@company.com'], ['Alice', 'alice1@company.com'], ['Bob', 'bob1@company.com']]) == [['Alice', 'alice1@company.com'], ['Bob', 'bob1@company.com'], ['Alice', 'alice2@company.com'], ['Alice', 'alice3@company.com'], ['Bob', 'bob2@company.com']]\n assert candidate(accounts = [['Anna', 'anna1@example.com'], ['Anna', 'anna2@example.com'], ['Anna', 'anna3@example.com'], ['Anna', 'anna1@example.com'], ['Anna', 'anna4@example.com'], ['Anna', 'anna2@example.com']]) == [['Anna', 'anna1@example.com'], ['Anna', 'anna2@example.com'], ['Anna', 'anna3@example.com'], ['Anna', 'anna4@example.com']]\n assert candidate(accounts = [['Sam', 'sam@example.com'], ['Tom', 'tom@example.com'], ['Sam', 'sam1@example.com'], ['Tom', 'tom1@example.com'], ['Sam', 'sam2@example.com'], ['Tom', 'tom2@example.com'], ['Sam', 'sam3@example.com'], ['Tom', 'tom3@example.com'], ['Sam', 'sam4@example.com'], ['Tom', 'tom4@example.com'], ['Sam', 'tom4@example.com'], ['Tom', 'sam4@example.com']]) == [['Sam', 'sam@example.com'], ['Tom', 'tom@example.com'], ['Sam', 'sam1@example.com'], ['Tom', 'tom1@example.com'], ['Sam', 'sam2@example.com'], ['Tom', 'tom2@example.com'], ['Sam', 'sam3@example.com'], ['Tom', 'tom3@example.com'], ['Sam', 'sam4@example.com'], ['Tom', 'tom4@example.com']]\n assert candidate(accounts = [['John', 'john1@example.com'], ['John', 'john2@example.com'], ['John', 'john3@example.com'], ['John', 'john4@example.com'], ['John', 'john5@example.com'], ['John', 'john6@example.com'], ['John', 'john7@example.com'], ['John', 'john8@example.com'], ['John', 'john9@example.com'], ['John', 'john10@example.com'], ['John', 'john11@example.com'], ['John', 'john12@example.com'], ['John', 'john13@example.com'], ['John', 'john14@example.com'], ['John', 'john15@example.com'], ['John', 'john16@example.com'], ['John', 'john17@example.com'], ['John', 'john18@example.com'], ['John', 'john19@example.com'], ['John', 'john20@example.com'], ['John', 'john21@example.com'], ['John', 'john22@example.com'], ['John', 'john23@example.com'], ['John', 'john24@example.com'], ['John', 'john25@example.com']]) == [['John', 'john1@example.com'], ['John', 'john2@example.com'], ['John', 'john3@example.com'], ['John', 'john4@example.com'], ['John', 'john5@example.com'], ['John', 'john6@example.com'], ['John', 'john7@example.com'], ['John', 'john8@example.com'], ['John', 'john9@example.com'], ['John', 'john10@example.com'], ['John', 'john11@example.com'], ['John', 'john12@example.com'], ['John', 'john13@example.com'], ['John', 'john14@example.com'], ['John', 'john15@example.com'], ['John', 'john16@example.com'], ['John', 'john17@example.com'], ['John', 'john18@example.com'], ['John', 'john19@example.com'], ['John', 'john20@example.com'], ['John', 'john21@example.com'], ['John', 'john22@example.com'], ['John', 'john23@example.com'], ['John', 'john24@example.com'], ['John', 'john25@example.com']]\n assert candidate(accounts = [['Greg', 'greg1@example.com'], ['Greg', 'greg2@example.com'], ['Greg', 'greg3@example.com'], ['Greg', 'greg4@example.com'], ['Greg', 'greg5@example.com'], ['Greg', 'greg6@example.com'], ['Greg', 'greg7@example.com'], ['Greg', 'greg8@example.com'], ['Greg', 'greg9@example.com'], ['Greg', 'greg10@example.com']]) == [['Greg', 'greg1@example.com'], ['Greg', 'greg2@example.com'], ['Greg', 'greg3@example.com'], ['Greg', 'greg4@example.com'], ['Greg', 'greg5@example.com'], ['Greg', 'greg6@example.com'], ['Greg', 'greg7@example.com'], ['Greg', 'greg8@example.com'], ['Greg', 'greg9@example.com'], ['Greg', 'greg10@example.com']]\n assert candidate(accounts = [['Mike', 'mike1@example.com'], ['Mike', 'mike2@example.com'], ['Anna', 'anna1@example.com'], ['Anna', 'anna2@example.com'], ['Mike', 'mike3@example.com'], ['Anna', 'anna3@example.com'], ['Mike', 'mike1@example.com'], ['Anna', 'anna4@example.com']]) == [['Mike', 'mike1@example.com'], ['Mike', 'mike2@example.com'], ['Anna', 'anna1@example.com'], ['Anna', 'anna2@example.com'], ['Mike', 'mike3@example.com'], ['Anna', 'anna3@example.com'], ['Anna', 'anna4@example.com']]\n assert candidate(accounts = [['Sam', 'sam1@example.com'], ['Sam', 'sam2@example.com', 'sam3@example.com'], ['Sam', 'sam4@example.com'], ['Sam', 'sam5@example.com', 'sam6@example.com'], ['Sam', 'sam7@example.com'], ['Sam', 'sam1@example.com', 'sam8@example.com'], ['Sam', 'sam9@example.com', 'sam5@example.com']]) == [['Sam', 'sam1@example.com', 'sam8@example.com'], ['Sam', 'sam2@example.com', 'sam3@example.com'], ['Sam', 'sam4@example.com'], ['Sam', 'sam5@example.com', 'sam6@example.com', 'sam9@example.com'], ['Sam', 'sam7@example.com']]\n assert candidate(accounts = [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris7@example.com'], ['Chris', 'chris8@example.com'], ['Chris', 'chris9@example.com'], ['Chris', 'chris10@example.com'], ['Chris', 'chris11@example.com'], ['Chris', 'chris12@example.com'], ['Chris', 'chris13@example.com'], ['Chris', 'chris14@example.com'], ['Chris', 'chris15@example.com'], ['Chris', 'chris16@example.com'], ['Chris', 'chris17@example.com'], ['Chris', 'chris18@example.com'], ['Chris', 'chris19@example.com'], ['Chris', 'chris20@example.com']]) == [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris7@example.com'], ['Chris', 'chris8@example.com'], ['Chris', 'chris9@example.com'], ['Chris', 'chris10@example.com'], ['Chris', 'chris11@example.com'], ['Chris', 'chris12@example.com'], ['Chris', 'chris13@example.com'], ['Chris', 'chris14@example.com'], ['Chris', 'chris15@example.com'], ['Chris', 'chris16@example.com'], ['Chris', 'chris17@example.com'], ['Chris', 'chris18@example.com'], ['Chris', 'chris19@example.com'], ['Chris', 'chris20@example.com']]\n assert candidate(accounts = [['Alice', 'alice1@example.com', 'alice2@example.com'], ['Bob', 'bob1@example.com', 'alice2@example.com'], ['Charlie', 'charlie1@example.com'], ['Alice', 'alice3@example.com'], ['Bob', 'bob2@example.com', 'bob3@example.com'], ['Bob', 'bob3@example.com', 'charlie1@example.com']]) == [['Alice', 'alice1@example.com', 'alice2@example.com', 'bob1@example.com'], ['Bob', 'bob2@example.com', 'bob3@example.com', 'charlie1@example.com'], ['Alice', 'alice3@example.com']]\n assert candidate(accounts = [['Liam', 'liam1@example.com'], ['Noah', 'noah1@example.com'], ['Olivia', 'olivia1@example.com'], ['Emma', 'emma1@example.com'], ['Ava', 'ava1@example.com'], ['Sophia', 'sophia1@example.com'], ['Isabella', 'isabella1@example.com'], ['Mia', 'mia1@example.com'], ['Liam', 'liam2@example.com'], ['Noah', 'noah2@example.com'], ['Olivia', 'olivia2@example.com'], ['Emma', 'emma2@example.com'], ['Ava', 'ava2@example.com'], ['Sophia', 'sophia2@example.com'], ['Isabella', 'isabella2@example.com'], ['Mia', 'mia2@example.com'], ['Liam', 'liam3@example.com'], ['Noah', 'noah3@example.com'], ['Olivia', 'olivia3@example.com'], ['Emma', 'emma3@example.com'], ['Ava', 'ava3@example.com'], ['Sophia', 'sophia3@example.com'], ['Isabella', 'isabella3@example.com'], ['Mia', 'mia3@example.com']]) == [['Liam', 'liam1@example.com'], ['Noah', 'noah1@example.com'], ['Olivia', 'olivia1@example.com'], ['Emma', 'emma1@example.com'], ['Ava', 'ava1@example.com'], ['Sophia', 'sophia1@example.com'], ['Isabella', 'isabella1@example.com'], ['Mia', 'mia1@example.com'], ['Liam', 'liam2@example.com'], ['Noah', 'noah2@example.com'], ['Olivia', 'olivia2@example.com'], ['Emma', 'emma2@example.com'], ['Ava', 'ava2@example.com'], ['Sophia', 'sophia2@example.com'], ['Isabella', 'isabella2@example.com'], ['Mia', 'mia2@example.com'], ['Liam', 'liam3@example.com'], ['Noah', 'noah3@example.com'], ['Olivia', 'olivia3@example.com'], ['Emma', 'emma3@example.com'], ['Ava', 'ava3@example.com'], ['Sophia', 'sophia3@example.com'], ['Isabella', 'isabella3@example.com'], ['Mia', 'mia3@example.com']]\n assert candidate(accounts = [['Sam', 'sam1@example.com'], ['Tom', 'tom1@example.com', 'tom2@example.com'], ['Sam', 'sam2@example.com'], ['Tom', 'tom3@example.com'], ['Sam', 'sam3@example.com'], ['Sam', 'sam4@example.com'], ['Tom', 'tom2@example.com'], ['Sam', 'sam2@example.com']]) == [['Sam', 'sam1@example.com'], ['Tom', 'tom1@example.com', 'tom2@example.com'], ['Sam', 'sam2@example.com'], ['Tom', 'tom3@example.com'], ['Sam', 'sam3@example.com'], ['Sam', 'sam4@example.com']]\n assert candidate(accounts = [['Emily', 'emily1@example.com'], ['Emily', 'emily2@example.com'], ['Laura', 'laura1@example.com'], ['Laura', 'laura2@example.com'], ['Emily', 'emily3@example.com'], ['Laura', 'laura3@example.com'], ['Emily', 'emily1@example.com'], ['Laura', 'laura1@example.com']]) == [['Emily', 'emily1@example.com'], ['Emily', 'emily2@example.com'], ['Laura', 'laura1@example.com'], ['Laura', 'laura2@example.com'], ['Emily', 'emily3@example.com'], ['Laura', 'laura3@example.com']]\n assert candidate(accounts = [['Alice', 'alice1@example.com', 'alice2@example.com'], ['Alice', 'alice3@example.com', 'alice4@example.com'], ['Bob', 'bob1@example.com', 'bob2@example.com'], ['Bob', 'bob3@example.com', 'bob1@example.com'], ['Charlie', 'charlie1@example.com'], ['Charlie', 'charlie1@example.com', 'charlie2@example.com']]) == [['Alice', 'alice1@example.com', 'alice2@example.com'], ['Alice', 'alice3@example.com', 'alice4@example.com'], ['Bob', 'bob1@example.com', 'bob2@example.com', 'bob3@example.com'], ['Charlie', 'charlie1@example.com', 'charlie2@example.com']]\n assert candidate(accounts = [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris7@example.com'], ['Chris', 'chris8@example.com'], ['Chris', 'chris9@example.com'], ['Chris', 'chris10@example.com']]) == [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris7@example.com'], ['Chris', 'chris8@example.com'], ['Chris', 'chris9@example.com'], ['Chris', 'chris10@example.com']]\n assert candidate(accounts = [['Ivan', 'ivan1@example.com'], ['Ivan', 'ivan2@example.com'], ['Jack', 'jack1@example.com'], ['Ivan', 'jack1@example.com'], ['Jack', 'jack2@example.com'], ['Jack', 'ivan2@example.com']]) == [['Ivan', 'ivan1@example.com'], ['Ivan', 'ivan2@example.com'], ['Jack', 'jack1@example.com'], ['Jack', 'jack2@example.com']]\n assert candidate(accounts = [['Emma', 'emma1@example.com'], ['Emma', 'emma2@example.com'], ['Olivia', 'olivia1@example.com'], ['Olivia', 'olivia2@example.com'], ['Emma', 'olivia1@example.com'], ['Olivia', 'emma1@example.com'], ['Olivia', 'emma2@example.com'], ['Emma', 'olivia2@example.com'], ['Ava', 'ava1@example.com'], ['Ava', 'ava2@example.com'], ['Ava', 'ava3@example.com']]) == [['Emma', 'emma1@example.com'], ['Emma', 'emma2@example.com'], ['Olivia', 'olivia1@example.com'], ['Olivia', 'olivia2@example.com'], ['Ava', 'ava1@example.com'], ['Ava', 'ava2@example.com'], ['Ava', 'ava3@example.com']]\n assert candidate(accounts = [['Mike', 'mike1@example.com'], ['Mike', 'mike2@example.com'], ['Mike', 'mike3@example.com'], ['Mike', 'mike4@example.com'], ['Mike', 'mike5@example.com'], ['Mike', 'mike6@example.com'], ['Mike', 'mike7@example.com'], ['Mike', 'mike8@example.com'], ['Mike', 'mike9@example.com']]) == [['Mike', 'mike1@example.com'], ['Mike', 'mike2@example.com'], ['Mike', 'mike3@example.com'], ['Mike', 'mike4@example.com'], ['Mike', 'mike5@example.com'], ['Mike', 'mike6@example.com'], ['Mike', 'mike7@example.com'], ['Mike', 'mike8@example.com'], ['Mike', 'mike9@example.com']]\n assert candidate(accounts = [['Eve', 'eve1@example.com', 'eve2@example.com'], ['Eve', 'eve3@example.com'], ['Eve', 'eve1@example.com', 'eve4@example.com'], ['Eve', 'eve2@example.com', 'eve5@example.com'], ['Eve', 'eve3@example.com', 'eve6@example.com']]) == [['Eve', 'eve1@example.com', 'eve2@example.com', 'eve4@example.com', 'eve5@example.com'], ['Eve', 'eve3@example.com', 'eve6@example.com']]\n assert candidate(accounts = [['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com', 'eve3@example.com'], ['Eve', 'eve4@example.com'], ['Eve', 'eve5@example.com', 'eve3@example.com'], ['Eve', 'eve6@example.com', 'eve4@example.com'], ['Eve', 'eve7@example.com']]) == [['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com', 'eve3@example.com', 'eve5@example.com'], ['Eve', 'eve4@example.com', 'eve6@example.com'], ['Eve', 'eve7@example.com']]\n assert candidate(accounts = [['Alex', 'alex1@example.com'], ['Alex', 'alex2@example.com'], ['Alex', 'alex3@example.com'], ['Alex', 'alex4@example.com'], ['Alex', 'alex5@example.com'], ['Alex', 'alex6@example.com'], ['Alex', 'alex7@example.com']]) == [['Alex', 'alex1@example.com'], ['Alex', 'alex2@example.com'], ['Alex', 'alex3@example.com'], ['Alex', 'alex4@example.com'], ['Alex', 'alex5@example.com'], ['Alex', 'alex6@example.com'], ['Alex', 'alex7@example.com']]\n assert candidate(accounts = [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris1@example.com']]) == [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com']]\n assert candidate(accounts = [['Alice', 'alice1@example.com', 'alice2@example.com'], ['Bob', 'bob1@example.com', 'bob2@example.com'], ['Alice', 'alice3@example.com', 'bob1@example.com'], ['Charlie', 'charlie1@example.com'], ['Bob', 'bob3@example.com', 'alice1@example.com']]) == [['Alice', 'alice1@example.com', 'alice2@example.com', 'bob3@example.com'], ['Bob', 'alice3@example.com', 'bob1@example.com', 'bob2@example.com'], ['Charlie', 'charlie1@example.com']]\n assert candidate(accounts = [['Oscar', 'oscar1@example.com'], ['Oscar', 'oscar2@example.com'], ['Paul', 'paul1@example.com'], ['Paul', 'paul2@example.com'], ['Paul', 'oscar2@example.com'], ['Paul', 'paul3@example.com'], ['Paul', 'oscar1@example.com'], ['Paul', 'oscar3@example.com']]) == [['Oscar', 'oscar1@example.com'], ['Oscar', 'oscar2@example.com'], ['Paul', 'paul1@example.com'], ['Paul', 'paul2@example.com'], ['Paul', 'paul3@example.com'], ['Paul', 'oscar3@example.com']]\n assert candidate(accounts = [['Alex', 'alex1@example.com', 'alex2@example.com'], ['Steve', 'steve1@example.com'], ['Alex', 'alex3@example.com'], ['Steve', 'steve2@example.com', 'steve3@example.com'], ['Alex', 'alex1@example.com']]) == [['Alex', 'alex1@example.com', 'alex2@example.com'], ['Steve', 'steve1@example.com'], ['Alex', 'alex3@example.com'], ['Steve', 'steve2@example.com', 'steve3@example.com']]\n assert candidate(accounts = [['James', 'james1@example.com'], ['James', 'james2@example.com'], ['James', 'james3@example.com'], ['James', 'james4@example.com'], ['James', 'james5@example.com'], ['James', 'james6@example.com'], ['James', 'james7@example.com'], ['James', 'james8@example.com'], ['James', 'james9@example.com'], ['James', 'james10@example.com'], ['James', 'james11@example.com'], ['James', 'james12@example.com'], ['James', 'james13@example.com'], ['James', 'james14@example.com'], ['James', 'james15@example.com'], ['James', 'james16@example.com'], ['James', 'james17@example.com'], ['James', 'james18@example.com'], ['James', 'james19@example.com'], ['James', 'james20@example.com'], ['James', 'james21@example.com'], ['James', 'james22@example.com'], ['James', 'james23@example.com'], ['James', 'james24@example.com'], ['James', 'james25@example.com'], ['James', 'james26@example.com'], ['James', 'james27@example.com'], ['James', 'james28@example.com'], ['James', 'james29@example.com'], ['James', 'james30@example.com']]) == [['James', 'james1@example.com'], ['James', 'james2@example.com'], ['James', 'james3@example.com'], ['James', 'james4@example.com'], ['James', 'james5@example.com'], ['James', 'james6@example.com'], ['James', 'james7@example.com'], ['James', 'james8@example.com'], ['James', 'james9@example.com'], ['James', 'james10@example.com'], ['James', 'james11@example.com'], ['James', 'james12@example.com'], ['James', 'james13@example.com'], ['James', 'james14@example.com'], ['James', 'james15@example.com'], ['James', 'james16@example.com'], ['James', 'james17@example.com'], ['James', 'james18@example.com'], ['James', 'james19@example.com'], ['James', 'james20@example.com'], ['James', 'james21@example.com'], ['James', 'james22@example.com'], ['James', 'james23@example.com'], ['James', 'james24@example.com'], ['James', 'james25@example.com'], ['James', 'james26@example.com'], ['James', 'james27@example.com'], ['James', 'james28@example.com'], ['James', 'james29@example.com'], ['James', 'james30@example.com']]\n assert candidate(accounts = [['Sam', 'sam1@example.com', 'sam2@example.com'], ['Sam', 'sam3@example.com'], ['Max', 'max1@example.com'], ['Sam', 'sam2@example.com', 'sam4@example.com'], ['Max', 'max2@example.com', 'max3@example.com'], ['Sam', 'sam5@example.com'], ['Max', 'sam3@example.com']]) == [['Sam', 'sam1@example.com', 'sam2@example.com', 'sam4@example.com'], ['Sam', 'sam3@example.com'], ['Max', 'max1@example.com'], ['Max', 'max2@example.com', 'max3@example.com'], ['Sam', 'sam5@example.com']]\n assert candidate(accounts = [['Liam', 'liam1@example.com'], ['Liam', 'liam2@example.com'], ['Noah', 'noah1@example.com'], ['Noah', 'noah2@example.com'], ['Noah', 'liam1@example.com'], ['Noah', 'liam2@example.com'], ['Mia', 'mia1@example.com'], ['Mia', 'mia2@example.com'], ['Liam', 'mia1@example.com']]) == [['Liam', 'liam1@example.com'], ['Liam', 'liam2@example.com'], ['Noah', 'noah1@example.com'], ['Noah', 'noah2@example.com'], ['Mia', 'mia1@example.com'], ['Mia', 'mia2@example.com']]\n assert candidate(accounts = [['Ava', 'ava1@example.com'], ['Ava', 'ava2@example.com'], ['Isabella', 'isabella1@example.com'], ['Isabella', 'isabella2@example.com'], ['Ava', 'isabella1@example.com'], ['Isabella', 'ava1@example.com'], ['Ava', 'ava3@example.com'], ['Isabella', 'isabella3@example.com'], ['Ava', 'ava4@example.com'], ['Isabella', 'isabella4@example.com'], ['Ava', 'ava5@example.com'], ['Isabella', 'isabella5@example.com']]) == [['Ava', 'ava1@example.com'], ['Ava', 'ava2@example.com'], ['Isabella', 'isabella1@example.com'], ['Isabella', 'isabella2@example.com'], ['Ava', 'ava3@example.com'], ['Isabella', 'isabella3@example.com'], ['Ava', 'ava4@example.com'], ['Isabella', 'isabella4@example.com'], ['Ava', 'ava5@example.com'], ['Isabella', 'isabella5@example.com']]\n assert candidate(accounts = [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris7@example.com'], ['Chris', 'chris8@example.com'], ['Chris', 'chris9@example.com'], ['Chris', 'chris1@example.com'], ['Chris', 'chris11@example.com'], ['Chris', 'chris12@example.com'], ['Chris', 'chris13@example.com'], ['Chris', 'chris14@example.com'], ['Chris', 'chris15@example.com'], ['Chris', 'chris16@example.com'], ['Chris', 'chris17@example.com'], ['Chris', 'chris18@example.com'], ['Chris', 'chris19@example.com'], ['Chris', 'chris20@example.com'], ['Chris', 'chris21@example.com'], ['Chris', 'chris22@example.com'], ['Chris', 'chris23@example.com'], ['Chris', 'chris24@example.com'], ['Chris', 'chris25@example.com'], ['Chris', 'chris26@example.com'], ['Chris', 'chris27@example.com'], ['Chris', 'chris28@example.com'], ['Chris', 'chris29@example.com'], ['Chris', 'chris30@example.com']]) == [['Chris', 'chris1@example.com'], ['Chris', 'chris2@example.com'], ['Chris', 'chris3@example.com'], ['Chris', 'chris4@example.com'], ['Chris', 'chris5@example.com'], ['Chris', 'chris6@example.com'], ['Chris', 'chris7@example.com'], ['Chris', 'chris8@example.com'], ['Chris', 'chris9@example.com'], ['Chris', 'chris11@example.com'], ['Chris', 'chris12@example.com'], ['Chris', 'chris13@example.com'], ['Chris', 'chris14@example.com'], ['Chris', 'chris15@example.com'], ['Chris', 'chris16@example.com'], ['Chris', 'chris17@example.com'], ['Chris', 'chris18@example.com'], ['Chris', 'chris19@example.com'], ['Chris', 'chris20@example.com'], ['Chris', 'chris21@example.com'], ['Chris', 'chris22@example.com'], ['Chris', 'chris23@example.com'], ['Chris', 'chris24@example.com'], ['Chris', 'chris25@example.com'], ['Chris', 'chris26@example.com'], ['Chris', 'chris27@example.com'], ['Chris', 'chris28@example.com'], ['Chris', 'chris29@example.com'], ['Chris', 'chris30@example.com']]\n assert candidate(accounts = [['Tom', 'tom1@example.com', 'tom2@example.com'], ['Jerry', 'jerry1@example.com'], ['Spike', 'spike1@example.com', 'spike2@example.com'], ['Tyke', 'tyke1@example.com'], ['Tom', 'tom3@example.com'], ['Jerry', 'jerry2@example.com', 'jerry1@example.com']]) == [['Tom', 'tom1@example.com', 'tom2@example.com'], ['Jerry', 'jerry1@example.com', 'jerry2@example.com'], ['Spike', 'spike1@example.com', 'spike2@example.com'], ['Tyke', 'tyke1@example.com'], ['Tom', 'tom3@example.com']]\n assert candidate(accounts = [['George', 'george1@example.com'], ['George', 'george2@example.com'], ['George', 'george3@example.com'], ['Hannah', 'hannah1@example.com'], ['George', 'hannah1@example.com'], ['George', 'george4@example.com'], ['George', 'george5@example.com']]) == [['George', 'george1@example.com'], ['George', 'george2@example.com'], ['George', 'george3@example.com'], ['Hannah', 'hannah1@example.com'], ['George', 'george4@example.com'], ['George', 'george5@example.com']]\n assert candidate(accounts = [['Quinn', 'quinn1@example.com'], ['Quinn', 'quinn2@example.com'], ['Quinn', 'quinn3@example.com'], ['Rachel', 'rachel1@example.com'], ['Rachel', 'rachel2@example.com'], ['Rachel', 'quinn2@example.com'], ['Rachel', 'quinn3@example.com'], ['Rachel', 'rachel3@example.com'], ['Rachel', 'quinn1@example.com']]) == [['Quinn', 'quinn1@example.com'], ['Quinn', 'quinn2@example.com'], ['Quinn', 'quinn3@example.com'], ['Rachel', 'rachel1@example.com'], ['Rachel', 'rachel2@example.com'], ['Rachel', 'rachel3@example.com']]\n assert candidate(accounts = [['David', 'david@example.com'], ['David', 'david1@example.com'], ['David', 'david2@example.com'], ['David', 'david3@example.com'], ['David', 'david4@example.com'], ['David', 'david5@example.com']]) == [['David', 'david@example.com'], ['David', 'david1@example.com'], ['David', 'david2@example.com'], ['David', 'david3@example.com'], ['David', 'david4@example.com'], ['David', 'david5@example.com']]\n assert candidate(accounts = [['Karl', 'karl1@example.com'], ['Karl', 'karl2@example.com'], ['Karl', 'karl3@example.com'], ['Laura', 'laura1@example.com'], ['Laura', 'laura2@example.com'], ['Laura', 'karl2@example.com'], ['Laura', 'laura3@example.com']]) == [['Karl', 'karl1@example.com'], ['Karl', 'karl2@example.com'], ['Karl', 'karl3@example.com'], ['Laura', 'laura1@example.com'], ['Laura', 'laura2@example.com'], ['Laura', 'laura3@example.com']]\n assert candidate(accounts = [['Anna', 'anna@example.com', 'anna1@example.com'], ['Anna', 'anna2@example.com'], ['Anna', 'anna3@example.com', 'anna1@example.com'], ['Tom', 'tom@example.com'], ['Anna', 'anna4@example.com'], ['Tom', 'tom1@example.com', 'tom2@example.com']]) == [['Anna', 'anna1@example.com', 'anna3@example.com', 'anna@example.com'], ['Anna', 'anna2@example.com'], ['Tom', 'tom@example.com'], ['Anna', 'anna4@example.com'], ['Tom', 'tom1@example.com', 'tom2@example.com']]\n assert candidate(accounts = [['Lily', 'lily1@example.com'], ['Lily', 'lily2@example.com'], ['Lily', 'lily3@example.com'], ['Lily', 'lily1@example.com'], ['Lily', 'lily4@example.com'], ['Lily', 'lily2@example.com'], ['Lily', 'lily5@example.com'], ['Lily', 'lily3@example.com'], ['Lily', 'lily6@example.com'], ['Lily', 'lily7@example.com']]) == [['Lily', 'lily1@example.com'], ['Lily', 'lily2@example.com'], ['Lily', 'lily3@example.com'], ['Lily', 'lily4@example.com'], ['Lily', 'lily5@example.com'], ['Lily', 'lily6@example.com'], ['Lily', 'lily7@example.com']]\n assert candidate(accounts = [['Isabella', 'isabella1@example.com'], ['Isabella', 'isabella2@example.com'], ['Isabella', 'isabella3@example.com'], ['Sophia', 'isabella1@example.com'], ['Sophia', 'sophia2@example.com'], ['Sophia', 'sophia3@example.com'], ['Sophia', 'sophia4@example.com'], ['Sophia', 'sophia5@example.com'], ['Sophia', 'sophia6@example.com'], ['Sophia', 'sophia7@example.com']]) == [['Isabella', 'isabella1@example.com'], ['Isabella', 'isabella2@example.com'], ['Isabella', 'isabella3@example.com'], ['Sophia', 'sophia2@example.com'], ['Sophia', 'sophia3@example.com'], ['Sophia', 'sophia4@example.com'], ['Sophia', 'sophia5@example.com'], ['Sophia', 'sophia6@example.com'], ['Sophia', 'sophia7@example.com']]\n assert candidate(accounts = [['Sophia', 'sophia1@example.com'], ['Sophia', 'sophia2@example.com'], ['Sophia', 'sophia3@example.com'], ['Sophia', 'sophia4@example.com'], ['Sophia', 'sophia5@example.com'], ['Sophia', 'sophia6@example.com'], ['Sophia', 'sophia7@example.com'], ['Sophia', 'sophia8@example.com'], ['Sophia', 'sophia9@example.com'], ['Sophia', 'sophia10@example.com']]) == [['Sophia', 'sophia1@example.com'], ['Sophia', 'sophia2@example.com'], ['Sophia', 'sophia3@example.com'], ['Sophia', 'sophia4@example.com'], ['Sophia', 'sophia5@example.com'], ['Sophia', 'sophia6@example.com'], ['Sophia', 'sophia7@example.com'], ['Sophia', 'sophia8@example.com'], ['Sophia', 'sophia9@example.com'], ['Sophia', 'sophia10@example.com']]\n"}, "metadata": {"canonical_parameter_names": ["accounts"], "leetcode_dataset_entry_point": "Solution().accountsMerge", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var accountsMerge = function(accounts) {", "container": null, "callable": "accountsMerge", "parameters": [{"name": "accounts", "type": "string[][]"}], "return_type": "string[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 722, "task_id": "remove-comments", "difficulty": "Medium", "problem_description": "Given a C++ program, remove comments from it. The program source is an array of strings source where source[i] is the ith line of the source code. This represents the result of splitting the original source code string by the newline character '\\\n'.\nIn C++, there are two types of comments, line comments, and block comments.\n\nThe string \"//\" denotes a line comment, which represents that it and the rest of the characters to the right of it in the same line should be ignored.\nThe string \"/*\" denotes a block comment, which represents that all characters until the next (non-overlapping) occurrence of \"*/\" should be ignored. (Here, occurrences happen in reading order: line by line from left to right.) To be clear, the string \"/*/\" does not yet end the block comment, as the ending would be overlapping the beginning.\n\nThe first effective comment takes precedence over others.\n\nFor example, if the string \"//\" occurs in a block comment, it is ignored.\nSimilarly, if the string \"/*\" occurs in a line or block comment, it is also ignored.\n\nIf a certain line of code is empty after removing comments, you must not output that line: each string in the answer list will be non-empty.\nThere will be no control characters, single quote, or double quote characters.\n\nFor example, source = \"string s = \"/* Not a comment. */\";\" will not be a test case.\n\nAlso, nothing else such as defines or macros will interfere with the comments.\nIt is guaranteed that every open block comment will eventually be closed, so \"/*\" outside of a line or block comment always starts a new comment.\nFinally, implicit newline characters can be deleted by block comments. Please see the examples below for details.\nAfter removing the comments from the source code, return the source code in the same format.\n \nExample 1:\n\nInput: source = [\"/*Test program */\", \"int main()\", \"{ \", \" // variable declaration \", \"int a, b, c;\", \"/* This is a test\", \" multiline \", \" comment for \", \" testing */\", \"a = b + c;\", \"}\"]\nOutput: [\"int main()\",\"{ \",\" \",\"int a, b, c;\",\"a = b + c;\",\"}\"]\nExplanation: The line by line code is visualized as below:\n/*Test program */\nint main()\n{ \n // variable declaration \nint a, b, c;\n/* This is a test\n multiline \n comment for \n testing */\na = b + c;\n}\nThe string /* denotes a block comment, including line 1 and lines 6-9. The string // denotes line 4 as comments.\nThe line by line output code is visualized as below:\nint main()\n{ \n \nint a, b, c;\na = b + c;\n}\n\nExample 2:\n\nInput: source = [\"a/*comment\", \"line\", \"more_comment*/b\"]\nOutput: [\"ab\"]\nExplanation: The original source string is \"a/*comment\\\nline\\\nmore_comment*/b\", where we have bolded the newline characters. After deletion, the implicit newline characters are deleted, leaving the string \"ab\", which when delimited by newline characters becomes [\"ab\"].\n\n \nConstraints:\n\n1 <= source.length <= 100\n0 <= source[i].length <= 80\nsource[i] consists of printable ASCII characters.\nEvery open block comment is eventually closed.\nThere are no single-quote or double-quote in the input.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(source = ['/* This is a comment // with a line comment inside the block comment */', 'int x = 10;', 'cout << \"Hello World\";', '}']) == ['int x = 10;', 'cout << \"Hello World\";', '}']\n assert candidate(source = ['int main() {', ' printf(\"Hello World\"); // This is a comment', '}']) == ['int main() {', ' printf(\"Hello World\"); ', '}']\n assert candidate(source = ['int main() {', '/* Start of block comment \" /* still in block comment */ end of block comment */', 'int x = 10;', 'cout << \"Hello World\";', '}']) == ['int main() {', ' end of block comment */', 'int x = 10;', 'cout << \"Hello World\";', '}']\n assert candidate(source = ['int x = 10;', '// This is a line comment', 'int y = 20;']) == ['int x = 10;', 'int y = 20;']\n assert candidate(source = ['/* This is a block comment', 'and this is the second line', 'and the third line */', 'int z = 30;']) == ['int z = 30;']\n assert candidate(source = ['/*', 'block comment', '*/']) == []\n assert candidate(source = ['// This is a single line comment', 'int x = 10; // this is also a comment', '/* This is a block comment', ' that continues', ' on multiple lines */', 'int y = 20;']) == ['int x = 10; ', 'int y = 20;']\n assert candidate(source = ['void func() {', '/* This is a ', 'multiline comment */', 'int x = 10;', '// This is a single line comment', '}']) == ['void func() {', 'int x = 10;', '}']\n assert candidate(source = ['void fun() {', ' /* Multi', 'line', 'comment */', ' int k = 1;', '}']) == ['void fun() {', ' ', ' int k = 1;', '}']\n assert candidate(source = ['/* comment /* nested comment */ end of comment */', 'int x = 1;']) == [' end of comment */', 'int x = 1;']\n assert candidate(source = ['#include ', '/* Start of block comment', 'still in block comment', 'end of block comment */', 'int main() {', 'cout << \"Hello World\";', '// This line should be printed', '}']) == ['#include ', 'int main() {', 'cout << \"Hello World\";', '}']\n assert candidate(source = ['/*Test program */', 'int main()', '{ ', ' // variable declaration ', 'int a, b, c;', '/* This is a test', ' multiline ', ' comment for ', ' testing */', 'a = b + c;', '}']) == ['int main()', '{ ', ' ', 'int a, b, c;', 'a = b + c;', '}']\n assert candidate(source = ['int main() {', 'int x = 10; // This is a line comment', 'cout << \"Hello World\";', '}']) == ['int main() {', 'int x = 10; ', 'cout << \"Hello World\";', '}']\n assert candidate(source = ['int x = 10;', '// This is a line comment', 'x++;', '/* This is a block comment', 'x--;', '*/', 'return x;']) == ['int x = 10;', 'x++;', 'return x;']\n assert candidate(source = ['a/*comment', 'line', 'more_comment*/b']) == ['ab']\n assert candidate(source = ['/*Hello', 'World*/', 'int main()']) == ['int main()']\n assert candidate(source = ['int main()', '{', '/* This is a test comment', 'with multiple', 'lines */', 'return 0;', '}']) == ['int main()', '{', 'return 0;', '}']\n assert candidate(source = ['void f() {', '/* single line block comment */', '}']) == ['void f() {', '}']\n assert candidate(source = ['class Solution {', 'public:', ' vector twoSum(vector& nums, int target) {', ' /*', ' for (int i = 0; i < nums.size(); i++) {', ' for (int j = i + 1; j < nums.size(); j++) {', ' if (nums[i] + nums[j] == target) {', ' return {i, j};', ' }', ' }', ' }', ' */', ' return {};', ' }', '};']) == ['class Solution {', 'public:', ' vector twoSum(vector& nums, int target) {', ' ', ' return {};', ' }', '};']\n assert candidate(source = ['int x = 1; // single line comment', '/* int y = 2; */', 'int z = 3;']) == ['int x = 1; ', 'int z = 3;']\n assert candidate(source = ['// comment', '// another comment', 'int x = 1;']) == ['int x = 1;']\n assert candidate(source = ['/* Comment \" continues on next line', 'and ends here */', 'int a = 1;', '// Single line comment', 'int b = 2;', 'int c = 3;']) == ['int a = 1;', 'int b = 2;', 'int c = 3;']\n assert candidate(source = ['/* This is a block comment that includes', 'a line with // single line comment inside it', '*/', 'int a = 10;', 'int b = 20;', '/* Another block comment that includes', 'a line with // single line comment inside it', '*/', 'int c = 30;']) == ['int a = 10;', 'int b = 20;', 'int c = 30;']\n assert candidate(source = ['int main() {', ' // Start of line comment \" /* this is not a comment \" end of line comment', ' int x = 1;', ' /* Start of block comment \" // still in block comment \" */', ' int y = 2;', ' printf(\"Result: %d\", x + y);', '}']) == ['int main() {', ' ', ' int x = 1;', ' ', ' int y = 2;', ' printf(\"Result: %d\", x + y);', '}']\n assert candidate(source = ['int main() {', ' int x = 1;', ' /* Start of block comment \" // this is not a comment \" */', ' int y = 2;', ' // This is a line comment \" /* this is not a comment \" end of line comment', ' printf(\"Result: %d\", x + y);', ' /* Another block comment \" // still in block comment \" end of block comment */', '}']) == ['int main() {', ' int x = 1;', ' ', ' int y = 2;', ' ', ' printf(\"Result: %d\", x + y);', ' ', '}']\n assert candidate(source = ['int main() {', '/* Block comment starts here', 'int x = 10;', '/* Nested comment \" /* still in nested comment */ \" end of nested comment */', 'int y = 20;', '*/ int z = 30;', '// End of file comment', '}']) == ['int main() {', ' \" end of nested comment */', 'int y = 20;', '*/ int z = 30;', '}']\n assert candidate(source = ['/* Start of block comment \\n /* nested block comment */ still in block comment */', 'int x = 10;']) == [' still in block comment */', 'int x = 10;']\n assert candidate(source = ['/* Start of block comment ', '/* Nested block comment ', '*/', 'End of nested block comment */', 'int x = 40;', '// Line comment /* not a block comment */']) == ['End of nested block comment */', 'int x = 40;']\n assert candidate(source = ['void func() {', 'int x = 1;', '/* Comment with newline character \\n */', 'int y = 2;', '}']) == ['void func() {', 'int x = 1;', 'int y = 2;', '}']\n assert candidate(source = ['/* comment with \"escaped quotes\" inside block comment */', 'int x = 1;', '// Single line comment after block comment', '/* Another block comment \"with quotes\" inside */', 'int y = 2;', '}']) == ['int x = 1;', 'int y = 2;', '}']\n assert candidate(source = ['/* This is a comment /* nested block comment */ end of comment */', 'int x = 1;', '// Single-line comment after block comment', '/* Another block comment */ int y = 2;']) == [' end of comment */', 'int x = 1;', ' int y = 2;']\n assert candidate(source = ['/* Comment spanning multiple lines', 'including quotes \" and other symbols /* nested */', 'still in block comment \" end block comment */', 'int x = 1;', 'cout << \"Hello World\";']) == ['still in block comment \" end block comment */', 'int x = 1;', 'cout << \"Hello World\";']\n assert candidate(source = ['/* comment with end of line comment // inside block comment */', 'int q = 8;', 'int r = 9;', '/* comment with // nested line comment /* nested block comment */ inside block comment */', 'int s = 10;']) == ['int q = 8;', 'int r = 9;', ' inside block comment */', 'int s = 10;']\n assert candidate(source = ['int main() {', '/* Comment with \"quoted\" text inside */', 'int x = 20;', '/* Another /* nested */ comment */', 'return x;', '}']) == ['int main() {', 'int x = 20;', ' comment */', 'return x;', '}']\n assert candidate(source = ['void example() {', '/* This is a block comment /* with another comment inside */ and continues here */', 'int a = 10;', 'cout << \"Value: \" << a;', '// Single line comment after block comment', '}']) == ['void example() {', ' and continues here */', 'int a = 10;', 'cout << \"Value: \" << a;', '}']\n assert candidate(source = ['class MyClass {', ' // This is a single line comment', ' int a;', ' /* This is a block comment ', ' int b;', ' // Another single line comment', ' */', ' int c;', '}']) == ['class MyClass {', ' ', ' int a;', ' ', ' int c;', '}']\n assert candidate(source = ['/* This is a block comment that spans', 'multiple lines and includes', 'a single line comment // inside it */', 'int z = 30;', '// This is a single line comment', '}']) == ['int z = 30;', '}']\n assert candidate(source = ['/* Comment before code', 'int x = 1;', '/* Comment after code', 'int y = 2;', '// Single line comment', 'int z = 3;', '/* Comment after last line */']) == []\n assert candidate(source = ['void func() {', 'int x = 10;', '/* Start of block comment ', 'int y = 20;', 'int z = 30;', '}*/']) == ['void func() {', 'int x = 10;']\n assert candidate(source = ['int func() {', 'if (x < 0) /* This is a block comment */ {', 'return x;', '} else {', 'return -x;', '}', '/* Another comment \" with quotes \" inside */', '}']) == ['int func() {', 'if (x < 0) {', 'return x;', '} else {', 'return -x;', '}', '}']\n assert candidate(source = ['/* Comment spanning', 'multiple lines with newline character \\n and /* nested */ comment \\n end comment */', 'int x = 1;', 'cout << \"Hello World\";']) == [' comment \\n end comment */', 'int x = 1;', 'cout << \"Hello World\";']\n assert candidate(source = ['int main() {', '/* Start of block comment \" /* nested block comment \" still in block comment */', 'int x = 10;', 'cout << \"Hello World\";', '}']) == ['int main() {', 'int x = 10;', 'cout << \"Hello World\";', '}']\n assert candidate(source = ['/* comment with // nested line comment inside block comment /* nested block comment */ inside block comment */', 'int x = 15;', 'int y = 16;']) == [' inside block comment */', 'int x = 15;', 'int y = 16;']\n assert candidate(source = ['/* Comment spanning multiple lines', 'including quotes \" and other symbols /* nested /* deeply nested */ end nested comment */', 'still in block comment \" end block comment */', 'int x = 1;', 'cout << \"Hello World\";']) == [' end nested comment */', 'still in block comment \" end block comment */', 'int x = 1;', 'cout << \"Hello World\";']\n assert candidate(source = ['// Single-line comment', '/* Multi-line comment starts here', 'int x = 10;', '/* Nested comment */', 'int y = 20;', '*/ int z = 30;', '// End of file comment', '/* Last comment */']) == ['int y = 20;', '*/ int z = 30;']\n assert candidate(source = ['int main() {', ' /* Start of a block comment ', ' /* Nested block comment */', ' */', ' int x = 10;', ' // This is a single line comment', '}']) == ['int main() {', ' ', ' */', ' int x = 10;', ' ', '}']\n assert candidate(source = ['/* Start of block comment ', 'void func() {', 'int x = 10;', '} /* End of block comment */']) == []\n assert candidate(source = ['/* start of block comment', 'with multiple lines', 'and /* nested block comment */', 'inside it', 'end of block comment */', 'int t = 11;', 'int u = 12;']) == ['inside it', 'end of block comment */', 'int t = 11;', 'int u = 12;']\n assert candidate(source = ['/* comment with // nested line comment */', 'int o = 6;', '/* comment with /* nested block comment */ inside it */', 'int p = 7;']) == ['int o = 6;', ' inside it */', 'int p = 7;']\n assert candidate(source = ['int main() {', 'int x = 10;', '/* Comment with special characters !@#$%^&*()_+*/', 'int y = 20;', '}']) == ['int main() {', 'int x = 10;', 'int y = 20;', '}']\n assert candidate(source = ['/* Comment with /* deep nesting /* even deeper */ still deep */ end of deep nesting */', 'int x = 80;', 'int main() {', 'int y = 90;', 'return x + y;', '}']) == [' still deep */ end of deep nesting */', 'int x = 80;', 'int main() {', 'int y = 90;', 'return x + y;', '}']\n assert candidate(source = ['int main() {', '/* Block comment \" /* nested block comment \" end of nested block comment */ end of block comment */', 'int x = 10;', 'cout << \"Hello World\";', '}']) == ['int main() {', ' end of block comment */', 'int x = 10;', 'cout << \"Hello World\";', '}']\n assert candidate(source = ['// This is a single line comment', 'int a = 1;', '// Another single line comment', 'int b = 2;', '// Last single line comment']) == ['int a = 1;', 'int b = 2;']\n assert candidate(source = ['int main() {', 'if (true) {', '// This is a comment inside a block', 'int x = 1;', '}', '/* Another block comment \" end of block comment */', 'int y = 2;', '}']) == ['int main() {', 'if (true) {', 'int x = 1;', '}', 'int y = 2;', '}']\n assert candidate(source = ['int main() {', '/* Start of block comment', 'which continues', 'and includes \"quotes\" inside', '*/', 'int x = 10;', '// This is a single line comment after block comment', 'cout << \"Value: \" << x;', '}']) == ['int main() {', 'int x = 10;', 'cout << \"Value: \" << x;', '}']\n assert candidate(source = ['/* This is a block comment \" // this is not a comment \" */', 'int x = 1;', '/* another block comment \" // still in block comment \" */', 'int y = 2;', 'printf(\"Result: %d\", x + y);']) == ['int x = 1;', 'int y = 2;', 'printf(\"Result: %d\", x + y);']\n assert candidate(source = ['/* This is a comment /* nested block comment */ end of comment */', 'int x = 1;', '// Single-line comment after block comment', '/* Another block comment \" \" */ int y = 2;', 'int z = 3;']) == [' end of comment */', 'int x = 1;', ' int y = 2;', 'int z = 3;']\n assert candidate(source = ['void foo() {', '/* Multi-line comment starts here', 'and continues', 'on multiple lines */', 'int y = 30;', '// Another single-line comment', '}']) == ['void foo() {', 'int y = 30;', '}']\n assert candidate(source = ['/* Opening block comment', 'int x = 50;', 'int y = 60;', '// Line comment inside block comment', '*/', 'int z = 70;', '/* Another block comment \" with quotes \" inside */', '}']) == ['int z = 70;', '}']\n assert candidate(source = ['// single line comment /* block comment on same line */', '/* block comment // single line comment inside block comment */', 'int v = 13;']) == ['int v = 13;']\n assert candidate(source = ['int main() {', 'int x = 1;', '/* Comment with newline character \\n and /* nested */ comment */', 'int y = 2;', '}']) == ['int main() {', 'int x = 1;', ' comment */', 'int y = 2;', '}']\n assert candidate(source = ['int main() {', ' /* Start of block comment', ' // Single line comment inside block comment', ' end of block comment */', ' int x = 10;', ' // This is a single line comment', '}']) == ['int main() {', ' ', ' int x = 10;', ' ', '}']\n assert candidate(source = ['void foo() {', ' /* This is a block comment that ends on the same line */ int y = 20;', ' // This is a single line comment', '}']) == ['void foo() {', ' int y = 20;', ' ', '}']\n assert candidate(source = ['/* Comment line 1', 'Comment line 2', 'Comment line 3 */', 'int a = 1;', 'int b = 2;', 'int c = 3;']) == ['int a = 1;', 'int b = 2;', 'int c = 3;']\n assert candidate(source = ['/* Start of block comment', 'int x = 110;', '// Line comment inside block comment', 'int y = 120;', '*/', 'int z = 130;', '/* Another block comment', '/* Nested block comment */', 'End of nested block comment */', 'return x + y + z;', '}']) == ['int z = 130;', 'End of nested block comment */', 'return x + y + z;', '}']\n assert candidate(source = ['/* Start of block comment \\n /* nested block comment \\n still in block comment */', 'int x = 10;']) == ['int x = 10;']\n assert candidate(source = ['/* Start of block comment \" with quotes \" inside /* nested block comment \" with quotes \" inside */ end of nested block comment \" with quotes \" inside */', 'int main() {', 'int x = 140;', 'int y = 150;', '// Line comment \" with quotes \" inside block comment', 'int z = 160;', 'return x + y + z;', '}']) == [' end of nested block comment \" with quotes \" inside */', 'int main() {', 'int x = 140;', 'int y = 150;', 'int z = 160;', 'return x + y + z;', '}']\n assert candidate(source = ['int main() {', '// Line comment \" // still in line comment \" end of line comment ', 'int x = 10;', '}']) == ['int main() {', 'int x = 10;', '}']\n assert candidate(source = ['int main() {', '/* Start of block comment /* still in block comment */ end of block comment */', 'int x = 10;', '// Single line comment after block comment', 'cout << \"Hello World\";', '}']) == ['int main() {', ' end of block comment */', 'int x = 10;', 'cout << \"Hello World\";', '}']\n assert candidate(source = ['/* comment with /* nested block comment /* another nested block comment */ end of inner block comment */ end of outer block comment */', 'int w = 14;']) == [' end of inner block comment */ end of outer block comment */', 'int w = 14;']\n assert candidate(source = ['/* Multiline comment \"with quotes\" inside /* nested comment */ still inside */', 'int main() {', '/* Another comment \" with quotes \" and /* nested */ */', 'int z = 100;', 'return z;', '}']) == [' still inside */', 'int main() {', ' */', 'int z = 100;', 'return z;', '}']\n assert candidate(source = ['void func() {', '/* Start of block comment ', 'int x = 10;', '} // End of function ', '*/']) == ['void func() {']\n assert candidate(source = ['/* comment /* nested /* deeply nested */ comment */ end */', 'int x = 1;', '// single line comment after block comment']) == [' comment */ end */', 'int x = 1;']\n assert candidate(source = ['int main() {', '/* Block comment \" /* nested comment */ \" end of block comment */', 'int x = 10;', 'cout << \"Hello World\";', '// Single-line comment', '}']) == ['int main() {', ' \" end of block comment */', 'int x = 10;', 'cout << \"Hello World\";', '}']\n assert candidate(source = ['int main() {', ' if (x > 0) {', ' /* Start of block comment \" /* still in block comment */ \" end of block comment */', ' printf(\"Hello World\");', ' }', '}']) == ['int main() {', ' if (x > 0) {', ' \" end of block comment */', ' printf(\"Hello World\");', ' }', '}']\n assert candidate(source = ['/* Comment with \"escaped quote\" inside */', 'int x = 10;']) == ['int x = 10;']\n assert candidate(source = ['int main() {', 'int x = 1;', '// This is a comment \" /* this should be ignored */ end comment', 'int y = 2;', '/* This is a block comment \" /* nested */ end block comment */', 'int z = 3;', '}']) == ['int main() {', 'int x = 1;', 'int y = 2;', ' end block comment */', 'int z = 3;', '}']\n assert candidate(source = ['void func() {', '/* This is a ', 'multiline comment /* nested comment */', 'end of block comment */', 'int x = 10;', '// This is a single line comment /* this should be ignored */', '}']) == ['void func() {', 'end of block comment */', 'int x = 10;', '}']\n assert candidate(source = ['void function() {', 'int i = 0;', '/* start of block comment', 'int j = 1;', '// single line comment inside block comment', 'int k = 2;', 'end of block comment */', 'int l = 3;', '}']) == ['void function() {', 'int i = 0;', 'int l = 3;', '}']\n assert candidate(source = ['// Line comment \" // still a line comment \"', 'int main() {', 'int x = 30;', '/* Multiline \" comment \" block ', 'with line continuation ', '*/', 'return x;', '}']) == ['int main() {', 'int x = 30;', 'return x;', '}']\n assert candidate(source = ['int main() {', ' /* Start of block comment \" /* still in block comment \" */ end of block comment */', ' int x = 1;', ' if (x > 0) {', ' // This is a line comment \" /* this is not a comment \" end of line comment', ' int y = 2;', ' printf(\"Result: %d\", x + y);', ' }', '}']) == ['int main() {', ' end of block comment */', ' int x = 1;', ' if (x > 0) {', ' ', ' int y = 2;', ' printf(\"Result: %d\", x + y);', ' }', '}']\n assert candidate(source = ['/* Multi', 'line', 'block', 'comment */', 'int main() {', 'return 0;', '}']) == ['int main() {', 'return 0;', '}']\n assert candidate(source = ['/* Comment before code \" // this is not a comment \" */', '#include ', 'using namespace std;', 'int main() {', ' int x = 1;', ' /* Start of block comment \" /* still in block comment \" end of block comment */', ' int y = 2;', ' // This is a line comment \" /* this is not a comment \" end of line comment', ' printf(\"Result: %d\", x + y);', '}']) == ['#include ', 'using namespace std;', 'int main() {', ' int x = 1;', ' ', ' int y = 2;', ' ', ' printf(\"Result: %d\", x + y);', '}']\n assert candidate(source = ['/* This comment ', 'spans ', 'multiple lines */', 'int main() {', ' int x = 10;', ' /* Another block comment ', ' spanning ', ' multiple lines */', ' int y = 20;', '}']) == ['int main() {', ' int x = 10;', ' ', ' int y = 20;', '}']\n assert candidate(source = ['/* Start of block comment ', '/* nested block comment ', 'end of nested block comment */', 'end of block comment */', 'int x = 1;', 'cout << \"Hello World\";']) == ['end of block comment */', 'int x = 1;', 'cout << \"Hello World\";']\n assert candidate(source = ['/* Start of block comment \\n // line comment inside block comment \\n still in block comment */', 'int x = 10;']) == ['int x = 10;']\n assert candidate(source = ['/* Line 1', 'Line 2 still in comment', 'Line 3 // inline comment after block comment', 'Line 4 */ int x = 20;', '// End of file comment']) == [' int x = 20;']\n assert candidate(source = ['/* Comment before line */ int x = 10;', 'int y = 20; /* Comment after line */', 'int z = 30;']) == [' int x = 10;', 'int y = 20; ', 'int z = 30;']\n assert candidate(source = ['/* Line 1 comment', '/* Nested comment starts here', 'and continues here */', 'Back to outer comment */', 'int z = 40;', '// End of file comment']) == ['Back to outer comment */', 'int z = 40;']\n assert candidate(source = ['int main() {', '// Single line comment before block comment', '/* Start of block comment', 'which continues', 'and includes \"quotes\" inside', '*/', 'int x = 10;', 'cout << \"Value: \" << x;', '/* Another block comment \"with quotes\" inside */', 'int y = 2;', '}']) == ['int main() {', 'int x = 10;', 'cout << \"Value: \" << x;', 'int y = 2;', '}']\n assert candidate(source = ['/* comment starts', 'and continues here', 'and continues here too */', 'int y = 20;', '/* comment ends here', 'and here too */', 'int z = 30;']) == ['int y = 20;', 'int z = 30;']\n assert candidate(source = ['/* Start of block comment \" /* still in block comment */ end of block comment */', 'int x = 10;', '/* Another block comment \" end of block comment */', 'int y = 20;', 'cout << \"Hello World\";', '}']) == [' end of block comment */', 'int x = 10;', 'int y = 20;', 'cout << \"Hello World\";', '}']\n assert candidate(source = ['/* comment /* nested comment 1 */ more text', 'and continues here /* nested comment 2 */ still more text */', 'int a = 5;']) == [' more text', 'and continues here still more text */', 'int a = 5;']\n assert candidate(source = ['void bar() {', '/* Multi-line comment starts here', 'and continues', 'on multiple lines with \" escaped quotes \" */', 'int a = 100;', '// Single-line comment', '}']) == ['void bar() {', 'int a = 100;', '}']\n assert candidate(source = ['/* Comment before code', 'int main() {', '/* Start of block comment \" with quotes \" inside', '*/', 'int x = 10;', 'cout << \"Value: \" << x;', '// Single line comment after block comment', '}', '/* Comment after code */']) == ['int x = 10;', 'cout << \"Value: \" << x;', '}']\n assert candidate(source = ['/* comment with newline \\n inside it */', 'int m = 4;', '// comment with newline \\n inside it', 'int n = 5;']) == ['int m = 4;', 'int n = 5;']\n assert candidate(source = ['int main() {', '/* Multi-line', 'block', 'comment', 'ends', 'here */', 'int x = 1;', 'cout << \"Hello World\";', '}']) == ['int main() {', 'int x = 1;', 'cout << \"Hello World\";', '}']\n assert candidate(source = ['// Start of file comment', '/* Multi-line comment starts here', 'int x = 10;', '/* Nested comment */', 'int y = 20;', '*/ int z = 30;', '// End of file comment']) == ['int y = 20;', '*/ int z = 30;']\n assert candidate(source = ['/* Start of block comment /* Nested block comment */ still in block comment */', 'int x = 10;']) == [' still in block comment */', 'int x = 10;']\n assert candidate(source = ['int main() {', '/* Start of block comment \" /* still in block comment */ end of block comment */', 'int x = 10;', 'cout << \"Hello World\";', '/* Another block comment /* nested */ end */', '}']) == ['int main() {', ' end of block comment */', 'int x = 10;', 'cout << \"Hello World\";', ' end */', '}']\n assert candidate(source = ['int main() {', '/* This is a block comment', 'which spans multiple lines \" /* still in block comment */ \" and continues here', '*/', 'int a = 10;', '// This is a single line comment', 'cout << \"Output: \" << a;', '}']) == ['int main() {', ' \" and continues here', '*/', 'int a = 10;', 'cout << \"Output: \" << a;', '}']\n assert candidate(source = ['int main() {', 'if (/* inline block comment */ true) {', 'printf(\"Hello\\n\");', '}', '}']) == ['int main() {', 'if ( true) {', 'printf(\"Hello\\n\");', '}', '}']\n"}, "metadata": {"canonical_parameter_names": ["source"], "leetcode_dataset_entry_point": "Solution().removeComments", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var removeComments = function(source) {", "container": null, "callable": "removeComments", "parameters": [{"name": "source", "type": "string[]"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 724, "task_id": "find-pivot-index", "difficulty": "Easy", "problem_description": "Given an array of integers nums, calculate the pivot index of this array.\nThe pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly to the index's right.\nIf the index is on the left edge of the array, then the left sum is 0 because there are no elements to the left. This also applies to the right edge of the array.\nReturn the leftmost pivot index. If no such index exists, return -1.\n \nExample 1:\n\nInput: nums = [1,7,3,6,5,6]\nOutput: 3\nExplanation:\nThe pivot index is 3.\nLeft sum = nums[0] + nums[1] + nums[2] = 1 + 7 + 3 = 11\nRight sum = nums[4] + nums[5] = 5 + 6 = 11\n\nExample 2:\n\nInput: nums = [1,2,3]\nOutput: -1\nExplanation:\nThere is no index that satisfies the conditions in the problem statement.\nExample 3:\n\nInput: nums = [2,1,-1]\nOutput: 0\nExplanation:\nThe pivot index is 0.\nLeft sum = 0 (no elements to the left of index 0)\nRight sum = nums[1] + nums[2] = 1 + -1 = 0\n\n \nConstraints:\n\n1 <= nums.length <= 104\n-1000 <= nums[i] <= 1000\n\n \nNote: This question is the same as 1991: https://leetcode.com/problems/find-the-middle-index-in-array/\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == -1\n assert candidate(nums = [1]) == 0\n assert candidate(nums = [-1, -2, -3, -4, -5]) == -1\n assert candidate(nums = [1, 2, 1]) == 1\n assert candidate(nums = [-1, -1, -1, 0, -1, -1, -1]) == 3\n assert candidate(nums = [1000, -1000]) == -1\n assert candidate(nums = [1, 0]) == 0\n assert candidate(nums = [1, 2, 3, 4, 3, 2, 1]) == 3\n assert candidate(nums = [-1, -2, -3, 3, 2, 1]) == -1\n assert candidate(nums = [-1, -1, 0, 1, 1]) == -1\n assert candidate(nums = [2, 1, -1]) == 0\n assert candidate(nums = [-1, -1, -1, -1]) == -1\n assert candidate(nums = [1, 7, 3, 6, 5, 6]) == 3\n assert candidate(nums = [0, 0, 0, 0]) == 0\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [0, 1, 0]) == 1\n assert candidate(nums = [5, 5, 5, 5, 5, 5]) == -1\n assert candidate(nums = [1, 2, 3]) == -1\n assert candidate(nums = [100, 200, 300, 400, 500, 1500, 500, 400, 300, 200, 100]) == 5\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 10, 5]) == 6\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]) == -1\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1]) == -1\n assert candidate(nums = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16, 17, -18, 19, -20, 21]) == -1\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 37\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == -1\n assert candidate(nums = [1000, -1000, 500, -500, 250, -250, 125, -125, 62, -62]) == -1\n assert candidate(nums = [200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == -1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -325]) == -1\n assert candidate(nums = [1, 3, 2, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2]) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 100]) == -1\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5]) == -1\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1]) == 9\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1000]) == -1\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [1, 2, 3, 4, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == -1\n assert candidate(nums = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]) == 5\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == -1\n assert candidate(nums = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16, 17, -18, 19, -20]) == -1\n assert candidate(nums = [10, -10, 20, -20, 30, -30, 40, -40, 50, -50]) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1]) == -1\n assert candidate(nums = [10, 10, 10, 10, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 7\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 4, 3, 2, 1]) == -1\n assert candidate(nums = [1000, -500, 500, -250, 250, -125, 125, -62, 62]) == 0\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 10\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 1\n assert candidate(nums = [-1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1]) == -1\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -140, 140]) == 28\n assert candidate(nums = [1000, -500, 500, -250, 250, -125, 125, -62, 62, -31, 31]) == 0\n assert candidate(nums = [-100, 100, -200, 200, -300, 300, -400, 400, -500, 500]) == -1\n assert candidate(nums = [1000, -1000, 1000, -1000, 1000, -1000, 1000]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 14\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == -1\n assert candidate(nums = [1000, -500, 500, 0, 0, 0, 0, 0, 0, 0, 500, -500, 1000]) == 3\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]) == -1\n assert candidate(nums = [10, -20, 30, -40, 50, -60, 70, -80, 90, -100, 110, -120, 130, -140, 150, -160, 170, -180, 190, -200]) == -1\n assert candidate(nums = [10, -1, 10, -1, 10, -1, 10, -1, 10, -1]) == -1\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == -1\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9, 10, -10]) == -1\n assert candidate(nums = [10, 20, 30, 40, 50, 40, 30, 20, 10]) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -210]) == -1\n assert candidate(nums = [1000, -500, -250, -125, -62, -31, -15, -7, -3, -1]) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == -1\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1]) == -1\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == -1\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 4, 3, 2, 1]) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]) == -1\n assert candidate(nums = [10, -10, 20, -20, 30, -30, 40, -40]) == -1\n assert candidate(nums = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10]) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 55]) == -1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 36\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [-1, 1, -2, 2, -3, 3, -4, 4, -5, 5, -6, 6, -7, 7, -8, 8, -9, 9, -10, 10]) == -1\n assert candidate(nums = [100, -100, 100, -100, 100, -100, 100, -100, 100, -100]) == -1\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == -1\n assert candidate(nums = [100, -50, 50, -25, 25, -12, 12, -6, 6, -3, 3, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == -1\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20]) == -1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10]) == 14\n assert candidate(nums = [-1, 1, -2, 2, -3, 3, -4, 4, -5, 5, -6, 6, -7, 7, -8, 8, -9, 9, -10, 10, -11, 11, -12, 12, -13, 13, 1]) == 26\n assert candidate(nums = [10, 10, 10, 10, 10, 5, 5, 5, 5, 5, 5]) == -1\n assert candidate(nums = [-1, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0, 1]) == -1\n assert candidate(nums = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15]) == -1\n assert candidate(nums = [1, 2, 3, 6, 3, 2, 1]) == 3\n assert candidate(nums = [1000, -1000, 500, -500, 250, -250]) == -1\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9]) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -55]) == -1\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().pivotIndex", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var pivotIndex = function(nums) {", "container": null, "callable": "pivotIndex", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 726, "task_id": "number-of-atoms", "difficulty": "Hard", "problem_description": "Given a string formula representing a chemical formula, return the count of each atom.\nThe atomic element always starts with an uppercase character, then zero or more lowercase letters, representing the name.\nOne or more digits representing that element's count may follow if the count is greater than 1. If the count is 1, no digits will follow.\n\nFor example, \"H2O\" and \"H2O2\" are possible, but \"H1O2\" is impossible.\n\nTwo formulas are concatenated together to produce another formula.\n\nFor example, \"H2O2He3Mg4\" is also a formula.\n\nA formula placed in parentheses, and a count (optionally added) is also a formula.\n\nFor example, \"(H2O2)\" and \"(H2O2)3\" are formulas.\n\nReturn the count of all elements as a string in the following form: the first name (in sorted order), followed by its count (if that count is more than 1), followed by the second name (in sorted order), followed by its count (if that count is more than 1), and so on.\nThe test cases are generated so that all the values in the output fit in a 32-bit integer.\n \nExample 1:\n\nInput: formula = \"H2O\"\nOutput: \"H2O\"\nExplanation: The count of elements are {'H': 2, 'O': 1}.\n\nExample 2:\n\nInput: formula = \"Mg(OH)2\"\nOutput: \"H2MgO2\"\nExplanation: The count of elements are {'H': 2, 'Mg': 1, 'O': 2}.\n\nExample 3:\n\nInput: formula = \"K4(ON(SO3)2)2\"\nOutput: \"K4N2O14S4\"\nExplanation: The count of elements are {'K': 4, 'N': 2, 'O': 14, 'S': 4}.\n\n \nConstraints:\n\n1 <= formula.length <= 1000\nformula consists of English letters, digits, '(', and ')'.\nformula is always valid.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(formula = \"(NH4)3PO4\") == \"H12N3O4P\"\n assert candidate(formula = \"(NH4)2SO4\") == \"H8N2O4S\"\n assert candidate(formula = \"Be32(Al2(SiO3)4)3\") == \"Al6Be32O36Si12\"\n assert candidate(formula = \"Mg(OH)2\") == \"H2MgO2\"\n assert candidate(formula = \"Be3Al2(SiO3)6\") == \"Al2Be3O18Si6\"\n assert candidate(formula = \"((H2O)2)3\") == \"H12O6\"\n assert candidate(formula = \"(CH3)2CO\") == \"C3H6O\"\n assert candidate(formula = \"(C2H5)3N\") == \"C6H15N\"\n assert candidate(formula = \"Fe3(PO4)2\") == \"Fe3O8P2\"\n assert candidate(formula = \"(CO2)3(PO3)2\") == \"C3O12P2\"\n assert candidate(formula = \"SiO2\") == \"O2Si\"\n assert candidate(formula = \"Si(C3H5(NO3)3)4\") == \"C12H20N12O36Si\"\n assert candidate(formula = \"(C2H3O2)2\") == \"C4H6O4\"\n assert candidate(formula = \"CuSO4\") == \"CuO4S\"\n assert candidate(formula = \"C6H12O6\") == \"C6H12O6\"\n assert candidate(formula = \"Al2(SO4)3\") == \"Al2O12S3\"\n assert candidate(formula = \"K4(ON(SO3)2)2\") == \"K4N2O14S4\"\n assert candidate(formula = \"(CO(NH2)2)2\") == \"C2H8N4O2\"\n assert candidate(formula = \"(HCO3)3\") == \"C3H3O9\"\n assert candidate(formula = \"(H2O2)3\") == \"H6O6\"\n assert candidate(formula = \"H2O\") == \"H2O\"\n assert candidate(formula = \"Ca(CO3)2\") == \"C2CaO6\"\n assert candidate(formula = \"Si(C3H5O3)2\") == \"C6H10O6Si\"\n assert candidate(formula = \"Fe(NO3)3\") == \"FeN3O9\"\n assert candidate(formula = \"NaCl\") == \"ClNa\"\n assert candidate(formula = \"He\") == \"He\"\n assert candidate(formula = \"P2O7\") == \"O7P2\"\n assert candidate(formula = \"(NH4)2C2O4\") == \"C2H8N2O4\"\n assert candidate(formula = \"Fe(CN)6\") == \"C6FeN6\"\n assert candidate(formula = \"Si(C3H5O3H)3\") == \"C9H18O9Si\"\n assert candidate(formula = \"Fe6(PO4)3\") == \"Fe6O12P3\"\n assert candidate(formula = \"C12H22O11\") == \"C12H22O11\"\n assert candidate(formula = \"(CH3)2O\") == \"C2H6O\"\n assert candidate(formula = \"Fe3(Fe(H2O)2)2\") == \"Fe5H8O4\"\n assert candidate(formula = \"HCl\") == \"ClH\"\n assert candidate(formula = \"(CH3)3COOH\") == \"C4H10O2\"\n assert candidate(formula = \"(NH3)2SO4\") == \"H6N2O4S\"\n assert candidate(formula = \"Fe2(CO)9\") == \"C9Fe2O9\"\n assert candidate(formula = \"Pb(SO4)2\") == \"O8PbS2\"\n assert candidate(formula = \"Fe2(CO)4\") == \"C4Fe2O4\"\n assert candidate(formula = \"Mg3(PO4)2\") == \"Mg3O8P2\"\n assert candidate(formula = \"(C6H5OH)2\") == \"C12H12O2\"\n assert candidate(formula = \"(C4H10O4)2\") == \"C8H20O8\"\n assert candidate(formula = \"(NH4)2Cr2O7(K2Cr2O7)2\") == \"Cr6H8K4N2O21\"\n assert candidate(formula = \"(SiO2)3(CuSiO3)2\") == \"Cu2O12Si5\"\n assert candidate(formula = \"K3PO4\") == \"K3O4P\"\n assert candidate(formula = \"(NH4)2(C2H3O2)2Fe(H2O)4\") == \"C4FeH22N2O8\"\n assert candidate(formula = \"Cu(CuSO4)5(H2O)10\") == \"Cu6H20O30S5\"\n assert candidate(formula = \"Mg2(PO4)3\") == \"Mg2O12P3\"\n assert candidate(formula = \"((CH3COOH)2)3\") == \"C12H24O12\"\n assert candidate(formula = \"(FeSO4)2\") == \"Fe2O8S2\"\n assert candidate(formula = \"C3H6O\") == \"C3H6O\"\n assert candidate(formula = \"((H2O)3)4\") == \"H24O12\"\n assert candidate(formula = \"Fe(CO)4\") == \"C4FeO4\"\n assert candidate(formula = \"FeSO4((NH4)2S)2\") == \"FeH16N4O4S3\"\n assert candidate(formula = \"FeCl3\") == \"Cl3Fe\"\n assert candidate(formula = \"((C2H5OH)3SiO3)2\") == \"C12H36O12Si2\"\n assert candidate(formula = \"Fe(CO)4(Fe(OH)2)2\") == \"C4Fe3H4O8\"\n assert candidate(formula = \"C6H5(CH3COOH)3\") == \"C12H17O6\"\n assert candidate(formula = \"K2Cr2O7\") == \"Cr2K2O7\"\n assert candidate(formula = \"(CH3COO)2Cu\") == \"C4CuH6O4\"\n assert candidate(formula = \"(NaCl)3(MgSO4)2\") == \"Cl3Mg2Na3O8S2\"\n assert candidate(formula = \"(H2O)10\") == \"H20O10\"\n assert candidate(formula = \"Si(C3H5O3)3Na3\") == \"C9H15Na3O9Si\"\n assert candidate(formula = \"((N2)3H)2\") == \"H2N12\"\n assert candidate(formula = \"(NH4)2Cr2O7\") == \"Cr2H8N2O7\"\n assert candidate(formula = \"(NH4)2CO3\") == \"CH8N2O3\"\n assert candidate(formula = \"Al2(SO4)3(CaCO3)4\") == \"Al2C4Ca4O24S3\"\n assert candidate(formula = \"SiC\") == \"CSi\"\n assert candidate(formula = \"(Fe(CN)6)2Fe(CN)6\") == \"C18Fe3N18\"\n assert candidate(formula = \"(C2H5OH)3(CH3COOH)2\") == \"C10H26O7\"\n assert candidate(formula = \"Fe((OH)2)3\") == \"FeH6O6\"\n assert candidate(formula = \"(NH4)3PO4(CrO4)2\") == \"Cr2H12N3O12P\"\n assert candidate(formula = \"Fe3O4(Fe(OH)2)2(SO4)3\") == \"Fe5H4O20S3\"\n assert candidate(formula = \"(KAl(SO4)2)2\") == \"Al2K2O16S4\"\n assert candidate(formula = \"Fe(CO)5\") == \"C5FeO5\"\n assert candidate(formula = \"C6H10O5\") == \"C6H10O5\"\n assert candidate(formula = \"Na3PO4\") == \"Na3O4P\"\n assert candidate(formula = \"Zn(C4H9NH)3SO4\") == \"C12H30N3O4SZn\"\n assert candidate(formula = \"MgSO4\") == \"MgO4S\"\n assert candidate(formula = \"C2H5OH\") == \"C2H6O\"\n assert candidate(formula = \"(NH4)2HPO4\") == \"H9N2O4P\"\n assert candidate(formula = \"CaSO4\") == \"CaO4S\"\n assert candidate(formula = \"C2H5OH(CH3CH2OH)2\") == \"C6H18O3\"\n assert candidate(formula = \"(C2H5OH)2(CO2H)2\") == \"C6H14O6\"\n assert candidate(formula = \"((C2H5OH)2)3\") == \"C12H36O6\"\n assert candidate(formula = \"((CH3COOH)2Cu(CN)2)3\") == \"C18Cu3H24N6O12\"\n assert candidate(formula = \"BaCO3\") == \"BaCO3\"\n assert candidate(formula = \"K2CO3\") == \"CK2O3\"\n assert candidate(formula = \"Na2SiO3(Fe2(SO4)3)2\") == \"Fe4Na2O27S6Si\"\n assert candidate(formula = \"Al2(SO4)3(PO4)2\") == \"Al2O20P2S3\"\n assert candidate(formula = \"((C6H12O6)2H2O)4\") == \"C48H104O52\"\n assert candidate(formula = \"Na2SiO3(Al(OH)4)2\") == \"Al2H8Na2O11Si\"\n assert candidate(formula = \"Fe(Fe(OH)2)2(SO4)3\") == \"Fe3H4O16S3\"\n assert candidate(formula = \"((H2O)2SiO2)3\") == \"H12O12Si3\"\n assert candidate(formula = \"Ag(NH3)2Cl\") == \"AgClH6N2\"\n assert candidate(formula = \"(K4(ON(SO3)2)2)2\") == \"K8N4O28S8\"\n assert candidate(formula = \"(H2SO4)3\") == \"H6O12S3\"\n assert candidate(formula = \"(CH3COOH)2\") == \"C4H8O4\"\n assert candidate(formula = \"Cu3(PO4)2(F2)3\") == \"Cu3F6O8P2\"\n assert candidate(formula = \"(Fe(NO3)3)3\") == \"Fe3N9O27\"\n assert candidate(formula = \"FePO4\") == \"FeO4P\"\n assert candidate(formula = \"(C6H12O6)2\") == \"C12H24O12\"\n assert candidate(formula = \"Fe(CO)4(Fe(OH)2)2(SO4)3\") == \"C4Fe3H4O20S3\"\n assert candidate(formula = \"(C2H5OH)3\") == \"C6H18O3\"\n assert candidate(formula = \"C5H8O2\") == \"C5H8O2\"\n assert candidate(formula = \"(MgSO4)2\") == \"Mg2O8S2\"\n assert candidate(formula = \"C9H8O4\") == \"C9H8O4\"\n assert candidate(formula = \"(C5H12O)2\") == \"C10H24O2\"\n assert candidate(formula = \"Si2(H2O)3(PO4)2\") == \"H6O11P2Si2\"\n assert candidate(formula = \"Fe3(PO4)2(CaCO3)3\") == \"C3Ca3Fe3O17P2\"\n assert candidate(formula = \"Na2SO4\") == \"Na2O4S\"\n assert candidate(formula = \"Hg2(NO3)2\") == \"Hg2N2O6\"\n assert candidate(formula = \"K2Cr2O7((NH4)2SO4)3(CuSO4)5\") == \"Cr2Cu5H24K2N6O39S8\"\n assert candidate(formula = \"Na2S2O3\") == \"Na2O3S2\"\n assert candidate(formula = \"(K2Cr2O7)2\") == \"Cr4K4O14\"\n assert candidate(formula = \"K2(CrO4)2(H2O)2\") == \"Cr2H4K2O10\"\n assert candidate(formula = \"Fe3O4(Fe(OH)2)2\") == \"Fe5H4O8\"\n assert candidate(formula = \"Na2CO3\") == \"CNa2O3\"\n assert candidate(formula = \"Fe2(SO4)3\") == \"Fe2O12S3\"\n assert candidate(formula = \"Ni(CO)4\") == \"C4NiO4\"\n assert candidate(formula = \"Pb3O4\") == \"O4Pb3\"\n assert candidate(formula = \"((CO3)2Ca)3\") == \"C6Ca3O18\"\n assert candidate(formula = \"(SiO2)3(Al(OH)4)2\") == \"Al2H8O14Si3\"\n assert candidate(formula = \"CuSO4((NH4)2S)2\") == \"CuH16N4O4S3\"\n assert candidate(formula = \"((C2H5)2O)4\") == \"C16H40O4\"\n assert candidate(formula = \"(CH3(CH2)4CH3)3\") == \"C18H42\"\n assert candidate(formula = \"((H2O)2SiO2)2\") == \"H8O8Si2\"\n assert candidate(formula = \"CuSO4(Fe(CN)6)2\") == \"C12CuFe2N12O4S\"\n assert candidate(formula = \"Ca3(PO4)2(H2O)12\") == \"Ca3H24O20P2\"\n assert candidate(formula = \"(NH3)3PO4\") == \"H9N3O4P\"\n assert candidate(formula = \"FeS\") == \"FeS\"\n assert candidate(formula = \"Fe3O4(SO4)3\") == \"Fe3O16S3\"\n assert candidate(formula = \"(CaCO3)3\") == \"C3Ca3O9\"\n assert candidate(formula = \"Fe3O4\") == \"Fe3O4\"\n assert candidate(formula = \"(C2H3O2)2Mg\") == \"C4H6MgO4\"\n assert candidate(formula = \"(C6H10O4)3Na3\") == \"C18H30Na3O12\"\n assert candidate(formula = \"Ca(ClO)2\") == \"CaCl2O2\"\n assert candidate(formula = \"(C2H5OH)2\") == \"C4H12O2\"\n assert candidate(formula = \"Fe(CO3)3(Cu(NO3)2)4\") == \"C3Cu4FeN8O33\"\n assert candidate(formula = \"Fe(H2O)6(SO4)3\") == \"FeH12O18S3\"\n assert candidate(formula = \"Ag(NH3)2(NO3)3\") == \"AgH6N5O9\"\n assert candidate(formula = \"(CH3CH2OH)2\") == \"C4H12O2\"\n assert candidate(formula = \"SrTiO3\") == \"O3SrTi\"\n assert candidate(formula = \"Fe(CO)5(CN)2\") == \"C7FeN2O5\"\n assert candidate(formula = \"Fe2O3\") == \"Fe2O3\"\n assert candidate(formula = \"((CO2)2)3\") == \"C6O12\"\n assert candidate(formula = \"(SiO2)3\") == \"O6Si3\"\n assert candidate(formula = \"(Fe(CN)6)3\") == \"C18Fe3N18\"\n assert candidate(formula = \"C6H8O7\") == \"C6H8O7\"\n assert candidate(formula = \"(NH4)2S\") == \"H8N2S\"\n assert candidate(formula = \"(C6H10O5)6\") == \"C36H60O30\"\n assert candidate(formula = \"Pb(NO3)4\") == \"N4O12Pb\"\n assert candidate(formula = \"((NH3)2)3\") == \"H18N6\"\n assert candidate(formula = \"CaCO3(MgCO3)2(SiO2)4\") == \"C3CaMg2O17Si4\"\n assert candidate(formula = \"(Fe(CN)6)2Fe(CO)5\") == \"C17Fe3N12O5\"\n assert candidate(formula = \"C3H6(CO2)2\") == \"C5H6O4\"\n assert candidate(formula = \"(NH4)2SO4(Fe(CN)6)2\") == \"C12Fe2H8N14O4S\"\n assert candidate(formula = \"((H2CO3)2)2\") == \"C4H8O12\"\n assert candidate(formula = \"(K2(Ca(CO3)2)3)4\") == \"C24Ca12K8O72\"\n assert candidate(formula = \"Fe(CO)3(PO4)2\") == \"C3FeO11P2\"\n assert candidate(formula = \"Fe(NO3)3(PO4)2\") == \"FeN3O17P2\"\n assert candidate(formula = \"((CH3)3CO)2Si(CH3)2\") == \"C10H24O2Si\"\n assert candidate(formula = \"CaO\") == \"CaO\"\n assert candidate(formula = \"CaCO3\") == \"CCaO3\"\n assert candidate(formula = \"(NH4)2SO4Fe3(PO4)2\") == \"Fe3H8N2O12P2S\"\n assert candidate(formula = \"Fe(NO3)2(MgSO4)2\") == \"FeMg2N2O14S2\"\n assert candidate(formula = \"FeCl2\") == \"Cl2Fe\"\n assert candidate(formula = \"Fe3O4(NiO2)2Fe2O3\") == \"Fe5Ni2O11\"\n assert candidate(formula = \"((NH4)2SO4)2\") == \"H16N4O8S2\"\n assert candidate(formula = \"CaSiO3\") == \"CaO3Si\"\n assert candidate(formula = \"Ag(Ag(BrO3)2)2\") == \"Ag3Br4O12\"\n assert candidate(formula = \"(C6H5COOH)2Fe\") == \"C14FeH12O4\"\n"}, "metadata": {"canonical_parameter_names": ["formula"], "leetcode_dataset_entry_point": "Solution().countOfAtoms", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var countOfAtoms = function(formula) {", "container": null, "callable": "countOfAtoms", "parameters": [{"name": "formula", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 728, "task_id": "self-dividing-numbers", "difficulty": "Easy", "problem_description": "A self-dividing number is a number that is divisible by every digit it contains.\n\nFor example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0.\n\nA self-dividing number is not allowed to contain the digit zero.\nGiven two integers left and right, return a list of all the self-dividing numbers in the range [left, right] (both inclusive).\n \nExample 1:\nInput: left = 1, right = 22\nOutput: [1,2,3,4,5,6,7,8,9,11,12,15,22]\nExample 2:\nInput: left = 47, right = 85\nOutput: [48,55,66,77]\n\n \nConstraints:\n\n1 <= left <= right <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(left = 120,right = 130) == [122, 124, 126, 128]\n assert candidate(left = 47,right = 85) == [48, 55, 66, 77]\n assert candidate(left = 1,right = 100) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22, 24, 33, 36, 44, 48, 55, 66, 77, 88, 99]\n assert candidate(left = 9990,right = 10000) == [9999]\n assert candidate(left = 500,right = 700) == [515, 555, 612, 624, 636, 648, 666, 672]\n assert candidate(left = 10,right = 30) == [11, 12, 15, 22, 24]\n assert candidate(left = 10,right = 50) == [11, 12, 15, 22, 24, 33, 36, 44, 48]\n assert candidate(left = 90,right = 100) == [99]\n assert candidate(left = 90,right = 99) == [99]\n assert candidate(left = 1,right = 22) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22]\n assert candidate(left = 100,right = 200) == [111, 112, 115, 122, 124, 126, 128, 132, 135, 144, 155, 162, 168, 175, 184]\n assert candidate(left = 5000,right = 5500) == [5115, 5155, 5355]\n assert candidate(left = 900,right = 1000) == [936, 999]\n assert candidate(left = 1200,right = 1250) == [1212, 1222, 1224, 1236, 1244, 1248]\n assert candidate(left = 9990,right = 10010) == [9999]\n assert candidate(left = 1000,right = 1100) == []\n assert candidate(left = 1,right = 10000) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22, 24, 33, 36, 44, 48, 55, 66, 77, 88, 99, 111, 112, 115, 122, 124, 126, 128, 132, 135, 144, 155, 162, 168, 175, 184, 212, 216, 222, 224, 244, 248, 264, 288, 312, 315, 324, 333, 336, 366, 384, 396, 412, 424, 432, 444, 448, 488, 515, 555, 612, 624, 636, 648, 666, 672, 728, 735, 777, 784, 816, 824, 848, 864, 888, 936, 999, 1111, 1112, 1113, 1115, 1116, 1122, 1124, 1128, 1131, 1144, 1155, 1164, 1176, 1184, 1197, 1212, 1222, 1224, 1236, 1244, 1248, 1266, 1288, 1296, 1311, 1326, 1332, 1335, 1344, 1362, 1368, 1395, 1412, 1416, 1424, 1444, 1448, 1464, 1488, 1515, 1555, 1575, 1626, 1632, 1644, 1662, 1692, 1715, 1722, 1764, 1771, 1824, 1848, 1888, 1926, 1935, 1944, 1962, 2112, 2122, 2124, 2128, 2136, 2144, 2166, 2184, 2196, 2212, 2222, 2224, 2226, 2232, 2244, 2248, 2262, 2288, 2316, 2322, 2328, 2364, 2412, 2424, 2436, 2444, 2448, 2488, 2616, 2622, 2664, 2688, 2744, 2772, 2824, 2832, 2848, 2888, 2916, 3111, 3126, 3132, 3135, 3144, 3162, 3168, 3171, 3195, 3216, 3222, 3264, 3276, 3288, 3312, 3315, 3324, 3333, 3336, 3339, 3366, 3384, 3393, 3432, 3444, 3492, 3555, 3612, 3624, 3636, 3648, 3666, 3717, 3816, 3864, 3888, 3915, 3924, 3933, 3996, 4112, 4116, 4124, 4128, 4144, 4164, 4172, 4184, 4212, 4224, 4236, 4244, 4248, 4288, 4332, 4344, 4368, 4392, 4412, 4416, 4424, 4444, 4448, 4464, 4488, 4632, 4644, 4824, 4848, 4872, 4888, 4896, 4932, 4968, 5115, 5155, 5355, 5515, 5535, 5555, 5775, 6126, 6132, 6144, 6162, 6168, 6192, 6216, 6222, 6264, 6288, 6312, 6324, 6336, 6366, 6384, 6432, 6444, 6612, 6624, 6636, 6648, 6666, 6696, 6762, 6816, 6864, 6888, 6912, 6966, 6984, 7112, 7119, 7175, 7224, 7266, 7371, 7448, 7476, 7644, 7728, 7777, 7784, 8112, 8128, 8136, 8144, 8184, 8224, 8232, 8248, 8288, 8328, 8424, 8448, 8488, 8496, 8616, 8664, 8688, 8736, 8824, 8832, 8848, 8888, 8928, 9126, 9135, 9144, 9162, 9216, 9288, 9315, 9324, 9333, 9396, 9432, 9612, 9648, 9666, 9864, 9936, 9999]\n assert candidate(left = 800,right = 999) == [816, 824, 848, 864, 888, 936, 999]\n assert candidate(left = 1234,right = 4321) == [1236, 1244, 1248, 1266, 1288, 1296, 1311, 1326, 1332, 1335, 1344, 1362, 1368, 1395, 1412, 1416, 1424, 1444, 1448, 1464, 1488, 1515, 1555, 1575, 1626, 1632, 1644, 1662, 1692, 1715, 1722, 1764, 1771, 1824, 1848, 1888, 1926, 1935, 1944, 1962, 2112, 2122, 2124, 2128, 2136, 2144, 2166, 2184, 2196, 2212, 2222, 2224, 2226, 2232, 2244, 2248, 2262, 2288, 2316, 2322, 2328, 2364, 2412, 2424, 2436, 2444, 2448, 2488, 2616, 2622, 2664, 2688, 2744, 2772, 2824, 2832, 2848, 2888, 2916, 3111, 3126, 3132, 3135, 3144, 3162, 3168, 3171, 3195, 3216, 3222, 3264, 3276, 3288, 3312, 3315, 3324, 3333, 3336, 3339, 3366, 3384, 3393, 3432, 3444, 3492, 3555, 3612, 3624, 3636, 3648, 3666, 3717, 3816, 3864, 3888, 3915, 3924, 3933, 3996, 4112, 4116, 4124, 4128, 4144, 4164, 4172, 4184, 4212, 4224, 4236, 4244, 4248, 4288]\n assert candidate(left = 990,right = 1010) == [999]\n assert candidate(left = 8888,right = 8888) == [8888]\n assert candidate(left = 250,right = 350) == [264, 288, 312, 315, 324, 333, 336]\n assert candidate(left = 800,right = 1200) == [816, 824, 848, 864, 888, 936, 999, 1111, 1112, 1113, 1115, 1116, 1122, 1124, 1128, 1131, 1144, 1155, 1164, 1176, 1184, 1197]\n assert candidate(left = 150,right = 500) == [155, 162, 168, 175, 184, 212, 216, 222, 224, 244, 248, 264, 288, 312, 315, 324, 333, 336, 366, 384, 396, 412, 424, 432, 444, 448, 488]\n assert candidate(left = 1234,right = 1244) == [1236, 1244]\n assert candidate(left = 333,right = 666) == [333, 336, 366, 384, 396, 412, 424, 432, 444, 448, 488, 515, 555, 612, 624, 636, 648, 666]\n assert candidate(left = 678,right = 789) == [728, 735, 777, 784]\n assert candidate(left = 4000,right = 4500) == [4112, 4116, 4124, 4128, 4144, 4164, 4172, 4184, 4212, 4224, 4236, 4244, 4248, 4288, 4332, 4344, 4368, 4392, 4412, 4416, 4424, 4444, 4448, 4464, 4488]\n assert candidate(left = 1234,right = 1250) == [1236, 1244, 1248]\n assert candidate(left = 888,right = 999) == [888, 936, 999]\n assert candidate(left = 2020,right = 2120) == [2112]\n assert candidate(left = 5678,right = 9876) == [5775, 6126, 6132, 6144, 6162, 6168, 6192, 6216, 6222, 6264, 6288, 6312, 6324, 6336, 6366, 6384, 6432, 6444, 6612, 6624, 6636, 6648, 6666, 6696, 6762, 6816, 6864, 6888, 6912, 6966, 6984, 7112, 7119, 7175, 7224, 7266, 7371, 7448, 7476, 7644, 7728, 7777, 7784, 8112, 8128, 8136, 8144, 8184, 8224, 8232, 8248, 8288, 8328, 8424, 8448, 8488, 8496, 8616, 8664, 8688, 8736, 8824, 8832, 8848, 8888, 8928, 9126, 9135, 9144, 9162, 9216, 9288, 9315, 9324, 9333, 9396, 9432, 9612, 9648, 9666, 9864]\n assert candidate(left = 90,right = 150) == [99, 111, 112, 115, 122, 124, 126, 128, 132, 135, 144]\n assert candidate(left = 2000,right = 3000) == [2112, 2122, 2124, 2128, 2136, 2144, 2166, 2184, 2196, 2212, 2222, 2224, 2226, 2232, 2244, 2248, 2262, 2288, 2316, 2322, 2328, 2364, 2412, 2424, 2436, 2444, 2448, 2488, 2616, 2622, 2664, 2688, 2744, 2772, 2824, 2832, 2848, 2888, 2916]\n assert candidate(left = 6000,right = 6100) == []\n assert candidate(left = 200,right = 800) == [212, 216, 222, 224, 244, 248, 264, 288, 312, 315, 324, 333, 336, 366, 384, 396, 412, 424, 432, 444, 448, 488, 515, 555, 612, 624, 636, 648, 666, 672, 728, 735, 777, 784]\n assert candidate(left = 8888,right = 9999) == [8888, 8928, 9126, 9135, 9144, 9162, 9216, 9288, 9315, 9324, 9333, 9396, 9432, 9612, 9648, 9666, 9864, 9936, 9999]\n assert candidate(left = 5600,right = 5700) == []\n assert candidate(left = 8900,right = 8950) == [8928]\n assert candidate(left = 1234,right = 1240) == [1236]\n assert candidate(left = 10000,right = 10400) == []\n assert candidate(left = 3030,right = 3130) == [3111, 3126]\n assert candidate(left = 2500,right = 3000) == [2616, 2622, 2664, 2688, 2744, 2772, 2824, 2832, 2848, 2888, 2916]\n assert candidate(left = 7000,right = 7777) == [7112, 7119, 7175, 7224, 7266, 7371, 7448, 7476, 7644, 7728, 7777]\n assert candidate(left = 700,right = 1000) == [728, 735, 777, 784, 816, 824, 848, 864, 888, 936, 999]\n assert candidate(left = 990,right = 1000) == [999]\n assert candidate(left = 5000,right = 6000) == [5115, 5155, 5355, 5515, 5535, 5555, 5775]\n assert candidate(left = 6789,right = 9876) == [6816, 6864, 6888, 6912, 6966, 6984, 7112, 7119, 7175, 7224, 7266, 7371, 7448, 7476, 7644, 7728, 7777, 7784, 8112, 8128, 8136, 8144, 8184, 8224, 8232, 8248, 8288, 8328, 8424, 8448, 8488, 8496, 8616, 8664, 8688, 8736, 8824, 8832, 8848, 8888, 8928, 9126, 9135, 9144, 9162, 9216, 9288, 9315, 9324, 9333, 9396, 9432, 9612, 9648, 9666, 9864]\n assert candidate(left = 10000,right = 10050) == []\n assert candidate(left = 7000,right = 7500) == [7112, 7119, 7175, 7224, 7266, 7371, 7448, 7476]\n assert candidate(left = 8888,right = 9000) == [8888, 8928]\n assert candidate(left = 8000,right = 8999) == [8112, 8128, 8136, 8144, 8184, 8224, 8232, 8248, 8288, 8328, 8424, 8448, 8488, 8496, 8616, 8664, 8688, 8736, 8824, 8832, 8848, 8888, 8928]\n assert candidate(left = 1000,right = 1500) == [1111, 1112, 1113, 1115, 1116, 1122, 1124, 1128, 1131, 1144, 1155, 1164, 1176, 1184, 1197, 1212, 1222, 1224, 1236, 1244, 1248, 1266, 1288, 1296, 1311, 1326, 1332, 1335, 1344, 1362, 1368, 1395, 1412, 1416, 1424, 1444, 1448, 1464, 1488]\n assert candidate(left = 1111,right = 1111) == [1111]\n assert candidate(left = 555,right = 5555) == [555, 612, 624, 636, 648, 666, 672, 728, 735, 777, 784, 816, 824, 848, 864, 888, 936, 999, 1111, 1112, 1113, 1115, 1116, 1122, 1124, 1128, 1131, 1144, 1155, 1164, 1176, 1184, 1197, 1212, 1222, 1224, 1236, 1244, 1248, 1266, 1288, 1296, 1311, 1326, 1332, 1335, 1344, 1362, 1368, 1395, 1412, 1416, 1424, 1444, 1448, 1464, 1488, 1515, 1555, 1575, 1626, 1632, 1644, 1662, 1692, 1715, 1722, 1764, 1771, 1824, 1848, 1888, 1926, 1935, 1944, 1962, 2112, 2122, 2124, 2128, 2136, 2144, 2166, 2184, 2196, 2212, 2222, 2224, 2226, 2232, 2244, 2248, 2262, 2288, 2316, 2322, 2328, 2364, 2412, 2424, 2436, 2444, 2448, 2488, 2616, 2622, 2664, 2688, 2744, 2772, 2824, 2832, 2848, 2888, 2916, 3111, 3126, 3132, 3135, 3144, 3162, 3168, 3171, 3195, 3216, 3222, 3264, 3276, 3288, 3312, 3315, 3324, 3333, 3336, 3339, 3366, 3384, 3393, 3432, 3444, 3492, 3555, 3612, 3624, 3636, 3648, 3666, 3717, 3816, 3864, 3888, 3915, 3924, 3933, 3996, 4112, 4116, 4124, 4128, 4144, 4164, 4172, 4184, 4212, 4224, 4236, 4244, 4248, 4288, 4332, 4344, 4368, 4392, 4412, 4416, 4424, 4444, 4448, 4464, 4488, 4632, 4644, 4824, 4848, 4872, 4888, 4896, 4932, 4968, 5115, 5155, 5355, 5515, 5535, 5555]\n assert candidate(left = 9000,right = 10000) == [9126, 9135, 9144, 9162, 9216, 9288, 9315, 9324, 9333, 9396, 9432, 9612, 9648, 9666, 9864, 9936, 9999]\n assert candidate(left = 3000,right = 5000) == [3111, 3126, 3132, 3135, 3144, 3162, 3168, 3171, 3195, 3216, 3222, 3264, 3276, 3288, 3312, 3315, 3324, 3333, 3336, 3339, 3366, 3384, 3393, 3432, 3444, 3492, 3555, 3612, 3624, 3636, 3648, 3666, 3717, 3816, 3864, 3888, 3915, 3924, 3933, 3996, 4112, 4116, 4124, 4128, 4144, 4164, 4172, 4184, 4212, 4224, 4236, 4244, 4248, 4288, 4332, 4344, 4368, 4392, 4412, 4416, 4424, 4444, 4448, 4464, 4488, 4632, 4644, 4824, 4848, 4872, 4888, 4896, 4932, 4968]\n assert candidate(left = 7500,right = 7800) == [7644, 7728, 7777, 7784]\n assert candidate(left = 1000,right = 2000) == [1111, 1112, 1113, 1115, 1116, 1122, 1124, 1128, 1131, 1144, 1155, 1164, 1176, 1184, 1197, 1212, 1222, 1224, 1236, 1244, 1248, 1266, 1288, 1296, 1311, 1326, 1332, 1335, 1344, 1362, 1368, 1395, 1412, 1416, 1424, 1444, 1448, 1464, 1488, 1515, 1555, 1575, 1626, 1632, 1644, 1662, 1692, 1715, 1722, 1764, 1771, 1824, 1848, 1888, 1926, 1935, 1944, 1962]\n assert candidate(left = 1234,right = 5678) == [1236, 1244, 1248, 1266, 1288, 1296, 1311, 1326, 1332, 1335, 1344, 1362, 1368, 1395, 1412, 1416, 1424, 1444, 1448, 1464, 1488, 1515, 1555, 1575, 1626, 1632, 1644, 1662, 1692, 1715, 1722, 1764, 1771, 1824, 1848, 1888, 1926, 1935, 1944, 1962, 2112, 2122, 2124, 2128, 2136, 2144, 2166, 2184, 2196, 2212, 2222, 2224, 2226, 2232, 2244, 2248, 2262, 2288, 2316, 2322, 2328, 2364, 2412, 2424, 2436, 2444, 2448, 2488, 2616, 2622, 2664, 2688, 2744, 2772, 2824, 2832, 2848, 2888, 2916, 3111, 3126, 3132, 3135, 3144, 3162, 3168, 3171, 3195, 3216, 3222, 3264, 3276, 3288, 3312, 3315, 3324, 3333, 3336, 3339, 3366, 3384, 3393, 3432, 3444, 3492, 3555, 3612, 3624, 3636, 3648, 3666, 3717, 3816, 3864, 3888, 3915, 3924, 3933, 3996, 4112, 4116, 4124, 4128, 4144, 4164, 4172, 4184, 4212, 4224, 4236, 4244, 4248, 4288, 4332, 4344, 4368, 4392, 4412, 4416, 4424, 4444, 4448, 4464, 4488, 4632, 4644, 4824, 4848, 4872, 4888, 4896, 4932, 4968, 5115, 5155, 5355, 5515, 5535, 5555]\n assert candidate(left = 500,right = 1500) == [515, 555, 612, 624, 636, 648, 666, 672, 728, 735, 777, 784, 816, 824, 848, 864, 888, 936, 999, 1111, 1112, 1113, 1115, 1116, 1122, 1124, 1128, 1131, 1144, 1155, 1164, 1176, 1184, 1197, 1212, 1222, 1224, 1236, 1244, 1248, 1266, 1288, 1296, 1311, 1326, 1332, 1335, 1344, 1362, 1368, 1395, 1412, 1416, 1424, 1444, 1448, 1464, 1488]\n assert candidate(left = 7700,right = 7800) == [7728, 7777, 7784]\n assert candidate(left = 1234,right = 2000) == [1236, 1244, 1248, 1266, 1288, 1296, 1311, 1326, 1332, 1335, 1344, 1362, 1368, 1395, 1412, 1416, 1424, 1444, 1448, 1464, 1488, 1515, 1555, 1575, 1626, 1632, 1644, 1662, 1692, 1715, 1722, 1764, 1771, 1824, 1848, 1888, 1926, 1935, 1944, 1962]\n assert candidate(left = 9000,right = 9999) == [9126, 9135, 9144, 9162, 9216, 9288, 9315, 9324, 9333, 9396, 9432, 9612, 9648, 9666, 9864, 9936, 9999]\n assert candidate(left = 9800,right = 9900) == [9864]\n assert candidate(left = 123,right = 456) == [124, 126, 128, 132, 135, 144, 155, 162, 168, 175, 184, 212, 216, 222, 224, 244, 248, 264, 288, 312, 315, 324, 333, 336, 366, 384, 396, 412, 424, 432, 444, 448]\n assert candidate(left = 4000,right = 6000) == [4112, 4116, 4124, 4128, 4144, 4164, 4172, 4184, 4212, 4224, 4236, 4244, 4248, 4288, 4332, 4344, 4368, 4392, 4412, 4416, 4424, 4444, 4448, 4464, 4488, 4632, 4644, 4824, 4848, 4872, 4888, 4896, 4932, 4968, 5115, 5155, 5355, 5515, 5535, 5555, 5775]\n assert candidate(left = 99,right = 999) == [99, 111, 112, 115, 122, 124, 126, 128, 132, 135, 144, 155, 162, 168, 175, 184, 212, 216, 222, 224, 244, 248, 264, 288, 312, 315, 324, 333, 336, 366, 384, 396, 412, 424, 432, 444, 448, 488, 515, 555, 612, 624, 636, 648, 666, 672, 728, 735, 777, 784, 816, 824, 848, 864, 888, 936, 999]\n assert candidate(left = 500,right = 800) == [515, 555, 612, 624, 636, 648, 666, 672, 728, 735, 777, 784]\n assert candidate(left = 500,right = 1000) == [515, 555, 612, 624, 636, 648, 666, 672, 728, 735, 777, 784, 816, 824, 848, 864, 888, 936, 999]\n assert candidate(left = 111,right = 999) == [111, 112, 115, 122, 124, 126, 128, 132, 135, 144, 155, 162, 168, 175, 184, 212, 216, 222, 224, 244, 248, 264, 288, 312, 315, 324, 333, 336, 366, 384, 396, 412, 424, 432, 444, 448, 488, 515, 555, 612, 624, 636, 648, 666, 672, 728, 735, 777, 784, 816, 824, 848, 864, 888, 936, 999]\n assert candidate(left = 1024,right = 1024) == []\n assert candidate(left = 5000,right = 9999) == [5115, 5155, 5355, 5515, 5535, 5555, 5775, 6126, 6132, 6144, 6162, 6168, 6192, 6216, 6222, 6264, 6288, 6312, 6324, 6336, 6366, 6384, 6432, 6444, 6612, 6624, 6636, 6648, 6666, 6696, 6762, 6816, 6864, 6888, 6912, 6966, 6984, 7112, 7119, 7175, 7224, 7266, 7371, 7448, 7476, 7644, 7728, 7777, 7784, 8112, 8128, 8136, 8144, 8184, 8224, 8232, 8248, 8288, 8328, 8424, 8448, 8488, 8496, 8616, 8664, 8688, 8736, 8824, 8832, 8848, 8888, 8928, 9126, 9135, 9144, 9162, 9216, 9288, 9315, 9324, 9333, 9396, 9432, 9612, 9648, 9666, 9864, 9936, 9999]\n assert candidate(left = 800,right = 899) == [816, 824, 848, 864, 888]\n assert candidate(left = 10000,right = 10004) == []\n assert candidate(left = 10000,right = 10000) == []\n assert candidate(left = 900,right = 990) == [936]\n assert candidate(left = 200,right = 300) == [212, 216, 222, 224, 244, 248, 264, 288]\n assert candidate(left = 1111,right = 1115) == [1111, 1112, 1113, 1115]\n assert candidate(left = 1000,right = 10000) == [1111, 1112, 1113, 1115, 1116, 1122, 1124, 1128, 1131, 1144, 1155, 1164, 1176, 1184, 1197, 1212, 1222, 1224, 1236, 1244, 1248, 1266, 1288, 1296, 1311, 1326, 1332, 1335, 1344, 1362, 1368, 1395, 1412, 1416, 1424, 1444, 1448, 1464, 1488, 1515, 1555, 1575, 1626, 1632, 1644, 1662, 1692, 1715, 1722, 1764, 1771, 1824, 1848, 1888, 1926, 1935, 1944, 1962, 2112, 2122, 2124, 2128, 2136, 2144, 2166, 2184, 2196, 2212, 2222, 2224, 2226, 2232, 2244, 2248, 2262, 2288, 2316, 2322, 2328, 2364, 2412, 2424, 2436, 2444, 2448, 2488, 2616, 2622, 2664, 2688, 2744, 2772, 2824, 2832, 2848, 2888, 2916, 3111, 3126, 3132, 3135, 3144, 3162, 3168, 3171, 3195, 3216, 3222, 3264, 3276, 3288, 3312, 3315, 3324, 3333, 3336, 3339, 3366, 3384, 3393, 3432, 3444, 3492, 3555, 3612, 3624, 3636, 3648, 3666, 3717, 3816, 3864, 3888, 3915, 3924, 3933, 3996, 4112, 4116, 4124, 4128, 4144, 4164, 4172, 4184, 4212, 4224, 4236, 4244, 4248, 4288, 4332, 4344, 4368, 4392, 4412, 4416, 4424, 4444, 4448, 4464, 4488, 4632, 4644, 4824, 4848, 4872, 4888, 4896, 4932, 4968, 5115, 5155, 5355, 5515, 5535, 5555, 5775, 6126, 6132, 6144, 6162, 6168, 6192, 6216, 6222, 6264, 6288, 6312, 6324, 6336, 6366, 6384, 6432, 6444, 6612, 6624, 6636, 6648, 6666, 6696, 6762, 6816, 6864, 6888, 6912, 6966, 6984, 7112, 7119, 7175, 7224, 7266, 7371, 7448, 7476, 7644, 7728, 7777, 7784, 8112, 8128, 8136, 8144, 8184, 8224, 8232, 8248, 8288, 8328, 8424, 8448, 8488, 8496, 8616, 8664, 8688, 8736, 8824, 8832, 8848, 8888, 8928, 9126, 9135, 9144, 9162, 9216, 9288, 9315, 9324, 9333, 9396, 9432, 9612, 9648, 9666, 9864, 9936, 9999]\n assert candidate(left = 1200,right = 1300) == [1212, 1222, 1224, 1236, 1244, 1248, 1266, 1288, 1296]\n assert candidate(left = 3000,right = 3500) == [3111, 3126, 3132, 3135, 3144, 3162, 3168, 3171, 3195, 3216, 3222, 3264, 3276, 3288, 3312, 3315, 3324, 3333, 3336, 3339, 3366, 3384, 3393, 3432, 3444, 3492]\n"}, "metadata": {"canonical_parameter_names": ["left", "right"], "leetcode_dataset_entry_point": "Solution().selfDividingNumbers", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var selfDividingNumbers = function(left, right) {", "container": null, "callable": "selfDividingNumbers", "parameters": [{"name": "left", "type": "number"}, {"name": "right", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 730, "task_id": "count-different-palindromic-subsequences", "difficulty": "Hard", "problem_description": "Given a string s, return the number of different non-empty palindromic subsequences in s. Since the answer may be very large, return it modulo 109 + 7.\nA subsequence of a string is obtained by deleting zero or more characters from the string.\nA sequence is palindromic if it is equal to the sequence reversed.\nTwo sequences a1, a2, ... and b1, b2, ... are different if there is some i for which ai != bi.\n \nExample 1:\n\nInput: s = \"bccb\"\nOutput: 6\nExplanation: The 6 different non-empty palindromic subsequences are 'b', 'c', 'bb', 'cc', 'bcb', 'bccb'.\nNote that 'bcb' is counted only once, even though it occurs twice.\n\nExample 2:\n\nInput: s = \"abcdabcdabcdabcdabcdabcdabcdabcddcbadcbadcbadcbadcbadcbadcbadcba\"\nOutput: 104860361\nExplanation: There are 3104860382 different non-empty palindromic subsequences, which is 104860361 modulo 109 + 7.\n\n \nConstraints:\n\n1 <= s.length <= 1000\ns[i] is either 'a', 'b', 'c', or 'd'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"abba\") == 6\n assert candidate(s = \"abccba\") == 14\n assert candidate(s = \"abcba\") == 10\n assert candidate(s = \"abac\") == 5\n assert candidate(s = \"a\") == 1\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcddcbadcbadcbadcbadcbadcbadcbadcba\") == 104860361\n assert candidate(s = \"aabbaa\") == 10\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcd\") == 29348\n assert candidate(s = \"abcddcba\") == 30\n assert candidate(s = \"bccb\") == 6\n assert candidate(s = \"aaa\") == 3\n assert candidate(s = \"abcd\") == 4\n assert candidate(s = \"aabb\") == 4\n assert candidate(s = \"aaaa\") == 4\n assert candidate(s = \"abab\") == 6\n assert candidate(s = \"abacabadabacabadabacaba\") == 2571\n assert candidate(s = \"ababbabaabbababbab\") == 212\n assert candidate(s = \"aabbaabbaabb\") == 44\n assert candidate(s = \"aaaabbbbccccaaaabbbbccccaaaabbbbcccc\") == 996\n assert candidate(s = \"ddccbbbaaacccbdd\") == 94\n assert candidate(s = \"abcabcabcabc\") == 84\n assert candidate(s = \"aaaaabbbbbccccddddaaaaabbbbbccccddddaaaaabbbbbccccddddaaaaabbbbbccccddddaaaaabbbbbccccddddaaaaabbbbbccccddddaaaaabbbbbccccdddd\") == 127372410\n assert candidate(s = \"abcddcbaabcddcba\") == 340\n assert candidate(s = \"abcdabcdabcd\") == 72\n assert candidate(s = \"abababababababababababababababab\") == 8358\n assert candidate(s = \"aaaabbbbccccddddaaaabbbbccccdddd\") == 224\n assert candidate(s = \"abacaba\") == 19\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\") == 450061485\n assert candidate(s = \"aaaabbbaaaaabbbbaaaaabbbbaaaaabbbbaaaaabbbbaaaaabbbbaaaa\") == 61293\n assert candidate(s = \"abcdcba\") == 22\n assert candidate(s = \"acbdca\") == 14\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\") == 320164\n assert candidate(s = \"ababababababababababababababababababababababababababababababababababababababababababab\") == 672623781\n assert candidate(s = \"abcdbca\") == 20\n assert candidate(s = \"abccbaabccbaabccba\") == 446\n assert candidate(s = \"abcdabcdaabbccbddc\") == 184\n assert candidate(s = \"ababababababab\") == 106\n assert candidate(s = \"abababababab\") == 64\n assert candidate(s = \"abcababcababcababcababcababcababcababcab\") == 237716\n assert candidate(s = \"abcdabcdaabbccbddcddcbaabccbddcddcba\") == 17166\n assert candidate(s = \"abcabcabcabcabcabc\") == 504\n assert candidate(s = \"aababaababaababaababaababaababaababaababaababaababa\") == 442187\n assert candidate(s = \"abbbccaddccbbbaabbbccaddccbbba\") == 4260\n assert candidate(s = \"abcdabcdabcdabcd\") == 244\n assert candidate(s = \"abcdabcdabcdabcdabcd\") == 812\n assert candidate(s = \"ddccbbbaaacccbbbaaacccbdd\") == 607\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\") == 38097140\n assert candidate(s = \"dddddddddddddddddddddddd\") == 24\n assert candidate(s = \"abababababababababab\") == 462\n assert candidate(s = \"aaaaa\") == 5\n assert candidate(s = \"abacabadabacaba\") == 232\n assert candidate(s = \"dcbadcbadcbadcbadcbadcb\") == 2219\n assert candidate(s = \"aabababababababa\") == 161\n assert candidate(s = \"abcdabcd\") == 20\n assert candidate(s = \"aaaaabbbbbcccc\") == 14\n assert candidate(s = \"abccccddddddbbbaaaadddbbbbccccaaaabbbccbbccbbccbbccbbccbbccbbbbaaaaddbbbbccccaaaaadddbbbbccccaaaabbbccbbccbbccbbccbbccbbccbbbbaaaadd\") == 584072730\n assert candidate(s = \"dcbaabcd\") == 30\n assert candidate(s = \"abcabcdabcabcdabcabcdabcabcdabcabcdabcabcdabcabcdabcabcdabcabcdabcabcdabcabcd\") == 852725823\n assert candidate(s = \"abcdabcdbabcdbabcdb\") == 607\n assert candidate(s = \"aaaabbbbccccdddd\") == 16\n assert candidate(s = \"abacabadabacabadabacabad\") == 2784\n assert candidate(s = \"abbaabbaabba\") == 54\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcd\") == 96936\n assert candidate(s = \"aabbccddccbbaa\") == 106\n assert candidate(s = \"abccbaabcba\") == 56\n assert candidate(s = \"abababababababababababab\") == 1216\n assert candidate(s = \"ababababab\") == 38\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcda\") == 198263755\n assert candidate(s = \"abcabc\") == 12\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\") == 125826312\n assert candidate(s = \"abcdcbadcbadcbabcd\") == 432\n assert candidate(s = \"abcabcabcabcabcabcabcabc\") == 2952\n assert candidate(s = \"dcbbabdccacbaaadbcbbabcbbb\") == 934\n assert candidate(s = \"ababa\") == 9\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == 320443980\n assert candidate(s = \"ddddcbbaabcdccbdddbddbcccbdbabdbbaccabdbdddcbbaabaddabbdcbbaabcddbacccbadcbbaabcdccbdddbddbcccbdbabdbbaccabdbddd\") == 923039370\n assert candidate(s = \"abcadcbadcbadcb\") == 210\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcddcbadcbadcbadcbadcbadcbadcbadcbaabcd\") == 649659461\n assert candidate(s = \"abcdcbaabcdcbaabcdcba\") == 1694\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().countPalindromicSubsequences", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var countPalindromicSubsequences = function(s) {", "container": null, "callable": "countPalindromicSubsequences", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 733, "task_id": "flood-fill", "difficulty": "Easy", "problem_description": "You are given an image represented by an m x n grid of integers image, where image[i][j] represents the pixel value of the image. You are also given three integers sr, sc, and color. Your task is to perform a flood fill on the image starting from the pixel image[sr][sc].\nTo perform a flood fill:\n\nBegin with the starting pixel and change its color to color.\nPerform the same process for each pixel that is directly adjacent (pixels that share a side with the original pixel, either horizontally or vertically) and shares the same color as the starting pixel.\nKeep repeating this process by checking neighboring pixels of the updated pixels and modifying their color if it matches the original color of the starting pixel.\nThe process stops when there are no more adjacent pixels of the original color to update.\n\nReturn the modified image after performing the flood fill.\n \nExample 1:\n\nInput: image = [[1,1,1],[1,1,0],[1,0,1]], sr = 1, sc = 1, color = 2\nOutput: [[2,2,2],[2,2,0],[2,0,1]]\nExplanation:\n\nFrom the center of the image with position (sr, sc) = (1, 1) (i.e., the red pixel), all pixels connected by a path of the same color as the starting pixel (i.e., the blue pixels) are colored with the new color.\nNote the bottom corner is not colored 2, because it is not horizontally or vertically connected to the starting pixel.\n\nExample 2:\n\nInput: image = [[0,0,0],[0,0,0]], sr = 0, sc = 0, color = 0\nOutput: [[0,0,0],[0,0,0]]\nExplanation:\nThe starting pixel is already colored with 0, which is the same as the target color. Therefore, no changes are made to the image.\n\n \nConstraints:\n\nm == image.length\nn == image[i].length\n1 <= m, n <= 50\n0 <= image[i][j], color < 216\n0 <= sr < m\n0 <= sc < n\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(image = [[0, 0, 0], [0, 0, 0]],sr = 0,sc = 0,color = 0) == [[0, 0, 0], [0, 0, 0]]\n assert candidate(image = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],sr = 0,sc = 0,color = 3) == [[3, 3, 3], [3, 3, 3], [3, 3, 3]]\n assert candidate(image = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],sr = 2,sc = 2,color = 4) == [[4, 4, 4], [4, 4, 4], [4, 4, 4]]\n assert candidate(image = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],sr = 1,sc = 1,color = 10) == [[1, 2, 3], [4, 10, 6], [7, 8, 9]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]],sr = 2,sc = 2,color = 4) == [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 4, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],sr = 1,sc = 1,color = 2) == [[2, 2, 2], [2, 2, 2], [2, 2, 2]]\n assert candidate(image = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],sr = 2,sc = 2,color = 2) == [[2, 2, 2, 2], [2, 2, 2, 2], [2, 2, 2, 2], [2, 2, 2, 2]]\n assert candidate(image = [[1, 2, 3], [2, 2, 2], [3, 2, 1]],sr = 1,sc = 1,color = 1) == [[1, 1, 3], [1, 1, 1], [3, 1, 1]]\n assert candidate(image = [[1, 1, 1], [1, 1, 0], [1, 0, 1]],sr = 1,sc = 1,color = 2) == [[2, 2, 2], [2, 2, 0], [2, 0, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]],sr = 2,sc = 2,color = 5) == [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 5, 5, 2, 1], [1, 2, 5, 5, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1]],sr = 3,sc = 3,color = 4) == [[1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 2, 4, 4, 4, 4, 2, 1], [1, 2, 4, 4, 4, 4, 2, 1], [1, 2, 4, 4, 4, 4, 2, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],sr = 1,sc = 1,color = 2) == [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 1, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1], [2, 2, 2, 1], [1, 2, 2, 1], [1, 1, 1, 1]],sr = 1,sc = 1,color = 3) == [[1, 1, 1, 1], [3, 3, 3, 1], [1, 3, 3, 1], [1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3], [4, 4, 4, 4]],sr = 2,sc = 2,color = 1) == [[1, 1, 1, 1], [2, 2, 2, 2], [1, 1, 1, 1], [4, 4, 4, 4]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]],sr = 3,sc = 3,color = 5) == [[5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 2, 2, 0, 1], [1, 0, 2, 2, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]],sr = 2,sc = 2,color = 5) == [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 5, 5, 0, 1], [1, 0, 5, 5, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],sr = 0,sc = 0,color = 2) == [[2, 2, 2], [2, 2, 2], [2, 2, 2]]\n assert candidate(image = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],sr = 2,sc = 0,color = 5) == [[1, 2, 3], [4, 5, 6], [5, 8, 9]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 4, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]],sr = 3,sc = 3,color = 12) == [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 12, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 3, 0, 0, 3, 2, 1], [1, 2, 3, 0, 0, 3, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1]],sr = 3,sc = 3,color = 4) == [[1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 3, 4, 4, 3, 2, 1], [1, 2, 3, 4, 4, 3, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]],sr = 0,sc = 2,color = 5) == [[5, 5, 5, 5, 5], [5, 2, 2, 2, 5], [5, 2, 3, 2, 5], [5, 2, 2, 2, 5], [5, 5, 5, 5, 5]]\n assert candidate(image = [[2, 2, 2, 2, 2, 2], [2, 1, 1, 1, 1, 2], [2, 1, 3, 3, 1, 2], [2, 1, 3, 3, 1, 2], [2, 1, 1, 1, 1, 2], [2, 2, 2, 2, 2, 2]],sr = 2,sc = 2,color = 4) == [[2, 2, 2, 2, 2, 2], [2, 1, 1, 1, 1, 2], [2, 1, 4, 4, 1, 2], [2, 1, 4, 4, 1, 2], [2, 1, 1, 1, 1, 2], [2, 2, 2, 2, 2, 2]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]],sr = 2,sc = 2,color = 10) == [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 10, 10, 2, 1], [1, 2, 10, 10, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 2, 3, 4, 5], [1, 1, 1, 1, 1], [5, 4, 3, 2, 1], [1, 1, 1, 1, 1], [1, 2, 3, 4, 5]],sr = 2,sc = 2,color = 6) == [[1, 2, 3, 4, 5], [1, 1, 1, 1, 1], [5, 4, 6, 2, 1], [1, 1, 1, 1, 1], [1, 2, 3, 4, 5]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]],sr = 3,sc = 3,color = 2) == [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 2, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 2, 2], [1, 1, 1, 2, 2], [1, 3, 3, 3, 3], [1, 3, 3, 3, 3], [1, 4, 4, 4, 4]],sr = 0,sc = 0,color = 5) == [[5, 5, 5, 2, 2], [5, 5, 5, 2, 2], [5, 3, 3, 3, 3], [5, 3, 3, 3, 3], [5, 4, 4, 4, 4]]\n assert candidate(image = [[5, 5, 5, 5, 5, 5], [5, 4, 4, 4, 4, 5], [5, 4, 3, 3, 4, 5], [5, 4, 3, 3, 4, 5], [5, 4, 4, 4, 4, 5], [5, 5, 5, 5, 5, 5]],sr = 2,sc = 2,color = 6) == [[5, 5, 5, 5, 5, 5], [5, 4, 4, 4, 4, 5], [5, 4, 6, 6, 4, 5], [5, 4, 6, 6, 4, 5], [5, 4, 4, 4, 4, 5], [5, 5, 5, 5, 5, 5]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]],sr = 0,sc = 0,color = 8) == [[8, 8, 8, 8, 8], [8, 2, 2, 2, 8], [8, 2, 3, 2, 8], [8, 2, 2, 2, 8], [8, 8, 8, 8, 8]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 3, 0, 0, 0, 3, 2, 1], [1, 2, 3, 0, 1, 0, 3, 2, 1], [1, 2, 3, 0, 0, 0, 3, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]],sr = 4,sc = 4,color = 7) == [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 3, 0, 0, 0, 3, 2, 1], [1, 2, 3, 0, 7, 0, 3, 2, 1], [1, 2, 3, 0, 0, 0, 3, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 2, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],sr = 1,sc = 1,color = 3) == [[1, 1, 1, 1, 1], [1, 3, 3, 3, 1], [1, 3, 2, 3, 1], [1, 3, 3, 3, 1], [1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4], [5, 5, 5, 5, 5]],sr = 1,sc = 1,color = 3) == [[1, 1, 1, 1, 1], [3, 3, 3, 3, 3], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4], [5, 5, 5, 5, 5]]\n assert candidate(image = [[1, 1, 1, 1], [1, 0, 1, 1], [1, 0, 0, 1], [1, 1, 1, 1]],sr = 1,sc = 1,color = 3) == [[1, 1, 1, 1], [1, 3, 1, 1], [1, 3, 3, 1], [1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]],sr = 1,sc = 1,color = 3) == [[1, 1, 1, 1], [1, 3, 3, 1], [1, 3, 3, 1], [1, 1, 1, 1]]\n assert candidate(image = [[1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1]],sr = 2,sc = 2,color = 3) == [[1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 3, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1]]\n assert candidate(image = [[1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1], [2, 1, 2, 1, 2]],sr = 1,sc = 1,color = 3) == [[1, 2, 1, 2, 1], [2, 3, 2, 1, 2], [1, 2, 1, 2, 1], [2, 1, 2, 1, 2]]\n assert candidate(image = [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]],sr = 0,sc = 0,color = 10) == [[10, 2, 3, 4, 5], [10, 2, 3, 4, 5], [10, 2, 3, 4, 5], [10, 2, 3, 4, 5], [10, 2, 3, 4, 5]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]],sr = 2,sc = 2,color = 2) == [[2, 2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2, 2]]\n assert candidate(image = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],sr = 0,sc = 0,color = 2) == [[2, 2, 2, 2], [2, 2, 2, 2], [2, 2, 2, 2], [2, 2, 2, 2]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 2, 2, 2, 0, 1], [1, 0, 2, 3, 2, 0, 1], [1, 0, 2, 2, 2, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]],sr = 2,sc = 2,color = 9) == [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 9, 9, 9, 0, 1], [1, 0, 9, 3, 9, 0, 1], [1, 0, 9, 9, 9, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]],sr = 5,sc = 5,color = 11) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 11, 4, 3, 2, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 3, 0, 0, 3, 2, 1], [1, 2, 3, 0, 0, 3, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1]],sr = 4,sc = 4,color = 6) == [[1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 3, 6, 6, 3, 2, 1], [1, 2, 3, 6, 6, 3, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]],sr = 4,sc = 4,color = 10) == [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 10]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],sr = 2,sc = 2,color = 9) == [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 9, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]],sr = 0,sc = 0,color = 2) == [[2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]],sr = 1,sc = 3,color = 4) == [[1, 1, 1, 1, 1], [1, 4, 4, 4, 1], [1, 4, 3, 4, 1], [1, 4, 4, 4, 1], [1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]],sr = 2,sc = 2,color = 2) == [[2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2]]\n assert candidate(image = [[2, 1, 1], [1, 1, 0], [1, 0, 1]],sr = 0,sc = 1,color = 3) == [[2, 3, 3], [3, 3, 0], [3, 0, 1]]\n assert candidate(image = [[1, 1, 1, 2, 2], [1, 1, 1, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3]],sr = 0,sc = 0,color = 5) == [[5, 5, 5, 2, 2], [5, 5, 5, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]],sr = 2,sc = 2,color = 4) == [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 4, 4, 2, 1], [1, 2, 4, 4, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 2, 3, 4, 5], [5, 4, 3, 2, 1]],sr = 2,sc = 2,color = 6) == [[1, 2, 6, 4, 5], [5, 4, 6, 2, 1], [1, 2, 6, 4, 5], [5, 4, 6, 2, 1]]\n assert candidate(image = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7]],sr = 0,sc = 0,color = 9) == [[9, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]],sr = 1,sc = 1,color = 2) == [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 1, 1, 1, 2, 1], [1, 2, 1, 0, 1, 2, 1], [1, 2, 1, 1, 1, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1]],sr = 3,sc = 3,color = 11) == [[1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6], [6, 5, 4, 11, 2, 1], [1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 2, 3, 2, 1], [1, 2, 3, 2, 1], [1, 2, 3, 2, 1], [1, 1, 1, 1, 1]],sr = 0,sc = 2,color = 5) == [[5, 5, 5, 5, 5], [5, 2, 3, 2, 5], [5, 2, 3, 2, 5], [5, 2, 3, 2, 5], [5, 5, 5, 5, 5]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],sr = 4,sc = 4,color = 2) == [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 2, 2, 0, 1, 0, 1], [1, 0, 1, 0, 2, 0, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[10, 10, 10, 10, 10], [10, 20, 20, 20, 10], [10, 20, 30, 20, 10], [10, 20, 20, 20, 10], [10, 10, 10, 10, 10]],sr = 2,sc = 2,color = 50) == [[10, 10, 10, 10, 10], [10, 20, 20, 20, 10], [10, 20, 50, 20, 10], [10, 20, 20, 20, 10], [10, 10, 10, 10, 10]]\n assert candidate(image = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],sr = 0,sc = 2,color = 10) == [[1, 2, 10], [4, 5, 6], [7, 8, 9]]\n assert candidate(image = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]],sr = 0,sc = 0,color = 10) == [[10, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]]\n assert candidate(image = [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]],sr = 0,sc = 0,color = 5) == [[5, 2, 3, 4, 5], [5, 2, 3, 4, 5], [5, 2, 3, 4, 5], [5, 2, 3, 4, 5], [5, 2, 3, 4, 5]]\n assert candidate(image = [[2, 2, 2], [2, 2, 2], [2, 2, 2]],sr = 1,sc = 1,color = 3) == [[3, 3, 3], [3, 3, 3], [3, 3, 3]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]],sr = 3,sc = 3,color = 2) == [[2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2]]\n assert candidate(image = [[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]],sr = 0,sc = 0,color = 0) == [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]\n assert candidate(image = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1]],sr = 1,sc = 1,color = 2) == [[1, 0, 0, 1], [0, 2, 2, 0], [0, 2, 2, 0], [1, 0, 0, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 2, 3, 4, 1], [1, 5, 6, 7, 1], [1, 8, 9, 10, 1], [1, 1, 1, 1, 1]],sr = 1,sc = 2,color = 11) == [[1, 1, 1, 1, 1], [1, 2, 11, 4, 1], [1, 5, 6, 7, 1], [1, 8, 9, 10, 1], [1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]],sr = 2,sc = 2,color = 2) == [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 2, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]\n assert candidate(image = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 1], [3, 4, 5, 1, 2], [4, 5, 1, 2, 3], [5, 1, 2, 3, 4]],sr = 2,sc = 2,color = 6) == [[1, 2, 3, 4, 5], [2, 3, 4, 5, 1], [3, 4, 6, 1, 2], [4, 5, 1, 2, 3], [5, 1, 2, 3, 4]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 3, 3, 2, 1], [1, 2, 3, 4, 4, 4, 3, 3, 2, 1], [1, 2, 3, 4, 5, 4, 3, 3, 2, 1], [1, 2, 3, 4, 4, 4, 3, 3, 2, 1], [1, 2, 3, 3, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],sr = 4,sc = 4,color = 6) == [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 3, 3, 2, 1], [1, 2, 3, 4, 4, 4, 3, 3, 2, 1], [1, 2, 3, 4, 6, 4, 3, 3, 2, 1], [1, 2, 3, 4, 4, 4, 3, 3, 2, 1], [1, 2, 3, 3, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1]],sr = 0,sc = 0,color = 3) == [[3, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1]]\n assert candidate(image = [[1, 2, 3], [2, 3, 4], [3, 4, 5]],sr = 1,sc = 1,color = 1) == [[1, 2, 3], [2, 1, 4], [3, 4, 5]]\n assert candidate(image = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]],sr = 2,sc = 2,color = 26) == [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 26, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]\n assert candidate(image = [[5, 5, 5, 5, 5], [5, 4, 4, 4, 5], [5, 4, 3, 4, 5], [5, 4, 4, 4, 5], [5, 5, 5, 5, 5]],sr = 2,sc = 2,color = 1) == [[5, 5, 5, 5, 5], [5, 4, 4, 4, 5], [5, 4, 1, 4, 5], [5, 4, 4, 4, 5], [5, 5, 5, 5, 5]]\n assert candidate(image = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]],sr = 1,sc = 3,color = 100) == [[1, 2, 3, 4, 5], [2, 3, 4, 100, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]]\n assert candidate(image = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]],sr = 0,sc = 2,color = 7) == [[1, 2, 7], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]\n assert candidate(image = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]],sr = 2,sc = 2,color = 100) == [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 100, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]],sr = 3,sc = 3,color = 7) == [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 7, 7, 7, 2, 1], [1, 2, 7, 7, 7, 2, 1], [1, 2, 7, 7, 7, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]],sr = 3,sc = 3,color = 5) == [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 5, 5, 2, 1], [1, 2, 5, 5, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]],sr = 2,sc = 2,color = 6) == [[1, 2, 6, 4, 5], [1, 2, 6, 4, 5], [1, 2, 6, 4, 5], [1, 2, 6, 4, 5], [1, 2, 6, 4, 5]]\n assert candidate(image = [[2, 2, 2, 2, 2, 2, 2], [2, 1, 1, 1, 1, 1, 2], [2, 1, 2, 2, 2, 1, 2], [2, 1, 2, 1, 2, 1, 2], [2, 1, 2, 2, 2, 1, 2], [2, 1, 1, 1, 1, 1, 2], [2, 2, 2, 2, 2, 2, 2]],sr = 3,sc = 3,color = 3) == [[2, 2, 2, 2, 2, 2, 2], [2, 1, 1, 1, 1, 1, 2], [2, 1, 2, 2, 2, 1, 2], [2, 1, 2, 3, 2, 1, 2], [2, 1, 2, 2, 2, 1, 2], [2, 1, 1, 1, 1, 1, 2], [2, 2, 2, 2, 2, 2, 2]]\n assert candidate(image = [[1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7]],sr = 3,sc = 3,color = 8) == [[1, 2, 3, 8, 5, 6, 7], [1, 2, 3, 8, 5, 6, 7], [1, 2, 3, 8, 5, 6, 7], [1, 2, 3, 8, 5, 6, 7], [1, 2, 3, 8, 5, 6, 7]]\n assert candidate(image = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 2, 3, 4, 5]],sr = 2,sc = 2,color = 9) == [[1, 2, 9, 4, 5], [5, 4, 9, 2, 1], [1, 2, 9, 4, 5], [5, 4, 9, 2, 1], [1, 2, 9, 4, 5]]\n assert candidate(image = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]],sr = 3,sc = 4,color = 21) == [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 21]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 4, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]],sr = 3,sc = 3,color = 7) == [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 7, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1], [1, 2, 1], [1, 1, 1]],sr = 1,sc = 1,color = 1) == [[1, 1, 1], [1, 1, 1], [1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]],sr = 2,sc = 2,color = 2) == [[2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2]]\n assert candidate(image = [[1, 1, 1, 1], [1, 2, 2, 1], [1, 2, 2, 1], [1, 1, 1, 1]],sr = 1,sc = 1,color = 3) == [[1, 1, 1, 1], [1, 3, 3, 1], [1, 3, 3, 1], [1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]],sr = 1,sc = 1,color = 1) == [[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]]\n assert candidate(image = [[1, 2, 2, 2, 1], [2, 2, 2, 2, 2], [2, 2, 1, 2, 2], [2, 2, 2, 2, 2], [1, 2, 2, 2, 1]],sr = 2,sc = 2,color = 3) == [[1, 2, 2, 2, 1], [2, 2, 2, 2, 2], [2, 2, 3, 2, 2], [2, 2, 2, 2, 2], [1, 2, 2, 2, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1], [1, 2, 3, 2, 1], [1, 3, 4, 3, 1], [1, 2, 3, 2, 1], [1, 1, 1, 1, 1]],sr = 1,sc = 1,color = 7) == [[1, 1, 1, 1, 1], [1, 7, 3, 2, 1], [1, 3, 4, 3, 1], [1, 2, 3, 2, 1], [1, 1, 1, 1, 1]]\n"}, "metadata": {"canonical_parameter_names": ["image", "sr", "sc", "color"], "leetcode_dataset_entry_point": "Solution().floodFill", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var floodFill = function(image, sr, sc, color) {", "container": null, "callable": "floodFill", "parameters": [{"name": "image", "type": "number[][]"}, {"name": "sr", "type": "number"}, {"name": "sc", "type": "number"}, {"name": "color", "type": "number"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 735, "task_id": "asteroid-collision", "difficulty": "Medium", "problem_description": "We are given an array asteroids of integers representing asteroids in a row. The indices of the asteriod in the array represent their relative position in space.\nFor each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed.\nFind out the state of the asteroids after all collisions. If two asteroids meet, the smaller one will explode. If both are the same size, both will explode. Two asteroids moving in the same direction will never meet.\n \nExample 1:\n\nInput: asteroids = [5,10,-5]\nOutput: [5,10]\nExplanation: The 10 and -5 collide resulting in 10. The 5 and 10 never collide.\n\nExample 2:\n\nInput: asteroids = [8,-8]\nOutput: []\nExplanation: The 8 and -8 collide exploding each other.\n\nExample 3:\n\nInput: asteroids = [10,2,-5]\nOutput: [10]\nExplanation: The 2 and -5 collide resulting in -5. The 10 and -5 collide resulting in 10.\n\n \nConstraints:\n\n2 <= asteroids.length <= 104\n-1000 <= asteroids[i] <= 1000\nasteroids[i] != 0\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(asteroids = [1, -1, 2, -2, 3, -3]) == []\n assert candidate(asteroids = [8, -8]) == []\n assert candidate(asteroids = [-2, -2, 1, 1]) == [-2, -2, 1, 1]\n assert candidate(asteroids = [1, 2, 3, 4, 5, -1, -2, -3, -4, -5]) == [1, 2, 3, 4]\n assert candidate(asteroids = [-1000, 1000]) == [-1000, 1000]\n assert candidate(asteroids = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1]) == [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1]\n assert candidate(asteroids = [1, 2, 3, -4, -3, -2, -1]) == [-4, -3, -2, -1]\n assert candidate(asteroids = [5, -1, 5, -1]) == [5, 5]\n assert candidate(asteroids = [-2, -1, 1, 2]) == [-2, -1, 1, 2]\n assert candidate(asteroids = [1, 2, 3, -3, -2, -1]) == []\n assert candidate(asteroids = [-2, -2, 1, -2]) == [-2, -2, -2]\n assert candidate(asteroids = [1, 2, 3, -1, -2, -3]) == [1, 2]\n assert candidate(asteroids = [1, -2, -2, -2]) == [-2, -2, -2]\n assert candidate(asteroids = [1, 2, 3, -4, -5]) == [-4, -5]\n assert candidate(asteroids = [1000, -1000]) == []\n assert candidate(asteroids = [-3, 3, 1, -1, -2, 2]) == [-3, 3, 2]\n assert candidate(asteroids = [10, 1, 2, -3, -4, -5, 6, 7, 8, 9]) == [10, 6, 7, 8, 9]\n assert candidate(asteroids = [-2, -1, 1, 2, 3, 4]) == [-2, -1, 1, 2, 3, 4]\n assert candidate(asteroids = [5, -10, 10, -5]) == [-10, 10]\n assert candidate(asteroids = [10, 2, -5]) == [10]\n assert candidate(asteroids = [-5, -4, -3, -2, -1, 1, 2, 3, 4, 5]) == [-5, -4, -3, -2, -1, 1, 2, 3, 4, 5]\n assert candidate(asteroids = [6, 2, -3, -4, -5]) == [6]\n assert candidate(asteroids = [5, 10, -5]) == [5, 10]\n assert candidate(asteroids = [5, 10, -10, -5]) == []\n assert candidate(asteroids = [1, 2, -3, -4]) == [-3, -4]\n assert candidate(asteroids = [10, 2, -3, 5, -1, -4, 6, -6]) == [10, 5]\n assert candidate(asteroids = [-7, 7, -8, 8, -9, 9, 10, -10, 11, -11]) == [-7, -8, -9, 9]\n assert candidate(asteroids = [100, -100, 50, -50, 25, -25, 10, -10, 5, -5, 3, -3, 2, -2, 1, -1]) == []\n assert candidate(asteroids = [50, 40, 30, 20, 10, -10, -20, -30, -40, -50]) == []\n assert candidate(asteroids = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15]) == [-2, -4, -6, -8, -10, -12, -14, 15]\n assert candidate(asteroids = [1, 2, 3, 4, 5, -6, -7, -8, -9, -10]) == [-6, -7, -8, -9, -10]\n assert candidate(asteroids = [10, 20, 30, 40, 50, -15, -25, -35, -45, -55, 60, 70]) == [-55, 60, 70]\n assert candidate(asteroids = [5, 5, 5, 5, 5, -5, -5, -5, -5, -5]) == []\n assert candidate(asteroids = [3, 3, 3, 3, -3, -3, -3, -3, 3, 3, 3, 3, -3, -3, -3, -3]) == []\n assert candidate(asteroids = [50, -40, 30, -20, 10, -5, 0, 5, -10, 20, -30, 40, -50]) == []\n assert candidate(asteroids = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1]) == []\n assert candidate(asteroids = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1]) == []\n assert candidate(asteroids = [-50, 50, -40, 40, -30, 30, -20, 20, -10, 10]) == [-50, 50, 40, 30, 20, 10]\n assert candidate(asteroids = [100, -90, -80, 70, -60, 50, -40, 30, -20, 10]) == [100, 70, 50, 30, 10]\n assert candidate(asteroids = [-5, 5, -10, 10, -15, 15, -20, 20, 25]) == [-5, -10, -15, -20, 20, 25]\n assert candidate(asteroids = [10, 20, 30, 40, 50, -50, -40, -30, -20, -10]) == []\n assert candidate(asteroids = [1, -1, -1, 1, 2, -2, -2, 2, 3, -3, -3, 3, 4, -4, -4, 4]) == [-1, -2, -3, -4, 4]\n assert candidate(asteroids = [-10, -20, -30, -40, -50, 50, 40, 30, 20, 10]) == [-10, -20, -30, -40, -50, 50, 40, 30, 20, 10]\n assert candidate(asteroids = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5]) == []\n assert candidate(asteroids = [-1, -2, -3, 1, 2, 3, -4, -5, 4, 5]) == [-1, -2, -3, -4, -5, 4, 5]\n assert candidate(asteroids = [5, 15, 25, 35, 45, 55, -5, -15, -25, -35, -45, -55]) == [5, 15, 25, 35, 45]\n assert candidate(asteroids = [7, 6, 5, 4, 3, 2, 1, -1, -2, -3, -4, -5, -6, -7]) == []\n assert candidate(asteroids = [100, -200, 50, -50, 300, -150, 250, -100]) == [-200, 300, 250]\n assert candidate(asteroids = [-10, 1, -1, 2, -2, 3, -3, 4, -4, 5, -5]) == [-10]\n assert candidate(asteroids = [5, 10, 15, 20, -20, -15, -10, -5]) == []\n assert candidate(asteroids = [8, -2, 9, -3, 4, -1, 7, -5, 6, -4]) == [8, 9, 4, 7, 6]\n assert candidate(asteroids = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1]) == []\n assert candidate(asteroids = [5, 5, 5, 5, -5, -5, -5, -5, 5, 5]) == [5, 5]\n assert candidate(asteroids = [5, 7, 3, -7, 4, -4, 2, -2, 1, -1]) == [5]\n assert candidate(asteroids = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == [1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(asteroids = [9, 8, 7, 6, 5, 4, 3, 2, 1, -1, -2, -3, -4, -5, -6, -7, -8, -9]) == []\n assert candidate(asteroids = [-5, 5, -10, 10, -15, 15, -20, 20, -25, 25]) == [-5, -10, -15, -20, -25, 25]\n assert candidate(asteroids = [2, -2, 4, -4, 6, -6, 8, -8, 10, -10, 12, -12, 14, -14, 16, -16]) == []\n assert candidate(asteroids = [1, 3, 5, 7, 9, -9, -7, -5, -3, -1, 2, 4, 6, 8, 10, -10, -8, -6, -4, -2]) == []\n assert candidate(asteroids = [-1, -2, -3, 4, 5, 6, -7, -8, 9, 10, -10, 11, -11, 12, -12]) == [-1, -2, -3, -7, -8, 9]\n assert candidate(asteroids = [-10, 10, -9, 9, -8, 8, -7, 7, -6, 6, -5, 5, -4, 4, -3, 3, -2, 2, -1, 1]) == [-10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n assert candidate(asteroids = [50, 40, 30, 20, 10, -10, -20, -30, -40, -50, 60, 70, 80, 90]) == [60, 70, 80, 90]\n assert candidate(asteroids = [5, -3, 7, -2, 1, -10, 15, -15, 20]) == [-10, 20]\n assert candidate(asteroids = [2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9, 10, -10]) == []\n assert candidate(asteroids = [5, -10, 15, -20, 25, -30, 35, -40]) == [-10, -20, -30, -40]\n assert candidate(asteroids = [5, -5, 5, -5, 5, -5, 5, -5, 5, -5]) == []\n assert candidate(asteroids = [5, -5, 5, -5, 5, -5]) == []\n assert candidate(asteroids = [100, -99, 98, -97, 96, -95, 94, -93, 92, -91, 90]) == [100, 98, 96, 94, 92, 90]\n assert candidate(asteroids = [-10, -20, -30, 30, 20, 10, -10, -20, -30]) == [-10, -20, -30]\n assert candidate(asteroids = [10, 20, -15, -20, 5, 15, -10, 25, -30]) == [-30]\n assert candidate(asteroids = [10, 20, 30, -5, -15, -25, -35, 40, -45, 50]) == [-35, -45, 50]\n assert candidate(asteroids = [-10, -20, -30, 10, 20, 30, -15, -25, 5, 15, -5, -10, -20, 25, 35, -40, 40, -45, 45]) == [-10, -20, -30, -40, -45, 45]\n assert candidate(asteroids = [-9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [-9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(asteroids = [5, 10, -10, -5, 20, -20, 15, -15, 25, -25]) == []\n assert candidate(asteroids = [10, -10, 20, -20, 30, -30, 40, -40, 50, -50]) == []\n assert candidate(asteroids = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12]) == [-1, -3, -5, -7, -9, -11, 12]\n assert candidate(asteroids = [1, 2, 3, 4, 5, -5, -4, -3, -2, -1]) == []\n assert candidate(asteroids = [10, -1, 9, -2, 8, -3, 7, -4, 6, -5]) == [10, 9, 8, 7, 6]\n assert candidate(asteroids = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, -10, -20, -30, -40, -50, -60, -70, -80, -90, -100]) == []\n assert candidate(asteroids = [100, -99, 98, -97, 96, -95, 94, -93, 92, -91, 90, -89]) == [100, 98, 96, 94, 92, 90]\n assert candidate(asteroids = [1, 2, 3, 4, 5, 6, 7, 8, 9, -9, -8, -7, -6, -5, -4, -3, -2, -1]) == []\n assert candidate(asteroids = [1, 1, 1, 1, 1, -1, -1, -1, -1, -1]) == []\n assert candidate(asteroids = [5, 10, -5, 10, -10, 5, -5, 10]) == [5, 10, 10]\n assert candidate(asteroids = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == []\n assert candidate(asteroids = [1, 2, 3, 4, 5, -5, -4, -3, -2, -1]) == []\n assert candidate(asteroids = [100, 200, 300, -100, -200, -300, 400, -400, 500, -500]) == [100, 200]\n assert candidate(asteroids = [10, -20, 30, -40, 50, -60, 70, -80, 90, -100, 100, -90, 80, -70, 60, -50, 40, -30, 20, -10]) == [-20, -40, -60, -80, -100, 100, 80, 60, 40, 20]\n assert candidate(asteroids = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9, 10, -10, 11, -11]) == []\n assert candidate(asteroids = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20]) == []\n assert candidate(asteroids = [100, -1, 99, -2, 98, -3, 97, -4, 96, -5, 95, -6, 94, -7, 93, -8, 92, -9, 91, -10]) == [100, 99, 98, 97, 96, 95, 94, 93, 92, 91]\n assert candidate(asteroids = [10, -5, 5, -10, 10, -10, 5, -5, 2, -2]) == []\n assert candidate(asteroids = [-10, 20, -20, 30, -30, 40, -40, 50, -50, 60, -60]) == [-10]\n assert candidate(asteroids = [100, -50, 50, -100, 200, -200, 300, -300, 400, -400]) == []\n assert candidate(asteroids = [1000, -1000, 500, -500, 250, -250, 125, -125, 63, -63, 31, -31, 15, -15, 7, -7, 3, -3, 1, -1]) == []\n assert candidate(asteroids = [1, -2, 2, -3, 3, -4, 4, -5, 5, -6, 6, -7, 7, -8, 8, -9, 9, -10, 10]) == [-2, -3, -4, -5, -6, -7, -8, -9, -10, 10]\n assert candidate(asteroids = [-10, -20, -30, -40, -50, 50, 40, 30, 20, 10]) == [-10, -20, -30, -40, -50, 50, 40, 30, 20, 10]\n assert candidate(asteroids = [100, 200, 300, 400, 500, -100, -200, -300, -400, -500, 600, 700, 800, 900, 1000]) == [100, 200, 300, 400, 600, 700, 800, 900, 1000]\n assert candidate(asteroids = [10, 20, 30, 40, 50, -50, -40, -30, -20, -10]) == []\n assert candidate(asteroids = [-1, -2, -3, -4, -5, 5, 4, 3, 2, 1]) == [-1, -2, -3, -4, -5, 5, 4, 3, 2, 1]\n assert candidate(asteroids = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14, -15, 16]) == [-1, -3, -5, -7, -9, -11, -13, -15, 16]\n assert candidate(asteroids = [5, -5, 5, -5, 5, -5, 5, -5, 5, -5, 5, -5, 5, -5, 5, -5]) == []\n assert candidate(asteroids = [10, -10, 5, 3, -3, -5, 8, 8, -8, 2, -2]) == [8]\n assert candidate(asteroids = [10, -20, 30, -40, 50, -60, 70, -80, 90, -100, 110, -120, 130, -140, 150]) == [-20, -40, -60, -80, -100, -120, -140, 150]\n assert candidate(asteroids = [1, 2, 3, -3, -2, -1, 4, 5, -5, -4]) == []\n assert candidate(asteroids = [-1, -2, -3, -4, -5, 5, 4, 3, 2, 1]) == [-1, -2, -3, -4, -5, 5, 4, 3, 2, 1]\n assert candidate(asteroids = [5, 10, 15, -10, 20, -15, -20, 25, -25, 30, -30, 35, -35]) == [5, 10, 15]\n assert candidate(asteroids = [100, -50, 50, -25, 25, -10, 10, -5, 5, -2, 2, -1, 1]) == [100, 50, 25, 10, 5, 2, 1]\n assert candidate(asteroids = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10]) == [-1, -3, -5, -7, -9, 10]\n assert candidate(asteroids = [100, -50, 20, -10, 5, -5, 10, -20, 30, -40]) == [100]\n assert candidate(asteroids = [1, 2, 3, 4, 5, -1, -2, -3, -4, -5]) == [1, 2, 3, 4]\n assert candidate(asteroids = [10, 20, 30, 40, 50, 60, 70, 80, 90, -90, -80, -70, -60, -50, -40, -30, -20, -10]) == []\n assert candidate(asteroids = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n assert candidate(asteroids = [10, 20, 30, -15, -25, 5, 15, -5, -10, -20, 25, 35, -40, 40, -45, 45]) == [-40, -45, 45]\n assert candidate(asteroids = [1, 2, 3, 4, 5, 6, 7, 8, 9, -9, -8, -7, -6, -5, -4, -3, -2, -1]) == []\n assert candidate(asteroids = [10, 20, 30, 40, 50, -10, -20, -30, -40, -50]) == [10, 20, 30, 40]\n assert candidate(asteroids = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == [1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(asteroids = [50, -50, 49, -49, 48, -48, 47, -47, 46, -46, 45, -45, 44, -44, 43, -43]) == []\n assert candidate(asteroids = [-100, 50, -50, 50, -50, 50, -50, 50, -50, 50, -50, 50, -50, 50, -50, 50, -50, 50, -50, 50]) == [-100, 50]\n assert candidate(asteroids = [-1, -2, -3, -4, -5, 5, 4, 3, 2, 1, -6, 6, -7, 7, -8, 8, -9, 9]) == [-1, -2, -3, -4, -5, -6, -7, -8, -9, 9]\n assert candidate(asteroids = [5, 10, 15, -15, -10, -5, 20, -20, 25, -25, 30, -30]) == []\n assert candidate(asteroids = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9, 10, -10]) == []\n assert candidate(asteroids = [1, 1, 1, 1, 1, -1, -1, -1, -1, -1]) == []\n assert candidate(asteroids = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -15]) == [-2, -4, -6, -8, -10, -12, -14]\n"}, "metadata": {"canonical_parameter_names": ["asteroids"], "leetcode_dataset_entry_point": "Solution().asteroidCollision", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var asteroidCollision = function(asteroids) {", "container": null, "callable": "asteroidCollision", "parameters": [{"name": "asteroids", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 736, "task_id": "parse-lisp-expression", "difficulty": "Hard", "problem_description": "You are given a string expression representing a Lisp-like expression to return the integer value of.\nThe syntax for these expressions is given as follows.\n\nAn expression is either an integer, let expression, add expression, mult expression, or an assigned variable. Expressions always evaluate to a single integer.\n(An integer could be positive or negative.)\nA let expression takes the form \"(let v1 e1 v2 e2 ... vn en expr)\", where let is always the string \"let\", then there are one or more pairs of alternating variables and expressions, meaning that the first variable v1 is assigned the value of the expression e1, the second variable v2 is assigned the value of the expression e2, and so on sequentially; and then the value of this let expression is the value of the expression expr.\nAn add expression takes the form \"(add e1 e2)\" where add is always the string \"add\", there are always two expressions e1, e2 and the result is the addition of the evaluation of e1 and the evaluation of e2.\nA mult expression takes the form \"(mult e1 e2)\" where mult is always the string \"mult\", there are always two expressions e1, e2 and the result is the multiplication of the evaluation of e1 and the evaluation of e2.\nFor this question, we will use a smaller subset of variable names. A variable starts with a lowercase letter, then zero or more lowercase letters or digits. Additionally, for your convenience, the names \"add\", \"let\", and \"mult\" are protected and will never be used as variable names.\nFinally, there is the concept of scope. When an expression of a variable name is evaluated, within the context of that evaluation, the innermost scope (in terms of parentheses) is checked first for the value of that variable, and then outer scopes are checked sequentially. It is guaranteed that every expression is legal. Please see the examples for more details on the scope.\n\n \nExample 1:\n\nInput: expression = \"(let x 2 (mult x (let x 3 y 4 (add x y))))\"\nOutput: 14\nExplanation: In the expression (add x y), when checking for the value of the variable x,\nwe check from the innermost scope to the outermost in the context of the variable we are trying to evaluate.\nSince x = 3 is found first, the value of x is 3.\n\nExample 2:\n\nInput: expression = \"(let x 3 x 2 x)\"\nOutput: 2\nExplanation: Assignment in let statements is processed sequentially.\n\nExample 3:\n\nInput: expression = \"(let x 1 y 2 x (add x y) (add x y))\"\nOutput: 5\nExplanation: The first (add x y) evaluates as 3, and is assigned to x.\nThe second (add x y) evaluates as 3+2 = 5.\n\n \nConstraints:\n\n1 <= expression.length <= 2000\nThere are no leading or trailing spaces in expression.\nAll tokens are separated by a single space in expression.\nThe answer and all intermediate calculations of that answer are guaranteed to fit in a 32-bit integer.\nThe expression is guaranteed to be legal and evaluate to an integer.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(expression = \"(let x 2 (mult x (let x 3 y 4 (add x y))))\") == 14\n assert candidate(expression = \"(let x 7 (let y 2 (let z 3 (mult x (add y z)))))\") == 35\n assert candidate(expression = \"(mult (let x 2 (mult 3 x)) (let x 2 (add 4 x)))\") == 36\n assert candidate(expression = \"(let x 0 (let x 1 x) x)\") == 1\n assert candidate(expression = \"(add 1 2)\") == 3\n assert candidate(expression = \"(mult 3 4)\") == 12\n assert candidate(expression = \"(let a 5 (let b 6 (let c 7 (mult (add a b) (add b c)))))\") == 143\n assert candidate(expression = \"(let x 0 (let x 1 x))\") == 1\n assert candidate(expression = \"(mult (add 1 2) (add 3 4))\") == 21\n assert candidate(expression = \"(let x 0 (let x (add 1 x) (let x (mult x 2) x)))\") == 2\n assert candidate(expression = \"(mult (let x 2 (add x 2)) (let y 3 (mult y y)))\") == 36\n assert candidate(expression = \"(let x 1 y (add x 2) (mult x y))\") == 3\n assert candidate(expression = \"(let a 3 b (add a 1) c (mult a b) c)\") == 12\n assert candidate(expression = \"(let x 1 y 1 x (add x y) (add x y))\") == 3\n assert candidate(expression = \"(let x 1 y 2 x (add x y) (add x y))\") == 5\n assert candidate(expression = \"(let x 3 x 2 x)\") == 2\n assert candidate(expression = \"(let x 2 (mult 3 (let x 3 y 4 (add x y))))\") == 21\n assert candidate(expression = \"(let x 1 (add x (let x 2 (add x (let x 3 (add x 4)))))\") == 10\n assert candidate(expression = \"(let x 1 (let y 2 (let z 3 (add x (add y z)))))\") == 6\n assert candidate(expression = \"(let x 1 (mult (let x 2 (add x 2)) x))\") == 4\n assert candidate(expression = \"(let x 7 (let y 2 (let x 3 (add x y))))\") == 5\n assert candidate(expression = \"(mult (let a 2 b 3 (add a b)) (let c 4 d 5 (mult c d)))\") == 100\n assert candidate(expression = \"(let x 7 (add x 3) (mult x 2))\") == 10\n assert candidate(expression = \"(let x (add 1 2) (mult x 3))\") == 9\n assert candidate(expression = \"(let x 2 (let y 3 (let z (add x y) (mult x z))))\") == 10\n assert candidate(expression = \"(let a1 3 b2 4 (add a1 b2))\") == 7\n assert candidate(expression = \"(let a1 3 b2 (add a1 1) b2)\") == 4\n assert candidate(expression = \"(let x 1 (let y (let z 3 (add z 2)) (mult x y)) (add x y))\") == 5\n assert candidate(expression = \"(let x (let y 2 (mult y 3)) (add x 5))\") == 11\n assert candidate(expression = \"(let x 5 y (add x 3) z (mult x y) (let w 7 (add w (mult x z))))\") == 207\n assert candidate(expression = \"(let m 8 n (add m 2) o (mult m n) p (add o n) (mult p m))\") == 720\n assert candidate(expression = \"(let a 1 b (let a (add a 1) (mult a a)) (add a b))\") == 5\n assert candidate(expression = \"(let a 1 b 2 c (mult a b) d (add a b) (mult c d))\") == 6\n assert candidate(expression = \"(let a 1 b (add a 1) c (mult a b) (add c (let a 2 (mult a b))))\") == 6\n assert candidate(expression = \"(mult (let x 2 (let y 3 (add x y))) (let x 4 (let y 5 (mult x y))))\") == 100\n assert candidate(expression = \"(let a 1 b 2 c (add a b) d (mult a c) (add d c))\") == 6\n assert candidate(expression = \"(let x 2 y 3 z (mult x y) (add (let x 5 (mult x y)) (let y 4 (add y z))))\") == 25\n assert candidate(expression = \"(mult (let x 5 y (mult x 2) (add y 3)) (let z 4 w (add z 1) (mult w 3)))\") == 195\n assert candidate(expression = \"(let a 5 b (add a 3) (mult a b))\") == 40\n assert candidate(expression = \"(let a 1 (let b (add a 1) (let c (mult b 2) (let d (add c 3) (let e (mult d 4) (add e 5)))))\") == 33\n assert candidate(expression = \"(let m 5 n 10 (let p (add m n) (mult p (let q (mult m n) (add q (let r (add p q) r)))))\") == 1725\n assert candidate(expression = \"(let x (mult 3 3) y (add 5 5) z (let w (mult x y) (add w 10)) (mult z x))\") == 900\n assert candidate(expression = \"(let a 1 b (let c (mult a a) d (add a a) (mult c d)) e (let f (mult b b) g (add b b) (mult f g)) (add e e))\") == 32\n assert candidate(expression = \"(let a 1 b (add a 1) c (mult b 2) d (add c 3) e (mult d 2) (add e (mult e (add d (mult c (add b a))))))\") == 280\n assert candidate(expression = \"(add (let x 5 (mult x 2)) (let y 3 (mult y 4)))\") == 22\n assert candidate(expression = \"(let a 10 (let b (mult a 2) (let c (add a b) (let d (mult b c) d))))\") == 600\n assert candidate(expression = \"(let m 2 (let n (mult m 3) (let o (add m n) (let p (mult m o) (add p (mult n o)))))\") == 64\n assert candidate(expression = \"(let x 5 (let y 3 (mult (add x y) (let z 2 (add z (mult x y)))))\") == 136\n assert candidate(expression = \"(let a (mult 2 3) b (add a 4) c (mult b a) d (add c b) (mult d c))\") == 4200\n assert candidate(expression = \"(let x 5 y 3 (let z (mult x y) (let w (add x z) (mult w (let v (add y z) v)))))\") == 360\n assert candidate(expression = \"(let x 1 (let y (add x 1) (let z (mult y 2) (let a (add z 3) (let b (mult a 4) (add (mult b 5) (let c (add b 6) (mult c 7)))))))\") == 378\n assert candidate(expression = \"(let a 1 b (add a 1) c (mult b 2) d (let e (add c b) (mult e a)) (add d (mult c a)))\") == 10\n assert candidate(expression = \"(mult (let x 2 (let y 3 (let z (add x y) (mult z 4)))) (let a 5 (let b 6 (let c (add a b) (mult c 7))))\") == 1540\n assert candidate(expression = \"(let x 7 y (mult x 2) z (add x y) (let w 3 (add w (mult x z))))\") == 150\n assert candidate(expression = \"(let x 1 y 2 (let x (add x y) y (mult x y) (let z (add x y) (mult x z))))\") == 27\n assert candidate(expression = \"(let x 1 (let y 2 (let z 3 (let a 4 (let b 5 (let c 6 (let d 7 (let e 8 (let f 9 (add x (mult y (add z (mult a (add b (mult c (add d (mult e f))))))))))))))))\") == 3839\n assert candidate(expression = \"(let x 10 (let y (add x 5) z (mult y 2) (let a (add z 3) b (mult a 4) (let c (add b 2) (mult c 5))))\") == 670\n assert candidate(expression = \"(let x 7 y (add x 2) z (mult x y) (let w (add y z) (mult w x)))\") == 504\n assert candidate(expression = \"(let x 5 y (add x 3) z (mult y 2) (let w (add x y) (mult w z)))\") == 208\n assert candidate(expression = \"(let x (let y (let z 3 (add z 1)) (mult y 2)) (mult x 5))\") == 40\n assert candidate(expression = \"(let x 10 (let y (mult x 3) (let z (add x y) (let w (mult y z) (let v (add w z) v)))))\") == 1240\n assert candidate(expression = \"(let x 1 (let y 2 (let z 3 (let w 4 (add (add x y) (add z w))))))\") == 10\n assert candidate(expression = \"(let a 2 b (mult a 3) c (add a b) d (mult b c) (add d c))\") == 56\n assert candidate(expression = \"(mult (add 1 2) (mult 3 4))\") == 36\n assert candidate(expression = \"(let x 5 y (add x 3) z (mult x y) (add z (let x 10 (mult x y))))\") == 120\n assert candidate(expression = \"(let x 10 y (add x 5) z (mult y 2) (let w (add x y) (mult w z)))\") == 750\n assert candidate(expression = \"(let x 5 (let y (add x 3) (mult x y)))\") == 40\n assert candidate(expression = \"(mult (let x 3 (let y 5 (add x y))) (let a 2 (mult a (let b 4 (add b 1))))\") == 80\n assert candidate(expression = \"(let x 5 y (let x 10 (add x 5)) z (mult y 2) (add z y))\") == 45\n assert candidate(expression = \"(let x 1 (let y 2 (let z 3 (let a (add x y) (let b (mult y z) (add (mult a b) (let c (add a b) (mult c 2)))))))\") == 36\n assert candidate(expression = \"(let x 1 (let y (let x 2 (let z 3 (add x z))) (mult x y)) (add x y))\") == 5\n assert candidate(expression = \"(let x 1 y 2 z 3 a (add x y) b (mult a z) c (add b a) d (mult c b) (add d c) e (mult d a) (add e b))\") == 120\n assert candidate(expression = \"(let x 5 (let y (let z 3 (add x z)) (mult x y)) (let w (add x y) (mult w x)))\") == 40\n assert candidate(expression = \"(let x 1 (let y (add x 1) (let z (mult y 2) (add x (add y z)))))\") == 7\n assert candidate(expression = \"(let a 1 b 2 c 3 (add (mult a b) (mult b c)))\") == 8\n assert candidate(expression = \"(let x 1 (let y (mult x 2) (let z (add y 3) (mult x (add y z)))))\") == 7\n assert candidate(expression = \"(let a 2 b (mult a 2) c (let d (add b 1) (mult d 3)) (add c (mult a b)))\") == 23\n assert candidate(expression = \"(let a 1 b 2 (add a b) (mult a b))\") == 3\n assert candidate(expression = \"(let x 7 (let y (add x 3) z (mult y 2) (let w (add z 5) (mult w y))))\") == 250\n assert candidate(expression = \"(let x 10 y (add x 5) z (mult y 2) (let w (add y z) (mult w x)))\") == 450\n assert candidate(expression = \"(let a 1 b 2 c 3 (add (mult a b) c))\") == 5\n assert candidate(expression = \"(let x 1 (let y 2 (let z 3 (let w 4 (mult (add x y) (mult z w))))))\") == 36\n assert candidate(expression = \"(mult (let x 3 (let y 4 (add x y))) (let x 6 (let y 7 (mult x y))))\") == 294\n assert candidate(expression = \"(let a 1 b 2 c 3 (let d (add a b) e (mult b c) (add d e)))\") == 9\n assert candidate(expression = \"(let a 1 (let b 2 (let a 3 (let b 4 (add (mult a b) (let a 5 (mult a b)))))))\") == 32\n assert candidate(expression = \"(let x 5 (let y (mult x 2) (let z (add y 3) (mult x z))))\") == 65\n assert candidate(expression = \"(add (mult 2 3) (let x 4 (mult x 5)))\") == 26\n assert candidate(expression = \"(let x 1 (let y 2 (let z 3 (let a (add x y) b (mult y z) c (add a b) d (mult b c) (let e (add c d) (mult d e)))))\") == 3402\n assert candidate(expression = \"(let x 1 (let y 2 (let z 3 (let a (add x y) b (mult y z) c (add a b) (mult b c)))))\") == 54\n assert candidate(expression = \"(let x (let y (let z 3 (mult z z)) (add y 5)) (mult x x))\") == 196\n assert candidate(expression = \"(mult (let a 3 b (add a 2) c (mult b 2) (add c a)) (let d 4 e (mult d 3) (add e d)))\") == 208\n assert candidate(expression = \"(mult (let x 7 (let y 3 (add x y))) (let x 4 (let y 6 (mult x y))))\") == 240\n assert candidate(expression = \"(let x 2 (let y (let z 2 (add z z)) (mult x y)) (let a 3 (let b (mult a x) (add b (let c 4 (mult c x)))))\") == 8\n assert candidate(expression = \"(let x 1 y 2 (let z (add x y) (let w (mult x y) (let u (add z w) u))))\") == 5\n assert candidate(expression = \"(let a 1 (let b 2 (let c (add a b) (let d (mult b c) (mult c d))))\") == 18\n assert candidate(expression = \"(let a 1 b 2 c 3 d (add a b) e (add c d) (mult d (let a 5 (add a b))))\") == 21\n assert candidate(expression = \"(let x 10 (let y (mult x 2) (let z (add x y) (let w (mult y z) (add w z))))\") == 630\n assert candidate(expression = \"(let x 1 (let y (add x 1) (let z (mult y 2) (let w (add x z) (mult w (let v (mult z 2) v)))))\") == 40\n assert candidate(expression = \"(let x 5 y (add x 3) (mult x y))\") == 40\n assert candidate(expression = \"(let x 5 (let y 10 (let z (add x y) (mult z x))))\") == 75\n assert candidate(expression = \"(let x 10 y (let x 5 (add x 3)) z (mult x y) (add z y))\") == 88\n assert candidate(expression = \"(let x 1 y 2 z 3 a (add x y) b (mult a z) c (add b a) (mult c b))\") == 108\n assert candidate(expression = \"(let x 1 (let y 2 (let z 3 (add (mult x y) z))))\") == 5\n assert candidate(expression = \"(let a 1 b 2 c (add a b) (mult c (let b 4 (add a b))))\") == 15\n assert candidate(expression = \"(let x 1 (let y 2 (let z 3 (add (mult x y) (add y z)))))\") == 7\n assert candidate(expression = \"(let a 1 b 2 c 3 d 4 e 5 (add (mult a b) (add (mult b c) (add (mult c d) (mult d e)))))\") == 40\n assert candidate(expression = \"(add (let a 1 b (add a 1) c (mult b 2) (add c a)) (let d 4 e (mult d 3) (add e d)))\") == 21\n assert candidate(expression = \"(let z (mult 3 4) w (add z 5) x (let y (mult z w) (add y z)) x)\") == 216\n assert candidate(expression = \"(let x 5 (add (mult x 2) (let x 3 (add (mult x 4) (let x 6 (mult x 7))))))\") == 64\n assert candidate(expression = \"(let x 5 (let y (add x 2) z (mult y 3) (let w (add z 4) (mult w x))))\") == 125\n assert candidate(expression = \"(let x (mult 2 3) y (add x 5) (let z (mult x y) (add z (mult x y))))\") == 132\n"}, "metadata": {"canonical_parameter_names": ["expression"], "leetcode_dataset_entry_point": "Solution().evaluate", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var evaluate = function(expression) {", "container": null, "callable": "evaluate", "parameters": [{"name": "expression", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 738, "task_id": "monotone-increasing-digits", "difficulty": "Medium", "problem_description": "An integer has monotone increasing digits if and only if each pair of adjacent digits x and y satisfy x <= y.\nGiven an integer n, return the largest number that is less than or equal to n with monotone increasing digits.\n \nExample 1:\n\nInput: n = 10\nOutput: 9\n\nExample 2:\n\nInput: n = 1234\nOutput: 1234\n\nExample 3:\n\nInput: n = 332\nOutput: 299\n\n \nConstraints:\n\n0 <= n <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 999999999) == 999999999\n assert candidate(n = 111) == 111\n assert candidate(n = 100) == 99\n assert candidate(n = 1000) == 999\n assert candidate(n = 222) == 222\n assert candidate(n = 333) == 333\n assert candidate(n = 33332) == 29999\n assert candidate(n = 1001) == 999\n assert candidate(n = 101010101) == 99999999\n assert candidate(n = 21212) == 19999\n assert candidate(n = 0) == 0\n assert candidate(n = 9876543210) == 8999999999\n assert candidate(n = 999) == 999\n assert candidate(n = 4321) == 3999\n assert candidate(n = 111111111) == 111111111\n assert candidate(n = 332) == 299\n assert candidate(n = 987654321) == 899999999\n assert candidate(n = 11111) == 11111\n assert candidate(n = 101010) == 99999\n assert candidate(n = 1234) == 1234\n assert candidate(n = 120) == 119\n assert candidate(n = 10) == 9\n assert candidate(n = 1203) == 1199\n assert candidate(n = 567898765) == 567889999\n assert candidate(n = 987898789) == 899999999\n assert candidate(n = 998877665544332211) == 899999999999999999\n assert candidate(n = 1112233445566778899) == 1112233445566778899\n assert candidate(n = 22221111) == 19999999\n assert candidate(n = 5678987654) == 5678899999\n assert candidate(n = 1232123) == 1229999\n assert candidate(n = 111000999) == 99999999\n assert candidate(n = 233221) == 229999\n assert candidate(n = 333333333) == 333333333\n assert candidate(n = 123456780) == 123456779\n assert candidate(n = 5000) == 4999\n assert candidate(n = 1000000000) == 999999999\n assert candidate(n = 66778899) == 66778899\n assert candidate(n = 1234554321) == 1234499999\n assert candidate(n = 199999999) == 199999999\n assert candidate(n = 11119999) == 11119999\n assert candidate(n = 43210) == 39999\n assert candidate(n = 657890) == 599999\n assert candidate(n = 1111111111) == 1111111111\n assert candidate(n = 100000000) == 99999999\n assert candidate(n = 1111000011) == 999999999\n assert candidate(n = 199999) == 199999\n assert candidate(n = 565656565) == 559999999\n assert candidate(n = 33333222) == 29999999\n assert candidate(n = 444444444) == 444444444\n assert candidate(n = 999999998) == 899999999\n assert candidate(n = 2233445566778899) == 2233445566778899\n assert candidate(n = 1001001) == 999999\n assert candidate(n = 777777777) == 777777777\n assert candidate(n = 567891234) == 567889999\n assert candidate(n = 221332) == 199999\n assert candidate(n = 98787656545434241) == 89999999999999999\n assert candidate(n = 555555555) == 555555555\n assert candidate(n = 1234321) == 1233999\n assert candidate(n = 599) == 599\n assert candidate(n = 1010101010) == 999999999\n assert candidate(n = 123321) == 122999\n assert candidate(n = 888888888) == 888888888\n assert candidate(n = 123454321) == 123449999\n assert candidate(n = 8765432109) == 7999999999\n assert candidate(n = 123456789) == 123456789\n assert candidate(n = 9631) == 8999\n assert candidate(n = 87654321) == 79999999\n assert candidate(n = 1001001001) == 999999999\n assert candidate(n = 4444444444) == 4444444444\n assert candidate(n = 9988776655) == 8999999999\n assert candidate(n = 543212345) == 499999999\n assert candidate(n = 100100100) == 99999999\n assert candidate(n = 876543210) == 799999999\n assert candidate(n = 32123) == 29999\n assert candidate(n = 9876554321) == 8999999999\n assert candidate(n = 654321234) == 599999999\n assert candidate(n = 9876543210987654321) == 8999999999999999999\n assert candidate(n = 333222111) == 299999999\n assert candidate(n = 44444333) == 39999999\n assert candidate(n = 898989898) == 889999999\n assert candidate(n = 111000) == 99999\n assert candidate(n = 3214321) == 2999999\n assert candidate(n = 1122334455) == 1122334455\n assert candidate(n = 10998877665544332211) == 9999999999999999999\n assert candidate(n = 1234567890) == 1234567889\n assert candidate(n = 221122) == 199999\n assert candidate(n = 1000000) == 999999\n assert candidate(n = 543210987) == 499999999\n assert candidate(n = 1099) == 999\n assert candidate(n = 111222333444555666777888999) == 111222333444555666777888999\n assert candidate(n = 222222222) == 222222222\n assert candidate(n = 444333222111) == 399999999999\n assert candidate(n = 11112222) == 11112222\n assert candidate(n = 1109999999) == 999999999\n assert candidate(n = 111111110) == 99999999\n assert candidate(n = 654321098765) == 599999999999\n assert candidate(n = 1234567899) == 1234567899\n assert candidate(n = 345678901) == 345678899\n assert candidate(n = 666666666) == 666666666\n assert candidate(n = 123000456) == 122999999\n assert candidate(n = 111122221111) == 111119999999\n assert candidate(n = 3456543) == 3455999\n assert candidate(n = 3210987654321) == 2999999999999\n assert candidate(n = 221122112) == 199999999\n assert candidate(n = 12344321) == 12339999\n assert candidate(n = 888887777666655554444333322221111) == 799999999999999999999999999999999\n assert candidate(n = 555444555) == 499999999\n assert candidate(n = 222333444555) == 222333444555\n assert candidate(n = 543210) == 499999\n assert candidate(n = 8888777766665555) == 7999999999999999\n assert candidate(n = 100100) == 99999\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().monotoneIncreasingDigits", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var monotoneIncreasingDigits = function(n) {", "container": null, "callable": "monotoneIncreasingDigits", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 739, "task_id": "daily-temperatures", "difficulty": "Medium", "problem_description": "Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperature. If there is no future day for which this is possible, keep answer[i] == 0 instead.\n \nExample 1:\nInput: temperatures = [73,74,75,71,69,72,76,73]\nOutput: [1,1,4,2,1,1,0,0]\nExample 2:\nInput: temperatures = [30,40,50,60]\nOutput: [1,1,1,0]\nExample 3:\nInput: temperatures = [30,60,90]\nOutput: [1,1,0]\n\n \nConstraints:\n\n1 <= temperatures.length <= 105\n30 <= temperatures[i] <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(temperatures = [80, 79, 78, 77, 76, 75, 74, 73]) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [73, 74, 75, 71, 69, 72, 76, 73]) == [1, 1, 4, 2, 1, 1, 0, 0]\n assert candidate(temperatures = [40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [30, 30, 30, 30]) == [0, 0, 0, 0]\n assert candidate(temperatures = [30, 35, 40, 45, 50, 55, 60, 65, 70, 75]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [70, 69, 68, 67, 71, 72, 73]) == [4, 3, 2, 1, 1, 1, 0]\n assert candidate(temperatures = [55, 38, 53, 81, 61, 93, 97, 32, 43, 78]) == [3, 1, 1, 2, 1, 1, 0, 1, 1, 0]\n assert candidate(temperatures = [70, 70, 70, 70, 70, 70, 70, 71]) == [7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [30, 35, 30, 40, 30, 50, 60]) == [1, 2, 1, 2, 1, 1, 0]\n assert candidate(temperatures = [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [30, 40, 50, 60]) == [1, 1, 1, 0]\n assert candidate(temperatures = [30, 50, 40, 60, 55, 65, 70]) == [1, 2, 1, 2, 1, 1, 0]\n assert candidate(temperatures = [70, 70, 70, 71]) == [3, 2, 1, 0]\n assert candidate(temperatures = [30, 60, 90]) == [1, 1, 0]\n assert candidate(temperatures = [89, 62, 70, 58, 47, 47, 46, 76, 100, 70]) == [8, 1, 5, 4, 3, 2, 1, 1, 0, 0]\n assert candidate(temperatures = [70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 71]) == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [30, 60, 50, 90, 50, 70, 30, 40, 80, 60, 50, 70, 90, 100, 50, 40, 30, 20, 10, 90]) == [1, 2, 1, 10, 1, 3, 1, 1, 4, 2, 1, 1, 1, 0, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 74, 73]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0]\n assert candidate(temperatures = [72, 68, 74, 73, 75, 74, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]) == [2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480, 510, 540, 570, 600, 630, 660, 690, 720, 750, 780, 810, 840, 870, 900, 930, 960, 990, 1020, 1050, 1080, 1110, 1140, 1170, 1200, 1230, 1260, 1290, 1320, 1350, 1380, 1410, 1440, 1470, 1500]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 50]) == [18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0]\n assert candidate(temperatures = [70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 71]) == [41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [80, 79, 81, 78, 82, 77, 83, 76, 84, 75, 85, 74, 86, 73, 87, 72, 88, 71, 89, 70]) == [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 0]\n assert candidate(temperatures = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51]) == [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41, 40, 43, 42, 45, 44, 47, 46, 49, 48]) == [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 0]\n assert candidate(temperatures = [73, 74, 75, 71, 69, 72, 76, 73, 80, 85, 90, 100, 99, 98, 97, 96, 95, 94, 93, 92]) == [1, 1, 4, 2, 1, 1, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [30, 50, 40, 60, 50, 70, 60, 80, 70, 90, 80, 100, 90, 110, 100, 120, 110, 130, 120, 140]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0]\n assert candidate(temperatures = [30, 50, 40, 60, 50, 70, 60, 80, 70, 90, 80, 100, 90, 110, 100, 120, 110, 130, 120, 140, 130, 150, 140, 160, 150, 170, 160, 180, 170, 190, 180, 200, 190, 210, 200, 220, 210, 230, 220, 240, 230, 250, 240, 260, 250, 270, 260, 280, 270, 290, 280, 300, 290]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 0]\n assert candidate(temperatures = [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [50, 40, 30, 20, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]) == [9, 7, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90, 30, 60, 90]) == [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0]\n assert candidate(temperatures = [35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36]) == [27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 91]) == [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [73, 69, 71, 68, 74, 72, 69, 75, 70, 76, 71, 77, 72, 78, 73, 79, 74, 80, 75, 81, 76, 82, 77, 83, 78, 84, 79, 85, 80, 86, 81]) == [4, 1, 2, 1, 3, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 0]\n assert candidate(temperatures = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == [0, 59, 57, 55, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [30, 60, 50, 80, 70, 100, 90, 120, 110, 140, 130, 160, 150, 180, 170, 200, 190, 220, 210, 240, 230, 260, 250, 280, 270, 300, 290, 320, 310, 340, 330, 360, 350, 380, 370, 400, 390, 420, 410, 440, 430, 460, 450, 480, 470, 500, 490, 520, 510, 540, 530, 560, 550, 580, 570, 600, 590, 620, 610, 640, 630, 660, 650, 680, 670, 700, 690, 720, 710, 740, 730, 760, 750, 780, 770, 800, 790, 820, 810, 840, 830, 860, 850, 880, 870, 900, 890, 920, 910, 940, 930, 960, 950, 980, 970, 1000, 990, 1020, 1010, 1040, 1030, 1050]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0]\n assert candidate(temperatures = [80, 70, 60, 50, 40, 30, 20, 10, 80, 70, 60, 50, 40, 30, 20, 10, 80, 70, 60, 50, 40, 30, 20, 10, 80, 70, 60, 50, 40, 30, 20, 10, 80, 70, 60, 50, 40, 30, 20, 10, 80, 70, 60, 50, 40, 30, 20, 10]) == [0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [80, 79, 81, 80, 79, 81, 80, 79, 81, 80, 79, 81, 80, 79, 81, 80, 79, 81, 80, 79, 81, 80, 79, 81, 80, 79, 81, 80, 79, 81, 80, 79, 81, 80, 79, 81, 80, 79, 81, 80, 79, 81, 80, 82]) == [2, 1, 41, 2, 1, 38, 2, 1, 35, 2, 1, 32, 2, 1, 29, 2, 1, 26, 2, 1, 23, 2, 1, 20, 2, 1, 17, 2, 1, 14, 2, 1, 11, 2, 1, 8, 2, 1, 5, 2, 1, 2, 1, 0]\n assert candidate(temperatures = [30, 30, 30, 30, 30, 30, 30, 31]) == [7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [99, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 100]) == [27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [70, 60, 50, 40, 30, 20, 10, 21, 31, 41, 51, 61, 71]) == [12, 10, 8, 6, 4, 2, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 71]) == [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [73, 74, 75, 71, 69, 72, 76, 73, 69, 70, 74, 73, 72, 75, 71, 69, 72, 76, 73, 69, 70, 74, 73, 72, 75, 71, 69, 72, 76, 73, 69, 70, 74, 73, 72, 75, 71, 69, 72, 76, 73, 69, 70, 74, 73, 72]) == [1, 1, 4, 2, 1, 1, 0, 3, 1, 1, 3, 2, 1, 4, 2, 1, 1, 0, 3, 1, 1, 3, 2, 1, 4, 2, 1, 1, 0, 3, 1, 1, 3, 2, 1, 4, 2, 1, 1, 0, 3, 1, 1, 0, 0, 0]\n assert candidate(temperatures = [60, 50, 40, 30, 20, 10, 60, 50, 40, 30, 20, 10, 60, 50, 40, 30, 20, 10, 60, 50]) == [0, 5, 4, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0, 0]\n assert candidate(temperatures = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30]) == [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [60, 59, 61, 58, 62, 57, 63, 56, 64, 55, 65, 54, 66, 53, 67, 52, 68, 51, 69, 50]) == [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 0]\n assert candidate(temperatures = [30, 31, 30, 32, 31, 33, 32, 34, 33, 35, 34, 36, 35, 37, 36, 38, 37, 39, 38, 40, 39, 41, 40, 42, 41, 43, 42, 44, 43, 45, 44, 46, 45, 47, 46, 48, 47, 49, 48, 50, 49, 51, 50, 52, 51, 53, 52, 54, 53, 55, 54, 56, 55, 57, 56, 58, 57, 59, 58, 60]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0]\n assert candidate(temperatures = [71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [73, 74, 75, 71, 69, 72, 76, 73, 69, 72, 76, 73, 69, 72, 76, 73, 69, 72, 76, 73, 69, 72, 76, 73, 69, 72, 76, 73]) == [1, 1, 4, 2, 1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 0]\n assert candidate(temperatures = [30, 40, 50, 40, 30, 40, 50, 60, 70, 80, 70, 60, 50, 40, 30, 20, 10, 0]) == [1, 1, 5, 3, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [80, 80, 80, 80, 80, 81, 79, 80, 80, 80, 82]) == [5, 4, 3, 2, 1, 5, 1, 3, 2, 1, 0]\n assert candidate(temperatures = [30, 35, 30, 40, 30, 50, 60, 30, 35, 30, 40, 30, 50, 60, 30, 35, 30, 40, 30, 50, 60, 30, 35, 30, 40, 30, 50, 60, 30, 35, 30, 40, 30, 50, 60, 30, 35, 30, 40, 30, 50, 60, 30, 35, 30, 40]) == [1, 2, 1, 2, 1, 1, 0, 1, 2, 1, 2, 1, 1, 0, 1, 2, 1, 2, 1, 1, 0, 1, 2, 1, 2, 1, 1, 0, 1, 2, 1, 2, 1, 1, 0, 1, 2, 1, 2, 1, 1, 0, 1, 2, 1, 0]\n assert candidate(temperatures = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 30]) == [18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0]\n assert candidate(temperatures = [80, 80, 80, 80, 80, 80, 80, 80, 80, 81]) == [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 30]) == [0, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 101]) == [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31]) == [40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 72]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 51]) == [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 100, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 100, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 100, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]) == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == [1, 1, 1, 1, 1, 1, 1, 0, 17, 15, 13, 11, 9, 7, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [73, 72, 71, 70, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100, 100, 100, 100]) == [4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480, 510, 540, 570, 600, 630, 660, 690, 720, 750, 780, 810, 840, 870, 900, 930, 960, 990, 1020, 1050, 1080, 1110, 1140, 1170, 1200, 1230, 1260, 1290, 1320, 1350, 1380, 1410, 1440, 1470, 1500]) == [73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [30, 25, 35, 20, 40, 15, 45, 10, 50, 5, 55, 0, 60, 5, 65, 0, 70, 5, 75, 0]) == [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 0]\n assert candidate(temperatures = [73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 80]) == [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [50, 50, 50, 50, 50, 50, 50, 50, 50, 51]) == [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [60, 50, 65, 55, 70, 60, 75, 65, 80, 70, 85, 75, 90, 80, 95, 85, 100, 90, 105, 95]) == [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 0]\n assert candidate(temperatures = [30, 31, 30, 33, 30, 35, 30, 37, 30, 39, 30, 41, 30, 43, 30, 45, 30, 47, 30, 49]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0]\n assert candidate(temperatures = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 31, 20, 19]) == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0]\n assert candidate(temperatures = [30, 60, 50, 40, 30, 20, 10, 90, 80, 70, 60, 50, 40, 30, 20, 10, 91]) == [1, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [45, 44, 46, 43, 47, 42, 48, 41, 49, 40, 50, 39, 51, 38, 52, 37, 53, 36, 54, 35]) == [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 0]\n assert candidate(temperatures = [50, 60, 55, 65, 60, 70, 65, 75, 70, 80, 75, 85, 80, 90, 85, 95, 90, 100, 95, 105]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0]\n assert candidate(temperatures = [30, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60, 90, 60]) == [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]\n assert candidate(temperatures = [90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [220, 210, 200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [30, 100, 30, 100, 30, 100, 30, 100, 30, 100, 30, 100, 30, 100, 30, 100, 30, 100, 30, 100, 30, 100, 30, 100, 30, 100, 30, 100]) == [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(temperatures = [90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 91]) == [61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(temperatures = [73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [30, 29, 30, 28, 29, 27, 28, 26, 27, 25, 26, 24, 25, 23, 24, 22, 23, 21, 22, 20]) == [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]\n assert candidate(temperatures = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [70, 69, 68, 67, 66, 65, 64, 63, 62, 61]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [30, 60, 50, 65, 40, 70, 55, 75, 45, 80, 50, 85, 60, 90, 65, 95, 70, 100, 75, 105]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0]\n assert candidate(temperatures = [30, 40, 30, 50, 30, 60, 30, 70, 30, 80, 30, 90, 30, 100, 30, 110, 30, 120, 30, 130]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0]\n assert candidate(temperatures = [90, 80, 70, 60, 50, 40, 30, 20, 10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == [19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [30, 40, 50, 40, 30, 40, 50, 40, 30, 40, 50, 40, 30, 40, 50, 40, 30, 40, 50, 40, 30, 40, 50, 40, 30, 40, 50, 40, 30, 40, 50, 40, 30, 40, 50, 40, 30, 40, 50, 40, 30, 40, 50, 40, 30]) == [1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 3, 1, 1, 0, 0, 0]\n assert candidate(temperatures = [30, 40, 50, 60, 50, 40, 30, 20, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80]) == [1, 1, 1, 11, 9, 7, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0]\n assert candidate(temperatures = [73, 74, 75, 71, 69, 72, 76, 73, 71, 69, 72, 76, 73, 71, 69, 72, 76, 73, 71, 69, 72, 76, 73, 71, 69, 72, 76, 73, 71, 69, 72, 76, 73, 71, 69, 72, 76, 73, 71, 69, 72, 76, 73, 71, 69, 72, 76, 73, 71, 69, 72, 76, 73]) == [1, 1, 4, 2, 1, 1, 0, 4, 2, 1, 1, 0, 4, 2, 1, 1, 0, 4, 2, 1, 1, 0, 4, 2, 1, 1, 0, 4, 2, 1, 1, 0, 4, 2, 1, 1, 0, 4, 2, 1, 1, 0, 4, 2, 1, 1, 0, 4, 2, 1, 1, 0, 0]\n assert candidate(temperatures = [30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(temperatures = [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n"}, "metadata": {"canonical_parameter_names": ["temperatures"], "leetcode_dataset_entry_point": "Solution().dailyTemperatures", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var dailyTemperatures = function(temperatures) {", "container": null, "callable": "dailyTemperatures", "parameters": [{"name": "temperatures", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 740, "task_id": "delete-and-earn", "difficulty": "Medium", "problem_description": "You are given an integer array nums. You want to maximize the number of points you get by performing the following operation any number of times:\n\nPick any nums[i] and delete it to earn nums[i] points. Afterwards, you must delete every element equal to nums[i] - 1 and every element equal to nums[i] + 1.\n\nReturn the maximum number of points you can earn by applying the above operation some number of times.\n \nExample 1:\n\nInput: nums = [3,4,2]\nOutput: 6\nExplanation: You can perform the following operations:\n- Delete 4 to earn 4 points. Consequently, 3 is also deleted. nums = [2].\n- Delete 2 to earn 2 points. nums = [].\nYou earn a total of 6 points.\n\nExample 2:\n\nInput: nums = [2,2,3,3,3,4]\nOutput: 9\nExplanation: You can perform the following operations:\n- Delete a 3 to earn 3 points. All 2's and 4's are also deleted. nums = [3,3].\n- Delete a 3 again to earn 3 points. nums = [3].\n- Delete a 3 once more to earn 3 points. nums = [].\nYou earn a total of 9 points.\n \nConstraints:\n\n1 <= nums.length <= 2 * 104\n1 <= nums[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [2, 3, 5, 8, 13, 21]) == 50\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 60\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 20\n assert candidate(nums = [2, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 22\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 30\n assert candidate(nums = [2, 2, 3, 3, 3, 4]) == 9\n assert candidate(nums = [10000, 10000, 10000, 10000]) == 40000\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 30\n assert candidate(nums = [1]) == 1\n assert candidate(nums = [10000, 10000, 10000]) == 30000\n assert candidate(nums = [7, 6, 5, 4, 3, 2, 1]) == 16\n assert candidate(nums = [1, 10000]) == 10001\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 100\n assert candidate(nums = [1, 6, 3, 3, 8, 4, 8, 10]) == 39\n assert candidate(nums = [1, 2, 3, 4, 5]) == 9\n assert candidate(nums = [3, 4, 2]) == 6\n assert candidate(nums = [5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7]) == 48\n assert candidate(nums = [1, 6, 3, 3, 3, 3, 10, 5, 7]) == 35\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3]) == 12\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]) == 16\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 110\n assert candidate(nums = [3, 1, 5, 6, 7, 4, 5, 5, 2, 3, 4, 5, 7, 8, 9, 10]) == 51\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 20\n assert candidate(nums = [1, 2, 3, 3, 4, 5, 5, 6, 7, 8, 9, 10]) == 35\n assert candidate(nums = [1, 1, 1, 1, 1, 1]) == 6\n assert candidate(nums = [10000]) == 10000\n assert candidate(nums = [1, 10, 100, 1000, 10000, 1, 10, 100, 1000, 10000, 1, 10, 100, 1000, 10000]) == 33333\n assert candidate(nums = [1, 10, 100, 1000, 10000, 5, 55, 555, 5555, 3, 33, 333, 3333, 33333]) == 54316\n assert candidate(nums = [5, 3, 5, 5, 2, 4, 4, 4, 4, 4, 3, 2, 3, 5, 4]) == 29\n assert candidate(nums = [1, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 160\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 5, 5, 6, 7, 8, 9, 10, 10, 10, 10]) == 72\n assert candidate(nums = [8, 8, 7, 7, 7, 6, 5, 5, 5, 5, 4, 3, 3, 2, 1]) == 48\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 11000\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 110\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 100\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 20\n assert candidate(nums = [1, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 10, 10, 10, 10]) == 78\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 400\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 310\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 1100\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 240\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8]) == 120\n assert candidate(nums = [2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10]) == 90\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == 90\n assert candidate(nums = [1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 15]) == 114\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]) == 625\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]) == 1058\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 64\n assert candidate(nums = [5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]) == 165\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == 128\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 420\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25]) == 190\n assert candidate(nums = [5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9]) == 78\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 10]) == 76\n assert candidate(nums = [1, 10000, 10000, 10000, 10000, 10000]) == 50001\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8]) == 98\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50]) == 650\n assert candidate(nums = [42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42]) == 1260\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7]) == 62\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 60\n assert candidate(nums = [2, 2, 2, 3, 3, 3, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == 81\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 236\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19]) == 200\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 7, 8, 8, 9, 10, 10]) == 86\n assert candidate(nums = [1, 10000, 2, 9999, 3, 9998, 4, 9997, 5, 9996, 6, 9995, 7, 9994, 8, 9993, 9, 9992, 10, 9991]) == 50010\n assert candidate(nums = [4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 20, 20]) == 184\n assert candidate(nums = [1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 5]) == 20\n assert candidate(nums = [1, 100, 1000, 10000, 9999, 999, 99, 9, 8, 80, 800, 8000, 7, 70, 700, 7000, 6, 60, 600, 6000]) == 34427\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 110\n assert candidate(nums = [2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 34\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 9980]) == 99900\n assert candidate(nums = [5000, 5000, 5000, 5001, 5001, 5001, 5002, 5002, 5002, 5003, 5003, 5003, 5004, 5004, 5004, 5005, 5005, 5005, 5006, 5006, 5006, 5007, 5007, 5007]) == 60048\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 1650\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 35\n assert candidate(nums = [5, 7, 7, 7, 7, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 13, 13, 13, 13]) == 165\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6]) == 68\n assert candidate(nums = [1, 2, 3, 3, 4, 5, 5, 5, 6, 6, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10]) == 126\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6]) == 58\n assert candidate(nums = [10, 10, 10, 20, 20, 20, 30, 30, 30, 40, 40, 40, 50, 50, 50, 60, 60, 60, 70, 70, 70, 80, 80, 80, 90, 90, 90]) == 1350\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 120\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == 12000\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 5530\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]) == 420\n assert candidate(nums = [5, 6, 6, 6, 7, 8, 8, 8, 8, 9, 10, 10, 10, 10, 10, 10, 11, 12, 12, 12, 12, 12, 12, 12]) == 194\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 90\n assert candidate(nums = [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500]) == 10000\n assert candidate(nums = [10, 10, 10, 11, 11, 12, 12, 12, 13, 14, 14, 15, 16, 17, 18, 18, 19, 20, 20, 20, 20, 20]) == 246\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 165\n assert candidate(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == 1210\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]) == 169\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20]) == 220\n assert candidate(nums = [2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 10, 10, 10]) == 104\n assert candidate(nums = [2, 3, 6, 7, 10, 11, 12, 15, 16, 19, 20, 21, 24, 25, 26, 29, 30, 31, 34, 35, 36, 39, 40, 41, 44, 45, 46]) == 438\n assert candidate(nums = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55]) == 325\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8]) == 107\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == 161\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250]) == 3250\n assert candidate(nums = [3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 233\n assert candidate(nums = [2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13]) == 144\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 60\n assert candidate(nums = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 168\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]) == 110000\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 220\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 220\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == 90\n assert candidate(nums = [1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4]) == 36\n assert candidate(nums = [3, 3, 3, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 9, 9, 9, 9]) == 99\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 155\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51]) == 676\n assert candidate(nums = [3, 1, 2, 3, 3, 3, 4, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10]) == 96\n assert candidate(nums = [2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 10, 10, 10, 10]) == 128\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 5500\n assert candidate(nums = [4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12]) == 142\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10]) == 182\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().deleteAndEarn", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var deleteAndEarn = function(nums) {", "container": null, "callable": "deleteAndEarn", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 741, "task_id": "cherry-pickup", "difficulty": "Hard", "problem_description": "You are given an n x n grid representing a field of cherries, each cell is one of three possible integers.\n\n0 means the cell is empty, so you can pass through,\n1 means the cell contains a cherry that you can pick up and pass through, or\n-1 means the cell contains a thorn that blocks your way.\n\nReturn the maximum number of cherries you can collect by following the rules below:\n\nStarting at the position (0, 0) and reaching (n - 1, n - 1) by moving right or down through valid path cells (cells with value 0 or 1).\nAfter reaching (n - 1, n - 1), returning to (0, 0) by moving left or up through valid path cells.\nWhen passing through a path cell containing a cherry, you pick it up, and the cell becomes an empty cell 0.\nIf there is no valid path between (0, 0) and (n - 1, n - 1), then no cherries can be collected.\n\n \nExample 1:\n\n\nInput: grid = [[0,1,-1],[1,0,-1],[1,1,1]]\nOutput: 5\nExplanation: The player started at (0, 0) and went down, down, right right to reach (2, 2).\n4 cherries were picked up during this single trip, and the matrix becomes [[0,1,-1],[0,0,-1],[0,0,0]].\nThen, the player went left, up, up, left to return home, picking up one more cherry.\nThe total number of cherries picked up is 5, and this is the maximum possible.\n\nExample 2:\n\nInput: grid = [[1,1,-1],[1,-1,1],[-1,1,1]]\nOutput: 0\n\n \nConstraints:\n\nn == grid.length\nn == grid[i].length\n1 <= n <= 50\ngrid[i][j] is -1, 0, or 1.\ngrid[0][0] != -1\ngrid[n - 1][n - 1] != -1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[0, 1, -1], [1, 0, -1], [1, 1, 1]]) == 5\n assert candidate(grid = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 1, 1], [1, 1, 0, 1], [1, 1, 1, 1]]) == 12\n assert candidate(grid = [[1, -1, -1, -1], [-1, 1, -1, -1], [-1, -1, 1, -1], [-1, -1, -1, 1]]) == 0\n assert candidate(grid = [[1, 1, -1], [1, -1, 1], [-1, 1, 1]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 0, -1, 0, 0], [0, 1, 1, -1, 0], [0, 0, -1, 0, 1], [0, 0, 0, 0, 0]]) == 4\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, -1, -1, -1, 1], [1, -1, -1, -1, 1], [1, -1, -1, -1, 1], [1, 1, 1, 1, 1]]) == 16\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, -1, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [0, 1, 1, -1, 1, 1, 1], [1, 1, -1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]]) == 24\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 12\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 8\n assert candidate(grid = [[0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [1, 0, 0, 1, 1], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0]]) == 7\n assert candidate(grid = [[1, 0, 0, 1, 0], [0, -1, -1, 0, 0], [1, 0, 1, 0, 1], [-1, 0, 0, 1, 0], [0, 0, 1, 0, 1]]) == 7\n assert candidate(grid = [[1, 0, 1, -1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, -1, 1, -1, 1, -1, 1, -1], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 14\n assert candidate(grid = [[0, 1, 1, 0, 0], [0, 0, 0, 1, 0], [0, 1, -1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0]]) == 5\n assert candidate(grid = [[1, 1, 0, 0, 1], [0, 1, -1, 1, 0], [0, 1, 0, 1, 0], [0, -1, 1, 0, 0], [1, 0, 0, 0, 1]]) == 8\n assert candidate(grid = [[1, 0, 0, 0, 1, 1], [0, 0, -1, 0, 0, 0], [0, 0, 0, 0, -1, 0], [1, 1, 0, -1, 0, 0], [0, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]) == 9\n assert candidate(grid = [[0, 1, 1, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0], [1, 1, 0, 1, 0], [0, 1, 0, 1, 0]]) == 9\n assert candidate(grid = [[1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [0, 1, -1, 1, 0], [0, 0, 0, 0, 0], [0, 0, 1, 1, 1]]) == 10\n assert candidate(grid = [[1, 1, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 1, 1]]) == 18\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, -1, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 0, 0, 1, 1]]) == 10\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, -1, 1, -1, 1, -1], [1, -1, -1, -1, -1, 1], [1, -1, 1, -1, 1, -1], [1, 1, 1, 1, 1, 1]]) == 11\n assert candidate(grid = [[1, 1, 1, 0, 0, 0], [0, -1, 0, 1, 0, 0], [0, 0, 0, 0, -1, 0], [0, 0, -1, 0, 0, 1], [0, 0, 0, -1, 0, 0], [0, 0, 0, 0, 0, 1]]) == 6\n assert candidate(grid = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 8\n assert candidate(grid = [[1, 1, 0, 1, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1], [0, 0, 0, 0, 0], [1, 1, 0, 1, 1]]) == 10\n assert candidate(grid = [[1, 1, 0, 0, 0], [0, 0, 0, 1, 1], [0, 1, -1, 1, 0], [0, 1, 0, 0, 0], [0, 0, 0, 1, 1]]) == 8\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [0, -1, 0, -1, 0, -1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [0, -1, 0, -1, 0, -1], [1, 1, 1, 1, 1, 1]]) == 15\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1]]) == 12\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1]]) == 9\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 14\n assert candidate(grid = [[1, 1, 0, 0, 0, 1], [1, 1, 1, -1, 0, 0], [0, -1, 1, 0, 0, 0], [0, 0, 0, 0, -1, 0], [0, 0, -1, 0, 1, 1], [0, 0, 0, 0, 0, 1]]) == 10\n assert candidate(grid = [[1, 1, 0, 0, -1], [0, 1, 0, 1, 0], [1, 0, 1, -1, 1], [0, -1, 0, 1, 0], [0, 0, 1, 1, 0]]) == 9\n assert candidate(grid = [[1, 1, 1, -1, -1], [0, 1, 0, 0, 1], [0, 0, 0, 1, 0], [1, -1, 0, 0, 1], [1, 0, 1, 0, 1]]) == 9\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 0, 1, 0], [0, 1, 1, -1, 0], [0, 0, 0, 0, 0], [0, 0, 1, 0, 1]]) == 6\n assert candidate(grid = [[1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0], [1, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 1]]) == 6\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 0, -1, 0, 1, 1], [1, 1, 1, 1, 1, 1], [0, 1, 1, -1, 1, 1], [1, 1, -1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == 20\n assert candidate(grid = [[0, 1, 1, 1, 0], [1, 0, -1, 0, 1], [1, -1, 1, -1, 1], [0, 1, -1, 1, 0], [1, 1, 1, 0, 1]]) == 11\n assert candidate(grid = [[0, 1, 1, 0, 1, -1], [1, 0, -1, 0, 1, 0], [1, 0, 1, 0, 1, 1], [0, 1, 1, 1, 0, 1], [0, 0, 1, -1, 1, 1], [1, 0, 1, 1, 1, 0]]) == 16\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 0, -1, 0, 1], [0, 0, 1, 0, 0], [0, 1, 0, -1, 0], [0, 0, 0, 1, 1]]) == 7\n assert candidate(grid = [[1, 1, 0, 1, 1], [1, -1, -1, 1, 1], [0, 1, 0, -1, 1], [1, 0, 0, 1, 0], [1, 1, 1, 1, 0]]) == 12\n assert candidate(grid = [[1, -1, 1, -1, 1, -1, 1], [1, 1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, -1, 1], [1, 1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, -1, 1], [1, 1, 1, 1, 1, 1, 1], [1, -1, 1, -1, 1, -1, 1]]) == 22\n assert candidate(grid = [[1, -1, 1, -1, 1, -1], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 10\n assert candidate(grid = [[1, 1, 0, 0, 0, 0], [1, -1, 1, 1, -1, 1], [0, 1, -1, 0, 1, 0], [0, 0, 1, 0, 0, 0], [0, -1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 1]]) == 10\n assert candidate(grid = [[0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, -1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0]]) == 10\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 1, -1, 0, 0], [0, 1, 1, -1, 1, 1, 0], [0, 0, -1, 1, 0, 0, 0], [0, 0, 1, 0, 0, 1, 1], [1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 1, 0, 0]]) == 8\n assert candidate(grid = [[1, 1, 1, 0, 1], [1, 0, 1, 1, 1], [1, 1, -1, 1, 1], [0, 0, 1, 0, 1], [1, 1, 1, 0, 1]]) == 14\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0], [0, 0, 0, 0, -1, 0], [0, 0, 0, -1, 0, 0], [0, 0, 0, 0, 0, 1]]) == 2\n assert candidate(grid = [[0, 1, -1, -1, 0], [1, 0, 1, 0, 1], [-1, 1, 0, 1, -1], [0, 1, -1, 1, 0], [0, 0, 0, 0, 0]]) == 7\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, -1, 0, -1, 0, 1], [1, 0, -1, 0, -1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == 24\n assert candidate(grid = [[1, 1, 0, 0, 0, 1, 1], [1, 0, -1, 0, 1, 0, 1], [0, 0, 1, 0, 0, 1, 0], [0, 1, 0, -1, 0, 1, 0], [0, 0, 0, 1, 1, 0, 0], [1, 0, 1, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 1]]) == 13\n assert candidate(grid = [[1, -1, 1, -1, 1, -1, 1], [0, 0, 0, 0, 0, 0, 0], [1, -1, 1, -1, 1, -1, 1], [0, 0, 0, 0, 0, 0, 0], [1, -1, 1, -1, 1, -1, 1], [0, 0, 0, 0, 0, 0, 0], [1, -1, 1, -1, 1, -1, 1]]) == 6\n assert candidate(grid = [[1, 1, 1, 0, -1], [0, 0, 1, 1, 0], [-1, 1, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 10\n assert candidate(grid = [[0, 1, 0, 1, 0], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1], [0, 0, 0, 0, 0], [0, 1, 0, 1, 0]]) == 6\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 1], [0, -1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, -1, 0, 0], [0, 0, 0, -1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0]]) == 3\n assert candidate(grid = [[1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, -1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]) == 16\n assert candidate(grid = [[1, 0, 0, 0, -1], [0, -1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, -1, 0, 1], [0, 0, 0, 1, 1]]) == 5\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, -1, 0, 0, 0, 1], [1, 0, 0, -1, 0, 1], [1, 0, -1, 0, 0, 1], [1, 0, 0, 0, -1, 1], [1, 1, 1, 1, 1, 1]]) == 20\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]]) == 6\n assert candidate(grid = [[1, -1, 1, -1, 1], [1, 0, 1, 0, 1], [-1, 1, -1, 1, -1], [1, 0, 1, 0, 1], [1, -1, 1, -1, 1]]) == 8\n assert candidate(grid = [[0, 1, 0, 0, 1, -1], [0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1], [-1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1]]) == 9\n assert candidate(grid = [[0, 0, 0, 0, 0], [1, -1, 1, 1, 0], [0, 1, 1, -1, 1], [1, -1, 1, 0, 0], [0, 1, 0, 1, 1]]) == 9\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [1, 0, 0, 0, 1]]) == 4\n assert candidate(grid = [[0, 1, 1, 0, 0, 0], [0, 1, -1, 0, 1, 0], [0, 0, 1, 0, 0, 1], [0, 1, 0, -1, 0, 1], [0, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 0]]) == 9\n assert candidate(grid = [[1, -1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == 9\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 1, 1, 0], [1, 1, 0, 0, 0, 1, 0, 0, 1], [0, 0, -1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, -1, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0]]) == 11\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, -1, -1, 1, 1, 1], [1, 1, 1, -1, 1, 1], [1, 1, 1, 1, -1, 1], [1, 1, 1, 1, 1, -1], [1, 1, 1, 1, 1, 1]]) == 17\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, -1, 1, -1, 0], [0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 9\n assert candidate(grid = [[0, 0, 0, 1, 0], [0, -1, 0, 0, 0], [0, 1, -1, 0, 0], [0, -1, 0, 0, 0], [0, 0, 0, 0, 1]]) == 2\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) == 2\n assert candidate(grid = [[1, 0, 1, 0, 0], [0, 0, 0, 1, 0], [1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1]]) == 8\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, -1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 16\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 0, -1, 0, 0], [0, -1, 0, -1, 0], [0, 0, -1, 0, 0], [1, 0, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 1, 0, 1, 0, 1, 1], [1, 1, 1, 0, 1, 0, 1], [0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1], [1, 1, 0, 1, 0, 1, 1]]) == 16\n assert candidate(grid = [[0, 1, 1, 0, 1], [1, 0, 1, 0, 1], [1, 1, 1, 0, 1], [0, 1, 0, 1, 1], [1, 1, 0, 0, 1]]) == 12\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 16\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, -1, -1, -1, 1], [1, -1, 1, -1, 1], [1, -1, -1, -1, 1], [1, 1, 1, 1, 1]]) == 16\n assert candidate(grid = [[1, 0, 1, 0, 0, 0, 1], [0, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0, 1]]) == 10\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().cherryPickup", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var cherryPickup = function(grid) {", "container": null, "callable": "cherryPickup", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 743, "task_id": "network-delay-time", "difficulty": "Medium", "problem_description": "You are given a network of n nodes, labeled from 1 to n. You are also given times, a list of travel times as directed edges times[i] = (ui, vi, wi), where ui is the source node, vi is the target node, and wi is the time it takes for a signal to travel from source to target.\nWe will send a signal from a given node k. Return the minimum time it takes for all the n nodes to receive the signal. If it is impossible for all the n nodes to receive the signal, return -1.\n \nExample 1:\n\n\nInput: times = [[2,1,1],[2,3,1],[3,4,1]], n = 4, k = 2\nOutput: 2\n\nExample 2:\n\nInput: times = [[1,2,1]], n = 2, k = 1\nOutput: 1\n\nExample 3:\n\nInput: times = [[1,2,1]], n = 2, k = 2\nOutput: -1\n\n \nConstraints:\n\n1 <= k <= n <= 100\n1 <= times.length <= 6000\ntimes[i].length == 3\n1 <= ui, vi <= n\nui != vi\n0 <= wi <= 100\nAll the pairs (ui, vi) are unique. (i.e., no multiple edges.)\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(times = [[1, 2, 10], [2, 3, 10], [1, 3, 1]],n = 3,k = 1) == 10\n assert candidate(times = [[1, 2, 1]],n = 2,k = 1) == 1\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [1, 3, 4]],n = 3,k = 1) == 3\n assert candidate(times = [[3, 1, 5], [3, 2, 2], [2, 1, 2], [3, 4, 1], [4, 5, 1], [5, 3, 1], [1, 5, 4]],n = 5,k = 3) == 4\n assert candidate(times = [[1, 3, 1], [2, 1, 3], [2, 3, 1]],n = 3,k = 2) == 3\n assert candidate(times = [[1, 2, 1], [1, 3, 1], [2, 3, 1], [2, 4, 1], [3, 4, 1], [4, 5, 1]],n = 5,k = 1) == 3\n assert candidate(times = [[1, 2, 1]],n = 2,k = 2) == -1\n assert candidate(times = [[1, 2, 1], [2, 3, 7], [1, 3, 4], [2, 1, 2]],n = 3,k = 2) == 6\n assert candidate(times = [[3, 1, 5], [3, 2, 5], [3, 5, 2], [2, 1, 2], [2, 4, 1], [4, 3, 1], [5, 4, 1], [4, 5, 3], [4, 1, 6]],n = 5,k = 3) == 5\n assert candidate(times = [[1, 2, 1], [2, 1, 3]],n = 2,k = 1) == 1\n assert candidate(times = [[2, 1, 1], [2, 3, 1], [3, 4, 1]],n = 4,k = 2) == 2\n assert candidate(times = [[3, 1, 5], [3, 2, 5], [1, 2, 2], [2, 1, 3], [4, 3, 1]],n = 4,k = 3) == -1\n assert candidate(times = [[3, 1, 5], [3, 2, 2], [2, 1, 2], [3, 4, 1], [4, 5, 1], [5, 2, 5]],n = 5,k = 3) == 4\n assert candidate(times = [[1, 2, 10], [1, 3, 5], [1, 4, 8], [2, 3, 2], [2, 4, 6], [3, 4, 1]],n = 4,k = 1) == 10\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 1, 5]],n = 5,k = 1) == 10\n assert candidate(times = [[1, 2, 1], [1, 3, 2], [1, 4, 3], [1, 5, 4], [1, 6, 5], [1, 7, 6], [1, 8, 7], [1, 9, 8], [1, 10, 9], [2, 10, 1], [3, 10, 2], [4, 10, 3], [5, 10, 4], [6, 10, 5], [7, 10, 6], [8, 10, 7], [9, 10, 8]],n = 10,k = 1) == 8\n assert candidate(times = [[1, 2, 1], [1, 3, 4], [2, 4, 2], [3, 4, 3], [4, 5, 3]],n = 5,k = 1) == 6\n assert candidate(times = [[1, 2, 10], [1, 3, 10], [1, 4, 10], [1, 5, 10], [1, 6, 10], [1, 7, 10], [1, 8, 10], [1, 9, 10], [1, 10, 10]],n = 10,k = 1) == 10\n assert candidate(times = [[1, 2, 10], [1, 3, 20], [2, 4, 5], [3, 5, 10], [4, 6, 20], [5, 7, 30], [6, 8, 40], [7, 9, 50], [8, 10, 60]],n = 10,k = 1) == 135\n assert candidate(times = [[1, 2, 1], [1, 3, 4], [1, 4, 5], [2, 3, 2], [2, 4, 4], [3, 4, 1], [4, 5, 3], [5, 6, 2], [6, 7, 1]],n = 7,k = 1) == 10\n assert candidate(times = [[1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [5, 6, 50], [6, 7, 60], [7, 8, 70], [8, 9, 80], [9, 10, 90], [10, 11, 100], [11, 12, 110], [12, 13, 120]],n = 13,k = 1) == 780\n assert candidate(times = [[1, 2, 1], [1, 3, 2], [2, 4, 1], [3, 4, 2], [4, 5, 1], [2, 5, 2], [3, 5, 3]],n = 5,k = 1) == 3\n assert candidate(times = [[1, 2, 3], [1, 3, 5], [2, 3, 1], [3, 4, 4], [4, 5, 3], [5, 6, 2], [6, 7, 1], [7, 8, 5], [8, 9, 3], [9, 10, 2]],n = 10,k = 1) == 24\n assert candidate(times = [[1, 2, 2], [1, 3, 3], [2, 4, 5], [2, 5, 4], [3, 4, 1], [3, 5, 2], [4, 6, 3], [5, 6, 3], [6, 7, 4], [6, 8, 5], [7, 9, 6], [8, 9, 5], [9, 10, 7]],n = 10,k = 1) == 24\n assert candidate(times = [[1, 2, 5], [2, 3, 3], [3, 4, 2], [4, 5, 1], [5, 6, 1], [6, 7, 2], [7, 8, 3], [8, 9, 4], [9, 10, 5]],n = 10,k = 1) == 26\n assert candidate(times = [[1, 2, 10], [1, 3, 20], [1, 4, 30], [1, 5, 40], [1, 6, 50], [1, 7, 60], [1, 8, 70], [1, 9, 80], [1, 10, 90]],n = 10,k = 1) == 90\n assert candidate(times = [[1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 1, 1], [2, 4, 1], [3, 5, 1], [4, 1, 1], [5, 2, 1]],n = 5,k = 1) == 3\n assert candidate(times = [[1, 2, 10], [2, 3, 10], [3, 4, 10], [4, 5, 10], [5, 6, 10], [6, 7, 10], [7, 8, 10], [8, 9, 10], [9, 10, 10], [1, 10, 1]],n = 10,k = 1) == 80\n assert candidate(times = [[1, 2, 30], [2, 3, 40], [3, 4, 50], [4, 5, 60], [5, 1, 20]],n = 5,k = 5) == 140\n assert candidate(times = [[1, 2, 4], [1, 3, 2], [2, 4, 7], [2, 5, 3], [3, 4, 5], [3, 5, 4], [4, 6, 2], [5, 6, 3]],n = 6,k = 1) == 9\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 9, 8], [9, 10, 9], [10, 11, 10], [11, 12, 11], [12, 13, 12], [13, 14, 13], [14, 1, 14]],n = 14,k = 1) == 91\n assert candidate(times = [[1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [7, 8, 1], [8, 9, 1], [9, 10, 1], [10, 11, 1], [11, 12, 1], [12, 13, 1], [13, 14, 1], [14, 15, 1]],n = 15,k = 1) == 14\n assert candidate(times = [[1, 2, 3], [1, 3, 4], [2, 4, 5], [3, 5, 10], [4, 6, 2], [5, 7, 3], [6, 8, 1], [7, 9, 4], [8, 10, 5]],n = 10,k = 1) == 21\n assert candidate(times = [[1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [5, 1, 50]],n = 5,k = 1) == 100\n assert candidate(times = [[1, 2, 10], [1, 3, 4], [2, 3, 3], [2, 5, 2], [3, 5, 1], [3, 4, 5], [4, 5, 6], [5, 6, 1]],n = 6,k = 1) == 10\n assert candidate(times = [[1, 2, 4], [1, 3, 2], [2, 3, 3], [2, 4, 1], [3, 4, 2], [4, 5, 5], [4, 6, 3], [5, 6, 2]],n = 6,k = 1) == 9\n assert candidate(times = [[1, 2, 1], [2, 3, 1], [3, 1, 1], [1, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [7, 8, 1], [8, 9, 1], [9, 10, 1]],n = 10,k = 1) == 7\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 1, 5], [6, 7, 1], [7, 8, 2], [8, 9, 3], [9, 10, 4], [10, 6, 5]],n = 10,k = 1) == -1\n assert candidate(times = [[1, 2, 4], [2, 3, 6], [1, 3, 5], [3, 4, 2], [4, 5, 1], [5, 6, 3], [6, 7, 4], [7, 1, 8]],n = 7,k = 1) == 15\n assert candidate(times = [[1, 2, 2], [1, 3, 1], [3, 2, 1], [2, 4, 3], [3, 4, 4], [4, 5, 5], [5, 3, 6]],n = 5,k = 1) == 10\n assert candidate(times = [[1, 2, 1], [1, 3, 1], [2, 4, 1], [2, 5, 1], [3, 4, 1], [3, 5, 1], [4, 6, 1], [4, 7, 1], [5, 6, 1], [5, 7, 1], [6, 8, 1], [6, 9, 1], [7, 8, 1], [7, 9, 1], [8, 10, 1], [9, 10, 1], [10, 1, 10]],n = 10,k = 1) == 5\n assert candidate(times = [[1, 2, 10], [2, 3, 20], [3, 4, 10], [4, 5, 20], [1, 3, 5], [3, 1, 5]],n = 5,k = 1) == 35\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 9, 8], [9, 1, 9]],n = 9,k = 1) == 36\n assert candidate(times = [[1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [5, 6, 50], [6, 7, 60], [7, 8, 70], [8, 1, 80]],n = 8,k = 1) == 280\n assert candidate(times = [[1, 2, 1], [1, 3, 1], [2, 4, 1], [3, 4, 1], [4, 5, 1], [1, 5, 1], [2, 5, 1], [3, 5, 1], [4, 1, 1], [5, 1, 1]],n = 5,k = 1) == 2\n assert candidate(times = [[1, 2, 100], [2, 3, 99], [3, 4, 98], [4, 5, 97], [5, 6, 96], [6, 7, 95], [7, 8, 94], [8, 9, 93], [9, 10, 92]],n = 10,k = 1) == 864\n assert candidate(times = [[1, 2, 10], [2, 3, 5], [1, 3, 15], [3, 4, 10], [2, 4, 8], [4, 5, 2], [5, 6, 5], [6, 1, 7]],n = 6,k = 1) == 25\n assert candidate(times = [[1, 2, 1], [1, 3, 2], [2, 4, 3], [2, 5, 4], [3, 6, 5], [3, 7, 6], [4, 8, 7], [4, 9, 8], [5, 10, 9], [5, 11, 10], [6, 12, 11], [7, 12, 12]],n = 12,k = 1) == 18\n assert candidate(times = [[1, 2, 2], [2, 3, 3], [3, 4, 4], [4, 5, 5], [1, 5, 10], [5, 1, 10]],n = 5,k = 1) == 10\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 1, 5], [2, 5, 1], [3, 1, 2], [4, 2, 3], [5, 3, 4]],n = 5,k = 1) == 6\n assert candidate(times = [[1, 2, 2], [2, 3, 4], [3, 4, 6], [4, 5, 8], [5, 6, 10], [6, 7, 12], [7, 8, 14], [8, 9, 16], [9, 10, 18], [10, 1, 20]],n = 10,k = 1) == 90\n assert candidate(times = [[1, 2, 1], [1, 3, 1], [1, 4, 1], [1, 5, 1], [2, 3, 1], [2, 4, 1], [2, 5, 1], [3, 4, 1], [3, 5, 1], [4, 5, 1]],n = 5,k = 1) == 1\n assert candidate(times = [[1, 2, 1], [1, 3, 2], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 9, 8], [9, 10, 9], [10, 1, 10]],n = 10,k = 10) == 45\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 9, 8], [9, 10, 9], [10, 1, 10]],n = 10,k = 1) == 45\n assert candidate(times = [[1, 2, 2], [1, 3, 4], [1, 4, 1], [2, 3, 1], [2, 4, 5], [3, 4, 2], [4, 5, 3], [5, 6, 2], [6, 7, 1], [7, 8, 1], [8, 9, 1], [9, 10, 1], [10, 11, 1], [11, 12, 1], [12, 1, 1], [1, 5, 2]],n = 12,k = 1) == 10\n assert candidate(times = [[1, 2, 100], [1, 3, 200], [2, 4, 50], [2, 5, 150], [3, 5, 100], [4, 6, 200], [5, 7, 250], [6, 8, 300], [7, 9, 350], [8, 10, 400]],n = 10,k = 1) == 1050\n assert candidate(times = [[1, 2, 10], [2, 1, 10], [1, 3, 20], [3, 1, 20], [2, 4, 30], [4, 2, 30], [3, 4, 40], [4, 3, 40], [1, 4, 60], [4, 1, 60]],n = 4,k = 1) == 40\n assert candidate(times = [[1, 2, 10], [1, 3, 3], [2, 3, 1], [2, 4, 5], [3, 4, 2], [3, 5, 8], [4, 5, 7], [5, 6, 1]],n = 6,k = 1) == 12\n assert candidate(times = [[1, 2, 1], [1, 3, 1], [2, 4, 1], [3, 4, 1], [4, 5, 1], [2, 5, 1], [3, 5, 1], [4, 1, 1], [5, 1, 1], [1, 4, 1]],n = 5,k = 2) == 3\n assert candidate(times = [[1, 2, 10], [2, 3, 10], [3, 4, 10], [4, 5, 10], [5, 6, 10], [6, 7, 10], [7, 8, 10], [8, 9, 10], [9, 10, 10], [10, 1, 10]],n = 10,k = 1) == 90\n assert candidate(times = [[1, 2, 1], [1, 3, 2], [1, 4, 3], [2, 3, 1], [2, 4, 2], [3, 4, 1], [4, 5, 1]],n = 5,k = 1) == 4\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 1, 2], [2, 4, 3], [4, 5, 4], [5, 2, 3]],n = 5,k = 1) == 8\n assert candidate(times = [[1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 1, 1], [1, 6, 1], [6, 7, 1], [7, 8, 1], [8, 9, 1], [9, 10, 1]],n = 10,k = 1) == 5\n assert candidate(times = [[1, 2, 10], [1, 3, 10], [2, 4, 10], [2, 5, 10], [3, 6, 10], [3, 7, 10], [4, 8, 10], [4, 9, 10], [5, 10, 10], [5, 11, 10], [6, 12, 10], [6, 13, 10]],n = 13,k = 1) == 30\n assert candidate(times = [[1, 2, 1], [1, 3, 1], [2, 4, 1], [2, 5, 1], [3, 4, 1], [3, 5, 1], [4, 6, 1], [4, 7, 1], [5, 6, 1], [5, 7, 1], [6, 8, 1], [6, 9, 1], [7, 8, 1], [7, 9, 1], [8, 10, 1], [9, 10, 1]],n = 10,k = 1) == 5\n assert candidate(times = [[1, 2, 1], [1, 3, 4], [2, 3, 2], [3, 4, 1], [4, 5, 2], [2, 4, 3], [5, 4, 5], [4, 2, 2]],n = 5,k = 1) == 6\n assert candidate(times = [[1, 2, 1], [1, 3, 1], [1, 4, 1], [1, 5, 1], [2, 3, 2], [2, 4, 2], [2, 5, 2], [3, 4, 3], [3, 5, 3], [4, 5, 4]],n = 5,k = 1) == 1\n assert candidate(times = [[1, 2, 10], [2, 3, 10], [3, 4, 10], [4, 5, 10], [5, 6, 10], [6, 7, 10], [7, 8, 10], [8, 9, 10], [9, 10, 10]],n = 10,k = 1) == 90\n assert candidate(times = [[1, 2, 5], [1, 4, 10], [2, 3, 10], [2, 4, 30], [3, 4, 5], [3, 5, 15], [4, 5, 10], [5, 6, 5], [6, 7, 10], [7, 8, 15], [8, 9, 20], [9, 10, 25]],n = 10,k = 3) == -1\n assert candidate(times = [[1, 2, 3], [1, 3, 5], [2, 3, 1], [2, 4, 4], [3, 4, 2], [4, 5, 3], [5, 6, 2], [6, 7, 1], [7, 8, 1], [8, 9, 1], [9, 10, 1], [10, 11, 1], [11, 12, 1], [12, 1, 1]],n = 12,k = 1) == 17\n assert candidate(times = [[1, 2, 4], [2, 3, 3], [3, 4, 2], [4, 5, 1], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 1, 8]],n = 8,k = 1) == 28\n assert candidate(times = [[1, 4, 2], [1, 2, 4], [2, 3, 3], [3, 4, 1], [4, 5, 2], [5, 6, 1], [6, 7, 5], [7, 8, 3], [8, 9, 2], [9, 10, 1]],n = 10,k = 1) == 16\n assert candidate(times = [[1, 2, 1], [1, 3, 2], [1, 4, 3], [2, 3, 4], [2, 4, 5], [3, 4, 6], [4, 5, 7], [5, 6, 8], [6, 7, 9], [7, 8, 10]],n = 8,k = 1) == 37\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 9, 8], [9, 10, 9], [10, 1, 10]],n = 10,k = 5) == 51\n assert candidate(times = [[1, 2, 10], [2, 3, 9], [3, 4, 8], [4, 5, 7], [5, 6, 6], [6, 7, 5], [7, 8, 4], [8, 9, 3], [9, 10, 2], [10, 1, 1]],n = 10,k = 1) == 54\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 9, 8], [9, 10, 9], [10, 1, 10], [1, 3, 15], [3, 5, 20], [5, 7, 25], [7, 9, 30], [9, 11, 35]],n = 11,k = 1) == 71\n assert candidate(times = [[1, 2, 3], [1, 3, 2], [2, 3, 4], [2, 4, 5], [3, 4, 2], [3, 5, 3], [4, 5, 1], [5, 1, 1]],n = 5,k = 1) == 5\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 1, 5], [1, 3, 3], [3, 5, 1]],n = 5,k = 1) == 6\n assert candidate(times = [[1, 2, 5], [2, 3, 3], [3, 4, 1], [4, 5, 2], [5, 6, 4], [6, 7, 3], [7, 8, 2], [8, 9, 1], [9, 10, 5]],n = 10,k = 1) == 26\n assert candidate(times = [[1, 2, 1], [1, 3, 2], [2, 4, 3], [2, 5, 4], [3, 4, 5], [3, 5, 6], [4, 5, 7], [5, 6, 8], [5, 7, 9], [6, 7, 10]],n = 7,k = 1) == 14\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 9, 8], [9, 10, 9], [10, 11, 10], [11, 12, 11], [12, 13, 12], [13, 14, 13], [14, 15, 14], [15, 1, 15]],n = 15,k = 1) == 105\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 9, 8], [9, 10, 9], [10, 11, 10], [11, 12, 11], [12, 13, 12], [13, 14, 13], [14, 15, 14], [15, 16, 15], [16, 17, 16], [17, 18, 17], [18, 19, 18], [19, 20, 19]],n = 20,k = 1) == 190\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 9, 8], [9, 10, 9]],n = 10,k = 1) == 45\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 9, 8], [9, 10, 9], [10, 11, 10], [11, 12, 11], [12, 13, 12], [13, 14, 13]],n = 14,k = 1) == 91\n assert candidate(times = [[1, 2, 3], [1, 3, 2], [1, 4, 5], [2, 3, 1], [2, 5, 4], [3, 4, 6], [3, 5, 2], [4, 5, 3], [5, 6, 1]],n = 6,k = 1) == 5\n assert candidate(times = [[1, 2, 1], [1, 3, 4], [2, 3, 2], [3, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [7, 8, 1], [8, 9, 1], [9, 10, 1], [10, 1, 1]],n = 10,k = 1) == 10\n assert candidate(times = [[1, 4, 2], [1, 5, 4], [2, 1, 4], [2, 4, 1], [3, 1, 3], [3, 2, 2], [4, 3, 3], [4, 5, 1], [5, 1, 1], [5, 2, 5]],n = 5,k = 4) == 5\n assert candidate(times = [[1, 2, 1], [1, 3, 2], [2, 4, 1], [3, 4, 1], [4, 5, 1], [2, 5, 2], [3, 5, 2], [4, 1, 2], [5, 1, 2], [1, 4, 2], [2, 3, 2]],n = 5,k = 1) == 3\n assert candidate(times = [[1, 2, 10], [1, 3, 3], [1, 4, 20], [2, 5, 15], [3, 2, 20], [3, 4, 5], [4, 3, 5], [4, 5, 7], [5, 6, 20], [6, 7, 15], [7, 8, 10], [8, 9, 15], [9, 10, 20]],n = 10,k = 1) == 95\n assert candidate(times = [[1, 2, 1], [1, 3, 1], [2, 4, 2], [2, 5, 2], [3, 4, 3], [3, 5, 3], [4, 6, 4], [4, 7, 4], [5, 6, 5], [5, 7, 5], [6, 8, 6], [6, 9, 6], [7, 8, 7], [7, 9, 7], [8, 10, 8], [9, 10, 8]],n = 10,k = 1) == 21\n assert candidate(times = [[1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [5, 6, 50], [6, 7, 60], [7, 8, 70], [8, 9, 80], [9, 10, 90], [10, 1, 100]],n = 10,k = 1) == 450\n assert candidate(times = [[1, 2, 1], [1, 3, 4], [2, 3, 2], [2, 4, 5], [3, 4, 1], [4, 5, 3], [5, 6, 2], [6, 7, 4], [7, 8, 3], [8, 9, 1], [9, 10, 5]],n = 10,k = 1) == 22\n assert candidate(times = [[1, 2, 1], [1, 3, 2], [2, 4, 3], [2, 5, 4], [3, 4, 2], [3, 5, 3], [4, 6, 5], [4, 7, 6], [5, 6, 4], [5, 7, 5], [6, 8, 7], [7, 8, 8]],n = 8,k = 1) == 16\n assert candidate(times = [[1, 2, 1], [1, 3, 1], [2, 4, 1], [3, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [7, 8, 1], [8, 9, 1], [9, 10, 1], [10, 11, 1], [11, 12, 1], [12, 13, 1], [13, 14, 1], [14, 15, 1]],n = 15,k = 1) == 13\n assert candidate(times = [[1, 2, 100], [2, 3, 90], [3, 4, 80], [4, 5, 70], [5, 6, 60], [6, 7, 50], [7, 8, 40], [8, 9, 30], [9, 10, 20]],n = 10,k = 1) == 540\n assert candidate(times = [[1, 2, 10], [2, 3, 20], [1, 3, 40], [2, 4, 30], [3, 5, 50], [4, 6, 60], [5, 7, 70], [6, 8, 80], [7, 9, 90], [8, 10, 100]],n = 10,k = 1) == 280\n assert candidate(times = [[1, 2, 1], [1, 3, 2], [2, 4, 1], [3, 4, 2], [4, 5, 1], [2, 5, 2], [3, 5, 3], [5, 6, 1], [6, 7, 1], [7, 8, 1], [8, 9, 1]],n = 9,k = 1) == 7\n assert candidate(times = [[1, 2, 2], [1, 3, 4], [1, 4, 1], [2, 3, 1], [2, 4, 5], [3, 4, 2], [4, 5, 3], [5, 6, 2], [6, 7, 1], [7, 8, 1], [8, 9, 1], [9, 10, 1]],n = 10,k = 1) == 10\n assert candidate(times = [[1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [7, 8, 1], [8, 9, 1], [9, 10, 1], [10, 1, 1]],n = 10,k = 1) == 9\n assert candidate(times = [[1, 2, 1], [1, 3, 2], [2, 4, 3], [2, 5, 4], [3, 6, 5], [3, 7, 6], [4, 8, 7], [4, 9, 8], [5, 10, 9], [5, 11, 10]],n = 11,k = 1) == 15\n"}, "metadata": {"canonical_parameter_names": ["times", "n", "k"], "leetcode_dataset_entry_point": "Solution().networkDelayTime", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var networkDelayTime = function(times, n, k) {", "container": null, "callable": "networkDelayTime", "parameters": [{"name": "times", "type": "number[][]"}, {"name": "n", "type": "number"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 744, "task_id": "find-smallest-letter-greater-than-target", "difficulty": "Easy", "problem_description": "You are given an array of characters letters that is sorted in non-decreasing order, and a character target. There are at least two different characters in letters.\nReturn the smallest character in letters that is lexicographically greater than target. If such a character does not exist, return the first character in letters.\n \nExample 1:\n\nInput: letters = [\"c\",\"f\",\"j\"], target = \"a\"\nOutput: \"c\"\nExplanation: The smallest character that is lexicographically greater than 'a' in letters is 'c'.\n\nExample 2:\n\nInput: letters = [\"c\",\"f\",\"j\"], target = \"c\"\nOutput: \"f\"\nExplanation: The smallest character that is lexicographically greater than 'c' in letters is 'f'.\n\nExample 3:\n\nInput: letters = [\"x\",\"x\",\"y\",\"y\"], target = \"z\"\nOutput: \"x\"\nExplanation: There are no characters in letters that is lexicographically greater than 'z' so we return letters[0].\n\n \nConstraints:\n\n2 <= letters.length <= 104\nletters[i] is a lowercase English letter.\nletters is sorted in non-decreasing order.\nletters contains at least two different characters.\ntarget is a lowercase English letter.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'],target = \"d\") == \"e\"\n assert candidate(letters = ['c', 'f', 'j'],target = \"c\") == \"f\"\n assert candidate(letters = ['x', 'x', 'y', 'y'],target = \"z\") == \"x\"\n assert candidate(letters = ['a', 'b', 'c', 'd'],target = \"d\") == \"a\"\n assert candidate(letters = ['a', 'c', 'f', 'h'],target = \"g\") == \"h\"\n assert candidate(letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'],target = \"k\") == \"a\"\n assert candidate(letters = ['m', 'n', 'n', 'p', 'q'],target = \"l\") == \"m\"\n assert candidate(letters = ['s', 't', 'u', 'v'],target = \"r\") == \"s\"\n assert candidate(letters = ['a', 'c', 'f', 'h'],target = \"f\") == \"h\"\n assert candidate(letters = ['k', 'k', 'l', 'm', 'm'],target = \"m\") == \"k\"\n assert candidate(letters = ['b', 'b', 'c', 'd'],target = \"a\") == \"b\"\n assert candidate(letters = ['a', 'b', 'b', 'b'],target = \"b\") == \"a\"\n assert candidate(letters = ['a', 'b', 'c', 'd'],target = \"z\") == \"a\"\n assert candidate(letters = ['d', 'e', 'f', 'g'],target = \"z\") == \"d\"\n assert candidate(letters = ['c', 'f', 'j'],target = \"a\") == \"c\"\n assert candidate(letters = ['m', 'n', 'p', 'q'],target = \"o\") == \"p\"\n assert candidate(letters = ['a', 'a', 'a', 'b'],target = \"a\") == \"b\"\n assert candidate(letters = ['a', 'c', 'f', 'h'],target = \"b\") == \"c\"\n assert candidate(letters = ['c', 'g', 'k', 'o', 's', 'w'],target = \"o\") == \"s\"\n assert candidate(letters = ['m', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'],target = \"m\") == \"n\"\n assert candidate(letters = ['a', 'c', 'e', 'g', 'i', 'k', 'm', 'o', 'q', 's', 'u', 'w', 'y'],target = \"a\") == \"c\"\n assert candidate(letters = ['b', 'b', 'd', 'd', 'f', 'f', 'h', 'h', 'j', 'j', 'l', 'l', 'n', 'n'],target = \"f\") == \"h\"\n assert candidate(letters = ['l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'],target = \"l\") == \"m\"\n assert candidate(letters = ['b', 'b', 'c', 'c', 'd', 'd', 'e', 'e', 'f', 'f', 'g', 'g'],target = \"f\") == \"g\"\n assert candidate(letters = ['a', 'c', 'e', 'g', 'i', 'k', 'm', 'o', 'q', 's', 'u', 'w', 'y'],target = \"t\") == \"u\"\n assert candidate(letters = ['d', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],target = \"z\") == \"d\"\n assert candidate(letters = ['a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'],target = \"c\") == \"a\"\n assert candidate(letters = ['a', 'c', 'f', 'j', 'o', 't', 'z'],target = \"z\") == \"a\"\n assert candidate(letters = ['b', 'f', 'j', 'n', 'r', 'v', 'z'],target = \"a\") == \"b\"\n assert candidate(letters = ['z', 'z', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],target = \"w\") == \"x\"\n assert candidate(letters = ['a', 'c', 'f', 'i', 'l', 'o', 'r', 'u', 'x'],target = \"x\") == \"a\"\n assert candidate(letters = ['f', 'h', 'j', 'l', 'n', 'p', 'r', 't', 'v', 'x', 'z'],target = \"s\") == \"t\"\n assert candidate(letters = ['d', 'f', 'h', 'j', 'l', 'n', 'p', 'r', 't', 'v', 'x', 'z'],target = \"k\") == \"l\"\n assert candidate(letters = ['a', 'a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'],target = \"b\") == \"c\"\n assert candidate(letters = ['d', 'f', 'h', 'j', 'l', 'n', 'p', 'r', 't', 'v', 'x', 'z'],target = \"m\") == \"n\"\n assert candidate(letters = ['a', 'a', 'b', 'b', 'c', 'c', 'd', 'd', 'e', 'e', 'f', 'f', 'g', 'g', 'h', 'h', 'i', 'i', 'j', 'j'],target = \"j\") == \"a\"\n assert candidate(letters = ['a', 'c', 'e', 'g', 'i', 'k', 'm', 'o', 'q', 's', 'u', 'w', 'y'],target = \"x\") == \"y\"\n assert candidate(letters = ['a', 'c', 'e', 'g', 'i', 'k', 'm', 'o', 'q', 's', 'u', 'w', 'y'],target = \"l\") == \"m\"\n assert candidate(letters = ['a', 'a', 'b', 'b', 'c', 'c', 'd', 'd', 'e', 'e'],target = \"d\") == \"e\"\n assert candidate(letters = ['x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'],target = \"z\") == \"x\"\n assert candidate(letters = ['a', 'b', 'd', 'e', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'y', 'z'],target = \"w\") == \"y\"\n assert candidate(letters = ['b', 'b', 'b', 'c', 'c', 'd', 'd', 'e', 'e', 'f', 'f', 'g', 'g', 'h', 'h', 'i', 'i', 'j', 'j', 'k', 'k'],target = \"b\") == \"c\"\n assert candidate(letters = ['a', 'c', 'e', 'g', 'i', 'k', 'm', 'o', 'q', 's', 'u', 'w', 'y'],target = \"v\") == \"w\"\n assert candidate(letters = ['a', 'c', 'e', 'g', 'i', 'k', 'm', 'o', 'q', 's', 'u', 'w', 'y'],target = \"y\") == \"a\"\n assert candidate(letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],target = \"m\") == \"n\"\n assert candidate(letters = ['m', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],target = \"m\") == \"n\"\n assert candidate(letters = ['c', 'e', 'i', 'm', 'q', 'u', 'y'],target = \"u\") == \"y\"\n assert candidate(letters = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z'],target = \"u\") == \"v\"\n assert candidate(letters = ['d', 'd', 'd', 'e', 'e', 'f', 'g', 'h', 'i', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],target = \"d\") == \"e\"\n assert candidate(letters = ['m', 'm', 'm', 'm', 'n', 'n', 'n', 'n', 'p', 'p', 'p', 'p', 'q', 'q', 'q', 'q'],target = \"q\") == \"m\"\n assert candidate(letters = ['a', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'c', 'c', 'c', 'c'],target = \"a\") == \"b\"\n assert candidate(letters = ['a', 'c', 'e', 'g', 'i', 'k', 'm', 'o', 'q', 's', 'u', 'w', 'y'],target = \"w\") == \"y\"\n assert candidate(letters = ['d', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'e', 'e', 'e', 'f'],target = \"d\") == \"e\"\n assert candidate(letters = ['m', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'],target = \"l\") == \"m\"\n assert candidate(letters = ['l', 'm', 'n', 'n', 'n', 'o', 'p', 'q', 'q', 'r', 's'],target = \"p\") == \"q\"\n assert candidate(letters = ['x', 'y', 'z', 'a', 'b', 'c'],target = \"y\") == \"x\"\n assert candidate(letters = ['b', 'c', 'f', 'h', 'j', 'm', 'p', 'r', 'u', 'x', 'z'],target = \"g\") == \"h\"\n assert candidate(letters = ['b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],target = \"a\") == \"b\"\n assert candidate(letters = ['a', 'c', 'e', 'g', 'i', 'k', 'm', 'o', 'q', 's', 'u', 'w', 'y'],target = \"n\") == \"o\"\n assert candidate(letters = ['z', 'z', 'a', 'a', 'b', 'b', 'c'],target = \"y\") == \"z\"\n assert candidate(letters = ['l', 'l', 'm', 'm', 'n', 'n', 'o', 'o', 'p', 'p', 'q', 'q', 'r', 'r', 's', 's', 't', 't', 'u', 'u', 'v', 'v', 'w', 'w', 'x', 'x', 'y', 'y', 'z', 'z'],target = \"u\") == \"v\"\n assert candidate(letters = ['m', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c'],target = \"w\") == \"x\"\n assert candidate(letters = ['s', 's', 't', 't', 'u', 'u', 'v', 'v', 'w', 'w', 'x', 'x', 'y', 'y', 'z', 'z'],target = \"y\") == \"z\"\n assert candidate(letters = ['b', 'c', 'd', 'f', 'h', 'j', 'l', 'n', 'p', 'r', 't', 'v', 'x', 'z'],target = \"t\") == \"v\"\n assert candidate(letters = ['a', 'z'],target = \"m\") == \"z\"\n assert candidate(letters = ['p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],target = \"z\") == \"p\"\n assert candidate(letters = ['a', 'c', 'e', 'g', 'i', 'k', 'm', 'o', 'q', 's', 'u', 'w', 'y'],target = \"m\") == \"o\"\n assert candidate(letters = ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'],target = \"b\") == \"a\"\n assert candidate(letters = ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'],target = \"a\") == \"b\"\n assert candidate(letters = ['b', 'd', 'f', 'h', 'j', 'l', 'n', 'p', 'r', 't', 'v', 'x', 'z'],target = \"a\") == \"b\"\n assert candidate(letters = ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'],target = \"a\") == \"b\"\n assert candidate(letters = ['d', 'd', 'd', 'e', 'f', 'g', 'g', 'g', 'h'],target = \"g\") == \"h\"\n assert candidate(letters = ['a', 'b', 'd', 'e', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],target = \"f\") == \"g\"\n assert candidate(letters = ['a', 'e', 'i', 'm', 'q', 'u', 'y'],target = \"z\") == \"a\"\n assert candidate(letters = ['a', 'c', 'f', 'j', 'o', 'v', 'y'],target = \"z\") == \"a\"\n assert candidate(letters = ['b', 'd', 'f', 'h', 'j', 'l', 'n', 'p', 'r', 't', 'v', 'x', 'z'],target = \"z\") == \"b\"\n assert candidate(letters = ['x', 'x', 'x', 'x', 'y', 'y', 'y', 'y', 'z', 'z', 'z', 'z'],target = \"x\") == \"y\"\n assert candidate(letters = ['z', 'z', 'z', 'a', 'a', 'a', 'b', 'b', 'c', 'd'],target = \"z\") == \"z\"\n assert candidate(letters = ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'],target = \"a\") == \"b\"\n assert candidate(letters = ['f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],target = \"u\") == \"v\"\n assert candidate(letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],target = \"z\") == \"a\"\n assert candidate(letters = ['x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w'],target = \"w\") == \"x\"\n assert candidate(letters = ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'b'],target = \"a\") == \"b\"\n assert candidate(letters = ['m', 'o', 'q', 's', 'u', 'w', 'y'],target = \"a\") == \"m\"\n assert candidate(letters = ['b', 'b', 'b', 'c', 'c', 'c', 'd', 'd', 'd', 'e', 'e', 'e', 'f', 'f', 'f', 'g', 'g', 'g', 'h', 'h', 'h'],target = \"d\") == \"e\"\n assert candidate(letters = ['d', 'h', 'l', 'p', 't', 'x'],target = \"m\") == \"p\"\n assert candidate(letters = ['z', 'a', 'a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'],target = \"y\") == \"z\"\n assert candidate(letters = ['x', 'y', 'z', 'a', 'b', 'c', 'd'],target = \"z\") == \"x\"\n assert candidate(letters = ['h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g'],target = \"g\") == \"h\"\n assert candidate(letters = ['p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o'],target = \"n\") == \"o\"\n assert candidate(letters = ['x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w'],target = \"x\") == \"x\"\n assert candidate(letters = ['m', 'm', 'm', 'm', 'n', 'n', 'n', 'n', 'p', 'p', 'p', 'p', 'q', 'q', 'q', 'q'],target = \"m\") == \"n\"\n assert candidate(letters = ['z', 'a', 'b', 'c', 'd'],target = \"y\") == \"z\"\n"}, "metadata": {"canonical_parameter_names": ["letters", "target"], "leetcode_dataset_entry_point": "Solution().nextGreatestLetter", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var nextGreatestLetter = function(letters, target) {", "container": null, "callable": "nextGreatestLetter", "parameters": [{"name": "letters", "type": "character[]"}, {"name": "target", "type": "character"}], "return_type": "character", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 746, "task_id": "min-cost-climbing-stairs", "difficulty": "Easy", "problem_description": "You are given an integer array cost where cost[i] is the cost of ith step on a staircase. Once you pay the cost, you can either climb one or two steps.\nYou can either start from the step with index 0, or the step with index 1.\nReturn the minimum cost to reach the top of the floor.\n \nExample 1:\n\nInput: cost = [10,15,20]\nOutput: 15\nExplanation: You will start at index 1.\n- Pay 15 and climb two steps to reach the top.\nThe total cost is 15.\n\nExample 2:\n\nInput: cost = [1,100,1,1,1,100,1,1,100,1]\nOutput: 6\nExplanation: You will start at index 0.\n- Pay 1 and climb two steps to reach index 2.\n- Pay 1 and climb two steps to reach index 4.\n- Pay 1 and climb two steps to reach index 6.\n- Pay 1 and climb one step to reach index 7.\n- Pay 1 and climb two steps to reach index 9.\n- Pay 1 and climb one step to reach the top.\nThe total cost is 6.\n\n \nConstraints:\n\n2 <= cost.length <= 1000\n0 <= cost[i] <= 999\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(cost = [999, 999, 999, 999]) == 1998\n assert candidate(cost = [1, 2, 3, 4, 5]) == 6\n assert candidate(cost = [1, 100, 1, 1, 1, 100, 1, 1, 100, 1]) == 6\n assert candidate(cost = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 25\n assert candidate(cost = [0, 0, 0, 0]) == 0\n assert candidate(cost = [1, 2]) == 1\n assert candidate(cost = [999, 999, 999, 999, 999, 999]) == 2997\n assert candidate(cost = [1, 2, 3, 4, 5]) == 6\n assert candidate(cost = [10, 15, 20, 25, 30]) == 40\n assert candidate(cost = [10, 15]) == 10\n assert candidate(cost = [10, 20, 10, 5]) == 20\n assert candidate(cost = [10, 5, 20, 25, 30, 35, 40]) == 65\n assert candidate(cost = [10, 20, 15, 20, 30]) == 40\n assert candidate(cost = [10, 15]) == 10\n assert candidate(cost = [5, 8, 6, 3, 4, 2, 8, 5, 1]) == 18\n assert candidate(cost = [999, 999]) == 999\n assert candidate(cost = [10, 15, 20]) == 15\n assert candidate(cost = [10, 15, 20, 10, 15, 20]) == 40\n assert candidate(cost = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 5\n assert candidate(cost = [1, 100, 100, 1]) == 101\n assert candidate(cost = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81]) == 900\n assert candidate(cost = [10, 15, 20, 30, 40, 50, 60, 70, 80, 90]) == 210\n assert candidate(cost = [3, 5, 2, 1, 8, 9, 3, 5, 6, 2, 1, 4, 7, 3, 2, 8, 6, 4, 1, 7]) == 38\n assert candidate(cost = [50, 10, 20, 100, 30, 40, 10, 20, 30, 40]) == 100\n assert candidate(cost = [3, 2, 4, 3, 2, 5, 1, 2, 4, 3, 2, 5, 1, 2, 4]) == 17\n assert candidate(cost = [1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1]) == 13\n assert candidate(cost = [5, 8, 3, 12, 2, 7, 6, 10, 1, 4, 9, 11, 13, 14, 15]) == 46\n assert candidate(cost = [1, 100, 2, 100, 3, 100, 4, 100, 5, 100, 6, 100, 7, 100, 8]) == 36\n assert candidate(cost = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90]) == 450\n assert candidate(cost = [1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2]) == 13\n assert candidate(cost = [5, 8, 2, 3, 7, 1, 4, 6, 9, 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 92\n assert candidate(cost = [50, 10, 5, 100, 20, 15, 10, 5, 20, 10, 5, 100, 20, 15, 10, 5, 20, 10, 5, 100, 20, 15, 10, 5, 20]) == 150\n assert candidate(cost = [10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140]) == 495\n assert candidate(cost = [1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999]) == 8992\n assert candidate(cost = [3, 2, 10, 2, 3, 5, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]) == 52\n assert candidate(cost = [999, 0, 999, 0, 999, 0, 999, 0, 999, 0]) == 0\n assert candidate(cost = [999, 999, 1, 999, 999, 2, 999, 999, 3, 999]) == 3001\n assert candidate(cost = [999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999]) == 0\n assert candidate(cost = [100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1]) == 12\n assert candidate(cost = [5, 8, 10, 2, 9, 1, 3, 7, 4, 6, 11, 12]) == 29\n assert candidate(cost = [999, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0]) == 999\n assert candidate(cost = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == 475\n assert candidate(cost = [5, 8, 3, 7, 2, 8, 3, 7, 2, 8, 3, 7, 2, 8, 3, 7, 2]) == 25\n assert candidate(cost = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 156\n assert candidate(cost = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 125\n assert candidate(cost = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == 5600\n assert candidate(cost = [30, 5, 20, 10, 25, 15, 40, 35, 50, 45, 60, 55, 70, 65, 80, 75]) == 305\n assert candidate(cost = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 60\n assert candidate(cost = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 50\n assert candidate(cost = [1, 100, 100, 1, 100, 100, 1, 100, 100, 1]) == 302\n assert candidate(cost = [1, 100, 2, 99, 3, 98, 4, 97, 5, 96]) == 15\n assert candidate(cost = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80]) == 315\n assert candidate(cost = [5, 3, 8, 6, 7, 2, 4, 9, 1, 10]) == 16\n assert candidate(cost = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55]) == 150\n assert candidate(cost = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990]) == 4970\n assert candidate(cost = [999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999]) == 75924\n assert candidate(cost = [50, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 570\n assert candidate(cost = [5, 2, 7, 4, 9, 6, 11, 8, 13, 10, 15, 12, 17, 14, 19]) == 56\n assert candidate(cost = [999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0]) == 0\n assert candidate(cost = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 100\n assert candidate(cost = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980]) == 9890\n assert candidate(cost = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1, 2, 3, 4, 5]) == 2507\n assert candidate(cost = [999, 999, 0, 0, 999, 999, 0, 0, 999, 999, 0, 0]) == 2997\n assert candidate(cost = [100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(cost = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 56\n assert candidate(cost = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 560\n assert candidate(cost = [400, 5, 3, 10, 1, 1, 1, 1, 1, 1, 1, 1]) == 12\n assert candidate(cost = [20, 1, 3, 2, 4, 2, 5, 3, 6, 4, 7, 5, 8, 6, 9, 7, 10]) == 30\n assert candidate(cost = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == 2500\n assert candidate(cost = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1, 1, 1, 1, 1]) == 2503\n assert candidate(cost = [10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20, 10, 15, 20]) == 760\n assert candidate(cost = [999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0, 999, 0]) == 0\n assert candidate(cost = [20, 1, 5, 10, 1, 1, 5, 10, 1, 1, 5, 10, 1, 1, 5, 10, 1, 1, 5, 10]) == 30\n assert candidate(cost = [1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000]) == 5\n assert candidate(cost = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 100\n assert candidate(cost = [10, 15, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 36\n assert candidate(cost = [100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100]) == 7\n assert candidate(cost = [999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1]) == 10\n assert candidate(cost = [5, 8, 2, 3, 6, 1, 4, 7, 9, 10]) == 24\n assert candidate(cost = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 0\n assert candidate(cost = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 495\n assert candidate(cost = [999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999]) == 12\n assert candidate(cost = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 56\n assert candidate(cost = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 75\n assert candidate(cost = [2, 1, 4, 5, 6, 3, 2, 5, 4, 3, 1, 2, 4, 3, 2, 1, 4, 5, 6, 3, 2, 5, 4, 3, 1, 2, 4, 3, 2, 1, 4, 5, 6, 3, 2, 5, 4, 3, 1, 2, 4, 3, 2, 1, 4, 5, 6, 3, 2, 5, 4, 3, 1, 2, 4, 3, 2, 1, 4, 5, 6, 3, 2, 5, 4, 3, 1, 2, 4, 3, 2, 1, 4, 5, 6, 3, 2, 5, 4, 3, 1, 2, 4, 3, 2, 1, 4, 5, 6, 3, 2, 5, 4, 3, 1, 2, 4, 3, 2, 1, 4, 5, 6, 3, 2, 5, 4, 3, 1, 2, 4]) == 165\n assert candidate(cost = [10, 20, 30, 40, 50, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 65\n assert candidate(cost = [100, 150, 100, 150, 100, 150, 100, 150, 100, 150]) == 500\n assert candidate(cost = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 225\n assert candidate(cost = [3, 2, 1, 5, 4, 1, 3, 2, 1, 5, 4, 1, 3, 2, 1, 5, 4, 1]) == 23\n assert candidate(cost = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20]) == 50\n assert candidate(cost = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 156\n assert candidate(cost = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10]) == 130\n assert candidate(cost = [100, 200, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100]) == 106\n assert candidate(cost = [1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100]) == 14\n assert candidate(cost = [100, 50, 25, 12, 6, 3, 1, 0, 0, 1, 3, 6, 12, 25, 50, 100, 150, 200, 250, 300]) == 530\n assert candidate(cost = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(cost = [4, 2, 6, 7, 8, 1, 3, 5, 10, 2, 6, 7, 8, 1, 3, 5]) == 28\n assert candidate(cost = [1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999, 1, 999]) == 10\n assert candidate(cost = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040]) == 832039\n assert candidate(cost = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 2150\n assert candidate(cost = [999, 999, 999, 999, 999, 0, 0, 0, 0, 0]) == 1998\n assert candidate(cost = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n"}, "metadata": {"canonical_parameter_names": ["cost"], "leetcode_dataset_entry_point": "Solution().minCostClimbingStairs", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minCostClimbingStairs = function(cost) {", "container": null, "callable": "minCostClimbingStairs", "parameters": [{"name": "cost", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 747, "task_id": "largest-number-at-least-twice-of-others", "difficulty": "Easy", "problem_description": "You are given an integer array nums where the largest integer is unique.\nDetermine whether the largest element in the array is at least twice as much as every other number in the array. If it is, return the index of the largest element, or return -1 otherwise.\n \nExample 1:\n\nInput: nums = [3,6,1,0]\nOutput: 1\nExplanation: 6 is the largest integer.\nFor every other number in the array x, 6 is at least twice as big as x.\nThe index of value 6 is 1, so we return 1.\n\nExample 2:\n\nInput: nums = [1,2,3,4]\nOutput: -1\nExplanation: 4 is less than twice the value of 3, so we return -1.\n\n \nConstraints:\n\n2 <= nums.length <= 50\n0 <= nums[i] <= 100\nThe largest element in nums is unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 6]) == 3\n assert candidate(nums = [3, 6, 1, 0]) == 1\n assert candidate(nums = [7, 1, 3, 2]) == 0\n assert candidate(nums = [10, 1, 2, 3]) == 0\n assert candidate(nums = [100, 1, 2, 3]) == 0\n assert candidate(nums = [7, 1, 3, 5]) == -1\n assert candidate(nums = [1, 100, 2, 3]) == 1\n assert candidate(nums = [8, 8, 8, 8, 8, 16]) == 5\n assert candidate(nums = [5, 0, 3, 2]) == -1\n assert candidate(nums = [1, 2, 3, 4]) == -1\n assert candidate(nums = [5, 8, 3, 4]) == -1\n assert candidate(nums = [1, 1, 1, 7, 1, 1, 1]) == 3\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 7]) == 6\n assert candidate(nums = [5, 3, 1, 4]) == -1\n assert candidate(nums = [50, 25, 12, 6, 3, 1]) == 0\n assert candidate(nums = [1, 20, 3, 4]) == 1\n assert candidate(nums = [1, 1, 1, 100]) == 3\n assert candidate(nums = [10, 20]) == 1\n assert candidate(nums = [10, 5, 3, 1]) == 0\n assert candidate(nums = [1, 20, 3, 1]) == 1\n assert candidate(nums = [1, 0, 0, 0, 0]) == 0\n assert candidate(nums = [0, 0, 0, 1]) == 3\n assert candidate(nums = [8, 16, 32, 4]) == 2\n assert candidate(nums = [1, 2, 0, 4]) == 3\n assert candidate(nums = [2, 1, 3, 6]) == 3\n assert candidate(nums = [10, 5, 2]) == 0\n assert candidate(nums = [7, 0, 3, 10]) == -1\n assert candidate(nums = [7, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [1, 10, 2, 3]) == 1\n assert candidate(nums = [8, 1, 3, 4]) == 0\n assert candidate(nums = [1, 2, 0]) == 1\n assert candidate(nums = [81, 27, 9, 3, 1]) == 0\n assert candidate(nums = [100, 25, 50, 75, 0, 100]) == -1\n assert candidate(nums = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576]) == 19\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70]) == -1\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]) == 79\n assert candidate(nums = [5, 50, 500, 5000, 50000]) == 4\n assert candidate(nums = [30, 15, 7, 4, 2]) == 0\n assert candidate(nums = [8, 4, 4, 2, 1]) == 0\n assert candidate(nums = [50, 25, 10, 5, 1]) == 0\n assert candidate(nums = [42, 21, 7, 3, 1]) == 0\n assert candidate(nums = [50, 25, 10, 5, 1, 0]) == 0\n assert candidate(nums = [10, 20, 30, 40, 50]) == -1\n assert candidate(nums = [60, 30, 10, 5, 2]) == 0\n assert candidate(nums = [30, 15, 9, 4, 2]) == 0\n assert candidate(nums = [36, 18, 9, 4, 2]) == 0\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 60]) == 10\n assert candidate(nums = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(nums = [42, 21, 10, 5, 2]) == 0\n assert candidate(nums = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60]) == -1\n assert candidate(nums = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64]) == 6\n assert candidate(nums = [100, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 0\n assert candidate(nums = [100, 50, 25, 12, 6, 3, 1]) == 0\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]) == -1\n assert candidate(nums = [100, 99, 98, 97, 96, 95]) == -1\n assert candidate(nums = [49, 24, 12, 6, 3, 1]) == 0\n assert candidate(nums = [85, 84, 83, 82, 81, 80]) == -1\n assert candidate(nums = [10, 10, 10, 10, 20]) == 4\n assert candidate(nums = [25, 24, 23, 22, 21]) == -1\n assert candidate(nums = [99, 49, 33, 24, 19, 16, 14, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 0\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30]) == -1\n assert candidate(nums = [20, 10, 5, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [30, 20, 10, 5, 2, 1]) == -1\n assert candidate(nums = [55, 27, 13, 6, 3]) == 0\n assert candidate(nums = [80, 40, 20, 10, 5]) == 0\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == -1\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]) == 44\n assert candidate(nums = [5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == -1\n assert candidate(nums = [99, 33, 22, 11, 6, 5, 4, 3, 2, 1]) == 0\n assert candidate(nums = [20, 10, 5, 1]) == 0\n assert candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(nums = [98, 49, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(nums = [48, 24, 12, 6, 3]) == 0\n assert candidate(nums = [2, 4, 8, 16, 32, 64, 128, 256]) == 7\n assert candidate(nums = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == -1\n assert candidate(nums = [100, 50, 25, 10, 5]) == 0\n assert candidate(nums = [50, 25, 12, 6, 3, 1]) == 0\n assert candidate(nums = [49, 24, 12, 6, 3, 1]) == 0\n assert candidate(nums = [100, 50, 25, 12, 6, 3, 1]) == 0\n assert candidate(nums = [9, 18, 3, 6, 12, 24, 48]) == 6\n assert candidate(nums = [100, 50, 25, 12, 6, 3, 1, 0]) == 0\n assert candidate(nums = [25, 15, 5, 30, 10]) == -1\n assert candidate(nums = [49, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48]) == -1\n assert candidate(nums = [50, 49, 25, 10]) == -1\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 40]) == 10\n assert candidate(nums = [100, 99, 98, 97, 96]) == -1\n assert candidate(nums = [90, 45, 30, 15, 7]) == 0\n assert candidate(nums = [100, 50, 25, 12, 6, 3, 1, 0]) == 0\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99]) == -1\n assert candidate(nums = [9, 7, 5, 3, 1]) == -1\n assert candidate(nums = [50, 49, 48, 47, 46]) == -1\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 78]) == 20\n assert candidate(nums = [3, 6, 9, 18, 36]) == 4\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 20]) == -1\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == -1\n assert candidate(nums = [8, 80, 20, 40, 10]) == 1\n assert candidate(nums = [100, 99, 98, 97, 96]) == -1\n assert candidate(nums = [34, 17, 8, 4, 2, 1]) == 0\n assert candidate(nums = [42, 21, 10, 5, 3]) == 0\n assert candidate(nums = [60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50]) == -1\n assert candidate(nums = [77, 38, 19, 9, 4, 2, 1]) == 0\n assert candidate(nums = [70, 69, 35, 20, 10, 5, 1]) == -1\n assert candidate(nums = [10, 20, 30, 40, 50]) == -1\n assert candidate(nums = [98, 49, 24, 12, 6, 3, 1, 0]) == 0\n assert candidate(nums = [2, 4, 8, 16, 32, 64, 128]) == 6\n assert candidate(nums = [3, 3, 3, 3, 3, 6]) == 5\n assert candidate(nums = [150, 75, 37, 18, 9]) == 0\n assert candidate(nums = [8, 16, 32, 64, 128]) == 4\n assert candidate(nums = [90, 45, 30, 20, 10, 5, 1]) == 0\n assert candidate(nums = [42, 21, 10, 9, 8, 7, 6, 5]) == 0\n assert candidate(nums = [30, 15, 14, 13, 12, 11]) == 0\n assert candidate(nums = [99, 33, 11, 3, 1]) == 0\n assert candidate(nums = [20, 10, 5, 1, 0]) == 0\n assert candidate(nums = [100, 99, 98, 97, 96, 95]) == -1\n assert candidate(nums = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == -1\n assert candidate(nums = [64, 32, 16, 8, 4, 2, 1]) == 0\n assert candidate(nums = [9, 3, 1, 0, 0]) == 0\n assert candidate(nums = [18, 9, 4, 2, 1]) == 0\n assert candidate(nums = [20, 10, 5, 2, 1]) == 0\n assert candidate(nums = [9, 18, 27, 36, 45, 54, 63, 72, 81, 90]) == -1\n assert candidate(nums = [10, 9, 8, 7, 6]) == -1\n assert candidate(nums = [100, 50, 25, 12, 6]) == 0\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]) == 10\n assert candidate(nums = [1, 100, 2, 3, 4, 5, 6, 7, 8, 9]) == 1\n assert candidate(nums = [42, 21, 10, 5, 3, 1]) == 0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20]) == 19\n assert candidate(nums = [42, 21, 10, 5, 3, 2, 1]) == 0\n assert candidate(nums = [25, 10, 5, 3, 1]) == 0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == -1\n assert candidate(nums = [100, 49, 48, 47, 46, 45]) == 0\n assert candidate(nums = [5, 50, 25, 100, 75]) == -1\n assert candidate(nums = [8, 16, 32, 64, 128]) == 4\n assert candidate(nums = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21]) == -1\n assert candidate(nums = [100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 50]) == -1\n assert candidate(nums = [1, 10, 100, 1000, 10000]) == 4\n assert candidate(nums = [4, 4, 4, 4, 8]) == 4\n assert candidate(nums = [120, 60, 30, 15, 7]) == 0\n assert candidate(nums = [8, 4, 2, 1, 1, 1, 1]) == 0\n assert candidate(nums = [8, 16, 2, 4, 6]) == 1\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().dominantIndex", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var dominantIndex = function(nums) {", "container": null, "callable": "dominantIndex", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 748, "task_id": "shortest-completing-word", "difficulty": "Easy", "problem_description": "Given a string licensePlate and an array of strings words, find the shortest completing word in words.\nA completing word is a word that contains all the letters in licensePlate. Ignore numbers and spaces in licensePlate, and treat letters as case insensitive. If a letter appears more than once in licensePlate, then it must appear in the word the same number of times or more.\nFor example, if licensePlate = \"aBc 12c\", then it contains letters 'a', 'b' (ignoring case), and 'c' twice. Possible completing words are \"abccdef\", \"caaacab\", and \"cbca\".\nReturn the shortest completing word in words. It is guaranteed an answer exists. If there are multiple shortest completing words, return the first one that occurs in words.\n \nExample 1:\n\nInput: licensePlate = \"1s3 PSt\", words = [\"step\",\"steps\",\"stripe\",\"stepple\"]\nOutput: \"steps\"\nExplanation: licensePlate contains letters 's', 'p', 's' (ignoring case), and 't'.\n\"step\" contains 't' and 'p', but only contains 1 's'.\n\"steps\" contains 't', 'p', and both 's' characters.\n\"stripe\" is missing an 's'.\n\"stepple\" is missing an 's'.\nSince \"steps\" is the only word containing all the letters, that is the answer.\n\nExample 2:\n\nInput: licensePlate = \"1s3 456\", words = [\"looks\",\"pest\",\"stew\",\"show\"]\nOutput: \"pest\"\nExplanation: licensePlate only contains the letter 's'. All the words contain 's', but among these \"pest\", \"stew\", and \"show\" are shortest. The answer is \"pest\" because it is the word that appears earliest of the 3.\n\n \nConstraints:\n\n1 <= licensePlate.length <= 7\nlicensePlate contains digits, letters (uppercase or lowercase), or space ' '.\n1 <= words.length <= 1000\n1 <= words[i].length <= 15\nwords[i] consists of lower case English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(licensePlate = \"GrC8950\",words = ['grace', 'please']) == \"grace\"\n assert candidate(licensePlate = \"Ah71752\",words = ['enough', 'these', 'playground', 'point', 'president']) == None\n assert candidate(licensePlate = \"xyz\",words = ['xzy', 'zyx', 'yxz', 'zxy']) == \"xzy\"\n assert candidate(licensePlate = \"44472Ml\",words = ['call', 'tall', 'tell']) == None\n assert candidate(licensePlate = \"a 1 b 2 c 3\",words = ['abc', 'cab', 'bac', 'bca', 'acb', 'cba']) == \"abc\"\n assert candidate(licensePlate = \"1s3 456\",words = ['looks', 'pest', 'stew', 'show']) == \"pest\"\n assert candidate(licensePlate = \"1s3 PSt\",words = ['step', 'steps', 'stripe', 'stepple']) == \"steps\"\n assert candidate(licensePlate = \"aBc 12c\",words = ['abccdef', 'caaacab', 'cbca']) == \"cbca\"\n assert candidate(licensePlate = \"a1b2c3d4e5f6g7\",words = ['abcdefg', 'defghij', 'ghijklm', 'abcdefghijk', 'abcdeghijk', 'abcdefg', 'abcdefg']) == \"abcdefg\"\n assert candidate(licensePlate = \"g7h6i5j4k3l2m1n0\",words = ['highlight', 'jimmy', 'mink', 'gnimmik', 'kliming', 'jimmyhighlight']) == None\n assert candidate(licensePlate = \"zZyYxX\",words = ['zyx', 'yxz', 'xyzzyx', 'zyxzyx', 'zzzyyx', 'zyzyzy', 'xyzzyxzyx']) == \"xyzzyx\"\n assert candidate(licensePlate = \"hello world!\",words = ['heloworld', 'worldhello', 'helloworld', 'oworlhell', 'rldhellow']) == \"worldhello\"\n assert candidate(licensePlate = \"q9w8e7r6t5y4u3i2o1p0\",words = ['quickbrownfox', 'quizzify', 'piano', 'typewriter', 'pizzafactory', 'qwertyuiop']) == \"qwertyuiop\"\n assert candidate(licensePlate = \"XYZ 789\",words = ['xylophone', 'xyzzy', 'zyxwvutsrqponmlkjihgfedcba', 'zyxzyxzyx']) == \"xyzzy\"\n assert candidate(licensePlate = \"M1n2o3r4s5\",words = ['modern', 'store', 'monarchs', 'morse', 'minors', 'modes', 'monsters']) == \"minors\"\n assert candidate(licensePlate = \"A1b2C3d4\",words = ['completeword', 'complete', 'abcd', 'bacdc', 'badac']) == \"abcd\"\n assert candidate(licensePlate = \"q1w2e3r4t5y6\",words = ['qwerty', 'typerq', 'rqwety', 'wertyq', 'eqwrt', 'rqwet', 'qwetrt', 'qwrtqe', 'qwertyu']) == \"qwerty\"\n assert candidate(licensePlate = \"A1B2C3D4E5F6\",words = ['abcdef', 'defabc', 'fedcba', 'abcdfe', 'abcdefg', 'abcdefh', 'abcdefij']) == \"abcdef\"\n assert candidate(licensePlate = \"z9 x8 v7\",words = ['zebra', 'vex', 'vez', 'vexing', 'exhibition']) == None\n assert candidate(licensePlate = \"zzz\",words = ['zzzzzz', 'zzzz', 'zzz', 'zzzzz', 'zzzzzzz']) == \"zzz\"\n assert candidate(licensePlate = \"9A8B7C6D5E4F3G2H1I0J\",words = ['abcdefghij', 'jihgfedcba', 'abcdefghijk', 'abcdefghi', 'abcdefghijl']) == \"abcdefghij\"\n assert candidate(licensePlate = \"z9y8x7w6v5u4t3s2r1q0\",words = ['qrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'reverse', 'alphabet', 'zebra', 'quran']) == \"qrstuvwxyz\"\n assert candidate(licensePlate = \"qqq rrr sss\",words = ['qqrrrss', 'rrssqqq', 'ssqqqrrr', 'qqqrrrsss', 'ssqqqqrrr']) == \"qqqrrrsss\"\n assert candidate(licensePlate = \"G7H2K3L4\",words = ['ghkl', 'hklg', 'klhg', 'klgh', 'gkhll', 'hgkl']) == \"ghkl\"\n assert candidate(licensePlate = \"9gI2d4e5\",words = ['guide', 'gifted', 'digging', 'gigged', 'gadget', 'gigged', 'gagged', 'gagged', 'gagged']) == \"guide\"\n assert candidate(licensePlate = \"l3i2k4e5\",words = ['like', 'liker', 'likely', 'likeable', 'likeless']) == \"like\"\n assert candidate(licensePlate = \"m1n2o3r4\",words = ['immortal', 'monarch', 'romantic', 'moronic', 'motorcar']) == \"monarch\"\n assert candidate(licensePlate = \"f9g8h7j6k5\",words = ['fjkg', 'ghfk', 'jkhg', 'kjgf', 'hjgk']) == None\n assert candidate(licensePlate = \"4b 5c2 D\",words = ['bcd', 'bcdcd', 'bcdc', 'bbcd', 'bcdb']) == \"bcd\"\n assert candidate(licensePlate = \"3Rd sTreet\",words = ['street', 'retreat', 'store', 'restrain', 'sterret', 'druster']) == None\n assert candidate(licensePlate = \"aA1bB2cC\",words = ['abc', 'aabbcc', 'abbc', 'aabbc', 'aabbbc', 'aabbbcc', 'aabbbccc']) == \"aabbcc\"\n assert candidate(licensePlate = \"mN2mN3\",words = ['mnm', 'nmn', 'mmn', 'mnn', 'nmm', 'nmmm', 'nmmn']) == \"nmmn\"\n assert candidate(licensePlate = \"q2w3e4r5t6y7u8i9o0p\",words = ['typewriter', 'opposite', 'ipyroteur', 'preoptuitry', 'pyroteurizing']) == None\n assert candidate(licensePlate = \"1234567\",words = ['abcdefg', 'bcadefg', 'cbadefg', 'bcaefdg', 'bcaefdgh']) == \"abcdefg\"\n assert candidate(licensePlate = \"x9Y8Z7\",words = ['xyz', 'xyzz', 'yxz', 'zyx', 'zxzyx', 'zyzzzyx']) == \"xyz\"\n assert candidate(licensePlate = \"mMnN oO pP\",words = ['mnop', 'mnooop', 'mnoppp', 'mnopppp', 'mnoppppp']) == None\n assert candidate(licensePlate = \"aBc12d3E\",words = ['abcde', 'abced', 'abcdef', 'abcd', 'abcccde']) == \"abcde\"\n assert candidate(licensePlate = \"xyz XYZ\",words = ['xyzz', 'yzxx', 'zxzy', 'zyxzyx', 'zyxzyxz']) == \"zyxzyx\"\n assert candidate(licensePlate = \"aBc123cD\",words = ['abcd', 'abcc', 'accc', 'aabbccdd', 'abcde']) == \"aabbccdd\"\n assert candidate(licensePlate = \"z1y2x3w4\",words = ['xyzz', 'yzxz', 'zxzy', 'wxyz', 'zyxw']) == \"wxyz\"\n assert candidate(licensePlate = \"zzzzz\",words = ['zzzz', 'zzz', 'zzzzzz', 'zzzzz', 'zzzzzzz', 'zzzzzzzz']) == \"zzzzz\"\n assert candidate(licensePlate = \"aAaAa 123\",words = ['aaaaa', 'aaabc', 'aabbc', 'abcde', 'abbbb', 'abcdaa']) == \"aaaaa\"\n assert candidate(licensePlate = \"aAaAaA\",words = ['aaaaaa', 'aaaaaab', 'aaaaaabc', 'aaaaaabcd', 'aaaaaabcde']) == \"aaaaaa\"\n assert candidate(licensePlate = \"9A1B2C3D4E5F6G7H\",words = ['abcdefgh', 'bacdefgh', 'cabdefgh', 'abcdefghi', 'abcdefg']) == \"abcdefgh\"\n assert candidate(licensePlate = \"aA1Bb2Cc3\",words = ['aabbcc', 'bbaacc', 'ccaabb', 'aabbcccc', 'aaabbbcc', 'aabbcccd']) == \"aabbcc\"\n assert candidate(licensePlate = \"oNe TwO thReE\",words = ['onetwothree', 'twothreeone', 'onethreetwo', 'threetwoone', 'onetwoonetwo', 'twotoonetwo', 'threethreetwo']) == \"onetwothree\"\n assert candidate(licensePlate = \"aBcDeFgHiJ1234567890\",words = ['abcdefghij', 'bacdefghij', 'jihgfedcba', 'abcdefghijk', 'abcdefghijj']) == \"abcdefghij\"\n assert candidate(licensePlate = \"s9p8a7t6e5\",words = ['pastel', 'pasteler', 'paste', 'pastoral', 'past', 'pastor', 'pasta']) == \"paste\"\n assert candidate(licensePlate = \"XyZ 890\",words = ['xyz', 'xyzz', 'xzyz', 'zyxzy', 'zyzzx']) == \"xyz\"\n assert candidate(licensePlate = \"XYZ\",words = ['xylophone', 'xylem', 'yxz', 'zyx', 'zyxwvut']) == \"yxz\"\n assert candidate(licensePlate = \"Z9y2z\",words = ['buzzards', 'zyzzyva', 'yz', 'zyzzy', 'zzyzzy']) == \"zyzzy\"\n assert candidate(licensePlate = \"XyZ9\",words = ['zyx', 'xyzzy', 'yzzx', 'xyzz', 'zyzzxy']) == \"zyx\"\n assert candidate(licensePlate = \"f9o8x7\",words = ['fox', 'foxy', 'foxtrot', 'fix', 'fixes', 'foxtrotted', 'foxtrotter']) == \"fox\"\n assert candidate(licensePlate = \"XYZ 123\",words = ['exactly', 'xyzzyx', 'zyxzyx', 'zyzyzx', 'zyzyxzyx']) == \"xyzzyx\"\n assert candidate(licensePlate = \"1 2 3 a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3\",words = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz']) == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(licensePlate = \"b1r2e3\",words = ['berber', 'bereber', 'beriberi', 'reberber', 'beerbar']) == \"berber\"\n assert candidate(licensePlate = \"a1B2c3D4\",words = ['abcd', 'abdc', 'abcde', 'bacd', 'adcb']) == \"abcd\"\n assert candidate(licensePlate = \"123aaBBB456\",words = ['aabbb', 'abbbb', 'baaabbb', 'bbbaaab', 'bbbaaabbb']) == \"aabbb\"\n assert candidate(licensePlate = \"!!!abc###\",words = ['abc', 'cab', 'bac', 'bca', 'acb', 'cba']) == \"abc\"\n assert candidate(licensePlate = \"aA1bB2cC3\",words = ['abc', 'aabbcc', 'aaabbbccc', 'abbc', 'abbbcc']) == \"aabbcc\"\n assert candidate(licensePlate = \"p1QR2\",words = ['prq', 'pqr', 'pqrr', 'prqq', 'pqrrr', 'pqqrr']) == \"prq\"\n assert candidate(licensePlate = \"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",words = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcbaabcdefghijklmnopqrstuvwxyz']) == \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\"\n assert candidate(licensePlate = \"f!@#o1b2a3r4\",words = ['barfoot', 'aborfra', 'barform', 'barrofa', 'aborfar', 'barrage', 'baraffe', 'barfree']) == \"barfoot\"\n assert candidate(licensePlate = \"bLUE cAR 2022\",words = ['blueberry', 'blueprint', 'carbon', 'barcelona', 'bark']) == None\n assert candidate(licensePlate = \"mN9mN\",words = ['minnesota', 'miamin', 'manana', 'mimic', 'mimicry', 'mining', 'minimum']) == None\n assert candidate(licensePlate = \"xyZ123 456\",words = ['xyzxyz', 'zyxzyx', 'xyzzx', 'yxzxz', 'zxyzyx']) == \"xyzzx\"\n assert candidate(licensePlate = \"!@#$%^&*()_+aBc123\",words = ['abc', 'cba', 'bac', 'bca', 'cab', 'acb', 'aab', 'abb', 'bba', 'bbc', 'bcb', 'bacb', 'bcab', 'bacab', 'bacabc', 'bacabcd', 'bacabcde', 'bacabcdef', 'bacabcdefg']) == \"abc\"\n assert candidate(licensePlate = \"abc def ghi\",words = ['abcdefghi', 'defghibac', 'ghidefab', 'bacdefghi', 'abcdefghij']) == \"abcdefghi\"\n assert candidate(licensePlate = \"a1b2c3d4e5\",words = ['abcde', 'bcdea', 'cabde', 'decab', 'edcba', 'abcdde', 'abcdee', 'abcdeee', 'abcdeeee']) == \"abcde\"\n assert candidate(licensePlate = \"Gh00t2!@#\",words = ['ghostly', 'gnostic', 'ghost', 'tongue', 'tooth']) == \"ghost\"\n assert candidate(licensePlate = \"m2i5n4i3s5\",words = ['immisions', 'minimises', 'administs', 'ministers', 'misissues']) == \"immisions\"\n assert candidate(licensePlate = \"!@#$%^&*()\",words = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yzabcf']) == \"abcdef\"\n assert candidate(licensePlate = \"a2b3c4d5e6\",words = ['alphabet', 'bacded', 'abacax', 'decalbac', 'abacbac']) == \"bacded\"\n assert candidate(licensePlate = \"xyZ 123\",words = ['xyzzy', 'zyxwvutsrqponmlkjihgfedcba', 'zyxzyxzyx', 'xyzz', 'zyx', 'xyzx', 'xyzxy', 'xyzxyz', 'xyzxyzz', 'xyzxyzxy']) == \"zyx\"\n assert candidate(licensePlate = \"mno890\",words = ['mno', 'mon', 'nom', 'omn', 'nmo', 'omnmo', 'mnomo', 'omonomn']) == \"mno\"\n assert candidate(licensePlate = \"mno9PQR8\",words = ['mnopqr', 'nopqmr', 'pqmrno', 'mnopq', 'pqmnopr', 'mnopqrq']) == \"mnopqr\"\n assert candidate(licensePlate = \"1a2b3c4d5e\",words = ['abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij']) == \"abcde\"\n assert candidate(licensePlate = \"aA bB cC\",words = ['abc', 'abccba', 'cab', 'bcaac', 'acbac']) == \"abccba\"\n assert candidate(licensePlate = \"zzz\",words = ['zzzz', 'zzz', 'zzzzz', 'zzzzzz', 'zzzzzzz', 'zzzzzzzz', 'zzzzzzzzz', 'zzzzzzzzzz']) == \"zzz\"\n assert candidate(licensePlate = \"123abc ABC321\",words = ['cba', 'abc', 'bac', 'bca', 'cab', 'acb', 'aab', 'abb', 'bba', 'bbc', 'bcb', 'bacb', 'bcab', 'bacab', 'bacabc', 'bacabcd', 'bacabcde', 'bacabcdef', 'bacabcdefg']) == \"bacabc\"\n assert candidate(licensePlate = \"q9w8e7r6\",words = ['qwerty', 'qwertas', 'qwertyui', 'qwertyuio', 'qwertyuiop']) == \"qwerty\"\n assert candidate(licensePlate = \"qQwWeEr RtTyYuUiIoOpP\",words = ['qwertyuiop', 'qwertyuio', 'qwertyuiopp', 'qwertyuioppq', 'qwertyuiopqq']) == None\n assert candidate(licensePlate = \"xYz987\",words = ['xyz', 'yzx', 'zxy', 'xzy', 'yxz', 'zyx', 'xxxyyzzz']) == \"xyz\"\n assert candidate(licensePlate = \"XYZ 987\",words = ['xyzz', 'zyxw', 'zyxv', 'zyxuv', 'zyxwvut']) == \"xyzz\"\n assert candidate(licensePlate = \"P2l3l4o5\",words = ['poll', 'pillar', 'pollock', 'polyope', 'plaster', 'polyope']) == \"poll\"\n"}, "metadata": {"canonical_parameter_names": ["licensePlate", "words"], "leetcode_dataset_entry_point": "Solution().shortestCompletingWord", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shortestCompletingWord = function(licensePlate, words) {", "container": null, "callable": "shortestCompletingWord", "parameters": [{"name": "licensePlate", "type": "string"}, {"name": "words", "type": "string[]"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 749, "task_id": "contain-virus", "difficulty": "Hard", "problem_description": "A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls.\nThe world is modeled as an m x n binary grid isInfected, where isInfected[i][j] == 0 represents uninfected cells, and isInfected[i][j] == 1 represents cells contaminated with the virus. A wall (and only one wall) can be installed between any two 4-directionally adjacent cells, on the shared boundary.\nEvery night, the virus spreads to all neighboring cells in all four directions unless blocked by a wall. Resources are limited. Each day, you can install walls around only one region (i.e., the affected area (continuous block of infected cells) that threatens the most uninfected cells the following night). There will never be a tie.\nReturn the number of walls used to quarantine all the infected regions. If the world will become fully infected, return the number of walls used.\n \nExample 1:\n\n\nInput: isInfected = [[0,1,0,0,0,0,0,1],[0,1,0,0,0,0,0,1],[0,0,0,0,0,0,0,1],[0,0,0,0,0,0,0,0]]\nOutput: 10\nExplanation: There are 2 contaminated regions.\nOn the first day, add 5 walls to quarantine the viral region on the left. The board after the virus spreads is:\n\nOn the second day, add 5 walls to quarantine the viral region on the right. The virus is fully contained.\n\n\nExample 2:\n\n\nInput: isInfected = [[1,1,1],[1,0,1],[1,1,1]]\nOutput: 4\nExplanation: Even though there is only one cell saved, there are 4 walls built.\nNotice that walls are only built on the shared boundary of two different cells.\n\nExample 3:\n\nInput: isInfected = [[1,1,1,0,0,0,0,0,0],[1,0,1,0,1,1,1,1,1],[1,1,1,0,0,0,0,0,0]]\nOutput: 13\nExplanation: The region on the left only builds two new walls.\n\n \nConstraints:\n\nm == isInfected.length\nn == isInfected[i].length\n1 <= m, n <= 50\nisInfected[i][j] is either 0 or 1.\nThere is always a contiguous viral region throughout the described process that will infect strictly more uncontaminated squares in the next round.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(isInfected = [[0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0]]) == 10\n assert candidate(isInfected = [[1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(isInfected = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 16\n assert candidate(isInfected = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0]]) == 28\n assert candidate(isInfected = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 4\n assert candidate(isInfected = [[1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1]]) == 60\n assert candidate(isInfected = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 7\n assert candidate(isInfected = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 41\n assert candidate(isInfected = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 93\n assert candidate(isInfected = [[1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 17\n assert candidate(isInfected = [[1, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 1, 1, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 1, 0]]) == 28\n assert candidate(isInfected = [[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1]]) == 18\n assert candidate(isInfected = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 4\n assert candidate(isInfected = [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]]) == 50\n assert candidate(isInfected = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 0]]) == 28\n assert candidate(isInfected = [[1, 1, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 26\n assert candidate(isInfected = [[1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1]]) == 16\n assert candidate(isInfected = [[1, 1, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0, 0, 0, 1], [0, 0, 0, 1, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 1, 0, 0]]) == 30\n assert candidate(isInfected = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 66\n assert candidate(isInfected = [[1, 1, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 1, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 1, 1]]) == 29\n assert candidate(isInfected = [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0]]) == 32\n assert candidate(isInfected = [[1, 1, 0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 0, 1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1, 1, 0, 0]]) == 29\n assert candidate(isInfected = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 27\n assert candidate(isInfected = [[1, 1, 0, 0, 0, 1, 1, 0, 1, 1], [1, 0, 0, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0, 0, 0], [1, 0, 0, 1, 0, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0, 0, 0, 1, 0], [1, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0]]) == 30\n assert candidate(isInfected = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 4\n assert candidate(isInfected = [[1, 1, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 1, 0, 0]]) == 27\n assert candidate(isInfected = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 4\n assert candidate(isInfected = [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0]]) == 32\n assert candidate(isInfected = [[1, 1, 0, 0, 1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 1, 0, 1]]) == 25\n assert candidate(isInfected = [[0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 1, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0]]) == 34\n assert candidate(isInfected = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 4\n assert candidate(isInfected = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 69\n assert candidate(isInfected = [[1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0]]) == 36\n assert candidate(isInfected = [[1, 1, 0, 0, 1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0]]) == 33\n assert candidate(isInfected = [[1, 1, 0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 1, 1, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1, 1, 1, 0]]) == 30\n assert candidate(isInfected = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 4\n assert candidate(isInfected = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 4\n assert candidate(isInfected = [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 36\n assert candidate(isInfected = [[1, 1, 0, 0, 0, 1, 1], [1, 0, 0, 1, 0, 0, 1], [0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 1, 0, 0, 1], [0, 0, 1, 0, 1, 0, 0]]) == 6\n assert candidate(isInfected = [[1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 1]]) == 25\n assert candidate(isInfected = [[1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]]) == 45\n assert candidate(isInfected = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 40\n assert candidate(isInfected = [[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1]]) == 41\n assert candidate(isInfected = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(isInfected = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0]]) == 67\n assert candidate(isInfected = [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0]]) == 45\n assert candidate(isInfected = [[1, 1, 0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 1, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 44\n assert candidate(isInfected = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 34\n assert candidate(isInfected = [[1, 1, 0, 0, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1, 1]]) == 19\n assert candidate(isInfected = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 22\n assert candidate(isInfected = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 24\n assert candidate(isInfected = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0]]) == 29\n assert candidate(isInfected = [[1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0]]) == 28\n assert candidate(isInfected = [[1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0, 1, 1, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 1, 1, 0, 1, 1, 1], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 1]]) == 30\n assert candidate(isInfected = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 4\n assert candidate(isInfected = [[1, 1, 0, 0, 0, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 1, 0, 1, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 1], [0, 1, 1, 1, 0, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1, 1, 0, 0, 1]]) == 42\n assert candidate(isInfected = [[1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0]]) == 21\n assert candidate(isInfected = [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]]) == 47\n"}, "metadata": {"canonical_parameter_names": ["isInfected"], "leetcode_dataset_entry_point": "Solution().containVirus", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var containVirus = function(isInfected) {", "container": null, "callable": "containVirus", "parameters": [{"name": "isInfected", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 752, "task_id": "open-the-lock", "difficulty": "Medium", "problem_description": "You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rotate freely and wrap around: for example we can turn '9' to be '0', or '0' to be '9'. Each move consists of turning one wheel one slot.\nThe lock initially starts at '0000', a string representing the state of the 4 wheels.\nYou are given a list of deadends dead ends, meaning if the lock displays any of these codes, the wheels of the lock will stop turning and you will be unable to open it.\nGiven a target representing the value of the wheels that will unlock the lock, return the minimum total number of turns required to open the lock, or -1 if it is impossible.\n \nExample 1:\n\nInput: deadends = [\"0201\",\"0101\",\"0102\",\"1212\",\"2002\"], target = \"0202\"\nOutput: 6\nExplanation: \nA sequence of valid moves would be \"0000\" -> \"1000\" -> \"1100\" -> \"1200\" -> \"1201\" -> \"1202\" -> \"0202\".\nNote that a sequence like \"0000\" -> \"0001\" -> \"0002\" -> \"0102\" -> \"0202\" would be invalid,\nbecause the wheels of the lock become stuck after the display becomes the dead end \"0102\".\n\nExample 2:\n\nInput: deadends = [\"8888\"], target = \"0009\"\nOutput: 1\nExplanation: We can turn the last wheel in reverse to move from \"0000\" -> \"0009\".\n\nExample 3:\n\nInput: deadends = [\"8887\",\"8889\",\"8878\",\"8898\",\"8788\",\"8988\",\"7888\",\"9888\"], target = \"8888\"\nOutput: -1\nExplanation: We cannot reach the target without getting stuck.\n\n \nConstraints:\n\n1 <= deadends.length <= 500\ndeadends[i].length == 4\ntarget.length == 4\ntarget will not be in the list deadends.\ntarget and deadends[i] consist of digits only.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(deadends = [],target = \"1111\") == 4\n assert candidate(deadends = ['1111', '2222', '3333'],target = \"4444\") == 16\n assert candidate(deadends = ['0001', '0002', '0003', '0004'],target = \"0005\") == 5\n assert candidate(deadends = ['0001', '0011', '0101', '1001', '1101', '0111', '0110', '1010', '1110', '1100'],target = \"1111\") == 6\n assert candidate(deadends = ['1110', '1101', '1011', '0111'],target = \"1111\") == 6\n assert candidate(deadends = ['9998', '9997', '9996', '9995'],target = \"9999\") == 4\n assert candidate(deadends = ['0000'],target = \"1111\") == -1\n assert candidate(deadends = ['1111', '2222', '3333', '4444'],target = \"5555\") == 20\n assert candidate(deadends = ['1234'],target = \"0000\") == 0\n assert candidate(deadends = ['8888'],target = \"0009\") == 1\n assert candidate(deadends = ['0002', '0020', '0200', '2000'],target = \"0000\") == 0\n assert candidate(deadends = ['0001', '0010', '0100', '1000'],target = \"1111\") == 6\n assert candidate(deadends = ['0201', '0101', '0102', '1212', '2002'],target = \"0202\") == 6\n assert candidate(deadends = ['1110', '1101', '1011', '0111'],target = \"0000\") == 0\n assert candidate(deadends = ['1111'],target = \"0000\") == 0\n assert candidate(deadends = ['1111'],target = \"1112\") == 5\n assert candidate(deadends = ['0001', '0010', '0100', '1000'],target = \"0000\") == 0\n assert candidate(deadends = ['8887', '8889', '8878', '8898', '8788', '8988', '7888', '9888'],target = \"8888\") == -1\n assert candidate(deadends = [],target = \"0000\") == 0\n assert candidate(deadends = ['0000'],target = \"8888\") == -1\n assert candidate(deadends = ['9999'],target = \"0000\") == 0\n assert candidate(deadends = ['1234', '2345', '3456', '4567', '5678', '6789', '7890', '8901', '9012', '0123'],target = \"5555\") == 20\n assert candidate(deadends = ['1234', '4321', '2345', '5432', '3456', '6543', '4567', '7654', '5678'],target = \"8765\") == 14\n assert candidate(deadends = ['1234', '4321', '2143', '3412', '0987', '7890', '8709', '9087'],target = \"0000\") == 0\n assert candidate(deadends = ['1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888', '9999', '0000'],target = \"1234\") == -1\n assert candidate(deadends = ['0011', '0110', '1100', '1001', '1112', '1211', '2111'],target = \"2222\") == 8\n assert candidate(deadends = ['1000', '0100', '0010', '0001', '0011', '0110', '1010', '1100', '1110'],target = \"1111\") == 6\n assert candidate(deadends = ['0009', '0018', '0108', '0117', '0126', '0135', '0144', '0153', '0162', '0171'],target = \"0000\") == 0\n assert candidate(deadends = ['1234', '2345', '3456', '4567', '5678', '6789', '7890', '8901', '9012', '0123'],target = \"9999\") == 4\n assert candidate(deadends = ['1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888', '9999'],target = \"0000\") == 0\n assert candidate(deadends = ['0101', '1010', '1100', '1111'],target = \"0011\") == 2\n assert candidate(deadends = ['0000', '1111', '2222', '3333', '4444'],target = \"5555\") == -1\n assert candidate(deadends = ['0001', '0010', '1000', '0100', '0011', '1100', '0110', '1010'],target = \"1111\") == 6\n assert candidate(deadends = ['0001', '1112', '2223', '3334', '4445', '5556', '6667', '7778', '8889'],target = \"9999\") == 4\n assert candidate(deadends = ['0123', '9876', '5432', '1357', '2468', '0909', '1111', '2222', '3333'],target = \"4444\") == 16\n assert candidate(deadends = ['9998', '9989', '9899', '8999', '0000', '1111', '2222', '3333', '4444', '5555'],target = \"6789\") == -1\n assert candidate(deadends = ['0001', '0002', '0003', '0004', '0005', '0006', '0007', '0008', '0009'],target = \"1111\") == 4\n assert candidate(deadends = ['0123', '1234', '2345', '3456', '4567', '5678', '6789', '7890', '8901', '9012'],target = \"0123\") == 6\n assert candidate(deadends = ['0000', '1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888', '9999'],target = \"9999\") == -1\n assert candidate(deadends = ['0001', '0002', '0003', '0004', '0005', '0006', '0007', '0008', '0009', '0100'],target = \"0011\") == 2\n assert candidate(deadends = ['9999', '8888', '7777', '6666', '5555', '4444', '3333', '2222', '1111'],target = \"0000\") == 0\n assert candidate(deadends = ['1234', '2345', '3456', '4567', '5678', '6789', '7890', '8901', '9012', '0123'],target = \"1000\") == 1\n assert candidate(deadends = ['1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888', '9999', '1234', '4321', '2345', '5432', '3456', '6543', '4567', '7654', '5678', '8765', '6789', '9876', '7890', '0987', '8790', '9087', '0879'],target = \"0000\") == 0\n assert candidate(deadends = ['0000', '9999', '1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888'],target = \"1234\") == -1\n assert candidate(deadends = ['0011', '0101', '1001', '1100', '1110', '1101'],target = \"1111\") == 4\n assert candidate(deadends = ['0001', '0002', '0003', '0004', '0005', '0006', '0007', '0008', '0009', '0100'],target = \"9999\") == 4\n assert candidate(deadends = ['1000', '0100', '0010', '0001', '2000', '0200', '0020', '0002'],target = \"0000\") == 0\n assert candidate(deadends = ['0000', '0009', '0090', '0900', '9000', '1111', '2222', '3333', '4444'],target = \"5555\") == -1\n assert candidate(deadends = ['0010', '0100', '0001', '0110', '1001', '1100', '1111', '0000'],target = \"0101\") == -1\n assert candidate(deadends = ['0001', '0002', '0010', '0020', '0100', '0200', '1000', '2000', '0003', '0030', '0300', '3000'],target = \"0004\") == 6\n assert candidate(deadends = ['1234', '2345', '3456', '4567', '5678', '6789', '7890', '8901', '9012'],target = \"0123\") == 6\n assert candidate(deadends = ['0001', '0010', '0100', '1000', '0111', '1110', '1101', '1011', '2220', '2202', '2022', '0222'],target = \"0202\") == 6\n assert candidate(deadends = ['1234', '4321', '2143', '3412'],target = \"5678\") == 14\n assert candidate(deadends = ['1234', '2345', '3456', '4567', '5678', '6789', '7890', '8901', '9012', '0123', '0234', '1345', '2456', '3567', '4678', '5789', '6890', '7901', '8012', '9123'],target = \"4567\") == 16\n assert candidate(deadends = ['0001', '0010', '0100', '1000', '1234', '4321', '5678', '8765', '9999'],target = \"8888\") == 8\n assert candidate(deadends = ['0001', '0002', '0003', '0004', '0005', '0006', '0007', '0008', '0009'],target = \"9999\") == 4\n assert candidate(deadends = ['9999', '8888', '7777', '6666', '5555'],target = \"4444\") == 16\n assert candidate(deadends = ['0002', '0020', '0200', '2000', '0013', '0130', '1300', '3000', '0112', '1120', '1201', '2011', '1011', '0110', '0101', '1010', '0011'],target = \"1111\") == 4\n assert candidate(deadends = ['1111', '1110', '1101', '1011', '0111', '2222', '2221', '2212', '2122', '1222', '3333', '3332', '3323', '3233', '2333', '4444', '4443', '4434', '4344', '3444'],target = \"5555\") == 20\n assert candidate(deadends = ['9998', '9989', '9899', '8999', '0001', '0010', '0100', '1000'],target = \"9999\") == 4\n assert candidate(deadends = ['1110', '1101', '1011', '0111', '2220', '2202', '2022', '0222', '3330', '3303', '3033', '0333'],target = \"4444\") == 16\n assert candidate(deadends = ['0009', '0018', '0108', '0117', '0126', '0135', '0144', '0153', '0162', '0171', '0800', '0900', '1800', '1900', '2800', '2900', '3800', '3900', '4800', '4900', '5800', '5900', '6800', '6900', '7800', '7900', '8800', '8900', '9800', '9900'],target = \"0000\") == 0\n assert candidate(deadends = ['0001', '0010', '0100', '1000', '1110', '1101', '1011', '0111'],target = \"1111\") == 8\n assert candidate(deadends = ['0000', '1234', '5678', '9999'],target = \"4321\") == -1\n assert candidate(deadends = ['0010', '0020', '0030', '0040', '0050'],target = \"0060\") == 4\n assert candidate(deadends = ['1110', '1101', '1011', '0111', '0011', '0101', '0110'],target = \"1111\") == 6\n assert candidate(deadends = ['0001', '0010', '0100', '1000', '1110', '1101', '1011', '0111', '0002', '0020'],target = \"3333\") == 14\n assert candidate(deadends = ['0011', '1100', '2211', '3322', '4433', '5544', '6655', '7766', '8877'],target = \"9988\") == 6\n assert candidate(deadends = ['0000', '0010', '0100', '0110', '1000', '1010', '1100', '1110', '0001', '0011', '0101', '0111', '1001', '1011', '1101'],target = \"1111\") == -1\n assert candidate(deadends = ['0010', '0100', '0111', '1000', '1001', '1010', '1100', '1111', '0001', '0011', '0110', '1101', '0101', '1011'],target = \"0000\") == 0\n assert candidate(deadends = ['0001', '0011', '0111', '1111', '0002', '0020', '0200', '2000', '0003', '0030', '0300', '3000'],target = \"0101\") == 2\n assert candidate(deadends = ['1112', '1121', '1211', '2111', '2221', '2212', '2122', '1222'],target = \"2222\") == 10\n assert candidate(deadends = ['8888', '8887', '8878', '8788', '7888', '9999', '9998', '9989', '9899', '8999'],target = \"0000\") == 0\n assert candidate(deadends = ['1234', '2345', '3456', '4567', '5678', '6789', '7890', '8901', '9012'],target = \"0123\") == 6\n assert candidate(deadends = ['0010', '0100', '1000', '0001', '0002', '0020', '0200', '2000'],target = \"0003\") == 5\n assert candidate(deadends = ['0000', '0011', '0101', '0110', '1001', '1010', '1100', '1111', '2222'],target = \"3333\") == -1\n assert candidate(deadends = ['0001', '0009', '0010', '0090', '0100', '0900', '1000', '9000', '0002', '0020', '0200', '2000', '0008', '0080', '0800', '8000'],target = \"0000\") == 0\n assert candidate(deadends = ['0009', '0018', '0027', '0036', '0045', '0054', '0063', '0072', '0081'],target = \"0090\") == 1\n assert candidate(deadends = ['8888', '9999', '0000', '1111', '2222', '3333', '4444', '5555', '6666', '7777'],target = \"0001\") == -1\n assert candidate(deadends = ['0101', '1010', '1111', '0011', '1100', '1001', '0110', '0001', '0010', '0100'],target = \"9999\") == 4\n assert candidate(deadends = ['0000', '1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888', '9999'],target = \"1234\") == -1\n assert candidate(deadends = ['0000', '1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888'],target = \"9999\") == -1\n assert candidate(deadends = ['0001', '1112', '2223', '3334', '4445', '5556', '6667', '7778', '8889'],target = \"4321\") == 10\n assert candidate(deadends = ['0001', '0002', '0003', '0004', '0005', '0006', '0007', '0008', '0009'],target = \"1000\") == 1\n assert candidate(deadends = ['1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888'],target = \"0000\") == 0\n assert candidate(deadends = ['0000', '0010', '0020', '0030', '0040', '0050', '0060', '0070', '0080', '0090'],target = \"0009\") == -1\n assert candidate(deadends = ['0123', '4567', '8901', '2345', '6789', '0987', '5432', '1098', '3210'],target = \"1111\") == 4\n assert candidate(deadends = ['1110', '1101', '1011', '0111', '2222', '3333', '4444', '5555', '6666', '7777'],target = \"1234\") == 10\n assert candidate(deadends = ['0123', '1234', '2345', '3456', '4567', '5678', '6789', '7890'],target = \"9876\") == 10\n assert candidate(deadends = ['9998', '9989', '9899', '8999', '0000', '0001', '0010', '0100', '1000'],target = \"1111\") == -1\n assert candidate(deadends = ['9998', '9989', '9899', '8999', '0001', '0010', '0100', '1000'],target = \"0000\") == 0\n assert candidate(deadends = ['1234', '2345', '3456', '4567', '5678', '6789', '7890', '8901', '9012', '0123'],target = \"5678\") == 14\n assert candidate(deadends = ['1234', '4321', '2345', '5432', '3456', '6543', '4567', '7654', '5678', '8765'],target = \"9876\") == 10\n assert candidate(deadends = ['1234', '2345', '3456', '4567', '5678', '6789', '7890', '8901', '9012', '0123'],target = \"5432\") == 14\n assert candidate(deadends = ['0101', '1010', '1100', '1110', '1101', '0111', '1001', '0011'],target = \"1111\") == 6\n assert candidate(deadends = ['0123', '1230', '2301', '3012', '1023', '0231', '2310', '3102', '2013', '0132', '1320', '3201', '0213', '2130', '3021', '1203'],target = \"9999\") == 4\n assert candidate(deadends = ['1110', '1101', '1011', '0111', '1112', '1121', '1211', '2111', '1113', '1131', '1311', '3111'],target = \"1114\") == 7\n assert candidate(deadends = ['0123', '1234', '2345', '3456', '4567', '5678', '6789', '7890', '8901', '9012', '0013', '0103', '0130', '1030', '1300', '3000'],target = \"0000\") == 0\n assert candidate(deadends = ['0001', '0012', '0102', '0201', '0210', '1002', '1020', '1200', '2001', '2010', '2100'],target = \"2222\") == 8\n assert candidate(deadends = ['1000', '2000', '3000', '4000', '5000', '6000', '7000', '8000', '9000'],target = \"0000\") == 0\n assert candidate(deadends = ['1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888', '9999'],target = \"8888\") == 8\n assert candidate(deadends = ['0101', '1212', '2323', '3434', '4545', '5656', '6767', '7878', '8989', '9090'],target = \"9090\") == 2\n assert candidate(deadends = ['0000', '1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888', '9999'],target = \"0000\") == 0\n assert candidate(deadends = ['0009', '0090', '0900', '9000', '1111'],target = \"2222\") == 8\n assert candidate(deadends = ['0001', '0010', '0100', '1000', '0011', '0110', '1100', '1010', '0101', '1001', '0111', '1110', '1101', '1011', '1111'],target = \"0000\") == 0\n assert candidate(deadends = ['0001', '0011', '0111', '1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888', '9999'],target = \"0000\") == 0\n assert candidate(deadends = ['1110', '2220', '3330', '4440', '5550', '6660', '7770', '8880', '9990'],target = \"0001\") == 1\n assert candidate(deadends = ['1111', '2222', '3333', '4444', '5555'],target = \"6666\") == 16\n assert candidate(deadends = ['1001', '2002', '3003', '4004', '5005', '6006', '7007', '8008', '9009'],target = \"9999\") == 4\n assert candidate(deadends = ['1234', '2345', '3456', '4567', '5678', '6789', '7890', '8901', '9012'],target = \"0000\") == 0\n"}, "metadata": {"canonical_parameter_names": ["deadends", "target"], "leetcode_dataset_entry_point": "Solution().openLock", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var openLock = function(deadends, target) {", "container": null, "callable": "openLock", "parameters": [{"name": "deadends", "type": "string[]"}, {"name": "target", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 753, "task_id": "cracking-the-safe", "difficulty": "Hard", "problem_description": "There is a safe protected by a password. The password is a sequence of n digits where each digit can be in the range [0, k - 1].\nThe safe has a peculiar way of checking the password. When you enter in a sequence, it checks the most recent n digits that were entered each time you type a digit.\n\nFor example, the correct password is \"345\" and you enter in \"012345\":\n\n\t\nAfter typing 0, the most recent 3 digits is \"0\", which is incorrect.\nAfter typing 1, the most recent 3 digits is \"01\", which is incorrect.\nAfter typing 2, the most recent 3 digits is \"012\", which is incorrect.\nAfter typing 3, the most recent 3 digits is \"123\", which is incorrect.\nAfter typing 4, the most recent 3 digits is \"234\", which is incorrect.\nAfter typing 5, the most recent 3 digits is \"345\", which is correct and the safe unlocks.\n\n\n\nReturn any string of minimum length that will unlock the safe at some point of entering it.\n \nExample 1:\n\nInput: n = 1, k = 2\nOutput: \"10\"\nExplanation: The password is a single digit, so enter each digit. \"01\" would also unlock the safe.\n\nExample 2:\n\nInput: n = 2, k = 2\nOutput: \"01100\"\nExplanation: For each possible password:\n- \"00\" is typed in starting from the 4th digit.\n- \"01\" is typed in starting from the 1st digit.\n- \"10\" is typed in starting from the 3rd digit.\n- \"11\" is typed in starting from the 2nd digit.\nThus \"01100\" will unlock the safe. \"10011\", and \"11001\" would also unlock the safe.\n\n \nConstraints:\n\n1 <= n <= 4\n1 <= k <= 10\n1 <= kn <= 4096\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 1,k = 2) == \"10\"\n assert candidate(n = 1,k = 4) == \"3210\"\n assert candidate(n = 2,k = 4) == \"03322312113020100\"\n assert candidate(n = 2,k = 5) == \"04433423224131211403020100\"\n assert candidate(n = 3,k = 4) == \"003332322233123132122131121113302301303202201203102101103002001000\"\n assert candidate(n = 3,k = 3) == \"00222121112201202101102001000\"\n assert candidate(n = 2,k = 2) == \"01100\"\n assert candidate(n = 3,k = 2) == \"0011101000\"\n assert candidate(n = 2,k = 10) == \"09988978779686766958575655948474645449383736353433928272625242322918171615141312119080706050403020100\"\n assert candidate(n = 1,k = 3) == \"210\"\n assert candidate(n = 4,k = 2) == \"0001111010110010000\"\n assert candidate(n = 1,k = 10) == \"9876543210\"\n assert candidate(n = 2,k = 3) == \"0221120100\"\n assert candidate(n = 4,k = 3) == \"000222212122112111122201220212011202022101210211011102010102200120021001100200010000\"\n assert candidate(n = 1,k = 5) == \"43210\"\n assert candidate(n = 3,k = 5) == \"0044434333442342432332422322244134124143133123142132122141131121114403402401404303302301304203202201204103102101104003002001000\"\n assert candidate(n = 4,k = 4) == \"0003333232332232222333123313231223131332123213221222131212133112311321122113111211113330233013303230223012303130213011303033202320132032202220122031202120112030202033102310131032102210121031102110111030102010103300230013003200220012003100210011003000200010000\"\n assert candidate(n = 4,k = 5) == \"0004444343443343333444234424342334242443234324332333242323244223422432233224222322224441344124414341334123414241324122414144313431243143313331233142313231223141313144213421242143213321232142213221222141213121214411341124114311331123114211321122114111311121111444034402440144043403340234013404240324022401240414031402140114040443034302430143043303330233013304230323022301230413031302130113040303044203420242014204320332023201320422032202220122041203120212011204020302020441034102410141043103310231013104210321022101210411031102110111040103010201010440034002400140043003300230013004200320022001200410031002100110040003000200010000\"\n assert candidate(n = 3,k = 6) == \"00555454445534535434435334333552452352542442342532432332522422322255145135125154144134124153143133123152142132122151141131121115504503502501505404403402401405304303302301305204203202201205104103102101105004003002001000\"\n"}, "metadata": {"canonical_parameter_names": ["n", "k"], "leetcode_dataset_entry_point": "Solution().crackSafe", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var crackSafe = function(n, k) {", "container": null, "callable": "crackSafe", "parameters": [{"name": "n", "type": "number"}, {"name": "k", "type": "number"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 754, "task_id": "reach-a-number", "difficulty": "Medium", "problem_description": "You are standing at position 0 on an infinite number line. There is a destination at position target.\nYou can make some number of moves numMoves so that:\n\nOn each move, you can either go left or right.\nDuring the ith move (starting from i == 1 to i == numMoves), you take i steps in the chosen direction.\n\nGiven the integer target, return the minimum number of moves required (i.e., the minimum numMoves) to reach the destination.\n \nExample 1:\n\nInput: target = 2\nOutput: 3\nExplanation:\nOn the 1st move, we step from 0 to 1 (1 step).\nOn the 2nd move, we step from 1 to -1 (2 steps).\nOn the 3rd move, we step from -1 to 2 (3 steps).\n\nExample 2:\n\nInput: target = 3\nOutput: 2\nExplanation:\nOn the 1st move, we step from 0 to 1 (1 step).\nOn the 2nd move, we step from 1 to 3 (2 steps).\n\n \nConstraints:\n\n-109 <= target <= 109\ntarget != 0\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(target = 2) == 3\n assert candidate(target = -20) == 7\n assert candidate(target = 15) == 5\n assert candidate(target = 10) == 4\n assert candidate(target = -5) == 5\n assert candidate(target = 1) == 1\n assert candidate(target = -1) == 1\n assert candidate(target = 3) == 2\n assert candidate(target = 20) == 7\n assert candidate(target = -10) == 4\n assert candidate(target = 5000) == 100\n assert candidate(target = 8) == 4\n assert candidate(target = 123456789) == 15713\n assert candidate(target = -21) == 6\n assert candidate(target = -123456) == 499\n assert candidate(target = 25) == 9\n assert candidate(target = -987654) == 1407\n assert candidate(target = 65535) == 362\n assert candidate(target = -17) == 6\n assert candidate(target = 999999999) == 44721\n assert candidate(target = 60) == 11\n assert candidate(target = 45) == 9\n assert candidate(target = 500000001) == 31625\n assert candidate(target = 1000) == 47\n assert candidate(target = 987654321) == 44445\n assert candidate(target = 500000) == 1000\n assert candidate(target = -987654321) == 44445\n assert candidate(target = -101) == 14\n assert candidate(target = 5) == 5\n assert candidate(target = 55) == 10\n assert candidate(target = 12345) == 157\n assert candidate(target = 17) == 6\n assert candidate(target = -500000) == 1000\n assert candidate(target = 1000000) == 1415\n assert candidate(target = -501) == 33\n assert candidate(target = -2147483647) == 65537\n assert candidate(target = -15) == 5\n assert candidate(target = -100) == 15\n assert candidate(target = 13) == 5\n assert candidate(target = 81) == 13\n assert candidate(target = 500) == 32\n assert candidate(target = -5000) == 100\n assert candidate(target = -1024) == 47\n assert candidate(target = 101) == 14\n assert candidate(target = -75) == 13\n assert candidate(target = 7) == 5\n assert candidate(target = -123456789) == 15713\n assert candidate(target = 1023) == 45\n assert candidate(target = 100) == 15\n assert candidate(target = 2048) == 64\n assert candidate(target = 1024) == 47\n assert candidate(target = -25) == 9\n assert candidate(target = -1000000000) == 44723\n assert candidate(target = 1000000000) == 44723\n assert candidate(target = 50) == 11\n assert candidate(target = 499999999) == 31625\n assert candidate(target = -500) == 32\n assert candidate(target = -1023) == 45\n assert candidate(target = -999999999) == 44721\n assert candidate(target = 14) == 7\n assert candidate(target = 4096) == 91\n assert candidate(target = 501) == 33\n assert candidate(target = -1000) == 47\n assert candidate(target = 123456) == 499\n assert candidate(target = 100000000) == 14143\n assert candidate(target = -100000000) == 14143\n assert candidate(target = -65535) == 362\n assert candidate(target = -12) == 7\n assert candidate(target = -999999) == 1414\n assert candidate(target = 200) == 20\n"}, "metadata": {"canonical_parameter_names": ["target"], "leetcode_dataset_entry_point": "Solution().reachNumber", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var reachNumber = function(target) {", "container": null, "callable": "reachNumber", "parameters": [{"name": "target", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 756, "task_id": "pyramid-transition-matrix", "difficulty": "Medium", "problem_description": "You are stacking blocks to form a pyramid. Each block has a color, which is represented by a single letter. Each row of blocks contains one less block than the row beneath it and is centered on top.\nTo make the pyramid aesthetically pleasing, there are only specific triangular patterns that are allowed. A triangular pattern consists of a single block stacked on top of two blocks. The patterns are given as a list of three-letter strings allowed, where the first two characters of a pattern represent the left and right bottom blocks respectively, and the third character is the top block.\n\nFor example, \"ABC\" represents a triangular pattern with a 'C' block stacked on top of an 'A' (left) and 'B' (right) block. Note that this is different from \"BAC\" where 'B' is on the left bottom and 'A' is on the right bottom.\n\nYou start with a bottom row of blocks bottom, given as a single string, that you must use as the base of the pyramid.\nGiven bottom and allowed, return true if you can build the pyramid all the way to the top such that every triangular pattern in the pyramid is in allowed, or false otherwise.\n \nExample 1:\n\n\nInput: bottom = \"BCD\", allowed = [\"BCC\",\"CDE\",\"CEA\",\"FFF\"]\nOutput: true\nExplanation: The allowed triangular patterns are shown on the right.\nStarting from the bottom (level 3), we can build \"CE\" on level 2 and then build \"A\" on level 1.\nThere are three triangular patterns in the pyramid, which are \"BCC\", \"CDE\", and \"CEA\". All are allowed.\n\nExample 2:\n\n\nInput: bottom = \"AAAA\", allowed = [\"AAB\",\"AAC\",\"BCD\",\"BBE\",\"DEF\"]\nOutput: false\nExplanation: The allowed triangular patterns are shown on the right.\nStarting from the bottom (level 4), there are multiple ways to build level 3, but trying all the possibilites, you will get always stuck before building level 1.\n\n \nConstraints:\n\n2 <= bottom.length <= 6\n0 <= allowed.length <= 216\nallowed[i].length == 3\nThe letters in all input strings are from the set {'A', 'B', 'C', 'D', 'E', 'F'}.\nAll the values of allowed are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(bottom = \"FFFA\",allowed = ['FFF', 'FFA', 'FAF', 'AFF']) == True\n assert candidate(bottom = \"ABC\",allowed = ['ABD', 'BDC', 'CDB', 'BDD', 'DEF', 'DEE']) == False\n assert candidate(bottom = \"ABC\",allowed = ['ABD', 'BCE', 'DEF']) == True\n assert candidate(bottom = \"ABC\",allowed = ['ABD', 'BCE', 'DEF', 'FFF', 'GHI']) == True\n assert candidate(bottom = \"CDC\",allowed = ['ABA', 'ACA', 'BCD', 'BDA', 'CDE', 'CBD', 'DEC', 'DEF', 'FFF']) == False\n assert candidate(bottom = \"XXY\",allowed = ['XXY', 'XYX', 'YXX', 'XYY', 'YYX', 'YYY']) == True\n assert candidate(bottom = \"BCD\",allowed = ['BCC', 'CDE', 'CEA', 'FFF']) == True\n assert candidate(bottom = \"XXY\",allowed = ['XYX', 'XYD', 'YXZ', 'XYZ', 'XZX', 'XYX', 'YZX', 'XYZ', 'XYZ']) == False\n assert candidate(bottom = \"BDD\",allowed = ['ABB', 'ACB', 'BDC', 'BDB', 'BCC', 'BDD', 'CCC', 'BCB', 'CBC', 'DEC', 'CDB', 'DEB', 'CDE']) == False\n assert candidate(bottom = \"AB\",allowed = ['ABA', 'ABB']) == True\n assert candidate(bottom = \"AFA\",allowed = ['AFF', 'FAA', 'FFF']) == True\n assert candidate(bottom = \"XYZ\",allowed = ['XYA', 'YZB', 'AXY', 'BYZ', 'XYZ']) == False\n assert candidate(bottom = \"ABC\",allowed = ['ABD', 'BCE', 'DEF', 'FFF']) == True\n assert candidate(bottom = \"ABC\",allowed = ['ABA', 'BCB', 'ACA']) == True\n assert candidate(bottom = \"AAAA\",allowed = ['AAB', 'AAC', 'BCD', 'BBE', 'DEF']) == False\n assert candidate(bottom = \"CCD\",allowed = ['CCC', 'CDC', 'CDD', 'DDD']) == True\n assert candidate(bottom = \"XYZ\",allowed = ['XYX', 'YZY', 'ZXZ']) == True\n assert candidate(bottom = \"ABCDEFG\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFG', 'FGH', 'GHA', 'BCG', 'CDG', 'DEG', 'EFG', 'FGH', 'GHA', 'BCH', 'CDH', 'DEH', 'EFH', 'FGH', 'GHB', 'ACI', 'CDI', 'DEI', 'EFI', 'FGI', 'GHI', 'HIH', 'IDA', 'DEC', 'EFD', 'FDG', 'DGE', 'EFG', 'FGH', 'GHI', 'HII', 'IDE', 'DEC', 'EFD', 'FDG', 'DGE', 'EFG', 'FGH', 'GHI', 'HII', 'IDB', 'DEB', 'EFC', 'FDC', 'DGB', 'EHB', 'FHC', 'GHA', 'HIB']) == False\n assert candidate(bottom = \"BCDE\",allowed = ['BCF', 'CDE', 'DEF', 'EFG', 'FGH']) == False\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFA', 'FAB', 'BCG', 'CDG', 'DEG', 'EFG', 'FGH', 'GHA', 'BCH', 'CDH', 'DEH', 'EFH', 'FGH', 'GHB', 'ACI', 'CDI', 'DEI', 'EFI', 'FGI', 'GHI', 'HIH', 'IDA', 'DEC', 'EFD', 'FDG', 'DGE', 'EFG', 'FGH', 'GHI', 'HII', 'IDE', 'DEC', 'EFD', 'FDG', 'DGE', 'EFG', 'FGH', 'GHI', 'HII', 'IDB', 'DEB', 'EFC', 'FDC', 'DGB', 'EHB', 'FHC', 'GHA', 'HIB', 'IDA', 'IDB', 'IDC', 'IDE', 'IDF', 'IDG', 'IDH', 'IDI']) == True\n assert candidate(bottom = \"ABCD\",allowed = ['ABA', 'BAC', 'CAD', 'ADC', 'BCD', 'CDB', 'DBD', 'BCF', 'CFF', 'FFA']) == True\n assert candidate(bottom = \"ABCDEFA\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFA', 'FAB', 'ABE', 'BCE', 'CEF', 'DEF', 'EFD', 'FDA', 'ADB', 'BDC', 'CEB', 'DFC', 'EAD', 'FBE', 'ACB', 'BDC', 'CDB', 'DEA', 'EFD', 'FAD', 'BDA', 'CBD', 'DCB', 'EAF', 'FDB', 'AEB', 'BEC', 'CFA', 'DFB', 'EAD', 'FBA', 'ABC', 'BCD', 'CDE', 'DEF', 'EFA', 'FAB', 'ABE', 'BCE', 'CEF', 'DEF', 'EFD', 'FDA']) == True\n assert candidate(bottom = \"ABCDEFG\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFG', 'FGG', 'GGA', 'GGB', 'GBC', 'GCD', 'GDE', 'GEF', 'GFG', 'GHH', 'HHA', 'HHB', 'HHC', 'HHD', 'HEH', 'HHF', 'HGG', 'HHH']) == True\n assert candidate(bottom = \"AABBB\",allowed = ['AAA', 'AAB', 'ABA', 'ABB', 'BBB', 'BBA', 'BAB', 'BAA']) == True\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABF', 'BCG', 'CDF', 'DEH', 'EFA', 'FGA', 'GHB', 'HHA', 'HIB', 'IBC', 'JCA', 'KBD', 'LCE', 'MDF', 'NEG', 'OFA', 'PGH', 'QHI', 'RIB', 'SJC', 'TKD', 'ULC', 'VMF', 'WNG', 'XOH', 'YPI', 'ZQJ']) == False\n assert candidate(bottom = \"BCD\",allowed = ['BCD', 'CDE', 'DEE', 'EEA', 'EAB', 'ABC', 'BCA', 'CAB', 'BAC', 'ACB', 'BCD', 'CDE', 'DEF', 'EFG', 'FGH', 'GHI', 'HIJ', 'IJK', 'JKL', 'KLM', 'LMN', 'MNO', 'NOP', 'OPQ', 'PQR', 'QRS', 'RST', 'STU', 'TUV', 'UVW', 'VWX', 'WXZ', 'XYZ', 'YZA', 'ZAB']) == True\n assert candidate(bottom = \"ABCDE\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFG', 'FGH', 'GHI']) == True\n assert candidate(bottom = \"FEDCBA\",allowed = ['FEG', 'EGD', 'GDC', 'DCA', 'CAB', 'ABF', 'BFB']) == False\n assert candidate(bottom = \"FEDCBA\",allowed = ['FED', 'EDC', 'DCB', 'CBA', 'BAC', 'ACB', 'CAB', 'ABC', 'BCA', 'BCD', 'CDB', 'DBD', 'BCF', 'CFF', 'FFA', 'ACF', 'CFA', 'FAC']) == True\n assert candidate(bottom = \"AAAAAA\",allowed = ['AAA', 'AAB', 'ABA', 'ABB', 'BAA', 'BAB', 'BBA', 'BBB', 'AAC', 'ACA', 'ACC', 'BAC', 'BCA', 'BCB', 'BBC', 'BCC', 'CCC', 'CCA', 'CCC', 'BCC', 'CCC', 'CCC']) == True\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABG', 'BCG', 'CDE', 'DEC', 'EFA', 'FGH', 'GHI', 'HIJ', 'IJK', 'JKL', 'KLM', 'LMN', 'MNO', 'NOP', 'OPQ', 'PQR', 'QRS', 'RST', 'STU', 'TUV', 'UVW', 'VWX', 'WXY', 'XYZ']) == False\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFA', 'FAB', 'BCG', 'CDG', 'DEG', 'EFG', 'FGH', 'GHA', 'BCH', 'CDH', 'DEH', 'EFH', 'FGH', 'GHB', 'ACI', 'CDI', 'DEI', 'EFI', 'FGI', 'GHI', 'HIH', 'IDA', 'DEC', 'EFD', 'FDG', 'DGE', 'EFG', 'FGH', 'GHI', 'HIG', 'IHA', 'IDB', 'DEB', 'EFC', 'FDC', 'DGB', 'EHB', 'FHC', 'GHA', 'HIB', 'IDA', 'IDB', 'IDC', 'IDE', 'IDF', 'IDG', 'IDH', 'IDI']) == True\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABG', 'BCG', 'CDE', 'DEC', 'EFA', 'FGH']) == False\n assert candidate(bottom = \"ABCDE\",allowed = ['ABC', 'BCD', 'CDE', 'DEE', 'EEF', 'EFA', 'FAB', 'ABE', 'BEC', 'ECA', 'CAD', 'CDA', 'DAB', 'ACF', 'CFB']) == True\n assert candidate(bottom = \"ABCABC\",allowed = ['ABA', 'BCB', 'CAC', 'CBC', 'BDB', 'CDC', 'ADA', 'AEA', 'CEC', 'DEC', 'BEB', 'FEC']) == True\n assert candidate(bottom = \"FEDCBA\",allowed = ['FEE', 'EDD', 'DCC', 'CCB', 'BBA', 'AAB', 'ABD', 'BCE', 'DEF', 'FFF', 'GHI', 'IJH', 'KIG', 'LIF', 'MEG', 'NHF', 'OGI', 'PHJ', 'QIK', 'RLH', 'SGM', 'THN', 'UIO', 'VJP', 'WKQ', 'XLR', 'YMV', 'ZNW', 'AOX', 'BQP', 'CRS', 'DUT', 'EVV', 'FWW', 'GXW', 'HYX', 'IZY', 'JZZ']) == False\n assert candidate(bottom = \"XYZXYZ\",allowed = ['XYA', 'YZB', 'ZXC', 'XYD', 'YZE', 'ZXF', 'XYG', 'YZH', 'ZXI', 'XYJ', 'YZK', 'ZXL', 'XYM', 'YZN', 'ZXM', 'XYP', 'YZQ', 'ZXZ', 'XYX', 'YZY', 'ZXZ', 'XZX', 'YZX', 'ZZX', 'XXY', 'YZZ', 'ZZY', 'XXZ', 'YXY', 'ZYZ', 'XYX', 'YZY', 'ZXZ', 'XYZ', 'YZX', 'ZXY', 'XZY', 'YZZ', 'ZZX', 'XYZ', 'YZX', 'ZXY', 'XZY', 'YZZ', 'ZZX']) == True\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABE', 'BCD', 'CDE', 'DEF', 'EFG', 'FGA', 'GAB', 'BCF', 'CDA', 'DEB', 'EFC', 'FAB', 'GBC', 'HCD', 'IEA', 'JFB', 'KGA', 'LHB', 'MIA', 'NJB', 'OKC', 'PLD', 'QME', 'RNF', 'SGO', 'THP', 'UIQ', 'VRJ', 'WTK', 'XSL', 'YMV', 'ZNU']) == False\n assert candidate(bottom = \"ABCDEFG\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFG', 'FGH', 'GHA', 'BCG', 'CDG', 'DEG', 'EFG', 'FGH', 'GHA', 'BCH', 'CDH', 'DEH', 'EFH', 'FGH', 'GHB', 'ACI', 'CDI', 'DEI', 'EFI', 'FGI', 'GHI', 'HIH', 'IDA', 'DEC', 'EFD', 'FDG', 'DGE', 'EFG', 'FGH', 'GHI', 'HII', 'IDE', 'DEC', 'EFD', 'FDG', 'DGE', 'EFG', 'FGH', 'GHI', 'HII']) == False\n assert candidate(bottom = \"ABCDEFG\",allowed = ['ABA', 'BAC', 'ACA', 'CAD', 'BDA', 'BAA', 'BBA', 'ABA', 'AAA', 'BBA', 'CAA', 'DAD', 'BBD', 'ABA', 'BAC', 'ACA', 'CAD', 'BDA', 'BAA', 'BBA', 'ABA', 'AAA', 'BBA', 'CAA', 'DAD', 'BBD', 'ABA', 'BAC', 'ACA', 'CAD', 'BDA', 'BAA', 'BBA', 'ABA', 'AAA', 'BBA', 'CAA', 'DAD', 'BBD']) == False\n assert candidate(bottom = \"ABCD\",allowed = ['ABC', 'BCD', 'CDA', 'DAB', 'ABE', 'BCE', 'CEA', 'EAB', 'ACD', 'CDB', 'DBA', 'BAC', 'CAD', 'DCA', 'ACF', 'CFE', 'FEA', 'EAC', 'BDF', 'DFG', 'FGH', 'GHB', 'CDF', 'DFH', 'FHG', 'HGD', 'ACE', 'CEB', 'EBD', 'DBA', 'CFA', 'FAB', 'ABF', 'BFD', 'FDC', 'DCB']) == True\n assert candidate(bottom = \"ABCD\",allowed = ['ABE', 'BEC', 'ECA', 'CAD', 'CDA', 'DAB', 'ABC']) == False\n assert candidate(bottom = \"ACF\",allowed = ['ACF', 'CFA', 'FAC', 'BAC', 'BCA', 'CAB', 'ACB', 'BCC', 'CBA', 'ABC']) == True\n assert candidate(bottom = \"FEDCBA\",allowed = ['FEE', 'EDC', 'DBA', 'CBA', 'BAE', 'AEG']) == False\n assert candidate(bottom = \"FEDCBA\",allowed = ['FEG', 'EGD', 'GDC', 'DCA', 'CAB', 'ABF', 'BFB', 'BAE', 'AEC', 'ECF', 'CFD', 'DFG', 'FGH', 'GHG', 'HGH', 'GGH']) == False\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFG', 'FGH', 'GHI', 'HIJ', 'IJK', 'JKL', 'KLM', 'LMN', 'MNO', 'NOP', 'OPQ', 'PQR', 'QRS', 'RST', 'STU', 'TUV', 'UVW', 'VWX', 'WXZ', 'XYZ', 'YZA', 'ZAB', 'BCG', 'CGD', 'DGE', 'EGF', 'FGH', 'GHJ', 'HJK', 'IKL', 'JKM', 'KLN', 'LMO', 'MNP', 'NOP', 'OPQ', 'PQR', 'QRS', 'RST', 'STU', 'TUV', 'UVW', 'VWX', 'WXZ', 'XYZ', 'YZA', 'ZAB']) == True\n assert candidate(bottom = \"ABCDE\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFG', 'FGH', 'GHI', 'HIJ', 'IJK', 'JKL', 'KLM', 'LMN', 'MNO', 'NOP', 'OPQ', 'PQR', 'QRS', 'RST', 'STU', 'TUV', 'UVW', 'VWX', 'WXZ', 'XYZ', 'YZA', 'ZAB', 'ABB', 'BBD', 'CCD', 'DDF', 'EFF', 'GFF', 'HFF', 'IFF', 'JFF', 'KFF', 'LFF', 'MFF', 'NFF', 'OFF', 'PFF', 'QFF', 'RFF', 'SFF', 'TFF', 'UFF', 'VFF', 'WFF', 'XFF', 'YFF', 'ZFF']) == True\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFG', 'FGH', 'GHI', 'HIJ', 'IJK', 'JKL', 'KLM', 'LMN', 'MNO', 'NOP', 'OPQ', 'PQR', 'QRS', 'RST', 'STU', 'TUV', 'UVW', 'VWX', 'WXZ', 'XYZ', 'YZA', 'ZAB', 'FED', 'EDC', 'DCB', 'CBA', 'BAC', 'ACB', 'BCA', 'CAB', 'EAB', 'FCD', 'GHI', 'HJK', 'IKL', 'JKM', 'KLN', 'LMO', 'MNP', 'NOP', 'OPQ', 'PQR', 'QRS', 'RST', 'STU', 'TUV', 'UVW', 'VWX', 'WXZ', 'XYZ', 'YZA', 'ZAB', 'ABB', 'BBD', 'CCD', 'DDF', 'EFF', 'GFF', 'HFF', 'IFF', 'JFF', 'KFF', 'LFF', 'MFF', 'NFF', 'OFF', 'PFF', 'QFF', 'RFF', 'SFF', 'TFF', 'UFF', 'VFF', 'WFF', 'XFF', 'YFF', 'ZFF']) == True\n assert candidate(bottom = \"FFFFF\",allowed = ['FFF', 'FFG', 'FGF', 'GFF', 'GGG', 'FGG', 'GFG', 'GGF', 'FGH', 'GHF', 'GFG', 'HFG', 'FGF', 'GGG', 'FGF', 'GFG']) == True\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABG', 'BCD', 'CDE', 'DEF', 'EFG', 'FGH']) == False\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABB', 'BCD', 'CDE', 'DEF', 'EFG', 'FGH', 'GHI', 'HIJ']) == False\n assert candidate(bottom = \"ABACD\",allowed = ['ABA', 'BAC', 'ACD', 'CDE', 'DEA', 'EAB', 'ABC', 'BCD', 'CDA', 'DAB', 'ABD', 'BCE', 'CEF', 'DFE', 'EFD', 'FAC']) == True\n assert candidate(bottom = \"ABCD\",allowed = ['ABE', 'BCE', 'CDE', 'DEF', 'EFG', 'FGH']) == False\n assert candidate(bottom = \"XYZXYZ\",allowed = ['XYZ', 'YZX', 'ZXY', 'XZY', 'ZYX', 'YXZ', 'XYX', 'YYX', 'YXY', 'YXX', 'XXX', 'XXY', 'XYY', 'XZX', 'XZX', 'XZY', 'XYX', 'XYZ', 'YZX', 'ZXY', 'YZY', 'ZYY', 'ZZY', 'ZZZ', 'YZZ', 'XZZ', 'XXZ', 'XYX', 'XYZ', 'YYX', 'YXY', 'YZY', 'YZZ']) == True\n assert candidate(bottom = \"AABB\",allowed = ['AAB', 'ABA', 'BAA', 'AAA', 'BBB', 'ABB', 'BBA', 'BAB']) == True\n assert candidate(bottom = \"EABCD\",allowed = ['EAB', 'ABF', 'BCG', 'CDF', 'DEH', 'FGI', 'GHI']) == False\n assert candidate(bottom = \"ABCDE\",allowed = ['ABB', 'BCC', 'CDD', 'DEE', 'EFF', 'FGG', 'GHH', 'HHI']) == True\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFA', 'FAB', 'ABE', 'BCE', 'CEF', 'DEF', 'EFD', 'FDA', 'ADB', 'BDC', 'CEB', 'DFC', 'EAD', 'FBE', 'ACB', 'BDC', 'CDB', 'DEA', 'EFD', 'FAD', 'BDA', 'CBD', 'DCB', 'EAF', 'FDB', 'AEB', 'BEC', 'CFA', 'DFB', 'EAD', 'FBA']) == True\n assert candidate(bottom = \"ACDF\",allowed = ['ACA', 'CDF', 'ACF', 'CDF', 'CAF', 'FAC', 'FCA', 'FCD', 'DFC', 'FDC', 'ADC', 'CAD', 'ACD', 'CDA', 'CAF', 'FAC', 'CAD', 'ACD', 'FCA', 'FCD', 'CDA', 'FDC', 'DFC', 'CFA', 'CAF', 'FCA', 'FCD', 'FDC', 'CDA', 'DFC', 'FAC', 'CAD', 'ACD', 'FCA', 'FCD', 'CDA', 'FDC', 'DFC', 'CFA', 'CAF', 'FCA', 'FCD', 'FDC', 'CDA', 'DFC', 'FAC', 'CAD', 'ACD', 'FCA', 'FCD', 'CDA', 'FDC', 'DFC']) == True\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFG', 'FGH', 'GHI', 'HIJ', 'IJK']) == True\n assert candidate(bottom = \"FAEBC\",allowed = ['FAB', 'ABD', 'BCE', 'CEB', 'EFA', 'FAB', 'ABC', 'BCD', 'CDE', 'DEF', 'EFA', 'FFF', 'GHI', 'HIJ', 'IJK', 'JKL', 'KLM', 'LMN', 'MNO', 'NOP', 'OPQ', 'PQR', 'QRS', 'RST', 'STU', 'TUV', 'UVW', 'VWX', 'WXY', 'XYZ']) == False\n assert candidate(bottom = \"ABCABC\",allowed = ['ABA', 'BAC', 'ACB', 'BCA', 'CAB', 'CBA', 'AAB', 'BAA', 'ABB', 'BBA', 'AAC', 'CAA', 'ACC', 'CCA', 'BCC', 'CBB', 'BBB', 'AAA', 'CCC', 'FFF', 'GGG', 'HHH', 'III', 'JJJ', 'KKK', 'LLL', 'MMM', 'NNN', 'OOO', 'PPP', 'QQQ', 'RRR', 'SSS', 'TTT', 'UUU', 'VVV', 'WWW', 'XXX', 'YYY', 'ZZZ']) == True\n assert candidate(bottom = \"ABCFE\",allowed = ['ABC', 'BCF', 'CFE', 'FED', 'EDA', 'DAB', 'ABE', 'BEC', 'ECA', 'CAD', 'CDA', 'DAB', 'ACF', 'CFB', 'BCE']) == True\n assert candidate(bottom = \"FEDCBA\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFG', 'FGH', 'GHI', 'HIJ', 'IJK', 'JKL', 'KLM', 'LMN', 'MNO', 'NOP', 'OPQ', 'PQR', 'QRS', 'RST', 'STU', 'TUV', 'UVW', 'VWX', 'WXZ', 'XYZ', 'YZA', 'ZAB', 'FED', 'EDC', 'DCB', 'CBA', 'BAC', 'ACB', 'BCA', 'CAB', 'EAB', 'FCD', 'GHI', 'HJK', 'IKL', 'JKM', 'KLN', 'LMO', 'MNP', 'NOP', 'OPQ', 'PQR', 'QRS', 'RST', 'STU', 'TUV', 'UVW', 'VWX', 'WXZ', 'XYZ', 'YZA', 'ZAB']) == True\n assert candidate(bottom = \"ABAC\",allowed = ['ABA', 'BAC', 'ACA', 'BAA', 'CAA', 'ACB', 'CBA', 'BAB', 'ABA', 'BAA', 'AAB', 'BBA', 'ABA', 'ABB', 'BAC', 'BAA', 'BBA', 'BBA', 'BAC', 'BAC', 'BAC', 'BAC']) == True\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFA', 'FAB', 'ABG', 'BCG', 'CDG', 'DEG', 'EFG', 'FGA', 'GAB', 'BCH', 'CDH', 'DEH', 'EFH', 'FGH', 'GHG', 'CHD', 'DHE', 'EFH', 'FGH', 'GHG', 'ACI', 'CDI', 'DEI', 'EFI', 'FGI', 'GHI', 'HIH', 'IDC', 'DEC', 'EFD', 'FDG', 'DGE', 'EFG', 'FGH', 'GHI', 'HII', 'IDE', 'DEC', 'EFD', 'FDG', 'DGE', 'EFG', 'FGH', 'GHI', 'HII']) == True\n assert candidate(bottom = \"AAAAAA\",allowed = ['AAA', 'AAB', 'ABA', 'ABB', 'BBA', 'BAB', 'BAA', 'BBB', 'ABA', 'AAA', 'BBA', 'BAA', 'ABB', 'AAB', 'BAB', 'BBA', 'ABB', 'BAB', 'BAA', 'BBB', 'AAA', 'BBA', 'ABB', 'AAB', 'BAB', 'BBA', 'ABB', 'BAB', 'BAA', 'BBB', 'AAA', 'BBA', 'ABB', 'AAB', 'BAB', 'BBA', 'ABB', 'BAB', 'BAA', 'BBB', 'AAA', 'BBA', 'ABB', 'AAB', 'BAB', 'BBA', 'ABB', 'BAB', 'BAA', 'BBB', 'AAA']) == True\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABA', 'BCB', 'CDC', 'DED', 'EFE', 'FGF', 'GAG', 'GBG', 'GGG', 'GHH', 'GHI', 'GJJ', 'GJG', 'HJH', 'HJI', 'HJG', 'IJJ', 'IJK', 'IJG', 'JKJ', 'JKK', 'JKG', 'KLL', 'KLK', 'KLG', 'LLL', 'LLM', 'LLG', 'MLM', 'MLN', 'MLG', 'NLO', 'NLP', 'NMG', 'OOO', 'OOP', 'ONP', 'PPP', 'PPQ', 'PMQ', 'QQQ', 'QQR', 'QSR', 'RRR', 'RSS', 'RST', 'SSS', 'SST', 'TTT', 'TTU', 'TTV', 'UUU', 'UUV', 'UVU', 'VVV', 'VVW', 'WWW']) == True\n assert candidate(bottom = \"ABACAB\",allowed = ['ABA', 'BAC', 'ACA', 'CAD', 'BDA', 'BAA', 'BBA', 'ABA', 'AAA', 'BBA', 'CAA', 'DAD', 'BBD']) == True\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABA', 'BCB', 'CDE', 'DEF', 'EFG', 'FGA', 'GAB', 'BDA', 'DBA', 'ADB', 'CDB', 'DCB', 'BEC', 'ECB', 'CEB', 'DCE', 'EDC', 'DEC', 'FED', 'EFD', 'FDE', 'DFE', 'EDE', 'DED', 'EEF', 'FEF', 'EFF', 'FFF', 'FGF', 'GFF', 'FGG', 'GGF', 'GFG', 'GGG']) == False\n assert candidate(bottom = \"FEDCBA\",allowed = ['FED', 'EDC', 'DCB', 'CBA', 'BAF', 'AFB', 'FAB', 'ABD', 'BCE', 'CEB', 'EFA', 'FAB', 'ABC', 'BCD', 'CDE', 'DEF', 'EFA', 'FFF', 'GHI', 'HIJ', 'IJK', 'JKL', 'KLM', 'LMN', 'MNO', 'NOP', 'OPQ', 'PQR', 'QRS', 'RST', 'STU', 'TUV', 'UVW', 'VWX', 'WXY', 'XYZ']) == False\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABG', 'BCG', 'CDE', 'DEC', 'EFA', 'FGH', 'GHI']) == False\n assert candidate(bottom = \"ABCDEF\",allowed = ['ABC', 'BCD', 'CDE', 'DEF', 'EFA', 'FAB', 'ABD', 'BCE', 'CEF', 'DFE', 'EFD', 'FAC']) == True\n"}, "metadata": {"canonical_parameter_names": ["bottom", "allowed"], "leetcode_dataset_entry_point": "Solution().pyramidTransition", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var pyramidTransition = function(bottom, allowed) {", "container": null, "callable": "pyramidTransition", "parameters": [{"name": "bottom", "type": "string"}, {"name": "allowed", "type": "string[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 757, "task_id": "set-intersection-size-at-least-two", "difficulty": "Hard", "problem_description": "You are given a 2D integer array intervals where intervals[i] = [starti, endi] represents all the integers from starti to endi inclusively.\nA containing set is an array nums where each interval from intervals has at least two integers in nums.\n\nFor example, if intervals = [[1,3], [3,7], [8,9]], then [1,2,4,7,8,9] and [2,3,4,8,9] are containing sets.\n\nReturn the minimum possible size of a containing set.\n \nExample 1:\n\nInput: intervals = [[1,3],[3,7],[8,9]]\nOutput: 5\nExplanation: let nums = [2, 3, 4, 8, 9].\nIt can be shown that there cannot be any containing array of size 4.\n\nExample 2:\n\nInput: intervals = [[1,3],[1,4],[2,5],[3,5]]\nOutput: 3\nExplanation: let nums = [2, 3, 4].\nIt can be shown that there cannot be any containing array of size 2.\n\nExample 3:\n\nInput: intervals = [[1,2],[2,3],[2,4],[4,5]]\nOutput: 5\nExplanation: let nums = [1, 2, 3, 4, 5].\nIt can be shown that there cannot be any containing array of size 4.\n\n \nConstraints:\n\n1 <= intervals.length <= 3000\nintervals[i].length == 2\n0 <= starti < endi <= 108\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(intervals = [[1, 10], [5, 10], [7, 15]]) == 2\n assert candidate(intervals = [[1, 2], [2, 3]]) == 3\n assert candidate(intervals = [[1, 3], [1, 4], [2, 5], [3, 5]]) == 3\n assert candidate(intervals = [[1, 3], [3, 7], [8, 9]]) == 5\n assert candidate(intervals = [[1, 2], [3, 4], [5, 6]]) == 6\n assert candidate(intervals = [[1, 5], [2, 4], [3, 6]]) == 2\n assert candidate(intervals = [[1, 100], [50, 75], [25, 50], [75, 100]]) == 4\n assert candidate(intervals = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6]]) == 2\n assert candidate(intervals = [[1, 2], [2, 3], [2, 4], [4, 5]]) == 5\n assert candidate(intervals = [[1, 3], [3, 5], [5, 7], [7, 9], [9, 11], [11, 13], [13, 15], [15, 17], [17, 19], [19, 21]]) == 11\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]]) == 7\n assert candidate(intervals = [[1, 10], [2, 5], [3, 7], [4, 8], [5, 9]]) == 3\n assert candidate(intervals = [[1, 5], [1, 5], [1, 5], [1, 5], [1, 5], [1, 5], [1, 5], [1, 5], [1, 5], [1, 5]]) == 2\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8]]) == 8\n assert candidate(intervals = [[1, 4], [2, 5], [3, 6], [4, 7], [5, 8], [6, 9], [7, 10], [8, 11], [9, 12], [10, 13]]) == 6\n assert candidate(intervals = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8]]) == 5\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20]]) == 20\n assert candidate(intervals = [[1, 10], [1, 10], [1, 10], [1, 10], [1, 10], [1, 10], [1, 10], [1, 10], [1, 10], [1, 10], [2, 9], [3, 8], [4, 7], [5, 6]]) == 2\n assert candidate(intervals = [[1, 3], [3, 6], [6, 9], [9, 12], [12, 15]]) == 6\n assert candidate(intervals = [[1, 3], [2, 6], [4, 7], [6, 8], [8, 10]]) == 6\n assert candidate(intervals = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6]]) == 2\n assert candidate(intervals = [[10, 20], [15, 25], [20, 30], [25, 35], [30, 40], [35, 45], [40, 50]]) == 6\n assert candidate(intervals = [[1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 13]]) == 4\n assert candidate(intervals = [[10, 20], [15, 25], [20, 30], [25, 35], [30, 40], [35, 45], [40, 50], [45, 55], [50, 60], [55, 65]]) == 8\n assert candidate(intervals = [[1, 1000], [500, 750], [250, 500], [750, 1000], [100, 300], [300, 500], [500, 700], [700, 900], [900, 1100]]) == 6\n assert candidate(intervals = [[1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 13], [10, 14]]) == 5\n assert candidate(intervals = [[1, 100000000], [50000000, 100000000], [1, 50000000], [50000000, 100000000], [25000000, 75000000], [75000000, 125000000]]) == 4\n assert candidate(intervals = [[1, 100], [2, 99], [3, 98], [4, 97], [5, 96], [6, 95], [7, 94], [8, 93], [9, 92], [10, 91]]) == 2\n assert candidate(intervals = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10]]) == 6\n assert candidate(intervals = [[1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [1, 4], [2, 4], [3, 4], [4, 4], [1, 3], [2, 3], [3, 3], [1, 2], [2, 2], [1, 1]]) == 10\n assert candidate(intervals = [[1, 3], [3, 7], [8, 9], [10, 12], [11, 13]]) == 7\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14]]) == 14\n assert candidate(intervals = [[1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10]]) == 4\n assert candidate(intervals = [[1, 5], [1, 5], [1, 5], [1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 13]]) == 4\n assert candidate(intervals = [[1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2]]) == 2\n assert candidate(intervals = [[1, 20], [5, 15], [10, 25], [15, 30], [20, 40]]) == 4\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16]]) == 16\n assert candidate(intervals = [[1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12]]) == 4\n assert candidate(intervals = [[1, 3], [3, 5], [5, 7], [7, 9], [9, 11]]) == 6\n assert candidate(intervals = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [1, 3], [2, 4]]) == 4\n assert candidate(intervals = [[1, 50], [10, 30], [20, 40], [30, 50], [40, 60], [50, 70], [60, 80], [70, 90], [80, 100]]) == 6\n assert candidate(intervals = [[10, 20], [15, 25], [20, 30], [25, 35], [30, 40], [35, 45]]) == 5\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15]]) == 15\n assert candidate(intervals = [[1, 10], [1, 10], [1, 10], [1, 10], [1, 10], [1, 10], [1, 10], [1, 10], [1, 10], [1, 10]]) == 2\n assert candidate(intervals = [[1, 3], [1, 3], [1, 3], [1, 3], [1, 3]]) == 2\n assert candidate(intervals = [[1, 5], [2, 6], [3, 7], [4, 8], [5, 9]]) == 3\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == 10\n assert candidate(intervals = [[1, 3], [1, 5], [2, 4], [2, 6], [3, 5], [3, 7], [4, 6], [4, 8], [5, 7], [5, 9]]) == 4\n assert candidate(intervals = [[1, 3], [4, 6], [7, 9], [10, 12], [13, 15], [16, 18]]) == 12\n assert candidate(intervals = [[10, 20], [15, 25], [20, 30], [25, 35], [30, 40], [35, 45]]) == 5\n assert candidate(intervals = [[1, 30], [10, 20], [15, 25], [20, 30], [25, 30]]) == 4\n assert candidate(intervals = [[1, 10], [2, 11], [3, 12], [4, 13], [5, 14], [6, 15], [7, 16], [8, 17], [9, 18], [10, 19]]) == 3\n assert candidate(intervals = [[1, 20], [2, 19], [3, 18], [4, 17], [5, 16], [6, 15], [7, 14], [8, 13], [9, 12], [10, 11]]) == 2\n assert candidate(intervals = [[5, 10], [6, 8], [7, 9], [8, 11], [9, 12]]) == 4\n assert candidate(intervals = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 16], [15, 17]]) == 11\n assert candidate(intervals = [[1, 10], [10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100]]) == 11\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12]]) == 12\n assert candidate(intervals = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7]]) == 2\n assert candidate(intervals = [[1, 3], [3, 7], [7, 11], [11, 15], [15, 19], [19, 23], [23, 27], [27, 31]]) == 9\n assert candidate(intervals = [[1, 10], [2, 8], [3, 7], [4, 6], [5, 5]]) == 2\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 10], [5, 15], [10, 20], [15, 25]]) == 12\n assert candidate(intervals = [[1, 1000], [2, 999], [3, 998], [4, 997], [5, 996], [6, 995], [7, 994]]) == 2\n assert candidate(intervals = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1]]) == 11\n assert candidate(intervals = [[1, 10], [1, 9], [1, 8], [1, 7], [1, 6], [1, 5], [1, 4], [1, 3], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == 10\n assert candidate(intervals = [[1, 10], [2, 8], [3, 7], [4, 6], [5, 5], [6, 6]]) == 4\n assert candidate(intervals = [[1, 3], [1, 4], [2, 5], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12]]) == 8\n assert candidate(intervals = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [11, 20], [12, 19], [13, 18], [14, 17], [15, 16]]) == 4\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13]]) == 13\n assert candidate(intervals = [[1, 10], [11, 20], [21, 30], [31, 40], [41, 50], [51, 60], [61, 70], [71, 80], [81, 90], [91, 100]]) == 20\n assert candidate(intervals = [[1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2]]) == 2\n assert candidate(intervals = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [21, 22], [23, 24], [25, 26], [27, 28], [29, 30]]) == 30\n assert candidate(intervals = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1]]) == 11\n assert candidate(intervals = [[1, 10], [5, 15], [10, 20], [15, 25], [20, 30], [25, 35], [30, 40], [35, 45], [40, 50], [45, 55], [50, 60]]) == 8\n assert candidate(intervals = [[1, 10], [2, 5], [3, 6], [7, 12], [8, 9]]) == 4\n assert candidate(intervals = [[1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10]]) == 2\n assert candidate(intervals = [[5, 10], [10, 15], [15, 20], [20, 25], [25, 30]]) == 6\n assert candidate(intervals = [[1, 5], [5, 10], [10, 15], [15, 20], [20, 25], [25, 30]]) == 7\n assert candidate(intervals = [[1, 100000000], [50000000, 100000000], [1, 50000000], [50000000, 100000000]]) == 3\n assert candidate(intervals = [[1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10]]) == 2\n assert candidate(intervals = [[1, 10], [2, 8], [3, 6], [7, 10], [4, 5], [5, 9]]) == 4\n assert candidate(intervals = [[1, 10], [11, 20], [21, 30], [1, 20], [11, 30], [1, 30]]) == 6\n assert candidate(intervals = [[5, 15], [10, 20], [15, 25], [20, 30], [25, 35], [30, 40], [35, 45], [40, 50]]) == 6\n assert candidate(intervals = [[1, 50], [5, 55], [10, 60], [15, 65], [20, 70], [25, 75], [30, 80], [35, 85], [40, 90], [45, 95]]) == 2\n assert candidate(intervals = [[1, 100], [1, 50], [50, 100], [25, 75], [75, 125], [100, 150]]) == 4\n assert candidate(intervals = [[10, 20], [15, 25], [20, 30], [25, 35], [30, 40]]) == 4\n assert candidate(intervals = [[1, 10], [11, 20], [21, 30], [31, 40], [41, 50], [51, 60], [61, 70], [71, 80], [81, 90], [91, 100], [1, 100]]) == 20\n assert candidate(intervals = [[1, 100000000], [50000000, 75000000], [25000000, 50000000], [75000000, 100000000]]) == 4\n assert candidate(intervals = [[1, 50], [2, 49], [3, 48], [4, 47], [5, 46], [6, 45], [7, 44], [8, 43], [9, 42], [10, 41], [11, 40], [12, 39], [13, 38], [14, 37], [15, 36], [16, 35], [17, 34], [18, 33], [19, 32], [20, 31], [21, 30], [22, 29], [23, 28], [24, 27], [25, 26]]) == 2\n assert candidate(intervals = [[1, 3], [2, 5], [3, 7], [4, 9], [5, 11], [6, 13], [7, 15], [8, 17], [9, 19], [10, 21]]) == 6\n assert candidate(intervals = [[1, 100], [25, 50], [50, 75], [75, 100], [100, 125], [125, 150]]) == 6\n"}, "metadata": {"canonical_parameter_names": ["intervals"], "leetcode_dataset_entry_point": "Solution().intersectionSizeTwo", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var intersectionSizeTwo = function(intervals) {", "container": null, "callable": "intersectionSizeTwo", "parameters": [{"name": "intervals", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 761, "task_id": "special-binary-string", "difficulty": "Hard", "problem_description": "Special binary strings are binary strings with the following two properties:\n\nThe number of 0's is equal to the number of 1's.\nEvery prefix of the binary string has at least as many 1's as 0's.\n\nYou are given a special binary string s.\nA move consists of choosing two consecutive, non-empty, special substrings of s, and swapping them. Two strings are consecutive if the last character of the first string is exactly one index before the first character of the second string.\nReturn the lexicographically largest resulting string possible after applying the mentioned operations on the string.\n \nExample 1:\n\nInput: s = \"11011000\"\nOutput: \"11100100\"\nExplanation: The strings \"10\" [occuring at s[1]] and \"1100\" [at s[3]] are swapped.\nThis is the lexicographically largest string possible after some number of swaps.\n\nExample 2:\n\nInput: s = \"10\"\nOutput: \"10\"\n\n \nConstraints:\n\n1 <= s.length <= 50\ns[i] is either '0' or '1'.\ns is a special binary string.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"11010011\") == \"110100\"\n assert candidate(s = \"11011000\") == \"11100100\"\n assert candidate(s = \"11100100\") == \"11100100\"\n assert candidate(s = \"111000\") == \"111000\"\n assert candidate(s = \"101010\") == \"101010\"\n assert candidate(s = \"11001010\") == \"11001010\"\n assert candidate(s = \"11001100\") == \"11001100\"\n assert candidate(s = \"10\") == \"10\"\n assert candidate(s = \"1100\") == \"1100\"\n assert candidate(s = \"11010010\") == \"11010010\"\n assert candidate(s = \"10110011\") == \"110010\"\n assert candidate(s = \"10110010\") == \"11001010\"\n assert candidate(s = \"1010\") == \"1010\"\n assert candidate(s = \"11110000\") == \"11110000\"\n assert candidate(s = \"11101000\") == \"11101000\"\n assert candidate(s = \"10011010\") == \"10101010\"\n assert candidate(s = \"1101100011011000\") == \"1110010011100100\"\n assert candidate(s = \"111001100010\") == \"111001100010\"\n assert candidate(s = \"10101010110011\") == \"110010101010\"\n assert candidate(s = \"10111010000111\") == \"111010001010\"\n assert candidate(s = \"1100110011001010\") == \"1100110011001010\"\n assert candidate(s = \"11100100101000\") == \"111001001010\"\n assert candidate(s = \"11110011001000\") == \"11110011001000\"\n assert candidate(s = \"1111000100\") == \"1111000100\"\n assert candidate(s = \"1100110011001100\") == \"1100110011001100\"\n assert candidate(s = \"111111000011110000111100\") == \"\"\n assert candidate(s = \"110101001100\") == \"110101001100\"\n assert candidate(s = \"111001001100\") == \"111001001100\"\n assert candidate(s = \"110011110000110011001100\") == \"111100001100110011001100\"\n assert candidate(s = \"1111001111000000\") == \"1111110000110000\"\n assert candidate(s = \"1111101000011100\") == \"\"\n assert candidate(s = \"111010101000000000\") == \"111010101000\"\n assert candidate(s = \"101010101010101010101010\") == \"101010101010101010101010\"\n assert candidate(s = \"1101100011100100\") == \"1110010011100100\"\n assert candidate(s = \"10101010\") == \"10101010\"\n assert candidate(s = \"1001101010011010\") == \"1010101010101010\"\n assert candidate(s = \"11101010100100\") == \"11101010100100\"\n assert candidate(s = \"110110001001\") == \"111001001010\"\n assert candidate(s = \"11111100000011001100\") == \"11111100000011001100\"\n assert candidate(s = \"1100110011\") == \"11001100\"\n assert candidate(s = \"111001101001\") == \"\"\n assert candidate(s = \"1111001000\") == \"1111001000\"\n assert candidate(s = \"1110101010000000\") == \"111010101000\"\n assert candidate(s = \"1111100001110000\") == \"1111100001110000\"\n assert candidate(s = \"101100101100101100\") == \"110011001100101010\"\n assert candidate(s = \"110011001100\") == \"110011001100\"\n assert candidate(s = \"1110110000\") == \"1111001000\"\n assert candidate(s = \"1111100001100110\") == \"\"\n assert candidate(s = \"1101110000111000\") == \"1111000100111000\"\n assert candidate(s = \"11110000101010\") == \"11110000101010\"\n assert candidate(s = \"110011110000\") == \"111100001100\"\n assert candidate(s = \"111010011001\") == \"\"\n assert candidate(s = \"1111000011001100\") == \"1111000011001100\"\n assert candidate(s = \"101010101010\") == \"101010101010\"\n assert candidate(s = \"11101001100100\") == \"11101001100100\"\n assert candidate(s = \"11111100001010101000\") == \"11111100001010101000\"\n assert candidate(s = \"110010110100\") == \"110100110010\"\n assert candidate(s = \"1101100011001100\") == \"1110010011001100\"\n assert candidate(s = \"11001110100011\") == \"111010001100\"\n assert candidate(s = \"110110100001\") == \"111010010010\"\n assert candidate(s = \"1111000010001100\") == \"11110000110010\"\n assert candidate(s = \"101101011000\") == \"111001010010\"\n assert candidate(s = \"1110101001010100\") == \"1110101001010100\"\n assert candidate(s = \"11111000011000\") == \"11111000011000\"\n assert candidate(s = \"1101100100\") == \"1110010100\"\n assert candidate(s = \"11111100000010101010\") == \"11111100000010101010\"\n assert candidate(s = \"1111100011000100\") == \"1111100011000100\"\n assert candidate(s = \"110110010010\") == \"111001010010\"\n assert candidate(s = \"111010011000\") == \"111010011000\"\n assert candidate(s = \"111011001110000110110011\") == \"\"\n assert candidate(s = \"1101100010011100\") == \"1110010011001010\"\n assert candidate(s = \"1110011010001010\") == \"1110100110001010\"\n assert candidate(s = \"110110111000011100001100\") == \"111110001001110001001100\"\n assert candidate(s = \"1100111100001100\") == \"1111000011001100\"\n assert candidate(s = \"11001100110011001100\") == \"11001100110011001100\"\n assert candidate(s = \"1110110100100001\") == \"1111010010100010\"\n assert candidate(s = \"111100110000\") == \"111100110000\"\n assert candidate(s = \"111100001010\") == \"111100001010\"\n assert candidate(s = \"111110001111000011001100\") == \"\"\n assert candidate(s = \"111011001000\") == \"111100101000\"\n assert candidate(s = \"1110001110100000\") == \"11101000111000\"\n assert candidate(s = \"1111110000001010\") == \"1111110000001010\"\n assert candidate(s = \"111010101010010100101010\") == \"111010101010010100101010\"\n assert candidate(s = \"111011100000\") == \"111110001000\"\n assert candidate(s = \"110010101100\") == \"110011001010\"\n assert candidate(s = \"101100111010010011001100\") == \"111010010011001100110010\"\n assert candidate(s = \"110011001010\") == \"110011001010\"\n assert candidate(s = \"11100011100010\") == \"11100011100010\"\n assert candidate(s = \"1101101000\") == \"1110100100\"\n assert candidate(s = \"1011100010111000\") == \"1110001110001010\"\n assert candidate(s = \"11101001011000\") == \"11101001100100\"\n assert candidate(s = \"10110011110000\") == \"11110000110010\"\n assert candidate(s = \"10110110101000\") == \"11101010010010\"\n assert candidate(s = \"111001100111000011001100\") == \"111100011001100011001100\"\n assert candidate(s = \"1110011001\") == \"\"\n assert candidate(s = \"11011001100110\") == \"\"\n assert candidate(s = \"111111000000101010\") == \"111111000000101010\"\n assert candidate(s = \"11010110100011\") == \"111010010100\"\n assert candidate(s = \"110110010100\") == \"111001010100\"\n assert candidate(s = \"1110010100100011\") == \"1110010100110010\"\n assert candidate(s = \"11101100110010\") == \"\"\n assert candidate(s = \"11110100100100\") == \"11110100100100\"\n assert candidate(s = \"11010110001010\") == \"11100101001010\"\n assert candidate(s = \"1111000011110000\") == \"1111000011110000\"\n assert candidate(s = \"1110001100111000\") == \"1110001110001100\"\n assert candidate(s = \"11001111110000111100001100\") == \"1100\"\n assert candidate(s = \"101110100010\") == \"111010001010\"\n assert candidate(s = \"110101010010\") == \"110101010010\"\n assert candidate(s = \"110110011010010010110010\") == \"111010011001010011001010\"\n assert candidate(s = \"11011001110000\") == \"11110001100100\"\n assert candidate(s = \"11111000001010\") == \"11111000001010\"\n assert candidate(s = \"1101110000\") == \"1111000100\"\n assert candidate(s = \"111001110000\") == \"111100011000\"\n assert candidate(s = \"111111100000110011110000\") == \"\"\n assert candidate(s = \"110011100100\") == \"111001001100\"\n assert candidate(s = \"110011100011\") == \"1110001100\"\n assert candidate(s = \"111000110100\") == \"111000110100\"\n assert candidate(s = \"1110110011000000\") == \"11110011001000\"\n assert candidate(s = \"1110100011100010\") == \"1110100011100010\"\n assert candidate(s = \"101110001010\") == \"111000101010\"\n assert candidate(s = \"110110110110000000\") == \"1111100100100100\"\n assert candidate(s = \"111100001100\") == \"111100001100\"\n assert candidate(s = \"10101010101010\") == \"10101010101010\"\n assert candidate(s = \"111100111100110011001100\") == \"\"\n assert candidate(s = \"1101101100100010\") == \"1111001010010010\"\n assert candidate(s = \"1100110011011000\") == \"1110010011001100\"\n assert candidate(s = \"101101101000\") == \"111010010010\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().makeLargestSpecial", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var makeLargestSpecial = function(s) {", "container": null, "callable": "makeLargestSpecial", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 762, "task_id": "prime-number-of-set-bits-in-binary-representation", "difficulty": "Easy", "problem_description": "Given two integers left and right, return the count of numbers in the inclusive range [left, right] having a prime number of set bits in their binary representation.\nRecall that the number of set bits an integer has is the number of 1's present when written in binary.\n\nFor example, 21 written in binary is 10101, which has 3 set bits.\n\n \nExample 1:\n\nInput: left = 6, right = 10\nOutput: 4\nExplanation:\n6 -> 110 (2 set bits, 2 is prime)\n7 -> 111 (3 set bits, 3 is prime)\n8 -> 1000 (1 set bit, 1 is not prime)\n9 -> 1001 (2 set bits, 2 is prime)\n10 -> 1010 (2 set bits, 2 is prime)\n4 numbers have a prime number of set bits.\n\nExample 2:\n\nInput: left = 10, right = 15\nOutput: 5\nExplanation:\n10 -> 1010 (2 set bits, 2 is prime)\n11 -> 1011 (3 set bits, 3 is prime)\n12 -> 1100 (2 set bits, 2 is prime)\n13 -> 1101 (3 set bits, 3 is prime)\n14 -> 1110 (3 set bits, 3 is prime)\n15 -> 1111 (4 set bits, 4 is not prime)\n5 numbers have a prime number of set bits.\n\n \nConstraints:\n\n1 <= left <= right <= 106\n0 <= right - left <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(left = 100,right = 105) == 3\n assert candidate(left = 500,right = 1000) == 253\n assert candidate(left = 1,right = 100) == 65\n assert candidate(left = 6,right = 10) == 4\n assert candidate(left = 999900,right = 1000000) == 30\n assert candidate(left = 1,right = 20) == 14\n assert candidate(left = 5,right = 5) == 1\n assert candidate(left = 10,right = 15) == 5\n assert candidate(left = 1000,right = 10000) == 3722\n assert candidate(left = 500,right = 750) == 132\n assert candidate(left = 100000,right = 100010) == 4\n assert candidate(left = 222222,right = 222322) == 18\n assert candidate(left = 25000,right = 30000) == 1450\n assert candidate(left = 1024,right = 2048) == 476\n assert candidate(left = 100000,right = 100100) == 20\n assert candidate(left = 750000,right = 750100) == 40\n assert candidate(left = 262143,right = 262243) == 56\n assert candidate(left = 1048576,right = 1048676) == 56\n assert candidate(left = 1000,right = 1100) == 51\n assert candidate(left = 5000,right = 5500) == 217\n assert candidate(left = 876543,right = 876643) == 25\n assert candidate(left = 1000000,right = 1000010) == 1\n assert candidate(left = 6000,right = 7000) == 389\n assert candidate(left = 999990,right = 1000000) == 5\n assert candidate(left = 12345,right = 12445) == 49\n assert candidate(left = 1048575,right = 1048675) == 56\n assert candidate(left = 131072,right = 131272) == 107\n assert candidate(left = 99999,right = 100010) == 4\n assert candidate(left = 555555,right = 555655) == 23\n assert candidate(left = 10000,right = 10100) == 34\n assert candidate(left = 50000,right = 50100) == 26\n assert candidate(left = 9999,right = 10010) == 6\n assert candidate(left = 1000,right = 1050) == 24\n assert candidate(left = 999990,right = 999999) == 4\n assert candidate(left = 200000,right = 200100) == 19\n assert candidate(left = 1000,right = 1024) == 7\n assert candidate(left = 524288,right = 524388) == 56\n assert candidate(left = 100000,right = 101000) == 295\n assert candidate(left = 999999,right = 1000099) == 23\n assert candidate(left = 9999,right = 10099) == 34\n assert candidate(left = 200000,right = 201000) == 290\n assert candidate(left = 999,right = 2000) == 473\n assert candidate(left = 250000,right = 250100) == 19\n assert candidate(left = 1,right = 1000) == 530\n assert candidate(left = 3000,right = 4000) == 393\n assert candidate(left = 10000,right = 10050) == 19\n assert candidate(left = 5000,right = 6000) == 402\n assert candidate(left = 990000,right = 990100) == 48\n assert candidate(left = 987654,right = 987680) == 4\n assert candidate(left = 1023,right = 2048) == 476\n assert candidate(left = 262144,right = 262244) == 56\n assert candidate(left = 123456,right = 123556) == 19\n assert candidate(left = 1023,right = 2047) == 476\n assert candidate(left = 800000,right = 801000) == 291\n assert candidate(left = 5000,right = 5100) == 37\n assert candidate(left = 800000,right = 800100) == 18\n assert candidate(left = 131070,right = 131080) == 8\n assert candidate(left = 1234,right = 5678) == 1954\n assert candidate(left = 999,right = 1010) == 5\n assert candidate(left = 543210,right = 543310) == 38\n assert candidate(left = 111111,right = 111211) == 20\n assert candidate(left = 1000,right = 2000) == 473\n assert candidate(left = 999950,right = 1000000) == 9\n assert candidate(left = 500000,right = 500100) == 24\n assert candidate(left = 500,right = 800) == 157\n assert candidate(left = 765432,right = 765532) == 40\n assert candidate(left = 65535,right = 65635) == 56\n assert candidate(left = 1000,right = 1200) == 102\n assert candidate(left = 75000,right = 80000) == 1371\n assert candidate(left = 5,right = 10000) == 4251\n assert candidate(left = 987654,right = 987754) == 16\n assert candidate(left = 999999,right = 1000010) == 1\n assert candidate(left = 5000,right = 5050) == 22\n assert candidate(left = 500000,right = 501000) == 310\n assert candidate(left = 50000,right = 60000) == 2742\n assert candidate(left = 104743,right = 104843) == 19\n assert candidate(left = 8192,right = 16384) == 2821\n assert candidate(left = 200,right = 300) == 55\n assert candidate(left = 999990,right = 1000010) == 5\n"}, "metadata": {"canonical_parameter_names": ["left", "right"], "leetcode_dataset_entry_point": "Solution().countPrimeSetBits", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var countPrimeSetBits = function(left, right) {", "container": null, "callable": "countPrimeSetBits", "parameters": [{"name": "left", "type": "number"}, {"name": "right", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 763, "task_id": "partition-labels", "difficulty": "Medium", "problem_description": "You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in at most one part. For example, the string \"ababcc\" can be partitioned into [\"abab\", \"cc\"], but partitions such as [\"aba\", \"bcc\"] or [\"ab\", \"ab\", \"cc\"] are invalid.\nNote that the partition is done so that after concatenating all the parts in order, the resultant string should be s.\nReturn a list of integers representing the size of these parts.\n \nExample 1:\n\nInput: s = \"ababcbacadefegdehijhklij\"\nOutput: [9,7,8]\nExplanation:\nThe partition is \"ababcbaca\", \"defegde\", \"hijhklij\".\nThis is a partition so that each letter appears in at most one part.\nA partition like \"ababcbacadefegde\", \"hijhklij\" is incorrect, because it splits s into less parts.\n\nExample 2:\n\nInput: s = \"eccbbbbdec\"\nOutput: [10]\n\n \nConstraints:\n\n1 <= s.length <= 500\ns consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"abcdabcde\") == [8, 1]\n assert candidate(s = \"aaaaaabbbbbccccc\") == [6, 5, 5]\n assert candidate(s = \"xyzxyzxyz\") == [9]\n assert candidate(s = \"aaaabbbbbccccc\") == [4, 5, 5]\n assert candidate(s = \"abcdabcdeabcdabcde\") == [18]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\") == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]\n assert candidate(s = \"zab\") == [1, 1, 1]\n assert candidate(s = \"a\") == [1]\n assert candidate(s = \"zabbcdefghijklmnopqrstuvwxyz\") == [28]\n assert candidate(s = \"aabbccddeee\") == [2, 2, 2, 2, 3]\n assert candidate(s = \"abcdcba\") == [7]\n assert candidate(s = \"ababababab\") == [10]\n assert candidate(s = \"zabzabc\") == [6, 1]\n assert candidate(s = \"abababab\") == [8]\n assert candidate(s = \"abcde\") == [1, 1, 1, 1, 1]\n assert candidate(s = \"ababcbacadefegdehijhklij\") == [9, 7, 8]\n assert candidate(s = \"eccbbbbdec\") == [10]\n assert candidate(s = \"abcabcdabcdeabcdefabcdefg\") == [24, 1]\n assert candidate(s = \"xyzzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyx\") == [66]\n assert candidate(s = \"aaaaaaaaaabbbbbbbbccccccccddddddddeeeeeeeefffffffffghhhhhhhhiiiiiiiijjjjjjjjkkkkkkkkllllllllmmmmmmmmnnnnnnnnooooooooppppppppqqqqqqqqrrrrrrrrssssssssttttttttuuuuuuuuvvvvvvvvwwwwwwwwxxxxxxxxxyyyyyyyyzzzzzzzz\") == [10, 8, 8, 8, 8, 9, 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8]\n assert candidate(s = \"abcdabcdeabcde\") == [14]\n assert candidate(s = \"aaaabbbbccccddddeeeeffffgggg\") == [4, 4, 4, 4, 4, 4, 4]\n assert candidate(s = \"abcadefeghijklmnopqrstuvwxyzzxywvutsrqponmlkjihgfedcba\") == [54]\n assert candidate(s = \"xyzzyxzyxzzyxzyxzyxzzyxzyxzyxzzyxzyxzzyxzyxzyxzzyxzyxzyxzzyxzyxzyxzyxzzyxzyxzyxzyx\") == [82]\n assert candidate(s = \"zzyzxzyzxzyz\") == [12]\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabc\") == [30]\n assert candidate(s = \"abacabadabacabadabacabadabacabad\") == [32]\n assert candidate(s = \"abcdexyzabcdexyzabcdexyzabcdexyz\") == [32]\n assert candidate(s = \"abcdefghfedcba\") == [14]\n assert candidate(s = \"abcdefghihgfedcbaijklmnopqrstuvutsrqponmlkjihgfedcba\") == [52]\n assert candidate(s = \"abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij\") == [80]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzyxwvutsrqponmlkjihgfedcba\") == [78]\n assert candidate(s = \"mnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba\") == [66]\n assert candidate(s = \"ababcbacadeafgafghijghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\") == [66]\n assert candidate(s = \"zzzyyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbaaazzzyyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbaaazzzyyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbaaazzzyyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbaaa\") == [212]\n assert candidate(s = \"abcdefgabcdefgabcdefg\") == [21]\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == [70]\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == [62]\n assert candidate(s = \"abcdefghihgfedcba\") == [17]\n assert candidate(s = \"abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefg\") == [63]\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == [66]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 36]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == [52]\n assert candidate(s = \"xyzxyzxyzxyzxyzxyzxyzxyzxyzxyz\") == [30]\n assert candidate(s = \"mnopqrsmnopqrstuvwpqrstuv\") == [25]\n assert candidate(s = \"abcabcabcabcabcabc\") == [18]\n assert candidate(s = \"lkjihgfedcbaedcba\") == [1, 1, 1, 1, 1, 1, 1, 10]\n assert candidate(s = \"abcdefghijkabcdefghijk\") == [22]\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == [52]\n assert candidate(s = \"abcdefedcbafedcba\") == [17]\n assert candidate(s = \"aaaaabbbbccccdddddeeeeefffffggggghhhhiiiiijjjjkkkkllllmmmmnnnnoooo\") == [5, 4, 4, 5, 5, 5, 5, 4, 5, 4, 4, 4, 4, 4, 4]\n assert candidate(s = \"mnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\") == [28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcbaabcdefghijklmnopqrstuvwxyz\") == [78]\n assert candidate(s = \"zabacabadefegdehijhklijkmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba\") == [63]\n assert candidate(s = \"mnopqrstuabcrstuvwxyzzyxwvutsrqponmlkjihgfedcba\") == [47]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzzzzzzzzzzzzzzzz\") == [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18]\n assert candidate(s = \"xyzxyzxyzxyz\") == [12]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba\") == [51]\n assert candidate(s = \"abacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbac\") == [64]\n assert candidate(s = \"aabababababcabcabcabcdabcdabcdabcdeabcdeabcdefabcdef\") == [52]\n assert candidate(s = \"zababzabz\") == [9]\n assert candidate(s = \"aabbccddeeffaabbccddeeff\") == [24]\n assert candidate(s = \"aaaabbbbccccddddeeeeffffgggghhhh\") == [4, 4, 4, 4, 4, 4, 4, 4]\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().partitionLabels", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var partitionLabels = function(s) {", "container": null, "callable": "partitionLabels", "parameters": [{"name": "s", "type": "string"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 764, "task_id": "largest-plus-sign", "difficulty": "Medium", "problem_description": "You are given an integer n. You have an n x n binary grid grid with all values initially 1's except for some indices given in the array mines. The ith element of the array mines is defined as mines[i] = [xi, yi] where grid[xi][yi] == 0.\nReturn the order of the largest axis-aligned plus sign of 1's contained in grid. If there is none, return 0.\nAn axis-aligned plus sign of 1's of order k has some center grid[r][c] == 1 along with four arms of length k - 1 going up, down, left, and right, and made of 1's. Note that there could be 0's or 1's beyond the arms of the plus sign, only the relevant area of the plus sign is checked for 1's.\n \nExample 1:\n\n\nInput: n = 5, mines = [[4,2]]\nOutput: 2\nExplanation: In the above grid, the largest plus sign can only be of order 2. One of them is shown.\n\nExample 2:\n\n\nInput: n = 1, mines = [[0,0]]\nOutput: 0\nExplanation: There is no plus sign, so return 0.\n\n \nConstraints:\n\n1 <= n <= 500\n1 <= mines.length <= 5000\n0 <= xi, yi < n\nAll the pairs (xi, yi) are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 7,mines = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 0], [1, 6], [2, 0], [2, 6], [3, 0], [3, 6], [4, 0], [4, 6], [5, 0], [5, 6], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]]) == 3\n assert candidate(n = 4,mines = [[0, 0], [0, 3], [3, 0], [3, 3]]) == 2\n assert candidate(n = 5,mines = [[1, 1], [1, 3], [3, 1], [3, 3]]) == 3\n assert candidate(n = 5,mines = [[0, 0], [0, 4], [4, 0], [4, 4]]) == 3\n assert candidate(n = 6,mines = [[1, 1], [2, 2], [3, 3], [4, 4]]) == 2\n assert candidate(n = 6,mines = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2], [3, 3]]) == 2\n assert candidate(n = 1,mines = [[0, 0]]) == 0\n assert candidate(n = 500,mines = [[250, 250]]) == 250\n assert candidate(n = 4,mines = [[0, 0], [3, 3]]) == 2\n assert candidate(n = 3,mines = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 2], [2, 0], [2, 1], [2, 2]]) == 1\n assert candidate(n = 3,mines = [[1, 1]]) == 1\n assert candidate(n = 5,mines = [[0, 1], [1, 0], [1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3]]) == 1\n assert candidate(n = 500,mines = []) == 250\n assert candidate(n = 4,mines = []) == 2\n assert candidate(n = 5,mines = [[4, 2]]) == 2\n assert candidate(n = 3,mines = [[0, 0], [1, 1], [2, 2]]) == 1\n assert candidate(n = 3,mines = []) == 2\n assert candidate(n = 6,mines = [[1, 2], [2, 1], [2, 3], [3, 2]]) == 2\n assert candidate(n = 100,mines = [[50, 50], [49, 49], [49, 51], [51, 49], [51, 51], [49, 50], [50, 49], [50, 51], [60, 60], [30, 30]]) == 49\n assert candidate(n = 15,mines = [[5, 5], [5, 6], [5, 7], [6, 5], [6, 7], [7, 5], [7, 6], [7, 7], [0, 0], [14, 14]]) == 7\n assert candidate(n = 500,mines = [[250, 250], [249, 249], [251, 251], [248, 248], [252, 252], [247, 247], [253, 253]]) == 247\n assert candidate(n = 25,mines = [[10, 10], [11, 11], [12, 12], [13, 13], [10, 12], [12, 10], [11, 9], [11, 13], [9, 11], [13, 11]]) == 11\n assert candidate(n = 10,mines = [[0, 0], [9, 9], [0, 9], [9, 0], [4, 4], [5, 5]]) == 4\n assert candidate(n = 10,mines = [[5, 5], [5, 6], [6, 5], [4, 5], [5, 4]]) == 4\n assert candidate(n = 15,mines = [[5, 5], [5, 6], [5, 7], [6, 5], [6, 7], [7, 5], [7, 6], [7, 7]]) == 7\n assert candidate(n = 75,mines = [[37, 37], [36, 36], [36, 38], [38, 36], [38, 38], [36, 37], [37, 36], [37, 38]]) == 36\n assert candidate(n = 30,mines = [[10, 10], [11, 10], [9, 10], [10, 9], [10, 11], [15, 15], [14, 15], [16, 15], [15, 14], [15, 16], [20, 20], [21, 20], [19, 20], [20, 19], [20, 21]]) == 14\n assert candidate(n = 20,mines = [[5, 5], [5, 14], [14, 5], [14, 14], [10, 10], [10, 9], [9, 10], [9, 9], [10, 8], [8, 10], [0, 0], [19, 19]]) == 9\n assert candidate(n = 500,mines = [[250, 250], [249, 249], [249, 251], [251, 249], [251, 251], [249, 250], [250, 249], [250, 251], [200, 200], [300, 300]]) == 249\n assert candidate(n = 7,mines = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0]]) == 2\n assert candidate(n = 100,mines = [[50, 50], [49, 49], [51, 51], [48, 48], [52, 52], [47, 47], [53, 53], [46, 46], [54, 54], [45, 45], [55, 55]]) == 45\n assert candidate(n = 500,mines = [[250, 250], [250, 251], [250, 249], [249, 250], [251, 250]]) == 249\n assert candidate(n = 10,mines = [[3, 3], [3, 4], [4, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]) == 3\n assert candidate(n = 12,mines = [[0, 0], [11, 11], [5, 5], [6, 5], [5, 6], [6, 6], [7, 7], [8, 8], [4, 4], [4, 3], [4, 2], [3, 4], [2, 4]]) == 4\n assert candidate(n = 20,mines = [[5, 5], [5, 6], [6, 5], [6, 6], [10, 10], [10, 11], [11, 10], [11, 11]]) == 10\n assert candidate(n = 7,mines = [[1, 2], [2, 2], [3, 2], [2, 1], [2, 3], [2, 4], [2, 5], [2, 6]]) == 2\n assert candidate(n = 6,mines = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0]]) == 1\n assert candidate(n = 25,mines = [[0, 0], [0, 1], [0, 2], [0, 22], [0, 23], [0, 24], [1, 0], [1, 24], [2, 0], [2, 24], [22, 0], [22, 24], [23, 0], [23, 24], [24, 0], [24, 1], [24, 2], [24, 22], [24, 23], [24, 24]]) == 13\n assert candidate(n = 20,mines = [[1, 1], [1, 18], [18, 1], [18, 18], [9, 9], [10, 10], [11, 11]]) == 9\n assert candidate(n = 10,mines = [[5, 5], [4, 4], [6, 6], [5, 4], [4, 5], [5, 6], [6, 5]]) == 4\n assert candidate(n = 100,mines = [[10, 10], [10, 11], [10, 12], [11, 10], [11, 12], [12, 10], [12, 11], [12, 12]]) == 50\n assert candidate(n = 200,mines = [[100, 100], [100, 101], [101, 100], [99, 99], [101, 99], [99, 101], [98, 98], [102, 102]]) == 98\n assert candidate(n = 10,mines = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 3\n assert candidate(n = 15,mines = [[7, 7], [7, 8], [7, 9], [8, 7], [8, 9], [9, 7], [9, 8], [9, 9], [5, 5], [5, 6], [5, 7], [6, 5], [6, 7], [7, 5], [7, 6], [7, 7], [8, 5], [8, 6], [8, 7]]) == 5\n assert candidate(n = 15,mines = [[3, 3], [3, 4], [3, 5], [4, 3], [4, 5], [5, 3], [5, 4], [5, 5]]) == 8\n assert candidate(n = 15,mines = [[7, 7], [7, 8], [8, 7], [8, 8], [7, 9], [8, 9], [9, 7], [9, 8], [9, 9]]) == 7\n assert candidate(n = 10,mines = [[0, 5], [5, 0], [5, 5], [9, 5], [5, 9]]) == 5\n assert candidate(n = 15,mines = [[7, 7], [7, 8], [8, 7], [8, 8], [6, 6], [6, 7], [6, 8], [6, 9], [7, 6], [7, 9], [8, 6], [8, 9], [9, 6], [9, 7], [9, 8], [9, 9], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [6, 5], [6, 10], [7, 5], [7, 10], [8, 5], [8, 10], [9, 5], [9, 10], [10, 5], [10, 6], [10, 7], [10, 8], [10, 9]]) == 5\n assert candidate(n = 25,mines = [[12, 12], [11, 11], [13, 13], [10, 10], [11, 10], [10, 11], [13, 12], [12, 11], [11, 13], [12, 13], [13, 11], [10, 12], [12, 10], [12, 14], [14, 12], [11, 12], [13, 12], [12, 11], [12, 13]]) == 10\n assert candidate(n = 10,mines = [[5, 5], [4, 4], [6, 6], [5, 6], [6, 5], [5, 4], [4, 5], [3, 3], [7, 7], [2, 2], [8, 8], [1, 1], [9, 9]]) == 3\n assert candidate(n = 7,mines = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]) == 3\n assert candidate(n = 25,mines = [[5, 5], [5, 19], [19, 5], [19, 19], [12, 12], [13, 13], [12, 13], [13, 12]]) == 12\n assert candidate(n = 7,mines = [[1, 2], [2, 2], [3, 2], [2, 1], [2, 3], [2, 4], [2, 5], [4, 2], [5, 2], [6, 2]]) == 2\n assert candidate(n = 8,mines = [[2, 2], [2, 3], [3, 2], [3, 3], [4, 4], [4, 5], [5, 4], [5, 5]]) == 2\n assert candidate(n = 7,mines = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]) == 2\n assert candidate(n = 10,mines = [[4, 4], [4, 5], [4, 6], [5, 4], [5, 5], [5, 6], [6, 4], [6, 5], [6, 6]]) == 4\n assert candidate(n = 30,mines = [[15, 15], [14, 14], [13, 13], [12, 12], [11, 11], [10, 10], [9, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1], [0, 0]]) == 14\n assert candidate(n = 10,mines = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 3], [3, 4], [4, 3], [4, 4], [5, 5], [5, 6], [6, 5], [6, 6], [7, 7], [7, 8], [8, 7], [8, 8]]) == 3\n assert candidate(n = 8,mines = [[1, 1], [1, 6], [6, 1], [6, 6], [2, 2], [2, 5], [5, 2], [5, 5]]) == 4\n assert candidate(n = 300,mines = [[150, 150], [149, 149], [149, 151], [151, 149], [151, 151], [149, 150], [150, 149], [150, 151], [100, 100], [200, 200]]) == 149\n assert candidate(n = 20,mines = [[10, 10], [10, 11], [11, 10], [11, 11], [9, 9], [9, 10], [9, 11], [10, 9], [11, 9], [8, 8], [8, 9], [8, 10], [8, 11], [8, 12], [9, 8], [9, 12], [10, 8], [10, 12], [11, 8], [11, 12], [12, 8], [12, 9], [12, 10], [12, 11], [12, 12], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [8, 7], [8, 13], [9, 7], [9, 13], [10, 7], [10, 13], [11, 7], [11, 13], [12, 7], [12, 13], [13, 7], [13, 8], [13, 9], [13, 10], [13, 11], [13, 12], [13, 13]]) == 7\n assert candidate(n = 20,mines = [[10, 10], [10, 9], [10, 8], [10, 7], [10, 6], [10, 5], [10, 4], [10, 3], [10, 2], [10, 1], [10, 0]]) == 9\n assert candidate(n = 50,mines = [[25, 25], [25, 24], [25, 23], [25, 22], [25, 21], [25, 20], [25, 19], [25, 18], [25, 17], [25, 16], [25, 15], [25, 14], [25, 13], [25, 12], [25, 11], [25, 10], [25, 9], [25, 8], [25, 7], [25, 6], [25, 5], [25, 4], [25, 3], [25, 2], [25, 1], [25, 0]]) == 24\n assert candidate(n = 100,mines = [[49, 49], [50, 49], [51, 49], [49, 50], [50, 50], [51, 50], [49, 51], [50, 51], [51, 51], [20, 20], [21, 20], [19, 20], [20, 19], [20, 21]]) == 49\n assert candidate(n = 20,mines = [[10, 10], [10, 11], [10, 12], [10, 9], [9, 10], [9, 11], [9, 12], [9, 9], [11, 10], [11, 11], [11, 12], [11, 9]]) == 9\n assert candidate(n = 30,mines = [[15, 14], [15, 15], [15, 16], [14, 14], [14, 15], [14, 16], [16, 14], [16, 15], [16, 16], [15, 0], [15, 1], [15, 29], [14, 0], [14, 1], [14, 29], [16, 0], [16, 1], [16, 29], [0, 15], [1, 15], [29, 15], [0, 14], [0, 16], [29, 14], [29, 16]]) == 14\n assert candidate(n = 50,mines = [[25, 24], [25, 25], [25, 26], [24, 24], [24, 25], [24, 26], [26, 24], [26, 25], [26, 26], [10, 10], [10, 11], [10, 12], [9, 10], [9, 11], [9, 12], [11, 10], [11, 11], [11, 12]]) == 24\n assert candidate(n = 20,mines = [[9, 9], [9, 10], [10, 9], [8, 9], [9, 8], [9, 11], [11, 9], [7, 9], [9, 7], [10, 10]]) == 8\n assert candidate(n = 8,mines = [[3, 3], [4, 4], [5, 5], [3, 4], [4, 3], [3, 5], [4, 5], [5, 3], [5, 4], [5, 6], [6, 5], [6, 3], [6, 4]]) == 3\n assert candidate(n = 300,mines = [[150, 150], [151, 151], [149, 149], [152, 152], [148, 148]]) == 148\n assert candidate(n = 6,mines = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0]]) == 3\n assert candidate(n = 30,mines = [[0, 0], [0, 1], [0, 2], [0, 27], [0, 28], [0, 29], [1, 0], [1, 29], [2, 0], [2, 29], [27, 0], [27, 29], [28, 0], [28, 29], [29, 0], [29, 1], [29, 2], [29, 27], [29, 28], [29, 29], [10, 10], [10, 19], [19, 10], [19, 19]]) == 15\n assert candidate(n = 10,mines = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9]]) == 5\n assert candidate(n = 25,mines = [[5, 5], [5, 6], [5, 7], [6, 5], [6, 6], [6, 7], [7, 5], [7, 6], [7, 7], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15]]) == 10\n assert candidate(n = 15,mines = [[7, 7], [7, 8], [8, 7], [6, 7], [7, 6], [7, 9], [9, 7]]) == 6\n assert candidate(n = 10,mines = [[5, 5], [4, 5], [6, 5], [5, 4], [5, 6], [0, 0], [9, 9], [0, 9], [9, 0]]) == 4\n assert candidate(n = 20,mines = [[10, 10], [9, 10], [11, 10], [10, 9], [10, 11], [5, 5], [15, 15], [0, 0], [19, 19], [1, 1], [18, 18]]) == 9\n assert candidate(n = 15,mines = [[7, 7], [7, 8], [8, 7], [8, 8], [6, 6], [6, 7], [7, 6], [6, 8], [8, 6], [8, 9], [9, 8], [7, 9], [9, 7]]) == 6\n assert candidate(n = 12,mines = [[5, 5], [5, 6], [5, 7], [6, 5], [6, 6], [6, 7], [7, 5], [7, 6], [7, 7], [0, 0], [11, 11]]) == 5\n assert candidate(n = 500,mines = [[250, 250], [251, 250], [249, 250], [250, 251], [250, 249]]) == 249\n assert candidate(n = 50,mines = [[25, 25], [24, 24], [24, 26], [26, 24], [26, 26], [10, 10], [10, 39], [39, 10], [39, 39]]) == 24\n assert candidate(n = 500,mines = [[250, 250], [249, 249], [251, 251], [248, 248], [252, 252], [247, 247], [253, 253], [246, 246], [254, 254], [245, 245], [255, 255]]) == 245\n assert candidate(n = 10,mines = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [1, 0], [1, 9], [2, 0], [2, 9], [3, 0], [3, 9], [4, 0], [4, 9], [5, 0], [5, 9], [6, 0], [6, 9], [7, 0], [7, 9], [8, 0], [8, 9], [9, 0], [9, 1], [9, 2], [9, 3], [9, 4], [9, 5], [9, 6], [9, 7], [9, 8]]) == 4\n assert candidate(n = 500,mines = [[250, 250], [250, 251], [251, 250], [251, 251]]) == 250\n assert candidate(n = 7,mines = [[3, 3], [3, 4], [4, 3], [4, 4], [2, 2], [2, 4], [4, 2], [5, 3], [3, 5], [5, 5]]) == 2\n assert candidate(n = 30,mines = [[10, 10], [10, 11], [10, 12], [11, 10], [11, 11], [11, 12], [12, 10], [12, 11], [12, 12], [15, 15], [15, 16], [15, 17], [16, 15], [16, 16], [16, 17], [17, 15], [17, 16], [17, 17]]) == 15\n assert candidate(n = 12,mines = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11]]) == 4\n assert candidate(n = 10,mines = [[4, 5], [4, 4], [4, 3], [4, 2], [4, 1], [4, 0], [4, 6], [4, 7], [4, 8], [4, 9]]) == 3\n assert candidate(n = 15,mines = [[7, 7], [7, 8], [7, 9], [8, 7], [8, 8], [8, 9], [9, 7], [9, 8], [9, 9], [6, 6], [6, 10], [10, 6], [10, 10]]) == 6\n assert candidate(n = 400,mines = [[200, 200], [199, 199], [199, 201], [201, 199], [201, 201], [199, 200], [200, 199], [200, 201], [150, 150], [250, 250]]) == 199\n assert candidate(n = 8,mines = [[3, 3], [3, 4], [3, 5], [4, 3], [4, 4], [4, 5], [5, 3], [5, 4], [5, 5], [3, 2], [4, 2], [5, 2], [3, 6], [4, 6], [5, 6], [2, 3], [2, 4], [2, 5], [6, 3], [6, 4], [6, 5]]) == 2\n"}, "metadata": {"canonical_parameter_names": ["n", "mines"], "leetcode_dataset_entry_point": "Solution().orderOfLargestPlusSign", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var orderOfLargestPlusSign = function(n, mines) {", "container": null, "callable": "orderOfLargestPlusSign", "parameters": [{"name": "n", "type": "number"}, {"name": "mines", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 765, "task_id": "couples-holding-hands", "difficulty": "Hard", "problem_description": "There are n couples sitting in 2n seats arranged in a row and want to hold hands.\nThe people and seats are represented by an integer array row where row[i] is the ID of the person sitting in the ith seat. The couples are numbered in order, the first couple being (0, 1), the second couple being (2, 3), and so on with the last couple being (2n - 2, 2n - 1).\nReturn the minimum number of swaps so that every couple is sitting side by side. A swap consists of choosing any two people, then they stand up and switch seats.\n \nExample 1:\n\nInput: row = [0,2,1,3]\nOutput: 1\nExplanation: We only need to swap the second (row[1]) and third (row[2]) person.\n\nExample 2:\n\nInput: row = [3,2,0,1]\nOutput: 0\nExplanation: All couples are already seated side by side.\n\n \nConstraints:\n\n2n == row.length\n2 <= n <= 30\nn is even.\n0 <= row[i] < 2n\nAll the elements of row are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(row = [2, 0, 5, 4, 3, 1]) == 1\n assert candidate(row = [0, 1, 2, 3]) == 0\n assert candidate(row = [0, 2, 1, 3]) == 1\n assert candidate(row = [4, 3, 2, 1, 0, 5]) == 2\n assert candidate(row = [2, 0, 5, 4, 3, 6, 7, 1]) == 2\n assert candidate(row = [0, 2, 4, 6, 7, 1, 3, 5]) == 3\n assert candidate(row = [0, 1, 2, 3, 4, 5]) == 0\n assert candidate(row = [4, 3, 2, 5, 1, 6, 7, 8, 9, 0]) == 3\n assert candidate(row = [5, 4, 3, 2, 1, 0]) == 0\n assert candidate(row = [5, 4, 2, 6, 3, 1, 7, 0]) == 2\n assert candidate(row = [1, 4, 0, 5, 8, 7, 6, 3, 2, 9]) == 3\n assert candidate(row = [4, 6, 2, 8, 5, 3, 7, 0, 1, 9]) == 4\n assert candidate(row = [2, 0, 1, 3]) == 1\n assert candidate(row = [6, 2, 1, 7, 4, 5, 0, 3]) == 2\n assert candidate(row = [0, 5, 4, 2, 1, 6, 7, 3, 8, 9]) == 3\n assert candidate(row = [3, 2, 0, 1]) == 0\n assert candidate(row = [1, 3, 2, 0]) == 1\n assert candidate(row = [0, 29, 1, 28, 2, 27, 3, 26, 4, 25, 5, 24, 6, 23, 7, 22, 8, 21, 9, 20, 10, 19, 11, 18, 12, 17, 13, 16, 14, 15]) == 7\n assert candidate(row = [0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15]) == 0\n assert candidate(row = [4, 5, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11, 6, 7, 20, 21, 22, 23, 24, 25, 16, 17, 18, 19, 26, 27, 28, 29, 30, 31]) == 0\n assert candidate(row = [0, 1, 4, 5, 2, 3, 6, 7, 10, 11, 8, 9, 12, 13, 14, 15]) == 0\n assert candidate(row = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 0\n assert candidate(row = [14, 4, 13, 3, 12, 2, 11, 1, 10, 0, 9, 5, 8, 6, 7, 15]) == 5\n assert candidate(row = [0, 3, 2, 1, 8, 7, 6, 5, 4, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]) == 3\n assert candidate(row = [27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 0\n assert candidate(row = [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 15]) == 7\n assert candidate(row = [0, 15, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1]) == 1\n assert candidate(row = [14, 15, 12, 13, 6, 7, 10, 11, 2, 3, 0, 1, 8, 9, 4, 5]) == 0\n assert candidate(row = [1, 2, 3, 0, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30]) == 1\n assert candidate(row = [14, 13, 12, 15, 10, 9, 8, 11, 6, 7, 4, 5, 2, 3, 0, 1]) == 2\n assert candidate(row = [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 17]) == 8\n assert candidate(row = [0, 8, 2, 12, 4, 6, 10, 14, 1, 9, 3, 13, 5, 7, 11, 15]) == 4\n assert candidate(row = [1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10]) == 0\n assert candidate(row = [1, 2, 3, 0, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28]) == 1\n assert candidate(row = [26, 27, 20, 21, 22, 23, 24, 25, 18, 19, 30, 29, 10, 11, 8, 9, 6, 7, 2, 3, 0, 1, 16, 17, 4, 5, 12, 13, 14, 15, 28, 29]) == 1\n assert candidate(row = [29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 0\n assert candidate(row = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11]) == 7\n assert candidate(row = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 14\n assert candidate(row = [1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]) == 0\n assert candidate(row = [29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28]) == 7\n assert candidate(row = [14, 15, 8, 9, 10, 11, 6, 7, 2, 3, 0, 1, 12, 13, 4, 5]) == 0\n assert candidate(row = [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19, 22, 21, 24, 23, 26, 25, 28, 29, 27]) == 14\n assert candidate(row = [5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7, 6]) == 0\n assert candidate(row = [0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15]) == 4\n assert candidate(row = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16]) == 0\n assert candidate(row = [10, 11, 8, 9, 6, 7, 2, 3, 0, 1, 4, 5, 12, 13, 14, 15]) == 0\n assert candidate(row = [1, 3, 5, 7, 9, 11, 13, 15, 0, 2, 4, 6, 8, 10, 12, 14]) == 4\n assert candidate(row = [15, 2, 13, 3, 14, 11, 9, 12, 5, 6, 7, 8, 10, 0, 1, 4]) == 7\n assert candidate(row = [22, 23, 18, 19, 12, 13, 28, 27, 20, 21, 24, 25, 16, 17, 8, 9, 26, 29, 2, 3, 0, 1, 14, 15, 6, 7, 10, 11, 4, 5]) == 1\n assert candidate(row = [10, 9, 8, 11, 6, 7, 4, 3, 2, 5, 0, 1]) == 2\n assert candidate(row = [0, 2, 1, 3, 4, 6, 5, 7, 8, 10, 9, 11, 12, 14, 13, 15]) == 4\n assert candidate(row = [14, 15, 10, 2, 13, 3, 8, 9, 6, 7, 0, 1, 12, 11, 4, 5]) == 2\n assert candidate(row = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0]) == 14\n assert candidate(row = [0, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 14\n assert candidate(row = [1, 2, 3, 0, 7, 5, 6, 4, 11, 9, 10, 8]) == 3\n assert candidate(row = [14, 13, 10, 8, 12, 15, 0, 2, 4, 5, 1, 3, 6, 7, 9, 11]) == 3\n assert candidate(row = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 0\n assert candidate(row = [10, 1, 2, 5, 4, 3, 8, 7, 6, 11, 9, 12, 14, 13, 15, 0]) == 6\n assert candidate(row = [14, 13, 12, 15, 10, 9, 8, 11, 6, 7, 4, 5, 2, 3, 0, 1]) == 2\n assert candidate(row = [1, 2, 0, 3, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]) == 1\n assert candidate(row = [12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 0\n assert candidate(row = [10, 8, 9, 7, 6, 5, 4, 3, 2, 1, 0, 11]) == 5\n assert candidate(row = [29, 28, 25, 24, 27, 26, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 0\n assert candidate(row = [1, 3, 0, 2, 5, 7, 4, 6, 9, 11, 8, 10, 13, 15, 12, 14]) == 4\n assert candidate(row = [14, 13, 12, 15, 2, 3, 0, 1, 10, 11, 8, 9, 6, 7, 4, 5]) == 1\n assert candidate(row = [2, 3, 0, 1, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15]) == 3\n assert candidate(row = [14, 15, 8, 13, 12, 9, 0, 1, 2, 11, 10, 3, 6, 5, 4, 7]) == 3\n assert candidate(row = [0, 3, 5, 2, 1, 6, 7, 4, 8, 9, 10, 11]) == 3\n assert candidate(row = [1, 3, 2, 6, 5, 4, 7, 8, 9, 11, 10, 15, 14, 13, 12, 0]) == 6\n assert candidate(row = [28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 7\n assert candidate(row = [1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26]) == 0\n assert candidate(row = [3, 2, 1, 0, 5, 4, 7, 6, 9, 8, 11, 10, 15, 14, 13, 12, 17, 16, 19, 18]) == 0\n assert candidate(row = [28, 29, 24, 25, 26, 27, 20, 21, 22, 23, 18, 19, 10, 11, 8, 9, 6, 7, 2, 3, 0, 1, 16, 17, 4, 5, 12, 13, 14, 15, 30, 29]) == 1\n assert candidate(row = [6, 5, 0, 4, 3, 2, 7, 1, 10, 9, 8, 11]) == 3\n assert candidate(row = [8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 10, 11]) == 4\n assert candidate(row = [1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 0\n assert candidate(row = [0, 1, 14, 15, 6, 7, 2, 3, 8, 9, 4, 5, 12, 13, 10, 11, 22, 23, 16, 17, 18, 19, 20, 21, 24, 25, 26, 27, 28, 29]) == 0\n assert candidate(row = [0, 3, 2, 1, 4, 7, 6, 5, 8, 11, 10, 9, 12, 15, 14, 13]) == 4\n assert candidate(row = [18, 19, 16, 17, 14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1]) == 0\n assert candidate(row = [2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9]) == 0\n assert candidate(row = [28, 29, 26, 27, 24, 25, 22, 23, 20, 21, 18, 19, 16, 17, 14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1]) == 0\n"}, "metadata": {"canonical_parameter_names": ["row"], "leetcode_dataset_entry_point": "Solution().minSwapsCouples", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minSwapsCouples = function(row) {", "container": null, "callable": "minSwapsCouples", "parameters": [{"name": "row", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 766, "task_id": "toeplitz-matrix", "difficulty": "Easy", "problem_description": "Given an m x n matrix, return true if the matrix is Toeplitz. Otherwise, return false.\nA matrix is Toeplitz if every diagonal from top-left to bottom-right has the same elements.\n \nExample 1:\n\n\nInput: matrix = [[1,2,3,4],[5,1,2,3],[9,5,1,2]]\nOutput: true\nExplanation:\nIn the above grid, the diagonals are:\n\"[9]\", \"[5, 5]\", \"[1, 1, 1]\", \"[2, 2, 2]\", \"[3, 3]\", \"[4]\".\nIn each diagonal all elements are the same, so the answer is True.\n\nExample 2:\n\n\nInput: matrix = [[1,2],[2,2]]\nOutput: false\nExplanation:\nThe diagonal \"[1, 2]\" has different elements.\n\n \nConstraints:\n\nm == matrix.length\nn == matrix[i].length\n1 <= m, n <= 20\n0 <= matrix[i][j] <= 99\n\n \nFollow up:\n\nWhat if the matrix is stored on disk, and the memory is limited such that you can only load at most one row of the matrix into the memory at once?\nWhat if the matrix is so large that you can only load up a partial row into the memory at once?\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(matrix = [[3, 4, 5], [6, 3, 4], [7, 6, 3]]) == True\n assert candidate(matrix = [[1, 2, 3], [4, 1, 2], [7, 4, 1]]) == True\n assert candidate(matrix = [[1]]) == True\n assert candidate(matrix = [[1, 2], [3, 4]]) == False\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == False\n assert candidate(matrix = [[1, 1], [1, 1], [1, 1]]) == True\n assert candidate(matrix = [[3, 3, 3], [3, 3, 3], [3, 3, 3]]) == True\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6]]) == False\n assert candidate(matrix = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == True\n assert candidate(matrix = [[1, 2], [2, 2]]) == False\n assert candidate(matrix = [[1, 2, 3, 4], [5, 1, 2, 3], [9, 5, 1, 2]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6, 7, 8], [9, 1, 2, 3, 4, 5, 6, 7], [17, 9, 1, 2, 3, 4, 5, 6], [25, 17, 9, 1, 2, 3, 4, 5]]) == True\n assert candidate(matrix = [[9, 8, 7, 6], [8, 9, 8, 7], [7, 8, 9, 8], [6, 7, 8, 9]]) == True\n assert candidate(matrix = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6], [7, 1, 2, 3, 4, 5], [8, 7, 1, 2, 3, 4], [9, 8, 7, 1, 2, 3]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5], [6, 1, 2, 3, 4], [11, 6, 1, 2, 3], [17, 11, 6, 1, 2]]) == True\n assert candidate(matrix = [[1, 0, 0, 0], [1, 1, 0, 0], [1, 1, 1, 0], [1, 1, 1, 1]]) == True\n assert candidate(matrix = [[1, 2, 2], [3, 1, 2], [4, 3, 1]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5], [6, 1, 2, 3, 4], [11, 6, 1, 2, 3], [16, 11, 6, 1, 2], [21, 16, 11, 6, 1]]) == True\n assert candidate(matrix = [[5, 6, 7, 8], [4, 5, 6, 7], [3, 4, 5, 6], [2, 3, 4, 5], [1, 2, 3, 4]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 6, 7, 8, 9], [12, 13, 6, 7, 8]]) == False\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 1, 2, 3, 4, 5, 6, 7, 8], [19, 10, 1, 2, 3, 4, 5, 6, 7], [28, 19, 10, 1, 2, 3, 4, 5, 6]]) == True\n assert candidate(matrix = [[3, 4, 5, 6, 7, 8], [2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6], [0, 1, 2, 3, 4, 5]]) == True\n assert candidate(matrix = [[7, 8, 9], [1, 7, 8], [2, 1, 7], [3, 2, 1]]) == True\n assert candidate(matrix = [[7, 7, 7, 7], [7, 7, 7, 7], [7, 7, 7, 7], [7, 7, 7, 7]]) == True\n assert candidate(matrix = [[9], [8], [7], [6], [5]]) == True\n assert candidate(matrix = [[1, 2, 2], [4, 1, 2], [7, 4, 1]]) == True\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 1, 1], [3, 2, 1, 1, 1, 1], [4, 3, 2, 1, 1, 1]]) == True\n assert candidate(matrix = [[5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5]]) == True\n assert candidate(matrix = [[3, 8, 4, 2], [6, 3, 8, 4], [7, 6, 3, 8]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5], [6, 1, 2, 3, 4], [7, 6, 1, 2, 3], [8, 7, 6, 1, 2], [9, 8, 7, 6, 1]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6], [7, 1, 2, 3, 4, 5], [13, 7, 1, 2, 3, 4], [19, 13, 7, 1, 2, 3]]) == True\n assert candidate(matrix = [[10, 11, 12, 13], [14, 10, 11, 12], [15, 14, 10, 11]]) == True\n assert candidate(matrix = [[9, 8, 7, 6, 5], [8, 7, 6, 5, 4], [7, 6, 5, 4, 3], [6, 5, 4, 3, 2]]) == False\n assert candidate(matrix = [[1, 2, 3, 4], [5, 1, 2, 9], [9, 5, 1, 10]]) == False\n assert candidate(matrix = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == True\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) == False\n assert candidate(matrix = [[0, 1, 2, 3, 4, 5], [0, 0, 1, 2, 3, 4], [0, 0, 0, 1, 2, 3], [0, 0, 0, 0, 1, 2], [0, 0, 0, 0, 0, 1]]) == True\n assert candidate(matrix = [[10, 20, 30], [20, 10, 20], [30, 20, 10]]) == True\n assert candidate(matrix = [[1, 2, 3], [2, 3, 4], [3, 4, 5]]) == False\n assert candidate(matrix = [[5, 6, 7], [8, 5, 6], [9, 8, 5], [10, 9, 8]]) == True\n assert candidate(matrix = [[9, 8, 7], [8, 7, 6], [7, 6, 5], [6, 5, 4]]) == False\n assert candidate(matrix = [[1, 2], [2, 1], [3, 2], [4, 3]]) == True\n assert candidate(matrix = [[1, 0, 0, 0], [2, 1, 0, 0], [3, 2, 1, 0], [4, 3, 2, 1]]) == True\n assert candidate(matrix = [[10, 11, 12], [13, 10, 11], [14, 13, 10]]) == True\n assert candidate(matrix = [[1, 2], [3, 1], [4, 3], [5, 4], [6, 5]]) == True\n assert candidate(matrix = [[9, 8, 7, 6], [8, 7, 6, 5], [7, 6, 5, 4], [6, 5, 4, 3]]) == False\n assert candidate(matrix = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) == True\n assert candidate(matrix = [[10, 11, 12, 13, 14], [5, 10, 11, 12, 13], [0, 5, 10, 11, 12], [9, 0, 5, 10, 11]]) == True\n assert candidate(matrix = [[0, 1, 2, 3], [1, 0, 1, 2], [2, 1, 0, 1]]) == True\n assert candidate(matrix = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == True\n assert candidate(matrix = [[5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5]]) == True\n assert candidate(matrix = [[4, 5, 6, 7], [1, 4, 5, 6], [2, 1, 4, 5], [3, 2, 1, 4], [4, 3, 2, 1]]) == True\n assert candidate(matrix = [[7, 8, 9, 10], [4, 7, 8, 9], [1, 4, 7, 8], [0, 1, 4, 7]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18]]) == False\n assert candidate(matrix = [[1, 2], [2, 1], [1, 2]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 2, 3, 4, 5], [5, 4, 3, 2, 1]]) == False\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 1, 2, 3, 4, 5, 6, 7, 8, 9], [21, 11, 1, 2, 3, 4, 5, 6, 7, 8], [31, 21, 11, 1, 2, 3, 4, 5, 6, 7], [41, 31, 21, 11, 1, 2, 3, 4, 5, 6]]) == True\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]) == False\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]) == False\n assert candidate(matrix = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7]]) == False\n assert candidate(matrix = [[3, 3, 3, 3], [3, 3, 3, 3], [3, 3, 3, 3], [3, 3, 3, 3]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5], [6, 1, 2, 3, 4], [7, 6, 1, 2, 3], [8, 7, 6, 1, 2]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5], [6, 1, 2, 3, 4], [11, 6, 1, 2, 3], [12, 11, 6, 1, 2]]) == True\n assert candidate(matrix = [[1, 2, 3, 4], [5, 1, 2, 3], [9, 5, 1, 2], [8, 9, 5, 1]]) == True\n assert candidate(matrix = [[1, 2, 3], [2, 3, 4], [1, 2, 3]]) == False\n assert candidate(matrix = [[1, 2], [2, 3], [3, 4], [4, 5]]) == False\n assert candidate(matrix = [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]]) == False\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6, 7], [8, 1, 2, 3, 4, 5, 6], [15, 8, 1, 2, 3, 4, 5], [22, 15, 8, 1, 2, 3, 4]]) == True\n assert candidate(matrix = [[9, 8, 7], [8, 9, 8], [7, 8, 9]]) == True\n assert candidate(matrix = [[10, 11, 12, 13, 14], [9, 10, 11, 12, 13], [8, 9, 10, 11, 12], [7, 8, 9, 10, 11]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8], [0, 0, 1, 2, 3, 4, 5, 6, 7], [0, 0, 0, 1, 2, 3, 4, 5, 6], [0, 0, 0, 0, 1, 2, 3, 4, 5]]) == True\n assert candidate(matrix = [[5], [4], [3], [2], [1]]) == True\n assert candidate(matrix = [[1, 2, 3, 4], [4, 1, 2, 3], [3, 4, 1, 2], [2, 3, 4, 1]]) == True\n assert candidate(matrix = [[1, 1, 1, 2], [1, 1, 2, 3], [1, 2, 3, 4]]) == False\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6], [7, 8]]) == False\n assert candidate(matrix = [[5, 4, 3], [6, 5, 4], [7, 6, 5], [8, 7, 6]]) == True\n assert candidate(matrix = [[5, 6, 7, 8], [4, 5, 6, 7], [3, 4, 5, 6], [2, 3, 4, 5]]) == True\n assert candidate(matrix = [[1, 2, 3, 4], [2, 1, 2, 3], [3, 2, 1, 2], [4, 3, 2, 1]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [2, 1, 2, 3, 4, 5, 6, 7, 8], [3, 2, 1, 2, 3, 4, 5, 6, 7], [4, 3, 2, 1, 2, 3, 4, 5, 6]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6, 7], [3, 4, 5, 6, 7, 8], [4, 5, 6, 7, 8, 9]]) == False\n assert candidate(matrix = [[9, 8, 7, 6, 5], [8, 9, 8, 7, 6], [7, 8, 9, 8, 7], [6, 7, 8, 9, 8]]) == True\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == True\n assert candidate(matrix = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]]) == False\n"}, "metadata": {"canonical_parameter_names": ["matrix"], "leetcode_dataset_entry_point": "Solution().isToeplitzMatrix", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isToeplitzMatrix = function(matrix) {", "container": null, "callable": "isToeplitzMatrix", "parameters": [{"name": "matrix", "type": "number[][]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 767, "task_id": "reorganize-string", "difficulty": "Medium", "problem_description": "Given a string s, rearrange the characters of s so that any two adjacent characters are not the same.\nReturn any possible rearrangement of s or return \"\" if not possible.\n \nExample 1:\nInput: s = \"aab\"\nOutput: \"aba\"\nExample 2:\nInput: s = \"aaab\"\nOutput: \"\"\n\n \nConstraints:\n\n1 <= s.length <= 500\ns consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"aaabc\") == \"abaca\"\n assert candidate(s = \"aabbccc\") == \"cacbcba\"\n assert candidate(s = \"abcdefg\") == \"aebfcgd\"\n assert candidate(s = \"aaabbbccc\") == \"abacacbcb\"\n assert candidate(s = \"aabbccddeeffgghhijklmnop\") == \"agagbhbhcicjdkdlemenfofp\"\n assert candidate(s = \"abbabbaaa\") == \"ababababa\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\") == \"anbocpdqerfsgthuivjwkxlymz\"\n assert candidate(s = \"aabac\") == \"abaca\"\n assert candidate(s = \"zzzza\") == \"\"\n assert candidate(s = \"aabbccddeeffgghhijklmnopqrstuvwxy\") == \"ajakblbmcncodpdqeresftfugvgwhxhyi\"\n assert candidate(s = \"aabbaa\") == \"\"\n assert candidate(s = \"aabbbb\") == \"\"\n assert candidate(s = \"abababab\") == \"abababab\"\n assert candidate(s = \"aaabbbcccd\") == \"abacacbcbd\"\n assert candidate(s = \"aabbbcccc\") == \"cbcbcacab\"\n assert candidate(s = \"aabbccddeeffgghhijklmnopqr\") == \"agahbhbicjckdldmeneofpfqgr\"\n assert candidate(s = \"aabbccddeeffgghhijklmnopqrs\") == \"ahahbibjckcldmdneoepfqfrgsg\"\n assert candidate(s = \"aabbccddeeffgghhijklmnopqrstuvwxyz\") == \"ajakblbmcncodpdqeresftfugvgwhxhyiz\"\n assert candidate(s = \"aabbccddeeffgghhij\") == \"aeafbfbgcgchdhdiej\"\n assert candidate(s = \"aaaaabc\") == \"\"\n assert candidate(s = \"zzzzzzz\") == \"\"\n assert candidate(s = \"a\") == \"a\"\n assert candidate(s = \"aabbc\") == \"abacb\"\n assert candidate(s = \"zzzzzaabbcc\") == \"zazbzbzczca\"\n assert candidate(s = \"aa\") == \"\"\n assert candidate(s = \"aabbccddeeffgghhi\") == \"aeafbfbgcgchdhdie\"\n assert candidate(s = \"aaabbcc\") == \"abacacb\"\n assert candidate(s = \"abcabc\") == \"abacbc\"\n assert candidate(s = \"aabb\") == \"abab\"\n assert candidate(s = \"aabbccddeeffgghhijklmnopqrstuvw\") == \"aiajbkblcmcndodpeqerfsftgugvhwh\"\n assert candidate(s = \"vvvlo\") == \"vlvov\"\n assert candidate(s = \"abc\") == \"acb\"\n assert candidate(s = \"aabbccddeeffgghhijklmnopqrstuvwx\") == \"aiajbkblcmcndodpeqerfsftgugvhwhx\"\n assert candidate(s = \"aabbccddeeffgghhijkl\") == \"afafbgbgchchdidjekel\"\n assert candidate(s = \"aabbccddeeffgghhijklmnopqrst\") == \"ahahbibjckcldmdneoepfqfrgsgt\"\n assert candidate(s = \"geeksforgeeks\") == \"ekesesefgogrk\"\n assert candidate(s = \"aabbccddeeffgghhijklm\") == \"afagbgbhchcidjdkelemf\"\n assert candidate(s = \"aabbccddeeffgg\") == \"adaebebfcfcgdg\"\n assert candidate(s = \"aaabcbb\") == \"ababacb\"\n assert candidate(s = \"aabbccddeeffgghh\") == \"aeaebfbfcgcgdhdh\"\n assert candidate(s = \"bfrbs\") == \"brbsf\"\n assert candidate(s = \"aab\") == \"aba\"\n assert candidate(s = \"aabbccddeeffgghhijklmnopqrstuv\") == \"ahaibjbkclcmdndoepeqfrfsgtguhv\"\n assert candidate(s = \"aabbcc\") == \"abacbc\"\n assert candidate(s = \"mississippi\") == \"isisipipsms\"\n assert candidate(s = \"zzzzz\") == \"\"\n assert candidate(s = \"zmrlllllll\") == \"\"\n assert candidate(s = \"ababab\") == \"ababab\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == \"ananbobocpcpdqdqererfsfsgtgthuhuivivjwjwkxkxlylymzmz\"\n assert candidate(s = \"programming\") == \"rprogagimnm\"\n assert candidate(s = \"abacaba\") == \"ababaca\"\n assert candidate(s = \"zzzzzzzz\") == \"\"\n assert candidate(s = \"aaaabc\") == \"\"\n assert candidate(s = \"aabbccddeeffgghhijklmnopq\") == \"agahbhbicjckdldmeneofpfqg\"\n assert candidate(s = \"aabbccddeeffgghhijklmnopqrstu\") == \"ahaibjbkclcmdndoepeqfrfsgtguh\"\n assert candidate(s = \"aaab\") == \"\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().reorganizeString", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var reorganizeString = function(s) {", "container": null, "callable": "reorganizeString", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 768, "task_id": "max-chunks-to-make-sorted-ii", "difficulty": "Hard", "problem_description": "You are given an integer array arr.\nWe split arr into some number of chunks (i.e., partitions), and individually sort each chunk. After concatenating them, the result should equal the sorted array.\nReturn the largest number of chunks we can make to sort the array.\n \nExample 1:\n\nInput: arr = [5,4,3,2,1]\nOutput: 1\nExplanation:\nSplitting into two or more chunks will not return the required result.\nFor example, splitting into [5, 4], [3, 2, 1] will result in [4, 5, 1, 2, 3], which isn't sorted.\n\nExample 2:\n\nInput: arr = [2,1,3,4,4]\nOutput: 4\nExplanation:\nWe can split into two chunks, such as [2, 1], [3, 4, 4].\nHowever, splitting into [2, 1], [3], [4], [4] is the highest number of chunks possible.\n\n \nConstraints:\n\n1 <= arr.length <= 2000\n0 <= arr[i] <= 108\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [3, 2, 1, 0, 4, 5, 6, 7, 8, 9]) == 7\n assert candidate(arr = [5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [3, 2, 1, 4, 5]) == 3\n assert candidate(arr = [4, 3, 2, 1, 0, 9, 8, 7, 6, 5]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5]) == 5\n assert candidate(arr = [4, 2, 2, 1, 3]) == 1\n assert candidate(arr = [0, 1, 2, 3, 4]) == 5\n assert candidate(arr = [1, 2, 0, 3, 4, 5]) == 4\n assert candidate(arr = [1, 0, 2, 3, 4]) == 4\n assert candidate(arr = [2, 1, 3, 4, 4]) == 4\n assert candidate(arr = [0, 2, 1, 2, 1]) == 2\n assert candidate(arr = [1, 1, 1, 1, 1]) == 5\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [1, 0, 2, 0, 3]) == 2\n assert candidate(arr = [1, 1, 0, 0, 1]) == 2\n assert candidate(arr = [0, 0, 1, 1, 2, 2, 3, 3]) == 8\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16]) == 9\n assert candidate(arr = [10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 2\n assert candidate(arr = [1, 3, 2, 4, 6, 5, 7, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 20]) == 12\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 20\n assert candidate(arr = [2, 2, 2, 1, 1, 1, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7]) == 16\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == 30\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(arr = [5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 15, 14, 13, 12, 11, 20, 19, 18, 17, 16]) == 4\n assert candidate(arr = [5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1]) == 1\n assert candidate(arr = [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 25\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(arr = [5, 6, 1, 2, 3, 4, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 15\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 21\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == 1\n assert candidate(arr = [10, 20, 30, 40, 50, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29]) == 1\n assert candidate(arr = [5, 4, 3, 2, 1, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5]) == 1\n assert candidate(arr = [3, 2, 1, 6, 5, 4, 9, 8, 7, 12, 11, 10]) == 4\n assert candidate(arr = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10]) == 9\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 30\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 10, 11, 12, 13, 14, 15]) == 7\n assert candidate(arr = [1, 3, 2, 4, 5, 7, 6, 9, 8, 10]) == 7\n assert candidate(arr = [3, 2, 1, 4, 5, 6, 0]) == 1\n assert candidate(arr = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 10, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19]) == 11\n assert candidate(arr = [1, 5, 3, 4, 2, 6, 8, 7, 9, 10, 0, 11]) == 2\n assert candidate(arr = [10, 1, 20, 2, 30, 3, 40, 4, 50, 5, 60, 6, 70, 7, 80, 8, 90, 9, 100, 10]) == 1\n assert candidate(arr = [1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7]) == 3\n assert candidate(arr = [5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10]) == 11\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 3\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [1, 2, 0, 3, 4, 5, 6]) == 5\n assert candidate(arr = [5, 9, 3, 8, 7, 2, 4, 10, 1, 6]) == 1\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 12\n assert candidate(arr = [1, 2, 3, 0, 4, 5, 6, 7, 8, 9]) == 7\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0]) == 1\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 30\n assert candidate(arr = [2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [1, 3, 2, 4, 5, 7, 6, 8, 10, 9]) == 7\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 16\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 30\n assert candidate(arr = [1, 10, 2, 9, 3, 8, 4, 7, 5, 6]) == 2\n assert candidate(arr = [5, 3, 2, 4, 1, 6, 7]) == 3\n assert candidate(arr = [3, 1, 2, 4, 6, 5, 7]) == 4\n assert candidate(arr = [1, 2, 0, 3, 4, 5, 6, 7, 8, 9]) == 8\n assert candidate(arr = [1, 0, 2, 3, 4, 5, 6, 7, 8, 9]) == 9\n assert candidate(arr = [4, 5, 6, 0, 1, 2, 3]) == 1\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 3\n assert candidate(arr = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 11, 13, 15, 17, 19]) == 4\n assert candidate(arr = [9, 7, 5, 3, 1, 2, 4, 6, 8, 10]) == 2\n assert candidate(arr = [2, 1, 1, 1, 3, 4, 4, 4]) == 5\n assert candidate(arr = [20, 10, 30, 20, 40, 30, 50, 40, 60, 50, 70, 60, 80, 70, 90, 80, 100, 90, 110, 100]) == 10\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 7\n assert candidate(arr = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1]) == 2\n assert candidate(arr = [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9]) == 40\n assert candidate(arr = [5, 4, 3, 2, 1, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 10, 9, 8, 7, 6]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [1, 2, 3, 4, 0, 5]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == 100\n assert candidate(arr = [1, 5, 3, 4, 2, 6, 8, 7, 9, 10]) == 6\n assert candidate(arr = [5, 0, 3, 4, 1, 2]) == 1\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 15\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [1, 0, 2, 3, 4, 5]) == 5\n assert candidate(arr = [2, 3, 1, 4, 5, 3, 7, 6, 8, 9, 10, 8, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19, 22, 21, 24, 23, 26, 25, 28, 27, 30, 29, 32, 31, 34, 33, 36, 35, 38, 37, 40, 39, 42, 41, 44, 43, 46, 45, 48, 47, 50, 49, 52, 51, 54, 53, 56, 55, 58, 57, 60, 59, 62, 61, 64, 63, 66, 65, 68, 67, 70, 69, 72, 71, 74, 73, 76, 75, 78, 77, 80, 79, 82, 81, 84, 83, 86, 85, 88, 87, 90, 89, 92, 91, 94, 93, 96, 95, 98, 97, 100, 99]) == 50\n assert candidate(arr = [7, 5, 2, 3, 1, 4, 6, 8]) == 2\n assert candidate(arr = [3, 2, 1, 6, 5, 4, 9, 8, 7, 10]) == 4\n assert candidate(arr = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15]) == 8\n assert candidate(arr = [1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 0, 0, 0]) == 1\n assert candidate(arr = [5, 2, 6, 3, 7, 4, 8, 1, 9, 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 11\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(arr = [5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 3\n assert candidate(arr = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 19\n assert candidate(arr = [1, 5, 2, 6, 3, 7, 4, 8, 9, 10, 11, 12, 13, 14, 15]) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 21\n assert candidate(arr = [2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == 21\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 15\n assert candidate(arr = [4, 1, 2, 3, 5, 6, 7, 8, 9, 0]) == 1\n assert candidate(arr = [2, 3, 1, 5, 4, 8, 7, 10, 9, 6]) == 3\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 2\n assert candidate(arr = [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9]) == 6\n assert candidate(arr = [5, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 9, 8, 8, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4]) == 1\n assert candidate(arr = [3, 2, 1, 4, 6, 5, 9, 8, 7, 10]) == 5\n assert candidate(arr = [1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 15\n assert candidate(arr = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10]) == 8\n assert candidate(arr = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == 1\n assert candidate(arr = [1, 0, 2, 3, 5, 4, 6, 7, 8, 9]) == 8\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 2\n assert candidate(arr = [5, 1, 4, 2, 3, 8, 6, 10, 7, 9]) == 2\n assert candidate(arr = [1, 3, 2, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 17\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 0]) == 1\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 12\n assert candidate(arr = [1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 11, 20, 12, 19, 13, 18, 14, 17, 15, 16]) == 4\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 0, 0]) == 1\n assert candidate(arr = [4, 3, 2, 1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 12\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 20]) == 11\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == 20\n assert candidate(arr = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 2, 4, 3, 5, 6, 7, 8, 9, 10, 11]) == 4\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7, 6]) == 1\n assert candidate(arr = [1, 0, 3, 2, 5, 4, 7, 6, 9, 8]) == 5\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 10\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 1\n assert candidate(arr = [1, 5, 3, 4, 2, 6, 8, 7, 9, 10, 11, 15, 13, 14, 12, 16, 18, 17, 19, 20]) == 12\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 20\n assert candidate(arr = [1, 2, 3, 4, 5, 0, 6]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(arr = [4, 3, 2, 1, 5, 6, 7, 8, 9, 10]) == 7\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 3\n assert candidate(arr = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 10\n assert candidate(arr = [9, 7, 5, 3, 1, 8, 6, 4, 2, 10]) == 2\n assert candidate(arr = [5, 3, 2, 4, 1, 6, 8, 7, 9, 11, 10, 13, 15, 14, 16, 17]) == 9\n assert candidate(arr = [1, 3, 2, 4, 7, 6, 5, 8, 9, 0]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(arr = [8, 7, 6, 5, 4, 3, 2, 1, 0, 16, 15, 14, 13, 12, 11, 10, 9]) == 2\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9]) == 27\n assert candidate(arr = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 3\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]) == 15\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 10\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 11\n assert candidate(arr = [1, 2, 3, 4, 0, 5, 6, 7, 8, 9]) == 6\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().maxChunksToSorted", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxChunksToSorted = function(arr) {", "container": null, "callable": "maxChunksToSorted", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 769, "task_id": "max-chunks-to-make-sorted", "difficulty": "Medium", "problem_description": "You are given an integer array arr of length n that represents a permutation of the integers in the range [0, n - 1].\nWe split arr into some number of chunks (i.e., partitions), and individually sort each chunk. After concatenating them, the result should equal the sorted array.\nReturn the largest number of chunks we can make to sort the array.\n \nExample 1:\n\nInput: arr = [4,3,2,1,0]\nOutput: 1\nExplanation:\nSplitting into two or more chunks will not return the required result.\nFor example, splitting into [4, 3], [2, 1, 0] will result in [3, 4, 0, 1, 2], which isn't sorted.\n\nExample 2:\n\nInput: arr = [1,0,2,3,4]\nOutput: 4\nExplanation:\nWe can split into two chunks, such as [1, 0], [2, 3, 4].\nHowever, splitting into [1, 0], [2], [3], [4] is the highest number of chunks possible.\n\n \nConstraints:\n\nn == arr.length\n1 <= n <= 10\n0 <= arr[i] < n\nAll the elements of arr are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [1, 2, 0, 3, 4]) == 3\n assert candidate(arr = [5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [3, 1, 0, 2, 4]) == 2\n assert candidate(arr = [2, 0, 1, 3, 4]) == 3\n assert candidate(arr = [2, 1, 0, 3, 4]) == 3\n assert candidate(arr = [4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [3, 2, 1, 0, 4]) == 2\n assert candidate(arr = [1, 2, 3, 0, 4]) == 2\n assert candidate(arr = [2, 1, 0, 5, 4, 3]) == 2\n assert candidate(arr = [3, 2, 0, 1, 4]) == 2\n assert candidate(arr = [1, 2, 3, 4, 0]) == 1\n assert candidate(arr = [3, 2, 1, 6, 5, 4, 0]) == 1\n assert candidate(arr = [0, 1, 3, 2, 4]) == 4\n assert candidate(arr = [1, 0, 2, 3, 4]) == 4\n assert candidate(arr = [3, 0, 1, 4, 2]) == 1\n assert candidate(arr = [4, 0, 1, 2, 3]) == 1\n assert candidate(arr = [1, 2, 4, 3, 0]) == 1\n assert candidate(arr = [0, 1, 2, 3, 4, 5]) == 6\n assert candidate(arr = [0, 1, 2, 3, 4]) == 5\n assert candidate(arr = [0, 2, 1, 3, 4]) == 4\n assert candidate(arr = [0, 1, 2, 4, 3]) == 4\n assert candidate(arr = [2, 1, 0, 4, 3]) == 2\n assert candidate(arr = [2, 0, 1, 4, 3]) == 2\n assert candidate(arr = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4]) == 1\n assert candidate(arr = [0, 1, 3, 2, 4, 5]) == 5\n assert candidate(arr = [4, 3, 2, 1, 0, 9, 8, 7, 6, 5]) == 2\n assert candidate(arr = [2, 1, 3, 0, 4, 5]) == 3\n assert candidate(arr = [3, 2, 1, 4, 0, 5]) == 2\n assert candidate(arr = [0, 1, 2, 4, 5, 3]) == 4\n assert candidate(arr = [6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [5, 0, 1, 2, 4, 3, 9, 8, 7, 6]) == 2\n assert candidate(arr = [0, 1, 5, 2, 3, 4]) == 3\n assert candidate(arr = [0, 1, 5, 3, 2, 4]) == 3\n assert candidate(arr = [5, 1, 2, 3, 0, 4, 7, 6, 9, 8]) == 3\n assert candidate(arr = [2, 1, 4, 3, 0, 5]) == 2\n assert candidate(arr = [5, 0, 1, 2, 4, 3]) == 1\n assert candidate(arr = [8, 0, 1, 2, 3, 4, 5, 6, 7, 9]) == 2\n assert candidate(arr = [0, 1, 2, 3, 8, 7, 6, 5, 4, 9]) == 6\n assert candidate(arr = [0, 2, 1, 3, 5, 4]) == 4\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 9, 8]) == 9\n assert candidate(arr = [2, 0, 1, 4, 3, 6, 5, 8, 7, 9]) == 5\n assert candidate(arr = [1, 3, 2, 0, 5, 4, 6, 8, 7, 9]) == 5\n assert candidate(arr = [1, 2, 0, 4, 5, 3, 7, 8, 9, 6]) == 3\n assert candidate(arr = [1, 2, 0, 3, 5, 4, 7, 6, 9, 8]) == 5\n assert candidate(arr = [0, 4, 5, 2, 3, 1]) == 2\n assert candidate(arr = [3, 1, 2, 0, 5, 4, 7, 6, 9, 8]) == 4\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) == 1\n assert candidate(arr = [1, 0, 3, 2, 4, 5]) == 4\n assert candidate(arr = [8, 6, 7, 5, 3, 0, 9, 2, 1, 4]) == 1\n assert candidate(arr = [0, 1, 4, 3, 2, 5]) == 4\n assert candidate(arr = [1, 3, 2, 0, 4, 6, 5, 8, 7, 9]) == 5\n assert candidate(arr = [0, 4, 1, 3, 2, 7, 6, 9, 8, 5]) == 3\n assert candidate(arr = [2, 3, 0, 1, 4, 5]) == 3\n assert candidate(arr = [7, 6, 5, 4, 3, 2, 9, 8, 1, 0]) == 1\n assert candidate(arr = [1, 2, 3, 0, 4, 5, 6, 7, 8, 9]) == 7\n assert candidate(arr = [3, 2, 1, 0, 4, 5, 8, 7, 10, 9]) == 3\n assert candidate(arr = [1, 2, 0, 3, 4, 6, 5, 7, 9, 8]) == 6\n assert candidate(arr = [5, 1, 4, 3, 2, 0]) == 1\n assert candidate(arr = [3, 2, 5, 4, 1, 0]) == 1\n assert candidate(arr = [1, 0, 2, 5, 4, 3]) == 3\n assert candidate(arr = [0, 2, 1, 3, 5, 4, 6, 8, 7, 9]) == 7\n assert candidate(arr = [5, 1, 2, 3, 4, 0, 6, 7, 8, 9]) == 5\n assert candidate(arr = [0, 3, 2, 1, 5, 4]) == 3\n assert candidate(arr = [5, 4, 0, 1, 2, 3, 9, 8, 6, 7]) == 2\n assert candidate(arr = [5, 4, 3, 2, 1, 0, 9, 8, 7, 6]) == 2\n assert candidate(arr = [4, 2, 0, 1, 3, 8, 6, 7, 5, 9]) == 3\n assert candidate(arr = [0, 1, 3, 2, 5, 4, 6]) == 5\n assert candidate(arr = [0, 1, 4, 3, 5, 2]) == 3\n assert candidate(arr = [0, 3, 2, 1, 4, 5]) == 4\n assert candidate(arr = [3, 0, 1, 2, 5, 4, 6]) == 3\n assert candidate(arr = [1, 2, 0, 4, 5, 3, 8, 7, 9, 6]) == 3\n assert candidate(arr = [6, 0, 2, 1, 4, 3, 8, 5, 9, 7]) == 1\n assert candidate(arr = [2, 0, 1, 3, 5, 4, 6]) == 4\n assert candidate(arr = [0, 2, 1, 4, 3, 6, 5, 8, 7, 9]) == 6\n assert candidate(arr = [2, 0, 1, 5, 4, 3, 7, 6, 9, 8]) == 4\n assert candidate(arr = [1, 0, 2, 3, 5, 4, 6]) == 5\n assert candidate(arr = [6, 0, 1, 2, 3, 5, 4]) == 1\n assert candidate(arr = [1, 0, 4, 3, 2, 5]) == 3\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [4, 3, 2, 1, 0, 5, 6, 7, 8, 9]) == 6\n assert candidate(arr = [0, 3, 1, 2, 4, 5, 6, 7, 8, 9]) == 8\n assert candidate(arr = [3, 1, 0, 2, 5, 4]) == 2\n assert candidate(arr = [1, 3, 0, 2, 5, 4, 7, 6, 9, 8]) == 4\n assert candidate(arr = [0, 3, 2, 1, 4]) == 3\n assert candidate(arr = [0, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9]) == 2\n assert candidate(arr = [3, 0, 1, 2, 7, 4, 6, 5, 9, 8]) == 3\n assert candidate(arr = [2, 0, 1, 4, 3, 5]) == 3\n assert candidate(arr = [0, 1, 4, 5, 2, 3]) == 3\n assert candidate(arr = [0, 1, 3, 5, 2, 4]) == 3\n assert candidate(arr = [5, 4, 0, 1, 2, 3, 9, 8, 7, 6]) == 2\n assert candidate(arr = [0, 2, 4, 1, 3, 5, 7, 6, 8, 9]) == 6\n assert candidate(arr = [0, 3, 2, 1, 4, 7, 6, 5, 8, 9]) == 6\n assert candidate(arr = [1, 0, 4, 3, 2, 5, 6, 7, 8, 9]) == 7\n assert candidate(arr = [9, 7, 8, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [2, 3, 0, 1, 6, 7, 4, 5, 9, 8]) == 3\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 10\n assert candidate(arr = [1, 4, 0, 3, 2, 5]) == 2\n assert candidate(arr = [0, 3, 1, 2, 6, 5, 4, 7, 9, 8]) == 5\n assert candidate(arr = [3, 0, 1, 2, 5, 4, 7, 6, 9, 8]) == 4\n assert candidate(arr = [3, 2, 1, 0, 7, 6, 5, 4, 9, 8]) == 3\n assert candidate(arr = [8, 9, 6, 7, 4, 5, 2, 3, 0, 1]) == 1\n assert candidate(arr = [1, 2, 0, 4, 5, 3]) == 2\n assert candidate(arr = [1, 2, 0, 3, 5, 4]) == 3\n assert candidate(arr = [3, 0, 2, 1, 5, 4]) == 2\n assert candidate(arr = [6, 5, 4, 3, 2, 1, 0, 9, 8, 7]) == 2\n assert candidate(arr = [5, 0, 1, 2, 3, 4]) == 1\n assert candidate(arr = [4, 2, 3, 1, 0, 5]) == 2\n assert candidate(arr = [2, 0, 1, 4, 3, 6, 5, 9, 7, 8]) == 4\n assert candidate(arr = [0, 5, 1, 3, 2, 4]) == 2\n assert candidate(arr = [0, 1, 3, 5, 4, 2]) == 3\n assert candidate(arr = [2, 1, 0, 3, 4, 5]) == 4\n assert candidate(arr = [0, 1, 3, 2, 4, 5, 7, 6, 8, 9]) == 8\n assert candidate(arr = [6, 5, 0, 1, 3, 4, 2]) == 1\n assert candidate(arr = [1, 2, 0, 3, 4, 5]) == 4\n assert candidate(arr = [5, 3, 2, 4, 0, 1]) == 1\n assert candidate(arr = [0, 1, 3, 2, 5, 4]) == 4\n assert candidate(arr = [1, 0, 3, 2, 5, 4, 7, 6, 9, 8]) == 5\n assert candidate(arr = [0, 1, 2, 5, 3, 4]) == 4\n assert candidate(arr = [1, 3, 2, 0, 5, 4]) == 2\n assert candidate(arr = [1, 2, 0, 4, 5, 3, 7, 8, 6, 9]) == 4\n assert candidate(arr = [1, 2, 0, 4, 3, 6, 5]) == 3\n assert candidate(arr = [0, 5, 1, 2, 3, 4]) == 2\n assert candidate(arr = [0, 1, 2, 3, 5, 4]) == 5\n assert candidate(arr = [0, 1, 4, 2, 3, 5]) == 4\n assert candidate(arr = [3, 1, 2, 0, 4, 5, 8, 6, 9, 7]) == 4\n assert candidate(arr = [3, 2, 1, 0, 5, 4]) == 2\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().maxChunksToSorted", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxChunksToSorted = function(arr) {", "container": null, "callable": "maxChunksToSorted", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 770, "task_id": "basic-calculator-iv", "difficulty": "Hard", "problem_description": "Given an expression such as expression = \"e + 8 - a + 5\" and an evaluation map such as {\"e\": 1} (given in terms of evalvars = [\"e\"] and evalints = [1]), return a list of tokens representing the simplified expression, such as [\"-1*a\",\"14\"]\n\nAn expression alternates chunks and symbols, with a space separating each chunk and symbol.\nA chunk is either an expression in parentheses, a variable, or a non-negative integer.\nA variable is a string of lowercase letters (not including digits.) Note that variables can be multiple letters, and note that variables never have a leading coefficient or unary operator like \"2x\" or \"-x\".\n\nExpressions are evaluated in the usual order: brackets first, then multiplication, then addition and subtraction.\n\nFor example, expression = \"1 + 2 * 3\" has an answer of [\"7\"].\n\nThe format of the output is as follows:\n\nFor each term of free variables with a non-zero coefficient, we write the free variables within a term in sorted order lexicographically.\n\t\nFor example, we would never write a term like \"b*a*c\", only \"a*b*c\".\n\n\nTerms have degrees equal to the number of free variables being multiplied, counting multiplicity. We write the largest degree terms of our answer first, breaking ties by lexicographic order ignoring the leading coefficient of the term.\n\t\nFor example, \"a*a*b*c\" has degree 4.\n\n\nThe leading coefficient of the term is placed directly to the left with an asterisk separating it from the variables (if they exist.) A leading coefficient of 1 is still printed.\nAn example of a well-formatted answer is [\"-2*a*a*a\", \"3*a*a*b\", \"3*b*b\", \"4*a\", \"5*c\", \"-6\"].\nTerms (including constant terms) with coefficient 0 are not included.\n\t\nFor example, an expression of \"0\" has an output of [].\n\n\n\nNote: You may assume that the given expression is always valid. All intermediate results will be in the range of [-231, 231 - 1].\n \nExample 1:\n\nInput: expression = \"e + 8 - a + 5\", evalvars = [\"e\"], evalints = [1]\nOutput: [\"-1*a\",\"14\"]\n\nExample 2:\n\nInput: expression = \"e - 8 + temperature - pressure\", evalvars = [\"e\", \"temperature\"], evalints = [1, 12]\nOutput: [\"-1*pressure\",\"5\"]\n\nExample 3:\n\nInput: expression = \"(e + 8) * (e - 8)\", evalvars = [], evalints = []\nOutput: [\"1*e*e\",\"-64\"]\n\n \nConstraints:\n\n1 <= expression.length <= 250\nexpression consists of lowercase English letters, digits, '+', '-', '*', '(', ')', ' '.\nexpression does not contain any leading or trailing spaces.\nAll the tokens in expression are separated by a single space.\n0 <= evalvars.length <= 100\n1 <= evalvars[i].length <= 20\nevalvars[i] consists of lowercase English letters.\nevalints.length == evalvars.length\n-100 <= evalints[i] <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(expression = \"1 + (2 * 3) + (4 * (5 + 6))\",evalvars = [],evalints = []) == ['51']\n assert candidate(expression = \"10 + 20 * (30 + 40) - 50\",evalvars = [],evalints = []) == ['1360']\n assert candidate(expression = \"(x + y) * (x - y) + (x + z) * (x - z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == ['-11']\n assert candidate(expression = \"a + b * c - d / e + f\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f'],evalints = [1, 2, 3, 4, 5, 6]) == ['7']\n assert candidate(expression = \"a * (b + c) * (d + e)\",evalvars = ['a', 'b', 'c', 'd', 'e'],evalints = [1, 2, 3, 4, 5]) == ['45']\n assert candidate(expression = \"(x + y) * (x - y) + (x + y) * (x + y)\",evalvars = ['x', 'y'],evalints = [1, 2]) == ['6']\n assert candidate(expression = \"x + y * 2\",evalvars = ['x'],evalints = [3]) == ['2*y', '3']\n assert candidate(expression = \"a + b + c + d + e\",evalvars = ['a', 'b', 'c'],evalints = [1, 2, 3]) == ['1*d', '1*e', '6']\n assert candidate(expression = \"a + b * c - d / e\",evalvars = ['a', 'b', 'c', 'd', 'e'],evalints = [1, 2, 3, 4, 2]) == ['7']\n assert candidate(expression = \"3 * (a + b) - 2 * (a - b)\",evalvars = ['a'],evalints = [2]) == ['5*b', '2']\n assert candidate(expression = \"x + y * 2 - (x - y)\",evalvars = ['x', 'y'],evalints = [1, 2]) == ['6']\n assert candidate(expression = \"(a * b) * (c * d)\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, 2, 3, 4]) == ['24']\n assert candidate(expression = \"10 + 2 * 6\",evalvars = [],evalints = []) == ['22']\n assert candidate(expression = \"e - 8 + temperature - pressure\",evalvars = ['e', 'temperature'],evalints = [1, 12]) == ['-1*pressure', '5']\n assert candidate(expression = \"(x + y) * (x - y) + (x + z) * (x - z)\",evalvars = [],evalints = []) == ['2*x*x', '-1*y*y', '-1*z*z']\n assert candidate(expression = \"100 * ( 2 + 12 )\",evalvars = [],evalints = []) == ['1400']\n assert candidate(expression = \"100 * ( 2 + 12 ) / 14\",evalvars = [],evalints = []) == ['100']\n assert candidate(expression = \"x * y + y * x\",evalvars = ['x', 'y'],evalints = [1, 2]) == ['4']\n assert candidate(expression = \"x * y + z\",evalvars = ['x', 'y'],evalints = [2, 3]) == ['1*z', '6']\n assert candidate(expression = \"(x + y) * (x - y) + z\",evalvars = ['x', 'y', 'z'],evalints = [3, 4, 5]) == ['-2']\n assert candidate(expression = \"(a + b) * (a - b)\",evalvars = ['a', 'b'],evalints = [3, 2]) == ['5']\n assert candidate(expression = \"e + 8 - a + 5\",evalvars = ['e'],evalints = [1]) == ['-1*a', '14']\n assert candidate(expression = \"x * x + 2 * x + 1\",evalvars = ['x'],evalints = [1]) == ['4']\n assert candidate(expression = \"(e + 8) * (e - 8)\",evalvars = [],evalints = []) == ['1*e*e', '-64']\n assert candidate(expression = \"x * (y + z) + w\",evalvars = ['x', 'y', 'z'],evalints = [2, 3, 4]) == ['1*w', '14']\n assert candidate(expression = \"x + y * (2 + 3) - z\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == ['8']\n assert candidate(expression = \"(a + b) * (a - b)\",evalvars = ['a', 'b'],evalints = [3, 4]) == ['-7']\n assert candidate(expression = \"x + 2 * (y + z)\",evalvars = ['x'],evalints = [1]) == ['2*y', '2*z', '1']\n assert candidate(expression = \"(a + b) * (a - b)\",evalvars = [],evalints = []) == ['1*a*a', '-1*b*b']\n assert candidate(expression = \"x * x + y * y + z * z\",evalvars = [],evalints = []) == ['1*x*x', '1*y*y', '1*z*z']\n assert candidate(expression = \"(a + b) + (c + d)\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, 2, 3, 4]) == ['10']\n assert candidate(expression = \"(x + y) * (x + y)\",evalvars = [],evalints = []) == ['1*x*x', '2*x*y', '1*y*y']\n assert candidate(expression = \"(x + y) * (x + y)\",evalvars = ['x', 'y'],evalints = [1, 2]) == ['9']\n assert candidate(expression = \"a + b * c + d\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, 2, 3, 4]) == ['11']\n assert candidate(expression = \"10 * (x + y) + 5\",evalvars = ['x', 'y'],evalints = [1, 1]) == ['25']\n assert candidate(expression = \"100 * 2 + 12\",evalvars = [],evalints = []) == ['212']\n assert candidate(expression = \"(x + y + z) * (x - y + z) * (x + y - z) * (x - y - z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == []\n assert candidate(expression = \"(a + b) * (c + d + e) * (f + g + h) + (i + j) * (k + l + m) * (n + o + p)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'],evalints = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == ['31536']\n assert candidate(expression = \"(x + y + z) * (x + y + z) * (x + y + z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == ['216']\n assert candidate(expression = \"(x + 2*y + 3*z) * (4*x + 5*y + 6*z) - (7*x + 8*y + 9*z) * (10*x + 11*y + 12*z)\",evalvars = ['x', 'y', 'z'],evalints = [1, -1, 2]) == ['-336']\n assert candidate(expression = \"((x + 2*y) * (z + 3)) + ((4*x - 5*y) * (z - 6))\",evalvars = ['x', 'y', 'z'],evalints = [2, 3, 4]) == ['70']\n assert candidate(expression = \"(x + 2 * y + 3 * z + 4 * w) * (x - 2 * y - 3 * z - 4 * w) * (x + 5 * y + 6 * z + 7 * w) + 40\",evalvars = ['x', 'y', 'z', 'w'],evalints = [1, 1, 1, 1]) == ['-1480']\n assert candidate(expression = \"(x^2 + 2*x + 1) * (x^2 - 2*x + 1)\",evalvars = ['x'],evalints = [2]) == ['1*x^2*x^2', '2*x^2', '-15']\n assert candidate(expression = \"((a + b) * (c - d) + e) * f\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f'],evalints = [1, 2, 3, 4, 5, 6]) == ['12']\n assert candidate(expression = \"(a + b + c + d) * (a + b + c - d) * (a + b - c + d) * (a + b - c - d) * (a - b + c + d) * (a - b + c - d) * (a - b - c + d) * (a - b - c - d)\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, 1, 1, 1]) == []\n assert candidate(expression = \"(a + b) * (c + d) * (e + f) + (g + h) * (i + j) * (k + l)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'],evalints = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == ['16']\n assert candidate(expression = \"(1 + x) * (1 - x) * (1 + x * x) + (1 - x * x) * (1 - x * x) * (1 + x * x * x) + 7\",evalvars = ['x'],evalints = [0]) == ['9']\n assert candidate(expression = \"(2 * x + 3 * y) * (4 * z + 5) - (6 * w + 7 * v) * (8 * u + 9)\",evalvars = ['x', 'y', 'z', 'w', 'v', 'u'],evalints = [1, -1, 2, -2, 3, -3]) == ['122']\n assert candidate(expression = \"(a + 2 * b) * (3 * c + 4 * d) - (a - b) * (c - 2 * d)\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, 2, 3, 4]) == ['120']\n assert candidate(expression = \"(a + b + c) * (a - b - c)\",evalvars = ['a', 'b', 'c'],evalints = [1, 2, 3]) == ['-24']\n assert candidate(expression = \"(a + b + c) * (d + e + f)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f'],evalints = [1, 2, 3, 4, 5, 6]) == ['90']\n assert candidate(expression = \"((a + b) * (c + d) + (e + f) * (g + h)) * ((i + j) * (k + l) + (m + n) * (o + p))\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'],evalints = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == ['236964']\n assert candidate(expression = \"(a + b) * (c + d) + (e + f) * (g + h)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'],evalints = [1, 2, 3, 4, 5, 6, 7, 8]) == ['186']\n assert candidate(expression = \"((x + y) * (z + w)) * ((x - y) * (z - w))\",evalvars = ['x', 'y', 'z', 'w'],evalints = [1, -1, 2, -2]) == []\n assert candidate(expression = \"10 * (x + 2 * y + 3 * z) - 5 * (x - 2 * y + 3 * z) + 2 * (x + 2 * y - 3 * z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == ['102']\n assert candidate(expression = \"(x + 2*y + 3*z) * (4*x + 5*y + 6*z) - (7*x + 8*y + 9*z) * (10*x + 11*y + 12*z) + (13*x + 14*y + 15*z) * (16*x + 17*y + 18*z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 1, 1]) == ['1440']\n assert candidate(expression = \"(x + 2*y) * (3*z + 4*w) - (5*v + 6*u) * (7*t + 8*s)\",evalvars = ['x', 'y', 'z', 'w', 'v', 'u', 't', 's'],evalints = [1, 2, 3, 4, 5, 6, 7, 8]) == ['-6768']\n assert candidate(expression = \"(a + b + c + d) * (e + f + g + h)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'],evalints = [1, 2, 3, 4, 5, 6, 7, 8]) == ['260']\n assert candidate(expression = \"(2*x + 3*y + 4*z) * (5*x + 6*y + 7*z) + (8*x + 9*y + 10*z) * (11*x + 12*y + 13*z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 1, 1]) == ['1134']\n assert candidate(expression = \"(a + b + c + d + e) * (a + b + c + d + e) * (a + b + c + d + e)\",evalvars = ['a', 'b', 'c', 'd', 'e'],evalints = [1, 2, 3, 4, 5]) == ['3375']\n assert candidate(expression = \"((x + y + z) * (x - y + z)) * ((x + y - z) * (x - y - z))\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == []\n assert candidate(expression = \"(a + b + c) * (d + e + f) * (g + h + i)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'],evalints = [1, -1, 2, -2, 3, -3, 4, -4, 5]) == ['-20']\n assert candidate(expression = \"(a + b) * (a - b) + (a + c) * (a - c) + (b + c) * (b - c)\",evalvars = ['a', 'b', 'c'],evalints = [1, 1, 1]) == []\n assert candidate(expression = \"((x + y) * (z + w) + (v + u) * (t + s)) * (r + q + p)\",evalvars = ['x', 'y', 'z', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p'],evalints = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == ['24']\n assert candidate(expression = \"(x + 2 * y + 3 * z) * (x - 2 * y - 3 * z) * (x + 4 * y + 5 * z) + 30\",evalvars = ['x', 'y', 'z'],evalints = [1, 1, 1]) == ['-210']\n assert candidate(expression = \"(a + b) * (c + d) * (e + f)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f'],evalints = [1, 2, 3, 4, 5, 6]) == ['231']\n assert candidate(expression = \"(x + 3) * (x - 3) * (x + 2) * (x - 2) + 10\",evalvars = ['x'],evalints = [0]) == ['46']\n assert candidate(expression = \"(x * y * z * w) + (x * y + z * w) + (x + y) * (z + w) + (x + y) * (z + w) * (x * y + z * w)\",evalvars = ['x', 'y', 'z', 'w'],evalints = [1, 1, 1, 1]) == ['15']\n assert candidate(expression = \"(a + b + c) * (d + e + f) + (a - b - c) * (d - e - f)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f'],evalints = [1, 2, 3, 4, 5, 6]) == ['118']\n assert candidate(expression = \"((a + b) * (c + d)) + ((a - b) * (c - d))\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, 2, 3, 4]) == ['22']\n assert candidate(expression = \"((x + y) * (z + w) + (v + u) * (t + s)) * ((r + q) * (p + o) + (n + m) * (l + k))\",evalvars = ['x', 'y', 'z', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k'],evalints = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == ['64']\n assert candidate(expression = \"(a + b + c) * (d + e + f) + (g + h + i) * (j + k + l)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'],evalints = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == ['882']\n assert candidate(expression = \"(a + 2*b) * (3*a - 4*b) + (5*a + 6*b) * (7*a - 8*b)\",evalvars = ['a', 'b'],evalints = [1, 1]) == ['-14']\n assert candidate(expression = \"(x + y + z) * (x + y + z) - (x + y) * (x + y)\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == ['27']\n assert candidate(expression = \"(x + y + z) * (x - y - z) + (x + y - z) * (x - y + z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == ['-24']\n assert candidate(expression = \"((x + y) * (x - y)) + ((x + z) * (x - z))\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == ['-11']\n assert candidate(expression = \"100 * (x + 2*y) - 50 * (x - 3*y)\",evalvars = ['x', 'y'],evalints = [2, 3]) == ['1150']\n assert candidate(expression = \"(x + y + z) * (x + y - z) * (x - y + z) * (x - y - z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == []\n assert candidate(expression = \"(a + b) * (c + d) + (a - b) * (c - d)\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, 2, 3, 4]) == ['22']\n assert candidate(expression = \"(x + y) * (x - y) * (x + y) + (x - y) * (x - y) * (x + y)\",evalvars = ['x', 'y'],evalints = [1, 2]) == ['-6']\n assert candidate(expression = \"x * (y + z) * (y - z) + x * (y + w) * (y - w)\",evalvars = ['x', 'y', 'z', 'w'],evalints = [1, 2, 3, 4]) == ['-17']\n assert candidate(expression = \"(e + 8) * (e - 8) + (e + 2) * (e - 2) - (e + 1) * (e - 1)\",evalvars = ['e'],evalints = [1]) == ['-66']\n assert candidate(expression = \"(a * b * c + d * e * f) * (g + h + i)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'],evalints = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == ['3024']\n assert candidate(expression = \"(a + b + c) * (a - b - c) * (a + b - c)\",evalvars = ['a', 'b', 'c'],evalints = [1, -1, 2]) == []\n assert candidate(expression = \"(a * b + c) * (d - e) + f * (g + h)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'],evalints = [1, 2, 3, 4, 5, 6, 7, 8]) == ['85']\n assert candidate(expression = \"(a * b * c * d) + (a * b * c * e) + (a * b * d * e) + (a * c * d * e) + (b * c * d * e)\",evalvars = ['a', 'b', 'c', 'd', 'e'],evalints = [1, 2, 3, 4, 5]) == ['274']\n assert candidate(expression = \"(x + 2*y + 3*z) * (x - y + z) + 2 * (x + y + z) * (x - y + z) + 3 * (x + y) * (x - y + z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 1, 1]) == ['18']\n assert candidate(expression = \"(x + 2 * y + 3 * z) * (x - 2 * y + 3 * z) - (x + 2 * y - 3 * z) * (x - 2 * y - 3 * z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == ['36']\n assert candidate(expression = \"(a + 2*b + 3*c) * (4*d + 5*e + 6*f) + (7*g + 8*h + 9*i) * (10*j + 11*k + 12*l)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'],evalints = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == ['71888']\n assert candidate(expression = \"(a + 2*b) * (3*c + 4*d) + (5*e + 6*f) * (7*g + 8*h)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'],evalints = [1, -1, 2, -2, 3, -3, 4, -4]) == ['14']\n assert candidate(expression = \"(x + y + z + w) * (x + y + z + w) * (x + y + z + w) * (x + y + z + w)\",evalvars = ['x', 'y', 'z', 'w'],evalints = [1, 1, 1, 1]) == ['256']\n assert candidate(expression = \"(a + b) * (a - b) + (b + c) * (b - c)\",evalvars = ['a', 'b', 'c'],evalints = [1, 2, 3]) == ['-8']\n assert candidate(expression = \"(x * y + z) * (w * v + u) - (t * s + r) * (q * p + o)\",evalvars = ['x', 'y', 'z', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o'],evalints = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == ['-7800']\n assert candidate(expression = \"x * (y + z) - y * (x + z) + z * (x + y)\",evalvars = ['x', 'y', 'z'],evalints = [1, 1, 1]) == ['2']\n assert candidate(expression = \"10 * (a + 5 * (b + c)) - 3 * (a - b)\",evalvars = ['a', 'b', 'c'],evalints = [1, 2, 3]) == ['263']\n assert candidate(expression = \"(x + y + z) * (x - y - z) + (x + 2 * y + 3 * z) * (x - 2 * y - 3 * z) + 15\",evalvars = ['x', 'y', 'z'],evalints = [1, 1, 1]) == ['-12']\n assert candidate(expression = \"3 * (a * b + b * c + c * a) - 2 * (a * a + b * b + c * c) + (a + b + c) * (a + b + c)\",evalvars = ['a', 'b', 'c'],evalints = [1, 1, 1]) == ['12']\n assert candidate(expression = \"2 * (x + 3 * (y + 4)) - 5 * (x - y)\",evalvars = ['x', 'y'],evalints = [1, 2]) == ['43']\n assert candidate(expression = \"(a + b + c) * (a - b + c) * (a + b - c) * (a - b - c) + (d + e + f) * (d - e + f) * (d + e - f) * (d - e - f)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f'],evalints = [1, 2, 3, 4, 5, 6]) == ['-1575']\n assert candidate(expression = \"(a + b) * (a - b) - (a * a - b * b) + (c + d) * (c - d)\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, 2, 3, 4]) == ['-7']\n assert candidate(expression = \"(a + b) * (c + d) - (e + f) * (g + h)\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'],evalints = [1, 2, 3, 4, 5, 6, 7, 8]) == ['-144']\n assert candidate(expression = \"(a + b + c + d) * (a - b + c - d) - (a - b - c + d) * (a + b - c - d) + 25\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, 1, 1, 1]) == ['25']\n assert candidate(expression = \"(a + 3*b) * (c + 5*d) + (2*a - 4*b) * (6*c + 8*d) - (3*a + 6*b) * (9*c + 12*d)\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, 1, 1, 1]) == ['-193']\n assert candidate(expression = \"(a + b + c + d + e) * (a - b + c - d + e) - (a - b - c + d - e) * (a + b - c - d - e) + 35\",evalvars = ['a', 'b', 'c', 'd', 'e'],evalints = [1, 1, 1, 1, 1]) == ['39']\n assert candidate(expression = \"(a + b) * (a + b) * (a + b) + (c + d) * (c + d) * (c + d)\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, 1, 1, 1]) == ['16']\n assert candidate(expression = \"(x - 2*y) * (3*z - 4) + (5*x + 6*y) * (7*z - 8)\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == ['206']\n assert candidate(expression = \"(a + b + c + d) * (a - b + c - d) * (a + b - c - d) * (a - b - c + d)\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, 2, 3, 4]) == []\n assert candidate(expression = \"(x + 2*y + 3*z) * (4*x + 5*y + 6*z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == ['448']\n assert candidate(expression = \"((x + y) * (x - y)) * ((x + z) * (x - z))\",evalvars = ['x', 'y', 'z'],evalints = [2, 3, 4]) == ['60']\n assert candidate(expression = \"3 * (x + 2 * y + 3 * z) - 2 * (x - y + z) + 4 * (x - 2 * y + 3 * z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == ['62']\n assert candidate(expression = \"(x + y + z) * (x + y + z) * (x + y + z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 1, 1]) == ['27']\n assert candidate(expression = \"((x + y) * (x - y) + (y + z) * (y - z) + (z + x) * (z - x)) * 2\",evalvars = ['x', 'y', 'z'],evalints = [1, 1, 1]) == []\n assert candidate(expression = \"(a + b) * (a - b) * (c + d) * (c - d)\",evalvars = ['a', 'b', 'c', 'd'],evalints = [1, -1, 2, -2]) == []\n assert candidate(expression = \"(a + b + c) * (a + b + c) * (a + b + c) - 3 * (a + b) * (a + b) * (a + b) + 3 * (a + b) * (a + b) * (a + b) - (a + b) * (a + b) * (a + b)\",evalvars = ['a', 'b', 'c'],evalints = [1, 1, 1]) == ['19']\n assert candidate(expression = \"(x + 2*y + 3*z) * (4*x + 5*y + 6*z) - (7*x + 8*y + 9*z) * (10*x + 11*y + 12*z)\",evalvars = ['x', 'y', 'z'],evalints = [1, 2, 3]) == ['-2952']\n assert candidate(expression = \"(a + b) * (a + b) * (a + b) + (a + c) * (a + c) * (a + c) + (b + c) * (b + c) * (b + c)\",evalvars = ['a', 'b', 'c'],evalints = [1, 2, 3]) == ['216']\n assert candidate(expression = \"10 * (x + 2 * y) - 5 * (x - 3 * y)\",evalvars = ['x', 'y'],evalints = [1, 2]) == ['75']\n assert candidate(expression = \"(a + b) * (a - b) + (a + b) * (a + b) - (a - b) * (a - b)\",evalvars = ['a', 'b'],evalints = [1, 2]) == ['5']\n assert candidate(expression = \"(2*a + 3*b + 4*c) * (5*a + 6*b + 7*c) - (8*a + 9*b + 10*c) * (11*a + 12*b + 13*c)\",evalvars = ['a', 'b', 'c'],evalints = [1, -1, 2]) == ['-384']\n assert candidate(expression = \"(x + 3) * (x - 3) * (x + 3)\",evalvars = ['x'],evalints = [2]) == ['-25']\n assert candidate(expression = \"((x + y) * (x - y)) * ((x + z) * (x - z)) + (x * x)\",evalvars = ['x', 'y', 'z'],evalints = [2, 3, 4]) == ['64']\n assert candidate(expression = \"(x + y + z + w) * (x - y - z - w) + (x + y - z + w) * (x - y + z - w)\",evalvars = ['x', 'y', 'z', 'w'],evalints = [1, 2, 3, 4]) == ['-88']\n assert candidate(expression = \"(a + b) * (a - b) + (b + c) * (b - c) + (c + a) * (c - a)\",evalvars = ['a', 'b', 'c'],evalints = [1, 1, 1]) == []\n assert candidate(expression = \"(a + 2*b + 3*c) * (a - b + c) + 2 * (a + b + c) * (a - b + c)\",evalvars = ['a', 'b', 'c'],evalints = [1, 1, 1]) == ['12']\n assert candidate(expression = \"(x + 3) * (x - 3) * (x + 5) + 2 * (x + 1) * (x - 1)\",evalvars = ['x'],evalints = [2]) == ['-29']\n assert candidate(expression = \"(a + b + c) * (d + e + f) - (g + h + i) * (j + k + l) + 20\",evalvars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'],evalints = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == ['-682']\n"}, "metadata": {"canonical_parameter_names": ["expression", "evalvars", "evalints"], "leetcode_dataset_entry_point": "Solution().basicCalculatorIV", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var basicCalculatorIV = function(expression, evalvars, evalints) {", "container": null, "callable": "basicCalculatorIV", "parameters": [{"name": "expression", "type": "string"}, {"name": "evalvars", "type": "string[]"}, {"name": "evalints", "type": "number[]"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 771, "task_id": "jewels-and-stones", "difficulty": "Easy", "problem_description": "You're given strings jewels representing the types of stones that are jewels, and stones representing the stones you have. Each character in stones is a type of stone you have. You want to know how many of the stones you have are also jewels.\nLetters are case sensitive, so \"a\" is considered a different type of stone from \"A\".\n \nExample 1:\nInput: jewels = \"aA\", stones = \"aAAbbbb\"\nOutput: 3\nExample 2:\nInput: jewels = \"z\", stones = \"ZZ\"\nOutput: 0\n\n \nConstraints:\n\n1 <= jewels.length, stones.length <= 50\njewels and stones consist of only English letters.\nAll the characters of jewels are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(jewels = \"aA\",stones = \"aAAbbbb\") == 3\n assert candidate(jewels = \"xyz\",stones = \"aabbcc\") == 0\n assert candidate(jewels = \"xyz\",stones = \"\") == 0\n assert candidate(jewels = \"aA\",stones = \"\") == 0\n assert candidate(jewels = \"abcdefg\",stones = \"aghfbadcegf\") == 10\n assert candidate(jewels = \"abcdefg\",stones = \"aghgfedcba\") == 9\n assert candidate(jewels = \"\",stones = \"abcdefg\") == 0\n assert candidate(jewels = \"XYZ\",stones = \"xyzbxyz\") == 0\n assert candidate(jewels = \"abcdef\",stones = \"fedcba\") == 6\n assert candidate(jewels = \"J\",stones = \"jjjjjJ\") == 1\n assert candidate(jewels = \"aBcD\",stones = \"abCdEfGhIjKlMnOpQrStUvWxYz\") == 1\n assert candidate(jewels = \"A\",stones = \"aAaAaA\") == 3\n assert candidate(jewels = \"XYZ\",stones = \"xyzXYZxyz\") == 3\n assert candidate(jewels = \"J\",stones = \"Jjjjjjjjjjj\") == 1\n assert candidate(jewels = \"A\",stones = \"aA\") == 1\n assert candidate(jewels = \"xyz\",stones = \"xyzzxyzz\") == 8\n assert candidate(jewels = \"\",stones = \"aAAbbbb\") == 0\n assert candidate(jewels = \"z\",stones = \"ZZ\") == 0\n assert candidate(jewels = \"abc\",stones = \"acbacba\") == 7\n assert candidate(jewels = \"abc\",stones = \"aaabbbccc\") == 9\n assert candidate(jewels = \"abcdefg\",stones = \"\") == 0\n assert candidate(jewels = \"xyz\",stones = \"xyzzzyx\") == 7\n assert candidate(jewels = \"ABC\",stones = \"abcABC\") == 3\n assert candidate(jewels = \"abc\",stones = \"aabbcc\") == 6\n assert candidate(jewels = \"xyzXYZ\",stones = \"zyxwvutsrqponmlkjihgfedcbaZXCVBNMLKJIHGFEDCBA\") == 5\n assert candidate(jewels = \"xyzXYZ\",stones = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == 6\n assert candidate(jewels = \"ABCDEFGHIJK\",stones = \"ABCDEFGHIJKabcdefghijk\") == 11\n assert candidate(jewels = \"mnopqr\",stones = \"mnopqrzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == 6\n assert candidate(jewels = \"abcdef\",stones = \"aabbccddeeff\") == 12\n assert candidate(jewels = \"mnopqr\",stones = \"mnopqrstuvwxyz\") == 6\n assert candidate(jewels = \"ABCDEFGHIJKL\",stones = \"LJKIHFEDCBA\") == 11\n assert candidate(jewels = \"mnopqr\",stones = \"rstuvwrstuvwrstuvwrstuvw\") == 4\n assert candidate(jewels = \"JKLMNO\",stones = \"PQRSTUJKLMNOPQRSTUJKLMNOPQRSTUJKLMNOPQRSTUJKLMNOPQRSTUJKL\") == 27\n assert candidate(jewels = \"yza\",stones = \"yzayzayzayza\") == 12\n assert candidate(jewels = \"1234567890\",stones = \"09876543210123456789\") == 20\n assert candidate(jewels = \"LMNOPQ\",stones = \"mnopqrLMNOPQ\") == 6\n assert candidate(jewels = \"LMNOPQRSTU\",stones = \"LMNOPQRSTULMNOPQRSTUVWXYZ\") == 20\n assert candidate(jewels = \"QWERTY\",stones = \"qwertyuiopasdfghjklzxcvbnmQWERTY\") == 6\n assert candidate(jewels = \"aAbBcC\",stones = \"aabbccAAzz\") == 8\n assert candidate(jewels = \"pythonPYTHON\",stones = \"pythooonPYTHOOONpy\") == 18\n assert candidate(jewels = \"ABCDEFGHIJKL\",stones = \"abcdefghijlkjihgfedcba\") == 0\n assert candidate(jewels = \"javaJAVA\",stones = \"jjjaaaaavvvaaaAAAVVVAAA\") == 23\n assert candidate(jewels = \"abcdefghij\",stones = \"zzzzzzzzzzzzzzzzzzzz\") == 0\n assert candidate(jewels = \"AEIOU\",stones = \"aeiouAEIOUaeiouAEIOU\") == 10\n assert candidate(jewels = \"fghij\",stones = \"jihgf\") == 5\n assert candidate(jewels = \"xyzXYZ\",stones = \"zzzzzyyyxXxXyYy\") == 15\n assert candidate(jewels = \"pqrst\",stones = \"tsrpq\") == 5\n assert candidate(jewels = \"abcdefghijk\",stones = \"ABCDEFGHIJKabcdefghijk\") == 11\n assert candidate(jewels = \"ghijkl\",stones = \"lkjihg\") == 6\n assert candidate(jewels = \"abcdefg\",stones = \"abcdefgabcdefgabcdefg\") == 21\n assert candidate(jewels = \"abcde\",stones = \"edcba\") == 5\n assert candidate(jewels = \"QRSTUVWXYZ\",stones = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\") == 10\n assert candidate(jewels = \"123456\",stones = \"111222333444555666\") == 18\n assert candidate(jewels = \"z\",stones = \"zzzzzzzzzzzzzzzzzzzz\") == 20\n assert candidate(jewels = \"mnopqr\",stones = \"mnopqrnopqrxyz\") == 11\n assert candidate(jewels = \"aAbBcC\",stones = \"aAbBcCxxxyyyzzz\") == 6\n assert candidate(jewels = \"uvwxy\",stones = \"yxwvu\") == 5\n assert candidate(jewels = \"aAbBcC\",stones = \"abcABCabcABC\") == 12\n assert candidate(jewels = \"mnopqr\",stones = \"mnoqrpmnopqrmmmnopqr\") == 20\n assert candidate(jewels = \"QWJRTY\",stones = \"QWJRTYqwerty\") == 6\n assert candidate(jewels = \"Z\",stones = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == 0\n assert candidate(jewels = \"JKLM\",stones = \"ABCDEFGHIJKLmnopqrstu\") == 3\n assert candidate(jewels = \"abcABC\",stones = \"aAbBcCabcABC\") == 12\n assert candidate(jewels = \"qwertyuiopASDFGHJKLZXCVBNM\",stones = \"qwertyuiopASDFGHJKLZXCVBNMqwertyuiopASDFGHJKLZXCVBNM\") == 52\n assert candidate(jewels = \"\",stones = \"abcdefghijklmnopqrstuvwxyz\") == 0\n assert candidate(jewels = \"QRSTU\",stones = \"UTSRQ\") == 5\n assert candidate(jewels = \"abcdefgABCDEFG\",stones = \"gfedcbaGFEDCBAgfedcba\") == 21\n assert candidate(jewels = \"LMNOPQ\",stones = \"PQLNOM\") == 6\n assert candidate(jewels = \"abcABC\",stones = \"aBcDeFgHiJkLmNoPqRsTuVwXyZ\") == 3\n assert candidate(jewels = \"xyzXYZ\",stones = \"zyxZYXzyxZYXzyxZYX\") == 18\n assert candidate(jewels = \"abcdef\",stones = \"fedcbafedcbafedcba\") == 18\n assert candidate(jewels = \"xyzXYZ\",stones = \"xyzzzzyyxXXYYZZZ\") == 16\n assert candidate(jewels = \"abcdefg\",stones = \"hijklmnopqrstuvwxyz\") == 0\n assert candidate(jewels = \"MNOPQR\",stones = \"ZYXWVUTSRQPONMLKJIHGFEDCBA\") == 6\n assert candidate(jewels = \"abcdefghijkABCDEFGHIJK\",stones = \"abcdefghijkABCDEFGHIJK\") == 22\n assert candidate(jewels = \"GHIJKL\",stones = \"ghijklGHJKLMN\") == 5\n assert candidate(jewels = \"xyzXYZ\",stones = \"aAbBcCxyzXYZ\") == 6\n assert candidate(jewels = \"abcdef\",stones = \"abcdefabcdefabcdefabcdef\") == 24\n assert candidate(jewels = \"klmnopqrKLMNOPQR\",stones = \"klmnopqrKLMNOPQR\") == 16\n assert candidate(jewels = \"mnopqr\",stones = \"mnopqrstoopqrmmn\") == 14\n assert candidate(jewels = \"abcdefghijABCDEFGHIJ\",stones = \"abcdefghijABCDEFGHIJ\") == 20\n assert candidate(jewels = \"mnopqrstuvwxyz\",stones = \"abcdefghijklmnopqrstuvwxyz\") == 14\n assert candidate(jewels = \"mnopqrstuv\",stones = \"mlkjihgfdsazxcvbnm\") == 5\n assert candidate(jewels = \"klmno\",stones = \"onmlk\") == 5\n assert candidate(jewels = \"123456\",stones = \"112233445566\") == 12\n assert candidate(jewels = \"rstuvw\",stones = \"vwutsr\") == 6\n assert candidate(jewels = \"abcABC\",stones = \"abcABCabcABC\") == 12\n assert candidate(jewels = \"stuvwxyzSTUVWXYZ\",stones = \"stuvwxyzSTUVWXYZ\") == 16\n assert candidate(jewels = \"\",stones = \"abcdefgABCDEFG\") == 0\n assert candidate(jewels = \"xyzXYZ\",stones = \"xyzzzXXYyyZZZ\") == 13\n assert candidate(jewels = \"worldWORLD\",stones = \"wwoorrllddWWOOORRLLDD\") == 21\n assert candidate(jewels = \"qrstuv\",stones = \"qwertyuiopasdfghjklzxcvbnm\") == 6\n assert candidate(jewels = \"abcdef\",stones = \"fedcbaghijklmnopqrstuvwxyz\") == 6\n assert candidate(jewels = \"aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ\",stones = \"zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA\") == 52\n assert candidate(jewels = \"ABCDEFG\",stones = \"abcdefgABCDEFG\") == 7\n assert candidate(jewels = \"xyzXYZ\",stones = \"xYzXyZxYzXyZxYzXyZ\") == 18\n assert candidate(jewels = \"helloHELLO\",stones = \"hheelloollleeHHHELLO\") == 20\n assert candidate(jewels = \"ABCDEFGHIJ\",stones = \"ABCDEFGHIJabcdefghij\") == 10\n assert candidate(jewels = \"asdfghjklzxcvbnm\",stones = \"qwertyuiopzxcvbnmasdfghjklqwertyuiop\") == 16\n assert candidate(jewels = \"VWXYZ\",stones = \"ZYXWV\") == 5\n assert candidate(jewels = \"hijklmnopqrstuvwxyz\",stones = \"abcdefg\") == 0\n assert candidate(jewels = \"abcdefghijklmnopqrstuvwxyz\",stones = \"\") == 0\n assert candidate(jewels = \"12345\",stones = \"5432167890\") == 5\n"}, "metadata": {"canonical_parameter_names": ["jewels", "stones"], "leetcode_dataset_entry_point": "Solution().numJewelsInStones", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numJewelsInStones = function(jewels, stones) {", "container": null, "callable": "numJewelsInStones", "parameters": [{"name": "jewels", "type": "string"}, {"name": "stones", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 773, "task_id": "sliding-puzzle", "difficulty": "Hard", "problem_description": "On an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty square represented by 0. A move consists of choosing 0 and a 4-directionally adjacent number and swapping it.\nThe state of the board is solved if and only if the board is [[1,2,3],[4,5,0]].\nGiven the puzzle board board, return the least number of moves required so that the state of the board is solved. If it is impossible for the state of the board to be solved, return -1.\n \nExample 1:\n\n\nInput: board = [[1,2,3],[4,0,5]]\nOutput: 1\nExplanation: Swap the 0 and the 5 in one move.\n\nExample 2:\n\n\nInput: board = [[1,2,3],[5,4,0]]\nOutput: -1\nExplanation: No number of moves will make the board solved.\n\nExample 3:\n\n\nInput: board = [[4,1,2],[5,0,3]]\nOutput: 5\nExplanation: 5 is the smallest number of moves that solves the board.\nAn example path:\nAfter move 0: [[4,1,2],[5,0,3]]\nAfter move 1: [[4,1,2],[0,5,3]]\nAfter move 2: [[0,1,2],[4,5,3]]\nAfter move 3: [[1,0,2],[4,5,3]]\nAfter move 4: [[1,2,0],[4,5,3]]\nAfter move 5: [[1,2,3],[4,5,0]]\n\n \nConstraints:\n\nboard.length == 2\nboard[i].length == 3\n0 <= board[i][j] <= 5\nEach value board[i][j] is unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(board = [[4, 1, 2], [0, 5, 3]]) == 4\n assert candidate(board = [[3, 2, 4], [1, 5, 0]]) == 14\n assert candidate(board = [[0, 1, 2], [4, 5, 3]]) == 3\n assert candidate(board = [[1, 2, 3], [4, 0, 5]]) == 1\n assert candidate(board = [[1, 2, 0], [3, 4, 5]]) == 13\n assert candidate(board = [[1, 0, 2], [4, 5, 3]]) == 2\n assert candidate(board = [[1, 2, 3], [5, 4, 0]]) == -1\n assert candidate(board = [[0, 1, 2], [3, 4, 5]]) == 15\n assert candidate(board = [[1, 0, 3], [4, 2, 5]]) == 2\n assert candidate(board = [[1, 2, 3], [0, 4, 5]]) == 2\n assert candidate(board = [[4, 1, 2], [5, 0, 3]]) == 5\n assert candidate(board = [[3, 4, 2], [0, 1, 5]]) == -1\n assert candidate(board = [[2, 0, 3], [1, 5, 4]]) == -1\n assert candidate(board = [[2, 5, 3], [0, 4, 1]]) == 14\n assert candidate(board = [[1, 3, 0], [4, 2, 5]]) == 3\n assert candidate(board = [[2, 3, 1], [4, 0, 5]]) == 15\n assert candidate(board = [[4, 1, 0], [2, 5, 3]]) == 7\n assert candidate(board = [[5, 3, 0], [4, 1, 2]]) == 17\n assert candidate(board = [[1, 3, 5], [2, 4, 0]]) == -1\n assert candidate(board = [[2, 3, 4], [1, 0, 5]]) == -1\n assert candidate(board = [[5, 3, 4], [1, 2, 0]]) == 12\n assert candidate(board = [[1, 2, 5], [0, 4, 3]]) == -1\n assert candidate(board = [[4, 3, 2], [1, 5, 0]]) == 20\n assert candidate(board = [[3, 5, 4], [0, 2, 1]]) == 14\n assert candidate(board = [[5, 1, 3], [4, 0, 2]]) == 15\n assert candidate(board = [[2, 3, 0], [1, 5, 4]]) == -1\n assert candidate(board = [[1, 2, 0], [5, 4, 3]]) == -1\n assert candidate(board = [[1, 4, 2], [3, 5, 0]]) == 16\n assert candidate(board = [[2, 3, 4], [5, 0, 1]]) == 15\n assert candidate(board = [[3, 2, 1], [0, 5, 4]]) == 20\n assert candidate(board = [[5, 1, 4], [2, 3, 0]]) == 14\n assert candidate(board = [[5, 3, 0], [1, 4, 2]]) == -1\n assert candidate(board = [[0, 5, 4], [3, 2, 1]]) == 15\n assert candidate(board = [[2, 5, 3], [1, 4, 0]]) == -1\n assert candidate(board = [[0, 5, 4], [2, 3, 1]]) == -1\n assert candidate(board = [[5, 4, 0], [3, 2, 1]]) == 13\n assert candidate(board = [[3, 5, 4], [1, 2, 0]]) == -1\n assert candidate(board = [[5, 0, 2], [4, 3, 1]]) == 16\n assert candidate(board = [[0, 5, 1], [3, 4, 2]]) == 13\n assert candidate(board = [[5, 1, 2], [4, 0, 3]]) == -1\n assert candidate(board = [[1, 3, 5], [4, 0, 2]]) == 5\n assert candidate(board = [[1, 3, 0], [2, 4, 5]]) == -1\n assert candidate(board = [[3, 2, 0], [1, 5, 4]]) == 13\n assert candidate(board = [[3, 1, 2], [0, 4, 5]]) == 16\n assert candidate(board = [[1, 0, 2], [5, 3, 4]]) == 14\n assert candidate(board = [[1, 5, 3], [2, 4, 0]]) == 14\n assert candidate(board = [[5, 1, 2], [4, 3, 0]]) == -1\n assert candidate(board = [[5, 2, 3], [4, 1, 0]]) == -1\n assert candidate(board = [[1, 5, 3], [2, 0, 4]]) == 13\n assert candidate(board = [[3, 5, 2], [4, 1, 0]]) == -1\n assert candidate(board = [[1, 4, 0], [3, 5, 2]]) == 15\n assert candidate(board = [[4, 3, 5], [0, 1, 2]]) == -1\n assert candidate(board = [[4, 1, 2], [5, 3, 0]]) == 6\n assert candidate(board = [[3, 0, 1], [4, 2, 5]]) == -1\n assert candidate(board = [[5, 4, 3], [2, 1, 0]]) == 14\n assert candidate(board = [[1, 0, 5], [4, 3, 2]]) == 6\n assert candidate(board = [[2, 1, 3], [4, 5, 0]]) == -1\n assert candidate(board = [[2, 1, 0], [5, 3, 4]]) == -1\n assert candidate(board = [[4, 3, 1], [5, 0, 2]]) == 9\n assert candidate(board = [[5, 0, 1], [4, 3, 2]]) == -1\n assert candidate(board = [[2, 5, 1], [0, 4, 3]]) == -1\n assert candidate(board = [[4, 0, 2], [3, 5, 1]]) == 14\n assert candidate(board = [[1, 3, 2], [4, 0, 5]]) == -1\n assert candidate(board = [[3, 1, 2], [4, 5, 0]]) == 14\n assert candidate(board = [[4, 2, 0], [5, 1, 3]]) == 7\n assert candidate(board = [[5, 2, 3], [0, 4, 1]]) == -1\n assert candidate(board = [[4, 5, 1], [0, 3, 2]]) == -1\n assert candidate(board = [[4, 3, 0], [1, 2, 5]]) == -1\n assert candidate(board = [[4, 5, 3], [2, 0, 1]]) == -1\n assert candidate(board = [[0, 5, 2], [1, 3, 4]]) == -1\n assert candidate(board = [[2, 1, 3], [0, 5, 4]]) == 14\n assert candidate(board = [[4, 3, 5], [2, 0, 1]]) == 9\n assert candidate(board = [[4, 2, 3], [1, 5, 0]]) == -1\n assert candidate(board = [[2, 5, 3], [4, 0, 1]]) == 13\n assert candidate(board = [[2, 3, 1], [5, 4, 0]]) == -1\n assert candidate(board = [[5, 1, 2], [0, 4, 3]]) == -1\n assert candidate(board = [[3, 0, 1], [4, 5, 2]]) == 12\n assert candidate(board = [[2, 3, 5], [4, 1, 0]]) == -1\n"}, "metadata": {"canonical_parameter_names": ["board"], "leetcode_dataset_entry_point": "Solution().slidingPuzzle", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var slidingPuzzle = function(board) {", "container": null, "callable": "slidingPuzzle", "parameters": [{"name": "board", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 775, "task_id": "global-and-local-inversions", "difficulty": "Medium", "problem_description": "You are given an integer array nums of length n which represents a permutation of all the integers in the range [0, n - 1].\nThe number of global inversions is the number of the different pairs (i, j) where:\n\n0 <= i < j < n\nnums[i] > nums[j]\n\nThe number of local inversions is the number of indices i where:\n\n0 <= i < n - 1\nnums[i] > nums[i + 1]\n\nReturn true if the number of global inversions is equal to the number of local inversions.\n \nExample 1:\n\nInput: nums = [1,0,2]\nOutput: true\nExplanation: There is 1 global inversion and 1 local inversion.\n\nExample 2:\n\nInput: nums = [1,2,0]\nOutput: false\nExplanation: There are 2 global inversions and 1 local inversion.\n\n \nConstraints:\n\nn == nums.length\n1 <= n <= 105\n0 <= nums[i] < n\nAll the integers of nums are unique.\nnums is a permutation of all the numbers in the range [0, n - 1].\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [0, 1, 2, 3, 4]) == True\n assert candidate(nums = [4, 3, 2, 1, 0]) == False\n assert candidate(nums = [2, 0, 1, 3]) == False\n assert candidate(nums = [2, 1, 0, 3]) == False\n assert candidate(nums = [3, 2, 1, 0]) == False\n assert candidate(nums = [0, 2, 1, 3]) == True\n assert candidate(nums = [0, 1, 2, 3]) == True\n assert candidate(nums = [0, 1, 3, 2]) == True\n assert candidate(nums = [1, 0, 2]) == True\n assert candidate(nums = [1, 2, 0]) == False\n assert candidate(nums = [1, 2, 3, 0, 4, 5, 6]) == False\n assert candidate(nums = [0, 2, 4, 1, 3, 5, 7, 6, 9, 8]) == False\n assert candidate(nums = [6, 5, 4, 3, 2, 1, 0]) == False\n assert candidate(nums = [5, 2, 4, 0, 3, 1]) == False\n assert candidate(nums = [2, 1, 0, 3, 4, 5, 6, 7]) == False\n assert candidate(nums = [0, 2, 1, 3, 4, 5, 6, 7]) == True\n assert candidate(nums = [0, 3, 1, 2, 4, 5, 6, 7]) == False\n assert candidate(nums = [1, 3, 0, 2, 5, 4, 7, 6, 9, 8]) == False\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 7, 6, 8, 9, 10, 11]) == True\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == False\n assert candidate(nums = [8, 1, 2, 3, 4, 5, 6, 7, 0]) == False\n assert candidate(nums = [7, 6, 5, 4, 3, 2, 1, 0]) == False\n assert candidate(nums = [0, 2, 4, 1, 3, 5]) == False\n assert candidate(nums = [0, 2, 1, 3, 5, 4, 6]) == True\n assert candidate(nums = [2, 1, 0, 5, 4, 3, 8, 7, 10, 9]) == False\n assert candidate(nums = [2, 3, 0, 1, 4, 5]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 10]) == False\n assert candidate(nums = [6, 4, 2, 0, 3, 1, 8, 5, 7, 9, 10]) == False\n assert candidate(nums = [5, 1, 0, 4, 3, 2]) == False\n assert candidate(nums = [1, 3, 0, 2, 4]) == False\n assert candidate(nums = [2, 1, 0, 5, 4, 3, 8, 7, 6]) == False\n assert candidate(nums = [0, 2, 1, 3, 4, 5, 7, 6, 8]) == True\n assert candidate(nums = [5, 3, 1, 4, 2, 0]) == False\n assert candidate(nums = [2, 0, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11]) == False\n assert candidate(nums = [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9]) == True\n assert candidate(nums = [11, 5, 3, 7, 2, 8, 1, 6, 9, 4, 0, 10]) == False\n assert candidate(nums = [1, 2, 3, 0, 4, 5, 6, 7, 8, 9]) == False\n assert candidate(nums = [13, 7, 5, 9, 3, 11, 2, 10, 12, 4, 1, 6, 8, 0]) == False\n assert candidate(nums = [3, 0, 1, 2, 5, 4]) == False\n assert candidate(nums = [1, 0, 3, 2, 5, 4]) == True\n assert candidate(nums = [1, 2, 4, 3, 6, 5, 8, 7, 10, 9]) == True\n assert candidate(nums = [3, 0, 1, 2, 5, 4, 7, 6, 9, 8]) == False\n assert candidate(nums = [0, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9, 11]) == False\n assert candidate(nums = [5, 0, 1, 2, 3, 4, 6, 7, 8, 9]) == False\n assert candidate(nums = [4, 0, 3, 1, 2, 6, 5, 8, 9, 7]) == False\n assert candidate(nums = [0, 2, 1, 4, 3, 5]) == True\n assert candidate(nums = [1, 0, 3, 2, 5, 4, 6]) == True\n assert candidate(nums = [1, 3, 0, 2, 4, 5, 7, 6, 8, 9]) == False\n assert candidate(nums = [4, 0, 2, 1, 3]) == False\n assert candidate(nums = [1, 0, 3, 2, 5, 4, 7, 6, 9, 8]) == True\n assert candidate(nums = [5, 2, 3, 4, 0, 1, 6, 7, 8, 9]) == False\n assert candidate(nums = [9, 0, 8, 1, 7, 2, 6, 3, 5, 4]) == False\n assert candidate(nums = [1, 3, 0, 2, 4, 5]) == False\n assert candidate(nums = [5, 4, 3, 2, 1, 0]) == False\n assert candidate(nums = [0, 1, 3, 2, 4, 5, 7, 6, 8, 9, 11, 10]) == True\n assert candidate(nums = [5, 0, 1, 2, 3, 4]) == False\n assert candidate(nums = [10, 3, 4, 5, 2, 1, 8, 6, 9, 7, 0]) == False\n assert candidate(nums = [0, 1, 3, 2, 4, 5, 6]) == True\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == True\n assert candidate(nums = [0, 1, 2, 4, 3, 5, 6, 7]) == True\n assert candidate(nums = [0, 2, 1, 3, 4]) == True\n assert candidate(nums = [1, 0, 5, 4, 3, 2, 6]) == False\n assert candidate(nums = [1, 0, 2, 3, 4, 5, 6, 7]) == True\n assert candidate(nums = [0, 1, 2, 3, 4, 5]) == True\n assert candidate(nums = [3, 1, 0, 4, 2, 5]) == False\n assert candidate(nums = [1, 3, 2, 4, 0, 5, 6, 7, 8, 9]) == False\n assert candidate(nums = [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == False\n assert candidate(nums = [0, 1, 3, 2, 4]) == True\n assert candidate(nums = [4, 3, 2, 1, 0]) == False\n assert candidate(nums = [0, 2, 1, 3, 5, 4, 7, 6, 9, 8]) == True\n assert candidate(nums = [1, 3, 0, 2, 4]) == False\n assert candidate(nums = [0, 1, 3, 2, 5, 4, 7, 6, 9, 8]) == True\n assert candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1, 0]) == False\n assert candidate(nums = [2, 0, 1, 4, 3, 6, 5, 8, 7, 9]) == False\n assert candidate(nums = [0, 2, 1, 3, 4, 5]) == True\n assert candidate(nums = [0, 2, 3, 1, 4, 5, 6]) == False\n assert candidate(nums = [0, 2, 1, 4, 3, 6, 5, 8, 7, 9]) == True\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 0]) == False\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6]) == True\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 12, 13, 14]) == False\n assert candidate(nums = [0, 1, 3, 2, 4, 6, 5, 7]) == True\n assert candidate(nums = [6, 0, 5, 2, 1, 4, 3]) == False\n assert candidate(nums = [8, 0, 7, 1, 6, 2, 5, 3, 4]) == False\n assert candidate(nums = [10, 1, 9, 2, 8, 3, 7, 4, 6, 5, 0]) == False\n assert candidate(nums = [0, 2, 1, 3, 5, 4]) == True\n assert candidate(nums = [4, 3, 2, 1, 0, 5]) == False\n assert candidate(nums = [6, 2, 3, 5, 0, 4, 1]) == False\n assert candidate(nums = [2, 0, 1, 4, 3, 6, 5, 8, 7, 9, 10, 11]) == False\n assert candidate(nums = [0, 3, 1, 2, 4, 5, 6, 7, 8, 9]) == False\n assert candidate(nums = [0, 1, 2, 4, 3, 5, 7, 6]) == True\n assert candidate(nums = [0, 3, 2, 1, 4]) == False\n assert candidate(nums = [1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10]) == True\n assert candidate(nums = [3, 0, 2, 1, 4, 5, 6, 7, 8, 9]) == False\n assert candidate(nums = [1, 0, 3, 2, 5, 4, 7, 6]) == True\n assert candidate(nums = [3, 0, 1, 2, 5, 4, 6, 7]) == False\n assert candidate(nums = [4, 3, 0, 1, 2]) == False\n assert candidate(nums = [1, 3, 2, 0, 5, 4, 6]) == False\n assert candidate(nums = [5, 4, 3, 2, 1, 0]) == False\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == False\n assert candidate(nums = [5, 2, 3, 0, 1, 4]) == False\n assert candidate(nums = [0, 1, 2, 3, 5, 4, 6, 7, 8]) == True\n assert candidate(nums = [12, 6, 4, 8, 2, 10, 1, 7, 11, 3, 0, 5, 9]) == False\n assert candidate(nums = [2, 4, 0, 1, 3, 5]) == False\n assert candidate(nums = [1, 2, 3, 0, 4, 5]) == False\n assert candidate(nums = [9, 4, 2, 5, 7, 1, 3, 6, 8, 0]) == False\n assert candidate(nums = [1, 2, 0, 3, 4, 5, 6, 7, 8, 9]) == False\n assert candidate(nums = [7, 3, 4, 1, 2, 0, 5, 6]) == False\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().isIdealPermutation", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isIdealPermutation = function(nums) {", "container": null, "callable": "isIdealPermutation", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 777, "task_id": "swap-adjacent-in-lr-string", "difficulty": "Medium", "problem_description": "In a string composed of 'L', 'R', and 'X' characters, like \"RXXLRXRXL\", a move consists of either replacing one occurrence of \"XL\" with \"LX\", or replacing one occurrence of \"RX\" with \"XR\". Given the starting string start and the ending string result, return True if and only if there exists a sequence of moves to transform start to result.\n \nExample 1:\n\nInput: start = \"RXXLRXRXL\", result = \"XRLXXRRLX\"\nOutput: true\nExplanation: We can transform start to result following these steps:\nRXXLRXRXL ->\nXRXLRXRXL ->\nXRLXRXRXL ->\nXRLXXRRXL ->\nXRLXXRRLX\n\nExample 2:\n\nInput: start = \"X\", result = \"L\"\nOutput: false\n\n \nConstraints:\n\n1 <= start.length <= 104\nstart.length == result.length\nBoth start and result will only consist of characters in 'L', 'R', and 'X'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(start = \"XXL\",result = \"LXX\") == True\n assert candidate(start = \"RXXLRXRXL\",result = \"XRLXXRRLX\") == True\n assert candidate(start = \"LLR\",result = \"RRL\") == False\n assert candidate(start = \"RXXL\",result = \"XRXL\") == True\n assert candidate(start = \"XRXL\",result = \"LXXR\") == False\n assert candidate(start = \"RL\",result = \"LR\") == False\n assert candidate(start = \"RLX\",result = \"LXR\") == False\n assert candidate(start = \"XXXXXLXXXX\",result = \"LXXXXXXXXX\") == True\n assert candidate(start = \"XXRXXLXXXX\",result = \"XXXXRXXLXX\") == False\n assert candidate(start = \"XXLXXRXXX\",result = \"XXXLXXRXX\") == False\n assert candidate(start = \"RLXXXRRLL\",result = \"RXXRLXXLR\") == False\n assert candidate(start = \"XXXX\",result = \"XXXX\") == True\n assert candidate(start = \"LXXR\",result = \"XRXL\") == False\n assert candidate(start = \"RXX\",result = \"XXR\") == True\n assert candidate(start = \"XRLR\",result = \"LRXR\") == False\n assert candidate(start = \"XRXRX\",result = \"XXRRX\") == True\n assert candidate(start = \"LL\",result = \"RR\") == False\n assert candidate(start = \"X\",result = \"L\") == False\n assert candidate(start = \"LRRXXLRR\",result = \"XXLLRRRR\") == False\n assert candidate(start = \"XXRXLXLRRXL\",result = \"LXXRXRXLRXR\") == False\n assert candidate(start = \"RXLXLXLXXR\",result = \"XXLXLXLRXR\") == False\n assert candidate(start = \"RXXRXXRXX\",result = \"XXRXXRXXR\") == True\n assert candidate(start = \"RXLXLXLXRXXR\",result = \"LXRXRXRXLXXR\") == False\n assert candidate(start = \"RXXLXXRXLXXL\",result = \"XRLXXXRXLXXL\") == True\n assert candidate(start = \"RRXXLXXR\",result = \"RRXLXXXR\") == True\n assert candidate(start = \"RRXLXXL\",result = \"XXLXXLR\") == False\n assert candidate(start = \"RXLXLXLXL\",result = \"LXRXRXRXL\") == False\n assert candidate(start = \"LLLLLXXXXXX\",result = \"XXXXXXXXLLL\") == False\n assert candidate(start = \"RXLXRXLXX\",result = \"XRLXLXXRX\") == False\n assert candidate(start = \"LXXRXXLXXLR\",result = \"XLXXRXXRLXR\") == False\n assert candidate(start = \"RRRRRRXXXXX\",result = \"XXXXXRRRRRR\") == True\n assert candidate(start = \"RXLXXLXXR\",result = \"XRLXXLXXR\") == True\n assert candidate(start = \"LXXRXRXLR\",result = \"XXLRXRXLX\") == False\n assert candidate(start = \"LXXRXRXLX\",result = \"XLXRLXXRX\") == False\n assert candidate(start = \"LXXXXXXRXX\",result = \"XXLXXXXXRX\") == False\n assert candidate(start = \"RXXXXL\",result = \"XXLRXX\") == False\n assert candidate(start = \"LRXLRXLRXLR\",result = \"RXLRXLRXLRX\") == False\n assert candidate(start = \"RRXXLXXLXXR\",result = \"XXRXLXXRXLR\") == False\n assert candidate(start = \"XXLRLRXRXRX\",result = \"LLRXRXRXRXR\") == False\n assert candidate(start = \"LRRXLXXR\",result = \"XLLRXRXR\") == False\n assert candidate(start = \"RXXXXXXLXX\",result = \"XXXXXXLRXX\") == False\n assert candidate(start = \"XLXRXLXRXLX\",result = \"LXRLXRLXRLX\") == False\n assert candidate(start = \"RXRXRXRXRXR\",result = \"XRXRXRXRXRX\") == False\n assert candidate(start = \"XXRXLXRLX\",result = \"XRLXXRXRX\") == False\n assert candidate(start = \"RXXLXLXXRL\",result = \"XLRXRXRXLX\") == False\n assert candidate(start = \"RRXLRXLXXL\",result = \"XRLXXLRXLR\") == False\n assert candidate(start = \"LRRXLXXL\",result = \"XXLRXXRL\") == False\n assert candidate(start = \"LRLRLRLRLRL\",result = \"RLRLRLRLRLR\") == False\n assert candidate(start = \"RRRXXXXXXXL\",result = \"XXXXXXLRRRR\") == False\n assert candidate(start = \"LXXLRXXLXXR\",result = \"XXRXXLXXLR\") == False\n assert candidate(start = \"XXLXXLXXLXX\",result = \"LXXLXXLXXLX\") == False\n assert candidate(start = \"RXXXXLRRXXL\",result = \"XXLRXRXRLXX\") == False\n assert candidate(start = \"RXLXXLXXRLXX\",result = \"XLXXLXXLXXRX\") == False\n assert candidate(start = \"RXXLRXRXLXXL\",result = \"XRLXXRRLXRXL\") == False\n assert candidate(start = \"LXRXRXRXRLX\",result = \"XRLXRXRXLXL\") == False\n assert candidate(start = \"RRXXLXXLXXR\",result = \"LLXXRXRXRXR\") == False\n assert candidate(start = \"XXLXXRXR\",result = \"XLXXLXXR\") == False\n assert candidate(start = \"LRXXLXXR\",result = \"LXXRXXRL\") == False\n assert candidate(start = \"RLXXXXL\",result = \"XRLXXXX\") == False\n assert candidate(start = \"LXXRXRXXL\",result = \"XLRXLXXRX\") == False\n assert candidate(start = \"RLXXXLR\",result = \"XRLXXLR\") == False\n assert candidate(start = \"RRXXLXXR\",result = \"XXRXXRRL\") == False\n assert candidate(start = \"LRXRXLXRXL\",result = \"RXLXLRXLRX\") == False\n assert candidate(start = \"RXXXXLXXXR\",result = \"XXLXXXRXRX\") == False\n assert candidate(start = \"LXXRXRXL\",result = \"XXLXRXRX\") == False\n assert candidate(start = \"XRXRXRXRXRX\",result = \"RXRXRXRXRXR\") == False\n assert candidate(start = \"RXLXRXLX\",result = \"XRLXXLXR\") == False\n assert candidate(start = \"XXXXLXXXXLXXX\",result = \"LXXXXXXXXXXLX\") == False\n assert candidate(start = \"RXXLXXRXLXX\",result = \"XXLRXRXLXX\") == False\n assert candidate(start = \"RXLRXRXL\",result = \"LXXRXXRXL\") == False\n assert candidate(start = \"LXXRXRXLXX\",result = \"XXLXXRXLXR\") == False\n assert candidate(start = \"RXXRXRXRX\",result = \"XXRXXRXXR\") == False\n assert candidate(start = \"RRXXLXXLXXL\",result = \"XXLXRXRXLXR\") == False\n assert candidate(start = \"LXLXLXLXL\",result = \"XLXLXLXLX\") == False\n assert candidate(start = \"RXLXRXRXRXL\",result = \"LXRXRXRXRXL\") == False\n assert candidate(start = \"XRXLXXRXL\",result = \"XXLXXRXXR\") == False\n assert candidate(start = \"RRXLXRXLL\",result = \"XXRXLRXLR\") == False\n assert candidate(start = \"RXLRLXXLR\",result = \"XLRLXLRXR\") == False\n assert candidate(start = \"RXRXRXRXRX\",result = \"XRXRXRXRXR\") == True\n assert candidate(start = \"RRXXXXLL\",result = \"LLXXXXRR\") == False\n assert candidate(start = \"RXXRXRXLXX\",result = \"XXRXXRXLXR\") == False\n assert candidate(start = \"XXRXXL\",result = \"LXXRXX\") == False\n assert candidate(start = \"XRXLXLXLXL\",result = \"LXRXRXRXRX\") == False\n assert candidate(start = \"RXLXLXLXL\",result = \"XLXLXLXLR\") == False\n assert candidate(start = \"XXXXXXXXXXX\",result = \"XXXXXXXXXXX\") == True\n assert candidate(start = \"RXLXXLXXR\",result = \"XXLXXRXLR\") == False\n assert candidate(start = \"RXLXLXLXR\",result = \"XRLXLXLXR\") == True\n assert candidate(start = \"XXLXXRXXLXXR\",result = \"XXLXXLXXRXXR\") == False\n assert candidate(start = \"RXLXRRXLX\",result = \"XRLXXRXLX\") == False\n assert candidate(start = \"LXXRXRXXL\",result = \"XXLRXRXLX\") == False\n assert candidate(start = \"LXRXRXLXR\",result = \"XXLXLXLXR\") == False\n assert candidate(start = \"RXLXLXRX\",result = \"LXRXLXXR\") == False\n assert candidate(start = \"RXXXXLXRXL\",result = \"XRLXXRXLXX\") == False\n assert candidate(start = \"RRXXLLRXXXR\",result = \"XXLRRLXXRXR\") == False\n assert candidate(start = \"LXXLXRXLX\",result = \"XXLXXRLRX\") == False\n assert candidate(start = \"XLRXLRXLRXL\",result = \"LXRLXRLXRLX\") == True\n assert candidate(start = \"XRXXLXXRXL\",result = \"XRLXXRXLXX\") == False\n assert candidate(start = \"XXRLRXXL\",result = \"LXXLRXXR\") == False\n assert candidate(start = \"LXXRXXL\",result = \"XXLXXRXL\") == False\n assert candidate(start = \"RXLXRXRXLXR\",result = \"XRLXRXRXLXR\") == True\n assert candidate(start = \"LXRXRXRXLXXL\",result = \"XXLXXLXXLXXR\") == False\n assert candidate(start = \"RXLXXRXLX\",result = \"XRLXXLXXR\") == False\n assert candidate(start = \"XXLRRXXLXXR\",result = \"LXXLXXRXXRX\") == False\n assert candidate(start = \"XXLRXXLXX\",result = \"LXXRXXLXX\") == True\n assert candidate(start = \"RRXXLXXL\",result = \"XXLXXLRX\") == False\n assert candidate(start = \"RXXLXXXL\",result = \"XXLXRXLX\") == False\n assert candidate(start = \"LXRXRXRXL\",result = \"XXLXXRXXLR\") == False\n assert candidate(start = \"RRXXLXXR\",result = \"XXRRLXXR\") == True\n assert candidate(start = \"LLRRLRRRLL\",result = \"RLLLLRRRLL\") == False\n assert candidate(start = \"LXXXXLXXXXR\",result = \"XXXXLXXLXXR\") == False\n assert candidate(start = \"RXLXRXLXR\",result = \"XRLXRXLRX\") == False\n assert candidate(start = \"LRXXLXRXXRL\",result = \"XRLXLXXRRLX\") == False\n assert candidate(start = \"RXXLXXLXXR\",result = \"LXXRXXLXXR\") == False\n assert candidate(start = \"RXXLRLXXRX\",result = \"XRLXXLXXRX\") == False\n assert candidate(start = \"LXXXXXXRRRR\",result = \"RRRRXXXXXXL\") == False\n assert candidate(start = \"LXXRXXLXX\",result = \"XLRXXLXXX\") == False\n assert candidate(start = \"LXXLXXLXXL\",result = \"XXLXXLXXLX\") == False\n assert candidate(start = \"LRXXLXXRL\",result = \"LXXRXXLRL\") == False\n assert candidate(start = \"RXLXRXRXLXRX\",result = \"LXRXRXRXRXRX\") == False\n assert candidate(start = \"XXRLXXLXXR\",result = \"LXXRXXRXXL\") == False\n assert candidate(start = \"LXXLXXRXXR\",result = \"XXRXXLXXL\") == False\n assert candidate(start = \"RXLXRXRXLXXL\",result = \"XLXXLXXLXXRX\") == False\n assert candidate(start = \"RXRXRXRXR\",result = \"RRRRRXRXR\") == False\n assert candidate(start = \"RXLXXLRXLX\",result = \"XXLXXRXRXL\") == False\n assert candidate(start = \"RXLXXRXXL\",result = \"XXLRXRXLX\") == False\n assert candidate(start = \"LRRRRRXXL\",result = \"XXLRRRRRR\") == False\n assert candidate(start = \"LXXLXXLXXLX\",result = \"LXLXLXLXXLX\") == False\n assert candidate(start = \"RXXLRXXLXXRXXL\",result = \"XXLXXRXRXLXXR\") == False\n assert candidate(start = \"XXXXXXXXXX\",result = \"XXXXXXXXXX\") == True\n assert candidate(start = \"RXLR\",result = \"LXRR\") == False\n assert candidate(start = \"LRLR\",result = \"RLLR\") == False\n assert candidate(start = \"RLXXRXLXXR\",result = \"RLXXRXLXXR\") == True\n assert candidate(start = \"XXRXL\",result = \"XXLXR\") == False\n assert candidate(start = \"XRXXLXL\",result = \"XRLXXXL\") == True\n assert candidate(start = \"RXLXRX\",result = \"XRLXXR\") == True\n assert candidate(start = \"LXXR\",result = \"LRXX\") == False\n assert candidate(start = \"RLXXRXLXL\",result = \"XRLXXLRXL\") == False\n assert candidate(start = \"LXXRXXL\",result = \"XXLXXRL\") == False\n assert candidate(start = \"XXRXLXLXX\",result = \"XLXXXLRXX\") == False\n assert candidate(start = \"RXRXRXRX\",result = \"XRXRXRXR\") == True\n assert candidate(start = \"RLXXXRRXXL\",result = \"RLXXXXXRRXLX\") == False\n assert candidate(start = \"RXL\",result = \"LXR\") == False\n assert candidate(start = \"RXLXLXR\",result = \"XLRXRXL\") == False\n assert candidate(start = \"RLXXXXXXXXXXRXXL\",result = \"XRLXXXXXXXXXXRLX\") == False\n assert candidate(start = \"RLXXXRRXXL\",result = \"RLXXXRXLXL\") == False\n assert candidate(start = \"RLXXXXXXL\",result = \"LXXXXXXXX\") == False\n assert candidate(start = \"LXXXXLXXXX\",result = \"XXXXXXXXLL\") == False\n assert candidate(start = \"RLRXXRLLXL\",result = \"RLRXRLLXXL\") == False\n assert candidate(start = \"RLXXRXLX\",result = \"LXRXRXXL\") == False\n assert candidate(start = \"RXLX\",result = \"XLXR\") == False\n assert candidate(start = \"XRLXXRLXXX\",result = \"XXXRLXXRLX\") == False\n assert candidate(start = \"LXXXRXX\",result = \"XXLXXRX\") == False\n assert candidate(start = \"XXXXX\",result = \"XXXXX\") == True\n assert candidate(start = \"RXLR\",result = \"LXRX\") == False\n assert candidate(start = \"RXLXLXRXL\",result = \"XXRLXXLXR\") == False\n assert candidate(start = \"RXXXXXLXXX\",result = \"XXXXXXLRXX\") == False\n assert candidate(start = \"XXLXXRXXLX\",result = \"XXXLXXRXLX\") == False\n assert candidate(start = \"RXXLRXRXLX\",result = \"XRLXXRRXLX\") == True\n assert candidate(start = \"RXXXXXXXXR\",result = \"XXXXXXXXXR\") == False\n assert candidate(start = \"RXXXL\",result = \"LXXXX\") == False\n assert candidate(start = \"RXR\",result = \"XRX\") == False\n assert candidate(start = \"LLRRLRLLRL\",result = \"LRLRLLRLRL\") == False\n assert candidate(start = \"RXXLRXRXLXX\",result = \"XRLXXRRLXXX\") == True\n assert candidate(start = \"RRXXLXXL\",result = \"XXRLXXLR\") == False\n assert candidate(start = \"RLXX\",result = \"XLRX\") == False\n assert candidate(start = \"LRLR\",result = \"LRLR\") == True\n assert candidate(start = \"XXLXXRXXL\",result = \"LXXXXRXXX\") == False\n assert candidate(start = \"XRXR\",result = \"RXXR\") == False\n assert candidate(start = \"RXXXXXLXXXL\",result = \"XLRXXXXXXRL\") == False\n assert candidate(start = \"XXLX\",result = \"LXXX\") == True\n assert candidate(start = \"RLXXRXLXLX\",result = \"LRXXRXLXLX\") == False\n assert candidate(start = \"LLRXXRXL\",result = \"LXXLRXRL\") == False\n assert candidate(start = \"XRXRXRXXLX\",result = \"XXLRXRXLXX\") == False\n assert candidate(start = \"RXXLRXRXL\",result = \"XRLXRXRXL\") == True\n assert candidate(start = \"LXXXXLXXXX\",result = \"XXXXXXXXXX\") == False\n assert candidate(start = \"LXXR\",result = \"XLXR\") == False\n assert candidate(start = \"XXLXLXRXRXXLXXXXL\",result = \"XXXLLXXXXXXLRLXXR\") == False\n assert candidate(start = \"RXXLRXRXL\",result = \"XRLXXRRXL\") == True\n assert candidate(start = \"XXLXR\",result = \"LXXRX\") == False\n assert candidate(start = \"XXXXXXX\",result = \"XXXXXXX\") == True\n assert candidate(start = \"XXXLXXRXX\",result = \"XXLXXXXXR\") == True\n assert candidate(start = \"LXXXXLXXXXL\",result = \"LXLXLXLXL\") == False\n assert candidate(start = \"RXLXL\",result = \"LXRXR\") == False\n assert candidate(start = \"RXXXXRXXXX\",result = \"XXXXXXXXXX\") == False\n assert candidate(start = \"LRLR\",result = \"LRRL\") == False\n assert candidate(start = \"RLXXXXXXLRLX\",result = \"LXXXXXXXXXRL\") == False\n assert candidate(start = \"XXLXXLXX\",result = \"LXXLXXLX\") == False\n assert candidate(start = \"RLXXXRXL\",result = \"XRLXXRXL\") == False\n assert candidate(start = \"RXLXRXRXRX\",result = \"XRXRXRXLXR\") == False\n assert candidate(start = \"RXXLRXRXLXR\",result = \"XRLXXRRLXXR\") == True\n assert candidate(start = \"LLLL\",result = \"LLLL\") == True\n assert candidate(start = \"LXXLXRLXXL\",result = \"XLLXRXXLXL\") == False\n assert candidate(start = \"XRL\",result = \"LXR\") == False\n assert candidate(start = \"RLXXL\",result = \"LXXRL\") == False\n assert candidate(start = \"RRXXLXXR\",result = \"RXLXXRRX\") == False\n assert candidate(start = \"RRRR\",result = \"RRRR\") == True\n assert candidate(start = \"XXLXXLXXXX\",result = \"LXLXXXXXXL\") == False\n assert candidate(start = \"LXXLXRXRXL\",result = \"XLLXRXXRXX\") == False\n assert candidate(start = \"RXRXL\",result = \"XRLXR\") == False\n assert candidate(start = \"LRXXRXLX\",result = \"LXRLXXRX\") == False\n assert candidate(start = \"RXL\",result = \"XLR\") == False\n assert candidate(start = \"XXLXXXXLXX\",result = \"XXLXXXXLXX\") == True\n assert candidate(start = \"RXLXLXRXL\",result = \"XXRLXLXLX\") == False\n assert candidate(start = \"XXRXLXLXX\",result = \"LXXRXLXXR\") == False\n assert candidate(start = \"LXX\",result = \"XXL\") == False\n assert candidate(start = \"RXXLRXRXL\",result = \"XRXXLXRXL\") == False\n assert candidate(start = \"RXLXLXR\",result = \"LXRXLXR\") == False\n assert candidate(start = \"XXXXXXXLXX\",result = \"LXXXXXXXXX\") == True\n assert candidate(start = \"RXRXLXLXX\",result = \"XXRLXXLXR\") == False\n assert candidate(start = \"RLXXXL\",result = \"XLRXRX\") == False\n assert candidate(start = \"LXR\",result = \"XLR\") == False\n assert candidate(start = \"RXRXLXL\",result = \"XRLXXLR\") == False\n assert candidate(start = \"XXXXLXXXX\",result = \"LXXXXXXXX\") == True\n assert candidate(start = \"LXXXXXXR\",result = \"RXXXXXXL\") == False\n assert candidate(start = \"LXXLXRLXX\",result = \"XLLXRXXRX\") == False\n assert candidate(start = \"RXLR\",result = \"LXXR\") == False\n assert candidate(start = \"XXXXXLXXXX\",result = \"XXXXLXXXXX\") == True\n assert candidate(start = \"LXXLXRXRXXL\",result = \"XLLXRRLXXXL\") == False\n assert candidate(start = \"RXR\",result = \"RXR\") == True\n assert candidate(start = \"RXXLXXXXXX\",result = \"XXXXXXLXXR\") == False\n assert candidate(start = \"RLXXXXXRXL\",result = \"XRLXXRXLXR\") == False\n assert candidate(start = \"RLXXLRXRXL\",result = \"LRXXRXLXRX\") == False\n assert candidate(start = \"RRLL\",result = \"LLRR\") == False\n assert candidate(start = \"LXXR\",result = \"XXLR\") == False\n assert candidate(start = \"RXLXRXRXL\",result = \"XRLXXRRLX\") == True\n assert candidate(start = \"LR\",result = \"LR\") == True\n assert candidate(start = \"RLXXL\",result = \"XLRXL\") == False\n assert candidate(start = \"XXLXXXRXX\",result = \"LXXXXXXRX\") == True\n assert candidate(start = \"LXRX\",result = \"XLXR\") == False\n assert candidate(start = \"LLRR\",result = \"LLRR\") == True\n assert candidate(start = \"LLRXRXL\",result = \"LRXRLXL\") == False\n assert candidate(start = \"LXXR\",result = \"XRLX\") == False\n assert candidate(start = \"RXL\",result = \"XRL\") == True\n assert candidate(start = \"XXRXL\",result = \"XRLXX\") == False\n assert candidate(start = \"LXXLXRLXXL\",result = \"XLLXRXLXLX\") == False\n assert candidate(start = \"RLXXRXLXR\",result = \"XRLXXLRXR\") == False\n assert candidate(start = \"RXXXXXLXXXL\",result = \"XXXXXXXXLRL\") == False\n assert candidate(start = \"RLXXXRRLL\",result = \"RLXXRXXLL\") == False\n assert candidate(start = \"RXXLRXRXL\",result = \"XLRXXRRLX\") == False\n assert candidate(start = \"XXRXXXXL\",result = \"XXXXLXXR\") == False\n assert candidate(start = \"LXXL\",result = \"XLXL\") == False\n assert candidate(start = \"RXXLRXRXLX\",result = \"XRLXXRXRXL\") == False\n assert candidate(start = \"RXXLRXRXL\",result = \"RXXLRXRXL\") == True\n assert candidate(start = \"LLXXRRLXXL\",result = \"LXRXRLXLX\") == False\n assert candidate(start = \"LR\",result = \"RL\") == False\n assert candidate(start = \"RLXXLRXRXL\",result = \"LRXXLXLXXR\") == False\n assert candidate(start = \"XXXXXX\",result = \"XXXXXX\") == True\n assert candidate(start = \"LXR\",result = \"LRX\") == False\n assert candidate(start = \"XRLXXRRLX\",result = \"RXXLRXRXL\") == False\n assert candidate(start = \"LXXLXRXRXL\",result = \"XLLXRXRXLX\") == False\n assert candidate(start = \"XXR\",result = \"RXX\") == False\n assert candidate(start = \"LLRXXRXLX\",result = \"XLLXRXXRX\") == False\n assert candidate(start = \"XXRXL\",result = \"LXXRX\") == False\n assert candidate(start = \"XRLXL\",result = \"LXRLX\") == False\n assert candidate(start = \"XXXXXLXXXX\",result = \"XXXXXLXXXX\") == True\n assert candidate(start = \"RXLR\",result = \"LRXR\") == False\n assert candidate(start = \"RXRXXRXL\",result = \"XXRXLXRL\") == False\n"}, "metadata": {"canonical_parameter_names": ["start", "result"], "leetcode_dataset_entry_point": "Solution().canTransform", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var canTransform = function(start, result) {", "container": null, "callable": "canTransform", "parameters": [{"name": "start", "type": "string"}, {"name": "result", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 778, "task_id": "swim-in-rising-water", "difficulty": "Hard", "problem_description": "You are given an n x n integer matrix grid where each value grid[i][j] represents the elevation at that point (i, j).\nThe rain starts to fall. At time t, the depth of the water everywhere is t. You can swim from a square to another 4-directionally adjacent square if and only if the elevation of both squares individually are at most t. You can swim infinite distances in zero time. Of course, you must stay within the boundaries of the grid during your swim.\nReturn the least time until you can reach the bottom right square (n - 1, n - 1) if you start at the top left square (0, 0).\n \nExample 1:\n\n\nInput: grid = [[0,2],[1,3]]\nOutput: 3\nExplanation:\nAt time 0, you are in grid location (0, 0).\nYou cannot go anywhere else because 4-directionally adjacent neighbors have a higher elevation than t = 0.\nYou cannot reach point (1, 1) until time 3.\nWhen the depth of water is 3, we can swim anywhere inside the grid.\n\nExample 2:\n\n\nInput: grid = [[0,1,2,3,4],[24,23,22,21,5],[12,13,14,15,16],[11,17,18,19,20],[10,9,8,7,6]]\nOutput: 16\nExplanation: The final route is shown.\nWe need to wait until time 16 so that (0, 0) and (4, 4) are connected.\n\n \nConstraints:\n\nn == grid.length\nn == grid[i].length\n1 <= n <= 50\n0 <= grid[i][j] < n2\nEach value grid[i][j] is unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[3, 0, 8, 4], [2, 5, 1, 7], [9, 6, 10, 11], [13, 12, 14, 15]]) == 15\n assert candidate(grid = [[7, 1, 4, 0, 5], [2, 3, 6, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [20, 21, 22, 23, 24]]) == 24\n assert candidate(grid = [[0, 1, 2, 3, 4], [24, 23, 22, 21, 5], [12, 13, 14, 15, 16], [11, 17, 18, 19, 20], [10, 9, 8, 7, 6]]) == 16\n assert candidate(grid = [[0, 2], [1, 3]]) == 3\n assert candidate(grid = [[0]]) == 0\n assert candidate(grid = [[3, 0, 8, 0, 0], [0, 2, 0, 0, 4], [0, 0, 1, 2, 0], [0, 9, 0, 3, 0], [7, 0, 3, 0, 5]]) == 8\n assert candidate(grid = [[3, 0, 8, 0, 6], [5, 0, 0, 4, 0], [7, 8, 9, 5, 0], [9, 0, 0, 9, 0], [0, 4, 6, 0, 7]]) == -1\n assert candidate(grid = [[1, 14, 15, 16, 17, 18], [2, 13, 24, 23, 22, 19], [3, 12, 25, 28, 27, 20], [4, 11, 26, 29, 30, 21], [5, 10, 27, 32, 31, 34], [6, 9, 8, 7, 33, 35]]) == 35\n assert candidate(grid = [[0, 7, 4, 10, 5, 9], [2, 1, 6, 12, 8, 11], [3, 13, 30, 18, 14, 17], [15, 19, 24, 28, 21, 22], [32, 33, 31, 25, 26, 27], [16, 20, 23, 29, 34, 35]]) == 35\n assert candidate(grid = [[25, 24, 23, 22, 21, 20], [19, 18, 17, 16, 15, 14], [13, 12, 11, 10, 9, 8], [7, 6, 5, 4, 3, 2], [1, 0, 26, 27, 28, 29], [35, 34, 33, 32, 31, 30]]) == 30\n assert candidate(grid = [[0, 3, 2, 4, 1], [7, 6, 5, 8, 9], [12, 11, 10, 13, 14], [19, 18, 17, 16, 15], [24, 23, 22, 21, 20]]) == 20\n assert candidate(grid = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [19, 18, 17, 16, 15, 14, 13, 12, 11, 10], [20, 21, 22, 23, 24, 25, 26, 27, 28, 29], [39, 38, 37, 36, 35, 34, 33, 32, 31, 30], [40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [59, 58, 57, 56, 55, 54, 53, 52, 51, 50], [60, 61, 62, 63, 64, 65, 66, 67, 68, 69], [79, 78, 77, 76, 75, 74, 73, 72, 71, 70], [80, 81, 82, 83, 84, 85, 86, 87, 88, 89], [99, 98, 97, 96, 95, 94, 93, 92, 91, 90]]) == 90\n assert candidate(grid = [[5, 0, 4, 1, 2, 6], [9, 11, 13, 15, 17, 19], [8, 10, 12, 14, 16, 18], [7, 3, 23, 21, 25, 27], [6, 22, 20, 24, 26, 28], [29, 30, 31, 32, 33, 34]]) == 34\n assert candidate(grid = [[8, 3, 2, 6, 1, 4], [7, 5, 0, 9, 11, 13], [12, 10, 14, 15, 17, 19], [16, 18, 20, 21, 23, 25], [22, 24, 26, 27, 29, 31], [28, 30, 32, 33, 34, 35]]) == 35\n assert candidate(grid = [[0, 1, 2, 3, 4, 5], [16, 15, 14, 13, 12, 6], [17, 28, 27, 26, 11, 7], [18, 29, 34, 25, 10, 8], [19, 30, 33, 32, 9, 13], [20, 21, 22, 23, 24, 14]]) == 14\n assert candidate(grid = [[30, 29, 28, 27, 26, 25, 24], [31, 8, 7, 6, 5, 4, 23], [32, 9, 0, 1, 2, 3, 22], [33, 10, 11, 12, 13, 14, 21], [34, 19, 18, 17, 16, 15, 20], [35, 36, 37, 38, 39, 40, 41], [42, 43, 44, 45, 46, 47, 48]]) == 48\n assert candidate(grid = [[1, 14, 15, 16, 17], [12, 8, 9, 10, 18], [11, 7, 2, 13, 19], [10, 6, 5, 3, 20], [9, 4, 1, 0, 24]]) == 24\n assert candidate(grid = [[0, 1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12, 13], [14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27], [28, 29, 30, 31, 32, 33, 34], [35, 36, 37, 38, 39, 40, 41], [42, 43, 44, 45, 46, 47, 48]]) == 48\n assert candidate(grid = [[13, 14, 15, 16, 17], [8, 9, 10, 11, 12], [3, 4, 5, 6, 7], [0, 1, 2, 18, 19], [20, 21, 22, 23, 24]]) == 24\n assert candidate(grid = [[20, 21, 22, 23, 24, 25], [19, 18, 17, 16, 15, 26], [10, 9, 8, 7, 14, 27], [11, 12, 13, 6, 5, 28], [0, 1, 2, 3, 4, 29], [30, 31, 32, 33, 34, 35]]) == 35\n assert candidate(grid = [[4, 0, 7, 6, 5], [3, 9, 8, 1, 2], [16, 15, 14, 13, 10], [11, 12, 17, 18, 19], [20, 21, 22, 23, 24]]) == 24\n assert candidate(grid = [[0, 1, 2, 3, 4, 5, 6], [35, 34, 33, 32, 31, 30, 7], [36, 19, 18, 17, 16, 29, 8], [37, 20, 7, 6, 15, 28, 9], [38, 21, 8, 5, 4, 14, 10], [39, 22, 9, 10, 11, 13, 12], [40, 41, 42, 43, 44, 45, 46]]) == 46\n assert candidate(grid = [[0, 5, 9, 12, 17], [3, 1, 8, 10, 18], [4, 7, 2, 15, 16], [13, 6, 11, 14, 21], [22, 20, 19, 23, 24]]) == 24\n assert candidate(grid = [[37, 34, 26, 25, 38, 35, 31, 27, 36], [17, 20, 33, 29, 19, 23, 22, 21, 32], [2, 18, 16, 39, 40, 24, 11, 9, 30], [3, 5, 6, 42, 14, 4, 1, 8, 7], [41, 13, 43, 15, 44, 47, 50, 48, 49], [45, 12, 46, 10, 9, 11, 28, 39, 38], [29, 31, 32, 33, 34, 35, 36, 37, 38], [39, 40, 41, 42, 43, 44, 45, 46, 47], [48, 49, 50, 1, 2, 3, 4, 5, 6]]) == 51\n assert candidate(grid = [[3, 17, 12, 4, 16], [13, 14, 10, 11, 8], [6, 0, 7, 5, 15], [18, 1, 19, 2, 9], [24, 22, 23, 20, 21]]) == 21\n assert candidate(grid = [[0, 1, 2, 3, 4, 5], [19, 18, 17, 16, 15, 6], [14, 23, 22, 21, 10, 7], [13, 24, 25, 20, 11, 8], [12, 27, 26, 29, 12, 9], [34, 33, 32, 31, 30, 35]]) == 35\n assert candidate(grid = [[30, 29, 28, 27, 26, 25], [24, 23, 22, 21, 20, 19], [18, 17, 16, 15, 14, 13], [12, 11, 10, 9, 8, 7], [6, 5, 4, 3, 2, 1], [0, 35, 34, 33, 32, 31]]) == 31\n assert candidate(grid = [[49, 48, 47, 46, 45, 44, 43, 42, 41, 40], [40, 39, 38, 37, 36, 35, 34, 33, 32, 31], [31, 30, 29, 28, 27, 26, 25, 24, 23, 22], [22, 21, 20, 19, 18, 17, 16, 15, 14, 13], [13, 12, 11, 10, 9, 8, 7, 6, 5, 4], [4, 3, 2, 1, 0, 41, 42, 43, 44, 45], [46, 47, 48, 49, 50, 51, 52, 53, 54, 55], [55, 54, 53, 52, 51, 50, 49, 48, 47, 46], [45, 44, 43, 42, 41, 56, 57, 58, 59, 60], [60, 59, 58, 57, 56, 61, 62, 63, 64, 65]]) == -1\n assert candidate(grid = [[25, 24, 23, 22, 21, 20], [19, 18, 17, 16, 15, 14], [13, 12, 11, 10, 9, 8], [7, 6, 5, 4, 3, 2], [1, 0, 29, 28, 27, 26], [35, 34, 33, 32, 31, 30]]) == 30\n assert candidate(grid = [[0, 9, 8, 7, 6, 5], [1, 2, 3, 4, 30, 31], [14, 13, 12, 11, 10, 32], [15, 16, 17, 18, 19, 33], [24, 23, 22, 21, 20, 34], [25, 26, 27, 28, 29, 35]]) == 35\n assert candidate(grid = [[33, 16, 21, 30, 22, 10], [18, 5, 29, 3, 24, 20], [34, 2, 31, 17, 19, 9], [15, 13, 14, 23, 28, 32], [4, 35, 8, 7, 6, 27], [1, 0, 12, 11, 26, 25]]) == 33\n assert candidate(grid = [[5, 24, 19, 22, 21, 6], [4, 4, 20, 17, 15, 9], [14, 10, 3, 16, 1, 11], [7, 18, 23, 13, 12, 8], [2, 0, 5, 25, 27, 26], [30, 31, 32, 33, 34, 35]]) == 35\n assert candidate(grid = [[8, 2, 3], [4, 7, 6], [5, 1, 0]]) == 8\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().swimInWater", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var swimInWater = function(grid) {", "container": null, "callable": "swimInWater", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 779, "task_id": "k-th-symbol-in-grammar", "difficulty": "Medium", "problem_description": "We build a table of n rows (1-indexed). We start by writing 0 in the 1st row. Now in every subsequent row, we look at the previous row and replace each occurrence of 0 with 01, and each occurrence of 1 with 10.\n\nFor example, for n = 3, the 1st row is 0, the 2nd row is 01, and the 3rd row is 0110.\n\nGiven two integer n and k, return the kth (1-indexed) symbol in the nth row of a table of n rows.\n \nExample 1:\n\nInput: n = 1, k = 1\nOutput: 0\nExplanation: row 1: 0\n\nExample 2:\n\nInput: n = 2, k = 1\nOutput: 0\nExplanation: \nrow 1: 0\nrow 2: 01\n\nExample 3:\n\nInput: n = 2, k = 2\nOutput: 1\nExplanation: \nrow 1: 0\nrow 2: 01\n\n \nConstraints:\n\n1 <= n <= 30\n1 <= k <= 2n - 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 4,k = 8) == 1\n assert candidate(n = 5,k = 26) == 0\n assert candidate(n = 5,k = 21) == 0\n assert candidate(n = 5,k = 19) == 0\n assert candidate(n = 30,k = 536870912) == 1\n assert candidate(n = 3,k = 2) == 1\n assert candidate(n = 1,k = 1) == 0\n assert candidate(n = 30,k = 536870911) == 0\n assert candidate(n = 4,k = 5) == 1\n assert candidate(n = 5,k = 23) == 0\n assert candidate(n = 5,k = 20) == 0\n assert candidate(n = 5,k = 25) == 0\n assert candidate(n = 4,k = 1) == 0\n assert candidate(n = 5,k = 22) == 0\n assert candidate(n = 5,k = 29) == 0\n assert candidate(n = 5,k = 10) == 0\n assert candidate(n = 2,k = 1) == 0\n assert candidate(n = 3,k = 3) == 1\n assert candidate(n = 3,k = 4) == 0\n assert candidate(n = 5,k = 15) == 1\n assert candidate(n = 5,k = 17) == 0\n assert candidate(n = 5,k = 27) == 0\n assert candidate(n = 5,k = 30) == 0\n assert candidate(n = 4,k = 2) == 1\n assert candidate(n = 5,k = 31) == 0\n assert candidate(n = 5,k = 16) == 0\n assert candidate(n = 30,k = 1073741823) == 1\n assert candidate(n = 4,k = 3) == 1\n assert candidate(n = 5,k = 18) == 0\n assert candidate(n = 3,k = 1) == 0\n assert candidate(n = 5,k = 28) == 0\n assert candidate(n = 5,k = 24) == 0\n assert candidate(n = 4,k = 6) == 0\n assert candidate(n = 2,k = 2) == 1\n assert candidate(n = 4,k = 7) == 0\n assert candidate(n = 4,k = 4) == 0\n assert candidate(n = 7,k = 63) == 1\n assert candidate(n = 9,k = 128) == 1\n assert candidate(n = 19,k = 262144) == 0\n assert candidate(n = 10,k = 1023) == 1\n assert candidate(n = 18,k = 131071) == 0\n assert candidate(n = 7,k = 126) == 0\n assert candidate(n = 18,k = 262144) == 1\n assert candidate(n = 12,k = 2047) == 0\n assert candidate(n = 25,k = 1048575) == 1\n assert candidate(n = 14,k = 8192) == 1\n assert candidate(n = 6,k = 45) == 1\n assert candidate(n = 10,k = 511) == 0\n assert candidate(n = 22,k = 4194304) == 1\n assert candidate(n = 20,k = 524287) == 0\n assert candidate(n = 18,k = 65536) == 0\n assert candidate(n = 10,k = 350) == 0\n assert candidate(n = 29,k = 536870911) == 0\n assert candidate(n = 9,k = 255) == 1\n assert candidate(n = 20,k = 524288) == 1\n assert candidate(n = 15,k = 16383) == 1\n assert candidate(n = 15,k = 16382) == 1\n assert candidate(n = 15,k = 16384) == 0\n assert candidate(n = 15,k = 32767) == 0\n assert candidate(n = 7,k = 100) == 0\n assert candidate(n = 25,k = 33554432) == 0\n assert candidate(n = 10,k = 512) == 1\n assert candidate(n = 22,k = 2097151) == 0\n assert candidate(n = 20,k = 1048575) == 1\n assert candidate(n = 18,k = 262145) == 1\n assert candidate(n = 8,k = 129) == 1\n assert candidate(n = 25,k = 67108863) == 0\n assert candidate(n = 16,k = 65536) == 1\n assert candidate(n = 12,k = 2048) == 1\n assert candidate(n = 23,k = 8388607) == 0\n assert candidate(n = 18,k = 131072) == 1\n assert candidate(n = 25,k = 33554431) == 0\n assert candidate(n = 8,k = 255) == 1\n assert candidate(n = 8,k = 128) == 1\n assert candidate(n = 30,k = 1073741824) == 1\n assert candidate(n = 25,k = 16777215) == 1\n assert candidate(n = 24,k = 8388608) == 1\n assert candidate(n = 13,k = 4096) == 0\n assert candidate(n = 8,k = 127) == 0\n assert candidate(n = 9,k = 256) == 0\n assert candidate(n = 28,k = 268435455) == 1\n assert candidate(n = 20,k = 262144) == 0\n assert candidate(n = 15,k = 8192) == 1\n assert candidate(n = 6,k = 33) == 1\n assert candidate(n = 10,k = 256) == 0\n assert candidate(n = 7,k = 64) == 0\n"}, "metadata": {"canonical_parameter_names": ["n", "k"], "leetcode_dataset_entry_point": "Solution().kthGrammar", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var kthGrammar = function(n, k) {", "container": null, "callable": "kthGrammar", "parameters": [{"name": "n", "type": "number"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 780, "task_id": "reaching-points", "difficulty": "Hard", "problem_description": "Given four integers sx, sy, tx, and ty, return true if it is possible to convert the point (sx, sy) to the point (tx, ty) through some operations, or false otherwise.\nThe allowed operation on some point (x, y) is to convert it to either (x, x + y) or (x + y, y).\n \nExample 1:\n\nInput: sx = 1, sy = 1, tx = 3, ty = 5\nOutput: true\nExplanation:\nOne series of moves that transforms the starting point to the target is:\n(1, 1) -> (1, 2)\n(1, 2) -> (3, 2)\n(3, 2) -> (3, 5)\n\nExample 2:\n\nInput: sx = 1, sy = 1, tx = 2, ty = 2\nOutput: false\n\nExample 3:\n\nInput: sx = 1, sy = 1, tx = 1, ty = 1\nOutput: true\n\n \nConstraints:\n\n1 <= sx, sy, tx, ty <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(sx = 1,sy = 1,tx = 3,ty = 5) == True\n assert candidate(sx = 3,sy = 4,tx = 3,ty = 12) == False\n assert candidate(sx = 3,sy = 7,tx = 31,ty = 19) == False\n assert candidate(sx = 1,sy = 1,tx = 1000000000,ty = 1000000000) == False\n assert candidate(sx = 5,sy = 5,tx = 5,ty = 5) == True\n assert candidate(sx = 1,sy = 1,tx = 1,ty = 1) == True\n assert candidate(sx = 1,sy = 1,tx = 2,ty = 2) == False\n assert candidate(sx = 2,sy = 3,tx = 8,ty = 11) == True\n assert candidate(sx = 5,sy = 1,tx = 1000000000,ty = 1000000000) == False\n assert candidate(sx = 2,sy = 3,tx = 10,ty = 15) == False\n assert candidate(sx = 5,sy = 5,tx = 100,ty = 100) == False\n assert candidate(sx = 1,sy = 1,tx = 1000000000,ty = 1) == True\n assert candidate(sx = 2,sy = 3,tx = 10,ty = 3) == False\n assert candidate(sx = 7,sy = 11,tx = 412,ty = 575) == False\n assert candidate(sx = 10,sy = 15,tx = 55,ty = 70) == True\n assert candidate(sx = 2,sy = 5,tx = 27,ty = 35) == False\n assert candidate(sx = 5,sy = 7,tx = 29,ty = 41) == True\n assert candidate(sx = 3,sy = 1,tx = 10,ty = 28) == False\n assert candidate(sx = 3,sy = 10,tx = 81,ty = 270) == False\n assert candidate(sx = 1,sy = 1,tx = 987654321,ty = 123456789) == False\n assert candidate(sx = 15,sy = 10,tx = 225,ty = 150) == False\n assert candidate(sx = 17,sy = 29,tx = 306,ty = 511) == False\n assert candidate(sx = 2,sy = 5,tx = 23,ty = 47) == False\n assert candidate(sx = 7,sy = 9,tx = 161,ty = 208) == False\n assert candidate(sx = 2,sy = 7,tx = 113,ty = 287) == False\n assert candidate(sx = 21,sy = 34,tx = 1597,ty = 2584) == False\n assert candidate(sx = 8,sy = 5,tx = 144,ty = 95) == False\n assert candidate(sx = 3,sy = 3,tx = 18,ty = 27) == False\n assert candidate(sx = 2,sy = 3,tx = 50,ty = 83) == False\n assert candidate(sx = 12345,sy = 67890,tx = 56789,ty = 45678) == False\n assert candidate(sx = 13,sy = 8,tx = 65,ty = 40) == False\n assert candidate(sx = 7,sy = 3,tx = 49,ty = 24) == False\n assert candidate(sx = 5,sy = 5,tx = 35,ty = 35) == False\n assert candidate(sx = 2,sy = 5,tx = 17,ty = 27) == False\n assert candidate(sx = 3,sy = 2,tx = 18,ty = 33) == False\n assert candidate(sx = 999999999,sy = 1,tx = 1000000000,ty = 1) == True\n assert candidate(sx = 7,sy = 17,tx = 128,ty = 17) == False\n assert candidate(sx = 2,sy = 5,tx = 18,ty = 47) == False\n assert candidate(sx = 2,sy = 5,tx = 29,ty = 44) == False\n assert candidate(sx = 2,sy = 7,tx = 10,ty = 17) == False\n assert candidate(sx = 8,sy = 7,tx = 1000,ty = 875) == False\n assert candidate(sx = 13,sy = 21,tx = 286,ty = 455) == False\n assert candidate(sx = 3,sy = 1,tx = 39,ty = 19) == False\n assert candidate(sx = 5,sy = 7,tx = 22,ty = 37) == False\n assert candidate(sx = 6,sy = 19,tx = 114,ty = 175) == False\n assert candidate(sx = 10,sy = 10,tx = 110,ty = 110) == False\n assert candidate(sx = 5,sy = 7,tx = 35,ty = 56) == False\n assert candidate(sx = 1,sy = 1,tx = 19,ty = 29) == True\n assert candidate(sx = 5,sy = 7,tx = 46,ty = 33) == False\n assert candidate(sx = 10,sy = 10,tx = 100000000,ty = 100000000) == False\n assert candidate(sx = 5,sy = 6,tx = 60,ty = 55) == False\n assert candidate(sx = 10,sy = 4,tx = 100,ty = 64) == False\n assert candidate(sx = 8,sy = 13,tx = 104,ty = 169) == False\n assert candidate(sx = 13,sy = 8,tx = 104,ty = 80) == False\n assert candidate(sx = 7,sy = 17,tx = 119,ty = 203) == False\n assert candidate(sx = 2,sy = 3,tx = 1046527,ty = 165580141) == False\n assert candidate(sx = 4,sy = 9,tx = 100,ty = 225) == False\n assert candidate(sx = 1,sy = 2,tx = 47,ty = 70) == True\n assert candidate(sx = 1,sy = 1,tx = 55,ty = 89) == True\n assert candidate(sx = 3,sy = 9,tx = 27,ty = 81) == False\n assert candidate(sx = 4,sy = 6,tx = 144,ty = 216) == False\n assert candidate(sx = 3,sy = 9,tx = 81,ty = 243) == False\n assert candidate(sx = 8,sy = 13,tx = 233,ty = 377) == False\n assert candidate(sx = 5,sy = 5,tx = 125,ty = 125) == False\n assert candidate(sx = 11,sy = 22,tx = 121,ty = 242) == False\n assert candidate(sx = 13,sy = 21,tx = 34,ty = 55) == True\n assert candidate(sx = 3,sy = 11,tx = 121,ty = 55) == False\n assert candidate(sx = 10,sy = 10,tx = 100,ty = 100) == False\n assert candidate(sx = 12,sy = 18,tx = 108,ty = 162) == False\n assert candidate(sx = 10,sy = 15,tx = 150,ty = 225) == False\n assert candidate(sx = 3,sy = 1,tx = 10,ty = 7) == True\n assert candidate(sx = 11,sy = 23,tx = 132,ty = 303) == False\n assert candidate(sx = 1,sy = 2,tx = 5,ty = 8) == False\n assert candidate(sx = 7,sy = 11,tx = 217,ty = 352) == False\n assert candidate(sx = 7,sy = 3,tx = 31,ty = 9) == False\n assert candidate(sx = 5,sy = 10,tx = 100,ty = 150) == False\n assert candidate(sx = 8,sy = 5,tx = 8,ty = 13) == True\n assert candidate(sx = 12,sy = 18,tx = 324,ty = 486) == False\n assert candidate(sx = 3,sy = 5,tx = 100,ty = 150) == False\n assert candidate(sx = 1,sy = 1,tx = 987654321,ty = 987654321) == False\n assert candidate(sx = 1,sy = 2,tx = 1,ty = 1046527) == True\n assert candidate(sx = 21,sy = 34,tx = 55,ty = 89) == True\n assert candidate(sx = 5,sy = 2,tx = 27,ty = 11) == False\n assert candidate(sx = 2,sy = 5,tx = 29,ty = 37) == False\n assert candidate(sx = 5,sy = 7,tx = 1235,ty = 1907) == False\n assert candidate(sx = 100,sy = 1,tx = 999999999,ty = 1000000000) == True\n assert candidate(sx = 21,sy = 14,tx = 420,ty = 280) == False\n assert candidate(sx = 3,sy = 3,tx = 99,ty = 99) == False\n assert candidate(sx = 8,sy = 3,tx = 217,ty = 58) == False\n assert candidate(sx = 1,sy = 2,tx = 1000000000,ty = 999999999) == True\n assert candidate(sx = 10,sy = 15,tx = 110,ty = 165) == False\n assert candidate(sx = 5,sy = 8,tx = 165,ty = 280) == False\n assert candidate(sx = 10,sy = 15,tx = 100,ty = 150) == False\n assert candidate(sx = 1,sy = 1,tx = 1,ty = 1000000000) == True\n assert candidate(sx = 5,sy = 17,tx = 104,ty = 193) == False\n assert candidate(sx = 7,sy = 3,tx = 105,ty = 45) == False\n assert candidate(sx = 8,sy = 13,tx = 184,ty = 299) == False\n assert candidate(sx = 7,sy = 17,tx = 196,ty = 511) == False\n assert candidate(sx = 2,sy = 5,tx = 29,ty = 17) == True\n assert candidate(sx = 1,sy = 10,tx = 100,ty = 91) == False\n assert candidate(sx = 2,sy = 1,tx = 1046527,ty = 1) == True\n"}, "metadata": {"canonical_parameter_names": ["sx", "sy", "tx", "ty"], "leetcode_dataset_entry_point": "Solution().reachingPoints", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var reachingPoints = function(sx, sy, tx, ty) {", "container": null, "callable": "reachingPoints", "parameters": [{"name": "sx", "type": "number"}, {"name": "sy", "type": "number"}, {"name": "tx", "type": "number"}, {"name": "ty", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 781, "task_id": "rabbits-in-forest", "difficulty": "Medium", "problem_description": "There is a forest with an unknown number of rabbits. We asked n rabbits \"How many rabbits have the same color as you?\" and collected the answers in an integer array answers where answers[i] is the answer of the ith rabbit.\nGiven the array answers, return the minimum number of rabbits that could be in the forest.\n \nExample 1:\n\nInput: answers = [1,1,2]\nOutput: 5\nExplanation:\nThe two rabbits that answered \"1\" could both be the same color, say red.\nThe rabbit that answered \"2\" can't be red or the answers would be inconsistent.\nSay the rabbit that answered \"2\" was blue.\nThen there should be 2 other blue rabbits in the forest that didn't answer into the array.\nThe smallest possible number of rabbits in the forest is therefore 5: 3 that answered plus 2 that didn't.\n\nExample 2:\n\nInput: answers = [10,10,10]\nOutput: 11\n\n \nConstraints:\n\n1 <= answers.length <= 1000\n0 <= answers[i] < 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(answers = [1, 2, 3, 4, 5]) == 20\n assert candidate(answers = [4, 4, 4, 4, 4, 4]) == 10\n assert candidate(answers = [1, 1, 2]) == 5\n assert candidate(answers = [0, 0, 1, 1, 1]) == 6\n assert candidate(answers = [999, 999, 999]) == 1000\n assert candidate(answers = [1, 1, 2, 2, 2, 3, 3, 3, 3]) == 9\n assert candidate(answers = [3, 3, 3, 3, 3, 3]) == 8\n assert candidate(answers = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 20\n assert candidate(answers = [2, 2, 2, 2, 2, 2]) == 6\n assert candidate(answers = [0, 0, 1, 1, 1, 2, 2, 2, 2]) == 12\n assert candidate(answers = [0, 0, 0]) == 3\n assert candidate(answers = [2, 2, 2, 2, 2, 2, 2]) == 9\n assert candidate(answers = [10, 10, 10]) == 11\n assert candidate(answers = [1, 0, 1, 0, 0]) == 5\n assert candidate(answers = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 12\n assert candidate(answers = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 38\n assert candidate(answers = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 21\n assert candidate(answers = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 28\n assert candidate(answers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 153\n assert candidate(answers = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 77\n assert candidate(answers = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 152\n assert candidate(answers = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 24\n assert candidate(answers = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 12\n assert candidate(answers = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 40\n assert candidate(answers = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == 24\n assert candidate(answers = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 30\n assert candidate(answers = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 65\n assert candidate(answers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 1326\n assert candidate(answers = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]) == 101\n assert candidate(answers = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 70\n assert candidate(answers = [1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 42\n assert candidate(answers = [1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3]) == 18\n assert candidate(answers = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 41\n assert candidate(answers = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 32\n assert candidate(answers = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 20\n assert candidate(answers = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 10\n assert candidate(answers = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 21\n assert candidate(answers = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 21\n assert candidate(answers = [4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 1, 1, 0]) == 15\n assert candidate(answers = [999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999]) == 1000\n assert candidate(answers = [1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7]) == 37\n assert candidate(answers = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 24\n assert candidate(answers = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == 32\n assert candidate(answers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 65\n assert candidate(answers = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 24\n assert candidate(answers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]) == 5049\n assert candidate(answers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 20\n assert candidate(answers = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 24\n assert candidate(answers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 231\n assert candidate(answers = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == 54\n assert candidate(answers = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 33\n assert candidate(answers = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 18\n assert candidate(answers = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 66\n assert candidate(answers = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 59\n assert candidate(answers = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == 45\n assert candidate(answers = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 20\n assert candidate(answers = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9]) == 59\n assert candidate(answers = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 77\n assert candidate(answers = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == 40\n assert candidate(answers = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 30\n assert candidate(answers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 61\n assert candidate(answers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 65\n assert candidate(answers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 66\n assert candidate(answers = [99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99]) == 200\n assert candidate(answers = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == 27\n assert candidate(answers = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5]) == 22\n"}, "metadata": {"canonical_parameter_names": ["answers"], "leetcode_dataset_entry_point": "Solution().numRabbits", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numRabbits = function(answers) {", "container": null, "callable": "numRabbits", "parameters": [{"name": "answers", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 782, "task_id": "transform-to-chessboard", "difficulty": "Hard", "problem_description": "You are given an n x n binary grid board. In each move, you can swap any two rows with each other, or any two columns with each other.\nReturn the minimum number of moves to transform the board into a chessboard board. If the task is impossible, return -1.\nA chessboard board is a board where no 0's and no 1's are 4-directionally adjacent.\n \nExample 1:\n\n\nInput: board = [[0,1,1,0],[0,1,1,0],[1,0,0,1],[1,0,0,1]]\nOutput: 2\nExplanation: One potential sequence of moves is shown.\nThe first move swaps the first and second column.\nThe second move swaps the second and third row.\n\nExample 2:\n\n\nInput: board = [[0,1],[1,0]]\nOutput: 0\nExplanation: Also note that the board with 0 in the top left corner, is also a valid chessboard.\n\nExample 3:\n\n\nInput: board = [[1,0],[1,0]]\nOutput: -1\nExplanation: No matter what sequence of moves you make, you cannot end with a valid chessboard.\n\n \nConstraints:\n\nn == board.length\nn == board[i].length\n2 <= n <= 30\nboard[i][j] is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(board = [[0, 0, 1, 1], [0, 0, 1, 1], [1, 1, 0, 0], [1, 1, 0, 0]]) == 2\n assert candidate(board = [[1, 0], [1, 0]]) == -1\n assert candidate(board = [[0, 1], [1, 0]]) == 0\n assert candidate(board = [[0, 0, 1, 1], [1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1]]) == 2\n assert candidate(board = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == 0\n assert candidate(board = [[0, 0], [0, 0]]) == -1\n assert candidate(board = [[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == 0\n assert candidate(board = [[1, 1], [1, 1]]) == -1\n assert candidate(board = [[1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1], [1, 1, 0, 0]]) == 2\n assert candidate(board = [[0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1], [1, 0, 0, 1]]) == 2\n assert candidate(board = [[1, 1, 0, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 0, 0]]) == 1\n assert candidate(board = [[1, 1, 0], [0, 0, 1], [0, 1, 0]]) == -1\n assert candidate(board = [[0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1]]) == -1\n assert candidate(board = [[1, 1, 0, 0], [0, 0, 1, 1], [1, 1, 0, 0], [0, 0, 1, 1]]) == 1\n assert candidate(board = [[1, 0, 1], [0, 1, 0], [1, 0, 1]]) == 0\n assert candidate(board = [[0, 1, 1, 0], [1, 0, 0, 1], [0, 1, 1, 0], [1, 0, 0, 1]]) == 1\n assert candidate(board = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1]]) == 2\n assert candidate(board = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == -1\n assert candidate(board = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == -1\n assert candidate(board = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 0\n assert candidate(board = [[1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0, 0]]) == 2\n assert candidate(board = [[0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1]]) == 2\n assert candidate(board = [[0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1, 0, 0]]) == 4\n assert candidate(board = [[1, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0]]) == 2\n assert candidate(board = [[1, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 0, 1, 1], [0, 1, 1, 0, 0, 1, 1], [1, 0, 0, 1, 1, 0, 0], [1, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 0, 1, 1], [0, 1, 1, 0, 0, 1, 1]]) == 4\n assert candidate(board = [[1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1]]) == 2\n assert candidate(board = [[0, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0]]) == 2\n assert candidate(board = [[0, 1, 1, 0, 0], [1, 0, 0, 1, 1], [0, 1, 1, 0, 0], [1, 0, 0, 1, 1], [0, 1, 1, 0, 0]]) == 1\n assert candidate(board = [[0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 0\n assert candidate(board = [[0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == 0\n assert candidate(board = [[0, 0, 1, 1, 0, 1], [1, 1, 0, 0, 1, 0], [0, 0, 1, 1, 0, 1], [1, 1, 0, 0, 1, 0], [0, 0, 1, 1, 0, 1], [1, 1, 0, 0, 1, 0]]) == 1\n assert candidate(board = [[1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 1]]) == 5\n assert candidate(board = [[1, 1, 1, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 1, 1], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [1, 1, 1, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 1, 1]]) == -1\n assert candidate(board = [[0, 1, 1, 0, 1, 0, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 0, 1]]) == 4\n assert candidate(board = [[0, 1, 1, 0, 1, 0, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0]]) == 4\n assert candidate(board = [[1, 0, 0, 1, 0, 0], [0, 1, 1, 0, 1, 1], [0, 1, 1, 0, 1, 1], [1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0], [0, 1, 1, 0, 1, 1]]) == -1\n assert candidate(board = [[0, 1, 0, 1, 1, 0, 0], [1, 0, 1, 0, 0, 1, 1], [0, 1, 0, 1, 1, 0, 0], [1, 0, 1, 0, 0, 1, 1], [0, 1, 0, 1, 1, 0, 0], [1, 0, 1, 0, 0, 1, 1], [0, 1, 0, 1, 1, 0, 0]]) == 1\n assert candidate(board = [[1, 0, 0, 1, 1], [0, 1, 1, 0, 0], [1, 0, 0, 1, 1], [0, 1, 1, 0, 0], [1, 0, 0, 1, 1]]) == 1\n assert candidate(board = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 0\n assert candidate(board = [[0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 0\n assert candidate(board = [[0, 1, 1, 0, 1], [1, 0, 0, 1, 0], [0, 1, 1, 0, 1], [1, 0, 0, 1, 0], [0, 1, 1, 0, 1]]) == 1\n assert candidate(board = [[0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0]]) == 0\n assert candidate(board = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 0\n assert candidate(board = [[0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0]]) == 2\n assert candidate(board = [[0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0]]) == -1\n assert candidate(board = [[0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0]]) == 2\n assert candidate(board = [[1, 0, 1, 0, 0, 1, 1, 0], [0, 1, 0, 1, 1, 0, 0, 1], [1, 0, 1, 0, 0, 1, 1, 0], [0, 1, 0, 1, 1, 0, 0, 1], [1, 0, 1, 0, 0, 1, 1, 0], [0, 1, 0, 1, 1, 0, 0, 1], [1, 0, 1, 0, 0, 1, 1, 0], [0, 1, 0, 1, 1, 0, 0, 1]]) == 1\n assert candidate(board = [[1, 0, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0], [1, 0, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0], [1, 0, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0]]) == 1\n assert candidate(board = [[1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 1, 1, 1, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1, 1, 1, 0], [1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 1, 1, 1, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1, 1, 1, 0], [1, 0, 0, 0, 1, 0, 0, 0, 1]]) == -1\n assert candidate(board = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 0\n assert candidate(board = [[1, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0, 0, 1]]) == 4\n assert candidate(board = [[1, 1, 0, 0, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 0, 0, 1, 1]]) == 2\n assert candidate(board = [[1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0], [1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0], [1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0]]) == 1\n assert candidate(board = [[1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 0], [1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 0]]) == 4\n assert candidate(board = [[1, 1, 0, 0, 1], [1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [0, 0, 1, 1, 0], [1, 1, 0, 0, 1]]) == 2\n assert candidate(board = [[1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0]]) == 3\n assert candidate(board = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1]]) == 0\n assert candidate(board = [[1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1], [1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0]]) == -1\n assert candidate(board = [[1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0]]) == -1\n assert candidate(board = [[1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1]]) == 2\n assert candidate(board = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 0\n assert candidate(board = [[1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 0, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 0, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 1, 0, 0, 1, 0]]) == -1\n assert candidate(board = [[1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1]]) == 1\n assert candidate(board = [[1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1]]) == 1\n assert candidate(board = [[1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1]]) == 2\n assert candidate(board = [[1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 0, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 0, 1, 1, 0, 1]]) == -1\n assert candidate(board = [[1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1]]) == 2\n assert candidate(board = [[0, 1, 0, 1, 1, 0], [1, 0, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0], [1, 0, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0], [1, 0, 1, 0, 0, 1]]) == 1\n assert candidate(board = [[1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [1, 1, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0]]) == 4\n assert candidate(board = [[1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 0\n assert candidate(board = [[1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 1]]) == 1\n assert candidate(board = [[1, 1, 0, 0], [0, 1, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == -1\n assert candidate(board = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 1, 1]]) == -1\n assert candidate(board = [[1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1]]) == 4\n assert candidate(board = [[0, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0]]) == -1\n"}, "metadata": {"canonical_parameter_names": ["board"], "leetcode_dataset_entry_point": "Solution().movesToChessboard", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var movesToChessboard = function(board) {", "container": null, "callable": "movesToChessboard", "parameters": [{"name": "board", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 783, "task_id": "minimum-distance-between-bst-nodes", "difficulty": "Easy", "problem_description": "Given the root of a Binary Search Tree (BST), return the minimum difference between the values of any two different nodes in the tree.\n \nExample 1:\n\n\nInput: root = [4,2,6,1,3]\nOutput: 1\n\nExample 2:\n\n\nInput: root = [1,0,48,null,null,12,49]\nOutput: 1\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [2, 100].\n0 <= Node.val <= 105\n\n \nNote: This question is the same as 530: https://leetcode.com/problems/minimum-absolute-difference-in-bst/\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([4, 2, 6, 1, 3])) == 1\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18])) == 2\n assert candidate(root = tree_node([2, 1, 3])) == 1\n assert candidate(root = tree_node([1, 0, 48, None, None, 12, 49])) == 1\n assert candidate(root = tree_node([90, 69, None, 49, 89, None, 52])) == 1\n assert candidate(root = tree_node([4, 2, 7, 1, 3, 6, 9])) == 1\n assert candidate(root = tree_node([4, 2, None, 1, 3])) == 1\n assert candidate(root = tree_node([50, 25, 75, 15, 35, 65, 85, 10, 20, 30, 40, 60, 70, 80, 90])) == 5\n assert candidate(root = tree_node([5, 3, 7, 2, 4, 6, 8, 1, None, None, None, None, None, None, 9])) == 1\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 18, 25, 35, 42, 47, 55])) == 2\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 130, 160, 180])) == 5\n assert candidate(root = tree_node([88, 44, 132, 22, 66, 110, 154, 11, 33, 55, 77, 88, 99, 121, 143])) == -11\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 85, 115, 140, 160, 185])) == 5\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 17, 25, 35, 42, 48, 55, 1, 8, 14, 16, 19, 23, 28, 33, 37, 41, 44, 46, 49, 53, 52, 56, 58, 59, 60])) == -57\n assert candidate(root = tree_node([8, 3, 10, None, 6, None, None, 4, 7, 9, 12])) == -6\n assert candidate(root = tree_node([2, 1, None, 0])) == 1\n assert candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15])) == 1\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8])) == -1\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 12, 18, 22, 28, 33, 37, 1, None, None, None, None, 13, None, None, 21, 27, None, 31, 36, None, None, None, 14, 17, None, 23, 26, 32, 34, None, None, None, None, None, None, None, None, 16])) == -13\n assert candidate(root = tree_node([27, 18, 35, 12, 24, 30, 40, 9, 15, 21, 26, 28, 33, 38, 45])) == 1\n assert candidate(root = tree_node([8, 3, 13, None, 7, 10, 18, None, None, 9, 12, 15, 20])) == 1\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 180])) == 5\n assert candidate(root = tree_node([50, 25, 75, 10, 40, 60, 90, 5, 15, 30, 45, 55, 65, 85, 95])) == 5\n assert candidate(root = tree_node([70, 30, 110, 10, 50, 90, 130, 5, 25, 40, 60, 80, 100, 120, 140])) == 5\n assert candidate(root = tree_node([50, 25, 75, 10, 40, 60, 90, None, None, 30, 45, 55, 70, None, None, None, None, 35, 42, 52, 65, 68, 72, 85, 87, 95])) == -53\n assert candidate(root = tree_node([60, 30, 90, 15, 45, 75, 105, 5, 25, 35, 50, 65, 85, 95, 110, 3, 10, 20, 32, 40, 48, 55, 63, 68, 72, 80, 88, 92, 98, 102, 108, 113, 115, 118, 120])) == -110\n assert candidate(root = tree_node([33, 16, 50, 13, 18, 45, 55, 8, 14, 17, 22, 40, 48, 52, 60])) == 1\n assert candidate(root = tree_node([5, 3, 10, 2, 4, None, 15, 1, None, 6, 8, 13, 18])) == -3\n assert candidate(root = tree_node([8, 3, 10, None, 4, 9, 12, None, None, 7])) == -1\n assert candidate(root = tree_node([2, 1, 3, 0, 4, 2, 5, None, None, None, 6, None, None, 7, 8, None, None, 9, 10])) == -5\n assert candidate(root = tree_node([7, 3, 15, None, None, 9, 20])) == 2\n assert candidate(root = tree_node([35, 18, 45, 12, 23, 40, 50, 8, 16, 20, 25, 38, 43, 48, 55, 5, 11, 14, 17, 19, 22, 24, 27, 32, 37, 42, 47, 49, 54, 57, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 41])) == -4\n assert candidate(root = tree_node([1, 2, 4, 3, 5, 7, 9, 6, 8, 10])) == -6\n assert candidate(root = tree_node([27, 14, 35, 10, 19, 31, 42, 4, 13, 17, 23, 29, 34, 39, 40, 1, 7, 12, 16, 18, 22, 25, 26, 28, 32, 36, 38, 41, 43, 44, 45, 46, 47, 48, 49, 50])) == -45\n assert candidate(root = tree_node([30, 10, 45, 5, 20, 35, 50, 1, 7, 15, 25, 32, 37, 47, 55, None, 8, None, None, None, None, None, 22, None, None, None, None, 27, 40, 48, None, None, None, None, None, None, 52])) == -18\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, 7, 12, 18, 23, 27, 32, 37])) == 2\n assert candidate(root = tree_node([60, 30, 90, 10, 45, 75, 105, None, None, 35, 50, 70, 80, None, None, 55, None, None, None, None, 95, 100, 110, None, None, None, None, None, None, None, 115])) == -25\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 17, 25, 35, 48, None, None, None, 9, None, None, 18, None, 23, 33, 43, 47, None, None, None, 27, None, None, 37, 41, 44, None, None, None, 46])) == -17\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6, None, 11, 14, None, None, None, 16, 19])) == -13\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 12, 18, 23, 28, 32, 37])) == 2\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, None, 8, 12, 22, 28, 32, 40])) == -3\n assert candidate(root = tree_node([25, 10, 40, 5, 20, 35, 50, 3, 7, 15, 23, 30, 38, 45, 55])) == 2\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == -10\n assert candidate(root = tree_node([100000, 50000, 150000, 25000, 75000, None, 200000])) == 25000\n assert candidate(root = tree_node([22, 15, 30, 10, 20, 25, 40, 5, 12, 18, 23, 27, 35, 37, 45])) == -5\n assert candidate(root = tree_node([10, 5, 15, None, None, 13, 18, 12, 14, 16, 19])) == 1\n assert candidate(root = tree_node([60, 30, 90, 20, 40, 70, 100, 10, 25, 35, 45, 65, 80, 95, 105, 5, 15, None, 32, None, None, 55, 75, 85, 98, 103, 110, 1, None, None, 12, None, None, 33, None, None, None, None, 62, None, None, 72, None, None, 82, None, None, 102, None, 108, None, None, 107, None, 109, 111])) == -107\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 18, 25, 35, 43, 47, 55, 3, 7, 11, 16, 19, 23, 28, 33, 38, 42, 46, 49, 52, 57, 60, 65, 70, 2, 8, 13, 17, 21, 26, 31, 37, 41, 44, 48, 51, 54, 59, 63, 67, 71, 62, 66, 72, 69, 73])) == -67\n assert candidate(root = tree_node([10, 1, None, None, 10])) == 0\n assert candidate(root = tree_node([50, 25, 75, 10, 35, 60, 90, 5, 20, 30, 40, 55, 65, 80, 95])) == 5\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 40, 60, 85, 110, 140, 160, 185])) == 10\n assert candidate(root = tree_node([15, 9, 21, 7, 11, 19, 25, 6, 8, 10, 12, 18, 20, 24, 26])) == 1\n assert candidate(root = tree_node([2, 1, 3, None, None, 2.5])) == 0.5\n assert candidate(root = tree_node([5, 3, 7, 1, 4, 6, 8, None, None, 2, None, None, None, None, None])) == -1\n assert candidate(root = tree_node([100, 99, 101, 98, 102, 97, 103, 96, 104, 95, 105, 94, 106, 93, 107, 92, 108, 91, 109, 90, 110, 89, 111, 88, 112, 87, 113, 86, 114, 85, 115])) == -18\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, None, 1, 4, 6, 8, 12, 14, 11])) == -10\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 35, 60, 85, 110, 140, 160, 190])) == 10\n assert candidate(root = tree_node([200, 100, 300, 50, 150, 250, 350, 25, 75, 125, 175, 225, 275, 325, 375])) == 25\n assert candidate(root = tree_node([50, 25, 75, 10, 35, 65, 85, 5, 15, 30, 40, 60, 70, 80, 90, 2, 8, 20, 32, 45, 55, 63, 68, 73, 78, 82, 87, 92, 3, 12, 18, 28, 42, 48, 53, 58, 62, 67, 72, 77, 81, 86, 91, 93])) == -77\n assert candidate(root = tree_node([5, 3, 8, 1, 4, 7, 9])) == 1\n assert candidate(root = tree_node([500, 250, 750, 125, 375, 625, 875, 63, 188, 313, 438, 563, 688, 813, 938])) == 62\n assert candidate(root = tree_node([500, 250, 750, 125, 375, 625, 875, 63, 188, 292, 438, 563, 713, 813, 938])) == 37\n assert candidate(root = tree_node([10, 5, 20, None, None, 15, 25, None, None, None, 30, None, 35])) == 5\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, 7, 12, 18, 22, 27, 32, 40])) == 2\n assert candidate(root = tree_node([42, 21, 63, 10, 31, 52, 74, 5, 15, 26, 36, 47, 57, 67, 83])) == 4\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, 7, 12, 17, 23, 27, 32, 37])) == 2\n assert candidate(root = tree_node([1, 2, None, None, 3, None, None, 4, None, None, 5, None, None, 6, None, None, 7, None, None, 8, None, None, 9, None, None, 10])) == -2\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 17, 25, 35, 48, 3, 8, 11, 14, 16, 19, 22, 27, 33, 43, 47, 49])) == -42\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, 1])) == 1\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 13, 17, 23, 27, 33, 37])) == 2\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6])) == 1\n assert candidate(root = tree_node([3, 1, 4, None, 2])) == 1\n assert candidate(root = tree_node([5, 3, 9, 2, 4, None, 10, None, 1, None, None, None, None, 6, 11])) == -8\n assert candidate(root = tree_node([77, 50, 100, 30, 60, 80, 110, 20, 40, 55, 65, 75, 90, 105, 120])) == -2\n assert candidate(root = tree_node([66, 33, 99, 16, 49, 82, 116, 8, 24, 41, 58, 69, 76, 106, 129])) == -6\n assert candidate(root = tree_node([10, 5, 15, 2, 7, 12, 20, 1, None, None, 8, None, None, None, 9])) == -11\n assert candidate(root = tree_node([10, 5, 15, 2, 7, None, 18, None, None, 6, 8])) == 1\n assert candidate(root = tree_node([7, 3, 15, None, 4, 10, 20, None, None, 8, 12, 18, 25, None, None, 16, 19, 22, 27, None, None, None, None, None, 17, 21, 23, 26, 28, None, None, None, None, None, None, 14, None, None, None, None, None, 6, None, None, None, None, None, None, None, 13, None, None, None, None, None, None, None, None, None, 9, None, None, None, None, None, None, 11])) == -8\n assert candidate(root = tree_node([50, 25, 75, 12, 37, 62, 87, 6, 18, 31, 43, 56, 69, 81, 93, 3, 9, 15, 21, 27, 34, 40, 48, 52, 60, 65, 72, 78, 84, 90, 96])) == 2\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 130, 160, 180, 5, 15, 28, 40, 55, 105, 120, 140, 170, 190, 3, None, 8, None, 13, None, None, None, None, None, None, None, 53, None, None, 95, None, None, 108, None, None, 135, None, None, None, None, None, None, 185, None, None, None])) == -177\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 18, 22, 28, 32, 38])) == 2\n assert candidate(root = tree_node([10, 5, 15, None, None, 12, 20, 11, 13, None, 19, 18, 21, 17, 22])) == -9\n assert candidate(root = tree_node([12, 5, 20, 3, 7, 16, 24, 1, 4, 6, 8, 14, 18, 22, 25, None, None, None, None, None, None, None, None, None, None, None, 17, 19, 21, 23, 26, 27])) == -10\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == -1\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 17, 22, 28, 32, 38])) == 2\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180])) == 5\n assert candidate(root = tree_node([15, 9, 21, 7, 12, 18, 25, 5, 8, 10, 14, 17, 20, 23, 27])) == 1\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 85, 115, 140, 160, 185, 5, 12, 20, 28, 52, 70, 80, 90, 105, 110, 130, 135, 145, 155, 165, 170, 180, 190, 195, 200])) == -183\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, None, 12, 18, 22, 28, None, None, None, None, 11, 13, None, 17, 19, 21, 23, 27, 29])) == -18\n assert candidate(root = tree_node([45, 20, 65, 10, 30, 55, 75, 5, 15, 25, 35, 50, 60, 70, 80])) == 5\n assert candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15, 17])) == -16\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 17, 25, 35, 47, 3, 8, 13, 18, 22, 33, 38, 44, 46, 48, 49, 51])) == -42\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, None, None, 13, 17, None, 28, 32, 40])) == 2\n assert candidate(root = tree_node([8, 3, 15, 1, 7, 12, 20, None, None, None, None, None, None, 10, 14, 16, 25, None, None, None, None, None, None, 22, 23, 26, 28])) == -6\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().minDiffInBST", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minDiffInBST = function(root) {", "container": null, "callable": "minDiffInBST", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 784, "task_id": "letter-case-permutation", "difficulty": "Medium", "problem_description": "Given a string s, you can transform every letter individually to be lowercase or uppercase to create another string.\nReturn a list of all possible strings we could create. Return the output in any order.\n \nExample 1:\n\nInput: s = \"a1b2\"\nOutput: [\"a1b2\",\"a1B2\",\"A1b2\",\"A1B2\"]\n\nExample 2:\n\nInput: s = \"3z4\"\nOutput: [\"3z4\",\"3Z4\"]\n\n \nConstraints:\n\n1 <= s.length <= 12\ns consists of lowercase English letters, uppercase English letters, and digits.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"aBcDeF\") == ['aBcDeF', 'aBcDef', 'aBcDEf', 'aBcDEF', 'aBcdEF', 'aBcdEf', 'aBcdef', 'aBcdeF', 'aBCdeF', 'aBCdef', 'aBCdEf', 'aBCdEF', 'aBCDEF', 'aBCDEf', 'aBCDef', 'aBCDeF', 'abCDeF', 'abCDef', 'abCDEf', 'abCDEF', 'abCdEF', 'abCdEf', 'abCdef', 'abCdeF', 'abcdeF', 'abcdef', 'abcdEf', 'abcdEF', 'abcDEF', 'abcDEf', 'abcDef', 'abcDeF', 'AbcDeF', 'AbcDef', 'AbcDEf', 'AbcDEF', 'AbcdEF', 'AbcdEf', 'Abcdef', 'AbcdeF', 'AbCdeF', 'AbCdef', 'AbCdEf', 'AbCdEF', 'AbCDEF', 'AbCDEf', 'AbCDef', 'AbCDeF', 'ABCDeF', 'ABCDef', 'ABCDEf', 'ABCDEF', 'ABCdEF', 'ABCdEf', 'ABCdef', 'ABCdeF', 'ABcdeF', 'ABcdef', 'ABcdEf', 'ABcdEF', 'ABcDEF', 'ABcDEf', 'ABcDef', 'ABcDeF']\n assert candidate(s = \"3z4\") == ['3z4', '3Z4']\n assert candidate(s = \"aBc1\") == ['aBc1', 'aBC1', 'abC1', 'abc1', 'Abc1', 'AbC1', 'ABC1', 'ABc1']\n assert candidate(s = \"abcdef\") == ['abcdef', 'abcdeF', 'abcdEF', 'abcdEf', 'abcDEf', 'abcDEF', 'abcDeF', 'abcDef', 'abCDef', 'abCDeF', 'abCDEF', 'abCDEf', 'abCdEf', 'abCdEF', 'abCdeF', 'abCdef', 'aBCdef', 'aBCdeF', 'aBCdEF', 'aBCdEf', 'aBCDEf', 'aBCDEF', 'aBCDeF', 'aBCDef', 'aBcDef', 'aBcDeF', 'aBcDEF', 'aBcDEf', 'aBcdEf', 'aBcdEF', 'aBcdeF', 'aBcdef', 'ABcdef', 'ABcdeF', 'ABcdEF', 'ABcdEf', 'ABcDEf', 'ABcDEF', 'ABcDeF', 'ABcDef', 'ABCDef', 'ABCDeF', 'ABCDEF', 'ABCDEf', 'ABCdEf', 'ABCdEF', 'ABCdeF', 'ABCdef', 'AbCdef', 'AbCdeF', 'AbCdEF', 'AbCdEf', 'AbCDEf', 'AbCDEF', 'AbCDeF', 'AbCDef', 'AbcDef', 'AbcDeF', 'AbcDEF', 'AbcDEf', 'AbcdEf', 'AbcdEF', 'AbcdeF', 'Abcdef']\n assert candidate(s = \"ABC123\") == ['ABC123', 'ABc123', 'Abc123', 'AbC123', 'abC123', 'abc123', 'aBc123', 'aBC123']\n assert candidate(s = \"123abc456DEF\") == ['123abc456DEF', '123abc456DEf', '123abc456Def', '123abc456DeF', '123abc456deF', '123abc456def', '123abc456dEf', '123abc456dEF', '123abC456dEF', '123abC456dEf', '123abC456def', '123abC456deF', '123abC456DeF', '123abC456Def', '123abC456DEf', '123abC456DEF', '123aBC456DEF', '123aBC456DEf', '123aBC456Def', '123aBC456DeF', '123aBC456deF', '123aBC456def', '123aBC456dEf', '123aBC456dEF', '123aBc456dEF', '123aBc456dEf', '123aBc456def', '123aBc456deF', '123aBc456DeF', '123aBc456Def', '123aBc456DEf', '123aBc456DEF', '123ABc456DEF', '123ABc456DEf', '123ABc456Def', '123ABc456DeF', '123ABc456deF', '123ABc456def', '123ABc456dEf', '123ABc456dEF', '123ABC456dEF', '123ABC456dEf', '123ABC456def', '123ABC456deF', '123ABC456DeF', '123ABC456Def', '123ABC456DEf', '123ABC456DEF', '123AbC456DEF', '123AbC456DEf', '123AbC456Def', '123AbC456DeF', '123AbC456deF', '123AbC456def', '123AbC456dEf', '123AbC456dEF', '123Abc456dEF', '123Abc456dEf', '123Abc456def', '123Abc456deF', '123Abc456DeF', '123Abc456Def', '123Abc456DEf', '123Abc456DEF']\n assert candidate(s = \"1234567890\") == ['1234567890']\n assert candidate(s = \"a\") == ['a', 'A']\n assert candidate(s = \"a1b2\") == ['a1b2', 'a1B2', 'A1B2', 'A1b2']\n assert candidate(s = \"ab\") == ['ab', 'aB', 'AB', 'Ab']\n assert candidate(s = \"A1B2C3\") == ['A1B2C3', 'A1B2c3', 'A1b2c3', 'A1b2C3', 'a1b2C3', 'a1b2c3', 'a1B2c3', 'a1B2C3']\n assert candidate(s = \"\") == ['']\n assert candidate(s = \"Z1y2X3\") == ['Z1y2X3', 'Z1y2x3', 'Z1Y2x3', 'Z1Y2X3', 'z1Y2X3', 'z1Y2x3', 'z1y2x3', 'z1y2X3']\n assert candidate(s = \"A1B\") == ['A1B', 'A1b', 'a1b', 'a1B']\n assert candidate(s = \"A\") == ['A', 'a']\n assert candidate(s = \"1a2B3c4D\") == ['1a2B3c4D', '1a2B3c4d', '1a2B3C4d', '1a2B3C4D', '1a2b3C4D', '1a2b3C4d', '1a2b3c4d', '1a2b3c4D', '1A2b3c4D', '1A2b3c4d', '1A2b3C4d', '1A2b3C4D', '1A2B3C4D', '1A2B3C4d', '1A2B3c4d', '1A2B3c4D']\n assert candidate(s = \"a1B2c3D4e5F6g7H8\") == ['a1B2c3D4e5F6g7H8', 'a1B2c3D4e5F6g7h8', 'a1B2c3D4e5F6G7h8', 'a1B2c3D4e5F6G7H8', 'a1B2c3D4e5f6G7H8', 'a1B2c3D4e5f6G7h8', 'a1B2c3D4e5f6g7h8', 'a1B2c3D4e5f6g7H8', 'a1B2c3D4E5f6g7H8', 'a1B2c3D4E5f6g7h8', 'a1B2c3D4E5f6G7h8', 'a1B2c3D4E5f6G7H8', 'a1B2c3D4E5F6G7H8', 'a1B2c3D4E5F6G7h8', 'a1B2c3D4E5F6g7h8', 'a1B2c3D4E5F6g7H8', 'a1B2c3d4E5F6g7H8', 'a1B2c3d4E5F6g7h8', 'a1B2c3d4E5F6G7h8', 'a1B2c3d4E5F6G7H8', 'a1B2c3d4E5f6G7H8', 'a1B2c3d4E5f6G7h8', 'a1B2c3d4E5f6g7h8', 'a1B2c3d4E5f6g7H8', 'a1B2c3d4e5f6g7H8', 'a1B2c3d4e5f6g7h8', 'a1B2c3d4e5f6G7h8', 'a1B2c3d4e5f6G7H8', 'a1B2c3d4e5F6G7H8', 'a1B2c3d4e5F6G7h8', 'a1B2c3d4e5F6g7h8', 'a1B2c3d4e5F6g7H8', 'a1B2C3d4e5F6g7H8', 'a1B2C3d4e5F6g7h8', 'a1B2C3d4e5F6G7h8', 'a1B2C3d4e5F6G7H8', 'a1B2C3d4e5f6G7H8', 'a1B2C3d4e5f6G7h8', 'a1B2C3d4e5f6g7h8', 'a1B2C3d4e5f6g7H8', 'a1B2C3d4E5f6g7H8', 'a1B2C3d4E5f6g7h8', 'a1B2C3d4E5f6G7h8', 'a1B2C3d4E5f6G7H8', 'a1B2C3d4E5F6G7H8', 'a1B2C3d4E5F6G7h8', 'a1B2C3d4E5F6g7h8', 'a1B2C3d4E5F6g7H8', 'a1B2C3D4E5F6g7H8', 'a1B2C3D4E5F6g7h8', 'a1B2C3D4E5F6G7h8', 'a1B2C3D4E5F6G7H8', 'a1B2C3D4E5f6G7H8', 'a1B2C3D4E5f6G7h8', 'a1B2C3D4E5f6g7h8', 'a1B2C3D4E5f6g7H8', 'a1B2C3D4e5f6g7H8', 'a1B2C3D4e5f6g7h8', 'a1B2C3D4e5f6G7h8', 'a1B2C3D4e5f6G7H8', 'a1B2C3D4e5F6G7H8', 'a1B2C3D4e5F6G7h8', 'a1B2C3D4e5F6g7h8', 'a1B2C3D4e5F6g7H8', 'a1b2C3D4e5F6g7H8', 'a1b2C3D4e5F6g7h8', 'a1b2C3D4e5F6G7h8', 'a1b2C3D4e5F6G7H8', 'a1b2C3D4e5f6G7H8', 'a1b2C3D4e5f6G7h8', 'a1b2C3D4e5f6g7h8', 'a1b2C3D4e5f6g7H8', 'a1b2C3D4E5f6g7H8', 'a1b2C3D4E5f6g7h8', 'a1b2C3D4E5f6G7h8', 'a1b2C3D4E5f6G7H8', 'a1b2C3D4E5F6G7H8', 'a1b2C3D4E5F6G7h8', 'a1b2C3D4E5F6g7h8', 'a1b2C3D4E5F6g7H8', 'a1b2C3d4E5F6g7H8', 'a1b2C3d4E5F6g7h8', 'a1b2C3d4E5F6G7h8', 'a1b2C3d4E5F6G7H8', 'a1b2C3d4E5f6G7H8', 'a1b2C3d4E5f6G7h8', 'a1b2C3d4E5f6g7h8', 'a1b2C3d4E5f6g7H8', 'a1b2C3d4e5f6g7H8', 'a1b2C3d4e5f6g7h8', 'a1b2C3d4e5f6G7h8', 'a1b2C3d4e5f6G7H8', 'a1b2C3d4e5F6G7H8', 'a1b2C3d4e5F6G7h8', 'a1b2C3d4e5F6g7h8', 'a1b2C3d4e5F6g7H8', 'a1b2c3d4e5F6g7H8', 'a1b2c3d4e5F6g7h8', 'a1b2c3d4e5F6G7h8', 'a1b2c3d4e5F6G7H8', 'a1b2c3d4e5f6G7H8', 'a1b2c3d4e5f6G7h8', 'a1b2c3d4e5f6g7h8', 'a1b2c3d4e5f6g7H8', 'a1b2c3d4E5f6g7H8', 'a1b2c3d4E5f6g7h8', 'a1b2c3d4E5f6G7h8', 'a1b2c3d4E5f6G7H8', 'a1b2c3d4E5F6G7H8', 'a1b2c3d4E5F6G7h8', 'a1b2c3d4E5F6g7h8', 'a1b2c3d4E5F6g7H8', 'a1b2c3D4E5F6g7H8', 'a1b2c3D4E5F6g7h8', 'a1b2c3D4E5F6G7h8', 'a1b2c3D4E5F6G7H8', 'a1b2c3D4E5f6G7H8', 'a1b2c3D4E5f6G7h8', 'a1b2c3D4E5f6g7h8', 'a1b2c3D4E5f6g7H8', 'a1b2c3D4e5f6g7H8', 'a1b2c3D4e5f6g7h8', 'a1b2c3D4e5f6G7h8', 'a1b2c3D4e5f6G7H8', 'a1b2c3D4e5F6G7H8', 'a1b2c3D4e5F6G7h8', 'a1b2c3D4e5F6g7h8', 'a1b2c3D4e5F6g7H8', 'A1b2c3D4e5F6g7H8', 'A1b2c3D4e5F6g7h8', 'A1b2c3D4e5F6G7h8', 'A1b2c3D4e5F6G7H8', 'A1b2c3D4e5f6G7H8', 'A1b2c3D4e5f6G7h8', 'A1b2c3D4e5f6g7h8', 'A1b2c3D4e5f6g7H8', 'A1b2c3D4E5f6g7H8', 'A1b2c3D4E5f6g7h8', 'A1b2c3D4E5f6G7h8', 'A1b2c3D4E5f6G7H8', 'A1b2c3D4E5F6G7H8', 'A1b2c3D4E5F6G7h8', 'A1b2c3D4E5F6g7h8', 'A1b2c3D4E5F6g7H8', 'A1b2c3d4E5F6g7H8', 'A1b2c3d4E5F6g7h8', 'A1b2c3d4E5F6G7h8', 'A1b2c3d4E5F6G7H8', 'A1b2c3d4E5f6G7H8', 'A1b2c3d4E5f6G7h8', 'A1b2c3d4E5f6g7h8', 'A1b2c3d4E5f6g7H8', 'A1b2c3d4e5f6g7H8', 'A1b2c3d4e5f6g7h8', 'A1b2c3d4e5f6G7h8', 'A1b2c3d4e5f6G7H8', 'A1b2c3d4e5F6G7H8', 'A1b2c3d4e5F6G7h8', 'A1b2c3d4e5F6g7h8', 'A1b2c3d4e5F6g7H8', 'A1b2C3d4e5F6g7H8', 'A1b2C3d4e5F6g7h8', 'A1b2C3d4e5F6G7h8', 'A1b2C3d4e5F6G7H8', 'A1b2C3d4e5f6G7H8', 'A1b2C3d4e5f6G7h8', 'A1b2C3d4e5f6g7h8', 'A1b2C3d4e5f6g7H8', 'A1b2C3d4E5f6g7H8', 'A1b2C3d4E5f6g7h8', 'A1b2C3d4E5f6G7h8', 'A1b2C3d4E5f6G7H8', 'A1b2C3d4E5F6G7H8', 'A1b2C3d4E5F6G7h8', 'A1b2C3d4E5F6g7h8', 'A1b2C3d4E5F6g7H8', 'A1b2C3D4E5F6g7H8', 'A1b2C3D4E5F6g7h8', 'A1b2C3D4E5F6G7h8', 'A1b2C3D4E5F6G7H8', 'A1b2C3D4E5f6G7H8', 'A1b2C3D4E5f6G7h8', 'A1b2C3D4E5f6g7h8', 'A1b2C3D4E5f6g7H8', 'A1b2C3D4e5f6g7H8', 'A1b2C3D4e5f6g7h8', 'A1b2C3D4e5f6G7h8', 'A1b2C3D4e5f6G7H8', 'A1b2C3D4e5F6G7H8', 'A1b2C3D4e5F6G7h8', 'A1b2C3D4e5F6g7h8', 'A1b2C3D4e5F6g7H8', 'A1B2C3D4e5F6g7H8', 'A1B2C3D4e5F6g7h8', 'A1B2C3D4e5F6G7h8', 'A1B2C3D4e5F6G7H8', 'A1B2C3D4e5f6G7H8', 'A1B2C3D4e5f6G7h8', 'A1B2C3D4e5f6g7h8', 'A1B2C3D4e5f6g7H8', 'A1B2C3D4E5f6g7H8', 'A1B2C3D4E5f6g7h8', 'A1B2C3D4E5f6G7h8', 'A1B2C3D4E5f6G7H8', 'A1B2C3D4E5F6G7H8', 'A1B2C3D4E5F6G7h8', 'A1B2C3D4E5F6g7h8', 'A1B2C3D4E5F6g7H8', 'A1B2C3d4E5F6g7H8', 'A1B2C3d4E5F6g7h8', 'A1B2C3d4E5F6G7h8', 'A1B2C3d4E5F6G7H8', 'A1B2C3d4E5f6G7H8', 'A1B2C3d4E5f6G7h8', 'A1B2C3d4E5f6g7h8', 'A1B2C3d4E5f6g7H8', 'A1B2C3d4e5f6g7H8', 'A1B2C3d4e5f6g7h8', 'A1B2C3d4e5f6G7h8', 'A1B2C3d4e5f6G7H8', 'A1B2C3d4e5F6G7H8', 'A1B2C3d4e5F6G7h8', 'A1B2C3d4e5F6g7h8', 'A1B2C3d4e5F6g7H8', 'A1B2c3d4e5F6g7H8', 'A1B2c3d4e5F6g7h8', 'A1B2c3d4e5F6G7h8', 'A1B2c3d4e5F6G7H8', 'A1B2c3d4e5f6G7H8', 'A1B2c3d4e5f6G7h8', 'A1B2c3d4e5f6g7h8', 'A1B2c3d4e5f6g7H8', 'A1B2c3d4E5f6g7H8', 'A1B2c3d4E5f6g7h8', 'A1B2c3d4E5f6G7h8', 'A1B2c3d4E5f6G7H8', 'A1B2c3d4E5F6G7H8', 'A1B2c3d4E5F6G7h8', 'A1B2c3d4E5F6g7h8', 'A1B2c3d4E5F6g7H8', 'A1B2c3D4E5F6g7H8', 'A1B2c3D4E5F6g7h8', 'A1B2c3D4E5F6G7h8', 'A1B2c3D4E5F6G7H8', 'A1B2c3D4E5f6G7H8', 'A1B2c3D4E5f6G7h8', 'A1B2c3D4E5f6g7h8', 'A1B2c3D4E5f6g7H8', 'A1B2c3D4e5f6g7H8', 'A1B2c3D4e5f6g7h8', 'A1B2c3D4e5f6G7h8', 'A1B2c3D4e5f6G7H8', 'A1B2c3D4e5F6G7H8', 'A1B2c3D4e5F6G7h8', 'A1B2c3D4e5F6g7h8', 'A1B2c3D4e5F6g7H8']\n assert candidate(s = \"aBc123\") == ['aBc123', 'aBC123', 'abC123', 'abc123', 'Abc123', 'AbC123', 'ABC123', 'ABc123']\n assert candidate(s = \"123abcDEF\") == ['123abcDEF', '123abcDEf', '123abcDef', '123abcDeF', '123abcdeF', '123abcdef', '123abcdEf', '123abcdEF', '123abCdEF', '123abCdEf', '123abCdef', '123abCdeF', '123abCDeF', '123abCDef', '123abCDEf', '123abCDEF', '123aBCDEF', '123aBCDEf', '123aBCDef', '123aBCDeF', '123aBCdeF', '123aBCdef', '123aBCdEf', '123aBCdEF', '123aBcdEF', '123aBcdEf', '123aBcdef', '123aBcdeF', '123aBcDeF', '123aBcDef', '123aBcDEf', '123aBcDEF', '123ABcDEF', '123ABcDEf', '123ABcDef', '123ABcDeF', '123ABcdeF', '123ABcdef', '123ABcdEf', '123ABcdEF', '123ABCdEF', '123ABCdEf', '123ABCdef', '123ABCdeF', '123ABCDeF', '123ABCDef', '123ABCDEf', '123ABCDEF', '123AbCDEF', '123AbCDEf', '123AbCDef', '123AbCDeF', '123AbCdeF', '123AbCdef', '123AbCdEf', '123AbCdEF', '123AbcdEF', '123AbcdEf', '123Abcdef', '123AbcdeF', '123AbcDeF', '123AbcDef', '123AbcDEf', '123AbcDEF']\n assert candidate(s = \"1\") == ['1']\n assert candidate(s = \"123\") == ['123']\n assert candidate(s = \"aBc\") == ['aBc', 'aBC', 'abC', 'abc', 'Abc', 'AbC', 'ABC', 'ABc']\n assert candidate(s = \"aB\") == ['aB', 'ab', 'Ab', 'AB']\n assert candidate(s = \"ABCDEFG\") == ['ABCDEFG', 'ABCDEFg', 'ABCDEfg', 'ABCDEfG', 'ABCDefG', 'ABCDefg', 'ABCDeFg', 'ABCDeFG', 'ABCdeFG', 'ABCdeFg', 'ABCdefg', 'ABCdefG', 'ABCdEfG', 'ABCdEfg', 'ABCdEFg', 'ABCdEFG', 'ABcdEFG', 'ABcdEFg', 'ABcdEfg', 'ABcdEfG', 'ABcdefG', 'ABcdefg', 'ABcdeFg', 'ABcdeFG', 'ABcDeFG', 'ABcDeFg', 'ABcDefg', 'ABcDefG', 'ABcDEfG', 'ABcDEfg', 'ABcDEFg', 'ABcDEFG', 'AbcDEFG', 'AbcDEFg', 'AbcDEfg', 'AbcDEfG', 'AbcDefG', 'AbcDefg', 'AbcDeFg', 'AbcDeFG', 'AbcdeFG', 'AbcdeFg', 'Abcdefg', 'AbcdefG', 'AbcdEfG', 'AbcdEfg', 'AbcdEFg', 'AbcdEFG', 'AbCdEFG', 'AbCdEFg', 'AbCdEfg', 'AbCdEfG', 'AbCdefG', 'AbCdefg', 'AbCdeFg', 'AbCdeFG', 'AbCDeFG', 'AbCDeFg', 'AbCDefg', 'AbCDefG', 'AbCDEfG', 'AbCDEfg', 'AbCDEFg', 'AbCDEFG', 'abCDEFG', 'abCDEFg', 'abCDEfg', 'abCDEfG', 'abCDefG', 'abCDefg', 'abCDeFg', 'abCDeFG', 'abCdeFG', 'abCdeFg', 'abCdefg', 'abCdefG', 'abCdEfG', 'abCdEfg', 'abCdEFg', 'abCdEFG', 'abcdEFG', 'abcdEFg', 'abcdEfg', 'abcdEfG', 'abcdefG', 'abcdefg', 'abcdeFg', 'abcdeFG', 'abcDeFG', 'abcDeFg', 'abcDefg', 'abcDefG', 'abcDEfG', 'abcDEfg', 'abcDEFg', 'abcDEFG', 'aBcDEFG', 'aBcDEFg', 'aBcDEfg', 'aBcDEfG', 'aBcDefG', 'aBcDefg', 'aBcDeFg', 'aBcDeFG', 'aBcdeFG', 'aBcdeFg', 'aBcdefg', 'aBcdefG', 'aBcdEfG', 'aBcdEfg', 'aBcdEFg', 'aBcdEFG', 'aBCdEFG', 'aBCdEFg', 'aBCdEfg', 'aBCdEfG', 'aBCdefG', 'aBCdefg', 'aBCdeFg', 'aBCdeFG', 'aBCDeFG', 'aBCDeFg', 'aBCDefg', 'aBCDefG', 'aBCDEfG', 'aBCDEfg', 'aBCDEFg', 'aBCDEFG']\n assert candidate(s = \"GHIjkl456\") == ['GHIjkl456', 'GHIjkL456', 'GHIjKL456', 'GHIjKl456', 'GHIJKl456', 'GHIJKL456', 'GHIJkL456', 'GHIJkl456', 'GHiJkl456', 'GHiJkL456', 'GHiJKL456', 'GHiJKl456', 'GHijKl456', 'GHijKL456', 'GHijkL456', 'GHijkl456', 'Ghijkl456', 'GhijkL456', 'GhijKL456', 'GhijKl456', 'GhiJKl456', 'GhiJKL456', 'GhiJkL456', 'GhiJkl456', 'GhIJkl456', 'GhIJkL456', 'GhIJKL456', 'GhIJKl456', 'GhIjKl456', 'GhIjKL456', 'GhIjkL456', 'GhIjkl456', 'ghIjkl456', 'ghIjkL456', 'ghIjKL456', 'ghIjKl456', 'ghIJKl456', 'ghIJKL456', 'ghIJkL456', 'ghIJkl456', 'ghiJkl456', 'ghiJkL456', 'ghiJKL456', 'ghiJKl456', 'ghijKl456', 'ghijKL456', 'ghijkL456', 'ghijkl456', 'gHijkl456', 'gHijkL456', 'gHijKL456', 'gHijKl456', 'gHiJKl456', 'gHiJKL456', 'gHiJkL456', 'gHiJkl456', 'gHIJkl456', 'gHIJkL456', 'gHIJKL456', 'gHIJKl456', 'gHIjKl456', 'gHIjKL456', 'gHIjkL456', 'gHIjkl456']\n assert candidate(s = \"000aBc111\") == ['000aBc111', '000aBC111', '000abC111', '000abc111', '000Abc111', '000AbC111', '000ABC111', '000ABc111']\n assert candidate(s = \"123ABC\") == ['123ABC', '123ABc', '123Abc', '123AbC', '123abC', '123abc', '123aBc', '123aBC']\n assert candidate(s = \"aBcD\") == ['aBcD', 'aBcd', 'aBCd', 'aBCD', 'abCD', 'abCd', 'abcd', 'abcD', 'AbcD', 'Abcd', 'AbCd', 'AbCD', 'ABCD', 'ABCd', 'ABcd', 'ABcD']\n assert candidate(s = \"xyz789\") == ['xyz789', 'xyZ789', 'xYZ789', 'xYz789', 'XYz789', 'XYZ789', 'XyZ789', 'Xyz789']\n assert candidate(s = \"0f1G2h\") == ['0f1G2h', '0f1G2H', '0f1g2H', '0f1g2h', '0F1g2h', '0F1g2H', '0F1G2H', '0F1G2h']\n assert candidate(s = \"9a8B7\") == ['9a8B7', '9a8b7', '9A8b7', '9A8B7']\n assert candidate(s = \"A1b2C3d4E5\") == ['A1b2C3d4E5', 'A1b2C3d4e5', 'A1b2C3D4e5', 'A1b2C3D4E5', 'A1b2c3D4E5', 'A1b2c3D4e5', 'A1b2c3d4e5', 'A1b2c3d4E5', 'A1B2c3d4E5', 'A1B2c3d4e5', 'A1B2c3D4e5', 'A1B2c3D4E5', 'A1B2C3D4E5', 'A1B2C3D4e5', 'A1B2C3d4e5', 'A1B2C3d4E5', 'a1B2C3d4E5', 'a1B2C3d4e5', 'a1B2C3D4e5', 'a1B2C3D4E5', 'a1B2c3D4E5', 'a1B2c3D4e5', 'a1B2c3d4e5', 'a1B2c3d4E5', 'a1b2c3d4E5', 'a1b2c3d4e5', 'a1b2c3D4e5', 'a1b2c3D4E5', 'a1b2C3D4E5', 'a1b2C3D4e5', 'a1b2C3d4e5', 'a1b2C3d4E5']\n assert candidate(s = \"9l8k7j6i5h4g3f2e1d\") == ['9l8k7j6i5h4g3f2e1d', '9l8k7j6i5h4g3f2e1D', '9l8k7j6i5h4g3f2E1D', '9l8k7j6i5h4g3f2E1d', '9l8k7j6i5h4g3F2E1d', '9l8k7j6i5h4g3F2E1D', '9l8k7j6i5h4g3F2e1D', '9l8k7j6i5h4g3F2e1d', '9l8k7j6i5h4G3F2e1d', '9l8k7j6i5h4G3F2e1D', '9l8k7j6i5h4G3F2E1D', '9l8k7j6i5h4G3F2E1d', '9l8k7j6i5h4G3f2E1d', '9l8k7j6i5h4G3f2E1D', '9l8k7j6i5h4G3f2e1D', '9l8k7j6i5h4G3f2e1d', '9l8k7j6i5H4G3f2e1d', '9l8k7j6i5H4G3f2e1D', '9l8k7j6i5H4G3f2E1D', '9l8k7j6i5H4G3f2E1d', '9l8k7j6i5H4G3F2E1d', '9l8k7j6i5H4G3F2E1D', '9l8k7j6i5H4G3F2e1D', '9l8k7j6i5H4G3F2e1d', '9l8k7j6i5H4g3F2e1d', '9l8k7j6i5H4g3F2e1D', '9l8k7j6i5H4g3F2E1D', '9l8k7j6i5H4g3F2E1d', '9l8k7j6i5H4g3f2E1d', '9l8k7j6i5H4g3f2E1D', '9l8k7j6i5H4g3f2e1D', '9l8k7j6i5H4g3f2e1d', '9l8k7j6I5H4g3f2e1d', '9l8k7j6I5H4g3f2e1D', '9l8k7j6I5H4g3f2E1D', '9l8k7j6I5H4g3f2E1d', '9l8k7j6I5H4g3F2E1d', '9l8k7j6I5H4g3F2E1D', '9l8k7j6I5H4g3F2e1D', '9l8k7j6I5H4g3F2e1d', '9l8k7j6I5H4G3F2e1d', '9l8k7j6I5H4G3F2e1D', '9l8k7j6I5H4G3F2E1D', '9l8k7j6I5H4G3F2E1d', '9l8k7j6I5H4G3f2E1d', '9l8k7j6I5H4G3f2E1D', '9l8k7j6I5H4G3f2e1D', '9l8k7j6I5H4G3f2e1d', '9l8k7j6I5h4G3f2e1d', '9l8k7j6I5h4G3f2e1D', '9l8k7j6I5h4G3f2E1D', '9l8k7j6I5h4G3f2E1d', '9l8k7j6I5h4G3F2E1d', '9l8k7j6I5h4G3F2E1D', '9l8k7j6I5h4G3F2e1D', '9l8k7j6I5h4G3F2e1d', '9l8k7j6I5h4g3F2e1d', '9l8k7j6I5h4g3F2e1D', '9l8k7j6I5h4g3F2E1D', '9l8k7j6I5h4g3F2E1d', '9l8k7j6I5h4g3f2E1d', '9l8k7j6I5h4g3f2E1D', '9l8k7j6I5h4g3f2e1D', '9l8k7j6I5h4g3f2e1d', '9l8k7J6I5h4g3f2e1d', '9l8k7J6I5h4g3f2e1D', '9l8k7J6I5h4g3f2E1D', '9l8k7J6I5h4g3f2E1d', '9l8k7J6I5h4g3F2E1d', '9l8k7J6I5h4g3F2E1D', '9l8k7J6I5h4g3F2e1D', '9l8k7J6I5h4g3F2e1d', '9l8k7J6I5h4G3F2e1d', '9l8k7J6I5h4G3F2e1D', '9l8k7J6I5h4G3F2E1D', '9l8k7J6I5h4G3F2E1d', '9l8k7J6I5h4G3f2E1d', '9l8k7J6I5h4G3f2E1D', '9l8k7J6I5h4G3f2e1D', '9l8k7J6I5h4G3f2e1d', '9l8k7J6I5H4G3f2e1d', '9l8k7J6I5H4G3f2e1D', '9l8k7J6I5H4G3f2E1D', '9l8k7J6I5H4G3f2E1d', '9l8k7J6I5H4G3F2E1d', '9l8k7J6I5H4G3F2E1D', '9l8k7J6I5H4G3F2e1D', '9l8k7J6I5H4G3F2e1d', '9l8k7J6I5H4g3F2e1d', '9l8k7J6I5H4g3F2e1D', '9l8k7J6I5H4g3F2E1D', '9l8k7J6I5H4g3F2E1d', '9l8k7J6I5H4g3f2E1d', '9l8k7J6I5H4g3f2E1D', '9l8k7J6I5H4g3f2e1D', '9l8k7J6I5H4g3f2e1d', '9l8k7J6i5H4g3f2e1d', '9l8k7J6i5H4g3f2e1D', '9l8k7J6i5H4g3f2E1D', '9l8k7J6i5H4g3f2E1d', '9l8k7J6i5H4g3F2E1d', '9l8k7J6i5H4g3F2E1D', '9l8k7J6i5H4g3F2e1D', '9l8k7J6i5H4g3F2e1d', '9l8k7J6i5H4G3F2e1d', '9l8k7J6i5H4G3F2e1D', '9l8k7J6i5H4G3F2E1D', '9l8k7J6i5H4G3F2E1d', '9l8k7J6i5H4G3f2E1d', '9l8k7J6i5H4G3f2E1D', '9l8k7J6i5H4G3f2e1D', '9l8k7J6i5H4G3f2e1d', '9l8k7J6i5h4G3f2e1d', '9l8k7J6i5h4G3f2e1D', '9l8k7J6i5h4G3f2E1D', '9l8k7J6i5h4G3f2E1d', '9l8k7J6i5h4G3F2E1d', '9l8k7J6i5h4G3F2E1D', '9l8k7J6i5h4G3F2e1D', '9l8k7J6i5h4G3F2e1d', '9l8k7J6i5h4g3F2e1d', '9l8k7J6i5h4g3F2e1D', '9l8k7J6i5h4g3F2E1D', '9l8k7J6i5h4g3F2E1d', '9l8k7J6i5h4g3f2E1d', '9l8k7J6i5h4g3f2E1D', '9l8k7J6i5h4g3f2e1D', '9l8k7J6i5h4g3f2e1d', '9l8K7J6i5h4g3f2e1d', '9l8K7J6i5h4g3f2e1D', '9l8K7J6i5h4g3f2E1D', '9l8K7J6i5h4g3f2E1d', '9l8K7J6i5h4g3F2E1d', '9l8K7J6i5h4g3F2E1D', '9l8K7J6i5h4g3F2e1D', '9l8K7J6i5h4g3F2e1d', '9l8K7J6i5h4G3F2e1d', '9l8K7J6i5h4G3F2e1D', '9l8K7J6i5h4G3F2E1D', '9l8K7J6i5h4G3F2E1d', '9l8K7J6i5h4G3f2E1d', '9l8K7J6i5h4G3f2E1D', '9l8K7J6i5h4G3f2e1D', '9l8K7J6i5h4G3f2e1d', '9l8K7J6i5H4G3f2e1d', '9l8K7J6i5H4G3f2e1D', '9l8K7J6i5H4G3f2E1D', '9l8K7J6i5H4G3f2E1d', '9l8K7J6i5H4G3F2E1d', '9l8K7J6i5H4G3F2E1D', '9l8K7J6i5H4G3F2e1D', '9l8K7J6i5H4G3F2e1d', '9l8K7J6i5H4g3F2e1d', '9l8K7J6i5H4g3F2e1D', '9l8K7J6i5H4g3F2E1D', '9l8K7J6i5H4g3F2E1d', '9l8K7J6i5H4g3f2E1d', '9l8K7J6i5H4g3f2E1D', '9l8K7J6i5H4g3f2e1D', '9l8K7J6i5H4g3f2e1d', '9l8K7J6I5H4g3f2e1d', '9l8K7J6I5H4g3f2e1D', '9l8K7J6I5H4g3f2E1D', '9l8K7J6I5H4g3f2E1d', '9l8K7J6I5H4g3F2E1d', '9l8K7J6I5H4g3F2E1D', '9l8K7J6I5H4g3F2e1D', '9l8K7J6I5H4g3F2e1d', '9l8K7J6I5H4G3F2e1d', '9l8K7J6I5H4G3F2e1D', '9l8K7J6I5H4G3F2E1D', '9l8K7J6I5H4G3F2E1d', '9l8K7J6I5H4G3f2E1d', '9l8K7J6I5H4G3f2E1D', '9l8K7J6I5H4G3f2e1D', '9l8K7J6I5H4G3f2e1d', '9l8K7J6I5h4G3f2e1d', '9l8K7J6I5h4G3f2e1D', '9l8K7J6I5h4G3f2E1D', '9l8K7J6I5h4G3f2E1d', '9l8K7J6I5h4G3F2E1d', '9l8K7J6I5h4G3F2E1D', '9l8K7J6I5h4G3F2e1D', '9l8K7J6I5h4G3F2e1d', '9l8K7J6I5h4g3F2e1d', '9l8K7J6I5h4g3F2e1D', '9l8K7J6I5h4g3F2E1D', '9l8K7J6I5h4g3F2E1d', '9l8K7J6I5h4g3f2E1d', '9l8K7J6I5h4g3f2E1D', '9l8K7J6I5h4g3f2e1D', '9l8K7J6I5h4g3f2e1d', '9l8K7j6I5h4g3f2e1d', '9l8K7j6I5h4g3f2e1D', '9l8K7j6I5h4g3f2E1D', '9l8K7j6I5h4g3f2E1d', '9l8K7j6I5h4g3F2E1d', '9l8K7j6I5h4g3F2E1D', '9l8K7j6I5h4g3F2e1D', '9l8K7j6I5h4g3F2e1d', '9l8K7j6I5h4G3F2e1d', '9l8K7j6I5h4G3F2e1D', '9l8K7j6I5h4G3F2E1D', '9l8K7j6I5h4G3F2E1d', '9l8K7j6I5h4G3f2E1d', '9l8K7j6I5h4G3f2E1D', '9l8K7j6I5h4G3f2e1D', '9l8K7j6I5h4G3f2e1d', '9l8K7j6I5H4G3f2e1d', '9l8K7j6I5H4G3f2e1D', '9l8K7j6I5H4G3f2E1D', '9l8K7j6I5H4G3f2E1d', '9l8K7j6I5H4G3F2E1d', '9l8K7j6I5H4G3F2E1D', '9l8K7j6I5H4G3F2e1D', '9l8K7j6I5H4G3F2e1d', '9l8K7j6I5H4g3F2e1d', '9l8K7j6I5H4g3F2e1D', '9l8K7j6I5H4g3F2E1D', '9l8K7j6I5H4g3F2E1d', '9l8K7j6I5H4g3f2E1d', '9l8K7j6I5H4g3f2E1D', '9l8K7j6I5H4g3f2e1D', '9l8K7j6I5H4g3f2e1d', '9l8K7j6i5H4g3f2e1d', '9l8K7j6i5H4g3f2e1D', '9l8K7j6i5H4g3f2E1D', '9l8K7j6i5H4g3f2E1d', '9l8K7j6i5H4g3F2E1d', '9l8K7j6i5H4g3F2E1D', '9l8K7j6i5H4g3F2e1D', '9l8K7j6i5H4g3F2e1d', '9l8K7j6i5H4G3F2e1d', '9l8K7j6i5H4G3F2e1D', '9l8K7j6i5H4G3F2E1D', '9l8K7j6i5H4G3F2E1d', '9l8K7j6i5H4G3f2E1d', '9l8K7j6i5H4G3f2E1D', '9l8K7j6i5H4G3f2e1D', '9l8K7j6i5H4G3f2e1d', '9l8K7j6i5h4G3f2e1d', '9l8K7j6i5h4G3f2e1D', '9l8K7j6i5h4G3f2E1D', '9l8K7j6i5h4G3f2E1d', '9l8K7j6i5h4G3F2E1d', '9l8K7j6i5h4G3F2E1D', '9l8K7j6i5h4G3F2e1D', '9l8K7j6i5h4G3F2e1d', '9l8K7j6i5h4g3F2e1d', '9l8K7j6i5h4g3F2e1D', '9l8K7j6i5h4g3F2E1D', '9l8K7j6i5h4g3F2E1d', '9l8K7j6i5h4g3f2E1d', '9l8K7j6i5h4g3f2E1D', '9l8K7j6i5h4g3f2e1D', '9l8K7j6i5h4g3f2e1d', '9L8K7j6i5h4g3f2e1d', '9L8K7j6i5h4g3f2e1D', '9L8K7j6i5h4g3f2E1D', '9L8K7j6i5h4g3f2E1d', '9L8K7j6i5h4g3F2E1d', '9L8K7j6i5h4g3F2E1D', '9L8K7j6i5h4g3F2e1D', '9L8K7j6i5h4g3F2e1d', '9L8K7j6i5h4G3F2e1d', '9L8K7j6i5h4G3F2e1D', '9L8K7j6i5h4G3F2E1D', '9L8K7j6i5h4G3F2E1d', '9L8K7j6i5h4G3f2E1d', '9L8K7j6i5h4G3f2E1D', '9L8K7j6i5h4G3f2e1D', '9L8K7j6i5h4G3f2e1d', '9L8K7j6i5H4G3f2e1d', '9L8K7j6i5H4G3f2e1D', '9L8K7j6i5H4G3f2E1D', '9L8K7j6i5H4G3f2E1d', '9L8K7j6i5H4G3F2E1d', '9L8K7j6i5H4G3F2E1D', '9L8K7j6i5H4G3F2e1D', '9L8K7j6i5H4G3F2e1d', '9L8K7j6i5H4g3F2e1d', '9L8K7j6i5H4g3F2e1D', '9L8K7j6i5H4g3F2E1D', '9L8K7j6i5H4g3F2E1d', '9L8K7j6i5H4g3f2E1d', '9L8K7j6i5H4g3f2E1D', '9L8K7j6i5H4g3f2e1D', '9L8K7j6i5H4g3f2e1d', '9L8K7j6I5H4g3f2e1d', '9L8K7j6I5H4g3f2e1D', '9L8K7j6I5H4g3f2E1D', '9L8K7j6I5H4g3f2E1d', '9L8K7j6I5H4g3F2E1d', '9L8K7j6I5H4g3F2E1D', '9L8K7j6I5H4g3F2e1D', '9L8K7j6I5H4g3F2e1d', '9L8K7j6I5H4G3F2e1d', '9L8K7j6I5H4G3F2e1D', '9L8K7j6I5H4G3F2E1D', '9L8K7j6I5H4G3F2E1d', '9L8K7j6I5H4G3f2E1d', '9L8K7j6I5H4G3f2E1D', '9L8K7j6I5H4G3f2e1D', '9L8K7j6I5H4G3f2e1d', '9L8K7j6I5h4G3f2e1d', '9L8K7j6I5h4G3f2e1D', '9L8K7j6I5h4G3f2E1D', '9L8K7j6I5h4G3f2E1d', '9L8K7j6I5h4G3F2E1d', '9L8K7j6I5h4G3F2E1D', '9L8K7j6I5h4G3F2e1D', '9L8K7j6I5h4G3F2e1d', '9L8K7j6I5h4g3F2e1d', '9L8K7j6I5h4g3F2e1D', '9L8K7j6I5h4g3F2E1D', '9L8K7j6I5h4g3F2E1d', '9L8K7j6I5h4g3f2E1d', '9L8K7j6I5h4g3f2E1D', '9L8K7j6I5h4g3f2e1D', '9L8K7j6I5h4g3f2e1d', '9L8K7J6I5h4g3f2e1d', '9L8K7J6I5h4g3f2e1D', '9L8K7J6I5h4g3f2E1D', '9L8K7J6I5h4g3f2E1d', '9L8K7J6I5h4g3F2E1d', '9L8K7J6I5h4g3F2E1D', '9L8K7J6I5h4g3F2e1D', '9L8K7J6I5h4g3F2e1d', '9L8K7J6I5h4G3F2e1d', '9L8K7J6I5h4G3F2e1D', '9L8K7J6I5h4G3F2E1D', '9L8K7J6I5h4G3F2E1d', '9L8K7J6I5h4G3f2E1d', '9L8K7J6I5h4G3f2E1D', '9L8K7J6I5h4G3f2e1D', '9L8K7J6I5h4G3f2e1d', '9L8K7J6I5H4G3f2e1d', '9L8K7J6I5H4G3f2e1D', '9L8K7J6I5H4G3f2E1D', '9L8K7J6I5H4G3f2E1d', '9L8K7J6I5H4G3F2E1d', '9L8K7J6I5H4G3F2E1D', '9L8K7J6I5H4G3F2e1D', '9L8K7J6I5H4G3F2e1d', '9L8K7J6I5H4g3F2e1d', '9L8K7J6I5H4g3F2e1D', '9L8K7J6I5H4g3F2E1D', '9L8K7J6I5H4g3F2E1d', '9L8K7J6I5H4g3f2E1d', '9L8K7J6I5H4g3f2E1D', '9L8K7J6I5H4g3f2e1D', '9L8K7J6I5H4g3f2e1d', '9L8K7J6i5H4g3f2e1d', '9L8K7J6i5H4g3f2e1D', '9L8K7J6i5H4g3f2E1D', '9L8K7J6i5H4g3f2E1d', '9L8K7J6i5H4g3F2E1d', '9L8K7J6i5H4g3F2E1D', '9L8K7J6i5H4g3F2e1D', '9L8K7J6i5H4g3F2e1d', '9L8K7J6i5H4G3F2e1d', '9L8K7J6i5H4G3F2e1D', '9L8K7J6i5H4G3F2E1D', '9L8K7J6i5H4G3F2E1d', '9L8K7J6i5H4G3f2E1d', '9L8K7J6i5H4G3f2E1D', '9L8K7J6i5H4G3f2e1D', '9L8K7J6i5H4G3f2e1d', '9L8K7J6i5h4G3f2e1d', '9L8K7J6i5h4G3f2e1D', '9L8K7J6i5h4G3f2E1D', '9L8K7J6i5h4G3f2E1d', '9L8K7J6i5h4G3F2E1d', '9L8K7J6i5h4G3F2E1D', '9L8K7J6i5h4G3F2e1D', '9L8K7J6i5h4G3F2e1d', '9L8K7J6i5h4g3F2e1d', '9L8K7J6i5h4g3F2e1D', '9L8K7J6i5h4g3F2E1D', '9L8K7J6i5h4g3F2E1d', '9L8K7J6i5h4g3f2E1d', '9L8K7J6i5h4g3f2E1D', '9L8K7J6i5h4g3f2e1D', '9L8K7J6i5h4g3f2e1d', '9L8k7J6i5h4g3f2e1d', '9L8k7J6i5h4g3f2e1D', '9L8k7J6i5h4g3f2E1D', '9L8k7J6i5h4g3f2E1d', '9L8k7J6i5h4g3F2E1d', '9L8k7J6i5h4g3F2E1D', '9L8k7J6i5h4g3F2e1D', '9L8k7J6i5h4g3F2e1d', '9L8k7J6i5h4G3F2e1d', '9L8k7J6i5h4G3F2e1D', '9L8k7J6i5h4G3F2E1D', '9L8k7J6i5h4G3F2E1d', '9L8k7J6i5h4G3f2E1d', '9L8k7J6i5h4G3f2E1D', '9L8k7J6i5h4G3f2e1D', '9L8k7J6i5h4G3f2e1d', '9L8k7J6i5H4G3f2e1d', '9L8k7J6i5H4G3f2e1D', '9L8k7J6i5H4G3f2E1D', '9L8k7J6i5H4G3f2E1d', '9L8k7J6i5H4G3F2E1d', '9L8k7J6i5H4G3F2E1D', '9L8k7J6i5H4G3F2e1D', '9L8k7J6i5H4G3F2e1d', '9L8k7J6i5H4g3F2e1d', '9L8k7J6i5H4g3F2e1D', '9L8k7J6i5H4g3F2E1D', '9L8k7J6i5H4g3F2E1d', '9L8k7J6i5H4g3f2E1d', '9L8k7J6i5H4g3f2E1D', '9L8k7J6i5H4g3f2e1D', '9L8k7J6i5H4g3f2e1d', '9L8k7J6I5H4g3f2e1d', '9L8k7J6I5H4g3f2e1D', '9L8k7J6I5H4g3f2E1D', '9L8k7J6I5H4g3f2E1d', '9L8k7J6I5H4g3F2E1d', '9L8k7J6I5H4g3F2E1D', '9L8k7J6I5H4g3F2e1D', '9L8k7J6I5H4g3F2e1d', '9L8k7J6I5H4G3F2e1d', '9L8k7J6I5H4G3F2e1D', '9L8k7J6I5H4G3F2E1D', '9L8k7J6I5H4G3F2E1d', '9L8k7J6I5H4G3f2E1d', '9L8k7J6I5H4G3f2E1D', '9L8k7J6I5H4G3f2e1D', '9L8k7J6I5H4G3f2e1d', '9L8k7J6I5h4G3f2e1d', '9L8k7J6I5h4G3f2e1D', '9L8k7J6I5h4G3f2E1D', '9L8k7J6I5h4G3f2E1d', '9L8k7J6I5h4G3F2E1d', '9L8k7J6I5h4G3F2E1D', '9L8k7J6I5h4G3F2e1D', '9L8k7J6I5h4G3F2e1d', '9L8k7J6I5h4g3F2e1d', '9L8k7J6I5h4g3F2e1D', '9L8k7J6I5h4g3F2E1D', '9L8k7J6I5h4g3F2E1d', '9L8k7J6I5h4g3f2E1d', '9L8k7J6I5h4g3f2E1D', '9L8k7J6I5h4g3f2e1D', '9L8k7J6I5h4g3f2e1d', '9L8k7j6I5h4g3f2e1d', '9L8k7j6I5h4g3f2e1D', '9L8k7j6I5h4g3f2E1D', '9L8k7j6I5h4g3f2E1d', '9L8k7j6I5h4g3F2E1d', '9L8k7j6I5h4g3F2E1D', '9L8k7j6I5h4g3F2e1D', '9L8k7j6I5h4g3F2e1d', '9L8k7j6I5h4G3F2e1d', '9L8k7j6I5h4G3F2e1D', '9L8k7j6I5h4G3F2E1D', '9L8k7j6I5h4G3F2E1d', '9L8k7j6I5h4G3f2E1d', '9L8k7j6I5h4G3f2E1D', '9L8k7j6I5h4G3f2e1D', '9L8k7j6I5h4G3f2e1d', '9L8k7j6I5H4G3f2e1d', '9L8k7j6I5H4G3f2e1D', '9L8k7j6I5H4G3f2E1D', '9L8k7j6I5H4G3f2E1d', '9L8k7j6I5H4G3F2E1d', '9L8k7j6I5H4G3F2E1D', '9L8k7j6I5H4G3F2e1D', '9L8k7j6I5H4G3F2e1d', '9L8k7j6I5H4g3F2e1d', '9L8k7j6I5H4g3F2e1D', '9L8k7j6I5H4g3F2E1D', '9L8k7j6I5H4g3F2E1d', '9L8k7j6I5H4g3f2E1d', '9L8k7j6I5H4g3f2E1D', '9L8k7j6I5H4g3f2e1D', '9L8k7j6I5H4g3f2e1d', '9L8k7j6i5H4g3f2e1d', '9L8k7j6i5H4g3f2e1D', '9L8k7j6i5H4g3f2E1D', '9L8k7j6i5H4g3f2E1d', '9L8k7j6i5H4g3F2E1d', '9L8k7j6i5H4g3F2E1D', '9L8k7j6i5H4g3F2e1D', '9L8k7j6i5H4g3F2e1d', '9L8k7j6i5H4G3F2e1d', '9L8k7j6i5H4G3F2e1D', '9L8k7j6i5H4G3F2E1D', '9L8k7j6i5H4G3F2E1d', '9L8k7j6i5H4G3f2E1d', '9L8k7j6i5H4G3f2E1D', '9L8k7j6i5H4G3f2e1D', '9L8k7j6i5H4G3f2e1d', '9L8k7j6i5h4G3f2e1d', '9L8k7j6i5h4G3f2e1D', '9L8k7j6i5h4G3f2E1D', '9L8k7j6i5h4G3f2E1d', '9L8k7j6i5h4G3F2E1d', '9L8k7j6i5h4G3F2E1D', '9L8k7j6i5h4G3F2e1D', '9L8k7j6i5h4G3F2e1d', '9L8k7j6i5h4g3F2e1d', '9L8k7j6i5h4g3F2e1D', '9L8k7j6i5h4g3F2E1D', '9L8k7j6i5h4g3F2E1d', '9L8k7j6i5h4g3f2E1d', '9L8k7j6i5h4g3f2E1D', '9L8k7j6i5h4g3f2e1D', '9L8k7j6i5h4g3f2e1d']\n assert candidate(s = \"XYZ789\") == ['XYZ789', 'XYz789', 'Xyz789', 'XyZ789', 'xyZ789', 'xyz789', 'xYz789', 'xYZ789']\n assert candidate(s = \"aBc1D\") == ['aBc1D', 'aBc1d', 'aBC1d', 'aBC1D', 'abC1D', 'abC1d', 'abc1d', 'abc1D', 'Abc1D', 'Abc1d', 'AbC1d', 'AbC1D', 'ABC1D', 'ABC1d', 'ABc1d', 'ABc1D']\n assert candidate(s = \"0Z9X\") == ['0Z9X', '0Z9x', '0z9x', '0z9X']\n assert candidate(s = \"ZZZZ9999\") == ['ZZZZ9999', 'ZZZz9999', 'ZZzz9999', 'ZZzZ9999', 'ZzzZ9999', 'Zzzz9999', 'ZzZz9999', 'ZzZZ9999', 'zzZZ9999', 'zzZz9999', 'zzzz9999', 'zzzZ9999', 'zZzZ9999', 'zZzz9999', 'zZZz9999', 'zZZZ9999']\n assert candidate(s = \"A1B2C3D4\") == ['A1B2C3D4', 'A1B2C3d4', 'A1B2c3d4', 'A1B2c3D4', 'A1b2c3D4', 'A1b2c3d4', 'A1b2C3d4', 'A1b2C3D4', 'a1b2C3D4', 'a1b2C3d4', 'a1b2c3d4', 'a1b2c3D4', 'a1B2c3D4', 'a1B2c3d4', 'a1B2C3d4', 'a1B2C3D4']\n assert candidate(s = \"123abc456\") == ['123abc456', '123abC456', '123aBC456', '123aBc456', '123ABc456', '123ABC456', '123AbC456', '123Abc456']\n assert candidate(s = \"AaBbCc\") == ['AaBbCc', 'AaBbCC', 'AaBbcC', 'AaBbcc', 'AaBBcc', 'AaBBcC', 'AaBBCC', 'AaBBCc', 'AabBCc', 'AabBCC', 'AabBcC', 'AabBcc', 'Aabbcc', 'AabbcC', 'AabbCC', 'AabbCc', 'AAbbCc', 'AAbbCC', 'AAbbcC', 'AAbbcc', 'AAbBcc', 'AAbBcC', 'AAbBCC', 'AAbBCc', 'AABBCc', 'AABBCC', 'AABBcC', 'AABBcc', 'AABbcc', 'AABbcC', 'AABbCC', 'AABbCc', 'aABbCc', 'aABbCC', 'aABbcC', 'aABbcc', 'aABBcc', 'aABBcC', 'aABBCC', 'aABBCc', 'aAbBCc', 'aAbBCC', 'aAbBcC', 'aAbBcc', 'aAbbcc', 'aAbbcC', 'aAbbCC', 'aAbbCc', 'aabbCc', 'aabbCC', 'aabbcC', 'aabbcc', 'aabBcc', 'aabBcC', 'aabBCC', 'aabBCc', 'aaBBCc', 'aaBBCC', 'aaBBcC', 'aaBBcc', 'aaBbcc', 'aaBbcC', 'aaBbCC', 'aaBbCc']\n assert candidate(s = \"WORLD456\") == ['WORLD456', 'WORLd456', 'WORld456', 'WORlD456', 'WOrlD456', 'WOrld456', 'WOrLd456', 'WOrLD456', 'WorLD456', 'WorLd456', 'World456', 'WorlD456', 'WoRlD456', 'WoRld456', 'WoRLd456', 'WoRLD456', 'woRLD456', 'woRLd456', 'woRld456', 'woRlD456', 'worlD456', 'world456', 'worLd456', 'worLD456', 'wOrLD456', 'wOrLd456', 'wOrld456', 'wOrlD456', 'wORlD456', 'wORld456', 'wORLd456', 'wORLD456']\n assert candidate(s = \"123abcDEF456\") == ['123abcDEF456', '123abcDEf456', '123abcDef456', '123abcDeF456', '123abcdeF456', '123abcdef456', '123abcdEf456', '123abcdEF456', '123abCdEF456', '123abCdEf456', '123abCdef456', '123abCdeF456', '123abCDeF456', '123abCDef456', '123abCDEf456', '123abCDEF456', '123aBCDEF456', '123aBCDEf456', '123aBCDef456', '123aBCDeF456', '123aBCdeF456', '123aBCdef456', '123aBCdEf456', '123aBCdEF456', '123aBcdEF456', '123aBcdEf456', '123aBcdef456', '123aBcdeF456', '123aBcDeF456', '123aBcDef456', '123aBcDEf456', '123aBcDEF456', '123ABcDEF456', '123ABcDEf456', '123ABcDef456', '123ABcDeF456', '123ABcdeF456', '123ABcdef456', '123ABcdEf456', '123ABcdEF456', '123ABCdEF456', '123ABCdEf456', '123ABCdef456', '123ABCdeF456', '123ABCDeF456', '123ABCDef456', '123ABCDEf456', '123ABCDEF456', '123AbCDEF456', '123AbCDEf456', '123AbCDef456', '123AbCDeF456', '123AbCdeF456', '123AbCdef456', '123AbCdEf456', '123AbCdEF456', '123AbcdEF456', '123AbcdEf456', '123Abcdef456', '123AbcdeF456', '123AbcDeF456', '123AbcDef456', '123AbcDEf456', '123AbcDEF456']\n assert candidate(s = \"AbC1dE2f3\") == ['AbC1dE2f3', 'AbC1dE2F3', 'AbC1de2F3', 'AbC1de2f3', 'AbC1De2f3', 'AbC1De2F3', 'AbC1DE2F3', 'AbC1DE2f3', 'Abc1DE2f3', 'Abc1DE2F3', 'Abc1De2F3', 'Abc1De2f3', 'Abc1de2f3', 'Abc1de2F3', 'Abc1dE2F3', 'Abc1dE2f3', 'ABc1dE2f3', 'ABc1dE2F3', 'ABc1de2F3', 'ABc1de2f3', 'ABc1De2f3', 'ABc1De2F3', 'ABc1DE2F3', 'ABc1DE2f3', 'ABC1DE2f3', 'ABC1DE2F3', 'ABC1De2F3', 'ABC1De2f3', 'ABC1de2f3', 'ABC1de2F3', 'ABC1dE2F3', 'ABC1dE2f3', 'aBC1dE2f3', 'aBC1dE2F3', 'aBC1de2F3', 'aBC1de2f3', 'aBC1De2f3', 'aBC1De2F3', 'aBC1DE2F3', 'aBC1DE2f3', 'aBc1DE2f3', 'aBc1DE2F3', 'aBc1De2F3', 'aBc1De2f3', 'aBc1de2f3', 'aBc1de2F3', 'aBc1dE2F3', 'aBc1dE2f3', 'abc1dE2f3', 'abc1dE2F3', 'abc1de2F3', 'abc1de2f3', 'abc1De2f3', 'abc1De2F3', 'abc1DE2F3', 'abc1DE2f3', 'abC1DE2f3', 'abC1DE2F3', 'abC1De2F3', 'abC1De2f3', 'abC1de2f3', 'abC1de2F3', 'abC1dE2F3', 'abC1dE2f3']\n assert candidate(s = \"a123b456c789\") == ['a123b456c789', 'a123b456C789', 'a123B456C789', 'a123B456c789', 'A123B456c789', 'A123B456C789', 'A123b456C789', 'A123b456c789']\n assert candidate(s = \"1A2B3C4D5E6F7G8H9I0J\") == ['1A2B3C4D5E6F7G8H9I0J', '1A2B3C4D5E6F7G8H9I0j', '1A2B3C4D5E6F7G8H9i0j', '1A2B3C4D5E6F7G8H9i0J', '1A2B3C4D5E6F7G8h9i0J', '1A2B3C4D5E6F7G8h9i0j', '1A2B3C4D5E6F7G8h9I0j', '1A2B3C4D5E6F7G8h9I0J', '1A2B3C4D5E6F7g8h9I0J', '1A2B3C4D5E6F7g8h9I0j', '1A2B3C4D5E6F7g8h9i0j', '1A2B3C4D5E6F7g8h9i0J', '1A2B3C4D5E6F7g8H9i0J', '1A2B3C4D5E6F7g8H9i0j', '1A2B3C4D5E6F7g8H9I0j', '1A2B3C4D5E6F7g8H9I0J', '1A2B3C4D5E6f7g8H9I0J', '1A2B3C4D5E6f7g8H9I0j', '1A2B3C4D5E6f7g8H9i0j', '1A2B3C4D5E6f7g8H9i0J', '1A2B3C4D5E6f7g8h9i0J', '1A2B3C4D5E6f7g8h9i0j', '1A2B3C4D5E6f7g8h9I0j', '1A2B3C4D5E6f7g8h9I0J', '1A2B3C4D5E6f7G8h9I0J', '1A2B3C4D5E6f7G8h9I0j', '1A2B3C4D5E6f7G8h9i0j', '1A2B3C4D5E6f7G8h9i0J', '1A2B3C4D5E6f7G8H9i0J', '1A2B3C4D5E6f7G8H9i0j', '1A2B3C4D5E6f7G8H9I0j', '1A2B3C4D5E6f7G8H9I0J', '1A2B3C4D5e6f7G8H9I0J', '1A2B3C4D5e6f7G8H9I0j', '1A2B3C4D5e6f7G8H9i0j', '1A2B3C4D5e6f7G8H9i0J', '1A2B3C4D5e6f7G8h9i0J', '1A2B3C4D5e6f7G8h9i0j', '1A2B3C4D5e6f7G8h9I0j', '1A2B3C4D5e6f7G8h9I0J', '1A2B3C4D5e6f7g8h9I0J', '1A2B3C4D5e6f7g8h9I0j', '1A2B3C4D5e6f7g8h9i0j', '1A2B3C4D5e6f7g8h9i0J', '1A2B3C4D5e6f7g8H9i0J', '1A2B3C4D5e6f7g8H9i0j', '1A2B3C4D5e6f7g8H9I0j', '1A2B3C4D5e6f7g8H9I0J', '1A2B3C4D5e6F7g8H9I0J', '1A2B3C4D5e6F7g8H9I0j', '1A2B3C4D5e6F7g8H9i0j', '1A2B3C4D5e6F7g8H9i0J', '1A2B3C4D5e6F7g8h9i0J', '1A2B3C4D5e6F7g8h9i0j', '1A2B3C4D5e6F7g8h9I0j', '1A2B3C4D5e6F7g8h9I0J', '1A2B3C4D5e6F7G8h9I0J', '1A2B3C4D5e6F7G8h9I0j', '1A2B3C4D5e6F7G8h9i0j', '1A2B3C4D5e6F7G8h9i0J', '1A2B3C4D5e6F7G8H9i0J', '1A2B3C4D5e6F7G8H9i0j', '1A2B3C4D5e6F7G8H9I0j', '1A2B3C4D5e6F7G8H9I0J', '1A2B3C4d5e6F7G8H9I0J', '1A2B3C4d5e6F7G8H9I0j', '1A2B3C4d5e6F7G8H9i0j', '1A2B3C4d5e6F7G8H9i0J', '1A2B3C4d5e6F7G8h9i0J', '1A2B3C4d5e6F7G8h9i0j', '1A2B3C4d5e6F7G8h9I0j', '1A2B3C4d5e6F7G8h9I0J', '1A2B3C4d5e6F7g8h9I0J', '1A2B3C4d5e6F7g8h9I0j', '1A2B3C4d5e6F7g8h9i0j', '1A2B3C4d5e6F7g8h9i0J', '1A2B3C4d5e6F7g8H9i0J', '1A2B3C4d5e6F7g8H9i0j', '1A2B3C4d5e6F7g8H9I0j', '1A2B3C4d5e6F7g8H9I0J', '1A2B3C4d5e6f7g8H9I0J', '1A2B3C4d5e6f7g8H9I0j', '1A2B3C4d5e6f7g8H9i0j', '1A2B3C4d5e6f7g8H9i0J', '1A2B3C4d5e6f7g8h9i0J', '1A2B3C4d5e6f7g8h9i0j', '1A2B3C4d5e6f7g8h9I0j', '1A2B3C4d5e6f7g8h9I0J', '1A2B3C4d5e6f7G8h9I0J', '1A2B3C4d5e6f7G8h9I0j', '1A2B3C4d5e6f7G8h9i0j', '1A2B3C4d5e6f7G8h9i0J', '1A2B3C4d5e6f7G8H9i0J', '1A2B3C4d5e6f7G8H9i0j', '1A2B3C4d5e6f7G8H9I0j', '1A2B3C4d5e6f7G8H9I0J', '1A2B3C4d5E6f7G8H9I0J', '1A2B3C4d5E6f7G8H9I0j', '1A2B3C4d5E6f7G8H9i0j', '1A2B3C4d5E6f7G8H9i0J', '1A2B3C4d5E6f7G8h9i0J', '1A2B3C4d5E6f7G8h9i0j', '1A2B3C4d5E6f7G8h9I0j', '1A2B3C4d5E6f7G8h9I0J', '1A2B3C4d5E6f7g8h9I0J', '1A2B3C4d5E6f7g8h9I0j', '1A2B3C4d5E6f7g8h9i0j', '1A2B3C4d5E6f7g8h9i0J', '1A2B3C4d5E6f7g8H9i0J', '1A2B3C4d5E6f7g8H9i0j', '1A2B3C4d5E6f7g8H9I0j', '1A2B3C4d5E6f7g8H9I0J', '1A2B3C4d5E6F7g8H9I0J', '1A2B3C4d5E6F7g8H9I0j', '1A2B3C4d5E6F7g8H9i0j', '1A2B3C4d5E6F7g8H9i0J', '1A2B3C4d5E6F7g8h9i0J', '1A2B3C4d5E6F7g8h9i0j', '1A2B3C4d5E6F7g8h9I0j', '1A2B3C4d5E6F7g8h9I0J', '1A2B3C4d5E6F7G8h9I0J', '1A2B3C4d5E6F7G8h9I0j', '1A2B3C4d5E6F7G8h9i0j', '1A2B3C4d5E6F7G8h9i0J', '1A2B3C4d5E6F7G8H9i0J', '1A2B3C4d5E6F7G8H9i0j', '1A2B3C4d5E6F7G8H9I0j', '1A2B3C4d5E6F7G8H9I0J', '1A2B3c4d5E6F7G8H9I0J', '1A2B3c4d5E6F7G8H9I0j', '1A2B3c4d5E6F7G8H9i0j', '1A2B3c4d5E6F7G8H9i0J', '1A2B3c4d5E6F7G8h9i0J', '1A2B3c4d5E6F7G8h9i0j', '1A2B3c4d5E6F7G8h9I0j', '1A2B3c4d5E6F7G8h9I0J', '1A2B3c4d5E6F7g8h9I0J', '1A2B3c4d5E6F7g8h9I0j', '1A2B3c4d5E6F7g8h9i0j', '1A2B3c4d5E6F7g8h9i0J', '1A2B3c4d5E6F7g8H9i0J', '1A2B3c4d5E6F7g8H9i0j', '1A2B3c4d5E6F7g8H9I0j', '1A2B3c4d5E6F7g8H9I0J', '1A2B3c4d5E6f7g8H9I0J', '1A2B3c4d5E6f7g8H9I0j', '1A2B3c4d5E6f7g8H9i0j', '1A2B3c4d5E6f7g8H9i0J', '1A2B3c4d5E6f7g8h9i0J', '1A2B3c4d5E6f7g8h9i0j', '1A2B3c4d5E6f7g8h9I0j', '1A2B3c4d5E6f7g8h9I0J', '1A2B3c4d5E6f7G8h9I0J', '1A2B3c4d5E6f7G8h9I0j', '1A2B3c4d5E6f7G8h9i0j', '1A2B3c4d5E6f7G8h9i0J', '1A2B3c4d5E6f7G8H9i0J', '1A2B3c4d5E6f7G8H9i0j', '1A2B3c4d5E6f7G8H9I0j', '1A2B3c4d5E6f7G8H9I0J', '1A2B3c4d5e6f7G8H9I0J', '1A2B3c4d5e6f7G8H9I0j', '1A2B3c4d5e6f7G8H9i0j', '1A2B3c4d5e6f7G8H9i0J', '1A2B3c4d5e6f7G8h9i0J', '1A2B3c4d5e6f7G8h9i0j', '1A2B3c4d5e6f7G8h9I0j', '1A2B3c4d5e6f7G8h9I0J', '1A2B3c4d5e6f7g8h9I0J', '1A2B3c4d5e6f7g8h9I0j', '1A2B3c4d5e6f7g8h9i0j', '1A2B3c4d5e6f7g8h9i0J', '1A2B3c4d5e6f7g8H9i0J', '1A2B3c4d5e6f7g8H9i0j', '1A2B3c4d5e6f7g8H9I0j', '1A2B3c4d5e6f7g8H9I0J', '1A2B3c4d5e6F7g8H9I0J', '1A2B3c4d5e6F7g8H9I0j', '1A2B3c4d5e6F7g8H9i0j', '1A2B3c4d5e6F7g8H9i0J', '1A2B3c4d5e6F7g8h9i0J', '1A2B3c4d5e6F7g8h9i0j', '1A2B3c4d5e6F7g8h9I0j', '1A2B3c4d5e6F7g8h9I0J', '1A2B3c4d5e6F7G8h9I0J', '1A2B3c4d5e6F7G8h9I0j', '1A2B3c4d5e6F7G8h9i0j', '1A2B3c4d5e6F7G8h9i0J', '1A2B3c4d5e6F7G8H9i0J', '1A2B3c4d5e6F7G8H9i0j', '1A2B3c4d5e6F7G8H9I0j', '1A2B3c4d5e6F7G8H9I0J', '1A2B3c4D5e6F7G8H9I0J', '1A2B3c4D5e6F7G8H9I0j', '1A2B3c4D5e6F7G8H9i0j', '1A2B3c4D5e6F7G8H9i0J', '1A2B3c4D5e6F7G8h9i0J', '1A2B3c4D5e6F7G8h9i0j', '1A2B3c4D5e6F7G8h9I0j', '1A2B3c4D5e6F7G8h9I0J', '1A2B3c4D5e6F7g8h9I0J', '1A2B3c4D5e6F7g8h9I0j', '1A2B3c4D5e6F7g8h9i0j', '1A2B3c4D5e6F7g8h9i0J', '1A2B3c4D5e6F7g8H9i0J', '1A2B3c4D5e6F7g8H9i0j', '1A2B3c4D5e6F7g8H9I0j', '1A2B3c4D5e6F7g8H9I0J', '1A2B3c4D5e6f7g8H9I0J', '1A2B3c4D5e6f7g8H9I0j', '1A2B3c4D5e6f7g8H9i0j', '1A2B3c4D5e6f7g8H9i0J', '1A2B3c4D5e6f7g8h9i0J', '1A2B3c4D5e6f7g8h9i0j', '1A2B3c4D5e6f7g8h9I0j', '1A2B3c4D5e6f7g8h9I0J', '1A2B3c4D5e6f7G8h9I0J', '1A2B3c4D5e6f7G8h9I0j', '1A2B3c4D5e6f7G8h9i0j', '1A2B3c4D5e6f7G8h9i0J', '1A2B3c4D5e6f7G8H9i0J', '1A2B3c4D5e6f7G8H9i0j', '1A2B3c4D5e6f7G8H9I0j', '1A2B3c4D5e6f7G8H9I0J', '1A2B3c4D5E6f7G8H9I0J', '1A2B3c4D5E6f7G8H9I0j', '1A2B3c4D5E6f7G8H9i0j', '1A2B3c4D5E6f7G8H9i0J', '1A2B3c4D5E6f7G8h9i0J', '1A2B3c4D5E6f7G8h9i0j', '1A2B3c4D5E6f7G8h9I0j', '1A2B3c4D5E6f7G8h9I0J', '1A2B3c4D5E6f7g8h9I0J', '1A2B3c4D5E6f7g8h9I0j', '1A2B3c4D5E6f7g8h9i0j', '1A2B3c4D5E6f7g8h9i0J', '1A2B3c4D5E6f7g8H9i0J', '1A2B3c4D5E6f7g8H9i0j', '1A2B3c4D5E6f7g8H9I0j', '1A2B3c4D5E6f7g8H9I0J', '1A2B3c4D5E6F7g8H9I0J', '1A2B3c4D5E6F7g8H9I0j', '1A2B3c4D5E6F7g8H9i0j', '1A2B3c4D5E6F7g8H9i0J', '1A2B3c4D5E6F7g8h9i0J', '1A2B3c4D5E6F7g8h9i0j', '1A2B3c4D5E6F7g8h9I0j', '1A2B3c4D5E6F7g8h9I0J', '1A2B3c4D5E6F7G8h9I0J', '1A2B3c4D5E6F7G8h9I0j', '1A2B3c4D5E6F7G8h9i0j', '1A2B3c4D5E6F7G8h9i0J', '1A2B3c4D5E6F7G8H9i0J', '1A2B3c4D5E6F7G8H9i0j', '1A2B3c4D5E6F7G8H9I0j', '1A2B3c4D5E6F7G8H9I0J', '1A2b3c4D5E6F7G8H9I0J', '1A2b3c4D5E6F7G8H9I0j', '1A2b3c4D5E6F7G8H9i0j', '1A2b3c4D5E6F7G8H9i0J', '1A2b3c4D5E6F7G8h9i0J', '1A2b3c4D5E6F7G8h9i0j', '1A2b3c4D5E6F7G8h9I0j', '1A2b3c4D5E6F7G8h9I0J', '1A2b3c4D5E6F7g8h9I0J', '1A2b3c4D5E6F7g8h9I0j', '1A2b3c4D5E6F7g8h9i0j', '1A2b3c4D5E6F7g8h9i0J', '1A2b3c4D5E6F7g8H9i0J', '1A2b3c4D5E6F7g8H9i0j', '1A2b3c4D5E6F7g8H9I0j', '1A2b3c4D5E6F7g8H9I0J', '1A2b3c4D5E6f7g8H9I0J', '1A2b3c4D5E6f7g8H9I0j', '1A2b3c4D5E6f7g8H9i0j', '1A2b3c4D5E6f7g8H9i0J', '1A2b3c4D5E6f7g8h9i0J', '1A2b3c4D5E6f7g8h9i0j', '1A2b3c4D5E6f7g8h9I0j', '1A2b3c4D5E6f7g8h9I0J', '1A2b3c4D5E6f7G8h9I0J', '1A2b3c4D5E6f7G8h9I0j', '1A2b3c4D5E6f7G8h9i0j', '1A2b3c4D5E6f7G8h9i0J', '1A2b3c4D5E6f7G8H9i0J', '1A2b3c4D5E6f7G8H9i0j', '1A2b3c4D5E6f7G8H9I0j', '1A2b3c4D5E6f7G8H9I0J', '1A2b3c4D5e6f7G8H9I0J', '1A2b3c4D5e6f7G8H9I0j', '1A2b3c4D5e6f7G8H9i0j', '1A2b3c4D5e6f7G8H9i0J', '1A2b3c4D5e6f7G8h9i0J', '1A2b3c4D5e6f7G8h9i0j', '1A2b3c4D5e6f7G8h9I0j', '1A2b3c4D5e6f7G8h9I0J', '1A2b3c4D5e6f7g8h9I0J', '1A2b3c4D5e6f7g8h9I0j', '1A2b3c4D5e6f7g8h9i0j', '1A2b3c4D5e6f7g8h9i0J', '1A2b3c4D5e6f7g8H9i0J', '1A2b3c4D5e6f7g8H9i0j', '1A2b3c4D5e6f7g8H9I0j', '1A2b3c4D5e6f7g8H9I0J', '1A2b3c4D5e6F7g8H9I0J', '1A2b3c4D5e6F7g8H9I0j', '1A2b3c4D5e6F7g8H9i0j', '1A2b3c4D5e6F7g8H9i0J', '1A2b3c4D5e6F7g8h9i0J', '1A2b3c4D5e6F7g8h9i0j', '1A2b3c4D5e6F7g8h9I0j', '1A2b3c4D5e6F7g8h9I0J', '1A2b3c4D5e6F7G8h9I0J', '1A2b3c4D5e6F7G8h9I0j', '1A2b3c4D5e6F7G8h9i0j', '1A2b3c4D5e6F7G8h9i0J', '1A2b3c4D5e6F7G8H9i0J', '1A2b3c4D5e6F7G8H9i0j', '1A2b3c4D5e6F7G8H9I0j', '1A2b3c4D5e6F7G8H9I0J', '1A2b3c4d5e6F7G8H9I0J', '1A2b3c4d5e6F7G8H9I0j', '1A2b3c4d5e6F7G8H9i0j', '1A2b3c4d5e6F7G8H9i0J', '1A2b3c4d5e6F7G8h9i0J', '1A2b3c4d5e6F7G8h9i0j', '1A2b3c4d5e6F7G8h9I0j', '1A2b3c4d5e6F7G8h9I0J', '1A2b3c4d5e6F7g8h9I0J', '1A2b3c4d5e6F7g8h9I0j', '1A2b3c4d5e6F7g8h9i0j', '1A2b3c4d5e6F7g8h9i0J', '1A2b3c4d5e6F7g8H9i0J', '1A2b3c4d5e6F7g8H9i0j', '1A2b3c4d5e6F7g8H9I0j', '1A2b3c4d5e6F7g8H9I0J', '1A2b3c4d5e6f7g8H9I0J', '1A2b3c4d5e6f7g8H9I0j', '1A2b3c4d5e6f7g8H9i0j', '1A2b3c4d5e6f7g8H9i0J', '1A2b3c4d5e6f7g8h9i0J', '1A2b3c4d5e6f7g8h9i0j', '1A2b3c4d5e6f7g8h9I0j', '1A2b3c4d5e6f7g8h9I0J', '1A2b3c4d5e6f7G8h9I0J', '1A2b3c4d5e6f7G8h9I0j', '1A2b3c4d5e6f7G8h9i0j', '1A2b3c4d5e6f7G8h9i0J', '1A2b3c4d5e6f7G8H9i0J', '1A2b3c4d5e6f7G8H9i0j', '1A2b3c4d5e6f7G8H9I0j', '1A2b3c4d5e6f7G8H9I0J', '1A2b3c4d5E6f7G8H9I0J', '1A2b3c4d5E6f7G8H9I0j', '1A2b3c4d5E6f7G8H9i0j', '1A2b3c4d5E6f7G8H9i0J', '1A2b3c4d5E6f7G8h9i0J', '1A2b3c4d5E6f7G8h9i0j', '1A2b3c4d5E6f7G8h9I0j', '1A2b3c4d5E6f7G8h9I0J', '1A2b3c4d5E6f7g8h9I0J', '1A2b3c4d5E6f7g8h9I0j', '1A2b3c4d5E6f7g8h9i0j', '1A2b3c4d5E6f7g8h9i0J', '1A2b3c4d5E6f7g8H9i0J', '1A2b3c4d5E6f7g8H9i0j', '1A2b3c4d5E6f7g8H9I0j', '1A2b3c4d5E6f7g8H9I0J', '1A2b3c4d5E6F7g8H9I0J', '1A2b3c4d5E6F7g8H9I0j', '1A2b3c4d5E6F7g8H9i0j', '1A2b3c4d5E6F7g8H9i0J', '1A2b3c4d5E6F7g8h9i0J', '1A2b3c4d5E6F7g8h9i0j', '1A2b3c4d5E6F7g8h9I0j', '1A2b3c4d5E6F7g8h9I0J', '1A2b3c4d5E6F7G8h9I0J', '1A2b3c4d5E6F7G8h9I0j', '1A2b3c4d5E6F7G8h9i0j', '1A2b3c4d5E6F7G8h9i0J', '1A2b3c4d5E6F7G8H9i0J', '1A2b3c4d5E6F7G8H9i0j', '1A2b3c4d5E6F7G8H9I0j', '1A2b3c4d5E6F7G8H9I0J', '1A2b3C4d5E6F7G8H9I0J', '1A2b3C4d5E6F7G8H9I0j', '1A2b3C4d5E6F7G8H9i0j', '1A2b3C4d5E6F7G8H9i0J', '1A2b3C4d5E6F7G8h9i0J', '1A2b3C4d5E6F7G8h9i0j', '1A2b3C4d5E6F7G8h9I0j', '1A2b3C4d5E6F7G8h9I0J', '1A2b3C4d5E6F7g8h9I0J', '1A2b3C4d5E6F7g8h9I0j', '1A2b3C4d5E6F7g8h9i0j', '1A2b3C4d5E6F7g8h9i0J', '1A2b3C4d5E6F7g8H9i0J', '1A2b3C4d5E6F7g8H9i0j', '1A2b3C4d5E6F7g8H9I0j', '1A2b3C4d5E6F7g8H9I0J', '1A2b3C4d5E6f7g8H9I0J', '1A2b3C4d5E6f7g8H9I0j', '1A2b3C4d5E6f7g8H9i0j', '1A2b3C4d5E6f7g8H9i0J', '1A2b3C4d5E6f7g8h9i0J', '1A2b3C4d5E6f7g8h9i0j', '1A2b3C4d5E6f7g8h9I0j', '1A2b3C4d5E6f7g8h9I0J', '1A2b3C4d5E6f7G8h9I0J', '1A2b3C4d5E6f7G8h9I0j', '1A2b3C4d5E6f7G8h9i0j', '1A2b3C4d5E6f7G8h9i0J', '1A2b3C4d5E6f7G8H9i0J', '1A2b3C4d5E6f7G8H9i0j', '1A2b3C4d5E6f7G8H9I0j', '1A2b3C4d5E6f7G8H9I0J', '1A2b3C4d5e6f7G8H9I0J', '1A2b3C4d5e6f7G8H9I0j', '1A2b3C4d5e6f7G8H9i0j', '1A2b3C4d5e6f7G8H9i0J', '1A2b3C4d5e6f7G8h9i0J', '1A2b3C4d5e6f7G8h9i0j', '1A2b3C4d5e6f7G8h9I0j', '1A2b3C4d5e6f7G8h9I0J', '1A2b3C4d5e6f7g8h9I0J', '1A2b3C4d5e6f7g8h9I0j', '1A2b3C4d5e6f7g8h9i0j', '1A2b3C4d5e6f7g8h9i0J', '1A2b3C4d5e6f7g8H9i0J', '1A2b3C4d5e6f7g8H9i0j', '1A2b3C4d5e6f7g8H9I0j', '1A2b3C4d5e6f7g8H9I0J', '1A2b3C4d5e6F7g8H9I0J', '1A2b3C4d5e6F7g8H9I0j', '1A2b3C4d5e6F7g8H9i0j', '1A2b3C4d5e6F7g8H9i0J', '1A2b3C4d5e6F7g8h9i0J', '1A2b3C4d5e6F7g8h9i0j', '1A2b3C4d5e6F7g8h9I0j', '1A2b3C4d5e6F7g8h9I0J', '1A2b3C4d5e6F7G8h9I0J', '1A2b3C4d5e6F7G8h9I0j', '1A2b3C4d5e6F7G8h9i0j', '1A2b3C4d5e6F7G8h9i0J', '1A2b3C4d5e6F7G8H9i0J', '1A2b3C4d5e6F7G8H9i0j', '1A2b3C4d5e6F7G8H9I0j', '1A2b3C4d5e6F7G8H9I0J', '1A2b3C4D5e6F7G8H9I0J', '1A2b3C4D5e6F7G8H9I0j', '1A2b3C4D5e6F7G8H9i0j', '1A2b3C4D5e6F7G8H9i0J', '1A2b3C4D5e6F7G8h9i0J', '1A2b3C4D5e6F7G8h9i0j', '1A2b3C4D5e6F7G8h9I0j', '1A2b3C4D5e6F7G8h9I0J', '1A2b3C4D5e6F7g8h9I0J', '1A2b3C4D5e6F7g8h9I0j', '1A2b3C4D5e6F7g8h9i0j', '1A2b3C4D5e6F7g8h9i0J', '1A2b3C4D5e6F7g8H9i0J', '1A2b3C4D5e6F7g8H9i0j', '1A2b3C4D5e6F7g8H9I0j', '1A2b3C4D5e6F7g8H9I0J', '1A2b3C4D5e6f7g8H9I0J', '1A2b3C4D5e6f7g8H9I0j', '1A2b3C4D5e6f7g8H9i0j', '1A2b3C4D5e6f7g8H9i0J', '1A2b3C4D5e6f7g8h9i0J', '1A2b3C4D5e6f7g8h9i0j', '1A2b3C4D5e6f7g8h9I0j', '1A2b3C4D5e6f7g8h9I0J', '1A2b3C4D5e6f7G8h9I0J', '1A2b3C4D5e6f7G8h9I0j', '1A2b3C4D5e6f7G8h9i0j', '1A2b3C4D5e6f7G8h9i0J', '1A2b3C4D5e6f7G8H9i0J', '1A2b3C4D5e6f7G8H9i0j', '1A2b3C4D5e6f7G8H9I0j', '1A2b3C4D5e6f7G8H9I0J', '1A2b3C4D5E6f7G8H9I0J', '1A2b3C4D5E6f7G8H9I0j', '1A2b3C4D5E6f7G8H9i0j', '1A2b3C4D5E6f7G8H9i0J', '1A2b3C4D5E6f7G8h9i0J', '1A2b3C4D5E6f7G8h9i0j', '1A2b3C4D5E6f7G8h9I0j', '1A2b3C4D5E6f7G8h9I0J', '1A2b3C4D5E6f7g8h9I0J', '1A2b3C4D5E6f7g8h9I0j', '1A2b3C4D5E6f7g8h9i0j', '1A2b3C4D5E6f7g8h9i0J', '1A2b3C4D5E6f7g8H9i0J', '1A2b3C4D5E6f7g8H9i0j', '1A2b3C4D5E6f7g8H9I0j', '1A2b3C4D5E6f7g8H9I0J', '1A2b3C4D5E6F7g8H9I0J', '1A2b3C4D5E6F7g8H9I0j', '1A2b3C4D5E6F7g8H9i0j', '1A2b3C4D5E6F7g8H9i0J', '1A2b3C4D5E6F7g8h9i0J', '1A2b3C4D5E6F7g8h9i0j', '1A2b3C4D5E6F7g8h9I0j', '1A2b3C4D5E6F7g8h9I0J', '1A2b3C4D5E6F7G8h9I0J', '1A2b3C4D5E6F7G8h9I0j', '1A2b3C4D5E6F7G8h9i0j', '1A2b3C4D5E6F7G8h9i0J', '1A2b3C4D5E6F7G8H9i0J', '1A2b3C4D5E6F7G8H9i0j', '1A2b3C4D5E6F7G8H9I0j', '1A2b3C4D5E6F7G8H9I0J', '1a2b3C4D5E6F7G8H9I0J', '1a2b3C4D5E6F7G8H9I0j', '1a2b3C4D5E6F7G8H9i0j', '1a2b3C4D5E6F7G8H9i0J', '1a2b3C4D5E6F7G8h9i0J', '1a2b3C4D5E6F7G8h9i0j', '1a2b3C4D5E6F7G8h9I0j', '1a2b3C4D5E6F7G8h9I0J', '1a2b3C4D5E6F7g8h9I0J', '1a2b3C4D5E6F7g8h9I0j', '1a2b3C4D5E6F7g8h9i0j', '1a2b3C4D5E6F7g8h9i0J', '1a2b3C4D5E6F7g8H9i0J', '1a2b3C4D5E6F7g8H9i0j', '1a2b3C4D5E6F7g8H9I0j', '1a2b3C4D5E6F7g8H9I0J', '1a2b3C4D5E6f7g8H9I0J', '1a2b3C4D5E6f7g8H9I0j', '1a2b3C4D5E6f7g8H9i0j', '1a2b3C4D5E6f7g8H9i0J', '1a2b3C4D5E6f7g8h9i0J', '1a2b3C4D5E6f7g8h9i0j', '1a2b3C4D5E6f7g8h9I0j', '1a2b3C4D5E6f7g8h9I0J', '1a2b3C4D5E6f7G8h9I0J', '1a2b3C4D5E6f7G8h9I0j', '1a2b3C4D5E6f7G8h9i0j', '1a2b3C4D5E6f7G8h9i0J', '1a2b3C4D5E6f7G8H9i0J', '1a2b3C4D5E6f7G8H9i0j', '1a2b3C4D5E6f7G8H9I0j', '1a2b3C4D5E6f7G8H9I0J', '1a2b3C4D5e6f7G8H9I0J', '1a2b3C4D5e6f7G8H9I0j', '1a2b3C4D5e6f7G8H9i0j', '1a2b3C4D5e6f7G8H9i0J', '1a2b3C4D5e6f7G8h9i0J', '1a2b3C4D5e6f7G8h9i0j', '1a2b3C4D5e6f7G8h9I0j', '1a2b3C4D5e6f7G8h9I0J', '1a2b3C4D5e6f7g8h9I0J', '1a2b3C4D5e6f7g8h9I0j', '1a2b3C4D5e6f7g8h9i0j', '1a2b3C4D5e6f7g8h9i0J', '1a2b3C4D5e6f7g8H9i0J', '1a2b3C4D5e6f7g8H9i0j', '1a2b3C4D5e6f7g8H9I0j', '1a2b3C4D5e6f7g8H9I0J', '1a2b3C4D5e6F7g8H9I0J', '1a2b3C4D5e6F7g8H9I0j', '1a2b3C4D5e6F7g8H9i0j', '1a2b3C4D5e6F7g8H9i0J', '1a2b3C4D5e6F7g8h9i0J', '1a2b3C4D5e6F7g8h9i0j', '1a2b3C4D5e6F7g8h9I0j', '1a2b3C4D5e6F7g8h9I0J', '1a2b3C4D5e6F7G8h9I0J', '1a2b3C4D5e6F7G8h9I0j', '1a2b3C4D5e6F7G8h9i0j', '1a2b3C4D5e6F7G8h9i0J', '1a2b3C4D5e6F7G8H9i0J', '1a2b3C4D5e6F7G8H9i0j', '1a2b3C4D5e6F7G8H9I0j', '1a2b3C4D5e6F7G8H9I0J', '1a2b3C4d5e6F7G8H9I0J', '1a2b3C4d5e6F7G8H9I0j', '1a2b3C4d5e6F7G8H9i0j', '1a2b3C4d5e6F7G8H9i0J', '1a2b3C4d5e6F7G8h9i0J', '1a2b3C4d5e6F7G8h9i0j', '1a2b3C4d5e6F7G8h9I0j', '1a2b3C4d5e6F7G8h9I0J', '1a2b3C4d5e6F7g8h9I0J', '1a2b3C4d5e6F7g8h9I0j', '1a2b3C4d5e6F7g8h9i0j', '1a2b3C4d5e6F7g8h9i0J', '1a2b3C4d5e6F7g8H9i0J', '1a2b3C4d5e6F7g8H9i0j', '1a2b3C4d5e6F7g8H9I0j', '1a2b3C4d5e6F7g8H9I0J', '1a2b3C4d5e6f7g8H9I0J', '1a2b3C4d5e6f7g8H9I0j', '1a2b3C4d5e6f7g8H9i0j', '1a2b3C4d5e6f7g8H9i0J', '1a2b3C4d5e6f7g8h9i0J', '1a2b3C4d5e6f7g8h9i0j', '1a2b3C4d5e6f7g8h9I0j', '1a2b3C4d5e6f7g8h9I0J', '1a2b3C4d5e6f7G8h9I0J', '1a2b3C4d5e6f7G8h9I0j', '1a2b3C4d5e6f7G8h9i0j', '1a2b3C4d5e6f7G8h9i0J', '1a2b3C4d5e6f7G8H9i0J', '1a2b3C4d5e6f7G8H9i0j', '1a2b3C4d5e6f7G8H9I0j', '1a2b3C4d5e6f7G8H9I0J', '1a2b3C4d5E6f7G8H9I0J', '1a2b3C4d5E6f7G8H9I0j', '1a2b3C4d5E6f7G8H9i0j', '1a2b3C4d5E6f7G8H9i0J', '1a2b3C4d5E6f7G8h9i0J', '1a2b3C4d5E6f7G8h9i0j', '1a2b3C4d5E6f7G8h9I0j', '1a2b3C4d5E6f7G8h9I0J', '1a2b3C4d5E6f7g8h9I0J', '1a2b3C4d5E6f7g8h9I0j', '1a2b3C4d5E6f7g8h9i0j', '1a2b3C4d5E6f7g8h9i0J', '1a2b3C4d5E6f7g8H9i0J', '1a2b3C4d5E6f7g8H9i0j', '1a2b3C4d5E6f7g8H9I0j', '1a2b3C4d5E6f7g8H9I0J', '1a2b3C4d5E6F7g8H9I0J', '1a2b3C4d5E6F7g8H9I0j', '1a2b3C4d5E6F7g8H9i0j', '1a2b3C4d5E6F7g8H9i0J', '1a2b3C4d5E6F7g8h9i0J', '1a2b3C4d5E6F7g8h9i0j', '1a2b3C4d5E6F7g8h9I0j', '1a2b3C4d5E6F7g8h9I0J', '1a2b3C4d5E6F7G8h9I0J', '1a2b3C4d5E6F7G8h9I0j', '1a2b3C4d5E6F7G8h9i0j', '1a2b3C4d5E6F7G8h9i0J', '1a2b3C4d5E6F7G8H9i0J', '1a2b3C4d5E6F7G8H9i0j', '1a2b3C4d5E6F7G8H9I0j', '1a2b3C4d5E6F7G8H9I0J', '1a2b3c4d5E6F7G8H9I0J', '1a2b3c4d5E6F7G8H9I0j', '1a2b3c4d5E6F7G8H9i0j', '1a2b3c4d5E6F7G8H9i0J', '1a2b3c4d5E6F7G8h9i0J', '1a2b3c4d5E6F7G8h9i0j', '1a2b3c4d5E6F7G8h9I0j', '1a2b3c4d5E6F7G8h9I0J', '1a2b3c4d5E6F7g8h9I0J', '1a2b3c4d5E6F7g8h9I0j', '1a2b3c4d5E6F7g8h9i0j', '1a2b3c4d5E6F7g8h9i0J', '1a2b3c4d5E6F7g8H9i0J', '1a2b3c4d5E6F7g8H9i0j', '1a2b3c4d5E6F7g8H9I0j', '1a2b3c4d5E6F7g8H9I0J', '1a2b3c4d5E6f7g8H9I0J', '1a2b3c4d5E6f7g8H9I0j', '1a2b3c4d5E6f7g8H9i0j', '1a2b3c4d5E6f7g8H9i0J', '1a2b3c4d5E6f7g8h9i0J', '1a2b3c4d5E6f7g8h9i0j', '1a2b3c4d5E6f7g8h9I0j', '1a2b3c4d5E6f7g8h9I0J', '1a2b3c4d5E6f7G8h9I0J', '1a2b3c4d5E6f7G8h9I0j', '1a2b3c4d5E6f7G8h9i0j', '1a2b3c4d5E6f7G8h9i0J', '1a2b3c4d5E6f7G8H9i0J', '1a2b3c4d5E6f7G8H9i0j', '1a2b3c4d5E6f7G8H9I0j', '1a2b3c4d5E6f7G8H9I0J', '1a2b3c4d5e6f7G8H9I0J', '1a2b3c4d5e6f7G8H9I0j', '1a2b3c4d5e6f7G8H9i0j', '1a2b3c4d5e6f7G8H9i0J', '1a2b3c4d5e6f7G8h9i0J', '1a2b3c4d5e6f7G8h9i0j', '1a2b3c4d5e6f7G8h9I0j', '1a2b3c4d5e6f7G8h9I0J', '1a2b3c4d5e6f7g8h9I0J', '1a2b3c4d5e6f7g8h9I0j', '1a2b3c4d5e6f7g8h9i0j', '1a2b3c4d5e6f7g8h9i0J', '1a2b3c4d5e6f7g8H9i0J', '1a2b3c4d5e6f7g8H9i0j', '1a2b3c4d5e6f7g8H9I0j', '1a2b3c4d5e6f7g8H9I0J', '1a2b3c4d5e6F7g8H9I0J', '1a2b3c4d5e6F7g8H9I0j', '1a2b3c4d5e6F7g8H9i0j', '1a2b3c4d5e6F7g8H9i0J', '1a2b3c4d5e6F7g8h9i0J', '1a2b3c4d5e6F7g8h9i0j', '1a2b3c4d5e6F7g8h9I0j', '1a2b3c4d5e6F7g8h9I0J', '1a2b3c4d5e6F7G8h9I0J', '1a2b3c4d5e6F7G8h9I0j', '1a2b3c4d5e6F7G8h9i0j', '1a2b3c4d5e6F7G8h9i0J', '1a2b3c4d5e6F7G8H9i0J', '1a2b3c4d5e6F7G8H9i0j', '1a2b3c4d5e6F7G8H9I0j', '1a2b3c4d5e6F7G8H9I0J', '1a2b3c4D5e6F7G8H9I0J', '1a2b3c4D5e6F7G8H9I0j', '1a2b3c4D5e6F7G8H9i0j', '1a2b3c4D5e6F7G8H9i0J', '1a2b3c4D5e6F7G8h9i0J', '1a2b3c4D5e6F7G8h9i0j', '1a2b3c4D5e6F7G8h9I0j', '1a2b3c4D5e6F7G8h9I0J', '1a2b3c4D5e6F7g8h9I0J', '1a2b3c4D5e6F7g8h9I0j', '1a2b3c4D5e6F7g8h9i0j', '1a2b3c4D5e6F7g8h9i0J', '1a2b3c4D5e6F7g8H9i0J', '1a2b3c4D5e6F7g8H9i0j', '1a2b3c4D5e6F7g8H9I0j', '1a2b3c4D5e6F7g8H9I0J', '1a2b3c4D5e6f7g8H9I0J', '1a2b3c4D5e6f7g8H9I0j', '1a2b3c4D5e6f7g8H9i0j', '1a2b3c4D5e6f7g8H9i0J', '1a2b3c4D5e6f7g8h9i0J', '1a2b3c4D5e6f7g8h9i0j', '1a2b3c4D5e6f7g8h9I0j', '1a2b3c4D5e6f7g8h9I0J', '1a2b3c4D5e6f7G8h9I0J', '1a2b3c4D5e6f7G8h9I0j', '1a2b3c4D5e6f7G8h9i0j', '1a2b3c4D5e6f7G8h9i0J', '1a2b3c4D5e6f7G8H9i0J', '1a2b3c4D5e6f7G8H9i0j', '1a2b3c4D5e6f7G8H9I0j', '1a2b3c4D5e6f7G8H9I0J', '1a2b3c4D5E6f7G8H9I0J', '1a2b3c4D5E6f7G8H9I0j', '1a2b3c4D5E6f7G8H9i0j', '1a2b3c4D5E6f7G8H9i0J', '1a2b3c4D5E6f7G8h9i0J', '1a2b3c4D5E6f7G8h9i0j', '1a2b3c4D5E6f7G8h9I0j', '1a2b3c4D5E6f7G8h9I0J', '1a2b3c4D5E6f7g8h9I0J', '1a2b3c4D5E6f7g8h9I0j', '1a2b3c4D5E6f7g8h9i0j', '1a2b3c4D5E6f7g8h9i0J', '1a2b3c4D5E6f7g8H9i0J', '1a2b3c4D5E6f7g8H9i0j', '1a2b3c4D5E6f7g8H9I0j', '1a2b3c4D5E6f7g8H9I0J', '1a2b3c4D5E6F7g8H9I0J', '1a2b3c4D5E6F7g8H9I0j', '1a2b3c4D5E6F7g8H9i0j', '1a2b3c4D5E6F7g8H9i0J', '1a2b3c4D5E6F7g8h9i0J', '1a2b3c4D5E6F7g8h9i0j', '1a2b3c4D5E6F7g8h9I0j', '1a2b3c4D5E6F7g8h9I0J', '1a2b3c4D5E6F7G8h9I0J', '1a2b3c4D5E6F7G8h9I0j', '1a2b3c4D5E6F7G8h9i0j', '1a2b3c4D5E6F7G8h9i0J', '1a2b3c4D5E6F7G8H9i0J', '1a2b3c4D5E6F7G8H9i0j', '1a2b3c4D5E6F7G8H9I0j', '1a2b3c4D5E6F7G8H9I0J', '1a2B3c4D5E6F7G8H9I0J', '1a2B3c4D5E6F7G8H9I0j', '1a2B3c4D5E6F7G8H9i0j', '1a2B3c4D5E6F7G8H9i0J', '1a2B3c4D5E6F7G8h9i0J', '1a2B3c4D5E6F7G8h9i0j', '1a2B3c4D5E6F7G8h9I0j', '1a2B3c4D5E6F7G8h9I0J', '1a2B3c4D5E6F7g8h9I0J', '1a2B3c4D5E6F7g8h9I0j', '1a2B3c4D5E6F7g8h9i0j', '1a2B3c4D5E6F7g8h9i0J', '1a2B3c4D5E6F7g8H9i0J', '1a2B3c4D5E6F7g8H9i0j', '1a2B3c4D5E6F7g8H9I0j', '1a2B3c4D5E6F7g8H9I0J', '1a2B3c4D5E6f7g8H9I0J', '1a2B3c4D5E6f7g8H9I0j', '1a2B3c4D5E6f7g8H9i0j', '1a2B3c4D5E6f7g8H9i0J', '1a2B3c4D5E6f7g8h9i0J', '1a2B3c4D5E6f7g8h9i0j', '1a2B3c4D5E6f7g8h9I0j', '1a2B3c4D5E6f7g8h9I0J', '1a2B3c4D5E6f7G8h9I0J', '1a2B3c4D5E6f7G8h9I0j', '1a2B3c4D5E6f7G8h9i0j', '1a2B3c4D5E6f7G8h9i0J', '1a2B3c4D5E6f7G8H9i0J', '1a2B3c4D5E6f7G8H9i0j', '1a2B3c4D5E6f7G8H9I0j', '1a2B3c4D5E6f7G8H9I0J', '1a2B3c4D5e6f7G8H9I0J', '1a2B3c4D5e6f7G8H9I0j', '1a2B3c4D5e6f7G8H9i0j', '1a2B3c4D5e6f7G8H9i0J', '1a2B3c4D5e6f7G8h9i0J', '1a2B3c4D5e6f7G8h9i0j', '1a2B3c4D5e6f7G8h9I0j', '1a2B3c4D5e6f7G8h9I0J', '1a2B3c4D5e6f7g8h9I0J', '1a2B3c4D5e6f7g8h9I0j', '1a2B3c4D5e6f7g8h9i0j', '1a2B3c4D5e6f7g8h9i0J', '1a2B3c4D5e6f7g8H9i0J', '1a2B3c4D5e6f7g8H9i0j', '1a2B3c4D5e6f7g8H9I0j', '1a2B3c4D5e6f7g8H9I0J', '1a2B3c4D5e6F7g8H9I0J', '1a2B3c4D5e6F7g8H9I0j', '1a2B3c4D5e6F7g8H9i0j', '1a2B3c4D5e6F7g8H9i0J', '1a2B3c4D5e6F7g8h9i0J', '1a2B3c4D5e6F7g8h9i0j', '1a2B3c4D5e6F7g8h9I0j', '1a2B3c4D5e6F7g8h9I0J', '1a2B3c4D5e6F7G8h9I0J', '1a2B3c4D5e6F7G8h9I0j', '1a2B3c4D5e6F7G8h9i0j', '1a2B3c4D5e6F7G8h9i0J', '1a2B3c4D5e6F7G8H9i0J', '1a2B3c4D5e6F7G8H9i0j', '1a2B3c4D5e6F7G8H9I0j', '1a2B3c4D5e6F7G8H9I0J', '1a2B3c4d5e6F7G8H9I0J', '1a2B3c4d5e6F7G8H9I0j', '1a2B3c4d5e6F7G8H9i0j', '1a2B3c4d5e6F7G8H9i0J', '1a2B3c4d5e6F7G8h9i0J', '1a2B3c4d5e6F7G8h9i0j', '1a2B3c4d5e6F7G8h9I0j', '1a2B3c4d5e6F7G8h9I0J', '1a2B3c4d5e6F7g8h9I0J', '1a2B3c4d5e6F7g8h9I0j', '1a2B3c4d5e6F7g8h9i0j', '1a2B3c4d5e6F7g8h9i0J', '1a2B3c4d5e6F7g8H9i0J', '1a2B3c4d5e6F7g8H9i0j', '1a2B3c4d5e6F7g8H9I0j', '1a2B3c4d5e6F7g8H9I0J', '1a2B3c4d5e6f7g8H9I0J', '1a2B3c4d5e6f7g8H9I0j', '1a2B3c4d5e6f7g8H9i0j', '1a2B3c4d5e6f7g8H9i0J', '1a2B3c4d5e6f7g8h9i0J', '1a2B3c4d5e6f7g8h9i0j', '1a2B3c4d5e6f7g8h9I0j', '1a2B3c4d5e6f7g8h9I0J', '1a2B3c4d5e6f7G8h9I0J', '1a2B3c4d5e6f7G8h9I0j', '1a2B3c4d5e6f7G8h9i0j', '1a2B3c4d5e6f7G8h9i0J', '1a2B3c4d5e6f7G8H9i0J', '1a2B3c4d5e6f7G8H9i0j', '1a2B3c4d5e6f7G8H9I0j', '1a2B3c4d5e6f7G8H9I0J', '1a2B3c4d5E6f7G8H9I0J', '1a2B3c4d5E6f7G8H9I0j', '1a2B3c4d5E6f7G8H9i0j', '1a2B3c4d5E6f7G8H9i0J', '1a2B3c4d5E6f7G8h9i0J', '1a2B3c4d5E6f7G8h9i0j', '1a2B3c4d5E6f7G8h9I0j', '1a2B3c4d5E6f7G8h9I0J', '1a2B3c4d5E6f7g8h9I0J', '1a2B3c4d5E6f7g8h9I0j', '1a2B3c4d5E6f7g8h9i0j', '1a2B3c4d5E6f7g8h9i0J', '1a2B3c4d5E6f7g8H9i0J', '1a2B3c4d5E6f7g8H9i0j', '1a2B3c4d5E6f7g8H9I0j', '1a2B3c4d5E6f7g8H9I0J', '1a2B3c4d5E6F7g8H9I0J', '1a2B3c4d5E6F7g8H9I0j', '1a2B3c4d5E6F7g8H9i0j', '1a2B3c4d5E6F7g8H9i0J', '1a2B3c4d5E6F7g8h9i0J', '1a2B3c4d5E6F7g8h9i0j', '1a2B3c4d5E6F7g8h9I0j', '1a2B3c4d5E6F7g8h9I0J', '1a2B3c4d5E6F7G8h9I0J', '1a2B3c4d5E6F7G8h9I0j', '1a2B3c4d5E6F7G8h9i0j', '1a2B3c4d5E6F7G8h9i0J', '1a2B3c4d5E6F7G8H9i0J', '1a2B3c4d5E6F7G8H9i0j', '1a2B3c4d5E6F7G8H9I0j', '1a2B3c4d5E6F7G8H9I0J', '1a2B3C4d5E6F7G8H9I0J', '1a2B3C4d5E6F7G8H9I0j', '1a2B3C4d5E6F7G8H9i0j', '1a2B3C4d5E6F7G8H9i0J', '1a2B3C4d5E6F7G8h9i0J', '1a2B3C4d5E6F7G8h9i0j', '1a2B3C4d5E6F7G8h9I0j', '1a2B3C4d5E6F7G8h9I0J', '1a2B3C4d5E6F7g8h9I0J', '1a2B3C4d5E6F7g8h9I0j', '1a2B3C4d5E6F7g8h9i0j', '1a2B3C4d5E6F7g8h9i0J', '1a2B3C4d5E6F7g8H9i0J', '1a2B3C4d5E6F7g8H9i0j', '1a2B3C4d5E6F7g8H9I0j', '1a2B3C4d5E6F7g8H9I0J', '1a2B3C4d5E6f7g8H9I0J', '1a2B3C4d5E6f7g8H9I0j', '1a2B3C4d5E6f7g8H9i0j', '1a2B3C4d5E6f7g8H9i0J', '1a2B3C4d5E6f7g8h9i0J', '1a2B3C4d5E6f7g8h9i0j', '1a2B3C4d5E6f7g8h9I0j', '1a2B3C4d5E6f7g8h9I0J', '1a2B3C4d5E6f7G8h9I0J', '1a2B3C4d5E6f7G8h9I0j', '1a2B3C4d5E6f7G8h9i0j', '1a2B3C4d5E6f7G8h9i0J', '1a2B3C4d5E6f7G8H9i0J', '1a2B3C4d5E6f7G8H9i0j', '1a2B3C4d5E6f7G8H9I0j', '1a2B3C4d5E6f7G8H9I0J', '1a2B3C4d5e6f7G8H9I0J', '1a2B3C4d5e6f7G8H9I0j', '1a2B3C4d5e6f7G8H9i0j', '1a2B3C4d5e6f7G8H9i0J', '1a2B3C4d5e6f7G8h9i0J', '1a2B3C4d5e6f7G8h9i0j', '1a2B3C4d5e6f7G8h9I0j', '1a2B3C4d5e6f7G8h9I0J', '1a2B3C4d5e6f7g8h9I0J', '1a2B3C4d5e6f7g8h9I0j', '1a2B3C4d5e6f7g8h9i0j', '1a2B3C4d5e6f7g8h9i0J', '1a2B3C4d5e6f7g8H9i0J', '1a2B3C4d5e6f7g8H9i0j', '1a2B3C4d5e6f7g8H9I0j', '1a2B3C4d5e6f7g8H9I0J', '1a2B3C4d5e6F7g8H9I0J', '1a2B3C4d5e6F7g8H9I0j', '1a2B3C4d5e6F7g8H9i0j', '1a2B3C4d5e6F7g8H9i0J', '1a2B3C4d5e6F7g8h9i0J', '1a2B3C4d5e6F7g8h9i0j', '1a2B3C4d5e6F7g8h9I0j', '1a2B3C4d5e6F7g8h9I0J', '1a2B3C4d5e6F7G8h9I0J', '1a2B3C4d5e6F7G8h9I0j', '1a2B3C4d5e6F7G8h9i0j', '1a2B3C4d5e6F7G8h9i0J', '1a2B3C4d5e6F7G8H9i0J', '1a2B3C4d5e6F7G8H9i0j', '1a2B3C4d5e6F7G8H9I0j', '1a2B3C4d5e6F7G8H9I0J', '1a2B3C4D5e6F7G8H9I0J', '1a2B3C4D5e6F7G8H9I0j', '1a2B3C4D5e6F7G8H9i0j', '1a2B3C4D5e6F7G8H9i0J', '1a2B3C4D5e6F7G8h9i0J', '1a2B3C4D5e6F7G8h9i0j', '1a2B3C4D5e6F7G8h9I0j', '1a2B3C4D5e6F7G8h9I0J', '1a2B3C4D5e6F7g8h9I0J', '1a2B3C4D5e6F7g8h9I0j', '1a2B3C4D5e6F7g8h9i0j', '1a2B3C4D5e6F7g8h9i0J', '1a2B3C4D5e6F7g8H9i0J', '1a2B3C4D5e6F7g8H9i0j', '1a2B3C4D5e6F7g8H9I0j', '1a2B3C4D5e6F7g8H9I0J', '1a2B3C4D5e6f7g8H9I0J', '1a2B3C4D5e6f7g8H9I0j', '1a2B3C4D5e6f7g8H9i0j', '1a2B3C4D5e6f7g8H9i0J', '1a2B3C4D5e6f7g8h9i0J', '1a2B3C4D5e6f7g8h9i0j', '1a2B3C4D5e6f7g8h9I0j', '1a2B3C4D5e6f7g8h9I0J', '1a2B3C4D5e6f7G8h9I0J', '1a2B3C4D5e6f7G8h9I0j', '1a2B3C4D5e6f7G8h9i0j', '1a2B3C4D5e6f7G8h9i0J', '1a2B3C4D5e6f7G8H9i0J', '1a2B3C4D5e6f7G8H9i0j', '1a2B3C4D5e6f7G8H9I0j', '1a2B3C4D5e6f7G8H9I0J', '1a2B3C4D5E6f7G8H9I0J', '1a2B3C4D5E6f7G8H9I0j', '1a2B3C4D5E6f7G8H9i0j', '1a2B3C4D5E6f7G8H9i0J', '1a2B3C4D5E6f7G8h9i0J', '1a2B3C4D5E6f7G8h9i0j', '1a2B3C4D5E6f7G8h9I0j', '1a2B3C4D5E6f7G8h9I0J', '1a2B3C4D5E6f7g8h9I0J', '1a2B3C4D5E6f7g8h9I0j', '1a2B3C4D5E6f7g8h9i0j', '1a2B3C4D5E6f7g8h9i0J', '1a2B3C4D5E6f7g8H9i0J', '1a2B3C4D5E6f7g8H9i0j', '1a2B3C4D5E6f7g8H9I0j', '1a2B3C4D5E6f7g8H9I0J', '1a2B3C4D5E6F7g8H9I0J', '1a2B3C4D5E6F7g8H9I0j', '1a2B3C4D5E6F7g8H9i0j', '1a2B3C4D5E6F7g8H9i0J', '1a2B3C4D5E6F7g8h9i0J', '1a2B3C4D5E6F7g8h9i0j', '1a2B3C4D5E6F7g8h9I0j', '1a2B3C4D5E6F7g8h9I0J', '1a2B3C4D5E6F7G8h9I0J', '1a2B3C4D5E6F7G8h9I0j', '1a2B3C4D5E6F7G8h9i0j', '1a2B3C4D5E6F7G8h9i0J', '1a2B3C4D5E6F7G8H9i0J', '1a2B3C4D5E6F7G8H9i0j', '1a2B3C4D5E6F7G8H9I0j', '1a2B3C4D5E6F7G8H9I0J']\n assert candidate(s = \"a1B2c3\") == ['a1B2c3', 'a1B2C3', 'a1b2C3', 'a1b2c3', 'A1b2c3', 'A1b2C3', 'A1B2C3', 'A1B2c3']\n assert candidate(s = \"MnOpQrSt\") == ['MnOpQrSt', 'MnOpQrST', 'MnOpQrsT', 'MnOpQrst', 'MnOpQRst', 'MnOpQRsT', 'MnOpQRST', 'MnOpQRSt', 'MnOpqRSt', 'MnOpqRST', 'MnOpqRsT', 'MnOpqRst', 'MnOpqrst', 'MnOpqrsT', 'MnOpqrST', 'MnOpqrSt', 'MnOPqrSt', 'MnOPqrST', 'MnOPqrsT', 'MnOPqrst', 'MnOPqRst', 'MnOPqRsT', 'MnOPqRST', 'MnOPqRSt', 'MnOPQRSt', 'MnOPQRST', 'MnOPQRsT', 'MnOPQRst', 'MnOPQrst', 'MnOPQrsT', 'MnOPQrST', 'MnOPQrSt', 'MnoPQrSt', 'MnoPQrST', 'MnoPQrsT', 'MnoPQrst', 'MnoPQRst', 'MnoPQRsT', 'MnoPQRST', 'MnoPQRSt', 'MnoPqRSt', 'MnoPqRST', 'MnoPqRsT', 'MnoPqRst', 'MnoPqrst', 'MnoPqrsT', 'MnoPqrST', 'MnoPqrSt', 'MnopqrSt', 'MnopqrST', 'MnopqrsT', 'Mnopqrst', 'MnopqRst', 'MnopqRsT', 'MnopqRST', 'MnopqRSt', 'MnopQRSt', 'MnopQRST', 'MnopQRsT', 'MnopQRst', 'MnopQrst', 'MnopQrsT', 'MnopQrST', 'MnopQrSt', 'MNopQrSt', 'MNopQrST', 'MNopQrsT', 'MNopQrst', 'MNopQRst', 'MNopQRsT', 'MNopQRST', 'MNopQRSt', 'MNopqRSt', 'MNopqRST', 'MNopqRsT', 'MNopqRst', 'MNopqrst', 'MNopqrsT', 'MNopqrST', 'MNopqrSt', 'MNoPqrSt', 'MNoPqrST', 'MNoPqrsT', 'MNoPqrst', 'MNoPqRst', 'MNoPqRsT', 'MNoPqRST', 'MNoPqRSt', 'MNoPQRSt', 'MNoPQRST', 'MNoPQRsT', 'MNoPQRst', 'MNoPQrst', 'MNoPQrsT', 'MNoPQrST', 'MNoPQrSt', 'MNOPQrSt', 'MNOPQrST', 'MNOPQrsT', 'MNOPQrst', 'MNOPQRst', 'MNOPQRsT', 'MNOPQRST', 'MNOPQRSt', 'MNOPqRSt', 'MNOPqRST', 'MNOPqRsT', 'MNOPqRst', 'MNOPqrst', 'MNOPqrsT', 'MNOPqrST', 'MNOPqrSt', 'MNOpqrSt', 'MNOpqrST', 'MNOpqrsT', 'MNOpqrst', 'MNOpqRst', 'MNOpqRsT', 'MNOpqRST', 'MNOpqRSt', 'MNOpQRSt', 'MNOpQRST', 'MNOpQRsT', 'MNOpQRst', 'MNOpQrst', 'MNOpQrsT', 'MNOpQrST', 'MNOpQrSt', 'mNOpQrSt', 'mNOpQrST', 'mNOpQrsT', 'mNOpQrst', 'mNOpQRst', 'mNOpQRsT', 'mNOpQRST', 'mNOpQRSt', 'mNOpqRSt', 'mNOpqRST', 'mNOpqRsT', 'mNOpqRst', 'mNOpqrst', 'mNOpqrsT', 'mNOpqrST', 'mNOpqrSt', 'mNOPqrSt', 'mNOPqrST', 'mNOPqrsT', 'mNOPqrst', 'mNOPqRst', 'mNOPqRsT', 'mNOPqRST', 'mNOPqRSt', 'mNOPQRSt', 'mNOPQRST', 'mNOPQRsT', 'mNOPQRst', 'mNOPQrst', 'mNOPQrsT', 'mNOPQrST', 'mNOPQrSt', 'mNoPQrSt', 'mNoPQrST', 'mNoPQrsT', 'mNoPQrst', 'mNoPQRst', 'mNoPQRsT', 'mNoPQRST', 'mNoPQRSt', 'mNoPqRSt', 'mNoPqRST', 'mNoPqRsT', 'mNoPqRst', 'mNoPqrst', 'mNoPqrsT', 'mNoPqrST', 'mNoPqrSt', 'mNopqrSt', 'mNopqrST', 'mNopqrsT', 'mNopqrst', 'mNopqRst', 'mNopqRsT', 'mNopqRST', 'mNopqRSt', 'mNopQRSt', 'mNopQRST', 'mNopQRsT', 'mNopQRst', 'mNopQrst', 'mNopQrsT', 'mNopQrST', 'mNopQrSt', 'mnopQrSt', 'mnopQrST', 'mnopQrsT', 'mnopQrst', 'mnopQRst', 'mnopQRsT', 'mnopQRST', 'mnopQRSt', 'mnopqRSt', 'mnopqRST', 'mnopqRsT', 'mnopqRst', 'mnopqrst', 'mnopqrsT', 'mnopqrST', 'mnopqrSt', 'mnoPqrSt', 'mnoPqrST', 'mnoPqrsT', 'mnoPqrst', 'mnoPqRst', 'mnoPqRsT', 'mnoPqRST', 'mnoPqRSt', 'mnoPQRSt', 'mnoPQRST', 'mnoPQRsT', 'mnoPQRst', 'mnoPQrst', 'mnoPQrsT', 'mnoPQrST', 'mnoPQrSt', 'mnOPQrSt', 'mnOPQrST', 'mnOPQrsT', 'mnOPQrst', 'mnOPQRst', 'mnOPQRsT', 'mnOPQRST', 'mnOPQRSt', 'mnOPqRSt', 'mnOPqRST', 'mnOPqRsT', 'mnOPqRst', 'mnOPqrst', 'mnOPqrsT', 'mnOPqrST', 'mnOPqrSt', 'mnOpqrSt', 'mnOpqrST', 'mnOpqrsT', 'mnOpqrst', 'mnOpqRst', 'mnOpqRsT', 'mnOpqRST', 'mnOpqRSt', 'mnOpQRSt', 'mnOpQRST', 'mnOpQRsT', 'mnOpQRst', 'mnOpQrst', 'mnOpQrsT', 'mnOpQrST', 'mnOpQrSt']\n assert candidate(s = \"xYz\") == ['xYz', 'xYZ', 'xyZ', 'xyz', 'Xyz', 'XyZ', 'XYZ', 'XYz']\n assert candidate(s = \"ABCDEFGHIJ\") == ['ABCDEFGHIJ', 'ABCDEFGHIj', 'ABCDEFGHij', 'ABCDEFGHiJ', 'ABCDEFGhiJ', 'ABCDEFGhij', 'ABCDEFGhIj', 'ABCDEFGhIJ', 'ABCDEFghIJ', 'ABCDEFghIj', 'ABCDEFghij', 'ABCDEFghiJ', 'ABCDEFgHiJ', 'ABCDEFgHij', 'ABCDEFgHIj', 'ABCDEFgHIJ', 'ABCDEfgHIJ', 'ABCDEfgHIj', 'ABCDEfgHij', 'ABCDEfgHiJ', 'ABCDEfghiJ', 'ABCDEfghij', 'ABCDEfghIj', 'ABCDEfghIJ', 'ABCDEfGhIJ', 'ABCDEfGhIj', 'ABCDEfGhij', 'ABCDEfGhiJ', 'ABCDEfGHiJ', 'ABCDEfGHij', 'ABCDEfGHIj', 'ABCDEfGHIJ', 'ABCDefGHIJ', 'ABCDefGHIj', 'ABCDefGHij', 'ABCDefGHiJ', 'ABCDefGhiJ', 'ABCDefGhij', 'ABCDefGhIj', 'ABCDefGhIJ', 'ABCDefghIJ', 'ABCDefghIj', 'ABCDefghij', 'ABCDefghiJ', 'ABCDefgHiJ', 'ABCDefgHij', 'ABCDefgHIj', 'ABCDefgHIJ', 'ABCDeFgHIJ', 'ABCDeFgHIj', 'ABCDeFgHij', 'ABCDeFgHiJ', 'ABCDeFghiJ', 'ABCDeFghij', 'ABCDeFghIj', 'ABCDeFghIJ', 'ABCDeFGhIJ', 'ABCDeFGhIj', 'ABCDeFGhij', 'ABCDeFGhiJ', 'ABCDeFGHiJ', 'ABCDeFGHij', 'ABCDeFGHIj', 'ABCDeFGHIJ', 'ABCdeFGHIJ', 'ABCdeFGHIj', 'ABCdeFGHij', 'ABCdeFGHiJ', 'ABCdeFGhiJ', 'ABCdeFGhij', 'ABCdeFGhIj', 'ABCdeFGhIJ', 'ABCdeFghIJ', 'ABCdeFghIj', 'ABCdeFghij', 'ABCdeFghiJ', 'ABCdeFgHiJ', 'ABCdeFgHij', 'ABCdeFgHIj', 'ABCdeFgHIJ', 'ABCdefgHIJ', 'ABCdefgHIj', 'ABCdefgHij', 'ABCdefgHiJ', 'ABCdefghiJ', 'ABCdefghij', 'ABCdefghIj', 'ABCdefghIJ', 'ABCdefGhIJ', 'ABCdefGhIj', 'ABCdefGhij', 'ABCdefGhiJ', 'ABCdefGHiJ', 'ABCdefGHij', 'ABCdefGHIj', 'ABCdefGHIJ', 'ABCdEfGHIJ', 'ABCdEfGHIj', 'ABCdEfGHij', 'ABCdEfGHiJ', 'ABCdEfGhiJ', 'ABCdEfGhij', 'ABCdEfGhIj', 'ABCdEfGhIJ', 'ABCdEfghIJ', 'ABCdEfghIj', 'ABCdEfghij', 'ABCdEfghiJ', 'ABCdEfgHiJ', 'ABCdEfgHij', 'ABCdEfgHIj', 'ABCdEfgHIJ', 'ABCdEFgHIJ', 'ABCdEFgHIj', 'ABCdEFgHij', 'ABCdEFgHiJ', 'ABCdEFghiJ', 'ABCdEFghij', 'ABCdEFghIj', 'ABCdEFghIJ', 'ABCdEFGhIJ', 'ABCdEFGhIj', 'ABCdEFGhij', 'ABCdEFGhiJ', 'ABCdEFGHiJ', 'ABCdEFGHij', 'ABCdEFGHIj', 'ABCdEFGHIJ', 'ABcdEFGHIJ', 'ABcdEFGHIj', 'ABcdEFGHij', 'ABcdEFGHiJ', 'ABcdEFGhiJ', 'ABcdEFGhij', 'ABcdEFGhIj', 'ABcdEFGhIJ', 'ABcdEFghIJ', 'ABcdEFghIj', 'ABcdEFghij', 'ABcdEFghiJ', 'ABcdEFgHiJ', 'ABcdEFgHij', 'ABcdEFgHIj', 'ABcdEFgHIJ', 'ABcdEfgHIJ', 'ABcdEfgHIj', 'ABcdEfgHij', 'ABcdEfgHiJ', 'ABcdEfghiJ', 'ABcdEfghij', 'ABcdEfghIj', 'ABcdEfghIJ', 'ABcdEfGhIJ', 'ABcdEfGhIj', 'ABcdEfGhij', 'ABcdEfGhiJ', 'ABcdEfGHiJ', 'ABcdEfGHij', 'ABcdEfGHIj', 'ABcdEfGHIJ', 'ABcdefGHIJ', 'ABcdefGHIj', 'ABcdefGHij', 'ABcdefGHiJ', 'ABcdefGhiJ', 'ABcdefGhij', 'ABcdefGhIj', 'ABcdefGhIJ', 'ABcdefghIJ', 'ABcdefghIj', 'ABcdefghij', 'ABcdefghiJ', 'ABcdefgHiJ', 'ABcdefgHij', 'ABcdefgHIj', 'ABcdefgHIJ', 'ABcdeFgHIJ', 'ABcdeFgHIj', 'ABcdeFgHij', 'ABcdeFgHiJ', 'ABcdeFghiJ', 'ABcdeFghij', 'ABcdeFghIj', 'ABcdeFghIJ', 'ABcdeFGhIJ', 'ABcdeFGhIj', 'ABcdeFGhij', 'ABcdeFGhiJ', 'ABcdeFGHiJ', 'ABcdeFGHij', 'ABcdeFGHIj', 'ABcdeFGHIJ', 'ABcDeFGHIJ', 'ABcDeFGHIj', 'ABcDeFGHij', 'ABcDeFGHiJ', 'ABcDeFGhiJ', 'ABcDeFGhij', 'ABcDeFGhIj', 'ABcDeFGhIJ', 'ABcDeFghIJ', 'ABcDeFghIj', 'ABcDeFghij', 'ABcDeFghiJ', 'ABcDeFgHiJ', 'ABcDeFgHij', 'ABcDeFgHIj', 'ABcDeFgHIJ', 'ABcDefgHIJ', 'ABcDefgHIj', 'ABcDefgHij', 'ABcDefgHiJ', 'ABcDefghiJ', 'ABcDefghij', 'ABcDefghIj', 'ABcDefghIJ', 'ABcDefGhIJ', 'ABcDefGhIj', 'ABcDefGhij', 'ABcDefGhiJ', 'ABcDefGHiJ', 'ABcDefGHij', 'ABcDefGHIj', 'ABcDefGHIJ', 'ABcDEfGHIJ', 'ABcDEfGHIj', 'ABcDEfGHij', 'ABcDEfGHiJ', 'ABcDEfGhiJ', 'ABcDEfGhij', 'ABcDEfGhIj', 'ABcDEfGhIJ', 'ABcDEfghIJ', 'ABcDEfghIj', 'ABcDEfghij', 'ABcDEfghiJ', 'ABcDEfgHiJ', 'ABcDEfgHij', 'ABcDEfgHIj', 'ABcDEfgHIJ', 'ABcDEFgHIJ', 'ABcDEFgHIj', 'ABcDEFgHij', 'ABcDEFgHiJ', 'ABcDEFghiJ', 'ABcDEFghij', 'ABcDEFghIj', 'ABcDEFghIJ', 'ABcDEFGhIJ', 'ABcDEFGhIj', 'ABcDEFGhij', 'ABcDEFGhiJ', 'ABcDEFGHiJ', 'ABcDEFGHij', 'ABcDEFGHIj', 'ABcDEFGHIJ', 'AbcDEFGHIJ', 'AbcDEFGHIj', 'AbcDEFGHij', 'AbcDEFGHiJ', 'AbcDEFGhiJ', 'AbcDEFGhij', 'AbcDEFGhIj', 'AbcDEFGhIJ', 'AbcDEFghIJ', 'AbcDEFghIj', 'AbcDEFghij', 'AbcDEFghiJ', 'AbcDEFgHiJ', 'AbcDEFgHij', 'AbcDEFgHIj', 'AbcDEFgHIJ', 'AbcDEfgHIJ', 'AbcDEfgHIj', 'AbcDEfgHij', 'AbcDEfgHiJ', 'AbcDEfghiJ', 'AbcDEfghij', 'AbcDEfghIj', 'AbcDEfghIJ', 'AbcDEfGhIJ', 'AbcDEfGhIj', 'AbcDEfGhij', 'AbcDEfGhiJ', 'AbcDEfGHiJ', 'AbcDEfGHij', 'AbcDEfGHIj', 'AbcDEfGHIJ', 'AbcDefGHIJ', 'AbcDefGHIj', 'AbcDefGHij', 'AbcDefGHiJ', 'AbcDefGhiJ', 'AbcDefGhij', 'AbcDefGhIj', 'AbcDefGhIJ', 'AbcDefghIJ', 'AbcDefghIj', 'AbcDefghij', 'AbcDefghiJ', 'AbcDefgHiJ', 'AbcDefgHij', 'AbcDefgHIj', 'AbcDefgHIJ', 'AbcDeFgHIJ', 'AbcDeFgHIj', 'AbcDeFgHij', 'AbcDeFgHiJ', 'AbcDeFghiJ', 'AbcDeFghij', 'AbcDeFghIj', 'AbcDeFghIJ', 'AbcDeFGhIJ', 'AbcDeFGhIj', 'AbcDeFGhij', 'AbcDeFGhiJ', 'AbcDeFGHiJ', 'AbcDeFGHij', 'AbcDeFGHIj', 'AbcDeFGHIJ', 'AbcdeFGHIJ', 'AbcdeFGHIj', 'AbcdeFGHij', 'AbcdeFGHiJ', 'AbcdeFGhiJ', 'AbcdeFGhij', 'AbcdeFGhIj', 'AbcdeFGhIJ', 'AbcdeFghIJ', 'AbcdeFghIj', 'AbcdeFghij', 'AbcdeFghiJ', 'AbcdeFgHiJ', 'AbcdeFgHij', 'AbcdeFgHIj', 'AbcdeFgHIJ', 'AbcdefgHIJ', 'AbcdefgHIj', 'AbcdefgHij', 'AbcdefgHiJ', 'AbcdefghiJ', 'Abcdefghij', 'AbcdefghIj', 'AbcdefghIJ', 'AbcdefGhIJ', 'AbcdefGhIj', 'AbcdefGhij', 'AbcdefGhiJ', 'AbcdefGHiJ', 'AbcdefGHij', 'AbcdefGHIj', 'AbcdefGHIJ', 'AbcdEfGHIJ', 'AbcdEfGHIj', 'AbcdEfGHij', 'AbcdEfGHiJ', 'AbcdEfGhiJ', 'AbcdEfGhij', 'AbcdEfGhIj', 'AbcdEfGhIJ', 'AbcdEfghIJ', 'AbcdEfghIj', 'AbcdEfghij', 'AbcdEfghiJ', 'AbcdEfgHiJ', 'AbcdEfgHij', 'AbcdEfgHIj', 'AbcdEfgHIJ', 'AbcdEFgHIJ', 'AbcdEFgHIj', 'AbcdEFgHij', 'AbcdEFgHiJ', 'AbcdEFghiJ', 'AbcdEFghij', 'AbcdEFghIj', 'AbcdEFghIJ', 'AbcdEFGhIJ', 'AbcdEFGhIj', 'AbcdEFGhij', 'AbcdEFGhiJ', 'AbcdEFGHiJ', 'AbcdEFGHij', 'AbcdEFGHIj', 'AbcdEFGHIJ', 'AbCdEFGHIJ', 'AbCdEFGHIj', 'AbCdEFGHij', 'AbCdEFGHiJ', 'AbCdEFGhiJ', 'AbCdEFGhij', 'AbCdEFGhIj', 'AbCdEFGhIJ', 'AbCdEFghIJ', 'AbCdEFghIj', 'AbCdEFghij', 'AbCdEFghiJ', 'AbCdEFgHiJ', 'AbCdEFgHij', 'AbCdEFgHIj', 'AbCdEFgHIJ', 'AbCdEfgHIJ', 'AbCdEfgHIj', 'AbCdEfgHij', 'AbCdEfgHiJ', 'AbCdEfghiJ', 'AbCdEfghij', 'AbCdEfghIj', 'AbCdEfghIJ', 'AbCdEfGhIJ', 'AbCdEfGhIj', 'AbCdEfGhij', 'AbCdEfGhiJ', 'AbCdEfGHiJ', 'AbCdEfGHij', 'AbCdEfGHIj', 'AbCdEfGHIJ', 'AbCdefGHIJ', 'AbCdefGHIj', 'AbCdefGHij', 'AbCdefGHiJ', 'AbCdefGhiJ', 'AbCdefGhij', 'AbCdefGhIj', 'AbCdefGhIJ', 'AbCdefghIJ', 'AbCdefghIj', 'AbCdefghij', 'AbCdefghiJ', 'AbCdefgHiJ', 'AbCdefgHij', 'AbCdefgHIj', 'AbCdefgHIJ', 'AbCdeFgHIJ', 'AbCdeFgHIj', 'AbCdeFgHij', 'AbCdeFgHiJ', 'AbCdeFghiJ', 'AbCdeFghij', 'AbCdeFghIj', 'AbCdeFghIJ', 'AbCdeFGhIJ', 'AbCdeFGhIj', 'AbCdeFGhij', 'AbCdeFGhiJ', 'AbCdeFGHiJ', 'AbCdeFGHij', 'AbCdeFGHIj', 'AbCdeFGHIJ', 'AbCDeFGHIJ', 'AbCDeFGHIj', 'AbCDeFGHij', 'AbCDeFGHiJ', 'AbCDeFGhiJ', 'AbCDeFGhij', 'AbCDeFGhIj', 'AbCDeFGhIJ', 'AbCDeFghIJ', 'AbCDeFghIj', 'AbCDeFghij', 'AbCDeFghiJ', 'AbCDeFgHiJ', 'AbCDeFgHij', 'AbCDeFgHIj', 'AbCDeFgHIJ', 'AbCDefgHIJ', 'AbCDefgHIj', 'AbCDefgHij', 'AbCDefgHiJ', 'AbCDefghiJ', 'AbCDefghij', 'AbCDefghIj', 'AbCDefghIJ', 'AbCDefGhIJ', 'AbCDefGhIj', 'AbCDefGhij', 'AbCDefGhiJ', 'AbCDefGHiJ', 'AbCDefGHij', 'AbCDefGHIj', 'AbCDefGHIJ', 'AbCDEfGHIJ', 'AbCDEfGHIj', 'AbCDEfGHij', 'AbCDEfGHiJ', 'AbCDEfGhiJ', 'AbCDEfGhij', 'AbCDEfGhIj', 'AbCDEfGhIJ', 'AbCDEfghIJ', 'AbCDEfghIj', 'AbCDEfghij', 'AbCDEfghiJ', 'AbCDEfgHiJ', 'AbCDEfgHij', 'AbCDEfgHIj', 'AbCDEfgHIJ', 'AbCDEFgHIJ', 'AbCDEFgHIj', 'AbCDEFgHij', 'AbCDEFgHiJ', 'AbCDEFghiJ', 'AbCDEFghij', 'AbCDEFghIj', 'AbCDEFghIJ', 'AbCDEFGhIJ', 'AbCDEFGhIj', 'AbCDEFGhij', 'AbCDEFGhiJ', 'AbCDEFGHiJ', 'AbCDEFGHij', 'AbCDEFGHIj', 'AbCDEFGHIJ', 'abCDEFGHIJ', 'abCDEFGHIj', 'abCDEFGHij', 'abCDEFGHiJ', 'abCDEFGhiJ', 'abCDEFGhij', 'abCDEFGhIj', 'abCDEFGhIJ', 'abCDEFghIJ', 'abCDEFghIj', 'abCDEFghij', 'abCDEFghiJ', 'abCDEFgHiJ', 'abCDEFgHij', 'abCDEFgHIj', 'abCDEFgHIJ', 'abCDEfgHIJ', 'abCDEfgHIj', 'abCDEfgHij', 'abCDEfgHiJ', 'abCDEfghiJ', 'abCDEfghij', 'abCDEfghIj', 'abCDEfghIJ', 'abCDEfGhIJ', 'abCDEfGhIj', 'abCDEfGhij', 'abCDEfGhiJ', 'abCDEfGHiJ', 'abCDEfGHij', 'abCDEfGHIj', 'abCDEfGHIJ', 'abCDefGHIJ', 'abCDefGHIj', 'abCDefGHij', 'abCDefGHiJ', 'abCDefGhiJ', 'abCDefGhij', 'abCDefGhIj', 'abCDefGhIJ', 'abCDefghIJ', 'abCDefghIj', 'abCDefghij', 'abCDefghiJ', 'abCDefgHiJ', 'abCDefgHij', 'abCDefgHIj', 'abCDefgHIJ', 'abCDeFgHIJ', 'abCDeFgHIj', 'abCDeFgHij', 'abCDeFgHiJ', 'abCDeFghiJ', 'abCDeFghij', 'abCDeFghIj', 'abCDeFghIJ', 'abCDeFGhIJ', 'abCDeFGhIj', 'abCDeFGhij', 'abCDeFGhiJ', 'abCDeFGHiJ', 'abCDeFGHij', 'abCDeFGHIj', 'abCDeFGHIJ', 'abCdeFGHIJ', 'abCdeFGHIj', 'abCdeFGHij', 'abCdeFGHiJ', 'abCdeFGhiJ', 'abCdeFGhij', 'abCdeFGhIj', 'abCdeFGhIJ', 'abCdeFghIJ', 'abCdeFghIj', 'abCdeFghij', 'abCdeFghiJ', 'abCdeFgHiJ', 'abCdeFgHij', 'abCdeFgHIj', 'abCdeFgHIJ', 'abCdefgHIJ', 'abCdefgHIj', 'abCdefgHij', 'abCdefgHiJ', 'abCdefghiJ', 'abCdefghij', 'abCdefghIj', 'abCdefghIJ', 'abCdefGhIJ', 'abCdefGhIj', 'abCdefGhij', 'abCdefGhiJ', 'abCdefGHiJ', 'abCdefGHij', 'abCdefGHIj', 'abCdefGHIJ', 'abCdEfGHIJ', 'abCdEfGHIj', 'abCdEfGHij', 'abCdEfGHiJ', 'abCdEfGhiJ', 'abCdEfGhij', 'abCdEfGhIj', 'abCdEfGhIJ', 'abCdEfghIJ', 'abCdEfghIj', 'abCdEfghij', 'abCdEfghiJ', 'abCdEfgHiJ', 'abCdEfgHij', 'abCdEfgHIj', 'abCdEfgHIJ', 'abCdEFgHIJ', 'abCdEFgHIj', 'abCdEFgHij', 'abCdEFgHiJ', 'abCdEFghiJ', 'abCdEFghij', 'abCdEFghIj', 'abCdEFghIJ', 'abCdEFGhIJ', 'abCdEFGhIj', 'abCdEFGhij', 'abCdEFGhiJ', 'abCdEFGHiJ', 'abCdEFGHij', 'abCdEFGHIj', 'abCdEFGHIJ', 'abcdEFGHIJ', 'abcdEFGHIj', 'abcdEFGHij', 'abcdEFGHiJ', 'abcdEFGhiJ', 'abcdEFGhij', 'abcdEFGhIj', 'abcdEFGhIJ', 'abcdEFghIJ', 'abcdEFghIj', 'abcdEFghij', 'abcdEFghiJ', 'abcdEFgHiJ', 'abcdEFgHij', 'abcdEFgHIj', 'abcdEFgHIJ', 'abcdEfgHIJ', 'abcdEfgHIj', 'abcdEfgHij', 'abcdEfgHiJ', 'abcdEfghiJ', 'abcdEfghij', 'abcdEfghIj', 'abcdEfghIJ', 'abcdEfGhIJ', 'abcdEfGhIj', 'abcdEfGhij', 'abcdEfGhiJ', 'abcdEfGHiJ', 'abcdEfGHij', 'abcdEfGHIj', 'abcdEfGHIJ', 'abcdefGHIJ', 'abcdefGHIj', 'abcdefGHij', 'abcdefGHiJ', 'abcdefGhiJ', 'abcdefGhij', 'abcdefGhIj', 'abcdefGhIJ', 'abcdefghIJ', 'abcdefghIj', 'abcdefghij', 'abcdefghiJ', 'abcdefgHiJ', 'abcdefgHij', 'abcdefgHIj', 'abcdefgHIJ', 'abcdeFgHIJ', 'abcdeFgHIj', 'abcdeFgHij', 'abcdeFgHiJ', 'abcdeFghiJ', 'abcdeFghij', 'abcdeFghIj', 'abcdeFghIJ', 'abcdeFGhIJ', 'abcdeFGhIj', 'abcdeFGhij', 'abcdeFGhiJ', 'abcdeFGHiJ', 'abcdeFGHij', 'abcdeFGHIj', 'abcdeFGHIJ', 'abcDeFGHIJ', 'abcDeFGHIj', 'abcDeFGHij', 'abcDeFGHiJ', 'abcDeFGhiJ', 'abcDeFGhij', 'abcDeFGhIj', 'abcDeFGhIJ', 'abcDeFghIJ', 'abcDeFghIj', 'abcDeFghij', 'abcDeFghiJ', 'abcDeFgHiJ', 'abcDeFgHij', 'abcDeFgHIj', 'abcDeFgHIJ', 'abcDefgHIJ', 'abcDefgHIj', 'abcDefgHij', 'abcDefgHiJ', 'abcDefghiJ', 'abcDefghij', 'abcDefghIj', 'abcDefghIJ', 'abcDefGhIJ', 'abcDefGhIj', 'abcDefGhij', 'abcDefGhiJ', 'abcDefGHiJ', 'abcDefGHij', 'abcDefGHIj', 'abcDefGHIJ', 'abcDEfGHIJ', 'abcDEfGHIj', 'abcDEfGHij', 'abcDEfGHiJ', 'abcDEfGhiJ', 'abcDEfGhij', 'abcDEfGhIj', 'abcDEfGhIJ', 'abcDEfghIJ', 'abcDEfghIj', 'abcDEfghij', 'abcDEfghiJ', 'abcDEfgHiJ', 'abcDEfgHij', 'abcDEfgHIj', 'abcDEfgHIJ', 'abcDEFgHIJ', 'abcDEFgHIj', 'abcDEFgHij', 'abcDEFgHiJ', 'abcDEFghiJ', 'abcDEFghij', 'abcDEFghIj', 'abcDEFghIJ', 'abcDEFGhIJ', 'abcDEFGhIj', 'abcDEFGhij', 'abcDEFGhiJ', 'abcDEFGHiJ', 'abcDEFGHij', 'abcDEFGHIj', 'abcDEFGHIJ', 'aBcDEFGHIJ', 'aBcDEFGHIj', 'aBcDEFGHij', 'aBcDEFGHiJ', 'aBcDEFGhiJ', 'aBcDEFGhij', 'aBcDEFGhIj', 'aBcDEFGhIJ', 'aBcDEFghIJ', 'aBcDEFghIj', 'aBcDEFghij', 'aBcDEFghiJ', 'aBcDEFgHiJ', 'aBcDEFgHij', 'aBcDEFgHIj', 'aBcDEFgHIJ', 'aBcDEfgHIJ', 'aBcDEfgHIj', 'aBcDEfgHij', 'aBcDEfgHiJ', 'aBcDEfghiJ', 'aBcDEfghij', 'aBcDEfghIj', 'aBcDEfghIJ', 'aBcDEfGhIJ', 'aBcDEfGhIj', 'aBcDEfGhij', 'aBcDEfGhiJ', 'aBcDEfGHiJ', 'aBcDEfGHij', 'aBcDEfGHIj', 'aBcDEfGHIJ', 'aBcDefGHIJ', 'aBcDefGHIj', 'aBcDefGHij', 'aBcDefGHiJ', 'aBcDefGhiJ', 'aBcDefGhij', 'aBcDefGhIj', 'aBcDefGhIJ', 'aBcDefghIJ', 'aBcDefghIj', 'aBcDefghij', 'aBcDefghiJ', 'aBcDefgHiJ', 'aBcDefgHij', 'aBcDefgHIj', 'aBcDefgHIJ', 'aBcDeFgHIJ', 'aBcDeFgHIj', 'aBcDeFgHij', 'aBcDeFgHiJ', 'aBcDeFghiJ', 'aBcDeFghij', 'aBcDeFghIj', 'aBcDeFghIJ', 'aBcDeFGhIJ', 'aBcDeFGhIj', 'aBcDeFGhij', 'aBcDeFGhiJ', 'aBcDeFGHiJ', 'aBcDeFGHij', 'aBcDeFGHIj', 'aBcDeFGHIJ', 'aBcdeFGHIJ', 'aBcdeFGHIj', 'aBcdeFGHij', 'aBcdeFGHiJ', 'aBcdeFGhiJ', 'aBcdeFGhij', 'aBcdeFGhIj', 'aBcdeFGhIJ', 'aBcdeFghIJ', 'aBcdeFghIj', 'aBcdeFghij', 'aBcdeFghiJ', 'aBcdeFgHiJ', 'aBcdeFgHij', 'aBcdeFgHIj', 'aBcdeFgHIJ', 'aBcdefgHIJ', 'aBcdefgHIj', 'aBcdefgHij', 'aBcdefgHiJ', 'aBcdefghiJ', 'aBcdefghij', 'aBcdefghIj', 'aBcdefghIJ', 'aBcdefGhIJ', 'aBcdefGhIj', 'aBcdefGhij', 'aBcdefGhiJ', 'aBcdefGHiJ', 'aBcdefGHij', 'aBcdefGHIj', 'aBcdefGHIJ', 'aBcdEfGHIJ', 'aBcdEfGHIj', 'aBcdEfGHij', 'aBcdEfGHiJ', 'aBcdEfGhiJ', 'aBcdEfGhij', 'aBcdEfGhIj', 'aBcdEfGhIJ', 'aBcdEfghIJ', 'aBcdEfghIj', 'aBcdEfghij', 'aBcdEfghiJ', 'aBcdEfgHiJ', 'aBcdEfgHij', 'aBcdEfgHIj', 'aBcdEfgHIJ', 'aBcdEFgHIJ', 'aBcdEFgHIj', 'aBcdEFgHij', 'aBcdEFgHiJ', 'aBcdEFghiJ', 'aBcdEFghij', 'aBcdEFghIj', 'aBcdEFghIJ', 'aBcdEFGhIJ', 'aBcdEFGhIj', 'aBcdEFGhij', 'aBcdEFGhiJ', 'aBcdEFGHiJ', 'aBcdEFGHij', 'aBcdEFGHIj', 'aBcdEFGHIJ', 'aBCdEFGHIJ', 'aBCdEFGHIj', 'aBCdEFGHij', 'aBCdEFGHiJ', 'aBCdEFGhiJ', 'aBCdEFGhij', 'aBCdEFGhIj', 'aBCdEFGhIJ', 'aBCdEFghIJ', 'aBCdEFghIj', 'aBCdEFghij', 'aBCdEFghiJ', 'aBCdEFgHiJ', 'aBCdEFgHij', 'aBCdEFgHIj', 'aBCdEFgHIJ', 'aBCdEfgHIJ', 'aBCdEfgHIj', 'aBCdEfgHij', 'aBCdEfgHiJ', 'aBCdEfghiJ', 'aBCdEfghij', 'aBCdEfghIj', 'aBCdEfghIJ', 'aBCdEfGhIJ', 'aBCdEfGhIj', 'aBCdEfGhij', 'aBCdEfGhiJ', 'aBCdEfGHiJ', 'aBCdEfGHij', 'aBCdEfGHIj', 'aBCdEfGHIJ', 'aBCdefGHIJ', 'aBCdefGHIj', 'aBCdefGHij', 'aBCdefGHiJ', 'aBCdefGhiJ', 'aBCdefGhij', 'aBCdefGhIj', 'aBCdefGhIJ', 'aBCdefghIJ', 'aBCdefghIj', 'aBCdefghij', 'aBCdefghiJ', 'aBCdefgHiJ', 'aBCdefgHij', 'aBCdefgHIj', 'aBCdefgHIJ', 'aBCdeFgHIJ', 'aBCdeFgHIj', 'aBCdeFgHij', 'aBCdeFgHiJ', 'aBCdeFghiJ', 'aBCdeFghij', 'aBCdeFghIj', 'aBCdeFghIJ', 'aBCdeFGhIJ', 'aBCdeFGhIj', 'aBCdeFGhij', 'aBCdeFGhiJ', 'aBCdeFGHiJ', 'aBCdeFGHij', 'aBCdeFGHIj', 'aBCdeFGHIJ', 'aBCDeFGHIJ', 'aBCDeFGHIj', 'aBCDeFGHij', 'aBCDeFGHiJ', 'aBCDeFGhiJ', 'aBCDeFGhij', 'aBCDeFGhIj', 'aBCDeFGhIJ', 'aBCDeFghIJ', 'aBCDeFghIj', 'aBCDeFghij', 'aBCDeFghiJ', 'aBCDeFgHiJ', 'aBCDeFgHij', 'aBCDeFgHIj', 'aBCDeFgHIJ', 'aBCDefgHIJ', 'aBCDefgHIj', 'aBCDefgHij', 'aBCDefgHiJ', 'aBCDefghiJ', 'aBCDefghij', 'aBCDefghIj', 'aBCDefghIJ', 'aBCDefGhIJ', 'aBCDefGhIj', 'aBCDefGhij', 'aBCDefGhiJ', 'aBCDefGHiJ', 'aBCDefGHij', 'aBCDefGHIj', 'aBCDefGHIJ', 'aBCDEfGHIJ', 'aBCDEfGHIj', 'aBCDEfGHij', 'aBCDEfGHiJ', 'aBCDEfGhiJ', 'aBCDEfGhij', 'aBCDEfGhIj', 'aBCDEfGhIJ', 'aBCDEfghIJ', 'aBCDEfghIj', 'aBCDEfghij', 'aBCDEfghiJ', 'aBCDEfgHiJ', 'aBCDEfgHij', 'aBCDEfgHIj', 'aBCDEfgHIJ', 'aBCDEFgHIJ', 'aBCDEFgHIj', 'aBCDEFgHij', 'aBCDEFgHiJ', 'aBCDEFghiJ', 'aBCDEFghij', 'aBCDEFghIj', 'aBCDEFghIJ', 'aBCDEFGhIJ', 'aBCDEFGhIj', 'aBCDEFGhij', 'aBCDEFGhiJ', 'aBCDEFGHiJ', 'aBCDEFGHij', 'aBCDEFGHIj', 'aBCDEFGHIJ']\n assert candidate(s = \"123aB4cD\") == ['123aB4cD', '123aB4cd', '123aB4Cd', '123aB4CD', '123ab4CD', '123ab4Cd', '123ab4cd', '123ab4cD', '123Ab4cD', '123Ab4cd', '123Ab4Cd', '123Ab4CD', '123AB4CD', '123AB4Cd', '123AB4cd', '123AB4cD']\n assert candidate(s = \"abc123ABC\") == ['abc123ABC', 'abc123ABc', 'abc123Abc', 'abc123AbC', 'abc123abC', 'abc123abc', 'abc123aBc', 'abc123aBC', 'abC123aBC', 'abC123aBc', 'abC123abc', 'abC123abC', 'abC123AbC', 'abC123Abc', 'abC123ABc', 'abC123ABC', 'aBC123ABC', 'aBC123ABc', 'aBC123Abc', 'aBC123AbC', 'aBC123abC', 'aBC123abc', 'aBC123aBc', 'aBC123aBC', 'aBc123aBC', 'aBc123aBc', 'aBc123abc', 'aBc123abC', 'aBc123AbC', 'aBc123Abc', 'aBc123ABc', 'aBc123ABC', 'ABc123ABC', 'ABc123ABc', 'ABc123Abc', 'ABc123AbC', 'ABc123abC', 'ABc123abc', 'ABc123aBc', 'ABc123aBC', 'ABC123aBC', 'ABC123aBc', 'ABC123abc', 'ABC123abC', 'ABC123AbC', 'ABC123Abc', 'ABC123ABc', 'ABC123ABC', 'AbC123ABC', 'AbC123ABc', 'AbC123Abc', 'AbC123AbC', 'AbC123abC', 'AbC123abc', 'AbC123aBc', 'AbC123aBC', 'Abc123aBC', 'Abc123aBc', 'Abc123abc', 'Abc123abC', 'Abc123AbC', 'Abc123Abc', 'Abc123ABc', 'Abc123ABC']\n assert candidate(s = \"123ABCdef\") == ['123ABCdef', '123ABCdeF', '123ABCdEF', '123ABCdEf', '123ABCDEf', '123ABCDEF', '123ABCDeF', '123ABCDef', '123ABcDef', '123ABcDeF', '123ABcDEF', '123ABcDEf', '123ABcdEf', '123ABcdEF', '123ABcdeF', '123ABcdef', '123Abcdef', '123AbcdeF', '123AbcdEF', '123AbcdEf', '123AbcDEf', '123AbcDEF', '123AbcDeF', '123AbcDef', '123AbCDef', '123AbCDeF', '123AbCDEF', '123AbCDEf', '123AbCdEf', '123AbCdEF', '123AbCdeF', '123AbCdef', '123abCdef', '123abCdeF', '123abCdEF', '123abCdEf', '123abCDEf', '123abCDEF', '123abCDeF', '123abCDef', '123abcDef', '123abcDeF', '123abcDEF', '123abcDEf', '123abcdEf', '123abcdEF', '123abcdeF', '123abcdef', '123aBcdef', '123aBcdeF', '123aBcdEF', '123aBcdEf', '123aBcDEf', '123aBcDEF', '123aBcDeF', '123aBcDef', '123aBCDef', '123aBCDeF', '123aBCDEF', '123aBCDEf', '123aBCdEf', '123aBCdEF', '123aBCdeF', '123aBCdef']\n assert candidate(s = \"12a3b4c5d\") == ['12a3b4c5d', '12a3b4c5D', '12a3b4C5D', '12a3b4C5d', '12a3B4C5d', '12a3B4C5D', '12a3B4c5D', '12a3B4c5d', '12A3B4c5d', '12A3B4c5D', '12A3B4C5D', '12A3B4C5d', '12A3b4C5d', '12A3b4C5D', '12A3b4c5D', '12A3b4c5d']\n assert candidate(s = \"abcd\") == ['abcd', 'abcD', 'abCD', 'abCd', 'aBCd', 'aBCD', 'aBcD', 'aBcd', 'ABcd', 'ABcD', 'ABCD', 'ABCd', 'AbCd', 'AbCD', 'AbcD', 'Abcd']\n assert candidate(s = \"a1B2c3D4e5F6g7H8i9J0\") == ['a1B2c3D4e5F6g7H8i9J0', 'a1B2c3D4e5F6g7H8i9j0', 'a1B2c3D4e5F6g7H8I9j0', 'a1B2c3D4e5F6g7H8I9J0', 'a1B2c3D4e5F6g7h8I9J0', 'a1B2c3D4e5F6g7h8I9j0', 'a1B2c3D4e5F6g7h8i9j0', 'a1B2c3D4e5F6g7h8i9J0', 'a1B2c3D4e5F6G7h8i9J0', 'a1B2c3D4e5F6G7h8i9j0', 'a1B2c3D4e5F6G7h8I9j0', 'a1B2c3D4e5F6G7h8I9J0', 'a1B2c3D4e5F6G7H8I9J0', 'a1B2c3D4e5F6G7H8I9j0', 'a1B2c3D4e5F6G7H8i9j0', 'a1B2c3D4e5F6G7H8i9J0', 'a1B2c3D4e5f6G7H8i9J0', 'a1B2c3D4e5f6G7H8i9j0', 'a1B2c3D4e5f6G7H8I9j0', 'a1B2c3D4e5f6G7H8I9J0', 'a1B2c3D4e5f6G7h8I9J0', 'a1B2c3D4e5f6G7h8I9j0', 'a1B2c3D4e5f6G7h8i9j0', 'a1B2c3D4e5f6G7h8i9J0', 'a1B2c3D4e5f6g7h8i9J0', 'a1B2c3D4e5f6g7h8i9j0', 'a1B2c3D4e5f6g7h8I9j0', 'a1B2c3D4e5f6g7h8I9J0', 'a1B2c3D4e5f6g7H8I9J0', 'a1B2c3D4e5f6g7H8I9j0', 'a1B2c3D4e5f6g7H8i9j0', 'a1B2c3D4e5f6g7H8i9J0', 'a1B2c3D4E5f6g7H8i9J0', 'a1B2c3D4E5f6g7H8i9j0', 'a1B2c3D4E5f6g7H8I9j0', 'a1B2c3D4E5f6g7H8I9J0', 'a1B2c3D4E5f6g7h8I9J0', 'a1B2c3D4E5f6g7h8I9j0', 'a1B2c3D4E5f6g7h8i9j0', 'a1B2c3D4E5f6g7h8i9J0', 'a1B2c3D4E5f6G7h8i9J0', 'a1B2c3D4E5f6G7h8i9j0', 'a1B2c3D4E5f6G7h8I9j0', 'a1B2c3D4E5f6G7h8I9J0', 'a1B2c3D4E5f6G7H8I9J0', 'a1B2c3D4E5f6G7H8I9j0', 'a1B2c3D4E5f6G7H8i9j0', 'a1B2c3D4E5f6G7H8i9J0', 'a1B2c3D4E5F6G7H8i9J0', 'a1B2c3D4E5F6G7H8i9j0', 'a1B2c3D4E5F6G7H8I9j0', 'a1B2c3D4E5F6G7H8I9J0', 'a1B2c3D4E5F6G7h8I9J0', 'a1B2c3D4E5F6G7h8I9j0', 'a1B2c3D4E5F6G7h8i9j0', 'a1B2c3D4E5F6G7h8i9J0', 'a1B2c3D4E5F6g7h8i9J0', 'a1B2c3D4E5F6g7h8i9j0', 'a1B2c3D4E5F6g7h8I9j0', 'a1B2c3D4E5F6g7h8I9J0', 'a1B2c3D4E5F6g7H8I9J0', 'a1B2c3D4E5F6g7H8I9j0', 'a1B2c3D4E5F6g7H8i9j0', 'a1B2c3D4E5F6g7H8i9J0', 'a1B2c3d4E5F6g7H8i9J0', 'a1B2c3d4E5F6g7H8i9j0', 'a1B2c3d4E5F6g7H8I9j0', 'a1B2c3d4E5F6g7H8I9J0', 'a1B2c3d4E5F6g7h8I9J0', 'a1B2c3d4E5F6g7h8I9j0', 'a1B2c3d4E5F6g7h8i9j0', 'a1B2c3d4E5F6g7h8i9J0', 'a1B2c3d4E5F6G7h8i9J0', 'a1B2c3d4E5F6G7h8i9j0', 'a1B2c3d4E5F6G7h8I9j0', 'a1B2c3d4E5F6G7h8I9J0', 'a1B2c3d4E5F6G7H8I9J0', 'a1B2c3d4E5F6G7H8I9j0', 'a1B2c3d4E5F6G7H8i9j0', 'a1B2c3d4E5F6G7H8i9J0', 'a1B2c3d4E5f6G7H8i9J0', 'a1B2c3d4E5f6G7H8i9j0', 'a1B2c3d4E5f6G7H8I9j0', 'a1B2c3d4E5f6G7H8I9J0', 'a1B2c3d4E5f6G7h8I9J0', 'a1B2c3d4E5f6G7h8I9j0', 'a1B2c3d4E5f6G7h8i9j0', 'a1B2c3d4E5f6G7h8i9J0', 'a1B2c3d4E5f6g7h8i9J0', 'a1B2c3d4E5f6g7h8i9j0', 'a1B2c3d4E5f6g7h8I9j0', 'a1B2c3d4E5f6g7h8I9J0', 'a1B2c3d4E5f6g7H8I9J0', 'a1B2c3d4E5f6g7H8I9j0', 'a1B2c3d4E5f6g7H8i9j0', 'a1B2c3d4E5f6g7H8i9J0', 'a1B2c3d4e5f6g7H8i9J0', 'a1B2c3d4e5f6g7H8i9j0', 'a1B2c3d4e5f6g7H8I9j0', 'a1B2c3d4e5f6g7H8I9J0', 'a1B2c3d4e5f6g7h8I9J0', 'a1B2c3d4e5f6g7h8I9j0', 'a1B2c3d4e5f6g7h8i9j0', 'a1B2c3d4e5f6g7h8i9J0', 'a1B2c3d4e5f6G7h8i9J0', 'a1B2c3d4e5f6G7h8i9j0', 'a1B2c3d4e5f6G7h8I9j0', 'a1B2c3d4e5f6G7h8I9J0', 'a1B2c3d4e5f6G7H8I9J0', 'a1B2c3d4e5f6G7H8I9j0', 'a1B2c3d4e5f6G7H8i9j0', 'a1B2c3d4e5f6G7H8i9J0', 'a1B2c3d4e5F6G7H8i9J0', 'a1B2c3d4e5F6G7H8i9j0', 'a1B2c3d4e5F6G7H8I9j0', 'a1B2c3d4e5F6G7H8I9J0', 'a1B2c3d4e5F6G7h8I9J0', 'a1B2c3d4e5F6G7h8I9j0', 'a1B2c3d4e5F6G7h8i9j0', 'a1B2c3d4e5F6G7h8i9J0', 'a1B2c3d4e5F6g7h8i9J0', 'a1B2c3d4e5F6g7h8i9j0', 'a1B2c3d4e5F6g7h8I9j0', 'a1B2c3d4e5F6g7h8I9J0', 'a1B2c3d4e5F6g7H8I9J0', 'a1B2c3d4e5F6g7H8I9j0', 'a1B2c3d4e5F6g7H8i9j0', 'a1B2c3d4e5F6g7H8i9J0', 'a1B2C3d4e5F6g7H8i9J0', 'a1B2C3d4e5F6g7H8i9j0', 'a1B2C3d4e5F6g7H8I9j0', 'a1B2C3d4e5F6g7H8I9J0', 'a1B2C3d4e5F6g7h8I9J0', 'a1B2C3d4e5F6g7h8I9j0', 'a1B2C3d4e5F6g7h8i9j0', 'a1B2C3d4e5F6g7h8i9J0', 'a1B2C3d4e5F6G7h8i9J0', 'a1B2C3d4e5F6G7h8i9j0', 'a1B2C3d4e5F6G7h8I9j0', 'a1B2C3d4e5F6G7h8I9J0', 'a1B2C3d4e5F6G7H8I9J0', 'a1B2C3d4e5F6G7H8I9j0', 'a1B2C3d4e5F6G7H8i9j0', 'a1B2C3d4e5F6G7H8i9J0', 'a1B2C3d4e5f6G7H8i9J0', 'a1B2C3d4e5f6G7H8i9j0', 'a1B2C3d4e5f6G7H8I9j0', 'a1B2C3d4e5f6G7H8I9J0', 'a1B2C3d4e5f6G7h8I9J0', 'a1B2C3d4e5f6G7h8I9j0', 'a1B2C3d4e5f6G7h8i9j0', 'a1B2C3d4e5f6G7h8i9J0', 'a1B2C3d4e5f6g7h8i9J0', 'a1B2C3d4e5f6g7h8i9j0', 'a1B2C3d4e5f6g7h8I9j0', 'a1B2C3d4e5f6g7h8I9J0', 'a1B2C3d4e5f6g7H8I9J0', 'a1B2C3d4e5f6g7H8I9j0', 'a1B2C3d4e5f6g7H8i9j0', 'a1B2C3d4e5f6g7H8i9J0', 'a1B2C3d4E5f6g7H8i9J0', 'a1B2C3d4E5f6g7H8i9j0', 'a1B2C3d4E5f6g7H8I9j0', 'a1B2C3d4E5f6g7H8I9J0', 'a1B2C3d4E5f6g7h8I9J0', 'a1B2C3d4E5f6g7h8I9j0', 'a1B2C3d4E5f6g7h8i9j0', 'a1B2C3d4E5f6g7h8i9J0', 'a1B2C3d4E5f6G7h8i9J0', 'a1B2C3d4E5f6G7h8i9j0', 'a1B2C3d4E5f6G7h8I9j0', 'a1B2C3d4E5f6G7h8I9J0', 'a1B2C3d4E5f6G7H8I9J0', 'a1B2C3d4E5f6G7H8I9j0', 'a1B2C3d4E5f6G7H8i9j0', 'a1B2C3d4E5f6G7H8i9J0', 'a1B2C3d4E5F6G7H8i9J0', 'a1B2C3d4E5F6G7H8i9j0', 'a1B2C3d4E5F6G7H8I9j0', 'a1B2C3d4E5F6G7H8I9J0', 'a1B2C3d4E5F6G7h8I9J0', 'a1B2C3d4E5F6G7h8I9j0', 'a1B2C3d4E5F6G7h8i9j0', 'a1B2C3d4E5F6G7h8i9J0', 'a1B2C3d4E5F6g7h8i9J0', 'a1B2C3d4E5F6g7h8i9j0', 'a1B2C3d4E5F6g7h8I9j0', 'a1B2C3d4E5F6g7h8I9J0', 'a1B2C3d4E5F6g7H8I9J0', 'a1B2C3d4E5F6g7H8I9j0', 'a1B2C3d4E5F6g7H8i9j0', 'a1B2C3d4E5F6g7H8i9J0', 'a1B2C3D4E5F6g7H8i9J0', 'a1B2C3D4E5F6g7H8i9j0', 'a1B2C3D4E5F6g7H8I9j0', 'a1B2C3D4E5F6g7H8I9J0', 'a1B2C3D4E5F6g7h8I9J0', 'a1B2C3D4E5F6g7h8I9j0', 'a1B2C3D4E5F6g7h8i9j0', 'a1B2C3D4E5F6g7h8i9J0', 'a1B2C3D4E5F6G7h8i9J0', 'a1B2C3D4E5F6G7h8i9j0', 'a1B2C3D4E5F6G7h8I9j0', 'a1B2C3D4E5F6G7h8I9J0', 'a1B2C3D4E5F6G7H8I9J0', 'a1B2C3D4E5F6G7H8I9j0', 'a1B2C3D4E5F6G7H8i9j0', 'a1B2C3D4E5F6G7H8i9J0', 'a1B2C3D4E5f6G7H8i9J0', 'a1B2C3D4E5f6G7H8i9j0', 'a1B2C3D4E5f6G7H8I9j0', 'a1B2C3D4E5f6G7H8I9J0', 'a1B2C3D4E5f6G7h8I9J0', 'a1B2C3D4E5f6G7h8I9j0', 'a1B2C3D4E5f6G7h8i9j0', 'a1B2C3D4E5f6G7h8i9J0', 'a1B2C3D4E5f6g7h8i9J0', 'a1B2C3D4E5f6g7h8i9j0', 'a1B2C3D4E5f6g7h8I9j0', 'a1B2C3D4E5f6g7h8I9J0', 'a1B2C3D4E5f6g7H8I9J0', 'a1B2C3D4E5f6g7H8I9j0', 'a1B2C3D4E5f6g7H8i9j0', 'a1B2C3D4E5f6g7H8i9J0', 'a1B2C3D4e5f6g7H8i9J0', 'a1B2C3D4e5f6g7H8i9j0', 'a1B2C3D4e5f6g7H8I9j0', 'a1B2C3D4e5f6g7H8I9J0', 'a1B2C3D4e5f6g7h8I9J0', 'a1B2C3D4e5f6g7h8I9j0', 'a1B2C3D4e5f6g7h8i9j0', 'a1B2C3D4e5f6g7h8i9J0', 'a1B2C3D4e5f6G7h8i9J0', 'a1B2C3D4e5f6G7h8i9j0', 'a1B2C3D4e5f6G7h8I9j0', 'a1B2C3D4e5f6G7h8I9J0', 'a1B2C3D4e5f6G7H8I9J0', 'a1B2C3D4e5f6G7H8I9j0', 'a1B2C3D4e5f6G7H8i9j0', 'a1B2C3D4e5f6G7H8i9J0', 'a1B2C3D4e5F6G7H8i9J0', 'a1B2C3D4e5F6G7H8i9j0', 'a1B2C3D4e5F6G7H8I9j0', 'a1B2C3D4e5F6G7H8I9J0', 'a1B2C3D4e5F6G7h8I9J0', 'a1B2C3D4e5F6G7h8I9j0', 'a1B2C3D4e5F6G7h8i9j0', 'a1B2C3D4e5F6G7h8i9J0', 'a1B2C3D4e5F6g7h8i9J0', 'a1B2C3D4e5F6g7h8i9j0', 'a1B2C3D4e5F6g7h8I9j0', 'a1B2C3D4e5F6g7h8I9J0', 'a1B2C3D4e5F6g7H8I9J0', 'a1B2C3D4e5F6g7H8I9j0', 'a1B2C3D4e5F6g7H8i9j0', 'a1B2C3D4e5F6g7H8i9J0', 'a1b2C3D4e5F6g7H8i9J0', 'a1b2C3D4e5F6g7H8i9j0', 'a1b2C3D4e5F6g7H8I9j0', 'a1b2C3D4e5F6g7H8I9J0', 'a1b2C3D4e5F6g7h8I9J0', 'a1b2C3D4e5F6g7h8I9j0', 'a1b2C3D4e5F6g7h8i9j0', 'a1b2C3D4e5F6g7h8i9J0', 'a1b2C3D4e5F6G7h8i9J0', 'a1b2C3D4e5F6G7h8i9j0', 'a1b2C3D4e5F6G7h8I9j0', 'a1b2C3D4e5F6G7h8I9J0', 'a1b2C3D4e5F6G7H8I9J0', 'a1b2C3D4e5F6G7H8I9j0', 'a1b2C3D4e5F6G7H8i9j0', 'a1b2C3D4e5F6G7H8i9J0', 'a1b2C3D4e5f6G7H8i9J0', 'a1b2C3D4e5f6G7H8i9j0', 'a1b2C3D4e5f6G7H8I9j0', 'a1b2C3D4e5f6G7H8I9J0', 'a1b2C3D4e5f6G7h8I9J0', 'a1b2C3D4e5f6G7h8I9j0', 'a1b2C3D4e5f6G7h8i9j0', 'a1b2C3D4e5f6G7h8i9J0', 'a1b2C3D4e5f6g7h8i9J0', 'a1b2C3D4e5f6g7h8i9j0', 'a1b2C3D4e5f6g7h8I9j0', 'a1b2C3D4e5f6g7h8I9J0', 'a1b2C3D4e5f6g7H8I9J0', 'a1b2C3D4e5f6g7H8I9j0', 'a1b2C3D4e5f6g7H8i9j0', 'a1b2C3D4e5f6g7H8i9J0', 'a1b2C3D4E5f6g7H8i9J0', 'a1b2C3D4E5f6g7H8i9j0', 'a1b2C3D4E5f6g7H8I9j0', 'a1b2C3D4E5f6g7H8I9J0', 'a1b2C3D4E5f6g7h8I9J0', 'a1b2C3D4E5f6g7h8I9j0', 'a1b2C3D4E5f6g7h8i9j0', 'a1b2C3D4E5f6g7h8i9J0', 'a1b2C3D4E5f6G7h8i9J0', 'a1b2C3D4E5f6G7h8i9j0', 'a1b2C3D4E5f6G7h8I9j0', 'a1b2C3D4E5f6G7h8I9J0', 'a1b2C3D4E5f6G7H8I9J0', 'a1b2C3D4E5f6G7H8I9j0', 'a1b2C3D4E5f6G7H8i9j0', 'a1b2C3D4E5f6G7H8i9J0', 'a1b2C3D4E5F6G7H8i9J0', 'a1b2C3D4E5F6G7H8i9j0', 'a1b2C3D4E5F6G7H8I9j0', 'a1b2C3D4E5F6G7H8I9J0', 'a1b2C3D4E5F6G7h8I9J0', 'a1b2C3D4E5F6G7h8I9j0', 'a1b2C3D4E5F6G7h8i9j0', 'a1b2C3D4E5F6G7h8i9J0', 'a1b2C3D4E5F6g7h8i9J0', 'a1b2C3D4E5F6g7h8i9j0', 'a1b2C3D4E5F6g7h8I9j0', 'a1b2C3D4E5F6g7h8I9J0', 'a1b2C3D4E5F6g7H8I9J0', 'a1b2C3D4E5F6g7H8I9j0', 'a1b2C3D4E5F6g7H8i9j0', 'a1b2C3D4E5F6g7H8i9J0', 'a1b2C3d4E5F6g7H8i9J0', 'a1b2C3d4E5F6g7H8i9j0', 'a1b2C3d4E5F6g7H8I9j0', 'a1b2C3d4E5F6g7H8I9J0', 'a1b2C3d4E5F6g7h8I9J0', 'a1b2C3d4E5F6g7h8I9j0', 'a1b2C3d4E5F6g7h8i9j0', 'a1b2C3d4E5F6g7h8i9J0', 'a1b2C3d4E5F6G7h8i9J0', 'a1b2C3d4E5F6G7h8i9j0', 'a1b2C3d4E5F6G7h8I9j0', 'a1b2C3d4E5F6G7h8I9J0', 'a1b2C3d4E5F6G7H8I9J0', 'a1b2C3d4E5F6G7H8I9j0', 'a1b2C3d4E5F6G7H8i9j0', 'a1b2C3d4E5F6G7H8i9J0', 'a1b2C3d4E5f6G7H8i9J0', 'a1b2C3d4E5f6G7H8i9j0', 'a1b2C3d4E5f6G7H8I9j0', 'a1b2C3d4E5f6G7H8I9J0', 'a1b2C3d4E5f6G7h8I9J0', 'a1b2C3d4E5f6G7h8I9j0', 'a1b2C3d4E5f6G7h8i9j0', 'a1b2C3d4E5f6G7h8i9J0', 'a1b2C3d4E5f6g7h8i9J0', 'a1b2C3d4E5f6g7h8i9j0', 'a1b2C3d4E5f6g7h8I9j0', 'a1b2C3d4E5f6g7h8I9J0', 'a1b2C3d4E5f6g7H8I9J0', 'a1b2C3d4E5f6g7H8I9j0', 'a1b2C3d4E5f6g7H8i9j0', 'a1b2C3d4E5f6g7H8i9J0', 'a1b2C3d4e5f6g7H8i9J0', 'a1b2C3d4e5f6g7H8i9j0', 'a1b2C3d4e5f6g7H8I9j0', 'a1b2C3d4e5f6g7H8I9J0', 'a1b2C3d4e5f6g7h8I9J0', 'a1b2C3d4e5f6g7h8I9j0', 'a1b2C3d4e5f6g7h8i9j0', 'a1b2C3d4e5f6g7h8i9J0', 'a1b2C3d4e5f6G7h8i9J0', 'a1b2C3d4e5f6G7h8i9j0', 'a1b2C3d4e5f6G7h8I9j0', 'a1b2C3d4e5f6G7h8I9J0', 'a1b2C3d4e5f6G7H8I9J0', 'a1b2C3d4e5f6G7H8I9j0', 'a1b2C3d4e5f6G7H8i9j0', 'a1b2C3d4e5f6G7H8i9J0', 'a1b2C3d4e5F6G7H8i9J0', 'a1b2C3d4e5F6G7H8i9j0', 'a1b2C3d4e5F6G7H8I9j0', 'a1b2C3d4e5F6G7H8I9J0', 'a1b2C3d4e5F6G7h8I9J0', 'a1b2C3d4e5F6G7h8I9j0', 'a1b2C3d4e5F6G7h8i9j0', 'a1b2C3d4e5F6G7h8i9J0', 'a1b2C3d4e5F6g7h8i9J0', 'a1b2C3d4e5F6g7h8i9j0', 'a1b2C3d4e5F6g7h8I9j0', 'a1b2C3d4e5F6g7h8I9J0', 'a1b2C3d4e5F6g7H8I9J0', 'a1b2C3d4e5F6g7H8I9j0', 'a1b2C3d4e5F6g7H8i9j0', 'a1b2C3d4e5F6g7H8i9J0', 'a1b2c3d4e5F6g7H8i9J0', 'a1b2c3d4e5F6g7H8i9j0', 'a1b2c3d4e5F6g7H8I9j0', 'a1b2c3d4e5F6g7H8I9J0', 'a1b2c3d4e5F6g7h8I9J0', 'a1b2c3d4e5F6g7h8I9j0', 'a1b2c3d4e5F6g7h8i9j0', 'a1b2c3d4e5F6g7h8i9J0', 'a1b2c3d4e5F6G7h8i9J0', 'a1b2c3d4e5F6G7h8i9j0', 'a1b2c3d4e5F6G7h8I9j0', 'a1b2c3d4e5F6G7h8I9J0', 'a1b2c3d4e5F6G7H8I9J0', 'a1b2c3d4e5F6G7H8I9j0', 'a1b2c3d4e5F6G7H8i9j0', 'a1b2c3d4e5F6G7H8i9J0', 'a1b2c3d4e5f6G7H8i9J0', 'a1b2c3d4e5f6G7H8i9j0', 'a1b2c3d4e5f6G7H8I9j0', 'a1b2c3d4e5f6G7H8I9J0', 'a1b2c3d4e5f6G7h8I9J0', 'a1b2c3d4e5f6G7h8I9j0', 'a1b2c3d4e5f6G7h8i9j0', 'a1b2c3d4e5f6G7h8i9J0', 'a1b2c3d4e5f6g7h8i9J0', 'a1b2c3d4e5f6g7h8i9j0', 'a1b2c3d4e5f6g7h8I9j0', 'a1b2c3d4e5f6g7h8I9J0', 'a1b2c3d4e5f6g7H8I9J0', 'a1b2c3d4e5f6g7H8I9j0', 'a1b2c3d4e5f6g7H8i9j0', 'a1b2c3d4e5f6g7H8i9J0', 'a1b2c3d4E5f6g7H8i9J0', 'a1b2c3d4E5f6g7H8i9j0', 'a1b2c3d4E5f6g7H8I9j0', 'a1b2c3d4E5f6g7H8I9J0', 'a1b2c3d4E5f6g7h8I9J0', 'a1b2c3d4E5f6g7h8I9j0', 'a1b2c3d4E5f6g7h8i9j0', 'a1b2c3d4E5f6g7h8i9J0', 'a1b2c3d4E5f6G7h8i9J0', 'a1b2c3d4E5f6G7h8i9j0', 'a1b2c3d4E5f6G7h8I9j0', 'a1b2c3d4E5f6G7h8I9J0', 'a1b2c3d4E5f6G7H8I9J0', 'a1b2c3d4E5f6G7H8I9j0', 'a1b2c3d4E5f6G7H8i9j0', 'a1b2c3d4E5f6G7H8i9J0', 'a1b2c3d4E5F6G7H8i9J0', 'a1b2c3d4E5F6G7H8i9j0', 'a1b2c3d4E5F6G7H8I9j0', 'a1b2c3d4E5F6G7H8I9J0', 'a1b2c3d4E5F6G7h8I9J0', 'a1b2c3d4E5F6G7h8I9j0', 'a1b2c3d4E5F6G7h8i9j0', 'a1b2c3d4E5F6G7h8i9J0', 'a1b2c3d4E5F6g7h8i9J0', 'a1b2c3d4E5F6g7h8i9j0', 'a1b2c3d4E5F6g7h8I9j0', 'a1b2c3d4E5F6g7h8I9J0', 'a1b2c3d4E5F6g7H8I9J0', 'a1b2c3d4E5F6g7H8I9j0', 'a1b2c3d4E5F6g7H8i9j0', 'a1b2c3d4E5F6g7H8i9J0', 'a1b2c3D4E5F6g7H8i9J0', 'a1b2c3D4E5F6g7H8i9j0', 'a1b2c3D4E5F6g7H8I9j0', 'a1b2c3D4E5F6g7H8I9J0', 'a1b2c3D4E5F6g7h8I9J0', 'a1b2c3D4E5F6g7h8I9j0', 'a1b2c3D4E5F6g7h8i9j0', 'a1b2c3D4E5F6g7h8i9J0', 'a1b2c3D4E5F6G7h8i9J0', 'a1b2c3D4E5F6G7h8i9j0', 'a1b2c3D4E5F6G7h8I9j0', 'a1b2c3D4E5F6G7h8I9J0', 'a1b2c3D4E5F6G7H8I9J0', 'a1b2c3D4E5F6G7H8I9j0', 'a1b2c3D4E5F6G7H8i9j0', 'a1b2c3D4E5F6G7H8i9J0', 'a1b2c3D4E5f6G7H8i9J0', 'a1b2c3D4E5f6G7H8i9j0', 'a1b2c3D4E5f6G7H8I9j0', 'a1b2c3D4E5f6G7H8I9J0', 'a1b2c3D4E5f6G7h8I9J0', 'a1b2c3D4E5f6G7h8I9j0', 'a1b2c3D4E5f6G7h8i9j0', 'a1b2c3D4E5f6G7h8i9J0', 'a1b2c3D4E5f6g7h8i9J0', 'a1b2c3D4E5f6g7h8i9j0', 'a1b2c3D4E5f6g7h8I9j0', 'a1b2c3D4E5f6g7h8I9J0', 'a1b2c3D4E5f6g7H8I9J0', 'a1b2c3D4E5f6g7H8I9j0', 'a1b2c3D4E5f6g7H8i9j0', 'a1b2c3D4E5f6g7H8i9J0', 'a1b2c3D4e5f6g7H8i9J0', 'a1b2c3D4e5f6g7H8i9j0', 'a1b2c3D4e5f6g7H8I9j0', 'a1b2c3D4e5f6g7H8I9J0', 'a1b2c3D4e5f6g7h8I9J0', 'a1b2c3D4e5f6g7h8I9j0', 'a1b2c3D4e5f6g7h8i9j0', 'a1b2c3D4e5f6g7h8i9J0', 'a1b2c3D4e5f6G7h8i9J0', 'a1b2c3D4e5f6G7h8i9j0', 'a1b2c3D4e5f6G7h8I9j0', 'a1b2c3D4e5f6G7h8I9J0', 'a1b2c3D4e5f6G7H8I9J0', 'a1b2c3D4e5f6G7H8I9j0', 'a1b2c3D4e5f6G7H8i9j0', 'a1b2c3D4e5f6G7H8i9J0', 'a1b2c3D4e5F6G7H8i9J0', 'a1b2c3D4e5F6G7H8i9j0', 'a1b2c3D4e5F6G7H8I9j0', 'a1b2c3D4e5F6G7H8I9J0', 'a1b2c3D4e5F6G7h8I9J0', 'a1b2c3D4e5F6G7h8I9j0', 'a1b2c3D4e5F6G7h8i9j0', 'a1b2c3D4e5F6G7h8i9J0', 'a1b2c3D4e5F6g7h8i9J0', 'a1b2c3D4e5F6g7h8i9j0', 'a1b2c3D4e5F6g7h8I9j0', 'a1b2c3D4e5F6g7h8I9J0', 'a1b2c3D4e5F6g7H8I9J0', 'a1b2c3D4e5F6g7H8I9j0', 'a1b2c3D4e5F6g7H8i9j0', 'a1b2c3D4e5F6g7H8i9J0', 'A1b2c3D4e5F6g7H8i9J0', 'A1b2c3D4e5F6g7H8i9j0', 'A1b2c3D4e5F6g7H8I9j0', 'A1b2c3D4e5F6g7H8I9J0', 'A1b2c3D4e5F6g7h8I9J0', 'A1b2c3D4e5F6g7h8I9j0', 'A1b2c3D4e5F6g7h8i9j0', 'A1b2c3D4e5F6g7h8i9J0', 'A1b2c3D4e5F6G7h8i9J0', 'A1b2c3D4e5F6G7h8i9j0', 'A1b2c3D4e5F6G7h8I9j0', 'A1b2c3D4e5F6G7h8I9J0', 'A1b2c3D4e5F6G7H8I9J0', 'A1b2c3D4e5F6G7H8I9j0', 'A1b2c3D4e5F6G7H8i9j0', 'A1b2c3D4e5F6G7H8i9J0', 'A1b2c3D4e5f6G7H8i9J0', 'A1b2c3D4e5f6G7H8i9j0', 'A1b2c3D4e5f6G7H8I9j0', 'A1b2c3D4e5f6G7H8I9J0', 'A1b2c3D4e5f6G7h8I9J0', 'A1b2c3D4e5f6G7h8I9j0', 'A1b2c3D4e5f6G7h8i9j0', 'A1b2c3D4e5f6G7h8i9J0', 'A1b2c3D4e5f6g7h8i9J0', 'A1b2c3D4e5f6g7h8i9j0', 'A1b2c3D4e5f6g7h8I9j0', 'A1b2c3D4e5f6g7h8I9J0', 'A1b2c3D4e5f6g7H8I9J0', 'A1b2c3D4e5f6g7H8I9j0', 'A1b2c3D4e5f6g7H8i9j0', 'A1b2c3D4e5f6g7H8i9J0', 'A1b2c3D4E5f6g7H8i9J0', 'A1b2c3D4E5f6g7H8i9j0', 'A1b2c3D4E5f6g7H8I9j0', 'A1b2c3D4E5f6g7H8I9J0', 'A1b2c3D4E5f6g7h8I9J0', 'A1b2c3D4E5f6g7h8I9j0', 'A1b2c3D4E5f6g7h8i9j0', 'A1b2c3D4E5f6g7h8i9J0', 'A1b2c3D4E5f6G7h8i9J0', 'A1b2c3D4E5f6G7h8i9j0', 'A1b2c3D4E5f6G7h8I9j0', 'A1b2c3D4E5f6G7h8I9J0', 'A1b2c3D4E5f6G7H8I9J0', 'A1b2c3D4E5f6G7H8I9j0', 'A1b2c3D4E5f6G7H8i9j0', 'A1b2c3D4E5f6G7H8i9J0', 'A1b2c3D4E5F6G7H8i9J0', 'A1b2c3D4E5F6G7H8i9j0', 'A1b2c3D4E5F6G7H8I9j0', 'A1b2c3D4E5F6G7H8I9J0', 'A1b2c3D4E5F6G7h8I9J0', 'A1b2c3D4E5F6G7h8I9j0', 'A1b2c3D4E5F6G7h8i9j0', 'A1b2c3D4E5F6G7h8i9J0', 'A1b2c3D4E5F6g7h8i9J0', 'A1b2c3D4E5F6g7h8i9j0', 'A1b2c3D4E5F6g7h8I9j0', 'A1b2c3D4E5F6g7h8I9J0', 'A1b2c3D4E5F6g7H8I9J0', 'A1b2c3D4E5F6g7H8I9j0', 'A1b2c3D4E5F6g7H8i9j0', 'A1b2c3D4E5F6g7H8i9J0', 'A1b2c3d4E5F6g7H8i9J0', 'A1b2c3d4E5F6g7H8i9j0', 'A1b2c3d4E5F6g7H8I9j0', 'A1b2c3d4E5F6g7H8I9J0', 'A1b2c3d4E5F6g7h8I9J0', 'A1b2c3d4E5F6g7h8I9j0', 'A1b2c3d4E5F6g7h8i9j0', 'A1b2c3d4E5F6g7h8i9J0', 'A1b2c3d4E5F6G7h8i9J0', 'A1b2c3d4E5F6G7h8i9j0', 'A1b2c3d4E5F6G7h8I9j0', 'A1b2c3d4E5F6G7h8I9J0', 'A1b2c3d4E5F6G7H8I9J0', 'A1b2c3d4E5F6G7H8I9j0', 'A1b2c3d4E5F6G7H8i9j0', 'A1b2c3d4E5F6G7H8i9J0', 'A1b2c3d4E5f6G7H8i9J0', 'A1b2c3d4E5f6G7H8i9j0', 'A1b2c3d4E5f6G7H8I9j0', 'A1b2c3d4E5f6G7H8I9J0', 'A1b2c3d4E5f6G7h8I9J0', 'A1b2c3d4E5f6G7h8I9j0', 'A1b2c3d4E5f6G7h8i9j0', 'A1b2c3d4E5f6G7h8i9J0', 'A1b2c3d4E5f6g7h8i9J0', 'A1b2c3d4E5f6g7h8i9j0', 'A1b2c3d4E5f6g7h8I9j0', 'A1b2c3d4E5f6g7h8I9J0', 'A1b2c3d4E5f6g7H8I9J0', 'A1b2c3d4E5f6g7H8I9j0', 'A1b2c3d4E5f6g7H8i9j0', 'A1b2c3d4E5f6g7H8i9J0', 'A1b2c3d4e5f6g7H8i9J0', 'A1b2c3d4e5f6g7H8i9j0', 'A1b2c3d4e5f6g7H8I9j0', 'A1b2c3d4e5f6g7H8I9J0', 'A1b2c3d4e5f6g7h8I9J0', 'A1b2c3d4e5f6g7h8I9j0', 'A1b2c3d4e5f6g7h8i9j0', 'A1b2c3d4e5f6g7h8i9J0', 'A1b2c3d4e5f6G7h8i9J0', 'A1b2c3d4e5f6G7h8i9j0', 'A1b2c3d4e5f6G7h8I9j0', 'A1b2c3d4e5f6G7h8I9J0', 'A1b2c3d4e5f6G7H8I9J0', 'A1b2c3d4e5f6G7H8I9j0', 'A1b2c3d4e5f6G7H8i9j0', 'A1b2c3d4e5f6G7H8i9J0', 'A1b2c3d4e5F6G7H8i9J0', 'A1b2c3d4e5F6G7H8i9j0', 'A1b2c3d4e5F6G7H8I9j0', 'A1b2c3d4e5F6G7H8I9J0', 'A1b2c3d4e5F6G7h8I9J0', 'A1b2c3d4e5F6G7h8I9j0', 'A1b2c3d4e5F6G7h8i9j0', 'A1b2c3d4e5F6G7h8i9J0', 'A1b2c3d4e5F6g7h8i9J0', 'A1b2c3d4e5F6g7h8i9j0', 'A1b2c3d4e5F6g7h8I9j0', 'A1b2c3d4e5F6g7h8I9J0', 'A1b2c3d4e5F6g7H8I9J0', 'A1b2c3d4e5F6g7H8I9j0', 'A1b2c3d4e5F6g7H8i9j0', 'A1b2c3d4e5F6g7H8i9J0', 'A1b2C3d4e5F6g7H8i9J0', 'A1b2C3d4e5F6g7H8i9j0', 'A1b2C3d4e5F6g7H8I9j0', 'A1b2C3d4e5F6g7H8I9J0', 'A1b2C3d4e5F6g7h8I9J0', 'A1b2C3d4e5F6g7h8I9j0', 'A1b2C3d4e5F6g7h8i9j0', 'A1b2C3d4e5F6g7h8i9J0', 'A1b2C3d4e5F6G7h8i9J0', 'A1b2C3d4e5F6G7h8i9j0', 'A1b2C3d4e5F6G7h8I9j0', 'A1b2C3d4e5F6G7h8I9J0', 'A1b2C3d4e5F6G7H8I9J0', 'A1b2C3d4e5F6G7H8I9j0', 'A1b2C3d4e5F6G7H8i9j0', 'A1b2C3d4e5F6G7H8i9J0', 'A1b2C3d4e5f6G7H8i9J0', 'A1b2C3d4e5f6G7H8i9j0', 'A1b2C3d4e5f6G7H8I9j0', 'A1b2C3d4e5f6G7H8I9J0', 'A1b2C3d4e5f6G7h8I9J0', 'A1b2C3d4e5f6G7h8I9j0', 'A1b2C3d4e5f6G7h8i9j0', 'A1b2C3d4e5f6G7h8i9J0', 'A1b2C3d4e5f6g7h8i9J0', 'A1b2C3d4e5f6g7h8i9j0', 'A1b2C3d4e5f6g7h8I9j0', 'A1b2C3d4e5f6g7h8I9J0', 'A1b2C3d4e5f6g7H8I9J0', 'A1b2C3d4e5f6g7H8I9j0', 'A1b2C3d4e5f6g7H8i9j0', 'A1b2C3d4e5f6g7H8i9J0', 'A1b2C3d4E5f6g7H8i9J0', 'A1b2C3d4E5f6g7H8i9j0', 'A1b2C3d4E5f6g7H8I9j0', 'A1b2C3d4E5f6g7H8I9J0', 'A1b2C3d4E5f6g7h8I9J0', 'A1b2C3d4E5f6g7h8I9j0', 'A1b2C3d4E5f6g7h8i9j0', 'A1b2C3d4E5f6g7h8i9J0', 'A1b2C3d4E5f6G7h8i9J0', 'A1b2C3d4E5f6G7h8i9j0', 'A1b2C3d4E5f6G7h8I9j0', 'A1b2C3d4E5f6G7h8I9J0', 'A1b2C3d4E5f6G7H8I9J0', 'A1b2C3d4E5f6G7H8I9j0', 'A1b2C3d4E5f6G7H8i9j0', 'A1b2C3d4E5f6G7H8i9J0', 'A1b2C3d4E5F6G7H8i9J0', 'A1b2C3d4E5F6G7H8i9j0', 'A1b2C3d4E5F6G7H8I9j0', 'A1b2C3d4E5F6G7H8I9J0', 'A1b2C3d4E5F6G7h8I9J0', 'A1b2C3d4E5F6G7h8I9j0', 'A1b2C3d4E5F6G7h8i9j0', 'A1b2C3d4E5F6G7h8i9J0', 'A1b2C3d4E5F6g7h8i9J0', 'A1b2C3d4E5F6g7h8i9j0', 'A1b2C3d4E5F6g7h8I9j0', 'A1b2C3d4E5F6g7h8I9J0', 'A1b2C3d4E5F6g7H8I9J0', 'A1b2C3d4E5F6g7H8I9j0', 'A1b2C3d4E5F6g7H8i9j0', 'A1b2C3d4E5F6g7H8i9J0', 'A1b2C3D4E5F6g7H8i9J0', 'A1b2C3D4E5F6g7H8i9j0', 'A1b2C3D4E5F6g7H8I9j0', 'A1b2C3D4E5F6g7H8I9J0', 'A1b2C3D4E5F6g7h8I9J0', 'A1b2C3D4E5F6g7h8I9j0', 'A1b2C3D4E5F6g7h8i9j0', 'A1b2C3D4E5F6g7h8i9J0', 'A1b2C3D4E5F6G7h8i9J0', 'A1b2C3D4E5F6G7h8i9j0', 'A1b2C3D4E5F6G7h8I9j0', 'A1b2C3D4E5F6G7h8I9J0', 'A1b2C3D4E5F6G7H8I9J0', 'A1b2C3D4E5F6G7H8I9j0', 'A1b2C3D4E5F6G7H8i9j0', 'A1b2C3D4E5F6G7H8i9J0', 'A1b2C3D4E5f6G7H8i9J0', 'A1b2C3D4E5f6G7H8i9j0', 'A1b2C3D4E5f6G7H8I9j0', 'A1b2C3D4E5f6G7H8I9J0', 'A1b2C3D4E5f6G7h8I9J0', 'A1b2C3D4E5f6G7h8I9j0', 'A1b2C3D4E5f6G7h8i9j0', 'A1b2C3D4E5f6G7h8i9J0', 'A1b2C3D4E5f6g7h8i9J0', 'A1b2C3D4E5f6g7h8i9j0', 'A1b2C3D4E5f6g7h8I9j0', 'A1b2C3D4E5f6g7h8I9J0', 'A1b2C3D4E5f6g7H8I9J0', 'A1b2C3D4E5f6g7H8I9j0', 'A1b2C3D4E5f6g7H8i9j0', 'A1b2C3D4E5f6g7H8i9J0', 'A1b2C3D4e5f6g7H8i9J0', 'A1b2C3D4e5f6g7H8i9j0', 'A1b2C3D4e5f6g7H8I9j0', 'A1b2C3D4e5f6g7H8I9J0', 'A1b2C3D4e5f6g7h8I9J0', 'A1b2C3D4e5f6g7h8I9j0', 'A1b2C3D4e5f6g7h8i9j0', 'A1b2C3D4e5f6g7h8i9J0', 'A1b2C3D4e5f6G7h8i9J0', 'A1b2C3D4e5f6G7h8i9j0', 'A1b2C3D4e5f6G7h8I9j0', 'A1b2C3D4e5f6G7h8I9J0', 'A1b2C3D4e5f6G7H8I9J0', 'A1b2C3D4e5f6G7H8I9j0', 'A1b2C3D4e5f6G7H8i9j0', 'A1b2C3D4e5f6G7H8i9J0', 'A1b2C3D4e5F6G7H8i9J0', 'A1b2C3D4e5F6G7H8i9j0', 'A1b2C3D4e5F6G7H8I9j0', 'A1b2C3D4e5F6G7H8I9J0', 'A1b2C3D4e5F6G7h8I9J0', 'A1b2C3D4e5F6G7h8I9j0', 'A1b2C3D4e5F6G7h8i9j0', 'A1b2C3D4e5F6G7h8i9J0', 'A1b2C3D4e5F6g7h8i9J0', 'A1b2C3D4e5F6g7h8i9j0', 'A1b2C3D4e5F6g7h8I9j0', 'A1b2C3D4e5F6g7h8I9J0', 'A1b2C3D4e5F6g7H8I9J0', 'A1b2C3D4e5F6g7H8I9j0', 'A1b2C3D4e5F6g7H8i9j0', 'A1b2C3D4e5F6g7H8i9J0', 'A1B2C3D4e5F6g7H8i9J0', 'A1B2C3D4e5F6g7H8i9j0', 'A1B2C3D4e5F6g7H8I9j0', 'A1B2C3D4e5F6g7H8I9J0', 'A1B2C3D4e5F6g7h8I9J0', 'A1B2C3D4e5F6g7h8I9j0', 'A1B2C3D4e5F6g7h8i9j0', 'A1B2C3D4e5F6g7h8i9J0', 'A1B2C3D4e5F6G7h8i9J0', 'A1B2C3D4e5F6G7h8i9j0', 'A1B2C3D4e5F6G7h8I9j0', 'A1B2C3D4e5F6G7h8I9J0', 'A1B2C3D4e5F6G7H8I9J0', 'A1B2C3D4e5F6G7H8I9j0', 'A1B2C3D4e5F6G7H8i9j0', 'A1B2C3D4e5F6G7H8i9J0', 'A1B2C3D4e5f6G7H8i9J0', 'A1B2C3D4e5f6G7H8i9j0', 'A1B2C3D4e5f6G7H8I9j0', 'A1B2C3D4e5f6G7H8I9J0', 'A1B2C3D4e5f6G7h8I9J0', 'A1B2C3D4e5f6G7h8I9j0', 'A1B2C3D4e5f6G7h8i9j0', 'A1B2C3D4e5f6G7h8i9J0', 'A1B2C3D4e5f6g7h8i9J0', 'A1B2C3D4e5f6g7h8i9j0', 'A1B2C3D4e5f6g7h8I9j0', 'A1B2C3D4e5f6g7h8I9J0', 'A1B2C3D4e5f6g7H8I9J0', 'A1B2C3D4e5f6g7H8I9j0', 'A1B2C3D4e5f6g7H8i9j0', 'A1B2C3D4e5f6g7H8i9J0', 'A1B2C3D4E5f6g7H8i9J0', 'A1B2C3D4E5f6g7H8i9j0', 'A1B2C3D4E5f6g7H8I9j0', 'A1B2C3D4E5f6g7H8I9J0', 'A1B2C3D4E5f6g7h8I9J0', 'A1B2C3D4E5f6g7h8I9j0', 'A1B2C3D4E5f6g7h8i9j0', 'A1B2C3D4E5f6g7h8i9J0', 'A1B2C3D4E5f6G7h8i9J0', 'A1B2C3D4E5f6G7h8i9j0', 'A1B2C3D4E5f6G7h8I9j0', 'A1B2C3D4E5f6G7h8I9J0', 'A1B2C3D4E5f6G7H8I9J0', 'A1B2C3D4E5f6G7H8I9j0', 'A1B2C3D4E5f6G7H8i9j0', 'A1B2C3D4E5f6G7H8i9J0', 'A1B2C3D4E5F6G7H8i9J0', 'A1B2C3D4E5F6G7H8i9j0', 'A1B2C3D4E5F6G7H8I9j0', 'A1B2C3D4E5F6G7H8I9J0', 'A1B2C3D4E5F6G7h8I9J0', 'A1B2C3D4E5F6G7h8I9j0', 'A1B2C3D4E5F6G7h8i9j0', 'A1B2C3D4E5F6G7h8i9J0', 'A1B2C3D4E5F6g7h8i9J0', 'A1B2C3D4E5F6g7h8i9j0', 'A1B2C3D4E5F6g7h8I9j0', 'A1B2C3D4E5F6g7h8I9J0', 'A1B2C3D4E5F6g7H8I9J0', 'A1B2C3D4E5F6g7H8I9j0', 'A1B2C3D4E5F6g7H8i9j0', 'A1B2C3D4E5F6g7H8i9J0', 'A1B2C3d4E5F6g7H8i9J0', 'A1B2C3d4E5F6g7H8i9j0', 'A1B2C3d4E5F6g7H8I9j0', 'A1B2C3d4E5F6g7H8I9J0', 'A1B2C3d4E5F6g7h8I9J0', 'A1B2C3d4E5F6g7h8I9j0', 'A1B2C3d4E5F6g7h8i9j0', 'A1B2C3d4E5F6g7h8i9J0', 'A1B2C3d4E5F6G7h8i9J0', 'A1B2C3d4E5F6G7h8i9j0', 'A1B2C3d4E5F6G7h8I9j0', 'A1B2C3d4E5F6G7h8I9J0', 'A1B2C3d4E5F6G7H8I9J0', 'A1B2C3d4E5F6G7H8I9j0', 'A1B2C3d4E5F6G7H8i9j0', 'A1B2C3d4E5F6G7H8i9J0', 'A1B2C3d4E5f6G7H8i9J0', 'A1B2C3d4E5f6G7H8i9j0', 'A1B2C3d4E5f6G7H8I9j0', 'A1B2C3d4E5f6G7H8I9J0', 'A1B2C3d4E5f6G7h8I9J0', 'A1B2C3d4E5f6G7h8I9j0', 'A1B2C3d4E5f6G7h8i9j0', 'A1B2C3d4E5f6G7h8i9J0', 'A1B2C3d4E5f6g7h8i9J0', 'A1B2C3d4E5f6g7h8i9j0', 'A1B2C3d4E5f6g7h8I9j0', 'A1B2C3d4E5f6g7h8I9J0', 'A1B2C3d4E5f6g7H8I9J0', 'A1B2C3d4E5f6g7H8I9j0', 'A1B2C3d4E5f6g7H8i9j0', 'A1B2C3d4E5f6g7H8i9J0', 'A1B2C3d4e5f6g7H8i9J0', 'A1B2C3d4e5f6g7H8i9j0', 'A1B2C3d4e5f6g7H8I9j0', 'A1B2C3d4e5f6g7H8I9J0', 'A1B2C3d4e5f6g7h8I9J0', 'A1B2C3d4e5f6g7h8I9j0', 'A1B2C3d4e5f6g7h8i9j0', 'A1B2C3d4e5f6g7h8i9J0', 'A1B2C3d4e5f6G7h8i9J0', 'A1B2C3d4e5f6G7h8i9j0', 'A1B2C3d4e5f6G7h8I9j0', 'A1B2C3d4e5f6G7h8I9J0', 'A1B2C3d4e5f6G7H8I9J0', 'A1B2C3d4e5f6G7H8I9j0', 'A1B2C3d4e5f6G7H8i9j0', 'A1B2C3d4e5f6G7H8i9J0', 'A1B2C3d4e5F6G7H8i9J0', 'A1B2C3d4e5F6G7H8i9j0', 'A1B2C3d4e5F6G7H8I9j0', 'A1B2C3d4e5F6G7H8I9J0', 'A1B2C3d4e5F6G7h8I9J0', 'A1B2C3d4e5F6G7h8I9j0', 'A1B2C3d4e5F6G7h8i9j0', 'A1B2C3d4e5F6G7h8i9J0', 'A1B2C3d4e5F6g7h8i9J0', 'A1B2C3d4e5F6g7h8i9j0', 'A1B2C3d4e5F6g7h8I9j0', 'A1B2C3d4e5F6g7h8I9J0', 'A1B2C3d4e5F6g7H8I9J0', 'A1B2C3d4e5F6g7H8I9j0', 'A1B2C3d4e5F6g7H8i9j0', 'A1B2C3d4e5F6g7H8i9J0', 'A1B2c3d4e5F6g7H8i9J0', 'A1B2c3d4e5F6g7H8i9j0', 'A1B2c3d4e5F6g7H8I9j0', 'A1B2c3d4e5F6g7H8I9J0', 'A1B2c3d4e5F6g7h8I9J0', 'A1B2c3d4e5F6g7h8I9j0', 'A1B2c3d4e5F6g7h8i9j0', 'A1B2c3d4e5F6g7h8i9J0', 'A1B2c3d4e5F6G7h8i9J0', 'A1B2c3d4e5F6G7h8i9j0', 'A1B2c3d4e5F6G7h8I9j0', 'A1B2c3d4e5F6G7h8I9J0', 'A1B2c3d4e5F6G7H8I9J0', 'A1B2c3d4e5F6G7H8I9j0', 'A1B2c3d4e5F6G7H8i9j0', 'A1B2c3d4e5F6G7H8i9J0', 'A1B2c3d4e5f6G7H8i9J0', 'A1B2c3d4e5f6G7H8i9j0', 'A1B2c3d4e5f6G7H8I9j0', 'A1B2c3d4e5f6G7H8I9J0', 'A1B2c3d4e5f6G7h8I9J0', 'A1B2c3d4e5f6G7h8I9j0', 'A1B2c3d4e5f6G7h8i9j0', 'A1B2c3d4e5f6G7h8i9J0', 'A1B2c3d4e5f6g7h8i9J0', 'A1B2c3d4e5f6g7h8i9j0', 'A1B2c3d4e5f6g7h8I9j0', 'A1B2c3d4e5f6g7h8I9J0', 'A1B2c3d4e5f6g7H8I9J0', 'A1B2c3d4e5f6g7H8I9j0', 'A1B2c3d4e5f6g7H8i9j0', 'A1B2c3d4e5f6g7H8i9J0', 'A1B2c3d4E5f6g7H8i9J0', 'A1B2c3d4E5f6g7H8i9j0', 'A1B2c3d4E5f6g7H8I9j0', 'A1B2c3d4E5f6g7H8I9J0', 'A1B2c3d4E5f6g7h8I9J0', 'A1B2c3d4E5f6g7h8I9j0', 'A1B2c3d4E5f6g7h8i9j0', 'A1B2c3d4E5f6g7h8i9J0', 'A1B2c3d4E5f6G7h8i9J0', 'A1B2c3d4E5f6G7h8i9j0', 'A1B2c3d4E5f6G7h8I9j0', 'A1B2c3d4E5f6G7h8I9J0', 'A1B2c3d4E5f6G7H8I9J0', 'A1B2c3d4E5f6G7H8I9j0', 'A1B2c3d4E5f6G7H8i9j0', 'A1B2c3d4E5f6G7H8i9J0', 'A1B2c3d4E5F6G7H8i9J0', 'A1B2c3d4E5F6G7H8i9j0', 'A1B2c3d4E5F6G7H8I9j0', 'A1B2c3d4E5F6G7H8I9J0', 'A1B2c3d4E5F6G7h8I9J0', 'A1B2c3d4E5F6G7h8I9j0', 'A1B2c3d4E5F6G7h8i9j0', 'A1B2c3d4E5F6G7h8i9J0', 'A1B2c3d4E5F6g7h8i9J0', 'A1B2c3d4E5F6g7h8i9j0', 'A1B2c3d4E5F6g7h8I9j0', 'A1B2c3d4E5F6g7h8I9J0', 'A1B2c3d4E5F6g7H8I9J0', 'A1B2c3d4E5F6g7H8I9j0', 'A1B2c3d4E5F6g7H8i9j0', 'A1B2c3d4E5F6g7H8i9J0', 'A1B2c3D4E5F6g7H8i9J0', 'A1B2c3D4E5F6g7H8i9j0', 'A1B2c3D4E5F6g7H8I9j0', 'A1B2c3D4E5F6g7H8I9J0', 'A1B2c3D4E5F6g7h8I9J0', 'A1B2c3D4E5F6g7h8I9j0', 'A1B2c3D4E5F6g7h8i9j0', 'A1B2c3D4E5F6g7h8i9J0', 'A1B2c3D4E5F6G7h8i9J0', 'A1B2c3D4E5F6G7h8i9j0', 'A1B2c3D4E5F6G7h8I9j0', 'A1B2c3D4E5F6G7h8I9J0', 'A1B2c3D4E5F6G7H8I9J0', 'A1B2c3D4E5F6G7H8I9j0', 'A1B2c3D4E5F6G7H8i9j0', 'A1B2c3D4E5F6G7H8i9J0', 'A1B2c3D4E5f6G7H8i9J0', 'A1B2c3D4E5f6G7H8i9j0', 'A1B2c3D4E5f6G7H8I9j0', 'A1B2c3D4E5f6G7H8I9J0', 'A1B2c3D4E5f6G7h8I9J0', 'A1B2c3D4E5f6G7h8I9j0', 'A1B2c3D4E5f6G7h8i9j0', 'A1B2c3D4E5f6G7h8i9J0', 'A1B2c3D4E5f6g7h8i9J0', 'A1B2c3D4E5f6g7h8i9j0', 'A1B2c3D4E5f6g7h8I9j0', 'A1B2c3D4E5f6g7h8I9J0', 'A1B2c3D4E5f6g7H8I9J0', 'A1B2c3D4E5f6g7H8I9j0', 'A1B2c3D4E5f6g7H8i9j0', 'A1B2c3D4E5f6g7H8i9J0', 'A1B2c3D4e5f6g7H8i9J0', 'A1B2c3D4e5f6g7H8i9j0', 'A1B2c3D4e5f6g7H8I9j0', 'A1B2c3D4e5f6g7H8I9J0', 'A1B2c3D4e5f6g7h8I9J0', 'A1B2c3D4e5f6g7h8I9j0', 'A1B2c3D4e5f6g7h8i9j0', 'A1B2c3D4e5f6g7h8i9J0', 'A1B2c3D4e5f6G7h8i9J0', 'A1B2c3D4e5f6G7h8i9j0', 'A1B2c3D4e5f6G7h8I9j0', 'A1B2c3D4e5f6G7h8I9J0', 'A1B2c3D4e5f6G7H8I9J0', 'A1B2c3D4e5f6G7H8I9j0', 'A1B2c3D4e5f6G7H8i9j0', 'A1B2c3D4e5f6G7H8i9J0', 'A1B2c3D4e5F6G7H8i9J0', 'A1B2c3D4e5F6G7H8i9j0', 'A1B2c3D4e5F6G7H8I9j0', 'A1B2c3D4e5F6G7H8I9J0', 'A1B2c3D4e5F6G7h8I9J0', 'A1B2c3D4e5F6G7h8I9j0', 'A1B2c3D4e5F6G7h8i9j0', 'A1B2c3D4e5F6G7h8i9J0', 'A1B2c3D4e5F6g7h8i9J0', 'A1B2c3D4e5F6g7h8i9j0', 'A1B2c3D4e5F6g7h8I9j0', 'A1B2c3D4e5F6g7h8I9J0', 'A1B2c3D4e5F6g7H8I9J0', 'A1B2c3D4e5F6g7H8I9j0', 'A1B2c3D4e5F6g7H8i9j0', 'A1B2c3D4e5F6g7H8i9J0']\n assert candidate(s = \"XyZ9\") == ['XyZ9', 'Xyz9', 'XYz9', 'XYZ9', 'xYZ9', 'xYz9', 'xyz9', 'xyZ9']\n assert candidate(s = \"mNoPqRsT\") == ['mNoPqRsT', 'mNoPqRst', 'mNoPqRSt', 'mNoPqRST', 'mNoPqrST', 'mNoPqrSt', 'mNoPqrst', 'mNoPqrsT', 'mNoPQrsT', 'mNoPQrst', 'mNoPQrSt', 'mNoPQrST', 'mNoPQRST', 'mNoPQRSt', 'mNoPQRst', 'mNoPQRsT', 'mNopQRsT', 'mNopQRst', 'mNopQRSt', 'mNopQRST', 'mNopQrST', 'mNopQrSt', 'mNopQrst', 'mNopQrsT', 'mNopqrsT', 'mNopqrst', 'mNopqrSt', 'mNopqrST', 'mNopqRST', 'mNopqRSt', 'mNopqRst', 'mNopqRsT', 'mNOpqRsT', 'mNOpqRst', 'mNOpqRSt', 'mNOpqRST', 'mNOpqrST', 'mNOpqrSt', 'mNOpqrst', 'mNOpqrsT', 'mNOpQrsT', 'mNOpQrst', 'mNOpQrSt', 'mNOpQrST', 'mNOpQRST', 'mNOpQRSt', 'mNOpQRst', 'mNOpQRsT', 'mNOPQRsT', 'mNOPQRst', 'mNOPQRSt', 'mNOPQRST', 'mNOPQrST', 'mNOPQrSt', 'mNOPQrst', 'mNOPQrsT', 'mNOPqrsT', 'mNOPqrst', 'mNOPqrSt', 'mNOPqrST', 'mNOPqRST', 'mNOPqRSt', 'mNOPqRst', 'mNOPqRsT', 'mnOPqRsT', 'mnOPqRst', 'mnOPqRSt', 'mnOPqRST', 'mnOPqrST', 'mnOPqrSt', 'mnOPqrst', 'mnOPqrsT', 'mnOPQrsT', 'mnOPQrst', 'mnOPQrSt', 'mnOPQrST', 'mnOPQRST', 'mnOPQRSt', 'mnOPQRst', 'mnOPQRsT', 'mnOpQRsT', 'mnOpQRst', 'mnOpQRSt', 'mnOpQRST', 'mnOpQrST', 'mnOpQrSt', 'mnOpQrst', 'mnOpQrsT', 'mnOpqrsT', 'mnOpqrst', 'mnOpqrSt', 'mnOpqrST', 'mnOpqRST', 'mnOpqRSt', 'mnOpqRst', 'mnOpqRsT', 'mnopqRsT', 'mnopqRst', 'mnopqRSt', 'mnopqRST', 'mnopqrST', 'mnopqrSt', 'mnopqrst', 'mnopqrsT', 'mnopQrsT', 'mnopQrst', 'mnopQrSt', 'mnopQrST', 'mnopQRST', 'mnopQRSt', 'mnopQRst', 'mnopQRsT', 'mnoPQRsT', 'mnoPQRst', 'mnoPQRSt', 'mnoPQRST', 'mnoPQrST', 'mnoPQrSt', 'mnoPQrst', 'mnoPQrsT', 'mnoPqrsT', 'mnoPqrst', 'mnoPqrSt', 'mnoPqrST', 'mnoPqRST', 'mnoPqRSt', 'mnoPqRst', 'mnoPqRsT', 'MnoPqRsT', 'MnoPqRst', 'MnoPqRSt', 'MnoPqRST', 'MnoPqrST', 'MnoPqrSt', 'MnoPqrst', 'MnoPqrsT', 'MnoPQrsT', 'MnoPQrst', 'MnoPQrSt', 'MnoPQrST', 'MnoPQRST', 'MnoPQRSt', 'MnoPQRst', 'MnoPQRsT', 'MnopQRsT', 'MnopQRst', 'MnopQRSt', 'MnopQRST', 'MnopQrST', 'MnopQrSt', 'MnopQrst', 'MnopQrsT', 'MnopqrsT', 'Mnopqrst', 'MnopqrSt', 'MnopqrST', 'MnopqRST', 'MnopqRSt', 'MnopqRst', 'MnopqRsT', 'MnOpqRsT', 'MnOpqRst', 'MnOpqRSt', 'MnOpqRST', 'MnOpqrST', 'MnOpqrSt', 'MnOpqrst', 'MnOpqrsT', 'MnOpQrsT', 'MnOpQrst', 'MnOpQrSt', 'MnOpQrST', 'MnOpQRST', 'MnOpQRSt', 'MnOpQRst', 'MnOpQRsT', 'MnOPQRsT', 'MnOPQRst', 'MnOPQRSt', 'MnOPQRST', 'MnOPQrST', 'MnOPQrSt', 'MnOPQrst', 'MnOPQrsT', 'MnOPqrsT', 'MnOPqrst', 'MnOPqrSt', 'MnOPqrST', 'MnOPqRST', 'MnOPqRSt', 'MnOPqRst', 'MnOPqRsT', 'MNOPqRsT', 'MNOPqRst', 'MNOPqRSt', 'MNOPqRST', 'MNOPqrST', 'MNOPqrSt', 'MNOPqrst', 'MNOPqrsT', 'MNOPQrsT', 'MNOPQrst', 'MNOPQrSt', 'MNOPQrST', 'MNOPQRST', 'MNOPQRSt', 'MNOPQRst', 'MNOPQRsT', 'MNOpQRsT', 'MNOpQRst', 'MNOpQRSt', 'MNOpQRST', 'MNOpQrST', 'MNOpQrSt', 'MNOpQrst', 'MNOpQrsT', 'MNOpqrsT', 'MNOpqrst', 'MNOpqrSt', 'MNOpqrST', 'MNOpqRST', 'MNOpqRSt', 'MNOpqRst', 'MNOpqRsT', 'MNopqRsT', 'MNopqRst', 'MNopqRSt', 'MNopqRST', 'MNopqrST', 'MNopqrSt', 'MNopqrst', 'MNopqrsT', 'MNopQrsT', 'MNopQrst', 'MNopQrSt', 'MNopQrST', 'MNopQRST', 'MNopQRSt', 'MNopQRst', 'MNopQRsT', 'MNoPQRsT', 'MNoPQRst', 'MNoPQRSt', 'MNoPQRST', 'MNoPQrST', 'MNoPQrSt', 'MNoPQrst', 'MNoPQrsT', 'MNoPqrsT', 'MNoPqrst', 'MNoPqrSt', 'MNoPqrST', 'MNoPqRST', 'MNoPqRSt', 'MNoPqRst', 'MNoPqRsT']\n assert candidate(s = \"aBcDeFgHiJ\") == ['aBcDeFgHiJ', 'aBcDeFgHij', 'aBcDeFgHIj', 'aBcDeFgHIJ', 'aBcDeFghIJ', 'aBcDeFghIj', 'aBcDeFghij', 'aBcDeFghiJ', 'aBcDeFGhiJ', 'aBcDeFGhij', 'aBcDeFGhIj', 'aBcDeFGhIJ', 'aBcDeFGHIJ', 'aBcDeFGHIj', 'aBcDeFGHij', 'aBcDeFGHiJ', 'aBcDefGHiJ', 'aBcDefGHij', 'aBcDefGHIj', 'aBcDefGHIJ', 'aBcDefGhIJ', 'aBcDefGhIj', 'aBcDefGhij', 'aBcDefGhiJ', 'aBcDefghiJ', 'aBcDefghij', 'aBcDefghIj', 'aBcDefghIJ', 'aBcDefgHIJ', 'aBcDefgHIj', 'aBcDefgHij', 'aBcDefgHiJ', 'aBcDEfgHiJ', 'aBcDEfgHij', 'aBcDEfgHIj', 'aBcDEfgHIJ', 'aBcDEfghIJ', 'aBcDEfghIj', 'aBcDEfghij', 'aBcDEfghiJ', 'aBcDEfGhiJ', 'aBcDEfGhij', 'aBcDEfGhIj', 'aBcDEfGhIJ', 'aBcDEfGHIJ', 'aBcDEfGHIj', 'aBcDEfGHij', 'aBcDEfGHiJ', 'aBcDEFGHiJ', 'aBcDEFGHij', 'aBcDEFGHIj', 'aBcDEFGHIJ', 'aBcDEFGhIJ', 'aBcDEFGhIj', 'aBcDEFGhij', 'aBcDEFGhiJ', 'aBcDEFghiJ', 'aBcDEFghij', 'aBcDEFghIj', 'aBcDEFghIJ', 'aBcDEFgHIJ', 'aBcDEFgHIj', 'aBcDEFgHij', 'aBcDEFgHiJ', 'aBcdEFgHiJ', 'aBcdEFgHij', 'aBcdEFgHIj', 'aBcdEFgHIJ', 'aBcdEFghIJ', 'aBcdEFghIj', 'aBcdEFghij', 'aBcdEFghiJ', 'aBcdEFGhiJ', 'aBcdEFGhij', 'aBcdEFGhIj', 'aBcdEFGhIJ', 'aBcdEFGHIJ', 'aBcdEFGHIj', 'aBcdEFGHij', 'aBcdEFGHiJ', 'aBcdEfGHiJ', 'aBcdEfGHij', 'aBcdEfGHIj', 'aBcdEfGHIJ', 'aBcdEfGhIJ', 'aBcdEfGhIj', 'aBcdEfGhij', 'aBcdEfGhiJ', 'aBcdEfghiJ', 'aBcdEfghij', 'aBcdEfghIj', 'aBcdEfghIJ', 'aBcdEfgHIJ', 'aBcdEfgHIj', 'aBcdEfgHij', 'aBcdEfgHiJ', 'aBcdefgHiJ', 'aBcdefgHij', 'aBcdefgHIj', 'aBcdefgHIJ', 'aBcdefghIJ', 'aBcdefghIj', 'aBcdefghij', 'aBcdefghiJ', 'aBcdefGhiJ', 'aBcdefGhij', 'aBcdefGhIj', 'aBcdefGhIJ', 'aBcdefGHIJ', 'aBcdefGHIj', 'aBcdefGHij', 'aBcdefGHiJ', 'aBcdeFGHiJ', 'aBcdeFGHij', 'aBcdeFGHIj', 'aBcdeFGHIJ', 'aBcdeFGhIJ', 'aBcdeFGhIj', 'aBcdeFGhij', 'aBcdeFGhiJ', 'aBcdeFghiJ', 'aBcdeFghij', 'aBcdeFghIj', 'aBcdeFghIJ', 'aBcdeFgHIJ', 'aBcdeFgHIj', 'aBcdeFgHij', 'aBcdeFgHiJ', 'aBCdeFgHiJ', 'aBCdeFgHij', 'aBCdeFgHIj', 'aBCdeFgHIJ', 'aBCdeFghIJ', 'aBCdeFghIj', 'aBCdeFghij', 'aBCdeFghiJ', 'aBCdeFGhiJ', 'aBCdeFGhij', 'aBCdeFGhIj', 'aBCdeFGhIJ', 'aBCdeFGHIJ', 'aBCdeFGHIj', 'aBCdeFGHij', 'aBCdeFGHiJ', 'aBCdefGHiJ', 'aBCdefGHij', 'aBCdefGHIj', 'aBCdefGHIJ', 'aBCdefGhIJ', 'aBCdefGhIj', 'aBCdefGhij', 'aBCdefGhiJ', 'aBCdefghiJ', 'aBCdefghij', 'aBCdefghIj', 'aBCdefghIJ', 'aBCdefgHIJ', 'aBCdefgHIj', 'aBCdefgHij', 'aBCdefgHiJ', 'aBCdEfgHiJ', 'aBCdEfgHij', 'aBCdEfgHIj', 'aBCdEfgHIJ', 'aBCdEfghIJ', 'aBCdEfghIj', 'aBCdEfghij', 'aBCdEfghiJ', 'aBCdEfGhiJ', 'aBCdEfGhij', 'aBCdEfGhIj', 'aBCdEfGhIJ', 'aBCdEfGHIJ', 'aBCdEfGHIj', 'aBCdEfGHij', 'aBCdEfGHiJ', 'aBCdEFGHiJ', 'aBCdEFGHij', 'aBCdEFGHIj', 'aBCdEFGHIJ', 'aBCdEFGhIJ', 'aBCdEFGhIj', 'aBCdEFGhij', 'aBCdEFGhiJ', 'aBCdEFghiJ', 'aBCdEFghij', 'aBCdEFghIj', 'aBCdEFghIJ', 'aBCdEFgHIJ', 'aBCdEFgHIj', 'aBCdEFgHij', 'aBCdEFgHiJ', 'aBCDEFgHiJ', 'aBCDEFgHij', 'aBCDEFgHIj', 'aBCDEFgHIJ', 'aBCDEFghIJ', 'aBCDEFghIj', 'aBCDEFghij', 'aBCDEFghiJ', 'aBCDEFGhiJ', 'aBCDEFGhij', 'aBCDEFGhIj', 'aBCDEFGhIJ', 'aBCDEFGHIJ', 'aBCDEFGHIj', 'aBCDEFGHij', 'aBCDEFGHiJ', 'aBCDEfGHiJ', 'aBCDEfGHij', 'aBCDEfGHIj', 'aBCDEfGHIJ', 'aBCDEfGhIJ', 'aBCDEfGhIj', 'aBCDEfGhij', 'aBCDEfGhiJ', 'aBCDEfghiJ', 'aBCDEfghij', 'aBCDEfghIj', 'aBCDEfghIJ', 'aBCDEfgHIJ', 'aBCDEfgHIj', 'aBCDEfgHij', 'aBCDEfgHiJ', 'aBCDefgHiJ', 'aBCDefgHij', 'aBCDefgHIj', 'aBCDefgHIJ', 'aBCDefghIJ', 'aBCDefghIj', 'aBCDefghij', 'aBCDefghiJ', 'aBCDefGhiJ', 'aBCDefGhij', 'aBCDefGhIj', 'aBCDefGhIJ', 'aBCDefGHIJ', 'aBCDefGHIj', 'aBCDefGHij', 'aBCDefGHiJ', 'aBCDeFGHiJ', 'aBCDeFGHij', 'aBCDeFGHIj', 'aBCDeFGHIJ', 'aBCDeFGhIJ', 'aBCDeFGhIj', 'aBCDeFGhij', 'aBCDeFGhiJ', 'aBCDeFghiJ', 'aBCDeFghij', 'aBCDeFghIj', 'aBCDeFghIJ', 'aBCDeFgHIJ', 'aBCDeFgHIj', 'aBCDeFgHij', 'aBCDeFgHiJ', 'abCDeFgHiJ', 'abCDeFgHij', 'abCDeFgHIj', 'abCDeFgHIJ', 'abCDeFghIJ', 'abCDeFghIj', 'abCDeFghij', 'abCDeFghiJ', 'abCDeFGhiJ', 'abCDeFGhij', 'abCDeFGhIj', 'abCDeFGhIJ', 'abCDeFGHIJ', 'abCDeFGHIj', 'abCDeFGHij', 'abCDeFGHiJ', 'abCDefGHiJ', 'abCDefGHij', 'abCDefGHIj', 'abCDefGHIJ', 'abCDefGhIJ', 'abCDefGhIj', 'abCDefGhij', 'abCDefGhiJ', 'abCDefghiJ', 'abCDefghij', 'abCDefghIj', 'abCDefghIJ', 'abCDefgHIJ', 'abCDefgHIj', 'abCDefgHij', 'abCDefgHiJ', 'abCDEfgHiJ', 'abCDEfgHij', 'abCDEfgHIj', 'abCDEfgHIJ', 'abCDEfghIJ', 'abCDEfghIj', 'abCDEfghij', 'abCDEfghiJ', 'abCDEfGhiJ', 'abCDEfGhij', 'abCDEfGhIj', 'abCDEfGhIJ', 'abCDEfGHIJ', 'abCDEfGHIj', 'abCDEfGHij', 'abCDEfGHiJ', 'abCDEFGHiJ', 'abCDEFGHij', 'abCDEFGHIj', 'abCDEFGHIJ', 'abCDEFGhIJ', 'abCDEFGhIj', 'abCDEFGhij', 'abCDEFGhiJ', 'abCDEFghiJ', 'abCDEFghij', 'abCDEFghIj', 'abCDEFghIJ', 'abCDEFgHIJ', 'abCDEFgHIj', 'abCDEFgHij', 'abCDEFgHiJ', 'abCdEFgHiJ', 'abCdEFgHij', 'abCdEFgHIj', 'abCdEFgHIJ', 'abCdEFghIJ', 'abCdEFghIj', 'abCdEFghij', 'abCdEFghiJ', 'abCdEFGhiJ', 'abCdEFGhij', 'abCdEFGhIj', 'abCdEFGhIJ', 'abCdEFGHIJ', 'abCdEFGHIj', 'abCdEFGHij', 'abCdEFGHiJ', 'abCdEfGHiJ', 'abCdEfGHij', 'abCdEfGHIj', 'abCdEfGHIJ', 'abCdEfGhIJ', 'abCdEfGhIj', 'abCdEfGhij', 'abCdEfGhiJ', 'abCdEfghiJ', 'abCdEfghij', 'abCdEfghIj', 'abCdEfghIJ', 'abCdEfgHIJ', 'abCdEfgHIj', 'abCdEfgHij', 'abCdEfgHiJ', 'abCdefgHiJ', 'abCdefgHij', 'abCdefgHIj', 'abCdefgHIJ', 'abCdefghIJ', 'abCdefghIj', 'abCdefghij', 'abCdefghiJ', 'abCdefGhiJ', 'abCdefGhij', 'abCdefGhIj', 'abCdefGhIJ', 'abCdefGHIJ', 'abCdefGHIj', 'abCdefGHij', 'abCdefGHiJ', 'abCdeFGHiJ', 'abCdeFGHij', 'abCdeFGHIj', 'abCdeFGHIJ', 'abCdeFGhIJ', 'abCdeFGhIj', 'abCdeFGhij', 'abCdeFGhiJ', 'abCdeFghiJ', 'abCdeFghij', 'abCdeFghIj', 'abCdeFghIJ', 'abCdeFgHIJ', 'abCdeFgHIj', 'abCdeFgHij', 'abCdeFgHiJ', 'abcdeFgHiJ', 'abcdeFgHij', 'abcdeFgHIj', 'abcdeFgHIJ', 'abcdeFghIJ', 'abcdeFghIj', 'abcdeFghij', 'abcdeFghiJ', 'abcdeFGhiJ', 'abcdeFGhij', 'abcdeFGhIj', 'abcdeFGhIJ', 'abcdeFGHIJ', 'abcdeFGHIj', 'abcdeFGHij', 'abcdeFGHiJ', 'abcdefGHiJ', 'abcdefGHij', 'abcdefGHIj', 'abcdefGHIJ', 'abcdefGhIJ', 'abcdefGhIj', 'abcdefGhij', 'abcdefGhiJ', 'abcdefghiJ', 'abcdefghij', 'abcdefghIj', 'abcdefghIJ', 'abcdefgHIJ', 'abcdefgHIj', 'abcdefgHij', 'abcdefgHiJ', 'abcdEfgHiJ', 'abcdEfgHij', 'abcdEfgHIj', 'abcdEfgHIJ', 'abcdEfghIJ', 'abcdEfghIj', 'abcdEfghij', 'abcdEfghiJ', 'abcdEfGhiJ', 'abcdEfGhij', 'abcdEfGhIj', 'abcdEfGhIJ', 'abcdEfGHIJ', 'abcdEfGHIj', 'abcdEfGHij', 'abcdEfGHiJ', 'abcdEFGHiJ', 'abcdEFGHij', 'abcdEFGHIj', 'abcdEFGHIJ', 'abcdEFGhIJ', 'abcdEFGhIj', 'abcdEFGhij', 'abcdEFGhiJ', 'abcdEFghiJ', 'abcdEFghij', 'abcdEFghIj', 'abcdEFghIJ', 'abcdEFgHIJ', 'abcdEFgHIj', 'abcdEFgHij', 'abcdEFgHiJ', 'abcDEFgHiJ', 'abcDEFgHij', 'abcDEFgHIj', 'abcDEFgHIJ', 'abcDEFghIJ', 'abcDEFghIj', 'abcDEFghij', 'abcDEFghiJ', 'abcDEFGhiJ', 'abcDEFGhij', 'abcDEFGhIj', 'abcDEFGhIJ', 'abcDEFGHIJ', 'abcDEFGHIj', 'abcDEFGHij', 'abcDEFGHiJ', 'abcDEfGHiJ', 'abcDEfGHij', 'abcDEfGHIj', 'abcDEfGHIJ', 'abcDEfGhIJ', 'abcDEfGhIj', 'abcDEfGhij', 'abcDEfGhiJ', 'abcDEfghiJ', 'abcDEfghij', 'abcDEfghIj', 'abcDEfghIJ', 'abcDEfgHIJ', 'abcDEfgHIj', 'abcDEfgHij', 'abcDEfgHiJ', 'abcDefgHiJ', 'abcDefgHij', 'abcDefgHIj', 'abcDefgHIJ', 'abcDefghIJ', 'abcDefghIj', 'abcDefghij', 'abcDefghiJ', 'abcDefGhiJ', 'abcDefGhij', 'abcDefGhIj', 'abcDefGhIJ', 'abcDefGHIJ', 'abcDefGHIj', 'abcDefGHij', 'abcDefGHiJ', 'abcDeFGHiJ', 'abcDeFGHij', 'abcDeFGHIj', 'abcDeFGHIJ', 'abcDeFGhIJ', 'abcDeFGhIj', 'abcDeFGhij', 'abcDeFGhiJ', 'abcDeFghiJ', 'abcDeFghij', 'abcDeFghIj', 'abcDeFghIJ', 'abcDeFgHIJ', 'abcDeFgHIj', 'abcDeFgHij', 'abcDeFgHiJ', 'AbcDeFgHiJ', 'AbcDeFgHij', 'AbcDeFgHIj', 'AbcDeFgHIJ', 'AbcDeFghIJ', 'AbcDeFghIj', 'AbcDeFghij', 'AbcDeFghiJ', 'AbcDeFGhiJ', 'AbcDeFGhij', 'AbcDeFGhIj', 'AbcDeFGhIJ', 'AbcDeFGHIJ', 'AbcDeFGHIj', 'AbcDeFGHij', 'AbcDeFGHiJ', 'AbcDefGHiJ', 'AbcDefGHij', 'AbcDefGHIj', 'AbcDefGHIJ', 'AbcDefGhIJ', 'AbcDefGhIj', 'AbcDefGhij', 'AbcDefGhiJ', 'AbcDefghiJ', 'AbcDefghij', 'AbcDefghIj', 'AbcDefghIJ', 'AbcDefgHIJ', 'AbcDefgHIj', 'AbcDefgHij', 'AbcDefgHiJ', 'AbcDEfgHiJ', 'AbcDEfgHij', 'AbcDEfgHIj', 'AbcDEfgHIJ', 'AbcDEfghIJ', 'AbcDEfghIj', 'AbcDEfghij', 'AbcDEfghiJ', 'AbcDEfGhiJ', 'AbcDEfGhij', 'AbcDEfGhIj', 'AbcDEfGhIJ', 'AbcDEfGHIJ', 'AbcDEfGHIj', 'AbcDEfGHij', 'AbcDEfGHiJ', 'AbcDEFGHiJ', 'AbcDEFGHij', 'AbcDEFGHIj', 'AbcDEFGHIJ', 'AbcDEFGhIJ', 'AbcDEFGhIj', 'AbcDEFGhij', 'AbcDEFGhiJ', 'AbcDEFghiJ', 'AbcDEFghij', 'AbcDEFghIj', 'AbcDEFghIJ', 'AbcDEFgHIJ', 'AbcDEFgHIj', 'AbcDEFgHij', 'AbcDEFgHiJ', 'AbcdEFgHiJ', 'AbcdEFgHij', 'AbcdEFgHIj', 'AbcdEFgHIJ', 'AbcdEFghIJ', 'AbcdEFghIj', 'AbcdEFghij', 'AbcdEFghiJ', 'AbcdEFGhiJ', 'AbcdEFGhij', 'AbcdEFGhIj', 'AbcdEFGhIJ', 'AbcdEFGHIJ', 'AbcdEFGHIj', 'AbcdEFGHij', 'AbcdEFGHiJ', 'AbcdEfGHiJ', 'AbcdEfGHij', 'AbcdEfGHIj', 'AbcdEfGHIJ', 'AbcdEfGhIJ', 'AbcdEfGhIj', 'AbcdEfGhij', 'AbcdEfGhiJ', 'AbcdEfghiJ', 'AbcdEfghij', 'AbcdEfghIj', 'AbcdEfghIJ', 'AbcdEfgHIJ', 'AbcdEfgHIj', 'AbcdEfgHij', 'AbcdEfgHiJ', 'AbcdefgHiJ', 'AbcdefgHij', 'AbcdefgHIj', 'AbcdefgHIJ', 'AbcdefghIJ', 'AbcdefghIj', 'Abcdefghij', 'AbcdefghiJ', 'AbcdefGhiJ', 'AbcdefGhij', 'AbcdefGhIj', 'AbcdefGhIJ', 'AbcdefGHIJ', 'AbcdefGHIj', 'AbcdefGHij', 'AbcdefGHiJ', 'AbcdeFGHiJ', 'AbcdeFGHij', 'AbcdeFGHIj', 'AbcdeFGHIJ', 'AbcdeFGhIJ', 'AbcdeFGhIj', 'AbcdeFGhij', 'AbcdeFGhiJ', 'AbcdeFghiJ', 'AbcdeFghij', 'AbcdeFghIj', 'AbcdeFghIJ', 'AbcdeFgHIJ', 'AbcdeFgHIj', 'AbcdeFgHij', 'AbcdeFgHiJ', 'AbCdeFgHiJ', 'AbCdeFgHij', 'AbCdeFgHIj', 'AbCdeFgHIJ', 'AbCdeFghIJ', 'AbCdeFghIj', 'AbCdeFghij', 'AbCdeFghiJ', 'AbCdeFGhiJ', 'AbCdeFGhij', 'AbCdeFGhIj', 'AbCdeFGhIJ', 'AbCdeFGHIJ', 'AbCdeFGHIj', 'AbCdeFGHij', 'AbCdeFGHiJ', 'AbCdefGHiJ', 'AbCdefGHij', 'AbCdefGHIj', 'AbCdefGHIJ', 'AbCdefGhIJ', 'AbCdefGhIj', 'AbCdefGhij', 'AbCdefGhiJ', 'AbCdefghiJ', 'AbCdefghij', 'AbCdefghIj', 'AbCdefghIJ', 'AbCdefgHIJ', 'AbCdefgHIj', 'AbCdefgHij', 'AbCdefgHiJ', 'AbCdEfgHiJ', 'AbCdEfgHij', 'AbCdEfgHIj', 'AbCdEfgHIJ', 'AbCdEfghIJ', 'AbCdEfghIj', 'AbCdEfghij', 'AbCdEfghiJ', 'AbCdEfGhiJ', 'AbCdEfGhij', 'AbCdEfGhIj', 'AbCdEfGhIJ', 'AbCdEfGHIJ', 'AbCdEfGHIj', 'AbCdEfGHij', 'AbCdEfGHiJ', 'AbCdEFGHiJ', 'AbCdEFGHij', 'AbCdEFGHIj', 'AbCdEFGHIJ', 'AbCdEFGhIJ', 'AbCdEFGhIj', 'AbCdEFGhij', 'AbCdEFGhiJ', 'AbCdEFghiJ', 'AbCdEFghij', 'AbCdEFghIj', 'AbCdEFghIJ', 'AbCdEFgHIJ', 'AbCdEFgHIj', 'AbCdEFgHij', 'AbCdEFgHiJ', 'AbCDEFgHiJ', 'AbCDEFgHij', 'AbCDEFgHIj', 'AbCDEFgHIJ', 'AbCDEFghIJ', 'AbCDEFghIj', 'AbCDEFghij', 'AbCDEFghiJ', 'AbCDEFGhiJ', 'AbCDEFGhij', 'AbCDEFGhIj', 'AbCDEFGhIJ', 'AbCDEFGHIJ', 'AbCDEFGHIj', 'AbCDEFGHij', 'AbCDEFGHiJ', 'AbCDEfGHiJ', 'AbCDEfGHij', 'AbCDEfGHIj', 'AbCDEfGHIJ', 'AbCDEfGhIJ', 'AbCDEfGhIj', 'AbCDEfGhij', 'AbCDEfGhiJ', 'AbCDEfghiJ', 'AbCDEfghij', 'AbCDEfghIj', 'AbCDEfghIJ', 'AbCDEfgHIJ', 'AbCDEfgHIj', 'AbCDEfgHij', 'AbCDEfgHiJ', 'AbCDefgHiJ', 'AbCDefgHij', 'AbCDefgHIj', 'AbCDefgHIJ', 'AbCDefghIJ', 'AbCDefghIj', 'AbCDefghij', 'AbCDefghiJ', 'AbCDefGhiJ', 'AbCDefGhij', 'AbCDefGhIj', 'AbCDefGhIJ', 'AbCDefGHIJ', 'AbCDefGHIj', 'AbCDefGHij', 'AbCDefGHiJ', 'AbCDeFGHiJ', 'AbCDeFGHij', 'AbCDeFGHIj', 'AbCDeFGHIJ', 'AbCDeFGhIJ', 'AbCDeFGhIj', 'AbCDeFGhij', 'AbCDeFGhiJ', 'AbCDeFghiJ', 'AbCDeFghij', 'AbCDeFghIj', 'AbCDeFghIJ', 'AbCDeFgHIJ', 'AbCDeFgHIj', 'AbCDeFgHij', 'AbCDeFgHiJ', 'ABCDeFgHiJ', 'ABCDeFgHij', 'ABCDeFgHIj', 'ABCDeFgHIJ', 'ABCDeFghIJ', 'ABCDeFghIj', 'ABCDeFghij', 'ABCDeFghiJ', 'ABCDeFGhiJ', 'ABCDeFGhij', 'ABCDeFGhIj', 'ABCDeFGhIJ', 'ABCDeFGHIJ', 'ABCDeFGHIj', 'ABCDeFGHij', 'ABCDeFGHiJ', 'ABCDefGHiJ', 'ABCDefGHij', 'ABCDefGHIj', 'ABCDefGHIJ', 'ABCDefGhIJ', 'ABCDefGhIj', 'ABCDefGhij', 'ABCDefGhiJ', 'ABCDefghiJ', 'ABCDefghij', 'ABCDefghIj', 'ABCDefghIJ', 'ABCDefgHIJ', 'ABCDefgHIj', 'ABCDefgHij', 'ABCDefgHiJ', 'ABCDEfgHiJ', 'ABCDEfgHij', 'ABCDEfgHIj', 'ABCDEfgHIJ', 'ABCDEfghIJ', 'ABCDEfghIj', 'ABCDEfghij', 'ABCDEfghiJ', 'ABCDEfGhiJ', 'ABCDEfGhij', 'ABCDEfGhIj', 'ABCDEfGhIJ', 'ABCDEfGHIJ', 'ABCDEfGHIj', 'ABCDEfGHij', 'ABCDEfGHiJ', 'ABCDEFGHiJ', 'ABCDEFGHij', 'ABCDEFGHIj', 'ABCDEFGHIJ', 'ABCDEFGhIJ', 'ABCDEFGhIj', 'ABCDEFGhij', 'ABCDEFGhiJ', 'ABCDEFghiJ', 'ABCDEFghij', 'ABCDEFghIj', 'ABCDEFghIJ', 'ABCDEFgHIJ', 'ABCDEFgHIj', 'ABCDEFgHij', 'ABCDEFgHiJ', 'ABCdEFgHiJ', 'ABCdEFgHij', 'ABCdEFgHIj', 'ABCdEFgHIJ', 'ABCdEFghIJ', 'ABCdEFghIj', 'ABCdEFghij', 'ABCdEFghiJ', 'ABCdEFGhiJ', 'ABCdEFGhij', 'ABCdEFGhIj', 'ABCdEFGhIJ', 'ABCdEFGHIJ', 'ABCdEFGHIj', 'ABCdEFGHij', 'ABCdEFGHiJ', 'ABCdEfGHiJ', 'ABCdEfGHij', 'ABCdEfGHIj', 'ABCdEfGHIJ', 'ABCdEfGhIJ', 'ABCdEfGhIj', 'ABCdEfGhij', 'ABCdEfGhiJ', 'ABCdEfghiJ', 'ABCdEfghij', 'ABCdEfghIj', 'ABCdEfghIJ', 'ABCdEfgHIJ', 'ABCdEfgHIj', 'ABCdEfgHij', 'ABCdEfgHiJ', 'ABCdefgHiJ', 'ABCdefgHij', 'ABCdefgHIj', 'ABCdefgHIJ', 'ABCdefghIJ', 'ABCdefghIj', 'ABCdefghij', 'ABCdefghiJ', 'ABCdefGhiJ', 'ABCdefGhij', 'ABCdefGhIj', 'ABCdefGhIJ', 'ABCdefGHIJ', 'ABCdefGHIj', 'ABCdefGHij', 'ABCdefGHiJ', 'ABCdeFGHiJ', 'ABCdeFGHij', 'ABCdeFGHIj', 'ABCdeFGHIJ', 'ABCdeFGhIJ', 'ABCdeFGhIj', 'ABCdeFGhij', 'ABCdeFGhiJ', 'ABCdeFghiJ', 'ABCdeFghij', 'ABCdeFghIj', 'ABCdeFghIJ', 'ABCdeFgHIJ', 'ABCdeFgHIj', 'ABCdeFgHij', 'ABCdeFgHiJ', 'ABcdeFgHiJ', 'ABcdeFgHij', 'ABcdeFgHIj', 'ABcdeFgHIJ', 'ABcdeFghIJ', 'ABcdeFghIj', 'ABcdeFghij', 'ABcdeFghiJ', 'ABcdeFGhiJ', 'ABcdeFGhij', 'ABcdeFGhIj', 'ABcdeFGhIJ', 'ABcdeFGHIJ', 'ABcdeFGHIj', 'ABcdeFGHij', 'ABcdeFGHiJ', 'ABcdefGHiJ', 'ABcdefGHij', 'ABcdefGHIj', 'ABcdefGHIJ', 'ABcdefGhIJ', 'ABcdefGhIj', 'ABcdefGhij', 'ABcdefGhiJ', 'ABcdefghiJ', 'ABcdefghij', 'ABcdefghIj', 'ABcdefghIJ', 'ABcdefgHIJ', 'ABcdefgHIj', 'ABcdefgHij', 'ABcdefgHiJ', 'ABcdEfgHiJ', 'ABcdEfgHij', 'ABcdEfgHIj', 'ABcdEfgHIJ', 'ABcdEfghIJ', 'ABcdEfghIj', 'ABcdEfghij', 'ABcdEfghiJ', 'ABcdEfGhiJ', 'ABcdEfGhij', 'ABcdEfGhIj', 'ABcdEfGhIJ', 'ABcdEfGHIJ', 'ABcdEfGHIj', 'ABcdEfGHij', 'ABcdEfGHiJ', 'ABcdEFGHiJ', 'ABcdEFGHij', 'ABcdEFGHIj', 'ABcdEFGHIJ', 'ABcdEFGhIJ', 'ABcdEFGhIj', 'ABcdEFGhij', 'ABcdEFGhiJ', 'ABcdEFghiJ', 'ABcdEFghij', 'ABcdEFghIj', 'ABcdEFghIJ', 'ABcdEFgHIJ', 'ABcdEFgHIj', 'ABcdEFgHij', 'ABcdEFgHiJ', 'ABcDEFgHiJ', 'ABcDEFgHij', 'ABcDEFgHIj', 'ABcDEFgHIJ', 'ABcDEFghIJ', 'ABcDEFghIj', 'ABcDEFghij', 'ABcDEFghiJ', 'ABcDEFGhiJ', 'ABcDEFGhij', 'ABcDEFGhIj', 'ABcDEFGhIJ', 'ABcDEFGHIJ', 'ABcDEFGHIj', 'ABcDEFGHij', 'ABcDEFGHiJ', 'ABcDEfGHiJ', 'ABcDEfGHij', 'ABcDEfGHIj', 'ABcDEfGHIJ', 'ABcDEfGhIJ', 'ABcDEfGhIj', 'ABcDEfGhij', 'ABcDEfGhiJ', 'ABcDEfghiJ', 'ABcDEfghij', 'ABcDEfghIj', 'ABcDEfghIJ', 'ABcDEfgHIJ', 'ABcDEfgHIj', 'ABcDEfgHij', 'ABcDEfgHiJ', 'ABcDefgHiJ', 'ABcDefgHij', 'ABcDefgHIj', 'ABcDefgHIJ', 'ABcDefghIJ', 'ABcDefghIj', 'ABcDefghij', 'ABcDefghiJ', 'ABcDefGhiJ', 'ABcDefGhij', 'ABcDefGhIj', 'ABcDefGhIJ', 'ABcDefGHIJ', 'ABcDefGHIj', 'ABcDefGHij', 'ABcDefGHiJ', 'ABcDeFGHiJ', 'ABcDeFGHij', 'ABcDeFGHIj', 'ABcDeFGHIJ', 'ABcDeFGhIJ', 'ABcDeFGhIj', 'ABcDeFGhij', 'ABcDeFGhiJ', 'ABcDeFghiJ', 'ABcDeFghij', 'ABcDeFghIj', 'ABcDeFghIJ', 'ABcDeFgHIJ', 'ABcDeFgHIj', 'ABcDeFgHij', 'ABcDeFgHiJ']\n assert candidate(s = \"aBcDeFgHiJ12345\") == ['aBcDeFgHiJ12345', 'aBcDeFgHij12345', 'aBcDeFgHIj12345', 'aBcDeFgHIJ12345', 'aBcDeFghIJ12345', 'aBcDeFghIj12345', 'aBcDeFghij12345', 'aBcDeFghiJ12345', 'aBcDeFGhiJ12345', 'aBcDeFGhij12345', 'aBcDeFGhIj12345', 'aBcDeFGhIJ12345', 'aBcDeFGHIJ12345', 'aBcDeFGHIj12345', 'aBcDeFGHij12345', 'aBcDeFGHiJ12345', 'aBcDefGHiJ12345', 'aBcDefGHij12345', 'aBcDefGHIj12345', 'aBcDefGHIJ12345', 'aBcDefGhIJ12345', 'aBcDefGhIj12345', 'aBcDefGhij12345', 'aBcDefGhiJ12345', 'aBcDefghiJ12345', 'aBcDefghij12345', 'aBcDefghIj12345', 'aBcDefghIJ12345', 'aBcDefgHIJ12345', 'aBcDefgHIj12345', 'aBcDefgHij12345', 'aBcDefgHiJ12345', 'aBcDEfgHiJ12345', 'aBcDEfgHij12345', 'aBcDEfgHIj12345', 'aBcDEfgHIJ12345', 'aBcDEfghIJ12345', 'aBcDEfghIj12345', 'aBcDEfghij12345', 'aBcDEfghiJ12345', 'aBcDEfGhiJ12345', 'aBcDEfGhij12345', 'aBcDEfGhIj12345', 'aBcDEfGhIJ12345', 'aBcDEfGHIJ12345', 'aBcDEfGHIj12345', 'aBcDEfGHij12345', 'aBcDEfGHiJ12345', 'aBcDEFGHiJ12345', 'aBcDEFGHij12345', 'aBcDEFGHIj12345', 'aBcDEFGHIJ12345', 'aBcDEFGhIJ12345', 'aBcDEFGhIj12345', 'aBcDEFGhij12345', 'aBcDEFGhiJ12345', 'aBcDEFghiJ12345', 'aBcDEFghij12345', 'aBcDEFghIj12345', 'aBcDEFghIJ12345', 'aBcDEFgHIJ12345', 'aBcDEFgHIj12345', 'aBcDEFgHij12345', 'aBcDEFgHiJ12345', 'aBcdEFgHiJ12345', 'aBcdEFgHij12345', 'aBcdEFgHIj12345', 'aBcdEFgHIJ12345', 'aBcdEFghIJ12345', 'aBcdEFghIj12345', 'aBcdEFghij12345', 'aBcdEFghiJ12345', 'aBcdEFGhiJ12345', 'aBcdEFGhij12345', 'aBcdEFGhIj12345', 'aBcdEFGhIJ12345', 'aBcdEFGHIJ12345', 'aBcdEFGHIj12345', 'aBcdEFGHij12345', 'aBcdEFGHiJ12345', 'aBcdEfGHiJ12345', 'aBcdEfGHij12345', 'aBcdEfGHIj12345', 'aBcdEfGHIJ12345', 'aBcdEfGhIJ12345', 'aBcdEfGhIj12345', 'aBcdEfGhij12345', 'aBcdEfGhiJ12345', 'aBcdEfghiJ12345', 'aBcdEfghij12345', 'aBcdEfghIj12345', 'aBcdEfghIJ12345', 'aBcdEfgHIJ12345', 'aBcdEfgHIj12345', 'aBcdEfgHij12345', 'aBcdEfgHiJ12345', 'aBcdefgHiJ12345', 'aBcdefgHij12345', 'aBcdefgHIj12345', 'aBcdefgHIJ12345', 'aBcdefghIJ12345', 'aBcdefghIj12345', 'aBcdefghij12345', 'aBcdefghiJ12345', 'aBcdefGhiJ12345', 'aBcdefGhij12345', 'aBcdefGhIj12345', 'aBcdefGhIJ12345', 'aBcdefGHIJ12345', 'aBcdefGHIj12345', 'aBcdefGHij12345', 'aBcdefGHiJ12345', 'aBcdeFGHiJ12345', 'aBcdeFGHij12345', 'aBcdeFGHIj12345', 'aBcdeFGHIJ12345', 'aBcdeFGhIJ12345', 'aBcdeFGhIj12345', 'aBcdeFGhij12345', 'aBcdeFGhiJ12345', 'aBcdeFghiJ12345', 'aBcdeFghij12345', 'aBcdeFghIj12345', 'aBcdeFghIJ12345', 'aBcdeFgHIJ12345', 'aBcdeFgHIj12345', 'aBcdeFgHij12345', 'aBcdeFgHiJ12345', 'aBCdeFgHiJ12345', 'aBCdeFgHij12345', 'aBCdeFgHIj12345', 'aBCdeFgHIJ12345', 'aBCdeFghIJ12345', 'aBCdeFghIj12345', 'aBCdeFghij12345', 'aBCdeFghiJ12345', 'aBCdeFGhiJ12345', 'aBCdeFGhij12345', 'aBCdeFGhIj12345', 'aBCdeFGhIJ12345', 'aBCdeFGHIJ12345', 'aBCdeFGHIj12345', 'aBCdeFGHij12345', 'aBCdeFGHiJ12345', 'aBCdefGHiJ12345', 'aBCdefGHij12345', 'aBCdefGHIj12345', 'aBCdefGHIJ12345', 'aBCdefGhIJ12345', 'aBCdefGhIj12345', 'aBCdefGhij12345', 'aBCdefGhiJ12345', 'aBCdefghiJ12345', 'aBCdefghij12345', 'aBCdefghIj12345', 'aBCdefghIJ12345', 'aBCdefgHIJ12345', 'aBCdefgHIj12345', 'aBCdefgHij12345', 'aBCdefgHiJ12345', 'aBCdEfgHiJ12345', 'aBCdEfgHij12345', 'aBCdEfgHIj12345', 'aBCdEfgHIJ12345', 'aBCdEfghIJ12345', 'aBCdEfghIj12345', 'aBCdEfghij12345', 'aBCdEfghiJ12345', 'aBCdEfGhiJ12345', 'aBCdEfGhij12345', 'aBCdEfGhIj12345', 'aBCdEfGhIJ12345', 'aBCdEfGHIJ12345', 'aBCdEfGHIj12345', 'aBCdEfGHij12345', 'aBCdEfGHiJ12345', 'aBCdEFGHiJ12345', 'aBCdEFGHij12345', 'aBCdEFGHIj12345', 'aBCdEFGHIJ12345', 'aBCdEFGhIJ12345', 'aBCdEFGhIj12345', 'aBCdEFGhij12345', 'aBCdEFGhiJ12345', 'aBCdEFghiJ12345', 'aBCdEFghij12345', 'aBCdEFghIj12345', 'aBCdEFghIJ12345', 'aBCdEFgHIJ12345', 'aBCdEFgHIj12345', 'aBCdEFgHij12345', 'aBCdEFgHiJ12345', 'aBCDEFgHiJ12345', 'aBCDEFgHij12345', 'aBCDEFgHIj12345', 'aBCDEFgHIJ12345', 'aBCDEFghIJ12345', 'aBCDEFghIj12345', 'aBCDEFghij12345', 'aBCDEFghiJ12345', 'aBCDEFGhiJ12345', 'aBCDEFGhij12345', 'aBCDEFGhIj12345', 'aBCDEFGhIJ12345', 'aBCDEFGHIJ12345', 'aBCDEFGHIj12345', 'aBCDEFGHij12345', 'aBCDEFGHiJ12345', 'aBCDEfGHiJ12345', 'aBCDEfGHij12345', 'aBCDEfGHIj12345', 'aBCDEfGHIJ12345', 'aBCDEfGhIJ12345', 'aBCDEfGhIj12345', 'aBCDEfGhij12345', 'aBCDEfGhiJ12345', 'aBCDEfghiJ12345', 'aBCDEfghij12345', 'aBCDEfghIj12345', 'aBCDEfghIJ12345', 'aBCDEfgHIJ12345', 'aBCDEfgHIj12345', 'aBCDEfgHij12345', 'aBCDEfgHiJ12345', 'aBCDefgHiJ12345', 'aBCDefgHij12345', 'aBCDefgHIj12345', 'aBCDefgHIJ12345', 'aBCDefghIJ12345', 'aBCDefghIj12345', 'aBCDefghij12345', 'aBCDefghiJ12345', 'aBCDefGhiJ12345', 'aBCDefGhij12345', 'aBCDefGhIj12345', 'aBCDefGhIJ12345', 'aBCDefGHIJ12345', 'aBCDefGHIj12345', 'aBCDefGHij12345', 'aBCDefGHiJ12345', 'aBCDeFGHiJ12345', 'aBCDeFGHij12345', 'aBCDeFGHIj12345', 'aBCDeFGHIJ12345', 'aBCDeFGhIJ12345', 'aBCDeFGhIj12345', 'aBCDeFGhij12345', 'aBCDeFGhiJ12345', 'aBCDeFghiJ12345', 'aBCDeFghij12345', 'aBCDeFghIj12345', 'aBCDeFghIJ12345', 'aBCDeFgHIJ12345', 'aBCDeFgHIj12345', 'aBCDeFgHij12345', 'aBCDeFgHiJ12345', 'abCDeFgHiJ12345', 'abCDeFgHij12345', 'abCDeFgHIj12345', 'abCDeFgHIJ12345', 'abCDeFghIJ12345', 'abCDeFghIj12345', 'abCDeFghij12345', 'abCDeFghiJ12345', 'abCDeFGhiJ12345', 'abCDeFGhij12345', 'abCDeFGhIj12345', 'abCDeFGhIJ12345', 'abCDeFGHIJ12345', 'abCDeFGHIj12345', 'abCDeFGHij12345', 'abCDeFGHiJ12345', 'abCDefGHiJ12345', 'abCDefGHij12345', 'abCDefGHIj12345', 'abCDefGHIJ12345', 'abCDefGhIJ12345', 'abCDefGhIj12345', 'abCDefGhij12345', 'abCDefGhiJ12345', 'abCDefghiJ12345', 'abCDefghij12345', 'abCDefghIj12345', 'abCDefghIJ12345', 'abCDefgHIJ12345', 'abCDefgHIj12345', 'abCDefgHij12345', 'abCDefgHiJ12345', 'abCDEfgHiJ12345', 'abCDEfgHij12345', 'abCDEfgHIj12345', 'abCDEfgHIJ12345', 'abCDEfghIJ12345', 'abCDEfghIj12345', 'abCDEfghij12345', 'abCDEfghiJ12345', 'abCDEfGhiJ12345', 'abCDEfGhij12345', 'abCDEfGhIj12345', 'abCDEfGhIJ12345', 'abCDEfGHIJ12345', 'abCDEfGHIj12345', 'abCDEfGHij12345', 'abCDEfGHiJ12345', 'abCDEFGHiJ12345', 'abCDEFGHij12345', 'abCDEFGHIj12345', 'abCDEFGHIJ12345', 'abCDEFGhIJ12345', 'abCDEFGhIj12345', 'abCDEFGhij12345', 'abCDEFGhiJ12345', 'abCDEFghiJ12345', 'abCDEFghij12345', 'abCDEFghIj12345', 'abCDEFghIJ12345', 'abCDEFgHIJ12345', 'abCDEFgHIj12345', 'abCDEFgHij12345', 'abCDEFgHiJ12345', 'abCdEFgHiJ12345', 'abCdEFgHij12345', 'abCdEFgHIj12345', 'abCdEFgHIJ12345', 'abCdEFghIJ12345', 'abCdEFghIj12345', 'abCdEFghij12345', 'abCdEFghiJ12345', 'abCdEFGhiJ12345', 'abCdEFGhij12345', 'abCdEFGhIj12345', 'abCdEFGhIJ12345', 'abCdEFGHIJ12345', 'abCdEFGHIj12345', 'abCdEFGHij12345', 'abCdEFGHiJ12345', 'abCdEfGHiJ12345', 'abCdEfGHij12345', 'abCdEfGHIj12345', 'abCdEfGHIJ12345', 'abCdEfGhIJ12345', 'abCdEfGhIj12345', 'abCdEfGhij12345', 'abCdEfGhiJ12345', 'abCdEfghiJ12345', 'abCdEfghij12345', 'abCdEfghIj12345', 'abCdEfghIJ12345', 'abCdEfgHIJ12345', 'abCdEfgHIj12345', 'abCdEfgHij12345', 'abCdEfgHiJ12345', 'abCdefgHiJ12345', 'abCdefgHij12345', 'abCdefgHIj12345', 'abCdefgHIJ12345', 'abCdefghIJ12345', 'abCdefghIj12345', 'abCdefghij12345', 'abCdefghiJ12345', 'abCdefGhiJ12345', 'abCdefGhij12345', 'abCdefGhIj12345', 'abCdefGhIJ12345', 'abCdefGHIJ12345', 'abCdefGHIj12345', 'abCdefGHij12345', 'abCdefGHiJ12345', 'abCdeFGHiJ12345', 'abCdeFGHij12345', 'abCdeFGHIj12345', 'abCdeFGHIJ12345', 'abCdeFGhIJ12345', 'abCdeFGhIj12345', 'abCdeFGhij12345', 'abCdeFGhiJ12345', 'abCdeFghiJ12345', 'abCdeFghij12345', 'abCdeFghIj12345', 'abCdeFghIJ12345', 'abCdeFgHIJ12345', 'abCdeFgHIj12345', 'abCdeFgHij12345', 'abCdeFgHiJ12345', 'abcdeFgHiJ12345', 'abcdeFgHij12345', 'abcdeFgHIj12345', 'abcdeFgHIJ12345', 'abcdeFghIJ12345', 'abcdeFghIj12345', 'abcdeFghij12345', 'abcdeFghiJ12345', 'abcdeFGhiJ12345', 'abcdeFGhij12345', 'abcdeFGhIj12345', 'abcdeFGhIJ12345', 'abcdeFGHIJ12345', 'abcdeFGHIj12345', 'abcdeFGHij12345', 'abcdeFGHiJ12345', 'abcdefGHiJ12345', 'abcdefGHij12345', 'abcdefGHIj12345', 'abcdefGHIJ12345', 'abcdefGhIJ12345', 'abcdefGhIj12345', 'abcdefGhij12345', 'abcdefGhiJ12345', 'abcdefghiJ12345', 'abcdefghij12345', 'abcdefghIj12345', 'abcdefghIJ12345', 'abcdefgHIJ12345', 'abcdefgHIj12345', 'abcdefgHij12345', 'abcdefgHiJ12345', 'abcdEfgHiJ12345', 'abcdEfgHij12345', 'abcdEfgHIj12345', 'abcdEfgHIJ12345', 'abcdEfghIJ12345', 'abcdEfghIj12345', 'abcdEfghij12345', 'abcdEfghiJ12345', 'abcdEfGhiJ12345', 'abcdEfGhij12345', 'abcdEfGhIj12345', 'abcdEfGhIJ12345', 'abcdEfGHIJ12345', 'abcdEfGHIj12345', 'abcdEfGHij12345', 'abcdEfGHiJ12345', 'abcdEFGHiJ12345', 'abcdEFGHij12345', 'abcdEFGHIj12345', 'abcdEFGHIJ12345', 'abcdEFGhIJ12345', 'abcdEFGhIj12345', 'abcdEFGhij12345', 'abcdEFGhiJ12345', 'abcdEFghiJ12345', 'abcdEFghij12345', 'abcdEFghIj12345', 'abcdEFghIJ12345', 'abcdEFgHIJ12345', 'abcdEFgHIj12345', 'abcdEFgHij12345', 'abcdEFgHiJ12345', 'abcDEFgHiJ12345', 'abcDEFgHij12345', 'abcDEFgHIj12345', 'abcDEFgHIJ12345', 'abcDEFghIJ12345', 'abcDEFghIj12345', 'abcDEFghij12345', 'abcDEFghiJ12345', 'abcDEFGhiJ12345', 'abcDEFGhij12345', 'abcDEFGhIj12345', 'abcDEFGhIJ12345', 'abcDEFGHIJ12345', 'abcDEFGHIj12345', 'abcDEFGHij12345', 'abcDEFGHiJ12345', 'abcDEfGHiJ12345', 'abcDEfGHij12345', 'abcDEfGHIj12345', 'abcDEfGHIJ12345', 'abcDEfGhIJ12345', 'abcDEfGhIj12345', 'abcDEfGhij12345', 'abcDEfGhiJ12345', 'abcDEfghiJ12345', 'abcDEfghij12345', 'abcDEfghIj12345', 'abcDEfghIJ12345', 'abcDEfgHIJ12345', 'abcDEfgHIj12345', 'abcDEfgHij12345', 'abcDEfgHiJ12345', 'abcDefgHiJ12345', 'abcDefgHij12345', 'abcDefgHIj12345', 'abcDefgHIJ12345', 'abcDefghIJ12345', 'abcDefghIj12345', 'abcDefghij12345', 'abcDefghiJ12345', 'abcDefGhiJ12345', 'abcDefGhij12345', 'abcDefGhIj12345', 'abcDefGhIJ12345', 'abcDefGHIJ12345', 'abcDefGHIj12345', 'abcDefGHij12345', 'abcDefGHiJ12345', 'abcDeFGHiJ12345', 'abcDeFGHij12345', 'abcDeFGHIj12345', 'abcDeFGHIJ12345', 'abcDeFGhIJ12345', 'abcDeFGhIj12345', 'abcDeFGhij12345', 'abcDeFGhiJ12345', 'abcDeFghiJ12345', 'abcDeFghij12345', 'abcDeFghIj12345', 'abcDeFghIJ12345', 'abcDeFgHIJ12345', 'abcDeFgHIj12345', 'abcDeFgHij12345', 'abcDeFgHiJ12345', 'AbcDeFgHiJ12345', 'AbcDeFgHij12345', 'AbcDeFgHIj12345', 'AbcDeFgHIJ12345', 'AbcDeFghIJ12345', 'AbcDeFghIj12345', 'AbcDeFghij12345', 'AbcDeFghiJ12345', 'AbcDeFGhiJ12345', 'AbcDeFGhij12345', 'AbcDeFGhIj12345', 'AbcDeFGhIJ12345', 'AbcDeFGHIJ12345', 'AbcDeFGHIj12345', 'AbcDeFGHij12345', 'AbcDeFGHiJ12345', 'AbcDefGHiJ12345', 'AbcDefGHij12345', 'AbcDefGHIj12345', 'AbcDefGHIJ12345', 'AbcDefGhIJ12345', 'AbcDefGhIj12345', 'AbcDefGhij12345', 'AbcDefGhiJ12345', 'AbcDefghiJ12345', 'AbcDefghij12345', 'AbcDefghIj12345', 'AbcDefghIJ12345', 'AbcDefgHIJ12345', 'AbcDefgHIj12345', 'AbcDefgHij12345', 'AbcDefgHiJ12345', 'AbcDEfgHiJ12345', 'AbcDEfgHij12345', 'AbcDEfgHIj12345', 'AbcDEfgHIJ12345', 'AbcDEfghIJ12345', 'AbcDEfghIj12345', 'AbcDEfghij12345', 'AbcDEfghiJ12345', 'AbcDEfGhiJ12345', 'AbcDEfGhij12345', 'AbcDEfGhIj12345', 'AbcDEfGhIJ12345', 'AbcDEfGHIJ12345', 'AbcDEfGHIj12345', 'AbcDEfGHij12345', 'AbcDEfGHiJ12345', 'AbcDEFGHiJ12345', 'AbcDEFGHij12345', 'AbcDEFGHIj12345', 'AbcDEFGHIJ12345', 'AbcDEFGhIJ12345', 'AbcDEFGhIj12345', 'AbcDEFGhij12345', 'AbcDEFGhiJ12345', 'AbcDEFghiJ12345', 'AbcDEFghij12345', 'AbcDEFghIj12345', 'AbcDEFghIJ12345', 'AbcDEFgHIJ12345', 'AbcDEFgHIj12345', 'AbcDEFgHij12345', 'AbcDEFgHiJ12345', 'AbcdEFgHiJ12345', 'AbcdEFgHij12345', 'AbcdEFgHIj12345', 'AbcdEFgHIJ12345', 'AbcdEFghIJ12345', 'AbcdEFghIj12345', 'AbcdEFghij12345', 'AbcdEFghiJ12345', 'AbcdEFGhiJ12345', 'AbcdEFGhij12345', 'AbcdEFGhIj12345', 'AbcdEFGhIJ12345', 'AbcdEFGHIJ12345', 'AbcdEFGHIj12345', 'AbcdEFGHij12345', 'AbcdEFGHiJ12345', 'AbcdEfGHiJ12345', 'AbcdEfGHij12345', 'AbcdEfGHIj12345', 'AbcdEfGHIJ12345', 'AbcdEfGhIJ12345', 'AbcdEfGhIj12345', 'AbcdEfGhij12345', 'AbcdEfGhiJ12345', 'AbcdEfghiJ12345', 'AbcdEfghij12345', 'AbcdEfghIj12345', 'AbcdEfghIJ12345', 'AbcdEfgHIJ12345', 'AbcdEfgHIj12345', 'AbcdEfgHij12345', 'AbcdEfgHiJ12345', 'AbcdefgHiJ12345', 'AbcdefgHij12345', 'AbcdefgHIj12345', 'AbcdefgHIJ12345', 'AbcdefghIJ12345', 'AbcdefghIj12345', 'Abcdefghij12345', 'AbcdefghiJ12345', 'AbcdefGhiJ12345', 'AbcdefGhij12345', 'AbcdefGhIj12345', 'AbcdefGhIJ12345', 'AbcdefGHIJ12345', 'AbcdefGHIj12345', 'AbcdefGHij12345', 'AbcdefGHiJ12345', 'AbcdeFGHiJ12345', 'AbcdeFGHij12345', 'AbcdeFGHIj12345', 'AbcdeFGHIJ12345', 'AbcdeFGhIJ12345', 'AbcdeFGhIj12345', 'AbcdeFGhij12345', 'AbcdeFGhiJ12345', 'AbcdeFghiJ12345', 'AbcdeFghij12345', 'AbcdeFghIj12345', 'AbcdeFghIJ12345', 'AbcdeFgHIJ12345', 'AbcdeFgHIj12345', 'AbcdeFgHij12345', 'AbcdeFgHiJ12345', 'AbCdeFgHiJ12345', 'AbCdeFgHij12345', 'AbCdeFgHIj12345', 'AbCdeFgHIJ12345', 'AbCdeFghIJ12345', 'AbCdeFghIj12345', 'AbCdeFghij12345', 'AbCdeFghiJ12345', 'AbCdeFGhiJ12345', 'AbCdeFGhij12345', 'AbCdeFGhIj12345', 'AbCdeFGhIJ12345', 'AbCdeFGHIJ12345', 'AbCdeFGHIj12345', 'AbCdeFGHij12345', 'AbCdeFGHiJ12345', 'AbCdefGHiJ12345', 'AbCdefGHij12345', 'AbCdefGHIj12345', 'AbCdefGHIJ12345', 'AbCdefGhIJ12345', 'AbCdefGhIj12345', 'AbCdefGhij12345', 'AbCdefGhiJ12345', 'AbCdefghiJ12345', 'AbCdefghij12345', 'AbCdefghIj12345', 'AbCdefghIJ12345', 'AbCdefgHIJ12345', 'AbCdefgHIj12345', 'AbCdefgHij12345', 'AbCdefgHiJ12345', 'AbCdEfgHiJ12345', 'AbCdEfgHij12345', 'AbCdEfgHIj12345', 'AbCdEfgHIJ12345', 'AbCdEfghIJ12345', 'AbCdEfghIj12345', 'AbCdEfghij12345', 'AbCdEfghiJ12345', 'AbCdEfGhiJ12345', 'AbCdEfGhij12345', 'AbCdEfGhIj12345', 'AbCdEfGhIJ12345', 'AbCdEfGHIJ12345', 'AbCdEfGHIj12345', 'AbCdEfGHij12345', 'AbCdEfGHiJ12345', 'AbCdEFGHiJ12345', 'AbCdEFGHij12345', 'AbCdEFGHIj12345', 'AbCdEFGHIJ12345', 'AbCdEFGhIJ12345', 'AbCdEFGhIj12345', 'AbCdEFGhij12345', 'AbCdEFGhiJ12345', 'AbCdEFghiJ12345', 'AbCdEFghij12345', 'AbCdEFghIj12345', 'AbCdEFghIJ12345', 'AbCdEFgHIJ12345', 'AbCdEFgHIj12345', 'AbCdEFgHij12345', 'AbCdEFgHiJ12345', 'AbCDEFgHiJ12345', 'AbCDEFgHij12345', 'AbCDEFgHIj12345', 'AbCDEFgHIJ12345', 'AbCDEFghIJ12345', 'AbCDEFghIj12345', 'AbCDEFghij12345', 'AbCDEFghiJ12345', 'AbCDEFGhiJ12345', 'AbCDEFGhij12345', 'AbCDEFGhIj12345', 'AbCDEFGhIJ12345', 'AbCDEFGHIJ12345', 'AbCDEFGHIj12345', 'AbCDEFGHij12345', 'AbCDEFGHiJ12345', 'AbCDEfGHiJ12345', 'AbCDEfGHij12345', 'AbCDEfGHIj12345', 'AbCDEfGHIJ12345', 'AbCDEfGhIJ12345', 'AbCDEfGhIj12345', 'AbCDEfGhij12345', 'AbCDEfGhiJ12345', 'AbCDEfghiJ12345', 'AbCDEfghij12345', 'AbCDEfghIj12345', 'AbCDEfghIJ12345', 'AbCDEfgHIJ12345', 'AbCDEfgHIj12345', 'AbCDEfgHij12345', 'AbCDEfgHiJ12345', 'AbCDefgHiJ12345', 'AbCDefgHij12345', 'AbCDefgHIj12345', 'AbCDefgHIJ12345', 'AbCDefghIJ12345', 'AbCDefghIj12345', 'AbCDefghij12345', 'AbCDefghiJ12345', 'AbCDefGhiJ12345', 'AbCDefGhij12345', 'AbCDefGhIj12345', 'AbCDefGhIJ12345', 'AbCDefGHIJ12345', 'AbCDefGHIj12345', 'AbCDefGHij12345', 'AbCDefGHiJ12345', 'AbCDeFGHiJ12345', 'AbCDeFGHij12345', 'AbCDeFGHIj12345', 'AbCDeFGHIJ12345', 'AbCDeFGhIJ12345', 'AbCDeFGhIj12345', 'AbCDeFGhij12345', 'AbCDeFGhiJ12345', 'AbCDeFghiJ12345', 'AbCDeFghij12345', 'AbCDeFghIj12345', 'AbCDeFghIJ12345', 'AbCDeFgHIJ12345', 'AbCDeFgHIj12345', 'AbCDeFgHij12345', 'AbCDeFgHiJ12345', 'ABCDeFgHiJ12345', 'ABCDeFgHij12345', 'ABCDeFgHIj12345', 'ABCDeFgHIJ12345', 'ABCDeFghIJ12345', 'ABCDeFghIj12345', 'ABCDeFghij12345', 'ABCDeFghiJ12345', 'ABCDeFGhiJ12345', 'ABCDeFGhij12345', 'ABCDeFGhIj12345', 'ABCDeFGhIJ12345', 'ABCDeFGHIJ12345', 'ABCDeFGHIj12345', 'ABCDeFGHij12345', 'ABCDeFGHiJ12345', 'ABCDefGHiJ12345', 'ABCDefGHij12345', 'ABCDefGHIj12345', 'ABCDefGHIJ12345', 'ABCDefGhIJ12345', 'ABCDefGhIj12345', 'ABCDefGhij12345', 'ABCDefGhiJ12345', 'ABCDefghiJ12345', 'ABCDefghij12345', 'ABCDefghIj12345', 'ABCDefghIJ12345', 'ABCDefgHIJ12345', 'ABCDefgHIj12345', 'ABCDefgHij12345', 'ABCDefgHiJ12345', 'ABCDEfgHiJ12345', 'ABCDEfgHij12345', 'ABCDEfgHIj12345', 'ABCDEfgHIJ12345', 'ABCDEfghIJ12345', 'ABCDEfghIj12345', 'ABCDEfghij12345', 'ABCDEfghiJ12345', 'ABCDEfGhiJ12345', 'ABCDEfGhij12345', 'ABCDEfGhIj12345', 'ABCDEfGhIJ12345', 'ABCDEfGHIJ12345', 'ABCDEfGHIj12345', 'ABCDEfGHij12345', 'ABCDEfGHiJ12345', 'ABCDEFGHiJ12345', 'ABCDEFGHij12345', 'ABCDEFGHIj12345', 'ABCDEFGHIJ12345', 'ABCDEFGhIJ12345', 'ABCDEFGhIj12345', 'ABCDEFGhij12345', 'ABCDEFGhiJ12345', 'ABCDEFghiJ12345', 'ABCDEFghij12345', 'ABCDEFghIj12345', 'ABCDEFghIJ12345', 'ABCDEFgHIJ12345', 'ABCDEFgHIj12345', 'ABCDEFgHij12345', 'ABCDEFgHiJ12345', 'ABCdEFgHiJ12345', 'ABCdEFgHij12345', 'ABCdEFgHIj12345', 'ABCdEFgHIJ12345', 'ABCdEFghIJ12345', 'ABCdEFghIj12345', 'ABCdEFghij12345', 'ABCdEFghiJ12345', 'ABCdEFGhiJ12345', 'ABCdEFGhij12345', 'ABCdEFGhIj12345', 'ABCdEFGhIJ12345', 'ABCdEFGHIJ12345', 'ABCdEFGHIj12345', 'ABCdEFGHij12345', 'ABCdEFGHiJ12345', 'ABCdEfGHiJ12345', 'ABCdEfGHij12345', 'ABCdEfGHIj12345', 'ABCdEfGHIJ12345', 'ABCdEfGhIJ12345', 'ABCdEfGhIj12345', 'ABCdEfGhij12345', 'ABCdEfGhiJ12345', 'ABCdEfghiJ12345', 'ABCdEfghij12345', 'ABCdEfghIj12345', 'ABCdEfghIJ12345', 'ABCdEfgHIJ12345', 'ABCdEfgHIj12345', 'ABCdEfgHij12345', 'ABCdEfgHiJ12345', 'ABCdefgHiJ12345', 'ABCdefgHij12345', 'ABCdefgHIj12345', 'ABCdefgHIJ12345', 'ABCdefghIJ12345', 'ABCdefghIj12345', 'ABCdefghij12345', 'ABCdefghiJ12345', 'ABCdefGhiJ12345', 'ABCdefGhij12345', 'ABCdefGhIj12345', 'ABCdefGhIJ12345', 'ABCdefGHIJ12345', 'ABCdefGHIj12345', 'ABCdefGHij12345', 'ABCdefGHiJ12345', 'ABCdeFGHiJ12345', 'ABCdeFGHij12345', 'ABCdeFGHIj12345', 'ABCdeFGHIJ12345', 'ABCdeFGhIJ12345', 'ABCdeFGhIj12345', 'ABCdeFGhij12345', 'ABCdeFGhiJ12345', 'ABCdeFghiJ12345', 'ABCdeFghij12345', 'ABCdeFghIj12345', 'ABCdeFghIJ12345', 'ABCdeFgHIJ12345', 'ABCdeFgHIj12345', 'ABCdeFgHij12345', 'ABCdeFgHiJ12345', 'ABcdeFgHiJ12345', 'ABcdeFgHij12345', 'ABcdeFgHIj12345', 'ABcdeFgHIJ12345', 'ABcdeFghIJ12345', 'ABcdeFghIj12345', 'ABcdeFghij12345', 'ABcdeFghiJ12345', 'ABcdeFGhiJ12345', 'ABcdeFGhij12345', 'ABcdeFGhIj12345', 'ABcdeFGhIJ12345', 'ABcdeFGHIJ12345', 'ABcdeFGHIj12345', 'ABcdeFGHij12345', 'ABcdeFGHiJ12345', 'ABcdefGHiJ12345', 'ABcdefGHij12345', 'ABcdefGHIj12345', 'ABcdefGHIJ12345', 'ABcdefGhIJ12345', 'ABcdefGhIj12345', 'ABcdefGhij12345', 'ABcdefGhiJ12345', 'ABcdefghiJ12345', 'ABcdefghij12345', 'ABcdefghIj12345', 'ABcdefghIJ12345', 'ABcdefgHIJ12345', 'ABcdefgHIj12345', 'ABcdefgHij12345', 'ABcdefgHiJ12345', 'ABcdEfgHiJ12345', 'ABcdEfgHij12345', 'ABcdEfgHIj12345', 'ABcdEfgHIJ12345', 'ABcdEfghIJ12345', 'ABcdEfghIj12345', 'ABcdEfghij12345', 'ABcdEfghiJ12345', 'ABcdEfGhiJ12345', 'ABcdEfGhij12345', 'ABcdEfGhIj12345', 'ABcdEfGhIJ12345', 'ABcdEfGHIJ12345', 'ABcdEfGHIj12345', 'ABcdEfGHij12345', 'ABcdEfGHiJ12345', 'ABcdEFGHiJ12345', 'ABcdEFGHij12345', 'ABcdEFGHIj12345', 'ABcdEFGHIJ12345', 'ABcdEFGhIJ12345', 'ABcdEFGhIj12345', 'ABcdEFGhij12345', 'ABcdEFGhiJ12345', 'ABcdEFghiJ12345', 'ABcdEFghij12345', 'ABcdEFghIj12345', 'ABcdEFghIJ12345', 'ABcdEFgHIJ12345', 'ABcdEFgHIj12345', 'ABcdEFgHij12345', 'ABcdEFgHiJ12345', 'ABcDEFgHiJ12345', 'ABcDEFgHij12345', 'ABcDEFgHIj12345', 'ABcDEFgHIJ12345', 'ABcDEFghIJ12345', 'ABcDEFghIj12345', 'ABcDEFghij12345', 'ABcDEFghiJ12345', 'ABcDEFGhiJ12345', 'ABcDEFGhij12345', 'ABcDEFGhIj12345', 'ABcDEFGhIJ12345', 'ABcDEFGHIJ12345', 'ABcDEFGHIj12345', 'ABcDEFGHij12345', 'ABcDEFGHiJ12345', 'ABcDEfGHiJ12345', 'ABcDEfGHij12345', 'ABcDEfGHIj12345', 'ABcDEfGHIJ12345', 'ABcDEfGhIJ12345', 'ABcDEfGhIj12345', 'ABcDEfGhij12345', 'ABcDEfGhiJ12345', 'ABcDEfghiJ12345', 'ABcDEfghij12345', 'ABcDEfghIj12345', 'ABcDEfghIJ12345', 'ABcDEfgHIJ12345', 'ABcDEfgHIj12345', 'ABcDEfgHij12345', 'ABcDEfgHiJ12345', 'ABcDefgHiJ12345', 'ABcDefgHij12345', 'ABcDefgHIj12345', 'ABcDefgHIJ12345', 'ABcDefghIJ12345', 'ABcDefghIj12345', 'ABcDefghij12345', 'ABcDefghiJ12345', 'ABcDefGhiJ12345', 'ABcDefGhij12345', 'ABcDefGhIj12345', 'ABcDefGhIJ12345', 'ABcDefGHIJ12345', 'ABcDefGHIj12345', 'ABcDefGHij12345', 'ABcDefGHiJ12345', 'ABcDeFGHiJ12345', 'ABcDeFGHij12345', 'ABcDeFGHIj12345', 'ABcDeFGHIJ12345', 'ABcDeFGhIJ12345', 'ABcDeFGhIj12345', 'ABcDeFGhij12345', 'ABcDeFGhiJ12345', 'ABcDeFghiJ12345', 'ABcDeFghij12345', 'ABcDeFghIj12345', 'ABcDeFghIJ12345', 'ABcDeFgHIJ12345', 'ABcDeFgHIj12345', 'ABcDeFgHij12345', 'ABcDeFgHiJ12345']\n assert candidate(s = \"aBcDeFgH\") == ['aBcDeFgH', 'aBcDeFgh', 'aBcDeFGh', 'aBcDeFGH', 'aBcDefGH', 'aBcDefGh', 'aBcDefgh', 'aBcDefgH', 'aBcDEfgH', 'aBcDEfgh', 'aBcDEfGh', 'aBcDEfGH', 'aBcDEFGH', 'aBcDEFGh', 'aBcDEFgh', 'aBcDEFgH', 'aBcdEFgH', 'aBcdEFgh', 'aBcdEFGh', 'aBcdEFGH', 'aBcdEfGH', 'aBcdEfGh', 'aBcdEfgh', 'aBcdEfgH', 'aBcdefgH', 'aBcdefgh', 'aBcdefGh', 'aBcdefGH', 'aBcdeFGH', 'aBcdeFGh', 'aBcdeFgh', 'aBcdeFgH', 'aBCdeFgH', 'aBCdeFgh', 'aBCdeFGh', 'aBCdeFGH', 'aBCdefGH', 'aBCdefGh', 'aBCdefgh', 'aBCdefgH', 'aBCdEfgH', 'aBCdEfgh', 'aBCdEfGh', 'aBCdEfGH', 'aBCdEFGH', 'aBCdEFGh', 'aBCdEFgh', 'aBCdEFgH', 'aBCDEFgH', 'aBCDEFgh', 'aBCDEFGh', 'aBCDEFGH', 'aBCDEfGH', 'aBCDEfGh', 'aBCDEfgh', 'aBCDEfgH', 'aBCDefgH', 'aBCDefgh', 'aBCDefGh', 'aBCDefGH', 'aBCDeFGH', 'aBCDeFGh', 'aBCDeFgh', 'aBCDeFgH', 'abCDeFgH', 'abCDeFgh', 'abCDeFGh', 'abCDeFGH', 'abCDefGH', 'abCDefGh', 'abCDefgh', 'abCDefgH', 'abCDEfgH', 'abCDEfgh', 'abCDEfGh', 'abCDEfGH', 'abCDEFGH', 'abCDEFGh', 'abCDEFgh', 'abCDEFgH', 'abCdEFgH', 'abCdEFgh', 'abCdEFGh', 'abCdEFGH', 'abCdEfGH', 'abCdEfGh', 'abCdEfgh', 'abCdEfgH', 'abCdefgH', 'abCdefgh', 'abCdefGh', 'abCdefGH', 'abCdeFGH', 'abCdeFGh', 'abCdeFgh', 'abCdeFgH', 'abcdeFgH', 'abcdeFgh', 'abcdeFGh', 'abcdeFGH', 'abcdefGH', 'abcdefGh', 'abcdefgh', 'abcdefgH', 'abcdEfgH', 'abcdEfgh', 'abcdEfGh', 'abcdEfGH', 'abcdEFGH', 'abcdEFGh', 'abcdEFgh', 'abcdEFgH', 'abcDEFgH', 'abcDEFgh', 'abcDEFGh', 'abcDEFGH', 'abcDEfGH', 'abcDEfGh', 'abcDEfgh', 'abcDEfgH', 'abcDefgH', 'abcDefgh', 'abcDefGh', 'abcDefGH', 'abcDeFGH', 'abcDeFGh', 'abcDeFgh', 'abcDeFgH', 'AbcDeFgH', 'AbcDeFgh', 'AbcDeFGh', 'AbcDeFGH', 'AbcDefGH', 'AbcDefGh', 'AbcDefgh', 'AbcDefgH', 'AbcDEfgH', 'AbcDEfgh', 'AbcDEfGh', 'AbcDEfGH', 'AbcDEFGH', 'AbcDEFGh', 'AbcDEFgh', 'AbcDEFgH', 'AbcdEFgH', 'AbcdEFgh', 'AbcdEFGh', 'AbcdEFGH', 'AbcdEfGH', 'AbcdEfGh', 'AbcdEfgh', 'AbcdEfgH', 'AbcdefgH', 'Abcdefgh', 'AbcdefGh', 'AbcdefGH', 'AbcdeFGH', 'AbcdeFGh', 'AbcdeFgh', 'AbcdeFgH', 'AbCdeFgH', 'AbCdeFgh', 'AbCdeFGh', 'AbCdeFGH', 'AbCdefGH', 'AbCdefGh', 'AbCdefgh', 'AbCdefgH', 'AbCdEfgH', 'AbCdEfgh', 'AbCdEfGh', 'AbCdEfGH', 'AbCdEFGH', 'AbCdEFGh', 'AbCdEFgh', 'AbCdEFgH', 'AbCDEFgH', 'AbCDEFgh', 'AbCDEFGh', 'AbCDEFGH', 'AbCDEfGH', 'AbCDEfGh', 'AbCDEfgh', 'AbCDEfgH', 'AbCDefgH', 'AbCDefgh', 'AbCDefGh', 'AbCDefGH', 'AbCDeFGH', 'AbCDeFGh', 'AbCDeFgh', 'AbCDeFgH', 'ABCDeFgH', 'ABCDeFgh', 'ABCDeFGh', 'ABCDeFGH', 'ABCDefGH', 'ABCDefGh', 'ABCDefgh', 'ABCDefgH', 'ABCDEfgH', 'ABCDEfgh', 'ABCDEfGh', 'ABCDEfGH', 'ABCDEFGH', 'ABCDEFGh', 'ABCDEFgh', 'ABCDEFgH', 'ABCdEFgH', 'ABCdEFgh', 'ABCdEFGh', 'ABCdEFGH', 'ABCdEfGH', 'ABCdEfGh', 'ABCdEfgh', 'ABCdEfgH', 'ABCdefgH', 'ABCdefgh', 'ABCdefGh', 'ABCdefGH', 'ABCdeFGH', 'ABCdeFGh', 'ABCdeFgh', 'ABCdeFgH', 'ABcdeFgH', 'ABcdeFgh', 'ABcdeFGh', 'ABcdeFGH', 'ABcdefGH', 'ABcdefGh', 'ABcdefgh', 'ABcdefgH', 'ABcdEfgH', 'ABcdEfgh', 'ABcdEfGh', 'ABcdEfGH', 'ABcdEFGH', 'ABcdEFGh', 'ABcdEFgh', 'ABcdEFgH', 'ABcDEFgH', 'ABcDEFgh', 'ABcDEFGh', 'ABcDEFGH', 'ABcDEfGH', 'ABcDEfGh', 'ABcDEfgh', 'ABcDEfgH', 'ABcDefgH', 'ABcDefgh', 'ABcDefGh', 'ABcDefGH', 'ABcDeFGH', 'ABcDeFGh', 'ABcDeFgh', 'ABcDeFgH']\n assert candidate(s = \"mNoPQ\") == ['mNoPQ', 'mNoPq', 'mNopq', 'mNopQ', 'mNOpQ', 'mNOpq', 'mNOPq', 'mNOPQ', 'mnOPQ', 'mnOPq', 'mnOpq', 'mnOpQ', 'mnopQ', 'mnopq', 'mnoPq', 'mnoPQ', 'MnoPQ', 'MnoPq', 'Mnopq', 'MnopQ', 'MnOpQ', 'MnOpq', 'MnOPq', 'MnOPQ', 'MNOPQ', 'MNOPq', 'MNOpq', 'MNOpQ', 'MNopQ', 'MNopq', 'MNoPq', 'MNoPQ']\n assert candidate(s = \"aBcD3fGh4Ij5K\") == ['aBcD3fGh4Ij5K', 'aBcD3fGh4Ij5k', 'aBcD3fGh4IJ5k', 'aBcD3fGh4IJ5K', 'aBcD3fGh4iJ5K', 'aBcD3fGh4iJ5k', 'aBcD3fGh4ij5k', 'aBcD3fGh4ij5K', 'aBcD3fGH4ij5K', 'aBcD3fGH4ij5k', 'aBcD3fGH4iJ5k', 'aBcD3fGH4iJ5K', 'aBcD3fGH4IJ5K', 'aBcD3fGH4IJ5k', 'aBcD3fGH4Ij5k', 'aBcD3fGH4Ij5K', 'aBcD3fgH4Ij5K', 'aBcD3fgH4Ij5k', 'aBcD3fgH4IJ5k', 'aBcD3fgH4IJ5K', 'aBcD3fgH4iJ5K', 'aBcD3fgH4iJ5k', 'aBcD3fgH4ij5k', 'aBcD3fgH4ij5K', 'aBcD3fgh4ij5K', 'aBcD3fgh4ij5k', 'aBcD3fgh4iJ5k', 'aBcD3fgh4iJ5K', 'aBcD3fgh4IJ5K', 'aBcD3fgh4IJ5k', 'aBcD3fgh4Ij5k', 'aBcD3fgh4Ij5K', 'aBcD3Fgh4Ij5K', 'aBcD3Fgh4Ij5k', 'aBcD3Fgh4IJ5k', 'aBcD3Fgh4IJ5K', 'aBcD3Fgh4iJ5K', 'aBcD3Fgh4iJ5k', 'aBcD3Fgh4ij5k', 'aBcD3Fgh4ij5K', 'aBcD3FgH4ij5K', 'aBcD3FgH4ij5k', 'aBcD3FgH4iJ5k', 'aBcD3FgH4iJ5K', 'aBcD3FgH4IJ5K', 'aBcD3FgH4IJ5k', 'aBcD3FgH4Ij5k', 'aBcD3FgH4Ij5K', 'aBcD3FGH4Ij5K', 'aBcD3FGH4Ij5k', 'aBcD3FGH4IJ5k', 'aBcD3FGH4IJ5K', 'aBcD3FGH4iJ5K', 'aBcD3FGH4iJ5k', 'aBcD3FGH4ij5k', 'aBcD3FGH4ij5K', 'aBcD3FGh4ij5K', 'aBcD3FGh4ij5k', 'aBcD3FGh4iJ5k', 'aBcD3FGh4iJ5K', 'aBcD3FGh4IJ5K', 'aBcD3FGh4IJ5k', 'aBcD3FGh4Ij5k', 'aBcD3FGh4Ij5K', 'aBcd3FGh4Ij5K', 'aBcd3FGh4Ij5k', 'aBcd3FGh4IJ5k', 'aBcd3FGh4IJ5K', 'aBcd3FGh4iJ5K', 'aBcd3FGh4iJ5k', 'aBcd3FGh4ij5k', 'aBcd3FGh4ij5K', 'aBcd3FGH4ij5K', 'aBcd3FGH4ij5k', 'aBcd3FGH4iJ5k', 'aBcd3FGH4iJ5K', 'aBcd3FGH4IJ5K', 'aBcd3FGH4IJ5k', 'aBcd3FGH4Ij5k', 'aBcd3FGH4Ij5K', 'aBcd3FgH4Ij5K', 'aBcd3FgH4Ij5k', 'aBcd3FgH4IJ5k', 'aBcd3FgH4IJ5K', 'aBcd3FgH4iJ5K', 'aBcd3FgH4iJ5k', 'aBcd3FgH4ij5k', 'aBcd3FgH4ij5K', 'aBcd3Fgh4ij5K', 'aBcd3Fgh4ij5k', 'aBcd3Fgh4iJ5k', 'aBcd3Fgh4iJ5K', 'aBcd3Fgh4IJ5K', 'aBcd3Fgh4IJ5k', 'aBcd3Fgh4Ij5k', 'aBcd3Fgh4Ij5K', 'aBcd3fgh4Ij5K', 'aBcd3fgh4Ij5k', 'aBcd3fgh4IJ5k', 'aBcd3fgh4IJ5K', 'aBcd3fgh4iJ5K', 'aBcd3fgh4iJ5k', 'aBcd3fgh4ij5k', 'aBcd3fgh4ij5K', 'aBcd3fgH4ij5K', 'aBcd3fgH4ij5k', 'aBcd3fgH4iJ5k', 'aBcd3fgH4iJ5K', 'aBcd3fgH4IJ5K', 'aBcd3fgH4IJ5k', 'aBcd3fgH4Ij5k', 'aBcd3fgH4Ij5K', 'aBcd3fGH4Ij5K', 'aBcd3fGH4Ij5k', 'aBcd3fGH4IJ5k', 'aBcd3fGH4IJ5K', 'aBcd3fGH4iJ5K', 'aBcd3fGH4iJ5k', 'aBcd3fGH4ij5k', 'aBcd3fGH4ij5K', 'aBcd3fGh4ij5K', 'aBcd3fGh4ij5k', 'aBcd3fGh4iJ5k', 'aBcd3fGh4iJ5K', 'aBcd3fGh4IJ5K', 'aBcd3fGh4IJ5k', 'aBcd3fGh4Ij5k', 'aBcd3fGh4Ij5K', 'aBCd3fGh4Ij5K', 'aBCd3fGh4Ij5k', 'aBCd3fGh4IJ5k', 'aBCd3fGh4IJ5K', 'aBCd3fGh4iJ5K', 'aBCd3fGh4iJ5k', 'aBCd3fGh4ij5k', 'aBCd3fGh4ij5K', 'aBCd3fGH4ij5K', 'aBCd3fGH4ij5k', 'aBCd3fGH4iJ5k', 'aBCd3fGH4iJ5K', 'aBCd3fGH4IJ5K', 'aBCd3fGH4IJ5k', 'aBCd3fGH4Ij5k', 'aBCd3fGH4Ij5K', 'aBCd3fgH4Ij5K', 'aBCd3fgH4Ij5k', 'aBCd3fgH4IJ5k', 'aBCd3fgH4IJ5K', 'aBCd3fgH4iJ5K', 'aBCd3fgH4iJ5k', 'aBCd3fgH4ij5k', 'aBCd3fgH4ij5K', 'aBCd3fgh4ij5K', 'aBCd3fgh4ij5k', 'aBCd3fgh4iJ5k', 'aBCd3fgh4iJ5K', 'aBCd3fgh4IJ5K', 'aBCd3fgh4IJ5k', 'aBCd3fgh4Ij5k', 'aBCd3fgh4Ij5K', 'aBCd3Fgh4Ij5K', 'aBCd3Fgh4Ij5k', 'aBCd3Fgh4IJ5k', 'aBCd3Fgh4IJ5K', 'aBCd3Fgh4iJ5K', 'aBCd3Fgh4iJ5k', 'aBCd3Fgh4ij5k', 'aBCd3Fgh4ij5K', 'aBCd3FgH4ij5K', 'aBCd3FgH4ij5k', 'aBCd3FgH4iJ5k', 'aBCd3FgH4iJ5K', 'aBCd3FgH4IJ5K', 'aBCd3FgH4IJ5k', 'aBCd3FgH4Ij5k', 'aBCd3FgH4Ij5K', 'aBCd3FGH4Ij5K', 'aBCd3FGH4Ij5k', 'aBCd3FGH4IJ5k', 'aBCd3FGH4IJ5K', 'aBCd3FGH4iJ5K', 'aBCd3FGH4iJ5k', 'aBCd3FGH4ij5k', 'aBCd3FGH4ij5K', 'aBCd3FGh4ij5K', 'aBCd3FGh4ij5k', 'aBCd3FGh4iJ5k', 'aBCd3FGh4iJ5K', 'aBCd3FGh4IJ5K', 'aBCd3FGh4IJ5k', 'aBCd3FGh4Ij5k', 'aBCd3FGh4Ij5K', 'aBCD3FGh4Ij5K', 'aBCD3FGh4Ij5k', 'aBCD3FGh4IJ5k', 'aBCD3FGh4IJ5K', 'aBCD3FGh4iJ5K', 'aBCD3FGh4iJ5k', 'aBCD3FGh4ij5k', 'aBCD3FGh4ij5K', 'aBCD3FGH4ij5K', 'aBCD3FGH4ij5k', 'aBCD3FGH4iJ5k', 'aBCD3FGH4iJ5K', 'aBCD3FGH4IJ5K', 'aBCD3FGH4IJ5k', 'aBCD3FGH4Ij5k', 'aBCD3FGH4Ij5K', 'aBCD3FgH4Ij5K', 'aBCD3FgH4Ij5k', 'aBCD3FgH4IJ5k', 'aBCD3FgH4IJ5K', 'aBCD3FgH4iJ5K', 'aBCD3FgH4iJ5k', 'aBCD3FgH4ij5k', 'aBCD3FgH4ij5K', 'aBCD3Fgh4ij5K', 'aBCD3Fgh4ij5k', 'aBCD3Fgh4iJ5k', 'aBCD3Fgh4iJ5K', 'aBCD3Fgh4IJ5K', 'aBCD3Fgh4IJ5k', 'aBCD3Fgh4Ij5k', 'aBCD3Fgh4Ij5K', 'aBCD3fgh4Ij5K', 'aBCD3fgh4Ij5k', 'aBCD3fgh4IJ5k', 'aBCD3fgh4IJ5K', 'aBCD3fgh4iJ5K', 'aBCD3fgh4iJ5k', 'aBCD3fgh4ij5k', 'aBCD3fgh4ij5K', 'aBCD3fgH4ij5K', 'aBCD3fgH4ij5k', 'aBCD3fgH4iJ5k', 'aBCD3fgH4iJ5K', 'aBCD3fgH4IJ5K', 'aBCD3fgH4IJ5k', 'aBCD3fgH4Ij5k', 'aBCD3fgH4Ij5K', 'aBCD3fGH4Ij5K', 'aBCD3fGH4Ij5k', 'aBCD3fGH4IJ5k', 'aBCD3fGH4IJ5K', 'aBCD3fGH4iJ5K', 'aBCD3fGH4iJ5k', 'aBCD3fGH4ij5k', 'aBCD3fGH4ij5K', 'aBCD3fGh4ij5K', 'aBCD3fGh4ij5k', 'aBCD3fGh4iJ5k', 'aBCD3fGh4iJ5K', 'aBCD3fGh4IJ5K', 'aBCD3fGh4IJ5k', 'aBCD3fGh4Ij5k', 'aBCD3fGh4Ij5K', 'abCD3fGh4Ij5K', 'abCD3fGh4Ij5k', 'abCD3fGh4IJ5k', 'abCD3fGh4IJ5K', 'abCD3fGh4iJ5K', 'abCD3fGh4iJ5k', 'abCD3fGh4ij5k', 'abCD3fGh4ij5K', 'abCD3fGH4ij5K', 'abCD3fGH4ij5k', 'abCD3fGH4iJ5k', 'abCD3fGH4iJ5K', 'abCD3fGH4IJ5K', 'abCD3fGH4IJ5k', 'abCD3fGH4Ij5k', 'abCD3fGH4Ij5K', 'abCD3fgH4Ij5K', 'abCD3fgH4Ij5k', 'abCD3fgH4IJ5k', 'abCD3fgH4IJ5K', 'abCD3fgH4iJ5K', 'abCD3fgH4iJ5k', 'abCD3fgH4ij5k', 'abCD3fgH4ij5K', 'abCD3fgh4ij5K', 'abCD3fgh4ij5k', 'abCD3fgh4iJ5k', 'abCD3fgh4iJ5K', 'abCD3fgh4IJ5K', 'abCD3fgh4IJ5k', 'abCD3fgh4Ij5k', 'abCD3fgh4Ij5K', 'abCD3Fgh4Ij5K', 'abCD3Fgh4Ij5k', 'abCD3Fgh4IJ5k', 'abCD3Fgh4IJ5K', 'abCD3Fgh4iJ5K', 'abCD3Fgh4iJ5k', 'abCD3Fgh4ij5k', 'abCD3Fgh4ij5K', 'abCD3FgH4ij5K', 'abCD3FgH4ij5k', 'abCD3FgH4iJ5k', 'abCD3FgH4iJ5K', 'abCD3FgH4IJ5K', 'abCD3FgH4IJ5k', 'abCD3FgH4Ij5k', 'abCD3FgH4Ij5K', 'abCD3FGH4Ij5K', 'abCD3FGH4Ij5k', 'abCD3FGH4IJ5k', 'abCD3FGH4IJ5K', 'abCD3FGH4iJ5K', 'abCD3FGH4iJ5k', 'abCD3FGH4ij5k', 'abCD3FGH4ij5K', 'abCD3FGh4ij5K', 'abCD3FGh4ij5k', 'abCD3FGh4iJ5k', 'abCD3FGh4iJ5K', 'abCD3FGh4IJ5K', 'abCD3FGh4IJ5k', 'abCD3FGh4Ij5k', 'abCD3FGh4Ij5K', 'abCd3FGh4Ij5K', 'abCd3FGh4Ij5k', 'abCd3FGh4IJ5k', 'abCd3FGh4IJ5K', 'abCd3FGh4iJ5K', 'abCd3FGh4iJ5k', 'abCd3FGh4ij5k', 'abCd3FGh4ij5K', 'abCd3FGH4ij5K', 'abCd3FGH4ij5k', 'abCd3FGH4iJ5k', 'abCd3FGH4iJ5K', 'abCd3FGH4IJ5K', 'abCd3FGH4IJ5k', 'abCd3FGH4Ij5k', 'abCd3FGH4Ij5K', 'abCd3FgH4Ij5K', 'abCd3FgH4Ij5k', 'abCd3FgH4IJ5k', 'abCd3FgH4IJ5K', 'abCd3FgH4iJ5K', 'abCd3FgH4iJ5k', 'abCd3FgH4ij5k', 'abCd3FgH4ij5K', 'abCd3Fgh4ij5K', 'abCd3Fgh4ij5k', 'abCd3Fgh4iJ5k', 'abCd3Fgh4iJ5K', 'abCd3Fgh4IJ5K', 'abCd3Fgh4IJ5k', 'abCd3Fgh4Ij5k', 'abCd3Fgh4Ij5K', 'abCd3fgh4Ij5K', 'abCd3fgh4Ij5k', 'abCd3fgh4IJ5k', 'abCd3fgh4IJ5K', 'abCd3fgh4iJ5K', 'abCd3fgh4iJ5k', 'abCd3fgh4ij5k', 'abCd3fgh4ij5K', 'abCd3fgH4ij5K', 'abCd3fgH4ij5k', 'abCd3fgH4iJ5k', 'abCd3fgH4iJ5K', 'abCd3fgH4IJ5K', 'abCd3fgH4IJ5k', 'abCd3fgH4Ij5k', 'abCd3fgH4Ij5K', 'abCd3fGH4Ij5K', 'abCd3fGH4Ij5k', 'abCd3fGH4IJ5k', 'abCd3fGH4IJ5K', 'abCd3fGH4iJ5K', 'abCd3fGH4iJ5k', 'abCd3fGH4ij5k', 'abCd3fGH4ij5K', 'abCd3fGh4ij5K', 'abCd3fGh4ij5k', 'abCd3fGh4iJ5k', 'abCd3fGh4iJ5K', 'abCd3fGh4IJ5K', 'abCd3fGh4IJ5k', 'abCd3fGh4Ij5k', 'abCd3fGh4Ij5K', 'abcd3fGh4Ij5K', 'abcd3fGh4Ij5k', 'abcd3fGh4IJ5k', 'abcd3fGh4IJ5K', 'abcd3fGh4iJ5K', 'abcd3fGh4iJ5k', 'abcd3fGh4ij5k', 'abcd3fGh4ij5K', 'abcd3fGH4ij5K', 'abcd3fGH4ij5k', 'abcd3fGH4iJ5k', 'abcd3fGH4iJ5K', 'abcd3fGH4IJ5K', 'abcd3fGH4IJ5k', 'abcd3fGH4Ij5k', 'abcd3fGH4Ij5K', 'abcd3fgH4Ij5K', 'abcd3fgH4Ij5k', 'abcd3fgH4IJ5k', 'abcd3fgH4IJ5K', 'abcd3fgH4iJ5K', 'abcd3fgH4iJ5k', 'abcd3fgH4ij5k', 'abcd3fgH4ij5K', 'abcd3fgh4ij5K', 'abcd3fgh4ij5k', 'abcd3fgh4iJ5k', 'abcd3fgh4iJ5K', 'abcd3fgh4IJ5K', 'abcd3fgh4IJ5k', 'abcd3fgh4Ij5k', 'abcd3fgh4Ij5K', 'abcd3Fgh4Ij5K', 'abcd3Fgh4Ij5k', 'abcd3Fgh4IJ5k', 'abcd3Fgh4IJ5K', 'abcd3Fgh4iJ5K', 'abcd3Fgh4iJ5k', 'abcd3Fgh4ij5k', 'abcd3Fgh4ij5K', 'abcd3FgH4ij5K', 'abcd3FgH4ij5k', 'abcd3FgH4iJ5k', 'abcd3FgH4iJ5K', 'abcd3FgH4IJ5K', 'abcd3FgH4IJ5k', 'abcd3FgH4Ij5k', 'abcd3FgH4Ij5K', 'abcd3FGH4Ij5K', 'abcd3FGH4Ij5k', 'abcd3FGH4IJ5k', 'abcd3FGH4IJ5K', 'abcd3FGH4iJ5K', 'abcd3FGH4iJ5k', 'abcd3FGH4ij5k', 'abcd3FGH4ij5K', 'abcd3FGh4ij5K', 'abcd3FGh4ij5k', 'abcd3FGh4iJ5k', 'abcd3FGh4iJ5K', 'abcd3FGh4IJ5K', 'abcd3FGh4IJ5k', 'abcd3FGh4Ij5k', 'abcd3FGh4Ij5K', 'abcD3FGh4Ij5K', 'abcD3FGh4Ij5k', 'abcD3FGh4IJ5k', 'abcD3FGh4IJ5K', 'abcD3FGh4iJ5K', 'abcD3FGh4iJ5k', 'abcD3FGh4ij5k', 'abcD3FGh4ij5K', 'abcD3FGH4ij5K', 'abcD3FGH4ij5k', 'abcD3FGH4iJ5k', 'abcD3FGH4iJ5K', 'abcD3FGH4IJ5K', 'abcD3FGH4IJ5k', 'abcD3FGH4Ij5k', 'abcD3FGH4Ij5K', 'abcD3FgH4Ij5K', 'abcD3FgH4Ij5k', 'abcD3FgH4IJ5k', 'abcD3FgH4IJ5K', 'abcD3FgH4iJ5K', 'abcD3FgH4iJ5k', 'abcD3FgH4ij5k', 'abcD3FgH4ij5K', 'abcD3Fgh4ij5K', 'abcD3Fgh4ij5k', 'abcD3Fgh4iJ5k', 'abcD3Fgh4iJ5K', 'abcD3Fgh4IJ5K', 'abcD3Fgh4IJ5k', 'abcD3Fgh4Ij5k', 'abcD3Fgh4Ij5K', 'abcD3fgh4Ij5K', 'abcD3fgh4Ij5k', 'abcD3fgh4IJ5k', 'abcD3fgh4IJ5K', 'abcD3fgh4iJ5K', 'abcD3fgh4iJ5k', 'abcD3fgh4ij5k', 'abcD3fgh4ij5K', 'abcD3fgH4ij5K', 'abcD3fgH4ij5k', 'abcD3fgH4iJ5k', 'abcD3fgH4iJ5K', 'abcD3fgH4IJ5K', 'abcD3fgH4IJ5k', 'abcD3fgH4Ij5k', 'abcD3fgH4Ij5K', 'abcD3fGH4Ij5K', 'abcD3fGH4Ij5k', 'abcD3fGH4IJ5k', 'abcD3fGH4IJ5K', 'abcD3fGH4iJ5K', 'abcD3fGH4iJ5k', 'abcD3fGH4ij5k', 'abcD3fGH4ij5K', 'abcD3fGh4ij5K', 'abcD3fGh4ij5k', 'abcD3fGh4iJ5k', 'abcD3fGh4iJ5K', 'abcD3fGh4IJ5K', 'abcD3fGh4IJ5k', 'abcD3fGh4Ij5k', 'abcD3fGh4Ij5K', 'AbcD3fGh4Ij5K', 'AbcD3fGh4Ij5k', 'AbcD3fGh4IJ5k', 'AbcD3fGh4IJ5K', 'AbcD3fGh4iJ5K', 'AbcD3fGh4iJ5k', 'AbcD3fGh4ij5k', 'AbcD3fGh4ij5K', 'AbcD3fGH4ij5K', 'AbcD3fGH4ij5k', 'AbcD3fGH4iJ5k', 'AbcD3fGH4iJ5K', 'AbcD3fGH4IJ5K', 'AbcD3fGH4IJ5k', 'AbcD3fGH4Ij5k', 'AbcD3fGH4Ij5K', 'AbcD3fgH4Ij5K', 'AbcD3fgH4Ij5k', 'AbcD3fgH4IJ5k', 'AbcD3fgH4IJ5K', 'AbcD3fgH4iJ5K', 'AbcD3fgH4iJ5k', 'AbcD3fgH4ij5k', 'AbcD3fgH4ij5K', 'AbcD3fgh4ij5K', 'AbcD3fgh4ij5k', 'AbcD3fgh4iJ5k', 'AbcD3fgh4iJ5K', 'AbcD3fgh4IJ5K', 'AbcD3fgh4IJ5k', 'AbcD3fgh4Ij5k', 'AbcD3fgh4Ij5K', 'AbcD3Fgh4Ij5K', 'AbcD3Fgh4Ij5k', 'AbcD3Fgh4IJ5k', 'AbcD3Fgh4IJ5K', 'AbcD3Fgh4iJ5K', 'AbcD3Fgh4iJ5k', 'AbcD3Fgh4ij5k', 'AbcD3Fgh4ij5K', 'AbcD3FgH4ij5K', 'AbcD3FgH4ij5k', 'AbcD3FgH4iJ5k', 'AbcD3FgH4iJ5K', 'AbcD3FgH4IJ5K', 'AbcD3FgH4IJ5k', 'AbcD3FgH4Ij5k', 'AbcD3FgH4Ij5K', 'AbcD3FGH4Ij5K', 'AbcD3FGH4Ij5k', 'AbcD3FGH4IJ5k', 'AbcD3FGH4IJ5K', 'AbcD3FGH4iJ5K', 'AbcD3FGH4iJ5k', 'AbcD3FGH4ij5k', 'AbcD3FGH4ij5K', 'AbcD3FGh4ij5K', 'AbcD3FGh4ij5k', 'AbcD3FGh4iJ5k', 'AbcD3FGh4iJ5K', 'AbcD3FGh4IJ5K', 'AbcD3FGh4IJ5k', 'AbcD3FGh4Ij5k', 'AbcD3FGh4Ij5K', 'Abcd3FGh4Ij5K', 'Abcd3FGh4Ij5k', 'Abcd3FGh4IJ5k', 'Abcd3FGh4IJ5K', 'Abcd3FGh4iJ5K', 'Abcd3FGh4iJ5k', 'Abcd3FGh4ij5k', 'Abcd3FGh4ij5K', 'Abcd3FGH4ij5K', 'Abcd3FGH4ij5k', 'Abcd3FGH4iJ5k', 'Abcd3FGH4iJ5K', 'Abcd3FGH4IJ5K', 'Abcd3FGH4IJ5k', 'Abcd3FGH4Ij5k', 'Abcd3FGH4Ij5K', 'Abcd3FgH4Ij5K', 'Abcd3FgH4Ij5k', 'Abcd3FgH4IJ5k', 'Abcd3FgH4IJ5K', 'Abcd3FgH4iJ5K', 'Abcd3FgH4iJ5k', 'Abcd3FgH4ij5k', 'Abcd3FgH4ij5K', 'Abcd3Fgh4ij5K', 'Abcd3Fgh4ij5k', 'Abcd3Fgh4iJ5k', 'Abcd3Fgh4iJ5K', 'Abcd3Fgh4IJ5K', 'Abcd3Fgh4IJ5k', 'Abcd3Fgh4Ij5k', 'Abcd3Fgh4Ij5K', 'Abcd3fgh4Ij5K', 'Abcd3fgh4Ij5k', 'Abcd3fgh4IJ5k', 'Abcd3fgh4IJ5K', 'Abcd3fgh4iJ5K', 'Abcd3fgh4iJ5k', 'Abcd3fgh4ij5k', 'Abcd3fgh4ij5K', 'Abcd3fgH4ij5K', 'Abcd3fgH4ij5k', 'Abcd3fgH4iJ5k', 'Abcd3fgH4iJ5K', 'Abcd3fgH4IJ5K', 'Abcd3fgH4IJ5k', 'Abcd3fgH4Ij5k', 'Abcd3fgH4Ij5K', 'Abcd3fGH4Ij5K', 'Abcd3fGH4Ij5k', 'Abcd3fGH4IJ5k', 'Abcd3fGH4IJ5K', 'Abcd3fGH4iJ5K', 'Abcd3fGH4iJ5k', 'Abcd3fGH4ij5k', 'Abcd3fGH4ij5K', 'Abcd3fGh4ij5K', 'Abcd3fGh4ij5k', 'Abcd3fGh4iJ5k', 'Abcd3fGh4iJ5K', 'Abcd3fGh4IJ5K', 'Abcd3fGh4IJ5k', 'Abcd3fGh4Ij5k', 'Abcd3fGh4Ij5K', 'AbCd3fGh4Ij5K', 'AbCd3fGh4Ij5k', 'AbCd3fGh4IJ5k', 'AbCd3fGh4IJ5K', 'AbCd3fGh4iJ5K', 'AbCd3fGh4iJ5k', 'AbCd3fGh4ij5k', 'AbCd3fGh4ij5K', 'AbCd3fGH4ij5K', 'AbCd3fGH4ij5k', 'AbCd3fGH4iJ5k', 'AbCd3fGH4iJ5K', 'AbCd3fGH4IJ5K', 'AbCd3fGH4IJ5k', 'AbCd3fGH4Ij5k', 'AbCd3fGH4Ij5K', 'AbCd3fgH4Ij5K', 'AbCd3fgH4Ij5k', 'AbCd3fgH4IJ5k', 'AbCd3fgH4IJ5K', 'AbCd3fgH4iJ5K', 'AbCd3fgH4iJ5k', 'AbCd3fgH4ij5k', 'AbCd3fgH4ij5K', 'AbCd3fgh4ij5K', 'AbCd3fgh4ij5k', 'AbCd3fgh4iJ5k', 'AbCd3fgh4iJ5K', 'AbCd3fgh4IJ5K', 'AbCd3fgh4IJ5k', 'AbCd3fgh4Ij5k', 'AbCd3fgh4Ij5K', 'AbCd3Fgh4Ij5K', 'AbCd3Fgh4Ij5k', 'AbCd3Fgh4IJ5k', 'AbCd3Fgh4IJ5K', 'AbCd3Fgh4iJ5K', 'AbCd3Fgh4iJ5k', 'AbCd3Fgh4ij5k', 'AbCd3Fgh4ij5K', 'AbCd3FgH4ij5K', 'AbCd3FgH4ij5k', 'AbCd3FgH4iJ5k', 'AbCd3FgH4iJ5K', 'AbCd3FgH4IJ5K', 'AbCd3FgH4IJ5k', 'AbCd3FgH4Ij5k', 'AbCd3FgH4Ij5K', 'AbCd3FGH4Ij5K', 'AbCd3FGH4Ij5k', 'AbCd3FGH4IJ5k', 'AbCd3FGH4IJ5K', 'AbCd3FGH4iJ5K', 'AbCd3FGH4iJ5k', 'AbCd3FGH4ij5k', 'AbCd3FGH4ij5K', 'AbCd3FGh4ij5K', 'AbCd3FGh4ij5k', 'AbCd3FGh4iJ5k', 'AbCd3FGh4iJ5K', 'AbCd3FGh4IJ5K', 'AbCd3FGh4IJ5k', 'AbCd3FGh4Ij5k', 'AbCd3FGh4Ij5K', 'AbCD3FGh4Ij5K', 'AbCD3FGh4Ij5k', 'AbCD3FGh4IJ5k', 'AbCD3FGh4IJ5K', 'AbCD3FGh4iJ5K', 'AbCD3FGh4iJ5k', 'AbCD3FGh4ij5k', 'AbCD3FGh4ij5K', 'AbCD3FGH4ij5K', 'AbCD3FGH4ij5k', 'AbCD3FGH4iJ5k', 'AbCD3FGH4iJ5K', 'AbCD3FGH4IJ5K', 'AbCD3FGH4IJ5k', 'AbCD3FGH4Ij5k', 'AbCD3FGH4Ij5K', 'AbCD3FgH4Ij5K', 'AbCD3FgH4Ij5k', 'AbCD3FgH4IJ5k', 'AbCD3FgH4IJ5K', 'AbCD3FgH4iJ5K', 'AbCD3FgH4iJ5k', 'AbCD3FgH4ij5k', 'AbCD3FgH4ij5K', 'AbCD3Fgh4ij5K', 'AbCD3Fgh4ij5k', 'AbCD3Fgh4iJ5k', 'AbCD3Fgh4iJ5K', 'AbCD3Fgh4IJ5K', 'AbCD3Fgh4IJ5k', 'AbCD3Fgh4Ij5k', 'AbCD3Fgh4Ij5K', 'AbCD3fgh4Ij5K', 'AbCD3fgh4Ij5k', 'AbCD3fgh4IJ5k', 'AbCD3fgh4IJ5K', 'AbCD3fgh4iJ5K', 'AbCD3fgh4iJ5k', 'AbCD3fgh4ij5k', 'AbCD3fgh4ij5K', 'AbCD3fgH4ij5K', 'AbCD3fgH4ij5k', 'AbCD3fgH4iJ5k', 'AbCD3fgH4iJ5K', 'AbCD3fgH4IJ5K', 'AbCD3fgH4IJ5k', 'AbCD3fgH4Ij5k', 'AbCD3fgH4Ij5K', 'AbCD3fGH4Ij5K', 'AbCD3fGH4Ij5k', 'AbCD3fGH4IJ5k', 'AbCD3fGH4IJ5K', 'AbCD3fGH4iJ5K', 'AbCD3fGH4iJ5k', 'AbCD3fGH4ij5k', 'AbCD3fGH4ij5K', 'AbCD3fGh4ij5K', 'AbCD3fGh4ij5k', 'AbCD3fGh4iJ5k', 'AbCD3fGh4iJ5K', 'AbCD3fGh4IJ5K', 'AbCD3fGh4IJ5k', 'AbCD3fGh4Ij5k', 'AbCD3fGh4Ij5K', 'ABCD3fGh4Ij5K', 'ABCD3fGh4Ij5k', 'ABCD3fGh4IJ5k', 'ABCD3fGh4IJ5K', 'ABCD3fGh4iJ5K', 'ABCD3fGh4iJ5k', 'ABCD3fGh4ij5k', 'ABCD3fGh4ij5K', 'ABCD3fGH4ij5K', 'ABCD3fGH4ij5k', 'ABCD3fGH4iJ5k', 'ABCD3fGH4iJ5K', 'ABCD3fGH4IJ5K', 'ABCD3fGH4IJ5k', 'ABCD3fGH4Ij5k', 'ABCD3fGH4Ij5K', 'ABCD3fgH4Ij5K', 'ABCD3fgH4Ij5k', 'ABCD3fgH4IJ5k', 'ABCD3fgH4IJ5K', 'ABCD3fgH4iJ5K', 'ABCD3fgH4iJ5k', 'ABCD3fgH4ij5k', 'ABCD3fgH4ij5K', 'ABCD3fgh4ij5K', 'ABCD3fgh4ij5k', 'ABCD3fgh4iJ5k', 'ABCD3fgh4iJ5K', 'ABCD3fgh4IJ5K', 'ABCD3fgh4IJ5k', 'ABCD3fgh4Ij5k', 'ABCD3fgh4Ij5K', 'ABCD3Fgh4Ij5K', 'ABCD3Fgh4Ij5k', 'ABCD3Fgh4IJ5k', 'ABCD3Fgh4IJ5K', 'ABCD3Fgh4iJ5K', 'ABCD3Fgh4iJ5k', 'ABCD3Fgh4ij5k', 'ABCD3Fgh4ij5K', 'ABCD3FgH4ij5K', 'ABCD3FgH4ij5k', 'ABCD3FgH4iJ5k', 'ABCD3FgH4iJ5K', 'ABCD3FgH4IJ5K', 'ABCD3FgH4IJ5k', 'ABCD3FgH4Ij5k', 'ABCD3FgH4Ij5K', 'ABCD3FGH4Ij5K', 'ABCD3FGH4Ij5k', 'ABCD3FGH4IJ5k', 'ABCD3FGH4IJ5K', 'ABCD3FGH4iJ5K', 'ABCD3FGH4iJ5k', 'ABCD3FGH4ij5k', 'ABCD3FGH4ij5K', 'ABCD3FGh4ij5K', 'ABCD3FGh4ij5k', 'ABCD3FGh4iJ5k', 'ABCD3FGh4iJ5K', 'ABCD3FGh4IJ5K', 'ABCD3FGh4IJ5k', 'ABCD3FGh4Ij5k', 'ABCD3FGh4Ij5K', 'ABCd3FGh4Ij5K', 'ABCd3FGh4Ij5k', 'ABCd3FGh4IJ5k', 'ABCd3FGh4IJ5K', 'ABCd3FGh4iJ5K', 'ABCd3FGh4iJ5k', 'ABCd3FGh4ij5k', 'ABCd3FGh4ij5K', 'ABCd3FGH4ij5K', 'ABCd3FGH4ij5k', 'ABCd3FGH4iJ5k', 'ABCd3FGH4iJ5K', 'ABCd3FGH4IJ5K', 'ABCd3FGH4IJ5k', 'ABCd3FGH4Ij5k', 'ABCd3FGH4Ij5K', 'ABCd3FgH4Ij5K', 'ABCd3FgH4Ij5k', 'ABCd3FgH4IJ5k', 'ABCd3FgH4IJ5K', 'ABCd3FgH4iJ5K', 'ABCd3FgH4iJ5k', 'ABCd3FgH4ij5k', 'ABCd3FgH4ij5K', 'ABCd3Fgh4ij5K', 'ABCd3Fgh4ij5k', 'ABCd3Fgh4iJ5k', 'ABCd3Fgh4iJ5K', 'ABCd3Fgh4IJ5K', 'ABCd3Fgh4IJ5k', 'ABCd3Fgh4Ij5k', 'ABCd3Fgh4Ij5K', 'ABCd3fgh4Ij5K', 'ABCd3fgh4Ij5k', 'ABCd3fgh4IJ5k', 'ABCd3fgh4IJ5K', 'ABCd3fgh4iJ5K', 'ABCd3fgh4iJ5k', 'ABCd3fgh4ij5k', 'ABCd3fgh4ij5K', 'ABCd3fgH4ij5K', 'ABCd3fgH4ij5k', 'ABCd3fgH4iJ5k', 'ABCd3fgH4iJ5K', 'ABCd3fgH4IJ5K', 'ABCd3fgH4IJ5k', 'ABCd3fgH4Ij5k', 'ABCd3fgH4Ij5K', 'ABCd3fGH4Ij5K', 'ABCd3fGH4Ij5k', 'ABCd3fGH4IJ5k', 'ABCd3fGH4IJ5K', 'ABCd3fGH4iJ5K', 'ABCd3fGH4iJ5k', 'ABCd3fGH4ij5k', 'ABCd3fGH4ij5K', 'ABCd3fGh4ij5K', 'ABCd3fGh4ij5k', 'ABCd3fGh4iJ5k', 'ABCd3fGh4iJ5K', 'ABCd3fGh4IJ5K', 'ABCd3fGh4IJ5k', 'ABCd3fGh4Ij5k', 'ABCd3fGh4Ij5K', 'ABcd3fGh4Ij5K', 'ABcd3fGh4Ij5k', 'ABcd3fGh4IJ5k', 'ABcd3fGh4IJ5K', 'ABcd3fGh4iJ5K', 'ABcd3fGh4iJ5k', 'ABcd3fGh4ij5k', 'ABcd3fGh4ij5K', 'ABcd3fGH4ij5K', 'ABcd3fGH4ij5k', 'ABcd3fGH4iJ5k', 'ABcd3fGH4iJ5K', 'ABcd3fGH4IJ5K', 'ABcd3fGH4IJ5k', 'ABcd3fGH4Ij5k', 'ABcd3fGH4Ij5K', 'ABcd3fgH4Ij5K', 'ABcd3fgH4Ij5k', 'ABcd3fgH4IJ5k', 'ABcd3fgH4IJ5K', 'ABcd3fgH4iJ5K', 'ABcd3fgH4iJ5k', 'ABcd3fgH4ij5k', 'ABcd3fgH4ij5K', 'ABcd3fgh4ij5K', 'ABcd3fgh4ij5k', 'ABcd3fgh4iJ5k', 'ABcd3fgh4iJ5K', 'ABcd3fgh4IJ5K', 'ABcd3fgh4IJ5k', 'ABcd3fgh4Ij5k', 'ABcd3fgh4Ij5K', 'ABcd3Fgh4Ij5K', 'ABcd3Fgh4Ij5k', 'ABcd3Fgh4IJ5k', 'ABcd3Fgh4IJ5K', 'ABcd3Fgh4iJ5K', 'ABcd3Fgh4iJ5k', 'ABcd3Fgh4ij5k', 'ABcd3Fgh4ij5K', 'ABcd3FgH4ij5K', 'ABcd3FgH4ij5k', 'ABcd3FgH4iJ5k', 'ABcd3FgH4iJ5K', 'ABcd3FgH4IJ5K', 'ABcd3FgH4IJ5k', 'ABcd3FgH4Ij5k', 'ABcd3FgH4Ij5K', 'ABcd3FGH4Ij5K', 'ABcd3FGH4Ij5k', 'ABcd3FGH4IJ5k', 'ABcd3FGH4IJ5K', 'ABcd3FGH4iJ5K', 'ABcd3FGH4iJ5k', 'ABcd3FGH4ij5k', 'ABcd3FGH4ij5K', 'ABcd3FGh4ij5K', 'ABcd3FGh4ij5k', 'ABcd3FGh4iJ5k', 'ABcd3FGh4iJ5K', 'ABcd3FGh4IJ5K', 'ABcd3FGh4IJ5k', 'ABcd3FGh4Ij5k', 'ABcd3FGh4Ij5K', 'ABcD3FGh4Ij5K', 'ABcD3FGh4Ij5k', 'ABcD3FGh4IJ5k', 'ABcD3FGh4IJ5K', 'ABcD3FGh4iJ5K', 'ABcD3FGh4iJ5k', 'ABcD3FGh4ij5k', 'ABcD3FGh4ij5K', 'ABcD3FGH4ij5K', 'ABcD3FGH4ij5k', 'ABcD3FGH4iJ5k', 'ABcD3FGH4iJ5K', 'ABcD3FGH4IJ5K', 'ABcD3FGH4IJ5k', 'ABcD3FGH4Ij5k', 'ABcD3FGH4Ij5K', 'ABcD3FgH4Ij5K', 'ABcD3FgH4Ij5k', 'ABcD3FgH4IJ5k', 'ABcD3FgH4IJ5K', 'ABcD3FgH4iJ5K', 'ABcD3FgH4iJ5k', 'ABcD3FgH4ij5k', 'ABcD3FgH4ij5K', 'ABcD3Fgh4ij5K', 'ABcD3Fgh4ij5k', 'ABcD3Fgh4iJ5k', 'ABcD3Fgh4iJ5K', 'ABcD3Fgh4IJ5K', 'ABcD3Fgh4IJ5k', 'ABcD3Fgh4Ij5k', 'ABcD3Fgh4Ij5K', 'ABcD3fgh4Ij5K', 'ABcD3fgh4Ij5k', 'ABcD3fgh4IJ5k', 'ABcD3fgh4IJ5K', 'ABcD3fgh4iJ5K', 'ABcD3fgh4iJ5k', 'ABcD3fgh4ij5k', 'ABcD3fgh4ij5K', 'ABcD3fgH4ij5K', 'ABcD3fgH4ij5k', 'ABcD3fgH4iJ5k', 'ABcD3fgH4iJ5K', 'ABcD3fgH4IJ5K', 'ABcD3fgH4IJ5k', 'ABcD3fgH4Ij5k', 'ABcD3fgH4Ij5K', 'ABcD3fGH4Ij5K', 'ABcD3fGH4Ij5k', 'ABcD3fGH4IJ5k', 'ABcD3fGH4IJ5K', 'ABcD3fGH4iJ5K', 'ABcD3fGH4iJ5k', 'ABcD3fGH4ij5k', 'ABcD3fGH4ij5K', 'ABcD3fGh4ij5K', 'ABcD3fGh4ij5k', 'ABcD3fGh4iJ5k', 'ABcD3fGh4iJ5K', 'ABcD3fGh4IJ5K', 'ABcD3fGh4IJ5k', 'ABcD3fGh4Ij5k', 'ABcD3fGh4Ij5K']\n assert candidate(s = \"AbCd\") == ['AbCd', 'AbCD', 'AbcD', 'Abcd', 'ABcd', 'ABcD', 'ABCD', 'ABCd', 'aBCd', 'aBCD', 'aBcD', 'aBcd', 'abcd', 'abcD', 'abCD', 'abCd']\n assert candidate(s = \"abcDEF123\") == ['abcDEF123', 'abcDEf123', 'abcDef123', 'abcDeF123', 'abcdeF123', 'abcdef123', 'abcdEf123', 'abcdEF123', 'abCdEF123', 'abCdEf123', 'abCdef123', 'abCdeF123', 'abCDeF123', 'abCDef123', 'abCDEf123', 'abCDEF123', 'aBCDEF123', 'aBCDEf123', 'aBCDef123', 'aBCDeF123', 'aBCdeF123', 'aBCdef123', 'aBCdEf123', 'aBCdEF123', 'aBcdEF123', 'aBcdEf123', 'aBcdef123', 'aBcdeF123', 'aBcDeF123', 'aBcDef123', 'aBcDEf123', 'aBcDEF123', 'ABcDEF123', 'ABcDEf123', 'ABcDef123', 'ABcDeF123', 'ABcdeF123', 'ABcdef123', 'ABcdEf123', 'ABcdEF123', 'ABCdEF123', 'ABCdEf123', 'ABCdef123', 'ABCdeF123', 'ABCDeF123', 'ABCDef123', 'ABCDEf123', 'ABCDEF123', 'AbCDEF123', 'AbCDEf123', 'AbCDef123', 'AbCDeF123', 'AbCdeF123', 'AbCdef123', 'AbCdEf123', 'AbCdEF123', 'AbcdEF123', 'AbcdEf123', 'Abcdef123', 'AbcdeF123', 'AbcDeF123', 'AbcDef123', 'AbcDEf123', 'AbcDEF123']\n assert candidate(s = \"aAaAaAaA\") == ['aAaAaAaA', 'aAaAaAaa', 'aAaAaAAa', 'aAaAaAAA', 'aAaAaaAA', 'aAaAaaAa', 'aAaAaaaa', 'aAaAaaaA', 'aAaAAaaA', 'aAaAAaaa', 'aAaAAaAa', 'aAaAAaAA', 'aAaAAAAA', 'aAaAAAAa', 'aAaAAAaa', 'aAaAAAaA', 'aAaaAAaA', 'aAaaAAaa', 'aAaaAAAa', 'aAaaAAAA', 'aAaaAaAA', 'aAaaAaAa', 'aAaaAaaa', 'aAaaAaaA', 'aAaaaaaA', 'aAaaaaaa', 'aAaaaaAa', 'aAaaaaAA', 'aAaaaAAA', 'aAaaaAAa', 'aAaaaAaa', 'aAaaaAaA', 'aAAaaAaA', 'aAAaaAaa', 'aAAaaAAa', 'aAAaaAAA', 'aAAaaaAA', 'aAAaaaAa', 'aAAaaaaa', 'aAAaaaaA', 'aAAaAaaA', 'aAAaAaaa', 'aAAaAaAa', 'aAAaAaAA', 'aAAaAAAA', 'aAAaAAAa', 'aAAaAAaa', 'aAAaAAaA', 'aAAAAAaA', 'aAAAAAaa', 'aAAAAAAa', 'aAAAAAAA', 'aAAAAaAA', 'aAAAAaAa', 'aAAAAaaa', 'aAAAAaaA', 'aAAAaaaA', 'aAAAaaaa', 'aAAAaaAa', 'aAAAaaAA', 'aAAAaAAA', 'aAAAaAAa', 'aAAAaAaa', 'aAAAaAaA', 'aaAAaAaA', 'aaAAaAaa', 'aaAAaAAa', 'aaAAaAAA', 'aaAAaaAA', 'aaAAaaAa', 'aaAAaaaa', 'aaAAaaaA', 'aaAAAaaA', 'aaAAAaaa', 'aaAAAaAa', 'aaAAAaAA', 'aaAAAAAA', 'aaAAAAAa', 'aaAAAAaa', 'aaAAAAaA', 'aaAaAAaA', 'aaAaAAaa', 'aaAaAAAa', 'aaAaAAAA', 'aaAaAaAA', 'aaAaAaAa', 'aaAaAaaa', 'aaAaAaaA', 'aaAaaaaA', 'aaAaaaaa', 'aaAaaaAa', 'aaAaaaAA', 'aaAaaAAA', 'aaAaaAAa', 'aaAaaAaa', 'aaAaaAaA', 'aaaaaAaA', 'aaaaaAaa', 'aaaaaAAa', 'aaaaaAAA', 'aaaaaaAA', 'aaaaaaAa', 'aaaaaaaa', 'aaaaaaaA', 'aaaaAaaA', 'aaaaAaaa', 'aaaaAaAa', 'aaaaAaAA', 'aaaaAAAA', 'aaaaAAAa', 'aaaaAAaa', 'aaaaAAaA', 'aaaAAAaA', 'aaaAAAaa', 'aaaAAAAa', 'aaaAAAAA', 'aaaAAaAA', 'aaaAAaAa', 'aaaAAaaa', 'aaaAAaaA', 'aaaAaaaA', 'aaaAaaaa', 'aaaAaaAa', 'aaaAaaAA', 'aaaAaAAA', 'aaaAaAAa', 'aaaAaAaa', 'aaaAaAaA', 'AaaAaAaA', 'AaaAaAaa', 'AaaAaAAa', 'AaaAaAAA', 'AaaAaaAA', 'AaaAaaAa', 'AaaAaaaa', 'AaaAaaaA', 'AaaAAaaA', 'AaaAAaaa', 'AaaAAaAa', 'AaaAAaAA', 'AaaAAAAA', 'AaaAAAAa', 'AaaAAAaa', 'AaaAAAaA', 'AaaaAAaA', 'AaaaAAaa', 'AaaaAAAa', 'AaaaAAAA', 'AaaaAaAA', 'AaaaAaAa', 'AaaaAaaa', 'AaaaAaaA', 'AaaaaaaA', 'Aaaaaaaa', 'AaaaaaAa', 'AaaaaaAA', 'AaaaaAAA', 'AaaaaAAa', 'AaaaaAaa', 'AaaaaAaA', 'AaAaaAaA', 'AaAaaAaa', 'AaAaaAAa', 'AaAaaAAA', 'AaAaaaAA', 'AaAaaaAa', 'AaAaaaaa', 'AaAaaaaA', 'AaAaAaaA', 'AaAaAaaa', 'AaAaAaAa', 'AaAaAaAA', 'AaAaAAAA', 'AaAaAAAa', 'AaAaAAaa', 'AaAaAAaA', 'AaAAAAaA', 'AaAAAAaa', 'AaAAAAAa', 'AaAAAAAA', 'AaAAAaAA', 'AaAAAaAa', 'AaAAAaaa', 'AaAAAaaA', 'AaAAaaaA', 'AaAAaaaa', 'AaAAaaAa', 'AaAAaaAA', 'AaAAaAAA', 'AaAAaAAa', 'AaAAaAaa', 'AaAAaAaA', 'AAAAaAaA', 'AAAAaAaa', 'AAAAaAAa', 'AAAAaAAA', 'AAAAaaAA', 'AAAAaaAa', 'AAAAaaaa', 'AAAAaaaA', 'AAAAAaaA', 'AAAAAaaa', 'AAAAAaAa', 'AAAAAaAA', 'AAAAAAAA', 'AAAAAAAa', 'AAAAAAaa', 'AAAAAAaA', 'AAAaAAaA', 'AAAaAAaa', 'AAAaAAAa', 'AAAaAAAA', 'AAAaAaAA', 'AAAaAaAa', 'AAAaAaaa', 'AAAaAaaA', 'AAAaaaaA', 'AAAaaaaa', 'AAAaaaAa', 'AAAaaaAA', 'AAAaaAAA', 'AAAaaAAa', 'AAAaaAaa', 'AAAaaAaA', 'AAaaaAaA', 'AAaaaAaa', 'AAaaaAAa', 'AAaaaAAA', 'AAaaaaAA', 'AAaaaaAa', 'AAaaaaaa', 'AAaaaaaA', 'AAaaAaaA', 'AAaaAaaa', 'AAaaAaAa', 'AAaaAaAA', 'AAaaAAAA', 'AAaaAAAa', 'AAaaAAaa', 'AAaaAAaA', 'AAaAAAaA', 'AAaAAAaa', 'AAaAAAAa', 'AAaAAAAA', 'AAaAAaAA', 'AAaAAaAa', 'AAaAAaaa', 'AAaAAaaA', 'AAaAaaaA', 'AAaAaaaa', 'AAaAaaAa', 'AAaAaaAA', 'AAaAaAAA', 'AAaAaAAa', 'AAaAaAaa', 'AAaAaAaA']\n assert candidate(s = \"0a1B2c3D4\") == ['0a1B2c3D4', '0a1B2c3d4', '0a1B2C3d4', '0a1B2C3D4', '0a1b2C3D4', '0a1b2C3d4', '0a1b2c3d4', '0a1b2c3D4', '0A1b2c3D4', '0A1b2c3d4', '0A1b2C3d4', '0A1b2C3D4', '0A1B2C3D4', '0A1B2C3d4', '0A1B2c3d4', '0A1B2c3D4']\n assert candidate(s = \"1a2b3c\") == ['1a2b3c', '1a2b3C', '1a2B3C', '1a2B3c', '1A2B3c', '1A2B3C', '1A2b3C', '1A2b3c']\n assert candidate(s = \"a1b2c3\") == ['a1b2c3', 'a1b2C3', 'a1B2C3', 'a1B2c3', 'A1B2c3', 'A1B2C3', 'A1b2C3', 'A1b2c3']\n assert candidate(s = \"abc123XYZ\") == ['abc123XYZ', 'abc123XYz', 'abc123Xyz', 'abc123XyZ', 'abc123xyZ', 'abc123xyz', 'abc123xYz', 'abc123xYZ', 'abC123xYZ', 'abC123xYz', 'abC123xyz', 'abC123xyZ', 'abC123XyZ', 'abC123Xyz', 'abC123XYz', 'abC123XYZ', 'aBC123XYZ', 'aBC123XYz', 'aBC123Xyz', 'aBC123XyZ', 'aBC123xyZ', 'aBC123xyz', 'aBC123xYz', 'aBC123xYZ', 'aBc123xYZ', 'aBc123xYz', 'aBc123xyz', 'aBc123xyZ', 'aBc123XyZ', 'aBc123Xyz', 'aBc123XYz', 'aBc123XYZ', 'ABc123XYZ', 'ABc123XYz', 'ABc123Xyz', 'ABc123XyZ', 'ABc123xyZ', 'ABc123xyz', 'ABc123xYz', 'ABc123xYZ', 'ABC123xYZ', 'ABC123xYz', 'ABC123xyz', 'ABC123xyZ', 'ABC123XyZ', 'ABC123Xyz', 'ABC123XYz', 'ABC123XYZ', 'AbC123XYZ', 'AbC123XYz', 'AbC123Xyz', 'AbC123XyZ', 'AbC123xyZ', 'AbC123xyz', 'AbC123xYz', 'AbC123xYZ', 'Abc123xYZ', 'Abc123xYz', 'Abc123xyz', 'Abc123xyZ', 'Abc123XyZ', 'Abc123Xyz', 'Abc123XYz', 'Abc123XYZ']\n assert candidate(s = \"aBcDeF1G2H3\") == ['aBcDeF1G2H3', 'aBcDeF1G2h3', 'aBcDeF1g2h3', 'aBcDeF1g2H3', 'aBcDef1g2H3', 'aBcDef1g2h3', 'aBcDef1G2h3', 'aBcDef1G2H3', 'aBcDEf1G2H3', 'aBcDEf1G2h3', 'aBcDEf1g2h3', 'aBcDEf1g2H3', 'aBcDEF1g2H3', 'aBcDEF1g2h3', 'aBcDEF1G2h3', 'aBcDEF1G2H3', 'aBcdEF1G2H3', 'aBcdEF1G2h3', 'aBcdEF1g2h3', 'aBcdEF1g2H3', 'aBcdEf1g2H3', 'aBcdEf1g2h3', 'aBcdEf1G2h3', 'aBcdEf1G2H3', 'aBcdef1G2H3', 'aBcdef1G2h3', 'aBcdef1g2h3', 'aBcdef1g2H3', 'aBcdeF1g2H3', 'aBcdeF1g2h3', 'aBcdeF1G2h3', 'aBcdeF1G2H3', 'aBCdeF1G2H3', 'aBCdeF1G2h3', 'aBCdeF1g2h3', 'aBCdeF1g2H3', 'aBCdef1g2H3', 'aBCdef1g2h3', 'aBCdef1G2h3', 'aBCdef1G2H3', 'aBCdEf1G2H3', 'aBCdEf1G2h3', 'aBCdEf1g2h3', 'aBCdEf1g2H3', 'aBCdEF1g2H3', 'aBCdEF1g2h3', 'aBCdEF1G2h3', 'aBCdEF1G2H3', 'aBCDEF1G2H3', 'aBCDEF1G2h3', 'aBCDEF1g2h3', 'aBCDEF1g2H3', 'aBCDEf1g2H3', 'aBCDEf1g2h3', 'aBCDEf1G2h3', 'aBCDEf1G2H3', 'aBCDef1G2H3', 'aBCDef1G2h3', 'aBCDef1g2h3', 'aBCDef1g2H3', 'aBCDeF1g2H3', 'aBCDeF1g2h3', 'aBCDeF1G2h3', 'aBCDeF1G2H3', 'abCDeF1G2H3', 'abCDeF1G2h3', 'abCDeF1g2h3', 'abCDeF1g2H3', 'abCDef1g2H3', 'abCDef1g2h3', 'abCDef1G2h3', 'abCDef1G2H3', 'abCDEf1G2H3', 'abCDEf1G2h3', 'abCDEf1g2h3', 'abCDEf1g2H3', 'abCDEF1g2H3', 'abCDEF1g2h3', 'abCDEF1G2h3', 'abCDEF1G2H3', 'abCdEF1G2H3', 'abCdEF1G2h3', 'abCdEF1g2h3', 'abCdEF1g2H3', 'abCdEf1g2H3', 'abCdEf1g2h3', 'abCdEf1G2h3', 'abCdEf1G2H3', 'abCdef1G2H3', 'abCdef1G2h3', 'abCdef1g2h3', 'abCdef1g2H3', 'abCdeF1g2H3', 'abCdeF1g2h3', 'abCdeF1G2h3', 'abCdeF1G2H3', 'abcdeF1G2H3', 'abcdeF1G2h3', 'abcdeF1g2h3', 'abcdeF1g2H3', 'abcdef1g2H3', 'abcdef1g2h3', 'abcdef1G2h3', 'abcdef1G2H3', 'abcdEf1G2H3', 'abcdEf1G2h3', 'abcdEf1g2h3', 'abcdEf1g2H3', 'abcdEF1g2H3', 'abcdEF1g2h3', 'abcdEF1G2h3', 'abcdEF1G2H3', 'abcDEF1G2H3', 'abcDEF1G2h3', 'abcDEF1g2h3', 'abcDEF1g2H3', 'abcDEf1g2H3', 'abcDEf1g2h3', 'abcDEf1G2h3', 'abcDEf1G2H3', 'abcDef1G2H3', 'abcDef1G2h3', 'abcDef1g2h3', 'abcDef1g2H3', 'abcDeF1g2H3', 'abcDeF1g2h3', 'abcDeF1G2h3', 'abcDeF1G2H3', 'AbcDeF1G2H3', 'AbcDeF1G2h3', 'AbcDeF1g2h3', 'AbcDeF1g2H3', 'AbcDef1g2H3', 'AbcDef1g2h3', 'AbcDef1G2h3', 'AbcDef1G2H3', 'AbcDEf1G2H3', 'AbcDEf1G2h3', 'AbcDEf1g2h3', 'AbcDEf1g2H3', 'AbcDEF1g2H3', 'AbcDEF1g2h3', 'AbcDEF1G2h3', 'AbcDEF1G2H3', 'AbcdEF1G2H3', 'AbcdEF1G2h3', 'AbcdEF1g2h3', 'AbcdEF1g2H3', 'AbcdEf1g2H3', 'AbcdEf1g2h3', 'AbcdEf1G2h3', 'AbcdEf1G2H3', 'Abcdef1G2H3', 'Abcdef1G2h3', 'Abcdef1g2h3', 'Abcdef1g2H3', 'AbcdeF1g2H3', 'AbcdeF1g2h3', 'AbcdeF1G2h3', 'AbcdeF1G2H3', 'AbCdeF1G2H3', 'AbCdeF1G2h3', 'AbCdeF1g2h3', 'AbCdeF1g2H3', 'AbCdef1g2H3', 'AbCdef1g2h3', 'AbCdef1G2h3', 'AbCdef1G2H3', 'AbCdEf1G2H3', 'AbCdEf1G2h3', 'AbCdEf1g2h3', 'AbCdEf1g2H3', 'AbCdEF1g2H3', 'AbCdEF1g2h3', 'AbCdEF1G2h3', 'AbCdEF1G2H3', 'AbCDEF1G2H3', 'AbCDEF1G2h3', 'AbCDEF1g2h3', 'AbCDEF1g2H3', 'AbCDEf1g2H3', 'AbCDEf1g2h3', 'AbCDEf1G2h3', 'AbCDEf1G2H3', 'AbCDef1G2H3', 'AbCDef1G2h3', 'AbCDef1g2h3', 'AbCDef1g2H3', 'AbCDeF1g2H3', 'AbCDeF1g2h3', 'AbCDeF1G2h3', 'AbCDeF1G2H3', 'ABCDeF1G2H3', 'ABCDeF1G2h3', 'ABCDeF1g2h3', 'ABCDeF1g2H3', 'ABCDef1g2H3', 'ABCDef1g2h3', 'ABCDef1G2h3', 'ABCDef1G2H3', 'ABCDEf1G2H3', 'ABCDEf1G2h3', 'ABCDEf1g2h3', 'ABCDEf1g2H3', 'ABCDEF1g2H3', 'ABCDEF1g2h3', 'ABCDEF1G2h3', 'ABCDEF1G2H3', 'ABCdEF1G2H3', 'ABCdEF1G2h3', 'ABCdEF1g2h3', 'ABCdEF1g2H3', 'ABCdEf1g2H3', 'ABCdEf1g2h3', 'ABCdEf1G2h3', 'ABCdEf1G2H3', 'ABCdef1G2H3', 'ABCdef1G2h3', 'ABCdef1g2h3', 'ABCdef1g2H3', 'ABCdeF1g2H3', 'ABCdeF1g2h3', 'ABCdeF1G2h3', 'ABCdeF1G2H3', 'ABcdeF1G2H3', 'ABcdeF1G2h3', 'ABcdeF1g2h3', 'ABcdeF1g2H3', 'ABcdef1g2H3', 'ABcdef1g2h3', 'ABcdef1G2h3', 'ABcdef1G2H3', 'ABcdEf1G2H3', 'ABcdEf1G2h3', 'ABcdEf1g2h3', 'ABcdEf1g2H3', 'ABcdEF1g2H3', 'ABcdEF1g2h3', 'ABcdEF1G2h3', 'ABcdEF1G2H3', 'ABcDEF1G2H3', 'ABcDEF1G2h3', 'ABcDEF1g2h3', 'ABcDEF1g2H3', 'ABcDEf1g2H3', 'ABcDEf1g2h3', 'ABcDEf1G2h3', 'ABcDEf1G2H3', 'ABcDef1G2H3', 'ABcDef1G2h3', 'ABcDef1g2h3', 'ABcDef1g2H3', 'ABcDeF1g2H3', 'ABcDeF1g2h3', 'ABcDeF1G2h3', 'ABcDeF1G2H3']\n assert candidate(s = \"xYz09\") == ['xYz09', 'xYZ09', 'xyZ09', 'xyz09', 'Xyz09', 'XyZ09', 'XYZ09', 'XYz09']\n assert candidate(s = \"Zz123Yy456Xx\") == ['Zz123Yy456Xx', 'Zz123Yy456XX', 'Zz123Yy456xX', 'Zz123Yy456xx', 'Zz123YY456xx', 'Zz123YY456xX', 'Zz123YY456XX', 'Zz123YY456Xx', 'Zz123yY456Xx', 'Zz123yY456XX', 'Zz123yY456xX', 'Zz123yY456xx', 'Zz123yy456xx', 'Zz123yy456xX', 'Zz123yy456XX', 'Zz123yy456Xx', 'ZZ123yy456Xx', 'ZZ123yy456XX', 'ZZ123yy456xX', 'ZZ123yy456xx', 'ZZ123yY456xx', 'ZZ123yY456xX', 'ZZ123yY456XX', 'ZZ123yY456Xx', 'ZZ123YY456Xx', 'ZZ123YY456XX', 'ZZ123YY456xX', 'ZZ123YY456xx', 'ZZ123Yy456xx', 'ZZ123Yy456xX', 'ZZ123Yy456XX', 'ZZ123Yy456Xx', 'zZ123Yy456Xx', 'zZ123Yy456XX', 'zZ123Yy456xX', 'zZ123Yy456xx', 'zZ123YY456xx', 'zZ123YY456xX', 'zZ123YY456XX', 'zZ123YY456Xx', 'zZ123yY456Xx', 'zZ123yY456XX', 'zZ123yY456xX', 'zZ123yY456xx', 'zZ123yy456xx', 'zZ123yy456xX', 'zZ123yy456XX', 'zZ123yy456Xx', 'zz123yy456Xx', 'zz123yy456XX', 'zz123yy456xX', 'zz123yy456xx', 'zz123yY456xx', 'zz123yY456xX', 'zz123yY456XX', 'zz123yY456Xx', 'zz123YY456Xx', 'zz123YY456XX', 'zz123YY456xX', 'zz123YY456xx', 'zz123Yy456xx', 'zz123Yy456xX', 'zz123Yy456XX', 'zz123Yy456Xx']\n assert candidate(s = \"a1B2c3D4\") == ['a1B2c3D4', 'a1B2c3d4', 'a1B2C3d4', 'a1B2C3D4', 'a1b2C3D4', 'a1b2C3d4', 'a1b2c3d4', 'a1b2c3D4', 'A1b2c3D4', 'A1b2c3d4', 'A1b2C3d4', 'A1b2C3D4', 'A1B2C3D4', 'A1B2C3d4', 'A1B2c3d4', 'A1B2c3D4']\n assert candidate(s = \"987xyz\") == ['987xyz', '987xyZ', '987xYZ', '987xYz', '987XYz', '987XYZ', '987XyZ', '987Xyz']\n assert candidate(s = \"A1bC2dE3fG4\") == ['A1bC2dE3fG4', 'A1bC2dE3fg4', 'A1bC2dE3Fg4', 'A1bC2dE3FG4', 'A1bC2de3FG4', 'A1bC2de3Fg4', 'A1bC2de3fg4', 'A1bC2de3fG4', 'A1bC2De3fG4', 'A1bC2De3fg4', 'A1bC2De3Fg4', 'A1bC2De3FG4', 'A1bC2DE3FG4', 'A1bC2DE3Fg4', 'A1bC2DE3fg4', 'A1bC2DE3fG4', 'A1bc2DE3fG4', 'A1bc2DE3fg4', 'A1bc2DE3Fg4', 'A1bc2DE3FG4', 'A1bc2De3FG4', 'A1bc2De3Fg4', 'A1bc2De3fg4', 'A1bc2De3fG4', 'A1bc2de3fG4', 'A1bc2de3fg4', 'A1bc2de3Fg4', 'A1bc2de3FG4', 'A1bc2dE3FG4', 'A1bc2dE3Fg4', 'A1bc2dE3fg4', 'A1bc2dE3fG4', 'A1Bc2dE3fG4', 'A1Bc2dE3fg4', 'A1Bc2dE3Fg4', 'A1Bc2dE3FG4', 'A1Bc2de3FG4', 'A1Bc2de3Fg4', 'A1Bc2de3fg4', 'A1Bc2de3fG4', 'A1Bc2De3fG4', 'A1Bc2De3fg4', 'A1Bc2De3Fg4', 'A1Bc2De3FG4', 'A1Bc2DE3FG4', 'A1Bc2DE3Fg4', 'A1Bc2DE3fg4', 'A1Bc2DE3fG4', 'A1BC2DE3fG4', 'A1BC2DE3fg4', 'A1BC2DE3Fg4', 'A1BC2DE3FG4', 'A1BC2De3FG4', 'A1BC2De3Fg4', 'A1BC2De3fg4', 'A1BC2De3fG4', 'A1BC2de3fG4', 'A1BC2de3fg4', 'A1BC2de3Fg4', 'A1BC2de3FG4', 'A1BC2dE3FG4', 'A1BC2dE3Fg4', 'A1BC2dE3fg4', 'A1BC2dE3fG4', 'a1BC2dE3fG4', 'a1BC2dE3fg4', 'a1BC2dE3Fg4', 'a1BC2dE3FG4', 'a1BC2de3FG4', 'a1BC2de3Fg4', 'a1BC2de3fg4', 'a1BC2de3fG4', 'a1BC2De3fG4', 'a1BC2De3fg4', 'a1BC2De3Fg4', 'a1BC2De3FG4', 'a1BC2DE3FG4', 'a1BC2DE3Fg4', 'a1BC2DE3fg4', 'a1BC2DE3fG4', 'a1Bc2DE3fG4', 'a1Bc2DE3fg4', 'a1Bc2DE3Fg4', 'a1Bc2DE3FG4', 'a1Bc2De3FG4', 'a1Bc2De3Fg4', 'a1Bc2De3fg4', 'a1Bc2De3fG4', 'a1Bc2de3fG4', 'a1Bc2de3fg4', 'a1Bc2de3Fg4', 'a1Bc2de3FG4', 'a1Bc2dE3FG4', 'a1Bc2dE3Fg4', 'a1Bc2dE3fg4', 'a1Bc2dE3fG4', 'a1bc2dE3fG4', 'a1bc2dE3fg4', 'a1bc2dE3Fg4', 'a1bc2dE3FG4', 'a1bc2de3FG4', 'a1bc2de3Fg4', 'a1bc2de3fg4', 'a1bc2de3fG4', 'a1bc2De3fG4', 'a1bc2De3fg4', 'a1bc2De3Fg4', 'a1bc2De3FG4', 'a1bc2DE3FG4', 'a1bc2DE3Fg4', 'a1bc2DE3fg4', 'a1bc2DE3fG4', 'a1bC2DE3fG4', 'a1bC2DE3fg4', 'a1bC2DE3Fg4', 'a1bC2DE3FG4', 'a1bC2De3FG4', 'a1bC2De3Fg4', 'a1bC2De3fg4', 'a1bC2De3fG4', 'a1bC2de3fG4', 'a1bC2de3fg4', 'a1bC2de3Fg4', 'a1bC2de3FG4', 'a1bC2dE3FG4', 'a1bC2dE3Fg4', 'a1bC2dE3fg4', 'a1bC2dE3fG4']\n assert candidate(s = \"123ABC456\") == ['123ABC456', '123ABc456', '123Abc456', '123AbC456', '123abC456', '123abc456', '123aBc456', '123aBC456']\n assert candidate(s = \"abcXYZ\") == ['abcXYZ', 'abcXYz', 'abcXyz', 'abcXyZ', 'abcxyZ', 'abcxyz', 'abcxYz', 'abcxYZ', 'abCxYZ', 'abCxYz', 'abCxyz', 'abCxyZ', 'abCXyZ', 'abCXyz', 'abCXYz', 'abCXYZ', 'aBCXYZ', 'aBCXYz', 'aBCXyz', 'aBCXyZ', 'aBCxyZ', 'aBCxyz', 'aBCxYz', 'aBCxYZ', 'aBcxYZ', 'aBcxYz', 'aBcxyz', 'aBcxyZ', 'aBcXyZ', 'aBcXyz', 'aBcXYz', 'aBcXYZ', 'ABcXYZ', 'ABcXYz', 'ABcXyz', 'ABcXyZ', 'ABcxyZ', 'ABcxyz', 'ABcxYz', 'ABcxYZ', 'ABCxYZ', 'ABCxYz', 'ABCxyz', 'ABCxyZ', 'ABCXyZ', 'ABCXyz', 'ABCXYz', 'ABCXYZ', 'AbCXYZ', 'AbCXYz', 'AbCXyz', 'AbCXyZ', 'AbCxyZ', 'AbCxyz', 'AbCxYz', 'AbCxYZ', 'AbcxYZ', 'AbcxYz', 'Abcxyz', 'AbcxyZ', 'AbcXyZ', 'AbcXyz', 'AbcXYz', 'AbcXYZ']\n assert candidate(s = \"aBcDeF12\") == ['aBcDeF12', 'aBcDef12', 'aBcDEf12', 'aBcDEF12', 'aBcdEF12', 'aBcdEf12', 'aBcdef12', 'aBcdeF12', 'aBCdeF12', 'aBCdef12', 'aBCdEf12', 'aBCdEF12', 'aBCDEF12', 'aBCDEf12', 'aBCDef12', 'aBCDeF12', 'abCDeF12', 'abCDef12', 'abCDEf12', 'abCDEF12', 'abCdEF12', 'abCdEf12', 'abCdef12', 'abCdeF12', 'abcdeF12', 'abcdef12', 'abcdEf12', 'abcdEF12', 'abcDEF12', 'abcDEf12', 'abcDef12', 'abcDeF12', 'AbcDeF12', 'AbcDef12', 'AbcDEf12', 'AbcDEF12', 'AbcdEF12', 'AbcdEf12', 'Abcdef12', 'AbcdeF12', 'AbCdeF12', 'AbCdef12', 'AbCdEf12', 'AbCdEF12', 'AbCDEF12', 'AbCDEf12', 'AbCDef12', 'AbCDeF12', 'ABCDeF12', 'ABCDef12', 'ABCDEf12', 'ABCDEF12', 'ABCdEF12', 'ABCdEf12', 'ABCdef12', 'ABCdeF12', 'ABcdeF12', 'ABcdef12', 'ABcdEf12', 'ABcdEF12', 'ABcDEF12', 'ABcDEf12', 'ABcDef12', 'ABcDeF12']\n assert candidate(s = \"aBc123dE\") == ['aBc123dE', 'aBc123de', 'aBc123De', 'aBc123DE', 'aBC123DE', 'aBC123De', 'aBC123de', 'aBC123dE', 'abC123dE', 'abC123de', 'abC123De', 'abC123DE', 'abc123DE', 'abc123De', 'abc123de', 'abc123dE', 'Abc123dE', 'Abc123de', 'Abc123De', 'Abc123DE', 'AbC123DE', 'AbC123De', 'AbC123de', 'AbC123dE', 'ABC123dE', 'ABC123de', 'ABC123De', 'ABC123DE', 'ABc123DE', 'ABc123De', 'ABc123de', 'ABc123dE']\n assert candidate(s = \"abcdefghij\") == ['abcdefghij', 'abcdefghiJ', 'abcdefghIJ', 'abcdefghIj', 'abcdefgHIj', 'abcdefgHIJ', 'abcdefgHiJ', 'abcdefgHij', 'abcdefGHij', 'abcdefGHiJ', 'abcdefGHIJ', 'abcdefGHIj', 'abcdefGhIj', 'abcdefGhIJ', 'abcdefGhiJ', 'abcdefGhij', 'abcdeFGhij', 'abcdeFGhiJ', 'abcdeFGhIJ', 'abcdeFGhIj', 'abcdeFGHIj', 'abcdeFGHIJ', 'abcdeFGHiJ', 'abcdeFGHij', 'abcdeFgHij', 'abcdeFgHiJ', 'abcdeFgHIJ', 'abcdeFgHIj', 'abcdeFghIj', 'abcdeFghIJ', 'abcdeFghiJ', 'abcdeFghij', 'abcdEFghij', 'abcdEFghiJ', 'abcdEFghIJ', 'abcdEFghIj', 'abcdEFgHIj', 'abcdEFgHIJ', 'abcdEFgHiJ', 'abcdEFgHij', 'abcdEFGHij', 'abcdEFGHiJ', 'abcdEFGHIJ', 'abcdEFGHIj', 'abcdEFGhIj', 'abcdEFGhIJ', 'abcdEFGhiJ', 'abcdEFGhij', 'abcdEfGhij', 'abcdEfGhiJ', 'abcdEfGhIJ', 'abcdEfGhIj', 'abcdEfGHIj', 'abcdEfGHIJ', 'abcdEfGHiJ', 'abcdEfGHij', 'abcdEfgHij', 'abcdEfgHiJ', 'abcdEfgHIJ', 'abcdEfgHIj', 'abcdEfghIj', 'abcdEfghIJ', 'abcdEfghiJ', 'abcdEfghij', 'abcDEfghij', 'abcDEfghiJ', 'abcDEfghIJ', 'abcDEfghIj', 'abcDEfgHIj', 'abcDEfgHIJ', 'abcDEfgHiJ', 'abcDEfgHij', 'abcDEfGHij', 'abcDEfGHiJ', 'abcDEfGHIJ', 'abcDEfGHIj', 'abcDEfGhIj', 'abcDEfGhIJ', 'abcDEfGhiJ', 'abcDEfGhij', 'abcDEFGhij', 'abcDEFGhiJ', 'abcDEFGhIJ', 'abcDEFGhIj', 'abcDEFGHIj', 'abcDEFGHIJ', 'abcDEFGHiJ', 'abcDEFGHij', 'abcDEFgHij', 'abcDEFgHiJ', 'abcDEFgHIJ', 'abcDEFgHIj', 'abcDEFghIj', 'abcDEFghIJ', 'abcDEFghiJ', 'abcDEFghij', 'abcDeFghij', 'abcDeFghiJ', 'abcDeFghIJ', 'abcDeFghIj', 'abcDeFgHIj', 'abcDeFgHIJ', 'abcDeFgHiJ', 'abcDeFgHij', 'abcDeFGHij', 'abcDeFGHiJ', 'abcDeFGHIJ', 'abcDeFGHIj', 'abcDeFGhIj', 'abcDeFGhIJ', 'abcDeFGhiJ', 'abcDeFGhij', 'abcDefGhij', 'abcDefGhiJ', 'abcDefGhIJ', 'abcDefGhIj', 'abcDefGHIj', 'abcDefGHIJ', 'abcDefGHiJ', 'abcDefGHij', 'abcDefgHij', 'abcDefgHiJ', 'abcDefgHIJ', 'abcDefgHIj', 'abcDefghIj', 'abcDefghIJ', 'abcDefghiJ', 'abcDefghij', 'abCDefghij', 'abCDefghiJ', 'abCDefghIJ', 'abCDefghIj', 'abCDefgHIj', 'abCDefgHIJ', 'abCDefgHiJ', 'abCDefgHij', 'abCDefGHij', 'abCDefGHiJ', 'abCDefGHIJ', 'abCDefGHIj', 'abCDefGhIj', 'abCDefGhIJ', 'abCDefGhiJ', 'abCDefGhij', 'abCDeFGhij', 'abCDeFGhiJ', 'abCDeFGhIJ', 'abCDeFGhIj', 'abCDeFGHIj', 'abCDeFGHIJ', 'abCDeFGHiJ', 'abCDeFGHij', 'abCDeFgHij', 'abCDeFgHiJ', 'abCDeFgHIJ', 'abCDeFgHIj', 'abCDeFghIj', 'abCDeFghIJ', 'abCDeFghiJ', 'abCDeFghij', 'abCDEFghij', 'abCDEFghiJ', 'abCDEFghIJ', 'abCDEFghIj', 'abCDEFgHIj', 'abCDEFgHIJ', 'abCDEFgHiJ', 'abCDEFgHij', 'abCDEFGHij', 'abCDEFGHiJ', 'abCDEFGHIJ', 'abCDEFGHIj', 'abCDEFGhIj', 'abCDEFGhIJ', 'abCDEFGhiJ', 'abCDEFGhij', 'abCDEfGhij', 'abCDEfGhiJ', 'abCDEfGhIJ', 'abCDEfGhIj', 'abCDEfGHIj', 'abCDEfGHIJ', 'abCDEfGHiJ', 'abCDEfGHij', 'abCDEfgHij', 'abCDEfgHiJ', 'abCDEfgHIJ', 'abCDEfgHIj', 'abCDEfghIj', 'abCDEfghIJ', 'abCDEfghiJ', 'abCDEfghij', 'abCdEfghij', 'abCdEfghiJ', 'abCdEfghIJ', 'abCdEfghIj', 'abCdEfgHIj', 'abCdEfgHIJ', 'abCdEfgHiJ', 'abCdEfgHij', 'abCdEfGHij', 'abCdEfGHiJ', 'abCdEfGHIJ', 'abCdEfGHIj', 'abCdEfGhIj', 'abCdEfGhIJ', 'abCdEfGhiJ', 'abCdEfGhij', 'abCdEFGhij', 'abCdEFGhiJ', 'abCdEFGhIJ', 'abCdEFGhIj', 'abCdEFGHIj', 'abCdEFGHIJ', 'abCdEFGHiJ', 'abCdEFGHij', 'abCdEFgHij', 'abCdEFgHiJ', 'abCdEFgHIJ', 'abCdEFgHIj', 'abCdEFghIj', 'abCdEFghIJ', 'abCdEFghiJ', 'abCdEFghij', 'abCdeFghij', 'abCdeFghiJ', 'abCdeFghIJ', 'abCdeFghIj', 'abCdeFgHIj', 'abCdeFgHIJ', 'abCdeFgHiJ', 'abCdeFgHij', 'abCdeFGHij', 'abCdeFGHiJ', 'abCdeFGHIJ', 'abCdeFGHIj', 'abCdeFGhIj', 'abCdeFGhIJ', 'abCdeFGhiJ', 'abCdeFGhij', 'abCdefGhij', 'abCdefGhiJ', 'abCdefGhIJ', 'abCdefGhIj', 'abCdefGHIj', 'abCdefGHIJ', 'abCdefGHiJ', 'abCdefGHij', 'abCdefgHij', 'abCdefgHiJ', 'abCdefgHIJ', 'abCdefgHIj', 'abCdefghIj', 'abCdefghIJ', 'abCdefghiJ', 'abCdefghij', 'aBCdefghij', 'aBCdefghiJ', 'aBCdefghIJ', 'aBCdefghIj', 'aBCdefgHIj', 'aBCdefgHIJ', 'aBCdefgHiJ', 'aBCdefgHij', 'aBCdefGHij', 'aBCdefGHiJ', 'aBCdefGHIJ', 'aBCdefGHIj', 'aBCdefGhIj', 'aBCdefGhIJ', 'aBCdefGhiJ', 'aBCdefGhij', 'aBCdeFGhij', 'aBCdeFGhiJ', 'aBCdeFGhIJ', 'aBCdeFGhIj', 'aBCdeFGHIj', 'aBCdeFGHIJ', 'aBCdeFGHiJ', 'aBCdeFGHij', 'aBCdeFgHij', 'aBCdeFgHiJ', 'aBCdeFgHIJ', 'aBCdeFgHIj', 'aBCdeFghIj', 'aBCdeFghIJ', 'aBCdeFghiJ', 'aBCdeFghij', 'aBCdEFghij', 'aBCdEFghiJ', 'aBCdEFghIJ', 'aBCdEFghIj', 'aBCdEFgHIj', 'aBCdEFgHIJ', 'aBCdEFgHiJ', 'aBCdEFgHij', 'aBCdEFGHij', 'aBCdEFGHiJ', 'aBCdEFGHIJ', 'aBCdEFGHIj', 'aBCdEFGhIj', 'aBCdEFGhIJ', 'aBCdEFGhiJ', 'aBCdEFGhij', 'aBCdEfGhij', 'aBCdEfGhiJ', 'aBCdEfGhIJ', 'aBCdEfGhIj', 'aBCdEfGHIj', 'aBCdEfGHIJ', 'aBCdEfGHiJ', 'aBCdEfGHij', 'aBCdEfgHij', 'aBCdEfgHiJ', 'aBCdEfgHIJ', 'aBCdEfgHIj', 'aBCdEfghIj', 'aBCdEfghIJ', 'aBCdEfghiJ', 'aBCdEfghij', 'aBCDEfghij', 'aBCDEfghiJ', 'aBCDEfghIJ', 'aBCDEfghIj', 'aBCDEfgHIj', 'aBCDEfgHIJ', 'aBCDEfgHiJ', 'aBCDEfgHij', 'aBCDEfGHij', 'aBCDEfGHiJ', 'aBCDEfGHIJ', 'aBCDEfGHIj', 'aBCDEfGhIj', 'aBCDEfGhIJ', 'aBCDEfGhiJ', 'aBCDEfGhij', 'aBCDEFGhij', 'aBCDEFGhiJ', 'aBCDEFGhIJ', 'aBCDEFGhIj', 'aBCDEFGHIj', 'aBCDEFGHIJ', 'aBCDEFGHiJ', 'aBCDEFGHij', 'aBCDEFgHij', 'aBCDEFgHiJ', 'aBCDEFgHIJ', 'aBCDEFgHIj', 'aBCDEFghIj', 'aBCDEFghIJ', 'aBCDEFghiJ', 'aBCDEFghij', 'aBCDeFghij', 'aBCDeFghiJ', 'aBCDeFghIJ', 'aBCDeFghIj', 'aBCDeFgHIj', 'aBCDeFgHIJ', 'aBCDeFgHiJ', 'aBCDeFgHij', 'aBCDeFGHij', 'aBCDeFGHiJ', 'aBCDeFGHIJ', 'aBCDeFGHIj', 'aBCDeFGhIj', 'aBCDeFGhIJ', 'aBCDeFGhiJ', 'aBCDeFGhij', 'aBCDefGhij', 'aBCDefGhiJ', 'aBCDefGhIJ', 'aBCDefGhIj', 'aBCDefGHIj', 'aBCDefGHIJ', 'aBCDefGHiJ', 'aBCDefGHij', 'aBCDefgHij', 'aBCDefgHiJ', 'aBCDefgHIJ', 'aBCDefgHIj', 'aBCDefghIj', 'aBCDefghIJ', 'aBCDefghiJ', 'aBCDefghij', 'aBcDefghij', 'aBcDefghiJ', 'aBcDefghIJ', 'aBcDefghIj', 'aBcDefgHIj', 'aBcDefgHIJ', 'aBcDefgHiJ', 'aBcDefgHij', 'aBcDefGHij', 'aBcDefGHiJ', 'aBcDefGHIJ', 'aBcDefGHIj', 'aBcDefGhIj', 'aBcDefGhIJ', 'aBcDefGhiJ', 'aBcDefGhij', 'aBcDeFGhij', 'aBcDeFGhiJ', 'aBcDeFGhIJ', 'aBcDeFGhIj', 'aBcDeFGHIj', 'aBcDeFGHIJ', 'aBcDeFGHiJ', 'aBcDeFGHij', 'aBcDeFgHij', 'aBcDeFgHiJ', 'aBcDeFgHIJ', 'aBcDeFgHIj', 'aBcDeFghIj', 'aBcDeFghIJ', 'aBcDeFghiJ', 'aBcDeFghij', 'aBcDEFghij', 'aBcDEFghiJ', 'aBcDEFghIJ', 'aBcDEFghIj', 'aBcDEFgHIj', 'aBcDEFgHIJ', 'aBcDEFgHiJ', 'aBcDEFgHij', 'aBcDEFGHij', 'aBcDEFGHiJ', 'aBcDEFGHIJ', 'aBcDEFGHIj', 'aBcDEFGhIj', 'aBcDEFGhIJ', 'aBcDEFGhiJ', 'aBcDEFGhij', 'aBcDEfGhij', 'aBcDEfGhiJ', 'aBcDEfGhIJ', 'aBcDEfGhIj', 'aBcDEfGHIj', 'aBcDEfGHIJ', 'aBcDEfGHiJ', 'aBcDEfGHij', 'aBcDEfgHij', 'aBcDEfgHiJ', 'aBcDEfgHIJ', 'aBcDEfgHIj', 'aBcDEfghIj', 'aBcDEfghIJ', 'aBcDEfghiJ', 'aBcDEfghij', 'aBcdEfghij', 'aBcdEfghiJ', 'aBcdEfghIJ', 'aBcdEfghIj', 'aBcdEfgHIj', 'aBcdEfgHIJ', 'aBcdEfgHiJ', 'aBcdEfgHij', 'aBcdEfGHij', 'aBcdEfGHiJ', 'aBcdEfGHIJ', 'aBcdEfGHIj', 'aBcdEfGhIj', 'aBcdEfGhIJ', 'aBcdEfGhiJ', 'aBcdEfGhij', 'aBcdEFGhij', 'aBcdEFGhiJ', 'aBcdEFGhIJ', 'aBcdEFGhIj', 'aBcdEFGHIj', 'aBcdEFGHIJ', 'aBcdEFGHiJ', 'aBcdEFGHij', 'aBcdEFgHij', 'aBcdEFgHiJ', 'aBcdEFgHIJ', 'aBcdEFgHIj', 'aBcdEFghIj', 'aBcdEFghIJ', 'aBcdEFghiJ', 'aBcdEFghij', 'aBcdeFghij', 'aBcdeFghiJ', 'aBcdeFghIJ', 'aBcdeFghIj', 'aBcdeFgHIj', 'aBcdeFgHIJ', 'aBcdeFgHiJ', 'aBcdeFgHij', 'aBcdeFGHij', 'aBcdeFGHiJ', 'aBcdeFGHIJ', 'aBcdeFGHIj', 'aBcdeFGhIj', 'aBcdeFGhIJ', 'aBcdeFGhiJ', 'aBcdeFGhij', 'aBcdefGhij', 'aBcdefGhiJ', 'aBcdefGhIJ', 'aBcdefGhIj', 'aBcdefGHIj', 'aBcdefGHIJ', 'aBcdefGHiJ', 'aBcdefGHij', 'aBcdefgHij', 'aBcdefgHiJ', 'aBcdefgHIJ', 'aBcdefgHIj', 'aBcdefghIj', 'aBcdefghIJ', 'aBcdefghiJ', 'aBcdefghij', 'ABcdefghij', 'ABcdefghiJ', 'ABcdefghIJ', 'ABcdefghIj', 'ABcdefgHIj', 'ABcdefgHIJ', 'ABcdefgHiJ', 'ABcdefgHij', 'ABcdefGHij', 'ABcdefGHiJ', 'ABcdefGHIJ', 'ABcdefGHIj', 'ABcdefGhIj', 'ABcdefGhIJ', 'ABcdefGhiJ', 'ABcdefGhij', 'ABcdeFGhij', 'ABcdeFGhiJ', 'ABcdeFGhIJ', 'ABcdeFGhIj', 'ABcdeFGHIj', 'ABcdeFGHIJ', 'ABcdeFGHiJ', 'ABcdeFGHij', 'ABcdeFgHij', 'ABcdeFgHiJ', 'ABcdeFgHIJ', 'ABcdeFgHIj', 'ABcdeFghIj', 'ABcdeFghIJ', 'ABcdeFghiJ', 'ABcdeFghij', 'ABcdEFghij', 'ABcdEFghiJ', 'ABcdEFghIJ', 'ABcdEFghIj', 'ABcdEFgHIj', 'ABcdEFgHIJ', 'ABcdEFgHiJ', 'ABcdEFgHij', 'ABcdEFGHij', 'ABcdEFGHiJ', 'ABcdEFGHIJ', 'ABcdEFGHIj', 'ABcdEFGhIj', 'ABcdEFGhIJ', 'ABcdEFGhiJ', 'ABcdEFGhij', 'ABcdEfGhij', 'ABcdEfGhiJ', 'ABcdEfGhIJ', 'ABcdEfGhIj', 'ABcdEfGHIj', 'ABcdEfGHIJ', 'ABcdEfGHiJ', 'ABcdEfGHij', 'ABcdEfgHij', 'ABcdEfgHiJ', 'ABcdEfgHIJ', 'ABcdEfgHIj', 'ABcdEfghIj', 'ABcdEfghIJ', 'ABcdEfghiJ', 'ABcdEfghij', 'ABcDEfghij', 'ABcDEfghiJ', 'ABcDEfghIJ', 'ABcDEfghIj', 'ABcDEfgHIj', 'ABcDEfgHIJ', 'ABcDEfgHiJ', 'ABcDEfgHij', 'ABcDEfGHij', 'ABcDEfGHiJ', 'ABcDEfGHIJ', 'ABcDEfGHIj', 'ABcDEfGhIj', 'ABcDEfGhIJ', 'ABcDEfGhiJ', 'ABcDEfGhij', 'ABcDEFGhij', 'ABcDEFGhiJ', 'ABcDEFGhIJ', 'ABcDEFGhIj', 'ABcDEFGHIj', 'ABcDEFGHIJ', 'ABcDEFGHiJ', 'ABcDEFGHij', 'ABcDEFgHij', 'ABcDEFgHiJ', 'ABcDEFgHIJ', 'ABcDEFgHIj', 'ABcDEFghIj', 'ABcDEFghIJ', 'ABcDEFghiJ', 'ABcDEFghij', 'ABcDeFghij', 'ABcDeFghiJ', 'ABcDeFghIJ', 'ABcDeFghIj', 'ABcDeFgHIj', 'ABcDeFgHIJ', 'ABcDeFgHiJ', 'ABcDeFgHij', 'ABcDeFGHij', 'ABcDeFGHiJ', 'ABcDeFGHIJ', 'ABcDeFGHIj', 'ABcDeFGhIj', 'ABcDeFGhIJ', 'ABcDeFGhiJ', 'ABcDeFGhij', 'ABcDefGhij', 'ABcDefGhiJ', 'ABcDefGhIJ', 'ABcDefGhIj', 'ABcDefGHIj', 'ABcDefGHIJ', 'ABcDefGHiJ', 'ABcDefGHij', 'ABcDefgHij', 'ABcDefgHiJ', 'ABcDefgHIJ', 'ABcDefgHIj', 'ABcDefghIj', 'ABcDefghIJ', 'ABcDefghiJ', 'ABcDefghij', 'ABCDefghij', 'ABCDefghiJ', 'ABCDefghIJ', 'ABCDefghIj', 'ABCDefgHIj', 'ABCDefgHIJ', 'ABCDefgHiJ', 'ABCDefgHij', 'ABCDefGHij', 'ABCDefGHiJ', 'ABCDefGHIJ', 'ABCDefGHIj', 'ABCDefGhIj', 'ABCDefGhIJ', 'ABCDefGhiJ', 'ABCDefGhij', 'ABCDeFGhij', 'ABCDeFGhiJ', 'ABCDeFGhIJ', 'ABCDeFGhIj', 'ABCDeFGHIj', 'ABCDeFGHIJ', 'ABCDeFGHiJ', 'ABCDeFGHij', 'ABCDeFgHij', 'ABCDeFgHiJ', 'ABCDeFgHIJ', 'ABCDeFgHIj', 'ABCDeFghIj', 'ABCDeFghIJ', 'ABCDeFghiJ', 'ABCDeFghij', 'ABCDEFghij', 'ABCDEFghiJ', 'ABCDEFghIJ', 'ABCDEFghIj', 'ABCDEFgHIj', 'ABCDEFgHIJ', 'ABCDEFgHiJ', 'ABCDEFgHij', 'ABCDEFGHij', 'ABCDEFGHiJ', 'ABCDEFGHIJ', 'ABCDEFGHIj', 'ABCDEFGhIj', 'ABCDEFGhIJ', 'ABCDEFGhiJ', 'ABCDEFGhij', 'ABCDEfGhij', 'ABCDEfGhiJ', 'ABCDEfGhIJ', 'ABCDEfGhIj', 'ABCDEfGHIj', 'ABCDEfGHIJ', 'ABCDEfGHiJ', 'ABCDEfGHij', 'ABCDEfgHij', 'ABCDEfgHiJ', 'ABCDEfgHIJ', 'ABCDEfgHIj', 'ABCDEfghIj', 'ABCDEfghIJ', 'ABCDEfghiJ', 'ABCDEfghij', 'ABCdEfghij', 'ABCdEfghiJ', 'ABCdEfghIJ', 'ABCdEfghIj', 'ABCdEfgHIj', 'ABCdEfgHIJ', 'ABCdEfgHiJ', 'ABCdEfgHij', 'ABCdEfGHij', 'ABCdEfGHiJ', 'ABCdEfGHIJ', 'ABCdEfGHIj', 'ABCdEfGhIj', 'ABCdEfGhIJ', 'ABCdEfGhiJ', 'ABCdEfGhij', 'ABCdEFGhij', 'ABCdEFGhiJ', 'ABCdEFGhIJ', 'ABCdEFGhIj', 'ABCdEFGHIj', 'ABCdEFGHIJ', 'ABCdEFGHiJ', 'ABCdEFGHij', 'ABCdEFgHij', 'ABCdEFgHiJ', 'ABCdEFgHIJ', 'ABCdEFgHIj', 'ABCdEFghIj', 'ABCdEFghIJ', 'ABCdEFghiJ', 'ABCdEFghij', 'ABCdeFghij', 'ABCdeFghiJ', 'ABCdeFghIJ', 'ABCdeFghIj', 'ABCdeFgHIj', 'ABCdeFgHIJ', 'ABCdeFgHiJ', 'ABCdeFgHij', 'ABCdeFGHij', 'ABCdeFGHiJ', 'ABCdeFGHIJ', 'ABCdeFGHIj', 'ABCdeFGhIj', 'ABCdeFGhIJ', 'ABCdeFGhiJ', 'ABCdeFGhij', 'ABCdefGhij', 'ABCdefGhiJ', 'ABCdefGhIJ', 'ABCdefGhIj', 'ABCdefGHIj', 'ABCdefGHIJ', 'ABCdefGHiJ', 'ABCdefGHij', 'ABCdefgHij', 'ABCdefgHiJ', 'ABCdefgHIJ', 'ABCdefgHIj', 'ABCdefghIj', 'ABCdefghIJ', 'ABCdefghiJ', 'ABCdefghij', 'AbCdefghij', 'AbCdefghiJ', 'AbCdefghIJ', 'AbCdefghIj', 'AbCdefgHIj', 'AbCdefgHIJ', 'AbCdefgHiJ', 'AbCdefgHij', 'AbCdefGHij', 'AbCdefGHiJ', 'AbCdefGHIJ', 'AbCdefGHIj', 'AbCdefGhIj', 'AbCdefGhIJ', 'AbCdefGhiJ', 'AbCdefGhij', 'AbCdeFGhij', 'AbCdeFGhiJ', 'AbCdeFGhIJ', 'AbCdeFGhIj', 'AbCdeFGHIj', 'AbCdeFGHIJ', 'AbCdeFGHiJ', 'AbCdeFGHij', 'AbCdeFgHij', 'AbCdeFgHiJ', 'AbCdeFgHIJ', 'AbCdeFgHIj', 'AbCdeFghIj', 'AbCdeFghIJ', 'AbCdeFghiJ', 'AbCdeFghij', 'AbCdEFghij', 'AbCdEFghiJ', 'AbCdEFghIJ', 'AbCdEFghIj', 'AbCdEFgHIj', 'AbCdEFgHIJ', 'AbCdEFgHiJ', 'AbCdEFgHij', 'AbCdEFGHij', 'AbCdEFGHiJ', 'AbCdEFGHIJ', 'AbCdEFGHIj', 'AbCdEFGhIj', 'AbCdEFGhIJ', 'AbCdEFGhiJ', 'AbCdEFGhij', 'AbCdEfGhij', 'AbCdEfGhiJ', 'AbCdEfGhIJ', 'AbCdEfGhIj', 'AbCdEfGHIj', 'AbCdEfGHIJ', 'AbCdEfGHiJ', 'AbCdEfGHij', 'AbCdEfgHij', 'AbCdEfgHiJ', 'AbCdEfgHIJ', 'AbCdEfgHIj', 'AbCdEfghIj', 'AbCdEfghIJ', 'AbCdEfghiJ', 'AbCdEfghij', 'AbCDEfghij', 'AbCDEfghiJ', 'AbCDEfghIJ', 'AbCDEfghIj', 'AbCDEfgHIj', 'AbCDEfgHIJ', 'AbCDEfgHiJ', 'AbCDEfgHij', 'AbCDEfGHij', 'AbCDEfGHiJ', 'AbCDEfGHIJ', 'AbCDEfGHIj', 'AbCDEfGhIj', 'AbCDEfGhIJ', 'AbCDEfGhiJ', 'AbCDEfGhij', 'AbCDEFGhij', 'AbCDEFGhiJ', 'AbCDEFGhIJ', 'AbCDEFGhIj', 'AbCDEFGHIj', 'AbCDEFGHIJ', 'AbCDEFGHiJ', 'AbCDEFGHij', 'AbCDEFgHij', 'AbCDEFgHiJ', 'AbCDEFgHIJ', 'AbCDEFgHIj', 'AbCDEFghIj', 'AbCDEFghIJ', 'AbCDEFghiJ', 'AbCDEFghij', 'AbCDeFghij', 'AbCDeFghiJ', 'AbCDeFghIJ', 'AbCDeFghIj', 'AbCDeFgHIj', 'AbCDeFgHIJ', 'AbCDeFgHiJ', 'AbCDeFgHij', 'AbCDeFGHij', 'AbCDeFGHiJ', 'AbCDeFGHIJ', 'AbCDeFGHIj', 'AbCDeFGhIj', 'AbCDeFGhIJ', 'AbCDeFGhiJ', 'AbCDeFGhij', 'AbCDefGhij', 'AbCDefGhiJ', 'AbCDefGhIJ', 'AbCDefGhIj', 'AbCDefGHIj', 'AbCDefGHIJ', 'AbCDefGHiJ', 'AbCDefGHij', 'AbCDefgHij', 'AbCDefgHiJ', 'AbCDefgHIJ', 'AbCDefgHIj', 'AbCDefghIj', 'AbCDefghIJ', 'AbCDefghiJ', 'AbCDefghij', 'AbcDefghij', 'AbcDefghiJ', 'AbcDefghIJ', 'AbcDefghIj', 'AbcDefgHIj', 'AbcDefgHIJ', 'AbcDefgHiJ', 'AbcDefgHij', 'AbcDefGHij', 'AbcDefGHiJ', 'AbcDefGHIJ', 'AbcDefGHIj', 'AbcDefGhIj', 'AbcDefGhIJ', 'AbcDefGhiJ', 'AbcDefGhij', 'AbcDeFGhij', 'AbcDeFGhiJ', 'AbcDeFGhIJ', 'AbcDeFGhIj', 'AbcDeFGHIj', 'AbcDeFGHIJ', 'AbcDeFGHiJ', 'AbcDeFGHij', 'AbcDeFgHij', 'AbcDeFgHiJ', 'AbcDeFgHIJ', 'AbcDeFgHIj', 'AbcDeFghIj', 'AbcDeFghIJ', 'AbcDeFghiJ', 'AbcDeFghij', 'AbcDEFghij', 'AbcDEFghiJ', 'AbcDEFghIJ', 'AbcDEFghIj', 'AbcDEFgHIj', 'AbcDEFgHIJ', 'AbcDEFgHiJ', 'AbcDEFgHij', 'AbcDEFGHij', 'AbcDEFGHiJ', 'AbcDEFGHIJ', 'AbcDEFGHIj', 'AbcDEFGhIj', 'AbcDEFGhIJ', 'AbcDEFGhiJ', 'AbcDEFGhij', 'AbcDEfGhij', 'AbcDEfGhiJ', 'AbcDEfGhIJ', 'AbcDEfGhIj', 'AbcDEfGHIj', 'AbcDEfGHIJ', 'AbcDEfGHiJ', 'AbcDEfGHij', 'AbcDEfgHij', 'AbcDEfgHiJ', 'AbcDEfgHIJ', 'AbcDEfgHIj', 'AbcDEfghIj', 'AbcDEfghIJ', 'AbcDEfghiJ', 'AbcDEfghij', 'AbcdEfghij', 'AbcdEfghiJ', 'AbcdEfghIJ', 'AbcdEfghIj', 'AbcdEfgHIj', 'AbcdEfgHIJ', 'AbcdEfgHiJ', 'AbcdEfgHij', 'AbcdEfGHij', 'AbcdEfGHiJ', 'AbcdEfGHIJ', 'AbcdEfGHIj', 'AbcdEfGhIj', 'AbcdEfGhIJ', 'AbcdEfGhiJ', 'AbcdEfGhij', 'AbcdEFGhij', 'AbcdEFGhiJ', 'AbcdEFGhIJ', 'AbcdEFGhIj', 'AbcdEFGHIj', 'AbcdEFGHIJ', 'AbcdEFGHiJ', 'AbcdEFGHij', 'AbcdEFgHij', 'AbcdEFgHiJ', 'AbcdEFgHIJ', 'AbcdEFgHIj', 'AbcdEFghIj', 'AbcdEFghIJ', 'AbcdEFghiJ', 'AbcdEFghij', 'AbcdeFghij', 'AbcdeFghiJ', 'AbcdeFghIJ', 'AbcdeFghIj', 'AbcdeFgHIj', 'AbcdeFgHIJ', 'AbcdeFgHiJ', 'AbcdeFgHij', 'AbcdeFGHij', 'AbcdeFGHiJ', 'AbcdeFGHIJ', 'AbcdeFGHIj', 'AbcdeFGhIj', 'AbcdeFGhIJ', 'AbcdeFGhiJ', 'AbcdeFGhij', 'AbcdefGhij', 'AbcdefGhiJ', 'AbcdefGhIJ', 'AbcdefGhIj', 'AbcdefGHIj', 'AbcdefGHIJ', 'AbcdefGHiJ', 'AbcdefGHij', 'AbcdefgHij', 'AbcdefgHiJ', 'AbcdefgHIJ', 'AbcdefgHIj', 'AbcdefghIj', 'AbcdefghIJ', 'AbcdefghiJ', 'Abcdefghij']\n assert candidate(s = \"mNoPqR\") == ['mNoPqR', 'mNoPqr', 'mNoPQr', 'mNoPQR', 'mNopQR', 'mNopQr', 'mNopqr', 'mNopqR', 'mNOpqR', 'mNOpqr', 'mNOpQr', 'mNOpQR', 'mNOPQR', 'mNOPQr', 'mNOPqr', 'mNOPqR', 'mnOPqR', 'mnOPqr', 'mnOPQr', 'mnOPQR', 'mnOpQR', 'mnOpQr', 'mnOpqr', 'mnOpqR', 'mnopqR', 'mnopqr', 'mnopQr', 'mnopQR', 'mnoPQR', 'mnoPQr', 'mnoPqr', 'mnoPqR', 'MnoPqR', 'MnoPqr', 'MnoPQr', 'MnoPQR', 'MnopQR', 'MnopQr', 'Mnopqr', 'MnopqR', 'MnOpqR', 'MnOpqr', 'MnOpQr', 'MnOpQR', 'MnOPQR', 'MnOPQr', 'MnOPqr', 'MnOPqR', 'MNOPqR', 'MNOPqr', 'MNOPQr', 'MNOPQR', 'MNOpQR', 'MNOpQr', 'MNOpqr', 'MNOpqR', 'MNopqR', 'MNopqr', 'MNopQr', 'MNopQR', 'MNoPQR', 'MNoPQr', 'MNoPqr', 'MNoPqR']\n assert candidate(s = \"hello123\") == ['hello123', 'hellO123', 'helLO123', 'helLo123', 'heLLo123', 'heLLO123', 'heLlO123', 'heLlo123', 'hELlo123', 'hELlO123', 'hELLO123', 'hELLo123', 'hElLo123', 'hElLO123', 'hEllO123', 'hEllo123', 'HEllo123', 'HEllO123', 'HElLO123', 'HElLo123', 'HELLo123', 'HELLO123', 'HELlO123', 'HELlo123', 'HeLlo123', 'HeLlO123', 'HeLLO123', 'HeLLo123', 'HelLo123', 'HelLO123', 'HellO123', 'Hello123']\n assert candidate(s = \"aA1Bb2Cc3\") == ['aA1Bb2Cc3', 'aA1Bb2CC3', 'aA1Bb2cC3', 'aA1Bb2cc3', 'aA1BB2cc3', 'aA1BB2cC3', 'aA1BB2CC3', 'aA1BB2Cc3', 'aA1bB2Cc3', 'aA1bB2CC3', 'aA1bB2cC3', 'aA1bB2cc3', 'aA1bb2cc3', 'aA1bb2cC3', 'aA1bb2CC3', 'aA1bb2Cc3', 'aa1bb2Cc3', 'aa1bb2CC3', 'aa1bb2cC3', 'aa1bb2cc3', 'aa1bB2cc3', 'aa1bB2cC3', 'aa1bB2CC3', 'aa1bB2Cc3', 'aa1BB2Cc3', 'aa1BB2CC3', 'aa1BB2cC3', 'aa1BB2cc3', 'aa1Bb2cc3', 'aa1Bb2cC3', 'aa1Bb2CC3', 'aa1Bb2Cc3', 'Aa1Bb2Cc3', 'Aa1Bb2CC3', 'Aa1Bb2cC3', 'Aa1Bb2cc3', 'Aa1BB2cc3', 'Aa1BB2cC3', 'Aa1BB2CC3', 'Aa1BB2Cc3', 'Aa1bB2Cc3', 'Aa1bB2CC3', 'Aa1bB2cC3', 'Aa1bB2cc3', 'Aa1bb2cc3', 'Aa1bb2cC3', 'Aa1bb2CC3', 'Aa1bb2Cc3', 'AA1bb2Cc3', 'AA1bb2CC3', 'AA1bb2cC3', 'AA1bb2cc3', 'AA1bB2cc3', 'AA1bB2cC3', 'AA1bB2CC3', 'AA1bB2Cc3', 'AA1BB2Cc3', 'AA1BB2CC3', 'AA1BB2cC3', 'AA1BB2cc3', 'AA1Bb2cc3', 'AA1Bb2cC3', 'AA1Bb2CC3', 'AA1Bb2Cc3']\n assert candidate(s = \"helloWORLD\") == ['helloWORLD', 'helloWORLd', 'helloWORld', 'helloWORlD', 'helloWOrlD', 'helloWOrld', 'helloWOrLd', 'helloWOrLD', 'helloWorLD', 'helloWorLd', 'helloWorld', 'helloWorlD', 'helloWoRlD', 'helloWoRld', 'helloWoRLd', 'helloWoRLD', 'hellowoRLD', 'hellowoRLd', 'hellowoRld', 'hellowoRlD', 'helloworlD', 'helloworld', 'helloworLd', 'helloworLD', 'hellowOrLD', 'hellowOrLd', 'hellowOrld', 'hellowOrlD', 'hellowORlD', 'hellowORld', 'hellowORLd', 'hellowORLD', 'hellOwORLD', 'hellOwORLd', 'hellOwORld', 'hellOwORlD', 'hellOwOrlD', 'hellOwOrld', 'hellOwOrLd', 'hellOwOrLD', 'hellOworLD', 'hellOworLd', 'hellOworld', 'hellOworlD', 'hellOwoRlD', 'hellOwoRld', 'hellOwoRLd', 'hellOwoRLD', 'hellOWoRLD', 'hellOWoRLd', 'hellOWoRld', 'hellOWoRlD', 'hellOWorlD', 'hellOWorld', 'hellOWorLd', 'hellOWorLD', 'hellOWOrLD', 'hellOWOrLd', 'hellOWOrld', 'hellOWOrlD', 'hellOWORlD', 'hellOWORld', 'hellOWORLd', 'hellOWORLD', 'helLOWORLD', 'helLOWORLd', 'helLOWORld', 'helLOWORlD', 'helLOWOrlD', 'helLOWOrld', 'helLOWOrLd', 'helLOWOrLD', 'helLOWorLD', 'helLOWorLd', 'helLOWorld', 'helLOWorlD', 'helLOWoRlD', 'helLOWoRld', 'helLOWoRLd', 'helLOWoRLD', 'helLOwoRLD', 'helLOwoRLd', 'helLOwoRld', 'helLOwoRlD', 'helLOworlD', 'helLOworld', 'helLOworLd', 'helLOworLD', 'helLOwOrLD', 'helLOwOrLd', 'helLOwOrld', 'helLOwOrlD', 'helLOwORlD', 'helLOwORld', 'helLOwORLd', 'helLOwORLD', 'helLowORLD', 'helLowORLd', 'helLowORld', 'helLowORlD', 'helLowOrlD', 'helLowOrld', 'helLowOrLd', 'helLowOrLD', 'helLoworLD', 'helLoworLd', 'helLoworld', 'helLoworlD', 'helLowoRlD', 'helLowoRld', 'helLowoRLd', 'helLowoRLD', 'helLoWoRLD', 'helLoWoRLd', 'helLoWoRld', 'helLoWoRlD', 'helLoWorlD', 'helLoWorld', 'helLoWorLd', 'helLoWorLD', 'helLoWOrLD', 'helLoWOrLd', 'helLoWOrld', 'helLoWOrlD', 'helLoWORlD', 'helLoWORld', 'helLoWORLd', 'helLoWORLD', 'heLLoWORLD', 'heLLoWORLd', 'heLLoWORld', 'heLLoWORlD', 'heLLoWOrlD', 'heLLoWOrld', 'heLLoWOrLd', 'heLLoWOrLD', 'heLLoWorLD', 'heLLoWorLd', 'heLLoWorld', 'heLLoWorlD', 'heLLoWoRlD', 'heLLoWoRld', 'heLLoWoRLd', 'heLLoWoRLD', 'heLLowoRLD', 'heLLowoRLd', 'heLLowoRld', 'heLLowoRlD', 'heLLoworlD', 'heLLoworld', 'heLLoworLd', 'heLLoworLD', 'heLLowOrLD', 'heLLowOrLd', 'heLLowOrld', 'heLLowOrlD', 'heLLowORlD', 'heLLowORld', 'heLLowORLd', 'heLLowORLD', 'heLLOwORLD', 'heLLOwORLd', 'heLLOwORld', 'heLLOwORlD', 'heLLOwOrlD', 'heLLOwOrld', 'heLLOwOrLd', 'heLLOwOrLD', 'heLLOworLD', 'heLLOworLd', 'heLLOworld', 'heLLOworlD', 'heLLOwoRlD', 'heLLOwoRld', 'heLLOwoRLd', 'heLLOwoRLD', 'heLLOWoRLD', 'heLLOWoRLd', 'heLLOWoRld', 'heLLOWoRlD', 'heLLOWorlD', 'heLLOWorld', 'heLLOWorLd', 'heLLOWorLD', 'heLLOWOrLD', 'heLLOWOrLd', 'heLLOWOrld', 'heLLOWOrlD', 'heLLOWORlD', 'heLLOWORld', 'heLLOWORLd', 'heLLOWORLD', 'heLlOWORLD', 'heLlOWORLd', 'heLlOWORld', 'heLlOWORlD', 'heLlOWOrlD', 'heLlOWOrld', 'heLlOWOrLd', 'heLlOWOrLD', 'heLlOWorLD', 'heLlOWorLd', 'heLlOWorld', 'heLlOWorlD', 'heLlOWoRlD', 'heLlOWoRld', 'heLlOWoRLd', 'heLlOWoRLD', 'heLlOwoRLD', 'heLlOwoRLd', 'heLlOwoRld', 'heLlOwoRlD', 'heLlOworlD', 'heLlOworld', 'heLlOworLd', 'heLlOworLD', 'heLlOwOrLD', 'heLlOwOrLd', 'heLlOwOrld', 'heLlOwOrlD', 'heLlOwORlD', 'heLlOwORld', 'heLlOwORLd', 'heLlOwORLD', 'heLlowORLD', 'heLlowORLd', 'heLlowORld', 'heLlowORlD', 'heLlowOrlD', 'heLlowOrld', 'heLlowOrLd', 'heLlowOrLD', 'heLloworLD', 'heLloworLd', 'heLloworld', 'heLloworlD', 'heLlowoRlD', 'heLlowoRld', 'heLlowoRLd', 'heLlowoRLD', 'heLloWoRLD', 'heLloWoRLd', 'heLloWoRld', 'heLloWoRlD', 'heLloWorlD', 'heLloWorld', 'heLloWorLd', 'heLloWorLD', 'heLloWOrLD', 'heLloWOrLd', 'heLloWOrld', 'heLloWOrlD', 'heLloWORlD', 'heLloWORld', 'heLloWORLd', 'heLloWORLD', 'hELloWORLD', 'hELloWORLd', 'hELloWORld', 'hELloWORlD', 'hELloWOrlD', 'hELloWOrld', 'hELloWOrLd', 'hELloWOrLD', 'hELloWorLD', 'hELloWorLd', 'hELloWorld', 'hELloWorlD', 'hELloWoRlD', 'hELloWoRld', 'hELloWoRLd', 'hELloWoRLD', 'hELlowoRLD', 'hELlowoRLd', 'hELlowoRld', 'hELlowoRlD', 'hELloworlD', 'hELloworld', 'hELloworLd', 'hELloworLD', 'hELlowOrLD', 'hELlowOrLd', 'hELlowOrld', 'hELlowOrlD', 'hELlowORlD', 'hELlowORld', 'hELlowORLd', 'hELlowORLD', 'hELlOwORLD', 'hELlOwORLd', 'hELlOwORld', 'hELlOwORlD', 'hELlOwOrlD', 'hELlOwOrld', 'hELlOwOrLd', 'hELlOwOrLD', 'hELlOworLD', 'hELlOworLd', 'hELlOworld', 'hELlOworlD', 'hELlOwoRlD', 'hELlOwoRld', 'hELlOwoRLd', 'hELlOwoRLD', 'hELlOWoRLD', 'hELlOWoRLd', 'hELlOWoRld', 'hELlOWoRlD', 'hELlOWorlD', 'hELlOWorld', 'hELlOWorLd', 'hELlOWorLD', 'hELlOWOrLD', 'hELlOWOrLd', 'hELlOWOrld', 'hELlOWOrlD', 'hELlOWORlD', 'hELlOWORld', 'hELlOWORLd', 'hELlOWORLD', 'hELLOWORLD', 'hELLOWORLd', 'hELLOWORld', 'hELLOWORlD', 'hELLOWOrlD', 'hELLOWOrld', 'hELLOWOrLd', 'hELLOWOrLD', 'hELLOWorLD', 'hELLOWorLd', 'hELLOWorld', 'hELLOWorlD', 'hELLOWoRlD', 'hELLOWoRld', 'hELLOWoRLd', 'hELLOWoRLD', 'hELLOwoRLD', 'hELLOwoRLd', 'hELLOwoRld', 'hELLOwoRlD', 'hELLOworlD', 'hELLOworld', 'hELLOworLd', 'hELLOworLD', 'hELLOwOrLD', 'hELLOwOrLd', 'hELLOwOrld', 'hELLOwOrlD', 'hELLOwORlD', 'hELLOwORld', 'hELLOwORLd', 'hELLOwORLD', 'hELLowORLD', 'hELLowORLd', 'hELLowORld', 'hELLowORlD', 'hELLowOrlD', 'hELLowOrld', 'hELLowOrLd', 'hELLowOrLD', 'hELLoworLD', 'hELLoworLd', 'hELLoworld', 'hELLoworlD', 'hELLowoRlD', 'hELLowoRld', 'hELLowoRLd', 'hELLowoRLD', 'hELLoWoRLD', 'hELLoWoRLd', 'hELLoWoRld', 'hELLoWoRlD', 'hELLoWorlD', 'hELLoWorld', 'hELLoWorLd', 'hELLoWorLD', 'hELLoWOrLD', 'hELLoWOrLd', 'hELLoWOrld', 'hELLoWOrlD', 'hELLoWORlD', 'hELLoWORld', 'hELLoWORLd', 'hELLoWORLD', 'hElLoWORLD', 'hElLoWORLd', 'hElLoWORld', 'hElLoWORlD', 'hElLoWOrlD', 'hElLoWOrld', 'hElLoWOrLd', 'hElLoWOrLD', 'hElLoWorLD', 'hElLoWorLd', 'hElLoWorld', 'hElLoWorlD', 'hElLoWoRlD', 'hElLoWoRld', 'hElLoWoRLd', 'hElLoWoRLD', 'hElLowoRLD', 'hElLowoRLd', 'hElLowoRld', 'hElLowoRlD', 'hElLoworlD', 'hElLoworld', 'hElLoworLd', 'hElLoworLD', 'hElLowOrLD', 'hElLowOrLd', 'hElLowOrld', 'hElLowOrlD', 'hElLowORlD', 'hElLowORld', 'hElLowORLd', 'hElLowORLD', 'hElLOwORLD', 'hElLOwORLd', 'hElLOwORld', 'hElLOwORlD', 'hElLOwOrlD', 'hElLOwOrld', 'hElLOwOrLd', 'hElLOwOrLD', 'hElLOworLD', 'hElLOworLd', 'hElLOworld', 'hElLOworlD', 'hElLOwoRlD', 'hElLOwoRld', 'hElLOwoRLd', 'hElLOwoRLD', 'hElLOWoRLD', 'hElLOWoRLd', 'hElLOWoRld', 'hElLOWoRlD', 'hElLOWorlD', 'hElLOWorld', 'hElLOWorLd', 'hElLOWorLD', 'hElLOWOrLD', 'hElLOWOrLd', 'hElLOWOrld', 'hElLOWOrlD', 'hElLOWORlD', 'hElLOWORld', 'hElLOWORLd', 'hElLOWORLD', 'hEllOWORLD', 'hEllOWORLd', 'hEllOWORld', 'hEllOWORlD', 'hEllOWOrlD', 'hEllOWOrld', 'hEllOWOrLd', 'hEllOWOrLD', 'hEllOWorLD', 'hEllOWorLd', 'hEllOWorld', 'hEllOWorlD', 'hEllOWoRlD', 'hEllOWoRld', 'hEllOWoRLd', 'hEllOWoRLD', 'hEllOwoRLD', 'hEllOwoRLd', 'hEllOwoRld', 'hEllOwoRlD', 'hEllOworlD', 'hEllOworld', 'hEllOworLd', 'hEllOworLD', 'hEllOwOrLD', 'hEllOwOrLd', 'hEllOwOrld', 'hEllOwOrlD', 'hEllOwORlD', 'hEllOwORld', 'hEllOwORLd', 'hEllOwORLD', 'hEllowORLD', 'hEllowORLd', 'hEllowORld', 'hEllowORlD', 'hEllowOrlD', 'hEllowOrld', 'hEllowOrLd', 'hEllowOrLD', 'hElloworLD', 'hElloworLd', 'hElloworld', 'hElloworlD', 'hEllowoRlD', 'hEllowoRld', 'hEllowoRLd', 'hEllowoRLD', 'hElloWoRLD', 'hElloWoRLd', 'hElloWoRld', 'hElloWoRlD', 'hElloWorlD', 'hElloWorld', 'hElloWorLd', 'hElloWorLD', 'hElloWOrLD', 'hElloWOrLd', 'hElloWOrld', 'hElloWOrlD', 'hElloWORlD', 'hElloWORld', 'hElloWORLd', 'hElloWORLD', 'HElloWORLD', 'HElloWORLd', 'HElloWORld', 'HElloWORlD', 'HElloWOrlD', 'HElloWOrld', 'HElloWOrLd', 'HElloWOrLD', 'HElloWorLD', 'HElloWorLd', 'HElloWorld', 'HElloWorlD', 'HElloWoRlD', 'HElloWoRld', 'HElloWoRLd', 'HElloWoRLD', 'HEllowoRLD', 'HEllowoRLd', 'HEllowoRld', 'HEllowoRlD', 'HElloworlD', 'HElloworld', 'HElloworLd', 'HElloworLD', 'HEllowOrLD', 'HEllowOrLd', 'HEllowOrld', 'HEllowOrlD', 'HEllowORlD', 'HEllowORld', 'HEllowORLd', 'HEllowORLD', 'HEllOwORLD', 'HEllOwORLd', 'HEllOwORld', 'HEllOwORlD', 'HEllOwOrlD', 'HEllOwOrld', 'HEllOwOrLd', 'HEllOwOrLD', 'HEllOworLD', 'HEllOworLd', 'HEllOworld', 'HEllOworlD', 'HEllOwoRlD', 'HEllOwoRld', 'HEllOwoRLd', 'HEllOwoRLD', 'HEllOWoRLD', 'HEllOWoRLd', 'HEllOWoRld', 'HEllOWoRlD', 'HEllOWorlD', 'HEllOWorld', 'HEllOWorLd', 'HEllOWorLD', 'HEllOWOrLD', 'HEllOWOrLd', 'HEllOWOrld', 'HEllOWOrlD', 'HEllOWORlD', 'HEllOWORld', 'HEllOWORLd', 'HEllOWORLD', 'HElLOWORLD', 'HElLOWORLd', 'HElLOWORld', 'HElLOWORlD', 'HElLOWOrlD', 'HElLOWOrld', 'HElLOWOrLd', 'HElLOWOrLD', 'HElLOWorLD', 'HElLOWorLd', 'HElLOWorld', 'HElLOWorlD', 'HElLOWoRlD', 'HElLOWoRld', 'HElLOWoRLd', 'HElLOWoRLD', 'HElLOwoRLD', 'HElLOwoRLd', 'HElLOwoRld', 'HElLOwoRlD', 'HElLOworlD', 'HElLOworld', 'HElLOworLd', 'HElLOworLD', 'HElLOwOrLD', 'HElLOwOrLd', 'HElLOwOrld', 'HElLOwOrlD', 'HElLOwORlD', 'HElLOwORld', 'HElLOwORLd', 'HElLOwORLD', 'HElLowORLD', 'HElLowORLd', 'HElLowORld', 'HElLowORlD', 'HElLowOrlD', 'HElLowOrld', 'HElLowOrLd', 'HElLowOrLD', 'HElLoworLD', 'HElLoworLd', 'HElLoworld', 'HElLoworlD', 'HElLowoRlD', 'HElLowoRld', 'HElLowoRLd', 'HElLowoRLD', 'HElLoWoRLD', 'HElLoWoRLd', 'HElLoWoRld', 'HElLoWoRlD', 'HElLoWorlD', 'HElLoWorld', 'HElLoWorLd', 'HElLoWorLD', 'HElLoWOrLD', 'HElLoWOrLd', 'HElLoWOrld', 'HElLoWOrlD', 'HElLoWORlD', 'HElLoWORld', 'HElLoWORLd', 'HElLoWORLD', 'HELLoWORLD', 'HELLoWORLd', 'HELLoWORld', 'HELLoWORlD', 'HELLoWOrlD', 'HELLoWOrld', 'HELLoWOrLd', 'HELLoWOrLD', 'HELLoWorLD', 'HELLoWorLd', 'HELLoWorld', 'HELLoWorlD', 'HELLoWoRlD', 'HELLoWoRld', 'HELLoWoRLd', 'HELLoWoRLD', 'HELLowoRLD', 'HELLowoRLd', 'HELLowoRld', 'HELLowoRlD', 'HELLoworlD', 'HELLoworld', 'HELLoworLd', 'HELLoworLD', 'HELLowOrLD', 'HELLowOrLd', 'HELLowOrld', 'HELLowOrlD', 'HELLowORlD', 'HELLowORld', 'HELLowORLd', 'HELLowORLD', 'HELLOwORLD', 'HELLOwORLd', 'HELLOwORld', 'HELLOwORlD', 'HELLOwOrlD', 'HELLOwOrld', 'HELLOwOrLd', 'HELLOwOrLD', 'HELLOworLD', 'HELLOworLd', 'HELLOworld', 'HELLOworlD', 'HELLOwoRlD', 'HELLOwoRld', 'HELLOwoRLd', 'HELLOwoRLD', 'HELLOWoRLD', 'HELLOWoRLd', 'HELLOWoRld', 'HELLOWoRlD', 'HELLOWorlD', 'HELLOWorld', 'HELLOWorLd', 'HELLOWorLD', 'HELLOWOrLD', 'HELLOWOrLd', 'HELLOWOrld', 'HELLOWOrlD', 'HELLOWORlD', 'HELLOWORld', 'HELLOWORLd', 'HELLOWORLD', 'HELlOWORLD', 'HELlOWORLd', 'HELlOWORld', 'HELlOWORlD', 'HELlOWOrlD', 'HELlOWOrld', 'HELlOWOrLd', 'HELlOWOrLD', 'HELlOWorLD', 'HELlOWorLd', 'HELlOWorld', 'HELlOWorlD', 'HELlOWoRlD', 'HELlOWoRld', 'HELlOWoRLd', 'HELlOWoRLD', 'HELlOwoRLD', 'HELlOwoRLd', 'HELlOwoRld', 'HELlOwoRlD', 'HELlOworlD', 'HELlOworld', 'HELlOworLd', 'HELlOworLD', 'HELlOwOrLD', 'HELlOwOrLd', 'HELlOwOrld', 'HELlOwOrlD', 'HELlOwORlD', 'HELlOwORld', 'HELlOwORLd', 'HELlOwORLD', 'HELlowORLD', 'HELlowORLd', 'HELlowORld', 'HELlowORlD', 'HELlowOrlD', 'HELlowOrld', 'HELlowOrLd', 'HELlowOrLD', 'HELloworLD', 'HELloworLd', 'HELloworld', 'HELloworlD', 'HELlowoRlD', 'HELlowoRld', 'HELlowoRLd', 'HELlowoRLD', 'HELloWoRLD', 'HELloWoRLd', 'HELloWoRld', 'HELloWoRlD', 'HELloWorlD', 'HELloWorld', 'HELloWorLd', 'HELloWorLD', 'HELloWOrLD', 'HELloWOrLd', 'HELloWOrld', 'HELloWOrlD', 'HELloWORlD', 'HELloWORld', 'HELloWORLd', 'HELloWORLD', 'HeLloWORLD', 'HeLloWORLd', 'HeLloWORld', 'HeLloWORlD', 'HeLloWOrlD', 'HeLloWOrld', 'HeLloWOrLd', 'HeLloWOrLD', 'HeLloWorLD', 'HeLloWorLd', 'HeLloWorld', 'HeLloWorlD', 'HeLloWoRlD', 'HeLloWoRld', 'HeLloWoRLd', 'HeLloWoRLD', 'HeLlowoRLD', 'HeLlowoRLd', 'HeLlowoRld', 'HeLlowoRlD', 'HeLloworlD', 'HeLloworld', 'HeLloworLd', 'HeLloworLD', 'HeLlowOrLD', 'HeLlowOrLd', 'HeLlowOrld', 'HeLlowOrlD', 'HeLlowORlD', 'HeLlowORld', 'HeLlowORLd', 'HeLlowORLD', 'HeLlOwORLD', 'HeLlOwORLd', 'HeLlOwORld', 'HeLlOwORlD', 'HeLlOwOrlD', 'HeLlOwOrld', 'HeLlOwOrLd', 'HeLlOwOrLD', 'HeLlOworLD', 'HeLlOworLd', 'HeLlOworld', 'HeLlOworlD', 'HeLlOwoRlD', 'HeLlOwoRld', 'HeLlOwoRLd', 'HeLlOwoRLD', 'HeLlOWoRLD', 'HeLlOWoRLd', 'HeLlOWoRld', 'HeLlOWoRlD', 'HeLlOWorlD', 'HeLlOWorld', 'HeLlOWorLd', 'HeLlOWorLD', 'HeLlOWOrLD', 'HeLlOWOrLd', 'HeLlOWOrld', 'HeLlOWOrlD', 'HeLlOWORlD', 'HeLlOWORld', 'HeLlOWORLd', 'HeLlOWORLD', 'HeLLOWORLD', 'HeLLOWORLd', 'HeLLOWORld', 'HeLLOWORlD', 'HeLLOWOrlD', 'HeLLOWOrld', 'HeLLOWOrLd', 'HeLLOWOrLD', 'HeLLOWorLD', 'HeLLOWorLd', 'HeLLOWorld', 'HeLLOWorlD', 'HeLLOWoRlD', 'HeLLOWoRld', 'HeLLOWoRLd', 'HeLLOWoRLD', 'HeLLOwoRLD', 'HeLLOwoRLd', 'HeLLOwoRld', 'HeLLOwoRlD', 'HeLLOworlD', 'HeLLOworld', 'HeLLOworLd', 'HeLLOworLD', 'HeLLOwOrLD', 'HeLLOwOrLd', 'HeLLOwOrld', 'HeLLOwOrlD', 'HeLLOwORlD', 'HeLLOwORld', 'HeLLOwORLd', 'HeLLOwORLD', 'HeLLowORLD', 'HeLLowORLd', 'HeLLowORld', 'HeLLowORlD', 'HeLLowOrlD', 'HeLLowOrld', 'HeLLowOrLd', 'HeLLowOrLD', 'HeLLoworLD', 'HeLLoworLd', 'HeLLoworld', 'HeLLoworlD', 'HeLLowoRlD', 'HeLLowoRld', 'HeLLowoRLd', 'HeLLowoRLD', 'HeLLoWoRLD', 'HeLLoWoRLd', 'HeLLoWoRld', 'HeLLoWoRlD', 'HeLLoWorlD', 'HeLLoWorld', 'HeLLoWorLd', 'HeLLoWorLD', 'HeLLoWOrLD', 'HeLLoWOrLd', 'HeLLoWOrld', 'HeLLoWOrlD', 'HeLLoWORlD', 'HeLLoWORld', 'HeLLoWORLd', 'HeLLoWORLD', 'HelLoWORLD', 'HelLoWORLd', 'HelLoWORld', 'HelLoWORlD', 'HelLoWOrlD', 'HelLoWOrld', 'HelLoWOrLd', 'HelLoWOrLD', 'HelLoWorLD', 'HelLoWorLd', 'HelLoWorld', 'HelLoWorlD', 'HelLoWoRlD', 'HelLoWoRld', 'HelLoWoRLd', 'HelLoWoRLD', 'HelLowoRLD', 'HelLowoRLd', 'HelLowoRld', 'HelLowoRlD', 'HelLoworlD', 'HelLoworld', 'HelLoworLd', 'HelLoworLD', 'HelLowOrLD', 'HelLowOrLd', 'HelLowOrld', 'HelLowOrlD', 'HelLowORlD', 'HelLowORld', 'HelLowORLd', 'HelLowORLD', 'HelLOwORLD', 'HelLOwORLd', 'HelLOwORld', 'HelLOwORlD', 'HelLOwOrlD', 'HelLOwOrld', 'HelLOwOrLd', 'HelLOwOrLD', 'HelLOworLD', 'HelLOworLd', 'HelLOworld', 'HelLOworlD', 'HelLOwoRlD', 'HelLOwoRld', 'HelLOwoRLd', 'HelLOwoRLD', 'HelLOWoRLD', 'HelLOWoRLd', 'HelLOWoRld', 'HelLOWoRlD', 'HelLOWorlD', 'HelLOWorld', 'HelLOWorLd', 'HelLOWorLD', 'HelLOWOrLD', 'HelLOWOrLd', 'HelLOWOrld', 'HelLOWOrlD', 'HelLOWORlD', 'HelLOWORld', 'HelLOWORLd', 'HelLOWORLD', 'HellOWORLD', 'HellOWORLd', 'HellOWORld', 'HellOWORlD', 'HellOWOrlD', 'HellOWOrld', 'HellOWOrLd', 'HellOWOrLD', 'HellOWorLD', 'HellOWorLd', 'HellOWorld', 'HellOWorlD', 'HellOWoRlD', 'HellOWoRld', 'HellOWoRLd', 'HellOWoRLD', 'HellOwoRLD', 'HellOwoRLd', 'HellOwoRld', 'HellOwoRlD', 'HellOworlD', 'HellOworld', 'HellOworLd', 'HellOworLD', 'HellOwOrLD', 'HellOwOrLd', 'HellOwOrld', 'HellOwOrlD', 'HellOwORlD', 'HellOwORld', 'HellOwORLd', 'HellOwORLD', 'HellowORLD', 'HellowORLd', 'HellowORld', 'HellowORlD', 'HellowOrlD', 'HellowOrld', 'HellowOrLd', 'HellowOrLD', 'HelloworLD', 'HelloworLd', 'Helloworld', 'HelloworlD', 'HellowoRlD', 'HellowoRld', 'HellowoRLd', 'HellowoRLD', 'HelloWoRLD', 'HelloWoRLd', 'HelloWoRld', 'HelloWoRlD', 'HelloWorlD', 'HelloWorld', 'HelloWorLd', 'HelloWorLD', 'HelloWOrLD', 'HelloWOrLd', 'HelloWOrld', 'HelloWOrlD', 'HelloWORlD', 'HelloWORld', 'HelloWORLd', 'HelloWORLD']\n assert candidate(s = \"A1bC2dE3\") == ['A1bC2dE3', 'A1bC2de3', 'A1bC2De3', 'A1bC2DE3', 'A1bc2DE3', 'A1bc2De3', 'A1bc2de3', 'A1bc2dE3', 'A1Bc2dE3', 'A1Bc2de3', 'A1Bc2De3', 'A1Bc2DE3', 'A1BC2DE3', 'A1BC2De3', 'A1BC2de3', 'A1BC2dE3', 'a1BC2dE3', 'a1BC2de3', 'a1BC2De3', 'a1BC2DE3', 'a1Bc2DE3', 'a1Bc2De3', 'a1Bc2de3', 'a1Bc2dE3', 'a1bc2dE3', 'a1bc2de3', 'a1bc2De3', 'a1bc2DE3', 'a1bC2DE3', 'a1bC2De3', 'a1bC2de3', 'a1bC2dE3']\n assert candidate(s = \"abcdefg\") == ['abcdefg', 'abcdefG', 'abcdeFG', 'abcdeFg', 'abcdEFg', 'abcdEFG', 'abcdEfG', 'abcdEfg', 'abcDEfg', 'abcDEfG', 'abcDEFG', 'abcDEFg', 'abcDeFg', 'abcDeFG', 'abcDefG', 'abcDefg', 'abCDefg', 'abCDefG', 'abCDeFG', 'abCDeFg', 'abCDEFg', 'abCDEFG', 'abCDEfG', 'abCDEfg', 'abCdEfg', 'abCdEfG', 'abCdEFG', 'abCdEFg', 'abCdeFg', 'abCdeFG', 'abCdefG', 'abCdefg', 'aBCdefg', 'aBCdefG', 'aBCdeFG', 'aBCdeFg', 'aBCdEFg', 'aBCdEFG', 'aBCdEfG', 'aBCdEfg', 'aBCDEfg', 'aBCDEfG', 'aBCDEFG', 'aBCDEFg', 'aBCDeFg', 'aBCDeFG', 'aBCDefG', 'aBCDefg', 'aBcDefg', 'aBcDefG', 'aBcDeFG', 'aBcDeFg', 'aBcDEFg', 'aBcDEFG', 'aBcDEfG', 'aBcDEfg', 'aBcdEfg', 'aBcdEfG', 'aBcdEFG', 'aBcdEFg', 'aBcdeFg', 'aBcdeFG', 'aBcdefG', 'aBcdefg', 'ABcdefg', 'ABcdefG', 'ABcdeFG', 'ABcdeFg', 'ABcdEFg', 'ABcdEFG', 'ABcdEfG', 'ABcdEfg', 'ABcDEfg', 'ABcDEfG', 'ABcDEFG', 'ABcDEFg', 'ABcDeFg', 'ABcDeFG', 'ABcDefG', 'ABcDefg', 'ABCDefg', 'ABCDefG', 'ABCDeFG', 'ABCDeFg', 'ABCDEFg', 'ABCDEFG', 'ABCDEfG', 'ABCDEfg', 'ABCdEfg', 'ABCdEfG', 'ABCdEFG', 'ABCdEFg', 'ABCdeFg', 'ABCdeFG', 'ABCdefG', 'ABCdefg', 'AbCdefg', 'AbCdefG', 'AbCdeFG', 'AbCdeFg', 'AbCdEFg', 'AbCdEFG', 'AbCdEfG', 'AbCdEfg', 'AbCDEfg', 'AbCDEfG', 'AbCDEFG', 'AbCDEFg', 'AbCDeFg', 'AbCDeFG', 'AbCDefG', 'AbCDefg', 'AbcDefg', 'AbcDefG', 'AbcDeFG', 'AbcDeFg', 'AbcDEFg', 'AbcDEFG', 'AbcDEfG', 'AbcDEfg', 'AbcdEfg', 'AbcdEfG', 'AbcdEFG', 'AbcdEFg', 'AbcdeFg', 'AbcdeFG', 'AbcdefG', 'Abcdefg']\n assert candidate(s = \"0a1B2\") == ['0a1B2', '0a1b2', '0A1b2', '0A1B2']\n assert candidate(s = \"1A2B3C4D\") == ['1A2B3C4D', '1A2B3C4d', '1A2B3c4d', '1A2B3c4D', '1A2b3c4D', '1A2b3c4d', '1A2b3C4d', '1A2b3C4D', '1a2b3C4D', '1a2b3C4d', '1a2b3c4d', '1a2b3c4D', '1a2B3c4D', '1a2B3c4d', '1a2B3C4d', '1a2B3C4D']\n assert candidate(s = \"z9Y8X7W6\") == ['z9Y8X7W6', 'z9Y8X7w6', 'z9Y8x7w6', 'z9Y8x7W6', 'z9y8x7W6', 'z9y8x7w6', 'z9y8X7w6', 'z9y8X7W6', 'Z9y8X7W6', 'Z9y8X7w6', 'Z9y8x7w6', 'Z9y8x7W6', 'Z9Y8x7W6', 'Z9Y8x7w6', 'Z9Y8X7w6', 'Z9Y8X7W6']\n assert candidate(s = \"A1bC2d3\") == ['A1bC2d3', 'A1bC2D3', 'A1bc2D3', 'A1bc2d3', 'A1Bc2d3', 'A1Bc2D3', 'A1BC2D3', 'A1BC2d3', 'a1BC2d3', 'a1BC2D3', 'a1Bc2D3', 'a1Bc2d3', 'a1bc2d3', 'a1bc2D3', 'a1bC2D3', 'a1bC2d3']\n assert candidate(s = \"12abc34\") == ['12abc34', '12abC34', '12aBC34', '12aBc34', '12ABc34', '12ABC34', '12AbC34', '12Abc34']\n assert candidate(s = \"0000\") == ['0000']\n assert candidate(s = \"mN9oP\") == ['mN9oP', 'mN9op', 'mN9Op', 'mN9OP', 'mn9OP', 'mn9Op', 'mn9op', 'mn9oP', 'Mn9oP', 'Mn9op', 'Mn9Op', 'Mn9OP', 'MN9OP', 'MN9Op', 'MN9op', 'MN9oP']\n assert candidate(s = \"0xYz9\") == ['0xYz9', '0xYZ9', '0xyZ9', '0xyz9', '0Xyz9', '0XyZ9', '0XYZ9', '0XYz9']\n assert candidate(s = \"A1b2C3d4\") == ['A1b2C3d4', 'A1b2C3D4', 'A1b2c3D4', 'A1b2c3d4', 'A1B2c3d4', 'A1B2c3D4', 'A1B2C3D4', 'A1B2C3d4', 'a1B2C3d4', 'a1B2C3D4', 'a1B2c3D4', 'a1B2c3d4', 'a1b2c3d4', 'a1b2c3D4', 'a1b2C3D4', 'a1b2C3d4']\n assert candidate(s = \"Z9y8X7w6V5u4T3s2R1\") == ['Z9y8X7w6V5u4T3s2R1', 'Z9y8X7w6V5u4T3s2r1', 'Z9y8X7w6V5u4T3S2r1', 'Z9y8X7w6V5u4T3S2R1', 'Z9y8X7w6V5u4t3S2R1', 'Z9y8X7w6V5u4t3S2r1', 'Z9y8X7w6V5u4t3s2r1', 'Z9y8X7w6V5u4t3s2R1', 'Z9y8X7w6V5U4t3s2R1', 'Z9y8X7w6V5U4t3s2r1', 'Z9y8X7w6V5U4t3S2r1', 'Z9y8X7w6V5U4t3S2R1', 'Z9y8X7w6V5U4T3S2R1', 'Z9y8X7w6V5U4T3S2r1', 'Z9y8X7w6V5U4T3s2r1', 'Z9y8X7w6V5U4T3s2R1', 'Z9y8X7w6v5U4T3s2R1', 'Z9y8X7w6v5U4T3s2r1', 'Z9y8X7w6v5U4T3S2r1', 'Z9y8X7w6v5U4T3S2R1', 'Z9y8X7w6v5U4t3S2R1', 'Z9y8X7w6v5U4t3S2r1', 'Z9y8X7w6v5U4t3s2r1', 'Z9y8X7w6v5U4t3s2R1', 'Z9y8X7w6v5u4t3s2R1', 'Z9y8X7w6v5u4t3s2r1', 'Z9y8X7w6v5u4t3S2r1', 'Z9y8X7w6v5u4t3S2R1', 'Z9y8X7w6v5u4T3S2R1', 'Z9y8X7w6v5u4T3S2r1', 'Z9y8X7w6v5u4T3s2r1', 'Z9y8X7w6v5u4T3s2R1', 'Z9y8X7W6v5u4T3s2R1', 'Z9y8X7W6v5u4T3s2r1', 'Z9y8X7W6v5u4T3S2r1', 'Z9y8X7W6v5u4T3S2R1', 'Z9y8X7W6v5u4t3S2R1', 'Z9y8X7W6v5u4t3S2r1', 'Z9y8X7W6v5u4t3s2r1', 'Z9y8X7W6v5u4t3s2R1', 'Z9y8X7W6v5U4t3s2R1', 'Z9y8X7W6v5U4t3s2r1', 'Z9y8X7W6v5U4t3S2r1', 'Z9y8X7W6v5U4t3S2R1', 'Z9y8X7W6v5U4T3S2R1', 'Z9y8X7W6v5U4T3S2r1', 'Z9y8X7W6v5U4T3s2r1', 'Z9y8X7W6v5U4T3s2R1', 'Z9y8X7W6V5U4T3s2R1', 'Z9y8X7W6V5U4T3s2r1', 'Z9y8X7W6V5U4T3S2r1', 'Z9y8X7W6V5U4T3S2R1', 'Z9y8X7W6V5U4t3S2R1', 'Z9y8X7W6V5U4t3S2r1', 'Z9y8X7W6V5U4t3s2r1', 'Z9y8X7W6V5U4t3s2R1', 'Z9y8X7W6V5u4t3s2R1', 'Z9y8X7W6V5u4t3s2r1', 'Z9y8X7W6V5u4t3S2r1', 'Z9y8X7W6V5u4t3S2R1', 'Z9y8X7W6V5u4T3S2R1', 'Z9y8X7W6V5u4T3S2r1', 'Z9y8X7W6V5u4T3s2r1', 'Z9y8X7W6V5u4T3s2R1', 'Z9y8x7W6V5u4T3s2R1', 'Z9y8x7W6V5u4T3s2r1', 'Z9y8x7W6V5u4T3S2r1', 'Z9y8x7W6V5u4T3S2R1', 'Z9y8x7W6V5u4t3S2R1', 'Z9y8x7W6V5u4t3S2r1', 'Z9y8x7W6V5u4t3s2r1', 'Z9y8x7W6V5u4t3s2R1', 'Z9y8x7W6V5U4t3s2R1', 'Z9y8x7W6V5U4t3s2r1', 'Z9y8x7W6V5U4t3S2r1', 'Z9y8x7W6V5U4t3S2R1', 'Z9y8x7W6V5U4T3S2R1', 'Z9y8x7W6V5U4T3S2r1', 'Z9y8x7W6V5U4T3s2r1', 'Z9y8x7W6V5U4T3s2R1', 'Z9y8x7W6v5U4T3s2R1', 'Z9y8x7W6v5U4T3s2r1', 'Z9y8x7W6v5U4T3S2r1', 'Z9y8x7W6v5U4T3S2R1', 'Z9y8x7W6v5U4t3S2R1', 'Z9y8x7W6v5U4t3S2r1', 'Z9y8x7W6v5U4t3s2r1', 'Z9y8x7W6v5U4t3s2R1', 'Z9y8x7W6v5u4t3s2R1', 'Z9y8x7W6v5u4t3s2r1', 'Z9y8x7W6v5u4t3S2r1', 'Z9y8x7W6v5u4t3S2R1', 'Z9y8x7W6v5u4T3S2R1', 'Z9y8x7W6v5u4T3S2r1', 'Z9y8x7W6v5u4T3s2r1', 'Z9y8x7W6v5u4T3s2R1', 'Z9y8x7w6v5u4T3s2R1', 'Z9y8x7w6v5u4T3s2r1', 'Z9y8x7w6v5u4T3S2r1', 'Z9y8x7w6v5u4T3S2R1', 'Z9y8x7w6v5u4t3S2R1', 'Z9y8x7w6v5u4t3S2r1', 'Z9y8x7w6v5u4t3s2r1', 'Z9y8x7w6v5u4t3s2R1', 'Z9y8x7w6v5U4t3s2R1', 'Z9y8x7w6v5U4t3s2r1', 'Z9y8x7w6v5U4t3S2r1', 'Z9y8x7w6v5U4t3S2R1', 'Z9y8x7w6v5U4T3S2R1', 'Z9y8x7w6v5U4T3S2r1', 'Z9y8x7w6v5U4T3s2r1', 'Z9y8x7w6v5U4T3s2R1', 'Z9y8x7w6V5U4T3s2R1', 'Z9y8x7w6V5U4T3s2r1', 'Z9y8x7w6V5U4T3S2r1', 'Z9y8x7w6V5U4T3S2R1', 'Z9y8x7w6V5U4t3S2R1', 'Z9y8x7w6V5U4t3S2r1', 'Z9y8x7w6V5U4t3s2r1', 'Z9y8x7w6V5U4t3s2R1', 'Z9y8x7w6V5u4t3s2R1', 'Z9y8x7w6V5u4t3s2r1', 'Z9y8x7w6V5u4t3S2r1', 'Z9y8x7w6V5u4t3S2R1', 'Z9y8x7w6V5u4T3S2R1', 'Z9y8x7w6V5u4T3S2r1', 'Z9y8x7w6V5u4T3s2r1', 'Z9y8x7w6V5u4T3s2R1', 'Z9Y8x7w6V5u4T3s2R1', 'Z9Y8x7w6V5u4T3s2r1', 'Z9Y8x7w6V5u4T3S2r1', 'Z9Y8x7w6V5u4T3S2R1', 'Z9Y8x7w6V5u4t3S2R1', 'Z9Y8x7w6V5u4t3S2r1', 'Z9Y8x7w6V5u4t3s2r1', 'Z9Y8x7w6V5u4t3s2R1', 'Z9Y8x7w6V5U4t3s2R1', 'Z9Y8x7w6V5U4t3s2r1', 'Z9Y8x7w6V5U4t3S2r1', 'Z9Y8x7w6V5U4t3S2R1', 'Z9Y8x7w6V5U4T3S2R1', 'Z9Y8x7w6V5U4T3S2r1', 'Z9Y8x7w6V5U4T3s2r1', 'Z9Y8x7w6V5U4T3s2R1', 'Z9Y8x7w6v5U4T3s2R1', 'Z9Y8x7w6v5U4T3s2r1', 'Z9Y8x7w6v5U4T3S2r1', 'Z9Y8x7w6v5U4T3S2R1', 'Z9Y8x7w6v5U4t3S2R1', 'Z9Y8x7w6v5U4t3S2r1', 'Z9Y8x7w6v5U4t3s2r1', 'Z9Y8x7w6v5U4t3s2R1', 'Z9Y8x7w6v5u4t3s2R1', 'Z9Y8x7w6v5u4t3s2r1', 'Z9Y8x7w6v5u4t3S2r1', 'Z9Y8x7w6v5u4t3S2R1', 'Z9Y8x7w6v5u4T3S2R1', 'Z9Y8x7w6v5u4T3S2r1', 'Z9Y8x7w6v5u4T3s2r1', 'Z9Y8x7w6v5u4T3s2R1', 'Z9Y8x7W6v5u4T3s2R1', 'Z9Y8x7W6v5u4T3s2r1', 'Z9Y8x7W6v5u4T3S2r1', 'Z9Y8x7W6v5u4T3S2R1', 'Z9Y8x7W6v5u4t3S2R1', 'Z9Y8x7W6v5u4t3S2r1', 'Z9Y8x7W6v5u4t3s2r1', 'Z9Y8x7W6v5u4t3s2R1', 'Z9Y8x7W6v5U4t3s2R1', 'Z9Y8x7W6v5U4t3s2r1', 'Z9Y8x7W6v5U4t3S2r1', 'Z9Y8x7W6v5U4t3S2R1', 'Z9Y8x7W6v5U4T3S2R1', 'Z9Y8x7W6v5U4T3S2r1', 'Z9Y8x7W6v5U4T3s2r1', 'Z9Y8x7W6v5U4T3s2R1', 'Z9Y8x7W6V5U4T3s2R1', 'Z9Y8x7W6V5U4T3s2r1', 'Z9Y8x7W6V5U4T3S2r1', 'Z9Y8x7W6V5U4T3S2R1', 'Z9Y8x7W6V5U4t3S2R1', 'Z9Y8x7W6V5U4t3S2r1', 'Z9Y8x7W6V5U4t3s2r1', 'Z9Y8x7W6V5U4t3s2R1', 'Z9Y8x7W6V5u4t3s2R1', 'Z9Y8x7W6V5u4t3s2r1', 'Z9Y8x7W6V5u4t3S2r1', 'Z9Y8x7W6V5u4t3S2R1', 'Z9Y8x7W6V5u4T3S2R1', 'Z9Y8x7W6V5u4T3S2r1', 'Z9Y8x7W6V5u4T3s2r1', 'Z9Y8x7W6V5u4T3s2R1', 'Z9Y8X7W6V5u4T3s2R1', 'Z9Y8X7W6V5u4T3s2r1', 'Z9Y8X7W6V5u4T3S2r1', 'Z9Y8X7W6V5u4T3S2R1', 'Z9Y8X7W6V5u4t3S2R1', 'Z9Y8X7W6V5u4t3S2r1', 'Z9Y8X7W6V5u4t3s2r1', 'Z9Y8X7W6V5u4t3s2R1', 'Z9Y8X7W6V5U4t3s2R1', 'Z9Y8X7W6V5U4t3s2r1', 'Z9Y8X7W6V5U4t3S2r1', 'Z9Y8X7W6V5U4t3S2R1', 'Z9Y8X7W6V5U4T3S2R1', 'Z9Y8X7W6V5U4T3S2r1', 'Z9Y8X7W6V5U4T3s2r1', 'Z9Y8X7W6V5U4T3s2R1', 'Z9Y8X7W6v5U4T3s2R1', 'Z9Y8X7W6v5U4T3s2r1', 'Z9Y8X7W6v5U4T3S2r1', 'Z9Y8X7W6v5U4T3S2R1', 'Z9Y8X7W6v5U4t3S2R1', 'Z9Y8X7W6v5U4t3S2r1', 'Z9Y8X7W6v5U4t3s2r1', 'Z9Y8X7W6v5U4t3s2R1', 'Z9Y8X7W6v5u4t3s2R1', 'Z9Y8X7W6v5u4t3s2r1', 'Z9Y8X7W6v5u4t3S2r1', 'Z9Y8X7W6v5u4t3S2R1', 'Z9Y8X7W6v5u4T3S2R1', 'Z9Y8X7W6v5u4T3S2r1', 'Z9Y8X7W6v5u4T3s2r1', 'Z9Y8X7W6v5u4T3s2R1', 'Z9Y8X7w6v5u4T3s2R1', 'Z9Y8X7w6v5u4T3s2r1', 'Z9Y8X7w6v5u4T3S2r1', 'Z9Y8X7w6v5u4T3S2R1', 'Z9Y8X7w6v5u4t3S2R1', 'Z9Y8X7w6v5u4t3S2r1', 'Z9Y8X7w6v5u4t3s2r1', 'Z9Y8X7w6v5u4t3s2R1', 'Z9Y8X7w6v5U4t3s2R1', 'Z9Y8X7w6v5U4t3s2r1', 'Z9Y8X7w6v5U4t3S2r1', 'Z9Y8X7w6v5U4t3S2R1', 'Z9Y8X7w6v5U4T3S2R1', 'Z9Y8X7w6v5U4T3S2r1', 'Z9Y8X7w6v5U4T3s2r1', 'Z9Y8X7w6v5U4T3s2R1', 'Z9Y8X7w6V5U4T3s2R1', 'Z9Y8X7w6V5U4T3s2r1', 'Z9Y8X7w6V5U4T3S2r1', 'Z9Y8X7w6V5U4T3S2R1', 'Z9Y8X7w6V5U4t3S2R1', 'Z9Y8X7w6V5U4t3S2r1', 'Z9Y8X7w6V5U4t3s2r1', 'Z9Y8X7w6V5U4t3s2R1', 'Z9Y8X7w6V5u4t3s2R1', 'Z9Y8X7w6V5u4t3s2r1', 'Z9Y8X7w6V5u4t3S2r1', 'Z9Y8X7w6V5u4t3S2R1', 'Z9Y8X7w6V5u4T3S2R1', 'Z9Y8X7w6V5u4T3S2r1', 'Z9Y8X7w6V5u4T3s2r1', 'Z9Y8X7w6V5u4T3s2R1', 'z9Y8X7w6V5u4T3s2R1', 'z9Y8X7w6V5u4T3s2r1', 'z9Y8X7w6V5u4T3S2r1', 'z9Y8X7w6V5u4T3S2R1', 'z9Y8X7w6V5u4t3S2R1', 'z9Y8X7w6V5u4t3S2r1', 'z9Y8X7w6V5u4t3s2r1', 'z9Y8X7w6V5u4t3s2R1', 'z9Y8X7w6V5U4t3s2R1', 'z9Y8X7w6V5U4t3s2r1', 'z9Y8X7w6V5U4t3S2r1', 'z9Y8X7w6V5U4t3S2R1', 'z9Y8X7w6V5U4T3S2R1', 'z9Y8X7w6V5U4T3S2r1', 'z9Y8X7w6V5U4T3s2r1', 'z9Y8X7w6V5U4T3s2R1', 'z9Y8X7w6v5U4T3s2R1', 'z9Y8X7w6v5U4T3s2r1', 'z9Y8X7w6v5U4T3S2r1', 'z9Y8X7w6v5U4T3S2R1', 'z9Y8X7w6v5U4t3S2R1', 'z9Y8X7w6v5U4t3S2r1', 'z9Y8X7w6v5U4t3s2r1', 'z9Y8X7w6v5U4t3s2R1', 'z9Y8X7w6v5u4t3s2R1', 'z9Y8X7w6v5u4t3s2r1', 'z9Y8X7w6v5u4t3S2r1', 'z9Y8X7w6v5u4t3S2R1', 'z9Y8X7w6v5u4T3S2R1', 'z9Y8X7w6v5u4T3S2r1', 'z9Y8X7w6v5u4T3s2r1', 'z9Y8X7w6v5u4T3s2R1', 'z9Y8X7W6v5u4T3s2R1', 'z9Y8X7W6v5u4T3s2r1', 'z9Y8X7W6v5u4T3S2r1', 'z9Y8X7W6v5u4T3S2R1', 'z9Y8X7W6v5u4t3S2R1', 'z9Y8X7W6v5u4t3S2r1', 'z9Y8X7W6v5u4t3s2r1', 'z9Y8X7W6v5u4t3s2R1', 'z9Y8X7W6v5U4t3s2R1', 'z9Y8X7W6v5U4t3s2r1', 'z9Y8X7W6v5U4t3S2r1', 'z9Y8X7W6v5U4t3S2R1', 'z9Y8X7W6v5U4T3S2R1', 'z9Y8X7W6v5U4T3S2r1', 'z9Y8X7W6v5U4T3s2r1', 'z9Y8X7W6v5U4T3s2R1', 'z9Y8X7W6V5U4T3s2R1', 'z9Y8X7W6V5U4T3s2r1', 'z9Y8X7W6V5U4T3S2r1', 'z9Y8X7W6V5U4T3S2R1', 'z9Y8X7W6V5U4t3S2R1', 'z9Y8X7W6V5U4t3S2r1', 'z9Y8X7W6V5U4t3s2r1', 'z9Y8X7W6V5U4t3s2R1', 'z9Y8X7W6V5u4t3s2R1', 'z9Y8X7W6V5u4t3s2r1', 'z9Y8X7W6V5u4t3S2r1', 'z9Y8X7W6V5u4t3S2R1', 'z9Y8X7W6V5u4T3S2R1', 'z9Y8X7W6V5u4T3S2r1', 'z9Y8X7W6V5u4T3s2r1', 'z9Y8X7W6V5u4T3s2R1', 'z9Y8x7W6V5u4T3s2R1', 'z9Y8x7W6V5u4T3s2r1', 'z9Y8x7W6V5u4T3S2r1', 'z9Y8x7W6V5u4T3S2R1', 'z9Y8x7W6V5u4t3S2R1', 'z9Y8x7W6V5u4t3S2r1', 'z9Y8x7W6V5u4t3s2r1', 'z9Y8x7W6V5u4t3s2R1', 'z9Y8x7W6V5U4t3s2R1', 'z9Y8x7W6V5U4t3s2r1', 'z9Y8x7W6V5U4t3S2r1', 'z9Y8x7W6V5U4t3S2R1', 'z9Y8x7W6V5U4T3S2R1', 'z9Y8x7W6V5U4T3S2r1', 'z9Y8x7W6V5U4T3s2r1', 'z9Y8x7W6V5U4T3s2R1', 'z9Y8x7W6v5U4T3s2R1', 'z9Y8x7W6v5U4T3s2r1', 'z9Y8x7W6v5U4T3S2r1', 'z9Y8x7W6v5U4T3S2R1', 'z9Y8x7W6v5U4t3S2R1', 'z9Y8x7W6v5U4t3S2r1', 'z9Y8x7W6v5U4t3s2r1', 'z9Y8x7W6v5U4t3s2R1', 'z9Y8x7W6v5u4t3s2R1', 'z9Y8x7W6v5u4t3s2r1', 'z9Y8x7W6v5u4t3S2r1', 'z9Y8x7W6v5u4t3S2R1', 'z9Y8x7W6v5u4T3S2R1', 'z9Y8x7W6v5u4T3S2r1', 'z9Y8x7W6v5u4T3s2r1', 'z9Y8x7W6v5u4T3s2R1', 'z9Y8x7w6v5u4T3s2R1', 'z9Y8x7w6v5u4T3s2r1', 'z9Y8x7w6v5u4T3S2r1', 'z9Y8x7w6v5u4T3S2R1', 'z9Y8x7w6v5u4t3S2R1', 'z9Y8x7w6v5u4t3S2r1', 'z9Y8x7w6v5u4t3s2r1', 'z9Y8x7w6v5u4t3s2R1', 'z9Y8x7w6v5U4t3s2R1', 'z9Y8x7w6v5U4t3s2r1', 'z9Y8x7w6v5U4t3S2r1', 'z9Y8x7w6v5U4t3S2R1', 'z9Y8x7w6v5U4T3S2R1', 'z9Y8x7w6v5U4T3S2r1', 'z9Y8x7w6v5U4T3s2r1', 'z9Y8x7w6v5U4T3s2R1', 'z9Y8x7w6V5U4T3s2R1', 'z9Y8x7w6V5U4T3s2r1', 'z9Y8x7w6V5U4T3S2r1', 'z9Y8x7w6V5U4T3S2R1', 'z9Y8x7w6V5U4t3S2R1', 'z9Y8x7w6V5U4t3S2r1', 'z9Y8x7w6V5U4t3s2r1', 'z9Y8x7w6V5U4t3s2R1', 'z9Y8x7w6V5u4t3s2R1', 'z9Y8x7w6V5u4t3s2r1', 'z9Y8x7w6V5u4t3S2r1', 'z9Y8x7w6V5u4t3S2R1', 'z9Y8x7w6V5u4T3S2R1', 'z9Y8x7w6V5u4T3S2r1', 'z9Y8x7w6V5u4T3s2r1', 'z9Y8x7w6V5u4T3s2R1', 'z9y8x7w6V5u4T3s2R1', 'z9y8x7w6V5u4T3s2r1', 'z9y8x7w6V5u4T3S2r1', 'z9y8x7w6V5u4T3S2R1', 'z9y8x7w6V5u4t3S2R1', 'z9y8x7w6V5u4t3S2r1', 'z9y8x7w6V5u4t3s2r1', 'z9y8x7w6V5u4t3s2R1', 'z9y8x7w6V5U4t3s2R1', 'z9y8x7w6V5U4t3s2r1', 'z9y8x7w6V5U4t3S2r1', 'z9y8x7w6V5U4t3S2R1', 'z9y8x7w6V5U4T3S2R1', 'z9y8x7w6V5U4T3S2r1', 'z9y8x7w6V5U4T3s2r1', 'z9y8x7w6V5U4T3s2R1', 'z9y8x7w6v5U4T3s2R1', 'z9y8x7w6v5U4T3s2r1', 'z9y8x7w6v5U4T3S2r1', 'z9y8x7w6v5U4T3S2R1', 'z9y8x7w6v5U4t3S2R1', 'z9y8x7w6v5U4t3S2r1', 'z9y8x7w6v5U4t3s2r1', 'z9y8x7w6v5U4t3s2R1', 'z9y8x7w6v5u4t3s2R1', 'z9y8x7w6v5u4t3s2r1', 'z9y8x7w6v5u4t3S2r1', 'z9y8x7w6v5u4t3S2R1', 'z9y8x7w6v5u4T3S2R1', 'z9y8x7w6v5u4T3S2r1', 'z9y8x7w6v5u4T3s2r1', 'z9y8x7w6v5u4T3s2R1', 'z9y8x7W6v5u4T3s2R1', 'z9y8x7W6v5u4T3s2r1', 'z9y8x7W6v5u4T3S2r1', 'z9y8x7W6v5u4T3S2R1', 'z9y8x7W6v5u4t3S2R1', 'z9y8x7W6v5u4t3S2r1', 'z9y8x7W6v5u4t3s2r1', 'z9y8x7W6v5u4t3s2R1', 'z9y8x7W6v5U4t3s2R1', 'z9y8x7W6v5U4t3s2r1', 'z9y8x7W6v5U4t3S2r1', 'z9y8x7W6v5U4t3S2R1', 'z9y8x7W6v5U4T3S2R1', 'z9y8x7W6v5U4T3S2r1', 'z9y8x7W6v5U4T3s2r1', 'z9y8x7W6v5U4T3s2R1', 'z9y8x7W6V5U4T3s2R1', 'z9y8x7W6V5U4T3s2r1', 'z9y8x7W6V5U4T3S2r1', 'z9y8x7W6V5U4T3S2R1', 'z9y8x7W6V5U4t3S2R1', 'z9y8x7W6V5U4t3S2r1', 'z9y8x7W6V5U4t3s2r1', 'z9y8x7W6V5U4t3s2R1', 'z9y8x7W6V5u4t3s2R1', 'z9y8x7W6V5u4t3s2r1', 'z9y8x7W6V5u4t3S2r1', 'z9y8x7W6V5u4t3S2R1', 'z9y8x7W6V5u4T3S2R1', 'z9y8x7W6V5u4T3S2r1', 'z9y8x7W6V5u4T3s2r1', 'z9y8x7W6V5u4T3s2R1', 'z9y8X7W6V5u4T3s2R1', 'z9y8X7W6V5u4T3s2r1', 'z9y8X7W6V5u4T3S2r1', 'z9y8X7W6V5u4T3S2R1', 'z9y8X7W6V5u4t3S2R1', 'z9y8X7W6V5u4t3S2r1', 'z9y8X7W6V5u4t3s2r1', 'z9y8X7W6V5u4t3s2R1', 'z9y8X7W6V5U4t3s2R1', 'z9y8X7W6V5U4t3s2r1', 'z9y8X7W6V5U4t3S2r1', 'z9y8X7W6V5U4t3S2R1', 'z9y8X7W6V5U4T3S2R1', 'z9y8X7W6V5U4T3S2r1', 'z9y8X7W6V5U4T3s2r1', 'z9y8X7W6V5U4T3s2R1', 'z9y8X7W6v5U4T3s2R1', 'z9y8X7W6v5U4T3s2r1', 'z9y8X7W6v5U4T3S2r1', 'z9y8X7W6v5U4T3S2R1', 'z9y8X7W6v5U4t3S2R1', 'z9y8X7W6v5U4t3S2r1', 'z9y8X7W6v5U4t3s2r1', 'z9y8X7W6v5U4t3s2R1', 'z9y8X7W6v5u4t3s2R1', 'z9y8X7W6v5u4t3s2r1', 'z9y8X7W6v5u4t3S2r1', 'z9y8X7W6v5u4t3S2R1', 'z9y8X7W6v5u4T3S2R1', 'z9y8X7W6v5u4T3S2r1', 'z9y8X7W6v5u4T3s2r1', 'z9y8X7W6v5u4T3s2R1', 'z9y8X7w6v5u4T3s2R1', 'z9y8X7w6v5u4T3s2r1', 'z9y8X7w6v5u4T3S2r1', 'z9y8X7w6v5u4T3S2R1', 'z9y8X7w6v5u4t3S2R1', 'z9y8X7w6v5u4t3S2r1', 'z9y8X7w6v5u4t3s2r1', 'z9y8X7w6v5u4t3s2R1', 'z9y8X7w6v5U4t3s2R1', 'z9y8X7w6v5U4t3s2r1', 'z9y8X7w6v5U4t3S2r1', 'z9y8X7w6v5U4t3S2R1', 'z9y8X7w6v5U4T3S2R1', 'z9y8X7w6v5U4T3S2r1', 'z9y8X7w6v5U4T3s2r1', 'z9y8X7w6v5U4T3s2R1', 'z9y8X7w6V5U4T3s2R1', 'z9y8X7w6V5U4T3s2r1', 'z9y8X7w6V5U4T3S2r1', 'z9y8X7w6V5U4T3S2R1', 'z9y8X7w6V5U4t3S2R1', 'z9y8X7w6V5U4t3S2r1', 'z9y8X7w6V5U4t3s2r1', 'z9y8X7w6V5U4t3s2R1', 'z9y8X7w6V5u4t3s2R1', 'z9y8X7w6V5u4t3s2r1', 'z9y8X7w6V5u4t3S2r1', 'z9y8X7w6V5u4t3S2R1', 'z9y8X7w6V5u4T3S2R1', 'z9y8X7w6V5u4T3S2r1', 'z9y8X7w6V5u4T3s2r1', 'z9y8X7w6V5u4T3s2R1']\n assert candidate(s = \"XyZ\") == ['XyZ', 'Xyz', 'XYz', 'XYZ', 'xYZ', 'xYz', 'xyz', 'xyZ']\n assert candidate(s = \"aBcDe\") == ['aBcDe', 'aBcDE', 'aBcdE', 'aBcde', 'aBCde', 'aBCdE', 'aBCDE', 'aBCDe', 'abCDe', 'abCDE', 'abCdE', 'abCde', 'abcde', 'abcdE', 'abcDE', 'abcDe', 'AbcDe', 'AbcDE', 'AbcdE', 'Abcde', 'AbCde', 'AbCdE', 'AbCDE', 'AbCDe', 'ABCDe', 'ABCDE', 'ABCdE', 'ABCde', 'ABcde', 'ABcdE', 'ABcDE', 'ABcDe']\n assert candidate(s = \"W3R5T\") == ['W3R5T', 'W3R5t', 'W3r5t', 'W3r5T', 'w3r5T', 'w3r5t', 'w3R5t', 'w3R5T']\n assert candidate(s = \"a1B2C3\") == ['a1B2C3', 'a1B2c3', 'a1b2c3', 'a1b2C3', 'A1b2C3', 'A1b2c3', 'A1B2c3', 'A1B2C3']\n assert candidate(s = \"aBcD123eF456gH789\") == ['aBcD123eF456gH789', 'aBcD123eF456gh789', 'aBcD123eF456Gh789', 'aBcD123eF456GH789', 'aBcD123ef456GH789', 'aBcD123ef456Gh789', 'aBcD123ef456gh789', 'aBcD123ef456gH789', 'aBcD123Ef456gH789', 'aBcD123Ef456gh789', 'aBcD123Ef456Gh789', 'aBcD123Ef456GH789', 'aBcD123EF456GH789', 'aBcD123EF456Gh789', 'aBcD123EF456gh789', 'aBcD123EF456gH789', 'aBcd123EF456gH789', 'aBcd123EF456gh789', 'aBcd123EF456Gh789', 'aBcd123EF456GH789', 'aBcd123Ef456GH789', 'aBcd123Ef456Gh789', 'aBcd123Ef456gh789', 'aBcd123Ef456gH789', 'aBcd123ef456gH789', 'aBcd123ef456gh789', 'aBcd123ef456Gh789', 'aBcd123ef456GH789', 'aBcd123eF456GH789', 'aBcd123eF456Gh789', 'aBcd123eF456gh789', 'aBcd123eF456gH789', 'aBCd123eF456gH789', 'aBCd123eF456gh789', 'aBCd123eF456Gh789', 'aBCd123eF456GH789', 'aBCd123ef456GH789', 'aBCd123ef456Gh789', 'aBCd123ef456gh789', 'aBCd123ef456gH789', 'aBCd123Ef456gH789', 'aBCd123Ef456gh789', 'aBCd123Ef456Gh789', 'aBCd123Ef456GH789', 'aBCd123EF456GH789', 'aBCd123EF456Gh789', 'aBCd123EF456gh789', 'aBCd123EF456gH789', 'aBCD123EF456gH789', 'aBCD123EF456gh789', 'aBCD123EF456Gh789', 'aBCD123EF456GH789', 'aBCD123Ef456GH789', 'aBCD123Ef456Gh789', 'aBCD123Ef456gh789', 'aBCD123Ef456gH789', 'aBCD123ef456gH789', 'aBCD123ef456gh789', 'aBCD123ef456Gh789', 'aBCD123ef456GH789', 'aBCD123eF456GH789', 'aBCD123eF456Gh789', 'aBCD123eF456gh789', 'aBCD123eF456gH789', 'abCD123eF456gH789', 'abCD123eF456gh789', 'abCD123eF456Gh789', 'abCD123eF456GH789', 'abCD123ef456GH789', 'abCD123ef456Gh789', 'abCD123ef456gh789', 'abCD123ef456gH789', 'abCD123Ef456gH789', 'abCD123Ef456gh789', 'abCD123Ef456Gh789', 'abCD123Ef456GH789', 'abCD123EF456GH789', 'abCD123EF456Gh789', 'abCD123EF456gh789', 'abCD123EF456gH789', 'abCd123EF456gH789', 'abCd123EF456gh789', 'abCd123EF456Gh789', 'abCd123EF456GH789', 'abCd123Ef456GH789', 'abCd123Ef456Gh789', 'abCd123Ef456gh789', 'abCd123Ef456gH789', 'abCd123ef456gH789', 'abCd123ef456gh789', 'abCd123ef456Gh789', 'abCd123ef456GH789', 'abCd123eF456GH789', 'abCd123eF456Gh789', 'abCd123eF456gh789', 'abCd123eF456gH789', 'abcd123eF456gH789', 'abcd123eF456gh789', 'abcd123eF456Gh789', 'abcd123eF456GH789', 'abcd123ef456GH789', 'abcd123ef456Gh789', 'abcd123ef456gh789', 'abcd123ef456gH789', 'abcd123Ef456gH789', 'abcd123Ef456gh789', 'abcd123Ef456Gh789', 'abcd123Ef456GH789', 'abcd123EF456GH789', 'abcd123EF456Gh789', 'abcd123EF456gh789', 'abcd123EF456gH789', 'abcD123EF456gH789', 'abcD123EF456gh789', 'abcD123EF456Gh789', 'abcD123EF456GH789', 'abcD123Ef456GH789', 'abcD123Ef456Gh789', 'abcD123Ef456gh789', 'abcD123Ef456gH789', 'abcD123ef456gH789', 'abcD123ef456gh789', 'abcD123ef456Gh789', 'abcD123ef456GH789', 'abcD123eF456GH789', 'abcD123eF456Gh789', 'abcD123eF456gh789', 'abcD123eF456gH789', 'AbcD123eF456gH789', 'AbcD123eF456gh789', 'AbcD123eF456Gh789', 'AbcD123eF456GH789', 'AbcD123ef456GH789', 'AbcD123ef456Gh789', 'AbcD123ef456gh789', 'AbcD123ef456gH789', 'AbcD123Ef456gH789', 'AbcD123Ef456gh789', 'AbcD123Ef456Gh789', 'AbcD123Ef456GH789', 'AbcD123EF456GH789', 'AbcD123EF456Gh789', 'AbcD123EF456gh789', 'AbcD123EF456gH789', 'Abcd123EF456gH789', 'Abcd123EF456gh789', 'Abcd123EF456Gh789', 'Abcd123EF456GH789', 'Abcd123Ef456GH789', 'Abcd123Ef456Gh789', 'Abcd123Ef456gh789', 'Abcd123Ef456gH789', 'Abcd123ef456gH789', 'Abcd123ef456gh789', 'Abcd123ef456Gh789', 'Abcd123ef456GH789', 'Abcd123eF456GH789', 'Abcd123eF456Gh789', 'Abcd123eF456gh789', 'Abcd123eF456gH789', 'AbCd123eF456gH789', 'AbCd123eF456gh789', 'AbCd123eF456Gh789', 'AbCd123eF456GH789', 'AbCd123ef456GH789', 'AbCd123ef456Gh789', 'AbCd123ef456gh789', 'AbCd123ef456gH789', 'AbCd123Ef456gH789', 'AbCd123Ef456gh789', 'AbCd123Ef456Gh789', 'AbCd123Ef456GH789', 'AbCd123EF456GH789', 'AbCd123EF456Gh789', 'AbCd123EF456gh789', 'AbCd123EF456gH789', 'AbCD123EF456gH789', 'AbCD123EF456gh789', 'AbCD123EF456Gh789', 'AbCD123EF456GH789', 'AbCD123Ef456GH789', 'AbCD123Ef456Gh789', 'AbCD123Ef456gh789', 'AbCD123Ef456gH789', 'AbCD123ef456gH789', 'AbCD123ef456gh789', 'AbCD123ef456Gh789', 'AbCD123ef456GH789', 'AbCD123eF456GH789', 'AbCD123eF456Gh789', 'AbCD123eF456gh789', 'AbCD123eF456gH789', 'ABCD123eF456gH789', 'ABCD123eF456gh789', 'ABCD123eF456Gh789', 'ABCD123eF456GH789', 'ABCD123ef456GH789', 'ABCD123ef456Gh789', 'ABCD123ef456gh789', 'ABCD123ef456gH789', 'ABCD123Ef456gH789', 'ABCD123Ef456gh789', 'ABCD123Ef456Gh789', 'ABCD123Ef456GH789', 'ABCD123EF456GH789', 'ABCD123EF456Gh789', 'ABCD123EF456gh789', 'ABCD123EF456gH789', 'ABCd123EF456gH789', 'ABCd123EF456gh789', 'ABCd123EF456Gh789', 'ABCd123EF456GH789', 'ABCd123Ef456GH789', 'ABCd123Ef456Gh789', 'ABCd123Ef456gh789', 'ABCd123Ef456gH789', 'ABCd123ef456gH789', 'ABCd123ef456gh789', 'ABCd123ef456Gh789', 'ABCd123ef456GH789', 'ABCd123eF456GH789', 'ABCd123eF456Gh789', 'ABCd123eF456gh789', 'ABCd123eF456gH789', 'ABcd123eF456gH789', 'ABcd123eF456gh789', 'ABcd123eF456Gh789', 'ABcd123eF456GH789', 'ABcd123ef456GH789', 'ABcd123ef456Gh789', 'ABcd123ef456gh789', 'ABcd123ef456gH789', 'ABcd123Ef456gH789', 'ABcd123Ef456gh789', 'ABcd123Ef456Gh789', 'ABcd123Ef456GH789', 'ABcd123EF456GH789', 'ABcd123EF456Gh789', 'ABcd123EF456gh789', 'ABcd123EF456gH789', 'ABcD123EF456gH789', 'ABcD123EF456gh789', 'ABcD123EF456Gh789', 'ABcD123EF456GH789', 'ABcD123Ef456GH789', 'ABcD123Ef456Gh789', 'ABcD123Ef456gh789', 'ABcD123Ef456gH789', 'ABcD123ef456gH789', 'ABcD123ef456gh789', 'ABcD123ef456Gh789', 'ABcD123ef456GH789', 'ABcD123eF456GH789', 'ABcD123eF456Gh789', 'ABcD123eF456gh789', 'ABcD123eF456gH789']\n assert candidate(s = \"xYz0A1b2C3\") == ['xYz0A1b2C3', 'xYz0A1b2c3', 'xYz0A1B2c3', 'xYz0A1B2C3', 'xYz0a1B2C3', 'xYz0a1B2c3', 'xYz0a1b2c3', 'xYz0a1b2C3', 'xYZ0a1b2C3', 'xYZ0a1b2c3', 'xYZ0a1B2c3', 'xYZ0a1B2C3', 'xYZ0A1B2C3', 'xYZ0A1B2c3', 'xYZ0A1b2c3', 'xYZ0A1b2C3', 'xyZ0A1b2C3', 'xyZ0A1b2c3', 'xyZ0A1B2c3', 'xyZ0A1B2C3', 'xyZ0a1B2C3', 'xyZ0a1B2c3', 'xyZ0a1b2c3', 'xyZ0a1b2C3', 'xyz0a1b2C3', 'xyz0a1b2c3', 'xyz0a1B2c3', 'xyz0a1B2C3', 'xyz0A1B2C3', 'xyz0A1B2c3', 'xyz0A1b2c3', 'xyz0A1b2C3', 'Xyz0A1b2C3', 'Xyz0A1b2c3', 'Xyz0A1B2c3', 'Xyz0A1B2C3', 'Xyz0a1B2C3', 'Xyz0a1B2c3', 'Xyz0a1b2c3', 'Xyz0a1b2C3', 'XyZ0a1b2C3', 'XyZ0a1b2c3', 'XyZ0a1B2c3', 'XyZ0a1B2C3', 'XyZ0A1B2C3', 'XyZ0A1B2c3', 'XyZ0A1b2c3', 'XyZ0A1b2C3', 'XYZ0A1b2C3', 'XYZ0A1b2c3', 'XYZ0A1B2c3', 'XYZ0A1B2C3', 'XYZ0a1B2C3', 'XYZ0a1B2c3', 'XYZ0a1b2c3', 'XYZ0a1b2C3', 'XYz0a1b2C3', 'XYz0a1b2c3', 'XYz0a1B2c3', 'XYz0a1B2C3', 'XYz0A1B2C3', 'XYz0A1B2c3', 'XYz0A1b2c3', 'XYz0A1b2C3']\n assert candidate(s = \"aBc123D\") == ['aBc123D', 'aBc123d', 'aBC123d', 'aBC123D', 'abC123D', 'abC123d', 'abc123d', 'abc123D', 'Abc123D', 'Abc123d', 'AbC123d', 'AbC123D', 'ABC123D', 'ABC123d', 'ABc123d', 'ABc123D']\n assert candidate(s = \"aB1C2d3E4f5G6\") == ['aB1C2d3E4f5G6', 'aB1C2d3E4f5g6', 'aB1C2d3E4F5g6', 'aB1C2d3E4F5G6', 'aB1C2d3e4F5G6', 'aB1C2d3e4F5g6', 'aB1C2d3e4f5g6', 'aB1C2d3e4f5G6', 'aB1C2D3e4f5G6', 'aB1C2D3e4f5g6', 'aB1C2D3e4F5g6', 'aB1C2D3e4F5G6', 'aB1C2D3E4F5G6', 'aB1C2D3E4F5g6', 'aB1C2D3E4f5g6', 'aB1C2D3E4f5G6', 'aB1c2D3E4f5G6', 'aB1c2D3E4f5g6', 'aB1c2D3E4F5g6', 'aB1c2D3E4F5G6', 'aB1c2D3e4F5G6', 'aB1c2D3e4F5g6', 'aB1c2D3e4f5g6', 'aB1c2D3e4f5G6', 'aB1c2d3e4f5G6', 'aB1c2d3e4f5g6', 'aB1c2d3e4F5g6', 'aB1c2d3e4F5G6', 'aB1c2d3E4F5G6', 'aB1c2d3E4F5g6', 'aB1c2d3E4f5g6', 'aB1c2d3E4f5G6', 'ab1c2d3E4f5G6', 'ab1c2d3E4f5g6', 'ab1c2d3E4F5g6', 'ab1c2d3E4F5G6', 'ab1c2d3e4F5G6', 'ab1c2d3e4F5g6', 'ab1c2d3e4f5g6', 'ab1c2d3e4f5G6', 'ab1c2D3e4f5G6', 'ab1c2D3e4f5g6', 'ab1c2D3e4F5g6', 'ab1c2D3e4F5G6', 'ab1c2D3E4F5G6', 'ab1c2D3E4F5g6', 'ab1c2D3E4f5g6', 'ab1c2D3E4f5G6', 'ab1C2D3E4f5G6', 'ab1C2D3E4f5g6', 'ab1C2D3E4F5g6', 'ab1C2D3E4F5G6', 'ab1C2D3e4F5G6', 'ab1C2D3e4F5g6', 'ab1C2D3e4f5g6', 'ab1C2D3e4f5G6', 'ab1C2d3e4f5G6', 'ab1C2d3e4f5g6', 'ab1C2d3e4F5g6', 'ab1C2d3e4F5G6', 'ab1C2d3E4F5G6', 'ab1C2d3E4F5g6', 'ab1C2d3E4f5g6', 'ab1C2d3E4f5G6', 'Ab1C2d3E4f5G6', 'Ab1C2d3E4f5g6', 'Ab1C2d3E4F5g6', 'Ab1C2d3E4F5G6', 'Ab1C2d3e4F5G6', 'Ab1C2d3e4F5g6', 'Ab1C2d3e4f5g6', 'Ab1C2d3e4f5G6', 'Ab1C2D3e4f5G6', 'Ab1C2D3e4f5g6', 'Ab1C2D3e4F5g6', 'Ab1C2D3e4F5G6', 'Ab1C2D3E4F5G6', 'Ab1C2D3E4F5g6', 'Ab1C2D3E4f5g6', 'Ab1C2D3E4f5G6', 'Ab1c2D3E4f5G6', 'Ab1c2D3E4f5g6', 'Ab1c2D3E4F5g6', 'Ab1c2D3E4F5G6', 'Ab1c2D3e4F5G6', 'Ab1c2D3e4F5g6', 'Ab1c2D3e4f5g6', 'Ab1c2D3e4f5G6', 'Ab1c2d3e4f5G6', 'Ab1c2d3e4f5g6', 'Ab1c2d3e4F5g6', 'Ab1c2d3e4F5G6', 'Ab1c2d3E4F5G6', 'Ab1c2d3E4F5g6', 'Ab1c2d3E4f5g6', 'Ab1c2d3E4f5G6', 'AB1c2d3E4f5G6', 'AB1c2d3E4f5g6', 'AB1c2d3E4F5g6', 'AB1c2d3E4F5G6', 'AB1c2d3e4F5G6', 'AB1c2d3e4F5g6', 'AB1c2d3e4f5g6', 'AB1c2d3e4f5G6', 'AB1c2D3e4f5G6', 'AB1c2D3e4f5g6', 'AB1c2D3e4F5g6', 'AB1c2D3e4F5G6', 'AB1c2D3E4F5G6', 'AB1c2D3E4F5g6', 'AB1c2D3E4f5g6', 'AB1c2D3E4f5G6', 'AB1C2D3E4f5G6', 'AB1C2D3E4f5g6', 'AB1C2D3E4F5g6', 'AB1C2D3E4F5G6', 'AB1C2D3e4F5G6', 'AB1C2D3e4F5g6', 'AB1C2D3e4f5g6', 'AB1C2D3e4f5G6', 'AB1C2d3e4f5G6', 'AB1C2d3e4f5g6', 'AB1C2d3e4F5g6', 'AB1C2d3e4F5G6', 'AB1C2d3E4F5G6', 'AB1C2d3E4F5g6', 'AB1C2d3E4f5g6', 'AB1C2d3E4f5G6']\n assert candidate(s = \"987abc654\") == ['987abc654', '987abC654', '987aBC654', '987aBc654', '987ABc654', '987ABC654', '987AbC654', '987Abc654']\n assert candidate(s = \"A1bC2d3E4f\") == ['A1bC2d3E4f', 'A1bC2d3E4F', 'A1bC2d3e4F', 'A1bC2d3e4f', 'A1bC2D3e4f', 'A1bC2D3e4F', 'A1bC2D3E4F', 'A1bC2D3E4f', 'A1bc2D3E4f', 'A1bc2D3E4F', 'A1bc2D3e4F', 'A1bc2D3e4f', 'A1bc2d3e4f', 'A1bc2d3e4F', 'A1bc2d3E4F', 'A1bc2d3E4f', 'A1Bc2d3E4f', 'A1Bc2d3E4F', 'A1Bc2d3e4F', 'A1Bc2d3e4f', 'A1Bc2D3e4f', 'A1Bc2D3e4F', 'A1Bc2D3E4F', 'A1Bc2D3E4f', 'A1BC2D3E4f', 'A1BC2D3E4F', 'A1BC2D3e4F', 'A1BC2D3e4f', 'A1BC2d3e4f', 'A1BC2d3e4F', 'A1BC2d3E4F', 'A1BC2d3E4f', 'a1BC2d3E4f', 'a1BC2d3E4F', 'a1BC2d3e4F', 'a1BC2d3e4f', 'a1BC2D3e4f', 'a1BC2D3e4F', 'a1BC2D3E4F', 'a1BC2D3E4f', 'a1Bc2D3E4f', 'a1Bc2D3E4F', 'a1Bc2D3e4F', 'a1Bc2D3e4f', 'a1Bc2d3e4f', 'a1Bc2d3e4F', 'a1Bc2d3E4F', 'a1Bc2d3E4f', 'a1bc2d3E4f', 'a1bc2d3E4F', 'a1bc2d3e4F', 'a1bc2d3e4f', 'a1bc2D3e4f', 'a1bc2D3e4F', 'a1bc2D3E4F', 'a1bc2D3E4f', 'a1bC2D3E4f', 'a1bC2D3E4F', 'a1bC2D3e4F', 'a1bC2D3e4f', 'a1bC2d3e4f', 'a1bC2d3e4F', 'a1bC2d3E4F', 'a1bC2d3E4f']\n assert candidate(s = \"aBc123dE456fG\") == ['aBc123dE456fG', 'aBc123dE456fg', 'aBc123dE456Fg', 'aBc123dE456FG', 'aBc123de456FG', 'aBc123de456Fg', 'aBc123de456fg', 'aBc123de456fG', 'aBc123De456fG', 'aBc123De456fg', 'aBc123De456Fg', 'aBc123De456FG', 'aBc123DE456FG', 'aBc123DE456Fg', 'aBc123DE456fg', 'aBc123DE456fG', 'aBC123DE456fG', 'aBC123DE456fg', 'aBC123DE456Fg', 'aBC123DE456FG', 'aBC123De456FG', 'aBC123De456Fg', 'aBC123De456fg', 'aBC123De456fG', 'aBC123de456fG', 'aBC123de456fg', 'aBC123de456Fg', 'aBC123de456FG', 'aBC123dE456FG', 'aBC123dE456Fg', 'aBC123dE456fg', 'aBC123dE456fG', 'abC123dE456fG', 'abC123dE456fg', 'abC123dE456Fg', 'abC123dE456FG', 'abC123de456FG', 'abC123de456Fg', 'abC123de456fg', 'abC123de456fG', 'abC123De456fG', 'abC123De456fg', 'abC123De456Fg', 'abC123De456FG', 'abC123DE456FG', 'abC123DE456Fg', 'abC123DE456fg', 'abC123DE456fG', 'abc123DE456fG', 'abc123DE456fg', 'abc123DE456Fg', 'abc123DE456FG', 'abc123De456FG', 'abc123De456Fg', 'abc123De456fg', 'abc123De456fG', 'abc123de456fG', 'abc123de456fg', 'abc123de456Fg', 'abc123de456FG', 'abc123dE456FG', 'abc123dE456Fg', 'abc123dE456fg', 'abc123dE456fG', 'Abc123dE456fG', 'Abc123dE456fg', 'Abc123dE456Fg', 'Abc123dE456FG', 'Abc123de456FG', 'Abc123de456Fg', 'Abc123de456fg', 'Abc123de456fG', 'Abc123De456fG', 'Abc123De456fg', 'Abc123De456Fg', 'Abc123De456FG', 'Abc123DE456FG', 'Abc123DE456Fg', 'Abc123DE456fg', 'Abc123DE456fG', 'AbC123DE456fG', 'AbC123DE456fg', 'AbC123DE456Fg', 'AbC123DE456FG', 'AbC123De456FG', 'AbC123De456Fg', 'AbC123De456fg', 'AbC123De456fG', 'AbC123de456fG', 'AbC123de456fg', 'AbC123de456Fg', 'AbC123de456FG', 'AbC123dE456FG', 'AbC123dE456Fg', 'AbC123dE456fg', 'AbC123dE456fG', 'ABC123dE456fG', 'ABC123dE456fg', 'ABC123dE456Fg', 'ABC123dE456FG', 'ABC123de456FG', 'ABC123de456Fg', 'ABC123de456fg', 'ABC123de456fG', 'ABC123De456fG', 'ABC123De456fg', 'ABC123De456Fg', 'ABC123De456FG', 'ABC123DE456FG', 'ABC123DE456Fg', 'ABC123DE456fg', 'ABC123DE456fG', 'ABc123DE456fG', 'ABc123DE456fg', 'ABc123DE456Fg', 'ABc123DE456FG', 'ABc123De456FG', 'ABc123De456Fg', 'ABc123De456fg', 'ABc123De456fG', 'ABc123de456fG', 'ABc123de456fg', 'ABc123de456Fg', 'ABc123de456FG', 'ABc123dE456FG', 'ABc123dE456Fg', 'ABc123dE456fg', 'ABc123dE456fG']\n assert candidate(s = \"1a2B3c4D5\") == ['1a2B3c4D5', '1a2B3c4d5', '1a2B3C4d5', '1a2B3C4D5', '1a2b3C4D5', '1a2b3C4d5', '1a2b3c4d5', '1a2b3c4D5', '1A2b3c4D5', '1A2b3c4d5', '1A2b3C4d5', '1A2b3C4D5', '1A2B3C4D5', '1A2B3C4d5', '1A2B3c4d5', '1A2B3c4D5']\n assert candidate(s = \"123abcXYZ\") == ['123abcXYZ', '123abcXYz', '123abcXyz', '123abcXyZ', '123abcxyZ', '123abcxyz', '123abcxYz', '123abcxYZ', '123abCxYZ', '123abCxYz', '123abCxyz', '123abCxyZ', '123abCXyZ', '123abCXyz', '123abCXYz', '123abCXYZ', '123aBCXYZ', '123aBCXYz', '123aBCXyz', '123aBCXyZ', '123aBCxyZ', '123aBCxyz', '123aBCxYz', '123aBCxYZ', '123aBcxYZ', '123aBcxYz', '123aBcxyz', '123aBcxyZ', '123aBcXyZ', '123aBcXyz', '123aBcXYz', '123aBcXYZ', '123ABcXYZ', '123ABcXYz', '123ABcXyz', '123ABcXyZ', '123ABcxyZ', '123ABcxyz', '123ABcxYz', '123ABcxYZ', '123ABCxYZ', '123ABCxYz', '123ABCxyz', '123ABCxyZ', '123ABCXyZ', '123ABCXyz', '123ABCXYz', '123ABCXYZ', '123AbCXYZ', '123AbCXYz', '123AbCXyz', '123AbCXyZ', '123AbCxyZ', '123AbCxyz', '123AbCxYz', '123AbCxYZ', '123AbcxYZ', '123AbcxYz', '123Abcxyz', '123AbcxyZ', '123AbcXyZ', '123AbcXyz', '123AbcXYz', '123AbcXYZ']\n assert candidate(s = \"A1B2C3D4E5F6G7H8I9J0\") == ['A1B2C3D4E5F6G7H8I9J0', 'A1B2C3D4E5F6G7H8I9j0', 'A1B2C3D4E5F6G7H8i9j0', 'A1B2C3D4E5F6G7H8i9J0', 'A1B2C3D4E5F6G7h8i9J0', 'A1B2C3D4E5F6G7h8i9j0', 'A1B2C3D4E5F6G7h8I9j0', 'A1B2C3D4E5F6G7h8I9J0', 'A1B2C3D4E5F6g7h8I9J0', 'A1B2C3D4E5F6g7h8I9j0', 'A1B2C3D4E5F6g7h8i9j0', 'A1B2C3D4E5F6g7h8i9J0', 'A1B2C3D4E5F6g7H8i9J0', 'A1B2C3D4E5F6g7H8i9j0', 'A1B2C3D4E5F6g7H8I9j0', 'A1B2C3D4E5F6g7H8I9J0', 'A1B2C3D4E5f6g7H8I9J0', 'A1B2C3D4E5f6g7H8I9j0', 'A1B2C3D4E5f6g7H8i9j0', 'A1B2C3D4E5f6g7H8i9J0', 'A1B2C3D4E5f6g7h8i9J0', 'A1B2C3D4E5f6g7h8i9j0', 'A1B2C3D4E5f6g7h8I9j0', 'A1B2C3D4E5f6g7h8I9J0', 'A1B2C3D4E5f6G7h8I9J0', 'A1B2C3D4E5f6G7h8I9j0', 'A1B2C3D4E5f6G7h8i9j0', 'A1B2C3D4E5f6G7h8i9J0', 'A1B2C3D4E5f6G7H8i9J0', 'A1B2C3D4E5f6G7H8i9j0', 'A1B2C3D4E5f6G7H8I9j0', 'A1B2C3D4E5f6G7H8I9J0', 'A1B2C3D4e5f6G7H8I9J0', 'A1B2C3D4e5f6G7H8I9j0', 'A1B2C3D4e5f6G7H8i9j0', 'A1B2C3D4e5f6G7H8i9J0', 'A1B2C3D4e5f6G7h8i9J0', 'A1B2C3D4e5f6G7h8i9j0', 'A1B2C3D4e5f6G7h8I9j0', 'A1B2C3D4e5f6G7h8I9J0', 'A1B2C3D4e5f6g7h8I9J0', 'A1B2C3D4e5f6g7h8I9j0', 'A1B2C3D4e5f6g7h8i9j0', 'A1B2C3D4e5f6g7h8i9J0', 'A1B2C3D4e5f6g7H8i9J0', 'A1B2C3D4e5f6g7H8i9j0', 'A1B2C3D4e5f6g7H8I9j0', 'A1B2C3D4e5f6g7H8I9J0', 'A1B2C3D4e5F6g7H8I9J0', 'A1B2C3D4e5F6g7H8I9j0', 'A1B2C3D4e5F6g7H8i9j0', 'A1B2C3D4e5F6g7H8i9J0', 'A1B2C3D4e5F6g7h8i9J0', 'A1B2C3D4e5F6g7h8i9j0', 'A1B2C3D4e5F6g7h8I9j0', 'A1B2C3D4e5F6g7h8I9J0', 'A1B2C3D4e5F6G7h8I9J0', 'A1B2C3D4e5F6G7h8I9j0', 'A1B2C3D4e5F6G7h8i9j0', 'A1B2C3D4e5F6G7h8i9J0', 'A1B2C3D4e5F6G7H8i9J0', 'A1B2C3D4e5F6G7H8i9j0', 'A1B2C3D4e5F6G7H8I9j0', 'A1B2C3D4e5F6G7H8I9J0', 'A1B2C3d4e5F6G7H8I9J0', 'A1B2C3d4e5F6G7H8I9j0', 'A1B2C3d4e5F6G7H8i9j0', 'A1B2C3d4e5F6G7H8i9J0', 'A1B2C3d4e5F6G7h8i9J0', 'A1B2C3d4e5F6G7h8i9j0', 'A1B2C3d4e5F6G7h8I9j0', 'A1B2C3d4e5F6G7h8I9J0', 'A1B2C3d4e5F6g7h8I9J0', 'A1B2C3d4e5F6g7h8I9j0', 'A1B2C3d4e5F6g7h8i9j0', 'A1B2C3d4e5F6g7h8i9J0', 'A1B2C3d4e5F6g7H8i9J0', 'A1B2C3d4e5F6g7H8i9j0', 'A1B2C3d4e5F6g7H8I9j0', 'A1B2C3d4e5F6g7H8I9J0', 'A1B2C3d4e5f6g7H8I9J0', 'A1B2C3d4e5f6g7H8I9j0', 'A1B2C3d4e5f6g7H8i9j0', 'A1B2C3d4e5f6g7H8i9J0', 'A1B2C3d4e5f6g7h8i9J0', 'A1B2C3d4e5f6g7h8i9j0', 'A1B2C3d4e5f6g7h8I9j0', 'A1B2C3d4e5f6g7h8I9J0', 'A1B2C3d4e5f6G7h8I9J0', 'A1B2C3d4e5f6G7h8I9j0', 'A1B2C3d4e5f6G7h8i9j0', 'A1B2C3d4e5f6G7h8i9J0', 'A1B2C3d4e5f6G7H8i9J0', 'A1B2C3d4e5f6G7H8i9j0', 'A1B2C3d4e5f6G7H8I9j0', 'A1B2C3d4e5f6G7H8I9J0', 'A1B2C3d4E5f6G7H8I9J0', 'A1B2C3d4E5f6G7H8I9j0', 'A1B2C3d4E5f6G7H8i9j0', 'A1B2C3d4E5f6G7H8i9J0', 'A1B2C3d4E5f6G7h8i9J0', 'A1B2C3d4E5f6G7h8i9j0', 'A1B2C3d4E5f6G7h8I9j0', 'A1B2C3d4E5f6G7h8I9J0', 'A1B2C3d4E5f6g7h8I9J0', 'A1B2C3d4E5f6g7h8I9j0', 'A1B2C3d4E5f6g7h8i9j0', 'A1B2C3d4E5f6g7h8i9J0', 'A1B2C3d4E5f6g7H8i9J0', 'A1B2C3d4E5f6g7H8i9j0', 'A1B2C3d4E5f6g7H8I9j0', 'A1B2C3d4E5f6g7H8I9J0', 'A1B2C3d4E5F6g7H8I9J0', 'A1B2C3d4E5F6g7H8I9j0', 'A1B2C3d4E5F6g7H8i9j0', 'A1B2C3d4E5F6g7H8i9J0', 'A1B2C3d4E5F6g7h8i9J0', 'A1B2C3d4E5F6g7h8i9j0', 'A1B2C3d4E5F6g7h8I9j0', 'A1B2C3d4E5F6g7h8I9J0', 'A1B2C3d4E5F6G7h8I9J0', 'A1B2C3d4E5F6G7h8I9j0', 'A1B2C3d4E5F6G7h8i9j0', 'A1B2C3d4E5F6G7h8i9J0', 'A1B2C3d4E5F6G7H8i9J0', 'A1B2C3d4E5F6G7H8i9j0', 'A1B2C3d4E5F6G7H8I9j0', 'A1B2C3d4E5F6G7H8I9J0', 'A1B2c3d4E5F6G7H8I9J0', 'A1B2c3d4E5F6G7H8I9j0', 'A1B2c3d4E5F6G7H8i9j0', 'A1B2c3d4E5F6G7H8i9J0', 'A1B2c3d4E5F6G7h8i9J0', 'A1B2c3d4E5F6G7h8i9j0', 'A1B2c3d4E5F6G7h8I9j0', 'A1B2c3d4E5F6G7h8I9J0', 'A1B2c3d4E5F6g7h8I9J0', 'A1B2c3d4E5F6g7h8I9j0', 'A1B2c3d4E5F6g7h8i9j0', 'A1B2c3d4E5F6g7h8i9J0', 'A1B2c3d4E5F6g7H8i9J0', 'A1B2c3d4E5F6g7H8i9j0', 'A1B2c3d4E5F6g7H8I9j0', 'A1B2c3d4E5F6g7H8I9J0', 'A1B2c3d4E5f6g7H8I9J0', 'A1B2c3d4E5f6g7H8I9j0', 'A1B2c3d4E5f6g7H8i9j0', 'A1B2c3d4E5f6g7H8i9J0', 'A1B2c3d4E5f6g7h8i9J0', 'A1B2c3d4E5f6g7h8i9j0', 'A1B2c3d4E5f6g7h8I9j0', 'A1B2c3d4E5f6g7h8I9J0', 'A1B2c3d4E5f6G7h8I9J0', 'A1B2c3d4E5f6G7h8I9j0', 'A1B2c3d4E5f6G7h8i9j0', 'A1B2c3d4E5f6G7h8i9J0', 'A1B2c3d4E5f6G7H8i9J0', 'A1B2c3d4E5f6G7H8i9j0', 'A1B2c3d4E5f6G7H8I9j0', 'A1B2c3d4E5f6G7H8I9J0', 'A1B2c3d4e5f6G7H8I9J0', 'A1B2c3d4e5f6G7H8I9j0', 'A1B2c3d4e5f6G7H8i9j0', 'A1B2c3d4e5f6G7H8i9J0', 'A1B2c3d4e5f6G7h8i9J0', 'A1B2c3d4e5f6G7h8i9j0', 'A1B2c3d4e5f6G7h8I9j0', 'A1B2c3d4e5f6G7h8I9J0', 'A1B2c3d4e5f6g7h8I9J0', 'A1B2c3d4e5f6g7h8I9j0', 'A1B2c3d4e5f6g7h8i9j0', 'A1B2c3d4e5f6g7h8i9J0', 'A1B2c3d4e5f6g7H8i9J0', 'A1B2c3d4e5f6g7H8i9j0', 'A1B2c3d4e5f6g7H8I9j0', 'A1B2c3d4e5f6g7H8I9J0', 'A1B2c3d4e5F6g7H8I9J0', 'A1B2c3d4e5F6g7H8I9j0', 'A1B2c3d4e5F6g7H8i9j0', 'A1B2c3d4e5F6g7H8i9J0', 'A1B2c3d4e5F6g7h8i9J0', 'A1B2c3d4e5F6g7h8i9j0', 'A1B2c3d4e5F6g7h8I9j0', 'A1B2c3d4e5F6g7h8I9J0', 'A1B2c3d4e5F6G7h8I9J0', 'A1B2c3d4e5F6G7h8I9j0', 'A1B2c3d4e5F6G7h8i9j0', 'A1B2c3d4e5F6G7h8i9J0', 'A1B2c3d4e5F6G7H8i9J0', 'A1B2c3d4e5F6G7H8i9j0', 'A1B2c3d4e5F6G7H8I9j0', 'A1B2c3d4e5F6G7H8I9J0', 'A1B2c3D4e5F6G7H8I9J0', 'A1B2c3D4e5F6G7H8I9j0', 'A1B2c3D4e5F6G7H8i9j0', 'A1B2c3D4e5F6G7H8i9J0', 'A1B2c3D4e5F6G7h8i9J0', 'A1B2c3D4e5F6G7h8i9j0', 'A1B2c3D4e5F6G7h8I9j0', 'A1B2c3D4e5F6G7h8I9J0', 'A1B2c3D4e5F6g7h8I9J0', 'A1B2c3D4e5F6g7h8I9j0', 'A1B2c3D4e5F6g7h8i9j0', 'A1B2c3D4e5F6g7h8i9J0', 'A1B2c3D4e5F6g7H8i9J0', 'A1B2c3D4e5F6g7H8i9j0', 'A1B2c3D4e5F6g7H8I9j0', 'A1B2c3D4e5F6g7H8I9J0', 'A1B2c3D4e5f6g7H8I9J0', 'A1B2c3D4e5f6g7H8I9j0', 'A1B2c3D4e5f6g7H8i9j0', 'A1B2c3D4e5f6g7H8i9J0', 'A1B2c3D4e5f6g7h8i9J0', 'A1B2c3D4e5f6g7h8i9j0', 'A1B2c3D4e5f6g7h8I9j0', 'A1B2c3D4e5f6g7h8I9J0', 'A1B2c3D4e5f6G7h8I9J0', 'A1B2c3D4e5f6G7h8I9j0', 'A1B2c3D4e5f6G7h8i9j0', 'A1B2c3D4e5f6G7h8i9J0', 'A1B2c3D4e5f6G7H8i9J0', 'A1B2c3D4e5f6G7H8i9j0', 'A1B2c3D4e5f6G7H8I9j0', 'A1B2c3D4e5f6G7H8I9J0', 'A1B2c3D4E5f6G7H8I9J0', 'A1B2c3D4E5f6G7H8I9j0', 'A1B2c3D4E5f6G7H8i9j0', 'A1B2c3D4E5f6G7H8i9J0', 'A1B2c3D4E5f6G7h8i9J0', 'A1B2c3D4E5f6G7h8i9j0', 'A1B2c3D4E5f6G7h8I9j0', 'A1B2c3D4E5f6G7h8I9J0', 'A1B2c3D4E5f6g7h8I9J0', 'A1B2c3D4E5f6g7h8I9j0', 'A1B2c3D4E5f6g7h8i9j0', 'A1B2c3D4E5f6g7h8i9J0', 'A1B2c3D4E5f6g7H8i9J0', 'A1B2c3D4E5f6g7H8i9j0', 'A1B2c3D4E5f6g7H8I9j0', 'A1B2c3D4E5f6g7H8I9J0', 'A1B2c3D4E5F6g7H8I9J0', 'A1B2c3D4E5F6g7H8I9j0', 'A1B2c3D4E5F6g7H8i9j0', 'A1B2c3D4E5F6g7H8i9J0', 'A1B2c3D4E5F6g7h8i9J0', 'A1B2c3D4E5F6g7h8i9j0', 'A1B2c3D4E5F6g7h8I9j0', 'A1B2c3D4E5F6g7h8I9J0', 'A1B2c3D4E5F6G7h8I9J0', 'A1B2c3D4E5F6G7h8I9j0', 'A1B2c3D4E5F6G7h8i9j0', 'A1B2c3D4E5F6G7h8i9J0', 'A1B2c3D4E5F6G7H8i9J0', 'A1B2c3D4E5F6G7H8i9j0', 'A1B2c3D4E5F6G7H8I9j0', 'A1B2c3D4E5F6G7H8I9J0', 'A1b2c3D4E5F6G7H8I9J0', 'A1b2c3D4E5F6G7H8I9j0', 'A1b2c3D4E5F6G7H8i9j0', 'A1b2c3D4E5F6G7H8i9J0', 'A1b2c3D4E5F6G7h8i9J0', 'A1b2c3D4E5F6G7h8i9j0', 'A1b2c3D4E5F6G7h8I9j0', 'A1b2c3D4E5F6G7h8I9J0', 'A1b2c3D4E5F6g7h8I9J0', 'A1b2c3D4E5F6g7h8I9j0', 'A1b2c3D4E5F6g7h8i9j0', 'A1b2c3D4E5F6g7h8i9J0', 'A1b2c3D4E5F6g7H8i9J0', 'A1b2c3D4E5F6g7H8i9j0', 'A1b2c3D4E5F6g7H8I9j0', 'A1b2c3D4E5F6g7H8I9J0', 'A1b2c3D4E5f6g7H8I9J0', 'A1b2c3D4E5f6g7H8I9j0', 'A1b2c3D4E5f6g7H8i9j0', 'A1b2c3D4E5f6g7H8i9J0', 'A1b2c3D4E5f6g7h8i9J0', 'A1b2c3D4E5f6g7h8i9j0', 'A1b2c3D4E5f6g7h8I9j0', 'A1b2c3D4E5f6g7h8I9J0', 'A1b2c3D4E5f6G7h8I9J0', 'A1b2c3D4E5f6G7h8I9j0', 'A1b2c3D4E5f6G7h8i9j0', 'A1b2c3D4E5f6G7h8i9J0', 'A1b2c3D4E5f6G7H8i9J0', 'A1b2c3D4E5f6G7H8i9j0', 'A1b2c3D4E5f6G7H8I9j0', 'A1b2c3D4E5f6G7H8I9J0', 'A1b2c3D4e5f6G7H8I9J0', 'A1b2c3D4e5f6G7H8I9j0', 'A1b2c3D4e5f6G7H8i9j0', 'A1b2c3D4e5f6G7H8i9J0', 'A1b2c3D4e5f6G7h8i9J0', 'A1b2c3D4e5f6G7h8i9j0', 'A1b2c3D4e5f6G7h8I9j0', 'A1b2c3D4e5f6G7h8I9J0', 'A1b2c3D4e5f6g7h8I9J0', 'A1b2c3D4e5f6g7h8I9j0', 'A1b2c3D4e5f6g7h8i9j0', 'A1b2c3D4e5f6g7h8i9J0', 'A1b2c3D4e5f6g7H8i9J0', 'A1b2c3D4e5f6g7H8i9j0', 'A1b2c3D4e5f6g7H8I9j0', 'A1b2c3D4e5f6g7H8I9J0', 'A1b2c3D4e5F6g7H8I9J0', 'A1b2c3D4e5F6g7H8I9j0', 'A1b2c3D4e5F6g7H8i9j0', 'A1b2c3D4e5F6g7H8i9J0', 'A1b2c3D4e5F6g7h8i9J0', 'A1b2c3D4e5F6g7h8i9j0', 'A1b2c3D4e5F6g7h8I9j0', 'A1b2c3D4e5F6g7h8I9J0', 'A1b2c3D4e5F6G7h8I9J0', 'A1b2c3D4e5F6G7h8I9j0', 'A1b2c3D4e5F6G7h8i9j0', 'A1b2c3D4e5F6G7h8i9J0', 'A1b2c3D4e5F6G7H8i9J0', 'A1b2c3D4e5F6G7H8i9j0', 'A1b2c3D4e5F6G7H8I9j0', 'A1b2c3D4e5F6G7H8I9J0', 'A1b2c3d4e5F6G7H8I9J0', 'A1b2c3d4e5F6G7H8I9j0', 'A1b2c3d4e5F6G7H8i9j0', 'A1b2c3d4e5F6G7H8i9J0', 'A1b2c3d4e5F6G7h8i9J0', 'A1b2c3d4e5F6G7h8i9j0', 'A1b2c3d4e5F6G7h8I9j0', 'A1b2c3d4e5F6G7h8I9J0', 'A1b2c3d4e5F6g7h8I9J0', 'A1b2c3d4e5F6g7h8I9j0', 'A1b2c3d4e5F6g7h8i9j0', 'A1b2c3d4e5F6g7h8i9J0', 'A1b2c3d4e5F6g7H8i9J0', 'A1b2c3d4e5F6g7H8i9j0', 'A1b2c3d4e5F6g7H8I9j0', 'A1b2c3d4e5F6g7H8I9J0', 'A1b2c3d4e5f6g7H8I9J0', 'A1b2c3d4e5f6g7H8I9j0', 'A1b2c3d4e5f6g7H8i9j0', 'A1b2c3d4e5f6g7H8i9J0', 'A1b2c3d4e5f6g7h8i9J0', 'A1b2c3d4e5f6g7h8i9j0', 'A1b2c3d4e5f6g7h8I9j0', 'A1b2c3d4e5f6g7h8I9J0', 'A1b2c3d4e5f6G7h8I9J0', 'A1b2c3d4e5f6G7h8I9j0', 'A1b2c3d4e5f6G7h8i9j0', 'A1b2c3d4e5f6G7h8i9J0', 'A1b2c3d4e5f6G7H8i9J0', 'A1b2c3d4e5f6G7H8i9j0', 'A1b2c3d4e5f6G7H8I9j0', 'A1b2c3d4e5f6G7H8I9J0', 'A1b2c3d4E5f6G7H8I9J0', 'A1b2c3d4E5f6G7H8I9j0', 'A1b2c3d4E5f6G7H8i9j0', 'A1b2c3d4E5f6G7H8i9J0', 'A1b2c3d4E5f6G7h8i9J0', 'A1b2c3d4E5f6G7h8i9j0', 'A1b2c3d4E5f6G7h8I9j0', 'A1b2c3d4E5f6G7h8I9J0', 'A1b2c3d4E5f6g7h8I9J0', 'A1b2c3d4E5f6g7h8I9j0', 'A1b2c3d4E5f6g7h8i9j0', 'A1b2c3d4E5f6g7h8i9J0', 'A1b2c3d4E5f6g7H8i9J0', 'A1b2c3d4E5f6g7H8i9j0', 'A1b2c3d4E5f6g7H8I9j0', 'A1b2c3d4E5f6g7H8I9J0', 'A1b2c3d4E5F6g7H8I9J0', 'A1b2c3d4E5F6g7H8I9j0', 'A1b2c3d4E5F6g7H8i9j0', 'A1b2c3d4E5F6g7H8i9J0', 'A1b2c3d4E5F6g7h8i9J0', 'A1b2c3d4E5F6g7h8i9j0', 'A1b2c3d4E5F6g7h8I9j0', 'A1b2c3d4E5F6g7h8I9J0', 'A1b2c3d4E5F6G7h8I9J0', 'A1b2c3d4E5F6G7h8I9j0', 'A1b2c3d4E5F6G7h8i9j0', 'A1b2c3d4E5F6G7h8i9J0', 'A1b2c3d4E5F6G7H8i9J0', 'A1b2c3d4E5F6G7H8i9j0', 'A1b2c3d4E5F6G7H8I9j0', 'A1b2c3d4E5F6G7H8I9J0', 'A1b2C3d4E5F6G7H8I9J0', 'A1b2C3d4E5F6G7H8I9j0', 'A1b2C3d4E5F6G7H8i9j0', 'A1b2C3d4E5F6G7H8i9J0', 'A1b2C3d4E5F6G7h8i9J0', 'A1b2C3d4E5F6G7h8i9j0', 'A1b2C3d4E5F6G7h8I9j0', 'A1b2C3d4E5F6G7h8I9J0', 'A1b2C3d4E5F6g7h8I9J0', 'A1b2C3d4E5F6g7h8I9j0', 'A1b2C3d4E5F6g7h8i9j0', 'A1b2C3d4E5F6g7h8i9J0', 'A1b2C3d4E5F6g7H8i9J0', 'A1b2C3d4E5F6g7H8i9j0', 'A1b2C3d4E5F6g7H8I9j0', 'A1b2C3d4E5F6g7H8I9J0', 'A1b2C3d4E5f6g7H8I9J0', 'A1b2C3d4E5f6g7H8I9j0', 'A1b2C3d4E5f6g7H8i9j0', 'A1b2C3d4E5f6g7H8i9J0', 'A1b2C3d4E5f6g7h8i9J0', 'A1b2C3d4E5f6g7h8i9j0', 'A1b2C3d4E5f6g7h8I9j0', 'A1b2C3d4E5f6g7h8I9J0', 'A1b2C3d4E5f6G7h8I9J0', 'A1b2C3d4E5f6G7h8I9j0', 'A1b2C3d4E5f6G7h8i9j0', 'A1b2C3d4E5f6G7h8i9J0', 'A1b2C3d4E5f6G7H8i9J0', 'A1b2C3d4E5f6G7H8i9j0', 'A1b2C3d4E5f6G7H8I9j0', 'A1b2C3d4E5f6G7H8I9J0', 'A1b2C3d4e5f6G7H8I9J0', 'A1b2C3d4e5f6G7H8I9j0', 'A1b2C3d4e5f6G7H8i9j0', 'A1b2C3d4e5f6G7H8i9J0', 'A1b2C3d4e5f6G7h8i9J0', 'A1b2C3d4e5f6G7h8i9j0', 'A1b2C3d4e5f6G7h8I9j0', 'A1b2C3d4e5f6G7h8I9J0', 'A1b2C3d4e5f6g7h8I9J0', 'A1b2C3d4e5f6g7h8I9j0', 'A1b2C3d4e5f6g7h8i9j0', 'A1b2C3d4e5f6g7h8i9J0', 'A1b2C3d4e5f6g7H8i9J0', 'A1b2C3d4e5f6g7H8i9j0', 'A1b2C3d4e5f6g7H8I9j0', 'A1b2C3d4e5f6g7H8I9J0', 'A1b2C3d4e5F6g7H8I9J0', 'A1b2C3d4e5F6g7H8I9j0', 'A1b2C3d4e5F6g7H8i9j0', 'A1b2C3d4e5F6g7H8i9J0', 'A1b2C3d4e5F6g7h8i9J0', 'A1b2C3d4e5F6g7h8i9j0', 'A1b2C3d4e5F6g7h8I9j0', 'A1b2C3d4e5F6g7h8I9J0', 'A1b2C3d4e5F6G7h8I9J0', 'A1b2C3d4e5F6G7h8I9j0', 'A1b2C3d4e5F6G7h8i9j0', 'A1b2C3d4e5F6G7h8i9J0', 'A1b2C3d4e5F6G7H8i9J0', 'A1b2C3d4e5F6G7H8i9j0', 'A1b2C3d4e5F6G7H8I9j0', 'A1b2C3d4e5F6G7H8I9J0', 'A1b2C3D4e5F6G7H8I9J0', 'A1b2C3D4e5F6G7H8I9j0', 'A1b2C3D4e5F6G7H8i9j0', 'A1b2C3D4e5F6G7H8i9J0', 'A1b2C3D4e5F6G7h8i9J0', 'A1b2C3D4e5F6G7h8i9j0', 'A1b2C3D4e5F6G7h8I9j0', 'A1b2C3D4e5F6G7h8I9J0', 'A1b2C3D4e5F6g7h8I9J0', 'A1b2C3D4e5F6g7h8I9j0', 'A1b2C3D4e5F6g7h8i9j0', 'A1b2C3D4e5F6g7h8i9J0', 'A1b2C3D4e5F6g7H8i9J0', 'A1b2C3D4e5F6g7H8i9j0', 'A1b2C3D4e5F6g7H8I9j0', 'A1b2C3D4e5F6g7H8I9J0', 'A1b2C3D4e5f6g7H8I9J0', 'A1b2C3D4e5f6g7H8I9j0', 'A1b2C3D4e5f6g7H8i9j0', 'A1b2C3D4e5f6g7H8i9J0', 'A1b2C3D4e5f6g7h8i9J0', 'A1b2C3D4e5f6g7h8i9j0', 'A1b2C3D4e5f6g7h8I9j0', 'A1b2C3D4e5f6g7h8I9J0', 'A1b2C3D4e5f6G7h8I9J0', 'A1b2C3D4e5f6G7h8I9j0', 'A1b2C3D4e5f6G7h8i9j0', 'A1b2C3D4e5f6G7h8i9J0', 'A1b2C3D4e5f6G7H8i9J0', 'A1b2C3D4e5f6G7H8i9j0', 'A1b2C3D4e5f6G7H8I9j0', 'A1b2C3D4e5f6G7H8I9J0', 'A1b2C3D4E5f6G7H8I9J0', 'A1b2C3D4E5f6G7H8I9j0', 'A1b2C3D4E5f6G7H8i9j0', 'A1b2C3D4E5f6G7H8i9J0', 'A1b2C3D4E5f6G7h8i9J0', 'A1b2C3D4E5f6G7h8i9j0', 'A1b2C3D4E5f6G7h8I9j0', 'A1b2C3D4E5f6G7h8I9J0', 'A1b2C3D4E5f6g7h8I9J0', 'A1b2C3D4E5f6g7h8I9j0', 'A1b2C3D4E5f6g7h8i9j0', 'A1b2C3D4E5f6g7h8i9J0', 'A1b2C3D4E5f6g7H8i9J0', 'A1b2C3D4E5f6g7H8i9j0', 'A1b2C3D4E5f6g7H8I9j0', 'A1b2C3D4E5f6g7H8I9J0', 'A1b2C3D4E5F6g7H8I9J0', 'A1b2C3D4E5F6g7H8I9j0', 'A1b2C3D4E5F6g7H8i9j0', 'A1b2C3D4E5F6g7H8i9J0', 'A1b2C3D4E5F6g7h8i9J0', 'A1b2C3D4E5F6g7h8i9j0', 'A1b2C3D4E5F6g7h8I9j0', 'A1b2C3D4E5F6g7h8I9J0', 'A1b2C3D4E5F6G7h8I9J0', 'A1b2C3D4E5F6G7h8I9j0', 'A1b2C3D4E5F6G7h8i9j0', 'A1b2C3D4E5F6G7h8i9J0', 'A1b2C3D4E5F6G7H8i9J0', 'A1b2C3D4E5F6G7H8i9j0', 'A1b2C3D4E5F6G7H8I9j0', 'A1b2C3D4E5F6G7H8I9J0', 'a1b2C3D4E5F6G7H8I9J0', 'a1b2C3D4E5F6G7H8I9j0', 'a1b2C3D4E5F6G7H8i9j0', 'a1b2C3D4E5F6G7H8i9J0', 'a1b2C3D4E5F6G7h8i9J0', 'a1b2C3D4E5F6G7h8i9j0', 'a1b2C3D4E5F6G7h8I9j0', 'a1b2C3D4E5F6G7h8I9J0', 'a1b2C3D4E5F6g7h8I9J0', 'a1b2C3D4E5F6g7h8I9j0', 'a1b2C3D4E5F6g7h8i9j0', 'a1b2C3D4E5F6g7h8i9J0', 'a1b2C3D4E5F6g7H8i9J0', 'a1b2C3D4E5F6g7H8i9j0', 'a1b2C3D4E5F6g7H8I9j0', 'a1b2C3D4E5F6g7H8I9J0', 'a1b2C3D4E5f6g7H8I9J0', 'a1b2C3D4E5f6g7H8I9j0', 'a1b2C3D4E5f6g7H8i9j0', 'a1b2C3D4E5f6g7H8i9J0', 'a1b2C3D4E5f6g7h8i9J0', 'a1b2C3D4E5f6g7h8i9j0', 'a1b2C3D4E5f6g7h8I9j0', 'a1b2C3D4E5f6g7h8I9J0', 'a1b2C3D4E5f6G7h8I9J0', 'a1b2C3D4E5f6G7h8I9j0', 'a1b2C3D4E5f6G7h8i9j0', 'a1b2C3D4E5f6G7h8i9J0', 'a1b2C3D4E5f6G7H8i9J0', 'a1b2C3D4E5f6G7H8i9j0', 'a1b2C3D4E5f6G7H8I9j0', 'a1b2C3D4E5f6G7H8I9J0', 'a1b2C3D4e5f6G7H8I9J0', 'a1b2C3D4e5f6G7H8I9j0', 'a1b2C3D4e5f6G7H8i9j0', 'a1b2C3D4e5f6G7H8i9J0', 'a1b2C3D4e5f6G7h8i9J0', 'a1b2C3D4e5f6G7h8i9j0', 'a1b2C3D4e5f6G7h8I9j0', 'a1b2C3D4e5f6G7h8I9J0', 'a1b2C3D4e5f6g7h8I9J0', 'a1b2C3D4e5f6g7h8I9j0', 'a1b2C3D4e5f6g7h8i9j0', 'a1b2C3D4e5f6g7h8i9J0', 'a1b2C3D4e5f6g7H8i9J0', 'a1b2C3D4e5f6g7H8i9j0', 'a1b2C3D4e5f6g7H8I9j0', 'a1b2C3D4e5f6g7H8I9J0', 'a1b2C3D4e5F6g7H8I9J0', 'a1b2C3D4e5F6g7H8I9j0', 'a1b2C3D4e5F6g7H8i9j0', 'a1b2C3D4e5F6g7H8i9J0', 'a1b2C3D4e5F6g7h8i9J0', 'a1b2C3D4e5F6g7h8i9j0', 'a1b2C3D4e5F6g7h8I9j0', 'a1b2C3D4e5F6g7h8I9J0', 'a1b2C3D4e5F6G7h8I9J0', 'a1b2C3D4e5F6G7h8I9j0', 'a1b2C3D4e5F6G7h8i9j0', 'a1b2C3D4e5F6G7h8i9J0', 'a1b2C3D4e5F6G7H8i9J0', 'a1b2C3D4e5F6G7H8i9j0', 'a1b2C3D4e5F6G7H8I9j0', 'a1b2C3D4e5F6G7H8I9J0', 'a1b2C3d4e5F6G7H8I9J0', 'a1b2C3d4e5F6G7H8I9j0', 'a1b2C3d4e5F6G7H8i9j0', 'a1b2C3d4e5F6G7H8i9J0', 'a1b2C3d4e5F6G7h8i9J0', 'a1b2C3d4e5F6G7h8i9j0', 'a1b2C3d4e5F6G7h8I9j0', 'a1b2C3d4e5F6G7h8I9J0', 'a1b2C3d4e5F6g7h8I9J0', 'a1b2C3d4e5F6g7h8I9j0', 'a1b2C3d4e5F6g7h8i9j0', 'a1b2C3d4e5F6g7h8i9J0', 'a1b2C3d4e5F6g7H8i9J0', 'a1b2C3d4e5F6g7H8i9j0', 'a1b2C3d4e5F6g7H8I9j0', 'a1b2C3d4e5F6g7H8I9J0', 'a1b2C3d4e5f6g7H8I9J0', 'a1b2C3d4e5f6g7H8I9j0', 'a1b2C3d4e5f6g7H8i9j0', 'a1b2C3d4e5f6g7H8i9J0', 'a1b2C3d4e5f6g7h8i9J0', 'a1b2C3d4e5f6g7h8i9j0', 'a1b2C3d4e5f6g7h8I9j0', 'a1b2C3d4e5f6g7h8I9J0', 'a1b2C3d4e5f6G7h8I9J0', 'a1b2C3d4e5f6G7h8I9j0', 'a1b2C3d4e5f6G7h8i9j0', 'a1b2C3d4e5f6G7h8i9J0', 'a1b2C3d4e5f6G7H8i9J0', 'a1b2C3d4e5f6G7H8i9j0', 'a1b2C3d4e5f6G7H8I9j0', 'a1b2C3d4e5f6G7H8I9J0', 'a1b2C3d4E5f6G7H8I9J0', 'a1b2C3d4E5f6G7H8I9j0', 'a1b2C3d4E5f6G7H8i9j0', 'a1b2C3d4E5f6G7H8i9J0', 'a1b2C3d4E5f6G7h8i9J0', 'a1b2C3d4E5f6G7h8i9j0', 'a1b2C3d4E5f6G7h8I9j0', 'a1b2C3d4E5f6G7h8I9J0', 'a1b2C3d4E5f6g7h8I9J0', 'a1b2C3d4E5f6g7h8I9j0', 'a1b2C3d4E5f6g7h8i9j0', 'a1b2C3d4E5f6g7h8i9J0', 'a1b2C3d4E5f6g7H8i9J0', 'a1b2C3d4E5f6g7H8i9j0', 'a1b2C3d4E5f6g7H8I9j0', 'a1b2C3d4E5f6g7H8I9J0', 'a1b2C3d4E5F6g7H8I9J0', 'a1b2C3d4E5F6g7H8I9j0', 'a1b2C3d4E5F6g7H8i9j0', 'a1b2C3d4E5F6g7H8i9J0', 'a1b2C3d4E5F6g7h8i9J0', 'a1b2C3d4E5F6g7h8i9j0', 'a1b2C3d4E5F6g7h8I9j0', 'a1b2C3d4E5F6g7h8I9J0', 'a1b2C3d4E5F6G7h8I9J0', 'a1b2C3d4E5F6G7h8I9j0', 'a1b2C3d4E5F6G7h8i9j0', 'a1b2C3d4E5F6G7h8i9J0', 'a1b2C3d4E5F6G7H8i9J0', 'a1b2C3d4E5F6G7H8i9j0', 'a1b2C3d4E5F6G7H8I9j0', 'a1b2C3d4E5F6G7H8I9J0', 'a1b2c3d4E5F6G7H8I9J0', 'a1b2c3d4E5F6G7H8I9j0', 'a1b2c3d4E5F6G7H8i9j0', 'a1b2c3d4E5F6G7H8i9J0', 'a1b2c3d4E5F6G7h8i9J0', 'a1b2c3d4E5F6G7h8i9j0', 'a1b2c3d4E5F6G7h8I9j0', 'a1b2c3d4E5F6G7h8I9J0', 'a1b2c3d4E5F6g7h8I9J0', 'a1b2c3d4E5F6g7h8I9j0', 'a1b2c3d4E5F6g7h8i9j0', 'a1b2c3d4E5F6g7h8i9J0', 'a1b2c3d4E5F6g7H8i9J0', 'a1b2c3d4E5F6g7H8i9j0', 'a1b2c3d4E5F6g7H8I9j0', 'a1b2c3d4E5F6g7H8I9J0', 'a1b2c3d4E5f6g7H8I9J0', 'a1b2c3d4E5f6g7H8I9j0', 'a1b2c3d4E5f6g7H8i9j0', 'a1b2c3d4E5f6g7H8i9J0', 'a1b2c3d4E5f6g7h8i9J0', 'a1b2c3d4E5f6g7h8i9j0', 'a1b2c3d4E5f6g7h8I9j0', 'a1b2c3d4E5f6g7h8I9J0', 'a1b2c3d4E5f6G7h8I9J0', 'a1b2c3d4E5f6G7h8I9j0', 'a1b2c3d4E5f6G7h8i9j0', 'a1b2c3d4E5f6G7h8i9J0', 'a1b2c3d4E5f6G7H8i9J0', 'a1b2c3d4E5f6G7H8i9j0', 'a1b2c3d4E5f6G7H8I9j0', 'a1b2c3d4E5f6G7H8I9J0', 'a1b2c3d4e5f6G7H8I9J0', 'a1b2c3d4e5f6G7H8I9j0', 'a1b2c3d4e5f6G7H8i9j0', 'a1b2c3d4e5f6G7H8i9J0', 'a1b2c3d4e5f6G7h8i9J0', 'a1b2c3d4e5f6G7h8i9j0', 'a1b2c3d4e5f6G7h8I9j0', 'a1b2c3d4e5f6G7h8I9J0', 'a1b2c3d4e5f6g7h8I9J0', 'a1b2c3d4e5f6g7h8I9j0', 'a1b2c3d4e5f6g7h8i9j0', 'a1b2c3d4e5f6g7h8i9J0', 'a1b2c3d4e5f6g7H8i9J0', 'a1b2c3d4e5f6g7H8i9j0', 'a1b2c3d4e5f6g7H8I9j0', 'a1b2c3d4e5f6g7H8I9J0', 'a1b2c3d4e5F6g7H8I9J0', 'a1b2c3d4e5F6g7H8I9j0', 'a1b2c3d4e5F6g7H8i9j0', 'a1b2c3d4e5F6g7H8i9J0', 'a1b2c3d4e5F6g7h8i9J0', 'a1b2c3d4e5F6g7h8i9j0', 'a1b2c3d4e5F6g7h8I9j0', 'a1b2c3d4e5F6g7h8I9J0', 'a1b2c3d4e5F6G7h8I9J0', 'a1b2c3d4e5F6G7h8I9j0', 'a1b2c3d4e5F6G7h8i9j0', 'a1b2c3d4e5F6G7h8i9J0', 'a1b2c3d4e5F6G7H8i9J0', 'a1b2c3d4e5F6G7H8i9j0', 'a1b2c3d4e5F6G7H8I9j0', 'a1b2c3d4e5F6G7H8I9J0', 'a1b2c3D4e5F6G7H8I9J0', 'a1b2c3D4e5F6G7H8I9j0', 'a1b2c3D4e5F6G7H8i9j0', 'a1b2c3D4e5F6G7H8i9J0', 'a1b2c3D4e5F6G7h8i9J0', 'a1b2c3D4e5F6G7h8i9j0', 'a1b2c3D4e5F6G7h8I9j0', 'a1b2c3D4e5F6G7h8I9J0', 'a1b2c3D4e5F6g7h8I9J0', 'a1b2c3D4e5F6g7h8I9j0', 'a1b2c3D4e5F6g7h8i9j0', 'a1b2c3D4e5F6g7h8i9J0', 'a1b2c3D4e5F6g7H8i9J0', 'a1b2c3D4e5F6g7H8i9j0', 'a1b2c3D4e5F6g7H8I9j0', 'a1b2c3D4e5F6g7H8I9J0', 'a1b2c3D4e5f6g7H8I9J0', 'a1b2c3D4e5f6g7H8I9j0', 'a1b2c3D4e5f6g7H8i9j0', 'a1b2c3D4e5f6g7H8i9J0', 'a1b2c3D4e5f6g7h8i9J0', 'a1b2c3D4e5f6g7h8i9j0', 'a1b2c3D4e5f6g7h8I9j0', 'a1b2c3D4e5f6g7h8I9J0', 'a1b2c3D4e5f6G7h8I9J0', 'a1b2c3D4e5f6G7h8I9j0', 'a1b2c3D4e5f6G7h8i9j0', 'a1b2c3D4e5f6G7h8i9J0', 'a1b2c3D4e5f6G7H8i9J0', 'a1b2c3D4e5f6G7H8i9j0', 'a1b2c3D4e5f6G7H8I9j0', 'a1b2c3D4e5f6G7H8I9J0', 'a1b2c3D4E5f6G7H8I9J0', 'a1b2c3D4E5f6G7H8I9j0', 'a1b2c3D4E5f6G7H8i9j0', 'a1b2c3D4E5f6G7H8i9J0', 'a1b2c3D4E5f6G7h8i9J0', 'a1b2c3D4E5f6G7h8i9j0', 'a1b2c3D4E5f6G7h8I9j0', 'a1b2c3D4E5f6G7h8I9J0', 'a1b2c3D4E5f6g7h8I9J0', 'a1b2c3D4E5f6g7h8I9j0', 'a1b2c3D4E5f6g7h8i9j0', 'a1b2c3D4E5f6g7h8i9J0', 'a1b2c3D4E5f6g7H8i9J0', 'a1b2c3D4E5f6g7H8i9j0', 'a1b2c3D4E5f6g7H8I9j0', 'a1b2c3D4E5f6g7H8I9J0', 'a1b2c3D4E5F6g7H8I9J0', 'a1b2c3D4E5F6g7H8I9j0', 'a1b2c3D4E5F6g7H8i9j0', 'a1b2c3D4E5F6g7H8i9J0', 'a1b2c3D4E5F6g7h8i9J0', 'a1b2c3D4E5F6g7h8i9j0', 'a1b2c3D4E5F6g7h8I9j0', 'a1b2c3D4E5F6g7h8I9J0', 'a1b2c3D4E5F6G7h8I9J0', 'a1b2c3D4E5F6G7h8I9j0', 'a1b2c3D4E5F6G7h8i9j0', 'a1b2c3D4E5F6G7h8i9J0', 'a1b2c3D4E5F6G7H8i9J0', 'a1b2c3D4E5F6G7H8i9j0', 'a1b2c3D4E5F6G7H8I9j0', 'a1b2c3D4E5F6G7H8I9J0', 'a1B2c3D4E5F6G7H8I9J0', 'a1B2c3D4E5F6G7H8I9j0', 'a1B2c3D4E5F6G7H8i9j0', 'a1B2c3D4E5F6G7H8i9J0', 'a1B2c3D4E5F6G7h8i9J0', 'a1B2c3D4E5F6G7h8i9j0', 'a1B2c3D4E5F6G7h8I9j0', 'a1B2c3D4E5F6G7h8I9J0', 'a1B2c3D4E5F6g7h8I9J0', 'a1B2c3D4E5F6g7h8I9j0', 'a1B2c3D4E5F6g7h8i9j0', 'a1B2c3D4E5F6g7h8i9J0', 'a1B2c3D4E5F6g7H8i9J0', 'a1B2c3D4E5F6g7H8i9j0', 'a1B2c3D4E5F6g7H8I9j0', 'a1B2c3D4E5F6g7H8I9J0', 'a1B2c3D4E5f6g7H8I9J0', 'a1B2c3D4E5f6g7H8I9j0', 'a1B2c3D4E5f6g7H8i9j0', 'a1B2c3D4E5f6g7H8i9J0', 'a1B2c3D4E5f6g7h8i9J0', 'a1B2c3D4E5f6g7h8i9j0', 'a1B2c3D4E5f6g7h8I9j0', 'a1B2c3D4E5f6g7h8I9J0', 'a1B2c3D4E5f6G7h8I9J0', 'a1B2c3D4E5f6G7h8I9j0', 'a1B2c3D4E5f6G7h8i9j0', 'a1B2c3D4E5f6G7h8i9J0', 'a1B2c3D4E5f6G7H8i9J0', 'a1B2c3D4E5f6G7H8i9j0', 'a1B2c3D4E5f6G7H8I9j0', 'a1B2c3D4E5f6G7H8I9J0', 'a1B2c3D4e5f6G7H8I9J0', 'a1B2c3D4e5f6G7H8I9j0', 'a1B2c3D4e5f6G7H8i9j0', 'a1B2c3D4e5f6G7H8i9J0', 'a1B2c3D4e5f6G7h8i9J0', 'a1B2c3D4e5f6G7h8i9j0', 'a1B2c3D4e5f6G7h8I9j0', 'a1B2c3D4e5f6G7h8I9J0', 'a1B2c3D4e5f6g7h8I9J0', 'a1B2c3D4e5f6g7h8I9j0', 'a1B2c3D4e5f6g7h8i9j0', 'a1B2c3D4e5f6g7h8i9J0', 'a1B2c3D4e5f6g7H8i9J0', 'a1B2c3D4e5f6g7H8i9j0', 'a1B2c3D4e5f6g7H8I9j0', 'a1B2c3D4e5f6g7H8I9J0', 'a1B2c3D4e5F6g7H8I9J0', 'a1B2c3D4e5F6g7H8I9j0', 'a1B2c3D4e5F6g7H8i9j0', 'a1B2c3D4e5F6g7H8i9J0', 'a1B2c3D4e5F6g7h8i9J0', 'a1B2c3D4e5F6g7h8i9j0', 'a1B2c3D4e5F6g7h8I9j0', 'a1B2c3D4e5F6g7h8I9J0', 'a1B2c3D4e5F6G7h8I9J0', 'a1B2c3D4e5F6G7h8I9j0', 'a1B2c3D4e5F6G7h8i9j0', 'a1B2c3D4e5F6G7h8i9J0', 'a1B2c3D4e5F6G7H8i9J0', 'a1B2c3D4e5F6G7H8i9j0', 'a1B2c3D4e5F6G7H8I9j0', 'a1B2c3D4e5F6G7H8I9J0', 'a1B2c3d4e5F6G7H8I9J0', 'a1B2c3d4e5F6G7H8I9j0', 'a1B2c3d4e5F6G7H8i9j0', 'a1B2c3d4e5F6G7H8i9J0', 'a1B2c3d4e5F6G7h8i9J0', 'a1B2c3d4e5F6G7h8i9j0', 'a1B2c3d4e5F6G7h8I9j0', 'a1B2c3d4e5F6G7h8I9J0', 'a1B2c3d4e5F6g7h8I9J0', 'a1B2c3d4e5F6g7h8I9j0', 'a1B2c3d4e5F6g7h8i9j0', 'a1B2c3d4e5F6g7h8i9J0', 'a1B2c3d4e5F6g7H8i9J0', 'a1B2c3d4e5F6g7H8i9j0', 'a1B2c3d4e5F6g7H8I9j0', 'a1B2c3d4e5F6g7H8I9J0', 'a1B2c3d4e5f6g7H8I9J0', 'a1B2c3d4e5f6g7H8I9j0', 'a1B2c3d4e5f6g7H8i9j0', 'a1B2c3d4e5f6g7H8i9J0', 'a1B2c3d4e5f6g7h8i9J0', 'a1B2c3d4e5f6g7h8i9j0', 'a1B2c3d4e5f6g7h8I9j0', 'a1B2c3d4e5f6g7h8I9J0', 'a1B2c3d4e5f6G7h8I9J0', 'a1B2c3d4e5f6G7h8I9j0', 'a1B2c3d4e5f6G7h8i9j0', 'a1B2c3d4e5f6G7h8i9J0', 'a1B2c3d4e5f6G7H8i9J0', 'a1B2c3d4e5f6G7H8i9j0', 'a1B2c3d4e5f6G7H8I9j0', 'a1B2c3d4e5f6G7H8I9J0', 'a1B2c3d4E5f6G7H8I9J0', 'a1B2c3d4E5f6G7H8I9j0', 'a1B2c3d4E5f6G7H8i9j0', 'a1B2c3d4E5f6G7H8i9J0', 'a1B2c3d4E5f6G7h8i9J0', 'a1B2c3d4E5f6G7h8i9j0', 'a1B2c3d4E5f6G7h8I9j0', 'a1B2c3d4E5f6G7h8I9J0', 'a1B2c3d4E5f6g7h8I9J0', 'a1B2c3d4E5f6g7h8I9j0', 'a1B2c3d4E5f6g7h8i9j0', 'a1B2c3d4E5f6g7h8i9J0', 'a1B2c3d4E5f6g7H8i9J0', 'a1B2c3d4E5f6g7H8i9j0', 'a1B2c3d4E5f6g7H8I9j0', 'a1B2c3d4E5f6g7H8I9J0', 'a1B2c3d4E5F6g7H8I9J0', 'a1B2c3d4E5F6g7H8I9j0', 'a1B2c3d4E5F6g7H8i9j0', 'a1B2c3d4E5F6g7H8i9J0', 'a1B2c3d4E5F6g7h8i9J0', 'a1B2c3d4E5F6g7h8i9j0', 'a1B2c3d4E5F6g7h8I9j0', 'a1B2c3d4E5F6g7h8I9J0', 'a1B2c3d4E5F6G7h8I9J0', 'a1B2c3d4E5F6G7h8I9j0', 'a1B2c3d4E5F6G7h8i9j0', 'a1B2c3d4E5F6G7h8i9J0', 'a1B2c3d4E5F6G7H8i9J0', 'a1B2c3d4E5F6G7H8i9j0', 'a1B2c3d4E5F6G7H8I9j0', 'a1B2c3d4E5F6G7H8I9J0', 'a1B2C3d4E5F6G7H8I9J0', 'a1B2C3d4E5F6G7H8I9j0', 'a1B2C3d4E5F6G7H8i9j0', 'a1B2C3d4E5F6G7H8i9J0', 'a1B2C3d4E5F6G7h8i9J0', 'a1B2C3d4E5F6G7h8i9j0', 'a1B2C3d4E5F6G7h8I9j0', 'a1B2C3d4E5F6G7h8I9J0', 'a1B2C3d4E5F6g7h8I9J0', 'a1B2C3d4E5F6g7h8I9j0', 'a1B2C3d4E5F6g7h8i9j0', 'a1B2C3d4E5F6g7h8i9J0', 'a1B2C3d4E5F6g7H8i9J0', 'a1B2C3d4E5F6g7H8i9j0', 'a1B2C3d4E5F6g7H8I9j0', 'a1B2C3d4E5F6g7H8I9J0', 'a1B2C3d4E5f6g7H8I9J0', 'a1B2C3d4E5f6g7H8I9j0', 'a1B2C3d4E5f6g7H8i9j0', 'a1B2C3d4E5f6g7H8i9J0', 'a1B2C3d4E5f6g7h8i9J0', 'a1B2C3d4E5f6g7h8i9j0', 'a1B2C3d4E5f6g7h8I9j0', 'a1B2C3d4E5f6g7h8I9J0', 'a1B2C3d4E5f6G7h8I9J0', 'a1B2C3d4E5f6G7h8I9j0', 'a1B2C3d4E5f6G7h8i9j0', 'a1B2C3d4E5f6G7h8i9J0', 'a1B2C3d4E5f6G7H8i9J0', 'a1B2C3d4E5f6G7H8i9j0', 'a1B2C3d4E5f6G7H8I9j0', 'a1B2C3d4E5f6G7H8I9J0', 'a1B2C3d4e5f6G7H8I9J0', 'a1B2C3d4e5f6G7H8I9j0', 'a1B2C3d4e5f6G7H8i9j0', 'a1B2C3d4e5f6G7H8i9J0', 'a1B2C3d4e5f6G7h8i9J0', 'a1B2C3d4e5f6G7h8i9j0', 'a1B2C3d4e5f6G7h8I9j0', 'a1B2C3d4e5f6G7h8I9J0', 'a1B2C3d4e5f6g7h8I9J0', 'a1B2C3d4e5f6g7h8I9j0', 'a1B2C3d4e5f6g7h8i9j0', 'a1B2C3d4e5f6g7h8i9J0', 'a1B2C3d4e5f6g7H8i9J0', 'a1B2C3d4e5f6g7H8i9j0', 'a1B2C3d4e5f6g7H8I9j0', 'a1B2C3d4e5f6g7H8I9J0', 'a1B2C3d4e5F6g7H8I9J0', 'a1B2C3d4e5F6g7H8I9j0', 'a1B2C3d4e5F6g7H8i9j0', 'a1B2C3d4e5F6g7H8i9J0', 'a1B2C3d4e5F6g7h8i9J0', 'a1B2C3d4e5F6g7h8i9j0', 'a1B2C3d4e5F6g7h8I9j0', 'a1B2C3d4e5F6g7h8I9J0', 'a1B2C3d4e5F6G7h8I9J0', 'a1B2C3d4e5F6G7h8I9j0', 'a1B2C3d4e5F6G7h8i9j0', 'a1B2C3d4e5F6G7h8i9J0', 'a1B2C3d4e5F6G7H8i9J0', 'a1B2C3d4e5F6G7H8i9j0', 'a1B2C3d4e5F6G7H8I9j0', 'a1B2C3d4e5F6G7H8I9J0', 'a1B2C3D4e5F6G7H8I9J0', 'a1B2C3D4e5F6G7H8I9j0', 'a1B2C3D4e5F6G7H8i9j0', 'a1B2C3D4e5F6G7H8i9J0', 'a1B2C3D4e5F6G7h8i9J0', 'a1B2C3D4e5F6G7h8i9j0', 'a1B2C3D4e5F6G7h8I9j0', 'a1B2C3D4e5F6G7h8I9J0', 'a1B2C3D4e5F6g7h8I9J0', 'a1B2C3D4e5F6g7h8I9j0', 'a1B2C3D4e5F6g7h8i9j0', 'a1B2C3D4e5F6g7h8i9J0', 'a1B2C3D4e5F6g7H8i9J0', 'a1B2C3D4e5F6g7H8i9j0', 'a1B2C3D4e5F6g7H8I9j0', 'a1B2C3D4e5F6g7H8I9J0', 'a1B2C3D4e5f6g7H8I9J0', 'a1B2C3D4e5f6g7H8I9j0', 'a1B2C3D4e5f6g7H8i9j0', 'a1B2C3D4e5f6g7H8i9J0', 'a1B2C3D4e5f6g7h8i9J0', 'a1B2C3D4e5f6g7h8i9j0', 'a1B2C3D4e5f6g7h8I9j0', 'a1B2C3D4e5f6g7h8I9J0', 'a1B2C3D4e5f6G7h8I9J0', 'a1B2C3D4e5f6G7h8I9j0', 'a1B2C3D4e5f6G7h8i9j0', 'a1B2C3D4e5f6G7h8i9J0', 'a1B2C3D4e5f6G7H8i9J0', 'a1B2C3D4e5f6G7H8i9j0', 'a1B2C3D4e5f6G7H8I9j0', 'a1B2C3D4e5f6G7H8I9J0', 'a1B2C3D4E5f6G7H8I9J0', 'a1B2C3D4E5f6G7H8I9j0', 'a1B2C3D4E5f6G7H8i9j0', 'a1B2C3D4E5f6G7H8i9J0', 'a1B2C3D4E5f6G7h8i9J0', 'a1B2C3D4E5f6G7h8i9j0', 'a1B2C3D4E5f6G7h8I9j0', 'a1B2C3D4E5f6G7h8I9J0', 'a1B2C3D4E5f6g7h8I9J0', 'a1B2C3D4E5f6g7h8I9j0', 'a1B2C3D4E5f6g7h8i9j0', 'a1B2C3D4E5f6g7h8i9J0', 'a1B2C3D4E5f6g7H8i9J0', 'a1B2C3D4E5f6g7H8i9j0', 'a1B2C3D4E5f6g7H8I9j0', 'a1B2C3D4E5f6g7H8I9J0', 'a1B2C3D4E5F6g7H8I9J0', 'a1B2C3D4E5F6g7H8I9j0', 'a1B2C3D4E5F6g7H8i9j0', 'a1B2C3D4E5F6g7H8i9J0', 'a1B2C3D4E5F6g7h8i9J0', 'a1B2C3D4E5F6g7h8i9j0', 'a1B2C3D4E5F6g7h8I9j0', 'a1B2C3D4E5F6g7h8I9J0', 'a1B2C3D4E5F6G7h8I9J0', 'a1B2C3D4E5F6G7h8I9j0', 'a1B2C3D4E5F6G7h8i9j0', 'a1B2C3D4E5F6G7h8i9J0', 'a1B2C3D4E5F6G7H8i9J0', 'a1B2C3D4E5F6G7H8i9j0', 'a1B2C3D4E5F6G7H8I9j0', 'a1B2C3D4E5F6G7H8I9J0']\n assert candidate(s = \"A1b2C3d4E5f6\") == ['A1b2C3d4E5f6', 'A1b2C3d4E5F6', 'A1b2C3d4e5F6', 'A1b2C3d4e5f6', 'A1b2C3D4e5f6', 'A1b2C3D4e5F6', 'A1b2C3D4E5F6', 'A1b2C3D4E5f6', 'A1b2c3D4E5f6', 'A1b2c3D4E5F6', 'A1b2c3D4e5F6', 'A1b2c3D4e5f6', 'A1b2c3d4e5f6', 'A1b2c3d4e5F6', 'A1b2c3d4E5F6', 'A1b2c3d4E5f6', 'A1B2c3d4E5f6', 'A1B2c3d4E5F6', 'A1B2c3d4e5F6', 'A1B2c3d4e5f6', 'A1B2c3D4e5f6', 'A1B2c3D4e5F6', 'A1B2c3D4E5F6', 'A1B2c3D4E5f6', 'A1B2C3D4E5f6', 'A1B2C3D4E5F6', 'A1B2C3D4e5F6', 'A1B2C3D4e5f6', 'A1B2C3d4e5f6', 'A1B2C3d4e5F6', 'A1B2C3d4E5F6', 'A1B2C3d4E5f6', 'a1B2C3d4E5f6', 'a1B2C3d4E5F6', 'a1B2C3d4e5F6', 'a1B2C3d4e5f6', 'a1B2C3D4e5f6', 'a1B2C3D4e5F6', 'a1B2C3D4E5F6', 'a1B2C3D4E5f6', 'a1B2c3D4E5f6', 'a1B2c3D4E5F6', 'a1B2c3D4e5F6', 'a1B2c3D4e5f6', 'a1B2c3d4e5f6', 'a1B2c3d4e5F6', 'a1B2c3d4E5F6', 'a1B2c3d4E5f6', 'a1b2c3d4E5f6', 'a1b2c3d4E5F6', 'a1b2c3d4e5F6', 'a1b2c3d4e5f6', 'a1b2c3D4e5f6', 'a1b2c3D4e5F6', 'a1b2c3D4E5F6', 'a1b2c3D4E5f6', 'a1b2C3D4E5f6', 'a1b2C3D4E5F6', 'a1b2C3D4e5F6', 'a1b2C3D4e5f6', 'a1b2C3d4e5f6', 'a1b2C3d4e5F6', 'a1b2C3d4E5F6', 'a1b2C3d4E5f6']\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().letterCasePermutation", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var letterCasePermutation = function(s) {", "container": null, "callable": "letterCasePermutation", "parameters": [{"name": "s", "type": "string"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 785, "task_id": "is-graph-bipartite", "difficulty": "Medium", "problem_description": "There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. More formally, for each v in graph[u], there is an undirected edge between node u and node v. The graph has the following properties:\n\nThere are no self-edges (graph[u] does not contain u).\nThere are no parallel edges (graph[u] does not contain duplicate values).\nIf v is in graph[u], then u is in graph[v] (the graph is undirected).\nThe graph may not be connected, meaning there may be two nodes u and v such that there is no path between them.\n\nA graph is bipartite if the nodes can be partitioned into two independent sets A and B such that every edge in the graph connects a node in set A and a node in set B.\nReturn true if and only if it is bipartite.\n \nExample 1:\n\n\nInput: graph = [[1,2,3],[0,2],[0,1,3],[0,2]]\nOutput: false\nExplanation: There is no way to partition the nodes into two independent sets such that every edge connects a node in one and a node in the other.\nExample 2:\n\n\nInput: graph = [[1,3],[0,2],[1,3],[0,2]]\nOutput: true\nExplanation: We can partition the nodes into two sets: {0, 2} and {1, 3}.\n \nConstraints:\n\ngraph.length == n\n1 <= n <= 100\n0 <= graph[u].length < n\n0 <= graph[u][i] <= n - 1\ngraph[u] does not contain u.\nAll the values of graph[u] are unique.\nIf graph[u] contains v, then graph[v] contains u.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(graph = [[], [3], [], [1]]) == True\n assert candidate(graph = [[], [2, 4, 6], [1, 4, 8, 9], [7, 8], [1, 2, 8, 9], [6, 9], [1, 5, 7, 8, 9], [3, 6, 9], [2, 3, 4, 6, 9], [2, 4, 5, 6, 7, 8]]) == False\n assert candidate(graph = [[1, 3], [0, 2], [1, 3], [0, 2]]) == True\n assert candidate(graph = [[2, 4], [2, 4], [0, 1, 3, 4], [2, 4], [0, 1, 2, 3]]) == False\n assert candidate(graph = [[], [2], [1, 3], [2], [6], [7, 8], [4], [5], [5]]) == True\n assert candidate(graph = [[], [2, 4, 6], [1, 4, 8, 9], [7, 8], [1, 3, 8, 9], [6, 9], [1, 5, 7, 8, 9], [3, 6, 9], [1, 3, 5, 6, 9], [2, 3, 4, 5, 6, 7]]) == False\n assert candidate(graph = [[], [2, 3, 6], [1, 4, 5, 6, 7, 8], [1, 4, 5, 6, 7, 8], [2, 3], [2, 3], [1, 2, 3, 7, 8], [2, 6, 8], [2, 6, 7]]) == False\n assert candidate(graph = [[3, 4, 6], [3, 6], [3, 6], [0, 1, 2, 5], [0, 6], [3], [0, 1, 2, 4]]) == False\n assert candidate(graph = [[], [3], [3], [1, 2]]) == True\n assert candidate(graph = [[2, 3, 4], [3, 4], [0, 4], [0, 1], [0, 1, 2]]) == False\n assert candidate(graph = [[2, 4], [2, 3, 4, 5], [0, 1, 4, 5], [1], [0, 1, 2], [1, 2]]) == False\n assert candidate(graph = [[2, 3], [2, 4, 5, 7], [0, 1, 5], [0, 6], [1], [1, 2, 6], [3, 5], [1]]) == False\n assert candidate(graph = [[1, 2, 3], [0, 2], [0, 1, 3], [0, 2]]) == False\n assert candidate(graph = [[2], [2, 3, 4], [0, 1], [1], [1]]) == True\n assert candidate(graph = [[1], [0]]) == True\n assert candidate(graph = [[3], [2, 4], [1], [0, 4], [1, 3]]) == True\n assert candidate(graph = [[1], [0], [3, 4], [2], [2], [6], [5], [9], [9], [7, 8]]) == True\n assert candidate(graph = [[], [3, 4, 6], [4, 6, 8], [1, 4, 5], [1, 2, 3, 5, 6, 7, 8], [3, 4, 6, 7], [1, 2, 4, 5, 7, 8], [4, 5, 6, 8], [2, 4, 5, 6, 7]]) == False\n assert candidate(graph = [[1, 2, 3, 4], [0, 3, 4], [0, 3], [0, 1, 2, 4], [0, 1, 3]]) == False\n assert candidate(graph = [[1, 4, 5], [0, 2], [1, 3, 4, 5], [2], [0, 1, 2, 5], [0, 1, 2, 4]]) == False\n assert candidate(graph = [[1, 4, 6], [0, 5, 7], [3, 6, 8], [2, 6, 9], [0, 5, 7, 10], [1, 4, 7, 8, 10], [0, 2, 3, 7, 8, 11], [1, 4, 6, 8, 9, 11], [2, 5, 6, 7, 10, 12], [3, 6, 7, 12], [4, 5, 8, 9, 12], [6, 7, 10], [8, 9, 10, 11]]) == False\n assert candidate(graph = [[1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 7, 8]]) == False\n assert candidate(graph = [[1], [0], [3, 5, 7, 8], [2, 5, 7, 8], [2, 5, 6, 8], [2, 3, 4, 6, 7], [4, 5, 7, 8], [2, 3, 5, 6, 8], [2, 3, 4, 6, 7]]) == False\n assert candidate(graph = [[1, 3, 5, 7, 9], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9]]) == True\n assert candidate(graph = [[1, 3, 5, 7, 9, 11], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 11], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 11], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 11], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 11], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 11], [0, 2, 4, 6, 8, 10]]) == True\n assert candidate(graph = [[1, 5], [0, 2, 6], [1, 3], [2, 5], [5], [0, 3, 4], [1]]) == False\n assert candidate(graph = [[1, 5, 6], [0, 2, 3, 4], [1, 3], [1, 2], [1, 5], [0, 4], [0]]) == False\n assert candidate(graph = [[1, 5], [0, 6], [6, 3, 4], [2, 5], [2, 6], [0, 3, 6], [1, 2, 4, 5]]) == False\n assert candidate(graph = [[1, 2, 3], [0, 2, 4], [0, 1, 3], [0, 2, 4], [1, 3]]) == False\n assert candidate(graph = [[1, 5, 7], [0, 2, 6], [1, 3], [2, 5, 7], [5, 6], [0, 2, 3, 4, 6], [1, 4, 5, 7], [0, 3, 5, 6], [9, 11, 12], [8, 10, 13], [9], [8, 13, 14], [8, 14, 15], [9, 10, 16], [11, 12, 17, 18], [12, 18], [13, 16, 17], [14, 16], [14, 15, 17]]) == False\n assert candidate(graph = [[2, 3, 4], [2, 3, 5], [0, 1], [0, 1, 5], [0], [1, 3]]) == False\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]]) == False\n assert candidate(graph = [[1], [0, 2, 6, 8], [1, 3, 4, 5], [2], [2], [2], [1, 7, 8], [6, 8, 9], [1, 6, 7, 9], [7, 8]]) == False\n assert candidate(graph = [[1, 2, 5], [0, 2, 4], [0, 1, 3, 4], [2], [1, 2], [0]]) == False\n assert candidate(graph = [[1, 4, 6, 8], [0, 3, 5, 7], [4, 6, 8], [1, 5, 7], [0, 2, 6], [1, 3, 7], [0, 2, 4, 8], [1, 3, 5], [0, 2, 4, 6]]) == False\n assert candidate(graph = [[1, 3, 4, 6], [0, 2, 4, 7], [1, 3, 5, 7], [0, 2, 6, 8], [0, 1, 5, 9], [2, 4, 6, 10], [0, 3, 5, 11], [1, 2, 8, 10], [3, 7, 9, 11], [4, 8, 10], [5, 7, 9, 11], [6, 7, 8, 10]]) == False\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8]]) == False\n assert candidate(graph = [[1], [0], [3], [2, 5], [6], [3, 6], [4], [8], [7, 9], [8]]) == True\n assert candidate(graph = [[1, 5, 9], [0, 4, 8], [3, 4, 6, 10], [2, 5, 11], [1, 5, 10], [0, 4, 8, 9, 11], [2, 7, 10], [6, 11], [1, 4, 9, 10], [0, 4, 8, 11], [2, 5, 6, 8, 10], [3, 5, 7, 9]]) == False\n assert candidate(graph = [[1, 3, 7], [0, 2, 4, 6], [1, 3, 6, 8], [0, 2, 5, 7], [1, 5, 7], [3, 4, 6, 8], [1, 2, 4, 5, 7], [0, 3, 4, 6, 8], [2, 5, 7]]) == False\n assert candidate(graph = [[1, 2], [0, 3, 4], [0, 3], [1, 2], [1, 5], [4, 6], [5]]) == True\n assert candidate(graph = [[], [2, 4, 6], [1, 4, 8, 9], [6, 7, 8], [1, 2, 8, 9], [6, 9], [1, 3, 5, 7, 8, 9], [3, 6], [1, 2, 3, 4, 9], [2, 4, 5, 6, 7, 8]]) == False\n assert candidate(graph = [[1, 2], [0, 3, 4, 5], [0, 3, 4, 5], [1, 2, 6, 7], [1, 2, 6, 7], [1, 2, 8, 9], [3, 4, 9, 10], [3, 4, 10, 11], [5, 9, 10, 11], [5, 6, 8, 11], [5, 6, 7, 8], [6, 7, 8, 9]]) == False\n assert candidate(graph = [[], [2, 4, 6], [1, 4, 8, 9], [5, 6, 7, 8], [1, 2, 8, 9], [3, 6, 9], [1, 3, 5, 7, 8, 9], [3, 6, 8, 9], [2, 3, 4, 6, 7, 9], [2, 4, 5, 6, 7, 8]]) == False\n assert candidate(graph = [[1, 2, 4, 6], [0, 3, 5, 8], [0, 3, 6, 8], [1, 2, 7, 8], [0, 5, 6, 9], [1, 4, 6, 9], [0, 1, 2, 4, 5, 9], [3, 8], [1, 2, 3, 7], [4, 5, 6]]) == False\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 2, 4, 6, 8, 10, 12, 14], [0, 1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [0, 1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [0, 1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [0, 1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [0, 1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [0, 1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [0, 1, 3, 5, 7, 9, 11, 13, 15]]) == False\n assert candidate(graph = [[1], [0], [3, 4], [2], [2], [6, 7], [5, 7], [5, 6]]) == False\n assert candidate(graph = [[1, 2, 3], [0, 4, 5], [0, 4, 6], [0, 5, 6], [1, 2, 7], [1, 3, 7], [2, 3, 8], [4, 5, 8], [6, 7, 9], [8]]) == False\n assert candidate(graph = [[1, 2, 3], [0, 4, 5], [0, 4], [0, 5], [1, 2], [1, 3]]) == True\n assert candidate(graph = [[1, 2, 3], [0, 4, 5], [0, 4, 6], [0, 5, 6], [1, 2], [1, 3], [2, 3]]) == True\n assert candidate(graph = [[1, 3, 5, 7, 9], [0, 2, 4, 6, 8, 10], [1], [0, 4, 6, 8, 10], [1, 3], [0, 6, 8, 10], [1, 3, 5], [0, 8, 10], [1, 3, 5, 7], [0, 6, 8], [1, 3, 5, 7, 9]]) == True\n assert candidate(graph = [[1, 5], [0, 2, 6], [1, 3], [2, 4, 6], [3, 5], [0, 4], [1, 3]]) == True\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 2, 4, 6, 8, 10, 12, 14], [0, 1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [0, 1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15], [0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14], [0, 2, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 3, 4, 6, 7, 9, 10, 11, 12, 13, 14, 15], [0, 2, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15], [0, 1, 3, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15], [0, 2, 4, 6, 7, 8, 9, 10, 12, 13, 14, 15], [0, 1, 3, 4, 6, 7, 8, 9, 10, 11, 13, 14, 15], [0, 2, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15], [0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15], [0, 1, 3, 5, 7, 9, 11, 13, 14]]) == False\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]) == False\n assert candidate(graph = [[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]]) == True\n assert candidate(graph = [[1, 2, 3, 4, 5, 6], [0, 2, 3, 4, 5, 6], [0, 1, 3, 4, 5, 6], [0, 1, 2, 4, 5, 6], [0, 1, 2, 3, 5, 6], [0, 1, 2, 3, 4, 6], [0, 1, 2, 3, 4, 5]]) == False\n assert candidate(graph = [[1, 2], [0, 3], [0, 4], [1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6], [7]]) == True\n assert candidate(graph = [[1, 5], [0, 2, 6], [1, 3], [2, 4, 6], [3, 5], [0, 4, 6], [1, 3, 5]]) == True\n assert candidate(graph = [[1, 4], [0, 2, 5], [1, 3, 6], [2, 7], [0, 8], [1, 9], [2, 10], [3, 11], [4, 12], [5, 13], [6, 14], [7, 15], [8, 16], [9, 17], [10, 18], [11, 19], [12], [13], [14], [15]]) == True\n assert candidate(graph = [[1], [0, 3, 4], [5, 6, 7], [1], [1], [2], [2], [2]]) == True\n assert candidate(graph = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18], [19, 20, 21], [22, 23, 24], [25, 26, 27], [28, 29, 30], [0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14], [15, 16, 17], [18, 19, 20], [21, 22, 23], [24, 25, 26], [27, 28, 29], [30, 0, 1], [2, 3, 4], [5, 6, 7], [8, 9, 10], [11, 12, 13], [14, 15, 16], [17, 18, 19], [20, 21, 22], [23, 24, 25], [26, 27, 28], [29, 30, 0], [1, 2, 3]]) == False\n assert candidate(graph = [[1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8]]) == True\n assert candidate(graph = [[1, 2, 3], [0, 4, 5], [0, 4, 5], [0, 6, 7], [1, 2, 6, 7], [1, 2, 8, 9], [3, 4, 9, 10], [3, 4, 10, 11], [5, 9, 10, 11], [4, 6, 8, 11], [5, 6, 7, 8], [6, 7, 8, 9]]) == False\n assert candidate(graph = [[1, 2], [0, 3, 8, 9], [0, 4, 6, 9], [1, 5, 7, 8], [2, 6, 8, 9], [3, 7, 8, 9], [2, 4, 5, 7, 8, 9], [3, 5, 6, 8, 9], [1, 3, 4, 5, 6, 7, 9], [1, 2, 3, 4, 5, 6, 7, 8]]) == False\n assert candidate(graph = [[], [2, 4, 6], [1, 4, 8, 9], [7, 8], [1, 2, 8, 9], [6, 8, 9], [1, 5, 7, 8, 9], [3, 6, 9], [2, 3, 4, 6, 9], [2, 3, 4, 5, 6, 7]]) == False\n assert candidate(graph = [[1, 2, 6], [0, 3, 5], [0, 3, 6, 7], [1, 2, 5, 8], [5, 6, 9], [1, 3, 4, 6, 8], [0, 2, 3, 4, 5, 7, 9], [2, 6, 8], [3, 5, 7], [4, 6]]) == False\n assert candidate(graph = [[1, 4], [0, 2, 5], [1, 3, 6], [2, 7], [0, 6, 8], [1, 7, 9], [2, 4, 10], [3, 5, 11], [4, 10, 12], [5, 11, 13], [6, 8, 12], [7, 9, 13], [8, 10, 14], [9, 11, 14], [12, 13]]) == False\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8]]) == False\n assert candidate(graph = [[1, 2], [0], [0], [4], [3], [6, 7, 8], [5], [5, 8], [5, 7], [10, 11, 12], [9], [9], [9], [14], [13]]) == False\n assert candidate(graph = [[1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [1, 3, 5, 7, 9, 11, 13, 15], [0, 2, 4, 6, 8, 10, 12, 14], [0, 2, 4, 6, 8, 10, 12, 14]]) == False\n assert candidate(graph = [[1], [0, 3, 4], [3], [1, 2], [1]]) == True\n assert candidate(graph = [[1, 4, 5], [0, 2, 3, 6], [1, 3, 4, 5, 6], [1, 2, 6], [0, 2], [0, 2], [1, 3]]) == False\n assert candidate(graph = [[1], [0, 3, 4], [3], [1, 2, 5], [1], [3, 6], [5, 7], [6]]) == True\n assert candidate(graph = [[1], [0], [3, 4], [2, 4], [2, 3], [6, 7, 8], [5, 7, 8], [5, 6, 8], [5, 6, 7], [10, 11, 12, 13], [9, 11, 13], [9, 10, 12], [9, 11], [9, 10]]) == False\n assert candidate(graph = [[1, 2], [0, 3], [0, 3, 4], [1, 2, 4], [2, 3, 5], [4]]) == False\n assert candidate(graph = [[1, 2, 4, 6, 8], [0, 3, 5, 7, 9], [0, 3, 5, 7, 9], [1, 2, 6, 8, 9], [0, 2, 6, 8, 9], [1, 2, 4, 8, 9], [0, 3, 4, 7, 9], [1, 3, 4, 6, 8], [0, 3, 4, 5, 6], [1, 2, 4, 5, 7]]) == False\n assert candidate(graph = [[2, 4, 6], [2, 5, 7], [0, 1, 8], [7, 9], [0, 9], [1, 9], [0, 8], [1, 6, 8], [2, 6, 7, 9], [3, 4, 5, 7, 8]]) == False\n assert candidate(graph = [[1, 3, 5], [0, 4, 6], [4, 7], [0, 5], [1, 7, 8], [0, 3], [1], [2, 4], [4]]) == False\n assert candidate(graph = [[1], [0], [], [4, 5], [3, 5], [3, 4], [7, 8], [6, 8], [6, 7]]) == False\n assert candidate(graph = [[1, 3, 4, 6], [0, 2, 5, 7], [1, 3, 5, 8], [0, 2, 6, 9], [0, 7, 8, 9], [1, 2, 6, 7, 8, 9], [0, 1, 3, 5, 7, 8, 9], [1, 4, 5, 6, 8, 9], [2, 4, 5, 6, 7, 9], [3, 4, 5, 6, 7, 8]]) == False\n assert candidate(graph = [[1], [0, 3, 4, 5], [3, 4, 5], [1, 2], [1, 2, 5, 6], [1, 2, 4, 6], [4, 5]]) == False\n assert candidate(graph = [[1, 2, 5, 7, 8], [0, 2, 4, 6, 9], [0, 1, 3, 4, 8], [2, 5, 7, 9], [1, 2, 6], [0, 3, 4, 7, 8, 9], [1, 4, 8], [0, 3, 4, 5, 8], [0, 2, 5, 6, 7], [1, 3, 5, 7]]) == False\n assert candidate(graph = [[1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6]]) == True\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28], [0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]]) == False\n assert candidate(graph = [[1, 2, 3], [0, 2], [0, 1, 3], [0, 2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7], [10], [9]]) == False\n assert candidate(graph = [[1, 4, 5, 6], [0, 2, 5, 7], [1, 3, 6, 7], [2, 4, 6, 7], [0, 3, 5, 7], [0, 1, 4, 7], [0, 1, 2, 7], [1, 2, 3, 4, 5, 6]]) == False\n assert candidate(graph = [[1, 2, 5, 7], [0, 3, 6], [0, 4, 7], [1, 5], [2, 6], [0, 3, 4], [1, 4], [0, 2]]) == False\n assert candidate(graph = [[1, 3, 4], [0, 4, 5], [4, 5, 6], [0, 6], [0, 1, 2], [1, 2], [2, 3]]) == False\n assert candidate(graph = [[1, 2, 3, 4], [0, 2], [0, 1, 4], [0], [0, 2]]) == False\n assert candidate(graph = [[1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8]]) == True\n assert candidate(graph = [[1, 2, 3, 4], [0, 5, 6], [0, 5, 6], [0, 7, 8], [0, 7, 8], [1, 2, 9], [1, 2, 9], [3, 4, 9], [3, 4, 9], [5, 6, 7, 8]]) == True\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0]]) == True\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 4, 6, 8], [0, 1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [0, 1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [0, 1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [0, 1, 3, 5, 7, 9], [0, 2, 4, 6, 8]]) == False\n assert candidate(graph = [[1, 3, 6], [0, 4], [3, 5], [0, 2, 4], [1, 3, 5, 7], [2, 4, 6], [0, 5, 7], [4, 6]]) == False\n assert candidate(graph = [[1, 3, 5], [0, 2, 4, 6], [1, 3, 5], [0, 2, 6], [1, 5], [0, 2, 4], [1, 3]]) == True\n assert candidate(graph = [[1, 4, 5], [0, 2, 4], [1, 3, 5], [2], [0, 1], [0, 2]]) == False\n assert candidate(graph = [[1, 2], [0, 3, 4], [0, 3], [1, 2, 4], [1, 3]]) == False\n assert candidate(graph = [[1], [0, 3, 5], [4], [1, 5], [2, 5], [1, 3, 4]]) == False\n assert candidate(graph = [[1, 3, 5, 7, 9], [0, 2, 6, 8, 10], [1, 3, 7, 9, 11], [0, 2, 6, 8, 12], [5, 9, 11, 13, 15], [0, 4, 8, 10, 14], [1, 3, 7, 11, 13], [0, 2, 4, 8, 12], [1, 3, 5, 9, 13], [0, 2, 4, 6, 14], [1, 3, 5, 7, 15], [2, 4, 6, 8, 15], [3, 5, 7, 9, 11], [4, 6, 8, 10, 12], [5, 7, 9, 11, 13], [6, 8, 10, 12, 14]]) == False\n assert candidate(graph = [[1, 2, 3, 4], [0, 5, 6, 7], [0, 8, 9, 10], [0, 11, 12, 13], [0, 14, 15, 16], [1], [1], [1], [2], [2], [2], [3], [3], [3], [4], [4], [4], [4]]) == True\n assert candidate(graph = [[1, 2, 4, 5], [0, 3, 6, 7], [0, 3, 8], [1, 2, 9], [0, 8, 10], [0, 10, 11], [1, 7], [1, 6], [2, 4], [3], [4, 5], [5]]) == False\n assert candidate(graph = [[1, 2, 4, 5], [0, 2, 3, 6], [0, 1, 3, 5], [1, 2, 6], [0, 5], [0, 2, 4, 6], [1, 3, 5]]) == False\n assert candidate(graph = [[3, 4, 6], [3, 6], [3, 6], [0, 1, 2, 5], [0, 7, 8], [3], [0, 1, 2, 7], [4, 6], [4, 6], [10], [9]]) == True\n"}, "metadata": {"canonical_parameter_names": ["graph"], "leetcode_dataset_entry_point": "Solution().isBipartite", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isBipartite = function(graph) {", "container": null, "callable": "isBipartite", "parameters": [{"name": "graph", "type": "number[][]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 786, "task_id": "k-th-smallest-prime-fraction", "difficulty": "Medium", "problem_description": "You are given a sorted integer array arr containing 1 and prime numbers, where all the integers of arr are unique. You are also given an integer k.\nFor every i and j where 0 <= i < j < arr.length, we consider the fraction arr[i] / arr[j].\nReturn the kth smallest fraction considered. Return your answer as an array of integers of size 2, where answer[0] == arr[i] and answer[1] == arr[j].\n \nExample 1:\n\nInput: arr = [1,2,3,5], k = 3\nOutput: [2,5]\nExplanation: The fractions to be considered in sorted order are:\n1/5, 1/3, 2/5, 1/2, 3/5, and 2/3.\nThe third fraction is 2/5.\n\nExample 2:\n\nInput: arr = [1,7], k = 1\nOutput: [1,7]\n\n \nConstraints:\n\n2 <= arr.length <= 1000\n1 <= arr[i] <= 3 * 104\narr[0] == 1\narr[i] is a prime number for i > 0.\nAll the numbers of arr are unique and sorted in strictly increasing order.\n1 <= k <= arr.length * (arr.length - 1) / 2\n\n \nFollow up: Can you solve the problem with better than O(n2) complexity?", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 2, 5, 13, 17, 19],k = 10) == [5, 13]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29],k = 25) == [2, 7]\n assert candidate(arr = [1, 2, 3, 5],k = 3) == [2, 5]\n assert candidate(arr = [1, 2, 5, 7, 11, 13, 17, 19],k = 10) == [1, 5]\n assert candidate(arr = [1, 7],k = 1) == [1, 7]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23],k = 20) == [2, 7]\n assert candidate(arr = [1, 3, 7, 11, 13],k = 5) == [3, 11]\n assert candidate(arr = [1, 2, 5, 11, 17, 23],k = 10) == [2, 5]\n assert candidate(arr = [1, 3, 7, 11, 13, 17],k = 5) == [3, 17]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29],k = 20) == [5, 23]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29],k = 15) == [3, 19]\n assert candidate(arr = [1, 2, 5, 7, 11, 13, 17],k = 10) == [5, 17]\n assert candidate(arr = [1, 5, 7, 11, 13, 17, 19, 23, 29],k = 20) == [5, 11]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199],k = 500) == [23, 67]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397],k = 1500) == [107, 277]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47],k = 20) == [3, 37]\n assert candidate(arr = [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317],k = 1) == [1, 317]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397],k = 2000) == [179, 317]\n assert candidate(arr = [1, 2, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53],k = 50) == [5, 17]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313],k = 500) == [5, 37]\n assert candidate(arr = [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317],k = 1000) == [89, 239]\n assert candidate(arr = [1, 5, 13, 29, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499],k = 3000) == [137, 179]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97],k = 150) == [19, 61]\n assert candidate(arr = [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199],k = 200) == [23, 199]\n assert candidate(arr = [1, 5, 13, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199],k = 500) == [107, 181]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47],k = 50) == [5, 19]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43],k = 30) == [3, 19]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97],k = 100) == [5, 29]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317],k = 500) == [29, 223]\n assert candidate(arr = [1, 2, 5, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199],k = 700) == [131, 191]\n assert candidate(arr = [1, 5, 13, 29, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499],k = 1) == [1, 499]\n assert candidate(arr = [1, 3, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239],k = 1000) == [53, 73]\n assert candidate(arr = [1, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199],k = 200) == [29, 197]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499],k = 1000) == [23, 173]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47],k = 100) == [13, 19]\n assert candidate(arr = [1, 2, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61],k = 70) == [17, 53]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317],k = 10) == [1, 269]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317],k = 1500) == [149, 251]\n assert candidate(arr = [1, 7, 13, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97],k = 200) == [43, 47]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199],k = 300) == [7, 43]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97],k = 300) == [71, 83]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199],k = 300) == [7, 43]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97],k = 100) == [5, 29]\n assert candidate(arr = [1, 5, 13, 29, 37, 41, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499],k = 1000) == [13, 47]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359],k = 2000) == [103, 149]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313],k = 500) == [5, 37]\n assert candidate(arr = [1, 3, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97],k = 50) == [7, 53]\n assert candidate(arr = [1, 3, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499],k = 1000) == [47, 283]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313],k = 1000) == [47, 131]\n assert candidate(arr = [1, 5, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113],k = 300) == [89, 109]\n assert candidate(arr = [1, 2, 5, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499],k = 2000) == [193, 479]\n"}, "metadata": {"canonical_parameter_names": ["arr", "k"], "leetcode_dataset_entry_point": "Solution().kthSmallestPrimeFraction", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var kthSmallestPrimeFraction = function(arr, k) {", "container": null, "callable": "kthSmallestPrimeFraction", "parameters": [{"name": "arr", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 787, "task_id": "cheapest-flights-within-k-stops", "difficulty": "Medium", "problem_description": "There are n cities connected by some number of flights. You are given an array flights where flights[i] = [fromi, toi, pricei] indicates that there is a flight from city fromi to city toi with cost pricei.\nYou are also given three integers src, dst, and k, return the cheapest price from src to dst with at most k stops. If there is no such route, return -1.\n \nExample 1:\n\n\nInput: n = 4, flights = [[0,1,100],[1,2,100],[2,0,100],[1,3,600],[2,3,200]], src = 0, dst = 3, k = 1\nOutput: 700\nExplanation:\nThe graph is shown above.\nThe optimal path with at most 1 stop from city 0 to 3 is marked in red and has cost 100 + 600 = 700.\nNote that the path through cities [0,1,2,3] is cheaper but is invalid because it uses 2 stops.\n\nExample 2:\n\n\nInput: n = 3, flights = [[0,1,100],[1,2,100],[0,2,500]], src = 0, dst = 2, k = 1\nOutput: 200\nExplanation:\nThe graph is shown above.\nThe optimal path with at most 1 stop from city 0 to 2 is marked in red and has cost 100 + 100 = 200.\n\nExample 3:\n\n\nInput: n = 3, flights = [[0,1,100],[1,2,100],[0,2,500]], src = 0, dst = 2, k = 0\nOutput: 500\nExplanation:\nThe graph is shown above.\nThe optimal path with no stops from city 0 to 2 is marked in red and has cost 500.\n\n \nConstraints:\n\n1 <= n <= 100\n0 <= flights.length <= (n * (n - 1) / 2)\nflights[i].length == 3\n0 <= fromi, toi < n\nfromi != toi\n1 <= pricei <= 104\nThere will not be any multiple flights between two cities.\n0 <= src, dst, k < n\nsrc != dst\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 6,flights = [[0, 1, 10], [0, 2, 15], [1, 2, 5], [1, 3, 20], [2, 3, 10], [3, 4, 10], [4, 5, 10]],src = 0,dst = 5,k = 2) == -1\n assert candidate(n = 3,flights = [[0, 1, 100], [1, 2, 100]],src = 0,dst = 2,k = 2) == 200\n assert candidate(n = 3,flights = [[0, 1, 100], [1, 2, 100], [0, 2, 500]],src = 0,dst = 2,k = 1) == 200\n assert candidate(n = 6,flights = [[0, 1, 10], [1, 2, 20], [0, 3, 40], [3, 4, 20], [4, 2, 10], [2, 5, 25]],src = 0,dst = 5,k = 2) == 55\n assert candidate(n = 3,flights = [[0, 1, 100], [1, 2, 100]],src = 0,dst = 2,k = 0) == -1\n assert candidate(n = 4,flights = [[0, 1, 1], [0, 2, 5], [1, 2, 1], [2, 3, 1]],src = 0,dst = 3,k = 1) == 6\n assert candidate(n = 4,flights = [[0, 1, 1], [0, 2, 5], [1, 2, 1], [2, 3, 1], [1, 3, 4]],src = 0,dst = 3,k = 1) == 5\n assert candidate(n = 6,flights = [[0, 1, 10], [0, 2, 15], [1, 3, 20], [2, 4, 50], [3, 4, 10], [4, 5, 10]],src = 0,dst = 5,k = 1) == -1\n assert candidate(n = 6,flights = [[0, 1, 10], [0, 2, 30], [1, 3, 50], [2, 3, 20], [3, 4, 10], [4, 5, 60]],src = 0,dst = 5,k = 2) == -1\n assert candidate(n = 4,flights = [[0, 1, 100], [1, 2, 100], [2, 0, 100], [1, 3, 600], [2, 3, 200]],src = 0,dst = 3,k = 1) == 700\n assert candidate(n = 6,flights = [[0, 1, 10], [0, 2, 30], [1, 2, 10], [1, 3, 40], [2, 3, 10], [2, 4, 10], [3, 4, 10], [4, 5, 10]],src = 0,dst = 5,k = 1) == -1\n assert candidate(n = 3,flights = [[0, 1, 100], [1, 2, 100], [0, 2, 500]],src = 0,dst = 2,k = 0) == 500\n assert candidate(n = 2,flights = [[0, 1, 100]],src = 0,dst = 1,k = 0) == 100\n assert candidate(n = 5,flights = [[0, 1, 5], [1, 2, 5], [0, 3, 2], [3, 1, 2], [1, 4, 1], [4, 2, 1]],src = 0,dst = 2,k = 2) == 7\n assert candidate(n = 9,flights = [[0, 1, 10], [0, 2, 20], [0, 3, 30], [1, 4, 40], [1, 5, 50], [2, 5, 60], [2, 6, 70], [3, 4, 80], [3, 6, 90], [4, 7, 100], [5, 7, 110], [5, 8, 120], [6, 8, 130], [7, 8, 140]],src = 0,dst = 8,k = 7) == 180\n assert candidate(n = 8,flights = [[0, 1, 10], [1, 2, 20], [2, 3, 30], [3, 4, 40], [4, 5, 50], [5, 6, 60], [6, 7, 70], [0, 7, 250], [7, 0, 250], [1, 3, 50], [3, 1, 50], [2, 4, 70], [4, 2, 70], [5, 7, 90], [7, 5, 90]],src = 0,dst = 7,k = 2) == 250\n assert candidate(n = 5,flights = [[0, 1, 500], [0, 2, 100], [2, 3, 300], [1, 4, 200], [3, 4, 50], [4, 2, 100], [2, 0, 200]],src = 0,dst = 4,k = 2) == 450\n assert candidate(n = 8,flights = [[0, 1, 100], [0, 2, 150], [1, 3, 100], [1, 4, 200], [2, 3, 150], [2, 5, 200], [3, 4, 100], [3, 6, 150], [4, 7, 200], [5, 6, 100], [5, 7, 150], [6, 7, 100]],src = 0,dst = 7,k = 3) == 450\n assert candidate(n = 7,flights = [[0, 1, 100], [0, 2, 150], [1, 3, 100], [1, 4, 200], [2, 3, 200], [2, 5, 300], [3, 4, 50], [3, 6, 200], [4, 6, 150], [5, 6, 100]],src = 0,dst = 6,k = 4) == 400\n assert candidate(n = 12,flights = [[0, 1, 5], [1, 2, 10], [2, 3, 5], [3, 4, 10], [4, 5, 5], [5, 6, 10], [6, 7, 5], [7, 8, 10], [8, 9, 5], [9, 10, 10], [10, 11, 5], [0, 11, 100]],src = 0,dst = 11,k = 6) == 100\n assert candidate(n = 7,flights = [[0, 1, 200], [0, 2, 300], [1, 2, 100], [1, 3, 150], [2, 3, 200], [2, 4, 100], [3, 4, 50], [3, 5, 100], [4, 5, 150], [4, 6, 100], [5, 6, 200]],src = 0,dst = 6,k = 5) == 500\n assert candidate(n = 9,flights = [[0, 1, 10], [0, 2, 20], [1, 2, 5], [1, 3, 20], [2, 3, 10], [2, 4, 15], [3, 4, 5], [3, 5, 25], [4, 5, 10], [4, 6, 20], [5, 6, 15], [5, 7, 25], [6, 7, 10], [6, 8, 15], [7, 8, 5]],src = 0,dst = 8,k = 5) == 65\n assert candidate(n = 12,flights = [[0, 1, 10], [0, 2, 15], [1, 2, 5], [1, 3, 10], [2, 3, 20], [3, 4, 50], [4, 5, 20], [5, 6, 10], [6, 7, 15], [7, 8, 30], [8, 9, 50], [9, 10, 70], [10, 11, 90], [11, 3, 110]],src = 0,dst = 11,k = 6) == -1\n assert candidate(n = 9,flights = [[0, 1, 50], [0, 2, 30], [1, 3, 100], [1, 4, 10], [2, 5, 50], [2, 6, 100], [3, 7, 10], [4, 8, 100], [5, 8, 50], [6, 8, 5], [7, 8, 50]],src = 0,dst = 8,k = 2) == 130\n assert candidate(n = 10,flights = [[0, 1, 10], [1, 2, 20], [2, 3, 30], [3, 4, 40], [4, 5, 50], [5, 6, 60], [6, 7, 70], [7, 8, 80], [8, 9, 90], [9, 0, 100]],src = 0,dst = 9,k = 9) == 450\n assert candidate(n = 5,flights = [[0, 1, 10], [0, 2, 5], [1, 2, 2], [1, 3, 20], [2, 3, 10], [2, 4, 15], [3, 4, 10]],src = 0,dst = 4,k = 2) == 20\n assert candidate(n = 12,flights = [[0, 1, 200], [0, 2, 300], [1, 3, 100], [1, 4, 200], [2, 3, 400], [2, 4, 500], [3, 4, 100], [3, 5, 200], [4, 5, 150], [4, 6, 300], [5, 6, 250], [6, 7, 400], [6, 8, 500], [7, 8, 100], [7, 9, 300], [8, 9, 200], [8, 10, 100], [9, 10, 250], [9, 11, 400], [10, 11, 300]],src = 0,dst = 11,k = 2) == -1\n assert candidate(n = 10,flights = [[0, 1, 10], [0, 2, 100], [1, 2, 50], [1, 3, 150], [1, 4, 120], [2, 4, 50], [3, 4, 10], [3, 5, 60], [4, 5, 30], [4, 6, 100], [5, 6, 50], [6, 7, 80], [6, 8, 100], [7, 8, 20], [7, 9, 60], [8, 9, 30]],src = 0,dst = 9,k = 3) == -1\n assert candidate(n = 10,flights = [[0, 1, 10], [0, 2, 30], [1, 2, 5], [1, 3, 40], [2, 3, 10], [2, 4, 10], [3, 4, 20], [4, 5, 10], [5, 6, 15], [6, 7, 25], [7, 8, 30], [8, 9, 10]],src = 0,dst = 9,k = 4) == -1\n assert candidate(n = 10,flights = [[0, 1, 100], [0, 2, 300], [1, 2, 150], [1, 3, 400], [2, 4, 100], [3, 4, 200], [3, 5, 500], [4, 5, 250], [4, 6, 350], [5, 6, 100], [6, 7, 200], [7, 8, 100], [8, 9, 150]],src = 0,dst = 9,k = 3) == -1\n assert candidate(n = 7,flights = [[0, 1, 5], [1, 2, 3], [2, 3, 8], [0, 3, 10], [3, 4, 4], [4, 5, 6], [5, 6, 2], [6, 3, 7], [0, 4, 20], [1, 5, 12], [2, 6, 9]],src = 0,dst = 6,k = 3) == 17\n assert candidate(n = 15,flights = [[0, 1, 10], [0, 2, 20], [1, 2, 30], [1, 3, 50], [2, 3, 10], [2, 4, 50], [3, 4, 10], [3, 5, 60], [4, 5, 30], [4, 6, 100], [5, 6, 50], [6, 7, 80], [6, 8, 100], [7, 8, 20], [7, 9, 60], [8, 9, 30], [8, 10, 50], [9, 10, 10], [9, 11, 60], [10, 11, 30], [11, 12, 50], [12, 13, 80], [13, 14, 100]],src = 0,dst = 14,k = 5) == -1\n assert candidate(n = 15,flights = [[0, 1, 10], [0, 2, 20], [1, 3, 5], [1, 4, 15], [2, 5, 6], [2, 6, 12], [3, 7, 8], [3, 8, 15], [4, 9, 15], [4, 10, 25], [5, 10, 7], [5, 11, 12], [6, 11, 6], [7, 8, 5], [8, 9, 5], [9, 10, 5], [10, 11, 5], [10, 12, 15], [11, 12, 10], [11, 13, 25], [12, 13, 15], [12, 14, 10], [13, 14, 5]],src = 0,dst = 14,k = 5) == 58\n assert candidate(n = 8,flights = [[0, 1, 10], [0, 2, 20], [1, 2, 5], [1, 3, 30], [2, 3, 25], [3, 4, 50], [4, 5, 20], [5, 6, 10], [6, 7, 15]],src = 0,dst = 7,k = 3) == -1\n assert candidate(n = 12,flights = [[0, 1, 5], [0, 2, 10], [1, 3, 15], [1, 4, 20], [2, 5, 25], [2, 6, 30], [3, 7, 35], [3, 8, 40], [4, 8, 45], [4, 9, 50], [5, 9, 55], [5, 10, 60], [6, 10, 65], [7, 11, 70], [8, 11, 75], [9, 11, 80]],src = 0,dst = 11,k = 4) == 125\n assert candidate(n = 10,flights = [[0, 1, 50], [1, 2, 30], [2, 3, 20], [3, 4, 10], [4, 5, 15], [5, 6, 25], [6, 7, 10], [7, 8, 5], [8, 9, 10]],src = 0,dst = 9,k = 3) == -1\n assert candidate(n = 7,flights = [[0, 1, 5], [0, 2, 10], [1, 2, 3], [1, 3, 8], [1, 4, 15], [2, 3, 4], [2, 4, 9], [3, 5, 20], [4, 5, 10], [4, 6, 25], [5, 6, 5]],src = 0,dst = 6,k = 4) == 32\n assert candidate(n = 7,flights = [[0, 1, 100], [0, 2, 150], [1, 2, 50], [1, 3, 200], [2, 4, 100], [3, 4, 200], [3, 5, 150], [4, 5, 100], [5, 6, 200]],src = 0,dst = 6,k = 3) == 550\n assert candidate(n = 11,flights = [[0, 1, 100], [0, 2, 200], [1, 2, 100], [1, 3, 150], [2, 3, 50], [2, 4, 50], [3, 4, 100], [3, 5, 150], [4, 5, 200], [4, 6, 100], [5, 6, 50], [6, 7, 100], [6, 8, 100], [7, 8, 50], [7, 9, 150], [8, 9, 200], [8, 10, 100], [9, 10, 150]],src = 0,dst = 10,k = 4) == 550\n assert candidate(n = 10,flights = [[0, 1, 5], [0, 2, 10], [0, 3, 15], [0, 4, 20], [0, 5, 25], [0, 6, 30], [0, 7, 35], [0, 8, 40], [0, 9, 45], [1, 2, 5], [2, 3, 5], [3, 4, 5], [4, 5, 5], [5, 6, 5], [6, 7, 5], [7, 8, 5], [8, 9, 5], [1, 9, 95], [9, 1, 95], [2, 8, 80], [8, 2, 80], [3, 7, 70], [7, 3, 70], [4, 6, 60], [6, 4, 60]],src = 0,dst = 9,k = 5) == 45\n assert candidate(n = 9,flights = [[0, 1, 100], [0, 2, 200], [1, 3, 100], [1, 4, 200], [2, 3, 150], [2, 4, 250], [3, 4, 50], [3, 5, 300], [4, 5, 200], [4, 6, 100], [5, 6, 150], [5, 7, 350], [6, 7, 100], [6, 8, 250], [7, 8, 200]],src = 0,dst = 8,k = 2) == -1\n assert candidate(n = 8,flights = [[0, 1, 1], [0, 2, 2], [1, 3, 3], [1, 4, 4], [2, 3, 5], [2, 4, 6], [3, 5, 7], [3, 6, 8], [4, 5, 9], [4, 6, 10], [5, 7, 11], [6, 7, 12]],src = 0,dst = 7,k = 6) == 22\n assert candidate(n = 8,flights = [[0, 1, 10], [0, 2, 100], [1, 3, 150], [1, 4, 200], [2, 4, 50], [2, 5, 100], [3, 6, 10], [4, 6, 300], [5, 6, 50], [6, 7, 100]],src = 0,dst = 7,k = 3) == 270\n assert candidate(n = 7,flights = [[0, 1, 50], [0, 2, 100], [1, 2, 10], [1, 3, 20], [2, 3, 5], [3, 4, 100], [4, 5, 10], [5, 6, 50], [4, 6, 200]],src = 0,dst = 6,k = 2) == -1\n assert candidate(n = 10,flights = [[0, 1, 10], [0, 2, 10], [1, 3, 10], [1, 4, 10], [2, 5, 10], [2, 6, 10], [3, 7, 10], [3, 8, 10], [4, 8, 10], [4, 9, 10], [5, 9, 10], [6, 7, 10], [7, 8, 10], [8, 9, 10]],src = 0,dst = 9,k = 5) == 30\n assert candidate(n = 6,flights = [[0, 1, 100], [1, 2, 100], [2, 3, 100], [3, 4, 100], [4, 5, 100], [0, 2, 150], [1, 3, 150], [2, 4, 150], [3, 5, 150], [0, 3, 200], [1, 4, 200], [2, 5, 200]],src = 0,dst = 5,k = 2) == 350\n assert candidate(n = 8,flights = [[0, 1, 50], [0, 2, 25], [1, 2, 10], [1, 3, 75], [2, 3, 60], [2, 4, 80], [3, 4, 40], [3, 5, 65], [4, 5, 30], [4, 6, 90], [5, 6, 50], [5, 7, 70], [6, 7, 20]],src = 0,dst = 7,k = 4) == 205\n assert candidate(n = 9,flights = [[0, 1, 10], [0, 2, 10], [1, 2, 10], [2, 3, 10], [3, 4, 10], [4, 5, 10], [5, 6, 10], [6, 7, 10], [7, 8, 10], [0, 8, 80]],src = 0,dst = 8,k = 2) == 80\n assert candidate(n = 6,flights = [[0, 1, 10], [0, 2, 50], [1, 2, 10], [1, 3, 40], [2, 3, 10], [3, 4, 10], [4, 5, 10], [2, 5, 50]],src = 0,dst = 5,k = 2) == 70\n assert candidate(n = 6,flights = [[0, 1, 10], [1, 2, 20], [2, 3, 30], [3, 4, 40], [4, 5, 50], [5, 0, 60]],src = 0,dst = 5,k = 5) == 150\n assert candidate(n = 8,flights = [[0, 1, 100], [0, 4, 10], [0, 2, 100], [1, 2, 10], [1, 3, 50], [2, 3, 20], [3, 4, 20], [4, 5, 10], [5, 6, 50], [6, 7, 10]],src = 0,dst = 7,k = 3) == 80\n assert candidate(n = 10,flights = [[0, 1, 10], [0, 2, 5], [1, 2, 1], [1, 3, 4], [2, 4, 10], [2, 5, 15], [3, 5, 25], [4, 6, 5], [5, 7, 10], [6, 8, 20], [7, 9, 15]],src = 0,dst = 9,k = 5) == 45\n assert candidate(n = 8,flights = [[0, 1, 10], [0, 2, 20], [1, 3, 30], [1, 4, 40], [2, 5, 50], [2, 6, 60], [3, 7, 70], [4, 7, 80], [5, 7, 90], [6, 7, 100]],src = 0,dst = 7,k = 4) == 110\n assert candidate(n = 7,flights = [[0, 1, 10], [0, 2, 10], [1, 2, 5], [1, 3, 50], [2, 3, 10], [3, 4, 20], [4, 5, 10], [5, 6, 10], [6, 0, 50]],src = 0,dst = 6,k = 3) == -1\n assert candidate(n = 6,flights = [[0, 1, 100], [0, 2, 200], [0, 3, 300], [1, 4, 400], [2, 4, 300], [3, 5, 200], [4, 5, 100]],src = 0,dst = 5,k = 2) == 500\n assert candidate(n = 7,flights = [[0, 1, 100], [0, 2, 200], [0, 3, 300], [1, 4, 100], [2, 4, 200], [3, 4, 300], [4, 5, 100], [4, 6, 200], [5, 6, 100]],src = 0,dst = 6,k = 3) == 400\n assert candidate(n = 6,flights = [[0, 1, 100], [0, 2, 100], [1, 3, 100], [1, 4, 100], [2, 4, 100], [2, 5, 100], [3, 4, 50], [4, 5, 50]],src = 0,dst = 5,k = 2) == 200\n assert candidate(n = 10,flights = [[0, 1, 10], [0, 2, 5], [0, 3, 15], [1, 2, 20], [1, 4, 50], [1, 5, 10], [2, 3, 10], [3, 4, 20], [4, 5, 10], [5, 6, 10], [6, 7, 5], [7, 8, 10], [8, 9, 10]],src = 0,dst = 9,k = 4) == -1\n assert candidate(n = 7,flights = [[0, 1, 10], [0, 2, 20], [0, 3, 30], [1, 4, 40], [1, 5, 50], [2, 5, 60], [2, 6, 70], [3, 4, 80], [4, 6, 90], [5, 6, 100]],src = 0,dst = 6,k = 5) == 90\n assert candidate(n = 8,flights = [[0, 1, 10], [1, 2, 20], [2, 3, 10], [3, 4, 20], [4, 5, 10], [5, 6, 20], [6, 7, 10], [0, 7, 100], [7, 3, 10], [3, 6, 50]],src = 0,dst = 7,k = 2) == 100\n assert candidate(n = 9,flights = [[0, 1, 50], [0, 2, 70], [1, 3, 100], [1, 4, 200], [2, 4, 120], [2, 5, 140], [3, 6, 90], [4, 6, 130], [4, 7, 150], [5, 7, 110], [6, 8, 80], [7, 8, 70]],src = 0,dst = 8,k = 4) == 320\n assert candidate(n = 6,flights = [[0, 1, 10], [0, 2, 20], [1, 3, 10], [1, 4, 20], [2, 4, 15], [2, 5, 30], [3, 5, 10], [4, 5, 5], [0, 5, 100]],src = 0,dst = 5,k = 1) == 50\n assert candidate(n = 7,flights = [[0, 1, 100], [0, 2, 300], [1, 2, 50], [1, 3, 200], [2, 3, 150], [2, 4, 250], [3, 4, 100], [3, 5, 200], [4, 5, 50], [4, 6, 100], [5, 6, 200]],src = 0,dst = 6,k = 2) == 650\n assert candidate(n = 6,flights = [[0, 1, 100], [0, 2, 150], [1, 2, 50], [1, 3, 200], [2, 3, 100], [2, 4, 150], [3, 4, 50], [3, 5, 250], [4, 5, 100]],src = 0,dst = 5,k = 2) == 400\n assert candidate(n = 12,flights = [[0, 1, 10], [1, 2, 10], [2, 3, 10], [3, 4, 10], [4, 5, 10], [5, 6, 10], [6, 7, 10], [7, 8, 10], [8, 9, 10], [9, 10, 10], [10, 11, 10], [11, 0, 10]],src = 0,dst = 11,k = 5) == -1\n assert candidate(n = 5,flights = [[0, 1, 100], [0, 2, 200], [1, 3, 300], [1, 4, 400], [2, 3, 150], [2, 4, 250], [3, 4, 100]],src = 0,dst = 4,k = 1) == 450\n assert candidate(n = 10,flights = [[0, 1, 10], [0, 2, 20], [1, 3, 100], [1, 4, 300], [2, 5, 50], [2, 6, 100], [3, 7, 10], [4, 7, 300], [5, 8, 50], [6, 8, 100], [7, 9, 10], [8, 9, 50]],src = 0,dst = 9,k = 4) == 130\n assert candidate(n = 8,flights = [[0, 1, 10], [1, 7, 50], [0, 7, 100], [1, 2, 20], [2, 3, 30], [3, 4, 40], [4, 5, 50], [5, 6, 60], [6, 7, 10], [7, 3, 20]],src = 0,dst = 7,k = 2) == 60\n assert candidate(n = 7,flights = [[0, 1, 50], [1, 2, 100], [2, 3, 50], [3, 4, 100], [4, 5, 50], [5, 6, 100], [0, 3, 200], [3, 5, 200], [0, 4, 300], [4, 6, 100], [1, 5, 200], [5, 1, 200], [2, 6, 250], [6, 2, 250], [0, 6, 350], [6, 0, 350]],src = 0,dst = 6,k = 4) == 350\n assert candidate(n = 10,flights = [[0, 1, 1], [0, 2, 1], [0, 3, 1], [0, 4, 1], [0, 5, 1], [0, 6, 1], [0, 7, 1], [0, 8, 1], [0, 9, 1], [1, 9, 1], [2, 9, 1], [3, 9, 1], [4, 9, 1], [5, 9, 1], [6, 9, 1], [7, 9, 1], [8, 9, 1]],src = 0,dst = 9,k = 0) == 1\n assert candidate(n = 10,flights = [[0, 1, 5], [0, 2, 10], [1, 3, 15], [1, 4, 20], [2, 5, 25], [2, 6, 30], [3, 7, 35], [3, 8, 40], [4, 9, 45], [5, 9, 50], [6, 9, 55], [7, 9, 60], [8, 9, 65]],src = 0,dst = 9,k = 5) == 70\n assert candidate(n = 8,flights = [[0, 1, 10], [1, 2, 20], [2, 3, 30], [3, 4, 40], [4, 5, 50], [5, 6, 60], [6, 7, 70], [0, 7, 400]],src = 0,dst = 7,k = 3) == 400\n assert candidate(n = 6,flights = [[0, 1, 100], [0, 2, 200], [1, 2, 100], [1, 3, 150], [2, 3, 150], [2, 4, 200], [3, 4, 50], [3, 5, 100], [4, 5, 50]],src = 0,dst = 5,k = 2) == 350\n assert candidate(n = 7,flights = [[0, 1, 100], [0, 2, 200], [1, 2, 50], [1, 3, 150], [2, 3, 100], [2, 4, 100], [3, 4, 50], [3, 5, 100], [4, 5, 150], [4, 6, 100], [5, 6, 50]],src = 0,dst = 6,k = 3) == 350\n assert candidate(n = 10,flights = [[0, 1, 10], [0, 2, 20], [1, 2, 5], [1, 3, 20], [2, 3, 10], [2, 4, 15], [3, 4, 5], [3, 5, 25], [4, 5, 10], [4, 6, 20], [5, 6, 15], [5, 7, 25], [6, 7, 10], [6, 8, 15], [7, 8, 5], [7, 9, 25], [8, 9, 10]],src = 0,dst = 9,k = 4) == 80\n assert candidate(n = 12,flights = [[0, 1, 5], [0, 2, 10], [1, 3, 20], [1, 4, 30], [2, 5, 20], [2, 6, 30], [3, 7, 40], [3, 8, 50], [4, 9, 40], [4, 10, 50], [5, 10, 20], [5, 11, 30], [6, 11, 20], [7, 8, 5], [8, 9, 5], [9, 10, 5], [10, 11, 5]],src = 0,dst = 11,k = 4) == 55\n assert candidate(n = 10,flights = [[0, 1, 100], [0, 2, 300], [1, 3, 200], [1, 4, 250], [2, 3, 50], [2, 5, 150], [3, 6, 50], [3, 7, 200], [4, 6, 150], [4, 7, 250], [5, 8, 50], [5, 9, 200], [6, 9, 150], [7, 8, 50], [8, 9, 50]],src = 0,dst = 9,k = 3) == 500\n assert candidate(n = 5,flights = [[0, 1, 10], [0, 2, 5], [0, 3, 15], [1, 2, 20], [1, 4, 50], [1, 3, 10], [2, 4, 10], [3, 4, 5]],src = 0,dst = 4,k = 2) == 15\n assert candidate(n = 5,flights = [[0, 1, 5], [0, 2, 30], [1, 2, 5], [1, 3, 15], [2, 3, 10], [2, 4, 50], [3, 4, 10], [0, 4, 100], [1, 4, 20], [2, 0, 10], [3, 0, 20]],src = 0,dst = 4,k = 2) == 25\n assert candidate(n = 10,flights = [[0, 1, 100], [1, 2, 200], [2, 3, 150], [3, 4, 200], [4, 5, 100], [5, 6, 250], [6, 7, 100], [7, 8, 300], [8, 9, 50]],src = 0,dst = 9,k = 0) == -1\n assert candidate(n = 5,flights = [[0, 1, 20], [0, 2, 10], [1, 3, 10], [1, 4, 20], [2, 3, 20], [2, 4, 10], [3, 4, 5], [3, 0, 15], [4, 0, 10], [4, 1, 5], [4, 2, 10]],src = 0,dst = 4,k = 2) == 20\n assert candidate(n = 12,flights = [[0, 1, 10], [0, 2, 20], [0, 3, 30], [1, 4, 40], [1, 5, 50], [2, 6, 60], [3, 7, 70], [4, 8, 80], [5, 9, 90], [6, 10, 100], [7, 11, 110], [8, 11, 120], [9, 11, 130]],src = 0,dst = 11,k = 5) == 210\n assert candidate(n = 9,flights = [[0, 1, 10], [1, 2, 10], [2, 3, 10], [3, 4, 10], [4, 5, 10], [5, 6, 10], [6, 7, 10], [7, 8, 10], [8, 0, 10], [0, 8, 10], [1, 8, 10], [2, 8, 10], [3, 8, 10], [4, 8, 10], [5, 8, 10], [6, 8, 10], [7, 8, 10]],src = 0,dst = 4,k = 4) == 40\n assert candidate(n = 6,flights = [[0, 1, 100], [0, 2, 500], [1, 2, 100], [2, 3, 200], [3, 4, 100], [4, 5, 300], [5, 2, 200], [2, 5, 200], [1, 3, 300], [3, 5, 100]],src = 0,dst = 5,k = 3) == 400\n assert candidate(n = 10,flights = [[0, 1, 10], [0, 2, 15], [1, 2, 5], [1, 3, 10], [2, 3, 20], [3, 4, 50], [4, 5, 20], [5, 6, 10], [6, 7, 15], [7, 8, 30], [8, 9, 50]],src = 0,dst = 9,k = 5) == -1\n assert candidate(n = 7,flights = [[0, 1, 100], [0, 2, 50], [0, 3, 100], [1, 4, 100], [1, 5, 50], [2, 4, 50], [2, 5, 100], [3, 4, 50], [4, 5, 25], [4, 6, 50], [5, 6, 100]],src = 0,dst = 6,k = 3) == 150\n assert candidate(n = 5,flights = [[0, 1, 1], [1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 0, 1], [1, 4, 1], [4, 2, 1], [2, 0, 1], [0, 3, 1], [3, 1, 1]],src = 0,dst = 4,k = 10) == 2\n assert candidate(n = 6,flights = [[0, 1, 10], [0, 2, 20], [1, 2, 5], [1, 3, 30], [2, 3, 25], [3, 4, 50], [4, 5, 20], [5, 0, 10]],src = 0,dst = 5,k = 2) == -1\n assert candidate(n = 7,flights = [[0, 1, 100], [0, 2, 200], [1, 3, 100], [1, 4, 150], [2, 3, 200], [2, 5, 300], [3, 4, 50], [3, 6, 200], [4, 6, 150], [5, 6, 100]],src = 0,dst = 6,k = 3) == 400\n assert candidate(n = 10,flights = [[0, 1, 100], [1, 2, 100], [2, 3, 100], [3, 4, 100], [4, 5, 100], [5, 6, 100], [6, 7, 100], [7, 8, 100], [8, 9, 100], [9, 0, 100], [0, 9, 10], [1, 8, 10], [2, 7, 10], [3, 6, 10], [4, 5, 10], [5, 4, 10], [6, 3, 10], [7, 2, 10], [8, 1, 10], [9, 0, 10]],src = 0,dst = 9,k = 4) == 10\n assert candidate(n = 15,flights = [[0, 1, 10], [0, 2, 20], [1, 3, 10], [2, 4, 20], [3, 5, 10], [4, 6, 20], [5, 7, 10], [6, 8, 20], [7, 9, 10], [8, 10, 20], [9, 11, 10], [10, 12, 20], [11, 13, 10], [12, 14, 20], [13, 14, 10]],src = 0,dst = 14,k = 7) == 80\n assert candidate(n = 9,flights = [[0, 1, 100], [1, 2, 100], [2, 3, 100], [3, 4, 100], [4, 5, 100], [5, 6, 100], [6, 7, 100], [7, 8, 100], [8, 0, 100], [0, 2, 150], [2, 4, 150], [4, 6, 150], [6, 8, 150], [1, 3, 150], [3, 5, 150], [5, 7, 150], [7, 0, 150]],src = 0,dst = 8,k = 4) == 600\n assert candidate(n = 8,flights = [[0, 1, 10], [0, 2, 10], [1, 3, 10], [2, 4, 10], [3, 5, 10], [4, 6, 10], [5, 7, 10], [6, 7, 10], [1, 4, 5], [2, 5, 5], [3, 6, 5], [4, 7, 5]],src = 0,dst = 7,k = 3) == 20\n assert candidate(n = 9,flights = [[0, 1, 100], [0, 2, 150], [1, 3, 50], [1, 4, 200], [2, 5, 100], [3, 6, 50], [4, 7, 200], [5, 8, 100], [6, 8, 100], [7, 8, 50]],src = 0,dst = 8,k = 4) == 300\n"}, "metadata": {"canonical_parameter_names": ["n", "flights", "src", "dst", "k"], "leetcode_dataset_entry_point": "Solution().findCheapestPrice", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findCheapestPrice = function(n, flights, src, dst, k) {", "container": null, "callable": "findCheapestPrice", "parameters": [{"name": "n", "type": "number"}, {"name": "flights", "type": "number[][]"}, {"name": "src", "type": "number"}, {"name": "dst", "type": "number"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 788, "task_id": "rotated-digits", "difficulty": "Medium", "problem_description": "An integer x is a good if after rotating each digit individually by 180 degrees, we get a valid number that is different from x. Each digit must be rotated - we cannot choose to leave it alone.\nA number is valid if each digit remains a digit after rotation. For example:\n\n0, 1, and 8 rotate to themselves,\n2 and 5 rotate to each other (in this case they are rotated in a different direction, in other words, 2 or 5 gets mirrored),\n6 and 9 rotate to each other, and\nthe rest of the numbers do not rotate to any other number and become invalid.\n\nGiven an integer n, return the number of good integers in the range [1, n].\n \nExample 1:\n\nInput: n = 10\nOutput: 4\nExplanation: There are four good numbers in the range [1, 10] : 2, 5, 6, 9.\nNote that 1 and 10 are not good numbers, since they remain unchanged after rotating.\n\nExample 2:\n\nInput: n = 1\nOutput: 0\n\nExample 3:\n\nInput: n = 2\nOutput: 1\n\n \nConstraints:\n\n1 <= n <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 100) == 40\n assert candidate(n = 10000) == 2320\n assert candidate(n = 104) == 41\n assert candidate(n = 20) == 9\n assert candidate(n = 2) == 1\n assert candidate(n = 1) == 0\n assert candidate(n = 1000) == 316\n assert candidate(n = 10) == 4\n assert candidate(n = 50) == 16\n assert candidate(n = 4000) == 975\n assert candidate(n = 1010) == 320\n assert candidate(n = 8765) == 1888\n assert candidate(n = 5678) == 1206\n assert candidate(n = 5959) == 1297\n assert candidate(n = 1111) == 360\n assert candidate(n = 7000) == 1661\n assert candidate(n = 6172) == 1402\n assert candidate(n = 2000) == 633\n assert candidate(n = 7500) == 1661\n assert candidate(n = 8888) == 1920\n assert candidate(n = 3333) == 975\n assert candidate(n = 2525) == 797\n assert candidate(n = 6969) == 1647\n assert candidate(n = 3500) == 975\n assert candidate(n = 300) == 129\n assert candidate(n = 3000) == 975\n assert candidate(n = 3456) == 975\n assert candidate(n = 6789) == 1563\n assert candidate(n = 6666) == 1547\n assert candidate(n = 9652) == 2197\n assert candidate(n = 1024) == 327\n assert candidate(n = 2020) == 647\n assert candidate(n = 789) == 227\n assert candidate(n = 999) == 316\n assert candidate(n = 5555) == 1147\n assert candidate(n = 8000) == 1661\n assert candidate(n = 5000) == 976\n assert candidate(n = 9999) == 2320\n assert candidate(n = 4444) == 975\n assert candidate(n = 7890) == 1661\n assert candidate(n = 6174) == 1402\n assert candidate(n = 4321) == 975\n assert candidate(n = 7654) == 1661\n assert candidate(n = 7777) == 1661\n assert candidate(n = 2222) == 747\n assert candidate(n = 8080) == 1690\n assert candidate(n = 9265) == 2107\n assert candidate(n = 2500) == 780\n assert candidate(n = 9000) == 1978\n assert candidate(n = 1234) == 417\n assert candidate(n = 750) == 227\n assert candidate(n = 6000) == 1319\n assert candidate(n = 2569) == 814\n assert candidate(n = 500) == 130\n assert candidate(n = 9090) == 2020\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().rotatedDigits", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var rotatedDigits = function(n) {", "container": null, "callable": "rotatedDigits", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 789, "task_id": "escape-the-ghosts", "difficulty": "Medium", "problem_description": "You are playing a simplified PAC-MAN game on an infinite 2-D grid. You start at the point [0, 0], and you are given a destination point target = [xtarget, ytarget] that you are trying to get to. There are several ghosts on the map with their starting positions given as a 2D array ghosts, where ghosts[i] = [xi, yi] represents the starting position of the ith ghost. All inputs are integral coordinates.\nEach turn, you and all the ghosts may independently choose to either move 1 unit in any of the four cardinal directions: north, east, south, or west, or stay still. All actions happen simultaneously.\nYou escape if and only if you can reach the target before any ghost reaches you. If you reach any square (including the target) at the same time as a ghost, it does not count as an escape.\nReturn true if it is possible to escape regardless of how the ghosts move, otherwise return false.\n \nExample 1:\n\nInput: ghosts = [[1,0],[0,3]], target = [0,1]\nOutput: true\nExplanation: You can reach the destination (0, 1) after 1 turn, while the ghosts located at (1, 0) and (0, 3) cannot catch up with you.\n\nExample 2:\n\nInput: ghosts = [[1,0]], target = [2,0]\nOutput: false\nExplanation: You need to reach the destination (2, 0), but the ghost at (1, 0) lies between you and the destination.\n\nExample 3:\n\nInput: ghosts = [[2,0]], target = [1,0]\nOutput: false\nExplanation: The ghost can reach the target at the same time as you.\n\n \nConstraints:\n\n1 <= ghosts.length <= 100\nghosts[i].length == 2\n-104 <= xi, yi <= 104\nThere can be multiple ghosts in the same location.\ntarget.length == 2\n-104 <= xtarget, ytarget <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(ghosts = [[0, 0], [0, 0]],target = [1, 1]) == False\n assert candidate(ghosts = [[-1, -1]],target = [0, 0]) == True\n assert candidate(ghosts = [[1, 1], [2, 2], [3, 3]],target = [4, 4]) == False\n assert candidate(ghosts = [[1, 1], [2, 2], [3, 3], [4, 4]],target = [5, 5]) == False\n assert candidate(ghosts = [[1, 0], [0, 3]],target = [0, 1]) == True\n assert candidate(ghosts = [[-1, -1], [-2, -2]],target = [-3, -3]) == False\n assert candidate(ghosts = [[0, 0], [0, 0]],target = [0, 0]) == False\n assert candidate(ghosts = [[0, 1], [1, 0], [0, -1], [-1, 0]],target = [0, 0]) == True\n assert candidate(ghosts = [[-10000, -10000]],target = [-9999, -9999]) == False\n assert candidate(ghosts = [[100, 100]],target = [-100, -100]) == True\n assert candidate(ghosts = [[10000, 10000]],target = [-10000, -10000]) == True\n assert candidate(ghosts = [[10000, 10000], [-10000, -10000]],target = [5000, 5000]) == False\n assert candidate(ghosts = [[0, 1], [0, -1], [1, 0], [-1, 0]],target = [1, 1]) == False\n assert candidate(ghosts = [[0, 0]],target = [0, 0]) == False\n assert candidate(ghosts = [[100, 100], [99, 100], [100, 99]],target = [101, 101]) == False\n assert candidate(ghosts = [[5, 5], [5, 6], [6, 5], [6, 6]],target = [5, 5]) == False\n assert candidate(ghosts = [[0, 1], [1, 0]],target = [1, 1]) == False\n assert candidate(ghosts = [[2, 0]],target = [1, 0]) == False\n assert candidate(ghosts = [[0, 0]],target = [1, 1]) == False\n assert candidate(ghosts = [[1, 1], [2, 2], [3, 3]],target = [0, 0]) == True\n assert candidate(ghosts = [[1, 1], [2, 2]],target = [3, 3]) == False\n assert candidate(ghosts = [[-1, -1]],target = [-2, -2]) == False\n assert candidate(ghosts = [[1, 1], [1, 1]],target = [2, 2]) == False\n assert candidate(ghosts = [[10000, 10000]],target = [9999, 9999]) == False\n assert candidate(ghosts = [[-1, -1], [2, 2]],target = [0, 0]) == True\n assert candidate(ghosts = [[-2, -2], [-3, -3]],target = [-4, -4]) == False\n assert candidate(ghosts = [[-1, 0], [0, -1]],target = [0, 0]) == True\n assert candidate(ghosts = [[1, 0]],target = [2, 0]) == False\n assert candidate(ghosts = [[-1, 0], [0, -1], [1, 0], [0, 1]],target = [0, 0]) == True\n assert candidate(ghosts = [[1, 0], [0, 1], [1, 1]],target = [-1, -1]) == True\n assert candidate(ghosts = [[-5, 5], [5, -5], [0, 10]],target = [5, 5]) == False\n assert candidate(ghosts = [[0, 1], [0, -1], [1, 0], [-1, 0]],target = [0, 0]) == True\n assert candidate(ghosts = [[5, 5], [3, 3], [-1, -1]],target = [0, 0]) == True\n assert candidate(ghosts = [[-1000, 0], [0, -1000], [1000, 0], [0, 1000]],target = [1001, 1001]) == False\n assert candidate(ghosts = [[-1, -2], [-2, -3], [-3, -4], [-4, -5], [-5, -6], [-6, -7]],target = [-7, -8]) == False\n assert candidate(ghosts = [[1, 0], [0, 1]],target = [-1, -1]) == True\n assert candidate(ghosts = [[100, 0], [0, 100], [-100, 0], [0, -100]],target = [50, 50]) == False\n assert candidate(ghosts = [[0, 0], [0, 0], [0, 0]],target = [1, 1]) == False\n assert candidate(ghosts = [[-100, 100], [100, -100], [50, 50]],target = [0, 0]) == True\n assert candidate(ghosts = [[10, 10], [10, -10], [-10, 10], [-10, -10]],target = [0, 0]) == True\n assert candidate(ghosts = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5]],target = [2, 5]) == False\n assert candidate(ghosts = [[-1, -1], [1, 1]],target = [10000, 10000]) == False\n assert candidate(ghosts = [[10000, 0], [0, 10000], [-10000, 0], [0, -10000]],target = [5000, 5000]) == False\n assert candidate(ghosts = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5], [-6, -6], [-7, -7], [-8, -8], [-9, -9], [-10, -10]],target = [-1, -1]) == False\n assert candidate(ghosts = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5]],target = [5, 5]) == True\n assert candidate(ghosts = [[1, 2], [3, 4], [5, 6], [7, 8]],target = [-1, -2]) == True\n assert candidate(ghosts = [[0, 1], [0, -1], [1, 0], [-1, 0], [1, 1], [-1, -1]],target = [2, 2]) == False\n assert candidate(ghosts = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],target = [9, 10]) == False\n assert candidate(ghosts = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],target = [6, 7]) == False\n assert candidate(ghosts = [[-1, 0], [0, -1], [1, 0], [0, 1], [-2, 0], [0, -2], [2, 0], [0, 2]],target = [3, 3]) == False\n assert candidate(ghosts = [[-1, -1], [-1, 1], [1, -1], [1, 1]],target = [2, 2]) == False\n assert candidate(ghosts = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]],target = [0, 0]) == True\n assert candidate(ghosts = [[10, 10], [20, 20], [30, 30]],target = [15, 15]) == False\n assert candidate(ghosts = [[-10, 10], [10, -10], [-10, -10]],target = [0, 0]) == True\n assert candidate(ghosts = [[0, 1], [0, -1], [1, 0], [-1, 0], [1, 1], [-1, -1]],target = [10, 10]) == False\n assert candidate(ghosts = [[5, 5], [5, -5], [-5, 5], [-5, -5]],target = [0, 0]) == True\n assert candidate(ghosts = [[-10, 0], [0, -10], [10, 0], [0, 10]],target = [3, 3]) == True\n assert candidate(ghosts = [[-10000, -10000], [-10000, 10000], [10000, -10000], [10000, 10000]],target = [0, 0]) == True\n assert candidate(ghosts = [[5, -5], [-5, 5], [0, 0]],target = [-3, 3]) == False\n assert candidate(ghosts = [[1, 2], [2, 1], [3, 3], [4, 4], [5, 5]],target = [0, 0]) == True\n assert candidate(ghosts = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]],target = [6, 6]) == False\n assert candidate(ghosts = [[1000, 1000], [1001, 1001], [999, 999], [998, 998]],target = [1002, 1002]) == False\n assert candidate(ghosts = [[-1000, -1000], [-2000, -2000], [-1500, -1500], [-500, -500]],target = [-1500, -1500]) == False\n assert candidate(ghosts = [[-5000, 5000], [5000, -5000], [0, 0], [1, 1]],target = [5000, 5000]) == False\n assert candidate(ghosts = [[1000, 1000], [2000, 2000], [3000, 3000]],target = [1500, 1500]) == False\n assert candidate(ghosts = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]],target = [6, 6]) == False\n assert candidate(ghosts = [[-10, -20], [-30, -40], [-50, -60]],target = [-40, -50]) == False\n assert candidate(ghosts = [[-5, 5], [5, -5], [-10, 10], [10, -10]],target = [0, 0]) == True\n assert candidate(ghosts = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2]],target = [2, 2]) == False\n assert candidate(ghosts = [[-100, -100], [100, 100], [-50, 50], [50, -50]],target = [0, 0]) == True\n assert candidate(ghosts = [[10000, 10000], [-10000, -10000], [10000, -10000], [-10000, 10000]],target = [0, 0]) == True\n assert candidate(ghosts = [[-10000, -10000], [10000, 10000]],target = [0, 0]) == True\n assert candidate(ghosts = [[-1, 1], [-2, 2], [-3, 3], [-4, 4]],target = [0, 0]) == True\n assert candidate(ghosts = [[10, 10], [20, 20], [30, 30]],target = [15, 15]) == False\n assert candidate(ghosts = [[1, 2], [3, 4], [5, 6]],target = [7, 8]) == False\n assert candidate(ghosts = [[0, 0], [0, 0]],target = [0, 0]) == False\n assert candidate(ghosts = [[1000, 1000], [999, 1000], [1000, 999], [999, 999]],target = [1001, 1001]) == False\n assert candidate(ghosts = [[1, 1], [1, -1], [-1, 1], [-1, -1]],target = [2, 2]) == False\n assert candidate(ghosts = [[5, 5], [5, -5], [-5, 5], [-5, -5]],target = [0, 0]) == True\n assert candidate(ghosts = [[100, 0], [0, 100], [50, 50], [0, 0]],target = [50, 50]) == False\n assert candidate(ghosts = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4]],target = [0, 5]) == False\n assert candidate(ghosts = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]],target = [7, 8]) == False\n assert candidate(ghosts = [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]],target = [1, 1]) == False\n assert candidate(ghosts = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]],target = [10, 10]) == False\n assert candidate(ghosts = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5]],target = [-6, -6]) == False\n assert candidate(ghosts = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]],target = [5, 5]) == False\n assert candidate(ghosts = [[1000, -1000], [-1000, 1000]],target = [0, 0]) == True\n assert candidate(ghosts = [[0, 0], [0, 1], [1, 0], [1, 1]],target = [10, 10]) == False\n assert candidate(ghosts = [[-5, -5], [-4, -4], [-3, -3], [-2, -2], [-1, -1]],target = [0, 0]) == True\n assert candidate(ghosts = [[2, 2], [3, 3], [4, 4], [5, 5]],target = [1, 1]) == False\n assert candidate(ghosts = [[0, 0], [0, 0], [0, 0], [0, 0]],target = [1000, 1000]) == False\n assert candidate(ghosts = [[-50, -50], [-49, -49], [-48, -48], [-47, -47]],target = [-45, -45]) == False\n assert candidate(ghosts = [[-1000, -1000], [-1001, -1001], [-1002, -1002]],target = [-1003, -1003]) == False\n assert candidate(ghosts = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]],target = [0, 0]) == True\n assert candidate(ghosts = [[-1, -1], [-2, -2], [-3, -3], [-4, -4]],target = [0, 0]) == True\n assert candidate(ghosts = [[0, 10000], [10000, 0], [-10000, 0], [0, -10000]],target = [5000, 5000]) == False\n assert candidate(ghosts = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0]],target = [6, 0]) == False\n assert candidate(ghosts = [[-10000, 0], [0, -10000], [10000, 0], [0, 10000]],target = [1, 1]) == True\n assert candidate(ghosts = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1]],target = [2, 2]) == False\n assert candidate(ghosts = [[10, 10], [20, 20], [30, 30]],target = [0, 0]) == True\n assert candidate(ghosts = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]],target = [5, 6]) == False\n assert candidate(ghosts = [[-10, 10], [10, -10]],target = [5, 5]) == True\n assert candidate(ghosts = [[5, 5], [5, -5], [-5, 5], [-5, -5]],target = [10, 10]) == False\n assert candidate(ghosts = [[1, 0], [0, 1], [0, 0], [0, 2], [2, 0]],target = [2, 2]) == False\n assert candidate(ghosts = [[0, 1], [1, 0], [0, -1], [-1, 0]],target = [2, 2]) == False\n assert candidate(ghosts = [[2, 3], [4, 5], [6, 7], [8, 9]],target = [10, 10]) == False\n assert candidate(ghosts = [[5, 5], [-5, -5], [5, -5], [-5, 5]],target = [0, 0]) == True\n assert candidate(ghosts = [[-100, -100], [100, 100]],target = [0, 0]) == True\n assert candidate(ghosts = [[-1, 0], [0, -1], [1, 0], [0, 1], [0, 0]],target = [0, 0]) == False\n assert candidate(ghosts = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50]],target = [60, 60]) == False\n assert candidate(ghosts = [[1, 2], [3, 4], [5, 6], [7, 8]],target = [4, 4]) == False\n assert candidate(ghosts = [[-100, 0], [0, -100], [100, 0], [0, 100]],target = [100, 100]) == False\n assert candidate(ghosts = [[100, 0], [100, 0], [100, 0]],target = [200, 0]) == False\n assert candidate(ghosts = [[-5, 0], [5, 0], [0, -5], [0, 5]],target = [3, 3]) == False\n assert candidate(ghosts = [[-1, 1], [1, -1], [-1, -1]],target = [1, 1]) == False\n assert candidate(ghosts = [[1000, 1000], [2000, 2000], [1500, 1500], [500, 500]],target = [1500, 1500]) == False\n assert candidate(ghosts = [[1, 2], [3, 4], [5, 6]],target = [3, 3]) == False\n assert candidate(ghosts = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 3]],target = [3, 1]) == False\n assert candidate(ghosts = [[0, 0], [0, 0], [0, 0], [0, 0]],target = [1, 1]) == False\n assert candidate(ghosts = [[100, 0], [0, 100], [-100, 0], [0, -100]],target = [50, 50]) == False\n assert candidate(ghosts = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5]],target = [0, 6]) == False\n assert candidate(ghosts = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5]],target = [-6, -6]) == False\n assert candidate(ghosts = [[-1000, 0], [0, -1000], [1000, 0], [0, 1000]],target = [0, 0]) == True\n assert candidate(ghosts = [[-10, -10], [-9, -9], [-8, -8], [-7, -7], [-6, -6]],target = [-5, -5]) == False\n assert candidate(ghosts = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]],target = [5, 5]) == False\n assert candidate(ghosts = [[-100, -100], [-200, -200], [-300, -300]],target = [-150, -150]) == False\n assert candidate(ghosts = [[5, 5], [5, 5], [5, 5]],target = [10, 10]) == False\n assert candidate(ghosts = [[1, 0], [0, 1], [0, 0], [2, 2], [3, 3]],target = [2, 1]) == False\n assert candidate(ghosts = [[0, 0], [0, 0], [0, 0], [0, 0]],target = [1, 1]) == False\n assert candidate(ghosts = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5], [-6, -6], [-7, -7], [-8, -8], [-9, -9], [-10, -10]],target = [-5, -5]) == False\n assert candidate(ghosts = [[1, 0], [0, 1], [1, 1], [2, 0], [0, 2]],target = [1, 1]) == False\n assert candidate(ghosts = [[0, 1], [1, 0], [0, -1], [-1, 0]],target = [10, 10]) == False\n assert candidate(ghosts = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]],target = [1, 1]) == False\n assert candidate(ghosts = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],target = [0, 0]) == True\n assert candidate(ghosts = [[-1, 0], [0, -1]],target = [-10000, -10000]) == False\n assert candidate(ghosts = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]],target = [2, 2]) == False\n assert candidate(ghosts = [[1000, 1000], [1001, 1001], [1002, 1002]],target = [1003, 1003]) == False\n assert candidate(ghosts = [[-10, -10], [-20, -20], [-30, -30], [-40, -40]],target = [-15, -15]) == False\n"}, "metadata": {"canonical_parameter_names": ["ghosts", "target"], "leetcode_dataset_entry_point": "Solution().escapeGhosts", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var escapeGhosts = function(ghosts, target) {", "container": null, "callable": "escapeGhosts", "parameters": [{"name": "ghosts", "type": "number[][]"}, {"name": "target", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 790, "task_id": "domino-and-tromino-tiling", "difficulty": "Medium", "problem_description": "You have two types of tiles: a 2 x 1 domino shape and a tromino shape. You may rotate these shapes.\n\nGiven an integer n, return the number of ways to tile an 2 x n board. Since the answer may be very large, return it modulo 109 + 7.\nIn a tiling, every square must be covered by a tile. Two tilings are different if and only if there are two 4-directionally adjacent cells on the board such that exactly one of the tilings has both squares occupied by a tile.\n \nExample 1:\n\n\nInput: n = 3\nOutput: 5\nExplanation: The five different ways are show above.\n\nExample 2:\n\nInput: n = 1\nOutput: 1\n\n \nConstraints:\n\n1 <= n <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 3) == 5\n assert candidate(n = 100) == 190242381\n assert candidate(n = 4) == 11\n assert candidate(n = 2) == 2\n assert candidate(n = 1) == 1\n assert candidate(n = 500) == 603582422\n assert candidate(n = 1000) == 979232805\n assert candidate(n = 10) == 1255\n assert candidate(n = 5) == 24\n assert candidate(n = 12) == 6105\n assert candidate(n = 125) == 562894970\n assert candidate(n = 50) == 451995198\n assert candidate(n = 650) == 5517492\n assert candidate(n = 300) == 768506587\n assert candidate(n = 123) == 215563687\n assert candidate(n = 550) == 727269359\n assert candidate(n = 600) == 771568221\n assert candidate(n = 450) == 795340037\n assert candidate(n = 501) == 210280741\n assert candidate(n = 700) == 637136622\n assert candidate(n = 250) == 872044590\n assert candidate(n = 999) == 326038248\n assert candidate(n = 89) == 469785861\n assert candidate(n = 20) == 3418626\n assert candidate(n = 150) == 773955023\n assert candidate(n = 800) == 177362789\n assert candidate(n = 200) == 627399438\n assert candidate(n = 400) == 517656200\n assert candidate(n = 750) == 533845494\n assert candidate(n = 6) == 53\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().numTilings", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numTilings = function(n) {", "container": null, "callable": "numTilings", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 791, "task_id": "custom-sort-string", "difficulty": "Medium", "problem_description": "You are given two strings order and s. All the characters of order are unique and were sorted in some custom order previously.\nPermute the characters of s so that they match the order that order was sorted. More specifically, if a character x occurs before a character y in order, then x should occur before y in the permuted string.\nReturn any permutation of s that satisfies this property.\n \nExample 1:\n\nInput: order = \"cba\", s = \"abcd\" \nOutput: \"cbad\" \nExplanation: \"a\", \"b\", \"c\" appear in order, so the order of \"a\", \"b\", \"c\" should be \"c\", \"b\", and \"a\".\nSince \"d\" does not appear in order, it can be at any position in the returned string. \"dcba\", \"cdba\", \"cbda\" are also valid outputs.\n\nExample 2:\n\nInput: order = \"bcafg\", s = \"abcd\" \nOutput: \"bcad\" \nExplanation: The characters \"b\", \"c\", and \"a\" from order dictate the order for the characters in s. The character \"d\" in s does not appear in order, so its position is flexible.\nFollowing the order of appearance in order, \"b\", \"c\", and \"a\" from s should be arranged as \"b\", \"c\", \"a\". \"d\" can be placed at any position since it's not in order. The output \"bcad\" correctly follows this rule. Other arrangements like \"dbca\" or \"bcda\" would also be valid, as long as \"b\", \"c\", \"a\" maintain their order.\n\n \nConstraints:\n\n1 <= order.length <= 26\n1 <= s.length <= 200\norder and s consist of lowercase English letters.\nAll the characters of order are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(order = \"zyx\",s = \"zyxwvut\") == \"zwvutyx\"\n assert candidate(order = \"abcdefg\",s = \"gfedcba\") == \"abcdefg\"\n assert candidate(order = \"xyz\",s = \"abcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(order = \"mnopqr\",s = \"abcdefghij\") == \"abcdefghij\"\n assert candidate(order = \"abcdef\",s = \"fedcba\") == \"abcdef\"\n assert candidate(order = \"\",s = \"abcdefg\") == \"abcdefg\"\n assert candidate(order = \"zyx\",s = \"abcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwzyx\"\n assert candidate(order = \"abc\",s = \"\") == \"\"\n assert candidate(order = \"a\",s = \"b\") == \"b\"\n assert candidate(order = \"\",s = \"abc\") == \"abc\"\n assert candidate(order = \"xyz\",s = \"aabbcc\") == \"aabbcc\"\n assert candidate(order = \"zyxwvutsrqponmlkjihgfedcba\",s = \"abcdefghijklmnopqrstuvwxyz\") == \"zyxwvutsrqponmlkjihgfedcba\"\n assert candidate(order = \"abc\",s = \"abc\") == \"abc\"\n assert candidate(order = \"cba\",s = \"abcd\") == \"cdba\"\n assert candidate(order = \"zyx\",s = \"xyz\") == \"zyx\"\n assert candidate(order = \"abcd\",s = \"zyxwvutsrqponmlkjihgfedcba\") == \"zyxwvutsrqponmlkjihgfeabcd\"\n assert candidate(order = \"qrstuv\",s = \"uvwxyz\") == \"wxyzuv\"\n assert candidate(order = \"a\",s = \"aabbcc\") == \"aabbcc\"\n assert candidate(order = \"xyz\",s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\"\n assert candidate(order = \"abcdefg\",s = \"\") == \"\"\n assert candidate(order = \"abcdefghijklmnopqrstuvwxyz\",s = \"zyxwvutsrqponmlkjihgfedcba\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(order = \"mnopqr\",s = \"abcdefghijklzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"abcdefghijklzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(order = \"bcafg\",s = \"abcd\") == \"bdca\"\n assert candidate(order = \"\",s = \"anything\") == \"anything\"\n assert candidate(order = \"xyz\",s = \"zyxzyxzyx\") == \"xxxyyyzzz\"\n assert candidate(order = \"poiuytrewqlkjhgfdsamnbvcxz\",s = \"thequickbrownfoxjumpsoverthelazydog\") == \"pooooiuuyttrreeewqlkjhhgfdsamnbvcxz\"\n assert candidate(order = \"acegikm\",s = \"fedcbahjilnmporqstuvwxyz\") == \"fdbahjlnporqstuvwxyzceim\"\n assert candidate(order = \"ghjklm\",s = \"abcdefghijklmnopqrstuvmnopqrstuvwxyz\") == \"abcdefginopqrstuvnopqrstuvwxyzhjklmm\"\n assert candidate(order = \"qrstuv\",s = \"qwertyuiopasdfghjklzxcvbnm\") == \"qweyiopadfghjklzxcbnmrstuv\"\n assert candidate(order = \"abcdef\",s = \"fedcbahgfedcba\") == \"ahgabbccddeeff\"\n assert candidate(order = \"pqrs\",s = \"zyxwvutsrqponmlkjihgfedcba\") == \"zyxwvutponmlkjihgfedcbaqrs\"\n assert candidate(order = \"ghijklmnop\",s = \"fedcbazxcvbnmopqrstuvw\") == \"fedcbazxcvbqrstuvwmnop\"\n assert candidate(order = \"abcdefghijklmnop\",s = \"abcdefghijklmnopabcdefghijklmnop\") == \"aabbccddeeffgghhiijjkkllmmnnoopp\"\n assert candidate(order = \"zyxwvutsrqponmlkjihgfedcba\",s = \"aaabbbcccddd\") == \"dddcccbbbaaa\"\n assert candidate(order = \"aeiouy\",s = \"aeiouyaeiouyaeiouyaeiouy\") == \"aaaaeeeeiiiioooouuuuyyyy\"\n assert candidate(order = \"acegikmoqsuwy\",s = \"abcdefghijklmnopqrstuvwxyz\") == \"abdfhjlnprtvxzcegikmoqsuwy\"\n assert candidate(order = \"abcdef\",s = \"ghijklmnopqrstuvwxyz\") == \"ghijklmnopqrstuvwxyz\"\n assert candidate(order = \"qweasdzxc\",s = \"sazxqwecvfr\") == \"qvfrweaszxc\"\n assert candidate(order = \"abcd\",s = \"aabbccddeeffaabbccddeeff\") == \"aaeeffaaeeffbbbbccccdddd\"\n assert candidate(order = \"fjlad\",s = \"flafjlajldalfajfladflajfl\") == \"ffffffjjjjlllllllaaaaaadd\"\n assert candidate(order = \"abcdefg\",s = \"zyxcba\") == \"zyxabc\"\n assert candidate(order = \"xyz\",s = \"xyzxyzxyzxyzxyz\") == \"xxxxxyyyyyzzzzz\"\n assert candidate(order = \"abcde\",s = \"edcbafghijklmnopqrstuvwxyz\") == \"afghijklmnopqrstuvwxyzbcde\"\n assert candidate(order = \"qrstuv\",s = \"thequickbrownfoxjumpsoverthelazydog\") == \"heqickbownfoxjmpoehelazydogrrsttuuv\"\n assert candidate(order = \"abcd\",s = \"dbcaabcd\") == \"aabbccdd\"\n assert candidate(order = \"qwertyuiopasdfghjklzxcvbnm\",s = \"thequickbrownfoxjumpsoverthelazydog\") == \"qweeerrttyuuioooopasdfghhjklzxcvbnm\"\n assert candidate(order = \"bac\",s = \"abcabcabc\") == \"bbbaaaccc\"\n assert candidate(order = \"abcdefghijklmnopqrstuvwxy\",s = \"abcdefghijklmnopqrstuvwxyz\") == \"azbcdefghijklmnopqrstuvwxy\"\n assert candidate(order = \"jkl\",s = \"thequickbrownfoxjumpsoverthelazydog\") == \"thequicbrownfoxjumpsovertheazydogkl\"\n assert candidate(order = \"abc\",s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == \"aaddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzbbcc\"\n assert candidate(order = \"bdfhjlnprtvxz\",s = \"abcdefghijklmnopqrstuvwxyz\") == \"abcegikmoqsuwydfhjlnprtvxz\"\n assert candidate(order = \"xyz\",s = \"abcdef\") == \"abcdef\"\n assert candidate(order = \"qrstuvw\",s = \"vwutsrqponmlkjihgfedcba\") == \"qponmlkjihgfedcbarstuvw\"\n assert candidate(order = \"qrstuvw\",s = \"zyxwvutsrqponmlkjihgfedcba\") == \"zyxqponmlkjihgfedcbarstuvw\"\n assert candidate(order = \"vwxyz\",s = \"abcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(order = \"abc\",s = \"cccbbaaa\") == \"aaabbccc\"\n assert candidate(order = \"mnop\",s = \"wertyuiopasdfghjklzxcvbnm\") == \"wertyuiasdfghjklzxcvbmnop\"\n assert candidate(order = \"mnopqr\",s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmnopqr\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmnopqr\"\n assert candidate(order = \"abcdef\",s = \"fedcbafedcbafedcbafedcba\") == \"aaaabbbbccccddddeeeeffff\"\n assert candidate(order = \"xyzabc\",s = \"zyxwvutsrqponmlkjihgfedcba\") == \"xwvutsrqponmlkjihgfedyzabc\"\n assert candidate(order = \"bdfhjlnprtvxz\",s = \"aegikmoqsuwy\") == \"aegikmoqsuwy\"\n assert candidate(order = \"aeiou\",s = \"thequickbrownfoxjumpsoverthelazydog\") == \"thqckbrwnfxjmpsvrthlazydgeeeioooouu\"\n assert candidate(order = \"mnopqr\",s = \"rmqponlksjihgfedcba\") == \"mlksjihgfedcbanopqr\"\n assert candidate(order = \"qwer\",s = \"qwertyuiopasdfghjklzxcvbnm\") == \"qtyuiopasdfghjklzxcvbnmwer\"\n assert candidate(order = \"pqrs\",s = \"pqrspqrspqrspqrspqrs\") == \"pppppqqqqqrrrrrsssss\"\n assert candidate(order = \"xyz\",s = \"abcxyzdefxyz\") == \"abcxdefxyyzz\"\n assert candidate(order = \"abcdefghijklm\",s = \"nopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\") == \"nopqrstuvwxyzzyxwvutsrqponabcdefghijklm\"\n assert candidate(order = \"xyz\",s = \"aabbccxxzzyy\") == \"aabbccxxyyzz\"\n assert candidate(order = \"jihgfedcba\",s = \"abcdefghijklmnopqrstuvwxyz\") == \"jklmnopqrstuvwxyzihgfedcba\"\n assert candidate(order = \"lmnop\",s = \"lkjhgfedcba\") == \"lkjhgfedcba\"\n assert candidate(order = \"qwertyuiopasdfghjklzxcvbnm\",s = \"abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\") == \"qqwweerrttyyuuiiooppaassddffgghhjjkkllzzxxccvvbbnnmm\"\n assert candidate(order = \"zxcvbnmlkjhgfdsapoiuytrewq\",s = \"qwertyuiopasdfghjklzxcvbnm\") == \"zxcvbnmlkjhgfdsapoiuytrewq\"\n assert candidate(order = \"a\",s = \"aaaaaaaa\") == \"aaaaaaaa\"\n assert candidate(order = \"qrstuv\",s = \"qoprtusvklmijnhgfeabcdxyz\") == \"qopklmijnhgfeabcdxyzrstuv\"\n assert candidate(order = \"acegikmoqsuwy\",s = \"zyxwvutsrqponmlkjihgfedcba\") == \"zxvtrpnljhfdbacegikmoqsuwy\"\n assert candidate(order = \"abcdefg\",s = \"zyxwvutsrqponmlkjihgfedcba\") == \"zyxwvutsrqponmlkjihabcdefg\"\n assert candidate(order = \"abcd\",s = \"ddcbaaabbccdddddd\") == \"aaabbbcccdddddddd\"\n assert candidate(order = \"mno\",s = \"lkjhgfdcbazyxwvutsrqponmlkjihgfedcba\") == \"lkjhgfdcbazyxwvutsrqpmlkjihgfedcbano\"\n assert candidate(order = \"pqrstuvwxyz\",s = \"abcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(order = \"zyxwvutsrqponmlkjihgfedcba\",s = \"thequickbrownfoxjumpsoverthelazydog\") == \"zyxwvuuttsrrqpoooonmlkjihhgfeeedcba\"\n assert candidate(order = \"mnop\",s = \"pnmlkjoiehgfcdcba\") == \"mlkjiehgfcdcbanop\"\n assert candidate(order = \"ace\",s = \"aaabbbcccddd\") == \"aaabbbdddccc\"\n assert candidate(order = \"abcd\",s = \"dcbaedcba\") == \"aeabbccdd\"\n assert candidate(order = \"abcxyz\",s = \"xyzabczyxcba\") == \"aabbccxxyyzz\"\n assert candidate(order = \"mnopqr\",s = \"mnopqrabcdefghijklmnop\") == \"mabcdefghijklmnnooppqr\"\n assert candidate(order = \"abcdefghij\",s = \"zzzzzyyyxxxwwwwvvvuuuuttttssssrrrrqqqqppppooolllkkkkjjjjiijjhhhgggfffeeedddccccbbbaaaa\") == \"zzzzzyyyxxxwwwwvvvuuuuttttssssrrrrqqqqppppooolllkkkkaaaabbbccccdddeeefffggghhhiijjjjjj\"\n assert candidate(order = \"zyxwvutsrqponmlkjihgfedcba\",s = \"fedcba\") == \"fedcba\"\n assert candidate(order = \"qaz\",s = \"abcdefghijklmnopqrstuvwxyz\") == \"bcdefghijklmnopqrstuvwxyaz\"\n assert candidate(order = \"aeiou\",s = \"abcdefghijklmnopqrstuvwxyz\") == \"abcdfghjklmnpqrstvwxyzeiou\"\n assert candidate(order = \"mnopqr\",s = \"rqponmlkjihgfedcba\") == \"mlkjihgfedcbanopqr\"\n assert candidate(order = \"xyzabc\",s = \"fedcba\") == \"fedabc\"\n assert candidate(order = \"abc\",s = \"ccccbaaabbbccc\") == \"aaabbbbccccccc\"\n assert candidate(order = \"abcdef\",s = \"fedcbafghijklmnopqrstuvwxyz\") == \"aghijklmnopqrstuvwxyzbcdeff\"\n assert candidate(order = \"a\",s = \"a\") == \"a\"\n assert candidate(order = \"bzdx\",s = \"abcdexyz\") == \"abceyzdx\"\n assert candidate(order = \"mnbvcxzlkjhgfdsapoiuytrewq\",s = \"abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\") == \"mmnnbbvvccxxzzllkkjjhhggffddssaappooiiuuyyttrreewwqq\"\n assert candidate(order = \"uvwxy\",s = \"uvwxyuvwxyuvwxyuvwxyuvwxyuvwxy\") == \"uuuuuuvvvvvvwwwwwwxxxxxxyyyyyy\"\n assert candidate(order = \"abcdefghij\",s = \"jihgfedcba\") == \"abcdefghij\"\n assert candidate(order = \"t\",s = \"tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt\") == \"tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt\"\n assert candidate(order = \"mnop\",s = \"mnopmnopmnopmnopmnopmnopmnop\") == \"mmmmmmmnnnnnnnoooooooppppppp\"\n assert candidate(order = \"abcdefgh\",s = \"hgfedcba\") == \"abcdefgh\"\n assert candidate(order = \"a\",s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(order = \"tuvwxyz\",s = \"zyxwvutsrqponmlkjihgfedcba\") == \"tsrqponmlkjihgfedcbauvwxyz\"\n assert candidate(order = \"abc\",s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(order = \"bdfhjlnprtvxz\",s = \"zyxwvutsrqponmlkjihgfedcba\") == \"ywusqomkigecbadfhjlnprtvxz\"\n assert candidate(order = \"fedcba\",s = \"abcdef\") == \"fedcba\"\n assert candidate(order = \"gfedcba\",s = \"zyxwvutsrqponmlkjihgfedcba\") == \"zyxwvutsrqponmlkjihgfedcba\"\n assert candidate(order = \"mnop\",s = \"abmncdopefqrsgthijkl\") == \"abmcdefqrsgthijklnop\"\n assert candidate(order = \"nvmb\",s = \"nvbnvmbvmbnnbmvmbnb\") == \"nnnnnvvvvmmmmbbbbbb\"\n assert candidate(order = \"mnopqr\",s = \"mnopqrstuvwxynmlkjihgfedcba\") == \"mstuvwxymlkjihgfedcbannopqr\"\n assert candidate(order = \"abcxyz\",s = \"zyxcba\") == \"abcxyz\"\n assert candidate(order = \"qrst\",s = \"trqs\") == \"qrst\"\n assert candidate(order = \"xyzuvw\",s = \"zzzzzyyyxxxwwwwvvvuuuuttttssssrrrrqqqqppppooolllkkkkjjjjiijjhhhgggfffeeedddccccbbbaaaa\") == \"xxxttttssssrrrrqqqqppppooolllkkkkjjjjiijjhhhgggfffeeedddccccbbbaaaayyyzzzzzuuuuvvvwwww\"\n assert candidate(order = \"z\",s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(order = \"qz\",s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(order = \"thq\",s = \"thequickbrownfoxjumpsoverthelazydog\") == \"teuickbrownfoxjumpsovertelazydoghhq\"\n assert candidate(order = \"zyxwvutsrqponmlkjihgfedcba\",s = \"zyxwvutsrqponmlkjihgfedcba\") == \"zyxwvutsrqponmlkjihgfedcba\"\n"}, "metadata": {"canonical_parameter_names": ["order", "s"], "leetcode_dataset_entry_point": "Solution().customSortString", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var customSortString = function(order, s) {", "container": null, "callable": "customSortString", "parameters": [{"name": "order", "type": "string"}, {"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 792, "task_id": "number-of-matching-subsequences", "difficulty": "Medium", "problem_description": "Given a string s and an array of strings words, return the number of words[i] that is a subsequence of s.\nA subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.\n\nFor example, \"ace\" is a subsequence of \"abcde\".\n\n \nExample 1:\n\nInput: s = \"abcde\", words = [\"a\",\"bb\",\"acd\",\"ace\"]\nOutput: 3\nExplanation: There are three strings in words that are a subsequence of s: \"a\", \"acd\", \"ace\".\n\nExample 2:\n\nInput: s = \"dsahjpjauf\", words = [\"ahjpjau\",\"ja\",\"ahbwzgqnuk\",\"tnmlanowax\"]\nOutput: 2\n\n \nConstraints:\n\n1 <= s.length <= 5 * 104\n1 <= words.length <= 5000\n1 <= words[i].length <= 50\ns and words[i] consist of only lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"dsahjpjauf\",words = ['ahjpjau', 'ja', 'ahbwzgqnuk', 'tnmlanowax']) == 2\n assert candidate(s = \"abcde\",words = ['a', 'bb', 'acd', 'ace']) == 3\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnm\",words = ['qz', 'qp', 'qw', 'qr', 'qe', 'qt', 'qu', 'qi', 'qo', 'qp', 'qa', 'qs', 'qd', 'qf', 'qg', 'qh', 'qj', 'qk', 'ql', 'qm', 'zn', 'zm', 'zk', 'zj', 'zh', 'zg', 'zf', 'qe', 'qd', 'qc', 'qb', 'qa', 'zv', 'zu', 'zt', 'zs', 'zr', 'zp', 'zo', 'zn', 'zm', 'zk', 'zj', 'zh', 'zg', 'zf', 'ze', 'zd', 'zc', 'zb', 'za']) == 32\n assert candidate(s = \"mississippi\",words = ['miss', 'issi', 'ssip', 'ppis', 'isip', 'ippi', 'sipi', 'sspi', 'issp']) == 8\n assert candidate(s = \"longstringwithvariouscharacters\",words = ['long', 'string', 'with', 'various', 'characters', 'longstring', 'withvarious']) == 7\n assert candidate(s = \"aaaaabbbbbcccc\",words = ['aaabbb', 'bbcc', 'abac', 'aabb', 'accc', 'bbbc', 'cccc', 'bbbb', 'aabbcc']) == 8\n assert candidate(s = \"abacabadabacaba\",words = ['aba', 'abc', 'bac', 'bca', 'cab', 'acb', 'a', 'b', 'c', 'd', 'ab', 'ba', 'bc', 'cb', 'ac', 'ca']) == 16\n assert candidate(s = \"aaaaaaaaaaa\",words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa', 'aaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaaa']) == 10\n assert candidate(s = \"mississippi\",words = ['is', 'issi', 'miss', 'issip', 'ppi', 'ipi', 'mississippi']) == 7\n assert candidate(s = \"thefastbrownfoxjumpsoverthelazydog\",words = ['the', 'fast', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dog', 'thebrownfox', 'jumpsoverthelazy']) == 10\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",words = ['abc', 'xyz', 'mnopqr', 'uvw', 'zabcdefghijklmnopqrst']) == 4\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnm\",words = ['qwerty', 'asdfgh', 'zxcvbn', 'pol', 'lkjhg', 'mnbvcxz', 'yuiop', 'poiuyt', 'hgfdsa', 'xcvbnm', 'qwertyuiop', 'asdfghjklzxcvbnm']) == 7\n assert candidate(s = \"mississippi\",words = ['miss', 'issi', 'ssip', 'ssissipp', 'is', 'mp', 'ms', 's', 'i', 'p', 'pp', 'ip', 'mississippi', 'mississ', 'issipp']) == 15\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",words = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz', 'aaa', 'bbb', 'ccc']) == 9\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",words = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz', 'abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yzab', 'cdef', 'ghij', 'klmn', 'opqr', 'stuv', 'wxyz']) == 21\n assert candidate(s = \"abcabcabcabc\",words = ['abc', 'abcabc', 'abcabcabc', 'abcabcabcabc', 'ab', 'bc', 'ca', 'a', 'b', 'c']) == 10\n assert candidate(s = \"ababababab\",words = ['ab', 'aba', 'aab', 'baba', 'babababababab']) == 4\n assert candidate(s = \"mississippi\",words = ['issi', 'miss', 'mip', 'issip', 'issipp', 'mpis', 'mississippi']) == 6\n assert candidate(s = \"thisisaverylongandrandomstring\",words = ['this', 'is', 'very', 'long', 'and', 'random', 'string', 'av', 'er', 'ry', 'on', 'nd', 'ra', 'nd', 'om', 'mi', 'st', 'in', 'ng']) == 19\n assert candidate(s = \"repeatedcharacters\",words = ['repe', 'peate', 'atedchar', 'char', 'acter', 'ters', 'repeatedcharacters']) == 7\n assert candidate(s = \"abcabcabcabc\",words = ['abc', 'cab', 'bac', 'aaa', 'bbb', 'ccc', 'abcabc', 'abcbca', 'bcbcab', 'cabcab', 'abcabcabc', 'bcabcabc', 'cabcabca', 'a', 'b', 'c']) == 16\n assert candidate(s = \"babcabcabcabcabc\",words = ['ba', 'ca', 'ab', 'bc', 'ac', 'abc', 'bac', 'bca', 'cab', 'cba', 'acb', 'bba', 'aaa', 'ccc']) == 14\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",words = ['abc', 'xyz', 'def', 'uvw', 'mnopqr', 'st', 'ghijkl']) == 7\n assert candidate(s = \"hellohellohellohello\",words = ['he', 'lo', 'ell', 'hell', 'hello', 'heell', 'hellohe', 'helloell', 'helloello', 'hellohello', 'hellohelloh', 'hellohellohe', 'hellohelloell', 'hellohelloello', 'hellohellohello']) == 15\n assert candidate(s = \"abracadabra\",words = ['abra', 'rac', 'cad', 'bra', 'dabra', 'abra', 'acad', 'bracad', 'bracadabra', 'bracadabr', 'abracadabr', 'bracadabraa', 'bracadabrac']) == 11\n assert candidate(s = \"aaaaaaaaaaaaaaaaaa\",words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa', 'aaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaaa']) == 10\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",words = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz']) == 9\n assert candidate(s = \"abacabadabacaba\",words = ['aba', 'abc', 'bac', 'bca', 'cab', 'cba']) == 6\n assert candidate(s = \"zzzzzzzzzz\",words = ['z', 'zz', 'zzz', 'zzzz', 'zzzzz', 'zzzzzz', 'zzzzzzz', 'zzzzzzzz', 'zzzzzzzzz', 'zzzzzzzzzz']) == 10\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnm\",words = ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm']) == 26\n assert candidate(s = \"abracadabra\",words = ['abr', 'rac', 'aca', 'dab', 'bra', 'cad', 'bra', 'abra', 'brac', 'acad', 'radab', 'cabra', 'rabrac', 'acadabra', 'adabra', 'bracadabra', 'acabracadabra']) == 15\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",words = ['a', 'z', 'abc', 'xyz', 'abcdefghijklmnopqrstuvwxyzz']) == 4\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",words = ['z', 'zz', 'zzz', 'zzzz', 'zzzzz', 'zzzzzz', 'zzzzzzz', 'zzzzzzzz', 'zzzzzzzzz', 'zzzzzzzzzz']) == 10\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",words = ['abc', 'xyz', 'mnop', 'qrstuv', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == 31\n assert candidate(s = \"ababababababababababababababababababababababab\",words = ['aa', 'ab', 'ba', 'bb', 'aab', 'aba', 'abb', 'bba', 'bab', 'bbb', 'aaaa', 'abab', 'baba', 'abba', 'baab', 'abaa', 'bbaa', 'aabb', 'abbb', 'baaa', 'baab', 'baaa', 'bbab', 'bbba', 'bbbb', 'aaaaaaaa', 'abababab', 'babababa', 'ababababa', 'babababab']) == 30\n assert candidate(s = \"mississippi\",words = ['miss', 'issi', 'ippi', 'ssss', 'ppii', 'mississi', 'issippi', 'mississippi', 'mpis', 'ppis', 'ipis', 'mipp', 'ssip', 'piss', 'missippi', 'missisipp', 'ississippi', 'ssissippi', 'ippii', 'sippi', 'pissi', 'issis', 'missis', 'ssssip', 'pisssippi', 'issippis', 'pississi', 'sissippii', 'ppisssippi', 'mississippipp', 'ississipp', 'ppississippi', 'sippisippi', 'issississi', 'ppississippi', 'mississippippi', 'issississipp', 'ppissississi', 'sissississippi', 'issississippippi']) == 18\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",words = ['z', 'zz', 'zzz', 'zzzz', 'zzzzz']) == 5\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\",words = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz', 'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxy', 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz']) == 12\n assert candidate(s = \"leetcodeisacommunityforcoders\",words = ['leetcode', 'is', 'acommunity', 'of', 'coders', 'comm', 's', 't']) == 8\n assert candidate(s = \"abababababababababababababababababababababababababab\",words = ['aa', 'bb', 'ab', 'ba', 'aab', 'abb', 'bab', 'bba']) == 8\n assert candidate(s = \"bbaaaaabbbb\",words = ['bb', 'aaaa', 'bbb', 'baab', 'abba', 'aaaaa', 'bbbbb', 'bababa', 'bbbbba', 'ababab', 'bbabba']) == 6\n assert candidate(s = \"aaaaaaaabbbbbbbbccccccccdddddddd\",words = ['aaaa', 'bbbb', 'cccc', 'dddd', 'abdc', 'dcba', 'abcd', 'dcba', 'aabb', 'bbcc', 'ccdd', 'dddd', 'ac', 'bd', 'ca', 'db']) == 11\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",words = ['zz', 'zzz', 'zzzz', 'zzzzz', 'zzzzzz']) == 5\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnm\",words = ['qaz', 'wsx', 'edc', 'rfv', 'tgb', 'yhn', 'ujm', 'ikl', 'opy', 'asdf', 'ghjkl', 'zxcvbnm', 'ertyui', 'poiuyt', 'lkjhgfdsa', 'nmolkjiuhgfedcba']) == 12\n assert candidate(s = \"xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz\",words = ['xyz', 'xy', 'yz', 'xz', 'xx', 'yy', 'zz', 'xzy', 'yzx', 'zxy', 'xyzxyz', 'xyxyxy', 'yzyzyz', 'xzxzxz', 'xxx', 'yyy', 'zzz', 'xzyxzyxzy', 'yzxyzxyz', 'zxzyzxzyz', 'xyzxyzxyzxyz']) == 21\n assert candidate(s = \"aaaaaa\",words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa', 'aaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaaa']) == 6\n assert candidate(s = \"lkjhgfdsapoiuytrewq\",words = ['poi', 'uyt', 'rew', 'qwe', 'lkj', 'hgf', 'dsa', 'lkjh', 'gfds', 'poiu', 'uytr', 'trew', 'qwe', 'lkjhg', 'gfdsa', 'poiu', 'uytrw', 'trewq']) == 16\n assert candidate(s = \"abacabadabacaba\",words = ['aba', 'abc', 'aca', 'ada', 'baa', 'bac', 'bda', 'cab', 'cad', 'cda', 'daa', 'dac', 'dba']) == 13\n assert candidate(s = \"aaaaaaaaaaaaaaa\",words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa', 'aaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaaa']) == 10\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",words = ['abc', 'mnop', 'xyz', 'qrstuv', 'wxyz', 'defghijkl', 'nopqrstuv']) == 7\n assert candidate(s = \"aaaaaaaaaaaaaaa\",words = ['aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa', 'aaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaaa']) == 9\n assert candidate(s = \"abababababababababababab\",words = ['aba', 'bab', 'aaa', 'bbb', 'aab', 'aba', 'aabbaa', 'bbbabb', 'ab', 'ba', 'aa', 'bb', 'abab', 'baba', 'ababa', 'babab', 'ababab', 'bababa']) == 18\n assert candidate(s = \"bcbabbbbaabaaabaababbbbbbaaabbbabbababbababba\",words = ['bb', 'ba', 'bbba', 'bab', 'bbab', 'aa', 'aaa', 'aaaa', 'aaaaa', 'a', 'b', 'ab', 'ba', 'aba', 'bab', 'bba', 'abb', 'aab', 'bbb', 'bbbba']) == 20\n assert candidate(s = \"thisisaverylongstringwithseveralrepetitions\",words = ['this', 'is', 'a', 'very', 'long', 'string', 'with', 'several', 'repetitions', 'verylong', 'stringwith', 'longstring', 'thisisavery', 'averylongstring', 'thisisaverylongstringwithseveralrepetitions']) == 15\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",words = ['abc', 'xyz', 'abcd', 'uvw', 'wxyz', 'mnopqr', 'def', 'ghi', 'jkl', 'stu']) == 10\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",words = ['zyx', 'wvut', 'srqp', 'onml', 'kjih', 'gfed', 'cba', 'abc']) == 7\n"}, "metadata": {"canonical_parameter_names": ["s", "words"], "leetcode_dataset_entry_point": "Solution().numMatchingSubseq", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numMatchingSubseq = function(s, words) {", "container": null, "callable": "numMatchingSubseq", "parameters": [{"name": "s", "type": "string"}, {"name": "words", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 793, "task_id": "preimage-size-of-factorial-zeroes-function", "difficulty": "Hard", "problem_description": "Let f(x) be the number of zeroes at the end of x!. Recall that x! = 1 * 2 * 3 * ... * x and by convention, 0! = 1.\n\nFor example, f(3) = 0 because 3! = 6 has no zeroes at the end, while f(11) = 2 because 11! = 39916800 has two zeroes at the end.\n\nGiven an integer k, return the number of non-negative integers x have the property that f(x) = k.\n \nExample 1:\n\nInput: k = 0\nOutput: 5\nExplanation: 0!, 1!, 2!, 3!, and 4! end with k = 0 zeroes.\n\nExample 2:\n\nInput: k = 5\nOutput: 0\nExplanation: There is no x such that x! ends in k = 5 zeroes.\n\nExample 3:\n\nInput: k = 3\nOutput: 5\n\n \nConstraints:\n\n0 <= k <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(k = 100) == 5\n assert candidate(k = 1) == 5\n assert candidate(k = 10000) == 5\n assert candidate(k = 1000000) == 5\n assert candidate(k = 3) == 5\n assert candidate(k = 0) == 5\n assert candidate(k = 1000) == 5\n assert candidate(k = 100000) == 5\n assert candidate(k = 5) == 0\n assert candidate(k = 25) == 5\n assert candidate(k = 10) == 5\n assert candidate(k = 48828125) == 5\n assert candidate(k = 1192092) == 5\n assert candidate(k = 9999) == 5\n assert candidate(k = 50) == 5\n assert candidate(k = 100000000) == 5\n assert candidate(k = 2384185) == 5\n assert candidate(k = 6) == 5\n assert candidate(k = 1000045) == 5\n assert candidate(k = 19073486) == 5\n assert candidate(k = 13) == 5\n assert candidate(k = 1000025) == 5\n assert candidate(k = 625) == 5\n assert candidate(k = 3125) == 5\n assert candidate(k = 1000035) == 0\n assert candidate(k = 5000) == 5\n assert candidate(k = 78125) == 5\n assert candidate(k = 1249) == 5\n assert candidate(k = 10000000) == 5\n assert candidate(k = 200000) == 5\n assert candidate(k = 1250) == 5\n assert candidate(k = 4768371) == 5\n assert candidate(k = 50000001) == 5\n assert candidate(k = 80000) == 5\n assert candidate(k = 750000) == 5\n assert candidate(k = 4096) == 5\n assert candidate(k = 627) == 5\n assert candidate(k = 1000050) == 5\n assert candidate(k = 536870912) == 5\n assert candidate(k = 2500000) == 5\n assert candidate(k = 2048) == 5\n assert candidate(k = 1000015) == 5\n assert candidate(k = 152587890) == 5\n assert candidate(k = 123456789) == 5\n assert candidate(k = 1000001) == 5\n assert candidate(k = 5000000) == 5\n assert candidate(k = 31250) == 5\n assert candidate(k = 1000000000) == 5\n assert candidate(k = 20000) == 5\n assert candidate(k = 1000005) == 5\n assert candidate(k = 2) == 5\n assert candidate(k = 1000020) == 5\n assert candidate(k = 99999) == 5\n assert candidate(k = 610351562) == 5\n assert candidate(k = 2499999) == 5\n assert candidate(k = 1000010) == 0\n assert candidate(k = 9) == 5\n assert candidate(k = 123456) == 5\n assert candidate(k = 987654321) == 5\n assert candidate(k = 258) == 5\n assert candidate(k = 500000) == 5\n assert candidate(k = 9765625) == 5\n assert candidate(k = 32) == 5\n assert candidate(k = 268435456) == 5\n assert candidate(k = 101) == 5\n assert candidate(k = 76293945) == 5\n assert candidate(k = 99999999) == 5\n assert candidate(k = 15625) == 5\n assert candidate(k = 999999) == 5\n assert candidate(k = 64) == 5\n assert candidate(k = 390625) == 5\n assert candidate(k = 38146972) == 5\n assert candidate(k = 2147483647) == 5\n assert candidate(k = 1953125) == 5\n assert candidate(k = 31) == 5\n assert candidate(k = 50000000) == 5\n assert candidate(k = 1220703125) == 5\n assert candidate(k = 250) == 5\n assert candidate(k = 125) == 5\n assert candidate(k = 16) == 5\n assert candidate(k = 999999999) == 5\n assert candidate(k = 256) == 5\n assert candidate(k = 1001) == 5\n assert candidate(k = 249) == 5\n assert candidate(k = 9536743) == 5\n assert candidate(k = 500000000) == 5\n assert candidate(k = 1000030) == 5\n assert candidate(k = 20) == 5\n assert candidate(k = 1024) == 5\n assert candidate(k = 39062) == 5\n assert candidate(k = 244140625) == 5\n assert candidate(k = 500) == 5\n assert candidate(k = 1000040) == 5\n assert candidate(k = 21) == 5\n assert candidate(k = 800000000) == 5\n assert candidate(k = 12345) == 5\n assert candidate(k = 4) == 5\n assert candidate(k = 129) == 0\n assert candidate(k = 305175781) == 5\n assert candidate(k = 8) == 5\n assert candidate(k = 512) == 5\n assert candidate(k = 11) == 0\n assert candidate(k = 128) == 5\n assert candidate(k = 50000) == 5\n"}, "metadata": {"canonical_parameter_names": ["k"], "leetcode_dataset_entry_point": "Solution().preimageSizeFZF", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var preimageSizeFZF = function(k) {", "container": null, "callable": "preimageSizeFZF", "parameters": [{"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 794, "task_id": "valid-tic-tac-toe-state", "difficulty": "Medium", "problem_description": "Given a Tic-Tac-Toe board as a string array board, return true if and only if it is possible to reach this board position during the course of a valid tic-tac-toe game.\nThe board is a 3 x 3 array that consists of characters ' ', 'X', and 'O'. The ' ' character represents an empty square.\nHere are the rules of Tic-Tac-Toe:\n\nPlayers take turns placing characters into empty squares ' '.\nThe first player always places 'X' characters, while the second player always places 'O' characters.\n'X' and 'O' characters are always placed into empty squares, never filled ones.\nThe game ends when there are three of the same (non-empty) character filling any row, column, or diagonal.\nThe game also ends if all squares are non-empty.\nNo more moves can be played if the game is over.\n\n \nExample 1:\n\n\nInput: board = [\"O \",\" \",\" \"]\nOutput: false\nExplanation: The first player always plays \"X\".\n\nExample 2:\n\n\nInput: board = [\"XOX\",\" X \",\" \"]\nOutput: false\nExplanation: Players take turns making moves.\n\nExample 3:\n\n\nInput: board = [\"XOX\",\"O O\",\"XOX\"]\nOutput: true\n\n \nConstraints:\n\nboard.length == 3\nboard[i].length == 3\nboard[i][j] is either 'X', 'O', or ' '.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(board = ['XOX', 'O O', 'XOX']) == True\n assert candidate(board = ['X ', 'X ', 'X ']) == False\n assert candidate(board = ['XOX', 'O O', 'XOX']) == True\n assert candidate(board = ['XXX', ' ', 'O O']) == True\n assert candidate(board = ['X ', ' O ', ' ']) == True\n assert candidate(board = ['XOX', 'XOX', 'XOX']) == False\n assert candidate(board = ['OXX', 'XOX', 'OXO']) == False\n assert candidate(board = ['OOO', ' ', ' ']) == False\n assert candidate(board = ['XOX', 'OXO', ' ']) == True\n assert candidate(board = ['XOX', 'OXO', 'XOX']) == True\n assert candidate(board = ['XXO', 'OXO', 'XOX']) == True\n assert candidate(board = ['XXO', 'XOX', 'OXO']) == False\n assert candidate(board = ['XXX', ' ', ' ']) == False\n assert candidate(board = ['X ', ' X ', ' X']) == False\n assert candidate(board = ['XXO', 'OOX', 'OXO']) == False\n assert candidate(board = ['X ', 'XO ', ' X ']) == False\n assert candidate(board = ['XXX', ' ', 'OOO']) == False\n assert candidate(board = ['XOX', 'O O', 'XOX']) == True\n assert candidate(board = ['XOX', 'OOO', 'XOX']) == False\n assert candidate(board = ['XO ', 'OX ', 'OXO']) == False\n assert candidate(board = ['X ', ' O ', 'XOX']) == True\n assert candidate(board = ['XX ', 'OO ', ' ']) == True\n assert candidate(board = ['XOO', 'XOX', 'OOX']) == False\n assert candidate(board = ['XX ', 'OOX', 'XOX']) == False\n assert candidate(board = ['XXO', 'XOX', 'OOX']) == False\n assert candidate(board = ['OOO', 'XOX', 'XXO']) == False\n assert candidate(board = ['XOX', 'O O', ' ']) == False\n assert candidate(board = ['XOX', ' X ', ' ']) == False\n assert candidate(board = ['XOX', 'OOX', 'XOX']) == False\n assert candidate(board = ['OOO', 'OOO', 'OOO']) == False\n assert candidate(board = ['OXO', 'XOX', 'OXO']) == False\n assert candidate(board = ['XOO', 'XOX', 'OXO']) == False\n assert candidate(board = [' ', 'XOX', ' ']) == True\n assert candidate(board = ['X ', ' O ', ' O']) == False\n assert candidate(board = ['XOO', 'OXO', 'XOX']) == False\n assert candidate(board = ['XOX', 'XOX', 'OOO']) == False\n assert candidate(board = ['XXO', 'OXO', 'OXO']) == False\n assert candidate(board = ['XOO', 'XOX', 'XOX']) == False\n assert candidate(board = ['XXX', 'OOO', ' ']) == False\n assert candidate(board = ['XXX', 'OOO', ' ']) == False\n assert candidate(board = ['XOX', 'OXO', 'XO ']) == False\n assert candidate(board = ['OOO', 'X X', 'XOX']) == True\n assert candidate(board = ['XOX', 'OXO', 'XOX']) == True\n assert candidate(board = [' ', 'XXX', ' ']) == False\n assert candidate(board = ['O ', ' ', ' ']) == False\n assert candidate(board = ['XXO', 'OXO', 'XOX']) == True\n assert candidate(board = ['OOO', ' ', ' ']) == False\n assert candidate(board = ['X ', ' X ', ' X']) == False\n assert candidate(board = ['XOO', 'XOO', 'XOO']) == False\n assert candidate(board = ['X ', ' O ', ' X']) == True\n assert candidate(board = ['O ', ' ', ' ']) == False\n assert candidate(board = ['XXX', ' ', ' ']) == False\n assert candidate(board = ['OXX', 'OXO', 'XOX']) == True\n assert candidate(board = ['XXO', 'OXO', 'OXO']) == False\n assert candidate(board = ['XXX', 'OOO', 'XXX']) == False\n assert candidate(board = [' ', ' ', ' ']) == True\n assert candidate(board = ['XOX', ' X ', ' ']) == False\n assert candidate(board = ['XXO', 'OOX', 'XOX']) == True\n assert candidate(board = ['XXO', 'OXO', 'XOX']) == True\n assert candidate(board = ['X ', ' O ', ' O']) == False\n assert candidate(board = ['X ', ' O ', ' X ']) == True\n assert candidate(board = ['X ', 'OOO', 'X ']) == False\n assert candidate(board = ['XOX', 'OXX', 'OXO']) == True\n assert candidate(board = ['X ', ' O ', 'X ']) == True\n assert candidate(board = ['XOO', 'XOX', 'OXO']) == False\n assert candidate(board = ['X O', 'X O', 'X O']) == False\n assert candidate(board = ['XXX', ' ', ' ']) == False\n assert candidate(board = ['XXO', 'XOX', 'OOO']) == False\n assert candidate(board = ['XXO', 'XOX', 'OXO']) == False\n assert candidate(board = ['XOX', 'OXO', 'OOX']) == False\n assert candidate(board = ['O ', 'O ', 'O ']) == False\n assert candidate(board = ['XXO', 'OXO', 'OOX']) == False\n assert candidate(board = [' ', ' ', ' ']) == True\n assert candidate(board = ['XX ', 'OOX', 'X ']) == False\n assert candidate(board = [' ', ' ', 'XXX']) == False\n assert candidate(board = ['OOO', ' ', ' ']) == False\n assert candidate(board = ['X ', ' O ', ' X']) == True\n assert candidate(board = [' ', ' ', 'XXX']) == False\n assert candidate(board = ['O ', ' O ', ' O']) == False\n assert candidate(board = ['XO ', 'OX ', ' ']) == True\n assert candidate(board = ['XOX', 'OXO', 'XOX']) == True\n assert candidate(board = ['XO ', 'OXO', 'OXO']) == False\n assert candidate(board = ['X ', ' ', ' O']) == True\n assert candidate(board = ['O ', ' ', ' ']) == False\n assert candidate(board = ['XOX', ' X ', ' ']) == False\n assert candidate(board = ['XXX', 'XXX', 'XXX']) == False\n assert candidate(board = ['X ', 'X ', 'X ']) == False\n assert candidate(board = ['OOO', ' ', 'XXX']) == False\n assert candidate(board = ['O ', ' O ', ' O']) == False\n assert candidate(board = ['XOX', 'XOX', 'XOX']) == False\n assert candidate(board = [' ', ' ', ' ']) == True\n"}, "metadata": {"canonical_parameter_names": ["board"], "leetcode_dataset_entry_point": "Solution().validTicTacToe", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var validTicTacToe = function(board) {", "container": null, "callable": "validTicTacToe", "parameters": [{"name": "board", "type": "string[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 795, "task_id": "number-of-subarrays-with-bounded-maximum", "difficulty": "Medium", "problem_description": "Given an integer array nums and two integers left and right, return the number of contiguous non-empty subarrays such that the value of the maximum array element in that subarray is in the range [left, right].\nThe test cases are generated so that the answer will fit in a 32-bit integer.\n \nExample 1:\n\nInput: nums = [2,1,4,3], left = 2, right = 3\nOutput: 3\nExplanation: There are three subarrays that meet the requirements: [2], [2, 1], [3].\n\nExample 2:\n\nInput: nums = [2,9,2,5,6], left = 2, right = 8\nOutput: 7\n\n \nConstraints:\n\n1 <= nums.length <= 105\n0 <= nums[i] <= 109\n0 <= left <= right <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [5, 2, 1],left = 1,right = 5) == 6\n assert candidate(nums = [73, 55, 36, 5, 55, 14, 9, 7, 72, 52],left = 32,right = 69) == 22\n assert candidate(nums = [2, 1, 4, 3],left = 2,right = 3) == 3\n assert candidate(nums = [8, 2, 4, 4, 4, 6, 7, 7, 7, 8],left = 4,right = 6) == 14\n assert candidate(nums = [10, 20, 30, 40, 50],left = 15,right = 45) == 9\n assert candidate(nums = [5, 2, 4, 5, 5, 5, 6, 5, 5, 5],left = 4,right = 5) == 26\n assert candidate(nums = [2, 9, 2, 5, 6],left = 2,right = 8) == 7\n assert candidate(nums = [5, 5, 5, 5, 5],left = 5,right = 5) == 15\n assert candidate(nums = [10, 20, 30],left = 25,right = 25) == 0\n assert candidate(nums = [1, 2, 3],left = 1,right = 3) == 6\n assert candidate(nums = [10, 20, 30, 40, 50],left = 20,right = 40) == 9\n assert candidate(nums = [1, 2, 3, 4, 5],left = 2,right = 4) == 9\n assert candidate(nums = [5, 5, 5, 5, 5],left = 5,right = 5) == 15\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50],left = 30,right = 80) == 43\n assert candidate(nums = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 9, 3, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5],left = 5,right = 10) == 2028\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],left = 10,right = 20) == 0\n assert candidate(nums = [10, 5, 3, 15, 7, 9, 20, 1],left = 5,right = 10) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],left = 1,right = 10) == 55\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],left = 0,right = 2) == 210\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],left = 5,right = 15) == 33\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15],left = 4,right = 12) == 18\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13],left = 4,right = 10) == 12\n assert candidate(nums = [8, 1, 6, 3, 5, 7, 2, 9, 4, 10],left = 3,right = 7) == 20\n assert candidate(nums = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9],left = 3,right = 6) == 49\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1],left = 3,right = 7) == 25\n assert candidate(nums = [2, 3, 2, 1, 2, 3, 4, 3, 2, 1],left = 2,right = 3) == 25\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],left = 50,right = 950) == 45\n assert candidate(nums = [3, 2, 1, 4, 3, 5, 4, 3, 2, 1],left = 2,right = 4) == 23\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],left = 4,right = 8) == 35\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2],left = 1,right = 2) == 55\n assert candidate(nums = [100, 200, 300, 400, 500],left = 150,right = 350) == 5\n assert candidate(nums = [1, 2, 2, 2, 2, 2, 2, 2, 2, 1],left = 2,right = 2) == 53\n assert candidate(nums = [1, 10, 2, 9, 3, 8, 4, 7, 5, 6],left = 3,right = 8) == 21\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],left = 1,right = 5) == 120\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7],left = 7,right = 7) == 55\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],left = 10,right = 100) == 55\n assert candidate(nums = [7, 4, 7, 2, 5, 3, 6],left = 4,right = 6) == 9\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15],left = 6,right = 12) == 15\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7],left = 5,right = 5) == 0\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],left = 6,right = 14) == 25\n assert candidate(nums = [5, 4, 3, 2, 1, 0, 1, 2, 3, 4],left = 1,right = 3) == 27\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],left = 25,right = 75) == 25\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],left = 1,right = 1) == 55\n assert candidate(nums = [5, 4, 3, 2, 1],left = 2,right = 4) == 9\n assert candidate(nums = [3, 7, 2, 5, 4, 6, 1, 8, 9],left = 4,right = 7) == 25\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],left = 0,right = 0) == 55\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],left = 4,right = 8) == 30\n assert candidate(nums = [4, 2, 7, 3, 6, 5, 8, 1, 9, 0],left = 3,right = 7) == 20\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],left = 400,right = 800) == 30\n assert candidate(nums = [5, 10, 5, 10, 5, 10, 5, 10],left = 5,right = 10) == 36\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15],left = 5,right = 10) == 12\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5],left = 5,right = 15) == 66\n assert candidate(nums = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],left = 10,right = 15) == 27\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2],left = 1,right = 3) == 55\n assert candidate(nums = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10],left = 3,right = 8) == 33\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],left = 10,right = 20) == 165\n assert candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1],left = 3,right = 6) == 18\n assert candidate(nums = [3, 2, 1, 2, 3, 2, 1, 2, 3],left = 2,right = 3) == 43\n assert candidate(nums = [7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],left = 5,right = 9) == 45\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],left = 4,right = 8) == 35\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],left = 5,right = 15) == 110\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],left = 5,right = 10) == 45\n assert candidate(nums = [1, 4, 2, 3, 5, 6, 7, 8, 9, 10],left = 3,right = 8) == 34\n assert candidate(nums = [5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5],left = 1,right = 4) == 44\n assert candidate(nums = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8],left = 5,right = 10) == 210\n assert candidate(nums = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6],left = 3,right = 5) == 39\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],left = 2,right = 8) == 42\n assert candidate(nums = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8],left = 8,right = 8) == 55\n assert candidate(nums = [1, 3, 5, 2, 4, 6, 8, 7],left = 2,right = 6) == 20\n assert candidate(nums = [3, 4, 2, 2, 2, 2, 2, 4, 3, 1],left = 2,right = 3) == 18\n assert candidate(nums = [1000000000, 999999999, 1000000000, 999999999, 1000000000],left = 500000000,right = 1500000000) == 15\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],left = 200,right = 800) == 35\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],left = 1,right = 1) == 120\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],left = 15,right = 95) == 44\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7],left = 5,right = 9) == 55\n assert candidate(nums = [100, 200, 300, 400, 500],left = 150,right = 450) == 9\n assert candidate(nums = [5, 4, 3, 2, 1],left = 1,right = 3) == 6\n assert candidate(nums = [5, 1, 4, 3, 2, 5, 6, 7, 8, 5],left = 3,right = 6) == 27\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],left = 250,right = 750) == 25\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],left = 3,right = 7) == 25\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3],left = 2,right = 4) == 55\n assert candidate(nums = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],left = 10,right = 15) == 39\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],left = 2,right = 4) == 33\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],left = 4,right = 7) == 22\n assert candidate(nums = [1, 5, 1, 5, 1, 5, 1, 5, 1, 5],left = 5,right = 5) == 50\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],left = 3,right = 7) == 25\n assert candidate(nums = [3, 7, 2, 5, 9, 1, 6],left = 3,right = 7) == 11\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],left = 100,right = 1000) == 55\n assert candidate(nums = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8],left = 5,right = 10) == 55\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],left = 5,right = 5) == 210\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15],left = 4,right = 10) == 12\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13],left = 2,right = 10) == 14\n assert candidate(nums = [10, 12, 8, 7, 5, 4, 3, 11, 6, 10],left = 5,right = 10) == 16\n assert candidate(nums = [7, 1, 8, 2, 3, 8, 4, 5, 6, 8, 7, 1, 2],left = 3,right = 7) == 13\n assert candidate(nums = [1, 100, 1, 100, 1, 100, 1, 100, 1, 100],left = 50,right = 150) == 50\n assert candidate(nums = [5, 8, 1, 4, 9, 7, 6, 3, 2, 10],left = 4,right = 7) == 10\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],left = 5,right = 10) == 45\n assert candidate(nums = [10, 20, 30, 40, 50],left = 25,right = 45) == 7\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7],left = 6,right = 8) == 55\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],left = 2,right = 2) == 8\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],left = 0,right = 1) == 120\n"}, "metadata": {"canonical_parameter_names": ["nums", "left", "right"], "leetcode_dataset_entry_point": "Solution().numSubarrayBoundedMax", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numSubarrayBoundedMax = function(nums, left, right) {", "container": null, "callable": "numSubarrayBoundedMax", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "left", "type": "number"}, {"name": "right", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 796, "task_id": "rotate-string", "difficulty": "Easy", "problem_description": "Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s.\nA shift on s consists of moving the leftmost character of s to the rightmost position.\n\nFor example, if s = \"abcde\", then it will be \"bcdea\" after one shift.\n\n \nExample 1:\nInput: s = \"abcde\", goal = \"cdeab\"\nOutput: true\nExample 2:\nInput: s = \"abcde\", goal = \"abced\"\nOutput: false\n\n \nConstraints:\n\n1 <= s.length, goal.length <= 100\ns and goal consist of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"aaa\",goal = \"aaa\") == True\n assert candidate(s = \"abcdefg\",goal = \"efgabcd\") == True\n assert candidate(s = \"abab\",goal = \"abba\") == False\n assert candidate(s = \"abcd\",goal = \"dcba\") == False\n assert candidate(s = \"abcd\",goal = \"dabc\") == True\n assert candidate(s = \"hello\",goal = \"lohel\") == True\n assert candidate(s = \"aa\",goal = \"aa\") == True\n assert candidate(s = \"abcdef\",goal = \"defabc\") == True\n assert candidate(s = \"a\",goal = \"b\") == False\n assert candidate(s = \"aaaa\",goal = \"aaaa\") == True\n assert candidate(s = \"abab\",goal = \"abab\") == True\n assert candidate(s = \"aaa\",goal = \"aab\") == False\n assert candidate(s = \"xyz\",goal = \"zyx\") == False\n assert candidate(s = \"abcabcabc\",goal = \"abcabcabc\") == True\n assert candidate(s = \"whassup\",goal = \"psus\") == False\n assert candidate(s = \"abcde\",goal = \"abced\") == False\n assert candidate(s = \"a\",goal = \"a\") == True\n assert candidate(s = \"abcd\",goal = \"bcda\") == True\n assert candidate(s = \"abcd\",goal = \"abcd\") == True\n assert candidate(s = \"hello\",goal = \"llohe\") == True\n assert candidate(s = \"waterbottle\",goal = \"erbottlewat\") == True\n assert candidate(s = \"ab\",goal = \"ba\") == True\n assert candidate(s = \"abcd\",goal = \"cdab\") == True\n assert candidate(s = \"abcde\",goal = \"cdeab\") == True\n assert candidate(s = \"abcdef\",goal = \"ghijkl\") == False\n assert candidate(s = \"aabbccdd\",goal = \"ccddaabb\") == True\n assert candidate(s = \"abcdefgabcdefg\",goal = \"efgabcdefgabcd\") == True\n assert candidate(s = \"onetwothree\",goal = \"threeonetwo\") == True\n assert candidate(s = \"rotationexample\",goal = \"examplerotation\") == True\n assert candidate(s = \"abcdefabcdef\",goal = \"fabcdefabcde\") == True\n assert candidate(s = \"testtesttest\",goal = \"sttesttestte\") == True\n assert candidate(s = \"xyzxyz\",goal = \"xyzxyz\") == True\n assert candidate(s = \"pattern\",goal = \"ternpat\") == True\n assert candidate(s = \"algorithm\",goal = \"rithmalgo\") == True\n assert candidate(s = \"aaaaaaa\",goal = \"aaaaaaa\") == True\n assert candidate(s = \"identicalstring\",goal = \"identicalstring\") == True\n assert candidate(s = \"longerstringhere\",goal = \"stringhereelong\") == False\n assert candidate(s = \"mnopqr\",goal = \"nopqrm\") == True\n assert candidate(s = \"aabbccddeeff\",goal = \"ccddeeffaabb\") == True\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",goal = \"zzzzyyxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbbaa\") == False\n assert candidate(s = \"uniqueword\",goal = \"wordunique\") == True\n assert candidate(s = \"abcdefghij\",goal = \"ghijklmnopqr\") == False\n assert candidate(s = \"banana\",goal = \"ananab\") == True\n assert candidate(s = \"uniquestring\",goal = \"nguniquestri\") == True\n assert candidate(s = \"aaaaabbbbb\",goal = \"bbbbbAAAAA\") == False\n assert candidate(s = \"longstringfortesting\",goal = \"testinglongstringfor\") == True\n assert candidate(s = \"interview\",goal = \"erviewint\") == True\n assert candidate(s = \"xyzabcxyz\",goal = \"abcxyzxyz\") == True\n assert candidate(s = \"onesymbola\",goal = \"symbolaone\") == True\n assert candidate(s = \"repeatedrepeated\",goal = \"atedrepeatedrepe\") == True\n assert candidate(s = \"aquickbrownfoxjumpsoverthelazydog\",goal = \"thelazydogaquickbrownfoxjumpsover\") == True\n assert candidate(s = \"xyzxyzxyz\",goal = \"xyzxyzxyz\") == True\n assert candidate(s = \"unique\",goal = \"queuni\") == True\n assert candidate(s = \"banana\",goal = \"anabna\") == False\n assert candidate(s = \"abcdefghijk\",goal = \"ghijkabcdef\") == True\n assert candidate(s = \"programming\",goal = \"ammingprogr\") == True\n assert candidate(s = \"quickbrownfox\",goal = \"oxquickbrownf\") == True\n assert candidate(s = \"xyzxyzxyz\",goal = \"yzxyzxyzx\") == True\n assert candidate(s = \"almostmatchingbutnotquite\",goal = \"almostmatchingbutnotquit\") == False\n assert candidate(s = \"abcdabcdabcd\",goal = \"cdabcdabcda\") == False\n assert candidate(s = \"rotatestring\",goal = \"stringrotate\") == True\n assert candidate(s = \"thisisaverylongstringthatshouldworkwell\",goal = \"wellthisisaverylongstringthatshoul\") == False\n assert candidate(s = \"aaaabbbbccccddddeeeeffff\",goal = \"ffffaaaabbbbccccddddeeee\") == True\n assert candidate(s = \"mississippi\",goal = \"pimississi\") == False\n assert candidate(s = \"interview\",goal = \"erviewin\") == False\n assert candidate(s = \"aabbccdd\",goal = \"ccddaabbaa\") == False\n assert candidate(s = \"xyzabc\",goal = \"abcxyz\") == True\n assert candidate(s = \"singleletter\",goal = \"singleletter\") == True\n assert candidate(s = \"repeated\",goal = \"atedrepe\") == True\n assert candidate(s = \"abcdefghij\",goal = \"ghijklabce\") == False\n assert candidate(s = \"xyzxyz\",goal = \"zxyzxy\") == True\n assert candidate(s = \"algorithms\",goal = \"msalgorith\") == True\n assert candidate(s = \"shiftthisstring\",goal = \"stringshiftthis\") == True\n assert candidate(s = \"abcdabcdabcd\",goal = \"dabcdabcda\") == False\n assert candidate(s = \"abcde\",goal = \"deabc\") == True\n assert candidate(s = \"stackoverflow\",goal = \"flowoversta\") == False\n assert candidate(s = \"shiftandrotate\",goal = \"androtateshift\") == True\n assert candidate(s = \"onetwothreefourfivesixseveneightnine\",goal = \"nineonetwothreefourfivesixseveneigh\") == False\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",goal = \"zabcdefghijklmnopqrstuvwxy\") == True\n assert candidate(s = \"xyxyxyxyxyxy\",goal = \"xyxyxyxyxyyx\") == False\n assert candidate(s = \"programming\",goal = \"mingprogram\") == True\n assert candidate(s = \"abcdefgh\",goal = \"efghabcd\") == True\n assert candidate(s = \"repeatedcharacterszzzz\",goal = \"zzzzrepeatedcharacters\") == True\n assert candidate(s = \"almostdone\",goal = \"nearlycom\") == False\n assert candidate(s = \"samestring\",goal = \"stringames\") == False\n assert candidate(s = \"complexproblem\",goal = \"lecomplexprobo\") == False\n assert candidate(s = \"abababab\",goal = \"babababa\") == True\n assert candidate(s = \"ababab\",goal = \"bababa\") == True\n assert candidate(s = \"algorithm\",goal = \"rithalgo\") == False\n assert candidate(s = \"aabbccddeeff\",goal = \"ddeeffaabbcc\") == True\n assert candidate(s = \"qwertyuiop\",goal = \"uiopqwerty\") == True\n assert candidate(s = \"uniquestring\",goal = \"stringunique\") == True\n assert candidate(s = \"longstringexample\",goal = \"examplelongstring\") == True\n assert candidate(s = \"abcdefg\",goal = \"abcdefg\") == True\n assert candidate(s = \"repeatedpatternabcabcabc\",goal = \"abcabcabcrepeatedpattern\") == True\n assert candidate(s = \"ababababababababababab\",goal = \"bababababababababababa\") == True\n assert candidate(s = \"uniquecharacters\",goal = \"charactersunique\") == True\n assert candidate(s = \"shiftmearound\",goal = \"roundshiftmea\") == True\n assert candidate(s = \"cryptography\",goal = \"graphycryp\") == False\n assert candidate(s = \"complexstring\",goal = \"stringcomplex\") == True\n assert candidate(s = \"1234567890\",goal = \"5678901234\") == True\n assert candidate(s = \"thisisatest\",goal = \"stthisisa\") == False\n assert candidate(s = \"circularrotation\",goal = \"ircularrotationc\") == True\n assert candidate(s = \"longstringexample\",goal = \"plelongstringex\") == False\n assert candidate(s = \"shiftleft\",goal = \"ftleftshi\") == True\n assert candidate(s = \"abcdabcd\",goal = \"cdabcdab\") == True\n assert candidate(s = \"aninterestingcase\",goal = \"caseaninteresting\") == True\n assert candidate(s = \"question\",goal = \"uestionq\") == True\n assert candidate(s = \"almostsame\",goal = \"lmostsamea\") == True\n assert candidate(s = \"verylongstringthatneedstobeshifted\",goal = \"edverylongstringthatneedstobeshift\") == True\n assert candidate(s = \"rotation\",goal = \"tationro\") == True\n assert candidate(s = \"repeatedwordsrepeated\",goal = \"wordsrepeatedrepeated\") == True\n assert candidate(s = \"example\",goal = \"mpleexa\") == True\n"}, "metadata": {"canonical_parameter_names": ["s", "goal"], "leetcode_dataset_entry_point": "Solution().rotateString", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var rotateString = function(s, goal) {", "container": null, "callable": "rotateString", "parameters": [{"name": "s", "type": "string"}, {"name": "goal", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 797, "task_id": "all-paths-from-source-to-target", "difficulty": "Medium", "problem_description": "Given a directed acyclic graph (DAG) of n nodes labeled from 0 to n - 1, find all possible paths from node 0 to node n - 1 and return them in any order.\nThe graph is given as follows: graph[i] is a list of all nodes you can visit from node i (i.e., there is a directed edge from node i to node graph[i][j]).\n \nExample 1:\n\n\nInput: graph = [[1,2],[3],[3],[]]\nOutput: [[0,1,3],[0,2,3]]\nExplanation: There are two paths: 0 -> 1 -> 3 and 0 -> 2 -> 3.\n\nExample 2:\n\n\nInput: graph = [[4,3,1],[3,2,4],[3],[4],[]]\nOutput: [[0,4],[0,3,4],[0,1,3,4],[0,1,2,3,4],[0,1,4]]\n\n \nConstraints:\n\nn == graph.length\n2 <= n <= 15\n0 <= graph[i][j] < n\ngraph[i][j] != i (i.e., there will be no self-loops).\nAll the elements of graph[i] are unique.\nThe input graph is guaranteed to be a DAG.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(graph = [[1, 3], [2], [3], []]) == [[0, 3], [0, 1, 2, 3]]\n assert candidate(graph = [[1], []]) == [[0, 1]]\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 3, 4, 5, 6, 7, 8, 9, 10], [3, 4, 5, 6, 7, 8, 9, 10], [4, 5, 6, 7, 8, 9, 10], [5, 6, 7, 8, 9, 10], [6, 7, 8, 9, 10], [7, 8, 9, 10], [8, 9, 10], [9, 10], [10], []]) == [[0, 10], [0, 1, 10], [0, 2, 10], [0, 3, 10], [0, 4, 10], [0, 5, 10], [0, 6, 10], [0, 7, 10], [0, 8, 10], [0, 9, 10], [0, 1, 2, 10], [0, 1, 3, 10], [0, 1, 4, 10], [0, 1, 5, 10], [0, 1, 6, 10], [0, 1, 7, 10], [0, 1, 8, 10], [0, 1, 9, 10], [0, 2, 3, 10], [0, 2, 4, 10], [0, 2, 5, 10], [0, 2, 6, 10], [0, 2, 7, 10], [0, 2, 8, 10], [0, 2, 9, 10], [0, 3, 4, 10], [0, 3, 5, 10], [0, 3, 6, 10], [0, 3, 7, 10], [0, 3, 8, 10], [0, 3, 9, 10], [0, 4, 5, 10], [0, 4, 6, 10], [0, 4, 7, 10], [0, 4, 8, 10], [0, 4, 9, 10], [0, 5, 6, 10], [0, 5, 7, 10], [0, 5, 8, 10], [0, 5, 9, 10], [0, 6, 7, 10], [0, 6, 8, 10], [0, 6, 9, 10], [0, 7, 8, 10], [0, 7, 9, 10], [0, 8, 9, 10], [0, 1, 2, 3, 10], [0, 1, 2, 4, 10], [0, 1, 2, 5, 10], [0, 1, 2, 6, 10], [0, 1, 2, 7, 10], [0, 1, 2, 8, 10], [0, 1, 2, 9, 10], [0, 1, 3, 4, 10], [0, 1, 3, 5, 10], [0, 1, 3, 6, 10], [0, 1, 3, 7, 10], [0, 1, 3, 8, 10], [0, 1, 3, 9, 10], [0, 1, 4, 5, 10], [0, 1, 4, 6, 10], [0, 1, 4, 7, 10], [0, 1, 4, 8, 10], [0, 1, 4, 9, 10], [0, 1, 5, 6, 10], [0, 1, 5, 7, 10], [0, 1, 5, 8, 10], [0, 1, 5, 9, 10], [0, 1, 6, 7, 10], [0, 1, 6, 8, 10], [0, 1, 6, 9, 10], [0, 1, 7, 8, 10], [0, 1, 7, 9, 10], [0, 1, 8, 9, 10], [0, 2, 3, 4, 10], [0, 2, 3, 5, 10], [0, 2, 3, 6, 10], [0, 2, 3, 7, 10], [0, 2, 3, 8, 10], [0, 2, 3, 9, 10], [0, 2, 4, 5, 10], [0, 2, 4, 6, 10], [0, 2, 4, 7, 10], [0, 2, 4, 8, 10], [0, 2, 4, 9, 10], [0, 2, 5, 6, 10], [0, 2, 5, 7, 10], [0, 2, 5, 8, 10], [0, 2, 5, 9, 10], [0, 2, 6, 7, 10], [0, 2, 6, 8, 10], [0, 2, 6, 9, 10], [0, 2, 7, 8, 10], [0, 2, 7, 9, 10], [0, 2, 8, 9, 10], [0, 3, 4, 5, 10], [0, 3, 4, 6, 10], [0, 3, 4, 7, 10], [0, 3, 4, 8, 10], [0, 3, 4, 9, 10], [0, 3, 5, 6, 10], [0, 3, 5, 7, 10], [0, 3, 5, 8, 10], [0, 3, 5, 9, 10], [0, 3, 6, 7, 10], [0, 3, 6, 8, 10], [0, 3, 6, 9, 10], [0, 3, 7, 8, 10], [0, 3, 7, 9, 10], [0, 3, 8, 9, 10], [0, 4, 5, 6, 10], [0, 4, 5, 7, 10], [0, 4, 5, 8, 10], [0, 4, 5, 9, 10], [0, 4, 6, 7, 10], [0, 4, 6, 8, 10], [0, 4, 6, 9, 10], [0, 4, 7, 8, 10], [0, 4, 7, 9, 10], [0, 4, 8, 9, 10], [0, 5, 6, 7, 10], [0, 5, 6, 8, 10], [0, 5, 6, 9, 10], [0, 5, 7, 8, 10], [0, 5, 7, 9, 10], [0, 5, 8, 9, 10], [0, 6, 7, 8, 10], [0, 6, 7, 9, 10], [0, 6, 8, 9, 10], [0, 7, 8, 9, 10], [0, 1, 2, 3, 4, 10], [0, 1, 2, 3, 5, 10], [0, 1, 2, 3, 6, 10], [0, 1, 2, 3, 7, 10], [0, 1, 2, 3, 8, 10], [0, 1, 2, 3, 9, 10], [0, 1, 2, 4, 5, 10], [0, 1, 2, 4, 6, 10], [0, 1, 2, 4, 7, 10], [0, 1, 2, 4, 8, 10], [0, 1, 2, 4, 9, 10], [0, 1, 2, 5, 6, 10], [0, 1, 2, 5, 7, 10], [0, 1, 2, 5, 8, 10], [0, 1, 2, 5, 9, 10], [0, 1, 2, 6, 7, 10], [0, 1, 2, 6, 8, 10], [0, 1, 2, 6, 9, 10], [0, 1, 2, 7, 8, 10], [0, 1, 2, 7, 9, 10], [0, 1, 2, 8, 9, 10], [0, 1, 3, 4, 5, 10], [0, 1, 3, 4, 6, 10], [0, 1, 3, 4, 7, 10], [0, 1, 3, 4, 8, 10], [0, 1, 3, 4, 9, 10], [0, 1, 3, 5, 6, 10], [0, 1, 3, 5, 7, 10], [0, 1, 3, 5, 8, 10], [0, 1, 3, 5, 9, 10], [0, 1, 3, 6, 7, 10], [0, 1, 3, 6, 8, 10], [0, 1, 3, 6, 9, 10], [0, 1, 3, 7, 8, 10], [0, 1, 3, 7, 9, 10], [0, 1, 3, 8, 9, 10], [0, 1, 4, 5, 6, 10], [0, 1, 4, 5, 7, 10], [0, 1, 4, 5, 8, 10], [0, 1, 4, 5, 9, 10], [0, 1, 4, 6, 7, 10], [0, 1, 4, 6, 8, 10], [0, 1, 4, 6, 9, 10], [0, 1, 4, 7, 8, 10], [0, 1, 4, 7, 9, 10], [0, 1, 4, 8, 9, 10], [0, 1, 5, 6, 7, 10], [0, 1, 5, 6, 8, 10], [0, 1, 5, 6, 9, 10], [0, 1, 5, 7, 8, 10], [0, 1, 5, 7, 9, 10], [0, 1, 5, 8, 9, 10], [0, 1, 6, 7, 8, 10], [0, 1, 6, 7, 9, 10], [0, 1, 6, 8, 9, 10], [0, 1, 7, 8, 9, 10], [0, 2, 3, 4, 5, 10], [0, 2, 3, 4, 6, 10], [0, 2, 3, 4, 7, 10], [0, 2, 3, 4, 8, 10], [0, 2, 3, 4, 9, 10], [0, 2, 3, 5, 6, 10], [0, 2, 3, 5, 7, 10], [0, 2, 3, 5, 8, 10], [0, 2, 3, 5, 9, 10], [0, 2, 3, 6, 7, 10], [0, 2, 3, 6, 8, 10], [0, 2, 3, 6, 9, 10], [0, 2, 3, 7, 8, 10], [0, 2, 3, 7, 9, 10], [0, 2, 3, 8, 9, 10], [0, 2, 4, 5, 6, 10], [0, 2, 4, 5, 7, 10], [0, 2, 4, 5, 8, 10], [0, 2, 4, 5, 9, 10], [0, 2, 4, 6, 7, 10], [0, 2, 4, 6, 8, 10], [0, 2, 4, 6, 9, 10], [0, 2, 4, 7, 8, 10], [0, 2, 4, 7, 9, 10], [0, 2, 4, 8, 9, 10], [0, 2, 5, 6, 7, 10], [0, 2, 5, 6, 8, 10], [0, 2, 5, 6, 9, 10], [0, 2, 5, 7, 8, 10], [0, 2, 5, 7, 9, 10], [0, 2, 5, 8, 9, 10], [0, 2, 6, 7, 8, 10], [0, 2, 6, 7, 9, 10], [0, 2, 6, 8, 9, 10], [0, 2, 7, 8, 9, 10], [0, 3, 4, 5, 6, 10], [0, 3, 4, 5, 7, 10], [0, 3, 4, 5, 8, 10], [0, 3, 4, 5, 9, 10], [0, 3, 4, 6, 7, 10], [0, 3, 4, 6, 8, 10], [0, 3, 4, 6, 9, 10], [0, 3, 4, 7, 8, 10], [0, 3, 4, 7, 9, 10], [0, 3, 4, 8, 9, 10], [0, 3, 5, 6, 7, 10], [0, 3, 5, 6, 8, 10], [0, 3, 5, 6, 9, 10], [0, 3, 5, 7, 8, 10], [0, 3, 5, 7, 9, 10], [0, 3, 5, 8, 9, 10], [0, 3, 6, 7, 8, 10], [0, 3, 6, 7, 9, 10], [0, 3, 6, 8, 9, 10], [0, 3, 7, 8, 9, 10], [0, 4, 5, 6, 7, 10], [0, 4, 5, 6, 8, 10], [0, 4, 5, 6, 9, 10], [0, 4, 5, 7, 8, 10], [0, 4, 5, 7, 9, 10], [0, 4, 5, 8, 9, 10], [0, 4, 6, 7, 8, 10], [0, 4, 6, 7, 9, 10], [0, 4, 6, 8, 9, 10], [0, 4, 7, 8, 9, 10], [0, 5, 6, 7, 8, 10], [0, 5, 6, 7, 9, 10], [0, 5, 6, 8, 9, 10], [0, 5, 7, 8, 9, 10], [0, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 10], [0, 1, 2, 3, 4, 6, 10], [0, 1, 2, 3, 4, 7, 10], [0, 1, 2, 3, 4, 8, 10], [0, 1, 2, 3, 4, 9, 10], [0, 1, 2, 3, 5, 6, 10], [0, 1, 2, 3, 5, 7, 10], [0, 1, 2, 3, 5, 8, 10], [0, 1, 2, 3, 5, 9, 10], [0, 1, 2, 3, 6, 7, 10], [0, 1, 2, 3, 6, 8, 10], [0, 1, 2, 3, 6, 9, 10], [0, 1, 2, 3, 7, 8, 10], [0, 1, 2, 3, 7, 9, 10], [0, 1, 2, 3, 8, 9, 10], [0, 1, 2, 4, 5, 6, 10], [0, 1, 2, 4, 5, 7, 10], [0, 1, 2, 4, 5, 8, 10], [0, 1, 2, 4, 5, 9, 10], [0, 1, 2, 4, 6, 7, 10], [0, 1, 2, 4, 6, 8, 10], [0, 1, 2, 4, 6, 9, 10], [0, 1, 2, 4, 7, 8, 10], [0, 1, 2, 4, 7, 9, 10], [0, 1, 2, 4, 8, 9, 10], [0, 1, 2, 5, 6, 7, 10], [0, 1, 2, 5, 6, 8, 10], [0, 1, 2, 5, 6, 9, 10], [0, 1, 2, 5, 7, 8, 10], [0, 1, 2, 5, 7, 9, 10], [0, 1, 2, 5, 8, 9, 10], [0, 1, 2, 6, 7, 8, 10], [0, 1, 2, 6, 7, 9, 10], [0, 1, 2, 6, 8, 9, 10], [0, 1, 2, 7, 8, 9, 10], [0, 1, 3, 4, 5, 6, 10], [0, 1, 3, 4, 5, 7, 10], [0, 1, 3, 4, 5, 8, 10], [0, 1, 3, 4, 5, 9, 10], [0, 1, 3, 4, 6, 7, 10], [0, 1, 3, 4, 6, 8, 10], [0, 1, 3, 4, 6, 9, 10], [0, 1, 3, 4, 7, 8, 10], [0, 1, 3, 4, 7, 9, 10], [0, 1, 3, 4, 8, 9, 10], [0, 1, 3, 5, 6, 7, 10], [0, 1, 3, 5, 6, 8, 10], [0, 1, 3, 5, 6, 9, 10], [0, 1, 3, 5, 7, 8, 10], [0, 1, 3, 5, 7, 9, 10], [0, 1, 3, 5, 8, 9, 10], [0, 1, 3, 6, 7, 8, 10], [0, 1, 3, 6, 7, 9, 10], [0, 1, 3, 6, 8, 9, 10], [0, 1, 3, 7, 8, 9, 10], [0, 1, 4, 5, 6, 7, 10], [0, 1, 4, 5, 6, 8, 10], [0, 1, 4, 5, 6, 9, 10], [0, 1, 4, 5, 7, 8, 10], [0, 1, 4, 5, 7, 9, 10], [0, 1, 4, 5, 8, 9, 10], [0, 1, 4, 6, 7, 8, 10], [0, 1, 4, 6, 7, 9, 10], [0, 1, 4, 6, 8, 9, 10], [0, 1, 4, 7, 8, 9, 10], [0, 1, 5, 6, 7, 8, 10], [0, 1, 5, 6, 7, 9, 10], [0, 1, 5, 6, 8, 9, 10], [0, 1, 5, 7, 8, 9, 10], [0, 1, 6, 7, 8, 9, 10], [0, 2, 3, 4, 5, 6, 10], [0, 2, 3, 4, 5, 7, 10], [0, 2, 3, 4, 5, 8, 10], [0, 2, 3, 4, 5, 9, 10], [0, 2, 3, 4, 6, 7, 10], [0, 2, 3, 4, 6, 8, 10], [0, 2, 3, 4, 6, 9, 10], [0, 2, 3, 4, 7, 8, 10], [0, 2, 3, 4, 7, 9, 10], [0, 2, 3, 4, 8, 9, 10], [0, 2, 3, 5, 6, 7, 10], [0, 2, 3, 5, 6, 8, 10], [0, 2, 3, 5, 6, 9, 10], [0, 2, 3, 5, 7, 8, 10], [0, 2, 3, 5, 7, 9, 10], [0, 2, 3, 5, 8, 9, 10], [0, 2, 3, 6, 7, 8, 10], [0, 2, 3, 6, 7, 9, 10], [0, 2, 3, 6, 8, 9, 10], [0, 2, 3, 7, 8, 9, 10], [0, 2, 4, 5, 6, 7, 10], [0, 2, 4, 5, 6, 8, 10], [0, 2, 4, 5, 6, 9, 10], [0, 2, 4, 5, 7, 8, 10], [0, 2, 4, 5, 7, 9, 10], [0, 2, 4, 5, 8, 9, 10], [0, 2, 4, 6, 7, 8, 10], [0, 2, 4, 6, 7, 9, 10], [0, 2, 4, 6, 8, 9, 10], [0, 2, 4, 7, 8, 9, 10], [0, 2, 5, 6, 7, 8, 10], [0, 2, 5, 6, 7, 9, 10], [0, 2, 5, 6, 8, 9, 10], [0, 2, 5, 7, 8, 9, 10], [0, 2, 6, 7, 8, 9, 10], [0, 3, 4, 5, 6, 7, 10], [0, 3, 4, 5, 6, 8, 10], [0, 3, 4, 5, 6, 9, 10], [0, 3, 4, 5, 7, 8, 10], [0, 3, 4, 5, 7, 9, 10], [0, 3, 4, 5, 8, 9, 10], [0, 3, 4, 6, 7, 8, 10], [0, 3, 4, 6, 7, 9, 10], [0, 3, 4, 6, 8, 9, 10], [0, 3, 4, 7, 8, 9, 10], [0, 3, 5, 6, 7, 8, 10], [0, 3, 5, 6, 7, 9, 10], [0, 3, 5, 6, 8, 9, 10], [0, 3, 5, 7, 8, 9, 10], [0, 3, 6, 7, 8, 9, 10], [0, 4, 5, 6, 7, 8, 10], [0, 4, 5, 6, 7, 9, 10], [0, 4, 5, 6, 8, 9, 10], [0, 4, 5, 7, 8, 9, 10], [0, 4, 6, 7, 8, 9, 10], [0, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 10], [0, 1, 2, 3, 4, 5, 7, 10], [0, 1, 2, 3, 4, 5, 8, 10], [0, 1, 2, 3, 4, 5, 9, 10], [0, 1, 2, 3, 4, 6, 7, 10], [0, 1, 2, 3, 4, 6, 8, 10], [0, 1, 2, 3, 4, 6, 9, 10], [0, 1, 2, 3, 4, 7, 8, 10], [0, 1, 2, 3, 4, 7, 9, 10], [0, 1, 2, 3, 4, 8, 9, 10], [0, 1, 2, 3, 5, 6, 7, 10], [0, 1, 2, 3, 5, 6, 8, 10], [0, 1, 2, 3, 5, 6, 9, 10], [0, 1, 2, 3, 5, 7, 8, 10], [0, 1, 2, 3, 5, 7, 9, 10], [0, 1, 2, 3, 5, 8, 9, 10], [0, 1, 2, 3, 6, 7, 8, 10], [0, 1, 2, 3, 6, 7, 9, 10], [0, 1, 2, 3, 6, 8, 9, 10], [0, 1, 2, 3, 7, 8, 9, 10], [0, 1, 2, 4, 5, 6, 7, 10], [0, 1, 2, 4, 5, 6, 8, 10], [0, 1, 2, 4, 5, 6, 9, 10], [0, 1, 2, 4, 5, 7, 8, 10], [0, 1, 2, 4, 5, 7, 9, 10], [0, 1, 2, 4, 5, 8, 9, 10], [0, 1, 2, 4, 6, 7, 8, 10], [0, 1, 2, 4, 6, 7, 9, 10], [0, 1, 2, 4, 6, 8, 9, 10], [0, 1, 2, 4, 7, 8, 9, 10], [0, 1, 2, 5, 6, 7, 8, 10], [0, 1, 2, 5, 6, 7, 9, 10], [0, 1, 2, 5, 6, 8, 9, 10], [0, 1, 2, 5, 7, 8, 9, 10], [0, 1, 2, 6, 7, 8, 9, 10], [0, 1, 3, 4, 5, 6, 7, 10], [0, 1, 3, 4, 5, 6, 8, 10], [0, 1, 3, 4, 5, 6, 9, 10], [0, 1, 3, 4, 5, 7, 8, 10], [0, 1, 3, 4, 5, 7, 9, 10], [0, 1, 3, 4, 5, 8, 9, 10], [0, 1, 3, 4, 6, 7, 8, 10], [0, 1, 3, 4, 6, 7, 9, 10], [0, 1, 3, 4, 6, 8, 9, 10], [0, 1, 3, 4, 7, 8, 9, 10], [0, 1, 3, 5, 6, 7, 8, 10], [0, 1, 3, 5, 6, 7, 9, 10], [0, 1, 3, 5, 6, 8, 9, 10], [0, 1, 3, 5, 7, 8, 9, 10], [0, 1, 3, 6, 7, 8, 9, 10], [0, 1, 4, 5, 6, 7, 8, 10], [0, 1, 4, 5, 6, 7, 9, 10], [0, 1, 4, 5, 6, 8, 9, 10], [0, 1, 4, 5, 7, 8, 9, 10], [0, 1, 4, 6, 7, 8, 9, 10], [0, 1, 5, 6, 7, 8, 9, 10], [0, 2, 3, 4, 5, 6, 7, 10], [0, 2, 3, 4, 5, 6, 8, 10], [0, 2, 3, 4, 5, 6, 9, 10], [0, 2, 3, 4, 5, 7, 8, 10], [0, 2, 3, 4, 5, 7, 9, 10], [0, 2, 3, 4, 5, 8, 9, 10], [0, 2, 3, 4, 6, 7, 8, 10], [0, 2, 3, 4, 6, 7, 9, 10], [0, 2, 3, 4, 6, 8, 9, 10], [0, 2, 3, 4, 7, 8, 9, 10], [0, 2, 3, 5, 6, 7, 8, 10], [0, 2, 3, 5, 6, 7, 9, 10], [0, 2, 3, 5, 6, 8, 9, 10], [0, 2, 3, 5, 7, 8, 9, 10], [0, 2, 3, 6, 7, 8, 9, 10], [0, 2, 4, 5, 6, 7, 8, 10], [0, 2, 4, 5, 6, 7, 9, 10], [0, 2, 4, 5, 6, 8, 9, 10], [0, 2, 4, 5, 7, 8, 9, 10], [0, 2, 4, 6, 7, 8, 9, 10], [0, 2, 5, 6, 7, 8, 9, 10], [0, 3, 4, 5, 6, 7, 8, 10], [0, 3, 4, 5, 6, 7, 9, 10], [0, 3, 4, 5, 6, 8, 9, 10], [0, 3, 4, 5, 7, 8, 9, 10], [0, 3, 4, 6, 7, 8, 9, 10], [0, 3, 5, 6, 7, 8, 9, 10], [0, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 10], [0, 1, 2, 3, 4, 5, 6, 8, 10], [0, 1, 2, 3, 4, 5, 6, 9, 10], [0, 1, 2, 3, 4, 5, 7, 8, 10], [0, 1, 2, 3, 4, 5, 7, 9, 10], [0, 1, 2, 3, 4, 5, 8, 9, 10], [0, 1, 2, 3, 4, 6, 7, 8, 10], [0, 1, 2, 3, 4, 6, 7, 9, 10], [0, 1, 2, 3, 4, 6, 8, 9, 10], [0, 1, 2, 3, 4, 7, 8, 9, 10], [0, 1, 2, 3, 5, 6, 7, 8, 10], [0, 1, 2, 3, 5, 6, 7, 9, 10], [0, 1, 2, 3, 5, 6, 8, 9, 10], [0, 1, 2, 3, 5, 7, 8, 9, 10], [0, 1, 2, 3, 6, 7, 8, 9, 10], [0, 1, 2, 4, 5, 6, 7, 8, 10], [0, 1, 2, 4, 5, 6, 7, 9, 10], [0, 1, 2, 4, 5, 6, 8, 9, 10], [0, 1, 2, 4, 5, 7, 8, 9, 10], [0, 1, 2, 4, 6, 7, 8, 9, 10], [0, 1, 2, 5, 6, 7, 8, 9, 10], [0, 1, 3, 4, 5, 6, 7, 8, 10], [0, 1, 3, 4, 5, 6, 7, 9, 10], [0, 1, 3, 4, 5, 6, 8, 9, 10], [0, 1, 3, 4, 5, 7, 8, 9, 10], [0, 1, 3, 4, 6, 7, 8, 9, 10], [0, 1, 3, 5, 6, 7, 8, 9, 10], [0, 1, 4, 5, 6, 7, 8, 9, 10], [0, 2, 3, 4, 5, 6, 7, 8, 10], [0, 2, 3, 4, 5, 6, 7, 9, 10], [0, 2, 3, 4, 5, 6, 8, 9, 10], [0, 2, 3, 4, 5, 7, 8, 9, 10], [0, 2, 3, 4, 6, 7, 8, 9, 10], [0, 2, 3, 5, 6, 7, 8, 9, 10], [0, 2, 4, 5, 6, 7, 8, 9, 10], [0, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]\n assert candidate(graph = [[1], [2], []]) == [[0, 1, 2]]\n assert candidate(graph = [[4, 3, 1], [3, 2, 4], [3], [4], []]) == [[0, 4], [0, 3, 4], [0, 1, 4], [0, 1, 3, 4], [0, 1, 2, 3, 4]]\n assert candidate(graph = [[1, 2], [2, 3], [3], [4], []]) == [[0, 1, 3, 4], [0, 2, 3, 4], [0, 1, 2, 3, 4]]\n assert candidate(graph = [[1], [2, 3], [3], []]) == [[0, 1, 3], [0, 1, 2, 3]]\n assert candidate(graph = [[1, 2, 3], [2, 3], [3, 4], [4], []]) == [[0, 2, 4], [0, 3, 4], [0, 1, 2, 4], [0, 1, 3, 4], [0, 2, 3, 4], [0, 1, 2, 3, 4]]\n assert candidate(graph = [[1, 2], [3, 4], [3, 4], [5], [5], []]) == [[0, 1, 3, 5], [0, 1, 4, 5], [0, 2, 3, 5], [0, 2, 4, 5]]\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [8], [9], []]) == [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]\n assert candidate(graph = [[1, 2], [3], [3], []]) == [[0, 1, 3], [0, 2, 3]]\n assert candidate(graph = [[1, 2], [3], [3, 4], [4], []]) == [[0, 2, 4], [0, 1, 3, 4], [0, 2, 3, 4]]\n assert candidate(graph = [[1, 2, 3], [2], [3], []]) == [[0, 3], [0, 2, 3], [0, 1, 2, 3]]\n assert candidate(graph = [[1], [[]]]) == [[0, 1]]\n assert candidate(graph = [[1], [2, 3], [3, 4], [4, 5], [5], []]) == [[0, 1, 3, 5], [0, 1, 2, 3, 5], [0, 1, 2, 4, 5], [0, 1, 3, 4, 5], [0, 1, 2, 3, 4, 5]]\n assert candidate(graph = [[1], [2], [3, 4], [4], []]) == [[0, 1, 2, 4], [0, 1, 2, 3, 4]]\n assert candidate(graph = [[1, 2], [3], [], [4]]) == [[0, 1, 3]]\n assert candidate(graph = [[1, 3], [2, 4], [3, 4, 5], [5], [], []]) == [[0, 3, 5], [0, 1, 2, 5], [0, 1, 2, 3, 5]]\n assert candidate(graph = [[1, 2, 3, 5, 6], [3, 4], [3, 4], [4, 5, 6], [5, 6], [], []]) == [[0, 6], [0, 3, 6], [0, 1, 3, 6], [0, 1, 4, 6], [0, 2, 3, 6], [0, 2, 4, 6], [0, 3, 4, 6], [0, 1, 3, 4, 6], [0, 2, 3, 4, 6]]\n assert candidate(graph = [[1], [2, 3, 4], [3, 4], [4], [5], [6], [7], [8], []]) == [[0, 1, 4, 5, 6, 7, 8], [0, 1, 2, 4, 5, 6, 7, 8], [0, 1, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8]]\n assert candidate(graph = [[1, 2], [3, 4, 5], [4, 5], [5], [5], []]) == [[0, 1, 5], [0, 2, 5], [0, 1, 3, 5], [0, 1, 4, 5], [0, 2, 4, 5]]\n assert candidate(graph = [[1, 3, 4], [2, 4], [3, 4], [5], [5], []]) == [[0, 3, 5], [0, 4, 5], [0, 1, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 4, 5]]\n assert candidate(graph = [[1, 2, 3, 4], [2, 3, 4], [3, 4], [4], []]) == [[0, 4], [0, 1, 4], [0, 2, 4], [0, 3, 4], [0, 1, 2, 4], [0, 1, 3, 4], [0, 2, 3, 4], [0, 1, 2, 3, 4]]\n assert candidate(graph = [[1, 2, 5], [2, 3], [3, 4, 5], [4, 5], [5], []]) == [[0, 5], [0, 2, 5], [0, 1, 2, 5], [0, 1, 3, 5], [0, 2, 3, 5], [0, 2, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 4, 5], [0, 1, 3, 4, 5], [0, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5]]\n assert candidate(graph = [[1, 4], [2, 3, 4], [3, 5, 6], [4, 5, 6, 7], [5, 6, 7, 8], [6, 7, 8], [7, 8, 9], [8, 9], [9], []]) == [[0, 4, 6, 9], [0, 4, 7, 9], [0, 4, 8, 9], [0, 1, 2, 6, 9], [0, 1, 3, 6, 9], [0, 1, 3, 7, 9], [0, 1, 4, 6, 9], [0, 1, 4, 7, 9], [0, 1, 4, 8, 9], [0, 4, 5, 6, 9], [0, 4, 5, 7, 9], [0, 4, 5, 8, 9], [0, 4, 6, 7, 9], [0, 4, 6, 8, 9], [0, 4, 7, 8, 9], [0, 1, 2, 3, 6, 9], [0, 1, 2, 3, 7, 9], [0, 1, 2, 5, 6, 9], [0, 1, 2, 5, 7, 9], [0, 1, 2, 5, 8, 9], [0, 1, 2, 6, 7, 9], [0, 1, 2, 6, 8, 9], [0, 1, 3, 4, 6, 9], [0, 1, 3, 4, 7, 9], [0, 1, 3, 4, 8, 9], [0, 1, 3, 5, 6, 9], [0, 1, 3, 5, 7, 9], [0, 1, 3, 5, 8, 9], [0, 1, 3, 6, 7, 9], [0, 1, 3, 6, 8, 9], [0, 1, 3, 7, 8, 9], [0, 1, 4, 5, 6, 9], [0, 1, 4, 5, 7, 9], [0, 1, 4, 5, 8, 9], [0, 1, 4, 6, 7, 9], [0, 1, 4, 6, 8, 9], [0, 1, 4, 7, 8, 9], [0, 4, 5, 6, 7, 9], [0, 4, 5, 6, 8, 9], [0, 4, 5, 7, 8, 9], [0, 4, 6, 7, 8, 9], [0, 1, 2, 3, 4, 6, 9], [0, 1, 2, 3, 4, 7, 9], [0, 1, 2, 3, 4, 8, 9], [0, 1, 2, 3, 5, 6, 9], [0, 1, 2, 3, 5, 7, 9], [0, 1, 2, 3, 5, 8, 9], [0, 1, 2, 3, 6, 7, 9], [0, 1, 2, 3, 6, 8, 9], [0, 1, 2, 3, 7, 8, 9], [0, 1, 2, 5, 6, 7, 9], [0, 1, 2, 5, 6, 8, 9], [0, 1, 2, 5, 7, 8, 9], [0, 1, 2, 6, 7, 8, 9], [0, 1, 3, 4, 5, 6, 9], [0, 1, 3, 4, 5, 7, 9], [0, 1, 3, 4, 5, 8, 9], [0, 1, 3, 4, 6, 7, 9], [0, 1, 3, 4, 6, 8, 9], [0, 1, 3, 4, 7, 8, 9], [0, 1, 3, 5, 6, 7, 9], [0, 1, 3, 5, 6, 8, 9], [0, 1, 3, 5, 7, 8, 9], [0, 1, 3, 6, 7, 8, 9], [0, 1, 4, 5, 6, 7, 9], [0, 1, 4, 5, 6, 8, 9], [0, 1, 4, 5, 7, 8, 9], [0, 1, 4, 6, 7, 8, 9], [0, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 9], [0, 1, 2, 3, 4, 5, 7, 9], [0, 1, 2, 3, 4, 5, 8, 9], [0, 1, 2, 3, 4, 6, 7, 9], [0, 1, 2, 3, 4, 6, 8, 9], [0, 1, 2, 3, 4, 7, 8, 9], [0, 1, 2, 3, 5, 6, 7, 9], [0, 1, 2, 3, 5, 6, 8, 9], [0, 1, 2, 3, 5, 7, 8, 9], [0, 1, 2, 3, 6, 7, 8, 9], [0, 1, 2, 5, 6, 7, 8, 9], [0, 1, 3, 4, 5, 6, 7, 9], [0, 1, 3, 4, 5, 6, 8, 9], [0, 1, 3, 4, 5, 7, 8, 9], [0, 1, 3, 4, 6, 7, 8, 9], [0, 1, 3, 5, 6, 7, 8, 9], [0, 1, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 9], [0, 1, 2, 3, 4, 5, 6, 8, 9], [0, 1, 2, 3, 4, 5, 7, 8, 9], [0, 1, 2, 3, 4, 6, 7, 8, 9], [0, 1, 2, 3, 5, 6, 7, 8, 9], [0, 1, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]\n assert candidate(graph = [[1, 2, 3, 4], [2, 3, 5], [3, 5, 6], [4, 5, 6], [5, 6], [6], []]) == [[0, 2, 6], [0, 3, 6], [0, 4, 6], [0, 1, 2, 6], [0, 1, 3, 6], [0, 1, 5, 6], [0, 2, 3, 6], [0, 2, 5, 6], [0, 3, 4, 6], [0, 3, 5, 6], [0, 4, 5, 6], [0, 1, 2, 3, 6], [0, 1, 2, 5, 6], [0, 1, 3, 4, 6], [0, 1, 3, 5, 6], [0, 2, 3, 4, 6], [0, 2, 3, 5, 6], [0, 3, 4, 5, 6], [0, 1, 2, 3, 4, 6], [0, 1, 2, 3, 5, 6], [0, 1, 3, 4, 5, 6], [0, 2, 3, 4, 5, 6], [0, 1, 2, 3, 4, 5, 6]]\n assert candidate(graph = [[1, 2, 3], [4, 5], [4, 5], [4, 5], [6, 7], [6, 7], [], [], []]) == []\n assert candidate(graph = [[1, 2], [3, 4, 5], [4, 5], [5], [6, 7], [6, 7], [8], [8], []]) == [[0, 1, 4, 6, 8], [0, 1, 4, 7, 8], [0, 1, 5, 6, 8], [0, 1, 5, 7, 8], [0, 2, 4, 6, 8], [0, 2, 4, 7, 8], [0, 2, 5, 6, 8], [0, 2, 5, 7, 8], [0, 1, 3, 5, 6, 8], [0, 1, 3, 5, 7, 8]]\n assert candidate(graph = [[1, 3, 4], [2], [3, 4], [4], []]) == [[0, 4], [0, 3, 4], [0, 1, 2, 4], [0, 1, 2, 3, 4]]\n assert candidate(graph = [[1, 2, 5], [2, 3, 4], [3, 4, 5], [4, 5], [5], []]) == [[0, 5], [0, 2, 5], [0, 1, 2, 5], [0, 1, 3, 5], [0, 1, 4, 5], [0, 2, 3, 5], [0, 2, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 4, 5], [0, 1, 3, 4, 5], [0, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5]]\n assert candidate(graph = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5], [4, 5], [5], []]) == [[0, 1, 5], [0, 2, 5], [0, 3, 5], [0, 4, 5], [0, 1, 2, 5], [0, 1, 3, 5], [0, 1, 4, 5], [0, 2, 3, 5], [0, 2, 4, 5], [0, 3, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 4, 5], [0, 1, 3, 4, 5], [0, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5]]\n assert candidate(graph = [[1, 2], [3, 4], [4], [], []]) == [[0, 1, 4], [0, 2, 4]]\n assert candidate(graph = [[1], [3, 4], [5], [5], [], [6], []]) == [[0, 1, 3, 5, 6]]\n assert candidate(graph = [[1, 3, 4], [2, 3, 4], [4], [], []]) == [[0, 4], [0, 1, 4], [0, 1, 2, 4]]\n assert candidate(graph = [[1, 2, 3], [3, 4, 5], [4, 5], [4, 5, 6], [5, 6], [6], []]) == [[0, 3, 6], [0, 1, 3, 6], [0, 1, 4, 6], [0, 1, 5, 6], [0, 2, 4, 6], [0, 2, 5, 6], [0, 3, 4, 6], [0, 3, 5, 6], [0, 1, 3, 4, 6], [0, 1, 3, 5, 6], [0, 1, 4, 5, 6], [0, 2, 4, 5, 6], [0, 3, 4, 5, 6], [0, 1, 3, 4, 5, 6]]\n assert candidate(graph = [[1, 2], [3, 4, 5, 6, 7], [3, 4, 5, 6, 7], [4, 5, 6, 7], [5, 6, 7], [6, 7], [7], [8], []]) == [[0, 1, 7, 8], [0, 2, 7, 8], [0, 1, 3, 7, 8], [0, 1, 4, 7, 8], [0, 1, 5, 7, 8], [0, 1, 6, 7, 8], [0, 2, 3, 7, 8], [0, 2, 4, 7, 8], [0, 2, 5, 7, 8], [0, 2, 6, 7, 8], [0, 1, 3, 4, 7, 8], [0, 1, 3, 5, 7, 8], [0, 1, 3, 6, 7, 8], [0, 1, 4, 5, 7, 8], [0, 1, 4, 6, 7, 8], [0, 1, 5, 6, 7, 8], [0, 2, 3, 4, 7, 8], [0, 2, 3, 5, 7, 8], [0, 2, 3, 6, 7, 8], [0, 2, 4, 5, 7, 8], [0, 2, 4, 6, 7, 8], [0, 2, 5, 6, 7, 8], [0, 1, 3, 4, 5, 7, 8], [0, 1, 3, 4, 6, 7, 8], [0, 1, 3, 5, 6, 7, 8], [0, 1, 4, 5, 6, 7, 8], [0, 2, 3, 4, 5, 7, 8], [0, 2, 3, 4, 6, 7, 8], [0, 2, 3, 5, 6, 7, 8], [0, 2, 4, 5, 6, 7, 8], [0, 1, 3, 4, 5, 6, 7, 8], [0, 2, 3, 4, 5, 6, 7, 8]]\n assert candidate(graph = [[1, 4], [2], [3], [4], []]) == [[0, 4], [0, 1, 2, 3, 4]]\n assert candidate(graph = [[1, 2, 5], [2, 3, 5], [3, 4, 5], [4, 5], [5], []]) == [[0, 5], [0, 1, 5], [0, 2, 5], [0, 1, 2, 5], [0, 1, 3, 5], [0, 2, 3, 5], [0, 2, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 4, 5], [0, 1, 3, 4, 5], [0, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5]]\n assert candidate(graph = [[1], [2, 3], [3], [4], [5, 6], [6], [7], []]) == [[0, 1, 3, 4, 6, 7], [0, 1, 2, 3, 4, 6, 7], [0, 1, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 6, 7]]\n assert candidate(graph = [[1, 2, 3], [3, 4, 5, 6], [4, 5, 6], [4, 5, 6, 7], [5, 6, 7], [6, 7], [7], []]) == [[0, 3, 7], [0, 1, 3, 7], [0, 1, 4, 7], [0, 1, 5, 7], [0, 1, 6, 7], [0, 2, 4, 7], [0, 2, 5, 7], [0, 2, 6, 7], [0, 3, 4, 7], [0, 3, 5, 7], [0, 3, 6, 7], [0, 1, 3, 4, 7], [0, 1, 3, 5, 7], [0, 1, 3, 6, 7], [0, 1, 4, 5, 7], [0, 1, 4, 6, 7], [0, 1, 5, 6, 7], [0, 2, 4, 5, 7], [0, 2, 4, 6, 7], [0, 2, 5, 6, 7], [0, 3, 4, 5, 7], [0, 3, 4, 6, 7], [0, 3, 5, 6, 7], [0, 1, 3, 4, 5, 7], [0, 1, 3, 4, 6, 7], [0, 1, 3, 5, 6, 7], [0, 1, 4, 5, 6, 7], [0, 2, 4, 5, 6, 7], [0, 3, 4, 5, 6, 7], [0, 1, 3, 4, 5, 6, 7]]\n assert candidate(graph = [[1, 2], [2, 3], [3], [4, 5], [5], [6], []]) == [[0, 1, 3, 5, 6], [0, 2, 3, 5, 6], [0, 1, 2, 3, 5, 6], [0, 1, 3, 4, 5, 6], [0, 2, 3, 4, 5, 6], [0, 1, 2, 3, 4, 5, 6]]\n assert candidate(graph = [[1, 2], [3], [3], [4], [5, 6], [6], [7, 8], [8], []]) == [[0, 1, 3, 4, 6, 8], [0, 2, 3, 4, 6, 8], [0, 1, 3, 4, 5, 6, 8], [0, 1, 3, 4, 6, 7, 8], [0, 2, 3, 4, 5, 6, 8], [0, 2, 3, 4, 6, 7, 8], [0, 1, 3, 4, 5, 6, 7, 8], [0, 2, 3, 4, 5, 6, 7, 8]]\n assert candidate(graph = [[1, 2, 3], [2, 3, 4, 5], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9], [6, 7, 8, 9], [7, 8, 9], [8, 9], [9], []]) == [[0, 1, 4, 9], [0, 1, 5, 9], [0, 2, 4, 9], [0, 2, 5, 9], [0, 2, 6, 9], [0, 2, 7, 9], [0, 3, 4, 9], [0, 3, 5, 9], [0, 3, 6, 9], [0, 3, 7, 9], [0, 3, 8, 9], [0, 1, 2, 4, 9], [0, 1, 2, 5, 9], [0, 1, 2, 6, 9], [0, 1, 2, 7, 9], [0, 1, 3, 4, 9], [0, 1, 3, 5, 9], [0, 1, 3, 6, 9], [0, 1, 3, 7, 9], [0, 1, 3, 8, 9], [0, 1, 4, 5, 9], [0, 1, 4, 6, 9], [0, 1, 4, 7, 9], [0, 1, 4, 8, 9], [0, 1, 5, 6, 9], [0, 1, 5, 7, 9], [0, 1, 5, 8, 9], [0, 2, 3, 4, 9], [0, 2, 3, 5, 9], [0, 2, 3, 6, 9], [0, 2, 3, 7, 9], [0, 2, 3, 8, 9], [0, 2, 4, 5, 9], [0, 2, 4, 6, 9], [0, 2, 4, 7, 9], [0, 2, 4, 8, 9], [0, 2, 5, 6, 9], [0, 2, 5, 7, 9], [0, 2, 5, 8, 9], [0, 2, 6, 7, 9], [0, 2, 6, 8, 9], [0, 2, 7, 8, 9], [0, 3, 4, 5, 9], [0, 3, 4, 6, 9], [0, 3, 4, 7, 9], [0, 3, 4, 8, 9], [0, 3, 5, 6, 9], [0, 3, 5, 7, 9], [0, 3, 5, 8, 9], [0, 3, 6, 7, 9], [0, 3, 6, 8, 9], [0, 3, 7, 8, 9], [0, 1, 2, 3, 4, 9], [0, 1, 2, 3, 5, 9], [0, 1, 2, 3, 6, 9], [0, 1, 2, 3, 7, 9], [0, 1, 2, 3, 8, 9], [0, 1, 2, 4, 5, 9], [0, 1, 2, 4, 6, 9], [0, 1, 2, 4, 7, 9], [0, 1, 2, 4, 8, 9], [0, 1, 2, 5, 6, 9], [0, 1, 2, 5, 7, 9], [0, 1, 2, 5, 8, 9], [0, 1, 2, 6, 7, 9], [0, 1, 2, 6, 8, 9], [0, 1, 2, 7, 8, 9], [0, 1, 3, 4, 5, 9], [0, 1, 3, 4, 6, 9], [0, 1, 3, 4, 7, 9], [0, 1, 3, 4, 8, 9], [0, 1, 3, 5, 6, 9], [0, 1, 3, 5, 7, 9], [0, 1, 3, 5, 8, 9], [0, 1, 3, 6, 7, 9], [0, 1, 3, 6, 8, 9], [0, 1, 3, 7, 8, 9], [0, 1, 4, 5, 6, 9], [0, 1, 4, 5, 7, 9], [0, 1, 4, 5, 8, 9], [0, 1, 4, 6, 7, 9], [0, 1, 4, 6, 8, 9], [0, 1, 4, 7, 8, 9], [0, 1, 5, 6, 7, 9], [0, 1, 5, 6, 8, 9], [0, 1, 5, 7, 8, 9], [0, 2, 3, 4, 5, 9], [0, 2, 3, 4, 6, 9], [0, 2, 3, 4, 7, 9], [0, 2, 3, 4, 8, 9], [0, 2, 3, 5, 6, 9], [0, 2, 3, 5, 7, 9], [0, 2, 3, 5, 8, 9], [0, 2, 3, 6, 7, 9], [0, 2, 3, 6, 8, 9], [0, 2, 3, 7, 8, 9], [0, 2, 4, 5, 6, 9], [0, 2, 4, 5, 7, 9], [0, 2, 4, 5, 8, 9], [0, 2, 4, 6, 7, 9], [0, 2, 4, 6, 8, 9], [0, 2, 4, 7, 8, 9], [0, 2, 5, 6, 7, 9], [0, 2, 5, 6, 8, 9], [0, 2, 5, 7, 8, 9], [0, 2, 6, 7, 8, 9], [0, 3, 4, 5, 6, 9], [0, 3, 4, 5, 7, 9], [0, 3, 4, 5, 8, 9], [0, 3, 4, 6, 7, 9], [0, 3, 4, 6, 8, 9], [0, 3, 4, 7, 8, 9], [0, 3, 5, 6, 7, 9], [0, 3, 5, 6, 8, 9], [0, 3, 5, 7, 8, 9], [0, 3, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 9], [0, 1, 2, 3, 4, 6, 9], [0, 1, 2, 3, 4, 7, 9], [0, 1, 2, 3, 4, 8, 9], [0, 1, 2, 3, 5, 6, 9], [0, 1, 2, 3, 5, 7, 9], [0, 1, 2, 3, 5, 8, 9], [0, 1, 2, 3, 6, 7, 9], [0, 1, 2, 3, 6, 8, 9], [0, 1, 2, 3, 7, 8, 9], [0, 1, 2, 4, 5, 6, 9], [0, 1, 2, 4, 5, 7, 9], [0, 1, 2, 4, 5, 8, 9], [0, 1, 2, 4, 6, 7, 9], [0, 1, 2, 4, 6, 8, 9], [0, 1, 2, 4, 7, 8, 9], [0, 1, 2, 5, 6, 7, 9], [0, 1, 2, 5, 6, 8, 9], [0, 1, 2, 5, 7, 8, 9], [0, 1, 2, 6, 7, 8, 9], [0, 1, 3, 4, 5, 6, 9], [0, 1, 3, 4, 5, 7, 9], [0, 1, 3, 4, 5, 8, 9], [0, 1, 3, 4, 6, 7, 9], [0, 1, 3, 4, 6, 8, 9], [0, 1, 3, 4, 7, 8, 9], [0, 1, 3, 5, 6, 7, 9], [0, 1, 3, 5, 6, 8, 9], [0, 1, 3, 5, 7, 8, 9], [0, 1, 3, 6, 7, 8, 9], [0, 1, 4, 5, 6, 7, 9], [0, 1, 4, 5, 6, 8, 9], [0, 1, 4, 5, 7, 8, 9], [0, 1, 4, 6, 7, 8, 9], [0, 1, 5, 6, 7, 8, 9], [0, 2, 3, 4, 5, 6, 9], [0, 2, 3, 4, 5, 7, 9], [0, 2, 3, 4, 5, 8, 9], [0, 2, 3, 4, 6, 7, 9], [0, 2, 3, 4, 6, 8, 9], [0, 2, 3, 4, 7, 8, 9], [0, 2, 3, 5, 6, 7, 9], [0, 2, 3, 5, 6, 8, 9], [0, 2, 3, 5, 7, 8, 9], [0, 2, 3, 6, 7, 8, 9], [0, 2, 4, 5, 6, 7, 9], [0, 2, 4, 5, 6, 8, 9], [0, 2, 4, 5, 7, 8, 9], [0, 2, 4, 6, 7, 8, 9], [0, 2, 5, 6, 7, 8, 9], [0, 3, 4, 5, 6, 7, 9], [0, 3, 4, 5, 6, 8, 9], [0, 3, 4, 5, 7, 8, 9], [0, 3, 4, 6, 7, 8, 9], [0, 3, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 9], [0, 1, 2, 3, 4, 5, 7, 9], [0, 1, 2, 3, 4, 5, 8, 9], [0, 1, 2, 3, 4, 6, 7, 9], [0, 1, 2, 3, 4, 6, 8, 9], [0, 1, 2, 3, 4, 7, 8, 9], [0, 1, 2, 3, 5, 6, 7, 9], [0, 1, 2, 3, 5, 6, 8, 9], [0, 1, 2, 3, 5, 7, 8, 9], [0, 1, 2, 3, 6, 7, 8, 9], [0, 1, 2, 4, 5, 6, 7, 9], [0, 1, 2, 4, 5, 6, 8, 9], [0, 1, 2, 4, 5, 7, 8, 9], [0, 1, 2, 4, 6, 7, 8, 9], [0, 1, 2, 5, 6, 7, 8, 9], [0, 1, 3, 4, 5, 6, 7, 9], [0, 1, 3, 4, 5, 6, 8, 9], [0, 1, 3, 4, 5, 7, 8, 9], [0, 1, 3, 4, 6, 7, 8, 9], [0, 1, 3, 5, 6, 7, 8, 9], [0, 1, 4, 5, 6, 7, 8, 9], [0, 2, 3, 4, 5, 6, 7, 9], [0, 2, 3, 4, 5, 6, 8, 9], [0, 2, 3, 4, 5, 7, 8, 9], [0, 2, 3, 4, 6, 7, 8, 9], [0, 2, 3, 5, 6, 7, 8, 9], [0, 2, 4, 5, 6, 7, 8, 9], [0, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 9], [0, 1, 2, 3, 4, 5, 6, 8, 9], [0, 1, 2, 3, 4, 5, 7, 8, 9], [0, 1, 2, 3, 4, 6, 7, 8, 9], [0, 1, 2, 3, 5, 6, 7, 8, 9], [0, 1, 2, 4, 5, 6, 7, 8, 9], [0, 1, 3, 4, 5, 6, 7, 8, 9], [0, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]\n assert candidate(graph = [[1, 3, 4], [2, 4], [3, 5], [4, 5], [5], []]) == [[0, 3, 5], [0, 4, 5], [0, 1, 2, 5], [0, 1, 4, 5], [0, 3, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 3, 4, 5]]\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8], [2, 3, 4, 5, 6, 7, 8], [3, 4, 5, 6, 7, 8], [4, 5, 6, 7, 8], [5, 6, 7, 8], [6, 7, 8], [7, 8], [8], []]) == [[0, 8], [0, 1, 8], [0, 2, 8], [0, 3, 8], [0, 4, 8], [0, 5, 8], [0, 6, 8], [0, 7, 8], [0, 1, 2, 8], [0, 1, 3, 8], [0, 1, 4, 8], [0, 1, 5, 8], [0, 1, 6, 8], [0, 1, 7, 8], [0, 2, 3, 8], [0, 2, 4, 8], [0, 2, 5, 8], [0, 2, 6, 8], [0, 2, 7, 8], [0, 3, 4, 8], [0, 3, 5, 8], [0, 3, 6, 8], [0, 3, 7, 8], [0, 4, 5, 8], [0, 4, 6, 8], [0, 4, 7, 8], [0, 5, 6, 8], [0, 5, 7, 8], [0, 6, 7, 8], [0, 1, 2, 3, 8], [0, 1, 2, 4, 8], [0, 1, 2, 5, 8], [0, 1, 2, 6, 8], [0, 1, 2, 7, 8], [0, 1, 3, 4, 8], [0, 1, 3, 5, 8], [0, 1, 3, 6, 8], [0, 1, 3, 7, 8], [0, 1, 4, 5, 8], [0, 1, 4, 6, 8], [0, 1, 4, 7, 8], [0, 1, 5, 6, 8], [0, 1, 5, 7, 8], [0, 1, 6, 7, 8], [0, 2, 3, 4, 8], [0, 2, 3, 5, 8], [0, 2, 3, 6, 8], [0, 2, 3, 7, 8], [0, 2, 4, 5, 8], [0, 2, 4, 6, 8], [0, 2, 4, 7, 8], [0, 2, 5, 6, 8], [0, 2, 5, 7, 8], [0, 2, 6, 7, 8], [0, 3, 4, 5, 8], [0, 3, 4, 6, 8], [0, 3, 4, 7, 8], [0, 3, 5, 6, 8], [0, 3, 5, 7, 8], [0, 3, 6, 7, 8], [0, 4, 5, 6, 8], [0, 4, 5, 7, 8], [0, 4, 6, 7, 8], [0, 5, 6, 7, 8], [0, 1, 2, 3, 4, 8], [0, 1, 2, 3, 5, 8], [0, 1, 2, 3, 6, 8], [0, 1, 2, 3, 7, 8], [0, 1, 2, 4, 5, 8], [0, 1, 2, 4, 6, 8], [0, 1, 2, 4, 7, 8], [0, 1, 2, 5, 6, 8], [0, 1, 2, 5, 7, 8], [0, 1, 2, 6, 7, 8], [0, 1, 3, 4, 5, 8], [0, 1, 3, 4, 6, 8], [0, 1, 3, 4, 7, 8], [0, 1, 3, 5, 6, 8], [0, 1, 3, 5, 7, 8], [0, 1, 3, 6, 7, 8], [0, 1, 4, 5, 6, 8], [0, 1, 4, 5, 7, 8], [0, 1, 4, 6, 7, 8], [0, 1, 5, 6, 7, 8], [0, 2, 3, 4, 5, 8], [0, 2, 3, 4, 6, 8], [0, 2, 3, 4, 7, 8], [0, 2, 3, 5, 6, 8], [0, 2, 3, 5, 7, 8], [0, 2, 3, 6, 7, 8], [0, 2, 4, 5, 6, 8], [0, 2, 4, 5, 7, 8], [0, 2, 4, 6, 7, 8], [0, 2, 5, 6, 7, 8], [0, 3, 4, 5, 6, 8], [0, 3, 4, 5, 7, 8], [0, 3, 4, 6, 7, 8], [0, 3, 5, 6, 7, 8], [0, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 8], [0, 1, 2, 3, 4, 6, 8], [0, 1, 2, 3, 4, 7, 8], [0, 1, 2, 3, 5, 6, 8], [0, 1, 2, 3, 5, 7, 8], [0, 1, 2, 3, 6, 7, 8], [0, 1, 2, 4, 5, 6, 8], [0, 1, 2, 4, 5, 7, 8], [0, 1, 2, 4, 6, 7, 8], [0, 1, 2, 5, 6, 7, 8], [0, 1, 3, 4, 5, 6, 8], [0, 1, 3, 4, 5, 7, 8], [0, 1, 3, 4, 6, 7, 8], [0, 1, 3, 5, 6, 7, 8], [0, 1, 4, 5, 6, 7, 8], [0, 2, 3, 4, 5, 6, 8], [0, 2, 3, 4, 5, 7, 8], [0, 2, 3, 4, 6, 7, 8], [0, 2, 3, 5, 6, 7, 8], [0, 2, 4, 5, 6, 7, 8], [0, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 8], [0, 1, 2, 3, 4, 5, 7, 8], [0, 1, 2, 3, 4, 6, 7, 8], [0, 1, 2, 3, 5, 6, 7, 8], [0, 1, 2, 4, 5, 6, 7, 8], [0, 1, 3, 4, 5, 6, 7, 8], [0, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8]]\n assert candidate(graph = [[1], [2, 3, 4], [3, 4], [4], [], [6, 7], [7], []]) == []\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7], [2, 3, 4, 5, 6, 7], [3, 4, 5, 6, 7], [4, 5, 6, 7], [5, 6, 7], [6, 7], [7], []]) == [[0, 7], [0, 1, 7], [0, 2, 7], [0, 3, 7], [0, 4, 7], [0, 5, 7], [0, 6, 7], [0, 1, 2, 7], [0, 1, 3, 7], [0, 1, 4, 7], [0, 1, 5, 7], [0, 1, 6, 7], [0, 2, 3, 7], [0, 2, 4, 7], [0, 2, 5, 7], [0, 2, 6, 7], [0, 3, 4, 7], [0, 3, 5, 7], [0, 3, 6, 7], [0, 4, 5, 7], [0, 4, 6, 7], [0, 5, 6, 7], [0, 1, 2, 3, 7], [0, 1, 2, 4, 7], [0, 1, 2, 5, 7], [0, 1, 2, 6, 7], [0, 1, 3, 4, 7], [0, 1, 3, 5, 7], [0, 1, 3, 6, 7], [0, 1, 4, 5, 7], [0, 1, 4, 6, 7], [0, 1, 5, 6, 7], [0, 2, 3, 4, 7], [0, 2, 3, 5, 7], [0, 2, 3, 6, 7], [0, 2, 4, 5, 7], [0, 2, 4, 6, 7], [0, 2, 5, 6, 7], [0, 3, 4, 5, 7], [0, 3, 4, 6, 7], [0, 3, 5, 6, 7], [0, 4, 5, 6, 7], [0, 1, 2, 3, 4, 7], [0, 1, 2, 3, 5, 7], [0, 1, 2, 3, 6, 7], [0, 1, 2, 4, 5, 7], [0, 1, 2, 4, 6, 7], [0, 1, 2, 5, 6, 7], [0, 1, 3, 4, 5, 7], [0, 1, 3, 4, 6, 7], [0, 1, 3, 5, 6, 7], [0, 1, 4, 5, 6, 7], [0, 2, 3, 4, 5, 7], [0, 2, 3, 4, 6, 7], [0, 2, 3, 5, 6, 7], [0, 2, 4, 5, 6, 7], [0, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 7], [0, 1, 2, 3, 4, 6, 7], [0, 1, 2, 3, 5, 6, 7], [0, 1, 2, 4, 5, 6, 7], [0, 1, 3, 4, 5, 6, 7], [0, 2, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 6, 7]]\n assert candidate(graph = [[1, 3], [2], [3, 4], [4], []]) == [[0, 3, 4], [0, 1, 2, 4], [0, 1, 2, 3, 4]]\n assert candidate(graph = [[1, 2, 5], [3, 4], [5], [4], [], []]) == [[0, 5], [0, 2, 5]]\n assert candidate(graph = [[1, 2], [3, 4, 5], [3, 4, 5], [6, 7], [6, 7], [6, 7], [8], [8], [9], []]) == [[0, 1, 3, 6, 8, 9], [0, 1, 3, 7, 8, 9], [0, 1, 4, 6, 8, 9], [0, 1, 4, 7, 8, 9], [0, 1, 5, 6, 8, 9], [0, 1, 5, 7, 8, 9], [0, 2, 3, 6, 8, 9], [0, 2, 3, 7, 8, 9], [0, 2, 4, 6, 8, 9], [0, 2, 4, 7, 8, 9], [0, 2, 5, 6, 8, 9], [0, 2, 5, 7, 8, 9]]\n assert candidate(graph = [[1, 2, 3, 4, 5], [2, 3, 4, 5], [3, 4, 5], [4, 5], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]) == [[0, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 1, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 1, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]]\n assert candidate(graph = [[1, 2, 3, 4], [2, 3], [3, 4], [4], [5], []]) == [[0, 4, 5], [0, 2, 4, 5], [0, 3, 4, 5], [0, 1, 2, 4, 5], [0, 1, 3, 4, 5], [0, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5]]\n assert candidate(graph = [[1, 2, 3, 4], [2, 3], [3, 4, 5, 6], [5, 6], [6], [], []]) == [[0, 2, 6], [0, 3, 6], [0, 4, 6], [0, 1, 2, 6], [0, 1, 3, 6], [0, 2, 3, 6], [0, 2, 4, 6], [0, 1, 2, 3, 6], [0, 1, 2, 4, 6]]\n assert candidate(graph = [[1], [2, 3, 4, 5], [3, 4, 5], [4, 5], [5], []]) == [[0, 1, 5], [0, 1, 2, 5], [0, 1, 3, 5], [0, 1, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 4, 5], [0, 1, 3, 4, 5], [0, 1, 2, 3, 4, 5]]\n assert candidate(graph = [[1, 4, 5], [2, 3, 4], [3], [4], [], []]) == [[0, 5]]\n assert candidate(graph = [[1], [2, 3], [3, 4], [4], [], [6], [7], []]) == []\n assert candidate(graph = [[1, 2, 3, 4], [2, 3, 4], [3, 4], [4], [5, 6, 7], [6, 7], [7], [], [], []]) == []\n assert candidate(graph = [[1, 2], [3, 4], [5], [5], [5], []]) == [[0, 2, 5], [0, 1, 3, 5], [0, 1, 4, 5]]\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], []]) == [[0, 1, 2, 3, 4, 5, 6, 7]]\n assert candidate(graph = [[1, 2, 4], [2, 3], [3, 4], [], [5], []]) == [[0, 4, 5], [0, 2, 4, 5], [0, 1, 2, 4, 5]]\n assert candidate(graph = [[1, 2], [2, 3, 4, 5], [3, 5], [4, 5, 6], [5, 6], [6], []]) == [[0, 1, 3, 6], [0, 1, 4, 6], [0, 1, 5, 6], [0, 2, 3, 6], [0, 2, 5, 6], [0, 1, 2, 3, 6], [0, 1, 2, 5, 6], [0, 1, 3, 4, 6], [0, 1, 3, 5, 6], [0, 1, 4, 5, 6], [0, 2, 3, 4, 6], [0, 2, 3, 5, 6], [0, 1, 2, 3, 4, 6], [0, 1, 2, 3, 5, 6], [0, 1, 3, 4, 5, 6], [0, 2, 3, 4, 5, 6], [0, 1, 2, 3, 4, 5, 6]]\n assert candidate(graph = [[1, 2, 3, 4], [2, 3, 4], [3, 4], [4], [], [], [], [], []]) == []\n assert candidate(graph = [[1, 2], [2, 3], [4], [4], []]) == [[0, 2, 4], [0, 1, 2, 4], [0, 1, 3, 4]]\n assert candidate(graph = [[1, 2, 3], [4, 5, 6, 7], [5, 6, 7], [5, 6, 7], [8], [8], [8], [8], []]) == [[0, 1, 4, 8], [0, 1, 5, 8], [0, 1, 6, 8], [0, 1, 7, 8], [0, 2, 5, 8], [0, 2, 6, 8], [0, 2, 7, 8], [0, 3, 5, 8], [0, 3, 6, 8], [0, 3, 7, 8]]\n assert candidate(graph = [[1, 2, 4], [3], [3, 4], [4], [5], []]) == [[0, 4, 5], [0, 2, 4, 5], [0, 1, 3, 4, 5], [0, 2, 3, 4, 5]]\n assert candidate(graph = [[1], [2, 3, 4], [3, 4], [4], []]) == [[0, 1, 4], [0, 1, 2, 4], [0, 1, 3, 4], [0, 1, 2, 3, 4]]\n assert candidate(graph = [[1, 3, 5], [2, 4, 6], [3, 5], [4, 6, 7], [5, 7], [6, 7], [7], []]) == [[0, 3, 7], [0, 5, 7], [0, 1, 4, 7], [0, 1, 6, 7], [0, 3, 4, 7], [0, 3, 6, 7], [0, 5, 6, 7], [0, 1, 2, 3, 7], [0, 1, 2, 5, 7], [0, 1, 4, 5, 7], [0, 3, 4, 5, 7], [0, 1, 2, 3, 4, 7], [0, 1, 2, 3, 6, 7], [0, 1, 2, 5, 6, 7], [0, 1, 4, 5, 6, 7], [0, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 7], [0, 1, 2, 3, 4, 5, 6, 7]]\n assert candidate(graph = [[1, 2], [3], [3], [5, 6], [6], [7], [7], []]) == [[0, 1, 3, 5, 7], [0, 1, 3, 6, 7], [0, 2, 3, 5, 7], [0, 2, 3, 6, 7]]\n assert candidate(graph = [[1, 2], [2, 3], [3, 4, 5], [4, 5, 6], [5, 6], [6], [7], []]) == [[0, 1, 3, 6, 7], [0, 2, 3, 6, 7], [0, 2, 4, 6, 7], [0, 2, 5, 6, 7], [0, 1, 2, 3, 6, 7], [0, 1, 2, 4, 6, 7], [0, 1, 2, 5, 6, 7], [0, 1, 3, 4, 6, 7], [0, 1, 3, 5, 6, 7], [0, 2, 3, 4, 6, 7], [0, 2, 3, 5, 6, 7], [0, 2, 4, 5, 6, 7], [0, 1, 2, 3, 4, 6, 7], [0, 1, 2, 3, 5, 6, 7], [0, 1, 2, 4, 5, 6, 7], [0, 1, 3, 4, 5, 6, 7], [0, 2, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 6, 7]]\n assert candidate(graph = [[1, 2], [3, 4], [3], [5], [5], []]) == [[0, 1, 3, 5], [0, 1, 4, 5], [0, 2, 3, 5]]\n assert candidate(graph = [[1, 2, 3], [2, 3, 4], [4], [4, 5], [5], []]) == [[0, 3, 5], [0, 1, 3, 5], [0, 1, 4, 5], [0, 2, 4, 5], [0, 3, 4, 5], [0, 1, 2, 4, 5], [0, 1, 3, 4, 5]]\n assert candidate(graph = [[1, 2, 3], [4, 5], [4, 5], [5], [], [], []]) == []\n"}, "metadata": {"canonical_parameter_names": ["graph"], "leetcode_dataset_entry_point": "Solution().allPathsSourceTarget", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var allPathsSourceTarget = function(graph) {", "container": null, "callable": "allPathsSourceTarget", "parameters": [{"name": "graph", "type": "number[][]"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 798, "task_id": "smallest-rotation-with-highest-score", "difficulty": "Hard", "problem_description": "You are given an array nums. You can rotate it by a non-negative integer k so that the array becomes [nums[k], nums[k + 1], ... nums[nums.length - 1], nums[0], nums[1], ..., nums[k-1]]. Afterward, any entries that are less than or equal to their index are worth one point.\n\nFor example, if we have nums = [2,4,1,3,0], and we rotate by k = 2, it becomes [1,3,0,2,4]. This is worth 3 points because 1 > 0 [no points], 3 > 1 [no points], 0 <= 2 [one point], 2 <= 3 [one point], 4 <= 4 [one point].\n\nReturn the rotation index k that corresponds to the highest score we can achieve if we rotated nums by it. If there are multiple answers, return the smallest such index k.\n \nExample 1:\n\nInput: nums = [2,3,1,4,0]\nOutput: 3\nExplanation: Scores for each k are listed below: \nk = 0, nums = [2,3,1,4,0], score 2\nk = 1, nums = [3,1,4,0,2], score 3\nk = 2, nums = [1,4,0,2,3], score 3\nk = 3, nums = [4,0,2,3,1], score 4\nk = 4, nums = [0,2,3,1,4], score 3\nSo we should choose k = 3, which has the highest score.\n\nExample 2:\n\nInput: nums = [1,3,0,2,4]\nOutput: 0\nExplanation: nums will always have 3 points no matter how it shifts.\nSo we will choose the smallest k, which is 0.\n\n \nConstraints:\n\n1 <= nums.length <= 105\n0 <= nums[i] < nums.length\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 0, 2, 4]) == 0\n assert candidate(nums = [5, 4, 3, 2, 1]) == 0\n assert candidate(nums = [0, 1, 2, 3, 4]) == 0\n assert candidate(nums = [1, 0, 3, 4, 2]) == 4\n assert candidate(nums = [5, 4, 3, 2, 1, 0]) == 1\n assert candidate(nums = [1, 0, 2, 3, 4]) == 0\n assert candidate(nums = [3, 2, 1, 0, 4]) == 0\n assert candidate(nums = [2, 3, 1, 4, 0]) == 3\n assert candidate(nums = [0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [4, 3, 2, 1, 0]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 9\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == 0\n assert candidate(nums = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 0\n assert candidate(nums = [2, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == 1\n assert candidate(nums = [10, 0, 10, 0, 10, 0, 10, 0, 10, 0]) == 0\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 9\n assert candidate(nums = [2, 1, 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == 0\n assert candidate(nums = [2, 5, 1, 6, 3, 0, 4]) == 1\n assert candidate(nums = [10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 1\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 0\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 0\n assert candidate(nums = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0]) == 8\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 0\n assert candidate(nums = [2, 3, 1, 4, 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == 18\n assert candidate(nums = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3]) == 0\n assert candidate(nums = [0, 9999, 1, 9998, 2, 9997, 3, 9996, 4, 9995]) == 0\n assert candidate(nums = [0, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9]) == 0\n assert candidate(nums = [10000, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991]) == 0\n assert candidate(nums = [5000, 4999, 5001, 4998, 5002, 4997, 5003, 4996, 5004, 4995]) == 0\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 1\n assert candidate(nums = [1, 3, 2, 4, 3, 2, 5, 4, 3, 2]) == 7\n assert candidate(nums = [5, 0, 5, 0, 5, 0, 5, 0, 5, 0]) == 1\n assert candidate(nums = [5, 0, 4, 1, 3, 2, 2, 3, 1, 4, 0, 5]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) == 9\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18]) == 1\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == 0\n assert candidate(nums = [1, 2, 3, 4, 0, 5, 6, 7, 8, 9]) == 9\n assert candidate(nums = [3, 0, 1, 2, 5, 4, 7, 6, 9, 8]) == 9\n assert candidate(nums = [9, 7, 5, 3, 1, 0, 8, 6, 4, 2]) == 0\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(nums = [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4]) == 0\n assert candidate(nums = [0, 9, 1, 8, 2, 7, 3, 6, 4, 5]) == 0\n assert candidate(nums = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4]) == 5\n assert candidate(nums = [9, 7, 6, 5, 4, 3, 2, 1, 0, 8]) == 0\n assert candidate(nums = [10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0]) == 0\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 19\n assert candidate(nums = [0, 1, 2, 3, 4, 5]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0]) == 99\n assert candidate(nums = [2, 1, 4, 3, 0, 5, 6]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) == 9\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == 1\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(nums = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 0\n assert candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1, 0]) == 0\n assert candidate(nums = [5, 6, 1, 2, 3, 4, 0, 1, 2, 3]) == 1\n assert candidate(nums = [4, 3, 2, 1, 0, 4, 3, 2, 1, 0]) == 0\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 0\n assert candidate(nums = [3, 0, 3, 0, 3, 0, 3, 0, 3, 0]) == 1\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1]) == 2\n assert candidate(nums = [1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9]) == 0\n assert candidate(nums = [9, 0, 9, 0, 9, 0, 9, 0, 9, 0]) == 1\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == 0\n assert candidate(nums = [7, 6, 5, 4, 3, 2, 1, 0, 9, 8]) == 1\n assert candidate(nums = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9]) == 8\n assert candidate(nums = [0, 5, 0, 5, 0, 5, 0, 5, 0, 5]) == 0\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]) == 0\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(nums = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]) == 5\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [5, 1, 2, 3, 4]) == 0\n assert candidate(nums = [0, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 9\n assert candidate(nums = [2, 0, 1, 0, 2, 1, 0, 2, 1, 0]) == 1\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4]) == 5\n assert candidate(nums = [5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1]) == 0\n assert candidate(nums = [5, 1, 3, 4, 2, 0, 7, 6, 8, 9]) == 9\n assert candidate(nums = [5, 3, 1, 2, 4, 0]) == 0\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [0, 0, 0, 0, 1, 1, 1, 1, 2, 2]) == 0\n assert candidate(nums = [2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) == 8\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 0\n assert candidate(nums = [2, 6, 1, 5, 0, 4, 3]) == 1\n assert candidate(nums = [0, 2, 0, 2, 0, 2, 0, 2, 0, 2]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 0, 6, 7, 8, 9]) == 9\n assert candidate(nums = [10, 20, 30, 40, 50, 0, 1, 2, 3, 4]) == 0\n assert candidate(nums = [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().bestRotation", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var bestRotation = function(nums) {", "container": null, "callable": "bestRotation", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 799, "task_id": "champagne-tower", "difficulty": "Medium", "problem_description": "We stack glasses in a pyramid, where the first row has 1 glass, the second row has 2 glasses, and so on until the 100th row.  Each glass holds one cup of champagne.\\r\n\\r\nThen, some champagne is poured into the first glass at the top.  When the topmost glass is full, any excess liquid poured will fall equally to the glass immediately to the left and right of it.  When those glasses become full, any excess champagne will fall equally to the left and right of those glasses, and so on.  (A glass at the bottom row has its excess champagne fall on the floor.)\\r\n\\r\nFor example, after one cup of champagne is poured, the top most glass is full.  After two cups of champagne are poured, the two glasses on the second row are half full.  After three cups of champagne are poured, those two cups become full - there are 3 full glasses total now.  After four cups of champagne are poured, the third row has the middle glass half full, and the two outside glasses are a quarter full, as pictured below.\\r\n\\r\n\\r\n\\r\nNow after pouring some non-negative integer cups of champagne, return how full the jth glass in the ith row is (both i and j are 0-indexed.)\\r\n\\r\n \\r\nExample 1:\\r\n\\r\n\\r\nInput: poured = 1, query_row = 1, query_glass = 1\\r\nOutput: 0.00000\\r\nExplanation: We poured 1 cup of champange to the top glass of the tower (which is indexed as (0, 0)). There will be no excess liquid so all the glasses under the top glass will remain empty.\\r\n\\r\n\\r\nExample 2:\\r\n\\r\n\\r\nInput: poured = 2, query_row = 1, query_glass = 1\\r\nOutput: 0.50000\\r\nExplanation: We poured 2 cups of champange to the top glass of the tower (which is indexed as (0, 0)). There is one cup of excess liquid. The glass indexed as (1, 0) and the glass indexed as (1, 1) will share the excess liquid equally, and each will get half cup of champange.\\r\n\\r\n\\r\nExample 3:\\r\n\\r\n\\r\nInput: poured = 100000009, query_row = 33, query_glass = 17\\r\nOutput: 1.00000\\r\n\\r\n\\r\n \\r\nConstraints:\\r\n\\r\n\\r\n\t0 <= poured <= 109\\r\n\t0 <= query_glass <= query_row < 100\\r\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(poured = 100,query_row = 99,query_glass = 50) == 0\n assert candidate(poured = 10,query_row = 2,query_glass = 1) == 1\n assert candidate(poured = 3,query_row = 2,query_glass = 0) == 0\n assert candidate(poured = 5,query_row = 2,query_glass = 2) == 0.5\n assert candidate(poured = 100,query_row = 9,query_glass = 4) == 1\n assert candidate(poured = 100000009,query_row = 33,query_glass = 17) == 1\n assert candidate(poured = 1,query_row = 1,query_glass = 1) == 0\n assert candidate(poured = 100,query_row = 4,query_glass = 2) == 1\n assert candidate(poured = 10,query_row = 4,query_glass = 2) == 0.625\n assert candidate(poured = 2,query_row = 1,query_glass = 1) == 0.5\n assert candidate(poured = 100,query_row = 4,query_glass = 3) == 1\n assert candidate(poured = 10,query_row = 3,query_glass = 2) == 1\n assert candidate(poured = 10,query_row = 5,query_glass = 2) == 0\n assert candidate(poured = 1000000000,query_row = 99,query_glass = 50) == 1\n assert candidate(poured = 0,query_row = 0,query_glass = 0) == 0\n assert candidate(poured = 5,query_row = 2,query_glass = 1) == 1.0\n assert candidate(poured = 600,query_row = 40,query_glass = 30) == 0\n assert candidate(poured = 500000000,query_row = 65,query_glass = 33) == 1\n assert candidate(poured = 20,query_row = 7,query_glass = 3) == 0.21875\n assert candidate(poured = 20000,query_row = 40,query_glass = 35) == 0\n assert candidate(poured = 50,query_row = 7,query_glass = 4) == 1\n assert candidate(poured = 300,query_row = 25,query_glass = 15) == 1\n assert candidate(poured = 20,query_row = 7,query_glass = 5) == 0\n assert candidate(poured = 2000,query_row = 25,query_glass = 20) == 0\n assert candidate(poured = 50000,query_row = 45,query_glass = 40) == 0\n assert candidate(poured = 100000,query_row = 45,query_glass = 23) == 1\n assert candidate(poured = 50000,query_row = 30,query_glass = 25) == 1\n assert candidate(poured = 350,query_row = 50,query_glass = 45) == 0\n assert candidate(poured = 50000,query_row = 45,query_glass = 23) == 1\n assert candidate(poured = 400,query_row = 55,query_glass = 50) == 0\n assert candidate(poured = 2000000,query_row = 65,query_glass = 33) == 1\n assert candidate(poured = 10000,query_row = 40,query_glass = 25) == 1\n assert candidate(poured = 5000,query_row = 30,query_glass = 18) == 1\n assert candidate(poured = 25,query_row = 8,query_glass = 6) == 0\n assert candidate(poured = 1200,query_row = 70,query_glass = 60) == 0\n assert candidate(poured = 100,query_row = 10,query_glass = 5) == 1\n assert candidate(poured = 500,query_row = 65,query_glass = 60) == 0\n assert candidate(poured = 50000000,query_row = 55,query_glass = 28) == 1\n assert candidate(poured = 200,query_row = 25,query_glass = 12) == 1\n assert candidate(poured = 5,query_row = 3,query_glass = 2) == 0\n assert candidate(poured = 400,query_row = 10,query_glass = 8) == 1\n assert candidate(poured = 250,query_row = 20,query_glass = 10) == 1\n assert candidate(poured = 10000,query_row = 35,query_glass = 30) == 0\n assert candidate(poured = 200,query_row = 9,query_glass = 7) == 1\n assert candidate(poured = 1000,query_row = 99,query_glass = 95) == 0\n assert candidate(poured = 15,query_row = 4,query_glass = 2) == 1\n assert candidate(poured = 20,query_row = 4,query_glass = 4) == 0.3125\n assert candidate(poured = 10000000,query_row = 70,query_glass = 35) == 1\n assert candidate(poured = 375,query_row = 85,query_glass = 80) == 0\n assert candidate(poured = 750,query_row = 90,query_glass = 85) == 0\n assert candidate(poured = 1000,query_row = 9,query_glass = 4) == 1\n assert candidate(poured = 1800,query_row = 99,query_glass = 99) == 0\n assert candidate(poured = 150,query_row = 8,query_glass = 4) == 1\n assert candidate(poured = 500,query_row = 20,query_glass = 10) == 1\n assert candidate(poured = 1000000,query_row = 40,query_glass = 20) == 1\n assert candidate(poured = 250,query_row = 40,query_glass = 35) == 0\n assert candidate(poured = 100000000,query_row = 60,query_glass = 30) == 1\n assert candidate(poured = 200000,query_row = 40,query_glass = 35) == 0\n assert candidate(poured = 500,query_row = 35,query_glass = 25) == 0\n assert candidate(poured = 450,query_row = 60,query_glass = 55) == 0\n assert candidate(poured = 50000000,query_row = 80,query_glass = 60) == 1\n assert candidate(poured = 150,query_row = 20,query_glass = 15) == 0\n assert candidate(poured = 5000000,query_row = 45,query_glass = 23) == 1\n assert candidate(poured = 10000000,query_row = 70,query_glass = 55) == 0.6195281249608406\n assert candidate(poured = 400,query_row = 40,query_glass = 35) == 0\n assert candidate(poured = 1000,query_row = 20,query_glass = 15) == 1\n assert candidate(poured = 300,query_row = 45,query_glass = 40) == 0\n assert candidate(poured = 10000,query_row = 30,query_glass = 15) == 1\n assert candidate(poured = 40,query_row = 10,query_glass = 8) == 0\n assert candidate(poured = 700,query_row = 70,query_glass = 65) == 0\n assert candidate(poured = 5000,query_row = 20,query_glass = 15) == 1\n assert candidate(poured = 1000,query_row = 60,query_glass = 50) == 0\n assert candidate(poured = 7,query_row = 4,query_glass = 2) == 0\n assert candidate(poured = 10000,query_row = 25,query_glass = 20) == 1\n assert candidate(poured = 100,query_row = 7,query_glass = 5) == 1\n assert candidate(poured = 200,query_row = 10,query_glass = 5) == 1\n assert candidate(poured = 500000,query_row = 55,query_glass = 28) == 1\n assert candidate(poured = 100000000,query_row = 90,query_glass = 65) == 1\n assert candidate(poured = 200000,query_row = 80,query_glass = 45) == 1\n assert candidate(poured = 425,query_row = 95,query_glass = 90) == 0\n assert candidate(poured = 1000,query_row = 10,query_glass = 5) == 1\n assert candidate(poured = 1024,query_row = 10,query_glass = 5) == 1\n assert candidate(poured = 600,query_row = 75,query_glass = 70) == 0\n assert candidate(poured = 200,query_row = 35,query_glass = 30) == 0\n assert candidate(poured = 25,query_row = 15,query_glass = 10) == 0\n assert candidate(poured = 1100,query_row = 65,query_glass = 55) == 0\n assert candidate(poured = 300,query_row = 9,query_glass = 6) == 1\n assert candidate(poured = 100000000,query_row = 90,query_glass = 45) == 1\n assert candidate(poured = 50,query_row = 15,query_glass = 10) == 0\n assert candidate(poured = 1400,query_row = 80,query_glass = 70) == 0\n assert candidate(poured = 50,query_row = 4,query_glass = 2) == 1\n assert candidate(poured = 175,query_row = 45,query_glass = 40) == 0\n assert candidate(poured = 5000,query_row = 25,query_glass = 12) == 1\n assert candidate(poured = 1700,query_row = 95,query_glass = 85) == 0\n assert candidate(poured = 1023,query_row = 10,query_glass = 5) == 1\n assert candidate(poured = 200000,query_row = 50,query_glass = 25) == 1\n assert candidate(poured = 50000,query_row = 25,query_glass = 12) == 1\n assert candidate(poured = 1000000000,query_row = 70,query_glass = 35) == 1\n assert candidate(poured = 10000,query_row = 20,query_glass = 10) == 1\n assert candidate(poured = 275,query_row = 65,query_glass = 60) == 0\n assert candidate(poured = 325,query_row = 75,query_glass = 70) == 0\n assert candidate(poured = 900,query_row = 99,query_glass = 98) == 0\n assert candidate(poured = 5,query_row = 3,query_glass = 1) == 0\n assert candidate(poured = 500,query_row = 15,query_glass = 7) == 1\n assert candidate(poured = 100000,query_row = 35,query_glass = 30) == 0\n assert candidate(poured = 1000000,query_row = 50,query_glass = 45) == 0\n assert candidate(poured = 10000,query_row = 40,query_glass = 20) == 1\n assert candidate(poured = 400,query_row = 30,query_glass = 20) == 0.12409851141273975\n assert candidate(poured = 5000000,query_row = 70,query_glass = 35) == 1\n assert candidate(poured = 999999999,query_row = 99,query_glass = 49) == 1\n assert candidate(poured = 950,query_row = 99,query_glass = 99) == 0\n assert candidate(poured = 50,query_row = 10,query_glass = 5) == 1\n assert candidate(poured = 150,query_row = 30,query_glass = 25) == 0\n assert candidate(poured = 100000,query_row = 50,query_glass = 45) == 0\n assert candidate(poured = 300,query_row = 30,query_glass = 25) == 0\n assert candidate(poured = 50,query_row = 7,query_glass = 5) == 1\n assert candidate(poured = 900,query_row = 90,query_glass = 85) == 0\n assert candidate(poured = 5000,query_row = 15,query_glass = 8) == 1\n assert candidate(poured = 500,query_row = 30,query_glass = 15) == 1\n assert candidate(poured = 60,query_row = 20,query_glass = 15) == 0\n assert candidate(poured = 800,query_row = 80,query_glass = 75) == 0\n assert candidate(poured = 500000,query_row = 60,query_glass = 55) == 0\n assert candidate(poured = 75,query_row = 25,query_glass = 20) == 0\n assert candidate(poured = 100000000,query_row = 80,query_glass = 40) == 1\n assert candidate(poured = 1000000,query_row = 60,query_glass = 30) == 1\n assert candidate(poured = 50000,query_row = 40,query_glass = 20) == 1\n assert candidate(poured = 15,query_row = 5,query_glass = 2) == 0.875\n assert candidate(poured = 20000,query_row = 50,query_glass = 30) == 1\n assert candidate(poured = 10000000,query_row = 75,query_glass = 38) == 1\n assert candidate(poured = 200,query_row = 7,query_glass = 3) == 1\n assert candidate(poured = 150,query_row = 20,query_glass = 10) == 1\n assert candidate(poured = 800,query_row = 50,query_glass = 40) == 0\n assert candidate(poured = 50,query_row = 6,query_glass = 2) == 1\n assert candidate(poured = 20000,query_row = 35,query_glass = 18) == 1\n assert candidate(poured = 20,query_row = 5,query_glass = 3) == 1\n assert candidate(poured = 100000,query_row = 50,query_glass = 25) == 1\n assert candidate(poured = 850,query_row = 98,query_glass = 95) == 0\n assert candidate(poured = 100000,query_row = 70,query_glass = 40) == 1\n assert candidate(poured = 100,query_row = 5,query_glass = 3) == 1\n assert candidate(poured = 1600,query_row = 90,query_glass = 80) == 0\n assert candidate(poured = 1000,query_row = 35,query_glass = 18) == 1\n assert candidate(poured = 15,query_row = 6,query_glass = 4) == 0\n assert candidate(poured = 500,query_row = 50,query_glass = 45) == 0\n assert candidate(poured = 30,query_row = 9,query_glass = 7) == 0\n assert candidate(poured = 2000,query_row = 15,query_glass = 10) == 1\n assert candidate(poured = 1000,query_row = 25,query_glass = 15) == 1\n assert candidate(poured = 200000,query_row = 55,query_glass = 50) == 0\n assert candidate(poured = 25,query_row = 6,query_glass = 4) == 1\n assert candidate(poured = 700,query_row = 85,query_glass = 80) == 0\n assert candidate(poured = 500,query_row = 15,query_glass = 10) == 1\n assert candidate(poured = 500000,query_row = 90,query_glass = 50) == 1\n assert candidate(poured = 550,query_row = 70,query_glass = 65) == 0\n assert candidate(poured = 800,query_row = 95,query_glass = 90) == 0\n assert candidate(poured = 1000,query_row = 15,query_glass = 7) == 1\n assert candidate(poured = 225,query_row = 55,query_glass = 50) == 0\n assert candidate(poured = 500,query_row = 10,query_glass = 5) == 1\n assert candidate(poured = 20000000,query_row = 80,query_glass = 40) == 1\n assert candidate(poured = 10000000,query_row = 50,query_glass = 25) == 1\n assert candidate(poured = 100000,query_row = 30,query_glass = 15) == 1\n assert candidate(poured = 2000,query_row = 20,query_glass = 10) == 1\n assert candidate(poured = 200,query_row = 10,query_glass = 6) == 1\n assert candidate(poured = 125,query_row = 35,query_glass = 30) == 0\n assert candidate(poured = 900,query_row = 55,query_glass = 45) == 0\n assert candidate(poured = 100,query_row = 15,query_glass = 7) == 1\n assert candidate(poured = 1500,query_row = 85,query_glass = 75) == 0\n assert candidate(poured = 100,query_row = 25,query_glass = 20) == 0\n assert candidate(poured = 500000,query_row = 45,query_glass = 40) == 0\n assert candidate(poured = 1300,query_row = 75,query_glass = 65) == 0\n assert candidate(poured = 650,query_row = 80,query_glass = 75) == 0\n assert candidate(poured = 100,query_row = 5,query_glass = 2) == 1\n assert candidate(poured = 7,query_row = 2,query_glass = 0) == 1.0\n assert candidate(poured = 50000000,query_row = 85,query_glass = 43) == 1\n assert candidate(poured = 1000,query_row = 99,query_glass = 99) == 0\n assert candidate(poured = 600,query_row = 60,query_glass = 55) == 0\n assert candidate(poured = 500000,query_row = 35,query_glass = 18) == 1\n assert candidate(poured = 700,query_row = 45,query_glass = 35) == 0\n assert candidate(poured = 50000,query_row = 60,query_glass = 35) == 1\n assert candidate(poured = 5000,query_row = 30,query_glass = 25) == 0\n assert candidate(poured = 200,query_row = 15,query_glass = 8) == 1\n assert candidate(poured = 100,query_row = 8,query_glass = 6) == 1\n assert candidate(poured = 1000000000,query_row = 90,query_glass = 45) == 1\n assert candidate(poured = 5000000,query_row = 60,query_glass = 50) == 0\n assert candidate(poured = 10,query_row = 5,query_glass = 3) == 0\n"}, "metadata": {"canonical_parameter_names": ["poured", "query_row", "query_glass"], "leetcode_dataset_entry_point": "Solution().champagneTower", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var champagneTower = function(poured, query_row, query_glass) {", "container": null, "callable": "champagneTower", "parameters": [{"name": "poured", "type": "number"}, {"name": "query_row", "type": "number"}, {"name": "query_glass", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 801, "task_id": "minimum-swaps-to-make-sequences-increasing", "difficulty": "Hard", "problem_description": "You are given two integer arrays of the same length nums1 and nums2. In one operation, you are allowed to swap nums1[i] with nums2[i].\n\nFor example, if nums1 = [1,2,3,8], and nums2 = [5,6,7,4], you can swap the element at i = 3 to obtain nums1 = [1,2,3,4] and nums2 = [5,6,7,8].\n\nReturn the minimum number of needed operations to make nums1 and nums2 strictly increasing. The test cases are generated so that the given input always makes it possible.\nAn array arr is strictly increasing if and only if arr[0] < arr[1] < arr[2] < ... < arr[arr.length - 1].\n \nExample 1:\n\nInput: nums1 = [1,3,5,4], nums2 = [1,2,3,7]\nOutput: 1\nExplanation: \nSwap nums1[3] and nums2[3]. Then the sequences are:\nnums1 = [1, 3, 5, 7] and nums2 = [1, 2, 3, 4]\nwhich are both strictly increasing.\n\nExample 2:\n\nInput: nums1 = [0,3,5,8,9], nums2 = [2,1,4,6,9]\nOutput: 1\n\n \nConstraints:\n\n2 <= nums1.length <= 105\nnums2.length == nums1.length\n0 <= nums1[i], nums2[i] <= 2 * 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums1 = [10, 19, 14, 6, 7],nums2 = [6, 5, 8, 11, 10]) == 2\n assert candidate(nums1 = [0, 4, 4, 5, 9],nums2 = [0, 1, 6, 8, 10]) == 1\n assert candidate(nums1 = [10, 19, 18, 3],nums2 = [5, 5, 5, 4]) == 2\n assert candidate(nums1 = [1, 2, 3],nums2 = [3, 2, 1]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5],nums2 = [5, 4, 3, 2, 1]) == 2\n assert candidate(nums1 = [1, 3, 5, 4],nums2 = [1, 2, 3, 7]) == 1\n assert candidate(nums1 = [1, 100, 1, 100],nums2 = [2, 1, 2, 1]) == 2\n assert candidate(nums1 = [1, 100, 3, 100, 100],nums2 = [1, 101, 3, 101, 100]) == 2\n assert candidate(nums1 = [0, 3, 5, 8, 9],nums2 = [2, 1, 4, 6, 9]) == 1\n assert candidate(nums1 = [1, 5, 9, 13, 17, 21],nums2 = [2, 6, 10, 14, 18, 22]) == 0\n assert candidate(nums1 = [1, 5, 6, 7, 8, 9, 10, 11, 12, 13],nums2 = [0, 2, 3, 4, 5, 6, 7, 8, 9, 14]) == 0\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9],nums2 = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 4\n assert candidate(nums1 = [3, 2, 1],nums2 = [6, 5, 4]) == 1\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110],nums2 = [9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 109]) == 0\n assert candidate(nums1 = [3, 20, 5, 9, 10, 11],nums2 = [1, 19, 4, 8, 12, 13]) == 1\n assert candidate(nums1 = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2],nums2 = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 5\n assert candidate(nums1 = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],nums2 = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 5\n assert candidate(nums1 = [20, 18, 16, 14, 12, 10, 8, 6, 4, 2],nums2 = [21, 19, 17, 15, 13, 11, 9, 7, 5, 3]) == 5\n assert candidate(nums1 = [100, 200, 150, 300, 250],nums2 = [90, 180, 210, 270, 350]) == 2\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 5\n assert candidate(nums1 = [3, 2, 1, 5, 6, 7, 8],nums2 = [4, 3, 2, 4, 5, 6, 7]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],nums2 = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 0\n assert candidate(nums1 = [10, 30, 20, 50, 40, 70, 60],nums2 = [5, 25, 25, 45, 55, 65, 80]) == 3\n assert candidate(nums1 = [5, 3, 4, 4, 7, 8, 9],nums2 = [6, 4, 5, 5, 8, 7, 10]) == 3\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],nums2 = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 16\n assert candidate(nums1 = [1, 5, 3, 9, 7, 11, 8],nums2 = [2, 4, 6, 8, 10, 9, 12]) == 3\n assert candidate(nums1 = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18],nums2 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 0\n assert candidate(nums1 = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],nums2 = [95, 85, 75, 65, 55, 45, 35, 25, 15, 5]) == 5\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 0\n assert candidate(nums1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],nums2 = [1, 0, 3, 2, 5, 4, 7, 6, 9, 8]) == 5\n assert candidate(nums1 = [5, 7, 4, 8, 9, 10, 6, 11, 12, 13],nums2 = [6, 6, 5, 7, 10, 9, 7, 12, 11, 14]) == 3\n assert candidate(nums1 = [3, 9, 7, 11, 13, 15, 17, 19],nums2 = [2, 10, 8, 12, 14, 16, 18, 20]) == 1\n assert candidate(nums1 = [10, 20, 30, 40, 50],nums2 = [15, 25, 35, 45, 55]) == 0\n assert candidate(nums1 = [5, 3, 8, 6, 11, 9, 14, 12, 17, 15],nums2 = [4, 4, 7, 7, 10, 10, 13, 13, 16, 16]) == 5\n assert candidate(nums1 = [30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2],nums2 = [29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 7\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16]) == 7\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9]) == 5\n assert candidate(nums1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 5\n assert candidate(nums1 = [0, 2, 2, 3, 5, 6, 8, 9, 11],nums2 = [1, 1, 3, 4, 4, 7, 7, 10, 12]) == 3\n assert candidate(nums1 = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],nums2 = [99, 89, 79, 69, 59, 49, 39, 29, 19, 9]) == 5\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],nums2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 0\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],nums2 = [11, 19, 31, 39, 51, 59, 71, 79, 91, 99]) == 0\n assert candidate(nums1 = [1, 3, 20, 4, 1, 5],nums2 = [1, 2, 5, 3, 7, 6]) == 2\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],nums2 = [9, 19, 29, 39, 49, 59, 69, 79, 89, 99]) == 0\n assert candidate(nums1 = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7],nums2 = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9]) == 5\n assert candidate(nums1 = [4, 3, 2, 1],nums2 = [1, 2, 3, 4]) == 2\n assert candidate(nums1 = [1, 3, 2, 1, 4, 7, 8, 9, 10],nums2 = [2, 4, 1, 5, 5, 6, 7, 8, 9]) == 2\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 5\n assert candidate(nums1 = [6, 8, 9, 2, 5],nums2 = [2, 7, 4, 8, 3]) == 2\n assert candidate(nums1 = [3, 12, 23, 45, 67, 89, 100],nums2 = [2, 13, 22, 46, 66, 90, 101]) == 0\n assert candidate(nums1 = [5, 10, 15, 20, 25, 30, 35, 40],nums2 = [6, 11, 14, 21, 24, 29, 36, 41]) == 0\n assert candidate(nums1 = [5, 3, 20, 15, 10, 25, 30],nums2 = [6, 7, 19, 14, 9, 24, 29]) == 2\n assert candidate(nums1 = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],nums2 = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 5\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],nums2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == 0\n assert candidate(nums1 = [5, 2, 4, 6, 8, 10, 12],nums2 = [6, 1, 5, 7, 9, 11, 13]) == 1\n assert candidate(nums1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 5\n assert candidate(nums1 = [1, 5, 3, 4, 2, 6, 7, 8, 9, 10],nums2 = [2, 4, 6, 5, 7, 8, 9, 10, 11, 12]) == 2\n assert candidate(nums1 = [1, 5, 3, 7, 9, 11, 13, 15],nums2 = [2, 4, 6, 8, 10, 12, 14, 16]) == 1\n assert candidate(nums1 = [3, 2, 1, 4, 5, 6, 9, 8, 7, 10],nums2 = [1, 2, 3, 5, 4, 7, 6, 9, 8, 11]) == 4\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],nums2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]) == 0\n assert candidate(nums1 = [1, 5, 4, 3, 2, 7, 8, 9, 10, 11],nums2 = [2, 4, 6, 7, 8, 9, 10, 11, 12, 13]) == 2\n assert candidate(nums1 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],nums2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 5\n assert candidate(nums1 = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37],nums2 = [2, 6, 10, 14, 18, 22, 26, 30, 34, 38]) == 0\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],nums2 = [11, 19, 29, 39, 49, 59, 69, 79, 89, 99]) == 0\n assert candidate(nums1 = [8, 4, 3, 6, 7, 5, 9],nums2 = [7, 5, 4, 9, 6, 8, 10]) == 2\n assert candidate(nums1 = [0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000],nums2 = [1, 999, 1999, 2999, 3999, 4999, 5999, 6999, 7999, 8999]) == 0\n assert candidate(nums1 = [4, 5, 8, 11, 2, 10, 15],nums2 = [3, 7, 9, 10, 3, 9, 14]) == 1\n assert candidate(nums1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 5\n assert candidate(nums1 = [8, 10, 1, 11, 13, 15, 17],nums2 = [7, 9, 2, 12, 14, 16, 18]) == 1\n assert candidate(nums1 = [2, 5, 1, 10, 6],nums2 = [3, 4, 8, 9, 7]) == 2\n assert candidate(nums1 = [1, 5, 2, 4, 3, 6, 7, 8, 9, 10],nums2 = [2, 4, 5, 3, 6, 5, 8, 7, 10, 9]) == 4\n assert candidate(nums1 = [2, 20, 18, 24, 22, 26, 24, 28, 26, 30],nums2 = [1, 19, 17, 23, 21, 25, 23, 27, 25, 29]) == 4\n assert candidate(nums1 = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28],nums2 = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29]) == 0\n assert candidate(nums1 = [4, 9, 6, 5, 8],nums2 = [3, 8, 7, 4, 10]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 0\n assert candidate(nums1 = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11],nums2 = [2, 4, 3, 6, 5, 8, 7, 10, 9, 12]) == 4\n assert candidate(nums1 = [1, 3, 2, 4, 5, 6, 8, 7, 9, 10],nums2 = [2, 1, 4, 3, 6, 5, 7, 8, 10, 9]) == 5\n assert candidate(nums1 = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109],nums2 = [99, 100, 101, 102, 103, 104, 105, 106, 107, 108]) == 0\n assert candidate(nums1 = [1, 2, 2, 3, 4, 5, 6, 7, 8, 9],nums2 = [1, 2, 3, 2, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums1 = [10, 10, 10, 10, 10, 10],nums2 = [11, 11, 11, 11, 11, 11]) == 3\n assert candidate(nums1 = [9, 8, 7, 6, 5, 4],nums2 = [10, 9, 8, 7, 6, 5]) == 3\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [2, 3, 1, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]) == 7\n assert candidate(nums1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 5\n assert candidate(nums1 = [5, 8, 3, 8, 9, 10, 12, 11, 14, 15],nums2 = [6, 7, 4, 7, 10, 9, 11, 12, 13, 16]) == 3\n assert candidate(nums1 = [8, 3, 9, 4, 6],nums2 = [5, 2, 7, 8, 1]) == 2\n assert candidate(nums1 = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],nums2 = [11, 10, 13, 12, 15, 14, 17, 16, 19, 18]) == 5\n assert candidate(nums1 = [8, 7, 6, 5, 4, 3, 2, 1],nums2 = [1, 2, 3, 4, 5, 6, 7, 8]) == 4\n assert candidate(nums1 = [3, 7, 5, 9, 12, 15],nums2 = [2, 8, 4, 11, 10, 16]) == 2\n assert candidate(nums1 = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],nums2 = [6, 14, 24, 34, 44, 54, 64, 74, 84, 94]) == 0\n assert candidate(nums1 = [6, 7, 8, 9, 10, 11, 12],nums2 = [5, 6, 7, 8, 9, 10, 11]) == 0\n assert candidate(nums1 = [1, 9, 4, 7, 8, 10],nums2 = [4, 3, 6, 5, 9, 11]) == 2\n assert candidate(nums1 = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91],nums2 = [101, 102, 103, 104, 105, 106, 107, 108, 109, 110]) == 5\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9]) == 5\n assert candidate(nums1 = [1, 3, 5, 4, 10, 12, 11, 15, 16],nums2 = [1, 2, 3, 7, 9, 11, 13, 14, 17]) == 2\n assert candidate(nums1 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],nums2 = [3, 5, 7, 9, 11, 13, 15, 17, 19, 21]) == 0\n assert candidate(nums1 = [4, 3, 2, 1],nums2 = [1, 2, 3, 4]) == 2\n assert candidate(nums1 = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10],nums2 = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12]) == 5\n assert candidate(nums1 = [5, 4, 3, 2, 1, 10, 9, 8, 7, 6],nums2 = [6, 5, 4, 3, 2, 11, 10, 9, 8, 7]) == 4\n assert candidate(nums1 = [4, 5, 6, 7, 8, 9],nums2 = [3, 4, 5, 6, 7, 8]) == 0\n assert candidate(nums1 = [5, 2, 3, 8, 1],nums2 = [1, 3, 9, 2, 7]) == 2\n assert candidate(nums1 = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3],nums2 = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 5\n assert candidate(nums1 = [5, 6, 4, 9, 8, 11, 13],nums2 = [4, 7, 5, 8, 9, 12, 14]) == 2\n assert candidate(nums1 = [4, 10, 12, 15, 16, 20, 25, 30],nums2 = [3, 9, 11, 14, 17, 19, 24, 29]) == 0\n assert candidate(nums1 = [2, 1, 4, 6, 8, 10, 12],nums2 = [3, 2, 5, 7, 9, 11, 13]) == 1\n assert candidate(nums1 = [4, 3, 2, 1],nums2 = [8, 7, 6, 5]) == 2\n assert candidate(nums1 = [1, 9, 4, 8, 10, 7, 12, 6, 14],nums2 = [2, 8, 5, 9, 9, 8, 11, 7, 15]) == 3\n"}, "metadata": {"canonical_parameter_names": ["nums1", "nums2"], "leetcode_dataset_entry_point": "Solution().minSwap", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minSwap = function(nums1, nums2) {", "container": null, "callable": "minSwap", "parameters": [{"name": "nums1", "type": "number[]"}, {"name": "nums2", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 802, "task_id": "find-eventual-safe-states", "difficulty": "Medium", "problem_description": "There is a directed graph of n nodes with each node labeled from 0 to n - 1. The graph is represented by a 0-indexed 2D integer array graph where graph[i] is an integer array of nodes adjacent to node i, meaning there is an edge from node i to each node in graph[i].\nA node is a terminal node if there are no outgoing edges. A node is a safe node if every possible path starting from that node leads to a terminal node (or another safe node).\nReturn an array containing all the safe nodes of the graph. The answer should be sorted in ascending order.\n \nExample 1:\n\n\nInput: graph = [[1,2],[2,3],[5],[0],[5],[],[]]\nOutput: [2,4,5,6]\nExplanation: The given graph is shown above.\nNodes 5 and 6 are terminal nodes as there are no outgoing edges from either of them.\nEvery path starting at nodes 2, 4, 5, and 6 all lead to either node 5 or 6.\nExample 2:\n\nInput: graph = [[1,2,3,4],[1,2],[3,4],[0,4],[]]\nOutput: [4]\nExplanation:\nOnly node 4 is a terminal node, and every path starting at node 4 leads to node 4.\n\n \nConstraints:\n\nn == graph.length\n1 <= n <= 104\n0 <= graph[i].length <= n\n0 <= graph[i][j] <= n - 1\ngraph[i] is sorted in a strictly increasing order.\nThe graph may contain self-loops.\nThe number of edges in the graph will be in the range [1, 4 * 104].\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(graph = [[1, 2, 3, 4], [1, 2], [3, 4], [0, 4], []]) == [4]\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], []]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n assert candidate(graph = [[], [0, 2, 3, 4, 5, 6, 7, 8, 9], [4, 5, 6, 7, 8, 9], [4, 5, 6, 7, 8, 9], [7, 8, 9], [7, 8, 9], [7, 8, 9], [8, 9], [9], []]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(graph = [[], [0, 2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6], [5, 6], [6], []]) == [0, 1, 2, 3, 4, 5, 6]\n assert candidate(graph = [[], [1], [2], [3], [4], [5], [6], [7], [8], [9], []]) == [0, 10]\n assert candidate(graph = [[], [0]]) == [0, 1]\n assert candidate(graph = [[1, 2], [2, 3], [3], [4], []]) == [0, 1, 2, 3, 4]\n assert candidate(graph = [[0], [2, 3, 4], [3, 4], [0, 4], []]) == [4]\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [3, 8], [9], []]) == [8, 9]\n assert candidate(graph = [[1, 2], [2, 3], [5], [0], [5], [], []]) == [2, 4, 5, 6]\n assert candidate(graph = [[], [0, 2, 3, 4, 5], [3], [4, 5], [5], [], []]) == [0, 1, 2, 3, 4, 5, 6]\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [0]]) == []\n assert candidate(graph = [[], [2], [3], [4], [5], [], [5]]) == [0, 1, 2, 3, 4, 5, 6]\n assert candidate(graph = [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7, 8, 9], []]) == [7]\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], []]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n assert candidate(graph = [[1], [2], [3], [4], []]) == [0, 1, 2, 3, 4]\n assert candidate(graph = [[0], [0]]) == []\n assert candidate(graph = [[], [], [], [], [], [], [], [], [], []]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(graph = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], []]) == [9]\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [], [10]]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n assert candidate(graph = [[], [0, 2, 3, 4], [3], [4], []]) == [0, 1, 2, 3, 4]\n assert candidate(graph = [[0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], []]) == [4]\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [8], [9], []]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(graph = [[1], [0, 2], [2]]) == []\n assert candidate(graph = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 0]]) == []\n assert candidate(graph = [[0, 1, 2], [2, 2, 3], [3], [4], []]) == [1, 2, 3, 4]\n assert candidate(graph = [[1, 2], [2, 4], [3], [6], [5], [6], []]) == [0, 1, 2, 3, 4, 5, 6]\n assert candidate(graph = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]) == []\n assert candidate(graph = [[1], [2], [3], []]) == [0, 1, 2, 3]\n assert candidate(graph = [[5, 2, 5, 3, 2, 3], [2, 4, 2, 2], [4, 5, 2, 2, 2], [2], [0, 3, 0, 0, 2, 2], [0, 0, 2, 5, 2, 0]]) == []\n assert candidate(graph = [[1], [2], [0], [3], [3, 5], [4, 5, 6], [4, 6, 7], [5, 6, 8], [7, 9], [], [10, 11, 12], [10], [10, 12], [13, 14, 15], [13, 15], [14], [15], [], [], [], [], [16, 17, 18], [16, 18], [16, 17, 19], [20, 21], [20, 22], [20, 21, 22], [23, 24, 25], [23, 25], [23, 24, 25], [26], [27, 28, 29], [27, 29], [27, 28, 30], [31], [32, 33, 34], [32, 34], [32, 33, 35], [33, 35], [34, 35], []]) == [9, 17, 18, 19, 20, 40]\n assert candidate(graph = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [21, 22], [23, 24], [25, 26], [27, 28], [29, 30], [31, 32], [33, 34], [35, 36], [37, 38], [39, 40], [41, 42], [43, 44], [45, 46], [47, 48], [49, 50], [51, 52], [53, 54], [55, 56], [57, 58], [59, 60], [61, 62], [63, 64], [65, 66], [67, 68], [69, 70], [71, 72], [73, 74], [75, 76], [77, 78], [79, 80], [81, 82], [83, 84], [85, 86], [87, 88], [89, 90], [91, 92], [93, 94], [95, 96], [97, 98], [99], [100, 101], [102, 103], [104, 105], [106, 107], [108, 109], [110, 111], [112, 113], [114, 115], [116, 117], [118, 119], [120, 121], [122, 123], [124, 125], [126, 127], [128, 129], [130, 131], [132, 133], [134, 135], [136, 137], [138, 139], [140, 141], [142, 143], [144, 145], [146, 147], [148, 149], [150, 151], [152, 153], [154, 155], [156, 157], [158, 159], [160, 161], [162, 163], [164, 165], [166, 167], [168, 169], [170, 171], [172, 173], [174, 175], [176, 177], [178, 179], [180, 181], [182, 183], [184, 185], [186, 187], [188, 189], [190, 191], [192, 193], [194, 195], [196, 197], [198, 199], [200, 201], [202, 203], [204, 205], [206, 207], [208, 209], [210, 211], [212, 213], [214, 215], [216, 217], [218, 219], [220, 221], [222, 223], [224, 225], [226, 227], [228, 229], [230, 231], [232, 233], [234, 235], [236, 237], [238, 239], [240, 241], [242, 243], [244, 245], [246, 247], [248, 249], [250, 251], [252, 253], [254, 255]]) == []\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [], [26], [], [28], [29], [30], [31], [32], [33], [34], [35], [36], [37], [38], [39], [40], [0]]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]\n assert candidate(graph = [[], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0]]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n assert candidate(graph = [[1, 2], [2, 3], [3, 4], [4, 0], [4]]) == []\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [0]]) == []\n assert candidate(graph = [[1, 2], [3], [3], [4], [5], [6], [5], [7], [8], [9], [10], [], [11], [], [13], [], [], [], [], [], []]) == [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n assert candidate(graph = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 0]]) == []\n assert candidate(graph = [[1, 2], [0, 3], [3, 4], [4, 1], [5], [], [4, 6]]) == [4, 5]\n assert candidate(graph = [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [0, 0, 0, 0, 0]]) == []\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [0], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 16], [15, 17], [16, 18], [17, 19], [18, 20], [19, 21], [20, 22], [21, 23], [22, 24], [23, 25], [24, 26], [25, 27], [26, 28], [27, 29], [28, 30], [29, 31], [30, 32], [31, 33], [32, 34], [33, 35], [34, 36], [35, 37], [36, 38], [37, 39], [38, 40], [39, 0]]) == []\n assert candidate(graph = [[1, 2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19], [0, 20], [21, 22], [23, 24], [25, 26], [27, 28], [29, 30], [31, 32], [33, 34], [35, 36], [37, 38], [39, 40], [41, 42], [43, 44], [45, 46], [47, 48], [49, 50], [51, 52], [53, 54], [55, 56], [57, 58], [59, 60], [61, 62], [63, 64], [65, 66], [67, 68], [69, 70], [71, 72], [73, 74], [75, 76], [77, 78], [79, 80], [81, 82], [83, 84], [85, 86], [87, 88], [89, 90], [91, 92], [93, 94], [95, 96], [97, 98], [99, 100], [101, 102], [103, 104], [105, 106], [107, 108], [109, 110], [111, 112], [113, 114], [115, 116], [117, 118], [119, 120], [121, 122], [123, 124], [125, 126], [127, 128], [129, 130], [131, 132], [133, 134], [135, 136], [137, 138], [139, 140], [141, 142], [143, 144], [145, 146], [147, 148], [149, 150], [151, 152], [153, 154], [155, 156], [157, 158], [159, 160], [161, 162], [163, 164], [165, 166], [167, 168], [169, 170], [171, 172], [173, 174], [175, 176], [177, 178], [179, 180], [181, 182], [183, 184], [185, 186], [187, 188], [189, 190], [191, 192], [193, 194], [195, 196], [197, 198], [199, 0]]) == []\n assert candidate(graph = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 0], [6, 7], [7, 8], [8, 9], [9, 6]]) == []\n assert candidate(graph = [[], [2], [1], [3], [3, 4], [3, 5], [4, 7], [8], [], [], [], [7], [10], [11], [12], [], [14], [], [16], [17], [18], [19], [0]]) == [0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]\n assert candidate(graph = [[], [0], [0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31], [32], [33], [34], [35], [36], [37], [38], [39], [40], [41], [42], [43], [44], [45], [46], [47], [48], [49], [50], [51], [52], [53], [54], [55], [56], [57], [58], [59], [60], [61], [62], [63], [64], [65], [66], [67], [68], [69], [70], [71], [72], [73], [74], [75], [76], [77], [78], [79], [80], [81], [82], [83], [84], [85], [86], [87], [88], [89], [90], [91], [92], [93], [94], [95], [96], [97], [98], [99]]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101]\n assert candidate(graph = [[1], [2], [3], [4], [0], [6], [7], [8], [9], [10], [11], [12], [13], [14], [], [16], [], [18], [19], [20], [21], [0]]) == [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]\n assert candidate(graph = [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], []]) == [4]\n assert candidate(graph = [[1, 2, 3, 4, 5], [2, 3, 4, 5], [3, 4, 5], [4, 5], [5], [6], [7], [8], [9], []]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(graph = [[], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]]) == [0]\n assert candidate(graph = [[], [2, 2, 3], [2], [4], [5, 6, 7], [8, 9], [10], [10, 9, 8], [11], [12], [12], [13], [13], []]) == [0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], []]) == [21]\n assert candidate(graph = [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7, 8, 9], [8, 9, 10], [9, 10, 0], [10, 0, 1]]) == []\n assert candidate(graph = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n assert candidate(graph = [[1, 2], [0, 3], [3], [4, 5], [5], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], [25, 26], [26, 27], [27, 28], [28, 29], [29, 30], [30, 31], [31, 32], [32, 33], [33, 34], [34, 35], [35, 36], [36, 37], [37, 38], [38, 39], [39, 40], [40, 41], [41, 42], [42, 43], [43, 44], [44, 45], [45, 46], [46, 47], [47, 48], [48, 49], [49, 50], [50, 51], [51, 52], [52, 53], [53, 54], [54, 55], [55, 56], [56, 57], [57, 58], [58, 59], [59, 60], [60, 61], [61, 62], [62, 63], [63, 64], [64, 65], [65, 66], [66, 67], [67, 68], [68, 69], [69, 70], [70, 71], [71, 72], [72, 73], [73, 74], [74, 75], [75, 76], [76, 77], [77, 78], [78, 79], [79, 80], [80, 81], [81, 82], [82, 83], [83, 84], [84, 85], [85, 86], [86, 87], [87, 88], [88, 89], [89, 90], [90, 91], [91, 92], [92, 93], [93, 94], [94, 95], [95, 96], [96, 97], [97, 98], [98, 99], [99, 100], [100, 101], [101, 102], [102, 103], [103, 104], [104, 105], [105, 106], [106, 107], [107, 108], [108, 109], [109, 110], [110, 111], [111, 112], [112, 113], [113, 114], [114, 115], [115, 116], [116, 117], [117, 118], [118, 119], [119, 120], [120, 121], [121, 122], [122, 123], [123, 124], [124, 125], [125, 126], [126, 127], [127, 128], [128, 129], [129, 130], [130, 131], [131, 132], [132, 133], [133, 134], [134, 135], [135, 136], [136, 137], [137, 138], [138, 139], [139, 140], [140, 141], [141, 142], [142, 143], [143, 144], [144, 145], [145, 146], [146, 147], [147, 148], [148, 149], [149, 150], [150, 151], [151, 152], [152, 153], [153, 154], [154, 155], [155, 156], [156, 157], [157, 158], [158, 159], [159, 160], [160, 161], [161, 162], [162, 163], [163, 164], [164, 165], [165, 166], [166, 167], [167, 168], [168, 169], [169, 170], [170, 171], [171, 172], [172, 173], [173, 174], [174, 175], [175, 176], [176, 177], [177, 178], [178, 179], [179, 180], [180, 181], [181, 182], [182, 183], [183, 184], [184, 185], [185, 186], [186, 187], [187, 188], [188, 189], [189, 190], [190, 191], [191, 192], [192, 193], [193, 194], [194, 195], [195, 196], [196, 197], [197, 198], [198, 199], [199, 200]]) == []\n assert candidate(graph = [[1, 2, 3], [2, 3], [3], [4, 5, 6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [0], [0, 1], [2]]) == []\n assert candidate(graph = [[1, 2], [0], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 16], [15, 17], [16, 18], [17, 19], [18, 19], [19]]) == []\n assert candidate(graph = [[], [0], [0, 1], [2], [3], [3], [3], [4]]) == [0, 1, 2, 3, 4, 5, 6, 7]\n assert candidate(graph = [[4, 3, 1], [3, 2, 4], [3], [4], []]) == [0, 1, 2, 3, 4]\n assert candidate(graph = [[], [0, 2], [0, 3], [0, 4], [0]]) == [0, 1, 2, 3, 4]\n assert candidate(graph = [[], [1, 2], [1, 2], [1, 2], [3, 4], [4], [5], [5], [5], [5]]) == [0]\n assert candidate(graph = [[1, 2, 3, 4], [2, 3, 5], [0, 2, 3, 5], [0, 1, 2, 3, 6], [0, 1, 2, 5], [1, 2, 3, 4, 7], [], [8], [9], [8]]) == [6]\n assert candidate(graph = [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7, 8, 9], [8, 9, 10], [9, 10, 11], [10, 11, 12], [11, 12, 13], [12, 13, 14], [13, 14, 15], [14, 15, 16], [15, 16, 17], [16, 17, 18], [17, 18, 19], [18, 19, 0], [19, 1], [0, 2]]) == []\n assert candidate(graph = [[1, 3], [2], [3, 4], [5], [6], [7], [8], [9], [], [1]]) == [4, 6, 8]\n assert candidate(graph = [[1, 2], [0, 3], [4, 5], [4, 6], [7], [7], [7], []]) == [2, 3, 4, 5, 6, 7]\n assert candidate(graph = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7], [5, 6, 7, 8], [6, 7, 8, 9], [7, 8, 9, 10], [8, 9, 10, 11], [9, 10, 11, 12], [10, 11, 12, 13], [11, 12, 13, 14], [12, 13, 14, 15], [13, 14, 15, 16], [14, 15, 16, 17], [15, 16, 17, 18], [16, 17, 18, 19], [17, 18, 19, 0], [18, 19, 0, 1], [19, 0, 1, 2], [0, 1, 2, 3]]) == []\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [3, 8], [9, 10], [10], [10, 11], [12], [13], [14], [15], [16], [17], [18], [19], [20, 21, 22], [20, 22], [20, 21, 22], [23, 24, 25], [23, 25], [23, 24, 25], [26], [27, 28, 29], [27, 29], [27, 28, 30], [31], [32, 33, 34], [32, 34], [32, 33, 35], [33, 35], [34, 35], [36], [37, 38, 39], [37, 39], [37, 38, 40], [41], [42, 43, 44], [42, 44], [42, 43, 45], [43, 45], [44, 45], [46], [47, 48, 49], [47, 49], [47, 48, 50], [51], [52, 53, 54], [52, 54], [52, 53, 55], [53, 55], [54, 55], []]) == [55]\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [3, 8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [20]]) == [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 31]\n assert candidate(graph = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], []]) == [20]\n assert candidate(graph = [[1, 2, 3], [2, 3], [3], []]) == [0, 1, 2, 3]\n assert candidate(graph = [[1, 2, 3], [0, 2], [3], [4], [5], [], [5], [8], [9], [8], [11], [12], [], [10]]) == [2, 3, 4, 5, 6, 10, 11, 12, 13]\n assert candidate(graph = [[1, 2, 3], [2], [0], [4], []]) == [3, 4]\n assert candidate(graph = [[1], [2], [3], [4], [3], [6], [5], [7], [7], [8], [], [9], [10], [11], [12], [], [14], [], [16], [17], [18], [19], [0]]) == [10, 12, 14, 15, 16, 17, 18, 19, 20, 21]\n assert candidate(graph = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], [25, 26], [26, 27], [27, 28], [28, 29], [29, 30], [30, 31], [31, 32], [32, 33], [33, 34], [34, 35], [35, 36], [36, 37], [37, 38], [38, 39], [39, 0]]) == []\n assert candidate(graph = [[1], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7, 8, 9], [8, 9, 10], [9, 10, 11], [10, 11, 12], [11, 12, 13], [12, 13, 14], [13, 14, 15], [14, 15, 16], [15, 16, 17], [16, 17, 18], [17, 18, 19], [18, 19, 20], [19, 20, 21], [20, 21, 22], [21, 22, 23], [22, 23, 24], [23, 24, 25], [24, 25, 26], [25, 26, 27], [26, 27, 28], [27, 28, 29], [28, 29, 30], [29, 30, 31], [30, 31, 32], [31, 32, 33], [32, 33, 34], [33, 34, 35], [34, 35, 36], [35, 36, 37], [36, 37, 38], [37, 38, 39], [38, 39, 0], [39, 0, 1]]) == []\n assert candidate(graph = [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7, 8, 9], [8, 9, 10], [9, 10, 11], [10, 11, 12], [11, 12, 13], [12, 13, 14], [13, 14, 15], [14, 15, 16], [15, 16, 17], [16, 17, 18], [17, 18, 19], [], [], []]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199], [0]]) == []\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]]) == []\n assert candidate(graph = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0]]) == []\n assert candidate(graph = [[1, 2], [0, 3], [4, 5], [6], [5], [6, 7], [7], [8, 9], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [10]]) == []\n assert candidate(graph = [[], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], []]) == [0, 21]\n"}, "metadata": {"canonical_parameter_names": ["graph"], "leetcode_dataset_entry_point": "Solution().eventualSafeNodes", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var eventualSafeNodes = function(graph) {", "container": null, "callable": "eventualSafeNodes", "parameters": [{"name": "graph", "type": "number[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 803, "task_id": "bricks-falling-when-hit", "difficulty": "Hard", "problem_description": "You are given an m x n binary grid, where each 1 represents a brick and 0 represents an empty space. A brick is stable if:\n\nIt is directly connected to the top of the grid, or\nAt least one other brick in its four adjacent cells is stable.\n\nYou are also given an array hits, which is a sequence of erasures we want to apply. Each time we want to erase the brick at the location hits[i] = (rowi, coli). The brick on that location (if it exists) will disappear. Some other bricks may no longer be stable because of that erasure and will fall. Once a brick falls, it is immediately erased from the grid (i.e., it does not land on other stable bricks).\nReturn an array result, where each result[i] is the number of bricks that will fall after the ith erasure is applied.\nNote that an erasure may refer to a location with no brick, and if it does, no bricks drop.\n \nExample 1:\n\nInput: grid = [[1,0,0,0],[1,1,1,0]], hits = [[1,0]]\nOutput: [2]\nExplanation: Starting with the grid:\n[[1,0,0,0],\n [1,1,1,0]]\nWe erase the underlined brick at (1,0), resulting in the grid:\n[[1,0,0,0],\n [0,1,1,0]]\nThe two underlined bricks are no longer stable as they are no longer connected to the top nor adjacent to another stable brick, so they will fall. The resulting grid is:\n[[1,0,0,0],\n [0,0,0,0]]\nHence the result is [2].\n\nExample 2:\n\nInput: grid = [[1,0,0,0],[1,1,0,0]], hits = [[1,1],[1,0]]\nOutput: [0,0]\nExplanation: Starting with the grid:\n[[1,0,0,0],\n [1,1,0,0]]\nWe erase the underlined brick at (1,1), resulting in the grid:\n[[1,0,0,0],\n [1,0,0,0]]\nAll remaining bricks are still stable, so no bricks fall. The grid remains the same:\n[[1,0,0,0],\n [1,0,0,0]]\nNext, we erase the underlined brick at (1,0), resulting in the grid:\n[[1,0,0,0],\n [0,0,0,0]]\nOnce again, all remaining bricks are still stable, so no bricks fall.\nHence the result is [0,0].\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m, n <= 200\ngrid[i][j] is 0 or 1.\n1 <= hits.length <= 4 * 104\nhits[i].length == 2\n0 <= xi <= m - 1\n0 <= yi <= n - 1\nAll (xi, yi) are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1, 1, 1, 0], [1, 0, 0, 0], [1, 1, 1, 0]],hits = [[0, 0], [1, 1], [2, 2]]) == [4, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1], [0, 1, 0, 1], [1, 1, 1, 1]],hits = [[1, 0], [1, 2]]) == [0, 0]\n assert candidate(grid = [[1, 0, 1], [1, 1, 1]],hits = [[0, 0], [0, 2]]) == [0, 3]\n assert candidate(grid = [[1, 0, 0, 0], [1, 1, 1, 0]],hits = [[1, 0]]) == [2]\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]],hits = [[0, 0], [0, 1], [0, 2]]) == [0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[1, 1]]) == [0]\n assert candidate(grid = [[1, 0, 0, 0], [1, 1, 0, 0]],hits = [[1, 1], [1, 0]]) == [0, 0]\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]],hits = [[1, 0]]) == [0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],hits = [[1, 1], [1, 2], [1, 3]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 1, 0, 1], [1, 1, 1, 1, 0, 1, 0], [0, 0, 1, 0, 1, 1, 1], [0, 1, 1, 1, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0]],hits = [[0, 0], [1, 2], [2, 1], [3, 1], [4, 0]]) == [10, 0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]],hits = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]]) == [0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0]],hits = [[0, 2], [0, 4], [2, 3], [4, 2]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],hits = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == [0, 0, 6, 0, 0, 0, 7, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]],hits = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == [0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 1], [0, 1, 0, 1, 0]],hits = [[0, 1], [2, 3], [4, 1]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]],hits = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]]) == [0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == [0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]],hits = [[1, 2], [2, 3], [3, 4], [4, 5]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1], [1, 1, 1, 0]],hits = [[0, 0], [1, 1], [2, 2], [3, 3]]) == [0, 5, 0, 0]\n assert candidate(grid = [[1, 1, 0, 0, 1], [1, 1, 1, 0, 1], [0, 0, 0, 1, 1], [1, 0, 0, 1, 1]],hits = [[0, 0], [2, 4], [1, 2], [3, 1], [2, 3]]) == [0, 3, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]],hits = [[0, 0], [0, 6], [4, 0], [4, 6]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == [0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1]],hits = [[1, 2], [2, 3], [3, 4]]) == [0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 0, 1, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 1, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 1, 0, 1, 1, 1, 1]],hits = [[0, 0], [0, 9], [2, 0], [2, 9], [4, 0], [4, 9]]) == [0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 1, 0, 1], [1, 0, 0, 1, 1], [1, 1, 1, 1, 1]],hits = [[0, 1], [1, 2], [2, 1], [3, 3], [4, 4]]) == [0, 13, 0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 0, 1]],hits = [[0, 0], [0, 4], [4, 0], [4, 4], [1, 1], [2, 2], [3, 3]]) == [0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]],hits = [[2, 3], [3, 3], [4, 3]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1]],hits = [[1, 1], [1, 2], [1, 3], [1, 4]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3], [0, 5], [1, 4], [2, 3], [3, 2]]) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],hits = [[1, 1], [1, 9], [3, 1], [3, 9], [5, 1], [5, 9]]) == [0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [0, 0, 0, 0, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == [0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],hits = [[0, 0], [0, 9], [4, 0], [4, 9], [2, 2], [2, 7], [1, 1], [1, 8], [3, 3], [3, 6]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 1, 0, 1, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0]],hits = [[1, 1], [1, 2], [1, 3]]) == [0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],hits = [[2, 2], [1, 1], [3, 3], [0, 0], [4, 4]]) == [0, 0, 0, 0, 7]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1]],hits = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 3], [2, 0], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]) == [0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1]],hits = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]]) == [0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]) == [0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 0, 1], [0, 0, 0, 1, 1, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == [0, 0, 3, 0, 0, 0]\n assert candidate(grid = [[1, 1, 0, 0, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]],hits = [[0, 1], [0, 4], [1, 1], [1, 4], [2, 2], [2, 4], [3, 1], [3, 4]]) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1]],hits = [[1, 1], [1, 4], [2, 2], [3, 3], [4, 2], [4, 4]]) == [0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]],hits = [[0, 0], [1, 1], [2, 2], [3, 3]]) == [0, 0, 3, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]],hits = [[1, 1], [1, 7], [2, 2], [2, 6], [3, 3], [3, 5], [4, 3], [4, 5], [5, 2], [5, 6]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]],hits = [[2, 2], [1, 3], [3, 2], [4, 4]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]],hits = [[0, 0], [4, 5], [2, 2], [3, 3]]) == [0, 8, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == [3, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 1, 1, 1, 1], [0, 1, 0, 1, 0], [0, 1, 0, 1, 0], [1, 1, 1, 1, 1]],hits = [[1, 2], [2, 2], [3, 2], [4, 2]]) == [0, 0, 0, 6]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],hits = [[0, 2], [1, 2], [2, 2], [3, 2], [1, 1], [2, 1], [3, 1], [2, 0], [2, 3]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 1, 0], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1]],hits = [[0, 1], [1, 2], [3, 3], [4, 4]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 1, 1, 0], [1, 1, 1, 0, 1], [0, 1, 0, 1, 0], [0, 0, 0, 1, 0]],hits = [[0, 0], [1, 2], [2, 4]]) == [0, 0, 0]\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]],hits = [[1, 1], [2, 2], [3, 1]]) == [0, 0, 0]\n assert candidate(grid = [[1, 1, 0, 1, 1], [0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1]],hits = [[0, 0], [0, 4], [2, 2], [2, 4], [4, 0]]) == [0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]],hits = [[1, 1], [1, 5], [2, 2], [2, 4], [3, 3]]) == [0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1], [1, 0, 0, 0, 1]],hits = [[1, 1], [2, 2], [3, 3], [4, 4]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1]],hits = [[0, 1], [0, 3], [0, 5], [2, 1], [2, 3], [2, 5], [4, 1], [4, 3], [4, 5]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [0, 0, 0, 0, 1]],hits = [[1, 1], [2, 2], [3, 3]]) == [0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],hits = [[0, 1], [1, 2], [2, 1], [3, 2], [4, 3]]) == [0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],hits = [[1, 2], [1, 3]]) == [0, 0]\n assert candidate(grid = [[1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 1, 0, 0, 1, 1]],hits = [[0, 0], [5, 5], [2, 2], [3, 3]]) == [1, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3], [0, 3], [3, 0], [1, 2], [2, 1]]) == [0, 0, 0, 6, 0, 0, 2, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]],hits = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == [0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0]],hits = [[0, 0], [2, 2], [4, 4]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 1, 0, 1]],hits = [[0, 0], [0, 8], [4, 0], [4, 8]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],hits = [[2, 2], [1, 1], [3, 3]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 1, 1], [1, 0, 0, 0, 1], [1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],hits = [[0, 1], [1, 2], [3, 1], [2, 3]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]],hits = [[1, 1], [1, 5], [2, 2], [2, 4], [3, 3], [4, 3], [4, 2], [5, 2], [5, 4]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]],hits = [[0, 0], [5, 6], [2, 3], [3, 4]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0, 0, 1]],hits = [[0, 0], [2, 2], [4, 4]]) == [0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1, 1], [0, 1, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 1, 0], [1, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 1, 0, 1]],hits = [[0, 0], [5, 6], [2, 2], [3, 3], [4, 4], [1, 5]]) == [1, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],hits = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]]) == [0, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 0, 0, 1], [1, 1, 1, 0, 1], [0, 0, 0, 0, 0], [1, 1, 0, 1, 1], [0, 1, 1, 1, 0]],hits = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == [0, 2, 0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0, 1]],hits = [[0, 0], [6, 6], [2, 2], [4, 4]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]],hits = [[2, 2], [1, 2], [0, 2]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0], [1, 1, 1, 1], [1, 1, 1, 1], [1, 0, 1, 0]],hits = [[0, 0], [1, 1], [2, 2], [3, 3]]) == [0, 0, 5, 0]\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [1, 1, 1, 1]],hits = [[0, 0], [2, 2]]) == [0, 0]\n assert candidate(grid = [[1, 1], [1, 1], [1, 1]],hits = [[0, 0], [1, 1]]) == [0, 3]\n assert candidate(grid = [[0, 0, 0], [0, 0, 0]],hits = [[0, 0], [0, 1], [0, 2]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 1, 0], [1, 1, 1, 1, 0], [1, 1, 0, 1, 0], [1, 0, 0, 0, 0]],hits = [[1, 0], [1, 1], [1, 2], [1, 3]]) == [0, 3, 0, 1]\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [1, 1, 1, 0]],hits = [[2, 1]]) == [0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]],hits = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4]]) == [0, 0, 0, 0, 15]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]],hits = [[0, 0], [0, 5], [4, 0], [4, 5]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[0, 0], [1, 0], [2, 0], [3, 0]]) == [0, 0, 0, 0]\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]],hits = [[0, 0], [1, 1], [2, 2]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0, 1], [0, 1, 0], [1, 0, 1]],hits = [[1, 1]]) == [0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[0, 0], [0, 1]]) == [0, 0]\n assert candidate(grid = [[1, 1, 1, 0], [1, 1, 0, 0], [1, 0, 0, 0]],hits = [[0, 0], [1, 1]]) == [0, 2]\n assert candidate(grid = [[1, 0], [0, 1]],hits = [[0, 0], [1, 1]]) == [0, 0]\n assert candidate(grid = [[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]],hits = [[0, 0], [1, 1]]) == [0, 1]\n assert candidate(grid = [[0]],hits = [[0, 0]]) == [0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]],hits = [[1, 1], [1, 2]]) == [0, 0]\n assert candidate(grid = [[1, 0, 1, 1], [0, 1, 0, 1], [1, 0, 1, 0]],hits = [[0, 0], [1, 1], [2, 2]]) == [0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]],hits = [[3, 3], [2, 2], [1, 1], [0, 0]]) == [0, 0, 0, 6]\n assert candidate(grid = [[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]],hits = [[0, 1], [1, 0], [1, 2], [2, 1]]) == [0, 0, 4, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 1, 1], [1, 1, 1, 1]],hits = [[0, 1], [1, 0], [1, 2]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0, 1], [1, 0, 1, 0, 1], [1, 0, 1, 0, 1], [1, 0, 1, 0, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3]]) == [3, 0, 1, 0]\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]],hits = [[0, 4], [1, 3], [2, 2], [3, 1], [4, 0]]) == [0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 0], [1, 1, 1, 0], [1, 1, 1, 0]],hits = [[0, 3], [1, 3], [2, 3]]) == [0, 0, 0]\n assert candidate(grid = [[1], [1], [1], [1], [1]],hits = [[2, 0], [3, 0]]) == [2, 0]\n assert candidate(grid = [[1, 0, 1], [1, 1, 1], [1, 0, 1]],hits = [[1, 1]]) == [0]\n assert candidate(grid = [[1, 0, 0, 0], [1, 1, 1, 1], [1, 1, 1, 1], [1, 0, 0, 0]],hits = [[1, 1], [1, 2]]) == [0, 0]\n assert candidate(grid = [[1, 0, 1], [0, 0, 0], [1, 0, 1]],hits = [[0, 0], [2, 2], [0, 2]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]],hits = [[1, 1]]) == [1]\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],hits = [[0, 0], [1, 1], [2, 2], [3, 3]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 0], [0, 1, 0], [0, 0, 1]],hits = [[0, 0], [0, 2], [2, 0], [2, 2]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],hits = [[1, 1], [1, 2], [1, 3]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0], [1, 0]],hits = [[1, 0]]) == [0]\n assert candidate(grid = [[1, 0, 1], [0, 1, 0], [1, 0, 1]],hits = [[0, 0], [1, 1], [2, 2]]) == [0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]],hits = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5]]) == [0, 0, 0, 0, 0]\n assert candidate(grid = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],hits = [[1, 1], [2, 2]]) == [0, 0]\n assert candidate(grid = [[1, 0, 0, 0], [1, 1, 0, 0], [1, 1, 1, 0]],hits = [[1, 0], [1, 1]]) == [4, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[1, 1], [1, 2]]) == [0, 0]\n assert candidate(grid = [[1, 1, 0, 0], [0, 0, 1, 1], [1, 0, 1, 0], [0, 1, 0, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 1], [1, 1, 0, 1], [0, 1, 1, 1]],hits = [[1, 1], [0, 0], [2, 2]]) == [0, 1, 1]\n assert candidate(grid = [[1, 1, 0, 1], [1, 1, 0, 1], [1, 1, 0, 1]],hits = [[1, 0], [1, 2], [1, 3]]) == [0, 0, 1]\n assert candidate(grid = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],hits = [[0, 0], [1, 1], [2, 2]]) == [0, 0, 0]\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]],hits = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) == [0, 0, 9, 0, 0, 0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3]]) == [0, 0, 0, 6]\n assert candidate(grid = [[1, 0, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[1, 0], [0, 1]]) == [0, 0]\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [1, 1, 0, 0]],hits = [[0, 0], [2, 1]]) == [0, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[0, 0], [0, 1], [0, 2], [0, 3]]) == [0, 0, 0, 12]\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]],hits = [[0, 0], [0, 4], [2, 2], [3, 3]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 1, 0], [1, 1, 1, 0], [1, 0, 1, 0], [1, 1, 1, 0]],hits = [[1, 1], [2, 2], [3, 3]]) == [0, 0, 0]\n assert candidate(grid = [[1], [1], [1], [1]],hits = [[0, 0], [1, 0], [2, 0], [3, 0]]) == [3, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],hits = [[1, 2], [3, 2]]) == [0, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 1, 1], [1, 1, 1, 1]],hits = [[1, 0], [1, 2]]) == [0, 0]\n assert candidate(grid = [[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]],hits = [[2, 2], [2, 3]]) == [0, 0]\n assert candidate(grid = [[1, 1, 1], [0, 1, 0], [1, 1, 1]],hits = [[0, 0], [1, 1], [2, 2]]) == [0, 3, 0]\n assert candidate(grid = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[0, 0], [1, 1]]) == [0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],hits = [[3, 3], [0, 3], [0, 0], [3, 0], [1, 2]]) == [0, 0, 0, 2, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]],hits = [[2, 2], [2, 3]]) == [0, 0]\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],hits = [[1, 0], [1, 1], [1, 2]]) == [0, 0, 3]\n assert candidate(grid = [[1, 1, 1], [0, 1, 0], [1, 1, 1]],hits = [[0, 0], [0, 1], [0, 2]]) == [0, 4, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 1, 1], [1, 1, 1, 1]],hits = [[1, 1]]) == [0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[0, 0], [1, 1], [2, 2]]) == [0, 0, 3]\n assert candidate(grid = [[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]],hits = [[1, 1], [1, 2]]) == [1, 2]\n assert candidate(grid = [[1, 1, 1], [0, 1, 0], [0, 0, 0]],hits = [[0, 0], [1, 1]]) == [0, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[0, 0], [0, 1], [0, 2], [0, 3]]) == [0, 0, 0, 8]\n assert candidate(grid = [[1, 1, 1], [0, 1, 0], [1, 1, 1]],hits = [[0, 0], [1, 1]]) == [0, 3]\n assert candidate(grid = [[1, 0, 1], [1, 1, 1], [1, 0, 1]],hits = [[1, 1], [1, 0]]) == [0, 1]\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],hits = [[0, 0], [0, 1], [0, 2], [0, 3]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]],hits = [[2, 0], [1, 0], [0, 0], [3, 1], [3, 0], [2, 2], [1, 1], [0, 1]]) == [0, 0, 0, 0, 0, 0, 1, 0]\n assert candidate(grid = [[1, 0, 1, 1], [1, 1, 0, 1], [1, 1, 1, 1]],hits = [[0, 1], [2, 1]]) == [0, 0]\n assert candidate(grid = [[1, 1, 1], [0, 1, 0], [0, 0, 1]],hits = [[1, 1]]) == [0]\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 1, 1, 0], [0, 0, 0, 0, 0]],hits = [[2, 2], [1, 1]]) == [0, 0]\n assert candidate(grid = [[1]],hits = [[0, 0]]) == [0]\n assert candidate(grid = [[1, 0, 1, 0], [1, 0, 1, 0], [1, 0, 1, 0]],hits = [[0, 0], [2, 2]]) == [2, 0]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],hits = [[0, 0], [1, 0], [2, 0]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0, 0], [0, 1, 0], [0, 0, 1]],hits = [[0, 0], [1, 1], [2, 2]]) == [0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]],hits = [[0, 0], [1, 1], [2, 2], [3, 3]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]],hits = [[1, 1], [1, 2], [1, 3], [1, 4]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 0, 0, 1], [1, 1, 1, 1], [1, 0, 0, 1], [1, 1, 1, 1]],hits = [[0, 1], [0, 2], [2, 1], [2, 2]]) == [0, 0, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]],hits = [[1, 2], [2, 2], [3, 2]]) == [0, 0, 0]\n assert candidate(grid = [[1, 1, 1], [0, 1, 0], [1, 1, 1]],hits = [[1, 1]]) == [3]\n assert candidate(grid = [[1, 0, 0, 1], [1, 1, 1, 1], [0, 0, 0, 0], [1, 0, 0, 1]],hits = [[1, 1], [1, 2]]) == [0, 0]\n"}, "metadata": {"canonical_parameter_names": ["grid", "hits"], "leetcode_dataset_entry_point": "Solution().hitBricks", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var hitBricks = function(grid, hits) {", "container": null, "callable": "hitBricks", "parameters": [{"name": "grid", "type": "number[][]"}, {"name": "hits", "type": "number[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 804, "task_id": "unique-morse-code-words", "difficulty": "Easy", "problem_description": "International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows:\n\n'a' maps to \".-\",\n'b' maps to \"-...\",\n'c' maps to \"-.-.\", and so on.\n\nFor convenience, the full table for the 26 letters of the English alphabet is given below:\n\n[\".-\",\"-...\",\"-.-.\",\"-..\",\".\",\"..-.\",\"--.\",\"....\",\"..\",\".---\",\"-.-\",\".-..\",\"--\",\"-.\",\"---\",\".--.\",\"--.-\",\".-.\",\"...\",\"-\",\"..-\",\"...-\",\".--\",\"-..-\",\"-.--\",\"--..\"]\nGiven an array of strings words where each word can be written as a concatenation of the Morse code of each letter.\n\nFor example, \"cab\" can be written as \"-.-..--...\", which is the concatenation of \"-.-.\", \".-\", and \"-...\". We will call such a concatenation the transformation of a word.\n\nReturn the number of different transformations among all words we have.\n \nExample 1:\n\nInput: words = [\"gin\",\"zen\",\"gig\",\"msg\"]\nOutput: 2\nExplanation: The transformation of each word is:\n\"gin\" -> \"--...-.\"\n\"zen\" -> \"--...-.\"\n\"gig\" -> \"--...--.\"\n\"msg\" -> \"--...--.\"\nThere are 2 different transformations: \"--...-.\" and \"--...--.\".\n\nExample 2:\n\nInput: words = [\"a\"]\nOutput: 1\n\n \nConstraints:\n\n1 <= words.length <= 100\n1 <= words[i].length <= 12\nwords[i] consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['s', 'u', 'n']) == 3\n assert candidate(words = ['mnop', 'qrst', 'uvwx', 'yz']) == 4\n assert candidate(words = ['hello', 'world']) == 2\n assert candidate(words = ['a']) == 1\n assert candidate(words = ['morse', 'coding', 'challenge']) == 3\n assert candidate(words = ['hello', 'world']) == 2\n assert candidate(words = ['test', 'code', 'abcd']) == 3\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz']) == 1\n assert candidate(words = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']) == 7\n assert candidate(words = ['abcd', 'efgh', 'ijkl']) == 3\n assert candidate(words = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']) == 8\n assert candidate(words = ['gin', 'zen', 'gig', 'msg']) == 2\n assert candidate(words = ['abcd', 'dcba', 'abba', 'baab']) == 4\n assert candidate(words = ['hello', 'world', 'python', 'challenge']) == 4\n assert candidate(words = ['single', 'letter', 'words', 'testcase', 'unique', 'morse', 'alphabet']) == 7\n assert candidate(words = ['abcd', 'dcba', 'mnop', 'ponm', 'qrst', 'tsrq', 'wxyz', 'zyxw']) == 8\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba']) == 2\n assert candidate(words = ['aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee', 'fffff', 'ggggg', 'hhhhh', 'iiiii', 'jjjjj']) == 10\n assert candidate(words = ['internationalization', 'globalization', 'localization', 'standardization', 'representation']) == 5\n assert candidate(words = ['programming', 'is', 'fun']) == 3\n assert candidate(words = ['unique', 'representation', 'morse', 'code', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']) == 12\n assert candidate(words = ['aabbcc', 'bbaacc', 'ccabba', 'abacab', 'cabacb']) == 5\n assert candidate(words = ['zzzzzzzzzzzz', 'aaaaaaaaaaaa', 'bbbbbbbbbbbb', 'cccccccccccc', 'dddddddddddd', 'eeeeeeeeeeee', 'ffffffffffff']) == 7\n assert candidate(words = ['transform', 'transformation', 'form', 'formation']) == 4\n assert candidate(words = ['alice', 'bob', 'charlie', 'david']) == 4\n assert candidate(words = ['aabbcc', 'ddeeff', 'gghhiijj', 'kkllmm', 'nnoopp', 'qqrrss', 'ttuuvv', 'wwxxyy', 'zz']) == 9\n assert candidate(words = ['international', 'morse', 'code', 'challenge']) == 4\n assert candidate(words = ['hello', 'world', 'python', 'programming']) == 4\n assert candidate(words = ['abcdefghijk', 'lmnopqrst', 'uvwxyz']) == 3\n assert candidate(words = ['quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dogs']) == 7\n assert candidate(words = ['short', 'longerword', 'averyverylongwordindeed', 'tiny', 'big']) == 5\n assert candidate(words = ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz']) == 1\n assert candidate(words = ['abcd', 'bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij', 'hijk', 'ijkl', 'jklm']) == 10\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'mnopqrstuvwxyzabcde']) == 3\n assert candidate(words = ['short', 'longerword', 'evenlongerword', 'thelongestwordinthislist']) == 4\n assert candidate(words = ['qwen', 'alibaba', 'cloud', 'computing', 'solution', 'developer', 'engineer']) == 7\n assert candidate(words = ['alice', 'bob', 'charlie', 'david', 'eve', 'frank', 'grace', 'heidi', 'ivan', 'judy']) == 10\n assert candidate(words = ['repeated', 'words', 'in', 'this', 'list', 'repeated', 'words']) == 5\n assert candidate(words = ['unique', 'transformations', 'morse', 'code']) == 4\n assert candidate(words = ['algorithm', 'datastructure', 'interview', 'challenge']) == 4\n assert candidate(words = ['abracadabra', 'xylophone', 'quizzing', 'algorithm', 'datastructure']) == 5\n assert candidate(words = ['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff', 'ggg', 'hhh', 'iii', 'jjj', 'kkk', 'lll', 'mmm', 'nnn', 'ooo', 'ppp', 'qqq', 'rrr', 'sss', 'ttt', 'uuu', 'vvv', 'www', 'xxx', 'yyy', 'zzz']) == 26\n assert candidate(words = ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', 'zzzyyxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbbaa']) == 2\n assert candidate(words = ['unique', 'morse', 'code', 'representations', 'different', 'transformations', 'concatenation', 'english', 'alphabet', 'lowercase', 'letters']) == 11\n assert candidate(words = ['morse', 'code', 'test', 'challenge', 'unique', 'representations', 'programming']) == 7\n assert candidate(words = ['aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee', 'fffff', 'ggggg', 'hhhhh', 'iiiii', 'jjjjj', 'kkkkk', 'lllll', 'mmmmm', 'nnnnn', 'ooooo', 'ppppp', 'qqqqq', 'rrrrr', 'sssss', 'ttttt', 'uuuuu', 'vvvvv', 'wwwww', 'xxxxx', 'yyyyy', 'zzzzz']) == 26\n assert candidate(words = ['repeat', 'repeat', 'repeat', 'repeat', 'unique']) == 2\n assert candidate(words = ['hello', 'world', 'this', 'is', 'a', 'test', 'case']) == 7\n assert candidate(words = ['repeated', 'words', 'are', 'here', 'repeated', 'words']) == 4\n assert candidate(words = ['repeated', 'words', 'are', 'transformed', 'into', 'morse', 'code', 'and', 'we', 'count', 'unique', 'representations']) == 12\n assert candidate(words = ['qz', 'jx', 'vk', 'bf']) == 4\n assert candidate(words = ['mississippi', 'bookkeeper', 'anagram', 'controller', 'algorithm']) == 5\n assert candidate(words = ['algorithms', 'data', 'structures', 'machine', 'learning']) == 5\n assert candidate(words = ['aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee']) == 5\n assert candidate(words = ['qzj', 'xlt', 'bkw', 'fmo', 'hmu', 'fsz', 'qqt', 'ztl', 'rgj', 'zhm', 'gmo', 'bwz', 'pqt', 'kcu', 'wqt', 'hmr', 'pgt', 'xqt', 'nzm', 'nhu', 'xzm', 'cmu', 'pqh', 'pgj', 'xju', 'zmh', 'xmu']) == 27\n assert candidate(words = ['single', 'unique', 'distinct', 'different']) == 4\n assert candidate(words = ['same', 'same', 'same', 'same', 'same', 'different']) == 2\n assert candidate(words = ['singleword', 'anotherword', 'yetanotherword', 'onemoreword', 'lastword']) == 5\n assert candidate(words = ['transformation', 'representation', 'unique', 'words', 'list']) == 5\n assert candidate(words = ['morsetest', 'codeforces', 'competitive', 'algorithm']) == 4\n assert candidate(words = ['morse', 'code', 'morsecode', 'codemorse']) == 4\n assert candidate(words = ['repeat', 'repeat', 'repeat', 'different', 'words']) == 3\n assert candidate(words = ['zebra', 'yak', 'antelope', 'hippopotamus', 'elephant', 'giraffe']) == 6\n assert candidate(words = ['this', 'is', 'a', 'simple', 'test', 'case']) == 6\n assert candidate(words = ['amazingrace', 'triathlon', 'cycling', 'running', 'swimming', 'tri', 'duathlon', 'aquathlon']) == 8\n assert candidate(words = ['alice', 'bob', 'charlie', 'delta', 'echo', 'foxtrot', 'golf', 'hotel', 'india', 'juliett', 'kilo', 'lima', 'mike', 'november', 'oscar', 'papa', 'quebec', 'romeo', 'sierra', 'tango', 'uniform', 'victor', 'whiskey', 'xray', 'yankee', 'zulu']) == 26\n assert candidate(words = ['karen', 'mike', 'nancy', 'olivia', 'peter', 'quincy', 'rachel', 'steve', 'tina', 'ulysses', 'victor', 'wendy', 'xander', 'yvonne', 'zach']) == 15\n assert candidate(words = ['qzj', 'xmv', 'nkt', 'hbw', 'lyf']) == 5\n assert candidate(words = ['programming', 'is', 'fun']) == 3\n assert candidate(words = ['unique', 'representations', 'morse', 'code', 'challenge']) == 5\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz']) == 3\n assert candidate(words = ['programming', 'challenge', 'python', 'codeforces']) == 4\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'mnopqrstuvwxyzabcdefghijkl']) == 3\n assert candidate(words = ['racecar', 'level', 'rotor', 'radar', 'deified', 'noon', 'kayak', 'reviler']) == 8\n assert candidate(words = ['qzcv', 'wqop', 'rgmo', 'mnlx', 'axta', 'qwkl', 'qzcv', 'wqop', 'rgmo', 'mnlx', 'axta', 'qwkl']) == 6\n assert candidate(words = ['unique', 'morse', 'representations', 'are', 'calculated', 'from', 'the', 'given', 'words']) == 9\n assert candidate(words = ['aabbccdd', 'bbaaddcc', 'ccddeeff', 'ddeeffcc', 'eeffccdd', 'ffccddeeff', 'ccddeeff', 'ddeeffcc', 'eeffccdd', 'ffccddeeff']) == 6\n assert candidate(words = ['transform', 'transformation', 'translate', 'translator', 'coding', 'decoding']) == 6\n assert candidate(words = ['python', 'java', 'csharp', 'javascript']) == 4\n assert candidate(words = ['repeat', 'repeat', 'repeat', 'repeat']) == 1\n assert candidate(words = ['hello', 'world', 'python', 'programming', 'challenge']) == 5\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'mnopqrstuvwxyzabcdefghijkl', 'fedcbazyxwvutsrqponmlkijgh']) == 4\n"}, "metadata": {"canonical_parameter_names": ["words"], "leetcode_dataset_entry_point": "Solution().uniqueMorseRepresentations", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var uniqueMorseRepresentations = function(words) {", "container": null, "callable": "uniqueMorseRepresentations", "parameters": [{"name": "words", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 805, "task_id": "split-array-with-same-average", "difficulty": "Hard", "problem_description": "You are given an integer array nums.\nYou should move each element of nums into one of the two arrays A and B such that A and B are non-empty, and average(A) == average(B).\nReturn true if it is possible to achieve that and false otherwise.\nNote that for an array arr, average(arr) is the sum of all the elements of arr over the length of arr.\n \nExample 1:\n\nInput: nums = [1,2,3,4,5,6,7,8]\nOutput: true\nExplanation: We can split the array into [1,4,5,8] and [2,3,6,7], and both of them have an average of 4.5.\n\nExample 2:\n\nInput: nums = [3,1]\nOutput: false\n\n \nConstraints:\n\n1 <= nums.length <= 30\n0 <= nums[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 20, 30]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [2, 4, 6, 8, 10, 12]) == True\n assert candidate(nums = [1, 1, 1, 1]) == True\n assert candidate(nums = [2, 4, 6, 8, 10]) == True\n assert candidate(nums = [1, 3, 5, 7, 9]) == True\n assert candidate(nums = [10000, 10000, 10000]) == True\n assert candidate(nums = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]) == True\n assert candidate(nums = [1, 2, 3, 4]) == True\n assert candidate(nums = [18, 10, 5, 3]) == False\n assert candidate(nums = [10000, 0, 10000, 0]) == True\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == True\n assert candidate(nums = [10, 20, 30, 40, 50]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == False\n assert candidate(nums = [1, 2, 3, 4, 5]) == True\n assert candidate(nums = [3, 1]) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [0, 0, 0, 0]) == True\n assert candidate(nums = [2, 2, 2, 2]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [6, 6, 6, 6, 6, 6]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8]) == True\n assert candidate(nums = [6, 6, 6, 6]) == True\n assert candidate(nums = [1, 3, 5, 7]) == True\n assert candidate(nums = [1, 2, 3]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000, 21000, 22000, 23000, 24000, 25000, 26000, 27000, 28000, 29000, 58000]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]) == True\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10000]) == False\n assert candidate(nums = [10000, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990]) == True\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == True\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == True\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == True\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == True\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == True\n assert candidate(nums = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105]) == True\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 60]) == False\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(nums = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 5000]) == False\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 100]) == False\n assert candidate(nums = [10000, 0, 10000, 0, 10000, 0, 10000, 0, 10000, 0, 10000, 0, 10000, 0, 10000, 0, 10000, 0, 10000, 0]) == True\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == False\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [1, 2, 3, 6, 4, 5, 9, 7, 8, 10]) == True\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000]) == True\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 50]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == False\n assert candidate(nums = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040]) == False\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == True\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 58]) == False\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [1, 10, 100, 1000, 10000, 1, 10, 100, 1000, 10000, 1, 10, 100, 1000, 10000, 1, 10, 100, 1000, 10000]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]) == True\n assert candidate(nums = [5, 6, 7, 8, 9, 10, 5, 6, 7, 8, 9, 10, 5, 6, 7, 8, 9, 10, 5, 6, 7, 8, 9, 10, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == False\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == True\n assert candidate(nums = [5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 15000]) == False\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == True\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == True\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == True\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == True\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == True\n assert candidate(nums = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 300]) == False\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 59]) == True\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 1, 1]) == True\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8]) == True\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300]) == True\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]) == True\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == False\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 590]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900]) == True\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().splitArraySameAverage", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var splitArraySameAverage = function(nums) {", "container": null, "callable": "splitArraySameAverage", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 806, "task_id": "number-of-lines-to-write-string", "difficulty": "Easy", "problem_description": "You are given a string s of lowercase English letters and an array widths denoting how many pixels wide each lowercase English letter is. Specifically, widths[0] is the width of 'a', widths[1] is the width of 'b', and so on.\nYou are trying to write s across several lines, where each line is no longer than 100 pixels. Starting at the beginning of s, write as many letters on the first line such that the total width does not exceed 100 pixels. Then, from where you stopped in s, continue writing as many letters as you can on the second line. Continue this process until you have written all of s.\nReturn an array result of length 2 where:\n\nresult[0] is the total number of lines.\nresult[1] is the width of the last line in pixels.\n\n \nExample 1:\n\nInput: widths = [10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10], s = \"abcdefghijklmnopqrstuvwxyz\"\nOutput: [3,60]\nExplanation: You can write s as follows:\nabcdefghij // 100 pixels wide\nklmnopqrst // 100 pixels wide\nuvwxyz // 60 pixels wide\nThere are a total of 3 lines, and the last line is 60 pixels wide.\nExample 2:\n\nInput: widths = [4,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10], s = \"bbbcccdddaaa\"\nOutput: [2,4]\nExplanation: You can write s as follows:\nbbbcccdddaa // 98 pixels wide\na // 4 pixels wide\nThere are a total of 2 lines, and the last line is 4 pixels wide.\n \nConstraints:\n\nwidths.length == 26\n2 <= widths[i] <= 10\n1 <= s.length <= 1000\ns contains only lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(widths = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7],s = \"examplestring\") == [1, 76]\n assert candidate(widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],s = \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\") == [1, 43]\n assert candidate(widths = [4, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],s = \"bbbcccdddaaa\") == [2, 4]\n assert candidate(widths = [5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55],s = \"abcdefghijklmnopqrstuvwxyz\") == [10, 55]\n assert candidate(widths = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7],s = \"akjflsajflsajfljsaljfljsalfjsalkfjsalkfjsalkfjsalkfjsalkfj\") == [3, 38]\n assert candidate(widths = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6],s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == [3, 62]\n assert candidate(widths = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],s = \"a\") == [1, 10]\n assert candidate(widths = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7],s = \"abcdefghijklmnopqrstuvwxyz\") == [2, 38]\n assert candidate(widths = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6],s = \"abcdefghij\") == [1, 55]\n assert candidate(widths = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26],s = \"zyxwvutsrqponmlkjihgfedcba\") == [4, 55]\n assert candidate(widths = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],s = \"equalpairsofequalrowsandcolumnsinamatrix\") == [2, 100]\n assert candidate(widths = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5],s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == [4, 16]\n assert candidate(widths = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],s = \"samewidthforallcharacters\") == [2, 25]\n assert candidate(widths = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6],s = \"abcdefghijklmnopqrstuvwxyz\") == [2, 31]\n assert candidate(widths = [5, 7, 9, 3, 5, 7, 9, 3, 5, 7, 9, 3, 5, 7, 9, 3, 5, 7, 9, 3, 5, 7, 9, 3, 5, 7],s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == [4, 24]\n assert candidate(widths = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6],s = \"abacabadabacabad\") == [1, 30]\n assert candidate(widths = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],s = \"abcdefghijklmnopqrstuvwxyz\") == [3, 60]\n assert candidate(widths = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8],s = \"qwertyuiopasdfghjklzxcvbnm\") == [2, 36]\n assert candidate(widths = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],s = \"equalwidthseachletter\") == [1, 63]\n assert candidate(widths = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7],s = \"thisstringwillhavesomeunevenwidthsandshouldtesttheboundarycases\") == [4, 70]\n assert candidate(widths = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],s = \"aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffgggggggggghhhhhhhhhhiiiiiiiiiijjjjjjjjjkkkkkkkkkkllllllllllmmmmmmmmmmnnnnnnnnnnooooooooooppppppppppqqqqqqqqqqrrrrrrrrrrssssssssssttttttttttuuuuuuuuuuvvvvvvvvvvwwwwwwwwwwxxxxxxxxxxyyyyyyyyyyzzzzzzzzzz\") == [26, 90]\n assert candidate(widths = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],s = \"ababababababababababababababababababababababababababababababababababababab\") == [8, 40]\n assert candidate(widths = [9, 2, 2, 8, 4, 4, 7, 6, 6, 2, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],s = \"narrowwidthsshouldwrapquickly\") == [2, 76]\n assert candidate(widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == [1, 96]\n assert candidate(widths = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],s = \"mississippi\") == [2, 10]\n assert candidate(widths = [8, 6, 10, 10, 5, 5, 7, 3, 7, 2, 8, 10, 4, 4, 3, 3, 6, 14, 8, 5, 11, 11, 5, 10, 4, 10],s = \"thisisaverylongstringthatwillrequiremultiplelines\") == [4, 64]\n assert candidate(widths = [10, 20, 30, 40, 50, 60, 70, 80, 90, 10, 20, 30, 40, 50, 60, 70, 80, 90, 10, 20, 30, 40, 50, 60, 70, 80],s = \"abcdefghijklmnopqrstuvwxyza\") == [17, 90]\n assert candidate(widths = [9, 7, 5, 3, 1, 9, 7, 5, 3, 1, 9, 7, 5, 3, 1, 9, 7, 5, 3, 1, 9, 7, 5, 3, 1, 9],s = \"atlasatlasmapping\") == [2, 7]\n assert candidate(widths = [10, 20, 30, 40, 50, 60, 70, 80, 90, 10, 20, 30, 40, 50, 60, 70, 80, 90, 10, 20, 30, 40, 50, 60, 70, 80],s = \"zyxwvutsrqponmlkjihgfedcba\") == [17, 60]\n assert candidate(widths = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == [3, 60]\n assert candidate(widths = [2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],s = \"aaaaaaaaaabbbbbbbbccccccccddddddddddeeeeeeeeeeffffffffffgggggggggghhhhhhhhhh\") == [2, 16]\n assert candidate(widths = [10, 20, 30, 40, 50, 60, 70, 80, 90, 10, 20, 30, 40, 50, 60, 70, 80, 90, 10, 20, 30, 40, 50, 60, 70, 80],s = \"abcdefghijabcdefghijabcdefghijabcdefghij\") == [24, 100]\n assert candidate(widths = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5],s = \"zyxwvutsrqponmlkjihgfedcba\") == [2, 55]\n assert candidate(widths = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5],s = \"thisstringwillalsoneedmultiplelinesandshouldtestvariouscasesontheedges\") == [4, 88]\n assert candidate(widths = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26],s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == [8, 52]\n assert candidate(widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == [1, 52]\n assert candidate(widths = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9, 2, 6, 5, 3, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6],s = \"qzweasxcrtyplkjhgfiodnmbvcxz\") == [2, 40]\n assert candidate(widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == [1, 78]\n assert candidate(widths = [26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],s = \"abcdefghijklmnopqrstuvwxyz\") == [4, 55]\n assert candidate(widths = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],s = \"wonderfulwizardwithawonderfulwizardofoz\") == [1, 78]\n assert candidate(widths = [5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5],s = \"shortstringsarefun\") == [1, 47]\n assert candidate(widths = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\") == [2, 14]\n assert candidate(widths = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == [2, 4]\n assert candidate(widths = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == [6, 20]\n assert candidate(widths = [5, 10, 15, 20, 25, 5, 10, 15, 20, 25, 5, 10, 15, 20, 25, 5, 10, 15, 20, 25, 5, 10, 15, 20, 25, 5],s = \"optimization\") == [3, 20]\n assert candidate(widths = [8, 6, 4, 2, 10, 6, 4, 2, 8, 6, 4, 2, 10, 6, 4, 2, 8, 6, 4, 2, 10, 6, 4, 2, 8, 6],s = \"algorithmsanddatastructures\") == [2, 46]\n"}, "metadata": {"canonical_parameter_names": ["widths", "s"], "leetcode_dataset_entry_point": "Solution().numberOfLines", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numberOfLines = function(widths, s) {", "container": null, "callable": "numberOfLines", "parameters": [{"name": "widths", "type": "number[]"}, {"name": "s", "type": "string"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 807, "task_id": "max-increase-to-keep-city-skyline", "difficulty": "Medium", "problem_description": "There is a city composed of n x n blocks, where each block contains a single building shaped like a vertical square prism. You are given a 0-indexed n x n integer matrix grid where grid[r][c] represents the height of the building located in the block at row r and column c.\nA city's skyline is the outer contour formed by all the building when viewing the side of the city from a distance. The skyline from each cardinal direction north, east, south, and west may be different.\nWe are allowed to increase the height of any number of buildings by any amount (the amount can be different per building). The height of a 0-height building can also be increased. However, increasing the height of a building should not affect the city's skyline from any cardinal direction.\nReturn the maximum total sum that the height of the buildings can be increased by without changing the city's skyline from any cardinal direction.\n \nExample 1:\n\n\nInput: grid = [[3,0,8,4],[2,4,5,7],[9,2,6,3],[0,3,1,0]]\nOutput: 35\nExplanation: The building heights are shown in the center of the above image.\nThe skylines when viewed from each cardinal direction are drawn in red.\nThe grid after increasing the height of buildings without affecting skylines is:\ngridNew = [ [8, 4, 8, 7],\n [7, 4, 7, 7],\n [9, 4, 8, 7],\n [3, 3, 3, 3] ]\n\nExample 2:\n\nInput: grid = [[0,0,0],[0,0,0],[0,0,0]]\nOutput: 0\nExplanation: Increasing the height of any building will result in the skyline changing.\n\n \nConstraints:\n\nn == grid.length\nn == grid[r].length\n2 <= n <= 50\n0 <= grid[r][c] <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == 0\n assert candidate(grid = [[3, 0, 8, 4], [2, 4, 5, 7], [9, 2, 6, 3], [0, 3, 1, 0]]) == 35\n assert candidate(grid = [[10, 0, 0, 0], [0, 10, 0, 0], [0, 0, 10, 0], [0, 0, 0, 10]]) == 120\n assert candidate(grid = [[5, 3, 3, 2], [4, 4, 4, 4], [3, 4, 5, 4], [2, 3, 4, 5]]) == 14\n assert candidate(grid = [[5, 5, 5], [5, 5, 5], [5, 5, 5]]) == 0\n assert candidate(grid = [[5, 3, 7, 8], [4, 4, 6, 6], [1, 2, 3, 4], [8, 7, 5, 3]]) == 24\n assert candidate(grid = [[1, 2], [3, 4]]) == 1\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == 6\n assert candidate(grid = [[50, 0, 0], [0, 0, 0], [0, 0, 50]]) == 100\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(grid = [[50, 50], [50, 50]]) == 0\n assert candidate(grid = [[1, 0, 1], [0, 1, 0], [1, 0, 1]]) == 4\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 18\n assert candidate(grid = [[1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 6, 2, 5, 3, 4], [4, 3, 5, 2, 6, 1], [2, 4, 6, 1, 5, 3], [3, 1, 4, 6, 1, 2]]) == 94\n assert candidate(grid = [[9, 9, 9, 9, 9], [9, 0, 0, 0, 9], [9, 0, 1, 0, 9], [9, 0, 0, 0, 9], [9, 9, 9, 9, 9]]) == 80\n assert candidate(grid = [[10, 20, 30], [30, 20, 10], [10, 30, 20], [20, 10, 30]]) == 120\n assert candidate(grid = [[1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6, 7], [3, 4, 5, 6, 7, 8], [4, 5, 6, 7, 8, 9], [5, 6, 7, 8, 9, 10], [6, 7, 8, 9, 10, 11]]) == 55\n assert candidate(grid = [[1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [2, 3, 4, 5, 6, 1], [1, 6, 5, 4, 3, 2], [3, 2, 1, 6, 5, 4], [4, 5, 6, 1, 2, 3]]) == 90\n assert candidate(grid = [[2, 0, 8, 6, 8], [5, 9, 3, 6, 4], [6, 4, 1, 3, 9], [7, 8, 9, 1, 6], [3, 5, 2, 4, 8]]) == 67\n assert candidate(grid = [[2, 3, 4, 5, 1], [1, 2, 3, 4, 5], [5, 1, 2, 3, 4], [4, 5, 1, 2, 3], [3, 4, 5, 1, 2]]) == 50\n assert candidate(grid = [[8, 2, 3, 4, 5], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9], [6, 7, 8, 9, 10], [7, 8, 9, 10, 11]]) == 42\n assert candidate(grid = [[10, 5, 2, 0, 4], [8, 3, 10, 10, 10], [9, 5, 3, 10, 6], [2, 6, 6, 9, 4], [3, 2, 3, 4, 2]]) == 64\n assert candidate(grid = [[10, 15, 7, 12, 8], [3, 18, 6, 9, 5], [14, 1, 17, 11, 10], [13, 16, 4, 2, 19], [1, 20, 16, 2, 0]]) == 151\n assert candidate(grid = [[10, 10, 10, 10], [10, 0, 0, 10], [10, 0, 0, 10], [10, 10, 10, 10]]) == 40\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) == 2\n assert candidate(grid = [[9, 6, 3, 8, 7, 2], [5, 4, 1, 10, 6, 1], [3, 9, 3, 2, 7, 2], [8, 1, 9, 1, 1, 1], [2, 3, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2]]) == 80\n assert candidate(grid = [[20, 10, 30, 50, 40], [30, 20, 40, 60, 50], [10, 30, 50, 70, 60], [40, 50, 70, 90, 80], [50, 60, 80, 100, 90]]) == 330\n assert candidate(grid = [[10, 15, 20, 25, 30, 35], [35, 30, 25, 20, 15, 10], [10, 35, 15, 30, 20, 25], [25, 20, 30, 15, 35, 10], [30, 10, 20, 35, 15, 25], [15, 25, 35, 10, 20, 30]]) == 450\n assert candidate(grid = [[3, 8, 8, 8, 3], [8, 4, 4, 4, 8], [8, 4, 4, 4, 8], [8, 4, 4, 4, 8], [3, 8, 8, 8, 3]]) == 56\n assert candidate(grid = [[1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1]]) == 54\n assert candidate(grid = [[5, 1, 9, 1, 5], [1, 1, 1, 1, 1], [9, 1, 9, 1, 9], [1, 1, 1, 1, 1], [5, 1, 9, 1, 5]]) == 16\n assert candidate(grid = [[2, 8, 4, 6, 2], [6, 3, 1, 7, 3], [7, 1, 4, 2, 8], [2, 8, 3, 7, 4], [1, 6, 2, 5, 9]]) == 58\n assert candidate(grid = [[40, 10, 50, 20, 30], [10, 20, 30, 40, 50], [50, 30, 20, 10, 40], [20, 40, 10, 30, 50], [30, 50, 40, 20, 10]]) == 450\n assert candidate(grid = [[5, 5, 5, 5, 5, 5, 5], [5, 0, 0, 0, 0, 0, 5], [5, 0, 5, 5, 5, 0, 5], [5, 0, 5, 0, 5, 0, 5], [5, 0, 5, 5, 5, 0, 5], [5, 0, 0, 0, 0, 0, 5], [5, 5, 5, 5, 5, 5, 5]]) == 85\n assert candidate(grid = [[2, 0, 0, 2, 2], [0, 1, 1, 0, 0], [0, 1, 1, 0, 0], [2, 0, 0, 2, 2], [2, 2, 2, 2, 2]]) == 14\n assert candidate(grid = [[5, 0, 10, 15, 20], [15, 20, 5, 0, 10], [0, 10, 15, 20, 5], [20, 5, 0, 10, 15], [10, 15, 20, 5, 0]]) == 250\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 1], [0, 2, 0, 0, 0, 2, 0], [0, 0, 3, 0, 3, 0, 0], [0, 0, 0, 4, 0, 0, 0], [0, 0, 3, 0, 3, 0, 0], [0, 2, 0, 0, 0, 2, 0], [1, 0, 0, 0, 0, 0, 1]]) == 56\n assert candidate(grid = [[2, 8, 4, 0, 0, 0], [4, 4, 4, 4, 4, 4], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 14\n assert candidate(grid = [[0, 1, 2, 3, 4, 5], [1, 2, 3, 4, 5, 0], [2, 3, 4, 5, 0, 1], [3, 4, 5, 0, 1, 2], [4, 5, 0, 1, 2, 3], [5, 0, 1, 2, 3, 4]]) == 90\n assert candidate(grid = [[9, 5, 7, 2, 8], [1, 3, 6, 4, 5], [8, 4, 1, 9, 2], [3, 8, 6, 7, 1], [2, 6, 5, 4, 3]]) == 62\n assert candidate(grid = [[30, 0, 9, 20, 40], [15, 25, 10, 35, 20], [20, 15, 5, 45, 30], [30, 40, 25, 10, 5], [5, 30, 35, 20, 45]]) == 366\n assert candidate(grid = [[1, 0, 0, 0, 1, 0, 0, 1], [0, 3, 0, 0, 0, 0, 3, 0], [0, 0, 5, 0, 0, 5, 0, 0], [0, 0, 0, 7, 7, 0, 0, 0], [0, 0, 0, 7, 7, 0, 0, 0], [0, 0, 5, 0, 0, 5, 0, 0], [0, 3, 0, 0, 0, 0, 3, 0], [1, 0, 0, 1, 0, 0, 0, 1]]) == 110\n assert candidate(grid = [[10, 2, 3, 4, 5], [1, 6, 7, 8, 9], [5, 4, 3, 2, 1], [1, 2, 3, 4, 5], [9, 8, 7, 6, 10]]) == 52\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 3, 1], [2, 4, 6, 4, 2], [1, 1, 1, 1, 1]]) == 32\n assert candidate(grid = [[15, 0, 0, 0, 10], [5, 0, 0, 0, 5], [10, 0, 0, 0, 5], [5, 0, 0, 0, 10], [10, 0, 0, 0, 15]]) == 20\n assert candidate(grid = [[10, 20, 30, 40, 50], [40, 30, 20, 10, 0], [50, 40, 30, 20, 10], [0, 10, 20, 30, 40], [5, 15, 25, 35, 45]]) == 375\n assert candidate(grid = [[10, 20, 30, 40, 50], [9, 19, 29, 39, 49], [8, 18, 28, 38, 48], [7, 17, 27, 37, 47], [6, 16, 26, 36, 46]]) == 40\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 100, 0, 0, 0, 0, 0], [0, 0, 100, 0, 0, 0, 0], [0, 0, 0, 100, 0, 0, 0], [0, 0, 0, 0, 100, 0, 0], [0, 0, 0, 0, 0, 100, 0], [0, 0, 0, 0, 0, 0, 100]]) == 3000\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[3, 0, 8, 4, 10], [2, 4, 5, 7, 1], [9, 2, 6, 3, 8], [0, 3, 1, 0, 9], [5, 5, 5, 5, 5]]) == 63\n assert candidate(grid = [[8, 2, 5, 9], [7, 5, 8, 8], [9, 8, 7, 6], [2, 8, 5, 9]]) == 28\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9]]) == 180\n assert candidate(grid = [[3, 3, 3, 3, 3, 3, 3], [3, 3, 3, 3, 3, 3, 3], [3, 3, 3, 3, 3, 3, 3], [3, 3, 3, 3, 3, 3, 3], [3, 3, 3, 3, 3, 3, 3], [3, 3, 3, 3, 3, 3, 3], [3, 3, 3, 3, 3, 3, 3]]) == 0\n assert candidate(grid = [[10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]]) == 90\n assert candidate(grid = [[20, 10, 0, 10, 20], [10, 20, 30, 20, 10], [0, 30, 40, 30, 0], [10, 20, 30, 20, 10], [20, 10, 0, 10, 20]]) == 200\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [2, 3, 4, 5, 6], [6, 5, 4, 3, 2], [3, 4, 5, 6, 7]]) == 40\n assert candidate(grid = [[7, 0, 1, 2, 5], [4, 0, 0, 0, 0], [6, 0, 0, 0, 0], [0, 0, 1, 0, 0], [5, 0, 5, 0, 5]]) == 31\n assert candidate(grid = [[5, 2, 7, 4], [4, 0, 9, 6], [3, 6, 1, 8], [9, 5, 4, 2]]) == 46\n assert candidate(grid = [[3, 1, 4, 1, 5, 9], [2, 6, 5, 3, 5, 9], [5, 0, 5, 0, 5, 0], [2, 6, 5, 3, 5, 9], [5, 0, 5, 0, 5, 0], [3, 1, 4, 1, 5, 9]]) == 52\n assert candidate(grid = [[9, 8, 7, 6, 5, 4], [8, 9, 6, 7, 5, 4], [7, 6, 9, 8, 4, 5], [6, 7, 8, 9, 5, 4], [5, 4, 7, 6, 9, 8], [4, 5, 6, 7, 8, 9]]) == 90\n assert candidate(grid = [[9, 8, 7, 6], [6, 5, 4, 3], [3, 4, 5, 6], [7, 8, 9, 10]]) == 19\n assert candidate(grid = [[9, 4, 8, 7, 10], [3, 5, 6, 4, 9], [7, 1, 2, 8, 3], [6, 5, 4, 2, 1], [8, 6, 7, 3, 5]]) == 54\n assert candidate(grid = [[1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 11], [11, 9, 7, 5, 3, 1], [2, 4, 6, 8, 10, 12], [12, 10, 8, 6, 4, 2]]) == 110\n assert candidate(grid = [[5, 3, 3, 3, 3], [3, 3, 3, 3, 5], [3, 3, 3, 3, 3], [3, 3, 3, 3, 3], [3, 5, 3, 3, 3]]) == 12\n assert candidate(grid = [[0, 10, 0, 10], [10, 0, 10, 0], [0, 10, 0, 10], [10, 0, 10, 0]]) == 80\n assert candidate(grid = [[1, 10, 10, 1], [1, 1, 1, 10], [10, 1, 1, 1], [1, 10, 1, 10]]) == 90\n assert candidate(grid = [[30, 10, 20, 40, 50], [25, 35, 15, 45, 55], [60, 50, 40, 30, 20], [10, 20, 30, 40, 50], [5, 15, 25, 35, 45]]) == 385\n assert candidate(grid = [[9, 9, 9, 9], [9, 0, 0, 9], [9, 0, 0, 9], [9, 9, 9, 9]]) == 36\n assert candidate(grid = [[20, 0, 15, 10, 25], [5, 10, 8, 12, 18], [0, 5, 0, 5, 0], [15, 12, 8, 6, 14], [25, 18, 14, 10, 9]]) == 104\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().maxIncreaseKeepingSkyline", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxIncreaseKeepingSkyline = function(grid) {", "container": null, "callable": "maxIncreaseKeepingSkyline", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 808, "task_id": "soup-servings", "difficulty": "Medium", "problem_description": "There are two types of soup: type A and type B. Initially, we have n ml of each type of soup. There are four kinds of operations:\n\nServe 100 ml of soup A and 0 ml of soup B,\nServe 75 ml of soup A and 25 ml of soup B,\nServe 50 ml of soup A and 50 ml of soup B, and\nServe 25 ml of soup A and 75 ml of soup B.\n\nWhen we serve some soup, we give it to someone, and we no longer have it. Each turn, we will choose from the four operations with an equal probability 0.25. If the remaining volume of soup is not enough to complete the operation, we will serve as much as possible. We stop once we no longer have some quantity of both types of soup.\nNote that we do not have an operation where all 100 ml's of soup B are used first.\nReturn the probability that soup A will be empty first, plus half the probability that A and B become empty at the same time. Answers within 10-5 of the actual answer will be accepted.\n \nExample 1:\n\nInput: n = 50\nOutput: 0.62500\nExplanation: If we choose the first two operations, A will become empty first.\nFor the third operation, A and B will become empty at the same time.\nFor the fourth operation, B will become empty first.\nSo the total probability of A becoming empty first plus half the probability that A and B become empty at the same time, is 0.25 * (1 + 1 + 0.5 + 0) = 0.625.\n\nExample 2:\n\nInput: n = 100\nOutput: 0.71875\n\n \nConstraints:\n\n0 <= n <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 0) == 0.5\n assert candidate(n = 125) == 0.7421875\n assert candidate(n = 200) == 0.796875\n assert candidate(n = 100) == 0.71875\n assert candidate(n = 1000000000) == 1\n assert candidate(n = 50) == 0.625\n assert candidate(n = 625) == 0.9417028725147247\n assert candidate(n = 1000000003) == 1\n assert candidate(n = 999999999) == 1\n assert candidate(n = 12345) == 1\n assert candidate(n = 999999996) == 1\n assert candidate(n = 7500) == 1\n assert candidate(n = 2000) == 0.9977163163248763\n assert candidate(n = 300000) == 1\n assert candidate(n = 50000) == 1\n assert candidate(n = 1000) == 0.9765650521094358\n assert candidate(n = 1000000002) == 1\n assert candidate(n = 3333) == 0.9998851608898072\n assert candidate(n = 250000) == 1\n assert candidate(n = 999999998) == 1\n assert candidate(n = 3000) == 0.9997529725570642\n assert candidate(n = 875000000) == 1\n assert candidate(n = 1200) == 0.9855064973468473\n assert candidate(n = 750000) == 1\n assert candidate(n = 10000) == 1\n assert candidate(n = 750000000) == 1\n assert candidate(n = 12345678) == 1\n assert candidate(n = 250) == 0.82763671875\n assert candidate(n = 999999995) == 1\n assert candidate(n = 100000) == 1\n assert candidate(n = 20000) == 1\n assert candidate(n = 375) == 0.88482666015625\n assert candidate(n = 999) == 0.9765650521094358\n assert candidate(n = 5000) == 1\n assert candidate(n = 75000) == 1\n assert candidate(n = 25000) == 1\n assert candidate(n = 9999) == 1\n assert candidate(n = 1000000001) == 1\n assert candidate(n = 987654321) == 1\n assert candidate(n = 800) == 0.961617625085637\n assert candidate(n = 567890123) == 1\n assert candidate(n = 2500) == 0.99925483400331\n assert candidate(n = 500000) == 1\n assert candidate(n = 999999997) == 1\n assert candidate(n = 400) == 0.8896331787109375\n assert candidate(n = 500000000) == 1\n assert candidate(n = 1000000) == 1\n assert candidate(n = 750) == 0.9564644806087017\n assert candidate(n = 123456789) == 1\n assert candidate(n = 1234567) == 1\n assert candidate(n = 999999) == 1\n assert candidate(n = 123456) == 1\n assert candidate(n = 500) == 0.916344165802002\n assert candidate(n = 25) == 0.625\n assert candidate(n = 1500) == 0.9928319024738018\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().soupServings", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var soupServings = function(n) {", "container": null, "callable": "soupServings", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 809, "task_id": "expressive-words", "difficulty": "Medium", "problem_description": "Sometimes people repeat letters to represent extra feeling. For example:\n\n\"hello\" -> \"heeellooo\"\n\"hi\" -> \"hiiii\"\n\nIn these strings like \"heeellooo\", we have groups of adjacent letters that are all the same: \"h\", \"eee\", \"ll\", \"ooo\".\nYou are given a string s and an array of query strings words. A query word is stretchy if it can be made to be equal to s by any number of applications of the following extension operation: choose a group consisting of characters c, and add some number of characters c to the group so that the size of the group is three or more.\n\nFor example, starting with \"hello\", we could do an extension on the group \"o\" to get \"hellooo\", but we cannot get \"helloo\" since the group \"oo\" has a size less than three. Also, we could do another extension like \"ll\" -> \"lllll\" to get \"helllllooo\". If s = \"helllllooo\", then the query word \"hello\" would be stretchy because of these two extension operations: query = \"hello\" -> \"hellooo\" -> \"helllllooo\" = s.\n\nReturn the number of query strings that are stretchy.\n \nExample 1:\n\nInput: s = \"heeellooo\", words = [\"hello\", \"hi\", \"helo\"]\nOutput: 1\nExplanation: \nWe can extend \"e\" and \"o\" in the word \"hello\" to get \"heeellooo\".\nWe can't extend \"helo\" to get \"heeellooo\" because the group \"ll\" is not size 3 or more.\n\nExample 2:\n\nInput: s = \"zzzzzyyyyy\", words = [\"zzyy\",\"zy\",\"zyy\"]\nOutput: 3\n\n \nConstraints:\n\n1 <= s.length, words.length <= 100\n1 <= words[i].length <= 100\ns and words[i] consist of lowercase letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"aaabaaa\",words = ['aa', 'aaa', 'aaaa', 'aabaaa']) == 1\n assert candidate(s = \"aaabaaa\",words = ['aaa', 'aab', 'aaaaa', 'aaabaa', 'aaaba']) == 2\n assert candidate(s = \"abcd\",words = ['abc', 'abcd', 'abdc', 'aabbccdd']) == 1\n assert candidate(s = \"abcd\",words = ['abc', 'abcd', 'abcde']) == 1\n assert candidate(s = \"aaabbbcccddd\",words = ['aabbccddd', 'aabbbcccddd', 'aabbbcccdd']) == 3\n assert candidate(s = \"a\",words = ['a', 'aa', 'aaa', 'aaaa']) == 1\n assert candidate(s = \"aabbcc\",words = ['aabbcc', 'aabbc', 'aaabc']) == 1\n assert candidate(s = \"abcd\",words = ['aabbccdd', 'abccdd', 'abbbccdd', 'aabbcccddd']) == 0\n assert candidate(s = \"heeellooo\",words = ['hello', 'hi', 'helo']) == 1\n assert candidate(s = \"aaabaaa\",words = ['aab', 'aaab', 'aaaab', 'aaaba', 'aaaaaaab']) == 1\n assert candidate(s = \"abcd\",words = ['abc', 'ab', 'abcd', 'abcde']) == 1\n assert candidate(s = \"aaa\",words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa']) == 3\n assert candidate(s = \"abcd\",words = ['abc', 'abcd', 'abcde', 'ab', 'a']) == 1\n assert candidate(s = \"aaabbb\",words = ['aabb', 'aabbbb', 'aaabbbb']) == 1\n assert candidate(s = \"abcd\",words = ['abc', 'ab', 'abcd', 'abcde', 'aabbccdd']) == 1\n assert candidate(s = \"zzzzzyyyyy\",words = ['zzyy', 'zy', 'zyy']) == 3\n assert candidate(s = \"heeellloooopppp\",words = ['helloppp', 'heellooppp', 'helooppp', 'helllopppp', 'heeelllooooooo', 'hello']) == 4\n assert candidate(s = \"ttttuuuuuuuuuuuuvvv\",words = ['tuv', 'tttuuuuuuuuuuvvv', 'ttttuuuuuuuuuuu', 'ttttuuuuuuuuuvv', 'ttttuuuuuuuuuuuuv']) == 4\n assert candidate(s = \"heeeloooooo\",words = ['hello', 'heeellooo', 'helllooo', 'heellooo', 'heeelloo']) == 0\n assert candidate(s = \"aaaabbbbcccc\",words = ['aabbcc', 'aaabbbcccc', 'aaaabbbbccc', 'aaaabbbcccc', 'aaaaabbbbcccc']) == 4\n assert candidate(s = \"aaaabbbbccccddddeeee\",words = ['aabcd', 'abbbcd', 'abccde', 'abcde', 'aaaaabbbbccccddddeee']) == 2\n assert candidate(s = \"mmmmnnnnnnoooopppppp\",words = ['mnop', 'mmnnnnoooppp', 'mmmmmnnnnnnnoooooopppppp', 'mmnnoopp', 'mmnnoooopppp']) == 4\n assert candidate(s = \"xxxxxyyyyyyzzzzzz\",words = ['xyzz', 'xxxyyyyzzz', 'xxxxxyyyzzzzz', 'xxxxxyyyyyyzzzz', 'xxxxxyyyyyyzzzzzz']) == 5\n assert candidate(s = \"llllaaaabbbbccccddddeeeee\",words = ['laabcd', 'labbbccddeee', 'labcde', 'laaaabbbbccccddddeee', 'lbbbcccddddeeee']) == 3\n assert candidate(s = \"abbbcccddd\",words = ['abc', 'abbc', 'abbcc', 'abbbcccd', 'abbbcccddd', 'abbbcccdd', 'abbbccccd', 'abbbccccdd']) == 3\n assert candidate(s = \"mmmmnnnnoooopppp\",words = ['mno', 'mmnnnnooooppp', 'mmmmnnnnoooop', 'mmmmnnnnoooopppp', 'mmmmnnnnoooppp']) == 4\n assert candidate(s = \"heeellloooowooorlddd\",words = ['helo', 'hello', 'helooworld', 'heeellooworld', 'heeelllooooowooorlddd']) == 2\n assert candidate(s = \"mmmmmmmnnnnnnn\",words = ['mmnn', 'mmmnnn', 'mmmmnnnn', 'mmmmmn', 'mmmmnn', 'mmmmmnnn', 'mmmmmmnnnnn', 'mmmmmmnnnn']) == 8\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",words = ['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy', 'zzzzz', 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', 'aabbbccddeeefffgghhhiiiijjjkkklllmmmnnnooooppppqqqqrrrrsssss', 'aabbccddeeefffgggiiiijjjkkklllmmmnnnoooopppqqqqrrrrrrsssss', 'aabbccddeeffgghhiijjkkklllmmmmmnnnnnoooooopppppqqqqqqrrrrrrssssss']) == 1\n assert candidate(s = \"xyzzzzzyyyyyyyy\",words = ['xyz', 'xyyz', 'xyzz', 'xyzzz', 'xyzzzz', 'xyzzzzzyyyyy', 'xyzzzzzyyyyyy', 'xyzzzzzyyyyyyyy']) == 3\n assert candidate(s = \"zzzzzzzyyyyyyy\",words = ['zzzyyyy', 'zzzzzyyy', 'zzzyyyyyyy', 'zzzzzzzzyy', 'zyyyyyyy']) == 4\n assert candidate(s = \"mississippiiii\",words = ['mississippi', 'missisiiippi', 'mississippiiiii', 'missisipi', 'misisipi']) == 1\n assert candidate(s = \"xxyyzzzz\",words = ['xxyyz', 'xxyyzz', 'xxxyyyzzzz', 'xxyyzzz', 'xyzzz']) == 3\n assert candidate(s = \"aabbccccddddeeeffggg\",words = ['aabbccddeeffg', 'aabbcccddddeffgg', 'aabbbccccddddeeeffggg', 'aabbbcccddddeeeffgg', 'aabbccccdddddeeeffggg']) == 2\n assert candidate(s = \"xxxxxxyyyyyyzzzzzz\",words = ['xyzz', 'xyzzz', 'xyyz', 'xxxyyyyzzz', 'xxxxxyyyyyyzzzzzz']) == 5\n assert candidate(s = \"qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\",words = ['qq', 'qqq', 'qqqq', 'qqqqqq', 'qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq']) == 4\n assert candidate(s = \"ttttttttttttuuuuuuuuuuuuuuuvvvvvvvvvvvvvvvvvvvvvvvv\",words = ['tuv', 'ttuuuvvv', 'ttttuuuuuuuvvvvvvv', 'tttuuuuuuvvvvvvvvvv', 'ttttuuuuuuuuuuuvvvvvvvvvvvvvvvvvv']) == 5\n assert candidate(s = \"ppppqqqqrrrrssss\",words = ['pqrst', 'pqrs', 'ppqrs', 'ppqqrrss', 'ppqqqrrrssss', 'ppqqqqrrrrsssss']) == 4\n assert candidate(s = \"helloooooworlddddd\",words = ['hellooworld', 'hellooworlddd', 'hellllooworld', 'helloooworldddddd', 'hellooooooworlddddd']) == 2\n assert candidate(s = \"mississippiissi\",words = ['mississippissi', 'misisipi', 'mississippi', 'mississsippi', 'mississippiii']) == 0\n assert candidate(s = \"aabbccddeee\",words = ['abcde', 'aabbcdeee', 'aaabbbcccdddeee', 'aabbccdde', 'aabccdeee']) == 1\n assert candidate(s = \"ppppqqqqrrrssss\",words = ['pqr', 'ppqqrrsss', 'pppqqqrrrrssss', 'ppqqrrsssss', 'ppqqrrr']) == 1\n assert candidate(s = \"abcdefghijklllllmnopqrstuvwxyz\",words = ['abcdefghijklmopqrstuvwxyz', 'abcdefghijklllmmnopqrstuvwxyz', 'abcdefghijkllllmnopqrstuvwxyz', 'abcdefghijklllllmnopqrstuvwxy', 'abcdefghijklllllmnopqrstuvwxyz']) == 2\n assert candidate(s = \"hhheeelllllooooworrlldd\",words = ['helloworld', 'hhhellooooworld', 'hheeellllllooooworld', 'hellooworld', 'hheellooworl']) == 0\n assert candidate(s = \"ssssaaafffff\",words = ['saff', 'ssaff', 'ssaaaff', 'ssaaaafff', 'ssaaaaaffff', 'ssssaaaafffff']) == 3\n assert candidate(s = \"abcdefghijjjjjjjklmnopqrstuvwxyz\",words = ['abcdefghijklnopqrstuvwxyz', 'abcdefghijjjklmnopqrstuvwxyz', 'abcdefghijjjjjjklmnopqrstuvwxyz', 'abcdefghijjjjjjjklmnopqrstuv', 'abcdefghijjjjjjjmnopqrstuvwxyz']) == 2\n assert candidate(s = \"abcdefghiiiiijjjjjjkkkkkkk\",words = ['abcdefghijjk', 'abcdefghijk', 'abcdefghiiijjjjkk', 'abcdefghiiijjjjjjkkkkk', 'abcdefghiiijjjjjjkkkkkkk']) == 5\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",words = ['abcdefghijklmnopqrstuvwxyzz', 'abcdefghijklmnopqrstuvwxy', 'abcdefghijklmnopqrstuvwxyzzz', 'abcdefghijklmnopqrstuvwxyzzzz', 'abcdefghijklmnopqrstuvwxyzzzzz']) == 0\n assert candidate(s = \"aaaaaaabbbbcccdd\",words = ['aabbbccdd', 'aaabbbcccdd', 'aaaabbbcccdd', 'aaaaabbbcccdd', 'aaaaaaabbbcccdd', 'aaaaaaabbbcccd', 'aaaaaaabbbbccdd', 'aaaaaaabbbbcccdd']) == 7\n assert candidate(s = \"qqqqqqqqqqqwwweeeerrrrttttt\",words = ['qqqqqqqwwwreeeeeerttt', 'qqqwwwreeert', 'qqqqqqqwwwreeerrttt', 'qqqqqqqqqqqwwweeeerrrtttt', 'qqqqqqqwwweeeerrrtttt']) == 2\n assert candidate(s = \"abcdeeeeef\",words = ['abcdeeef', 'abcdeeeef', 'abcdeeeeeef', 'abcdfeeeef', 'abcdef']) == 3\n assert candidate(s = \"abcdefghijjkkklllllmmmmmmmnnnnnnnnnooooooooooopppppppppppppppqqqqqqqqqqqqqqqqqqrrrrrrrrrrrrrrrrrrssssssssssssssssttttttttttttttttttuuuuuuuuuuuuuuuuvvvvvvvvvvvvvvvvvwwwwwwwwwwwwwwwwxxyyyyyyyyyyyyyyyyyzzzzzzzzzzzzzzzz\",words = ['abcdefghijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', 'abcdefghijjkkkllllmmmmnnnnooooopppqqqqrrrrsssssttttuvvvvwwwwxxyyyyzzzz', 'abcdefghijjkkklllllmmmmmmnnnnnnnooooooooooopppppppppppppppqqqqqqqqqqqqqqqqqqrrrrrrrrrrrrrrrrrrssssssssssssssssttttttttttttttttttuuuuuuuuuuuuuuuuvvvvvvvvvvvvvvvvvwwwwwwwwwwwwwwwwxxyyyyyyyyyyyyyyyyyzzzzzzzzzzzzzzzz']) == 3\n assert candidate(s = \"abbbccdddd\",words = ['abcdd', 'abbbccdd', 'abbbccccdd', 'abbbccdddd', 'aabbccddd']) == 2\n assert candidate(s = \"ppppqqqqrrr\",words = ['pqr', 'pppqqrr', 'ppqqqrrr', 'pppqqqqrrr', 'ppppqqqrrr']) == 5\n assert candidate(s = \"aaaaaabbcccddeeeee\",words = ['aabccddee', 'aaabbbcccdddeeee', 'aaaabbbcccdddeee', 'aaaaabbcccddeeee', 'aaaaabbbbccccddeeeeee']) == 1\n assert candidate(s = \"llllllmmmnnnnoo\",words = ['lmno', 'lllmmnno', 'lllllmmnnnoo', 'lllmmmnnnnoo', 'llllllmmmnnno']) == 2\n assert candidate(s = \"aabbccddeeefffggg\",words = ['aabbccddeefffggg', 'aabbbcccdddeeefffggg', 'aabbccddeeeffffgggg', 'aabbccddeeeffg', 'aabbcddfeeeffggg']) == 2\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",words = ['z', 'zz', 'zzz', 'zzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz']) == 4\n assert candidate(s = \"ttrrreeee\",words = ['tree', 'ttrree', 'ttrreee', 'ttreee', 'ttrre', 'ttre', 'trreee', 'ttreere']) == 5\n assert candidate(s = \"mmmaaa\",words = ['maa', 'maaaa', 'mmmaaa', 'mmma', 'mmmaaaam']) == 3\n assert candidate(s = \"sssssssssssssssssssssssssssss\",words = ['s', 'ss', 'sss', 'sssss', 'sssssss', 'sssssssssssssssssssssssssssss']) == 6\n assert candidate(s = \"nnnnooouuuuuuuuu\",words = ['no', 'noon', 'nou', 'noou', 'noonnouuuu', 'nnoooouuuuuuuu', 'nnooouuuuuuuuu', 'nnnooouuuuuuuuu']) == 4\n assert candidate(s = \"aaabbbccc\",words = ['aabbccc', 'aaabccc', 'aaabbbcc', 'aabbbccc', 'aaabbbccccc']) == 4\n assert candidate(s = \"aaabbbcccddd\",words = ['ab', 'aabbccddd', 'aabbbcccddd', 'aaabbbcccdd', 'aaabbbcccd']) == 4\n assert candidate(s = \"aaaabbbbccccdddd\",words = ['aabbccdd', 'aaabbbcccddd', 'aaaabbbbccccdddd', 'aabbbbccccdddd', 'aaaabbbcccdddd']) == 5\n assert candidate(s = \"qqqqqqqqqqqqqqqqq\",words = ['q', 'qq', 'qqq', 'qqqq', 'qqqqq', 'qqqqqq', 'qqqqqqqq', 'qqqqqqqqqqqqqqqqq']) == 8\n assert candidate(s = \"xxxyyyzzz\",words = ['xyzz', 'xxyyz', 'xxyyzz', 'xxxyyyzzz', 'xxxyyzzz', 'xxxxyyzzz', 'xxxyyyyzzz']) == 5\n assert candidate(s = \"abbbbbccccdddd\",words = ['abc', 'abcd', 'abbc', 'abcdd', 'abbbbbccccdddd']) == 3\n assert candidate(s = \"aaaaaaaaaabbbbbbbbbbcccccccccc\",words = ['aabbbccc', 'aaaaaaaaabbbbbbbbbbcccccccc', 'aaaaaaaaabbbbbbbbcccccccccc', 'aaaaaaaaaabbbbbbbbbbcccccc', 'aaaaaaaaaabbbbbbbbbbccccccccccc']) == 4\n assert candidate(s = \"mississiissippii\",words = ['mississippi', 'mississiippii', 'mississsippii', 'mississssippiii', 'mississssiiiiippiii']) == 0\n assert candidate(s = \"xyzzzzzzzzzxyzzzzzzzzzxyzzzzzzzzz\",words = ['xyzyxzy', 'xyzzzxyzzzxyzzz', 'xyzzzzxyzzzzxyzzzz', 'xyzzzzzzzzxyzzzzzzzzxyzzzzzzzz', 'xyzzzzzzzzzxyzzzzzzzzxzzzzzzzzzz']) == 3\n"}, "metadata": {"canonical_parameter_names": ["s", "words"], "leetcode_dataset_entry_point": "Solution().expressiveWords", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var expressiveWords = function(s, words) {", "container": null, "callable": "expressiveWords", "parameters": [{"name": "s", "type": "string"}, {"name": "words", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 810, "task_id": "chalkboard-xor-game", "difficulty": "Hard", "problem_description": "You are given an array of integers nums represents the numbers written on a chalkboard.\nAlice and Bob take turns erasing exactly one number from the chalkboard, with Alice starting first. If erasing a number causes the bitwise XOR of all the elements of the chalkboard to become 0, then that player loses. The bitwise XOR of one element is that element itself, and the bitwise XOR of no elements is 0.\nAlso, if any player starts their turn with the bitwise XOR of all the elements of the chalkboard equal to 0, then that player wins.\nReturn true if and only if Alice wins the game, assuming both players play optimally.\n \nExample 1:\n\nInput: nums = [1,1,2]\nOutput: false\nExplanation: \nAlice has two choices: erase 1 or erase 2. \nIf she erases 1, the nums array becomes [1, 2]. The bitwise XOR of all the elements of the chalkboard is 1 XOR 2 = 3. Now Bob can remove any element he wants, because Alice will be the one to erase the last element and she will lose. \nIf Alice erases 2 first, now nums become [1, 1]. The bitwise XOR of all the elements of the chalkboard is 1 XOR 1 = 0. Alice will lose.\n\nExample 2:\n\nInput: nums = [0,1]\nOutput: true\n\nExample 3:\n\nInput: nums = [1,2,3]\nOutput: true\n\n \nConstraints:\n\n1 <= nums.length <= 1000\n0 <= nums[i] < 216\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 2, 3]) == True\n assert candidate(nums = [1, 1, 1, 1]) == True\n assert candidate(nums = [8, 15, 23, 42, 67]) == False\n assert candidate(nums = [1, 2, 2, 1]) == True\n assert candidate(nums = [1, 3, 5, 7, 9]) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 4]) == True\n assert candidate(nums = [1]) == False\n assert candidate(nums = [5, 7, 9, 11]) == True\n assert candidate(nums = [0, 1]) == True\n assert candidate(nums = [4, 5, 6, 7, 8]) == False\n assert candidate(nums = [1, 1, 2]) == False\n assert candidate(nums = [2, 2, 2, 2, 2, 2]) == True\n assert candidate(nums = [1, 1, 1, 1, 1]) == False\n assert candidate(nums = [1, 0, 1, 0, 1, 0]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [4, 4, 4, 4]) == True\n assert candidate(nums = [0, 0, 0, 0]) == True\n assert candidate(nums = [7, 11, 14, 12]) == True\n assert candidate(nums = [1, 2, 4, 8, 16, 32]) == True\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3]) == False\n assert candidate(nums = [1, 2, 3]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [2, 2]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 10, 20, 30, 40, 50]) == False\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]) == True\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == True\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]) == True\n assert candidate(nums = [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == True\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == True\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5]) == True\n assert candidate(nums = [15, 15, 14, 14, 13, 13, 12, 12, 11, 11]) == True\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576]) == True\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == True\n assert candidate(nums = [3, 3, 3, 3, 3, 4, 4, 4, 4]) == False\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60]) == True\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == True\n assert candidate(nums = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20]) == True\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == True\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768]) == True\n assert candidate(nums = [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]) == True\n assert candidate(nums = [17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255]) == True\n assert candidate(nums = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000]) == True\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(nums = [31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == False\n assert candidate(nums = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == True\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]) == True\n assert candidate(nums = [255, 255, 255, 255, 255, 255, 255, 255, 255, 255]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]) == True\n assert candidate(nums = [134217728, 268435456, 536870912, 1073741824, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [1, 3, 3, 3, 3, 3, 3, 3, 3, 1]) == True\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == True\n assert candidate(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119]) == True\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == False\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]) == False\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(nums = [17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23]) == False\n assert candidate(nums = [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [1, 3, 2, 3, 2, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16]) == True\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == False\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [16, 8, 4, 2, 1, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == False\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == True\n assert candidate(nums = [17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31]) == True\n assert candidate(nums = [1, 3, 3, 1, 5, 5, 5]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64]) == True\n assert candidate(nums = [3, 3, 4, 4, 4, 5, 5, 5]) == True\n assert candidate(nums = [17, 17, 34, 34, 1, 2, 3, 3, 2, 1]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [1023, 511, 255, 127, 63, 31, 15, 7, 3, 1]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == True\n assert candidate(nums = [1, 2, 2, 1, 3, 3, 4, 4, 5, 5]) == True\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768]) == True\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(nums = [16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192]) == True\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == True\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]) == True\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6]) == True\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]) == False\n assert candidate(nums = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15]) == True\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536]) == False\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [255, 255, 255, 255, 255, 255, 255, 255, 255, 255]) == True\n assert candidate(nums = [2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647]) == False\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(nums = [0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == False\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == False\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == True\n assert candidate(nums = [31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [7, 7, 11, 11, 13, 13, 17, 17, 19, 19, 23, 23]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == True\n assert candidate(nums = [255, 127, 63, 31, 15, 7, 3, 1, 2, 4, 8, 16, 32, 64, 128, 256]) == True\n assert candidate(nums = [1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(nums = [15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255]) == False\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == True\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == False\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().xorGame", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var xorGame = function(nums) {", "container": null, "callable": "xorGame", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 811, "task_id": "subdomain-visit-count", "difficulty": "Medium", "problem_description": "A website domain \"discuss.leetcode.com\" consists of various subdomains. At the top level, we have \"com\", at the next level, we have \"leetcode.com\" and at the lowest level, \"discuss.leetcode.com\". When we visit a domain like \"discuss.leetcode.com\", we will also visit the parent domains \"leetcode.com\" and \"com\" implicitly.\nA count-paired domain is a domain that has one of the two formats \"rep d1.d2.d3\" or \"rep d1.d2\" where rep is the number of visits to the domain and d1.d2.d3 is the domain itself.\n\nFor example, \"9001 discuss.leetcode.com\" is a count-paired domain that indicates that discuss.leetcode.com was visited 9001 times.\n\nGiven an array of count-paired domains cpdomains, return an array of the count-paired domains of each subdomain in the input. You may return the answer in any order.\n \nExample 1:\n\nInput: cpdomains = [\"9001 discuss.leetcode.com\"]\nOutput: [\"9001 leetcode.com\",\"9001 discuss.leetcode.com\",\"9001 com\"]\nExplanation: We only have one website domain: \"discuss.leetcode.com\".\nAs discussed above, the subdomain \"leetcode.com\" and \"com\" will also be visited. So they will all be visited 9001 times.\n\nExample 2:\n\nInput: cpdomains = [\"900 google.mail.com\", \"50 yahoo.com\", \"1 intel.mail.com\", \"5 wiki.org\"]\nOutput: [\"901 mail.com\",\"50 yahoo.com\",\"900 google.mail.com\",\"5 wiki.org\",\"5 org\",\"1 intel.mail.com\",\"951 com\"]\nExplanation: We will visit \"google.mail.com\" 900 times, \"yahoo.com\" 50 times, \"intel.mail.com\" once and \"wiki.org\" 5 times.\nFor the subdomains, we will visit \"mail.com\" 900 + 1 = 901 times, \"com\" 900 + 50 + 1 = 951 times, and \"org\" 5 times.\n\n \nConstraints:\n\n1 <= cpdomain.length <= 100\n1 <= cpdomain[i].length <= 100\ncpdomain[i] follows either the \"repi d1i.d2i.d3i\" format or the \"repi d1i.d2i\" format.\nrepi is an integer in the range [1, 104].\nd1i, d2i, and d3i consist of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(cpdomains = ['1 x.y.z', '2 y.z', '3 z']) == ['1 x.y.z', '3 y.z', '6 z']\n assert candidate(cpdomains = ['1 a.com', '2 b.a.com', '3 c.b.a.com']) == ['6 a.com', '6 com', '5 b.a.com', '3 c.b.a.com']\n assert candidate(cpdomains = ['1 a.com', '2 a.b.com', '3 a.b.c.com']) == ['1 a.com', '6 com', '2 a.b.com', '2 b.com', '3 a.b.c.com', '3 b.c.com', '3 c.com']\n assert candidate(cpdomains = ['500 blog.example.co', '200 news.example.co', '100 example.co']) == ['500 blog.example.co', '800 example.co', '800 co', '200 news.example.co']\n assert candidate(cpdomains = ['900 google.mail.com', '50 yahoo.com', '1 intel.mail.com', '5 wiki.org']) == ['900 google.mail.com', '901 mail.com', '951 com', '50 yahoo.com', '1 intel.mail.com', '5 wiki.org', '5 org']\n assert candidate(cpdomains = ['50 mail.google.com', '1 mail.yahoo.com', '5 mail.msn.com']) == ['50 mail.google.com', '50 google.com', '56 com', '1 mail.yahoo.com', '1 yahoo.com', '5 mail.msn.com', '5 msn.com']\n assert candidate(cpdomains = ['9001 discuss.leetcode.com']) == ['9001 discuss.leetcode.com', '9001 leetcode.com', '9001 com']\n assert candidate(cpdomains = ['10 example.com', '5 example.co.uk', '3 sub.example.co.uk']) == ['10 example.com', '10 com', '8 example.co.uk', '8 co.uk', '8 uk', '3 sub.example.co.uk']\n assert candidate(cpdomains = ['100 x.y.z', '20 w.x.y.z', '30 v.w.x.y.z']) == ['150 x.y.z', '150 y.z', '150 z', '50 w.x.y.z', '30 v.w.x.y.z']\n assert candidate(cpdomains = ['1 example.com', '2 sub.example.com', '3 sub.sub.example.com']) == ['6 example.com', '6 com', '5 sub.example.com', '3 sub.sub.example.com']\n assert candidate(cpdomains = ['1000 main.domain.com', '500 sub.main.domain.com', '200 sub.domain.com']) == ['1500 main.domain.com', '1700 domain.com', '1700 com', '500 sub.main.domain.com', '200 sub.domain.com']\n assert candidate(cpdomains = ['100 a.com', '50 b.a.com', '25 c.b.a.com']) == ['175 a.com', '175 com', '75 b.a.com', '25 c.b.a.com']\n assert candidate(cpdomains = ['10 example.com', '5 sub.example.com', '3 subsub.example.com']) == ['18 example.com', '18 com', '5 sub.example.com', '3 subsub.example.com']\n assert candidate(cpdomains = ['700 tech.forum.net', '800 tech.net', '900 forum.net', '1000 net', '500 tech.forum.forge.net', '300 forum.forge.net', '200 forge.net']) == ['700 tech.forum.net', '1600 forum.net', '4400 net', '800 tech.net', '500 tech.forum.forge.net', '800 forum.forge.net', '1000 forge.net']\n assert candidate(cpdomains = ['300 deep.subdomain.example.com', '200 subdomain.example.com', '100 example.com', '150 another.subdomain.example.com', '50 yet.another.example.com']) == ['300 deep.subdomain.example.com', '650 subdomain.example.com', '800 example.com', '800 com', '150 another.subdomain.example.com', '50 yet.another.example.com', '50 another.example.com']\n assert candidate(cpdomains = ['3000 complex.sub.domain.com', '2000 sub.domain.com', '1000 domain.com', '500 verydeep.sub.domain.com', '100 verydeep.sub.sub.domain.com']) == ['3000 complex.sub.domain.com', '5600 sub.domain.com', '6600 domain.com', '6600 com', '500 verydeep.sub.domain.com', '100 verydeep.sub.sub.domain.com', '100 sub.sub.domain.com']\n assert candidate(cpdomains = ['300 www.example.co.uk', '200 mail.example.co.uk', '150 blog.example.co.uk', '100 co.uk']) == ['300 www.example.co.uk', '650 example.co.uk', '750 co.uk', '750 uk', '200 mail.example.co.uk', '150 blog.example.co.uk']\n assert candidate(cpdomains = ['600 alpha.beta.gamma.delta.com', '500 beta.gamma.delta.com', '400 gamma.delta.com', '300 delta.com', '200 alpha.com', '100 com']) == ['600 alpha.beta.gamma.delta.com', '1100 beta.gamma.delta.com', '1500 gamma.delta.com', '1800 delta.com', '2100 com', '200 alpha.com']\n assert candidate(cpdomains = ['1000 x.y.z.com', '500 y.z.com', '250 z.com', '150 a.b.y.z.com', '100 b.y.z.com', '75 y.z.com', '60 z.com', '40 w.x.y.z.com']) == ['1040 x.y.z.com', '1865 y.z.com', '2175 z.com', '2175 com', '150 a.b.y.z.com', '250 b.y.z.com', '40 w.x.y.z.com']\n assert candidate(cpdomains = ['100 one.two.three.four.com', '200 two.three.four.com', '150 three.four.com', '100 four.com', '75 one.two.four.com', '50 two.four.com', '40 four.com', '25 one.two.three.com', '100 two.three.com', '60 three.com', '35 com']) == ['100 one.two.three.four.com', '300 two.three.four.com', '450 three.four.com', '715 four.com', '935 com', '75 one.two.four.com', '125 two.four.com', '25 one.two.three.com', '125 two.three.com', '185 three.com']\n assert candidate(cpdomains = ['10 co.uk', '20 uk', '30 com', '40 google.com', '50 google.co.uk', '60 blog.google.co.uk', '70 news.google.co.uk', '80 mail.google.co.uk', '90 google.uk', '100 uk', '200 blog.uk', '300 news.uk', '400 mail.uk']) == ['270 co.uk', '1380 uk', '70 com', '40 google.com', '260 google.co.uk', '60 blog.google.co.uk', '70 news.google.co.uk', '80 mail.google.co.uk', '90 google.uk', '200 blog.uk', '300 news.uk', '400 mail.uk']\n assert candidate(cpdomains = ['100 example1.com', '200 example2.com', '300 example3.com', '400 example4.com', '500 example5.com', '600 example6.com', '700 example7.com', '800 example8.com', '900 example9.com', '1000 example10.com']) == ['100 example1.com', '5500 com', '200 example2.com', '300 example3.com', '400 example4.com', '500 example5.com', '600 example6.com', '700 example7.com', '800 example8.com', '900 example9.com', '1000 example10.com']\n assert candidate(cpdomains = ['1000 main.homepage.net', '2000 sub.main.homepage.net', '300 sub.homepage.net', '150 homepage.net', '500 main.net', '100 net', '250 sub.sub.main.homepage.net']) == ['3250 main.homepage.net', '3700 homepage.net', '4300 net', '2250 sub.main.homepage.net', '300 sub.homepage.net', '500 main.net', '250 sub.sub.main.homepage.net']\n assert candidate(cpdomains = ['1200 verydeep.subdomain.example.com', '300 deep.subdomain.example.com', '400 subdomain.example.com', '100 example.com']) == ['1200 verydeep.subdomain.example.com', '1900 subdomain.example.com', '2000 example.com', '2000 com', '300 deep.subdomain.example.com']\n assert candidate(cpdomains = ['800 blog.medium.com', '200 tech.medium.com', '300 news.medium.com', '100 medium.com', '500 articles.blog.medium.com']) == ['1300 blog.medium.com', '1900 medium.com', '1900 com', '200 tech.medium.com', '300 news.medium.com', '500 articles.blog.medium.com']\n assert candidate(cpdomains = ['1000 main.site.org', '500 sub1.main.site.org', '200 sub2.main.site.org', '100 site.org', '50 sub3.sub1.main.site.org', '25 sub4.sub1.main.site.org']) == ['1775 main.site.org', '1875 site.org', '1875 org', '575 sub1.main.site.org', '200 sub2.main.site.org', '50 sub3.sub1.main.site.org', '25 sub4.sub1.main.site.org']\n assert candidate(cpdomains = ['10000 top.level.domain.io', '9000 level.domain.io', '8000 domain.io', '7000 io', '6000 another.top.level.domain.io', '5000 another.level.domain.io', '4000 another.domain.io', '3000 another.io']) == ['16000 top.level.domain.io', '30000 level.domain.io', '42000 domain.io', '52000 io', '6000 another.top.level.domain.io', '5000 another.level.domain.io', '4000 another.domain.io', '3000 another.io']\n assert candidate(cpdomains = ['500 support.microsoft.com', '300 download.microsoft.com', '200 services.microsoft.com', '100 microsoft.com', '400 updates.microsoft.com', '150 secure.microsoft.com']) == ['500 support.microsoft.com', '1650 microsoft.com', '1650 com', '300 download.microsoft.com', '200 services.microsoft.com', '400 updates.microsoft.com', '150 secure.microsoft.com']\n assert candidate(cpdomains = ['100 forum.discussion.community.org', '50 news.discussion.community.org', '200 discussion.community.org', '100 community.org', '50 org', '300 updates.discussion.community.org']) == ['100 forum.discussion.community.org', '650 discussion.community.org', '750 community.org', '800 org', '50 news.discussion.community.org', '300 updates.discussion.community.org']\n assert candidate(cpdomains = ['150 mail.google.com', '50 docs.google.com', '200 accounts.google.com', '100 google.com', '300 app.mail.google.com']) == ['450 mail.google.com', '800 google.com', '800 com', '50 docs.google.com', '200 accounts.google.com', '300 app.mail.google.com']\n assert candidate(cpdomains = ['10000 main.prod.env.com', '5000 sub.main.prod.env.com', '2500 service.sub.main.prod.env.com', '1250 prod.env.com', '625 env.com', '312 helper.service.sub.main.prod.env.com', '156 feedback.helper.service.sub.main.prod.env.com']) == ['17968 main.prod.env.com', '19218 prod.env.com', '19843 env.com', '19843 com', '7968 sub.main.prod.env.com', '2968 service.sub.main.prod.env.com', '468 helper.service.sub.main.prod.env.com', '156 feedback.helper.service.sub.main.prod.env.com']\n assert candidate(cpdomains = ['1 abc.def.ghi', '2 abc.def', '3 def', '4 ghi', '5 abc', '6 abc.def.ghi.jkl', '7 def.ghi.jkl', '8 ghi.jkl', '9 jkl']) == ['1 abc.def.ghi', '1 def.ghi', '5 ghi', '2 abc.def', '5 def', '5 abc', '6 abc.def.ghi.jkl', '13 def.ghi.jkl', '21 ghi.jkl', '30 jkl']\n assert candidate(cpdomains = ['10000 main.example.com', '3000 sub1.main.example.com', '2000 sub2.sub1.main.example.com', '1500 sub.example.com', '1000 another.sub.example.com']) == ['15000 main.example.com', '17500 example.com', '17500 com', '5000 sub1.main.example.com', '2000 sub2.sub1.main.example.com', '2500 sub.example.com', '1000 another.sub.example.com']\n assert candidate(cpdomains = ['100 company.corp.local', '200 it.corp.local', '300 hr.corp.local', '400 dev.it.corp.local', '500 qa.it.corp.local', '600 design.it.corp.local', '700 finance.hr.corp.local', '800 marketing.hr.corp.local']) == ['100 company.corp.local', '3600 corp.local', '3600 local', '1700 it.corp.local', '1800 hr.corp.local', '400 dev.it.corp.local', '500 qa.it.corp.local', '600 design.it.corp.local', '700 finance.hr.corp.local', '800 marketing.hr.corp.local']\n assert candidate(cpdomains = ['1000 a.b.c.d.e.com', '500 f.g.c.d.e.com', '250 g.c.d.e.com', '125 c.d.e.com', '60 d.e.com', '30 e.com']) == ['1000 a.b.c.d.e.com', '1000 b.c.d.e.com', '1875 c.d.e.com', '1935 d.e.com', '1965 e.com', '1965 com', '500 f.g.c.d.e.com', '750 g.c.d.e.com']\n assert candidate(cpdomains = ['1 abc.com', '2 xyz.abc.com', '3 def.abc.com', '4 ghi.def.abc.com', '5 jkl.ghi.def.abc.com', '6 mno.jkl.ghi.def.abc.com']) == ['21 abc.com', '21 com', '2 xyz.abc.com', '18 def.abc.com', '15 ghi.def.abc.com', '11 jkl.ghi.def.abc.com', '6 mno.jkl.ghi.def.abc.com']\n assert candidate(cpdomains = ['1500 tech.gaming.website.com', '300 mobile.gaming.website.com', '200 gaming.website.com', '1000 website.com']) == ['1500 tech.gaming.website.com', '2000 gaming.website.com', '3000 website.com', '3000 com', '300 mobile.gaming.website.com']\n assert candidate(cpdomains = ['150 tech.productivitytools.io', '250 productivitytools.io', '400 blog.productivitytools.io', '300 dev.productivitytools.io', '200 docs.productivitytools.io', '100 io']) == ['150 tech.productivitytools.io', '1300 productivitytools.io', '1400 io', '400 blog.productivitytools.io', '300 dev.productivitytools.io', '200 docs.productivitytools.io']\n assert candidate(cpdomains = ['1500 forum.discussion.web', '2500 chat.forum.discussion.web', '1000 support.web', '500 help.support.web', '2000 help.web', '800 forum.web', '1200 web']) == ['4000 forum.discussion.web', '4000 discussion.web', '9500 web', '2500 chat.forum.discussion.web', '1500 support.web', '500 help.support.web', '2000 help.web', '800 forum.web']\n assert candidate(cpdomains = ['200 admin.internal.server.net', '150 db.internal.server.net', '100 internal.server.net', '50 server.net', '25 net']) == ['200 admin.internal.server.net', '450 internal.server.net', '500 server.net', '525 net', '150 db.internal.server.net']\n assert candidate(cpdomains = ['100 abc.def.com', '200 def.com', '300 ghi.jkl.com', '400 jkl.com', '500 mno.pqr.com', '600 pqr.com']) == ['100 abc.def.com', '300 def.com', '2100 com', '300 ghi.jkl.com', '700 jkl.com', '500 mno.pqr.com', '1100 pqr.com']\n assert candidate(cpdomains = ['1 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '2 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '3 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.com']) == ['1 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 m.n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 n.o.p.q.r.s.t.u.v.w.x.y.z.com', '1 o.p.q.r.s.t.u.v.w.x.y.z.com', '1 p.q.r.s.t.u.v.w.x.y.z.com', '1 q.r.s.t.u.v.w.x.y.z.com', '1 r.s.t.u.v.w.x.y.z.com', '1 s.t.u.v.w.x.y.z.com', '1 t.u.v.w.x.y.z.com', '1 u.v.w.x.y.z.com', '1 v.w.x.y.z.com', '1 w.x.y.z.com', '1 x.y.z.com', '1 y.z.com', '1 z.com', '6 com', '2 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 l.m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 m.n.o.p.q.r.s.t.u.v.w.x.y.com', '2 n.o.p.q.r.s.t.u.v.w.x.y.com', '2 o.p.q.r.s.t.u.v.w.x.y.com', '2 p.q.r.s.t.u.v.w.x.y.com', '2 q.r.s.t.u.v.w.x.y.com', '2 r.s.t.u.v.w.x.y.com', '2 s.t.u.v.w.x.y.com', '2 t.u.v.w.x.y.com', '2 u.v.w.x.y.com', '2 v.w.x.y.com', '2 w.x.y.com', '2 x.y.com', '2 y.com', '3 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.com', '3 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.com', '3 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.com', '3 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.com', '3 e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.com', '3 f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.com', '3 g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.com', '3 h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.com', '3 i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.com', '3 j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.com', '3 k.l.m.n.o.p.q.r.s.t.u.v.w.x.com', '3 l.m.n.o.p.q.r.s.t.u.v.w.x.com', '3 m.n.o.p.q.r.s.t.u.v.w.x.com', '3 n.o.p.q.r.s.t.u.v.w.x.com', '3 o.p.q.r.s.t.u.v.w.x.com', '3 p.q.r.s.t.u.v.w.x.com', '3 q.r.s.t.u.v.w.x.com', '3 r.s.t.u.v.w.x.com', '3 s.t.u.v.w.x.com', '3 t.u.v.w.x.com', '3 u.v.w.x.com', '3 v.w.x.com', '3 w.x.com', '3 x.com']\n assert candidate(cpdomains = ['1000 blog.devsite.co.uk', '2000 devsite.co.uk', '300 sub.devsite.co.uk', '150 sub.blog.devsite.co.uk', '500 blog.co.uk', '100 co.uk']) == ['1150 blog.devsite.co.uk', '3450 devsite.co.uk', '4050 co.uk', '4050 uk', '300 sub.devsite.co.uk', '150 sub.blog.devsite.co.uk', '500 blog.co.uk']\n assert candidate(cpdomains = ['1 example.net', '2 sub1.example.net', '3 sub2.sub1.example.net', '4 sub3.sub2.sub1.example.net', '5 sub4.sub3.sub2.sub1.example.net']) == ['15 example.net', '15 net', '14 sub1.example.net', '12 sub2.sub1.example.net', '9 sub3.sub2.sub1.example.net', '5 sub4.sub3.sub2.sub1.example.net']\n assert candidate(cpdomains = ['150 a.b.com', '200 b.com', '100 a.c.com', '120 c.com', '80 a.b.c.com', '50 b.c.com', '30 c.com', '25 d.e.f.g.com']) == ['150 a.b.com', '350 b.com', '755 com', '100 a.c.com', '380 c.com', '80 a.b.c.com', '130 b.c.com', '25 d.e.f.g.com', '25 e.f.g.com', '25 f.g.com', '25 g.com']\n assert candidate(cpdomains = ['10 tech.guru.experts.net', '20 experts.net', '30 guru.experts.net', '40 tech.net', '50 guru.net', '60 tech.guru.net', '70 guru.experts.net', '80 experts.tech.guru.net']) == ['10 tech.guru.experts.net', '110 guru.experts.net', '130 experts.net', '360 net', '40 tech.net', '190 guru.net', '140 tech.guru.net', '80 experts.tech.guru.net']\n assert candidate(cpdomains = ['300 tech.interview.prep.co', '200 coding.blog.tech.interview.prep.co', '100 interview.prep.co', '50 prep.co']) == ['500 tech.interview.prep.co', '600 interview.prep.co', '650 prep.co', '650 co', '200 coding.blog.tech.interview.prep.co', '200 blog.tech.interview.prep.co']\n assert candidate(cpdomains = ['1234 main.site.org', '4321 sub.site.org', '1111 sub.sub.site.org', '2222 site.org']) == ['1234 main.site.org', '8888 site.org', '8888 org', '5432 sub.site.org', '1111 sub.sub.site.org']\n assert candidate(cpdomains = ['12000 main.home.user.net', '6000 personal.main.home.user.net', '4000 work.home.user.net', '3000 personal.work.home.user.net', '2000 user.net', '1500 home.user.net', '1000 main.user.net']) == ['18000 main.home.user.net', '26500 home.user.net', '29500 user.net', '29500 net', '6000 personal.main.home.user.net', '7000 work.home.user.net', '3000 personal.work.home.user.net', '1000 main.user.net']\n assert candidate(cpdomains = ['9001 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '2 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y', '3 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x', '4 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w', '5 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v', '6 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u', '7 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t', '8 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s', '9 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r', '10 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q', '11 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p', '12 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o', '13 a.b.c.d.e.f.g.h.i.j.k.l.m.n', '14 a.b.c.d.e.f.g.h.i.j.k.l.m', '15 a.b.c.d.e.f.g.h.i.j.k.l', '16 a.b.c.d.e.f.g.h.i.j.k', '17 a.b.c.d.e.f.g.h.i.j', '18 a.b.c.d.e.f.g.h.i', '19 a.b.c.d.e.f.g.h', '20 a.b.c.d.e.f.g']) == ['9002 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 m.n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 n.o.p.q.r.s.t.u.v.w.x.y.z', '9002 o.p.q.r.s.t.u.v.w.x.y.z', '9002 p.q.r.s.t.u.v.w.x.y.z', '9002 q.r.s.t.u.v.w.x.y.z', '9002 r.s.t.u.v.w.x.y.z', '9002 s.t.u.v.w.x.y.z', '9002 t.u.v.w.x.y.z', '9002 u.v.w.x.y.z', '9002 v.w.x.y.z', '9002 w.x.y.z', '9002 x.y.z', '9002 y.z', '9002 z', '2 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y', '2 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y', '2 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y', '2 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y', '2 e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y', '2 f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y', '2 g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y', '2 h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y', '2 i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y', '2 j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y', '2 k.l.m.n.o.p.q.r.s.t.u.v.w.x.y', '2 l.m.n.o.p.q.r.s.t.u.v.w.x.y', '2 m.n.o.p.q.r.s.t.u.v.w.x.y', '2 n.o.p.q.r.s.t.u.v.w.x.y', '2 o.p.q.r.s.t.u.v.w.x.y', '2 p.q.r.s.t.u.v.w.x.y', '2 q.r.s.t.u.v.w.x.y', '2 r.s.t.u.v.w.x.y', '2 s.t.u.v.w.x.y', '2 t.u.v.w.x.y', '2 u.v.w.x.y', '2 v.w.x.y', '2 w.x.y', '2 x.y', '2 y', '3 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x', '3 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x', '3 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x', '3 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x', '3 e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x', '3 f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x', '3 g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x', '3 h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x', '3 i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x', '3 j.k.l.m.n.o.p.q.r.s.t.u.v.w.x', '3 k.l.m.n.o.p.q.r.s.t.u.v.w.x', '3 l.m.n.o.p.q.r.s.t.u.v.w.x', '3 m.n.o.p.q.r.s.t.u.v.w.x', '3 n.o.p.q.r.s.t.u.v.w.x', '3 o.p.q.r.s.t.u.v.w.x', '3 p.q.r.s.t.u.v.w.x', '3 q.r.s.t.u.v.w.x', '3 r.s.t.u.v.w.x', '3 s.t.u.v.w.x', '3 t.u.v.w.x', '3 u.v.w.x', '3 v.w.x', '3 w.x', '3 x', '4 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w', '4 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w', '4 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w', '4 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w', '4 e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w', '4 f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w', '4 g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w', '4 h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w', '4 i.j.k.l.m.n.o.p.q.r.s.t.u.v.w', '4 j.k.l.m.n.o.p.q.r.s.t.u.v.w', '4 k.l.m.n.o.p.q.r.s.t.u.v.w', '4 l.m.n.o.p.q.r.s.t.u.v.w', '4 m.n.o.p.q.r.s.t.u.v.w', '4 n.o.p.q.r.s.t.u.v.w', '4 o.p.q.r.s.t.u.v.w', '4 p.q.r.s.t.u.v.w', '4 q.r.s.t.u.v.w', '4 r.s.t.u.v.w', '4 s.t.u.v.w', '4 t.u.v.w', '4 u.v.w', '4 v.w', '4 w', '5 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v', '5 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v', '5 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v', '5 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v', '5 e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v', '5 f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v', '5 g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v', '5 h.i.j.k.l.m.n.o.p.q.r.s.t.u.v', '5 i.j.k.l.m.n.o.p.q.r.s.t.u.v', '5 j.k.l.m.n.o.p.q.r.s.t.u.v', '5 k.l.m.n.o.p.q.r.s.t.u.v', '5 l.m.n.o.p.q.r.s.t.u.v', '5 m.n.o.p.q.r.s.t.u.v', '5 n.o.p.q.r.s.t.u.v', '5 o.p.q.r.s.t.u.v', '5 p.q.r.s.t.u.v', '5 q.r.s.t.u.v', '5 r.s.t.u.v', '5 s.t.u.v', '5 t.u.v', '5 u.v', '5 v', '6 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u', '6 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u', '6 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u', '6 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u', '6 e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u', '6 f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u', '6 g.h.i.j.k.l.m.n.o.p.q.r.s.t.u', '6 h.i.j.k.l.m.n.o.p.q.r.s.t.u', '6 i.j.k.l.m.n.o.p.q.r.s.t.u', '6 j.k.l.m.n.o.p.q.r.s.t.u', '6 k.l.m.n.o.p.q.r.s.t.u', '6 l.m.n.o.p.q.r.s.t.u', '6 m.n.o.p.q.r.s.t.u', '6 n.o.p.q.r.s.t.u', '6 o.p.q.r.s.t.u', '6 p.q.r.s.t.u', '6 q.r.s.t.u', '6 r.s.t.u', '6 s.t.u', '6 t.u', '6 u', '7 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t', '7 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t', '7 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t', '7 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t', '7 e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t', '7 f.g.h.i.j.k.l.m.n.o.p.q.r.s.t', '7 g.h.i.j.k.l.m.n.o.p.q.r.s.t', '7 h.i.j.k.l.m.n.o.p.q.r.s.t', '7 i.j.k.l.m.n.o.p.q.r.s.t', '7 j.k.l.m.n.o.p.q.r.s.t', '7 k.l.m.n.o.p.q.r.s.t', '7 l.m.n.o.p.q.r.s.t', '7 m.n.o.p.q.r.s.t', '7 n.o.p.q.r.s.t', '7 o.p.q.r.s.t', '7 p.q.r.s.t', '7 q.r.s.t', '7 r.s.t', '7 s.t', '7 t', '8 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s', '8 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s', '8 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s', '8 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s', '8 e.f.g.h.i.j.k.l.m.n.o.p.q.r.s', '8 f.g.h.i.j.k.l.m.n.o.p.q.r.s', '8 g.h.i.j.k.l.m.n.o.p.q.r.s', '8 h.i.j.k.l.m.n.o.p.q.r.s', '8 i.j.k.l.m.n.o.p.q.r.s', '8 j.k.l.m.n.o.p.q.r.s', '8 k.l.m.n.o.p.q.r.s', '8 l.m.n.o.p.q.r.s', '8 m.n.o.p.q.r.s', '8 n.o.p.q.r.s', '8 o.p.q.r.s', '8 p.q.r.s', '8 q.r.s', '8 r.s', '8 s', '9 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r', '9 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r', '9 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r', '9 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r', '9 e.f.g.h.i.j.k.l.m.n.o.p.q.r', '9 f.g.h.i.j.k.l.m.n.o.p.q.r', '9 g.h.i.j.k.l.m.n.o.p.q.r', '9 h.i.j.k.l.m.n.o.p.q.r', '9 i.j.k.l.m.n.o.p.q.r', '9 j.k.l.m.n.o.p.q.r', '9 k.l.m.n.o.p.q.r', '9 l.m.n.o.p.q.r', '9 m.n.o.p.q.r', '9 n.o.p.q.r', '9 o.p.q.r', '9 p.q.r', '9 q.r', '9 r', '10 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q', '10 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q', '10 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q', '10 d.e.f.g.h.i.j.k.l.m.n.o.p.q', '10 e.f.g.h.i.j.k.l.m.n.o.p.q', '10 f.g.h.i.j.k.l.m.n.o.p.q', '10 g.h.i.j.k.l.m.n.o.p.q', '10 h.i.j.k.l.m.n.o.p.q', '10 i.j.k.l.m.n.o.p.q', '10 j.k.l.m.n.o.p.q', '10 k.l.m.n.o.p.q', '10 l.m.n.o.p.q', '10 m.n.o.p.q', '10 n.o.p.q', '10 o.p.q', '10 p.q', '10 q', '11 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p', '11 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p', '11 c.d.e.f.g.h.i.j.k.l.m.n.o.p', '11 d.e.f.g.h.i.j.k.l.m.n.o.p', '11 e.f.g.h.i.j.k.l.m.n.o.p', '11 f.g.h.i.j.k.l.m.n.o.p', '11 g.h.i.j.k.l.m.n.o.p', '11 h.i.j.k.l.m.n.o.p', '11 i.j.k.l.m.n.o.p', '11 j.k.l.m.n.o.p', '11 k.l.m.n.o.p', '11 l.m.n.o.p', '11 m.n.o.p', '11 n.o.p', '11 o.p', '11 p', '12 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o', '12 b.c.d.e.f.g.h.i.j.k.l.m.n.o', '12 c.d.e.f.g.h.i.j.k.l.m.n.o', '12 d.e.f.g.h.i.j.k.l.m.n.o', '12 e.f.g.h.i.j.k.l.m.n.o', '12 f.g.h.i.j.k.l.m.n.o', '12 g.h.i.j.k.l.m.n.o', '12 h.i.j.k.l.m.n.o', '12 i.j.k.l.m.n.o', '12 j.k.l.m.n.o', '12 k.l.m.n.o', '12 l.m.n.o', '12 m.n.o', '12 n.o', '12 o', '13 a.b.c.d.e.f.g.h.i.j.k.l.m.n', '13 b.c.d.e.f.g.h.i.j.k.l.m.n', '13 c.d.e.f.g.h.i.j.k.l.m.n', '13 d.e.f.g.h.i.j.k.l.m.n', '13 e.f.g.h.i.j.k.l.m.n', '13 f.g.h.i.j.k.l.m.n', '13 g.h.i.j.k.l.m.n', '13 h.i.j.k.l.m.n', '13 i.j.k.l.m.n', '13 j.k.l.m.n', '13 k.l.m.n', '13 l.m.n', '13 m.n', '13 n', '14 a.b.c.d.e.f.g.h.i.j.k.l.m', '14 b.c.d.e.f.g.h.i.j.k.l.m', '14 c.d.e.f.g.h.i.j.k.l.m', '14 d.e.f.g.h.i.j.k.l.m', '14 e.f.g.h.i.j.k.l.m', '14 f.g.h.i.j.k.l.m', '14 g.h.i.j.k.l.m', '14 h.i.j.k.l.m', '14 i.j.k.l.m', '14 j.k.l.m', '14 k.l.m', '14 l.m', '14 m', '15 a.b.c.d.e.f.g.h.i.j.k.l', '15 b.c.d.e.f.g.h.i.j.k.l', '15 c.d.e.f.g.h.i.j.k.l', '15 d.e.f.g.h.i.j.k.l', '15 e.f.g.h.i.j.k.l', '15 f.g.h.i.j.k.l', '15 g.h.i.j.k.l', '15 h.i.j.k.l', '15 i.j.k.l', '15 j.k.l', '15 k.l', '15 l', '16 a.b.c.d.e.f.g.h.i.j.k', '16 b.c.d.e.f.g.h.i.j.k', '16 c.d.e.f.g.h.i.j.k', '16 d.e.f.g.h.i.j.k', '16 e.f.g.h.i.j.k', '16 f.g.h.i.j.k', '16 g.h.i.j.k', '16 h.i.j.k', '16 i.j.k', '16 j.k', '16 k', '17 a.b.c.d.e.f.g.h.i.j', '17 b.c.d.e.f.g.h.i.j', '17 c.d.e.f.g.h.i.j', '17 d.e.f.g.h.i.j', '17 e.f.g.h.i.j', '17 f.g.h.i.j', '17 g.h.i.j', '17 h.i.j', '17 i.j', '17 j', '18 a.b.c.d.e.f.g.h.i', '18 b.c.d.e.f.g.h.i', '18 c.d.e.f.g.h.i', '18 d.e.f.g.h.i', '18 e.f.g.h.i', '18 f.g.h.i', '18 g.h.i', '18 h.i', '18 i', '19 a.b.c.d.e.f.g.h', '19 b.c.d.e.f.g.h', '19 c.d.e.f.g.h', '19 d.e.f.g.h', '19 e.f.g.h', '19 f.g.h', '19 g.h', '19 h', '20 a.b.c.d.e.f.g', '20 b.c.d.e.f.g', '20 c.d.e.f.g', '20 d.e.f.g', '20 e.f.g', '20 f.g', '20 g']\n assert candidate(cpdomains = ['75 blog.health.com', '25 news.health.com', '50 health.com', '1000 medicine.com', '500 health.medicine.com']) == ['75 blog.health.com', '150 health.com', '1650 com', '25 news.health.com', '1500 medicine.com', '500 health.medicine.com']\n assert candidate(cpdomains = ['1234 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '5678 y.x.w.v.u.t.s.r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a']) == ['1234 a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 m.n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 n.o.p.q.r.s.t.u.v.w.x.y.z', '1234 o.p.q.r.s.t.u.v.w.x.y.z', '1234 p.q.r.s.t.u.v.w.x.y.z', '1234 q.r.s.t.u.v.w.x.y.z', '1234 r.s.t.u.v.w.x.y.z', '1234 s.t.u.v.w.x.y.z', '1234 t.u.v.w.x.y.z', '1234 u.v.w.x.y.z', '1234 v.w.x.y.z', '1234 w.x.y.z', '1234 x.y.z', '1234 y.z', '1234 z', '5678 y.x.w.v.u.t.s.r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 x.w.v.u.t.s.r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 w.v.u.t.s.r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 v.u.t.s.r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 u.t.s.r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 t.s.r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 s.r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 o.n.m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 n.m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 m.l.k.j.i.h.g.f.e.d.c.b.a', '5678 l.k.j.i.h.g.f.e.d.c.b.a', '5678 k.j.i.h.g.f.e.d.c.b.a', '5678 j.i.h.g.f.e.d.c.b.a', '5678 i.h.g.f.e.d.c.b.a', '5678 h.g.f.e.d.c.b.a', '5678 g.f.e.d.c.b.a', '5678 f.e.d.c.b.a', '5678 e.d.c.b.a', '5678 d.c.b.a', '5678 c.b.a', '5678 b.a', '5678 a']\n assert candidate(cpdomains = ['9000 market.shop.com', '4500 tech.shop.com', '2250 blog.shop.com', '1125 shop.com', '562 support.blog.shop.com', '281 team.support.blog.shop.com', '140 help.team.support.blog.shop.com']) == ['9000 market.shop.com', '17858 shop.com', '17858 com', '4500 tech.shop.com', '3233 blog.shop.com', '983 support.blog.shop.com', '421 team.support.blog.shop.com', '140 help.team.support.blog.shop.com']\n assert candidate(cpdomains = ['1000 a.b.c.d.e', '500 f.g.h.i', '200 j.k.l', '300 m.n.o.p']) == ['1000 a.b.c.d.e', '1000 b.c.d.e', '1000 c.d.e', '1000 d.e', '1000 e', '500 f.g.h.i', '500 g.h.i', '500 h.i', '500 i', '200 j.k.l', '200 k.l', '200 l', '300 m.n.o.p', '300 n.o.p', '300 o.p', '300 p']\n assert candidate(cpdomains = ['10 main.business.world.com', '2 sub.main.business.world.com', '3 subsub.main.business.world.com', '4 business.world.com', '5 world.com']) == ['15 main.business.world.com', '19 business.world.com', '24 world.com', '24 com', '2 sub.main.business.world.com', '3 subsub.main.business.world.com']\n assert candidate(cpdomains = ['4000 blog.news.co', '1500 tech.blog.news.co', '1000 sports.co', '2000 sports.news.co', '500 tech.sports.co', '300 tech.co']) == ['5500 blog.news.co', '7500 news.co', '9300 co', '1500 tech.blog.news.co', '1500 sports.co', '2000 sports.news.co', '500 tech.sports.co', '300 tech.co']\n assert candidate(cpdomains = ['300 video.youtube.com', '200 music.youtube.com', '100 youtube.com', '500 m.youtube.com', '200 mobile.youtube.com', '100 google.com', '50 com']) == ['300 video.youtube.com', '1300 youtube.com', '1450 com', '200 music.youtube.com', '500 m.youtube.com', '200 mobile.youtube.com', '100 google.com']\n assert candidate(cpdomains = ['300 blog.businessinsider.com', '400 businessinsider.com', '200 news.businessinsider.com', '100 tech.businessinsider.com', '50 insider.com', '500 blog.insider.com', '200 tech.insider.com', '100 insider.com']) == ['300 blog.businessinsider.com', '1000 businessinsider.com', '1850 com', '200 news.businessinsider.com', '100 tech.businessinsider.com', '850 insider.com', '500 blog.insider.com', '200 tech.insider.com']\n assert candidate(cpdomains = ['500 blog.example.co', '300 news.example.co', '200 tech.example.co', '100 example.co', '50 sub.tech.example.co']) == ['500 blog.example.co', '1150 example.co', '1150 co', '300 news.example.co', '250 tech.example.co', '50 sub.tech.example.co']\n assert candidate(cpdomains = ['1234 company.job.search.engine.com', '4321 job.search.engine.com', '1111 search.engine.com', '2222 engine.com', '3333 com', '5678 tech.engine.com', '8765 tech.com']) == ['1234 company.job.search.engine.com', '5555 job.search.engine.com', '6666 search.engine.com', '14566 engine.com', '26664 com', '5678 tech.engine.com', '8765 tech.com']\n assert candidate(cpdomains = ['10000 web.page.co.uk', '2500 blog.page.co.uk', '1500 news.page.co.uk', '1000 mail.co.uk', '5000 co.uk', '7500 uk']) == ['10000 web.page.co.uk', '14000 page.co.uk', '20000 co.uk', '27500 uk', '2500 blog.page.co.uk', '1500 news.page.co.uk', '1000 mail.co.uk']\n assert candidate(cpdomains = ['1000 news.media.co', '5000 news.sport.media.co', '3000 news.culture.media.co', '2000 sport.media.co', '1500 culture.media.co', '1000 media.co', '800 news.co', '500 co']) == ['1000 news.media.co', '13500 media.co', '14800 co', '5000 news.sport.media.co', '7000 sport.media.co', '3000 news.culture.media.co', '4500 culture.media.co', '800 news.co']\n assert candidate(cpdomains = ['10 abc.def.ghi', '20 def.ghi', '30 ghi', '40 h.i.j', '50 i.j', '60 j', '70 k.l.m', '80 l.m', '90 m']) == ['10 abc.def.ghi', '30 def.ghi', '60 ghi', '40 h.i.j', '90 i.j', '150 j', '70 k.l.m', '150 l.m', '240 m']\n assert candidate(cpdomains = ['1000 main.domain.com', '500 sub.main.domain.com', '200 sub.domain.com', '300 another.sub.main.domain.com', '150 sub.another.main.domain.com', '50 yet.another.domain.com', '25 yet.sub.another.domain.com', '125 another.yet.sub.domain.com']) == ['1950 main.domain.com', '2350 domain.com', '2350 com', '800 sub.main.domain.com', '325 sub.domain.com', '300 another.sub.main.domain.com', '150 sub.another.main.domain.com', '150 another.main.domain.com', '50 yet.another.domain.com', '75 another.domain.com', '25 yet.sub.another.domain.com', '25 sub.another.domain.com', '125 another.yet.sub.domain.com', '125 yet.sub.domain.com']\n assert candidate(cpdomains = ['750 gaming.gamesite.net', '250 gamesite.net', '150 news.gamesite.net', '1000 gaming.net', '500 net', '200 streaming.gamesite.net', '100 gaming.streaming.gamesite.net']) == ['750 gaming.gamesite.net', '1450 gamesite.net', '2950 net', '150 news.gamesite.net', '1000 gaming.net', '300 streaming.gamesite.net', '100 gaming.streaming.gamesite.net']\n assert candidate(cpdomains = ['250 news.market.com', '150 finance.market.com', '1000 market.com', '500 news.international.market.com', '300 finance.international.market.com', '200 international.market.com']) == ['250 news.market.com', '2400 market.com', '2400 com', '150 finance.market.com', '500 news.international.market.com', '1000 international.market.com', '300 finance.international.market.com']\n assert candidate(cpdomains = ['1234 a.b.c.d.e.f.com', '5678 g.h.i.j.k.com', '9101 l.m.n.o.p.q.r.com', '1112 m.n.o.p.q.r.com', '1314 n.o.p.q.r.com']) == ['1234 a.b.c.d.e.f.com', '1234 b.c.d.e.f.com', '1234 c.d.e.f.com', '1234 d.e.f.com', '1234 e.f.com', '1234 f.com', '18439 com', '5678 g.h.i.j.k.com', '5678 h.i.j.k.com', '5678 i.j.k.com', '5678 j.k.com', '5678 k.com', '9101 l.m.n.o.p.q.r.com', '10213 m.n.o.p.q.r.com', '11527 n.o.p.q.r.com', '11527 o.p.q.r.com', '11527 p.q.r.com', '11527 q.r.com', '11527 r.com']\n assert candidate(cpdomains = ['500 x.y.z', '200 a.b.c.d', '100 e.f.g', '400 h.i.j.k.l', '600 m.n.o']) == ['500 x.y.z', '500 y.z', '500 z', '200 a.b.c.d', '200 b.c.d', '200 c.d', '200 d', '100 e.f.g', '100 f.g', '100 g', '400 h.i.j.k.l', '400 i.j.k.l', '400 j.k.l', '400 k.l', '400 l', '600 m.n.o', '600 n.o', '600 o']\n"}, "metadata": {"canonical_parameter_names": ["cpdomains"], "leetcode_dataset_entry_point": "Solution().subdomainVisits", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var subdomainVisits = function(cpdomains) {", "container": null, "callable": "subdomainVisits", "parameters": [{"name": "cpdomains", "type": "string[]"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 812, "task_id": "largest-triangle-area", "difficulty": "Easy", "problem_description": "Given an array of points on the X-Y plane points where points[i] = [xi, yi], return the area of the largest triangle that can be formed by any three different points. Answers within 10-5 of the actual answer will be accepted.\n \nExample 1:\n\n\nInput: points = [[0,0],[0,1],[1,0],[0,2],[2,0]]\nOutput: 2.00000\nExplanation: The five points are shown in the above figure. The red triangle is the largest.\n\nExample 2:\n\nInput: points = [[1,0],[0,0],[0,1]]\nOutput: 0.50000\n\n \nConstraints:\n\n3 <= points.length <= 50\n-50 <= xi, yi <= 50\nAll the given points are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 0\n assert candidate(points = [[-1, -1], [1, 1], [0, 0]]) == 0\n assert candidate(points = [[-1, -1], [-2, -3], [-3, -1]]) == 2.0\n assert candidate(points = [[-50, -50], [50, 50], [-50, 50], [50, -50], [0, 0]]) == 5000.0\n assert candidate(points = [[0, 0], [0, 1], [1, 0], [0, 2], [2, 0]]) == 2.0\n assert candidate(points = [[-50, -50], [-50, 50], [50, -50], [50, 50], [0, 0]]) == 5000.0\n assert candidate(points = [[-50, -50], [50, 50], [0, 0]]) == 0\n assert candidate(points = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70], [80, 80], [90, 90]]) == 0\n assert candidate(points = [[10, 10], [10, 20], [20, 10], [20, 20], [15, 15]]) == 50.0\n assert candidate(points = [[1, 1], [2, 3], [3, 1]]) == 2.0\n assert candidate(points = [[-1, 0], [0, -1], [1, 0], [0, 1], [0, 0]]) == 1.0\n assert candidate(points = [[-50, -50], [-49, -49], [-48, -48], [0, 0]]) == 0\n assert candidate(points = [[-50, -50], [50, 50], [0, 0], [25, -25], [-25, 25]]) == 2500.0\n assert candidate(points = [[0, 0], [1, 0], [0, 1], [1, 1], [0.5, 0.5]]) == 0.5\n assert candidate(points = [[1, 0], [0, 0], [0, 1]]) == 0.5\n assert candidate(points = [[0, 0], [10, 0], [5, 5], [5, 10], [10, 5]]) == 50.0\n assert candidate(points = [[0, 0], [1, 0], [0, 1], [1, 1], [2, 2]]) == 1.5\n assert candidate(points = [[0, 0], [5, 0], [0, 5]]) == 12.5\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]]) == 0\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4]]) == 0\n assert candidate(points = [[-1, -1], [1, 1], [-1, 1], [1, -1], [0, 0]]) == 2.0\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]) == 0\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3]]) == 0\n assert candidate(points = [[10, 0], [0, 10], [-10, 0], [0, -10], [0, 0]]) == 100.0\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 0\n assert candidate(points = [[1, 1], [2, 3], [5, 1], [3, 4], [4, 5], [6, 2]]) == 8.5\n assert candidate(points = [[-1, -1], [0, 0], [1, 1], [2, 2], [3, 3]]) == 0\n assert candidate(points = [[-10, -10], [10, 10], [-10, 10], [10, -10], [0, 0]]) == 200.0\n assert candidate(points = [[5, 5], [5, -5], [-5, -5], [-5, 5], [0, 0]]) == 50.0\n assert candidate(points = [[-50, -50], [0, 0], [50, 50], [-40, -40], [40, 40]]) == 0\n assert candidate(points = [[0, 0], [1, 0], [0, 1], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 8.5\n assert candidate(points = [[10, 20], [20, 30], [30, 10], [40, 40], [50, 5], [0, 0]]) == 900.0\n assert candidate(points = [[10, 10], [20, 20], [30, 30], [15, 25], [25, 15], [5, 5], [25, 35], [35, 25]]) == 250.0\n assert candidate(points = [[0, 0], [10, 0], [5, 5], [8, 2], [3, 7], [6, 1], [9, 4], [2, 6], [7, 3], [4, 8]]) == 40.0\n assert candidate(points = [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [1, 1], [9, 9], [2, 2], [8, 8], [3, 3], [7, 7]]) == 50.0\n assert candidate(points = [[-20, 20], [30, -30], [15, 45], [-40, -10], [25, 10], [0, 0], [-15, -25]]) == 2475.0\n assert candidate(points = [[0, 0], [1, 0], [0, 1], [1, 1], [2, 0], [2, 1], [1, 2], [0, 2], [2, 2], [1.5, 1.5]]) == 2.0\n assert candidate(points = [[5, 5], [15, 10], [25, 5], [15, 0], [25, 10], [35, 5]]) == 100.0\n assert candidate(points = [[-40, 40], [40, -40], [-30, 30], [30, -30], [-20, 20], [20, -20], [-10, 10], [10, -10], [0, 0], [-5, 5], [5, -5]]) == 0\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 0\n assert candidate(points = [[-20, 30], [10, -40], [0, 0], [25, 25], [-30, -30], [40, 40], [5, 5]]) == 2250.0\n assert candidate(points = [[-3, -3], [-2, -2], [-1, -1], [0, 0], [1, 1], [2, 2], [3, 3], [-3, 3], [-2, 2], [-1, 1]]) == 18.0\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 0\n assert candidate(points = [[-30, -20], [20, 25], [0, 0], [10, -10], [-25, 15], [5, 30], [-15, -25], [15, -5], [25, 10]]) == 975.0\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]]) == 0\n assert candidate(points = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [-10, -10], [-20, -20], [-30, -30], [-40, -40], [-50, -50]]) == 0\n assert candidate(points = [[-1, -1], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]) == 0\n assert candidate(points = [[-50, -40], [-40, -30], [-30, -20], [-20, -10], [-10, 0], [0, 10], [10, 20], [20, 30], [30, 40], [40, 50]]) == 0\n assert candidate(points = [[-10, 10], [10, -10], [-20, 20], [20, -20], [-30, 30], [30, -30], [-40, 40], [40, -40], [-50, 50], [50, -50], [-60, 60], [60, -60]]) == 0\n assert candidate(points = [[-30, -30], [0, 0], [30, 30], [-20, 20], [20, -20], [-10, 10], [10, -10], [-5, 5], [5, -5]]) == 1200.0\n assert candidate(points = [[-25, 0], [0, 25], [25, 0], [0, -25], [0, 0], [12.5, 12.5], [-12.5, -12.5]]) == 625.0\n assert candidate(points = [[-10, 0], [10, 0], [0, -10], [0, 10], [5, 5], [-5, -5], [-5, 5], [5, -5], [1, 1], [-1, -1]]) == 100.0\n assert candidate(points = [[-45, 45], [-35, 35], [-25, 25], [-15, 15], [-5, 5], [5, -5], [15, -15], [25, -25], [35, -35], [45, -45], [0, 0]]) == 0\n assert candidate(points = [[-25, 25], [-50, 0], [0, 0], [25, 0], [50, 0], [0, -25], [0, 25], [25, 25], [-25, 0]]) == 1562.5\n assert candidate(points = [[-10, 10], [-5, 5], [0, 0], [5, -5], [10, -10], [-8, 8], [-3, 3], [3, -3], [8, -8]]) == 0\n assert candidate(points = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5], [-6, -6], [-7, -7], [-8, -8], [-9, -9], [-10, -10]]) == 0\n assert candidate(points = [[50, 0], [0, 50], [-50, 0], [0, -50], [25, 25], [-25, -25], [25, -25], [-25, 25], [0, 0]]) == 2500.0\n assert candidate(points = [[-10, -10], [-5, -5], [0, 0], [5, 5], [10, 10], [15, 15], [20, 20], [25, 25]]) == 0\n assert candidate(points = [[-40, -40], [-20, -20], [-30, -10], [0, 0], [10, 10], [20, 20], [30, 30]]) == 700.0\n assert candidate(points = [[10, 20], [30, 40], [50, 60], [15, 25], [35, 45], [55, 65], [20, 30], [40, 50], [60, 70]]) == 0\n assert candidate(points = [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15], [6, 18], [7, 21], [8, 24], [9, 27]]) == 0\n assert candidate(points = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13]]) == 11.5\n assert candidate(points = [[-2, -2], [-1, 1], [0, 0], [1, -1], [2, 2], [3, -3], [4, 4]]) == 18.0\n assert candidate(points = [[-5, 5], [-4, 4], [-3, 3], [-2, 2], [-1, 1], [0, 0], [1, -1], [2, -2], [3, -3]]) == 0\n assert candidate(points = [[-10, -20], [15, 25], [-15, -25], [20, 20], [0, 0], [25, 15], [-25, -15]]) == 400.0\n assert candidate(points = [[-3, -3], [3, 3], [0, 0], [2, 4], [-2, -4], [5, -1], [-5, 1]]) == 23.0\n assert candidate(points = [[1, 2], [4, 8], [10, 20], [15, 30], [25, 40], [30, 10], [40, 50], [50, 60]]) == 645.0\n assert candidate(points = [[-45, 45], [-40, 40], [-35, 35], [-30, 30], [-25, 25], [-20, 20], [-15, 15], [-10, 10], [-5, 5], [0, 0]]) == 0\n assert candidate(points = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 1], [3, 2], [4, 1], [4, 2], [5, 1], [5, 2], [6, 1], [6, 2]]) == 2.5\n assert candidate(points = [[-45, -45], [45, 45], [45, -45], [-45, 45], [0, 0], [25, 25], [-25, -25], [25, -25], [-25, 25]]) == 4050.0\n assert candidate(points = [[1, -1], [2, -2], [3, -3], [4, -4], [5, -5], [6, -6], [7, -7], [8, -8], [9, -9], [10, -10]]) == 0\n assert candidate(points = [[-49, -49], [49, 49], [-49, 49], [49, -49], [0, 0], [25, 25], [-25, -25], [30, 30], [-30, -30]]) == 4802.0\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]]) == 0\n assert candidate(points = [[-1, 1], [-2, 2], [-3, 3], [-4, 4], [-5, 5], [1, -1], [2, -2], [3, -3], [4, -4], [5, -5]]) == 0\n assert candidate(points = [[-49, -49], [-48, -48], [-47, -47], [-46, -46], [-45, -45], [-44, -44], [-43, -43], [-42, -42], [-41, -41], [-40, -40]]) == 0\n assert candidate(points = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70]]) == 0\n assert candidate(points = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [7, 8], [8, 9], [9, 7]]) == 10.5\n assert candidate(points = [[-30, -30], [-30, 30], [30, -30], [30, 30], [0, 0], [10, 10], [-10, -10], [10, -10], [-10, 10]]) == 1800.0\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18]]) == 0\n assert candidate(points = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 7.5\n assert candidate(points = [[-25, 25], [0, 50], [25, -25], [50, 0], [-50, 0], [0, -50], [-25, -25], [25, 25], [0, 0]]) == 2500.0\n assert candidate(points = [[-1, 1], [-2, 2], [-3, 3], [-4, 4], [-5, 5], [-6, 6], [-7, 7], [-8, 8], [-9, 9], [-10, 10]]) == 0\n assert candidate(points = [[1, 1], [2, 1], [1, 2], [2, 2], [1, 3], [2, 3], [1, 4], [2, 4], [1, 5], [2, 5]]) == 2.0\n assert candidate(points = [[1, 1], [2, 1], [1, 2], [2, 2], [3, 3], [4, 3], [3, 4], [4, 4], [5, 5], [6, 5], [5, 6], [6, 6]]) == 4.5\n assert candidate(points = [[-5, -5], [5, 5], [-5, 5], [5, -5], [0, 0], [3, 3], [-3, -3], [2, 2], [-2, -2]]) == 50.0\n assert candidate(points = [[-4, -4], [-3, -3], [-2, -2], [-1, -1], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 0\n assert candidate(points = [[-20, 20], [-10, 10], [0, 0], [10, -10], [20, 20], [30, -30]]) == 1000.0\n assert candidate(points = [[1, 1], [1, 2], [2, 1], [2, 2], [1, 3], [2, 3], [3, 1], [3, 2], [3, 3], [1, 4], [2, 4], [3, 4]]) == 3.0\n assert candidate(points = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10]]) == 22.5\n assert candidate(points = [[0, 1], [1, 0], [0, -1], [-1, 0], [2, 2], [-2, -2], [2, -2], [-2, 2], [3, 3], [-3, -3]]) == 12.0\n assert candidate(points = [[-30, 30], [30, -30], [-20, 20], [20, -20], [-10, 10], [10, -10], [0, 0], [-5, 5], [5, -5]]) == 0\n assert candidate(points = [[5, 5], [10, 10], [15, 15], [20, 20], [25, 25], [30, 30], [35, 35], [40, 40], [45, 45], [50, 50]]) == 0\n assert candidate(points = [[-1, -1], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 0\n assert candidate(points = [[0, 0], [1, 0], [2, 0], [0, 1], [1, 1], [2, 1], [0, 2], [1, 2], [2, 2], [0, 3], [1, 3], [2, 3]]) == 3.0\n assert candidate(points = [[-10, -10], [10, 10], [-10, 10], [10, -10], [0, 0], [2, 2], [4, 4]]) == 200.0\n assert candidate(points = [[-10, 0], [-20, 10], [0, 20], [10, 10], [20, -10], [10, -20], [0, -20], [-20, -10]]) == 600.0\n assert candidate(points = [[0, 0], [0, 1], [1, 0], [1, 1], [0, 2], [1, 2], [2, 0], [2, 1], [2, 2], [0, 3]]) == 3.0\n assert candidate(points = [[-20, 20], [-10, 10], [0, 0], [10, -10], [20, -20], [-15, 15], [-5, 5], [5, -5], [15, -15]]) == 0\n assert candidate(points = [[-5, 0], [-4, 1], [-3, 2], [-2, 3], [-1, 4], [0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0]]) == 25.0\n assert candidate(points = [[-10, -10], [-10, 10], [10, -10], [10, 10], [0, 0], [5, 5], [-5, 5], [-5, -5], [5, -5]]) == 200.0\n assert candidate(points = [[-1, -1], [1, 1], [-2, -2], [2, 2], [-3, -3], [3, 3], [-4, -4], [4, 4], [-5, -5], [5, 5], [0, 0], [-0.5, -0.5], [0.5, 0.5]]) == 0\n assert candidate(points = [[-10, 0], [0, -10], [10, 0], [0, 10], [5, 5], [-5, -5], [5, -5], [-5, 5], [2, 2], [-2, -2]]) == 100.0\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]]) == 0\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]) == 0\n assert candidate(points = [[-40, 40], [-30, 30], [-20, 20], [-10, 10], [0, 0], [10, -10], [20, -20], [30, -30], [40, -40], [25, 25], [-25, -25]]) == 2000.0\n assert candidate(points = [[-10, -10], [10, -10], [-10, 10], [10, 10], [0, 0], [5, 5], [-5, -5], [5, -5], [-5, 5]]) == 200.0\n assert candidate(points = [[1, 2], [2, 3], [3, 1], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 12.5\n assert candidate(points = [[-1, -1], [-2, -2], [-3, -3], [1, 1], [2, 2], [3, 3], [0, 0], [-1, 1], [1, -1], [-2, 2], [2, -2]]) == 12.0\n assert candidate(points = [[-20, 20], [-10, 10], [0, 0], [10, -10], [20, -20], [-20, -20], [-10, -10], [10, 10], [20, 20]]) == 800.0\n assert candidate(points = [[0, 0], [1, 0], [0, 1], [-1, 0], [0, -1], [1, 1], [-1, 1], [-1, -1], [1, -1], [0, 2]]) == 3.0\n assert candidate(points = [[0, 50], [50, 0], [25, 25], [-25, 25], [25, -25], [-25, -25], [10, 10], [-10, 10], [10, -10], [-10, -10]]) == 2500.0\n assert candidate(points = [[-10, 10], [0, 0], [10, -10], [20, 20], [30, -30], [40, 40]]) == 1600.0\n assert candidate(points = [[-5, 5], [5, -5], [10, 10], [-10, -10], [0, 0], [15, -15], [-15, 15], [5, 5], [-5, -5]]) == 300.0\n"}, "metadata": {"canonical_parameter_names": ["points"], "leetcode_dataset_entry_point": "Solution().largestTriangleArea", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var largestTriangleArea = function(points) {", "container": null, "callable": "largestTriangleArea", "parameters": [{"name": "points", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 813, "task_id": "largest-sum-of-averages", "difficulty": "Medium", "problem_description": "You are given an integer array nums and an integer k. You can partition the array into at most k non-empty adjacent subarrays. The score of a partition is the sum of the averages of each subarray.\nNote that the partition must use every integer in nums, and that the score is not necessarily an integer.\nReturn the maximum score you can achieve of all the possible partitions. Answers within 10-6 of the actual answer will be accepted.\n \nExample 1:\n\nInput: nums = [9,1,2,3,9], k = 3\nOutput: 20.00000\nExplanation: \nThe best choice is to partition nums into [9], [1, 2, 3], [9]. The answer is 9 + (1 + 2 + 3) / 3 + 9 = 20.\nWe could have also partitioned nums into [9, 1], [2], [3, 9], for example.\nThat partition would lead to a score of 5 + 2 + 6 = 13, which is worse.\n\nExample 2:\n\nInput: nums = [1,2,3,4,5,6,7], k = 4\nOutput: 20.50000\n\n \nConstraints:\n\n1 <= nums.length <= 100\n1 <= nums[i] <= 104\n1 <= k <= nums.length\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 4, 5],k = 5) == 15.0\n assert candidate(nums = [9, 1, 2, 3, 9],k = 3) == 20.0\n assert candidate(nums = [1, 2, 3],k = 1) == 2.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7],k = 1) == 4.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7],k = 4) == 20.5\n assert candidate(nums = [4, 1, 7, 5, 6, 2, 3],k = 4) == 18.166666666666664\n assert candidate(nums = [10, 20, 30, 40, 50],k = 5) == 150.0\n assert candidate(nums = [5, 5, 5, 5, 5],k = 1) == 5.0\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 5) == 50.0\n assert candidate(nums = [5, 5, 5, 5, 5],k = 3) == 15.0\n assert candidate(nums = [1, 2, 3],k = 2) == 4.5\n assert candidate(nums = [100, 200, 300, 400],k = 2) == 600.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7],k = 7) == 28.0\n assert candidate(nums = [1, 2, 3, 4],k = 2) == 6.0\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == 27.5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 55.0\n assert candidate(nums = [5, 3, 8, 1, 9, 2],k = 3) == 16.0\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == 37.5\n assert candidate(nums = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 8) == 125.17647058823529\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45],k = 8) == 265.5\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 5.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 37.5\n assert candidate(nums = [10, 20, 30, 40, 50],k = 2) == 75.0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],k = 3) == 360.0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 10) == 550.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 3) == 36.0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 10.0\n assert candidate(nums = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],k = 10) == 1000.0\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59],k = 15) == 660.0\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 10) == 50.0\n assert candidate(nums = [9, 1, 2, 3, 9, 1, 2, 3, 9],k = 3) == 21.0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 5) == 375.0\n assert candidate(nums = [5, 3, 6, 4, 8, 9, 1, 2],k = 3) == 16.5\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 2) == 15.0\n assert candidate(nums = [100, 10, 1, 10, 100, 100, 1, 10, 100, 100, 1, 10, 100],k = 5) == 370.14285714285717\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1) == 1.0\n assert candidate(nums = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195],k = 6) == 950.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 55.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 1) == 5.5\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000],k = 3) == 1102222.2\n assert candidate(nums = [9, 1, 2, 3, 9, 1, 2, 3, 9, 1, 2, 3],k = 4) == 23.0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 5.0\n assert candidate(nums = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13],k = 3) == 32.5\n assert candidate(nums = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 6) == 102.5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 5) == 60.0\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4],k = 5) == 18.333333333333332\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 3) == 3.0\n assert candidate(nums = [15, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 5) == 55.0\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 15) == 75.0\n assert candidate(nums = [1000, 100, 10, 1, 0, 1, 10, 100, 1000, 10000],k = 4) == 12031.714285714286\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 3) == 3.0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],k = 8) == 1260.0\n assert candidate(nums = [9, 1, 4, 3, 8, 7, 5, 6, 2],k = 4) == 24.666666666666664\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 5) == 375.0\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 1) == 5.0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 10.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 20) == 405.0\n assert candidate(nums = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20],k = 5) == 81.66666666666667\n assert candidate(nums = [5, 3, 8, 1, 9, 2, 6, 7],k = 3) == 18.25\n assert candidate(nums = [3, 1, 2, 4, 5, 6, 7, 8, 9, 10],k = 3) == 23.5\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == 35.0625\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == 33.0\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000],k = 5) == 50000.0\n assert candidate(nums = [9, 1, 2, 3, 9, 5, 7, 8],k = 3) == 21.5\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 50) == 50.0\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == 25.0\n assert candidate(nums = [10000, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991],k = 5) == 49987.5\n assert candidate(nums = [4, 3, 2, 6, 2, 3, 4, 5, 1, 2],k = 4) == 15.333333333333334\n assert candidate(nums = [100, 200, 300, 400, 500],k = 2) == 750.0\n assert candidate(nums = [2, 3, 4, 5, 6, 7, 8, 9],k = 3) == 21.5\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 10) == 5500.0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 1) == 55.0\n assert candidate(nums = [5, 6, 1, 8, 4, 9],k = 2) == 13.8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 5) == 82.5\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 3) == 235.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 7) == 80.0\n assert candidate(nums = [1, 100, 1, 100, 1, 100, 1, 100, 1, 100],k = 5) == 318.5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 15) == 120.0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 15) == 15.0\n assert candidate(nums = [5, 2, 3, 1, 5, 2, 3, 1, 5, 2, 3, 1, 5, 2, 3, 1, 5, 2, 3, 1],k = 7) == 24.32857142857143\n assert candidate(nums = [9, 7, 5, 3, 1, 2, 4, 6, 8, 10],k = 2) == 15.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 2) == 22.5\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 2) == 150.0\n assert candidate(nums = [5, 1, 4, 2, 3, 6, 8, 7],k = 3) == 18.5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 20) == 210.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3) == 23.5\n assert candidate(nums = [9, 1, 2, 3, 9, 1, 2, 3, 9, 1, 2, 3, 9, 1, 2, 3],k = 6) == 34.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10) == 150.0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 5) == 3750.0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 10.0\n assert candidate(nums = [1, 100, 2, 100, 3, 100, 4, 100, 5, 100],k = 5) == 322.49999999999994\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000],k = 3) == 30000.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10) == 150.0\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],k = 4) == 58.0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 2) == 1500.0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],k = 25) == 937.5\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 3) == 21.0\n assert candidate(nums = [9, 1, 2, 3, 9, 8, 7, 6, 5, 4],k = 5) == 33.5\n assert candidate(nums = [1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100],k = 10) == 670.0\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 20) == 180.0\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 9) == 45.0\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 10) == 50.0\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().largestSumOfAverages", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var largestSumOfAverages = function(nums, k) {", "container": null, "callable": "largestSumOfAverages", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 814, "task_id": "binary-tree-pruning", "difficulty": "Medium", "problem_description": "Given the root of a binary tree, return the same tree where every subtree (of the given tree) not containing a 1 has been removed.\nA subtree of a node node is node plus every node that is a descendant of node.\n \nExample 1:\n\n\nInput: root = [1,null,0,0,1]\nOutput: [1,null,0,null,1]\nExplanation: \nOnly the red nodes satisfy the property \"every subtree not containing a 1\".\nThe diagram on the right represents the answer.\n\nExample 2:\n\n\nInput: root = [1,0,1,0,0,0,1]\nOutput: [1,null,1,null,1]\n\nExample 3:\n\n\nInput: root = [1,1,0,1,1,0,1,0]\nOutput: [1,1,0,1,1,null,1]\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 200].\nNode.val is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(root = tree_node([1, None, 0, 0, 1])), tree_node([1, None, 0, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, None, 0, 0, None])), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 0, 1, 0, 0, 1, 0, 1])), tree_node([1, 1, 0, 1, None, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 1])), tree_node([1, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0])), tree_node([1, 0, 0, 1, 0, None, 1, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 0, 0, 1])), tree_node([1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 0, 1, 1, 0, 1, 0])), tree_node([1, 1, 0, 1, 1, None, 1]))\n assert candidate(root = tree_node([0, 0, 0])) == None\n assert candidate(root = tree_node([0])) == None\n assert is_same_tree(candidate(root = tree_node([1])), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])), tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, None, 1, None, 1, None, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])), tree_node([1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0])), tree_node([1, None, 0, 0, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])), tree_node([1, 0, 0, None, 1, 0, None, None, None, 1, None, 0, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])), tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])), tree_node([1, 0, None, 0, 0, 1, None, 0, None, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0])), tree_node([1, 1, 0, 0, 1, None, 0, 1, None, None, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0])), tree_node([1, 0, 0, None, 1, 0, 0, 1, None, 0, None, None, 1, 1, None, None, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1])), tree_node([1, 1, 1, 0, None, 1, 0, 1, None, None, None, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0])), tree_node([0, 1, 0, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])), tree_node([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, None, 1, None, 1, None, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0])), tree_node([1, 0, None, 0, None, 0, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0])), tree_node([0, 0, 0, 0, None, 1, 0, None, 0, 1, None, None, 0, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0])), tree_node([1, None, 0, None, 0, 0, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])), tree_node([1, None, 0, None, 0, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0])), tree_node([1, 1, 0, 1, None, 0, 1, 0, 1, None, 1, None, None, 0, None, None, None, None, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0])), tree_node([1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, None, 0, 1, None, 0, 1, None, 0, 1, None, None, 1, 1, None, None, 1, 1, None, None, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0])), tree_node([0, 1, 0, 0, 0, 0, 0, 1, 0, 0, None, None, 0, 1, None, 0, None, None, 0, 1, None, 1, None, None, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])), tree_node([1, 0, None, 0, None, None, 0, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])), tree_node([1, None, 0, None, 0, None, 0, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])), tree_node([1, None, 0, None, 0, None, 0, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0])), tree_node([1, 1, 1, 1, 0, 1, 0, 1, None, 1, 0, None, 1, 1, 0, 1, 1, 1, None, None, 1, 1, 1, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1])), tree_node([1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, None, None, 1, None, None, 1, None, None, 1, None, None, 1, None, None, 1, None, None, 1, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])), tree_node([1, None, 0, 0, None, None, 0, 0, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0])), tree_node([1, 0, None, None, 0, None, 0, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0])), tree_node([1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, None, None, 1, None, None, 1, None, None, 1, None, None, 1, None, None, 1, None, None, 1, None, None, 1]))\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0])) == None\n assert is_same_tree(candidate(root = tree_node([1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), tree_node([1, 1, 0, 1, None, 0, 1, 0, 1, None, 1, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])), tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, None, 1, None, 1, None, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])), tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0])), tree_node([0, 0, 1, None, 0, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), tree_node([1, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0])), tree_node([1, 0, 0, 1, 0, 0, 1, 0, 0, 1, None, None, 1, None, None, 1, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0])), tree_node([0, 0, 1, 0, 0, 1, 1, 0, None, None, 1, None, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1])), tree_node([1, 0, 1, 0, 0, 1, 0, 0, None, 1, 0, None, None, 0, None, 1, 0, None, None, 1, None, 1, None, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])), tree_node([1, 0, None, 0, None, 0, None, 0, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])), tree_node([1, 0, 1, 0, 1, 0, 1, None, 1, None, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), tree_node([0, 0, None, None, 0, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0])), tree_node([1, 0, 0, None, 0, None, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])), tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])), tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1])), tree_node([1, None, 1, 0, 0, 1, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0])), tree_node([1, 0, 1, 0, 0, 1, 0, None, 1, 0, None, 1, 0, None, 1, 1, None, None, 1, 1, None, None, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])), tree_node([1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, None, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, None, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 1])), tree_node([1, 0, None, 0, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0])), tree_node([1, None, 1, None, 0, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])), tree_node([1, 0, None, None, 0, 0, None, 0, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1])), tree_node([1, 1, 1, 1, 1, 0, 0, None, None, 1, 0, 0, 1, 0, 0, None, None, 1, 1, None, 1, 1, None, 1, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0])), tree_node([1, 0, 1, 0, None, 0, 1, 0, None, 1, None, None, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])), tree_node([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1])), tree_node([1, 1, 0, 1, 0, 0, 1, 1, None, 1, None, 1, None, None, 1, None, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1])), tree_node([1, 0, 0, None, 0, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1])), tree_node([1, 1, 0, 0, 0, None, 1, 1, 0, None, 0, 0, 1, None, None, None, 1, 1, None, 1]))\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == None\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])), tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])), tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0])), tree_node([1, 1, 1, 1, None, 1, 0, 0, 1, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), tree_node([1, None, 0, None, 0, None, 0, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])), tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0])), tree_node([1, None, 0, None, 0, 0, None, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])), tree_node([1, 0, None, None, 0, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), tree_node([1, 0, 1, 0, 1, 0, 1, None, 1, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0])), tree_node([1, 0, 1, 0, 1, None, 1, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])), tree_node([1, 0, None, 0, 0, 0, 1, 0, None, 0, None, None, None, None, 1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1])), tree_node([1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, None, None, 1, None, None, 1, None, None, 1, None, None, 1]))\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == None\n assert is_same_tree(candidate(root = tree_node([1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])), tree_node([1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1]))\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().pruneTree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var pruneTree = function(root) {", "container": null, "callable": "pruneTree", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 815, "task_id": "bus-routes", "difficulty": "Hard", "problem_description": "You are given an array routes representing bus routes where routes[i] is a bus route that the ith bus repeats forever.\n\nFor example, if routes[0] = [1, 5, 7], this means that the 0th bus travels in the sequence 1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ... forever.\n\nYou will start at the bus stop source (You are not on any bus initially), and you want to go to the bus stop target. You can travel between bus stops by buses only.\nReturn the least number of buses you must take to travel from source to target. Return -1 if it is not possible.\n \nExample 1:\n\nInput: routes = [[1,2,7],[3,6,7]], source = 1, target = 6\nOutput: 2\nExplanation: The best strategy is take the first bus to the bus stop 7, then take the second bus to the bus stop 6.\n\nExample 2:\n\nInput: routes = [[7,12],[4,5,15],[6],[15,19],[9,12,13]], source = 15, target = 12\nOutput: -1\n\n \n \nConstraints:\n\n1 <= routes.length <= 500.\n1 <= routes[i].length <= 105\nAll the values of routes[i] are unique.\nsum(routes[i].length) <= 105\n0 <= routes[i][j] < 106\n0 <= source, target < 106\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(routes = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],source = 1,target = 9) == -1\n assert candidate(routes = [[1, 2, 3, 4, 5]],source = 1,target = 5) == 1\n assert candidate(routes = [[7, 12], [4, 5, 15], [6], [15, 19], [9, 12, 13]],source = 15,target = 12) == -1\n assert candidate(routes = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],source = 1,target = 8) == -1\n assert candidate(routes = [[1, 2, 3], [3, 4, 5], [5, 6, 1]],source = 2,target = 6) == 2\n assert candidate(routes = [[1, 5, 7], [1, 5, 3], [3, 7, 9]],source = 1,target = 9) == 2\n assert candidate(routes = [[1, 2, 3], [4, 5, 6]],source = 1,target = 6) == -1\n assert candidate(routes = [[1, 7], [3, 7], [5, 7], [7, 9]],source = 1,target = 9) == 2\n assert candidate(routes = [[1, 2, 3], [3, 4, 5], [5, 6, 1]],source = 1,target = 5) == 1\n assert candidate(routes = [[1, 7], [3, 5]],source = 5,target = 7) == -1\n assert candidate(routes = [[1, 5, 9], [3, 5, 7], [7, 8, 9]],source = 1,target = 8) == 2\n assert candidate(routes = [[1, 2, 3], [3, 4, 5], [5, 6, 7]],source = 1,target = 7) == 3\n assert candidate(routes = [[1, 2, 7], [3, 6, 7]],source = 1,target = 6) == 2\n assert candidate(routes = [[1, 2, 3], [3, 4, 5], [5, 6, 1], [6, 7, 8], [8, 9, 10], [10, 1, 2]],source = 1,target = 10) == 1\n assert candidate(routes = [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7, 8, 9], [8, 9, 10], [9, 10, 11], [10, 11, 12], [11, 12, 13], [12, 13, 14], [13, 14, 15], [14, 15, 16], [15, 16, 17], [16, 17, 18], [17, 18, 19], [18, 19, 20], [19, 20, 21], [20, 21, 22], [21, 22, 23], [22, 23, 24], [23, 24, 25]],source = 1,target = 25) == 12\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 4, 6, 8, 10], [3, 5, 7, 9, 11]],source = 1,target = 11) == 2\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [5, 10, 15, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36, 37, 38, 39, 40], [41, 42, 43, 44, 45, 46, 47, 48, 49, 50]],source = 1,target = 50) == -1\n assert candidate(routes = [[1, 3, 5, 7, 9, 11], [2, 4, 6, 8, 10, 12], [5, 10, 15, 20, 25, 30], [15, 25, 35, 45, 55, 65]],source = 1,target = 65) == 3\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 4, 6, 8, 10, 12, 14, 16, 18], [3, 5, 7, 9, 11, 13, 15, 17, 19, 21]],source = 1,target = 21) == 2\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [5, 10, 15, 20]],source = 1,target = 20) == 2\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [19, 20, 21, 22, 23, 24, 25, 26, 27, 28], [28, 29, 30, 1]],source = 1,target = 30) == 1\n assert candidate(routes = [[1, 2, 3, 4, 5], [5, 6, 7, 8, 9], [9, 10, 11, 12, 13], [13, 14, 15, 16, 17], [17, 18, 19, 20, 21], [21, 22, 23, 24, 25]],source = 1,target = 25) == 6\n assert candidate(routes = [[1, 10, 20, 30, 40], [2, 11, 21, 31, 41], [3, 12, 22, 32, 42], [4, 13, 23, 33, 43], [5, 14, 24, 34, 44]],source = 1,target = 44) == -1\n assert candidate(routes = [[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30], [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75]],source = 1,target = 75) == 2\n assert candidate(routes = [[1, 10, 15, 20], [2, 10, 12], [10, 15, 25], [5, 15, 30], [1, 5]],source = 1,target = 25) == 2\n assert candidate(routes = [[1, 3, 5, 7, 9, 11], [2, 4, 6, 8, 10, 12], [13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]],source = 1,target = 30) == -1\n assert candidate(routes = [[100, 200], [200, 300], [300, 400], [400, 500], [500, 100]],source = 100,target = 500) == 1\n assert candidate(routes = [[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49], [2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50], [3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47], [4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48], [5, 10, 15, 20, 25, 30, 35, 40, 45, 50], [1, 11, 21, 31, 41], [5, 15, 25, 35, 45]],source = 1,target = 50) == 2\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49], [5, 10, 15, 20, 25, 30, 35, 40, 45, 50], [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49]],source = 1,target = 50) == 1\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], [29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43]],source = 1,target = 43) == 3\n assert candidate(routes = [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [3, 6, 9, 12, 15], [4, 7, 10, 13, 16], [5, 8, 11, 14, 17]],source = 1,target = 17) == 2\n assert candidate(routes = [[3, 11, 16, 18, 23], [2, 10, 12, 21, 22, 24, 26, 33, 34, 38], [11, 13, 19, 32, 36, 43], [6, 16, 19, 26, 29, 34, 36, 37, 38, 39, 43, 44], [5, 9, 10, 12, 18, 21, 24, 27, 28, 32, 33, 35, 40, 41, 42, 45, 46, 48, 49], [2, 5, 8, 9, 13, 14, 17, 21, 22, 23, 24, 25, 30, 31, 33, 35, 41, 44, 45, 47], [3, 6, 7, 8, 10, 12, 14, 15, 17, 20, 21, 23, 27, 31, 32, 33, 37, 40, 41, 43, 45, 46, 47, 48, 49], [1, 6, 9, 13, 14, 25, 31, 32, 34, 35, 40, 41, 43, 44, 45, 46, 47, 48, 49], [3, 14, 17, 20, 21, 22, 26, 28, 30, 31, 32, 35, 37, 39, 40, 41, 42, 43, 44, 47, 48, 49], [1, 2, 4, 6, 8, 9, 11, 13, 15, 16, 17, 18, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [2, 4, 8, 10, 12, 13, 14, 15, 17, 18, 19, 20, 21, 23, 25, 26, 27, 28, 29, 31, 32, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [4, 6, 7, 11, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [1, 3, 6, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22, 24, 25, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [1, 3, 5, 7, 8, 9, 11, 14, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]],source = 4,target = 36) == 1\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20], [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]],source = 1,target = 50) == 2\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40], [1, 21, 11, 31], [10, 20, 30, 40], [15, 25, 35, 45]],source = 1,target = 45) == 2\n assert candidate(routes = [[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], [15, 25, 35, 45, 55, 65, 75, 85, 95, 105], [10, 25, 40, 55, 70, 85, 100, 115, 130, 145]],source = 10,target = 145) == 1\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]],source = 1,target = 100) == 2\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [1, 21, 30], [10, 20, 30]],source = 1,target = 30) == 1\n assert candidate(routes = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]],source = 1,target = 9) == 2\n assert candidate(routes = [[10, 11, 12, 13, 14, 15], [15, 16, 17, 18, 19, 20], [20, 21, 22, 23, 24, 25], [25, 26, 27, 28, 29, 30]],source = 10,target = 30) == 4\n assert candidate(routes = [[10, 20, 30], [20, 40, 50], [30, 50, 60], [60, 70, 80]],source = 10,target = 80) == 3\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [1, 11, 21], [2, 12, 22], [3, 13, 23], [4, 14, 24], [5, 15, 25], [6, 16, 26], [7, 17, 27], [8, 18, 28], [9, 19, 29], [10, 20, 30]],source = 1,target = 30) == 2\n assert candidate(routes = [[33, 22, 5, 13], [41, 33, 23, 32, 45, 35], [5, 6, 11, 15, 41, 47, 4, 19], [4, 31, 10, 48, 38, 16], [29, 38, 48, 18, 44, 35, 37, 42], [25, 22, 39, 43, 1, 26, 36, 28, 32, 30, 21], [12, 35, 29, 49, 11, 24], [47, 24, 40, 46, 42, 23, 41, 39, 34, 28], [26, 1, 34, 48, 49], [41, 26, 43, 20, 35, 30, 15, 37, 12], [11, 25, 39, 28, 10, 47, 21], [39, 18, 41, 19, 23, 26, 20, 11, 37, 33, 22, 34], [35, 18, 22, 40, 43, 27, 1, 37, 32, 20, 33], [32, 27, 28, 36, 43, 35, 24, 34, 39, 46, 42, 40, 37, 30, 31, 21, 15, 13, 4, 33, 19, 25, 10, 49, 23, 41, 12, 11, 47, 48], [4, 22, 18, 24, 40, 39, 26, 36, 43, 13, 11, 15, 28, 20, 37, 35, 33, 42, 47, 23, 30, 19, 1, 46, 34, 41, 49, 12, 31]],source = 1,target = 40) == 1\n assert candidate(routes = [[10, 20, 30, 40, 50], [60, 70, 80, 90, 100], [20, 80, 100], [50, 60, 70], [10, 50, 60, 70, 80, 90]],source = 10,target = 90) == 1\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]],source = 1,target = 17) == 2\n assert candidate(routes = [[1, 4, 6, 8, 10], [2, 5, 7, 9, 11], [3, 6, 9, 12, 15], [4, 7, 10, 13, 16], [5, 8, 11, 14, 17]],source = 1,target = 17) == 2\n assert candidate(routes = [[2, 5, 10], [8, 10, 11], [13, 14, 15], [1, 2, 5], [2, 6, 11], [3, 6, 13], [4, 5, 8, 14], [5, 6, 15]],source = 1,target = 15) == 2\n assert candidate(routes = [[1, 4, 5, 6], [2, 5, 7, 8], [3, 6, 8, 10], [4, 7, 9, 10], [5, 9, 11, 12], [6, 10, 12, 13], [7, 11, 13, 14], [8, 12, 14, 15]],source = 1,target = 15) == 3\n assert candidate(routes = [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [9, 10, 11, 12, 13], [13, 14, 15, 16, 17], [17, 18, 19, 20, 21], [21, 1, 2, 3, 4], [4, 5, 6, 7, 8]],source = 1,target = 21) == 1\n assert candidate(routes = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], [26, 27, 28, 29, 30], [31, 32, 33, 34, 35], [36, 37, 38, 39, 40], [41, 42, 43, 44, 45], [46, 47, 48, 49, 50], [1, 6, 11, 16, 21, 26, 31, 36, 41, 46], [2, 7, 12, 17, 22, 27, 32, 37, 42, 47], [3, 8, 13, 18, 23, 28, 33, 38, 43, 48], [4, 9, 14, 19, 24, 29, 34, 39, 44, 49], [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]],source = 1,target = 50) == 2\n assert candidate(routes = [[10, 20, 30, 40, 50], [15, 25, 35, 45, 55], [1, 11, 21, 31, 41, 51], [2, 12, 22, 32, 42, 52], [3, 13, 23, 33, 43, 53], [4, 14, 24, 34, 44, 54], [5, 15, 25, 35, 45, 55]],source = 1,target = 55) == -1\n assert candidate(routes = [[2, 7, 8, 9], [4, 7, 8, 11, 12, 13, 14, 17, 19, 20, 22, 23, 24, 26, 27, 30, 31, 32, 34, 35, 36, 37, 38, 40, 41, 42, 44, 45, 46, 48], [2, 3, 4, 6, 11, 12, 13, 16, 18, 19, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 40, 41, 42, 44, 46, 48, 49], [4, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [2, 3, 5, 6, 11, 12, 13, 14, 16, 18, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 40, 41, 42, 44, 45, 46, 48], [4, 7, 8, 11, 12, 13, 14, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [4, 7, 8, 11, 12, 13, 14, 15, 16, 18, 19, 20, 21, 23, 24, 25, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 48], [4, 7, 8, 11, 12, 14, 15, 17, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [3, 4, 5, 6, 7, 8, 11, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [2, 3, 5, 7, 8, 9, 11, 12, 14, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]],source = 4,target = 34) == 1\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39], [39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58]],source = 1,target = 58) == 3\n assert candidate(routes = [[1, 2, 3], [3, 4, 5], [5, 6, 7], [7, 8, 9], [9, 10, 11], [11, 12, 13], [13, 14, 15], [15, 16, 17], [17, 18, 19], [19, 20, 21], [21, 22, 23], [23, 24, 25], [25, 26, 27], [27, 28, 29], [29, 30, 31], [31, 32, 33], [33, 34, 35], [35, 36, 37], [37, 38, 39], [39, 40, 41], [41, 42, 43], [43, 44, 45]],source = 1,target = 45) == 22\n assert candidate(routes = [[3, 7, 9, 11, 13, 15], [1, 3, 5, 7, 9, 11], [5, 11, 17, 23, 29], [7, 15, 21, 27, 33], [9, 13, 19, 25, 31], [11, 17, 23, 29, 35], [13, 21, 25, 29, 37], [15, 27, 35, 43, 47], [17, 29, 39, 49, 53], [19, 31, 41, 49, 57], [21, 25, 31, 43, 49], [23, 37, 43, 51, 57], [25, 29, 35, 43, 49, 53, 57]],source = 3,target = 47) == 2\n assert candidate(routes = [[1, 2, 3, 4, 5], [5, 6, 7, 8, 9], [9, 10, 11, 12, 13], [13, 14, 15, 16, 17], [17, 18, 19, 20, 1]],source = 1,target = 20) == 1\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]],source = 1,target = 20) == -1\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]],source = 1,target = 20) == 2\n assert candidate(routes = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [5, 10, 15, 20], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]],source = 1,target = 20) == 2\n assert candidate(routes = [[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22], [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]],source = 1,target = 55) == 2\n assert candidate(routes = [[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [1, 11, 21, 31, 41, 51, 61, 71, 81, 91], [2, 12, 22, 32, 42, 52, 62, 72, 82, 92]],source = 1,target = 92) == 2\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90], [90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]],source = 1,target = 100) == 1\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]],source = 1,target = 30) == -1\n assert candidate(routes = [[3, 11, 13, 19], [7, 11, 17], [9, 13, 18, 23], [10, 14, 19, 23], [12, 15, 17, 21], [13, 18, 20, 22], [14, 15, 19, 21], [16, 17, 22, 23], [18, 20, 23, 24], [20, 21, 22, 24]],source = 3,target = 24) == 3\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100], [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250]],source = 1,target = 250) == 2\n assert candidate(routes = [[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]],source = 1,target = 20) == 2\n assert candidate(routes = [[1, 2, 3, 4, 5], [2, 6, 7, 8], [3, 9, 10, 11], [4, 12, 13, 14], [5, 6, 9, 12], [7, 10, 13, 15], [8, 11, 14, 16], [15, 16, 17, 18], [17, 18, 19, 20]],source = 1,target = 20) == 5\n assert candidate(routes = [[10, 20, 30, 40], [20, 50, 60], [30, 70, 80], [40, 50, 90], [60, 70, 100], [80, 90, 100]],source = 10,target = 100) == 3\n assert candidate(routes = [[1, 2, 3], [3, 4, 5], [5, 6, 7], [7, 8, 9], [9, 10, 1], [2, 4, 6], [8, 10, 12], [12, 14, 16], [16, 18, 20], [20, 1, 3]],source = 1,target = 20) == 1\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36, 37, 38, 39, 40]],source = 1,target = 40) == -1\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [4, 5, 6, 7, 8, 9, 10, 11, 12, 13]],source = 1,target = 13) == 2\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 11, 12, 13, 14, 15], [15, 16, 17, 18, 19, 20], [20, 21, 22, 23, 24, 25], [25, 26, 27, 28, 29, 30]],source = 1,target = 30) == 5\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [5, 10, 15, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]],source = 1,target = 30) == -1\n assert candidate(routes = [[1, 10, 19], [2, 3, 10, 14], [4, 14, 16, 20], [11, 16, 18], [6, 7, 11, 18], [9, 15, 20]],source = 1,target = 20) == 3\n assert candidate(routes = [[1, 2, 3, 4, 5], [5, 6, 7, 8, 9], [9, 10, 11, 12, 13], [13, 14, 15, 16, 17], [17, 18, 19, 20, 1]],source = 1,target = 20) == 1\n assert candidate(routes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [1, 11, 21, 31], [2, 12, 22, 32], [3, 13, 23, 33], [4, 14, 24, 34], [5, 15, 25, 35], [6, 16, 26, 36], [7, 17, 27, 37], [8, 18, 28, 38], [9, 19, 29, 39], [10, 20, 30, 40]],source = 1,target = 40) == 2\n assert candidate(routes = [[1000, 2000], [2000, 3000, 4000], [4000, 5000, 6000], [6000, 7000, 8000], [8000, 9000, 10000], [10000, 11000], [11000, 12000, 13000], [13000, 14000], [14000, 15000, 1000]],source = 1000,target = 15000) == 1\n assert candidate(routes = [[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22], [21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41], [41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61]],source = 1,target = 61) == 3\n"}, "metadata": {"canonical_parameter_names": ["routes", "source", "target"], "leetcode_dataset_entry_point": "Solution().numBusesToDestination", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numBusesToDestination = function(routes, source, target) {", "container": null, "callable": "numBusesToDestination", "parameters": [{"name": "routes", "type": "number[][]"}, {"name": "source", "type": "number"}, {"name": "target", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 816, "task_id": "ambiguous-coordinates", "difficulty": "Medium", "problem_description": "We had some 2-dimensional coordinates, like \"(1, 3)\" or \"(2, 0.5)\". Then, we removed all commas, decimal points, and spaces and ended up with the string s.\n\nFor example, \"(1, 3)\" becomes s = \"(13)\" and \"(2, 0.5)\" becomes s = \"(205)\".\n\nReturn a list of strings representing all possibilities for what our original coordinates could have been.\nOur original representation never had extraneous zeroes, so we never started with numbers like \"00\", \"0.0\", \"0.00\", \"1.0\", \"001\", \"00.01\", or any other number that can be represented with fewer digits. Also, a decimal point within a number never occurs without at least one digit occurring before it, so we never started with numbers like \".1\".\nThe final answer list can be returned in any order. All coordinates in the final answer have exactly one space between them (occurring after the comma.)\n \nExample 1:\n\nInput: s = \"(123)\"\nOutput: [\"(1, 2.3)\",\"(1, 23)\",\"(1.2, 3)\",\"(12, 3)\"]\n\nExample 2:\n\nInput: s = \"(0123)\"\nOutput: [\"(0, 1.23)\",\"(0, 12.3)\",\"(0, 123)\",\"(0.1, 2.3)\",\"(0.1, 23)\",\"(0.12, 3)\"]\nExplanation: 0.0, 00, 0001 or 00.01 are not allowed.\n\nExample 3:\n\nInput: s = \"(00011)\"\nOutput: [\"(0, 0.011)\",\"(0.001, 1)\"]\n\n \nConstraints:\n\n4 <= s.length <= 12\ns[0] == '(' and s[s.length - 1] == ')'.\nThe rest of s are digits.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"(1001)\") == ['(1, 0.01)', '(10, 0.1)', '(100, 1)']\n assert candidate(s = \"(12345)\") == ['(1, 2.345)', '(1, 23.45)', '(1, 234.5)', '(1, 2345)', '(1.2, 3.45)', '(1.2, 34.5)', '(1.2, 345)', '(12, 3.45)', '(12, 34.5)', '(12, 345)', '(1.23, 4.5)', '(1.23, 45)', '(12.3, 4.5)', '(12.3, 45)', '(123, 4.5)', '(123, 45)', '(1.234, 5)', '(12.34, 5)', '(123.4, 5)', '(1234, 5)']\n assert candidate(s = \"(01001)\") == ['(0, 1.001)', '(0, 10.01)', '(0, 100.1)', '(0, 1001)', '(0.1, 0.01)']\n assert candidate(s = \"(1010)\") == ['(10, 10)', '(1.01, 0)', '(10.1, 0)', '(101, 0)']\n assert candidate(s = \"(1000)\") == ['(100, 0)']\n assert candidate(s = \"(0123)\") == ['(0, 1.23)', '(0, 12.3)', '(0, 123)', '(0.1, 2.3)', '(0.1, 23)', '(0.12, 3)']\n assert candidate(s = \"(00011)\") == ['(0, 0.011)', '(0.001, 1)']\n assert candidate(s = \"(123)\") == ['(1, 2.3)', '(1, 23)', '(1.2, 3)', '(12, 3)']\n assert candidate(s = \"(1234)\") == ['(1, 2.34)', '(1, 23.4)', '(1, 234)', '(1.2, 3.4)', '(1.2, 34)', '(12, 3.4)', '(12, 34)', '(1.23, 4)', '(12.3, 4)', '(123, 4)']\n assert candidate(s = \"(100)\") == ['(10, 0)']\n assert candidate(s = \"(110)\") == ['(1, 10)', '(1.1, 0)', '(11, 0)']\n assert candidate(s = \"(10001)\") == ['(1, 0.001)', '(10, 0.01)', '(100, 0.1)', '(1000, 1)']\n assert candidate(s = \"(0000)\") == []\n assert candidate(s = \"(00100)\") == []\n assert candidate(s = \"(00001)\") == ['(0, 0.001)']\n assert candidate(s = \"(010)\") == ['(0, 10)', '(0.1, 0)']\n assert candidate(s = \"(987654)\") == ['(9, 8.7654)', '(9, 87.654)', '(9, 876.54)', '(9, 8765.4)', '(9, 87654)', '(9.8, 7.654)', '(9.8, 76.54)', '(9.8, 765.4)', '(9.8, 7654)', '(98, 7.654)', '(98, 76.54)', '(98, 765.4)', '(98, 7654)', '(9.87, 6.54)', '(9.87, 65.4)', '(9.87, 654)', '(98.7, 6.54)', '(98.7, 65.4)', '(98.7, 654)', '(987, 6.54)', '(987, 65.4)', '(987, 654)', '(9.876, 5.4)', '(9.876, 54)', '(98.76, 5.4)', '(98.76, 54)', '(987.6, 5.4)', '(987.6, 54)', '(9876, 5.4)', '(9876, 54)', '(9.8765, 4)', '(98.765, 4)', '(987.65, 4)', '(9876.5, 4)', '(98765, 4)']\n assert candidate(s = \"(00010001)\") == ['(0, 0.010001)', '(0.001, 0.001)']\n assert candidate(s = \"(12340001)\") == ['(1, 2.340001)', '(1, 23.40001)', '(1, 234.0001)', '(1, 2340.001)', '(1, 23400.01)', '(1, 234000.1)', '(1, 2340001)', '(1.2, 3.40001)', '(1.2, 34.0001)', '(1.2, 340.001)', '(1.2, 3400.01)', '(1.2, 34000.1)', '(1.2, 340001)', '(12, 3.40001)', '(12, 34.0001)', '(12, 340.001)', '(12, 3400.01)', '(12, 34000.1)', '(12, 340001)', '(1.23, 4.0001)', '(1.23, 40.001)', '(1.23, 400.01)', '(1.23, 4000.1)', '(1.23, 40001)', '(12.3, 4.0001)', '(12.3, 40.001)', '(12.3, 400.01)', '(12.3, 4000.1)', '(12.3, 40001)', '(123, 4.0001)', '(123, 40.001)', '(123, 400.01)', '(123, 4000.1)', '(123, 40001)', '(1.234, 0.001)', '(12.34, 0.001)', '(123.4, 0.001)', '(1234, 0.001)', '(12340, 0.01)', '(123400, 0.1)', '(1234000, 1)']\n assert candidate(s = \"(000100)\") == []\n assert candidate(s = \"(12300123)\") == ['(1, 2.300123)', '(1, 23.00123)', '(1, 230.0123)', '(1, 2300.123)', '(1, 23001.23)', '(1, 230012.3)', '(1, 2300123)', '(1.2, 3.00123)', '(1.2, 30.0123)', '(1.2, 300.123)', '(1.2, 3001.23)', '(1.2, 30012.3)', '(1.2, 300123)', '(12, 3.00123)', '(12, 30.0123)', '(12, 300.123)', '(12, 3001.23)', '(12, 30012.3)', '(12, 300123)', '(1.23, 0.0123)', '(12.3, 0.0123)', '(123, 0.0123)', '(1230, 0.123)', '(12300, 1.23)', '(12300, 12.3)', '(12300, 123)', '(1.23001, 2.3)', '(1.23001, 23)', '(12.3001, 2.3)', '(12.3001, 23)', '(123.001, 2.3)', '(123.001, 23)', '(1230.01, 2.3)', '(1230.01, 23)', '(12300.1, 2.3)', '(12300.1, 23)', '(123001, 2.3)', '(123001, 23)', '(1.230012, 3)', '(12.30012, 3)', '(123.0012, 3)', '(1230.012, 3)', '(12300.12, 3)', '(123001.2, 3)', '(1230012, 3)']\n assert candidate(s = \"(100020003000)\") == ['(1000, 20003000)', '(10002000, 3000)', '(10002000300, 0)']\n assert candidate(s = \"(0010001)\") == ['(0, 0.10001)', '(0.01, 0.001)']\n assert candidate(s = \"(1234567)\") == ['(1, 2.34567)', '(1, 23.4567)', '(1, 234.567)', '(1, 2345.67)', '(1, 23456.7)', '(1, 234567)', '(1.2, 3.4567)', '(1.2, 34.567)', '(1.2, 345.67)', '(1.2, 3456.7)', '(1.2, 34567)', '(12, 3.4567)', '(12, 34.567)', '(12, 345.67)', '(12, 3456.7)', '(12, 34567)', '(1.23, 4.567)', '(1.23, 45.67)', '(1.23, 456.7)', '(1.23, 4567)', '(12.3, 4.567)', '(12.3, 45.67)', '(12.3, 456.7)', '(12.3, 4567)', '(123, 4.567)', '(123, 45.67)', '(123, 456.7)', '(123, 4567)', '(1.234, 5.67)', '(1.234, 56.7)', '(1.234, 567)', '(12.34, 5.67)', '(12.34, 56.7)', '(12.34, 567)', '(123.4, 5.67)', '(123.4, 56.7)', '(123.4, 567)', '(1234, 5.67)', '(1234, 56.7)', '(1234, 567)', '(1.2345, 6.7)', '(1.2345, 67)', '(12.345, 6.7)', '(12.345, 67)', '(123.45, 6.7)', '(123.45, 67)', '(1234.5, 6.7)', '(1234.5, 67)', '(12345, 6.7)', '(12345, 67)', '(1.23456, 7)', '(12.3456, 7)', '(123.456, 7)', '(1234.56, 7)', '(12345.6, 7)', '(123456, 7)']\n assert candidate(s = \"(987654321)\") == ['(9, 8.7654321)', '(9, 87.654321)', '(9, 876.54321)', '(9, 8765.4321)', '(9, 87654.321)', '(9, 876543.21)', '(9, 8765432.1)', '(9, 87654321)', '(9.8, 7.654321)', '(9.8, 76.54321)', '(9.8, 765.4321)', '(9.8, 7654.321)', '(9.8, 76543.21)', '(9.8, 765432.1)', '(9.8, 7654321)', '(98, 7.654321)', '(98, 76.54321)', '(98, 765.4321)', '(98, 7654.321)', '(98, 76543.21)', '(98, 765432.1)', '(98, 7654321)', '(9.87, 6.54321)', '(9.87, 65.4321)', '(9.87, 654.321)', '(9.87, 6543.21)', '(9.87, 65432.1)', '(9.87, 654321)', '(98.7, 6.54321)', '(98.7, 65.4321)', '(98.7, 654.321)', '(98.7, 6543.21)', '(98.7, 65432.1)', '(98.7, 654321)', '(987, 6.54321)', '(987, 65.4321)', '(987, 654.321)', '(987, 6543.21)', '(987, 65432.1)', '(987, 654321)', '(9.876, 5.4321)', '(9.876, 54.321)', '(9.876, 543.21)', '(9.876, 5432.1)', '(9.876, 54321)', '(98.76, 5.4321)', '(98.76, 54.321)', '(98.76, 543.21)', '(98.76, 5432.1)', '(98.76, 54321)', '(987.6, 5.4321)', '(987.6, 54.321)', '(987.6, 543.21)', '(987.6, 5432.1)', '(987.6, 54321)', '(9876, 5.4321)', '(9876, 54.321)', '(9876, 543.21)', '(9876, 5432.1)', '(9876, 54321)', '(9.8765, 4.321)', '(9.8765, 43.21)', '(9.8765, 432.1)', '(9.8765, 4321)', '(98.765, 4.321)', '(98.765, 43.21)', '(98.765, 432.1)', '(98.765, 4321)', '(987.65, 4.321)', '(987.65, 43.21)', '(987.65, 432.1)', '(987.65, 4321)', '(9876.5, 4.321)', '(9876.5, 43.21)', '(9876.5, 432.1)', '(9876.5, 4321)', '(98765, 4.321)', '(98765, 43.21)', '(98765, 432.1)', '(98765, 4321)', '(9.87654, 3.21)', '(9.87654, 32.1)', '(9.87654, 321)', '(98.7654, 3.21)', '(98.7654, 32.1)', '(98.7654, 321)', '(987.654, 3.21)', '(987.654, 32.1)', '(987.654, 321)', '(9876.54, 3.21)', '(9876.54, 32.1)', '(9876.54, 321)', '(98765.4, 3.21)', '(98765.4, 32.1)', '(98765.4, 321)', '(987654, 3.21)', '(987654, 32.1)', '(987654, 321)', '(9.876543, 2.1)', '(9.876543, 21)', '(98.76543, 2.1)', '(98.76543, 21)', '(987.6543, 2.1)', '(987.6543, 21)', '(9876.543, 2.1)', '(9876.543, 21)', '(98765.43, 2.1)', '(98765.43, 21)', '(987654.3, 2.1)', '(987654.3, 21)', '(9876543, 2.1)', '(9876543, 21)', '(9.8765432, 1)', '(98.765432, 1)', '(987.65432, 1)', '(9876.5432, 1)', '(98765.432, 1)', '(987654.32, 1)', '(9876543.2, 1)', '(98765432, 1)']\n assert candidate(s = \"(000000)\") == []\n assert candidate(s = \"(000000000000)\") == []\n assert candidate(s = \"(01234506789)\") == ['(0, 1.234506789)', '(0, 12.34506789)', '(0, 123.4506789)', '(0, 1234.506789)', '(0, 12345.06789)', '(0, 123450.6789)', '(0, 1234506.789)', '(0, 12345067.89)', '(0, 123450678.9)', '(0, 1234506789)', '(0.1, 2.34506789)', '(0.1, 23.4506789)', '(0.1, 234.506789)', '(0.1, 2345.06789)', '(0.1, 23450.6789)', '(0.1, 234506.789)', '(0.1, 2345067.89)', '(0.1, 23450678.9)', '(0.1, 234506789)', '(0.12, 3.4506789)', '(0.12, 34.506789)', '(0.12, 345.06789)', '(0.12, 3450.6789)', '(0.12, 34506.789)', '(0.12, 345067.89)', '(0.12, 3450678.9)', '(0.12, 34506789)', '(0.123, 4.506789)', '(0.123, 45.06789)', '(0.123, 450.6789)', '(0.123, 4506.789)', '(0.123, 45067.89)', '(0.123, 450678.9)', '(0.123, 4506789)', '(0.1234, 5.06789)', '(0.1234, 50.6789)', '(0.1234, 506.789)', '(0.1234, 5067.89)', '(0.1234, 50678.9)', '(0.1234, 506789)', '(0.12345, 0.6789)', '(0.1234506, 7.89)', '(0.1234506, 78.9)', '(0.1234506, 789)', '(0.12345067, 8.9)', '(0.12345067, 89)', '(0.123450678, 9)']\n assert candidate(s = \"(00000123)\") == ['(0, 0.000123)', '(0.00001, 2.3)', '(0.00001, 23)', '(0.000012, 3)']\n assert candidate(s = \"(123050)\") == ['(1, 23050)', '(1.2, 3050)', '(12, 3050)', '(1230, 50)', '(1.2305, 0)', '(12.305, 0)', '(123.05, 0)', '(1230.5, 0)', '(12305, 0)']\n assert candidate(s = \"(000123)\") == ['(0, 0.0123)', '(0.001, 2.3)', '(0.001, 23)', '(0.0012, 3)']\n assert candidate(s = \"(0000000001)\") == ['(0, 0.00000001)']\n assert candidate(s = \"(00012345)\") == ['(0, 0.012345)', '(0.001, 2.345)', '(0.001, 23.45)', '(0.001, 234.5)', '(0.001, 2345)', '(0.0012, 3.45)', '(0.0012, 34.5)', '(0.0012, 345)', '(0.00123, 4.5)', '(0.00123, 45)', '(0.001234, 5)']\n assert candidate(s = \"(012301)\") == ['(0, 1.2301)', '(0, 12.301)', '(0, 123.01)', '(0, 1230.1)', '(0, 12301)', '(0.1, 2.301)', '(0.1, 23.01)', '(0.1, 230.1)', '(0.1, 2301)', '(0.12, 3.01)', '(0.12, 30.1)', '(0.12, 301)', '(0.123, 0.1)']\n assert candidate(s = \"(123450123)\") == ['(1, 2.3450123)', '(1, 23.450123)', '(1, 234.50123)', '(1, 2345.0123)', '(1, 23450.123)', '(1, 234501.23)', '(1, 2345012.3)', '(1, 23450123)', '(1.2, 3.450123)', '(1.2, 34.50123)', '(1.2, 345.0123)', '(1.2, 3450.123)', '(1.2, 34501.23)', '(1.2, 345012.3)', '(1.2, 3450123)', '(12, 3.450123)', '(12, 34.50123)', '(12, 345.0123)', '(12, 3450.123)', '(12, 34501.23)', '(12, 345012.3)', '(12, 3450123)', '(1.23, 4.50123)', '(1.23, 45.0123)', '(1.23, 450.123)', '(1.23, 4501.23)', '(1.23, 45012.3)', '(1.23, 450123)', '(12.3, 4.50123)', '(12.3, 45.0123)', '(12.3, 450.123)', '(12.3, 4501.23)', '(12.3, 45012.3)', '(12.3, 450123)', '(123, 4.50123)', '(123, 45.0123)', '(123, 450.123)', '(123, 4501.23)', '(123, 45012.3)', '(123, 450123)', '(1.234, 5.0123)', '(1.234, 50.123)', '(1.234, 501.23)', '(1.234, 5012.3)', '(1.234, 50123)', '(12.34, 5.0123)', '(12.34, 50.123)', '(12.34, 501.23)', '(12.34, 5012.3)', '(12.34, 50123)', '(123.4, 5.0123)', '(123.4, 50.123)', '(123.4, 501.23)', '(123.4, 5012.3)', '(123.4, 50123)', '(1234, 5.0123)', '(1234, 50.123)', '(1234, 501.23)', '(1234, 5012.3)', '(1234, 50123)', '(1.2345, 0.123)', '(12.345, 0.123)', '(123.45, 0.123)', '(1234.5, 0.123)', '(12345, 0.123)', '(123450, 1.23)', '(123450, 12.3)', '(123450, 123)', '(1.234501, 2.3)', '(1.234501, 23)', '(12.34501, 2.3)', '(12.34501, 23)', '(123.4501, 2.3)', '(123.4501, 23)', '(1234.501, 2.3)', '(1234.501, 23)', '(12345.01, 2.3)', '(12345.01, 23)', '(123450.1, 2.3)', '(123450.1, 23)', '(1234501, 2.3)', '(1234501, 23)', '(1.2345012, 3)', '(12.345012, 3)', '(123.45012, 3)', '(1234.5012, 3)', '(12345.012, 3)', '(123450.12, 3)', '(1234501.2, 3)', '(12345012, 3)']\n assert candidate(s = \"(010101)\") == ['(0, 1.0101)', '(0, 10.101)', '(0, 101.01)', '(0, 1010.1)', '(0, 10101)', '(0.1, 0.101)', '(0.101, 0.1)']\n assert candidate(s = \"(0001234)\") == ['(0, 0.01234)', '(0.001, 2.34)', '(0.001, 23.4)', '(0.001, 234)', '(0.0012, 3.4)', '(0.0012, 34)', '(0.00123, 4)']\n assert candidate(s = \"(000000001234)\") == ['(0, 0.0000001234)', '(0.00000001, 2.34)', '(0.00000001, 23.4)', '(0.00000001, 234)', '(0.000000012, 3.4)', '(0.000000012, 34)', '(0.0000000123, 4)']\n assert candidate(s = \"(00012340)\") == ['(0.001, 2340)', '(0.0012, 340)', '(0.00123, 40)', '(0.001234, 0)']\n assert candidate(s = \"(0000001)\") == ['(0, 0.00001)']\n assert candidate(s = \"(10000010)\") == ['(100000, 10)', '(1.000001, 0)', '(10.00001, 0)', '(100.0001, 0)', '(1000.001, 0)', '(10000.01, 0)', '(100000.1, 0)', '(1000001, 0)']\n assert candidate(s = \"(12012012)\") == ['(1, 2.012012)', '(1, 20.12012)', '(1, 201.2012)', '(1, 2012.012)', '(1, 20120.12)', '(1, 201201.2)', '(1, 2012012)', '(1.2, 0.12012)', '(12, 0.12012)', '(120, 1.2012)', '(120, 12.012)', '(120, 120.12)', '(120, 1201.2)', '(120, 12012)', '(1.201, 2.012)', '(1.201, 20.12)', '(1.201, 201.2)', '(1.201, 2012)', '(12.01, 2.012)', '(12.01, 20.12)', '(12.01, 201.2)', '(12.01, 2012)', '(120.1, 2.012)', '(120.1, 20.12)', '(120.1, 201.2)', '(120.1, 2012)', '(1201, 2.012)', '(1201, 20.12)', '(1201, 201.2)', '(1201, 2012)', '(1.2012, 0.12)', '(12.012, 0.12)', '(120.12, 0.12)', '(1201.2, 0.12)', '(12012, 0.12)', '(120120, 1.2)', '(120120, 12)', '(1.201201, 2)', '(12.01201, 2)', '(120.1201, 2)', '(1201.201, 2)', '(12012.01, 2)', '(120120.1, 2)', '(1201201, 2)']\n assert candidate(s = \"(001203)\") == ['(0, 0.1203)', '(0.01, 2.03)', '(0.01, 20.3)', '(0.01, 203)', '(0.012, 0.3)']\n assert candidate(s = \"(000010001)\") == ['(0, 0.0010001)', '(0.0001, 0.001)']\n assert candidate(s = \"(100100100100)\") == ['(100, 100100100)', '(100100, 100100)', '(100100100, 100)', '(10010010010, 0)']\n assert candidate(s = \"(100001)\") == ['(1, 0.0001)', '(10, 0.001)', '(100, 0.01)', '(1000, 0.1)', '(10000, 1)']\n assert candidate(s = \"(01230123)\") == ['(0, 1.230123)', '(0, 12.30123)', '(0, 123.0123)', '(0, 1230.123)', '(0, 12301.23)', '(0, 123012.3)', '(0, 1230123)', '(0.1, 2.30123)', '(0.1, 23.0123)', '(0.1, 230.123)', '(0.1, 2301.23)', '(0.1, 23012.3)', '(0.1, 230123)', '(0.12, 3.0123)', '(0.12, 30.123)', '(0.12, 301.23)', '(0.12, 3012.3)', '(0.12, 30123)', '(0.123, 0.123)', '(0.12301, 2.3)', '(0.12301, 23)', '(0.123012, 3)']\n assert candidate(s = \"(1000000)\") == ['(100000, 0)']\n assert candidate(s = \"(0001000100)\") == []\n assert candidate(s = \"(120030)\") == ['(1, 20030)', '(1200, 30)', '(1.2003, 0)', '(12.003, 0)', '(120.03, 0)', '(1200.3, 0)', '(12003, 0)']\n assert candidate(s = \"(001001)\") == ['(0, 0.1001)', '(0.01, 0.01)']\n assert candidate(s = \"(001234567890)\") == ['(0.01, 234567890)', '(0.012, 34567890)', '(0.0123, 4567890)', '(0.01234, 567890)', '(0.012345, 67890)', '(0.0123456, 7890)', '(0.01234567, 890)', '(0.012345678, 90)', '(0.0123456789, 0)']\n assert candidate(s = \"(100000001)\") == ['(1, 0.0000001)', '(10, 0.000001)', '(100, 0.00001)', '(1000, 0.0001)', '(10000, 0.001)', '(100000, 0.01)', '(1000000, 0.1)', '(10000000, 1)']\n assert candidate(s = \"(000000001)\") == ['(0, 0.0000001)']\n assert candidate(s = \"(001234056)\") == ['(0, 0.1234056)', '(0.01, 2.34056)', '(0.01, 23.4056)', '(0.01, 234.056)', '(0.01, 2340.56)', '(0.01, 23405.6)', '(0.01, 234056)', '(0.012, 3.4056)', '(0.012, 34.056)', '(0.012, 340.56)', '(0.012, 3405.6)', '(0.012, 34056)', '(0.0123, 4.056)', '(0.0123, 40.56)', '(0.0123, 405.6)', '(0.0123, 4056)', '(0.01234, 0.56)', '(0.0123405, 6)']\n assert candidate(s = \"(100100)\") == ['(100, 100)', '(10010, 0)']\n assert candidate(s = \"(00000000001)\") == ['(0, 0.000000001)']\n assert candidate(s = \"(00000000000)\") == []\n assert candidate(s = \"(12345678)\") == ['(1, 2.345678)', '(1, 23.45678)', '(1, 234.5678)', '(1, 2345.678)', '(1, 23456.78)', '(1, 234567.8)', '(1, 2345678)', '(1.2, 3.45678)', '(1.2, 34.5678)', '(1.2, 345.678)', '(1.2, 3456.78)', '(1.2, 34567.8)', '(1.2, 345678)', '(12, 3.45678)', '(12, 34.5678)', '(12, 345.678)', '(12, 3456.78)', '(12, 34567.8)', '(12, 345678)', '(1.23, 4.5678)', '(1.23, 45.678)', '(1.23, 456.78)', '(1.23, 4567.8)', '(1.23, 45678)', '(12.3, 4.5678)', '(12.3, 45.678)', '(12.3, 456.78)', '(12.3, 4567.8)', '(12.3, 45678)', '(123, 4.5678)', '(123, 45.678)', '(123, 456.78)', '(123, 4567.8)', '(123, 45678)', '(1.234, 5.678)', '(1.234, 56.78)', '(1.234, 567.8)', '(1.234, 5678)', '(12.34, 5.678)', '(12.34, 56.78)', '(12.34, 567.8)', '(12.34, 5678)', '(123.4, 5.678)', '(123.4, 56.78)', '(123.4, 567.8)', '(123.4, 5678)', '(1234, 5.678)', '(1234, 56.78)', '(1234, 567.8)', '(1234, 5678)', '(1.2345, 6.78)', '(1.2345, 67.8)', '(1.2345, 678)', '(12.345, 6.78)', '(12.345, 67.8)', '(12.345, 678)', '(123.45, 6.78)', '(123.45, 67.8)', '(123.45, 678)', '(1234.5, 6.78)', '(1234.5, 67.8)', '(1234.5, 678)', '(12345, 6.78)', '(12345, 67.8)', '(12345, 678)', '(1.23456, 7.8)', '(1.23456, 78)', '(12.3456, 7.8)', '(12.3456, 78)', '(123.456, 7.8)', '(123.456, 78)', '(1234.56, 7.8)', '(1234.56, 78)', '(12345.6, 7.8)', '(12345.6, 78)', '(123456, 7.8)', '(123456, 78)', '(1.234567, 8)', '(12.34567, 8)', '(123.4567, 8)', '(1234.567, 8)', '(12345.67, 8)', '(123456.7, 8)', '(1234567, 8)']\n assert candidate(s = \"(01001001)\") == ['(0, 1.001001)', '(0, 10.01001)', '(0, 100.1001)', '(0, 1001.001)', '(0, 10010.01)', '(0, 100100.1)', '(0, 1001001)', '(0.1, 0.01001)', '(0.1001, 0.01)']\n assert candidate(s = \"(100100100)\") == ['(100, 100100)', '(100100, 100)', '(10010010, 0)']\n assert candidate(s = \"(120000)\") == ['(1, 20000)', '(12000, 0)']\n assert candidate(s = \"(00000123456789)\") == ['(0, 0.000123456789)', '(0.00001, 2.3456789)', '(0.00001, 23.456789)', '(0.00001, 234.56789)', '(0.00001, 2345.6789)', '(0.00001, 23456.789)', '(0.00001, 234567.89)', '(0.00001, 2345678.9)', '(0.00001, 23456789)', '(0.000012, 3.456789)', '(0.000012, 34.56789)', '(0.000012, 345.6789)', '(0.000012, 3456.789)', '(0.000012, 34567.89)', '(0.000012, 345678.9)', '(0.000012, 3456789)', '(0.0000123, 4.56789)', '(0.0000123, 45.6789)', '(0.0000123, 456.789)', '(0.0000123, 4567.89)', '(0.0000123, 45678.9)', '(0.0000123, 456789)', '(0.00001234, 5.6789)', '(0.00001234, 56.789)', '(0.00001234, 567.89)', '(0.00001234, 5678.9)', '(0.00001234, 56789)', '(0.000012345, 6.789)', '(0.000012345, 67.89)', '(0.000012345, 678.9)', '(0.000012345, 6789)', '(0.0000123456, 7.89)', '(0.0000123456, 78.9)', '(0.0000123456, 789)', '(0.00001234567, 8.9)', '(0.00001234567, 89)', '(0.000012345678, 9)']\n assert candidate(s = \"(10010)\") == ['(100, 10)', '(1.001, 0)', '(10.01, 0)', '(100.1, 0)', '(1001, 0)']\n assert candidate(s = \"(000100010001)\") == ['(0, 0.0100010001)', '(0.001, 0.0010001)', '(0.0010001, 0.001)']\n assert candidate(s = \"(123456)\") == ['(1, 2.3456)', '(1, 23.456)', '(1, 234.56)', '(1, 2345.6)', '(1, 23456)', '(1.2, 3.456)', '(1.2, 34.56)', '(1.2, 345.6)', '(1.2, 3456)', '(12, 3.456)', '(12, 34.56)', '(12, 345.6)', '(12, 3456)', '(1.23, 4.56)', '(1.23, 45.6)', '(1.23, 456)', '(12.3, 4.56)', '(12.3, 45.6)', '(12.3, 456)', '(123, 4.56)', '(123, 45.6)', '(123, 456)', '(1.234, 5.6)', '(1.234, 56)', '(12.34, 5.6)', '(12.34, 56)', '(123.4, 5.6)', '(123.4, 56)', '(1234, 5.6)', '(1234, 56)', '(1.2345, 6)', '(12.345, 6)', '(123.45, 6)', '(1234.5, 6)', '(12345, 6)']\n assert candidate(s = \"(123456789012)\") == ['(1, 2.3456789012)', '(1, 23.456789012)', '(1, 234.56789012)', '(1, 2345.6789012)', '(1, 23456.789012)', '(1, 234567.89012)', '(1, 2345678.9012)', '(1, 23456789.012)', '(1, 234567890.12)', '(1, 2345678901.2)', '(1, 23456789012)', '(1.2, 3.456789012)', '(1.2, 34.56789012)', '(1.2, 345.6789012)', '(1.2, 3456.789012)', '(1.2, 34567.89012)', '(1.2, 345678.9012)', '(1.2, 3456789.012)', '(1.2, 34567890.12)', '(1.2, 345678901.2)', '(1.2, 3456789012)', '(12, 3.456789012)', '(12, 34.56789012)', '(12, 345.6789012)', '(12, 3456.789012)', '(12, 34567.89012)', '(12, 345678.9012)', '(12, 3456789.012)', '(12, 34567890.12)', '(12, 345678901.2)', '(12, 3456789012)', '(1.23, 4.56789012)', '(1.23, 45.6789012)', '(1.23, 456.789012)', '(1.23, 4567.89012)', '(1.23, 45678.9012)', '(1.23, 456789.012)', '(1.23, 4567890.12)', '(1.23, 45678901.2)', '(1.23, 456789012)', '(12.3, 4.56789012)', '(12.3, 45.6789012)', '(12.3, 456.789012)', '(12.3, 4567.89012)', '(12.3, 45678.9012)', '(12.3, 456789.012)', '(12.3, 4567890.12)', '(12.3, 45678901.2)', '(12.3, 456789012)', '(123, 4.56789012)', '(123, 45.6789012)', '(123, 456.789012)', '(123, 4567.89012)', '(123, 45678.9012)', '(123, 456789.012)', '(123, 4567890.12)', '(123, 45678901.2)', '(123, 456789012)', '(1.234, 5.6789012)', '(1.234, 56.789012)', '(1.234, 567.89012)', '(1.234, 5678.9012)', '(1.234, 56789.012)', '(1.234, 567890.12)', '(1.234, 5678901.2)', '(1.234, 56789012)', '(12.34, 5.6789012)', '(12.34, 56.789012)', '(12.34, 567.89012)', '(12.34, 5678.9012)', '(12.34, 56789.012)', '(12.34, 567890.12)', '(12.34, 5678901.2)', '(12.34, 56789012)', '(123.4, 5.6789012)', '(123.4, 56.789012)', '(123.4, 567.89012)', '(123.4, 5678.9012)', '(123.4, 56789.012)', '(123.4, 567890.12)', '(123.4, 5678901.2)', '(123.4, 56789012)', '(1234, 5.6789012)', '(1234, 56.789012)', '(1234, 567.89012)', '(1234, 5678.9012)', '(1234, 56789.012)', '(1234, 567890.12)', '(1234, 5678901.2)', '(1234, 56789012)', '(1.2345, 6.789012)', '(1.2345, 67.89012)', '(1.2345, 678.9012)', '(1.2345, 6789.012)', '(1.2345, 67890.12)', '(1.2345, 678901.2)', '(1.2345, 6789012)', '(12.345, 6.789012)', '(12.345, 67.89012)', '(12.345, 678.9012)', '(12.345, 6789.012)', '(12.345, 67890.12)', '(12.345, 678901.2)', '(12.345, 6789012)', '(123.45, 6.789012)', '(123.45, 67.89012)', '(123.45, 678.9012)', '(123.45, 6789.012)', '(123.45, 67890.12)', '(123.45, 678901.2)', '(123.45, 6789012)', '(1234.5, 6.789012)', '(1234.5, 67.89012)', '(1234.5, 678.9012)', '(1234.5, 6789.012)', '(1234.5, 67890.12)', '(1234.5, 678901.2)', '(1234.5, 6789012)', '(12345, 6.789012)', '(12345, 67.89012)', '(12345, 678.9012)', '(12345, 6789.012)', '(12345, 67890.12)', '(12345, 678901.2)', '(12345, 6789012)', '(1.23456, 7.89012)', '(1.23456, 78.9012)', '(1.23456, 789.012)', '(1.23456, 7890.12)', '(1.23456, 78901.2)', '(1.23456, 789012)', '(12.3456, 7.89012)', '(12.3456, 78.9012)', '(12.3456, 789.012)', '(12.3456, 7890.12)', '(12.3456, 78901.2)', '(12.3456, 789012)', '(123.456, 7.89012)', '(123.456, 78.9012)', '(123.456, 789.012)', '(123.456, 7890.12)', '(123.456, 78901.2)', '(123.456, 789012)', '(1234.56, 7.89012)', '(1234.56, 78.9012)', '(1234.56, 789.012)', '(1234.56, 7890.12)', '(1234.56, 78901.2)', '(1234.56, 789012)', '(12345.6, 7.89012)', '(12345.6, 78.9012)', '(12345.6, 789.012)', '(12345.6, 7890.12)', '(12345.6, 78901.2)', '(12345.6, 789012)', '(123456, 7.89012)', '(123456, 78.9012)', '(123456, 789.012)', '(123456, 7890.12)', '(123456, 78901.2)', '(123456, 789012)', '(1.234567, 8.9012)', '(1.234567, 89.012)', '(1.234567, 890.12)', '(1.234567, 8901.2)', '(1.234567, 89012)', '(12.34567, 8.9012)', '(12.34567, 89.012)', '(12.34567, 890.12)', '(12.34567, 8901.2)', '(12.34567, 89012)', '(123.4567, 8.9012)', '(123.4567, 89.012)', '(123.4567, 890.12)', '(123.4567, 8901.2)', '(123.4567, 89012)', '(1234.567, 8.9012)', '(1234.567, 89.012)', '(1234.567, 890.12)', '(1234.567, 8901.2)', '(1234.567, 89012)', '(12345.67, 8.9012)', '(12345.67, 89.012)', '(12345.67, 890.12)', '(12345.67, 8901.2)', '(12345.67, 89012)', '(123456.7, 8.9012)', '(123456.7, 89.012)', '(123456.7, 890.12)', '(123456.7, 8901.2)', '(123456.7, 89012)', '(1234567, 8.9012)', '(1234567, 89.012)', '(1234567, 890.12)', '(1234567, 8901.2)', '(1234567, 89012)', '(1.2345678, 9.012)', '(1.2345678, 90.12)', '(1.2345678, 901.2)', '(1.2345678, 9012)', '(12.345678, 9.012)', '(12.345678, 90.12)', '(12.345678, 901.2)', '(12.345678, 9012)', '(123.45678, 9.012)', '(123.45678, 90.12)', '(123.45678, 901.2)', '(123.45678, 9012)', '(1234.5678, 9.012)', '(1234.5678, 90.12)', '(1234.5678, 901.2)', '(1234.5678, 9012)', '(12345.678, 9.012)', '(12345.678, 90.12)', '(12345.678, 901.2)', '(12345.678, 9012)', '(123456.78, 9.012)', '(123456.78, 90.12)', '(123456.78, 901.2)', '(123456.78, 9012)', '(1234567.8, 9.012)', '(1234567.8, 90.12)', '(1234567.8, 901.2)', '(1234567.8, 9012)', '(12345678, 9.012)', '(12345678, 90.12)', '(12345678, 901.2)', '(12345678, 9012)', '(1.23456789, 0.12)', '(12.3456789, 0.12)', '(123.456789, 0.12)', '(1234.56789, 0.12)', '(12345.6789, 0.12)', '(123456.789, 0.12)', '(1234567.89, 0.12)', '(12345678.9, 0.12)', '(123456789, 0.12)', '(1234567890, 1.2)', '(1234567890, 12)', '(1.2345678901, 2)', '(12.345678901, 2)', '(123.45678901, 2)', '(1234.5678901, 2)', '(12345.678901, 2)', '(123456.78901, 2)', '(1234567.8901, 2)', '(12345678.901, 2)', '(123456789.01, 2)', '(1234567890.1, 2)', '(12345678901, 2)']\n assert candidate(s = \"(01000100)\") == ['(0, 1000100)']\n assert candidate(s = \"(0120304)\") == ['(0, 1.20304)', '(0, 12.0304)', '(0, 120.304)', '(0, 1203.04)', '(0, 12030.4)', '(0, 120304)', '(0.1, 2.0304)', '(0.1, 20.304)', '(0.1, 203.04)', '(0.1, 2030.4)', '(0.1, 20304)', '(0.12, 0.304)', '(0.1203, 0.4)']\n assert candidate(s = \"(001234567)\") == ['(0, 0.1234567)', '(0.01, 2.34567)', '(0.01, 23.4567)', '(0.01, 234.567)', '(0.01, 2345.67)', '(0.01, 23456.7)', '(0.01, 234567)', '(0.012, 3.4567)', '(0.012, 34.567)', '(0.012, 345.67)', '(0.012, 3456.7)', '(0.012, 34567)', '(0.0123, 4.567)', '(0.0123, 45.67)', '(0.0123, 456.7)', '(0.0123, 4567)', '(0.01234, 5.67)', '(0.01234, 56.7)', '(0.01234, 567)', '(0.012345, 6.7)', '(0.012345, 67)', '(0.0123456, 7)']\n assert candidate(s = \"(9876543210)\") == ['(9, 876543210)', '(9.8, 76543210)', '(98, 76543210)', '(9.87, 6543210)', '(98.7, 6543210)', '(987, 6543210)', '(9.876, 543210)', '(98.76, 543210)', '(987.6, 543210)', '(9876, 543210)', '(9.8765, 43210)', '(98.765, 43210)', '(987.65, 43210)', '(9876.5, 43210)', '(98765, 43210)', '(9.87654, 3210)', '(98.7654, 3210)', '(987.654, 3210)', '(9876.54, 3210)', '(98765.4, 3210)', '(987654, 3210)', '(9.876543, 210)', '(98.76543, 210)', '(987.6543, 210)', '(9876.543, 210)', '(98765.43, 210)', '(987654.3, 210)', '(9876543, 210)', '(9.8765432, 10)', '(98.765432, 10)', '(987.65432, 10)', '(9876.5432, 10)', '(98765.432, 10)', '(987654.32, 10)', '(9876543.2, 10)', '(98765432, 10)', '(9.87654321, 0)', '(98.7654321, 0)', '(987.654321, 0)', '(9876.54321, 0)', '(98765.4321, 0)', '(987654.321, 0)', '(9876543.21, 0)', '(98765432.1, 0)', '(987654321, 0)']\n assert candidate(s = \"(1230000000)\") == ['(1, 230000000)', '(1.2, 30000000)', '(12, 30000000)', '(123000000, 0)']\n assert candidate(s = \"(0123456789)\") == ['(0, 1.23456789)', '(0, 12.3456789)', '(0, 123.456789)', '(0, 1234.56789)', '(0, 12345.6789)', '(0, 123456.789)', '(0, 1234567.89)', '(0, 12345678.9)', '(0, 123456789)', '(0.1, 2.3456789)', '(0.1, 23.456789)', '(0.1, 234.56789)', '(0.1, 2345.6789)', '(0.1, 23456.789)', '(0.1, 234567.89)', '(0.1, 2345678.9)', '(0.1, 23456789)', '(0.12, 3.456789)', '(0.12, 34.56789)', '(0.12, 345.6789)', '(0.12, 3456.789)', '(0.12, 34567.89)', '(0.12, 345678.9)', '(0.12, 3456789)', '(0.123, 4.56789)', '(0.123, 45.6789)', '(0.123, 456.789)', '(0.123, 4567.89)', '(0.123, 45678.9)', '(0.123, 456789)', '(0.1234, 5.6789)', '(0.1234, 56.789)', '(0.1234, 567.89)', '(0.1234, 5678.9)', '(0.1234, 56789)', '(0.12345, 6.789)', '(0.12345, 67.89)', '(0.12345, 678.9)', '(0.12345, 6789)', '(0.123456, 7.89)', '(0.123456, 78.9)', '(0.123456, 789)', '(0.1234567, 8.9)', '(0.1234567, 89)', '(0.12345678, 9)']\n assert candidate(s = \"(010010)\") == ['(0, 10010)', '(0.1001, 0)']\n assert candidate(s = \"(0001230456)\") == ['(0, 0.01230456)', '(0.001, 2.30456)', '(0.001, 23.0456)', '(0.001, 230.456)', '(0.001, 2304.56)', '(0.001, 23045.6)', '(0.001, 230456)', '(0.0012, 3.0456)', '(0.0012, 30.456)', '(0.0012, 304.56)', '(0.0012, 3045.6)', '(0.0012, 30456)', '(0.00123, 0.456)', '(0.0012304, 5.6)', '(0.0012304, 56)', '(0.00123045, 6)']\n assert candidate(s = \"(0000123450000)\") == ['(0.0001, 23450000)', '(0.00012, 3450000)', '(0.000123, 450000)', '(0.0001234, 50000)']\n assert candidate(s = \"(010010010010)\") == ['(0, 10010010010)', '(0.1001001001, 0)']\n assert candidate(s = \"(0101010)\") == ['(0, 101010)', '(0.10101, 0)']\n assert candidate(s = \"(123400001234)\") == ['(1, 2.3400001234)', '(1, 23.400001234)', '(1, 234.00001234)', '(1, 2340.0001234)', '(1, 23400.001234)', '(1, 234000.01234)', '(1, 2340000.1234)', '(1, 23400001.234)', '(1, 234000012.34)', '(1, 2340000123.4)', '(1, 23400001234)', '(1.2, 3.400001234)', '(1.2, 34.00001234)', '(1.2, 340.0001234)', '(1.2, 3400.001234)', '(1.2, 34000.01234)', '(1.2, 340000.1234)', '(1.2, 3400001.234)', '(1.2, 34000012.34)', '(1.2, 340000123.4)', '(1.2, 3400001234)', '(12, 3.400001234)', '(12, 34.00001234)', '(12, 340.0001234)', '(12, 3400.001234)', '(12, 34000.01234)', '(12, 340000.1234)', '(12, 3400001.234)', '(12, 34000012.34)', '(12, 340000123.4)', '(12, 3400001234)', '(1.23, 4.00001234)', '(1.23, 40.0001234)', '(1.23, 400.001234)', '(1.23, 4000.01234)', '(1.23, 40000.1234)', '(1.23, 400001.234)', '(1.23, 4000012.34)', '(1.23, 40000123.4)', '(1.23, 400001234)', '(12.3, 4.00001234)', '(12.3, 40.0001234)', '(12.3, 400.001234)', '(12.3, 4000.01234)', '(12.3, 40000.1234)', '(12.3, 400001.234)', '(12.3, 4000012.34)', '(12.3, 40000123.4)', '(12.3, 400001234)', '(123, 4.00001234)', '(123, 40.0001234)', '(123, 400.001234)', '(123, 4000.01234)', '(123, 40000.1234)', '(123, 400001.234)', '(123, 4000012.34)', '(123, 40000123.4)', '(123, 400001234)', '(1.234, 0.0001234)', '(12.34, 0.0001234)', '(123.4, 0.0001234)', '(1234, 0.0001234)', '(12340, 0.001234)', '(123400, 0.01234)', '(1234000, 0.1234)', '(12340000, 1.234)', '(12340000, 12.34)', '(12340000, 123.4)', '(12340000, 1234)', '(1.23400001, 2.34)', '(1.23400001, 23.4)', '(1.23400001, 234)', '(12.3400001, 2.34)', '(12.3400001, 23.4)', '(12.3400001, 234)', '(123.400001, 2.34)', '(123.400001, 23.4)', '(123.400001, 234)', '(1234.00001, 2.34)', '(1234.00001, 23.4)', '(1234.00001, 234)', '(12340.0001, 2.34)', '(12340.0001, 23.4)', '(12340.0001, 234)', '(123400.001, 2.34)', '(123400.001, 23.4)', '(123400.001, 234)', '(1234000.01, 2.34)', '(1234000.01, 23.4)', '(1234000.01, 234)', '(12340000.1, 2.34)', '(12340000.1, 23.4)', '(12340000.1, 234)', '(123400001, 2.34)', '(123400001, 23.4)', '(123400001, 234)', '(1.234000012, 3.4)', '(1.234000012, 34)', '(12.34000012, 3.4)', '(12.34000012, 34)', '(123.4000012, 3.4)', '(123.4000012, 34)', '(1234.000012, 3.4)', '(1234.000012, 34)', '(12340.00012, 3.4)', '(12340.00012, 34)', '(123400.0012, 3.4)', '(123400.0012, 34)', '(1234000.012, 3.4)', '(1234000.012, 34)', '(12340000.12, 3.4)', '(12340000.12, 34)', '(123400001.2, 3.4)', '(123400001.2, 34)', '(1234000012, 3.4)', '(1234000012, 34)', '(1.2340000123, 4)', '(12.340000123, 4)', '(123.40000123, 4)', '(1234.0000123, 4)', '(12340.000123, 4)', '(123400.00123, 4)', '(1234000.0123, 4)', '(12340000.123, 4)', '(123400001.23, 4)', '(1234000012.3, 4)', '(12340000123, 4)']\n assert candidate(s = \"(123450000)\") == ['(1, 23450000)', '(1.2, 3450000)', '(12, 3450000)', '(1.23, 450000)', '(12.3, 450000)', '(123, 450000)', '(1.234, 50000)', '(12.34, 50000)', '(123.4, 50000)', '(1234, 50000)', '(12345000, 0)']\n assert candidate(s = \"(1230000)\") == ['(1, 230000)', '(1.2, 30000)', '(12, 30000)', '(123000, 0)']\n assert candidate(s = \"(1001001001)\") == ['(1, 0.01001001)', '(10, 0.1001001)', '(100, 1.001001)', '(100, 10.01001)', '(100, 100.1001)', '(100, 1001.001)', '(100, 10010.01)', '(100, 100100.1)', '(100, 1001001)', '(1.001, 0.01001)', '(10.01, 0.01001)', '(100.1, 0.01001)', '(1001, 0.01001)', '(10010, 0.1001)', '(100100, 1.001)', '(100100, 10.01)', '(100100, 100.1)', '(100100, 1001)', '(1.001001, 0.01)', '(10.01001, 0.01)', '(100.1001, 0.01)', '(1001.001, 0.01)', '(10010.01, 0.01)', '(100100.1, 0.01)', '(1001001, 0.01)', '(10010010, 0.1)', '(100100100, 1)']\n assert candidate(s = \"(100010100)\") == ['(1000, 10100)', '(100010, 100)', '(10001010, 0)']\n assert candidate(s = \"(123456789)\") == ['(1, 2.3456789)', '(1, 23.456789)', '(1, 234.56789)', '(1, 2345.6789)', '(1, 23456.789)', '(1, 234567.89)', '(1, 2345678.9)', '(1, 23456789)', '(1.2, 3.456789)', '(1.2, 34.56789)', '(1.2, 345.6789)', '(1.2, 3456.789)', '(1.2, 34567.89)', '(1.2, 345678.9)', '(1.2, 3456789)', '(12, 3.456789)', '(12, 34.56789)', '(12, 345.6789)', '(12, 3456.789)', '(12, 34567.89)', '(12, 345678.9)', '(12, 3456789)', '(1.23, 4.56789)', '(1.23, 45.6789)', '(1.23, 456.789)', '(1.23, 4567.89)', '(1.23, 45678.9)', '(1.23, 456789)', '(12.3, 4.56789)', '(12.3, 45.6789)', '(12.3, 456.789)', '(12.3, 4567.89)', '(12.3, 45678.9)', '(12.3, 456789)', '(123, 4.56789)', '(123, 45.6789)', '(123, 456.789)', '(123, 4567.89)', '(123, 45678.9)', '(123, 456789)', '(1.234, 5.6789)', '(1.234, 56.789)', '(1.234, 567.89)', '(1.234, 5678.9)', '(1.234, 56789)', '(12.34, 5.6789)', '(12.34, 56.789)', '(12.34, 567.89)', '(12.34, 5678.9)', '(12.34, 56789)', '(123.4, 5.6789)', '(123.4, 56.789)', '(123.4, 567.89)', '(123.4, 5678.9)', '(123.4, 56789)', '(1234, 5.6789)', '(1234, 56.789)', '(1234, 567.89)', '(1234, 5678.9)', '(1234, 56789)', '(1.2345, 6.789)', '(1.2345, 67.89)', '(1.2345, 678.9)', '(1.2345, 6789)', '(12.345, 6.789)', '(12.345, 67.89)', '(12.345, 678.9)', '(12.345, 6789)', '(123.45, 6.789)', '(123.45, 67.89)', '(123.45, 678.9)', '(123.45, 6789)', '(1234.5, 6.789)', '(1234.5, 67.89)', '(1234.5, 678.9)', '(1234.5, 6789)', '(12345, 6.789)', '(12345, 67.89)', '(12345, 678.9)', '(12345, 6789)', '(1.23456, 7.89)', '(1.23456, 78.9)', '(1.23456, 789)', '(12.3456, 7.89)', '(12.3456, 78.9)', '(12.3456, 789)', '(123.456, 7.89)', '(123.456, 78.9)', '(123.456, 789)', '(1234.56, 7.89)', '(1234.56, 78.9)', '(1234.56, 789)', '(12345.6, 7.89)', '(12345.6, 78.9)', '(12345.6, 789)', '(123456, 7.89)', '(123456, 78.9)', '(123456, 789)', '(1.234567, 8.9)', '(1.234567, 89)', '(12.34567, 8.9)', '(12.34567, 89)', '(123.4567, 8.9)', '(123.4567, 89)', '(1234.567, 8.9)', '(1234.567, 89)', '(12345.67, 8.9)', '(12345.67, 89)', '(123456.7, 8.9)', '(123456.7, 89)', '(1234567, 8.9)', '(1234567, 89)', '(1.2345678, 9)', '(12.345678, 9)', '(123.45678, 9)', '(1234.5678, 9)', '(12345.678, 9)', '(123456.78, 9)', '(1234567.8, 9)', '(12345678, 9)']\n assert candidate(s = \"(001001001)\") == ['(0, 0.1001001)', '(0.01, 0.01001)', '(0.01001, 0.01)']\n assert candidate(s = \"(001234)\") == ['(0, 0.1234)', '(0.01, 2.34)', '(0.01, 23.4)', '(0.01, 234)', '(0.012, 3.4)', '(0.012, 34)', '(0.0123, 4)']\n assert candidate(s = \"(1230456)\") == ['(1, 2.30456)', '(1, 23.0456)', '(1, 230.456)', '(1, 2304.56)', '(1, 23045.6)', '(1, 230456)', '(1.2, 3.0456)', '(1.2, 30.456)', '(1.2, 304.56)', '(1.2, 3045.6)', '(1.2, 30456)', '(12, 3.0456)', '(12, 30.456)', '(12, 304.56)', '(12, 3045.6)', '(12, 30456)', '(1.23, 0.456)', '(12.3, 0.456)', '(123, 0.456)', '(1230, 4.56)', '(1230, 45.6)', '(1230, 456)', '(1.2304, 5.6)', '(1.2304, 56)', '(12.304, 5.6)', '(12.304, 56)', '(123.04, 5.6)', '(123.04, 56)', '(1230.4, 5.6)', '(1230.4, 56)', '(12304, 5.6)', '(12304, 56)', '(1.23045, 6)', '(12.3045, 6)', '(123.045, 6)', '(1230.45, 6)', '(12304.5, 6)', '(123045, 6)']\n assert candidate(s = \"(1001001)\") == ['(1, 0.01001)', '(10, 0.1001)', '(100, 1.001)', '(100, 10.01)', '(100, 100.1)', '(100, 1001)', '(1.001, 0.01)', '(10.01, 0.01)', '(100.1, 0.01)', '(1001, 0.01)', '(10010, 0.1)', '(100100, 1)']\n assert candidate(s = \"(101010)\") == ['(10, 1010)', '(1010, 10)', '(1.0101, 0)', '(10.101, 0)', '(101.01, 0)', '(1010.1, 0)', '(10101, 0)']\n assert candidate(s = \"(1111111)\") == ['(1, 1.11111)', '(1, 11.1111)', '(1, 111.111)', '(1, 1111.11)', '(1, 11111.1)', '(1, 111111)', '(1.1, 1.1111)', '(1.1, 11.111)', '(1.1, 111.11)', '(1.1, 1111.1)', '(1.1, 11111)', '(11, 1.1111)', '(11, 11.111)', '(11, 111.11)', '(11, 1111.1)', '(11, 11111)', '(1.11, 1.111)', '(1.11, 11.11)', '(1.11, 111.1)', '(1.11, 1111)', '(11.1, 1.111)', '(11.1, 11.11)', '(11.1, 111.1)', '(11.1, 1111)', '(111, 1.111)', '(111, 11.11)', '(111, 111.1)', '(111, 1111)', '(1.111, 1.11)', '(1.111, 11.1)', '(1.111, 111)', '(11.11, 1.11)', '(11.11, 11.1)', '(11.11, 111)', '(111.1, 1.11)', '(111.1, 11.1)', '(111.1, 111)', '(1111, 1.11)', '(1111, 11.1)', '(1111, 111)', '(1.1111, 1.1)', '(1.1111, 11)', '(11.111, 1.1)', '(11.111, 11)', '(111.11, 1.1)', '(111.11, 11)', '(1111.1, 1.1)', '(1111.1, 11)', '(11111, 1.1)', '(11111, 11)', '(1.11111, 1)', '(11.1111, 1)', '(111.111, 1)', '(1111.11, 1)', '(11111.1, 1)', '(111111, 1)']\n assert candidate(s = \"(111111111111)\") == ['(1, 1.1111111111)', '(1, 11.111111111)', '(1, 111.11111111)', '(1, 1111.1111111)', '(1, 11111.111111)', '(1, 111111.11111)', '(1, 1111111.1111)', '(1, 11111111.111)', '(1, 111111111.11)', '(1, 1111111111.1)', '(1, 11111111111)', '(1.1, 1.111111111)', '(1.1, 11.11111111)', '(1.1, 111.1111111)', '(1.1, 1111.111111)', '(1.1, 11111.11111)', '(1.1, 111111.1111)', '(1.1, 1111111.111)', '(1.1, 11111111.11)', '(1.1, 111111111.1)', '(1.1, 1111111111)', '(11, 1.111111111)', '(11, 11.11111111)', '(11, 111.1111111)', '(11, 1111.111111)', '(11, 11111.11111)', '(11, 111111.1111)', '(11, 1111111.111)', '(11, 11111111.11)', '(11, 111111111.1)', '(11, 1111111111)', '(1.11, 1.11111111)', '(1.11, 11.1111111)', '(1.11, 111.111111)', '(1.11, 1111.11111)', '(1.11, 11111.1111)', '(1.11, 111111.111)', '(1.11, 1111111.11)', '(1.11, 11111111.1)', '(1.11, 111111111)', '(11.1, 1.11111111)', '(11.1, 11.1111111)', '(11.1, 111.111111)', '(11.1, 1111.11111)', '(11.1, 11111.1111)', '(11.1, 111111.111)', '(11.1, 1111111.11)', '(11.1, 11111111.1)', '(11.1, 111111111)', '(111, 1.11111111)', '(111, 11.1111111)', '(111, 111.111111)', '(111, 1111.11111)', '(111, 11111.1111)', '(111, 111111.111)', '(111, 1111111.11)', '(111, 11111111.1)', '(111, 111111111)', '(1.111, 1.1111111)', '(1.111, 11.111111)', '(1.111, 111.11111)', '(1.111, 1111.1111)', '(1.111, 11111.111)', '(1.111, 111111.11)', '(1.111, 1111111.1)', '(1.111, 11111111)', '(11.11, 1.1111111)', '(11.11, 11.111111)', '(11.11, 111.11111)', '(11.11, 1111.1111)', '(11.11, 11111.111)', '(11.11, 111111.11)', '(11.11, 1111111.1)', '(11.11, 11111111)', '(111.1, 1.1111111)', '(111.1, 11.111111)', '(111.1, 111.11111)', '(111.1, 1111.1111)', '(111.1, 11111.111)', '(111.1, 111111.11)', '(111.1, 1111111.1)', '(111.1, 11111111)', '(1111, 1.1111111)', '(1111, 11.111111)', '(1111, 111.11111)', '(1111, 1111.1111)', '(1111, 11111.111)', '(1111, 111111.11)', '(1111, 1111111.1)', '(1111, 11111111)', '(1.1111, 1.111111)', '(1.1111, 11.11111)', '(1.1111, 111.1111)', '(1.1111, 1111.111)', '(1.1111, 11111.11)', '(1.1111, 111111.1)', '(1.1111, 1111111)', '(11.111, 1.111111)', '(11.111, 11.11111)', '(11.111, 111.1111)', '(11.111, 1111.111)', '(11.111, 11111.11)', '(11.111, 111111.1)', '(11.111, 1111111)', '(111.11, 1.111111)', '(111.11, 11.11111)', '(111.11, 111.1111)', '(111.11, 1111.111)', '(111.11, 11111.11)', '(111.11, 111111.1)', '(111.11, 1111111)', '(1111.1, 1.111111)', '(1111.1, 11.11111)', '(1111.1, 111.1111)', '(1111.1, 1111.111)', '(1111.1, 11111.11)', '(1111.1, 111111.1)', '(1111.1, 1111111)', '(11111, 1.111111)', '(11111, 11.11111)', '(11111, 111.1111)', '(11111, 1111.111)', '(11111, 11111.11)', '(11111, 111111.1)', '(11111, 1111111)', '(1.11111, 1.11111)', '(1.11111, 11.1111)', '(1.11111, 111.111)', '(1.11111, 1111.11)', '(1.11111, 11111.1)', '(1.11111, 111111)', '(11.1111, 1.11111)', '(11.1111, 11.1111)', '(11.1111, 111.111)', '(11.1111, 1111.11)', '(11.1111, 11111.1)', '(11.1111, 111111)', '(111.111, 1.11111)', '(111.111, 11.1111)', '(111.111, 111.111)', '(111.111, 1111.11)', '(111.111, 11111.1)', '(111.111, 111111)', '(1111.11, 1.11111)', '(1111.11, 11.1111)', '(1111.11, 111.111)', '(1111.11, 1111.11)', '(1111.11, 11111.1)', '(1111.11, 111111)', '(11111.1, 1.11111)', '(11111.1, 11.1111)', '(11111.1, 111.111)', '(11111.1, 1111.11)', '(11111.1, 11111.1)', '(11111.1, 111111)', '(111111, 1.11111)', '(111111, 11.1111)', '(111111, 111.111)', '(111111, 1111.11)', '(111111, 11111.1)', '(111111, 111111)', '(1.111111, 1.1111)', '(1.111111, 11.111)', '(1.111111, 111.11)', '(1.111111, 1111.1)', '(1.111111, 11111)', '(11.11111, 1.1111)', '(11.11111, 11.111)', '(11.11111, 111.11)', '(11.11111, 1111.1)', '(11.11111, 11111)', '(111.1111, 1.1111)', '(111.1111, 11.111)', '(111.1111, 111.11)', '(111.1111, 1111.1)', '(111.1111, 11111)', '(1111.111, 1.1111)', '(1111.111, 11.111)', '(1111.111, 111.11)', '(1111.111, 1111.1)', '(1111.111, 11111)', '(11111.11, 1.1111)', '(11111.11, 11.111)', '(11111.11, 111.11)', '(11111.11, 1111.1)', '(11111.11, 11111)', '(111111.1, 1.1111)', '(111111.1, 11.111)', '(111111.1, 111.11)', '(111111.1, 1111.1)', '(111111.1, 11111)', '(1111111, 1.1111)', '(1111111, 11.111)', '(1111111, 111.11)', '(1111111, 1111.1)', '(1111111, 11111)', '(1.1111111, 1.111)', '(1.1111111, 11.11)', '(1.1111111, 111.1)', '(1.1111111, 1111)', '(11.111111, 1.111)', '(11.111111, 11.11)', '(11.111111, 111.1)', '(11.111111, 1111)', '(111.11111, 1.111)', '(111.11111, 11.11)', '(111.11111, 111.1)', '(111.11111, 1111)', '(1111.1111, 1.111)', '(1111.1111, 11.11)', '(1111.1111, 111.1)', '(1111.1111, 1111)', '(11111.111, 1.111)', '(11111.111, 11.11)', '(11111.111, 111.1)', '(11111.111, 1111)', '(111111.11, 1.111)', '(111111.11, 11.11)', '(111111.11, 111.1)', '(111111.11, 1111)', '(1111111.1, 1.111)', '(1111111.1, 11.11)', '(1111111.1, 111.1)', '(1111111.1, 1111)', '(11111111, 1.111)', '(11111111, 11.11)', '(11111111, 111.1)', '(11111111, 1111)', '(1.11111111, 1.11)', '(1.11111111, 11.1)', '(1.11111111, 111)', '(11.1111111, 1.11)', '(11.1111111, 11.1)', '(11.1111111, 111)', '(111.111111, 1.11)', '(111.111111, 11.1)', '(111.111111, 111)', '(1111.11111, 1.11)', '(1111.11111, 11.1)', '(1111.11111, 111)', '(11111.1111, 1.11)', '(11111.1111, 11.1)', '(11111.1111, 111)', '(111111.111, 1.11)', '(111111.111, 11.1)', '(111111.111, 111)', '(1111111.11, 1.11)', '(1111111.11, 11.1)', '(1111111.11, 111)', '(11111111.1, 1.11)', '(11111111.1, 11.1)', '(11111111.1, 111)', '(111111111, 1.11)', '(111111111, 11.1)', '(111111111, 111)', '(1.111111111, 1.1)', '(1.111111111, 11)', '(11.11111111, 1.1)', '(11.11111111, 11)', '(111.1111111, 1.1)', '(111.1111111, 11)', '(1111.111111, 1.1)', '(1111.111111, 11)', '(11111.11111, 1.1)', '(11111.11111, 11)', '(111111.1111, 1.1)', '(111111.1111, 11)', '(1111111.111, 1.1)', '(1111111.111, 11)', '(11111111.11, 1.1)', '(11111111.11, 11)', '(111111111.1, 1.1)', '(111111111.1, 11)', '(1111111111, 1.1)', '(1111111111, 11)', '(1.1111111111, 1)', '(11.111111111, 1)', '(111.11111111, 1)', '(1111.1111111, 1)', '(11111.111111, 1)', '(111111.11111, 1)', '(1111111.1111, 1)', '(11111111.111, 1)', '(111111111.11, 1)', '(1111111111.1, 1)', '(11111111111, 1)']\n assert candidate(s = \"(123000)\") == ['(1, 23000)', '(1.2, 3000)', '(12, 3000)', '(12300, 0)']\n assert candidate(s = \"(1000000000)\") == ['(100000000, 0)']\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().ambiguousCoordinates", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var ambiguousCoordinates = function(s) {", "container": null, "callable": "ambiguousCoordinates", "parameters": [{"name": "s", "type": "string"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 817, "task_id": "linked-list-components", "difficulty": "Medium", "problem_description": "You are given the head of a linked list containing unique integer values and an integer array nums that is a subset of the linked list values.\nReturn the number of connected components in nums where two values are connected if they appear consecutively in the linked list.\n \nExample 1:\n\n\nInput: head = [0,1,2,3], nums = [0,1,3]\nOutput: 2\nExplanation: 0 and 1 are connected, so [0, 1] and [3] are the two connected components.\n\nExample 2:\n\n\nInput: head = [0,1,2,3,4], nums = [0,3,1,4]\nOutput: 2\nExplanation: 0 and 1 are connected, 3 and 4 are connected, so [0, 1] and [3, 4] are the two connected components.\n\n \nConstraints:\n\nThe number of nodes in the linked list is n.\n1 <= n <= 104\n0 <= Node.val < n\nAll the values Node.val are unique.\n1 <= nums.length <= n\n0 <= nums[i] < n\nAll the values of nums are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),nums = [2, 4, 6, 8, 10]) == 5\n assert candidate(head = list_node([4, 3, 0, 1, 2]),nums = [0, 1, 2]) == 1\n assert candidate(head = list_node([5, 6, 7, 8, 9]),nums = [6, 7]) == 1\n assert candidate(head = list_node([4, 3, 2, 1]),nums = [1, 2]) == 1\n assert candidate(head = list_node([5, 6, 7, 8, 9]),nums = [5, 9]) == 2\n assert candidate(head = list_node([10, 20, 30, 40]),nums = [10, 40]) == 2\n assert candidate(head = list_node([9, 8, 7, 6, 5, 4, 3, 2, 1, 0]),nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(head = list_node([0]),nums = [0]) == 1\n assert candidate(head = list_node([1, 2, 3, 4, 5]),nums = [2, 3, 5]) == 2\n assert candidate(head = list_node([0, 1, 2, 3, 4]),nums = [0, 3, 1, 4]) == 2\n assert candidate(head = list_node([0, 2, 1, 3]),nums = [0, 1]) == 2\n assert candidate(head = list_node([7, 10, 1, 12, 3, 9, 6, 11, 4, 8, 2, 5]),nums = [10, 3, 5, 7, 4, 1]) == 4\n assert candidate(head = list_node([5, 6, 7, 8]),nums = [6, 7]) == 1\n assert candidate(head = list_node([0, 1, 2, 3]),nums = [0, 1, 3]) == 2\n assert candidate(head = list_node([1, 0, 2, 3, 4, 5]),nums = [0, 1, 3, 5]) == 3\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9]),nums = [1, 2, 3, 4, 5]) == 1\n assert candidate(head = list_node([4, 7, 1, 13, 8, 9, 2]),nums = [1, 13, 9, 8, 2]) == 1\n assert candidate(head = list_node([7, 10, 1, 12, 3, 9, 5, 8, 4, 6, 2, 11]),nums = [1, 3, 5, 7, 9, 11]) == 4\n assert candidate(head = list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]),nums = [6, 7, 8, 9, 10]) == 1\n assert candidate(head = list_node([3, 5, 7, 9, 11, 13, 15, 17, 19, 21]),nums = [5, 9, 13, 17, 21]) == 5\n assert candidate(head = list_node([2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 0, 11, 12, 13, 14, 15]),nums = [2, 4, 6, 8, 10, 1, 11, 13, 15]) == 8\n assert candidate(head = list_node([1, 2, 0, 3, 4, 5, 6, 7, 8, 9]),nums = [1, 2, 4, 7, 8]) == 3\n assert candidate(head = list_node([5, 4, 3, 2, 1]),nums = [3, 2, 1]) == 1\n assert candidate(head = list_node([1, 4, 3, 2, 5, 6, 7, 8, 9, 0]),nums = [2, 3, 1, 4]) == 1\n assert candidate(head = list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]),nums = [0, 2, 4, 6, 8, 10]) == 6\n assert candidate(head = list_node([5, 6, 7, 8, 9, 10, 11, 12]),nums = [6, 7, 9, 10, 12]) == 3\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),nums = [1, 2, 5, 6, 9, 10]) == 3\n assert candidate(head = list_node([10, 11, 12, 13, 14, 15, 16, 17, 18, 19]),nums = [10, 12, 14, 16, 18]) == 5\n assert candidate(head = list_node([0, 1, 3, 2, 5, 6, 7, 4, 8, 9]),nums = [3, 2, 4, 8, 9]) == 2\n assert candidate(head = list_node([1, 4, 3, 2, 5]),nums = [1, 3, 5]) == 3\n assert candidate(head = list_node([100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80]),nums = [80, 82, 84, 86, 88, 90, 92, 94, 96, 98]) == 10\n assert candidate(head = list_node([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38]),nums = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38]) == 1\n assert candidate(head = list_node([5, 1, 2, 3, 4, 6, 7, 8, 9]),nums = [1, 2, 6, 7, 9]) == 3\n assert candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15]),nums = [1, 5, 9, 15]) == 4\n assert candidate(head = list_node([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]),nums = [10, 30, 50, 70, 90, 110, 130, 150]) == 8\n assert candidate(head = list_node([1, 4, 2, 5, 3, 6, 7, 8, 9]),nums = [1, 3, 5, 7]) == 3\n assert candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41]),nums = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41]) == 11\n assert candidate(head = list_node([0, 2, 4, 6, 8, 10, 12, 14, 16]),nums = [1, 3, 5, 7, 9, 11, 13, 15]) == 0\n assert candidate(head = list_node([23, 45, 67, 89, 101, 123, 145, 167, 189, 211]),nums = [23, 45, 67, 89, 101, 123, 145, 167, 189, 211]) == 1\n assert candidate(head = list_node([0, 2, 1, 4, 3, 5]),nums = [3, 4, 5]) == 1\n assert candidate(head = list_node([3, 2, 1, 0, 5, 4, 7, 8, 6, 9]),nums = [3, 2, 1, 0, 5, 4, 7, 8, 6, 9]) == 1\n assert candidate(head = list_node([2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]),nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == 1\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]),nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]) == 25\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),nums = [1, 4, 7, 10, 13, 16, 19]) == 7\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),nums = [1, 2, 5, 6, 9]) == 3\n assert candidate(head = list_node([5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 11, 10, 15, 14, 13, 12]),nums = [5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 11, 10, 15, 14, 13, 12]) == 1\n assert candidate(head = list_node([100, 200, 300, 400, 500, 600, 700]),nums = [100, 300, 500, 700]) == 4\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),nums = [1, 3, 5, 7, 9]) == 5\n assert candidate(head = list_node([10, 20, 30, 40, 50, 60]),nums = [10, 30, 50]) == 3\n assert candidate(head = list_node([3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9]),nums = [3, 1, 4, 1, 5, 9, 2, 6, 5]) == 1\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),nums = [1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20]) == 7\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),nums = [1, 2, 4, 5, 7, 8, 10, 11, 13, 14]) == 5\n assert candidate(head = list_node([0, 2, 1, 4, 3, 5, 6, 7]),nums = [0, 2, 4, 6]) == 3\n assert candidate(head = list_node([2, 4, 6, 8, 10, 12, 14, 16, 18, 20]),nums = [2, 6, 10, 14, 18]) == 5\n assert candidate(head = list_node([2, 3, 5, 7, 11, 13, 17, 19, 23, 29]),nums = [2, 3, 11, 13, 17, 23, 29]) == 3\n assert candidate(head = list_node([5, 3, 9, 6, 1, 12, 7, 2, 4, 8, 11, 10]),nums = [3, 6, 7, 8, 10]) == 5\n assert candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]),nums = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49]) == 13\n assert candidate(head = list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]),nums = [10, 8, 6, 4, 2]) == 5\n assert candidate(head = list_node([1, 5, 6, 3, 2, 7, 4, 0, 9]),nums = [1, 3, 0, 9]) == 3\n assert candidate(head = list_node([1, 4, 6, 8, 9, 10, 11, 12, 13, 15, 17, 19]),nums = [4, 6, 8, 9, 11, 12, 15, 17]) == 3\n assert candidate(head = list_node([3, 0, 2, 8, 1, 5, 7, 4, 6]),nums = [2, 8, 0, 6, 4]) == 2\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]),nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 1\n assert candidate(head = list_node([10, 20, 30, 40, 50, 60, 70, 80, 90, 100]),nums = [30, 40, 60, 80, 100]) == 4\n assert candidate(head = list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]),nums = [1, 2, 4, 6, 8, 10]) == 5\n assert candidate(head = list_node([29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10]),nums = [29, 27, 25, 23, 21, 19, 17, 15, 13, 11]) == 10\n assert candidate(head = list_node([100, 90, 80, 70, 60, 50, 40, 30, 20, 10]),nums = [100, 90, 80, 60, 50, 30, 10]) == 4\n assert candidate(head = list_node([10, 20, 30, 40, 50, 60, 70, 80, 90]),nums = [10, 20, 40, 60, 80]) == 4\n assert candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]),nums = [1, 5, 9, 13, 17, 21, 25, 29]) == 8\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),nums = [1, 3, 5, 7, 9, 11, 13, 15]) == 8\n assert candidate(head = list_node([50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30]),nums = [30, 32, 34, 36, 38, 40, 42, 44, 46, 48]) == 10\n assert candidate(head = list_node([0, 2, 4, 6, 8, 10, 12, 14, 16, 18]),nums = [0, 4, 8, 12, 16]) == 5\n assert candidate(head = list_node([15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]),nums = [0, 2, 4, 6, 8, 10, 12, 14]) == 8\n assert candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]),nums = [1, 7, 13, 19, 25, 29]) == 6\n assert candidate(head = list_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]),nums = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == 16\n assert candidate(head = list_node([1, 5, 4, 3, 2, 6, 7, 8, 9, 10]),nums = [1, 3, 5, 7, 9]) == 4\n assert candidate(head = list_node([5, 4, 3, 2, 1, 0, 11, 12, 13, 14]),nums = [5, 4, 3, 11, 12]) == 2\n assert candidate(head = list_node([100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]),nums = [100, 300, 500, 700, 900]) == 5\n assert candidate(head = list_node([15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]),nums = [15, 13, 11, 9, 7, 5, 3, 1]) == 8\n assert candidate(head = list_node([5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]),nums = [5, 4, 3, -1, -2, -4, -5]) == 3\n assert candidate(head = list_node([9, 7, 5, 3, 1, 2, 4, 6, 8, 0]),nums = [9, 7, 5, 3, 1, 8, 0]) == 2\n assert candidate(head = list_node([2, 6, 5, 4, 3, 0, 7, 1, 8, 9]),nums = [2, 4, 7, 8, 9]) == 4\n assert candidate(head = list_node([5, 6, 2, 3, 4, 1, 7, 8]),nums = [2, 3, 4, 7, 8]) == 2\n assert candidate(head = list_node([2, 4, 6, 8, 10, 12, 14, 16, 18, 20]),nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 1\n assert candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19]),nums = [3, 5, 7, 9, 11, 13, 15, 17, 19]) == 1\n assert candidate(head = list_node([5, 4, 3, 2, 1, 0]),nums = [0, 1, 2, 3, 4, 5]) == 1\n assert candidate(head = list_node([5, 10, 15, 20, 25, 30, 35, 40, 45]),nums = [5, 20, 35, 50]) == 3\n assert candidate(head = list_node([3, 5, 7, 9, 11, 13, 15, 17, 19]),nums = [3, 7, 11, 15, 19]) == 5\n assert candidate(head = list_node([10, 20, 30, 40, 50, 60, 70, 80, 90, 100]),nums = [10, 20, 30, 50, 60, 80, 100]) == 4\n assert candidate(head = list_node([1, 4, 2, 3, 5, 7, 6, 8, 9]),nums = [1, 2, 3, 6, 8, 9]) == 3\n assert candidate(head = list_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),nums = [0, 2, 4, 6, 8, 10, 12, 14]) == 8\n assert candidate(head = list_node([1, 11, 21, 31, 41, 51, 61, 71, 81, 91]),nums = [11, 31, 51, 71, 91]) == 5\n assert candidate(head = list_node([0, 2, 4, 6, 8, 10, 12, 14, 16, 18]),nums = [2, 4, 6, 8, 10, 12, 14, 16, 18]) == 1\n assert candidate(head = list_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]),nums = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]) == 10\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9]),nums = [1, 3, 5, 7, 9]) == 5\n assert candidate(head = list_node([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]),nums = [0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40]) == 11\n assert candidate(head = list_node([4, 2, 8, 6, 9, 7, 3, 0, 5, 1]),nums = [3, 0, 5, 1, 6, 7, 9]) == 1\n assert candidate(head = list_node([0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13]),nums = [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13]) == 1\n assert candidate(head = list_node([9, 7, 5, 3, 1, 2, 4, 6, 8]),nums = [9, 7, 5, 3, 1, 4, 6, 8]) == 2\n assert candidate(head = list_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]),nums = [0, 2, 4, 6, 8]) == 5\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]),nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48]) == 24\n assert candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19]),nums = [1, 5, 9, 13, 17]) == 5\n assert candidate(head = list_node([5, 1, 3, 7, 9, 11, 13, 15, 17, 19]),nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 1\n assert candidate(head = list_node([1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]),nums = [1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]) == 1\n assert candidate(head = list_node([4, 5, 6, 7, 8, 9, 0, 1, 2, 3]),nums = [7, 8, 9, 0, 1]) == 1\n assert candidate(head = list_node([10, 20, 30, 40, 50, 60, 70, 80, 90]),nums = [10, 30, 50, 70, 90]) == 5\n assert candidate(head = list_node([7, 3, 6, 4, 5, 1, 2, 0, 8, 9]),nums = [3, 6, 5, 1, 2, 8, 9]) == 3\n"}, "metadata": {"canonical_parameter_names": ["head", "nums"], "leetcode_dataset_entry_point": "Solution().numComponents", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numComponents = function(head, nums) {", "container": null, "callable": "numComponents", "parameters": [{"name": "head", "type": "ListNode"}, {"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 818, "task_id": "race-car", "difficulty": "Hard", "problem_description": "Your car starts at position 0 and speed +1 on an infinite number line. Your car can go into negative positions. Your car drives automatically according to a sequence of instructions 'A' (accelerate) and 'R' (reverse):\n\nWhen you get an instruction 'A', your car does the following:\n\n\t\nposition += speed\nspeed *= 2\n\n\nWhen you get an instruction 'R', your car does the following:\n\t\nIf your speed is positive then speed = -1\notherwise speed = 1\n\n\tYour position stays the same.\n\nFor example, after commands \"AAR\", your car goes to positions 0 --> 1 --> 3 --> 3, and your speed goes to 1 --> 2 --> 4 --> -1.\nGiven a target position target, return the length of the shortest sequence of instructions to get there.\n \nExample 1:\n\nInput: target = 3\nOutput: 2\nExplanation: \nThe shortest instruction sequence is \"AA\".\nYour position goes from 0 --> 1 --> 3.\n\nExample 2:\n\nInput: target = 6\nOutput: 5\nExplanation: \nThe shortest instruction sequence is \"AAARA\".\nYour position goes from 0 --> 1 --> 3 --> 7 --> 7 --> 6.\n\n \nConstraints:\n\n1 <= target <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(target = 3) == 2\n assert candidate(target = 6) == 5\n assert candidate(target = 4) == 5\n assert candidate(target = 10) == 7\n assert candidate(target = 1) == 1\n assert candidate(target = 100) == 19\n assert candidate(target = 15) == 4\n assert candidate(target = 1000) == 23\n assert candidate(target = 999) == 20\n assert candidate(target = 16383) == 14\n assert candidate(target = 5000) == 41\n assert candidate(target = 8) == 6\n assert candidate(target = 6553) == 53\n assert candidate(target = 65535) == 16\n assert candidate(target = 25) == 11\n assert candidate(target = 5120) == 29\n assert candidate(target = 200) == 22\n assert candidate(target = 32767) == 15\n assert candidate(target = 29) == 10\n assert candidate(target = 2047) == 11\n assert candidate(target = 31) == 5\n assert candidate(target = 3000) == 33\n assert candidate(target = 2000) == 26\n assert candidate(target = 123) == 13\n assert candidate(target = 8192) == 16\n assert candidate(target = 40) == 15\n assert candidate(target = 8191) == 13\n assert candidate(target = 17) == 9\n assert candidate(target = 20) == 12\n assert candidate(target = 10000) == 45\n assert candidate(target = 500) == 20\n assert candidate(target = 750) == 25\n assert candidate(target = 9999) == 43\n assert candidate(target = 250) == 16\n assert candidate(target = 63) == 6\n assert candidate(target = 65536) == 19\n assert candidate(target = 7) == 3\n assert candidate(target = 32768) == 18\n assert candidate(target = 1023) == 10\n assert candidate(target = 42) == 15\n assert candidate(target = 1024) == 13\n assert candidate(target = 50) == 16\n assert candidate(target = 30) == 7\n assert candidate(target = 4096) == 15\n assert candidate(target = 4095) == 12\n assert candidate(target = 16) == 7\n assert candidate(target = 99) == 16\n assert candidate(target = 2048) == 14\n assert candidate(target = 5432) == 45\n"}, "metadata": {"canonical_parameter_names": ["target"], "leetcode_dataset_entry_point": "Solution().racecar", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var racecar = function(target) {", "container": null, "callable": "racecar", "parameters": [{"name": "target", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 820, "task_id": "short-encoding-of-words", "difficulty": "Medium", "problem_description": "A valid encoding of an array of words is any reference string s and array of indices indices such that:\n\nwords.length == indices.length\nThe reference string s ends with the '#' character.\nFor each index indices[i], the substring of s starting from indices[i] and up to (but not including) the next '#' character is equal to words[i].\n\nGiven an array of words, return the length of the shortest reference string s possible of any valid encoding of words.\n \nExample 1:\n\nInput: words = [\"time\", \"me\", \"bell\"]\nOutput: 10\nExplanation: A valid encoding would be s = \"time#bell#\" and indices = [0, 2, 5].\nwords[0] = \"time\", the substring of s starting from indices[0] = 0 to the next '#' is underlined in \"time#bell#\"\nwords[1] = \"me\", the substring of s starting from indices[1] = 2 to the next '#' is underlined in \"time#bell#\"\nwords[2] = \"bell\", the substring of s starting from indices[2] = 5 to the next '#' is underlined in \"time#bell#\"\n\nExample 2:\n\nInput: words = [\"t\"]\nOutput: 2\nExplanation: A valid encoding would be s = \"t#\" and indices = [0].\n\n \nConstraints:\n\n1 <= words.length <= 2000\n1 <= words[i].length <= 7\nwords[i] consists of only lowercase letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['abc', 'def', 'ghi', 'jkl', 'mno']) == 20\n assert candidate(words = ['test', 'testing', 'tested', 'testable']) == 29\n assert candidate(words = ['hello', 'hell', 'he', 'h']) == 16\n assert candidate(words = ['aaa', 'aa', 'a']) == 4\n assert candidate(words = ['one', 'two', 'three', 'four', 'five']) == 24\n assert candidate(words = ['abcd', 'bcde', 'cdef', 'defg']) == 20\n assert candidate(words = ['apple', 'ple', 'le', 'e']) == 6\n assert candidate(words = ['test', 'testcase', 'cases', 'ase', 'se', 'e']) == 20\n assert candidate(words = ['hello', 'world', 'python', 'programming']) == 31\n assert candidate(words = ['apple', 'pple', 'ple', 'le', 'e']) == 6\n assert candidate(words = ['ab', 'bc', 'cd', 'da']) == 12\n assert candidate(words = ['aa', 'aaa', 'aaaa', 'aaaaa']) == 6\n assert candidate(words = ['aa', 'aaa', 'aaaa']) == 5\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == 52\n assert candidate(words = ['xyz', 'xy', 'y', 'z']) == 7\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g']) == 14\n assert candidate(words = ['cat', 'dog', 'rat', 'car']) == 16\n assert candidate(words = ['hello', 'world', 'hold']) == 17\n assert candidate(words = ['time', 'me', 'bell']) == 10\n assert candidate(words = ['at', 'ac', 'bc', 'abc']) == 10\n assert candidate(words = ['hello', 'world', 'code', 'word']) == 22\n assert candidate(words = ['abc', 'bcd', 'cde']) == 12\n assert candidate(words = ['t']) == 2\n assert candidate(words = ['hello', 'world', 'word', 'hello']) == 17\n assert candidate(words = ['a', 'ab', 'abc', 'abcd', 'abcde']) == 20\n assert candidate(words = ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh']) == 24\n assert candidate(words = ['banana', 'nana', 'ana', 'na', 'a', 'nan', 'nanan']) == 13\n assert candidate(words = ['sequence', 'equence', 'quence', 'uence', 'ence', 'nce', 'ce', 'e', 'sq', 'qu', 'uen', 'en']) == 19\n assert candidate(words = ['xyz', 'xy', 'xz', 'yz', 'x', 'y', 'z']) == 12\n assert candidate(words = ['xyz', 'zyx', 'yzx', 'yxz', 'zxy', 'xzy', 'zy', 'yx', 'xz', 'zx', 'xy']) == 24\n assert candidate(words = ['random', 'andom', 'dom', 'om', 'm', 'rando', 'and', 'nd', 'd', 'rand', 'ran', 'ra', 'ndom']) == 25\n assert candidate(words = ['abcd', 'bcde', 'cdef', 'defg', 'efgh']) == 25\n assert candidate(words = ['abc', 'bc', 'c', 'abcd', 'bcd']) == 9\n assert candidate(words = ['apple', 'ple', 'leetcode', 'code', 'ode', 'de']) == 15\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa', 'aaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaaa', 'aaaaaaaaaaa', 'aaaaaaaaaaaa', 'aaaaaaaaaaaaa', 'aaaaaaaaaaaaaa', 'aaaaaaaaaaaaaaa']) == 16\n assert candidate(words = ['aa', 'aaa', 'aaaa', 'aab', 'aabaa', 'aabaaa', 'aabaaaa']) == 25\n assert candidate(words = ['abcdefgh', 'efgh', 'fgh', 'gh', 'h', 'abcdefghijk', 'ghijk', 'hijk', 'ijk', 'jk', 'k']) == 21\n assert candidate(words = ['xylophone', 'ylophone', 'lophone', 'ophone', 'phone', 'hone', 'one', 'ne', 'e']) == 10\n assert candidate(words = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg']) == 35\n assert candidate(words = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty', 'twentyone', 'twentytwo', 'twentythree', 'twentyfour', 'twentyfive']) == 162\n assert candidate(words = ['abcd', 'bcd', 'cd', 'd', 'abcde', 'bcde', 'cde', 'de', 'e']) == 11\n assert candidate(words = ['hello', 'hell', 'hel', 'he', 'h', 'world', 'worl', 'wor', 'wo', 'w']) == 40\n assert candidate(words = ['supercalifragilisticexpialidocious', 'supercalifragilisticexpialidocio', 'supercalifragilisticexpialido', 'supercalifragilisticexpalia', 'supercalifragilisticexpali', 'supercalifragilisticexpal', 'supercalifragilisticexpa', 'supercalifragilisticex', 'supercalifragilistice', 'supercalifragilistic', 'supercalifragilisti', 'supercalifragilist', 'supercalifragilis', 'supercalifragili', 'supercalifragil', 'supercalifragi', 'supercalifrag', 'supercalifra', 'supercalifr', 'supercalif', 'supercali', 'supercal', 'superc', 'super', 'supe', 'sup', 'su', 's']) == 469\n assert candidate(words = ['abcd', 'bcd', 'cd', 'd', 'a', 'ab', 'abc', 'bc', 'c']) == 14\n assert candidate(words = ['abracadabra', 'bracadabr', 'racadabr', 'acadabr', 'cadabr', 'adabr', 'dabr', 'abr', 'br', 'r']) == 22\n assert candidate(words = ['xylophone', 'ylophone', 'lophone', 'ophone', 'phone', 'hone', 'one', 'ne', 'e', 'x']) == 12\n assert candidate(words = ['qwerty', 'werty', 'erty', 'rty', 'ty', 'y', 'qwertyuiop', 'ertyuiop', 'rtyuiop', 'tyuiop', 'yuiop', 'uiop', 'iop', 'op', 'p']) == 18\n assert candidate(words = ['aaaaaa', 'aaaaa', 'aaaa', 'aaa', 'aa', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa']) == 7\n assert candidate(words = ['zebra', 'bra', 'ra', 'a', 'abacaxi', 'bacaxi', 'acaxi', 'caxi', 'axi', 'xi', 'i']) == 14\n assert candidate(words = ['zzzzzzz', 'zzzzzz', 'zzzzz', 'zzzz', 'zzz', 'zz', 'z', 'zzzzzzz', 'zzzzzz', 'zzzzz', 'zzzz', 'zzz', 'zz', 'z']) == 8\n assert candidate(words = ['ab', 'abc', 'abcd', 'abcde', 'abcdef']) == 25\n assert candidate(words = ['abcd', 'bcd', 'cd', 'd', 'efgh', 'fgh', 'gh', 'h', 'ijkl', 'jkl', 'kl', 'l']) == 15\n assert candidate(words = ['test', 'testing', 'tests', 'tes', 'te', 't', 'testcase', 'cases', 'ase', 'se', 'e']) == 41\n assert candidate(words = ['banana', 'anana', 'nana', 'ana', 'na', 'a', 'ban']) == 11\n assert candidate(words = ['abcd', 'bcd', 'cd', 'd', 'def', 'ef', 'f', 'fgh', 'gh', 'h']) == 13\n assert candidate(words = ['banana', 'anana', 'nana', 'ana', 'na', 'a', 'nabana', 'bananab']) == 22\n assert candidate(words = ['ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh']) == 42\n assert candidate(words = ['algorithm', 'logarithm', 'rhythm', 'syzygy', 'zymurgy', 'zymurgy', 'zymurgy', 'zymurgy', 'zymurgy']) == 42\n assert candidate(words = ['abcd', 'bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij', 'hijk', 'ijkl', 'jkl', 'kl', 'l']) == 45\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh', 'ii', 'jj', 'kk', 'll', 'mm', 'nn', 'oo', 'pp', 'qq', 'rr', 'ss', 'tt', 'uu', 'vv', 'ww', 'xx', 'yy', 'zz']) == 78\n assert candidate(words = ['hello', 'hell', 'helo', 'he', 'h', 'e']) == 21\n assert candidate(words = ['abacaxi', 'bacaxi', 'caxi', 'axi', 'xi', 'i']) == 8\n assert candidate(words = ['xyz', 'zyx', 'yzx', 'yxz', 'xzy', 'zxy']) == 24\n assert candidate(words = ['algorithm', 'rhythm', 'rhythmically', 'thym', 'hym', 'ym', 'm']) == 35\n assert candidate(words = ['flower', 'flow', 'flight', 'flighting', 'flour']) == 35\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa']) == 8\n assert candidate(words = ['word', 'ord', 'rd', 'd', 'word', 'ord', 'rd', 'd', 'word', 'ord', 'rd', 'd', 'word', 'ord', 'rd', 'd', 'word', 'ord', 'rd', 'd']) == 5\n assert candidate(words = ['apple', 'peel', 'pale', 'ale', 'le']) == 16\n assert candidate(words = ['apple', 'ple', 'le', 'e', 'app', 'ppl']) == 14\n assert candidate(words = ['abcdefgh', 'bcdefghi', 'cdefghij', 'defghijk', 'efghijkl', 'fghijklm', 'ghijklmn', 'hijklmno', 'ijklmnop', 'jklmnopq']) == 90\n assert candidate(words = ['ab', 'bc', 'abc', 'abcd', 'abcde']) == 18\n assert candidate(words = ['overlap', 'lap', 'ap', 'p', 'nolap', 'olap', 'lapo', 'lapor', 'laporator', 'laporatory']) == 46\n assert candidate(words = ['panorama', 'anorama', 'norama', 'orama', 'rama', 'ama', 'ma', 'a', 'planet', 'lanet', 'anet', 'net', 'et', 't']) == 16\n assert candidate(words = ['apple', 'ple', 'le', 'e', 'app', 'pple', 'plea']) == 15\n assert candidate(words = ['zebra', 'ebra', 'bra', 'ra', 'a', 'z']) == 8\n assert candidate(words = ['cat', 'dog', 'god', 'tac', 'act', 'gat']) == 24\n assert candidate(words = ['abc', 'bcd', 'cde', 'def', 'efg']) == 20\n assert candidate(words = ['coding', 'ing', 'ode', 'de', 'e']) == 11\n assert candidate(words = ['aaa', 'aab', 'aba', 'abb', 'baa', 'bab', 'bba', 'bbb', 'bbb', 'bbb']) == 32\n assert candidate(words = ['abcd', 'bcd', 'cd', 'd', 'abcds', 'bcde', 'cde', 'de', 'efg', 'fgh', 'ghi', 'hij', 'ijk', 'jkl', 'klm', 'lmn', 'mno', 'nop', 'opq', 'pqr', 'qrs', 'rst', 'stu', 'tuv', 'uvw', 'vwx', 'wxy', 'xyz']) == 96\n assert candidate(words = ['unique', 'un', 'iq', 'que', 'eue', 'eu', 'ue', 'eq', 'qu', 'uq']) == 29\n assert candidate(words = ['banana', 'ana', 'nana', 'anaconda', 'conda']) == 16\n assert candidate(words = ['zebra', 'ebra', 'bra', 'ra', 'a', 'cab', 'ab', 'b']) == 10\n assert candidate(words = ['programming', 'ming', 'gram', 'ing', 'am', 'm']) == 17\n assert candidate(words = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij']) == 65\n assert candidate(words = ['algorithm', 'lgorithm', 'gorithm', 'orithm', 'rithm', 'ithm', 'thm', 'hm', 'm']) == 10\n assert candidate(words = ['algorithm', 'lgorithm', 'gorithm', 'rhythm', 'hythm', 'hythm', 'thm', 'hm', 'm', 'a']) == 19\n assert candidate(words = ['abcdefgh', 'bcdefgh', 'cdefgh', 'defgh', 'efgh', 'fgh', 'gh', 'h']) == 9\n assert candidate(words = ['sun', 'un', 'n', 'moon', 'oon', 'on', 'noon', 'oon', 'on', 'n']) == 14\n assert candidate(words = ['longest', 'longer', 'long', 'lo', 'l', 'longestword', 'word', 'ord', 'rd', 'd']) == 37\n assert candidate(words = ['apple', 'peach', 'pear', 'leap', 'lead', 'meat', 'heat', 'seat']) == 42\n assert candidate(words = ['watermelon', 'atermelon', 'termelon', 'ermelon', 'rmelon', 'melon', 'elon', 'lon', 'on', 'n', 'w']) == 13\n assert candidate(words = ['aaaa', 'aaab', 'aabb', 'abbb', 'bbbb']) == 25\n assert candidate(words = ['banana', 'ananas', 'nana', 'ana', 'na', 'a', 'banana', 'ananas', 'nana', 'ana', 'na', 'a']) == 14\n assert candidate(words = ['aaaa', 'bbbb', 'cccc', 'dddd', 'eeee', 'ffff', 'gggg', 'hhhh', 'iiii', 'jjjj', 'kkkk', 'llll', 'mmmm', 'nnnn', 'oooo', 'pppp', 'qqqq', 'rrrr', 'ssss', 'tttt']) == 100\n assert candidate(words = ['aaa', 'aab', 'aac', 'aba', 'abc', 'aca', 'baa', 'bab', 'bac', 'bba', 'bbb', 'bbc', 'bca', 'bcb', 'bcc', 'caa', 'cab', 'cac', 'cba', 'cbb', 'cbc', 'cca', 'ccb', 'ccc']) == 96\n assert candidate(words = ['aaaa', 'aaa', 'aa', 'a', 'aaaaa']) == 6\n assert candidate(words = ['banana', 'nana', 'ana', 'na', 'a', 'anana', 'ananana', 'anananana', 'ananananana']) == 19\n assert candidate(words = ['abcdexyz', 'bcdexyz', 'cdexyz', 'dexyz', 'exyz', 'xyz', 'yz', 'z']) == 9\n assert candidate(words = ['banana', 'anana', 'nana', 'ana', 'na', 'a', 'cat', 'at', 't']) == 11\n assert candidate(words = ['xyz', 'yz', 'z', 'xy', 'x', 'yx', 'zxy', 'zyx', 'yxz', 'zyxz', 'xyzz', 'zyzzz', 'zyzyz']) == 34\n assert candidate(words = ['abcdefgh', 'bcdefghi', 'cdefghij', 'defghijk', 'efghijkl', 'fghijklm', 'ghijklmn', 'hijklmno', 'ijklmnop', 'jklmnopq', 'klmnopqr', 'lmnopqrs', 'mnopqrst', 'nopqrstu', 'opqrstuv', 'pqrstuvw', 'qrstuvwx', 'rstuvwxy', 'stuvwxyz']) == 171\n assert candidate(words = ['programming', 'gramming', 'mming', 'ming', 'ing', 'ng', 'g']) == 12\n assert candidate(words = ['abcde', 'bcdef', 'cdefg', 'defgh', 'efghi', 'fghij', 'ghijk', 'hijkl', 'ijklm', 'jklmn', 'klmno', 'lmnop', 'mnopq', 'nopqr', 'opqrs', 'pqrst', 'qrstu', 'rstuv', 'stuvw', 'tuvwx', 'uvwxy', 'vwxyz', 'wxyz', 'xyz', 'yz', 'z']) == 132\n assert candidate(words = ['apple', 'app', 'ple', 'le', 'e']) == 10\n assert candidate(words = ['pqr', 'pqs', 'prq', 'prs', 'psq', 'psr', 'rpq', 'rps', 'rsp', 'rsq', 'spq', 'spr']) == 48\n assert candidate(words = ['ab', 'bc', 'cd', 'de', 'ef', 'fg', 'gh', 'hi', 'ij', 'jk', 'kl', 'lm', 'mn', 'no', 'op', 'pq', 'qr', 'rs', 'st', 'tu', 'uv', 'vw', 'wx', 'xy', 'yz']) == 75\n assert candidate(words = ['apple', 'ple', 'le', 'e', 'orange', 'range', 'age', 'ge']) == 17\n assert candidate(words = ['abcd', 'bcd', 'cd', 'd', 'abcd', 'bcd', 'cd', 'd']) == 5\n assert candidate(words = ['apple', 'ple', 'app', 'le', 'p', 'l', 'e', 'a']) == 14\n assert candidate(words = ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh', 'ghi', 'hij', 'ijk', 'jkl', 'klm', 'lmn', 'mno', 'nop', 'opq', 'pqr', 'qrs', 'rst', 'stu', 'tuv', 'uvw', 'vwx', 'wxy', 'xyz']) == 96\n assert candidate(words = ['optimization', 'ptimization', 'timization', 'imization', 'mization', 'ization', 'zation', 'ation', 'tion', 'ion', 'on', 'n']) == 13\n assert candidate(words = ['sequence', 'equence', 'quence', 'uence', 'ence', 'nce', 'ce', 'e', 's', 'sequ', 'seq']) == 20\n assert candidate(words = ['abcdefg', 'cdefg', 'defg', 'efg', 'fg', 'g']) == 8\n assert candidate(words = ['abracadabra', 'racadabra', 'cadabra', 'adabra', 'dabra', 'abra', 'bra', 'ra', 'a']) == 12\n assert candidate(words = ['kitten', 'ten', 'en', 'n', 'sitting', 'ting', 'ing', 'ng', 'g']) == 15\n"}, "metadata": {"canonical_parameter_names": ["words"], "leetcode_dataset_entry_point": "Solution().minimumLengthEncoding", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minimumLengthEncoding = function(words) {", "container": null, "callable": "minimumLengthEncoding", "parameters": [{"name": "words", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 821, "task_id": "shortest-distance-to-a-character", "difficulty": "Easy", "problem_description": "Given a string s and a character c that occurs in s, return an array of integers answer where answer.length == s.length and answer[i] is the distance from index i to the closest occurrence of character c in s.\nThe distance between two indices i and j is abs(i - j), where abs is the absolute value function.\n \nExample 1:\n\nInput: s = \"loveleetcode\", c = \"e\"\nOutput: [3,2,1,0,1,0,0,1,2,2,1,0]\nExplanation: The character 'e' appears at indices 3, 5, 6, and 11 (0-indexed).\nThe closest occurrence of 'e' for index 0 is at index 3, so the distance is abs(0 - 3) = 3.\nThe closest occurrence of 'e' for index 1 is at index 3, so the distance is abs(1 - 3) = 2.\nFor index 4, there is a tie between the 'e' at index 3 and the 'e' at index 5, but the distance is still the same: abs(4 - 3) == abs(4 - 5) = 1.\nThe closest occurrence of 'e' for index 8 is at index 6, so the distance is abs(8 - 6) = 2.\n\nExample 2:\n\nInput: s = \"aaab\", c = \"b\"\nOutput: [3,2,1,0]\n\n \nConstraints:\n\n1 <= s.length <= 104\ns[i] and c are lowercase English letters.\nIt is guaranteed that c occurs at least once in s.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"abba\",c = \"a\") == [0, 1, 1, 0]\n assert candidate(s = \"loveleetcode\",c = \"e\") == [3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0]\n assert candidate(s = \"abcde\",c = \"e\") == [4, 3, 2, 1, 0]\n assert candidate(s = \"abcabcabc\",c = \"b\") == [1, 0, 1, 1, 0, 1, 1, 0, 1]\n assert candidate(s = \"abcdabcabcde\",c = \"c\") == [2, 1, 0, 1, 2, 1, 0, 1, 1, 0, 1, 2]\n assert candidate(s = \"eccdccccdcccdcced\",c = \"e\") == [0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 1]\n assert candidate(s = \"abcdabc\",c = \"a\") == [0, 1, 2, 1, 0, 1, 2]\n assert candidate(s = \"aabbcc\",c = \"b\") == [2, 1, 0, 0, 1, 2]\n assert candidate(s = \"zzzz\",c = \"z\") == [0, 0, 0, 0]\n assert candidate(s = \"bbaacc\",c = \"c\") == [4, 3, 2, 1, 0, 0]\n assert candidate(s = \"ababab\",c = \"a\") == [0, 1, 0, 1, 0, 1]\n assert candidate(s = \"aabbccddeeff\",c = \"d\") == [6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4]\n assert candidate(s = \"abcdefg\",c = \"a\") == [0, 1, 2, 3, 4, 5, 6]\n assert candidate(s = \"aabaabaaa\",c = \"b\") == [2, 1, 0, 1, 1, 0, 1, 2, 3]\n assert candidate(s = \"aaab\",c = \"b\") == [3, 2, 1, 0]\n assert candidate(s = \"abcde\",c = \"a\") == [0, 1, 2, 3, 4]\n assert candidate(s = \"mississippi\",c = \"i\") == [1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0]\n assert candidate(s = \"abcdefg\",c = \"g\") == [6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"abba\",c = \"b\") == [1, 0, 0, 1]\n assert candidate(s = \"aaaa\",c = \"a\") == [0, 0, 0, 0]\n assert candidate(s = \"aaaaabbbbbccccc\",c = \"b\") == [5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5]\n assert candidate(s = \"a\",c = \"a\") == [0]\n assert candidate(s = \"mnopqrstuvwxyzmnpqrstuvwxyzmnpqrstuvwxyzmnpqrstuvwxyzmnpqrstuvwxyz\",c = \"z\") == [13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",c = \"m\") == [24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]\n assert candidate(s = \"hellohellohello\",c = \"h\") == [0, 1, 2, 2, 1, 0, 1, 2, 2, 1, 0, 1, 2, 3, 4]\n assert candidate(s = \"abracadabraabracadabraabracadabra\",c = \"a\") == [0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0]\n assert candidate(s = \"zzzxxxyyyzzz\",c = \"y\") == [6, 5, 4, 3, 2, 1, 0, 0, 0, 1, 2, 3]\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnmqwertyuiop\",c = \"o\") == [8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1]\n assert candidate(s = \"abcdefghijabcdefghij\",c = \"f\") == [5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4]\n assert candidate(s = \"leetcodeleetcodeleetcode\",c = \"e\") == [1, 0, 0, 1, 2, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0]\n assert candidate(s = \"zzzzzzzzz\",c = \"z\") == [0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(s = \"allaboutthatbass\",c = \"a\") == [0, 1, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 1, 0, 1, 2]\n assert candidate(s = \"alibabaibabaibabaibabaibabaibabaibabaibaba\",c = \"b\") == [3, 2, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1]\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",c = \"z\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(s = \"bbaabbaabbaabbaabbaa\",c = \"b\") == [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 2]\n assert candidate(s = \"xyxzyzyxzyxzyzyx\",c = \"z\") == [3, 2, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 2]\n assert candidate(s = \"banana\",c = \"n\") == [2, 1, 0, 1, 0, 1]\n assert candidate(s = \"antidisestablishmentarianism\",c = \"a\") == [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 1, 0, 1, 2, 3, 4]\n assert candidate(s = \"bcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbc\",c = \"b\") == [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]\n assert candidate(s = \"banana\",c = \"a\") == [1, 0, 1, 0, 1, 0]\n assert candidate(s = \"ababababababababababa\",c = \"b\") == [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]\n assert candidate(s = \"xyxxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyx\",c = \"x\") == [0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(s = \"aaaaaaaabaaaaaaaa\",c = \"b\") == [8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8]\n assert candidate(s = \"aaaaaabbbaaaa\",c = \"b\") == [6, 5, 4, 3, 2, 1, 0, 0, 0, 1, 2, 3, 4]\n assert candidate(s = \"helloworld\",c = \"o\") == [4, 3, 2, 1, 0, 1, 0, 1, 2, 3]\n assert candidate(s = \"abababababababababab\",c = \"a\") == [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]\n assert candidate(s = \"zzzxyzxxzyzxzzzxzyzxzyzxzyzxzyz\",c = \"x\") == [3, 2, 1, 0, 1, 1, 0, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 3]\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzz\",c = \"z\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(s = \"ababababab\",c = \"b\") == [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(s = \"abcdefghij\",c = \"a\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(s = \"ababababababababababababababababababababa\",c = \"a\") == [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(s = \"abcdefgabcdefg\",c = \"c\") == [2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 4]\n assert candidate(s = \"ababababababababababababababababababababab\",c = \"a\") == [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]\n assert candidate(s = \"honorificabilitudinitatibus\",c = \"i\") == [5, 4, 3, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 2, 3]\n assert candidate(s = \"xyzxyzxyzxyzxyzxyzxyzxyzxyzxyz\",c = \"y\") == [1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1]\n assert candidate(s = \"leetcodeleetcodeleetcode\",c = \"o\") == [5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2]\n assert candidate(s = \"mississippi\",c = \"p\") == [8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1]\n assert candidate(s = \"bababababababababababababababababababababa\",c = \"b\") == [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",c = \"m\") == [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]\n assert candidate(s = \"abcdefghij\",c = \"c\") == [2, 1, 0, 1, 2, 3, 4, 5, 6, 7]\n assert candidate(s = \"longstringwithvariouscharacters\",c = \"r\") == [6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 2, 1, 0, 1]\n assert candidate(s = \"bbbbbbaaaabbbbbbaaaabbbbbbaaaabbbbbb\",c = \"a\") == [6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6]\n assert candidate(s = \"abcdefghij\",c = \"h\") == [7, 6, 5, 4, 3, 2, 1, 0, 1, 2]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",c = \"a\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]\n assert candidate(s = \"abcdefghijabcdefghijabcdefghij\",c = \"d\") == [3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6]\n assert candidate(s = \"xyxzyzyzxzyzxzyzx\",c = \"z\") == [3, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]\n assert candidate(s = \"aaabbbcccdddeee\",c = \"c\") == [6, 5, 4, 3, 2, 1, 0, 0, 0, 1, 2, 3, 4, 5, 6]\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnmqwertyuiop\",c = \"q\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(s = \"abcdefghij\",c = \"j\") == [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"pneumonoultramicroscopicsilicovolcanoconiosis\",c = \"o\") == [5, 4, 3, 2, 1, 0, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 1, 0, 1, 2, 3, 4, 4, 3, 2, 1, 0, 1, 0, 1, 2, 2, 1, 0, 1, 0, 1, 1, 0, 1, 2, 3]\n assert candidate(s = \"thequickbrownfoxjumpsoverthelazydog\",c = \"o\") == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1]\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",c = \"a\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(s = \"zxyxzyxzyxz\",c = \"y\") == [2, 1, 0, 1, 1, 0, 1, 1, 0, 1, 2]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",c = \"z\") == [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"zzzzzzzzzz\",c = \"z\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(s = \"longwordwithmanyletters\",c = \"w\") == [4, 3, 2, 1, 0, 1, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n assert candidate(s = \"racecar\",c = \"e\") == [3, 2, 1, 0, 1, 2, 3]\n assert candidate(s = \"abacabadabacaba\",c = \"c\") == [3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3]\n assert candidate(s = \"programming\",c = \"m\") == [6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3]\n assert candidate(s = \"abcabcabcabcabc\",c = \"b\") == [1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1]\n assert candidate(s = \"abacabadabacaba\",c = \"b\") == [1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1]\n assert candidate(s = \"aaaaabaaaabaaaaabaaa\",c = \"b\") == [5, 4, 3, 2, 1, 0, 1, 2, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3]\n assert candidate(s = \"abcdefghijabcdefghijabcdefghij\",c = \"f\") == [5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4]\n assert candidate(s = \"pppppppppp\",c = \"p\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(s = \"xxyyzzxxxyyzz\",c = \"z\") == [4, 3, 2, 1, 0, 0, 1, 2, 3, 2, 1, 0, 0]\n assert candidate(s = \"aaaaaaaaaaaaaaaab\",c = \"b\") == [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"bbaabbaabbaa\",c = \"a\") == [2, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",c = \"p\") == [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n assert candidate(s = \"civicciviccivic\",c = \"v\") == [2, 1, 0, 1, 2, 2, 1, 0, 1, 2, 2, 1, 0, 1, 2]\n assert candidate(s = \"xyzxyzxyz\",c = \"z\") == [2, 1, 0, 1, 1, 0, 1, 1, 0]\n assert candidate(s = \"zzzzzzz\",c = \"z\") == [0, 0, 0, 0, 0, 0, 0]\n assert candidate(s = \"abababababababababab\",c = \"b\") == [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(s = \"abcdefgabcdefg\",c = \"d\") == [3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",c = \"c\") == [4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46]\n assert candidate(s = \"thequickbrownfoxjumpsoverthelazydog\",c = \"q\") == [3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]\n assert candidate(s = \"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn\",c = \"n\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(s = \"abcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcb\",c = \"b\") == [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(s = \"xylophone\",c = \"o\") == [3, 2, 1, 0, 1, 1, 0, 1, 2]\n assert candidate(s = \"abababababababababababababab\",c = \"b\") == [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(s = \"racecar\",c = \"a\") == [1, 0, 1, 2, 1, 0, 1]\n assert candidate(s = \"aaabbaaa\",c = \"b\") == [3, 2, 1, 0, 0, 1, 2, 3]\n assert candidate(s = \"floccinaucinihilipilification\",c = \"f\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7]\n assert candidate(s = \"elephantelephant\",c = \"e\") == [0, 1, 0, 1, 2, 3, 2, 1, 0, 1, 0, 1, 2, 3, 4, 5]\n assert candidate(s = \"thisisaverylongstringwithsomerepeatedcharacters\",c = \"s\") == [3, 2, 1, 0, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"abacabadabacaba\",c = \"d\") == [7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7]\n assert candidate(s = \"aaaaaaaaaabbbbcccc\",c = \"b\") == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 1, 2, 3, 4]\n assert candidate(s = \"abcdefghigklmnopqrstuvwxyz\",c = \"m\") == [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]\n assert candidate(s = \"abracadabra\",c = \"a\") == [0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0]\n assert candidate(s = \"leetcodeisnice\",c = \"e\") == [1, 0, 0, 1, 2, 2, 1, 0, 1, 2, 3, 2, 1, 0]\n assert candidate(s = \"abcdefgabcdefgabcdefg\",c = \"g\") == [6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0]\n assert candidate(s = \"ababababa\",c = \"a\") == [0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(s = \"lkhfjldshgflsjghljsfgljsdgfljsgdfjlsghsflkghsflkl\",c = \"l\") == [0, 1, 2, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 2, 1, 0, 1, 2, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 0]\n assert candidate(s = \"supercalifragilisticexpialidocious\",c = \"i\") == [8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 2, 1, 0, 1, 0, 1, 1, 0, 1, 2, 2, 1, 0, 1, 1, 0, 1, 2, 1, 0, 1, 2, 3]\n assert candidate(s = \"hellohellohellohello\",c = \"l\") == [2, 1, 0, 0, 1, 2, 1, 0, 0, 1, 2, 1, 0, 0, 1, 2, 1, 0, 0, 1]\n assert candidate(s = \"elephant\",c = \"e\") == [0, 1, 0, 1, 2, 3, 4, 5]\n assert candidate(s = \"thisisaverylongstringwithmultiplescharacters\",c = \"s\") == [3, 2, 1, 0, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"llllllllllllllllllllllllllllllllllllllllllllllllllllll\",c = \"l\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(s = \"supercalifragilisticexpialidocious\",c = \"x\") == [21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n"}, "metadata": {"canonical_parameter_names": ["s", "c"], "leetcode_dataset_entry_point": "Solution().shortestToChar", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shortestToChar = function(s, c) {", "container": null, "callable": "shortestToChar", "parameters": [{"name": "s", "type": "string"}, {"name": "c", "type": "character"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 822, "task_id": "card-flipping-game", "difficulty": "Medium", "problem_description": "You are given two 0-indexed integer arrays fronts and backs of length n, where the ith card has the positive integer fronts[i] printed on the front and backs[i] printed on the back. Initially, each card is placed on a table such that the front number is facing up and the other is facing down. You may flip over any number of cards (possibly zero).\nAfter flipping the cards, an integer is considered good if it is facing down on some card and not facing up on any card.\nReturn the minimum possible good integer after flipping the cards. If there are no good integers, return 0.\n \nExample 1:\n\nInput: fronts = [1,2,4,4,7], backs = [1,3,4,1,3]\nOutput: 2\nExplanation:\nIf we flip the second card, the face up numbers are [1,3,4,4,7] and the face down are [1,2,4,1,3].\n2 is the minimum good integer as it appears facing down but not facing up.\nIt can be shown that 2 is the minimum possible good integer obtainable after flipping some cards.\n\nExample 2:\n\nInput: fronts = [1], backs = [1]\nOutput: 0\nExplanation:\nThere are no good integers no matter how we flip the cards, so we return 0.\n\n \nConstraints:\n\nn == fronts.length == backs.length\n1 <= n <= 1000\n1 <= fronts[i], backs[i] <= 2000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(fronts = [1, 3, 5, 7],backs = [2, 4, 6, 8]) == 1\n assert candidate(fronts = [1, 1, 2, 2],backs = [2, 2, 1, 1]) == 1\n assert candidate(fronts = [1, 3, 5, 7],backs = [2, 4, 6, 8]) == 1\n assert candidate(fronts = [1, 2, 3, 4, 5],backs = [5, 4, 3, 2, 1]) == 1\n assert candidate(fronts = [1, 3, 5, 7, 9],backs = [2, 4, 6, 8, 10]) == 1\n assert candidate(fronts = [5, 6, 7, 8],backs = [8, 7, 6, 5]) == 5\n assert candidate(fronts = [1, 2, 3, 4, 5],backs = [5, 4, 3, 2, 1]) == 1\n assert candidate(fronts = [1],backs = [1]) == 0\n assert candidate(fronts = [1, 1, 1, 1],backs = [1, 1, 1, 1]) == 0\n assert candidate(fronts = [1000, 1000, 1000],backs = [1001, 1002, 1003]) == 1000\n assert candidate(fronts = [1, 1, 1, 1, 1],backs = [2, 2, 2, 2, 1]) == 2\n assert candidate(fronts = [2, 2, 2, 2],backs = [2, 2, 2, 2]) == 0\n assert candidate(fronts = [1, 2, 3],backs = [3, 2, 1]) == 1\n assert candidate(fronts = [1, 2, 3],backs = [3, 2, 1]) == 1\n assert candidate(fronts = [1, 1, 1, 2],backs = [1, 1, 2, 1]) == 2\n assert candidate(fronts = [1, 1, 1, 1],backs = [2, 2, 2, 2]) == 1\n assert candidate(fronts = [1, 2, 3, 4, 5],backs = [6, 7, 8, 9, 10]) == 1\n assert candidate(fronts = [1, 2, 4, 4, 7],backs = [1, 3, 4, 1, 3]) == 2\n assert candidate(fronts = [1000, 2000],backs = [2000, 1000]) == 1000\n assert candidate(fronts = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],backs = [5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == 1\n assert candidate(fronts = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],backs = [5, 4, 3, 2, 1, 1, 2, 3, 4, 5]) == 1\n assert candidate(fronts = [1, 2, 2, 3, 3, 4, 5, 6],backs = [6, 5, 4, 3, 2, 1, 2, 3]) == 1\n assert candidate(fronts = [2, 3, 2, 3, 2, 3],backs = [3, 2, 3, 2, 3, 2]) == 2\n assert candidate(fronts = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8],backs = [8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == 1\n assert candidate(fronts = [10, 20, 30, 40, 50, 60],backs = [60, 50, 40, 30, 20, 10]) == 10\n assert candidate(fronts = [1, 1, 1, 1],backs = [1, 1, 1, 1]) == 0\n assert candidate(fronts = [2000, 1999, 1998, 1997, 1996, 1995],backs = [1995, 1996, 1997, 1998, 1999, 2000]) == 1995\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],backs = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 2\n assert candidate(fronts = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109],backs = [109, 108, 107, 106, 105, 104, 103, 102, 101, 100]) == 100\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],backs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(fronts = [1000, 2000, 1500, 500, 1200],backs = [2000, 1000, 1500, 1000, 500]) == 500\n assert candidate(fronts = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6],backs = [6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == 1\n assert candidate(fronts = [1, 1, 1, 1, 1, 1],backs = [1, 1, 1, 1, 1, 1]) == 0\n assert candidate(fronts = [1, 2, 3, 4, 5],backs = [6, 7, 8, 9, 10]) == 1\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],backs = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(fronts = [10, 10, 10, 10, 10],backs = [1, 2, 3, 4, 5]) == 1\n assert candidate(fronts = [500, 501, 502, 503, 504],backs = [504, 503, 502, 501, 500]) == 500\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],backs = [10, 9, 8, 7, 6, 5, 4, 3, 2, 10]) == 1\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],backs = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1]) == 1\n assert candidate(fronts = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],backs = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 1\n assert candidate(fronts = [10, 10, 20, 30, 40, 50],backs = [50, 20, 10, 30, 40, 60]) == 10\n assert candidate(fronts = [2000, 1999, 1998, 1997, 1996],backs = [1995, 1994, 1993, 1992, 1991]) == 1991\n assert candidate(fronts = [500, 500, 500, 500, 500],backs = [500, 501, 502, 503, 504]) == 501\n assert candidate(fronts = [1, 1, 2, 2, 3, 3],backs = [3, 3, 1, 1, 2, 2]) == 1\n assert candidate(fronts = [2000, 1999, 1998, 1997, 1996],backs = [1995, 1996, 1997, 1998, 1999]) == 1995\n assert candidate(fronts = [1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009],backs = [1009, 1008, 1007, 1006, 1005, 1004, 1003, 1002, 1001, 1000]) == 1000\n assert candidate(fronts = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],backs = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 1\n assert candidate(fronts = [1, 3, 5, 7, 9],backs = [2, 4, 6, 8, 1000]) == 1\n assert candidate(fronts = [1, 1, 1, 2, 2, 2, 3, 3, 3],backs = [3, 2, 1, 3, 2, 1, 3, 2, 1]) == 0\n assert candidate(fronts = [2, 3, 5, 7, 11, 13],backs = [11, 13, 2, 3, 5, 7]) == 2\n assert candidate(fronts = [1, 1, 1, 1, 1],backs = [1, 1, 1, 1, 1]) == 0\n assert candidate(fronts = [1, 2, 3, 4, 5],backs = [1, 2, 3, 4, 5]) == 0\n assert candidate(fronts = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],backs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],backs = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991]) == 1\n assert candidate(fronts = [2, 3, 5, 7, 11, 13, 17, 19],backs = [19, 17, 13, 11, 7, 5, 3, 2]) == 2\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],backs = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(fronts = [1, 3, 3, 7, 9],backs = [2, 3, 5, 7, 8]) == 1\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],backs = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11]) == 1\n assert candidate(fronts = [1, 1, 2, 3, 4, 5],backs = [5, 4, 3, 2, 1, 1]) == 1\n assert candidate(fronts = [500, 501, 502, 503, 504, 505],backs = [505, 504, 503, 502, 501, 500]) == 500\n assert candidate(fronts = [1, 2, 3, 4, 5],backs = [2, 1, 4, 3, 5]) == 1\n assert candidate(fronts = [11, 22, 33, 44, 55],backs = [55, 44, 33, 22, 11]) == 11\n assert candidate(fronts = [5, 5, 5, 5, 5],backs = [5, 5, 5, 5, 5]) == 0\n assert candidate(fronts = [2, 3, 2, 4, 3, 4, 5, 6, 7, 8],backs = [8, 7, 6, 5, 4, 3, 2, 1, 2, 3]) == 1\n assert candidate(fronts = [1, 1, 1, 1, 1],backs = [2, 2, 2, 2, 2]) == 1\n assert candidate(fronts = [1, 1, 1, 1, 2, 2, 2, 2],backs = [2, 2, 2, 2, 1, 1, 1, 1]) == 1\n assert candidate(fronts = [1, 1, 2, 2, 3, 3],backs = [2, 2, 3, 3, 4, 4]) == 1\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],backs = [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(fronts = [100, 200, 300, 400, 500],backs = [500, 400, 300, 200, 100]) == 100\n assert candidate(fronts = [10, 20, 30, 40, 50],backs = [50, 40, 30, 20, 10]) == 10\n assert candidate(fronts = [1500, 1600, 1700, 1800, 1900],backs = [1900, 1800, 1700, 1600, 1500]) == 1500\n assert candidate(fronts = [2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991],backs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(fronts = [1, 1, 2, 2, 3, 3],backs = [2, 2, 3, 3, 1, 1]) == 1\n assert candidate(fronts = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20],backs = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11]) == 11\n assert candidate(fronts = [100, 100, 200, 200, 300, 300],backs = [200, 200, 300, 300, 100, 100]) == 100\n assert candidate(fronts = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],backs = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 10\n assert candidate(fronts = [1, 2, 2, 3, 4],backs = [4, 3, 3, 2, 1]) == 1\n assert candidate(fronts = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],backs = [19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 1\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],backs = [10, 9, 8, 7, 6, 5, 4, 3, 2, 11]) == 1\n assert candidate(fronts = [15, 15, 15, 15, 16],backs = [16, 15, 15, 15, 15]) == 16\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],backs = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 1\n assert candidate(fronts = [1000, 2, 3, 4, 5],backs = [5, 1000, 3, 4, 2]) == 2\n assert candidate(fronts = [10, 20, 30, 40, 50, 60],backs = [10, 30, 50, 70, 90, 110]) == 20\n assert candidate(fronts = [101, 102, 103, 104, 105],backs = [106, 105, 104, 103, 102]) == 101\n assert candidate(fronts = [2000, 1999, 1998, 1997, 1996],backs = [1996, 1997, 1998, 1999, 2000]) == 1996\n assert candidate(fronts = [5, 5, 5, 5, 5, 5],backs = [6, 6, 6, 6, 6, 6]) == 5\n assert candidate(fronts = [1, 2, 2, 2, 3, 3, 3, 4, 4, 4],backs = [4, 4, 4, 3, 3, 3, 2, 2, 2, 1]) == 1\n assert candidate(fronts = [1, 1, 1, 2, 2, 3],backs = [1, 2, 3, 3, 1, 1]) == 2\n assert candidate(fronts = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],backs = [5, 4, 3, 2, 1, 6, 7, 8, 9, 10]) == 1\n assert candidate(fronts = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4],backs = [4, 3, 3, 2, 2, 2, 1, 1, 1, 1]) == 1\n assert candidate(fronts = [2, 3, 5, 7, 11, 13],backs = [13, 11, 7, 5, 3, 2]) == 2\n assert candidate(fronts = [1000, 2000, 1000, 2000, 1000, 2000],backs = [2000, 1000, 2000, 1000, 2000, 1000]) == 1000\n assert candidate(fronts = [1, 1, 2, 2, 3, 3, 4, 4],backs = [1, 2, 1, 3, 2, 4, 3, 5]) == 2\n assert candidate(fronts = [2000, 2000, 2000, 2000, 2000],backs = [1, 2, 3, 4, 5]) == 1\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],backs = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(fronts = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],backs = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1]) == 2\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],backs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11]) == 10\n assert candidate(fronts = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],backs = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]) == 1\n assert candidate(fronts = [1, 2, 3, 4, 5],backs = [5, 1, 4, 3, 2]) == 1\n assert candidate(fronts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],backs = [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(fronts = [1, 1, 2, 2, 3, 3, 4, 4],backs = [2, 2, 1, 1, 4, 4, 3, 3]) == 1\n assert candidate(fronts = [1, 3, 5, 7, 9, 11],backs = [11, 9, 7, 5, 3, 1]) == 1\n assert candidate(fronts = [1, 2, 3, 2, 1, 4, 5],backs = [5, 4, 3, 3, 4, 1, 2]) == 1\n assert candidate(fronts = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],backs = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 1\n assert candidate(fronts = [1, 2, 2, 3, 4, 4, 5, 5, 6, 6],backs = [6, 5, 5, 4, 3, 3, 2, 1, 1, 1]) == 1\n assert candidate(fronts = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],backs = [20, 18, 16, 14, 12, 10, 8, 6, 4, 2]) == 2\n assert candidate(fronts = [2, 4, 6, 8, 10],backs = [1, 3, 5, 7, 9]) == 1\n"}, "metadata": {"canonical_parameter_names": ["fronts", "backs"], "leetcode_dataset_entry_point": "Solution().flipgame", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var flipgame = function(fronts, backs) {", "container": null, "callable": "flipgame", "parameters": [{"name": "fronts", "type": "number[]"}, {"name": "backs", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 823, "task_id": "binary-trees-with-factors", "difficulty": "Medium", "problem_description": "Given an array of unique integers, arr, where each integer arr[i] is strictly greater than 1.\nWe make a binary tree using these integers, and each number may be used for any number of times. Each non-leaf node's value should be equal to the product of the values of its children.\nReturn the number of binary trees we can make. The answer may be too large so return the answer modulo 109 + 7.\n \nExample 1:\n\nInput: arr = [2,4]\nOutput: 3\nExplanation: We can make these trees: [2], [4], [4, 2, 2]\nExample 2:\n\nInput: arr = [2,4,5,10]\nOutput: 7\nExplanation: We can make these trees: [2], [4], [5], [10], [4, 2, 2], [10, 2, 5], [10, 5, 2].\n \nConstraints:\n\n1 <= arr.length <= 1000\n2 <= arr[i] <= 109\nAll the values of arr are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [10, 20, 40, 80]) == 4\n assert candidate(arr = [2, 4, 5, 10]) == 7\n assert candidate(arr = [2, 3, 6, 18]) == 12\n assert candidate(arr = [5, 10, 20, 40, 80]) == 5\n assert candidate(arr = [18, 3, 6, 2]) == 12\n assert candidate(arr = [3, 6, 9]) == 4\n assert candidate(arr = [2, 3, 4, 6, 8, 12, 16, 24, 48]) == 278\n assert candidate(arr = [2, 3, 6]) == 5\n assert candidate(arr = [2, 3, 5, 6, 10, 15, 30]) == 31\n assert candidate(arr = [2, 5, 10, 20, 40]) == 27\n assert candidate(arr = [2, 4]) == 3\n assert candidate(arr = [3, 6, 9, 18, 27]) == 12\n assert candidate(arr = [6, 10, 14, 15, 21, 22, 26, 33, 34, 35, 38, 39, 51, 55, 57, 58, 62, 65, 69, 74, 77, 82, 85, 86, 87, 91, 93, 94, 95, 106, 111, 115, 118, 119, 121, 122, 123, 133, 134, 141, 142, 143, 145, 146, 155, 158, 159, 161, 166, 177, 178, 183, 187, 194]) == 54\n assert candidate(arr = [19, 361, 6859, 130321, 2476099, 47045881, 893871739, 16983563041, 322687697779, 6131066257801, 116226146700419]) == 68001\n assert candidate(arr = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912]) == 93720241\n assert candidate(arr = [19, 38, 57, 76, 95, 114, 133, 152, 171, 190, 209, 228, 247, 266, 285, 304, 323, 342, 361, 380, 399, 418, 437, 456, 475, 494, 513, 532, 551, 570]) == 31\n assert candidate(arr = [21, 42, 63, 84, 105, 126, 147, 168, 189, 210, 231, 252, 273, 294, 315, 336, 357, 378, 399, 420, 441, 462, 483, 504, 525, 546, 567, 588, 609, 630, 651, 672, 693, 714, 735, 756, 777, 798, 819, 840, 861, 882, 903, 924, 945, 966, 987, 1008, 1029, 1050, 1071, 1092, 1113, 1134, 1155, 1176, 1197, 1218, 1239, 1260, 1281, 1302, 1323, 1344, 1365, 1386, 1407, 1428, 1449, 1470, 1491, 1512, 1533, 1554, 1575, 1596, 1617, 1638, 1659, 1680, 1701, 1722, 1743, 1764, 1785, 1806, 1827, 1848, 1869, 1890, 1911, 1932, 1953, 1974, 1995, 2016, 2037, 2058, 2079, 2100, 2121, 2142, 2163, 2184, 2205, 2226, 2247, 2268, 2289, 2310]) == 120\n assert candidate(arr = [5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125]) == 16178\n assert candidate(arr = [8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024]) == 64\n assert candidate(arr = [2, 3, 4, 6, 8, 12, 24]) == 68\n assert candidate(arr = [7, 14, 28, 56, 112, 224, 448, 896, 1792, 3584]) == 10\n assert candidate(arr = [7, 11, 13, 19, 21, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61]) == 15\n assert candidate(arr = [13, 169, 2197, 28561, 371293]) == 74\n assert candidate(arr = [7, 11, 13, 14, 15, 21, 22, 26, 33, 39, 77, 143]) == 16\n assert candidate(arr = [2, 4, 8, 16, 32, 64, 128, 256]) == 3943\n assert candidate(arr = [3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049, 177147, 531441, 1594323, 4782969, 14348907, 43046721, 129140163, 387420489, 1162261467]) == 882934334\n assert candidate(arr = [100, 200, 400, 500, 800, 1000, 2000, 4000, 8000, 10000]) == 11\n assert candidate(arr = [7, 14, 28, 49, 98, 196]) == 12\n assert candidate(arr = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]) == 68000\n assert candidate(arr = [2, 5, 10, 15, 25, 50, 75, 125, 250, 375, 625]) == 98\n assert candidate(arr = [3, 9, 27, 81, 243, 729, 2187, 6561, 19683]) == 16178\n assert candidate(arr = [12, 15, 20, 24, 30, 36, 40, 45, 48, 60, 72, 80, 90, 100, 120, 144, 150, 180, 200, 240, 300, 360, 400, 450, 600, 720, 900, 1200, 1800, 3600]) == 108\n assert candidate(arr = [7, 14, 28, 49, 98, 196, 343, 686, 1372]) == 47\n assert candidate(arr = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]) == 974876421\n assert candidate(arr = [18, 3, 6, 2, 9]) == 18\n assert candidate(arr = [13, 169, 2197, 28561, 371293, 4826809, 62748517, 815730721]) == 3943\n assert candidate(arr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]) == 25\n assert candidate(arr = [2, 3, 6, 12, 24]) == 27\n assert candidate(arr = [7, 14, 28, 49, 98, 196, 343, 686]) == 28\n assert candidate(arr = [3, 9, 27, 81, 243, 729, 2187]) == 993\n assert candidate(arr = [13, 17, 221, 289, 299, 377, 4913]) == 14\n assert candidate(arr = [6, 10, 15, 30, 60, 150, 300, 750, 1500]) == 21\n assert candidate(arr = [5, 10, 20, 25, 50, 100, 125, 200, 250, 500, 625, 1000, 1250, 2500, 5000]) == 366\n assert candidate(arr = [11, 22, 44, 88, 176, 352, 704, 1408, 2816, 5632, 11264]) == 11\n assert candidate(arr = [17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255, 272, 289, 306, 323, 340]) == 21\n assert candidate(arr = [7, 49, 343, 2401, 16807, 117649, 823543, 5764801, 40353607, 282475249, 1977326743]) == 291191\n assert candidate(arr = [23, 46, 69, 92, 115, 138, 161, 184, 207, 230, 253, 276, 299, 322, 345, 368, 391, 414, 437, 460, 483, 506, 529, 552, 575, 598, 621, 644, 667, 690, 713, 736, 759, 782, 805, 828, 851, 874, 897, 920, 943, 966, 989, 1012, 1035, 1058, 1081, 1104, 1127, 1150, 1173, 1196, 1219, 1242, 1265, 1288, 1311, 1334, 1357, 1380, 1403, 1426, 1449, 1472, 1495, 1518, 1541, 1564, 1587, 1610, 1633, 1656, 1679, 1702, 1725, 1748, 1771, 1794, 1817, 1840, 1863, 1886, 1909, 1932, 1955, 1978, 2001, 2024, 2047, 2070, 2093, 2116, 2139, 2162, 2185, 2208, 2231, 2254, 2277, 2300, 2323, 2346, 2369, 2392, 2415, 2438, 2461, 2484, 2507, 2530, 2553, 2576, 2599, 2622, 2645, 2668, 2691, 2714, 2737, 2760, 2783, 2806, 2829, 2852, 2875, 2898, 2921, 2944, 2967, 2990, 3013, 3036, 3059, 3082, 3105, 3128, 3151, 3174, 3197, 3220, 3243, 3266, 3289, 3312, 3335, 3358, 3381, 3404, 3427, 3450, 3473, 3496, 3519, 3542, 3565, 3588, 3611, 3634, 3657, 3680, 3703, 3726, 3749, 3772, 3795, 3818, 3841, 3864, 3887, 3910, 3933, 3956, 3979, 4002, 4025, 4048, 4071, 4094, 4117, 4140, 4163, 4186, 4209, 4232, 4255, 4278, 4301, 4324, 4347, 4370, 4393, 4416, 4439, 4462, 4485, 4508, 4531, 4554, 4577, 4600, 4623, 4646, 4669, 4692, 4715, 4738, 4761, 4784, 4807, 4830, 4853, 4876, 4899, 4922, 4945, 4968, 4991]) == 240\n assert candidate(arr = [8, 9, 12, 16, 18, 24, 27, 32, 36, 48, 54, 64, 72, 96, 108, 144, 162, 192, 216, 243, 288, 324, 384, 432, 486, 576, 648, 729, 768, 864, 972, 1152, 1296, 1458, 1728, 1944, 2187, 2304, 2592, 2916, 3456, 3888, 4374, 4608, 5184, 5832, 6561, 6912, 7776, 8748, 9216, 10368, 11664, 13122, 13824, 15552, 17496, 19683, 20736, 23328, 26244, 27648, 31104, 34992, 36450, 39366, 41472, 46656, 49152, 55296, 61440, 62208, 69984, 73728, 82944, 93312, 98304, 104976, 110592, 116640, 118098, 139968, 147456, 165888, 186624, 196608, 209952, 221184, 233280, 236196, 279936, 294912, 331776, 373248, 393216, 419904, 442368, 466560, 472392, 559872, 589824, 663552, 746496, 786432, 839808, 884736, 933120, 944784, 1039776, 1179648, 1327104, 1474560, 1568640, 1679616, 1769472, 1966080, 1989568, 2179328, 2654208, 2752512, 3133440, 3201152, 3556864, 3906240, 4014336, 4354560, 4482112, 4718592, 4839552, 5308416, 5505024, 6266880, 6402304, 6913728, 7208320, 7228672, 7837184, 8388608, 8449344, 9175040, 9612800, 9657344, 10285568, 10813440, 10898688, 11753728, 12288000, 12298752, 13136640, 13604864, 14336000, 14417408, 15422464, 16588800, 16797504, 17740800, 17783808, 18963200, 19215360, 19234816]) == 917736\n assert candidate(arr = [13, 130, 169, 260, 338, 520, 676, 1040, 1352, 2080, 2704, 4160, 5408, 8320, 10816]) == 16\n assert candidate(arr = [11, 22, 44, 88, 176, 352]) == 6\n assert candidate(arr = [19, 38, 57, 76, 95, 114, 133, 152, 171, 190]) == 10\n assert candidate(arr = [11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 220, 231, 242, 253, 264, 275, 286, 297, 308, 319, 330, 341, 352, 363, 374, 385, 396, 407, 418, 429, 440, 451, 462, 473, 484, 495, 506, 517, 528, 539, 550, 561, 572, 583, 594, 605, 616, 627, 638, 649, 660, 671, 682, 693, 704, 715, 726, 737, 748, 759, 770, 781, 792, 803, 814, 825, 836, 847, 858, 869, 880, 891, 902, 913, 924, 935, 946, 957, 968, 979, 990, 1001]) == 111\n assert candidate(arr = [2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 30, 36, 40, 45, 48, 50, 60, 72, 75, 80, 90, 100]) == 1298\n assert candidate(arr = [2, 3, 6, 9, 18]) == 18\n assert candidate(arr = [10, 14, 20, 28, 35, 40, 70, 140]) == 10\n assert candidate(arr = [7, 11, 13, 14, 15, 21, 22, 26, 33, 35, 39, 70, 77, 105, 143, 154, 182, 210, 231, 286, 385, 429, 715, 1001, 1430, 2002]) == 110\n assert candidate(arr = [5, 10, 20, 50, 100, 200]) == 13\n assert candidate(arr = [2, 3, 6, 9, 18]) == 18\n assert candidate(arr = [2, 5, 10, 25, 50, 125, 250, 625, 1250, 3125, 6250]) == 1202\n assert candidate(arr = [3, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 12288, 24576, 49152, 98304, 196608, 393216, 786432, 1572864]) == 20\n assert candidate(arr = [3, 5, 15, 25, 75, 125, 375, 625, 1875, 3125, 9375, 15625, 46875, 78125, 234375, 390625, 1171875, 1953125]) == 126293\n assert candidate(arr = [2, 10, 100, 1000, 10000]) == 24\n assert candidate(arr = [2, 5, 10, 20, 50, 100, 250, 500]) == 221\n assert candidate(arr = [3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049, 177147, 531441, 1594323, 4782969, 14348907, 43046721, 129140163, 387420489, 1162261467, 3486784401]) == 47166081\n assert candidate(arr = [5, 10, 25, 50, 125, 250]) == 23\n assert candidate(arr = [2, 4, 8, 16, 32, 64, 128, 256]) == 3943\n assert candidate(arr = [10, 14, 20, 28, 35, 40, 49, 70, 100, 140, 175, 200, 245, 490, 700, 980, 1400, 2450, 4900]) == 83\n assert candidate(arr = [2, 3, 5, 6, 10, 15, 30]) == 31\n assert candidate(arr = [17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255, 272, 289, 306, 323, 340]) == 21\n assert candidate(arr = [5, 10, 20, 25, 50, 100, 250, 500]) == 42\n assert candidate(arr = [7, 11, 13, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]) == 22\n assert candidate(arr = [18, 2, 9, 12, 6, 3]) == 25\n assert candidate(arr = [11, 121, 1331, 14641, 161051, 1771561, 19487171, 214358881, 2357947691]) == 16178\n assert candidate(arr = [18, 36, 54, 72, 90, 108, 126, 144, 162, 180]) == 10\n assert candidate(arr = [2, 3, 6, 9, 18, 27, 54]) == 68\n assert candidate(arr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]) == 46\n assert candidate(arr = [11, 121, 1331, 14641, 161051]) == 74\n assert candidate(arr = [3, 5, 7, 15, 21, 35, 105]) == 31\n assert candidate(arr = [11, 22, 44, 88, 176, 352, 704, 1408, 2816]) == 9\n assert candidate(arr = [11, 22, 33, 44, 55, 66, 77, 88, 99, 110]) == 10\n assert candidate(arr = [2, 5, 10, 20, 40, 80, 160]) == 121\n assert candidate(arr = [19, 38, 57, 76, 95, 114, 133, 152, 171, 190, 209, 228, 247, 266, 285, 304, 323, 342, 361, 380, 399, 418, 437, 456, 475, 494, 513, 532, 551, 570]) == 31\n assert candidate(arr = [2, 5, 10, 25, 50, 125, 250]) == 68\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1400, 1500, 1600, 1800, 2000, 2100, 2400, 2500, 2700, 2800, 3000, 3100, 3500, 4000, 4200, 4500, 5000, 5200, 5400, 6000, 6300, 6500, 7000, 7500, 8000, 8400, 9000, 9100, 9500, 10000]) == 42\n assert candidate(arr = [6, 12, 18, 24, 30, 36, 42, 48, 54, 60]) == 11\n assert candidate(arr = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576]) == 47166081\n assert candidate(arr = [11, 13, 143, 157, 1853, 1729, 1943, 22187, 24539, 25397, 30167, 31721, 35981, 42361, 45343, 52943, 56171]) == 19\n assert candidate(arr = [18, 36, 54, 72, 90, 108, 126, 144, 162, 180, 198, 216, 234, 252, 270, 288, 306, 324, 342, 360, 378, 396, 414, 432, 450, 468, 486, 504, 522, 540, 558, 576, 594, 612, 630, 648, 666, 684, 702, 720, 738, 756, 774, 792, 810, 828, 846, 864, 882, 900, 918, 936, 954, 972, 990]) == 60\n assert candidate(arr = [13, 26, 39, 52, 65, 78, 91, 104, 117, 130, 143, 156, 169, 182, 195]) == 16\n assert candidate(arr = [17, 257, 4369, 723517, 124518049, 21052314241, 3666579611167, 63842579163398337, 112840242932266121833]) == 11\n assert candidate(arr = [2, 5, 7, 10, 14, 17, 35, 70]) == 32\n assert candidate(arr = [3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049]) == 68000\n assert candidate(arr = [19, 38, 57, 76, 95, 114, 133, 152, 171, 190, 209, 228, 247, 266, 285, 304, 323, 342, 361, 380, 399, 418, 437, 456, 475, 494, 513, 532, 551, 570, 589, 608, 627, 646, 665, 684, 703, 722, 741, 760, 779, 798, 817, 836, 855, 874, 893, 912, 931, 950, 969, 988, 1007, 1026, 1045, 1064, 1083, 1102, 1121, 1140, 1159, 1178, 1197, 1216, 1235, 1254, 1273, 1292, 1311, 1330, 1349, 1368, 1387, 1406, 1425, 1444, 1463, 1482, 1501, 1520, 1539, 1558, 1577, 1596, 1615, 1634, 1653, 1672, 1691, 1710, 1729, 1748, 1767, 1786, 1805, 1824, 1843, 1862, 1881, 1900, 1919, 1938, 1957, 1976, 1995, 2014]) == 116\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 800, 900, 1000, 1200, 1500, 1800, 2000, 2400, 2500, 3000, 3600, 4000, 4500, 5000]) == 20\n assert candidate(arr = [3, 9, 27, 81, 243, 729]) == 262\n assert candidate(arr = [17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255, 272, 289, 306, 323, 340, 357, 374, 391, 408, 425, 442, 459, 476, 493, 510, 527, 544, 561, 578, 595, 612, 629, 646, 663, 680, 697, 714, 731, 748, 765, 782, 799, 816, 833, 850, 867, 884, 901, 918, 935, 952, 969, 986, 1003, 1020, 1037, 1054, 1071, 1088, 1105]) == 70\n assert candidate(arr = [5, 10, 20, 40, 80, 160]) == 6\n assert candidate(arr = [6, 10, 15, 30, 50, 75, 150, 250, 375, 750, 1250, 1875, 3750, 9375, 18750, 28125, 37500, 46875, 56250, 93750, 112500]) == 181\n assert candidate(arr = [23, 46, 69, 92, 115, 138, 161, 184, 207, 230, 253, 276, 299, 322, 345, 368, 391, 414, 437, 460, 483, 506, 529, 552, 575, 598, 621, 644, 667, 690, 713, 736, 759, 782, 805, 828, 851, 874, 897, 920, 943, 966, 989]) == 44\n assert candidate(arr = [100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600]) == 9\n assert candidate(arr = [2, 3, 5, 7, 10, 14, 15, 21, 22, 30, 35, 42, 70, 77, 105, 110, 140, 154, 165, 210, 231, 385, 462, 550, 770, 1001, 1155, 1540, 2310, 3003, 3850, 5005, 6930, 10010, 11550, 15015, 21021, 30030, 50050, 100100]) == 3630\n assert candidate(arr = [5, 10, 15, 25, 50, 75, 125, 250]) == 27\n assert candidate(arr = [2, 3, 6, 18, 36]) == 36\n assert candidate(arr = [7, 14, 28, 49, 98, 196]) == 12\n assert candidate(arr = [3, 6, 9, 12, 18, 27, 36, 54, 72, 108, 162, 216, 324, 486, 648]) == 516\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().numFactoredBinaryTrees", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numFactoredBinaryTrees = function(arr) {", "container": null, "callable": "numFactoredBinaryTrees", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 824, "task_id": "goat-latin", "difficulty": "Easy", "problem_description": "You are given a string sentence that consist of words separated by spaces. Each word consists of lowercase and uppercase letters only.\nWe would like to convert the sentence to \"Goat Latin\" (a made-up language similar to Pig Latin.) The rules of Goat Latin are as follows:\n\nIf a word begins with a vowel ('a', 'e', 'i', 'o', or 'u'), append \"ma\" to the end of the word.\n\n\t\nFor example, the word \"apple\" becomes \"applema\".\n\n\nIf a word begins with a consonant (i.e., not a vowel), remove the first letter and append it to the end, then add \"ma\".\n\t\nFor example, the word \"goat\" becomes \"oatgma\".\n\n\nAdd one letter 'a' to the end of each word per its word index in the sentence, starting with 1.\n\t\nFor example, the first word gets \"a\" added to the end, the second word gets \"aa\" added to the end, and so on.\n\n\n\nReturn the final sentence representing the conversion from sentence to Goat Latin.\n \nExample 1:\nInput: sentence = \"I speak Goat Latin\"\nOutput: \"Imaa peaksmaaa oatGmaaaa atinLmaaaaa\"\nExample 2:\nInput: sentence = \"The quick brown fox jumped over the lazy dog\"\nOutput: \"heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpedjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa\"\n\n \nConstraints:\n\n1 <= sentence.length <= 150\nsentence consists of English letters and spaces.\nsentence has no leading or trailing spaces.\nAll the words in sentence are separated by a single space.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(sentence = \"Convert this sentence\") == \"onvertCmaa histmaaa entencesmaaaa\"\n assert candidate(sentence = \"In the end\") == \"Inmaa hetmaaa endmaaaa\"\n assert candidate(sentence = \"a e i o u\") == \"amaa emaaa imaaaa omaaaaa umaaaaaa\"\n assert candidate(sentence = \"Hello world\") == \"elloHmaa orldwmaaa\"\n assert candidate(sentence = \"Python is great\") == \"ythonPmaa ismaaa reatgmaaaa\"\n assert candidate(sentence = \"This is a test\") == \"hisTmaa ismaaa amaaaa esttmaaaaa\"\n assert candidate(sentence = \"Hello World\") == \"elloHmaa orldWmaaa\"\n assert candidate(sentence = \"Goat Latin Example\") == \"oatGmaa atinLmaaa Examplemaaaa\"\n assert candidate(sentence = \"Convert this sentence to Goat Latin\") == \"onvertCmaa histmaaa entencesmaaaa otmaaaaa oatGmaaaaaa atinLmaaaaaaa\"\n assert candidate(sentence = \"The quick brown fox jumped over the lazy dog\") == \"heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpedjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa\"\n assert candidate(sentence = \"Programming is fun\") == \"rogrammingPmaa ismaaa unfmaaaa\"\n assert candidate(sentence = \"Every vowel example\") == \"Everymaa owelvmaaa examplemaaaa\"\n assert candidate(sentence = \"hello world\") == \"ellohmaa orldwmaaa\"\n assert candidate(sentence = \"Goat Latin is easy\") == \"oatGmaa atinLmaaa ismaaaa easymaaaaa\"\n assert candidate(sentence = \"Keep practicing\") == \"eepKmaa racticingpmaaa\"\n assert candidate(sentence = \"Conversion to Goat Latin\") == \"onversionCmaa otmaaa oatGmaaaa atinLmaaaaa\"\n assert candidate(sentence = \"I speak Goat Latin\") == \"Imaa peaksmaaa oatGmaaaa atinLmaaaaa\"\n assert candidate(sentence = \"Every word matters\") == \"Everymaa ordwmaaa attersmmaaaa\"\n assert candidate(sentence = \"ChatGPT is an AI language model\") == \"hatGPTCmaa ismaaa anmaaaa AImaaaaa anguagelmaaaaaa odelmmaaaaaaa\"\n assert candidate(sentence = \"A big brown dog jumps over a lazy fox\") == \"Amaa igbmaaa rownbmaaaa ogdmaaaaa umpsjmaaaaaa overmaaaaaaa amaaaaaaaa azylmaaaaaaaaa oxfmaaaaaaaaaa\"\n assert candidate(sentence = \"Quick brown fox jumps over the lazy dog\") == \"uickQmaa rownbmaaa oxfmaaaa umpsjmaaaaa overmaaaaaa hetmaaaaaaa azylmaaaaaaaa ogdmaaaaaaaaa\"\n assert candidate(sentence = \"Frogs jump joyfully in the rain\") == \"rogsFmaa umpjmaaa oyfullyjmaaaa inmaaaaa hetmaaaaaa ainrmaaaaaaa\"\n assert candidate(sentence = \"Conversion to Goat Latin should handle complex sentences properly\") == \"onversionCmaa otmaaa oatGmaaaa atinLmaaaaa houldsmaaaaaa andlehmaaaaaaa omplexcmaaaaaaaa entencessmaaaaaaaaa roperlypmaaaaaaaaaa\"\n assert candidate(sentence = \"The quick brown fox jumps over the lazy dog and runs\") == \"heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpsjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa andmaaaaaaaaaaa unsrmaaaaaaaaaaaa\"\n assert candidate(sentence = \"User experience design and usability\") == \"Usermaa experiencemaaa esigndmaaaa andmaaaaa usabilitymaaaaaa\"\n assert candidate(sentence = \"This is an interesting problem to solve\") == \"hisTmaa ismaaa anmaaaa interestingmaaaaa roblempmaaaaaa otmaaaaaaa olvesmaaaaaaaa\"\n assert candidate(sentence = \"A quick brown fox jumps over the lazy dog\") == \"Amaa uickqmaaa rownbmaaaa oxfmaaaaa umpsjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa\"\n assert candidate(sentence = \"This is a simple test case for Goat Latin\") == \"hisTmaa ismaaa amaaaa implesmaaaaa esttmaaaaaa asecmaaaaaaa orfmaaaaaaaa oatGmaaaaaaaaa atinLmaaaaaaaaaa\"\n assert candidate(sentence = \"Another Example to demonstrate the Conversion\") == \"Anothermaa Examplemaaa otmaaaa emonstratedmaaaaa hetmaaaaaa onversionCmaaaaaaa\"\n assert candidate(sentence = \"Let us create more examples for testing\") == \"etLmaa usmaaa reatecmaaaa oremmaaaaa examplesmaaaaaa orfmaaaaaaa estingtmaaaaaaaa\"\n assert candidate(sentence = \"a e i o u A E I O U\") == \"amaa emaaa imaaaa omaaaaa umaaaaaa Amaaaaaaa Emaaaaaaaa Imaaaaaaaaa Omaaaaaaaaaa Umaaaaaaaaaaa\"\n assert candidate(sentence = \"Lorem ipsum dolor sit amet consectetur adipiscing elit\") == \"oremLmaa ipsummaaa olordmaaaa itsmaaaaa ametmaaaaaa onsecteturcmaaaaaaa adipiscingmaaaaaaaa elitmaaaaaaaaa\"\n assert candidate(sentence = \"Every vowel and consonant has its own rule\") == \"Everymaa owelvmaaa andmaaaa onsonantcmaaaaa ashmaaaaaa itsmaaaaaaa ownmaaaaaaaa ulermaaaaaaaaa\"\n assert candidate(sentence = \"The quick brown fox jumps over the lazy dog and plays\") == \"heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpsjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa andmaaaaaaaaaaa layspmaaaaaaaaaaaa\"\n assert candidate(sentence = \"Sphinx of black quartz judge my vow\") == \"phinxSmaa ofmaaa lackbmaaaa uartzqmaaaaa udgejmaaaaaa ymmaaaaaaa owvmaaaaaaaa\"\n assert candidate(sentence = \"Artificial intelligence is transforming the world\") == \"Artificialmaa intelligencemaaa ismaaaa ransformingtmaaaaa hetmaaaaaa orldwmaaaaaaa\"\n assert candidate(sentence = \"Gnomes gather golden grains gracefully gathering groups\") == \"nomesGmaa athergmaaa oldengmaaaa rainsgmaaaaa racefullygmaaaaaa atheringgmaaaaaaa roupsgmaaaaaaaa\"\n assert candidate(sentence = \"Natural language processing is revolutionizing technology\") == \"aturalNmaa anguagelmaaa rocessingpmaaaa ismaaaaa evolutionizingrmaaaaaa echnologytmaaaaaaa\"\n assert candidate(sentence = \"Python programming is fun\") == \"ythonPmaa rogrammingpmaaa ismaaaa unfmaaaaa\"\n assert candidate(sentence = \"The weather today is absolutely perfect\") == \"heTmaa eatherwmaaa odaytmaaaa ismaaaaa absolutelymaaaaaa erfectpmaaaaaaa\"\n assert candidate(sentence = \"Let us see how this conversion works\") == \"etLmaa usmaaa eesmaaaa owhmaaaaa histmaaaaaa onversioncmaaaaaaa orkswmaaaaaaaa\"\n assert candidate(sentence = \"Internet of Things and smart devices\") == \"Internetmaa ofmaaa hingsTmaaaa andmaaaaa martsmaaaaaa evicesdmaaaaaaa\"\n assert candidate(sentence = \"OpenAI develops advanced AI systems\") == \"OpenAImaa evelopsdmaaa advancedmaaaa AImaaaaa ystemssmaaaaaa\"\n assert candidate(sentence = \"Edge cases exercise existing expertise effectively\") == \"Edgemaa asescmaaa exercisemaaaa existingmaaaaa expertisemaaaaaa effectivelymaaaaaaa\"\n assert candidate(sentence = \"Zoologists zealously zoom into zoological zoological zones\") == \"oologistsZmaa ealouslyzmaaa oomzmaaaa intomaaaaa oologicalzmaaaaaa oologicalzmaaaaaaa oneszmaaaaaaaa\"\n assert candidate(sentence = \"Beautiful scenery and wonderful views\") == \"eautifulBmaa cenerysmaaa andmaaaa onderfulwmaaaaa iewsvmaaaaaa\"\n assert candidate(sentence = \"Mixed CASE Words Should Still Work\") == \"ixedMmaa ASECmaaa ordsWmaaaa houldSmaaaaa tillSmaaaaaa orkWmaaaaaaa\"\n assert candidate(sentence = \"Every vowel and consonant has a unique rule\") == \"Everymaa owelvmaaa andmaaaa onsonantcmaaaaa ashmaaaaaa amaaaaaaa uniquemaaaaaaaa ulermaaaaaaaaa\"\n assert candidate(sentence = \"Artificial intelligence will change our lives\") == \"Artificialmaa intelligencemaaa illwmaaaa hangecmaaaaa ourmaaaaaa iveslmaaaaaaa\"\n assert candidate(sentence = \"Testing edge cases like empty spaces in between words\") == \"estingTmaa edgemaaa asescmaaaa ikelmaaaaa emptymaaaaaa pacessmaaaaaaa inmaaaaaaaa etweenbmaaaaaaaaa ordswmaaaaaaaaaa\"\n assert candidate(sentence = \"Programming in Python is fun and challenging\") == \"rogrammingPmaa inmaaa ythonPmaaaa ismaaaaa unfmaaaaaa andmaaaaaaa hallengingcmaaaaaaaa\"\n assert candidate(sentence = \"This is a longer sentence that includes several words to ensure the solution works correctly\") == \"hisTmaa ismaaa amaaaa ongerlmaaaaa entencesmaaaaaa hattmaaaaaaa includesmaaaaaaaa everalsmaaaaaaaaa ordswmaaaaaaaaaa otmaaaaaaaaaaa ensuremaaaaaaaaaaaa hetmaaaaaaaaaaaaa olutionsmaaaaaaaaaaaaaa orkswmaaaaaaaaaaaaaaa orrectlycmaaaaaaaaaaaaaaaa\"\n assert candidate(sentence = \"This is a simple test\") == \"hisTmaa ismaaa amaaaa implesmaaaaa esttmaaaaaa\"\n assert candidate(sentence = \"Conversion to Goat Latin can be tricky\") == \"onversionCmaa otmaaa oatGmaaaa atinLmaaaaa ancmaaaaaa ebmaaaaaaa rickytmaaaaaaaa\"\n assert candidate(sentence = \"Complex sentences with various words\") == \"omplexCmaa entencessmaaa ithwmaaaa ariousvmaaaaa ordswmaaaaaa\"\n assert candidate(sentence = \"Understanding algorithms and data structures\") == \"Understandingmaa algorithmsmaaa andmaaaa atadmaaaaa tructuressmaaaaaa\"\n assert candidate(sentence = \"Goat Latin is a fun and creative language\") == \"oatGmaa atinLmaaa ismaaaa amaaaaa unfmaaaaaa andmaaaaaaa reativecmaaaaaaaa anguagelmaaaaaaaaa\"\n assert candidate(sentence = \"Consonants should move their first letter to the end\") == \"onsonantsCmaa houldsmaaa ovemmaaaa heirtmaaaaa irstfmaaaaaa etterlmaaaaaaa otmaaaaaaaa hetmaaaaaaaaa endmaaaaaaaaaa\"\n assert candidate(sentence = \"Fascinating flora frequently feed furry friends\") == \"ascinatingFmaa lorafmaaa requentlyfmaaaa eedfmaaaaa urryfmaaaaaa riendsfmaaaaaaa\"\n assert candidate(sentence = \"Keep pushing your limits and you will achieve great things\") == \"eepKmaa ushingpmaaa ourymaaaa imitslmaaaaa andmaaaaaa ouymaaaaaaa illwmaaaaaaaa achievemaaaaaaaaa reatgmaaaaaaaaaa hingstmaaaaaaaaaaa\"\n assert candidate(sentence = \"Software engineering principles\") == \"oftwareSmaa engineeringmaaa rinciplespmaaaa\"\n assert candidate(sentence = \"Every vowel must be handled\") == \"Everymaa owelvmaaa ustmmaaaa ebmaaaaa andledhmaaaaaa\"\n assert candidate(sentence = \"Testing multiple words with varied starting letters\") == \"estingTmaa ultiplemmaaa ordswmaaaa ithwmaaaaa ariedvmaaaaaa tartingsmaaaaaaa etterslmaaaaaaaa\"\n assert candidate(sentence = \"Beautiful butterflies brightly bask in blazing sunshine\") == \"eautifulBmaa utterfliesbmaaa rightlybmaaaa askbmaaaaa inmaaaaaa lazingbmaaaaaaa unshinesmaaaaaaaa\"\n assert candidate(sentence = \"The quick brown fox jumps over the lazy dog on a sunny day\") == \"heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpsjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa onmaaaaaaaaaaa amaaaaaaaaaaaa unnysmaaaaaaaaaaaaa aydmaaaaaaaaaaaaaa\"\n assert candidate(sentence = \"Machine learning is transforming the world\") == \"achineMmaa earninglmaaa ismaaaa ransformingtmaaaaa hetmaaaaaa orldwmaaaaaaa\"\n assert candidate(sentence = \"b c d f g h j k l m n p q r s t v w x y z B C D F G H J K L M N P Q R S T V W X Y Z\") == \"bmaa cmaaa dmaaaa fmaaaaa gmaaaaaa hmaaaaaaa jmaaaaaaaa kmaaaaaaaaa lmaaaaaaaaaa mmaaaaaaaaaaa nmaaaaaaaaaaaa pmaaaaaaaaaaaaa qmaaaaaaaaaaaaaa rmaaaaaaaaaaaaaaa smaaaaaaaaaaaaaaaa tmaaaaaaaaaaaaaaaaa vmaaaaaaaaaaaaaaaaaa wmaaaaaaaaaaaaaaaaaaa xmaaaaaaaaaaaaaaaaaaaa ymaaaaaaaaaaaaaaaaaaaaa zmaaaaaaaaaaaaaaaaaaaaaa Bmaaaaaaaaaaaaaaaaaaaaaaa Cmaaaaaaaaaaaaaaaaaaaaaaaa Dmaaaaaaaaaaaaaaaaaaaaaaaaa Fmaaaaaaaaaaaaaaaaaaaaaaaaaa Gmaaaaaaaaaaaaaaaaaaaaaaaaaaa Hmaaaaaaaaaaaaaaaaaaaaaaaaaaaa Jmaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Kmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Lmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Mmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Nmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Pmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Qmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Rmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Smaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Tmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Vmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Wmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Xmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Ymaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Zmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(sentence = \"Bright vixens jump over the lazy dog\") == \"rightBmaa ixensvmaaa umpjmaaaa overmaaaaa hetmaaaaaa azylmaaaaaaa ogdmaaaaaaaa\"\n assert candidate(sentence = \"Hello world this is a test sentence\") == \"elloHmaa orldwmaaa histmaaaa ismaaaaa amaaaaaa esttmaaaaaaa entencesmaaaaaaaa\"\n assert candidate(sentence = \"Natural language processing and chatbots\") == \"aturalNmaa anguagelmaaa rocessingpmaaaa andmaaaaa hatbotscmaaaaaa\"\n assert candidate(sentence = \"Lazy dogs jump over sleeping cats\") == \"azyLmaa ogsdmaaa umpjmaaaa overmaaaaa leepingsmaaaaaa atscmaaaaaaa\"\n assert candidate(sentence = \"Computer vision and image processing\") == \"omputerCmaa isionvmaaa andmaaaa imagemaaaaa rocessingpmaaaaaa\"\n assert candidate(sentence = \"Every vowel should remain unchanged ma\") == \"Everymaa owelvmaaa houldsmaaaa emainrmaaaaa unchangedmaaaaaa ammaaaaaaa\"\n assert candidate(sentence = \"The five boxing wizards jump quickly\") == \"heTmaa ivefmaaa oxingbmaaaa izardswmaaaaa umpjmaaaaaa uicklyqmaaaaaaa\"\n assert candidate(sentence = \"Blockchain technology and cryptography\") == \"lockchainBmaa echnologytmaaa andmaaaa ryptographycmaaaaa\"\n assert candidate(sentence = \"Debugging code can be challenging\") == \"ebuggingDmaa odecmaaa ancmaaaa ebmaaaaa hallengingcmaaaaaa\"\n assert candidate(sentence = \"Python Programming Language is Fun\") == \"ythonPmaa rogrammingPmaaa anguageLmaaaa ismaaaaa unFmaaaaaa\"\n assert candidate(sentence = \"Algorithm design and analysis\") == \"Algorithmmaa esigndmaaa andmaaaa analysismaaaaa\"\n assert candidate(sentence = \"Alphabet University of Economics and Business Administration\") == \"Alphabetmaa Universitymaaa ofmaaaa Economicsmaaaaa andmaaaaaa usinessBmaaaaaaa Administrationmaaaaaaaa\"\n assert candidate(sentence = \"Continuous integration and deployment\") == \"ontinuousCmaa integrationmaaa andmaaaa eploymentdmaaaaa\"\n assert candidate(sentence = \"Beautiful scenery in nature\") == \"eautifulBmaa cenerysmaaa inmaaaa aturenmaaaaa\"\n assert candidate(sentence = \"Machine learning models are fascinating\") == \"achineMmaa earninglmaaa odelsmmaaaa aremaaaaa ascinatingfmaaaaaa\"\n assert candidate(sentence = \"Jackdaws love my big sphinx of quartz\") == \"ackdawsJmaa ovelmaaa ymmaaaa igbmaaaaa phinxsmaaaaaa ofmaaaaaaa uartzqmaaaaaaaa\"\n assert candidate(sentence = \"The brown fox jumps over a lazy dog\") == \"heTmaa rownbmaaa oxfmaaaa umpsjmaaaaa overmaaaaaa amaaaaaaa azylmaaaaaaaa ogdmaaaaaaaaa\"\n assert candidate(sentence = \"Python programming promotes productivity and problem solving\") == \"ythonPmaa rogrammingpmaaa romotespmaaaa roductivitypmaaaaa andmaaaaaa roblempmaaaaaaa olvingsmaaaaaaaa\"\n assert candidate(sentence = \"High performance computing and big data\") == \"ighHmaa erformancepmaaa omputingcmaaaa andmaaaaa igbmaaaaaa atadmaaaaaaa\"\n assert candidate(sentence = \"The quick brown fox jumps over the lazy dog quickly\") == \"heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpsjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa uicklyqmaaaaaaaaaaa\"\n assert candidate(sentence = \"The quick brown fox jumps over the lazy dog\") == \"heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpsjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa\"\n assert candidate(sentence = \"Data analysis and machine learning\") == \"ataDmaa analysismaaa andmaaaa achinemmaaaaa earninglmaaaaaa\"\n assert candidate(sentence = \"ComplexSentencesWithNoSpaces\") == \"omplexSentencesWithNoSpacesCmaa\"\n assert candidate(sentence = \"Understanding complex algorithms unravelles endless possibilities\") == \"Understandingmaa omplexcmaaa algorithmsmaaaa unravellesmaaaaa endlessmaaaaaa ossibilitiespmaaaaaaa\"\n assert candidate(sentence = \"Watch Jeopardy on NBC\") == \"atchWmaa eopardyJmaaa onmaaaa BCNmaaaaa\"\n assert candidate(sentence = \"Artificial neural networks and deep learning\") == \"Artificialmaa euralnmaaa etworksnmaaaa andmaaaaa eepdmaaaaaa earninglmaaaaaaa\"\n assert candidate(sentence = \"Data structures and algorithms\") == \"ataDmaa tructuressmaaa andmaaaa algorithmsmaaaaa\"\n assert candidate(sentence = \"Algorithms are crucial for computer science\") == \"Algorithmsmaa aremaaa rucialcmaaaa orfmaaaaa omputercmaaaaaa ciencesmaaaaaaa\"\n assert candidate(sentence = \"Consonants should also be tested\") == \"onsonantsCmaa houldsmaaa alsomaaaa ebmaaaaa estedtmaaaaaa\"\n assert candidate(sentence = \"She sells sea shells by the sea shore\") == \"heSmaa ellssmaaa easmaaaa hellssmaaaaa ybmaaaaaa hetmaaaaaaa easmaaaaaaaa horesmaaaaaaaaa\"\n assert candidate(sentence = \"abcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwxyzmaa\"\n assert candidate(sentence = \"A big black bear sat on a big black rug\") == \"Amaa igbmaaa lackbmaaaa earbmaaaaa atsmaaaaaa onmaaaaaaa amaaaaaaaa igbmaaaaaaaaa lackbmaaaaaaaaaa ugrmaaaaaaaaaaa\"\n assert candidate(sentence = \"Multiple words starting with a consonant\") == \"ultipleMmaa ordswmaaa tartingsmaaaa ithwmaaaaa amaaaaaa onsonantcmaaaaaaa\"\n assert candidate(sentence = \"How vexingly quick daft zebras jump\") == \"owHmaa exinglyvmaaa uickqmaaaa aftdmaaaaa ebraszmaaaaaa umpjmaaaaaaa\"\n assert candidate(sentence = \"SingleWord\") == \"ingleWordSmaa\"\n assert candidate(sentence = \"An example of a more complex sentence conversion\") == \"Anmaa examplemaaa ofmaaaa amaaaaa oremmaaaaaa omplexcmaaaaaaa entencesmaaaaaaaa onversioncmaaaaaaaaa\"\n assert candidate(sentence = \"Transformations are always fascinating\") == \"ransformationsTmaa aremaaa alwaysmaaaa ascinatingfmaaaaa\"\n assert candidate(sentence = \"Single\") == \"ingleSmaa\"\n assert candidate(sentence = \"bc df gh jk lm np qr st vx zy\") == \"cbmaa fdmaaa hgmaaaa kjmaaaaa mlmaaaaaa pnmaaaaaaa rqmaaaaaaaa tsmaaaaaaaaa xvmaaaaaaaaaa yzmaaaaaaaaaaa\"\n assert candidate(sentence = \"Algorithms and data structures\") == \"Algorithmsmaa andmaaa atadmaaaa tructuressmaaaaa\"\n assert candidate(sentence = \"Sometimes it rains cats and dogs\") == \"ometimesSmaa itmaaa ainsrmaaaa atscmaaaaa andmaaaaaa ogsdmaaaaaaa\"\n assert candidate(sentence = \"Understanding the rules of Goat Latin\") == \"Understandingmaa hetmaaa ulesrmaaaa ofmaaaaa oatGmaaaaaa atinLmaaaaaaa\"\n assert candidate(sentence = \"This is an elaborate test case with multiple words\") == \"hisTmaa ismaaa anmaaaa elaboratemaaaaa esttmaaaaaa asecmaaaaaaa ithwmaaaaaaaa ultiplemmaaaaaaaaa ordswmaaaaaaaaaa\"\n assert candidate(sentence = \"The early morning dew dries\") == \"heTmaa earlymaaa orningmmaaaa ewdmaaaaa riesdmaaaaaa\"\n assert candidate(sentence = \"Short long longer longest longestest\") == \"hortSmaa onglmaaa ongerlmaaaa ongestlmaaaaa ongestestlmaaaaaa\"\n assert candidate(sentence = \"Quantum computing and future technologies\") == \"uantumQmaa omputingcmaaa andmaaaa uturefmaaaaa echnologiestmaaaaaa\"\n assert candidate(sentence = \"The five boxing wizards jump quickly on this extraordinary bicycle\") == \"heTmaa ivefmaaa oxingbmaaaa izardswmaaaaa umpjmaaaaaa uicklyqmaaaaaaa onmaaaaaaaa histmaaaaaaaaa extraordinarymaaaaaaaaaa icyclebmaaaaaaaaaaa\"\n assert candidate(sentence = \"Python programming is fun and educational\") == \"ythonPmaa rogrammingpmaaa ismaaaa unfmaaaaa andmaaaaaa educationalmaaaaaaa\"\n assert candidate(sentence = \"Multiple words starting with a vowel\") == \"ultipleMmaa ordswmaaa tartingsmaaaa ithwmaaaaa amaaaaaa owelvmaaaaaaa\"\n assert candidate(sentence = \"Fuzzy wuzzy was a bear\") == \"uzzyFmaa uzzywmaaa aswmaaaa amaaaaa earbmaaaaaa\"\n assert candidate(sentence = \"Cloud computing and artificial intelligence\") == \"loudCmaa omputingcmaaa andmaaaa artificialmaaaaa intelligencemaaaaaa\"\n assert candidate(sentence = \"AEIOU aeiou UUIIOOAAEE\") == \"AEIOUmaa aeioumaaa UUIIOOAAEEmaaaa\"\n assert candidate(sentence = \"Multiple words with different starting letters\") == \"ultipleMmaa ordswmaaa ithwmaaaa ifferentdmaaaaa tartingsmaaaaaa etterslmaaaaaaa\"\n assert candidate(sentence = \"The quick brown fox jumps over the lazy dog several times\") == \"heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpsjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa everalsmaaaaaaaaaaa imestmaaaaaaaaaaaa\"\n assert candidate(sentence = \"Xylophones yield xylophonic xenon xylophonically\") == \"ylophonesXmaa ieldymaaa ylophonicxmaaaa enonxmaaaaa ylophonicallyxmaaaaaa\"\n assert candidate(sentence = \"Open source software development\") == \"Openmaa ourcesmaaa oftwaresmaaaa evelopmentdmaaaaa\"\n assert candidate(sentence = \"A rapid brown fox jumps over the lazy dog\") == \"Amaa apidrmaaa rownbmaaaa oxfmaaaaa umpsjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa\"\n assert candidate(sentence = \"Quickly zigzagging through the dense forest\") == \"uicklyQmaa igzaggingzmaaa hroughtmaaaa hetmaaaaa ensedmaaaaaa orestfmaaaaaaa\"\n assert candidate(sentence = \"Programming in Python is fun\") == \"rogrammingPmaa inmaaa ythonPmaaaa ismaaaaa unfmaaaaaa\"\n assert candidate(sentence = \"An elephant and an antelope\") == \"Anmaa elephantmaaa andmaaaa anmaaaaa antelopemaaaaaa\"\n assert candidate(sentence = \"This is an exceptionally long sentence to test the robustness of the solution\") == \"hisTmaa ismaaa anmaaaa exceptionallymaaaaa onglmaaaaaa entencesmaaaaaaa otmaaaaaaaa esttmaaaaaaaaa hetmaaaaaaaaaa obustnessrmaaaaaaaaaaa ofmaaaaaaaaaaaa hetmaaaaaaaaaaaaa olutionsmaaaaaaaaaaaaaa\"\n assert candidate(sentence = \"An exquisite oriental fan\") == \"Anmaa exquisitemaaa orientalmaaaa anfmaaaaa\"\n assert candidate(sentence = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\") == \"ABCDEFGHIJKLMNOPQRSTUVWXYZmaa\"\n assert candidate(sentence = \"Virtual reality and augmented reality\") == \"irtualVmaa ealityrmaaa andmaaaa augmentedmaaaaa ealityrmaaaaaa\"\n assert candidate(sentence = \"Every vowel should be handled properly\") == \"Everymaa owelvmaaa houldsmaaaa ebmaaaaa andledhmaaaaaa roperlypmaaaaaaa\"\n assert candidate(sentence = \"A quick movement of the enemy will jeopardize five gunboats\") == \"Amaa uickqmaaa ovementmmaaaa ofmaaaaa hetmaaaaaa enemymaaaaaaa illwmaaaaaaaa eopardizejmaaaaaaaaa ivefmaaaaaaaaaa unboatsgmaaaaaaaaaaa\"\n assert candidate(sentence = \"Beautiful butterflies brightly bask in blazing sun\") == \"eautifulBmaa utterfliesbmaaa rightlybmaaaa askbmaaaaa inmaaaaaa lazingbmaaaaaaa unsmaaaaaaaa\"\n assert candidate(sentence = \"This is a test of the Goat Latin conversion tool\") == \"hisTmaa ismaaa amaaaa esttmaaaaa ofmaaaaaa hetmaaaaaaa oatGmaaaaaaaa atinLmaaaaaaaaa onversioncmaaaaaaaaaa ooltmaaaaaaaaaaa\"\n"}, "metadata": {"canonical_parameter_names": ["sentence"], "leetcode_dataset_entry_point": "Solution().toGoatLatin", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var toGoatLatin = function(sentence) {", "container": null, "callable": "toGoatLatin", "parameters": [{"name": "sentence", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 825, "task_id": "friends-of-appropriate-ages", "difficulty": "Medium", "problem_description": "There are n persons on a social media website. You are given an integer array ages where ages[i] is the age of the ith person.\nA Person x will not send a friend request to a person y (x != y) if any of the following conditions is true:\n\nage[y] <= 0.5 * age[x] + 7\nage[y] > age[x]\nage[y] > 100 && age[x] < 100\n\nOtherwise, x will send a friend request to y.\nNote that if x sends a request to y, y will not necessarily send a request to x. Also, a person will not send a friend request to themself.\nReturn the total number of friend requests made.\n \nExample 1:\n\nInput: ages = [16,16]\nOutput: 2\nExplanation: 2 people friend request each other.\n\nExample 2:\n\nInput: ages = [16,17,18]\nOutput: 2\nExplanation: Friend requests are made 17 -> 16, 18 -> 17.\n\nExample 3:\n\nInput: ages = [20,30,100,110,120]\nOutput: 3\nExplanation: Friend requests are made 110 -> 100, 120 -> 110, 120 -> 100.\n\n \nConstraints:\n\nn == ages.length\n1 <= n <= 2 * 104\n1 <= ages[i] <= 120\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(ages = [120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110]) == 55\n assert candidate(ages = [25, 25, 25, 25, 25, 25, 25, 25, 25, 25]) == 90\n assert candidate(ages = [18, 18, 18, 18, 18, 18, 18, 18, 18, 18]) == 90\n assert candidate(ages = [15, 15, 15, 15, 15]) == 20\n assert candidate(ages = [20, 20, 21, 22, 23, 24, 25]) == 22\n assert candidate(ages = [1, 2, 3, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110]) == 55\n assert candidate(ages = [15, 15, 15, 15]) == 12\n assert candidate(ages = [16, 17, 18, 19, 20]) == 6\n assert candidate(ages = [20, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30]) == 220\n assert candidate(ages = [15, 15, 15, 16, 17]) == 7\n assert candidate(ages = [120, 119, 118, 117, 116, 115, 114, 113, 112, 111]) == 45\n assert candidate(ages = [120, 119, 118, 117, 116]) == 10\n assert candidate(ages = [15, 16, 15, 17, 18]) == 4\n assert candidate(ages = [1, 120, 1, 120, 1, 120, 1, 120, 1, 120]) == 20\n assert candidate(ages = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]) == 25\n assert candidate(ages = [16, 16]) == 2\n assert candidate(ages = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(ages = [16, 16, 16, 16, 16, 16, 16]) == 42\n assert candidate(ages = [16, 32, 48, 64, 80, 96, 112]) == 9\n assert candidate(ages = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 16\n assert candidate(ages = [15, 15, 15]) == 6\n assert candidate(ages = [100, 101, 102, 103, 104]) == 10\n assert candidate(ages = [20, 30, 100, 110, 120]) == 3\n assert candidate(ages = [101, 102, 103, 104, 105]) == 10\n assert candidate(ages = [120, 119, 118, 117, 116, 115]) == 15\n assert candidate(ages = [20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == 90\n assert candidate(ages = [1, 2, 3, 100, 101, 102, 103, 104, 105]) == 15\n assert candidate(ages = [16, 17, 18]) == 2\n assert candidate(ages = [100, 100, 100, 100, 100]) == 20\n assert candidate(ages = [50, 50, 50, 50, 50]) == 20\n assert candidate(ages = [1, 15, 16, 17, 18, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 101, 102, 105, 110, 115, 120]) == 140\n assert candidate(ages = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 306\n assert candidate(ages = [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 303\n assert candidate(ages = [10, 21, 31, 41, 51, 61, 71, 81, 91, 101, 111]) == 20\n assert candidate(ages = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 306\n assert candidate(ages = [20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 72\n assert candidate(ages = [16, 16, 17, 18, 18, 19, 20, 20, 21, 21, 22, 22]) == 43\n assert candidate(ages = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 0\n assert candidate(ages = [16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25]) == 120\n assert candidate(ages = [1, 120, 2, 119, 3, 118, 4, 117, 5, 116, 6, 115, 7, 114, 8, 113, 9, 112, 10, 111, 11, 110, 12]) == 55\n assert candidate(ages = [20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 72\n assert candidate(ages = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 72\n assert candidate(ages = [16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20]) == 84\n assert candidate(ages = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == 2756\n assert candidate(ages = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 110, 111, 112, 113, 114, 115]) == 71\n assert candidate(ages = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 10, 20, 30, 40, 50]) == 43\n assert candidate(ages = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == 2756\n assert candidate(ages = [15, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25]) == 126\n assert candidate(ages = [15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119]) == 676\n assert candidate(ages = [25, 50, 75, 100, 120, 100, 75, 50, 25]) == 20\n assert candidate(ages = [120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120]) == 812\n assert candidate(ages = [5, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 25\n assert candidate(ages = [20, 20, 20, 20, 30, 30, 30, 30, 40, 40, 40, 40, 50, 50, 50, 50, 60, 60, 60, 60]) == 124\n assert candidate(ages = [15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 120]) == 702\n assert candidate(ages = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 120]) == 57\n assert candidate(ages = [18, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 144\n assert candidate(ages = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 120, 120, 120]) == 106\n assert candidate(ages = [18, 25, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 120, 120, 120]) == 53\n assert candidate(ages = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 56\n assert candidate(ages = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]) == 122\n assert candidate(ages = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44]) == 210\n assert candidate(ages = [16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25]) == 285\n assert candidate(ages = [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 56\n assert candidate(ages = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]) == 100\n assert candidate(ages = [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 306\n assert candidate(ages = [16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 16, 24, 32, 40, 48, 56, 64, 72]) == 109\n assert candidate(ages = [15, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28]) == 200\n assert candidate(ages = [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66]) == 136\n assert candidate(ages = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120]) == 110\n assert candidate(ages = [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 25\n assert candidate(ages = [120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120]) == 462\n assert candidate(ages = [75, 75, 75, 75, 80, 80, 80, 85, 85, 90, 90, 95, 95, 100, 100, 105, 105, 110, 110, 115, 115, 120, 120]) == 270\n assert candidate(ages = [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]) == 279\n assert candidate(ages = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 156\n assert candidate(ages = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]) == 25\n assert candidate(ages = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 120, 120, 120, 120, 120]) == 3046\n assert candidate(ages = [15, 15, 16, 17, 18, 19, 20, 20, 20]) == 18\n assert candidate(ages = [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == 1211\n assert candidate(ages = [16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30]) == 254\n assert candidate(ages = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == 2756\n assert candidate(ages = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 99\n assert candidate(ages = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 56\n assert candidate(ages = [10, 12, 14, 16, 18, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 73\n assert candidate(ages = [18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23]) == 64\n assert candidate(ages = [20, 20, 20, 30, 30, 30, 40, 40, 40, 50, 50, 50]) == 42\n assert candidate(ages = [101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == 190\n assert candidate(ages = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]) == 291\n assert candidate(ages = [18, 24, 24, 30, 30, 30, 40, 40, 50, 60, 70, 80, 90, 100, 110, 120]) == 48\n assert candidate(ages = [1, 7, 14, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 1, 7, 14, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]) == 124\n assert candidate(ages = [70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == 465\n assert candidate(ages = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 156\n assert candidate(ages = [20, 20, 20, 30, 30, 30, 40, 40, 40, 50, 50, 50, 60, 60, 60, 70, 70, 70]) == 90\n assert candidate(ages = [16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100]) == 110\n assert candidate(ages = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15]) == 756\n assert candidate(ages = [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 156\n assert candidate(ages = [20, 20, 20, 21, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 173\n assert candidate(ages = [16, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58]) == 326\n assert candidate(ages = [16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23]) == 80\n assert candidate(ages = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 110, 120, 110, 120, 110, 120, 110, 120, 110, 120]) == 160\n assert candidate(ages = [120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 2756\n assert candidate(ages = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == 2756\n assert candidate(ages = [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 25\n"}, "metadata": {"canonical_parameter_names": ["ages"], "leetcode_dataset_entry_point": "Solution().numFriendRequests", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numFriendRequests = function(ages) {", "container": null, "callable": "numFriendRequests", "parameters": [{"name": "ages", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 826, "task_id": "most-profit-assigning-work", "difficulty": "Medium", "problem_description": "You have n jobs and m workers. You are given three arrays: difficulty, profit, and worker where:\n\ndifficulty[i] and profit[i] are the difficulty and the profit of the ith job, and\nworker[j] is the ability of jth worker (i.e., the jth worker can only complete a job with difficulty at most worker[j]).\n\nEvery worker can be assigned at most one job, but one job can be completed multiple times.\n\nFor example, if three workers attempt the same job that pays $1, then the total profit will be $3. If a worker cannot complete any job, their profit is $0.\n\nReturn the maximum profit we can achieve after assigning the workers to the jobs.\n \nExample 1:\n\nInput: difficulty = [2,4,6,8,10], profit = [10,20,30,40,50], worker = [4,5,6,7]\nOutput: 100\nExplanation: Workers are assigned jobs of difficulty [4,4,6,6] and they get a profit of [20,20,30,30] separately.\n\nExample 2:\n\nInput: difficulty = [85,47,57], profit = [24,66,99], worker = [40,25,25]\nOutput: 0\n\n \nConstraints:\n\nn == difficulty.length\nn == profit.length\nm == worker.length\n1 <= n, m <= 104\n1 <= difficulty[i], profit[i], worker[i] <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(difficulty = [68, 35, 52, 47, 86],profit = [67, 17, 17, 26, 86],worker = [68, 37, 50, 76, 33]) == 177\n assert candidate(difficulty = [10, 15, 25],profit = [100, 150, 250],worker = [20, 25, 30]) == 650\n assert candidate(difficulty = [66, 1, 28, 73, 56, 30, 96, 82, 21, 63],profit = [68, 40, 84, 84, 89, 46, 68, 105, 27, 68],worker = [40, 57, 88, 27, 11, 93, 8, 40, 20, 75]) == 716\n assert candidate(difficulty = [10, 20, 30],profit = [60, 50, 40],worker = [40, 25, 20]) == 180\n assert candidate(difficulty = [66, 1, 21, 88, 76, 13, 11, 60, 20, 35, 96, 77, 6, 46, 93],profit = [67, 68, 69, 55, 73, 60, 59, 66, 70, 58, 74, 72, 67, 68, 71],worker = [65, 91, 33, 52, 78]) == 356\n assert candidate(difficulty = [85, 47, 57],profit = [24, 66, 99],worker = [40, 25, 25]) == 0\n assert candidate(difficulty = [100],profit = [100],worker = [100]) == 100\n assert candidate(difficulty = [10, 20, 30],profit = [100, 200, 300],worker = [15, 25, 35]) == 600\n assert candidate(difficulty = [2, 4, 6, 8, 10],profit = [10, 20, 30, 40, 50],worker = [4, 5, 6, 7]) == 100\n assert candidate(difficulty = [5, 9, 10, 7, 4],profit = [4, 1, 10, 3, 9],worker = [4, 5, 6, 7, 8, 9, 10]) == 64\n assert candidate(difficulty = [5, 10, 15],profit = [10, 20, 30],worker = [5, 10, 15, 20]) == 90\n assert candidate(difficulty = [1, 2, 3, 4, 5],profit = [1, 2, 3, 4, 5],worker = [5, 4, 3, 2, 1]) == 15\n assert candidate(difficulty = [1, 1, 1],profit = [1, 2, 3],worker = [1, 1, 1]) == 9\n assert candidate(difficulty = [68, 35, 52, 47, 86],profit = [67, 17, 1, 50, 76],worker = [36, 99, 24, 79, 50]) == 210\n assert candidate(difficulty = [5, 15, 25, 35, 45, 55],profit = [10, 20, 30, 40, 50, 60],worker = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 450\n assert candidate(difficulty = [3, 5, 7, 9, 11, 13, 15, 17, 19, 21],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [10, 20, 30, 40, 50, 60, 70, 80, 90]) == 830\n assert candidate(difficulty = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 1000\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],profit = [150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10],worker = [1, 3, 5, 7, 9, 11, 13, 15]) == 1200\n assert candidate(difficulty = [50000, 25000, 12500, 6250, 3125, 1562, 781, 390, 195, 97],profit = [90, 80, 70, 60, 50, 40, 30, 20, 10, 5],worker = [20000, 40000, 60000, 80000, 100000, 120000, 140000, 160000, 180000, 200000]) == 870\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1000\n assert candidate(difficulty = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],worker = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 100\n assert candidate(difficulty = [1, 2, 3, 4, 5],profit = [10, 2, 15, 4, 25],worker = [1, 2, 3, 4, 5]) == 75\n assert candidate(difficulty = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],worker = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == 9\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 1050\n assert candidate(difficulty = [5, 2, 10, 3, 8],profit = [20, 10, 30, 5, 40],worker = [3, 15, 10, 2, 8]) == 140\n assert candidate(difficulty = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],profit = [20, 40, 60, 80, 100, 120, 140, 160, 180, 200],worker = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 1900\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1000\n assert candidate(difficulty = [100000, 90000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],worker = [10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000]) == 10000\n assert candidate(difficulty = [1, 1, 1, 1, 1],profit = [100, 200, 300, 400, 500],worker = [1, 1, 1, 1, 1]) == 2500\n assert candidate(difficulty = [100000, 90000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],worker = [10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000]) == 100\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],worker = [1, 3, 5, 7, 9, 11, 13, 15, 2, 4, 6, 8, 10, 12, 14]) == 1200\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 550\n assert candidate(difficulty = [100, 200, 300, 400, 500],profit = [1000, 900, 800, 700, 600],worker = [250, 150, 350, 450, 550]) == 5000\n assert candidate(difficulty = [10, 20, 30, 40, 50],profit = [10, 10, 10, 10, 10],worker = [5, 15, 25, 35, 45, 55]) == 50\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],profit = [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39],worker = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 300\n assert candidate(difficulty = [5, 10, 15, 20, 25],profit = [10, 20, 30, 40, 50],worker = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]) == 290\n assert candidate(difficulty = [2, 2, 2, 2, 2],profit = [50, 50, 50, 50, 50],worker = [2, 2, 2, 2, 2]) == 250\n assert candidate(difficulty = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],worker = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110]) == 11\n assert candidate(difficulty = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],profit = [20, 18, 16, 14, 12, 10, 8, 6, 4, 2],worker = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 180\n assert candidate(difficulty = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],worker = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 100\n assert candidate(difficulty = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],profit = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],worker = [20, 18, 16, 14, 12, 10, 8, 6, 4, 2]) == 100\n assert candidate(difficulty = [1, 5, 7, 10, 15],profit = [2, 8, 10, 4, 6],worker = [1, 3, 5, 7, 9, 11, 13, 15]) == 62\n assert candidate(difficulty = [1, 5, 7, 10, 15, 20, 25, 30, 35, 40, 45, 50],profit = [100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650],worker = [3, 6, 8, 12, 16, 18, 22, 26, 28, 32, 36, 38]) == 3900\n assert candidate(difficulty = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],worker = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 100\n assert candidate(difficulty = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],profit = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100],worker = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 10000\n assert candidate(difficulty = [1, 2, 3, 4, 5],profit = [100000, 90000, 80000, 70000, 60000],worker = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 2500000\n assert candidate(difficulty = [1, 5, 10, 15, 20],profit = [500, 400, 300, 200, 100],worker = [25, 20, 15, 10, 5]) == 2500\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],worker = [1, 3, 5, 7, 9]) == 2500\n assert candidate(difficulty = [1, 2, 3, 4, 5],profit = [1, 2, 3, 4, 5],worker = [5, 5, 5, 5, 5]) == 25\n assert candidate(difficulty = [1, 10, 100, 1000, 10000],profit = [10000, 1000, 100, 10, 1],worker = [1, 5, 10, 50, 100, 500, 1000, 5000, 10000]) == 90000\n assert candidate(difficulty = [20, 10, 30, 40, 50],profit = [100, 50, 200, 150, 250],worker = [5, 15, 25, 35, 45, 55]) == 800\n assert candidate(difficulty = [100000, 10000, 1000, 100, 10],profit = [1, 10, 100, 1000, 10000],worker = [50, 500, 5000, 50000, 100000]) == 50000\n assert candidate(difficulty = [5, 5, 5],profit = [10, 20, 30],worker = [5, 5, 5]) == 90\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],worker = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1000\n assert candidate(difficulty = [10, 20, 30, 40, 50],profit = [10, 20, 30, 40, 50],worker = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 250\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 100\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [100, 150, 200, 250, 300, 350, 400, 450, 500, 550],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 14250\n assert candidate(difficulty = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],worker = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == 4500\n assert candidate(difficulty = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],worker = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 5500\n assert candidate(difficulty = [50, 25, 75, 100, 125],profit = [10, 20, 30, 40, 50],worker = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 430\n assert candidate(difficulty = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],profit = [100, 200, 100, 300, 200, 400, 300, 500, 400, 600],worker = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 5000\n assert candidate(difficulty = [100000, 90000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],worker = [10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000]) == 100\n assert candidate(difficulty = [100000],profit = [100000],worker = [100000]) == 100000\n assert candidate(difficulty = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1000\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],worker = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 100\n assert candidate(difficulty = [30, 20, 10],profit = [3, 2, 1],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(difficulty = [10, 20, 30, 40, 50],profit = [5, 15, 25, 35, 45],worker = [10, 25, 35, 45, 55]) == 125\n assert candidate(difficulty = [100000, 99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],worker = [50000, 50001, 50002, 50003, 50004, 50005, 50006, 50007, 50008, 50009]) == 0\n assert candidate(difficulty = [10, 20, 30, 40, 50],profit = [50, 40, 30, 20, 10],worker = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 500\n assert candidate(difficulty = [5, 2, 1, 8, 3, 7, 4, 6, 9, 10],profit = [50, 20, 10, 80, 30, 70, 40, 60, 90, 100],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 550\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 100\n assert candidate(difficulty = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],profit = [50, 40, 30, 20, 10, 50, 40, 30, 20, 10],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 300\n assert candidate(difficulty = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 1000\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 100\n assert candidate(difficulty = [100, 50, 150, 200, 250],profit = [300, 200, 400, 500, 600],worker = [200, 300, 100, 150, 250, 50]) == 2600\n assert candidate(difficulty = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [1, 6, 11, 16, 21, 26, 31, 36, 41, 46]) == 450\n assert candidate(difficulty = [50, 40, 30, 20, 10],profit = [1000, 900, 800, 700, 600],worker = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90]) == 8000\n assert candidate(difficulty = [3, 6, 12, 24, 48],profit = [10, 20, 40, 80, 160],worker = [1, 2, 4, 8, 16, 32, 64, 128, 256]) == 630\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 750\n assert candidate(difficulty = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 1100\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [5, 8, 3, 10, 2, 7, 6, 9, 1, 4],worker = [1, 3, 5, 7, 9]) == 43\n assert candidate(difficulty = [100, 150, 200],profit = [10, 20, 30],worker = [50, 100, 125, 150, 175, 200, 250]) == 120\n assert candidate(difficulty = [10, 20, 30, 40, 50],profit = [50, 40, 30, 20, 10],worker = [5, 15, 25, 35, 45, 55]) == 250\n assert candidate(difficulty = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],worker = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 60\n assert candidate(difficulty = [1, 10, 100, 1000, 10000],profit = [10, 100, 1000, 10000, 100000],worker = [1, 5, 50, 500, 5000, 10000, 15000]) == 211120\n assert candidate(difficulty = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],profit = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],worker = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 1000\n assert candidate(difficulty = [20, 40, 60, 80, 100, 120, 140, 160, 180, 200],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],worker = [10, 30, 50, 70, 90, 110, 130, 150, 170, 190, 210]) == 55\n assert candidate(difficulty = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],profit = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],worker = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 110\n assert candidate(difficulty = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],worker = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105]) == 10\n assert candidate(difficulty = [5, 15, 25, 35, 45],profit = [10, 20, 30, 40, 50],worker = [1, 10, 20, 30, 40, 50]) == 150\n assert candidate(difficulty = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],profit = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],worker = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1000\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],worker = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 400\n assert candidate(difficulty = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 550\n assert candidate(difficulty = [100000, 90000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [99999, 89999, 79999, 69999, 59999, 49999, 39999, 29999, 19999, 9999]) == 900\n assert candidate(difficulty = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 550\n assert candidate(difficulty = [50000, 40000, 30000, 20000, 10000],profit = [100, 200, 300, 400, 500],worker = [50000, 45000, 40000, 35000, 30000, 25000, 20000, 15000, 10000, 5000]) == 4500\n assert candidate(difficulty = [1, 2, 3, 4, 5],profit = [5, 4, 3, 2, 1],worker = [1, 2, 3, 4, 5]) == 25\n assert candidate(difficulty = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],profit = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],worker = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 380\n assert candidate(difficulty = [10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],worker = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == 600\n assert candidate(difficulty = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],worker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 210\n assert candidate(difficulty = [100000, 100000, 100000],profit = [100000, 100000, 100000],worker = [100000, 100000, 100000]) == 300000\n assert candidate(difficulty = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],worker = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 6000\n assert candidate(difficulty = [5, 4, 8, 6, 9, 10, 12, 14, 16, 18],profit = [30, 20, 80, 60, 90, 100, 110, 120, 130, 140],worker = [5, 7, 9, 11, 13, 15, 17, 19, 21]) == 920\n assert candidate(difficulty = [10000, 20000, 30000, 40000, 50000],profit = [100, 200, 300, 400, 500],worker = [5000, 15000, 25000, 35000, 45000, 55000]) == 1500\n assert candidate(difficulty = [5, 10, 15, 20],profit = [50, 30, 20, 60],worker = [5, 10, 15, 20]) == 210\n"}, "metadata": {"canonical_parameter_names": ["difficulty", "profit", "worker"], "leetcode_dataset_entry_point": "Solution().maxProfitAssignment", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxProfitAssignment = function(difficulty, profit, worker) {", "container": null, "callable": "maxProfitAssignment", "parameters": [{"name": "difficulty", "type": "number[]"}, {"name": "profit", "type": "number[]"}, {"name": "worker", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 827, "task_id": "making-a-large-island", "difficulty": "Hard", "problem_description": "You are given an n x n binary matrix grid. You are allowed to change at most one 0 to be 1.\nReturn the size of the largest island in grid after applying this operation.\nAn island is a 4-directionally connected group of 1s.\n \nExample 1:\n\nInput: grid = [[1,0],[0,1]]\nOutput: 3\nExplanation: Change one 0 to 1 and connect two 1s, then we get an island with area = 3.\n\nExample 2:\n\nInput: grid = [[1,1],[1,0]]\nOutput: 4\nExplanation: Change the 0 to 1 and make the island bigger, only one island with area = 4.\nExample 3:\n\nInput: grid = [[1,1],[1,1]]\nOutput: 4\nExplanation: Can't change any 0 to 1, only one island with area = 4.\n\n \nConstraints:\n\nn == grid.length\nn == grid[i].length\n1 <= n <= 500\ngrid[i][j] is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1, 1], [1, 0]]) == 4\n assert candidate(grid = [[1, 0], [0, 1]]) == 3\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 9\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]]) == 13\n assert candidate(grid = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == 5\n assert candidate(grid = [[1, 0, 1, 1], [0, 1, 0, 0], [1, 0, 1, 1], [1, 0, 1, 1]]) == 8\n assert candidate(grid = [[0, 1, 1, 1], [1, 0, 0, 0], [1, 0, 0, 0], [1, 1, 1, 0]]) == 9\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 1\n assert candidate(grid = [[1, 1], [1, 1]]) == 4\n assert candidate(grid = [[1, 1, 0, 0], [0, 0, 0, 0], [0, 0, 1, 1], [0, 0, 0, 0]]) == 3\n assert candidate(grid = [[0, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0]]) == 4\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 3\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 4\n assert candidate(grid = [[1, 1, 1, 0, 0], [1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]]) == 7\n assert candidate(grid = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 5\n assert candidate(grid = [[1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [0, 0, 0, 0, 0], [1, 0, 0, 0, 1], [1, 1, 0, 1, 1]]) == 7\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]]) == 3\n assert candidate(grid = [[1, 1, 1, 1, 0], [1, 0, 0, 1, 0], [1, 0, 0, 1, 1], [1, 1, 0, 0, 0], [0, 0, 0, 0, 1]]) == 13\n assert candidate(grid = [[1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1]]) == 19\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) == 2\n assert candidate(grid = [[1, 0, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1], [1, 0, 0, 1, 0, 1]]) == 8\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 5\n assert candidate(grid = [[0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [1, 1, 1, 1, 1], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0]]) == 10\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 17\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 1]]) == 4\n assert candidate(grid = [[1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1], [1, 1, 0, 0, 0]]) == 11\n assert candidate(grid = [[0, 0, 0, 1, 1], [0, 0, 0, 1, 0], [1, 0, 0, 1, 0], [1, 0, 0, 0, 1], [1, 0, 1, 1, 1]]) == 9\n assert candidate(grid = [[0, 1, 0, 1, 0], [1, 1, 1, 1, 1], [0, 1, 0, 1, 0], [1, 1, 1, 1, 1], [0, 1, 0, 1, 0]]) == 17\n assert candidate(grid = [[0, 1, 0, 0, 0], [1, 1, 1, 0, 0], [0, 1, 0, 1, 1], [0, 0, 1, 1, 0], [0, 0, 0, 1, 0]]) == 11\n assert candidate(grid = [[1, 1, 0, 1, 0, 0, 1], [0, 0, 0, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1]]) == 9\n assert candidate(grid = [[1, 1, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1], [1, 1, 1, 0, 1, 1]]) == 9\n assert candidate(grid = [[1, 1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1], [0, 0, 1, 1, 1]]) == 6\n assert candidate(grid = [[1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1], [0, 1, 0, 0, 0, 1], [0, 1, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 1, 1, 0], [1, 1, 0, 0, 1], [0, 0, 0, 0, 0], [0, 1, 0, 1, 0], [0, 0, 1, 1, 0]]) == 5\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 1]]) == 10\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 9\n assert candidate(grid = [[1, 1, 0, 1, 1], [0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 1, 0, 1, 1]]) == 14\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 1, 1, 0], [1, 0, 0, 0, 1], [0, 1, 1, 1, 0], [1, 0, 1, 0, 1]]) == 10\n assert candidate(grid = [[1, 1, 1, 0, 0], [1, 0, 1, 1, 0], [1, 0, 1, 0, 1], [0, 1, 1, 0, 0], [0, 0, 0, 1, 1]]) == 13\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 0, 0, 1, 1], [0, 0, 0, 1, 0], [0, 1, 0, 0, 0], [1, 1, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1]]) == 3\n assert candidate(grid = [[1, 0, 1, 1, 0, 0, 1], [0, 1, 0, 0, 0, 1, 0], [1, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 1], [0, 1, 0, 0, 0, 1, 0], [1, 0, 1, 1, 0, 0, 1]]) == 6\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 9\n assert candidate(grid = [[1, 1, 0, 1, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 1, 0, 1, 1]]) == 16\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 18\n assert candidate(grid = [[1, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0], [1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1]]) == 3\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1]]) == 5\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 25\n assert candidate(grid = [[1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 1, 1, 0, 0]]) == 15\n assert candidate(grid = [[1, 1, 1, 1, 0], [0, 0, 0, 0, 0], [0, 1, 1, 1, 1], [0, 0, 0, 0, 0], [1, 1, 1, 1, 0]]) == 9\n assert candidate(grid = [[1, 0, 0, 1, 1], [0, 0, 0, 0, 0], [1, 1, 0, 1, 1], [1, 1, 0, 0, 0], [1, 0, 1, 0, 0]]) == 8\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0]]) == 7\n assert candidate(grid = [[1, 0, 0, 1, 1], [0, 1, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [1, 1, 0, 1, 0]]) == 8\n assert candidate(grid = [[0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0]]) == 10\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]]) == 7\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 0, 1], [1, 0, 0, 0, 0], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1], [1, 1, 0, 0, 1]]) == 11\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1]]) == 5\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1], [0, 0, 0, 0, 0]]) == 5\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 5\n assert candidate(grid = [[1, 1, 1, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [1, 1, 1, 1, 0]]) == 9\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 5\n assert candidate(grid = [[0, 1, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0]]) == 12\n assert candidate(grid = [[1, 1, 0, 0, 0, 1], [1, 1, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0], [1, 1, 0, 0, 0, 1], [1, 1, 0, 0, 0, 1]]) == 7\n assert candidate(grid = [[1, 1, 0, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 1, 1]]) == 4\n assert candidate(grid = [[1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0], [1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 0, 1, 1]]) == 17\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 5\n assert candidate(grid = [[0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 5\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 9\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 1, 1, 0, 0], [0, 1, 1, 0, 0], [0, 0, 0, 1, 1], [1, 1, 0, 0, 0]]) == 7\n assert candidate(grid = [[1, 0, 1, 1, 0], [0, 0, 1, 0, 0], [1, 1, 1, 0, 1], [1, 0, 0, 0, 1], [0, 1, 1, 1, 0]]) == 11\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 0], [1, 0, 1, 0, 1, 1, 0], [1, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1]]) == 19\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 10\n assert candidate(grid = [[1, 1, 1, 0, 0], [0, 0, 0, 0, 1], [0, 0, 0, 1, 1], [1, 1, 0, 0, 0], [0, 0, 0, 0, 0]]) == 4\n assert candidate(grid = [[1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1]]) == 5\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]]) == 49\n assert candidate(grid = [[1, 1, 1, 1, 0], [1, 0, 0, 1, 0], [1, 0, 0, 1, 0], [1, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 10\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 1, 1, 0], [1, 0, 1, 0, 1]]) == 14\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 3\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().largestIsland", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var largestIsland = function(grid) {", "container": null, "callable": "largestIsland", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 828, "task_id": "count-unique-characters-of-all-substrings-of-a-given-string", "difficulty": "Hard", "problem_description": "Let's define a function countUniqueChars(s) that returns the number of unique characters in s.\n\nFor example, calling countUniqueChars(s) if s = \"LEETCODE\" then \"L\", \"T\", \"C\", \"O\", \"D\" are the unique characters since they appear only once in s, therefore countUniqueChars(s) = 5.\n\nGiven a string s, return the sum of countUniqueChars(t) where t is a substring of s. The test cases are generated such that the answer fits in a 32-bit integer.\nNotice that some substrings can be repeated so in this case you have to count the repeated ones too.\n \nExample 1:\n\nInput: s = \"ABC\"\nOutput: 10\nExplanation: All possible substrings are: \"A\",\"B\",\"C\",\"AB\",\"BC\" and \"ABC\".\nEvery substring is composed with only unique letters.\nSum of lengths of all substring is 1 + 1 + 1 + 2 + 2 + 3 = 10\n\nExample 2:\n\nInput: s = \"ABA\"\nOutput: 8\nExplanation: The same as example 1, except countUniqueChars(\"ABA\") = 1.\n\nExample 3:\n\nInput: s = \"LEETCODE\"\nOutput: 92\n\n \nConstraints:\n\n1 <= s.length <= 105\ns consists of uppercase English letters only.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"ABCDEFG\") == 84\n assert candidate(s = \"ABAC\") == 16\n assert candidate(s = \"ABAB\") == 12\n assert candidate(s = \"JXWTRVABFBJSFNWFTTTOWEJXSGZSWQSZSQXRXRJTSFO\") == 4609\n assert candidate(s = \"ABCABC\") == 36\n assert candidate(s = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\") == 3276\n assert candidate(s = \"LEETCODE\") == 92\n assert candidate(s = \"ABABAB\") == 20\n assert candidate(s = \"AA\") == 2\n assert candidate(s = \"UPPERCASEENGLISHLETTERS\") == 1236\n assert candidate(s = \"ABC\") == 10\n assert candidate(s = \"AABAA\") == 15\n assert candidate(s = \"GCIYVUTETZTEKFREERERREERETEEEEEEDDDB\") == 2050\n assert candidate(s = \"A\") == 1\n assert candidate(s = \"ZZZ\") == 3\n assert candidate(s = \"ABA\") == 8\n assert candidate(s = \"ABABABABAB\") == 36\n assert candidate(s = \"AAABBBCCC\") == 27\n assert candidate(s = \"ZYXWVUTSRQPONMLKJIHGFEDCBA\") == 3276\n assert candidate(s = \"ABCA\") == 18\n assert candidate(s = \"ZZZZZZZZZZ\") == 10\n assert candidate(s = \"ABCDEFGHIJKLMNOPQRST\") == 1540\n assert candidate(s = \"UVRMCGWAHTRWWQRRQRQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ\") == 3333\n assert candidate(s = \"ABCDABCD\") == 80\n assert candidate(s = \"ZZZZZZZZZZZZZZZZZZZZZZZZZZ\") == 26\n assert candidate(s = \"SUPERLONGSTRINGWITHMANYCHARACTERSTOTESTTHEFUNCTIONALITYOFTHISSOLUTION\") == 11748\n assert candidate(s = \"UPPERCASEISUSEDUPPERCASEISUSEDUPPERCASEISUSEDUPPERCASEISUSED\") == 4352\n assert candidate(s = \"PYTHON\") == 56\n assert candidate(s = \"ALGORITHMSDESIGN\") == 688\n assert candidate(s = \"TESTTESTTESTTESTTEST\") == 166\n assert candidate(s = \"LONGSTRINGLONGSTRINGLONGSTRINGLONGSTRINGLONGSTRINGLONGSTRINGLONGSTRINGLONGSTRING\") == 4992\n assert candidate(s = \"VARYINGVARYINGVARYINGVARYINGVARYINGVARYINGVARYING\") == 2107\n assert candidate(s = \"REALLYLONGSTRINGWITHVARYINGCHARACTERFREQUENCIES\") == 6279\n assert candidate(s = \"XYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZ\") == 576\n assert candidate(s = \"DATASTRUCTURESANDALGORITHMS\") == 2087\n assert candidate(s = \"ALMOSTUNIQUEALMOSTUNIQUEALMOSTUNIQUEALMOSTUNIQUE\") == 4668\n assert candidate(s = \"AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXXXXYYYYYYZZZZZZ\") == 2262\n assert candidate(s = \"HIGHFREQUENCYHIGHFREQUENCYHIGHFREQUENCY\") == 3465\n assert candidate(s = \"THISPROBLEMMIGHTBEHARDTOSOLVEBUTITISNOTTHISPROBLEMMIGHTBEHARDTOSOLVEBUTITISNOT\") == 17778\n assert candidate(s = \"BUNCHOFOFTHEBUNCHOFTHEBUNCHOFTHE\") == 1902\n assert candidate(s = \"\") == 0\n assert candidate(s = \"HIGHFREQHIGHFREQHIGHFREQHIGHFREQHIGHFREQHIGHFREQHIGHFREQ\") == 2550\n assert candidate(s = \"AACBBBCCCCDDDDEEEEEFFFFFFFFGGGGGGHHHHHHHIIIIIIIIIJJJJJJJJ\") == 579\n assert candidate(s = \"UPPERCASELOWERCASEUPPERCASELOWERCASEUPPERCASELOWERCASE\") == 4631\n assert candidate(s = \"SAMECHARSSAMECHARSSAMECHARSSAMECHARS\") == 1469\n assert candidate(s = \"UPPERCASELOWERCASE\") == 723\n assert candidate(s = \"QWERTYUIOPASDFGHJKLZXCVBNMQWERTYUIOPASDFGHJKLZXCVBNM\") == 18252\n assert candidate(s = \"ABACADAEAFAG\") == 204\n assert candidate(s = \"MMMMMMMMMMMMAAAAAAAAAA\") == 44\n assert candidate(s = \"ALONGSTRINGWITHSOMEUNIQUECHARACTERSTHROUGHOUT\") == 5238\n assert candidate(s = \"LEETCODELEETCODELEETCODE\") == 726\n assert candidate(s = \"HELLOHELLOHELLOHELLOHELLO\") == 352\n assert candidate(s = \"UPPERCASEUPPERCASEUPPERCASE\") == 1001\n assert candidate(s = \"VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\") == 52\n assert candidate(s = \"HELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLO\") == 684\n assert candidate(s = \"ABCDEFGHIJKLMNOPQRSTABCDEFGHIJKLMNOPQRST\") == 8400\n assert candidate(s = \"AAABBBCCCDDD\") == 48\n assert candidate(s = \"THETREESAREBIGANDGREEN\") == 1035\n assert candidate(s = \"PYTHONPROGRAMMINGPYTHONPROGRAMMINGPYTHONPROGRAMMINGPYTHONPROGRAMMINGPYTHONPROGRAMMING\") == 8740\n assert candidate(s = \"REPEATSREPEATSREPEATSREPEATSREPEATSREPEATSREPEATSREPEATSREPEATSREPEATS\") == 2432\n assert candidate(s = \"COMPLEXSTRINGWITHMIXEDCHARACTERSDGFFFVGDVHFDGDFJGDFGDFGDFGDFGDFGDFGDFG\") == 10601\n assert candidate(s = \"ZABZACZADBZADCZADEZAEFZAFGZAFHZAGIZAHJZAKZALZAMZANZAOZAPZAQZARZASZATAUAVAWAXAYAZ\") == 22977\n assert candidate(s = \"REPEATREPEATREPEATREPEATREPEATREPEAT\") == 834\n assert candidate(s = \"ABCDEFGHIJKLMNOPQRSTUPONMLKJIHGFEDCBA\") == 6147\n assert candidate(s = \"XYZXYZXYZXYZXYZ\") == 117\n assert candidate(s = \"UNIQUECHARACTER\") == 468\n assert candidate(s = \"ABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGH\") == 3648\n assert candidate(s = \"AABCCDDEEFFGHHIJKLMMNOOPPQQRRSSTTUUVVWWXXYYZZ\") == 3859\n assert candidate(s = \"CONTAINSREPETITIONSCONTAINSREPETITIONSCONTAINSREPETITIONS\") == 4748\n assert candidate(s = \"KOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOKOK\") == 368\n assert candidate(s = \"SOMEVARIETYOFCHARSHEREANDTHERE\") == 2687\n assert candidate(s = \"SUPERLONGSTRINGWITHVARYINGCHARACTERFREQUENCIES\") == 6393\n assert candidate(s = \"UPPERCASEUPPERCASEUPPERCASEUPPERCASE\") == 1462\n assert candidate(s = \"PYTHONPROGRAMMING\") == 597\n assert candidate(s = \"AABCCDEEFFGHIJKLMMNOOPQRSTUUVWXYZ\") == 4065\n assert candidate(s = \"MISINTERPRETATIONMISINTERPRETATION\") == 2247\n assert candidate(s = \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\") == 72\n assert candidate(s = \"VARYINGCASESabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\") == 42384\n assert candidate(s = \"EXAMPLEWITHREPEATEDCHARSEXAMPLEWITHREPEATEDCHARSEXAMPLEWITHREPEATEDCHARS\") == 12926\n assert candidate(s = \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\") == 90\n assert candidate(s = \"AAAAAAAAABBBBBBBBCCCCCCCCCC\") == 81\n assert candidate(s = \"AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ\") == 1352\n assert candidate(s = \"SHORTLONGSHORTLONGSHORTLONGSHORTLONGSHORTLONG\") == 2515\n assert candidate(s = \"REALLYLONGSTRINGTOCHECKEFFICIENCYREALLYLONGSTRINGTOCHECKEFFICIENCY\") == 9311\n assert candidate(s = \"AABABABABABABABABABABABABABABABABABABABAB\") == 159\n assert candidate(s = \"MULTIPLEOCCURRENCESOFTHESAMELETTER\") == 3148\n assert candidate(s = \"UPPERCASEANDLOWERCASEANDNUMBERS1234567890\") == 6362\n assert candidate(s = \"AABBCCEEE\") == 36\n assert candidate(s = \"AAAAABBBBBCCCCC\") == 45\n assert candidate(s = \"AABCCDEE\") == 60\n assert candidate(s = \"AABBCCDDEEFFGGAABBCCDDEEFFGG\") == 280\n assert candidate(s = \"ALLTHELETTERSOFTHEALPHABETALLTHELETTERSOFTHEALPHABET\") == 5626\n assert candidate(s = \"XYZXYZXYZ\") == 63\n assert candidate(s = \"NINCOMPOOP\") == 138\n assert candidate(s = \"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ\") == 18252\n assert candidate(s = \"UNIQUEUNIQUEUNIQUE\") == 356\n assert candidate(s = \"ABACABACABAC\") == 94\n assert candidate(s = \"NOTSOEASYNOTSOEASYNOTSOEASY\") == 1052\n assert candidate(s = \"ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB\") == 244\n assert candidate(s = \"ZZZZZZZZZZYYYYYYYYYYXXXXXXXXXXWWWWWWWWVVVVVVVVUUUUUU\") == 312\n assert candidate(s = \"XYZXYZXYZXYZXYZXYZXYZXYZ\") == 198\n assert candidate(s = \"THISISTHEMOSTCOMPLEXTESTCASE\") == 1699\n assert candidate(s = \"AABCAAABCAAAABC\") == 132\n assert candidate(s = \"NOCOLLISIONNOCOLLISIONNOCOLLISIONNOCOLLISIONNOCOLLISIONNOCOLLISION\") == 1871\n assert candidate(s = \"AAAAABBBBBCCCCCDDDDD\") == 80\n assert candidate(s = \"ABACADAEAFAGAHAIAJAKALAMANAOAPAQAQARASATAUAVAWAXAYAZ\") == 11288\n assert candidate(s = \"X\") == 1\n assert candidate(s = \"AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYZZ\") == 1422\n assert candidate(s = \"ABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVA\") == 7168\n assert candidate(s = \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\") == 40\n assert candidate(s = \"SIMPLESTRING\") == 340\n assert candidate(s = \"LEETCODEISAWESOMEEVERYTHINGISPOSSIBLE\") == 4975\n assert candidate(s = \"SUBSTRINGCALCULATIONSARETRICKYTOGETRIGHT\") == 4360\n assert candidate(s = \"ABABABABABABABABABABABABAB\") == 100\n assert candidate(s = \"MIXEDCASEMIXEDCASEMIXEDCASE\") == 1302\n assert candidate(s = \"HELLOWORLDHELLOWORLDHELLOWORLD\") == 1208\n assert candidate(s = \"SUBSTRINGSUBSTRINGSUBSTRINGSUBSTRING\") == 1893\n assert candidate(s = \"SIMPLECOMPLEXSIMPLECOMPLEXSIMPLECOMPLEXSIMPLECOMPLEXSIMPLECOMPLEX\") == 4981\n assert candidate(s = \"REPEATEDCHARACTERSCONTINUOUSLYAAAAAAAAAAAAAAAA\") == 4381\n assert candidate(s = \"SUBSTRINGCALCULATIONISEXTRAORDINARY\") == 3303\n assert candidate(s = \"IDENTICALBLOCKSIDENTICALBLOCKSIDENTICALBLOCKS\") == 4848\n assert candidate(s = \"QWJRTYUPASDFGHJKLZXCVBNM\") == 2540\n assert candidate(s = \"HELLOWORLDHELLOWORLD\") == 647\n assert candidate(s = \"ABCDEFGHIJABCDEFGHIJ\") == 1100\n assert candidate(s = \"WASITATRATITASAWASITATRATITASAWASITATRATITASA\") == 1696\n assert candidate(s = \"AVOIDREPETITIONSINHEREAVOIDREPETITIONSINHEREAVOIDREPETITIONSINHERE\") == 8106\n assert candidate(s = \"ABCDEFGHJIJKLMNOPQRSTUVWXYZ\") == 3348\n assert candidate(s = \"ZBCDEFGHIJKLMNOPQRSTUVWXYZZYXWVUTSRQPONMLKJIHGFEDCBA\") == 12376\n assert candidate(s = \"MISSISSIPPI\") == 61\n assert candidate(s = \"PYTHONPYTHONPYTHONPYTHON\") == 684\n assert candidate(s = \"ALPHABETALPHABETALPHABETALPHABET\") == 1316\n assert candidate(s = \"REPEATREPEATREPEATREPEATREPEATREPEATREPEATREPEATREPEAT\") == 1314\n assert candidate(s = \"CHECKINGUNIQUECHARSCHECKINGUNIQUECHARSCHECKINGUNIQUECHARS\") == 6460\n assert candidate(s = \"AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPPQQQQRRRRSSSSTTTTUUUUVVVVWWWWXXXXYYYYZZZZ\") == 2704\n assert candidate(s = \"AAABBBCCCDDDEEEFFFGGGHHHHIIIJJJKKKLLLMMMNNNOOOPPPPQQQQRRRRSSSSTTTTUUUVVVWWWXXXYYYYZZZZ\") == 2236\n assert candidate(s = \"UNIQUECHARACTERSCOUNTUNIQUECHARACTERSCOUNTUNIQUECHARACTERSCOUNT\") == 7133\n assert candidate(s = \"HELLOOOWORLD\") == 156\n assert candidate(s = \"PYTHONPYTHONPYTHON\") == 468\n assert candidate(s = \"TESTSTRINGTESTSTRINGTESTSTRINGTESTSTRING\") == 1776\n assert candidate(s = \"ABCABCABCABCABCABCABCABCABCABCABCABCABCABC\") == 360\n assert candidate(s = \"CONSECUTIVECHARSAREHERECONSECUTIVECHARSAREHERECONSECUTIVECHARSAREHERE\") == 9088\n assert candidate(s = \"REPEATEDLETTERSARETRICKY\") == 1108\n assert candidate(s = \"RECURSION\") == 155\n assert candidate(s = \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\") == 104\n assert candidate(s = \"SUPERDUPERLONGSTRINGWITHMANYCHARACTERS\") == 4375\n assert candidate(s = \"AGCTAGCTAGCTAGCTAGCTAGCTAGCTAGCTAGCTAGCTAGCTAGCT\") == 720\n assert candidate(s = \"COMPUTERSCIENCE\") == 557\n assert candidate(s = \"LOWFREQLOWFREQLOWFREQLOWFREQLOWFREQLOWFREQLOWFREQLOWFREQLOWFREQLOWFREQLOWFREQLOWFREQ\") == 3822\n assert candidate(s = \"THETRUTHISTHETRUTH\") == 567\n assert candidate(s = \"QWERTYUIOPASDFGHJKLZXCVBNM\") == 3276\n assert candidate(s = \"UNIQUECHARACTERFUNCTION\") == 1232\n assert candidate(s = \"ZYXWVUTSRQPONMLKJIHGFEDCBAZYXWVUTSRQPONMLKJIHGFEDCBA\") == 18252\n assert candidate(s = \"LONGSTRINGSOMETIMESCONTAINMANYLETTERS\") == 2957\n assert candidate(s = \"MIXEDCASEBUTSAMECHARSMIXEDCASEBUTSAMECHARSMIXEDCASEBUTSAMECHARS\") == 9433\n assert candidate(s = \"LOWFREQUENCYLOWFREQUENCYLOWFREQUENCY\") == 3138\n assert candidate(s = \"ABACABA\") == 44\n assert candidate(s = \"AAABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ\") == 1378\n assert candidate(s = \"MNONMMNONMMNONMMNONMMNONMMNONMMNONMMNONMMNONMMNONMMNONMMNONMMNONM\") == 561\n assert candidate(s = \"AAAAAAAAAAAAAAAAAAAAAAAA\") == 24\n assert candidate(s = \"ABACADAEAFAGAHAIAJAKALAMANAOAPAQAQARASATAUAUAVAWAXAYAZ\") == 11698\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().uniqueLetterString", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var uniqueLetterString = function(s) {", "container": null, "callable": "uniqueLetterString", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 829, "task_id": "consecutive-numbers-sum", "difficulty": "Hard", "problem_description": "Given an integer n, return the number of ways you can write n as the sum of consecutive positive integers.\n \nExample 1:\n\nInput: n = 5\nOutput: 2\nExplanation: 5 = 2 + 3\n\nExample 2:\n\nInput: n = 9\nOutput: 3\nExplanation: 9 = 4 + 5 = 2 + 3 + 4\n\nExample 3:\n\nInput: n = 15\nOutput: 4\nExplanation: 15 = 8 + 7 = 4 + 5 + 6 = 1 + 2 + 3 + 4 + 5\n\n \nConstraints:\n\n1 <= n <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 100) == 3\n assert candidate(n = 15) == 4\n assert candidate(n = 9) == 3\n assert candidate(n = 1000000) == 7\n assert candidate(n = 25) == 3\n assert candidate(n = 1) == 1\n assert candidate(n = 1000000000) == 10\n assert candidate(n = 1000) == 4\n assert candidate(n = 10) == 2\n assert candidate(n = 5) == 2\n assert candidate(n = 3) == 2\n assert candidate(n = 45) == 6\n assert candidate(n = 210) == 8\n assert candidate(n = 897) == 8\n assert candidate(n = 999999999) == 20\n assert candidate(n = 49) == 3\n assert candidate(n = 12345) == 8\n assert candidate(n = 67890) == 16\n assert candidate(n = 2147483647) == 2\n assert candidate(n = 76543210) == 8\n assert candidate(n = 56789) == 4\n assert candidate(n = 89123456) == 4\n assert candidate(n = 2019) == 4\n assert candidate(n = 6789) == 8\n assert candidate(n = 10000) == 5\n assert candidate(n = 43210987) == 8\n assert candidate(n = 1001) == 8\n assert candidate(n = 2) == 1\n assert candidate(n = 200000000) == 9\n assert candidate(n = 50000000) == 9\n assert candidate(n = 1024) == 1\n assert candidate(n = 101) == 2\n assert candidate(n = 8) == 1\n assert candidate(n = 10000000) == 8\n assert candidate(n = 56789123) == 2\n assert candidate(n = 845123) == 4\n assert candidate(n = 1048576) == 1\n assert candidate(n = 89) == 2\n assert candidate(n = 89754321) == 4\n assert candidate(n = 8472187) == 4\n assert candidate(n = 84521) == 2\n assert candidate(n = 13) == 2\n assert candidate(n = 150) == 6\n assert candidate(n = 987654321) == 18\n assert candidate(n = 123456789) == 12\n assert candidate(n = 1234567) == 4\n assert candidate(n = 121) == 3\n assert candidate(n = 999999) == 64\n assert candidate(n = 123456) == 4\n assert candidate(n = 500) == 4\n assert candidate(n = 54321) == 8\n assert candidate(n = 100000000) == 9\n assert candidate(n = 1500) == 8\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().consecutiveNumbersSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var consecutiveNumbersSum = function(n) {", "container": null, "callable": "consecutiveNumbersSum", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 830, "task_id": "positions-of-large-groups", "difficulty": "Easy", "problem_description": "In a string s of lowercase letters, these letters form consecutive groups of the same character.\nFor example, a string like s = \"abbxxxxzyy\" has the groups \"a\", \"bb\", \"xxxx\", \"z\", and \"yy\".\nA group is identified by an interval [start, end], where start and end denote the start and end indices (inclusive) of the group. In the above example, \"xxxx\" has the interval [3,6].\nA group is considered large if it has 3 or more characters.\nReturn the intervals of every large group sorted in increasing order by start index.\n \nExample 1:\n\nInput: s = \"abbxxxxzzy\"\nOutput: [[3,6]]\nExplanation: \"xxxx\" is the only large group with start index 3 and end index 6.\n\nExample 2:\n\nInput: s = \"abc\"\nOutput: []\nExplanation: We have groups \"a\", \"b\", and \"c\", none of which are large groups.\n\nExample 3:\n\nInput: s = \"abcdddeeeeaabbbcd\"\nOutput: [[3,5],[6,9],[12,14]]\nExplanation: The large groups are \"ddd\", \"eeee\", and \"bbb\".\n\n \nConstraints:\n\n1 <= s.length <= 1000\ns contains lowercase English letters only.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"aabbbccccdddd\") == [[2, 4], [5, 8], [9, 12]]\n assert candidate(s = \"aabbbccccddeee\") == [[2, 4], [5, 8], [11, 13]]\n assert candidate(s = \"abcdefghijk\") == []\n assert candidate(s = \"aabbaa\") == []\n assert candidate(s = \"aabbccccaaaabbccccaaaabbcccc\") == [[4, 7], [8, 11], [14, 17], [18, 21], [24, 27]]\n assert candidate(s = \"a\") == []\n assert candidate(s = \"abbxxxxzzy\") == [[3, 6]]\n assert candidate(s = \"zzzzyyyyy\") == [[0, 3], [4, 8]]\n assert candidate(s = \"aa\") == []\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == [[0, 69]]\n assert candidate(s = \"aaa\") == [[0, 2]]\n assert candidate(s = \"pppppqqqppppppqqqqqqqqq\") == [[0, 4], [5, 7], [8, 13], [14, 22]]\n assert candidate(s = \"zzzzzzzzzz\") == [[0, 9]]\n assert candidate(s = \"aabbccddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnooopppqqqrrrsttuuvvvwwwwxxxxyyyyzzzz\") == [[8, 11], [12, 15], [16, 19], [20, 23], [24, 27], [28, 31], [32, 35], [36, 39], [40, 43], [44, 47], [48, 50], [51, 53], [54, 56], [57, 59], [65, 67], [68, 71], [72, 75], [76, 79], [80, 83]]\n assert candidate(s = \"abc\") == []\n assert candidate(s = \"abcd\") == []\n assert candidate(s = \"aabbbccddddeeeee\") == [[2, 4], [7, 10], [11, 15]]\n assert candidate(s = \"aaabaaa\") == [[0, 2], [4, 6]]\n assert candidate(s = \"abcdddeeeeaabbbcd\") == [[3, 5], [6, 9], [12, 14]]\n assert candidate(s = \"zzzzz\") == [[0, 4]]\n assert candidate(s = \"aabbccddeee\") == [[8, 10]]\n assert candidate(s = \"aaabbbcccddd\") == [[0, 2], [3, 5], [6, 8], [9, 11]]\n assert candidate(s = \"aaaaabbbbbcccccc\") == [[0, 4], [5, 9], [10, 15]]\n assert candidate(s = \"aabbcccddd\") == [[4, 6], [7, 9]]\n assert candidate(s = \"aabbccddeeffgggghhiijjjkkkllmmnnnooopppqqqqrrrrssss\") == [[12, 15], [20, 22], [23, 25], [30, 32], [33, 35], [36, 38], [39, 42], [43, 46], [47, 50]]\n assert candidate(s = \"zzzzzzyyyyaaaabbcccc\") == [[0, 5], [6, 9], [10, 13], [16, 19]]\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == []\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzzzzzzzz\") == [[50, 59]]\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == [[0, 101]]\n assert candidate(s = \"xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz\") == []\n assert candidate(s = \"aabbccccddeeeffffggggghhhhhiiiiijjjjjjkkkklllllmmmmmnnooooppppqqqqrrrrssssttttuuuuvvvvwwwwxxxyyyyzzzz\") == [[4, 7], [10, 12], [13, 16], [17, 21], [22, 26], [27, 31], [32, 37], [38, 41], [42, 46], [47, 51], [54, 57], [58, 61], [62, 65], [66, 69], [70, 73], [74, 77], [78, 81], [82, 85], [86, 89], [90, 92], [93, 96], [97, 100]]\n assert candidate(s = \"ababababababababababababababababababababababababababababababababababababababababababab\") == []\n assert candidate(s = \"zzzzzyyyyyxxxxwwwwvvvvuuuuttttsrrrqqqpooooonnnnmmmmmlllllkkkkjjjjjiiiihhhhhgggggfffffeeee\") == [[0, 4], [5, 9], [10, 13], [14, 17], [18, 21], [22, 25], [26, 29], [31, 33], [34, 36], [38, 42], [43, 46], [47, 51], [52, 56], [57, 60], [61, 65], [66, 69], [70, 74], [75, 79], [80, 84], [85, 88]]\n assert candidate(s = \"aabcccccaaaaabbbcccc\") == [[3, 7], [8, 12], [13, 15], [16, 19]]\n assert candidate(s = \"abcdefghijkllllmnopqrstuvwxyz\") == [[11, 14]]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcbaaaa\") == [[51, 54]]\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\") == [[0, 84], [85, 166]]\n assert candidate(s = \"aaaaaaabbbbbcccccdddddeeeeeeaaaaaaaaabbbbcccccddeeeeefffff\") == [[0, 6], [7, 11], [12, 16], [17, 21], [22, 27], [28, 36], [37, 40], [41, 45], [48, 52], [53, 57]]\n assert candidate(s = \"abccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccd\") == [[2, 65]]\n assert candidate(s = \"tttttttttttttttttttttttttttttttttttttt\") == [[0, 37]]\n assert candidate(s = \"aabbccddeeeffffggggghhhhhiiiiijjjjjj\") == [[8, 10], [11, 14], [15, 19], [20, 24], [25, 29], [30, 35]]\n assert candidate(s = \"xyzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == [[2, 47]]\n assert candidate(s = \"aabbccccddeeeffffggggghhhhhiiiiijjjjjjkkkklllllmmmmmnnooooppppqqqqrrrrssssttttuuuuvvvvwwwwxxxyyyyzzzzz\") == [[4, 7], [10, 12], [13, 16], [17, 21], [22, 26], [27, 31], [32, 37], [38, 41], [42, 46], [47, 51], [54, 57], [58, 61], [62, 65], [66, 69], [70, 73], [74, 77], [78, 81], [82, 85], [86, 89], [90, 92], [93, 96], [97, 101]]\n assert candidate(s = \"abcdefghiiiiijkllllmmnopqqqrrr\") == [[8, 12], [15, 18], [24, 26], [27, 29]]\n assert candidate(s = \"abcdefghijklmnopqrstuvwwxyzzaaabbbccc\") == [[28, 30], [31, 33], [34, 36]]\n assert candidate(s = \"kkkkkklllllmmmmmnnnnnoooooopppppqqqqqqrrrrrssssstttttuuuuuvvvvvwwwwwxxyyyyyzzzzz\") == [[0, 5], [6, 10], [11, 15], [16, 20], [21, 26], [27, 31], [32, 37], [38, 42], [43, 47], [48, 52], [53, 57], [58, 62], [63, 67], [70, 74], [75, 79]]\n assert candidate(s = \"aabbccccddddeeeffffffgggghhhiiiiijjjkkllmmnnnooppqqrrssttuuvvwxxxwwvvuuttssrrqponmlkjihgfedcba\") == [[4, 7], [8, 11], [12, 14], [15, 20], [21, 24], [25, 27], [28, 32], [33, 35], [42, 44], [62, 64]]\n assert candidate(s = \"aaaaabbbbccccdddd\") == [[0, 4], [5, 8], [9, 12], [13, 16]]\n assert candidate(s = \"ppppqqqqrrrsssttttuuuuvvvvwxxx\") == [[0, 3], [4, 7], [8, 10], [11, 13], [14, 17], [18, 21], [22, 25], [27, 29]]\n assert candidate(s = \"aaaaaaaaaabbbbbbbbbbbbbbccccccccccccccccccccccccdddddddddddddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeefffffffffffffffggggggggggggggggg\") == [[0, 9], [10, 23], [24, 47], [48, 84], [85, 116], [117, 131], [132, 148]]\n assert candidate(s = \"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnmmmm\") == [[0, 47], [48, 51]]\n assert candidate(s = \"xyzzyxwwwwwzzzzzz\") == [[6, 10], [11, 16]]\n assert candidate(s = \"aabbccddeeffggccddeeffggccddeeffggccddeeffggccddeeffgg\") == []\n assert candidate(s = \"aaabbbcccddddeeefff ggghhhhiiiiijjjjkkkkllllmmmmnnnnooopppqqqqrrrrssttttuuuuvvvvwwwwxxxxxyyyyyzzzzz\") == [[0, 2], [3, 5], [6, 8], [9, 12], [13, 15], [16, 18], [20, 22], [23, 26], [27, 31], [32, 35], [36, 39], [40, 43], [44, 47], [48, 51], [52, 54], [55, 57], [58, 61], [62, 65], [68, 71], [72, 75], [76, 79], [80, 83], [84, 88], [89, 93], [94, 98]]\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().largeGroupPositions", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var largeGroupPositions = function(s) {", "container": null, "callable": "largeGroupPositions", "parameters": [{"name": "s", "type": "string"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 831, "task_id": "masking-personal-information", "difficulty": "Medium", "problem_description": "You are given a personal information string s, representing either an email address or a phone number. Return the masked personal information using the below rules.\nEmail address:\nAn email address is:\n\nA name consisting of uppercase and lowercase English letters, followed by\nThe '@' symbol, followed by\nThe domain consisting of uppercase and lowercase English letters with a dot '.' somewhere in the middle (not the first or last character).\n\nTo mask an email:\n\nThe uppercase letters in the name and domain must be converted to lowercase letters.\nThe middle letters of the name (i.e., all but the first and last letters) must be replaced by 5 asterisks \"*****\".\n\nPhone number:\nA phone number is formatted as follows:\n\nThe phone number contains 10-13 digits.\nThe last 10 digits make up the local number.\nThe remaining 0-3 digits, in the beginning, make up the country code.\nSeparation characters from the set {'+', '-', '(', ')', ' '} separate the above digits in some way.\n\nTo mask a phone number:\n\nRemove all separation characters.\nThe masked phone number should have the form:\n\t\n\"***-***-XXXX\" if the country code has 0 digits.\n\"+*-***-***-XXXX\" if the country code has 1 digit.\n\"+**-***-***-XXXX\" if the country code has 2 digits.\n\"+***-***-***-XXXX\" if the country code has 3 digits.\n\n\n\"XXXX\" is the last 4 digits of the local number.\n\n \nExample 1:\n\nInput: s = \"LeetCode@LeetCode.com\"\nOutput: \"l*****e@leetcode.com\"\nExplanation: s is an email address.\nThe name and domain are converted to lowercase, and the middle of the name is replaced by 5 asterisks.\n\nExample 2:\n\nInput: s = \"AB@qq.com\"\nOutput: \"a*****b@qq.com\"\nExplanation: s is an email address.\nThe name and domain are converted to lowercase, and the middle of the name is replaced by 5 asterisks.\nNote that even though \"ab\" is 2 characters, it still must have 5 asterisks in the middle.\n\nExample 3:\n\nInput: s = \"1(234)567-890\"\nOutput: \"***-***-7890\"\nExplanation: s is a phone number.\nThere are 10 digits, so the local number is 10 digits and the country code is 0 digits.\nThus, the resulting masked number is \"***-***-7890\".\n\n \nConstraints:\n\ns is either a valid email or a phone number.\nIf s is an email:\n\t\n8 <= s.length <= 40\ns consists of uppercase and lowercase English letters and exactly one '@' symbol and '.' symbol.\n\n\nIf s is a phone number:\n\t\n10 <= s.length <= 20\ns consists of digits, spaces, and the symbols '(', ')', '-', and '+'.\n\n\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"12345678901\") == \"+*-***-***-8901\"\n assert candidate(s = \"+11234567890\") == \"+*-***-***-7890\"\n assert candidate(s = \"123 456 7890\") == \"***-***-7890\"\n assert candidate(s = \"+1-800-555-0199\") == \"+*-***-***-0199\"\n assert candidate(s = \"9876543210\") == \"***-***-3210\"\n assert candidate(s = \"123456789012\") == \"+**-***-***-9012\"\n assert candidate(s = \"123.456.7890\") == \"***-***-7890\"\n assert candidate(s = \"jane.doe@domain.co\") == \"j*****e@domain.co\"\n assert candidate(s = \"1234567890\") == \"***-***-7890\"\n assert candidate(s = \"John.Doe@example.com\") == \"j*****e@example.com\"\n assert candidate(s = \"alice@leetcode.com\") == \"a*****e@leetcode.com\"\n assert candidate(s = \"LeetCode@LeetCode.com\") == \"l*****e@leetcode.com\"\n assert candidate(s = \"AB@qq.com\") == \"a*****b@qq.com\"\n assert candidate(s = \"0-213-321-2345\") == \"+*-***-***-2345\"\n assert candidate(s = \"+91(123) 456-7890\") == \"+**-***-***-7890\"\n assert candidate(s = \"+123(123) 456-7890\") == \"+***-***-***-7890\"\n assert candidate(s = \"(123) 456-7890\") == \"***-***-7890\"\n assert candidate(s = \"abcdef@gmail.com\") == \"a*****f@gmail.com\"\n assert candidate(s = \"+111234567890\") == \"+**-***-***-7890\"\n assert candidate(s = \"+1-234-567-890\") == \"***-***-7890\"\n assert candidate(s = \"+1234567890\") == \"***-***-7890\"\n assert candidate(s = \"a@leetcode.com\") == \"a*****a@leetcode.com\"\n assert candidate(s = \"+1111234567890\") == \"+***-***-***-7890\"\n assert candidate(s = \"john.doe@example.co.uk\") == \"j*****e@example.co.uk\"\n assert candidate(s = \"+1-123-456-7890\") == \"+*-***-***-7890\"\n assert candidate(s = \"+12(123) 456-7890\") == \"+**-***-***-7890\"\n assert candidate(s = \"1234567890123\") == \"+***-***-***-0123\"\n assert candidate(s = \"+(123)-456-7890\") == \"***-***-7890\"\n assert candidate(s = \"bob.cathy@leetcode.com\") == \"b*****y@leetcode.com\"\n assert candidate(s = \"a.b@c.com\") == \"a*****b@c.com\"\n assert candidate(s = \"abcdefghijk@leetcode.com\") == \"a*****k@leetcode.com\"\n assert candidate(s = \"aBcD@eFgHiJ.com\") == \"a*****d@efghij.com\"\n assert candidate(s = \"1(234)567-890\") == \"***-***-7890\"\n assert candidate(s = \"+49 176 2345 6789\") == \"+***-***-***-6789\"\n assert candidate(s = \"+49(123) 456-7890\") == \"+**-***-***-7890\"\n assert candidate(s = \"ABCDE@FGHI.JKL\") == \"a*****e@fghi.jkl\"\n assert candidate(s = \"+442079460958\") == \"+**-***-***-0958\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz@abc.def.ghijklmnopqrstuvwxyz\") == \"a*****z@abc.def.ghijklmnopqrstuvwxyz\"\n assert candidate(s = \"Annie.Marie@service.org\") == \"a*****e@service.org\"\n assert candidate(s = \"+91-8765432109\") == \"+**-***-***-2109\"\n assert candidate(s = \"+1-800-MY-BANK\") == \"+-***-***-1800\"\n assert candidate(s = \"+911234567890\") == \"+**-***-***-7890\"\n assert candidate(s = \"(123) 456-7890 ext. 1234\") == \"+****-***-***-1234\"\n assert candidate(s = \"user@website.co\") == \"u*****r@website.co\"\n assert candidate(s = \"john.doe@EXAMPLE.COM\") == \"j*****e@example.com\"\n assert candidate(s = \"+91 (123) 456 7890\") == \"+**-***-***-7890\"\n assert candidate(s = \"+91 (123) 456-7890\") == \"+**-***-***-7890\"\n assert candidate(s = \"(+123) 456-7890123\") == \"+***-***-***-0123\"\n assert candidate(s = \"001234567890\") == \"+**-***-***-7890\"\n assert candidate(s = \"+44 20 7946 0958\") == \"+**-***-***-0958\"\n assert candidate(s = \"(012) 345 6789\") == \"***-***-6789\"\n assert candidate(s = \"user@domain.c\") == \"u*****r@domain.c\"\n assert candidate(s = \"ABC.DEF@GMAIL.COM\") == \"a*****f@gmail.com\"\n assert candidate(s = \"A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z@domain.com\") == \"a*****z@domain.com\"\n assert candidate(s = \"Alice.Bob.Charlie@example.co.uk\") == \"a*****e@example.co.uk\"\n assert candidate(s = \"+31(0)123456789\") == \"+**-***-***-6789\"\n assert candidate(s = \"+1 800 555 0199\") == \"+*-***-***-0199\"\n assert candidate(s = \"+0 1234 5678901\") == \"+**-***-***-8901\"\n assert candidate(s = \"An.Extremely.Long.Name@subdomain.example.com\") == \"a*****e@subdomain.example.com\"\n assert candidate(s = \"John_Doe@domain.com\") == \"j*****e@domain.com\"\n assert candidate(s = \"John-Doe@Example.com\") == \"j*****e@example.com\"\n assert candidate(s = \"foo-bar@baz-qux.org\") == \"f*****r@baz-qux.org\"\n assert candidate(s = \"FirstName.LastName@domain.co.uk\") == \"f*****e@domain.co.uk\"\n assert candidate(s = \"+01-123-456-7890\") == \"+**-***-***-7890\"\n assert candidate(s = \"PhoneNumber123@domain.com\") == \"p*****3@domain.com\"\n assert candidate(s = \"+1234-567-8901\") == \"+*-***-***-8901\"\n assert candidate(s = \"user@domain\") == \"u*****r@domain\"\n assert candidate(s = \"abcdefghij@klmno.pqr\") == \"a*****j@klmno.pqr\"\n assert candidate(s = \"Alice.Bob-Charlie.D@example.co.uk\") == \"a*****d@example.co.uk\"\n assert candidate(s = \"+1-234-567-89012\") == \"+**-***-***-9012\"\n assert candidate(s = \"(123) 456-7890; 123-456-7891; 123-456-7892\") == \"+********************-***-***-7892\"\n assert candidate(s = \"+44 (0) 1234 567890\") == \"+***-***-***-7890\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz@abc.def\") == \"a*****z@abc.def\"\n assert candidate(s = \"1-800-555-0199\") == \"+*-***-***-0199\"\n assert candidate(s = \"0012345678901\") == \"+***-***-***-8901\"\n assert candidate(s = \"+1234567890123\") == \"+***-***-***-0123\"\n assert candidate(s = \"user@domain.com\") == \"u*****r@domain.com\"\n assert candidate(s = \"abcdefg@hijklmnopqrstuvwxyz.co\") == \"a*****g@hijklmnopqrstuvwxyz.co\"\n assert candidate(s = \"+1 (234) 567-8901\") == \"+*-***-***-8901\"\n assert candidate(s = \"Nina.Nightly-Owl@Mailbox.ORG\") == \"n*****l@mailbox.org\"\n assert candidate(s = \"Name@Domain.co\") == \"n*****e@domain.co\"\n assert candidate(s = \"+91 12345 67890\") == \"+**-***-***-7890\"\n assert candidate(s = \"+33123456789\") == \"+*-***-***-6789\"\n assert candidate(s = \"user.name@sub.domain.co.uk\") == \"u*****e@sub.domain.co.uk\"\n assert candidate(s = \"234-567-8901\") == \"***-***-8901\"\n assert candidate(s = \"+358 (0)10 123 4567\") == \"+***-***-***-4567\"\n assert candidate(s = \"+1 (123) 456-7890x1234\") == \"+*****-***-***-1234\"\n assert candidate(s = \"user.name@sub.domain.com\") == \"u*****e@sub.domain.com\"\n assert candidate(s = \"123-4567-890\") == \"***-***-7890\"\n assert candidate(s = \"+33 (0)1 23 45 67 89\") == \"+**-***-***-6789\"\n assert candidate(s = \"+91-1234567890\") == \"+**-***-***-7890\"\n assert candidate(s = \"(+12) 123 456-7890x1234\") == \"+******-***-***-1234\"\n assert candidate(s = \"+44 1234567890\") == \"+**-***-***-7890\"\n assert candidate(s = \"A.B.C.D.E.F@domain.com\") == \"a*****f@domain.com\"\n assert candidate(s = \"(+1) 123 456 7890\") == \"+*-***-***-7890\"\n assert candidate(s = \"+1 800-555-0199 ext. 1234\") == \"+*****-***-***-1234\"\n assert candidate(s = \"+33 1 23 45 67 89\") == \"+*-***-***-6789\"\n assert candidate(s = \"++44-1234567890\") == \"+**-***-***-7890\"\n assert candidate(s = \"EMail+Address@domain.com\") == \"e*****s@domain.com\"\n assert candidate(s = \"abc-def@ghi.jkl.mno\") == \"a*****f@ghi.jkl.mno\"\n assert candidate(s = \"@domain.com\") == \"+-***-***-\"\n assert candidate(s = \"VeryLongFirstName.Last@website.org\") == \"v*****t@website.org\"\n assert candidate(s = \"+31 (6) 1234 5678\") == \"+*-***-***-5678\"\n assert candidate(s = \"(123) 4567 89012\") == \"+**-***-***-9012\"\n assert candidate(s = \"12345678901234567890\") == \"+**********-***-***-7890\"\n assert candidate(s = \"+123 (456) 7890-1234\") == \"+****-***-***-1234\"\n assert candidate(s = \"++1-123-456-7890\") == \"+*-***-***-7890\"\n assert candidate(s = \"John_Doe-123@website.net\") == \"j*****3@website.net\"\n assert candidate(s = \"+44 1234 567890\") == \"+**-***-***-7890\"\n assert candidate(s = \"(123) 456-7890x1234\") == \"+****-***-***-1234\"\n assert candidate(s = \"(+12) 345-678-9012\") == \"+**-***-***-9012\"\n assert candidate(s = \"McDonalds.Restaurant@domain.co.in\") == \"m*****t@domain.co.in\"\n assert candidate(s = \"+55(11)1234-5678\") == \"+**-***-***-5678\"\n assert candidate(s = \"(123)4567890\") == \"***-***-7890\"\n assert candidate(s = \"123-456-7890\") == \"***-***-7890\"\n assert candidate(s = \"a.b.c.d.e@f.com\") == \"a*****e@f.com\"\n assert candidate(s = \"++33 6 12 34 56 78\") == \"+*-***-***-5678\"\n assert candidate(s = \"FOO@BAR.COM\") == \"f*****o@bar.com\"\n assert candidate(s = \"Elizabeth-II@royal.gov.uk\") == \"e*****i@royal.gov.uk\"\n assert candidate(s = \"+1 (123) 456-7890 ext 1234\") == \"+*****-***-***-1234\"\n assert candidate(s = \"++++1234567890\") == \"***-***-7890\"\n assert candidate(s = \"(123) 456 7890\") == \"***-***-7890\"\n assert candidate(s = \"(123) 456-7890, 123-456-7891, 123-456-7892\") == \"+********************-***-***-7892\"\n assert candidate(s = \"alice+bob.cathy@leetcode.com\") == \"a*****y@leetcode.com\"\n assert candidate(s = \"001 415 796 2345\") == \"+***-***-***-2345\"\n assert candidate(s = \"aBCdE@fGh.iJk\") == \"a*****e@fgh.ijk\"\n assert candidate(s = \"user.name+tag+sorting@example.com\") == \"u*****g@example.com\"\n assert candidate(s = \"+123-456-7890123\") == \"+***-***-***-0123\"\n assert candidate(s = \"(123) 456-7890, 123-456-7891\") == \"+**********-***-***-7891\"\n assert candidate(s = \"1234567890123456\") == \"+******-***-***-3456\"\n assert candidate(s = \"(123)456-789012\") == \"+**-***-***-9012\"\n assert candidate(s = \"++44 1234 567890\") == \"+**-***-***-7890\"\n assert candidate(s = \"first.last@sub.domain.com\") == \"f*****t@sub.domain.com\"\n assert candidate(s = \"a.b.c@domain.com\") == \"a*****c@domain.com\"\n assert candidate(s = \"(012)-34567890\") == \"+*-***-***-7890\"\n assert candidate(s = \"firstname.lastname@sub.domain.co.uk\") == \"f*****e@sub.domain.co.uk\"\n assert candidate(s = \"++44(0)1234 567890\") == \"+***-***-***-7890\"\n assert candidate(s = \"+49 1234 5678901\") == \"+***-***-***-8901\"\n assert candidate(s = \"+49-89-636-48018\") == \"+**-***-***-8018\"\n assert candidate(s = \"john.doe@mywebsite.net\") == \"j*****e@mywebsite.net\"\n assert candidate(s = \"a@b.c\") == \"a*****a@b.c\"\n assert candidate(s = \"(123)-456-78901\") == \"+*-***-***-8901\"\n assert candidate(s = \"John.Doe123@example.co\") == \"j*****3@example.co\"\n assert candidate(s = \"(+44)1234567890\") == \"+**-***-***-7890\"\n assert candidate(s = \"+123 456 7890123\") == \"+***-***-***-0123\"\n assert candidate(s = \"eMail@Company.com\") == \"e*****l@company.com\"\n assert candidate(s = \"+1 (415) 796 2345\") == \"+*-***-***-2345\"\n assert candidate(s = \"Abc@xyz.co\") == \"a*****c@xyz.co\"\n assert candidate(s = \"(+12) 123 456-7890 ext 1234\") == \"+******-***-***-1234\"\n assert candidate(s = \"(123) 456-7890 (ext. 1234)\") == \"+****-***-***-1234\"\n assert candidate(s = \"Email@Subdomain.MyDomain.co.uk\") == \"e*****l@subdomain.mydomain.co.uk\"\n assert candidate(s = \"12345678901234\") == \"+****-***-***-1234\"\n assert candidate(s = \"user@.com\") == \"u*****r@.com\"\n assert candidate(s = \"USER.NAME@DOMAIN.COM\") == \"u*****e@domain.com\"\n assert candidate(s = \"123456789012345\") == \"+*****-***-***-2345\"\n assert candidate(s = \"FirstName.LastName@sub.domain.com\") == \"f*****e@sub.domain.com\"\n assert candidate(s = \"+86 123 4567 8901\") == \"+***-***-***-8901\"\n assert candidate(s = \"Foo@bar.com\") == \"f*****o@bar.com\"\n assert candidate(s = \"Alice.Bob.Clarke@mydomain.org\") == \"a*****e@mydomain.org\"\n assert candidate(s = \"Alice.Bob-Carol@domain.co.uk\") == \"a*****l@domain.co.uk\"\n assert candidate(s = \"++++1-234-567-8901\") == \"+*-***-***-8901\"\n assert candidate(s = \"FIRST.Last@domain.com\") == \"f*****t@domain.com\"\n assert candidate(s = \"user@sub.domain.com\") == \"u*****r@sub.domain.com\"\n assert candidate(s = \"++44 1234567890\") == \"+**-***-***-7890\"\n assert candidate(s = \"Alice.Bob-Jones@company.org\") == \"a*****s@company.org\"\n assert candidate(s = \"001-123-456-7890\") == \"+***-***-***-7890\"\n assert candidate(s = \"+358101234567\") == \"+**-***-***-4567\"\n assert candidate(s = \"987654321098765\") == \"+*****-***-***-8765\"\n assert candidate(s = \"(123)-456-7890\") == \"***-***-7890\"\n assert candidate(s = \"+49-123-456789-0\") == \"+**-***-***-7890\"\n assert candidate(s = \"-123-456-7890\") == \"***-***-7890\"\n assert candidate(s = \"+44(0)1234-567890\") == \"+***-***-***-7890\"\n assert candidate(s = \"9876543210123\") == \"+***-***-***-0123\"\n assert candidate(s = \"(123) 456-7890 x1234\") == \"+****-***-***-1234\"\n assert candidate(s = \"Alice.Bob-Carol@domain.co\") == \"a*****l@domain.co\"\n assert candidate(s = \"A.B.C.D.E.F.G.H@subdomain.example.com\") == \"a*****h@subdomain.example.com\"\n assert candidate(s = \"(123) 456-7890; 123-456-7891\") == \"+**********-***-***-7891\"\n assert candidate(s = \"name@sub.sub.domain.com\") == \"n*****e@sub.sub.domain.com\"\n assert candidate(s = \"(123)456-7890\") == \"***-***-7890\"\n assert candidate(s = \"(123) 456-7890-1234\") == \"+****-***-***-1234\"\n assert candidate(s = \"(123)456-7890-1234\") == \"+****-***-***-1234\"\n assert candidate(s = \"valid.email@sub.domain.co.uk\") == \"v*****l@sub.domain.co.uk\"\n assert candidate(s = \"++1-234-567-8901\") == \"+*-***-***-8901\"\n assert candidate(s = \"+1 (123) 456-7890\") == \"+*-***-***-7890\"\n assert candidate(s = \"(123) 456-7890 ext 1234\") == \"+****-***-***-1234\"\n assert candidate(s = \"123456789012123\") == \"+*****-***-***-2123\"\n assert candidate(s = \"123-456-7890-1234\") == \"+****-***-***-1234\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().maskPII", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maskPII = function(s) {", "container": null, "callable": "maskPII", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 832, "task_id": "flipping-an-image", "difficulty": "Easy", "problem_description": "Given an n x n binary matrix image, flip the image horizontally, then invert it, and return the resulting image.\nTo flip an image horizontally means that each row of the image is reversed.\n\nFor example, flipping [1,1,0] horizontally results in [0,1,1].\n\nTo invert an image means that each 0 is replaced by 1, and each 1 is replaced by 0.\n\nFor example, inverting [0,1,1] results in [1,0,0].\n\n \nExample 1:\n\nInput: image = [[1,1,0],[1,0,1],[0,0,0]]\nOutput: [[1,0,0],[0,1,0],[1,1,1]]\nExplanation: First reverse each row: [[0,1,1],[1,0,1],[0,0,0]].\nThen, invert the image: [[1,0,0],[0,1,0],[1,1,1]]\n\nExample 2:\n\nInput: image = [[1,1,0,0],[1,0,0,1],[0,1,1,1],[1,0,1,0]]\nOutput: [[1,1,0,0],[0,1,1,0],[0,0,0,1],[1,0,1,0]]\nExplanation: First reverse each row: [[0,0,1,1],[1,0,0,1],[1,1,1,0],[0,1,0,1]].\nThen invert the image: [[1,1,0,0],[0,1,1,0],[0,0,0,1],[1,0,1,0]]\n\n \nConstraints:\n\nn == image.length\nn == image[i].length\n1 <= n <= 20\nimages[i][j] is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(image = [[1, 1], [1, 0]]) == [[0, 0], [1, 0]]\n assert candidate(image = [[1, 1, 0, 0], [1, 0, 0, 1], [0, 1, 1, 1], [1, 0, 1, 0]]) == [[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 0, 1], [1, 0, 1, 0]]\n assert candidate(image = [[1, 0, 1], [0, 1, 0], [1, 0, 1]]) == [[0, 1, 0], [1, 0, 1], [0, 1, 0]]\n assert candidate(image = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == [[0, 0, 0], [0, 0, 0], [0, 0, 0]]\n assert candidate(image = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == [[1, 1, 1], [1, 1, 1], [1, 1, 1]]\n assert candidate(image = [[1, 1, 0], [1, 0, 1], [0, 0, 0]]) == [[1, 0, 0], [0, 1, 0], [1, 1, 1]]\n assert candidate(image = [[0, 0, 0], [1, 1, 1], [0, 0, 0]]) == [[1, 1, 1], [0, 0, 0], [1, 1, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == [[0, 0, 0, 0, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]\n assert candidate(image = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == [[0, 1, 0, 1, 0, 0], [1, 0, 1, 0, 1, 1], [0, 1, 0, 1, 0, 0], [1, 0, 1, 0, 1, 1], [0, 1, 0, 1, 0, 0]]\n assert candidate(image = [[1, 1, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0], [1, 0, 1, 1, 0, 0], [0, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0]]) == [[0, 1, 0, 1, 0, 0], [1, 0, 1, 0, 0, 1], [1, 1, 0, 0, 1, 0], [1, 0, 0, 1, 0, 1], [0, 1, 0, 1, 1, 0], [1, 0, 1, 0, 0, 1]]\n assert candidate(image = [[0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == [[1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]\n assert candidate(image = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]\n assert candidate(image = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(image = [[1, 1, 0, 0, 1, 1, 1, 0], [0, 0, 1, 1, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == [[1, 0, 0, 0, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0], [0, 1, 1, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]\n assert candidate(image = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [1, 1, 1, 0, 0]]) == [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 1, 0, 0], [1, 0, 0, 1, 1], [1, 1, 0, 0, 0]]\n assert candidate(image = [[1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1]]) == [[0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1]]\n assert candidate(image = [[1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == [[1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]\n assert candidate(image = [[0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [1, 1, 0, 0, 1]]) == [[1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [0, 1, 1, 0, 0]]\n assert candidate(image = [[1, 0, 1, 1, 0], [0, 1, 0, 0, 1], [1, 1, 0, 1, 0], [0, 0, 1, 0, 1], [1, 0, 0, 1, 1]]) == [[1, 0, 0, 1, 0], [0, 1, 1, 0, 1], [1, 0, 1, 0, 0], [0, 1, 0, 1, 1], [0, 0, 1, 1, 0]]\n assert candidate(image = [[1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 1, 0]]) == [[1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [0, 1, 1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1]]\n assert candidate(image = [[0, 1, 1, 1, 1, 1, 0], [1, 1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0], [1, 1, 1, 0, 1, 1, 1], [0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 1, 1]]) == [[1, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 0, 0], [1, 0, 1, 0, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 1, 0, 0, 0], [1, 1, 1, 0, 1, 1, 1], [0, 0, 1, 1, 0, 1, 0]]\n assert candidate(image = [[1, 0, 0, 0, 1, 0, 1], [0, 1, 1, 1, 0, 1, 0], [1, 0, 0, 1, 1, 0, 1], [0, 1, 1, 0, 0, 1, 0], [1, 0, 1, 1, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1, 1]]) == [[0, 1, 0, 1, 1, 1, 0], [1, 0, 1, 0, 0, 0, 1], [0, 1, 0, 0, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1], [0, 1, 0, 0, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 0, 1, 1, 0, 1, 0]]\n assert candidate(image = [[0, 1, 1, 1, 0, 0, 1, 0], [1, 0, 0, 0, 1, 1, 0, 1], [0, 1, 1, 0, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0]]) == [[1, 0, 1, 1, 0, 0, 0, 1], [0, 1, 0, 0, 1, 1, 1, 0], [1, 0, 1, 0, 1, 0, 0, 1], [0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0]]\n assert candidate(image = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [1, 1, 0, 0, 1]]) == [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [0, 1, 1, 0, 0]]\n assert candidate(image = [[0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == [[0, 1, 0, 1, 0, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1]]\n assert candidate(image = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]\n assert candidate(image = [[1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 0, 1], [0, 0, 0, 1, 1, 0]]) == [[0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 1, 0, 1, 1, 0], [1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 1]]\n assert candidate(image = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == [[0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0]]\n assert candidate(image = [[0, 0, 0, 1, 0], [1, 1, 1, 1, 1], [0, 1, 0, 1, 0], [0, 0, 1, 0, 1], [1, 0, 1, 0, 0]]) == [[1, 0, 1, 1, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 1], [1, 1, 0, 1, 0]]\n assert candidate(image = [[1, 1, 0, 1, 1], [0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == [[0, 0, 1, 0, 0], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]\n assert candidate(image = [[0, 1, 1, 1, 0, 1, 1, 1, 0], [1, 1, 1, 0, 1, 1, 1, 0, 1], [1, 1, 0, 1, 1, 0, 1, 1, 0], [1, 0, 1, 1, 0, 1, 1, 0, 1], [1, 1, 0, 1, 1, 0, 1, 1, 0], [1, 1, 1, 0, 1, 1, 1, 0, 1], [0, 1, 1, 1, 0, 1, 1, 1, 0]]) == [[0, 0, 1, 0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 1, 1, 0]]\n assert candidate(image = [[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1]]) == [[1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1]]\n assert candidate(image = [[0, 0, 1], [1, 0, 0], [0, 1, 0]]) == [[0, 1, 1], [1, 1, 0], [1, 0, 1]]\n assert candidate(image = [[1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 0, 0, 0, 0, 1], [0, 1, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1]]) == [[0, 1, 1, 1, 1, 1, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 0, 0, 1], [1, 1, 0, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == [[0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1]]\n assert candidate(image = [[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1]]) == [[1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == [[0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]]\n assert candidate(image = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [1, 1, 1, 1, 1]]) == [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 1, 0, 0], [1, 0, 0, 1, 1], [0, 0, 0, 0, 0]]\n assert candidate(image = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == [[1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0]]\n assert candidate(image = [[1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0]]) == [[0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0]]\n assert candidate(image = [[1, 1, 1, 0, 0], [0, 0, 0, 1, 1], [1, 1, 1, 0, 0], [0, 0, 0, 1, 1], [1, 1, 1, 0, 0]]) == [[1, 1, 0, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 0, 0]]\n assert candidate(image = [[0, 1, 1, 0, 0, 1, 1], [1, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 0, 1, 1], [1, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 0, 1, 1], [1, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 0, 1, 1]]) == [[0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1]]\n assert candidate(image = [[1, 1, 1, 1], [0, 0, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1]]) == [[0, 0, 0, 0], [1, 1, 1, 1], [1, 0, 1, 0], [0, 1, 0, 1]]\n assert candidate(image = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1]]) == [[0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]\n assert candidate(image = [[1, 0, 1, 1, 0, 0, 1, 0, 1], [0, 1, 0, 0, 1, 1, 0, 1, 0], [1, 1, 0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 1, 1, 0], [1, 1, 1, 0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1, 0, 0, 0], [1, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0, 0]]) == [[0, 1, 0, 1, 1, 0, 0, 1, 0], [1, 0, 1, 0, 0, 1, 1, 0, 1], [0, 1, 1, 0, 0, 1, 1, 0, 0], [1, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 1, 0, 0, 1, 0, 1, 1, 0]]\n assert candidate(image = [[0, 1, 0, 1], [1, 0, 1, 0], [0, 0, 0, 0], [1, 1, 1, 1]]) == [[0, 1, 0, 1], [1, 0, 1, 0], [1, 1, 1, 1], [0, 0, 0, 0]]\n assert candidate(image = [[1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == [[1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]\n assert candidate(image = [[1, 1, 0, 1, 1, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 1], [1, 1, 0, 1, 0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 0, 1, 1, 0]]) == [[1, 0, 1, 1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 1, 1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [0, 1, 1, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 1, 1, 0, 1, 0, 0, 1]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1, 1, 0], [1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 1, 0, 0]]) == [[0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 1, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 1, 1, 0, 0], [1, 1, 0, 0, 0, 0, 1, 1]]\n assert candidate(image = [[1, 1, 1, 0, 0, 0, 1], [0, 0, 0, 1, 1, 1, 0], [1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 0], [1, 0, 0, 1, 1, 0, 1], [0, 1, 1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 1, 1]]) == [[0, 1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 1, 1, 1], [0, 0, 1, 1, 1, 0, 0], [1, 1, 0, 0, 0, 1, 1], [0, 1, 0, 0, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 1, 0, 0]]\n assert candidate(image = [[1, 0, 0, 0, 1], [0, 1, 1, 0, 0], [1, 1, 0, 1, 1], [0, 0, 1, 1, 0], [1, 1, 1, 1, 1]]) == [[0, 1, 1, 1, 0], [1, 1, 0, 0, 1], [0, 0, 1, 0, 0], [1, 0, 0, 1, 1], [0, 0, 0, 0, 0]]\n assert candidate(image = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 1, 0, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 0, 1, 1, 1, 0], [0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0]]\n assert candidate(image = [[0, 0, 0, 1, 1], [1, 0, 1, 0, 0], [0, 0, 1, 1, 0], [1, 1, 0, 0, 1], [0, 1, 0, 1, 0]]) == [[0, 0, 1, 1, 1], [1, 1, 0, 1, 0], [1, 0, 0, 1, 1], [0, 1, 1, 0, 0], [1, 0, 1, 0, 1]]\n assert candidate(image = [[1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0], [1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0]]) == [[0, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1], [1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1], [0, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1]]\n assert candidate(image = [[0, 1, 1, 0], [1, 0, 0, 1], [1, 0, 0, 1], [0, 1, 1, 0]]) == [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1]]\n assert candidate(image = [[1, 0, 1, 1, 0, 0, 1], [0, 1, 0, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1]]) == [[0, 1, 1, 0, 0, 1, 0], [1, 0, 0, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0]]\n assert candidate(image = [[0, 0, 0, 1], [1, 1, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == [[0, 1, 1, 1], [1, 0, 0, 0], [0, 1, 0, 1], [1, 0, 1, 0]]\n assert candidate(image = [[1, 0, 1, 1, 0], [1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [1, 0, 0, 1, 0], [0, 1, 1, 0, 1]]) == [[1, 0, 0, 1, 0], [0, 1, 1, 0, 0], [1, 0, 0, 1, 1], [1, 0, 1, 1, 0], [0, 1, 0, 0, 1]]\n assert candidate(image = [[0, 1, 1, 0, 1, 0], [1, 0, 0, 1, 1, 0], [1, 1, 1, 0, 1, 1], [0, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 1]]) == [[0, 1, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1]]\n assert candidate(image = [[0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == [[0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]\n assert candidate(image = [[1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0]]) == [[0, 1, 0, 1, 1, 0], [1, 0, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0], [1, 0, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0], [1, 0, 1, 0, 0, 1]]\n"}, "metadata": {"canonical_parameter_names": ["image"], "leetcode_dataset_entry_point": "Solution().flipAndInvertImage", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var flipAndInvertImage = function(image) {", "container": null, "callable": "flipAndInvertImage", "parameters": [{"name": "image", "type": "number[][]"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 833, "task_id": "find-and-replace-in-string", "difficulty": "Medium", "problem_description": "You are given a 0-indexed string s that you must perform k replacement operations on. The replacement operations are given as three 0-indexed parallel arrays, indices, sources, and targets, all of length k.\nTo complete the ith replacement operation:\n\nCheck if the substring sources[i] occurs at index indices[i] in the original string s.\nIf it does not occur, do nothing.\nOtherwise if it does occur, replace that substring with targets[i].\n\nFor example, if s = \"abcd\", indices[i] = 0, sources[i] = \"ab\", and targets[i] = \"eee\", then the result of this replacement will be \"eeecd\".\nAll replacement operations must occur simultaneously, meaning the replacement operations should not affect the indexing of each other. The testcases will be generated such that the replacements will not overlap.\n\nFor example, a testcase with s = \"abc\", indices = [0, 1], and sources = [\"ab\",\"bc\"] will not be generated because the \"ab\" and \"bc\" replacements overlap.\n\nReturn the resulting string after performing all replacement operations on s.\nA substring is a contiguous sequence of characters in a string.\n \nExample 1:\n\n\nInput: s = \"abcd\", indices = [0, 2], sources = [\"a\", \"cd\"], targets = [\"eee\", \"ffff\"]\nOutput: \"eeebffff\"\nExplanation:\n\"a\" occurs at index 0 in s, so we replace it with \"eee\".\n\"cd\" occurs at index 2 in s, so we replace it with \"ffff\".\n\nExample 2:\n\n\nInput: s = \"abcd\", indices = [0, 2], sources = [\"ab\",\"ec\"], targets = [\"eee\",\"ffff\"]\nOutput: \"eeecd\"\nExplanation:\n\"ab\" occurs at index 0 in s, so we replace it with \"eee\".\n\"ec\" does not occur at index 2 in s, so we do nothing.\n\n \nConstraints:\n\n1 <= s.length <= 1000\nk == indices.length == sources.length == targets.length\n1 <= k <= 100\n0 <= indexes[i] < s.length\n1 <= sources[i].length, targets[i].length <= 50\ns consists of only lowercase English letters.\nsources[i] and targets[i] consist of only lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"abcd\",indices = [0, 2],sources = ['a', 'cd'],targets = ['eee', 'ffff']) == \"eeebffff\"\n assert candidate(s = \"abcd\",indices = [0, 1, 2, 3],sources = ['a', 'b', 'c', 'd'],targets = ['aa', 'bb', 'cc', 'dd']) == \"aabbccdd\"\n assert candidate(s = \"abcd\",indices = [0, 2],sources = ['ab', 'ec'],targets = ['eee', 'ffff']) == \"eeecd\"\n assert candidate(s = \"vmokgggqzp\",indices = [3, 5, 1],sources = ['kg', 'gggg', 'mo'],targets = ['s', 'so', 'bfr']) == \"vbfrsggqzp\"\n assert candidate(s = \"hello\",indices = [1, 4],sources = ['el', 'o'],targets = ['ll', 'oo']) == \"hllloo\"\n assert candidate(s = \"aaaaaa\",indices = [0, 2, 4],sources = ['aa', 'aa', 'aa'],targets = ['AA', 'BB', 'CC']) == \"AABBCC\"\n assert candidate(s = \"aaaaabbbbb\",indices = [0, 5],sources = ['aaaaa', 'bbbbb'],targets = ['z', 'y']) == \"zy\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnoopp\",indices = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],sources = ['bb', 'dd', 'ff', 'hh', 'jj', 'll', 'nn', 'pp'],targets = ['XX', 'YY', 'ZZ', 'WW', 'VV', 'UU', 'TT', 'SS']) == \"aabbccddeeffgghhiijjkkllmmnnoopp\"\n assert candidate(s = \"programming\",indices = [0, 4, 9],sources = ['pro', 'gra', 'ing'],targets = ['123', '456', '789']) == \"123gramming\"\n assert candidate(s = \"xylophone\",indices = [2, 4],sources = ['lo', 'ph'],targets = ['LOLO', 'PH']) == \"xyLOLOPHone\"\n assert candidate(s = \"mississippi\",indices = [0, 4, 10],sources = ['mis', 'issi', 'i'],targets = ['xxx', 'yyy', 'zzz']) == \"xxxsyyyppzzz\"\n assert candidate(s = \"banana\",indices = [0, 1, 2, 3, 4, 5],sources = ['b', 'a', 'n', 'a', 'n', 'a'],targets = ['B', 'A', 'N', 'A', 'N', 'A']) == \"BANANA\"\n assert candidate(s = \"helloworld\",indices = [0, 5],sources = ['hello', 'world'],targets = ['HELLO', 'WORLD']) == \"HELLOWORLD\"\n assert candidate(s = \"algorithms\",indices = [2, 6, 8],sources = ['gor', 'rith', 'ms'],targets = ['GOR', 'RITH', 'MS']) == \"alGORithMS\"\n assert candidate(s = \"mississippi\",indices = [0, 4, 6],sources = ['mi', 'iss', 'ippi'],targets = ['MMM', 'NNN', 'OOO']) == \"MMMssNNNippi\"\n assert candidate(s = \"zzzzzzzzzz\",indices = [0, 2, 4, 6, 8],sources = ['zz', 'zz', 'zz', 'zz', 'zz'],targets = ['1', '2', '3', '4', '5']) == \"12345\"\n assert candidate(s = \"abcdefg\",indices = [1, 2, 3, 4, 5],sources = ['b', 'c', 'd', 'e', 'f'],targets = ['B', 'C', 'D', 'E', 'F']) == \"aBCDEFg\"\n assert candidate(s = \"abababab\",indices = [0, 2, 4, 6],sources = ['ab', 'ab', 'ab', 'ab'],targets = ['xy', 'yz', 'zx', 'wv']) == \"xyyzzxwv\"\n assert candidate(s = \"abcdefgh\",indices = [1, 3, 5, 7],sources = ['bc', 'fg', 'h', 'a'],targets = ['X', 'Y', 'Z', 'W']) == \"aXdefgh\"\n assert candidate(s = \"abcdefghij\",indices = [0, 2, 4, 6, 8],sources = ['ab', 'cd', 'ef', 'gh', 'ij'],targets = ['12', '34', '56', '78', '90']) == \"1234567890\"\n assert candidate(s = \"ababababab\",indices = [0, 2, 4, 6, 8],sources = ['ab', 'ab', 'ab', 'ab', 'ab'],targets = ['xy', 'yx', 'xy', 'yx', 'xy']) == \"xyyxxyyxxy\"\n assert candidate(s = \"abcdefghijk\",indices = [1, 3, 5, 7, 9],sources = ['bc', 'ef', 'gh', 'jk', 'l'],targets = ['2', '3', '4', '5', '6']) == \"a2defghijk\"\n assert candidate(s = \"abcdefghij\",indices = [0, 2, 4, 6, 8],sources = ['ab', 'cd', 'ef', 'gh', 'ij'],targets = ['A', 'B', 'C', 'D', 'E']) == \"ABCDE\"\n assert candidate(s = \"mississippi\",indices = [4, 6],sources = ['iss', 'iss'],targets = ['42', '43']) == \"miss42ippi\"\n assert candidate(s = \"abcdefghij\",indices = [1, 4, 7],sources = ['bc', 'ef', 'hi'],targets = ['BCD', 'EFG', 'HIJ']) == \"aBCDdEFGgHIJj\"\n assert candidate(s = \"programming\",indices = [0, 3, 6, 9],sources = ['pro', 'gra', 'mming'],targets = ['123', '456', '789']) == \"123456789\"\n assert candidate(s = \"hellothere\",indices = [0, 5],sources = ['he', 'th'],targets = ['hola', 'allahuakbar']) == \"holalloallahuakbarere\"\n assert candidate(s = \"aabbccddeeff\",indices = [0, 3, 6, 9],sources = ['aab', 'bcd', 'cde', 'def'],targets = ['AAB', 'BCD', 'CDE', 'DEF']) == \"AABbccddeeff\"\n assert candidate(s = \"abcdefghijk\",indices = [0, 3, 6, 9],sources = ['abc', 'def', 'ghi', 'jk'],targets = ['XXX', 'YYY', 'ZZZ', 'WWW']) == \"XXXYYYZZZWWW\"\n assert candidate(s = \"aabbccddeeff\",indices = [1, 3, 5, 7, 9, 11],sources = ['ab', 'cd', 'ef', 'de', 'fg', 'ef'],targets = ['12', '34', '56', '43', '65', '65']) == \"a12bccd43eff\"\n assert candidate(s = \"mississippi\",indices = [4, 6],sources = ['iss', 'issi'],targets = ['3', '4']) == \"miss3ippi\"\n assert candidate(s = \"abcdefgh\",indices = [1, 4, 6],sources = ['bc', 'ef', 'gh'],targets = ['12', '34', '56']) == \"a12d3456\"\n assert candidate(s = \"thisisatest\",indices = [2, 6, 9],sources = ['is', 'is', 'est'],targets = ['IS', 'IS', 'EST']) == \"thISisatest\"\n assert candidate(s = \"thequickbrownfox\",indices = [4, 9, 15],sources = ['qui', 'bro', 'fox'],targets = ['QUI', 'BRO', 'FOX']) == \"thequickbrownfox\"\n assert candidate(s = \"ababababab\",indices = [0, 2, 4, 6, 8],sources = ['ab', 'ab', 'ab', 'ab', 'ab'],targets = ['xy', 'xy', 'xy', 'xy', 'xy']) == \"xyxyxyxyxy\"\n assert candidate(s = \"hellothere\",indices = [1, 5, 8],sources = ['ell', 'the', 'er'],targets = ['123', '456', '789']) == \"h123o456re\"\n assert candidate(s = \"aabbccddeeffgghhii\",indices = [0, 2, 4, 6, 8, 10, 12, 14, 16],sources = ['aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh', 'ii'],targets = ['AA', 'BB', 'CC', 'DD', 'EE', 'FF', 'GG', 'HH', 'II']) == \"AABBCCDDEEFFGGHHII\"\n assert candidate(s = \"abcdefghijk\",indices = [0, 4, 8],sources = ['abc', 'efg', 'ijk'],targets = ['123', '456', '789']) == \"123d456h789\"\n assert candidate(s = \"abcdefghij\",indices = [1, 3, 5, 7],sources = ['bc', 'de', 'fg', 'hi'],targets = ['BCD', 'EFG', 'FGH', 'HIJ']) == \"aBCDEFGFGHHIJj\"\n assert candidate(s = \"aabbccddeeff\",indices = [0, 2, 4, 6, 8, 10],sources = ['aa', 'bb', 'cc', 'dd', 'ee', 'ff'],targets = ['AA', 'BB', 'CC', 'DD', 'EE', 'FF']) == \"AABBCCDDEEFF\"\n assert candidate(s = \"ababababab\",indices = [0, 2, 4, 6, 8],sources = ['ab', 'ba', 'ab', 'ba', 'ab'],targets = ['A', 'B', 'C', 'D', 'E']) == \"AabCabE\"\n assert candidate(s = \"replacements\",indices = [0, 5, 9],sources = ['rep', 'lac', 'tions'],targets = ['REP', 'LAC', 'TIONS']) == \"REPlacements\"\n assert candidate(s = \"mississippi\",indices = [0, 4, 6],sources = ['mis', 'sis', 'sip'],targets = ['miss', 'sis', 'sip']) == \"misssissippi\"\n assert candidate(s = \"thisisateststring\",indices = [0, 4, 8, 12],sources = ['this', 'is', 'a', 'test'],targets = ['1', '2', '3', '4']) == \"12ateststring\"\n assert candidate(s = \"mississippi\",indices = [4, 6],sources = ['issi', 'issi'],targets = ['XXXX', 'YYYY']) == \"missXXXXppi\"\n assert candidate(s = \"ababab\",indices = [0, 2, 4],sources = ['ab', 'ab', 'ab'],targets = ['xy', 'yz', 'zx']) == \"xyyzzx\"\n assert candidate(s = \"abcdefgh\",indices = [1, 4, 7],sources = ['bc', 'ef', 'h'],targets = ['BBB', 'EEE', 'HHH']) == \"aBBBdEEEgHHH\"\n assert candidate(s = \"aaaaaa\",indices = [0, 2, 4],sources = ['aa', 'aa', 'aa'],targets = ['AA', 'AA', 'AA']) == \"AAAAAA\"\n assert candidate(s = \"hellothere\",indices = [0, 5],sources = ['hello', 'there'],targets = ['hi', 'bye']) == \"hibye\"\n assert candidate(s = \"aaaaaa\",indices = [0, 1, 2, 3, 4, 5],sources = ['a', 'a', 'a', 'a', 'a', 'a'],targets = ['b', 'c', 'd', 'e', 'f', 'g']) == \"bcdefg\"\n assert candidate(s = \"abcdefghij\",indices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],sources = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'],targets = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']) == \"ABCDEFGHIJ\"\n assert candidate(s = \"abcdefghijk\",indices = [0, 5, 10],sources = ['abc', 'fgh', 'ijk'],targets = ['123', '456', '789']) == \"123de456ijk\"\n assert candidate(s = \"replaceeverything\",indices = [0, 7, 14],sources = ['rep', 'ev', 'ing'],targets = ['REPLACE', 'EVERY', 'THING']) == \"REPLACElaceEVERYerythTHING\"\n assert candidate(s = \"abcdefghij\",indices = [3, 7],sources = ['def', 'hij'],targets = ['12345', '67890']) == \"abc12345g67890\"\n assert candidate(s = \"aaaabbbbcccc\",indices = [0, 4, 8],sources = ['aaaa', 'bbbb', 'cccc'],targets = ['AAAA', 'BBBB', 'CCCC']) == \"AAAABBBBCCCC\"\n assert candidate(s = \"abcdefghij\",indices = [1, 4, 7],sources = ['bc', 'efg', 'ij'],targets = ['XX', 'YYY', 'ZZ']) == \"aXXdYYYhij\"\n assert candidate(s = \"xxxyyyzzz\",indices = [0, 3, 6],sources = ['xxx', 'yyy', 'zzz'],targets = ['aaa', 'bbb', 'ccc']) == \"aaabbbccc\"\n assert candidate(s = \"hello_world\",indices = [0, 6],sources = ['hello', 'world'],targets = ['hi', 'earth']) == \"hi_earth\"\n assert candidate(s = \"mississippi\",indices = [0, 4, 7],sources = ['mi', 'issi', 'issi'],targets = ['MMMM', 'IIII', 'XXXX']) == \"MMMMssIIIIppi\"\n assert candidate(s = \"thisisatest\",indices = [0, 2, 4, 6, 8, 10],sources = ['this', 'is', 'a', 'test', 'xx', 'xx'],targets = ['that', 'was', 'the', 'exam', 'yy', 'zz']) == \"thatisatest\"\n assert candidate(s = \"hellohellohello\",indices = [0, 5, 10],sources = ['hello', 'hello', 'hello'],targets = ['hi', 'ho', 'ha']) == \"hihoha\"\n assert candidate(s = \"abcdefgabcdefg\",indices = [0, 7],sources = ['abcdefg', 'abcdefg'],targets = ['ABCDEFG', 'ABCDEFG']) == \"ABCDEFGABCDEFG\"\n assert candidate(s = \"abcdefghijk\",indices = [0, 3, 6, 9],sources = ['abc', 'def', 'ghi', 'jk'],targets = ['1', '2', '3', '4']) == \"1234\"\n assert candidate(s = \"mississippi\",indices = [1, 4, 7],sources = ['is', 'is', 'is'],targets = ['aa', 'bb', 'cc']) == \"maasbbsippi\"\n assert candidate(s = \"oneonetwoonetwoone\",indices = [0, 4, 8, 12],sources = ['one', 'one', 'two', 'two'],targets = ['111', '222', '333', '444']) == \"111onetwoone444one\"\n assert candidate(s = \"hellohellohello\",indices = [0, 5, 10],sources = ['hel', 'ell', 'llo'],targets = ['H', 'E', 'L']) == \"Hlohellohello\"\n assert candidate(s = \"programming\",indices = [0, 3, 6, 9],sources = ['pro', 'gra', 'mmi', 'ng'],targets = ['PRO', 'GRA', 'MMI', 'NG']) == \"PROGRAMMING\"\n assert candidate(s = \"abcdefghij\",indices = [0, 2, 4, 6, 8],sources = ['ab', 'cd', 'ef', 'gh', 'ij'],targets = ['xy', 'zw', '00', '11', '22']) == \"xyzw001122\"\n assert candidate(s = \"alabama\",indices = [0, 2, 4],sources = ['al', 'ba', 'ma'],targets = ['AL', 'BA', 'MA']) == \"ALabama\"\n assert candidate(s = \"abracadabra\",indices = [0, 3, 7, 10],sources = ['abra', 'cad', 'abr', 'a'],targets = ['1', '2', '3', '4']) == \"1cad34\"\n assert candidate(s = \"mississippi\",indices = [0, 4, 8],sources = ['mis', 'iss', 'ippi'],targets = ['misss', 'issii', 'ipppi']) == \"missssissiiippi\"\n assert candidate(s = \"programming\",indices = [0, 3, 5, 8],sources = ['pro', 'gra', 'mmi', 'ng'],targets = ['1', '2', '3', '4']) == \"12mming\"\n assert candidate(s = \"programming\",indices = [0, 3, 5, 8],sources = ['pro', 'g', 'am', 'mm'],targets = ['code', 'G', 'AM', 'MM']) == \"codeGrAMming\"\n assert candidate(s = \"hellothere\",indices = [0, 5],sources = ['he', 'there'],targets = ['HELLO', 'THERE']) == \"HELLOlloTHERE\"\n assert candidate(s = \"mississippi\",indices = [4, 6],sources = ['is', 'ip'],targets = ['IS', 'IP']) == \"missISsippi\"\n assert candidate(s = \"foobarbaz\",indices = [0, 3, 6],sources = ['foo', 'bar', 'baz'],targets = ['FOO', 'BAR', 'BAZ']) == \"FOOBARBAZ\"\n assert candidate(s = \"abababab\",indices = [0, 2, 4, 6],sources = ['ab', 'ab', 'ab', 'ab'],targets = ['XX', 'YY', 'ZZ', 'WW']) == \"XXYYZZWW\"\n assert candidate(s = \"hellothere\",indices = [0, 5],sources = ['hello', 'there'],targets = ['hi', 'world']) == \"hiworld\"\n assert candidate(s = \"banana\",indices = [0, 2, 4],sources = ['ba', 'na', 'na'],targets = ['xx', 'yy', 'zz']) == \"xxyyzz\"\n assert candidate(s = \"abcdefghij\",indices = [2, 4, 6, 8],sources = ['cd', 'ef', 'gh', 'ij'],targets = ['1234', '5678', '91011', '121314']) == \"ab1234567891011121314\"\n assert candidate(s = \"banana\",indices = [1, 3],sources = ['an', 'na'],targets = ['xx', 'yy']) == \"bxxana\"\n assert candidate(s = \"algorithms\",indices = [1, 3, 5, 7],sources = ['l', 'g', 'm', 'th'],targets = ['X', 'Y', 'Z', 'ABC']) == \"aXgorithms\"\n assert candidate(s = \"abracadabra\",indices = [0, 5, 7],sources = ['abra', 'a', 'abra'],targets = ['zzzz', 'x', 'yyyy']) == \"zzzzcxdyyyy\"\n assert candidate(s = \"abcdefghij\",indices = [1, 3, 5, 7],sources = ['bc', 'de', 'fg', 'hi'],targets = ['XX', 'YY', 'ZZ', 'QQ']) == \"aXXYYZZQQj\"\n assert candidate(s = \"banana\",indices = [1, 3, 5],sources = ['an', 'an', 'a'],targets = ['XX', 'YY', 'ZZ']) == \"bXXYYZZ\"\n assert candidate(s = \"aabbccddeeff\",indices = [1, 3, 5, 7, 9],sources = ['ab', 'cd', 'ef', 'gh', 'ij'],targets = ['xy', 'zw', 'XY', 'ZW', 'IJ']) == \"axybccddeeff\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",indices = [0, 5, 10, 15, 20],sources = ['abc', 'fgh', 'klm', 'pqr', 'uvw'],targets = ['123', '456', '789', '012', '345']) == \"123de456ij789no012st345xyz\"\n assert candidate(s = \"abracadabra\",indices = [0, 3, 7],sources = ['abr', 'aca', 'bra'],targets = ['A', 'B', 'C']) == \"ABdabra\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",indices = [0, 5, 10, 15, 20],sources = ['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy'],targets = ['11111', '22222', '33333', '44444', '55555']) == \"1111122222333334444455555z\"\n assert candidate(s = \"programmingisfun\",indices = [3, 10, 15],sources = ['gram', 'is', 'fun'],targets = ['code', 'was', 'great']) == \"procodemingisfun\"\n assert candidate(s = \"aaaaaa\",indices = [0, 2, 4],sources = ['aa', 'aa', 'aa'],targets = ['1', '2', '3']) == \"123\"\n assert candidate(s = \"abcdefg\",indices = [0, 3, 5],sources = ['abc', 'de', 'fg'],targets = ['xyz', 'qrs', 'tuv']) == \"xyzqrstuv\"\n assert candidate(s = \"xyzxyzxyz\",indices = [0, 3, 6],sources = ['xyz', 'xyz', 'xyz'],targets = ['123', '456', '789']) == \"123456789\"\n assert candidate(s = \"zzzzzzzz\",indices = [0, 1, 2, 3, 4, 5, 6],sources = ['zz', 'zz', 'zz', 'zz', 'zz', 'zz', 'zz'],targets = ['ZZ', 'YY', 'XX', 'WW', 'VV', 'UU', 'TT']) == \"ZZXXVVTT\"\n assert candidate(s = \"abcdefghij\",indices = [1, 3, 5, 7, 9],sources = ['bc', 'ef', 'hi', 'jk'],targets = ['XXX', 'YYY', 'ZZZ', 'WWW']) == \"aXXXdefghij\"\n assert candidate(s = \"xyzxyzxyz\",indices = [0, 3, 6],sources = ['xyz', 'xyz', 'xyz'],targets = ['XYZ', 'XYZ', 'XYZ']) == \"XYZXYZXYZ\"\n"}, "metadata": {"canonical_parameter_names": ["s", "indices", "sources", "targets"], "leetcode_dataset_entry_point": "Solution().findReplaceString", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findReplaceString = function(s, indices, sources, targets) {", "container": null, "callable": "findReplaceString", "parameters": [{"name": "s", "type": "string"}, {"name": "indices", "type": "number[]"}, {"name": "sources", "type": "string[]"}, {"name": "targets", "type": "string[]"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 834, "task_id": "sum-of-distances-in-tree", "difficulty": "Hard", "problem_description": "There is an undirected connected tree with n nodes labeled from 0 to n - 1 and n - 1 edges.\nYou are given the integer n and the array edges where edges[i] = [ai, bi] indicates that there is an edge between nodes ai and bi in the tree.\nReturn an array answer of length n where answer[i] is the sum of the distances between the ith node in the tree and all other nodes.\n \nExample 1:\n\n\nInput: n = 6, edges = [[0,1],[0,2],[2,3],[2,4],[2,5]]\nOutput: [8,12,6,10,10,10]\nExplanation: The tree is shown above.\nWe can see that dist(0,1) + dist(0,2) + dist(0,3) + dist(0,4) + dist(0,5)\nequals 1 + 1 + 2 + 2 + 2 = 8.\nHence, answer[0] = 8, and so on.\n\nExample 2:\n\n\nInput: n = 1, edges = []\nOutput: [0]\n\nExample 3:\n\n\nInput: n = 2, edges = [[1,0]]\nOutput: [1,1]\n\n \nConstraints:\n\n1 <= n <= 3 * 104\nedges.length == n - 1\nedges[i].length == 2\n0 <= ai, bi < n\nai != bi\nThe given input represents a valid tree.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 10,edges = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [2, 6], [2, 7], [3, 8], [3, 9]]) == [15, 19, 19, 19, 27, 27, 27, 27, 27, 27]\n assert candidate(n = 7,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6]]) == [10, 11, 11, 16, 16, 16, 16]\n assert candidate(n = 4,edges = [[0, 1], [1, 2], [1, 3]]) == [5, 3, 5, 5]\n assert candidate(n = 4,edges = [[0, 1], [0, 2], [1, 3]]) == [4, 4, 6, 6]\n assert candidate(n = 8,edges = [[0, 1], [1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7]]) == [17, 11, 13, 13, 19, 19, 19, 19]\n assert candidate(n = 2,edges = [[1, 0]]) == [1, 1]\n assert candidate(n = 3,edges = [[0, 1], [0, 2]]) == [2, 3, 3]\n assert candidate(n = 6,edges = [[0, 1], [0, 2], [2, 3], [2, 4], [2, 5]]) == [8, 12, 6, 10, 10, 10]\n assert candidate(n = 5,edges = [[0, 1], [0, 2], [2, 3], [2, 4]]) == [6, 9, 5, 8, 8]\n assert candidate(n = 10,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9]]) == [19, 17, 23, 21, 23, 31, 31, 29, 29, 31]\n assert candidate(n = 1,edges = []) == [0]\n assert candidate(n = 5,edges = [[0, 1], [0, 2], [1, 3], [1, 4]]) == [6, 5, 9, 8, 8]\n assert candidate(n = 7,edges = [[0, 1], [0, 2], [2, 3], [2, 4], [2, 5], [4, 6]]) == [11, 16, 8, 13, 11, 13, 16]\n assert candidate(n = 12,edges = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11]]) == [11, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21]\n assert candidate(n = 20,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [1, 5], [2, 6], [2, 7], [3, 8], [3, 9], [4, 10], [4, 11], [5, 12], [5, 13], [6, 14], [6, 15], [7, 16], [7, 17], [8, 18], [8, 19]]) == [50, 46, 56, 56, 60, 60, 70, 70, 70, 74, 78, 78, 78, 78, 88, 88, 88, 88, 88, 88]\n assert candidate(n = 12,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [1, 5], [2, 6], [2, 7], [2, 8], [3, 9], [3, 10], [4, 11]]) == [23, 21, 27, 27, 29, 31, 37, 37, 37, 37, 37, 39]\n assert candidate(n = 15,edges = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [2, 6], [2, 7], [2, 8], [3, 9], [3, 10], [3, 11], [4, 12], [5, 13], [5, 14]]) == [28, 31, 35, 35, 42, 40, 48, 48, 48, 48, 48, 48, 55, 53, 53]\n assert candidate(n = 30,edges = [[0, 1], [0, 2], [0, 3], [0, 4], [1, 5], [1, 6], [1, 7], [2, 8], [2, 9], [2, 10], [3, 11], [3, 12], [3, 13], [4, 14], [4, 15], [4, 16], [5, 17], [5, 18], [6, 19], [6, 20], [7, 21], [7, 22], [8, 23], [8, 24], [9, 25], [9, 26], [10, 27], [10, 28], [11, 29]]) == [67, 77, 77, 87, 89, 101, 101, 101, 101, 101, 101, 113, 115, 115, 117, 117, 117, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 141]\n assert candidate(n = 50,edges = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [1, 6], [2, 7], [2, 8], [2, 9], [3, 10], [3, 11], [3, 12], [4, 13], [4, 14], [4, 15], [5, 16], [5, 17], [5, 18], [6, 19], [6, 20], [6, 21], [7, 22], [7, 23], [7, 24], [8, 25], [8, 26], [8, 27], [9, 28], [9, 29], [9, 30], [10, 31], [10, 32], [10, 33], [11, 34], [11, 35], [11, 36], [12, 37], [12, 38], [12, 39], [13, 40], [13, 41], [13, 42], [14, 43], [14, 44], [14, 45], [15, 46], [15, 47], [15, 48], [16, 49]]) == [142, 146, 166, 166, 170, 186, 188, 208, 208, 208, 208, 208, 208, 212, 212, 212, 232, 234, 234, 236, 236, 236, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 260, 260, 260, 260, 260, 260, 260, 260, 260, 280]\n assert candidate(n = 30,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [1, 5], [2, 6], [2, 7], [2, 8], [3, 9], [3, 10], [3, 11], [4, 12], [4, 13], [4, 14], [5, 15], [5, 16], [5, 17], [6, 18], [6, 19], [6, 20], [7, 21], [7, 22], [7, 23], [8, 24], [8, 25], [8, 26], [9, 27], [9, 28], [9, 29]]) == [80, 78, 84, 94, 100, 100, 106, 106, 106, 116, 122, 122, 128, 128, 128, 128, 128, 128, 134, 134, 134, 134, 134, 134, 134, 134, 134, 144, 144, 144]\n assert candidate(n = 20,edges = [[0, 1], [0, 2], [0, 3], [0, 4], [1, 5], [1, 6], [2, 7], [2, 8], [3, 9], [3, 10], [4, 11], [4, 12], [5, 13], [5, 14], [6, 15], [6, 16], [7, 17], [7, 18], [8, 19]]) == [41, 47, 49, 55, 55, 61, 61, 63, 65, 73, 73, 73, 73, 79, 79, 79, 79, 81, 81, 83]\n assert candidate(n = 15,edges = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [2, 6], [2, 7], [3, 8], [3, 9], [4, 10], [4, 11], [5, 12], [5, 13], [6, 14]]) == [30, 31, 37, 39, 40, 40, 48, 50, 52, 52, 53, 53, 53, 53, 61]\n assert candidate(n = 25,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [1, 5], [2, 6], [2, 7], [3, 8], [3, 9], [4, 10], [4, 11], [5, 12], [5, 13], [6, 14], [6, 15], [6, 16], [7, 17], [7, 18], [8, 19], [8, 20], [9, 21], [9, 22], [10, 23], [10, 24]]) == [69, 62, 78, 73, 77, 81, 95, 97, 92, 92, 96, 100, 104, 104, 118, 118, 118, 120, 120, 115, 115, 115, 115, 119, 119]\n assert candidate(n = 30,edges = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [1, 6], [1, 7], [2, 8], [2, 9], [2, 10], [2, 11], [3, 12], [3, 13], [3, 14], [3, 15], [4, 16], [4, 17], [5, 18], [5, 19], [6, 20], [6, 21], [7, 22], [7, 23], [8, 24], [8, 25], [9, 26], [9, 27], [10, 28], [10, 29]]) == [69, 73, 77, 89, 97, 97, 97, 97, 101, 101, 101, 105, 117, 117, 117, 117, 125, 125, 125, 125, 125, 125, 125, 125, 129, 129, 129, 129, 129, 129]\n assert candidate(n = 22,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [5, 12], [6, 13], [6, 14], [7, 15], [8, 16], [9, 17], [10, 18], [11, 19], [12, 20], [13, 21]]) == [62, 62, 64, 74, 74, 76, 78, 92, 92, 92, 92, 94, 94, 96, 98, 112, 112, 112, 112, 114, 114, 116]\n assert candidate(n = 25,edges = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [1, 6], [2, 7], [2, 8], [2, 9], [3, 10], [3, 11], [3, 12], [4, 13], [4, 14], [5, 15], [5, 16], [6, 17], [6, 18], [7, 19], [7, 20], [8, 21], [8, 22], [9, 23], [9, 24]]) == [57, 62, 62, 74, 81, 81, 81, 81, 81, 81, 97, 97, 97, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104]\n assert candidate(n = 15,edges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14]]) == [105, 92, 81, 72, 65, 60, 57, 56, 57, 60, 65, 72, 81, 92, 105]\n assert candidate(n = 18,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [5, 12], [6, 13], [6, 14], [7, 15], [8, 16], [9, 17]]) == [46, 44, 50, 52, 54, 62, 62, 66, 66, 68, 70, 78, 78, 78, 78, 82, 82, 84]\n assert candidate(n = 15,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [5, 12], [6, 13], [6, 14]]) == [34, 35, 35, 44, 44, 44, 44, 57, 57, 57, 57, 57, 57, 57, 57]\n assert candidate(n = 12,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11]]) == [26, 26, 28, 32, 34, 36, 36, 40, 44, 46, 46, 50]\n assert candidate(n = 30,edges = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [2, 6], [2, 7], [3, 8], [3, 9], [4, 10], [4, 11], [5, 12], [5, 13], [6, 14], [6, 15], [7, 16], [7, 17], [8, 18], [8, 19], [9, 20], [9, 21], [10, 22], [10, 23], [11, 24], [11, 25], [12, 26], [12, 27], [13, 28], [13, 29]]) == [83, 83, 99, 99, 99, 99, 123, 123, 123, 123, 123, 123, 123, 123, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151]\n assert candidate(n = 35,edges = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [1, 6], [2, 7], [2, 8], [2, 9], [3, 10], [3, 11], [3, 12], [4, 13], [4, 14], [4, 15], [5, 16], [5, 17], [5, 18], [6, 19], [6, 20], [6, 21], [7, 22], [7, 23], [7, 24], [8, 25], [8, 26], [8, 27], [9, 28], [9, 29], [9, 30], [10, 31], [10, 32], [10, 33], [11, 34]]) == [87, 96, 96, 106, 123, 123, 123, 123, 123, 123, 133, 137, 139, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 166, 166, 166, 170]\n assert candidate(n = 10,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [4, 8], [4, 9]]) == [19, 17, 23, 23, 21, 31, 31, 31, 29, 29]\n assert candidate(n = 25,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [5, 12], [6, 13], [6, 14], [7, 15], [7, 16], [8, 17], [8, 18], [9, 19], [9, 20], [10, 21], [10, 22], [11, 23], [11, 24]]) == [74, 69, 81, 80, 80, 96, 100, 99, 99, 99, 99, 115, 119, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 138, 138]\n assert candidate(n = 12,edges = [[0, 1], [0, 5], [1, 2], [1, 3], [1, 4], [5, 6], [5, 7], [5, 8], [8, 9], [8, 10], [8, 11]]) == [23, 27, 37, 37, 37, 21, 31, 31, 25, 35, 35, 35]\n assert candidate(n = 25,edges = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [1, 6], [2, 7], [2, 8], [2, 9], [3, 10], [3, 11], [3, 12], [4, 13], [4, 14], [5, 15], [5, 16], [5, 17], [6, 18], [6, 19], [6, 20], [7, 21], [7, 22], [8, 23], [8, 24]]) == [57, 58, 66, 74, 77, 75, 75, 85, 85, 89, 97, 97, 97, 100, 100, 98, 98, 98, 98, 98, 98, 108, 108, 108, 108]\n assert candidate(n = 27,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [5, 12], [6, 13], [6, 14], [7, 15], [7, 16], [8, 17], [8, 18], [9, 19], [10, 20], [10, 21], [11, 22], [12, 23], [12, 24], [13, 25], [14, 26]]) == [82, 81, 85, 94, 96, 100, 102, 115, 115, 119, 117, 123, 121, 125, 125, 140, 140, 140, 140, 144, 142, 142, 148, 146, 146, 150, 150]\n assert candidate(n = 20,edges = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [2, 6], [2, 7], [2, 8], [3, 9], [3, 10], [3, 11], [4, 12], [4, 13], [5, 14], [5, 15], [6, 16], [6, 17], [7, 18], [7, 19]]) == [43, 49, 47, 55, 63, 63, 61, 61, 65, 73, 73, 73, 81, 81, 81, 81, 79, 79, 79, 79]\n assert candidate(n = 20,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [5, 12], [6, 13], [6, 14], [7, 15], [7, 16], [8, 17], [8, 18], [9, 19]]) == [54, 50, 60, 56, 62, 74, 74, 70, 70, 78, 80, 92, 92, 92, 92, 88, 88, 88, 88, 96]\n assert candidate(n = 30,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [5, 12], [6, 13], [6, 14], [7, 15], [7, 16], [8, 17], [8, 18], [9, 19], [9, 20], [10, 21], [10, 22], [11, 23], [11, 24], [12, 25], [12, 26], [13, 27], [13, 28], [14, 29]]) == [94, 94, 96, 110, 110, 112, 114, 134, 134, 134, 134, 136, 136, 138, 140, 162, 162, 162, 162, 162, 162, 162, 162, 164, 164, 164, 164, 166, 166, 168]\n"}, "metadata": {"canonical_parameter_names": ["n", "edges"], "leetcode_dataset_entry_point": "Solution().sumOfDistancesInTree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sumOfDistancesInTree = function(n, edges) {", "container": null, "callable": "sumOfDistancesInTree", "parameters": [{"name": "n", "type": "number"}, {"name": "edges", "type": "number[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 835, "task_id": "image-overlap", "difficulty": "Medium", "problem_description": "You are given two images, img1 and img2, represented as binary, square matrices of size n x n. A binary matrix has only 0s and 1s as values.\nWe translate one image however we choose by sliding all the 1 bits left, right, up, and/or down any number of units. We then place it on top of the other image. We can then calculate the overlap by counting the number of positions that have a 1 in both images.\nNote also that a translation does not include any kind of rotation. Any 1 bits that are translated outside of the matrix borders are erased.\nReturn the largest possible overlap.\n \nExample 1:\n\n\nInput: img1 = [[1,1,0],[0,1,0],[0,1,0]], img2 = [[0,0,0],[0,1,1],[0,0,1]]\nOutput: 3\nExplanation: We translate img1 to right by 1 unit and down by 1 unit.\n\nThe number of positions that have a 1 in both images is 3 (shown in red).\n\n\nExample 2:\n\nInput: img1 = [[1]], img2 = [[1]]\nOutput: 1\n\nExample 3:\n\nInput: img1 = [[0]], img2 = [[0]]\nOutput: 0\n\n \nConstraints:\n\nn == img1.length == img1[i].length\nn == img2.length == img2[i].length\n1 <= n <= 30\nimg1[i][j] is either 0 or 1.\nimg2[i][j] is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(img1 = [[1, 1, 0], [0, 1, 0], [0, 1, 0]],img2 = [[0, 0, 0], [0, 1, 1], [0, 0, 1]]) == 3\n assert candidate(img1 = [[1, 0], [0, 1]],img2 = [[1, 1], [1, 1]]) == 2\n assert candidate(img1 = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],img2 = [[0, 1, 0], [1, 1, 1], [0, 1, 0]]) == 5\n assert candidate(img1 = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],img2 = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(img1 = [[1]],img2 = [[1]]) == 1\n assert candidate(img1 = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],img2 = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == 9\n assert candidate(img1 = [[1, 1], [1, 1]],img2 = [[0, 0], [0, 0]]) == 0\n assert candidate(img1 = [[0]],img2 = [[0]]) == 0\n assert candidate(img1 = [[1, 0, 1], [0, 1, 0], [1, 0, 1]],img2 = [[1, 0, 1], [0, 1, 0], [1, 0, 1]]) == 5\n assert candidate(img1 = [[1, 0], [0, 1]],img2 = [[1, 1], [1, 0]]) == 1\n assert candidate(img1 = [[0, 0, 0], [0, 0, 0], [0, 0, 0]],img2 = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(img1 = [[1, 0], [0, 1]],img2 = [[1, 0], [0, 1]]) == 2\n assert candidate(img1 = [[1, 1, 0, 0], [0, 0, 1, 1], [1, 1, 0, 0], [0, 0, 1, 1]],img2 = [[0, 0, 1, 1], [1, 1, 0, 0], [0, 0, 1, 1], [1, 1, 0, 0]]) == 6\n assert candidate(img1 = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],img2 = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 16\n assert candidate(img1 = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],img2 = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 0\n assert candidate(img1 = [[0, 0, 0, 0, 1], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [1, 0, 0, 0, 0]],img2 = [[1, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 1]]) == 4\n assert candidate(img1 = [[1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 0, 1]],img2 = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) == 5\n assert candidate(img1 = [[1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 1, 0, 0]],img2 = [[1, 0, 0, 1, 1], [1, 1, 1, 0, 0], [1, 0, 0, 1, 1], [1, 1, 1, 0, 0], [1, 0, 0, 1, 1]]) == 10\n assert candidate(img1 = [[1, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0], [1, 0, 0, 1]],img2 = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0\n assert candidate(img1 = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],img2 = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]]) == 4\n assert candidate(img1 = [[1, 1, 0, 0], [0, 0, 1, 1], [1, 1, 0, 0], [0, 0, 1, 1]],img2 = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]]) == 2\n assert candidate(img1 = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]],img2 = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [1, 0, 0, 0, 0]]) == 1\n assert candidate(img1 = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]],img2 = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 12\n assert candidate(img1 = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]],img2 = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 13\n assert candidate(img1 = [[1, 0, 0, 0, 1], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [1, 0, 0, 0, 1]],img2 = [[0, 0, 0, 0, 1], [0, 0, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0], [1, 0, 0, 0, 0]]) == 3\n assert candidate(img1 = [[1, 1, 1, 0], [1, 0, 0, 1], [0, 1, 0, 1], [1, 0, 1, 0]],img2 = [[0, 0, 1, 1], [0, 1, 1, 0], [1, 1, 0, 0], [1, 0, 0, 0]]) == 3\n assert candidate(img1 = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],img2 = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1]]) == 8\n assert candidate(img1 = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]],img2 = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 12\n assert candidate(img1 = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]],img2 = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) == 4\n assert candidate(img1 = [[1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 0, 1]],img2 = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 9\n assert candidate(img1 = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]],img2 = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0]]) == 6\n assert candidate(img1 = [[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1], [1, 0, 0, 1]],img2 = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) == 4\n assert candidate(img1 = [[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]],img2 = [[0, 0, 0, 0], [0, 0, 0, 0], [1, 1, 0, 0], [1, 1, 0, 0]]) == 4\n assert candidate(img1 = [[1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 0, 1, 1, 0, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1]],img2 = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0]]) == 1\n assert candidate(img1 = [[1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 0, 1]],img2 = [[1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 0, 1]]) == 9\n assert candidate(img1 = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]],img2 = [[0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0], [1, 0, 0, 0]]) == 1\n assert candidate(img1 = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]],img2 = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 10\n assert candidate(img1 = [[0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1], [1, 0, 0, 0, 0]],img2 = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) == 4\n assert candidate(img1 = [[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 1, 1, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0]],img2 = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0]]) == 4\n assert candidate(img1 = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],img2 = [[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0]]) == 2\n assert candidate(img1 = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]],img2 = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 1\n assert candidate(img1 = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]],img2 = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 10\n assert candidate(img1 = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],img2 = [[1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 0, 1]]) == 4\n assert candidate(img1 = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]],img2 = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 4\n assert candidate(img1 = [[0, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 1], [0, 1, 1, 0]],img2 = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]]) == 4\n assert candidate(img1 = [[1, 0, 0, 1], [0, 1, 1, 0], [1, 1, 0, 0], [0, 0, 1, 1]],img2 = [[0, 0, 1, 1], [1, 1, 0, 0], [0, 0, 1, 1], [1, 1, 0, 0]]) == 5\n assert candidate(img1 = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]],img2 = [[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == 6\n assert candidate(img1 = [[1, 1, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 1, 1]],img2 = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) == 4\n assert candidate(img1 = [[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1], [1, 0, 0, 1]],img2 = [[0, 0, 1, 0], [0, 1, 1, 0], [1, 1, 0, 0], [0, 0, 0, 1]]) == 3\n assert candidate(img1 = [[1, 1, 0, 1], [0, 1, 1, 0], [1, 0, 0, 1], [0, 1, 0, 1]],img2 = [[1, 0, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1], [0, 1, 0, 0]]) == 5\n assert candidate(img1 = [[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1], [1, 0, 0, 1]],img2 = [[0, 0, 1, 1], [1, 0, 0, 1], [0, 1, 1, 0], [1, 1, 0, 0]]) == 4\n assert candidate(img1 = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]],img2 = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 6\n assert candidate(img1 = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],img2 = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) == 1\n assert candidate(img1 = [[1, 1, 1, 0], [0, 1, 1, 0], [0, 0, 1, 1], [0, 0, 0, 1]],img2 = [[1, 0, 0, 1], [1, 1, 0, 0], [0, 1, 1, 0], [0, 1, 0, 1]]) == 5\n assert candidate(img1 = [[1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 0, 1]],img2 = [[0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0]]) == 5\n assert candidate(img1 = [[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1], [0, 0, 0, 1]],img2 = [[0, 0, 1, 1], [0, 1, 1, 0], [1, 1, 0, 0], [0, 0, 0, 1]]) == 3\n assert candidate(img1 = [[1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 1, 1, 0], [0, 0, 0, 0, 1]],img2 = [[0, 0, 0, 0, 1], [0, 0, 1, 1, 0], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0], [1, 1, 0, 0, 0]]) == 4\n assert candidate(img1 = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1]],img2 = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]]) == 4\n assert candidate(img1 = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1]],img2 = [[0, 0, 1, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 1, 0, 0]]) == 6\n assert candidate(img1 = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]],img2 = [[0, 0, 0, 0, 1], [0, 0, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0], [1, 0, 0, 0, 0]]) == 1\n assert candidate(img1 = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]],img2 = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]]) == 2\n assert candidate(img1 = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]],img2 = [[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) == 2\n assert candidate(img1 = [[1, 0, 0, 1], [0, 1, 1, 0], [1, 1, 0, 1], [0, 0, 1, 0]],img2 = [[0, 0, 1, 0], [1, 1, 0, 1], [0, 1, 1, 0], [1, 0, 0, 1]]) == 6\n assert candidate(img1 = [[1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 0, 1]],img2 = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 0\n assert candidate(img1 = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]],img2 = [[1, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0], [1, 0, 0, 1]]) == 4\n assert candidate(img1 = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],img2 = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 5\n assert candidate(img1 = [[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1], [0, 0, 0, 1]],img2 = [[0, 0, 1, 1], [0, 1, 1, 0], [1, 1, 0, 0], [1, 0, 0, 0]]) == 2\n assert candidate(img1 = [[1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1], [1, 1, 1, 0, 0]],img2 = [[0, 0, 1, 1, 0], [0, 0, 1, 1, 0], [1, 1, 0, 0, 1], [1, 1, 0, 0, 1], [0, 0, 1, 1, 0]]) == 8\n assert candidate(img1 = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]],img2 = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 8\n assert candidate(img1 = [[0, 1, 1, 1], [1, 1, 1, 0], [1, 1, 1, 0], [0, 1, 1, 1]],img2 = [[1, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 1]]) == 6\n assert candidate(img1 = [[1, 1, 0, 0, 0], [0, 1, 1, 0, 0], [0, 0, 1, 1, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]],img2 = [[0, 0, 0, 0, 1], [0, 0, 0, 1, 1], [0, 0, 1, 1, 0], [0, 1, 1, 0, 0], [1, 1, 0, 0, 0]]) == 2\n assert candidate(img1 = [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]],img2 = [[0, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0], [1, 0, 0, 0]]) == 1\n assert candidate(img1 = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]],img2 = [[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 1, 1, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0]]) == 5\n assert candidate(img1 = [[1, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]],img2 = [[0, 0, 0, 0, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [1, 0, 0, 0, 0]]) == 1\n assert candidate(img1 = [[1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]],img2 = [[0, 0, 0, 1, 1], [0, 0, 0, 1, 1], [1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [1, 1, 1, 0, 0]]) == 9\n"}, "metadata": {"canonical_parameter_names": ["img1", "img2"], "leetcode_dataset_entry_point": "Solution().largestOverlap", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var largestOverlap = function(img1, img2) {", "container": null, "callable": "largestOverlap", "parameters": [{"name": "img1", "type": "number[][]"}, {"name": "img2", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 836, "task_id": "rectangle-overlap", "difficulty": "Easy", "problem_description": "An axis-aligned rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) is the coordinate of its bottom-left corner, and (x2, y2) is the coordinate of its top-right corner. Its top and bottom edges are parallel to the X-axis, and its left and right edges are parallel to the Y-axis.\nTwo rectangles overlap if the area of their intersection is positive. To be clear, two rectangles that only touch at the corner or edges do not overlap.\nGiven two axis-aligned rectangles rec1 and rec2, return true if they overlap, otherwise return false.\n \nExample 1:\nInput: rec1 = [0,0,2,2], rec2 = [1,1,3,3]\nOutput: true\nExample 2:\nInput: rec1 = [0,0,1,1], rec2 = [1,0,2,1]\nOutput: false\nExample 3:\nInput: rec1 = [0,0,1,1], rec2 = [2,2,3,3]\nOutput: false\n\n \nConstraints:\n\nrec1.length == 4\nrec2.length == 4\n-109 <= rec1[i], rec2[i] <= 109\nrec1 and rec2 represent a valid rectangle with a non-zero area.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(rec1 = [-5, -5, -3, -3],rec2 = [-4, -4, -2, -2]) == True\n assert candidate(rec1 = [1, 1, 5, 5],rec2 = [4, 4, 8, 8]) == True\n assert candidate(rec1 = [-5, -5, -2, -2],rec2 = [-4, -4, -1, -1]) == True\n assert candidate(rec1 = [-2, -2, 0, 0],rec2 = [-1, -1, 1, 1]) == True\n assert candidate(rec1 = [1, 1, 4, 4],rec2 = [0, 0, 3, 3]) == True\n assert candidate(rec1 = [5, 5, 10, 10],rec2 = [1, 1, 6, 6]) == True\n assert candidate(rec1 = [5, 5, 10, 10],rec2 = [8, 8, 15, 15]) == True\n assert candidate(rec1 = [0, 0, 5, 5],rec2 = [5, 5, 10, 10]) == False\n assert candidate(rec1 = [0, 0, 1, 1],rec2 = [2, 2, 3, 3]) == False\n assert candidate(rec1 = [1, 1, 3, 3],rec2 = [2, 2, 4, 4]) == True\n assert candidate(rec1 = [1, 1, 2, 2],rec2 = [2, 2, 3, 3]) == False\n assert candidate(rec1 = [1, 1, 3, 3],rec2 = [0, 0, 1, 1]) == False\n assert candidate(rec1 = [5, 5, 10, 10],rec2 = [10, 10, 15, 15]) == False\n assert candidate(rec1 = [5, 5, 10, 10],rec2 = [11, 11, 16, 16]) == False\n assert candidate(rec1 = [0, 0, 1, 1],rec2 = [1, 0, 2, 1]) == False\n assert candidate(rec1 = [-5, -5, -2, -2],rec2 = [-3, -3, -1, -1]) == True\n assert candidate(rec1 = [0, 0, 2, 2],rec2 = [1, 1, 3, 3]) == True\n assert candidate(rec1 = [1, 1, 3, 3],rec2 = [0, 0, 2, 2]) == True\n assert candidate(rec1 = [5, 5, 10, 10],rec2 = [6, 6, 11, 11]) == True\n assert candidate(rec1 = [-1, -1, 1, 1],rec2 = [0, 0, 2, 2]) == True\n assert candidate(rec1 = [-200000000, -200000000, -100000000, -100000000],rec2 = [-150000000, -150000000, -50000000, -50000000]) == True\n assert candidate(rec1 = [0, 0, 10, 10],rec2 = [10, 10, 20, 20]) == False\n assert candidate(rec1 = [0, 0, 2, 2],rec2 = [1, -1, 3, 1]) == True\n assert candidate(rec1 = [1, 2, 3, 4],rec2 = [2, 3, 5, 6]) == True\n assert candidate(rec1 = [1, 2, 3, 4],rec2 = [2, 3, 4, 5]) == True\n assert candidate(rec1 = [0, 0, 1000, 1000],rec2 = [500, 500, 1500, 1500]) == True\n assert candidate(rec1 = [-1, -1, 1, 1],rec2 = [-2, -2, 0, 0]) == True\n assert candidate(rec1 = [0, 0, 5, 5],rec2 = [5, 5, 10, 10]) == False\n assert candidate(rec1 = [10, 20, 30, 40],rec2 = [25, 35, 45, 55]) == True\n assert candidate(rec1 = [0, 0, 5, 5],rec2 = [6, 6, 10, 10]) == False\n assert candidate(rec1 = [0, 0, 10, 10],rec2 = [-5, -5, 5, 5]) == True\n assert candidate(rec1 = [0, 0, 5, 5],rec2 = [5, 0, 10, 5]) == False\n assert candidate(rec1 = [-5, 0, 5, 10],rec2 = [0, -10, 10, 0]) == False\n assert candidate(rec1 = [100, 200, 300, 400],rec2 = [250, 250, 350, 350]) == True\n assert candidate(rec1 = [1000, 1000, 2000, 2000],rec2 = [500, 500, 1500, 1500]) == True\n assert candidate(rec1 = [0, 0, 10, 10],rec2 = [5, -5, 15, 5]) == True\n assert candidate(rec1 = [0, 0, 1, 1],rec2 = [0.9, 0.9, 2, 2]) == True\n assert candidate(rec1 = [-1000000000, -1000000000, 1000000000, 1000000000],rec2 = [0, 0, 1, 1]) == True\n assert candidate(rec1 = [0, 0, 1, 1],rec2 = [-1, -1, 0, 0]) == False\n assert candidate(rec1 = [-10, -10, 0, 0],rec2 = [0, 0, 10, 10]) == False\n assert candidate(rec1 = [0, 0, 100, 100],rec2 = [50, 50, 150, 150]) == True\n assert candidate(rec1 = [0, 0, 10, 10],rec2 = [5, 5, 15, 15]) == True\n assert candidate(rec1 = [-5, -5, 5, 5],rec2 = [-10, -10, -5, -5]) == False\n assert candidate(rec1 = [10, 20, 30, 40],rec2 = [25, 35, 35, 45]) == True\n assert candidate(rec1 = [0, 0, 100, 100],rec2 = [99, 99, 200, 200]) == True\n assert candidate(rec1 = [0, 0, 1, 1],rec2 = [0.5, 0.5, 1.5, 1.5]) == True\n assert candidate(rec1 = [10, 10, 15, 15],rec2 = [12, 12, 18, 18]) == True\n assert candidate(rec1 = [10, 10, 20, 20],rec2 = [5, 5, 15, 15]) == True\n assert candidate(rec1 = [-100, 100, -50, 150],rec2 = [-75, 125, -25, 175]) == True\n assert candidate(rec1 = [1, 1, 4, 4],rec2 = [2, 2, 3, 3]) == True\n assert candidate(rec1 = [-100, -200, -50, -150],rec2 = [-75, -175, -25, -125]) == True\n assert candidate(rec1 = [0, 0, 5, 5],rec2 = [0, 5, 5, 10]) == False\n assert candidate(rec1 = [-10, -10, 0, 0],rec2 = [-5, -5, 5, 5]) == True\n assert candidate(rec1 = [0, 0, 1, 1],rec2 = [0, 1, 1, 2]) == False\n assert candidate(rec1 = [10, 10, 20, 20],rec2 = [15, 15, 25, 25]) == True\n assert candidate(rec1 = [-10, 20, -5, 25],rec2 = [-7, 15, -2, 22]) == True\n assert candidate(rec1 = [0, 0, 1, 1],rec2 = [0, -1, 1, 0]) == False\n assert candidate(rec1 = [0, 0, 10, 10],rec2 = [5, -5, 15, 5]) == True\n assert candidate(rec1 = [10, 10, 20, 20],rec2 = [10, 10, 20, 20]) == True\n assert candidate(rec1 = [100, 100, 200, 200],rec2 = [200, 200, 300, 300]) == False\n assert candidate(rec1 = [1, 1, 5, 5],rec2 = [5, 5, 9, 9]) == False\n assert candidate(rec1 = [-1, 0, 0, 1],rec2 = [0, -1, 1, 0]) == False\n assert candidate(rec1 = [-1, -1, 1, 1],rec2 = [1, 1, 2, 2]) == False\n assert candidate(rec1 = [-10, -20, -5, -15],rec2 = [-7, -18, -3, -12]) == True\n assert candidate(rec1 = [1000000000, 1000000000, 2000000000, 2000000000],rec2 = [1500000000, 1500000000, 2500000000, 2500000000]) == True\n assert candidate(rec1 = [-10, -10, 10, 10],rec2 = [-5, -5, 5, 5]) == True\n assert candidate(rec1 = [1, 1, 5, 5],rec2 = [1, 6, 5, 10]) == False\n assert candidate(rec1 = [0, 0, 10, 10],rec2 = [10, 0, 20, 10]) == False\n assert candidate(rec1 = [1, 2, 3, 4],rec2 = [4, 3, 5, 2]) == False\n assert candidate(rec1 = [-1000000000, -1000000000, 1000000000, 1000000000],rec2 = [0, 0, 1, 1]) == True\n assert candidate(rec1 = [1, 1, 5, 5],rec2 = [1, 1, 6, 6]) == True\n assert candidate(rec1 = [0, 0, 1, 1],rec2 = [1, 0, 2, 1]) == False\n assert candidate(rec1 = [100000000, 100000000, 200000000, 200000000],rec2 = [150000000, 150000000, 250000000, 250000000]) == True\n assert candidate(rec1 = [1, 1, 5, 5],rec2 = [6, 1, 10, 5]) == False\n assert candidate(rec1 = [10, 20, 30, 40],rec2 = [25, 35, 45, 55]) == True\n assert candidate(rec1 = [0, 0, 1, 1],rec2 = [1, 1, 2, 2]) == False\n assert candidate(rec1 = [1, 2, 3, 4],rec2 = [3, 4, 5, 6]) == False\n assert candidate(rec1 = [0, 0, 10, 10],rec2 = [9, 9, 11, 11]) == True\n assert candidate(rec1 = [0, 0, 1, 1],rec2 = [1.5, 1.5, 2.5, 2.5]) == False\n assert candidate(rec1 = [1000, 1000, 2000, 2000],rec2 = [1500, 1500, 2500, 2500]) == True\n assert candidate(rec1 = [-10, -10, 10, 10],rec2 = [9, 9, 20, 20]) == True\n assert candidate(rec1 = [-500000000, -500000000, 500000000, 500000000],rec2 = [0, 0, 1, 1]) == True\n assert candidate(rec1 = [0, 0, 100, 100],rec2 = [90, 90, 200, 200]) == True\n assert candidate(rec1 = [1, 1, 4, 4],rec2 = [4, 4, 7, 7]) == False\n assert candidate(rec1 = [10, 10, 20, 20],rec2 = [21, 21, 30, 30]) == False\n assert candidate(rec1 = [0, 0, 5, 5],rec2 = [-5, -5, 0, 0]) == False\n assert candidate(rec1 = [10, 10, 20, 20],rec2 = [20, 20, 30, 30]) == False\n assert candidate(rec1 = [2, 2, 5, 5],rec2 = [5, 5, 8, 8]) == False\n assert candidate(rec1 = [1, 2, 4, 5],rec2 = [3, 3, 6, 6]) == True\n assert candidate(rec1 = [0, 0, 10, 10],rec2 = [-10, -10, 0, 0]) == False\n assert candidate(rec1 = [-1, -1, 1, 1],rec2 = [0, 0, 2, 2]) == True\n assert candidate(rec1 = [-100, -100, 0, 0],rec2 = [-50, -50, 50, 50]) == True\n assert candidate(rec1 = [-1000000, -1000000, -900000, -900000],rec2 = [-950000, -950000, -850000, -850000]) == True\n assert candidate(rec1 = [0, 0, 1000000000, 1000000000],rec2 = [500000000, 500000000, 1500000000, 1500000000]) == True\n assert candidate(rec1 = [-100, -100, 0, 0],rec2 = [0, 0, 100, 100]) == False\n assert candidate(rec1 = [10, 20, 30, 40],rec2 = [25, 30, 35, 45]) == True\n assert candidate(rec1 = [0, 0, 1, 1],rec2 = [0.5, 0.5, 1.5, 1.5]) == True\n assert candidate(rec1 = [-20, -20, -10, -10],rec2 = [-15, -15, -5, -5]) == True\n assert candidate(rec1 = [15, 25, 30, 45],rec2 = [20, 30, 40, 50]) == True\n assert candidate(rec1 = [1, 1, 2, 2],rec2 = [1.5, 1.5, 2.5, 2.5]) == True\n assert candidate(rec1 = [1, 1, 10, 10],rec2 = [5, 5, 5, 10]) == True\n assert candidate(rec1 = [-1, -1, 1, 1],rec2 = [-2, -2, 0, 0]) == True\n assert candidate(rec1 = [100, 100, 200, 200],rec2 = [150, 150, 250, 250]) == True\n assert candidate(rec1 = [0, 0, 1, 1],rec2 = [1, 1, 2, 2]) == False\n assert candidate(rec1 = [1, 2, 3, 4],rec2 = [2, 1, 4, 3]) == True\n assert candidate(rec1 = [0, 0, 5, 5],rec2 = [-5, -5, 0, 0]) == False\n assert candidate(rec1 = [-2, -2, 2, 2],rec2 = [2, 2, 4, 4]) == False\n assert candidate(rec1 = [0, 0, 100, 100],rec2 = [50, 50, 150, 150]) == True\n assert candidate(rec1 = [-1, -1, 1, 1],rec2 = [-2, -2, 2, 2]) == True\n assert candidate(rec1 = [0, 0, 1000000000, 1000000000],rec2 = [500000000, 500000000, 1500000000, 1500000000]) == True\n assert candidate(rec1 = [10, 10, 20, 20],rec2 = [15, 15, 25, 25]) == True\n assert candidate(rec1 = [-1000000000, -1000000000, 0, 0],rec2 = [-500000000, -500000000, 500000000, 500000000]) == True\n assert candidate(rec1 = [-10, -10, 0, 0],rec2 = [-5, -5, 5, 5]) == True\n assert candidate(rec1 = [10, 10, 20, 20],rec2 = [20, 20, 30, 30]) == False\n assert candidate(rec1 = [0, 0, 10, 10],rec2 = [2, 2, 8, 8]) == True\n assert candidate(rec1 = [-10, -10, -5, -5],rec2 = [-8, -8, -3, -3]) == True\n assert candidate(rec1 = [-1000, -1000, 1000, 1000],rec2 = [-2000, -2000, 0, 0]) == True\n assert candidate(rec1 = [5, 5, 15, 15],rec2 = [5, 15, 15, 25]) == False\n assert candidate(rec1 = [100, 100, 200, 200],rec2 = [150, 150, 250, 250]) == True\n assert candidate(rec1 = [1, 1, 2, 2],rec2 = [0, 0, 100, 100]) == True\n assert candidate(rec1 = [-1, -2, 1, 2],rec2 = [-2, -3, 2, 3]) == True\n assert candidate(rec1 = [-1000000000, -1000000000, 0, 0],rec2 = [-500000000, -500000000, 500000000, 500000000]) == True\n"}, "metadata": {"canonical_parameter_names": ["rec1", "rec2"], "leetcode_dataset_entry_point": "Solution().isRectangleOverlap", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isRectangleOverlap = function(rec1, rec2) {", "container": null, "callable": "isRectangleOverlap", "parameters": [{"name": "rec1", "type": "number[]"}, {"name": "rec2", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 837, "task_id": "new-21-game", "difficulty": "Medium", "problem_description": "Alice plays the following game, loosely based on the card game \"21\".\nAlice starts with 0 points and draws numbers while she has less than k points. During each draw, she gains an integer number of points randomly from the range [1, maxPts], where maxPts is an integer. Each draw is independent and the outcomes have equal probabilities.\nAlice stops drawing numbers when she gets k or more points.\nReturn the probability that Alice has n or fewer points.\nAnswers within 10-5 of the actual answer are considered accepted.\n \nExample 1:\n\nInput: n = 10, k = 1, maxPts = 10\nOutput: 1.00000\nExplanation: Alice gets a single card, then stops.\n\nExample 2:\n\nInput: n = 6, k = 1, maxPts = 10\nOutput: 0.60000\nExplanation: Alice gets a single card, then stops.\nIn 6 out of 10 possibilities, she is at or below 6 points.\n\nExample 3:\n\nInput: n = 21, k = 17, maxPts = 10\nOutput: 0.73278\n\n \nConstraints:\n\n0 <= k <= n <= 104\n1 <= maxPts <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 10,k = 5,maxPts = 5) == 1.0\n assert candidate(n = 100,k = 50,maxPts = 20) == 1.0\n assert candidate(n = 100,k = 50,maxPts = 5) == 1.0\n assert candidate(n = 6,k = 1,maxPts = 10) == 0.6\n assert candidate(n = 10000,k = 0,maxPts = 10000) == 1\n assert candidate(n = 10,k = 1,maxPts = 10) == 1.0\n assert candidate(n = 21,k = 17,maxPts = 10) == 0.7327777870686083\n assert candidate(n = 20,k = 15,maxPts = 5) == 1.0\n assert candidate(n = 0,k = 0,maxPts = 1) == 1\n assert candidate(n = 100,k = 90,maxPts = 5) == 1.0\n assert candidate(n = 5,k = 3,maxPts = 2) == 1.0\n assert candidate(n = 20,k = 0,maxPts = 10) == 1\n assert candidate(n = 15,k = 15,maxPts = 10) == 0.18009983358324094\n assert candidate(n = 75,k = 50,maxPts = 20) == 1.0\n assert candidate(n = 25,k = 25,maxPts = 5) == 0.3333044673513253\n assert candidate(n = 100,k = 100,maxPts = 1) == 1.0\n assert candidate(n = 100,k = 50,maxPts = 50) == 1.0\n assert candidate(n = 30,k = 25,maxPts = 5) == 1.0\n assert candidate(n = 200,k = 150,maxPts = 50) == 1.0\n assert candidate(n = 75,k = 30,maxPts = 30) == 1.0\n assert candidate(n = 9999,k = 0,maxPts = 100) == 1\n assert candidate(n = 45,k = 45,maxPts = 10) == 0.18183615529245928\n assert candidate(n = 50,k = 30,maxPts = 20) == 1.0\n assert candidate(n = 100,k = 80,maxPts = 20) == 1.0\n assert candidate(n = 500,k = 400,maxPts = 50) == 1.0\n assert candidate(n = 50,k = 40,maxPts = 10) == 1.0\n assert candidate(n = 60,k = 55,maxPts = 10) == 0.818177813346613\n assert candidate(n = 60,k = 30,maxPts = 10) == 1.0\n assert candidate(n = 100,k = 0,maxPts = 1) == 1\n assert candidate(n = 200,k = 150,maxPts = 30) == 1.0\n assert candidate(n = 15,k = 10,maxPts = 5) == 1.0\n assert candidate(n = 100,k = 50,maxPts = 25) == 1.0\n assert candidate(n = 50,k = 25,maxPts = 20) == 1.0\n assert candidate(n = 80,k = 40,maxPts = 15) == 1.0\n assert candidate(n = 80,k = 70,maxPts = 10) == 1.0\n assert candidate(n = 90,k = 85,maxPts = 5) == 1.0\n assert candidate(n = 750,k = 300,maxPts = 50) == 1.0\n assert candidate(n = 30,k = 25,maxPts = 10) == 0.8193954028011721\n assert candidate(n = 500,k = 250,maxPts = 100) == 1.0\n assert candidate(n = 15,k = 7,maxPts = 5) == 1.0\n assert candidate(n = 80,k = 20,maxPts = 3) == 1.0\n assert candidate(n = 15,k = 15,maxPts = 1) == 1.0\n assert candidate(n = 80,k = 60,maxPts = 10) == 1.0\n assert candidate(n = 25,k = 25,maxPts = 1) == 1.0\n assert candidate(n = 25,k = 0,maxPts = 25) == 1\n assert candidate(n = 300,k = 1,maxPts = 100) == 1.0\n assert candidate(n = 30,k = 20,maxPts = 10) == 1.0\n assert candidate(n = 25,k = 20,maxPts = 15) == 0.6217079716932831\n assert candidate(n = 25,k = 20,maxPts = 5) == 1.0\n assert candidate(n = 120,k = 90,maxPts = 20) == 1.0\n assert candidate(n = 70,k = 60,maxPts = 3) == 1.0\n assert candidate(n = 15,k = 10,maxPts = 3) == 1.0\n assert candidate(n = 90,k = 75,maxPts = 12) == 1.0\n assert candidate(n = 50,k = 25,maxPts = 5) == 1.0\n assert candidate(n = 75,k = 50,maxPts = 25) == 1.0\n assert candidate(n = 40,k = 0,maxPts = 5) == 1\n assert candidate(n = 200,k = 150,maxPts = 10) == 1.0\n assert candidate(n = 70,k = 10,maxPts = 30) == 1.0\n assert candidate(n = 150,k = 100,maxPts = 15) == 1.0\n assert candidate(n = 30,k = 15,maxPts = 10) == 1.0\n assert candidate(n = 100,k = 90,maxPts = 10) == 1.0\n assert candidate(n = 30,k = 15,maxPts = 5) == 1.0\n assert candidate(n = 90,k = 80,maxPts = 5) == 1.0\n"}, "metadata": {"canonical_parameter_names": ["n", "k", "maxPts"], "leetcode_dataset_entry_point": "Solution().new21Game", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var new21Game = function(n, k, maxPts) {", "container": null, "callable": "new21Game", "parameters": [{"name": "n", "type": "number"}, {"name": "k", "type": "number"}, {"name": "maxPts", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 838, "task_id": "push-dominoes", "difficulty": "Medium", "problem_description": "There are n dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to the left or to the right.\nAfter each second, each domino that is falling to the left pushes the adjacent domino on the left. Similarly, the dominoes falling to the right push their adjacent dominoes standing on the right.\nWhen a vertical domino has dominoes falling on it from both sides, it stays still due to the balance of the forces.\nFor the purposes of this question, we will consider that a falling domino expends no additional force to a falling or already fallen domino.\nYou are given a string dominoes representing the initial state where:\n\ndominoes[i] = 'L', if the ith domino has been pushed to the left,\ndominoes[i] = 'R', if the ith domino has been pushed to the right, and\ndominoes[i] = '.', if the ith domino has not been pushed.\n\nReturn a string representing the final state.\n \nExample 1:\n\nInput: dominoes = \"RR.L\"\nOutput: \"RR.L\"\nExplanation: The first domino expends no additional force on the second domino.\n\nExample 2:\n\n\nInput: dominoes = \".L.R...LR..L..\"\nOutput: \"LL.RR.LLRRLL..\"\n\n \nConstraints:\n\nn == dominoes.length\n1 <= n <= 105\ndominoes[i] is either 'L', 'R', or '.'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(dominoes = \"R..L\") == \"RRLL\"\n assert candidate(dominoes = \"..R......L..\") == \"..RRRRLLLL..\"\n assert candidate(dominoes = \"RRRRRRRRRR\") == \"RRRRRRRRRR\"\n assert candidate(dominoes = \"L........R\") == \"L........R\"\n assert candidate(dominoes = \"L.R...R.L\") == \"L.RRRRR.L\"\n assert candidate(dominoes = \"LLLLL\") == \"LLLLL\"\n assert candidate(dominoes = \"LLRRLLRRLL\") == \"LLRRLLRRLL\"\n assert candidate(dominoes = \"LLLLLLLLLL\") == \"LLLLLLLLLL\"\n assert candidate(dominoes = \"LLRRLLRR\") == \"LLRRLLRR\"\n assert candidate(dominoes = \"RRRRR\") == \"RRRRR\"\n assert candidate(dominoes = \".L.R...LR..L..\") == \"LL.RR.LLRRLL..\"\n assert candidate(dominoes = \"........\") == \"........\"\n assert candidate(dominoes = \"R........\") == \"RRRRRRRRR\"\n assert candidate(dominoes = \"RRRRRRRRR\") == \"RRRRRRRRR\"\n assert candidate(dominoes = \"R....L\") == \"RRRLLL\"\n assert candidate(dominoes = \"L.L.L\") == \"LLLLL\"\n assert candidate(dominoes = \"R.L.R.L.R\") == \"R.L.R.L.R\"\n assert candidate(dominoes = \"R......L\") == \"RRRRLLLL\"\n assert candidate(dominoes = \"L.R.L\") == \"L.R.L\"\n assert candidate(dominoes = \"LR.LR.LR.LR\") == \"LR.LR.LR.LR\"\n assert candidate(dominoes = \"R........L\") == \"RRRRRLLLLL\"\n assert candidate(dominoes = \".....\") == \".....\"\n assert candidate(dominoes = \"R.R.L.L.R\") == \"RRR.LLL.R\"\n assert candidate(dominoes = \"R......R.L\") == \"RRRRRRRR.L\"\n assert candidate(dominoes = \"RR.L\") == \"RR.L\"\n assert candidate(dominoes = \"L.R.R.L.L.R.L.R.L.L.R.L.R.L.L.R.L.R.L\") == \"L.RRR.LLL.R.L.R.LLL.R.L.R.LLL.R.L.R.L\"\n assert candidate(dominoes = \"........L\") == \"LLLLLLLLL\"\n assert candidate(dominoes = \"RLRLRLRL\") == \"RLRLRLRL\"\n assert candidate(dominoes = \"R.....L\") == \"RRR.LLL\"\n assert candidate(dominoes = \"R.R.L\") == \"RRR.L\"\n assert candidate(dominoes = \"L.R.L.R.L\") == \"L.R.L.R.L\"\n assert candidate(dominoes = \".......\") == \".......\"\n assert candidate(dominoes = \"L.R.R.L.L.R\") == \"L.RRR.LLL.R\"\n assert candidate(dominoes = \"LLLLLLLLL\") == \"LLLLLLLLL\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L.R.L\") == \"L.R.L.R.L.R.L.R.L.R.L\"\n assert candidate(dominoes = \"............R.L...........\") == \"............R.L...........\"\n assert candidate(dominoes = \"R.....L.....R.....L\") == \"RRR.LLL.....RRR.LLL\"\n assert candidate(dominoes = \"L...R...L...R...L\") == \"L...RR.LL...RR.LL\"\n assert candidate(dominoes = \"L...R.L...R.L...R.L\") == \"L...R.L...R.L...R.L\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\") == \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\") == \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\") == \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\"\n assert candidate(dominoes = \"R......L.R.L......R\") == \"RRRRLLLL.R.L......R\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.R\") == \"L.R.L.R.L.R.L.RRR\"\n assert candidate(dominoes = \"L.....R.L.....R.L.....R\") == \"L.....R.L.....R.L.....R\"\n assert candidate(dominoes = \"...R...L...R...L...\") == \"...RR.LL...RR.LL...\"\n assert candidate(dominoes = \"R...L...R...L...R...L\") == \"RR.LL...RR.LL...RR.LL\"\n assert candidate(dominoes = \"R.L.R.L.R.L\") == \"R.L.R.L.R.L\"\n assert candidate(dominoes = \".......L........R\") == \"LLLLLLLL........R\"\n assert candidate(dominoes = \"R...L.L...R.R...L\") == \"RR.LLLL...RRRR.LL\"\n assert candidate(dominoes = \"L.L.L.L.L.L.L.L.L\") == \"LLLLLLLLLLLLLLLLL\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L\") == \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L\"\n assert candidate(dominoes = \"R.R.R.R.R.R.R.L.L.L.L.L\") == \"RRRRRRRRRRRRR.LLLLLLLLL\"\n assert candidate(dominoes = \"...R.L.L.R.L.L.R.L...\") == \"...R.LLL.R.LLL.R.L...\"\n assert candidate(dominoes = \"LLLLLLLLLLRRRRRRRRRR\") == \"LLLLLLLLLLRRRRRRRRRR\"\n assert candidate(dominoes = \"L........R........L\") == \"L........RRRRRLLLLL\"\n assert candidate(dominoes = \"L......R.R......L.L......R\") == \"L......RRRRRRLLLLLL......R\"\n assert candidate(dominoes = \"L.R.R.L.L.R.R.L.L\") == \"L.RRR.LLL.RRR.LLL\"\n assert candidate(dominoes = \"R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R\") == \"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L.R\") == \"L.R.L.R.L.R.L.R.L.R\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.R.L\") == \"L.R.L.R.L.R.L.RRR.L\"\n assert candidate(dominoes = \"R.......L.L.......R.R.......L\") == \"RRRR.LLLLLL.......RRRRRR.LLLL\"\n assert candidate(dominoes = \"L.R.R...L.R.L.R.L\") == \"L.RRRR.LL.R.L.R.L\"\n assert candidate(dominoes = \"RL.R.L.RL.R.L.RL\") == \"RL.R.L.RL.R.L.RL\"\n assert candidate(dominoes = \"R.R.R.R.R.R.R.R\") == \"RRRRRRRRRRRRRRR\"\n assert candidate(dominoes = \"RLRLRLRLRLRLRLRLRL\") == \"RLRLRLRLRLRLRLRLRL\"\n assert candidate(dominoes = \"R....L.R.L....L\") == \"RRRLLL.R.LLLLLL\"\n assert candidate(dominoes = \"RRRR.L.L.R..L.RR.L\") == \"RRRR.LLL.RRLL.RR.L\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.L\") == \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.LLL\"\n assert candidate(dominoes = \"R.L...L.R.R...L.L.R.L...L\") == \"R.LLLLL.RRRR.LLLL.R.LLLLL\"\n assert candidate(dominoes = \"RR.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\") == \"RR.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\") == \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\"\n assert candidate(dominoes = \"R.....L.R.....L.R.....L\") == \"RRR.LLL.RRR.LLL.RRR.LLL\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L\") == \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L\"\n assert candidate(dominoes = \"R...L.R...L\") == \"RR.LL.RR.LL\"\n assert candidate(dominoes = \"R.........L\") == \"RRRRR.LLLLL\"\n assert candidate(dominoes = \"R...............................L\") == \"RRRRRRRRRRRRRRRR.LLLLLLLLLLLLLLLL\"\n assert candidate(dominoes = \"R...L.R...L.R...L.R.L\") == \"RR.LL.RR.LL.RR.LL.R.L\"\n assert candidate(dominoes = \"L.L.L.L.L.L.L.L.L.L\") == \"LLLLLLLLLLLLLLLLLLL\"\n assert candidate(dominoes = \"LLRRRR.LLLLLRRR.L.L.L.L.L.R\") == \"LLRRRR.LLLLLRRR.LLLLLLLLL.R\"\n assert candidate(dominoes = \"RRRRRR.....LLLLL\") == \"RRRRRRRR.LLLLLLL\"\n assert candidate(dominoes = \".......R.L.......\") == \".......R.L.......\"\n assert candidate(dominoes = \"..R.L..R.L..R.L..\") == \"..R.L..R.L..R.L..\"\n assert candidate(dominoes = \"......R.L......\") == \"......R.L......\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L\") == \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L\"\n assert candidate(dominoes = \"RR.LL.RR.LL.RR.LL\") == \"RR.LL.RR.LL.RR.LL\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.R.L\") == \"R.L.R.L.R.L.R.L.R.L\"\n assert candidate(dominoes = \"RR...L.L.L.R...RR\") == \"RRR.LLLLLL.RRRRRR\"\n assert candidate(dominoes = \"LRLRLRLRLRLRLRLRLR\") == \"LRLRLRLRLRLRLRLRLR\"\n assert candidate(dominoes = \"R.L.L.L.L.L.L.L.L.L.R\") == \"R.LLLLLLLLLLLLLLLLL.R\"\n assert candidate(dominoes = \"RR.LLLLLRRRR.LLLLLRRRR.LLLLL\") == \"RR.LLLLLRRRR.LLLLLRRRR.LLLLL\"\n assert candidate(dominoes = \"L.L.L.L.L.R.R.R.R.R\") == \"LLLLLLLLL.RRRRRRRRR\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L.R.L.L\") == \"L.R.L.R.L.R.L.R.L.R.LLL\"\n assert candidate(dominoes = \"L...R...L...R...L...R\") == \"L...RR.LL...RR.LL...R\"\n assert candidate(dominoes = \"RR.LRR.LRR.LRR.L\") == \"RR.LRR.LRR.LRR.L\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\") == \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\"\n assert candidate(dominoes = \"...R.L...L.R...R.L...\") == \"...R.LLLLL.RRRRR.L...\"\n assert candidate(dominoes = \"........L...R\") == \"LLLLLLLLL...R\"\n assert candidate(dominoes = \"L...R.L...R.L...R.L...R.L...R.L...R.L...R.L...R.L...R.L\") == \"L...R.L...R.L...R.L...R.L...R.L...R.L...R.L...R.L...R.L\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.L\") == \"R.L.R.L.R.L.R.LLL\"\n assert candidate(dominoes = \"R.L....L.R.R.L\") == \"R.LLLLLL.RRR.L\"\n assert candidate(dominoes = \"L.L.R.R.L.L.R.R.L.L\") == \"LLL.RRR.LLL.RRR.LLL\"\n assert candidate(dominoes = \"L.L.L.L.L.L.L.L\") == \"LLLLLLLLLLLLLLL\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\") == \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\"\n assert candidate(dominoes = \"R......L.L......R.R......L\") == \"RRRRLLLLLL......RRRRRRLLLL\"\n assert candidate(dominoes = \".......................................\") == \".......................................\"\n assert candidate(dominoes = \"L.L.L.L.L.L.R.R.R.R.R\") == \"LLLLLLLLLLL.RRRRRRRRR\"\n assert candidate(dominoes = \"....R.L.....R.L....\") == \"....R.L.....R.L....\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.L.R.L\") == \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.LLL.R.L\"\n assert candidate(dominoes = \"RRRRLLLLLLLL\") == \"RRRRLLLLLLLL\"\n assert candidate(dominoes = \"L...R.L...R.L...R\") == \"L...R.L...R.L...R\"\n assert candidate(dominoes = \"RRRRRRRRRRLLLLLLLLLL\") == \"RRRRRRRRRRLLLLLLLLLL\"\n assert candidate(dominoes = \"RRRR.LLLLL.LLLLL.RRRR\") == \"RRRR.LLLLLLLLLLL.RRRR\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\") == \"L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R\"\n assert candidate(dominoes = \"L.....R.R...L.L.R.L\") == \"L.....RRRR.LLLL.R.L\"\n assert candidate(dominoes = \"R........L.......\") == \"RRRRRLLLLL.......\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.R.L.R\") == \"R.L.R.L.R.L.R.L.R.L.R\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.L.R.L\") == \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.LLL.R.L\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.R.L.R.L\") == \"R.L.R.L.R.L.R.L.R.L.R.L\"\n assert candidate(dominoes = \"L.....R.....L.....R\") == \"L.....RRR.LLL.....R\"\n assert candidate(dominoes = \"LR.LR.LR.LR.LR.LR\") == \"LR.LR.LR.LR.LR.LR\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.R\") == \"R.L.R.L.R.L.R.L.R\"\n assert candidate(dominoes = \"L.R.R.L.L.R.R.L.L.R\") == \"L.RRR.LLL.RRR.LLL.R\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.L.R\") == \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.LLL.R\"\n assert candidate(dominoes = \"........L...R........\") == \"LLLLLLLLL...RRRRRRRRR\"\n assert candidate(dominoes = \"R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R\") == \"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.L.R\") == \"R.L.R.L.R.L.R.LLL.R\"\n assert candidate(dominoes = \"........L.R........\") == \"LLLLLLLLL.RRRRRRRRR\"\n assert candidate(dominoes = \"..............R..............L..............\") == \"..............RRRRRRRRLLLLLLLL..............\"\n assert candidate(dominoes = \"R.R.R.R.R.L.L.L.L.L\") == \"RRRRRRRRR.LLLLLLLLL\"\n assert candidate(dominoes = \".RR.L.L.R.R.L.L\") == \".RR.LLL.RRR.LLL\"\n assert candidate(dominoes = \"L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L\") == \"LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL\"\n assert candidate(dominoes = \"R.L...........R\") == \"R.L...........R\"\n assert candidate(dominoes = \"..............................\") == \"..............................\"\n assert candidate(dominoes = \"LRR.LL.R..R.L.L...R\") == \"LRR.LL.RRRR.LLL...R\"\n assert candidate(dominoes = \"R.R.R.R.R.R.R.R.R.R\") == \"RRRRRRRRRRRRRRRRRRR\"\n assert candidate(dominoes = \"LLLLL.....RRRRR\") == \"LLLLL.....RRRRR\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L\") == \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L\"\n assert candidate(dominoes = \"R.L...R...L...R.L\") == \"R.L...RR.LL...R.L\"\n assert candidate(dominoes = \"R.R.R.R.R.R.R.R.R\") == \"RRRRRRRRRRRRRRRRR\"\n assert candidate(dominoes = \"R.R.R.R.R.R.R.R.R.R.R\") == \"RRRRRRRRRRRRRRRRRRRRR\"\n assert candidate(dominoes = \"...R.L.R.L.R.L.R.L.R.L...\") == \"...R.L.R.L.R.L.R.L.R.L...\"\n assert candidate(dominoes = \"........LR........\") == \"LLLLLLLLLRRRRRRRRR\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L\") == \"R.L.R.L.R.L.R.L\"\n assert candidate(dominoes = \"..R...L...R...L...R\") == \"..RR.LL...RR.LL...R\"\n assert candidate(dominoes = \"RR.L.L.R.R.L.L.R\") == \"RR.LLL.RRR.LLL.R\"\n assert candidate(dominoes = \"R.L....R.L\") == \"R.L....R.L\"\n assert candidate(dominoes = \"L.L.L.L.L.L.L.L.L.L.L\") == \"LLLLLLLLLLLLLLLLLLLLL\"\n assert candidate(dominoes = \"RR.R.L.LRR\") == \"RRRR.LLLRR\"\n assert candidate(dominoes = \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L\") == \"R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L.R.L\"\n assert candidate(dominoes = \"R....L.R.L.R....L\") == \"RRRLLL.R.L.RRRLLL\"\n assert candidate(dominoes = \"..R.R.L.L.R..L.L.R..\") == \"..RRR.LLL.RRLLLL.RRR\"\n assert candidate(dominoes = \"L.R...L...R...L\") == \"L.RR.LL...RR.LL\"\n assert candidate(dominoes = \"R.............L\") == \"RRRRRRR.LLLLLLL\"\n assert candidate(dominoes = \"R........L........R\") == \"RRRRRLLLLL........R\"\n assert candidate(dominoes = \"LLLLRRRRLLLLRRRRLLLLRRRRLLLL\") == \"LLLLRRRRLLLLRRRRLLLLRRRRLLLL\"\n assert candidate(dominoes = \"L...R...L...R.L\") == \"L...RR.LL...R.L\"\n assert candidate(dominoes = \"L.R.L.R.L.R.L.R.L\") == \"L.R.L.R.L.R.L.R.L\"\n assert candidate(dominoes = \"L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L\") == \"LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL\"\n assert candidate(dominoes = \"L...R.L...R.L...R.L.R\") == \"L...R.L...R.L...R.L.R\"\n assert candidate(dominoes = \"L.R...R.L.L...R.R.L.L...R\") == \"L.RRRRR.LLL...RRR.LLL...R\"\n assert candidate(dominoes = \"L...R....L...R\") == \"L...RRRLLL...R\"\n"}, "metadata": {"canonical_parameter_names": ["dominoes"], "leetcode_dataset_entry_point": "Solution().pushDominoes", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var pushDominoes = function(dominoes) {", "container": null, "callable": "pushDominoes", "parameters": [{"name": "dominoes", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 839, "task_id": "similar-string-groups", "difficulty": "Hard", "problem_description": "Two strings, X and Y, are considered similar if either they are identical or we can make them equivalent by swapping at most two letters (in distinct positions) within the string X.\nFor example, \"tars\" and \"rats\" are similar (swapping at positions 0 and 2), and \"rats\" and \"arts\" are similar, but \"star\" is not similar to \"tars\", \"rats\", or \"arts\".\nTogether, these form two connected groups by similarity: {\"tars\", \"rats\", \"arts\"} and {\"star\"}.  Notice that \"tars\" and \"arts\" are in the same group even though they are not similar.  Formally, each group is such that a word is in the group if and only if it is similar to at least one other word in the group.\nWe are given a list strs of strings where every string in strs is an anagram of every other string in strs. How many groups are there?\n \nExample 1:\n\nInput: strs = [\"tars\",\"rats\",\"arts\",\"star\"]\nOutput: 2\n\nExample 2:\n\nInput: strs = [\"omv\",\"ovm\"]\nOutput: 1\n\n \nConstraints:\n\n1 <= strs.length <= 300\n1 <= strs[i].length <= 300\nstrs[i] consists of lowercase letters only.\nAll words in strs have the same length and are anagrams of each other.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(strs = ['abc', 'bca', 'cab', 'cba', 'bac', 'acb']) == 1\n assert candidate(strs = ['ab', 'ba', 'abc', 'cab', 'bca']) == 1\n assert candidate(strs = ['aaaaa', 'aaabb', 'aaabc', 'aaaba', 'aaaaa']) == 1\n assert candidate(strs = ['tars', 'rats', 'arts', 'star']) == 2\n assert candidate(strs = ['abcd', 'abdc', 'acbd', 'acdb', 'adbc', 'adcb', 'bacd', 'badc', 'bcad', 'bcda', 'bdac', 'bdca', 'cabd', 'cadb', 'cbad', 'cbda', 'cdab', 'cdba', 'dabc', 'dacb', 'dbac', 'dbca', 'dcab', 'dcba']) == 1\n assert candidate(strs = ['abc', 'bca', 'cab', 'cba', 'acb', 'bac']) == 1\n assert candidate(strs = ['abcde', 'edcba', 'abced', 'decba', 'decab']) == 2\n assert candidate(strs = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yzw']) == 9\n assert candidate(strs = ['omv', 'ovm']) == 1\n assert candidate(strs = ['kite', 'peek', 'pink', 'pite', 'side', 'like', 'pipe', 'pike', 'lipk', 'kite', 'tape', 'pelt', 'pite', 'pink', 'pite']) == 1\n assert candidate(strs = ['aaa', 'aab', 'aba', 'baa', 'abb', 'bba', 'bab', 'bba', 'bbb', 'bbb']) == 1\n assert candidate(strs = ['aaaaaa', 'aaaabb', 'aaaabc', 'aaaaba', 'aaaaaa']) == 1\n assert candidate(strs = ['abc', 'bca', 'cab', 'acb', 'bac', 'cba']) == 1\n assert candidate(strs = ['abcdef', 'bcdefa', 'cdefab', 'defabc', 'efabcd', 'fabcde']) == 6\n assert candidate(strs = ['abcde', 'edcba', 'abced', 'deabc', 'decab', 'cdeab']) == 5\n assert candidate(strs = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']) == 1\n assert candidate(strs = ['a', 'a', 'a', 'a', 'a']) == 1\n assert candidate(strs = ['abcdefghijklmnopqrstuvwxyz', 'bcadefghijklmnopqrstuvwxyza', 'cdefghijklmnopqrstuvwxyzab']) == 3\n assert candidate(strs = ['aaaa', 'aada', 'aadaa', 'aadda', 'aaddd', 'adaaa', 'adaad', 'adaad', 'addaa', 'adada', 'adada', 'addaa', 'daaaa', 'daada', 'daada', 'dadaa', 'dadad', 'daada', 'dadaa', 'dadad', 'daada', 'ddaaa', 'ddada', 'ddaad', 'ddada', 'dddda']) == 1\n assert candidate(strs = ['zzzzzzzzzz', 'zzzzzzzzzy', 'zzzzzzzzzx', 'zzzzzzzzzw', 'zzzzzzzzzv', 'zzzzzzzzzu', 'zzzzzzzzzt', 'zzzzzzzzzs', 'zzzzzzzzzr', 'zzzzzzzzzq']) == 1\n assert candidate(strs = ['mnopqr', 'nopqmr', 'opqmnr', 'pqomnr', 'qpomnr', 'mnopqr', 'mnopqr', 'mnopqr', 'mnopqr', 'mnopqr', 'mnopqr', 'mnopqr', 'mnopqr', 'mnopqr', 'mnopqr', 'mnopqr', 'mnopqr', 'mnopqr', 'mnopqr', 'mnopqr']) == 3\n assert candidate(strs = ['abcde', 'edcba', 'abced', 'decba', 'decab', 'abcde', 'edcba', 'abced', 'decba', 'decab']) == 2\n assert candidate(strs = ['abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij']) == 1\n assert candidate(strs = ['abcdefgh', 'bcdefgha', 'cdefghab', 'defghabc', 'efghabcd', 'fghabcde', 'ghabcdef', 'habcdefg']) == 8\n assert candidate(strs = ['zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz']) == 1\n assert candidate(strs = ['abcdeabcde', 'edcbaedcba', 'abcedabced', 'decbaedcba', 'decabdecab', 'abcdeabced', 'abcdeabcdx']) == 3\n assert candidate(strs = ['abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik', 'abcdefghik']) == 1\n assert candidate(strs = ['aabbcc', 'ccaabb', 'bbaacc', 'aabbbc', 'bcaabb', 'abcabc', 'babcac', 'cabcab', 'bacbac', 'acbacb', 'acbbac', 'abacbc', 'cababc', 'cbaabc', 'acabbc', 'bcabac', 'abcbac', 'cabbac', 'bcacab', 'acbbca']) == 1\n assert candidate(strs = ['qwertyuiop', 'qeywrtuiop', 'qwrtypuioe', 'qwertyuiop', 'qwertyuipo']) == 3\n assert candidate(strs = ['abcabcabcabc', 'cbacbacbacba', 'bacbacbacbac', 'abcabcabcacb', 'cbacbacbacac', 'bacbacbacabc', 'abcabcabcaba', 'cbacbacbacad', 'bacbacbacaba', 'abcabcabcaca', 'cbacbacbacad', 'bacbacbacaca', 'abcabcabacba', 'cbacbacbacba', 'bacbacbacacb', 'abcabcabcabc', 'cbacbacbacac', 'bacbacbacabc']) == 3\n assert candidate(strs = ['abacabad', 'babadaba', 'bacabada', 'acabadab', 'adabacab', 'cabadaba', 'abadabac', 'badabaca']) == 4\n assert candidate(strs = ['abcdefghij', 'abcdefghji', 'abcdefghif', 'abcdefghig', 'abcdefghih']) == 1\n assert candidate(strs = ['abcdefghij', 'abcdefghik', 'abcdefghil', 'abcdefghim', 'abcdefghin', 'abcdefghio']) == 1\n assert candidate(strs = ['xyzzxy', 'zyxzyx', 'zzzyxy', 'zyzzxz', 'xyzzzx', 'zyxzyy', 'zyzzxy', 'zyzzxy']) == 1\n assert candidate(strs = ['abcdefg', 'gfedcba', 'fedcbag', 'gabcdef', 'bacdefg', 'gfeabcd', 'bcdefga', 'gfabcde', 'gefedcb', 'defgabc', 'gdefcab', 'fgedcba', 'gfabced', 'gfadebc', 'gbafced', 'gfacedb', 'gfebacd', 'gfbaced', 'gfbcdea', 'gfbedac', 'gfeadcb', 'gfecdba', 'gfdbeca', 'gfdecba']) == 13\n assert candidate(strs = ['abcdefghij', 'abcdefghik', 'abcdefghil', 'abcdefghim', 'abcdefghin']) == 1\n assert candidate(strs = ['abcdefgh', 'abcdefgh', 'bcdefgha', 'cdefghab', 'defghabc', 'efghabcd', 'fghabcde', 'ghabcdef', 'habcdefg', 'abcdefgha', 'abcdefghb', 'abcdefghc', 'abcdefghd', 'abcdefghi', 'abcdefghj']) == 8\n assert candidate(strs = ['abcdefgh', 'abcdefgh', 'aefghbcd', 'bcdefgha', 'ghabcdef', 'hgfedcba', 'abcdefgh']) == 5\n assert candidate(strs = ['xyzxyz', 'yzxyxz', 'zxyxyz', 'xyxzyz', 'yxzxzy', 'zxzyxy', 'xzyzxy', 'zyxzyx']) == 6\n assert candidate(strs = ['abcde', 'abced', 'abdec', 'abdec', 'abced', 'abcde', 'abced', 'abdec', 'abced', 'abcde', 'abced', 'abdec', 'abced', 'abcde', 'abced', 'abdec', 'abced', 'abcde']) == 1\n assert candidate(strs = ['abcdefghij', 'jihgfedcba', 'abcdefghij', 'abcdefghik', 'abcdefghil', 'abcdefghij', 'abcdefghim', 'abcdefghij', 'abcdefghin', 'abcdefghio']) == 2\n assert candidate(strs = ['abcdefg', 'bacdefg', 'cbadefg', 'dcabefg', 'edcabfg', 'fedcabc', 'gfedcab', 'hgfedca']) == 6\n assert candidate(strs = ['abcdefghij', 'bacdefghij', 'cabdefghij', 'abcdfehgij', 'abcdefghij', 'abcdefghik', 'abcdefghji']) == 2\n assert candidate(strs = ['abcd', 'dcba', 'cdab', 'bacd', 'cabd', 'acdb', 'adcb', 'bcda', 'cdba', 'bdca', 'dacb', 'cadb', 'bdac', 'abcd', 'dcba', 'cdab', 'bacd', 'cabd', 'acdb', 'adcb', 'bcda', 'cdba', 'bdca', 'dacb', 'cadb', 'bdac']) == 1\n assert candidate(strs = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba', 'abc', 'acb', 'bac', 'bca', 'cab', 'cba', 'abc', 'acb', 'bac', 'bca', 'cab', 'cba', 'abc', 'acb', 'bac', 'bca', 'cab', 'cba', 'abc', 'acb', 'bac', 'bca', 'cab', 'cba', 'abc', 'acb', 'bac', 'bca', 'cab', 'cba']) == 1\n assert candidate(strs = ['aaaaabbbbb', 'aaaabbbbba', 'aaabbbbaaa', 'aabbbbaaaa', 'abbbbaaaaa', 'baaaaabbbb', 'baaaaabbbb', 'bbbbbaaaaa', 'bbbbbaaaab', 'bbbbbaaabb', 'bbbbbaabba', 'bbbbbaabbb', 'bbbbabbbbb', 'bbbbbaabaa', 'bbbbaabbbb', 'bbaaaaabbb', 'bbaaaabbbb', 'bbaaabbbbb', 'bbbaaaaabb', 'bbbaaaabbb', 'bbbaaabbbb', 'bbbbaaaabb', 'bbbbaaabbb', 'bbbbaabbbb', 'bbbbbaaaab', 'bbbbbaaabbb', 'bbbbbaabbb', 'bbbbabbbba', 'bbbbabbaaa', 'bbbbbaabaa', 'bbbbbaaabb', 'bbbbaaaaaa', 'bbbbaaaaba', 'bbbbaaabaa', 'bbbbaaabab', 'bbbbaaabra', 'bbbbbaaaaa', 'bbbbbaaaab', 'bbbbbaaaba', 'bbbbbaabaa', 'bbbbbaaabb']) == 1\n assert candidate(strs = ['abcd', 'acbd', 'adbc', 'cabd', 'dbca', 'dcba', 'dcab']) == 1\n assert candidate(strs = ['abababab', 'babababa', 'aabbaabb', 'bbaabbaa', 'abbaabba', 'baabbaab', 'abbaabba', 'baabbaab', 'bbaabbaa', 'aabbaabb', 'babababa', 'abababab']) == 6\n assert candidate(strs = ['lkjhgfedcba', 'lkjhgfedcba', 'lkjhgfedcba', 'lkjhgfedcba', 'lkjhgfedcba']) == 1\n assert candidate(strs = ['abcde', 'edcba', 'dbeca', 'decba', 'decab', 'cedab', 'aebcd', 'bcdea', 'debac', 'baced', 'acebd', 'bdeca', 'acdeb', 'bacde', 'abced', 'decba', 'edabc', 'abcde', 'acbde', 'baced', 'bcaed']) == 5\n assert candidate(strs = ['qwertyuiop', 'wertyuiopq', 'ertyuiopqw', 'rtyuiopqwe', 'tyuiopqrst', 'yuiopqrstu', 'uiopqrstuv', 'iopqrstuvw', 'opqrstuvwx', 'pqrstuvwxy', 'qrstuvwxyz', 'rstuvwxyzp', 'stuvwxyzpr', 'tuvwxyzprs', 'uvwxyzprst', 'vwxyzprstq', 'wxyzprstqu', 'xyzprstquv', 'yzprstquvx', 'zprstquvxy', 'prstquvxyz', 'rstquvxyza', 'stquvxyzab', 'tquvxyzabc', 'quvxyzabcd', 'uvxyzabcde', 'vxyzabcdef', 'xyzabcdefg', 'yzabcdefgq', 'zabcdefgqr', 'abcdefgqrs', 'bcdefgqrst', 'cdefgqrstu', 'defgqrstuv', 'efgqrstuvw', 'fgqrstuvwxyz', 'gqrstuvwxyzx', 'hqrstuvwxyzx', 'qrstuvwxyzxy', 'rstuvwxyzxyq', 'stuvwxyzxyqp', 'tuvwxyzxyqpr', 'uvwxyzxyqprs', 'vwxyzxyqprst', 'wxyzxyqprstu', 'xyzxyqprstuv', 'yzxyqprstuvw', 'zxyqprstuvwx', 'xyqprstuvwxy', 'yqprstuvwxyz', 'qprstuvwxyzx', 'prstuvwxyzxy', 'rstuvwxyzxyz', 'stuvwxyzxyza', 'tuvwxyzxyqza']) == 44\n assert candidate(strs = ['abcdefg', 'gfedcba', 'bacdefg', 'abcdefg', 'gfedcbx', 'abcdefg', 'gfedcbw']) == 2\n assert candidate(strs = ['aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa', 'aabbccddeeff', 'ffeeddccbaaa']) == 2\n assert candidate(strs = ['ababab', 'bababa', 'bbaaab', 'aababb', 'ababba', 'abbaab', 'aabbab', 'ababab', 'aabbaa']) == 1\n assert candidate(strs = ['aaaaaaaa', 'aaaaabaa', 'aaaabaab', 'aaabaaba', 'aabaaaba', 'abaabaaa', 'baaaaaab', 'baaabaaa', 'baabaaab', 'babaaaaa', 'abaaaaab', 'abaaabaa', 'abaabaab', 'baabaaba', 'aabaaaba', 'aaabaaba', 'baaabaaa', 'baaaaaab', 'abaaaaab', 'baaaabaa', 'aabaaaba', 'abaabaab', 'baabaaba', 'aabaaaba', 'baaaabaa', 'baaaaaab', 'abaaaaab', 'abaabaab', 'baabaaba', 'aabaaaba', 'baaaabaa', 'baaaaaab', 'abaaaaab', 'abaabaab', 'baabaaba', 'aabaaaba', 'baaaabaa', 'baaaaaab', 'abaaaaab']) == 1\n assert candidate(strs = ['abcdefghij', 'jihgfedcba', 'abcdefghij', 'ijhgfedcba', 'abcdefghij', 'jihgfedcba', 'abcdefghij', 'ijhgfedcba']) == 2\n assert candidate(strs = ['abacax', 'aacxab', 'abacax', 'bacaxa', 'cacxab', 'abcaxa']) == 3\n"}, "metadata": {"canonical_parameter_names": ["strs"], "leetcode_dataset_entry_point": "Solution().numSimilarGroups", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numSimilarGroups = function(strs) {", "container": null, "callable": "numSimilarGroups", "parameters": [{"name": "strs", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 840, "task_id": "magic-squares-in-grid", "difficulty": "Medium", "problem_description": "A 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 to 9 such that each row, column, and both diagonals all have the same sum.\nGiven a row x col grid of integers, how many 3 x 3 magic square subgrids are there?\nNote: while a magic square can only contain numbers from 1 to 9, grid may contain numbers up to 15.\n \nExample 1:\n\n\nInput: grid = [[4,3,8,4],[9,5,1,9],[2,7,6,2]]\nOutput: 1\nExplanation: \nThe following subgrid is a 3 x 3 magic square:\n\nwhile this one is not:\n\nIn total, there is only one magic square inside the given grid.\n\nExample 2:\n\nInput: grid = [[8]]\nOutput: 0\n\n \nConstraints:\n\nrow == grid.length\ncol == grid[i].length\n1 <= row, col <= 10\n0 <= grid[i][j] <= 15\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]) == 0\n assert candidate(grid = [[4, 3, 8, 4, 0], [9, 5, 1, 9, 3], [2, 7, 6, 2, 4], [1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) == 1\n assert candidate(grid = [[7, 0, 5], [3, 5, 1], [6, 4, 3]]) == 0\n assert candidate(grid = [[8]]) == 0\n assert candidate(grid = [[5, 5, 5], [5, 5, 5], [5, 5, 5]]) == 0\n assert candidate(grid = [[4, 3, 8, 4], [9, 5, 1, 9], [2, 7, 6, 2]]) == 1\n assert candidate(grid = [[10, 11, 12], [13, 14, 15], [16, 17, 18]]) == 0\n assert candidate(grid = [[4, 3, 8, 4, 9], [9, 5, 1, 9, 2], [2, 7, 6, 2, 9], [9, 4, 3, 8, 4]]) == 1\n assert candidate(grid = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) == 0\n assert candidate(grid = [[1, 8, 6], [10, 5, 0], [4, 2, 3]]) == 0\n assert candidate(grid = [[9, 2, 7], [6, 5, 4], [3, 8, 1]]) == 0\n assert candidate(grid = [[8, 1, 6, 3, 5, 7, 4, 9, 2], [4, 9, 2, 3, 5, 7, 8, 1, 6], [3, 5, 7, 8, 1, 6, 4, 9, 2]]) == 0\n assert candidate(grid = [[9, 2, 3], [4, 5, 6], [7, 8, 1]]) == 0\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == 0\n assert candidate(grid = [[4, 3, 8, 4, 5], [9, 5, 1, 9, 3], [2, 7, 6, 2, 7], [1, 2, 3, 4, 5], [9, 8, 7, 6, 5]]) == 1\n assert candidate(grid = [[8, 1, 6, 3, 5, 7, 4, 9, 2], [4, 9, 2, 3, 5, 7, 8, 1, 6], [3, 5, 7, 4, 9, 2, 6, 1, 8]]) == 0\n assert candidate(grid = [[4, 3, 8, 4, 1], [9, 5, 1, 9, 7], [2, 7, 6, 2, 6], [9, 5, 1, 9, 7], [2, 7, 6, 2, 6]]) == 1\n assert candidate(grid = [[4, 3, 8, 1, 6], [9, 5, 1, 8, 3], [2, 7, 6, 4, 9], [4, 3, 8, 1, 6], [9, 5, 1, 8, 3]]) == 1\n assert candidate(grid = [[4, 3, 8, 4, 9, 2, 3, 5, 7], [8, 1, 6, 3, 5, 7, 4, 9, 2], [6, 7, 2, 4, 9, 2, 7, 9, 2], [8, 1, 6, 9, 5, 1, 2, 7, 6], [2, 9, 4, 8, 1, 6, 4, 9, 2], [9, 5, 1, 3, 5, 7, 9, 4, 2]]) == 0\n assert candidate(grid = [[15, 10, 5, 1, 6], [4, 3, 8, 9, 2], [7, 12, 13, 14, 15], [8, 11, 10, 9, 7], [5, 4, 3, 2, 1]]) == 0\n assert candidate(grid = [[4, 3, 8, 4, 9, 1, 5], [9, 5, 1, 9, 2, 6, 7], [2, 7, 6, 2, 9, 4, 3], [9, 5, 1, 9, 2, 6, 7], [2, 7, 6, 2, 9, 4, 3], [9, 5, 1, 9, 2, 6, 7], [2, 7, 6, 2, 9, 4, 3]]) == 1\n assert candidate(grid = [[8, 1, 6, 7, 2, 9, 4, 3, 8], [1, 6, 7, 2, 9, 4, 3, 8, 1], [6, 7, 2, 9, 4, 3, 8, 1, 6], [7, 2, 9, 4, 3, 8, 1, 6, 7], [2, 9, 4, 3, 8, 1, 6, 7, 2], [9, 4, 3, 8, 1, 6, 7, 2, 9], [4, 3, 8, 1, 6, 7, 2, 9, 4], [3, 8, 1, 6, 7, 2, 9, 4, 3], [8, 1, 6, 7, 2, 9, 4, 3, 8]]) == 0\n assert candidate(grid = [[5, 3, 4, 9, 1], [6, 7, 2, 8, 10], [1, 9, 8, 3, 5], [4, 2, 6, 7, 3], [9, 8, 1, 4, 6]]) == 0\n assert candidate(grid = [[5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5]]) == 0\n assert candidate(grid = [[5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5]]) == 0\n assert candidate(grid = [[2, 7, 6, 9, 5], [9, 5, 1, 4, 3], [4, 3, 8, 1, 4], [1, 4, 7, 8, 5], [8, 5, 2, 9, 6]]) == 1\n assert candidate(grid = [[4, 1, 9, 5, 10], [7, 5, 3, 6, 2], [6, 7, 2, 1, 8], [1, 6, 3, 7, 9], [5, 4, 8, 2, 1]]) == 0\n assert candidate(grid = [[5, 7, 3, 10, 1], [6, 1, 8, 2, 9], [7, 3, 5, 6, 4], [4, 9, 2, 8, 7], [9, 2, 4, 7, 6]]) == 0\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [4, 3, 8, 1, 6, 7, 2, 9, 4], [7, 6, 1, 8, 5, 2, 9, 4, 3], [2, 9, 4, 3, 8, 1, 6, 7, 2], [8, 1, 6, 7, 2, 9, 4, 3, 8], [3, 8, 1, 6, 7, 2, 9, 4, 3], [6, 7, 2, 9, 4, 3, 8, 1, 6], [9, 4, 3, 8, 1, 6, 7, 2, 9], [4, 3, 8, 1, 6, 7, 2, 9, 4]]) == 0\n assert candidate(grid = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) == 0\n assert candidate(grid = [[1, 6, 7, 2, 8], [9, 5, 3, 4, 1], [8, 3, 4, 5, 9], [3, 4, 5, 6, 7], [6, 7, 8, 9, 1]]) == 0\n assert candidate(grid = [[4, 3, 8, 4, 1, 6], [9, 5, 1, 9, 7, 1], [2, 7, 6, 2, 6, 4], [9, 5, 1, 9, 7, 2], [2, 7, 6, 2, 6, 3], [9, 4, 3, 8, 4, 2]]) == 1\n assert candidate(grid = [[8, 1, 6, 7, 2], [3, 5, 7, 8, 4], [4, 9, 2, 1, 6], [9, 5, 1, 8, 3], [2, 7, 6, 4, 9]]) == 1\n assert candidate(grid = [[15, 5, 9, 12, 6, 3], [6, 9, 5, 8, 12, 6], [3, 9, 5, 15, 10, 5], [12, 6, 3, 15, 5, 12], [6, 5, 12, 5, 10, 15], [15, 10, 5, 6, 9, 3]]) == 0\n assert candidate(grid = [[4, 3, 8, 1, 6, 7], [9, 5, 1, 8, 3, 4], [2, 7, 6, 4, 9, 2], [4, 3, 8, 1, 6, 7], [9, 5, 1, 8, 3, 4], [2, 7, 6, 4, 9, 2]]) == 2\n assert candidate(grid = [[10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [13, 14, 15, 16, 17, 18, 19, 10, 11, 12], [16, 17, 18, 19, 10, 11, 12, 13, 14, 15], [19, 10, 11, 12, 13, 14, 15, 16, 17, 18], [12, 13, 14, 15, 16, 17, 18, 19, 10, 11], [15, 16, 17, 18, 19, 10, 11, 12, 13, 14], [18, 19, 10, 11, 12, 13, 14, 15, 16, 17], [11, 12, 13, 14, 15, 16, 17, 18, 19, 10], [14, 15, 16, 17, 18, 19, 10, 11, 12, 13]]) == 0\n assert candidate(grid = [[4, 9, 2, 3, 5, 7, 8, 1, 6], [3, 5, 7, 8, 1, 6, 4, 9, 2], [8, 1, 6, 7, 9, 2, 3, 5, 7], [4, 9, 2, 7, 9, 2, 3, 5, 7], [3, 5, 7, 6, 1, 8, 9, 4, 2]]) == 1\n assert candidate(grid = [[4, 9, 2, 3, 5, 7], [3, 5, 7, 8, 1, 6], [8, 1, 6, 3, 5, 7], [3, 5, 7, 4, 9, 2], [4, 9, 2, 7, 5, 3], [9, 2, 4, 6, 1, 8]]) == 3\n assert candidate(grid = [[2, 7, 6, 9, 5, 1], [9, 4, 3, 8, 1, 6], [4, 3, 8, 1, 6, 7], [3, 8, 1, 6, 7, 2], [8, 1, 6, 7, 2, 9], [1, 6, 7, 2, 9, 4]]) == 0\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [4, 9, 2, 3, 5, 7, 8, 1, 6], [7, 6, 1, 8, 1, 4, 9, 2, 3], [2, 7, 6, 1, 9, 8, 4, 3, 5], [9, 5, 1, 4, 3, 8, 2, 7, 6]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[4, 9, 2, 3, 5, 7], [3, 5, 7, 8, 1, 6], [8, 1, 6, 4, 9, 2], [4, 9, 2, 3, 5, 7], [3, 5, 7, 8, 1, 6]]) == 2\n assert candidate(grid = [[9, 3, 8, 4, 9], [5, 1, 9, 2, 6], [2, 7, 6, 9, 3], [9, 5, 1, 9, 7], [2, 7, 6, 9, 3]]) == 0\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [4, 3, 8, 9, 5, 1, 4, 3, 8, 9], [5, 8, 3, 9, 5, 1, 9, 5, 1, 9], [6, 1, 8, 4, 3, 8, 2, 7, 6, 4], [7, 6, 1, 2, 7, 6, 9, 5, 1, 3]]) == 1\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 2, 4, 6, 8], [8, 6, 4, 2, 9, 7, 5, 3, 1], [2, 4, 6, 8, 1, 3, 5, 7, 9], [9, 7, 5, 3, 1, 8, 6, 4, 2], [3, 5, 7, 9, 2, 4, 6, 8, 1], [4, 6, 8, 1, 3, 5, 7, 9, 2], [5, 7, 9, 2, 4, 6, 8, 1, 3]]) == 0\n assert candidate(grid = [[8, 1, 6, 3, 5, 7, 4, 9, 2], [3, 5, 7, 8, 1, 6, 4, 9, 2], [4, 9, 2, 7, 6, 1, 8, 3, 5], [9, 2, 7, 6, 1, 8, 3, 5, 4], [2, 7, 6, 1, 8, 3, 5, 4, 9], [7, 6, 1, 8, 3, 5, 4, 9, 2], [6, 1, 8, 3, 5, 4, 9, 2, 7], [1, 8, 3, 5, 4, 9, 2, 7, 6], [8, 3, 5, 4, 9, 2, 7, 6, 1]]) == 1\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [14, 15, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8], [8, 7, 6, 5, 4, 3, 2, 1, 15, 14, 13, 12, 11, 10, 9], [7, 6, 5, 4, 3, 2, 1, 9, 8, 15, 14, 13, 12, 11, 10], [6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 15, 14, 13, 12, 11], [5, 4, 3, 2, 1, 11, 10, 9, 8, 7, 6, 15, 14, 13, 12], [4, 3, 2, 1, 12, 11, 10, 9, 8, 7, 6, 5, 15, 14, 13], [3, 2, 1, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 15, 14], [2, 1, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 15], [1, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]]) == 0\n assert candidate(grid = [[15, 10, 4, 5, 9, 3], [13, 14, 8, 7, 2, 12], [6, 7, 11, 1, 15, 1], [14, 5, 1, 10, 3, 9], [8, 2, 13, 4, 6, 11]]) == 0\n assert candidate(grid = [[4, 3, 8, 1, 6, 7, 2, 9, 5], [1, 8, 3, 6, 7, 2, 9, 5, 1], [6, 7, 2, 3, 8, 4, 1, 6, 7], [7, 2, 9, 8, 3, 4, 6, 1, 8], [2, 9, 5, 1, 6, 7, 8, 3, 4], [9, 5, 1, 7, 2, 9, 3, 8, 4], [4, 3, 8, 9, 5, 1, 2, 9, 5], [3, 8, 4, 5, 8, 3, 6, 7, 2], [8, 3, 4, 9, 1, 6, 7, 2, 9]]) == 0\n assert candidate(grid = [[5, 3, 4, 9, 7, 12], [1, 6, 2, 5, 9, 14], [7, 8, 9, 3, 11, 4], [10, 6, 1, 8, 2, 7], [3, 5, 2, 4, 10, 9], [11, 4, 13, 6, 7, 8]]) == 0\n assert candidate(grid = [[4, 3, 8, 4, 9, 3, 8, 4, 9], [9, 5, 1, 9, 2, 7, 6, 2, 9], [2, 7, 6, 2, 9, 5, 1, 9, 2], [9, 5, 1, 9, 2, 7, 6, 2, 9], [2, 7, 6, 2, 9, 5, 1, 9, 2], [9, 5, 1, 9, 2, 7, 6, 2, 9], [4, 3, 8, 4, 9, 3, 8, 4, 9], [9, 5, 1, 9, 2, 7, 6, 2, 9], [2, 7, 6, 2, 9, 5, 1, 9, 2]]) == 3\n assert candidate(grid = [[8, 3, 4, 1, 6, 7, 2, 9], [1, 6, 7, 2, 9, 4, 3, 8], [6, 7, 2, 9, 4, 3, 8, 1], [7, 2, 9, 4, 3, 8, 1, 6], [2, 9, 4, 3, 8, 1, 6, 7], [9, 4, 3, 8, 1, 6, 7, 2], [4, 3, 8, 1, 6, 7, 2, 9], [3, 8, 1, 6, 7, 2, 9, 4]]) == 0\n assert candidate(grid = [[8, 1, 6, 3, 5, 7], [3, 5, 7, 8, 1, 6], [4, 9, 2, 4, 9, 2], [3, 5, 7, 3, 5, 7], [8, 1, 6, 8, 1, 6]]) == 3\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 1], [1, 3, 5, 7, 9, 2, 4, 6, 8, 1], [2, 9, 4, 7, 6, 1, 8, 5, 3, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[4, 3, 8, 4, 9, 2, 1, 6, 7], [9, 5, 1, 9, 2, 1, 6, 7, 4], [2, 7, 6, 2, 9, 8, 4, 1, 3], [9, 8, 1, 4, 3, 2, 7, 6, 5], [3, 2, 9, 8, 7, 6, 5, 4, 1], [8, 7, 6, 5, 4, 3, 2, 1, 9], [1, 6, 7, 4, 5, 6, 7, 8, 9], [6, 7, 4, 5, 6, 7, 8, 9, 1], [7, 4, 5, 6, 7, 8, 9, 1, 6]]) == 1\n assert candidate(grid = [[9, 8, 7, 6, 5, 4, 3], [2, 3, 4, 5, 6, 7, 8], [1, 2, 3, 4, 5, 6, 7], [8, 7, 6, 5, 4, 3, 2], [7, 6, 5, 4, 3, 2, 1], [6, 5, 4, 3, 2, 1, 9], [5, 4, 3, 2, 1, 9, 8]]) == 0\n assert candidate(grid = [[5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5]]) == 0\n assert candidate(grid = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30]]) == 0\n assert candidate(grid = [[9, 3, 2, 8, 4], [6, 5, 4, 1, 7], [7, 8, 9, 6, 3], [4, 1, 2, 5, 8], [1, 6, 7, 3, 9]]) == 0\n assert candidate(grid = [[4, 3, 8, 1, 6, 7, 2, 9, 4, 9, 5, 1, 2, 7, 6], [8, 1, 6, 3, 5, 7, 4, 9, 2, 3, 5, 7, 8, 1, 6], [6, 7, 2, 4, 9, 2, 7, 9, 2, 6, 7, 2, 9, 5, 1], [8, 1, 6, 9, 5, 1, 2, 7, 6, 9, 5, 1, 2, 7, 6], [2, 9, 4, 8, 1, 6, 4, 9, 2, 8, 1, 6, 3, 5, 7], [9, 5, 1, 3, 5, 7, 9, 4, 2, 3, 5, 7, 6, 1, 8]]) == 0\n assert candidate(grid = [[1, 2, 3, 1, 2, 3, 1, 2, 3], [4, 5, 6, 4, 5, 6, 4, 5, 6], [7, 8, 9, 7, 8, 9, 7, 8, 9], [1, 2, 3, 1, 2, 3, 1, 2, 3], [4, 5, 6, 4, 5, 6, 4, 5, 6], [7, 8, 9, 7, 8, 9, 7, 8, 9], [1, 2, 3, 1, 2, 3, 1, 2, 3], [4, 5, 6, 4, 5, 6, 4, 5, 6], [7, 8, 9, 7, 8, 9, 7, 8, 9]]) == 0\n assert candidate(grid = [[4, 3, 8, 4, 10], [9, 5, 1, 9, 11], [2, 7, 6, 2, 12], [9, 5, 1, 9, 13], [2, 7, 6, 2, 14]]) == 1\n assert candidate(grid = [[8, 1, 6, 3, 5, 7, 4, 9, 2, 7], [3, 5, 7, 8, 1, 6, 2, 7, 6, 5], [6, 7, 2, 9, 5, 1, 3, 5, 7, 4], [8, 1, 6, 7, 9, 2, 6, 7, 2, 3], [4, 9, 2, 6, 1, 8, 9, 4, 2, 8], [9, 5, 1, 9, 7, 6, 2, 7, 6, 1]]) == 0\n assert candidate(grid = [[8, 1, 6, 3, 5], [7, 9, 2, 4, 6], [6, 7, 2, 1, 3], [8, 1, 6, 3, 5], [7, 9, 2, 4, 6]]) == 0\n assert candidate(grid = [[5, 3, 4, 9, 10], [6, 7, 2, 8, 11], [1, 9, 8, 7, 6], [3, 4, 5, 6, 7], [8, 9, 1, 2, 3]]) == 0\n assert candidate(grid = [[4, 3, 8, 1, 6, 7, 2, 9, 4], [9, 5, 1, 9, 7, 6, 2, 7, 6], [2, 7, 6, 4, 3, 8, 2, 9, 4], [4, 3, 8, 1, 6, 7, 2, 9, 4], [9, 5, 1, 9, 7, 6, 2, 7, 6]]) == 1\n assert candidate(grid = [[4, 3, 8, 4, 1], [9, 5, 1, 9, 7], [2, 7, 6, 2, 6], [9, 5, 1, 9, 7], [2, 7, 6, 2, 6], [4, 3, 8, 4, 1], [9, 5, 1, 9, 7]]) == 1\n assert candidate(grid = [[4, 3, 8, 4, 1, 9, 7], [9, 5, 1, 9, 2, 6, 8], [2, 7, 6, 2, 7, 4, 2], [9, 5, 1, 9, 2, 6, 8], [2, 7, 6, 2, 7, 4, 2]]) == 1\n assert candidate(grid = [[8, 3, 4, 1, 6, 7, 2, 9, 5], [3, 8, 4, 6, 1, 9, 7, 2, 9], [4, 3, 8, 7, 2, 9, 1, 6, 7], [9, 5, 1, 2, 9, 5, 1, 9, 5], [2, 7, 6, 4, 3, 8, 6, 1, 8], [6, 1, 8, 9, 5, 1, 8, 3, 4], [7, 2, 9, 5, 8, 3, 9, 5, 1], [8, 9, 5, 1, 6, 7, 4, 3, 8], [9, 5, 1, 3, 6, 9, 2, 7, 6]]) == 1\n assert candidate(grid = [[5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5]]) == 0\n assert candidate(grid = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [4, 3, 8, 1, 6], [9, 5, 1, 9, 2]]) == 0\n assert candidate(grid = [[1, 6, 7, 8, 9], [6, 7, 2, 1, 5], [8, 1, 6, 7, 2], [3, 5, 7, 8, 4], [4, 9, 2, 3, 5]]) == 1\n assert candidate(grid = [[2, 7, 6, 9, 5, 1], [9, 5, 1, 9, 5, 1], [4, 3, 8, 4, 3, 8], [3, 6, 9, 2, 7, 6], [4, 3, 8, 9, 5, 1], [2, 7, 6, 4, 3, 8]]) == 2\n assert candidate(grid = [[9, 7, 6, 8, 1, 4, 3, 5, 2], [2, 3, 4, 5, 6, 7, 8, 9, 1], [5, 1, 9, 7, 6, 8, 4, 3, 2], [6, 8, 7, 9, 1, 5, 2, 4, 3], [1, 4, 3, 6, 7, 2, 9, 5, 8], [7, 9, 8, 2, 4, 3, 5, 1, 6], [3, 2, 1, 4, 9, 8, 6, 7, 5], [8, 5, 2, 1, 3, 4, 7, 6, 9], [4, 6, 9, 3, 8, 7, 1, 2, 5]]) == 0\n assert candidate(grid = [[8, 1, 6, 3, 5, 7, 4, 9, 2, 7, 8, 1], [3, 5, 7, 8, 1, 6, 2, 7, 6, 5, 9, 4], [6, 7, 2, 9, 5, 1, 3, 5, 7, 4, 6, 8], [8, 1, 6, 7, 9, 2, 6, 7, 2, 3, 5, 9], [4, 9, 2, 6, 1, 8, 9, 4, 2, 8, 7, 1], [9, 5, 1, 9, 7, 6, 2, 7, 6, 1, 3, 4]]) == 0\n assert candidate(grid = [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 4, 3, 8, 1, 6, 7, 5], [5, 5, 5, 1, 8, 3, 6, 7, 2, 5], [5, 5, 5, 6, 7, 2, 9, 5, 1, 5], [5, 5, 5, 8, 1, 6, 7, 2, 9, 5], [5, 5, 5, 7, 6, 1, 2, 9, 5, 5], [5, 5, 5, 2, 9, 5, 1, 6, 7, 5], [5, 5, 5, 9, 5, 1, 8, 3, 4, 5]]) == 0\n assert candidate(grid = [[8, 1, 6, 7, 5], [3, 5, 7, 3, 9], [4, 9, 2, 8, 4], [5, 1, 9, 2, 6], [7, 5, 3, 4, 8]]) == 1\n assert candidate(grid = [[4, 3, 8, 4, 9], [9, 5, 1, 9, 2], [2, 7, 6, 2, 9], [9, 4, 3, 8, 4], [9, 5, 1, 9, 2], [2, 7, 6, 2, 9]]) == 1\n assert candidate(grid = [[4, 9, 2, 3, 5], [3, 5, 7, 4, 6], [8, 1, 6, 9, 2], [7, 5, 3, 8, 4], [9, 2, 4, 7, 5]]) == 1\n assert candidate(grid = [[5, 3, 1, 6, 9, 7, 2, 4, 8, 10, 11, 12, 13], [3, 5, 7, 1, 9, 2, 6, 8, 4, 14, 15, 16, 17], [1, 7, 5, 9, 2, 6, 8, 4, 3, 18, 19, 20, 21], [9, 2, 6, 8, 4, 7, 3, 5, 1, 22, 23, 24, 25], [2, 6, 8, 4, 7, 3, 5, 1, 9, 26, 27, 28, 29], [8, 4, 7, 3, 5, 1, 9, 2, 6, 30, 31, 32, 33], [4, 7, 3, 5, 1, 9, 2, 6, 8, 34, 35, 36, 37], [7, 3, 5, 1, 9, 2, 6, 8, 4, 38, 39, 40, 41], [3, 5, 7, 1, 9, 2, 6, 8, 4, 42, 43, 44, 45], [1, 9, 2, 6, 8, 4, 7, 3, 5, 46, 47, 48, 49]]) == 0\n assert candidate(grid = [[3, 8, 4, 9, 5], [4, 9, 2, 8, 6], [8, 4, 9, 2, 7], [5, 1, 6, 3, 4], [1, 6, 7, 5, 3]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [2, 7, 6, 9, 5, 1, 4, 3, 8], [4, 3, 8, 9, 5, 1, 2, 7, 6], [9, 5, 1, 4, 3, 8, 7, 6, 2], [2, 7, 6, 3, 5, 7, 8, 1, 6], [9, 5, 1, 8, 1, 6, 9, 5, 1], [2, 7, 6, 7, 5, 3, 2, 7, 6]]) == 1\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().numMagicSquaresInside", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numMagicSquaresInside = function(grid) {", "container": null, "callable": "numMagicSquaresInside", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 841, "task_id": "keys-and-rooms", "difficulty": "Medium", "problem_description": "There are n rooms labeled from 0 to n - 1 and all the rooms are locked except for room 0. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key.\nWhen you visit a room, you may find a set of distinct keys in it. Each key has a number on it, denoting which room it unlocks, and you can take all of them with you to unlock the other rooms.\nGiven an array rooms where rooms[i] is the set of keys that you can obtain if you visited room i, return true if you can visit all the rooms, or false otherwise.\n \nExample 1:\n\nInput: rooms = [[1],[2],[3],[]]\nOutput: true\nExplanation: \nWe visit room 0 and pick up key 1.\nWe then visit room 1 and pick up key 2.\nWe then visit room 2 and pick up key 3.\nWe then visit room 3.\nSince we were able to visit every room, we return true.\n\nExample 2:\n\nInput: rooms = [[1,3],[3,0,1],[2],[0]]\nOutput: false\nExplanation: We can not enter room number 2 since the only key that unlocks it is in that room.\n\n \nConstraints:\n\nn == rooms.length\n2 <= n <= 1000\n0 <= rooms[i].length <= 1000\n1 <= sum(rooms[i].length) <= 3000\n0 <= rooms[i][j] < n\nAll the values of rooms[i] are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(rooms = [[1], [2], [], [3]]) == False\n assert candidate(rooms = [[1], [1, 2], [2], []]) == False\n assert candidate(rooms = [[1], [2, 3], [], [1]]) == True\n assert candidate(rooms = [[], [], [], []]) == False\n assert candidate(rooms = [[1], [2, 3], [3], []]) == True\n assert candidate(rooms = [[2, 3], [0, 1], [3], [0]]) == False\n assert candidate(rooms = [[1, 2, 3], [], [], []]) == True\n assert candidate(rooms = [[1], [2], [3], []]) == True\n assert candidate(rooms = [[1, 2], [3], [], []]) == True\n assert candidate(rooms = [[2, 3], [], [2], [1, 3, 1]]) == True\n assert candidate(rooms = [[2], [3], [0, 1], []]) == True\n assert candidate(rooms = [[1], [0, 3], [1], [3]]) == False\n assert candidate(rooms = [[2, 3], [3, 0, 1], [2], [0]]) == False\n assert candidate(rooms = [[1], [0], [], []]) == False\n assert candidate(rooms = [[1, 3], [3, 0, 1], [2], [0]]) == False\n assert candidate(rooms = [[1, 2, 3], [], [], [], []]) == False\n assert candidate(rooms = [[1, 3], [2, 4], [3], [4], []]) == True\n assert candidate(rooms = [[1, 3], [2], [1, 3, 4], [4, 5], [5], []]) == True\n assert candidate(rooms = [[1, 2], [3], [4], [0], [1, 2, 3, 4]]) == True\n assert candidate(rooms = [[1, 3], [3, 0, 1], [2], [0, 2, 1, 3]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5, 6], [0, 2, 3, 4, 5, 6], [0, 1, 3, 4, 5, 6], [0, 1, 2, 4, 5, 6], [0, 1, 2, 3, 5, 6], [0, 1, 2, 3, 4, 6], [0, 1, 2, 3, 4, 5]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], []]) == False\n assert candidate(rooms = [[1, 2], [2], [0, 3], [1]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5], [2, 3, 4], [0, 3, 4], [1, 2, 4], [1, 2, 3], [0, 1]]) == True\n assert candidate(rooms = [[2], [3], [1], [5], [6, 7, 8], [6, 7, 8], [7, 8], [8], []]) == False\n assert candidate(rooms = [[1, 2, 3, 4], [3, 2, 1, 4], [4, 2, 0, 1], [3, 1, 2, 4], [0, 1, 2, 3]]) == True\n assert candidate(rooms = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [0]]) == True\n assert candidate(rooms = [[1, 2, 3, 4], [0, 2, 3, 4], [0, 1, 3, 4], [0, 1, 2, 4], [0, 1, 2, 3], []]) == False\n assert candidate(rooms = [[1], [0, 2, 3, 4], [1, 3, 4], [2, 4], [2, 3], []]) == False\n assert candidate(rooms = [[1], [0, 2, 3, 4], [0, 3, 4], [0, 2, 4], [0, 2, 3]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 3, 4, 5, 6, 7, 8, 9, 10], [3, 4, 5, 6, 7, 8, 9, 10], [4, 5, 6, 7, 8, 9, 10], [5, 6, 7, 8, 9, 10], [6, 7, 8, 9, 10], [7, 8, 9, 10], [8, 9, 10], [9, 10], [10], []]) == True\n assert candidate(rooms = [[1, 4], [0, 3, 4], [3, 4], [0, 1, 2], [0, 1, 2]]) == True\n assert candidate(rooms = [[1, 3], [2], [0], [1, 2, 4], [3]]) == True\n assert candidate(rooms = [[1], [0, 2, 3, 4], [1, 3], [1, 2, 4], [1, 2, 3]]) == True\n assert candidate(rooms = [[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5], [2, 3, 4, 5], [3, 4, 5], [4, 5], [5], []]) == True\n assert candidate(rooms = [[1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8]]) == True\n assert candidate(rooms = [[1, 2, 3, 4], [2, 3, 4], [3, 4], [4], []]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5], [2, 3, 4, 5], [3, 4, 5], [4, 5], [5], []]) == True\n assert candidate(rooms = [[1], [3], [2], [1], [4], [5]]) == False\n assert candidate(rooms = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [0]]) == True\n assert candidate(rooms = [[1, 2, 3], [1, 3, 4], [2, 4, 5], [3, 5, 6], [4, 6, 7], [5, 7, 8], [6, 8, 9], [7, 9, 10], [8, 10, 11], [9, 11, 12], [10, 12, 13], [11, 13, 14], [12, 14], [13, 14, 15], [14, 15], [15]]) == True\n assert candidate(rooms = [[1], [2, 3, 4, 5], [0], [2, 5], [3], [2, 3]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5], [0, 3, 4, 5], [0, 1, 4, 5], [0, 1, 2, 5], [0, 1, 2, 3], [0, 1, 2, 3, 4]]) == True\n assert candidate(rooms = [[1, 2, 3], [2, 4, 5], [1, 4, 5, 6], [2, 3, 5, 6, 7], [2, 3, 4, 6, 7], [3, 4, 5, 7, 8], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9], [6, 7, 8, 9], [7, 8, 9], []]) == False\n assert candidate(rooms = [[1, 3, 5], [2, 4], [3, 5], [4, 5], [1, 5], [0]]) == True\n assert candidate(rooms = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], []]) == True\n assert candidate(rooms = [[1], [0, 2, 3, 4, 5], [1], [0, 2, 3, 4, 5], [0, 2, 3, 4, 5], [0, 2, 3, 4, 5]]) == True\n assert candidate(rooms = [[1], [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], []]) == False\n assert candidate(rooms = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], []]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5], [1, 3, 4, 5, 6], [2, 4, 5, 6, 7], [3, 5, 6, 7, 8], [4, 6, 7, 8, 9], [5, 7, 8, 9, 10], [6, 8, 9, 10, 11], [7, 9, 10, 11, 12], [8, 10, 11, 12, 13], [9, 11, 12, 13, 14], [10, 12, 13, 14], [11, 13, 14], [12, 14], [13, 14], [14]]) == True\n assert candidate(rooms = [[1, 2, 3], [3, 0, 1], [2], [0]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5], [0, 2, 3, 4, 5], [0, 1, 3, 4, 5], [0, 1, 2, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 3, 4]]) == True\n assert candidate(rooms = [[1, 2, 3], [2, 4], [3, 5], [4], [5], [0]]) == True\n assert candidate(rooms = [[1], [2, 3, 4, 5, 6, 7, 8, 9, 10], [3], [4, 5, 6, 7, 8, 9, 10], [5, 6, 7, 8, 9, 10], [6, 7, 8, 9, 10], [7, 8, 9, 10], [8, 9, 10], [9, 10], [10], []]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5], [2, 3, 4], [3, 4, 5], [4, 5], [5], []]) == True\n assert candidate(rooms = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [0]]) == True\n assert candidate(rooms = [[1, 2, 3, 4], [2], [3], [4], []]) == True\n assert candidate(rooms = [[1, 2], [2, 3], [3, 4], [4, 1], [0]]) == True\n assert candidate(rooms = [[1, 2, 3], [2, 3], [3], [], [1]]) == False\n assert candidate(rooms = [[1, 3, 5], [0, 2, 4], [1, 3, 5], [0, 2, 4], [1, 3, 5], [0, 2, 4]]) == True\n assert candidate(rooms = [[1, 2, 3], [0, 2, 4], [0, 1, 3], [0, 1, 2, 4], [1, 3]]) == True\n assert candidate(rooms = [[1, 2, 3], [0, 4, 5], [0, 5, 6], [0, 6, 7], [1], [1, 2], [2, 3], [3]]) == True\n assert candidate(rooms = [[1, 2], [2, 3], [3, 1], [4], [1, 2, 3]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 0], [3, 4, 5, 0, 1], [4, 5, 0, 1, 2], [5, 0, 1, 2, 3], [0, 1, 2, 3, 4]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5, 6, 7], [0, 2, 3, 4, 5, 6, 7], [0, 1, 3, 4, 5, 6, 7], [0, 1, 2, 4, 5, 6, 7], [0, 1, 2, 3, 5, 6, 7], [0, 1, 2, 3, 4, 6, 7], [0, 1, 2, 3, 4, 5, 7], [0, 1, 2, 3, 4, 5, 6]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [7, 8, 9, 10, 11, 12, 13, 14, 15], [8, 9, 10, 11, 12, 13, 14, 15], [9, 10, 11, 12, 13, 14, 15], [10, 11, 12, 13, 14, 15], [11, 12, 13, 14, 15], [12, 13, 14, 15], [13, 14, 15], [14, 15], [15], []]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 3, 4, 5, 6, 7, 8, 9], [0, 1, 4, 5, 6, 7, 8, 9], [0, 1, 2, 5, 6, 7, 8, 9], [0, 1, 2, 3, 6, 7, 8, 9], [0, 1, 2, 3, 4, 7, 8, 9], [0, 1, 2, 3, 4, 5, 8, 9], [0, 1, 2, 3, 4, 5, 6, 9], [0, 1, 2, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 6, 7, 8]]) == True\n assert candidate(rooms = [[1, 2, 3], [0], [3, 4], [1, 2], [3]]) == True\n assert candidate(rooms = [[1, 2, 4], [2, 3], [0, 3], [1, 4], [0, 1]]) == True\n assert candidate(rooms = [[1, 2, 3], [0, 2], [1, 3], [1, 2]]) == True\n assert candidate(rooms = [[1], [3], [4], [1, 2, 3], [2]]) == True\n assert candidate(rooms = [[1, 3], [2, 4], [3, 4], [0, 4], [0, 1, 2, 3]]) == True\n assert candidate(rooms = [[1, 2, 3, 4], [2, 3], [3, 4], [4], []]) == True\n assert candidate(rooms = [[1, 2], [2, 3, 4], [0, 1], [2, 4], [2, 3]]) == True\n assert candidate(rooms = [[1, 4], [2], [3], [1, 4], [3]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [2, 3, 4, 5, 6, 7, 8, 9], [0], [2, 5, 6, 7, 8, 9], [3], [2, 3, 6, 7, 8, 9], [0, 1, 3, 4, 7, 8, 9], [0, 1, 2, 3, 4, 6, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8]]) == True\n assert candidate(rooms = [[1], [2, 3, 4], [1], [2, 4], [1, 3]]) == True\n assert candidate(rooms = [[1], [2], [0], [4, 5, 6], [5], [6], [7], [8, 9], [10], [10], []]) == False\n assert candidate(rooms = [[1, 2, 3, 4], [3, 2, 1, 0], [1, 2, 3], [0, 1], [0, 2]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [12, 13, 14, 15, 16, 17, 18, 19, 20], [13, 14, 15, 16, 17, 18, 19, 20], [14, 15, 16, 17, 18, 19, 20], [15, 16, 17, 18, 19, 20], [16, 17, 18, 19, 20], [17, 18, 19, 20], [18, 19, 20], [19, 20], [20], []]) == True\n assert candidate(rooms = [[1, 3, 5], [2, 4, 6], [3, 5, 7], [4, 6, 8], [5, 7, 9], [6, 8, 10], [7, 9, 11], [8, 10, 12], [9, 11, 13], [10, 12, 0], [], [], [], [], []]) == False\n assert candidate(rooms = [[1, 2, 4], [0, 2, 3, 4], [0, 1, 3, 4], [2, 0, 1, 4], [0, 1, 2, 3]]) == True\n assert candidate(rooms = [[1, 2, 3, 4], [2, 3], [1, 3, 4], [0, 2, 4], [0, 1, 3]]) == True\n assert candidate(rooms = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]) == True\n"}, "metadata": {"canonical_parameter_names": ["rooms"], "leetcode_dataset_entry_point": "Solution().canVisitAllRooms", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var canVisitAllRooms = function(rooms) {", "container": null, "callable": "canVisitAllRooms", "parameters": [{"name": "rooms", "type": "number[][]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 842, "task_id": "split-array-into-fibonacci-sequence", "difficulty": "Medium", "problem_description": "You are given a string of digits num, such as \"123456579\". We can split it into a Fibonacci-like sequence [123, 456, 579].\nFormally, a Fibonacci-like sequence is a list f of non-negative integers such that:\n\n0 <= f[i] < 231, (that is, each integer fits in a 32-bit signed integer type),\nf.length >= 3, and\nf[i] + f[i + 1] == f[i + 2] for all 0 <= i < f.length - 2.\n\nNote that when splitting the string into pieces, each piece must not have extra leading zeroes, except if the piece is the number 0 itself.\nReturn any Fibonacci-like sequence split from num, or return [] if it cannot be done.\n \nExample 1:\n\nInput: num = \"1101111\"\nOutput: [11,0,11,11]\nExplanation: The output [110, 1, 111] would also be accepted.\n\nExample 2:\n\nInput: num = \"112358130\"\nOutput: []\nExplanation: The task is impossible.\n\nExample 3:\n\nInput: num = \"0123\"\nOutput: []\nExplanation: Leading zeroes are not allowed, so \"01\", \"2\", \"3\" is not valid.\n\n \nConstraints:\n\n1 <= num.length <= 200\nnum contains only digits.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(num = \"10\") == []\n assert candidate(num = \"1203\") == []\n assert candidate(num = \"101001011001101110000110011100011010011110000\") == []\n assert candidate(num = \"0123\") == []\n assert candidate(num = \"53983465721539834678539834699107966937716195040762699173453431867752970178509821133650133\") == []\n assert candidate(num = \"10112358\") == [1, 0, 1, 1, 2, 3, 5, 8]\n assert candidate(num = \"53983465510284675882952\") == []\n assert candidate(num = \"55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555\") == []\n assert candidate(num = \"1101111\") == [11, 0, 11, 11]\n assert candidate(num = \"111\") == []\n assert candidate(num = \"123456579\") == [123, 456, 579]\n assert candidate(num = \"199100199\") == [1, 99, 100, 199]\n assert candidate(num = \"112358130\") == []\n assert candidate(num = \"0000\") == [0, 0, 0, 0]\n assert candidate(num = \"00000\") == [0, 0, 0, 0, 0]\n assert candidate(num = \"214748364721474836482147483646\") == []\n assert candidate(num = \"539834653091229486220197747750493000537622019774775049300053762\") == []\n assert candidate(num = \"5500550000000000000000000000000000000000000000000000000000000000\") == []\n assert candidate(num = \"1010101010101010101010101010101010101010101010101010101010101010101\") == []\n assert candidate(num = \"2189229958345551690260329539342957514193011232571777825519283043251\") == []\n assert candidate(num = \"1010203050813213455891440\") == []\n assert candidate(num = \"100000000010000000011000000012000000023000000450000007800000123\") == []\n assert candidate(num = \"112358132134558914423337761098715972584418559654330786547413903\") == []\n assert candidate(num = \"19641831781129858327132231435820140521011229963145654252296088955571186180559945309415\") == []\n assert candidate(num = \"1111111111222222223333333355555555888888881414213562373095048801922239641504076297850251470507925331978420941989030622213902439519781072266386935013004913220113023504674837457618958332110361340813201903214827848862248736090247475626926107126856242086055224517950816942922470696623689952663023662366236\") == []\n assert candidate(num = \"55144233377\") == []\n assert candidate(num = \"539834657215398346785398346991818018118818645518818212\") == []\n assert candidate(num = \"30508132134558914423337710141520\") == []\n assert candidate(num = \"19910011992\") == []\n assert candidate(num = \"1001012030508132134558914423337761098159725844181676510946177112865746368750140518752964196544\") == []\n assert candidate(num = \"1000999199899799699599499399299199098979695949392919089796959493\") == []\n assert candidate(num = \"8914423337761098715972584418167651094655921349556979\") == []\n assert candidate(num = \"305078118299718606835889290810611235649871976067436781691303468\") == []\n assert candidate(num = \"01010101010101010101010101010101010101010101010101010101010101\") == []\n assert candidate(num = \"10102030508132134558914423337761098715972584214633628946\") == []\n assert candidate(num = \"101020305081321345589144\") == []\n assert candidate(num = \"5555500000000000000000000000000000000000000000000000000000000000000000000\") == []\n assert candidate(num = \"3654352961622705190521006455228285587903213238462643383279509884035\") == []\n assert candidate(num = \"1224365589144233377\") == []\n assert candidate(num = \"1001010110211233583132134558981391123581321345589144233377610987\") == []\n assert candidate(num = \"123456579101415202535588143\") == []\n assert candidate(num = \"12345678910111213141516171819202122232425262728293031323334353637383940\") == []\n assert candidate(num = \"3000000003\") == []\n assert candidate(num = \"3589014494737144108571129522619683030531176667422058003735352909040718542829032\") == []\n assert candidate(num = \"3174592653897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679\") == []\n assert candidate(num = \"21892299583477870\") == []\n assert candidate(num = \"13213455891442333776109871597258441816765109465592134955697921\") == []\n assert candidate(num = \"1010203050813213455891442333776109815972584418167651094617711286574636875014051875296419654423337761098159725844181676510946177112865746368750140518752964196544\") == []\n assert candidate(num = \"1234567890123456789012345678901234567890\") == []\n assert candidate(num = \"11111111111111111111111111111111111111111111111111\") == []\n assert candidate(num = \"504329353555168827726123264864707818289106704556020971834363288219037107536233243\") == []\n assert candidate(num = \"1123581321345589144233377610987159725844181076036548214611663861370879102147404313423355812408790942594517191973075474824622450904452049229322734639046752384341598130235028841971693993751058209749445923078164062862089986280348253421170679\") == []\n assert candidate(num = \"305078116559834749165212441511537708168291561047446076484270032896\") == []\n assert candidate(num = \"1000000000000000000000000000000000000000000000000000000000000000101\") == []\n assert candidate(num = \"10000000000000000000000000000000000000000000000001000000000000000000000000\") == []\n assert candidate(num = \"111111111111111111111111111111111111111111111111111111111111111111111111111\") == []\n assert candidate(num = \"25841321345589144233377610987159725844181676510946\") == []\n assert candidate(num = \"352457863245986551816477364000016558014109896102208342120562338240750010987987\") == []\n assert candidate(num = \"55555555555555555555555555555555555555555555555555\") == []\n assert candidate(num = \"10100010001100021000320005300085001380021130341055089014402330377060\") == []\n assert candidate(num = \"21123581321345589144\") == []\n assert candidate(num = \"505349634\") == []\n assert candidate(num = \"1224366101525358912\") == []\n assert candidate(num = \"891442333776109871597258412914977374154233306638104538732745388111\") == []\n assert candidate(num = \"000000000000000000000000000000\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(num = \"55005500000000000000000000000000000000000000000000000000000000000000000000000000\") == []\n assert candidate(num = \"0101020305081321345589144233377\") == []\n assert candidate(num = \"1000000000100000000020000000000\") == []\n assert candidate(num = \"050050500000000000000000000000000000000000000000000000000000000000000000000000000\") == []\n assert candidate(num = \"10100000000000000000000000000000000000000000000000000000000000000002\") == []\n assert candidate(num = \"2134558914423337761098715972584418559654330786547413903890131055\") == []\n assert candidate(num = \"101123581321345589144\") == [1, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]\n assert candidate(num = \"2112358132134558914423337761098715972584\") == []\n assert candidate(num = \"555555555555\") == []\n assert candidate(num = \"0123581321345589144\") == []\n assert candidate(num = \"1224365813213455891442333776109871597258412914977374154233306638104\") == []\n assert candidate(num = \"1964183938646565104891103515279327917900041088400684259688063\") == []\n assert candidate(num = \"9223372036854775807922337203685477580718446744073709551615\") == []\n"}, "metadata": {"canonical_parameter_names": ["num"], "leetcode_dataset_entry_point": "Solution().splitIntoFibonacci", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var splitIntoFibonacci = function(num) {", "container": null, "callable": "splitIntoFibonacci", "parameters": [{"name": "num", "type": "string"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 844, "task_id": "backspace-string-compare", "difficulty": "Easy", "problem_description": "Given two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace character.\nNote that after backspacing an empty text, the text will continue empty.\n \nExample 1:\n\nInput: s = \"ab#c\", t = \"ad#c\"\nOutput: true\nExplanation: Both s and t become \"ac\".\n\nExample 2:\n\nInput: s = \"ab##\", t = \"c#d#\"\nOutput: true\nExplanation: Both s and t become \"\".\n\nExample 3:\n\nInput: s = \"a#c\", t = \"b\"\nOutput: false\nExplanation: s becomes \"c\" while t becomes \"b\".\n\n \nConstraints:\n\n1 <= s.length, t.length <= 200\ns and t only contain lowercase letters and '#' characters.\n\n \nFollow up: Can you solve it in O(n) time and O(1) space?\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"###\",t = \"\") == True\n assert candidate(s = \"#a#c\",t = \"c\") == True\n assert candidate(s = \"xywrrmp\",t = \"xywrrmu#p\") == True\n assert candidate(s = \"bbbextm#w\",t = \"bb#bbbextm#w\") == False\n assert candidate(s = \"ab\",t = \"a#b\") == False\n assert candidate(s = \"abc#d\",t = \"abzd#\") == False\n assert candidate(s = \"ab#\",t = \"a#b\") == False\n assert candidate(s = \"abc#d\",t = \"abcd#\") == False\n assert candidate(s = \"xywrrmp\",t = \"xywrrmp\") == True\n assert candidate(s = \"a####b\",t = \"b\") == True\n assert candidate(s = \"ab#\",t = \"ab#\") == True\n assert candidate(s = \"######\",t = \"\") == True\n assert candidate(s = \"aaa###a\",t = \"aaaa##a\") == False\n assert candidate(s = \"abcd\",t = \"dcba\") == False\n assert candidate(s = \"a#c\",t = \"b\") == False\n assert candidate(s = \"abc#d\",t = \"abz#d\") == True\n assert candidate(s = \"abcd####\",t = \"\") == True\n assert candidate(s = \"#####\",t = \"\") == True\n assert candidate(s = \"ab#c\",t = \"ad#c\") == True\n assert candidate(s = \"hello#world#\",t = \"hello#wor#ld\") == False\n assert candidate(s = \"#a#c\",t = \"b\") == False\n assert candidate(s = \"a##c\",t = \"#a#c\") == True\n assert candidate(s = \"####\",t = \"\") == True\n assert candidate(s = \"a###b\",t = \"b\") == True\n assert candidate(s = \"a###b\",t = \"a###b\") == True\n assert candidate(s = \"ab##\",t = \"c#d#\") == True\n assert candidate(s = \"ab#cd\",t = \"a#b#cd\") == False\n assert candidate(s = \"y#fo##f\",t = \"y#f#o##f\") == True\n assert candidate(s = \"ab#cd#e##f\",t = \"acdf\") == False\n assert candidate(s = \"abc###d##e##f##g##h##i##j##k##l##m##n##o##p##q##r##s##t##u##v##w##x##y##z##\",t = \"abc\") == False\n assert candidate(s = \"ab#cde##fg#\",t = \"ab#def#g#\") == False\n assert candidate(s = \"ab#cd#e##f\",t = \"abcdef##\") == False\n assert candidate(s = \"abcdef#####\",t = \"ab\") == False\n assert candidate(s = \"###abc###def###ghi###jkl###mno###pqr###stu###vwx###yz#\",t = \"abc###def###ghi###jkl###mno###pqr###stu###vwx###yz###\") == False\n assert candidate(s = \"a#b#cd#ef#gh##ij##klm#nop##qrst##uvw#xyz####\",t = \"a#b#cd#ef#gh##ij##klm#nop##qrst##uvw#xy#z#\") == False\n assert candidate(s = \"#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"#\") == True\n assert candidate(s = \"abcdefghij#klmnopqrst#uvwxyz#\",t = \"uvwxyz#tsrqponmlkjihgfedcba\") == False\n assert candidate(s = \"a#b#c#d#e#f#g\",t = \"\") == False\n assert candidate(s = \"abcdef#ghijkl#mnopqr#stuvwx#yz##\",t = \"yz##xwvu#tsrqpon#mlkjihg#fedcba\") == False\n assert candidate(s = \"a#b#cd#ef#gh##ij##klm#nop##qrst##uvw#xyz###\",t = \"abcdef#ghijklmnopqrstuvwxyz###\") == False\n assert candidate(s = \"abcd#efgh#ijkl#mnop#qrst#uvwx#yz##\",t = \"zyxw#vuts#rqpon#mlkj#ihgf#edcb#a\") == False\n assert candidate(s = \"x###y##z\",t = \"xyz###\") == False\n assert candidate(s = \"a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(s = \"zzzzzzzzzz####zzzzzzzzzz##\",t = \"zzzzzzzzzzzzzzzzzz\") == False\n assert candidate(s = \"a##b##c##d##e##f##g##h##i##j##k##l##m##n##o##p##q##r##s##t##u##v##w##x##y##z##\",t = \"\") == True\n assert candidate(s = \"abcd##efghijkl##mnopqr##stuv##wxyz####\",t = \"abcd##efghijkl##mnopqr##stuv##wxy##z###\") == False\n assert candidate(s = \"abcd#e#f#gh#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(s = \"f####jkl###xyz##\",t = \"jkxyz#\") == False\n assert candidate(s = \"a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"abcdefghijklmnopqrstuvwxyz#\") == False\n assert candidate(s = \"ab#cdef###gh#ij#kl##mno###pqr####stu#####vwxyz##\",t = \"vwxyz##\") == False\n assert candidate(s = \"ab#c#d#efg\",t = \"abcdefg###\") == False\n assert candidate(s = \"abcdefg#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"z#y#x#w#v#u#t#s#r#q#p#o#n#m#l#k#j#i#h#g#f#e#d#c#b#a#\") == False\n assert candidate(s = \"a#b#c#d#e#f#\",t = \"#f#e#d#c#b#a#\") == True\n assert candidate(s = \"abcde#fghij#klmno#pqrs#tu#v#w#x#y#z#\",t = \"abcdefghijklmnopqrstuvwxy\") == False\n assert candidate(s = \"a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"\") == True\n assert candidate(s = \"a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"z#y#x#w#v#u#t#s#r#q#p#o#n#m#l#k#j#i#h#g#f#e#d#c#b#a#\") == True\n assert candidate(s = \"z#x#c#v#b#n#m#w#q#o#p#l#k#j#i#h#g#f#e#d#c#b#a#\",t = \"\") == True\n assert candidate(s = \"##ab#c#d#e#f##g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(s = \"a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"z##y##x##w##v##u##t##s##r##q##p##o##n##m##l##k##j##i##h##g##f##e##d##c##b##a\") == False\n assert candidate(s = \"x#y#z#\",t = \"x#y#z#\") == True\n assert candidate(s = \"a###a###a###a###a###a###a###a###a###a###\",t = \"a#\") == True\n assert candidate(s = \"a#b#b#c#d#d#e#e#f#f#g#g#h#h#i#i#j#j#k#k#l#l#m#m#n#n#o#o#p#p#q#q#r#r#s#s#t#t#u#u#v#v#w#w#x#x#y#y#z#z#\",t = \"zz#yy#xx#ww#vv#uu#tt#ss#rr#qq#pp#oo#nn#mm#ll#kk#jj#ii#hh#gg#ff#ee#dd#cc#bb#aa\") == False\n assert candidate(s = \"abc#d##ef###\",t = \"ab##ef\") == False\n assert candidate(s = \"z#y#x#w#v#u#t#s#r#q#p#o#n#m#l#k#j#i#h#g#f#e#d#c#b#a#\",t = \"zyxwvutsrqponmlkjihgfedcba#\") == False\n assert candidate(s = \"a#b#cd#ef#gh##ij##klm#nop##qrst##uvw#xyz###\",t = \"a#b#cd#ef#gh##ij##klm#nop##qrst##uvw#xy##z###\") == False\n assert candidate(s = \"a#b#c#d#e#f#g#h#i#j#\",t = \"abcdefghij#\") == False\n assert candidate(s = \"abcabcabcabc#abcabcabcabc#\",t = \"abcabcabcabcabcabcabcabc\") == False\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz#abc#d##\",t = \"abcdefghijklmnopqrstuvwxy#\") == False\n assert candidate(s = \"abcde#f#ghi#jkl#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"z\") == False\n assert candidate(s = \"######abc\",t = \"abc######\") == False\n assert candidate(s = \"abc#de#fgh#ijk#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"z#y#x#w#v#u#t#s#r#q#p#o#n#m#l#k#j#i#h#g#f#e#d#c#b#a\") == False\n assert candidate(s = \"abcde#f#gh#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"zxywvutsrqponmlkjihgfedcba\") == False\n assert candidate(s = \"abcde##fgh##ij##k#\",t = \"abcd#efgh#ij##k\") == False\n assert candidate(s = \"a##b##c##d##e##f##g##\",t = \"\") == True\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz#abcdefghijklmnopqrstuvwxyz#\",t = \"abcdefghijklmnopqrstuvwxyz#abcdefghijklmnopqrstuvwxyz#\") == True\n assert candidate(s = \"#a#b#c#d#e#f#g#h#i#j#k#\",t = \"abcdefghijk#\") == False\n assert candidate(s = \"a##b##c##d##e##f##g##h##i##j##k##l##m##n##o##p##q##r##s##t##u##v##w##x##y##z##\",t = \"#z##y##x##w##v##u##t##s##r##q##p##o##n##m##l##k##j##i##h##g##f##e##d##c##b##a##\") == True\n assert candidate(s = \"a##b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(s = \"#a#b#c#d#e#f#\",t = \"\") == True\n assert candidate(s = \"####abc##d##ef###g####\",t = \"abc##d##ef###g####\") == True\n assert candidate(s = \"#a#a#a#a#a#a#a#a#a#a#\",t = \"a#a#a#a#a#a#a#a#a#a#\") == True\n assert candidate(s = \"ab#cd##ef#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"efghijklmnopqrstuvwxyz\") == False\n assert candidate(s = \"a##b##c##d##e##f##g##h##i##j##k##l##m##n##o##p##q##r##s##t##u##v##w##x##y##z##\",t = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(s = \"longstring#####anotherstring\",t = \"longanotherstring\") == False\n assert candidate(s = \"###xyz\",t = \"xyz###\") == False\n assert candidate(s = \"a##b##c##d##e##f##g##h##i##j##k##l##m##n##o##p##q##r##s##t##u##v##w##x##y##z##\",t = \"a##b##c##d##e##f##g##h##i##j##k##l##m##n##o##p##q##r##s##t##u##v##w##x##y##z##\") == True\n assert candidate(s = \"#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(s = \"#a##b##c##d##e##f##g##h##i##j##k##l##m##n##o##p##q##r##s##t##u##v##w##x##y##z##\",t = \"z##y##x##w##v##u##t##s##r##q##p##o##n##m##l##k##j##i##h##g##f##e##d##c##b##a##\") == True\n assert candidate(s = \"#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\") == True\n assert candidate(s = \"xy#z##\",t = \"xzz#\") == False\n assert candidate(s = \"abc#def##ghi###jkl####mno#####pqr######stu#######vwx########yz#########\",t = \"\") == True\n assert candidate(s = \"x####y\",t = \"xy#\") == False\n assert candidate(s = \"qwerty#uiop##asdfghjkl##zxcvbnm##\",t = \"qwerty#uiop##asdfghjkl##zxcvbnm##\") == True\n assert candidate(s = \"abc#d##e\",t = \"ab##de\") == False\n assert candidate(s = \"abcdefg#####hijkl#####mnop#####qrstu#####vwxyz\",t = \"hijklmnopqrstuuvwxyz\") == False\n assert candidate(s = \"abcde######\",t = \"fghij#####\") == True\n assert candidate(s = \"#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"\") == True\n assert candidate(s = \"xylophone##music####\",t = \"xylophone###music####\") == False\n assert candidate(s = \"a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"zxywvutsrqponmlkjihgfedcba\") == False\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz##\",t = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyz##\") == False\n assert candidate(s = \"z#z#z#z#z#\",t = \"\") == True\n assert candidate(s = \"ab#cd#ef#gh#ij#kl#mn#op#qr#st#uv#wx#yz#\",t = \"yz#xw#vu#ts#rq#po#nm#lk#ji#hg#fe#dc#ba\") == False\n assert candidate(s = \"abcde###fghijk###lmnop###qrstuvwxyz###\",t = \"qrstuvwxyz###mnop###fghijk###abcde###\") == False\n assert candidate(s = \"#a#b#b#c#d#d#e#e#f#f#g#g#h#h#i#i#j#j#k#k#l#l#m#m#n#n#o#o#p#p#q#q#r#r#s#s#t#t#u#u#v#v#w#w#x#x#y#y#z#z#\",t = \"\") == True\n assert candidate(s = \"a###b#c###d#e###f#g###h#i###j#k###l#m###n#o###p#q###r#s###t#u###v#w###x###y###z###\",t = \"\") == True\n assert candidate(s = \"a###b###c###d###e###f###g###h###i###j###k###l###m###n###o###p###q###r###s###t###u###v###w###x###y###z###\",t = \"\") == True\n assert candidate(s = \"ab##cd##ef##gh##ij##kl##mn##op##qr##st##uv##wx##yz##\",t = \"a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\") == True\n assert candidate(s = \"abc#de#f##g#hi#jkl##mno###pqr####stu#####vwxyz##\",t = \"abc#de#f##g#hi#jkl##mno###pqr####stu#####\") == False\n assert candidate(s = \"##abc#d##ef#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#\",t = \"abcdefghijklnopqrstuvwxyz\") == False\n"}, "metadata": {"canonical_parameter_names": ["s", "t"], "leetcode_dataset_entry_point": "Solution().backspaceCompare", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var backspaceCompare = function(s, t) {", "container": null, "callable": "backspaceCompare", "parameters": [{"name": "s", "type": "string"}, {"name": "t", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 845, "task_id": "longest-mountain-in-array", "difficulty": "Medium", "problem_description": "You may recall that an array arr is a mountain array if and only if:\n\narr.length >= 3\nThere exists some index i (0-indexed) with 0 < i < arr.length - 1 such that:\n\t\narr[0] < arr[1] < ... < arr[i - 1] < arr[i]\narr[i] > arr[i + 1] > ... > arr[arr.length - 1]\n\n\n\nGiven an integer array arr, return the length of the longest subarray, which is a mountain. Return 0 if there is no mountain subarray.\n \nExample 1:\n\nInput: arr = [2,1,4,7,3,2,5]\nOutput: 5\nExplanation: The largest mountain is [1,4,7,3,2] which has length 5.\n\nExample 2:\n\nInput: arr = [2,2,2]\nOutput: 0\nExplanation: There is no mountain.\n\n \nConstraints:\n\n1 <= arr.length <= 104\n0 <= arr[i] <= 104\n\n \nFollow up:\n\nCan you solve it using only one pass?\nCan you solve it in O(1) space?\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) == 11\n assert candidate(arr = [0, 1, 0, 2, 1, 0, 1, 3, 2, 1]) == 5\n assert candidate(arr = [5, 4, 3, 2, 1]) == 0\n assert candidate(arr = [1, 3, 1, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5]) == 11\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 0\n assert candidate(arr = [1, 2, 3]) == 0\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 0]) == 8\n assert candidate(arr = [1, 3, 5, 4, 2, 3, 6, 7, 5]) == 5\n assert candidate(arr = [1, 2, 3, 1, 2, 3, 4, 5, 6, 4, 3, 2, 1]) == 10\n assert candidate(arr = [3, 3, 3, 2, 1]) == 0\n assert candidate(arr = [1, 2, 2, 1]) == 0\n assert candidate(arr = [3, 3, 3, 2, 1, 2, 3, 3, 3]) == 0\n assert candidate(arr = [1, 2, 3, 4, 5, 3, 1]) == 7\n assert candidate(arr = [1, 3, 1]) == 3\n assert candidate(arr = [2, 1, 4, 7, 3, 2, 5]) == 5\n assert candidate(arr = [1, 2, 2, 2, 1]) == 0\n assert candidate(arr = [2, 2, 2]) == 0\n assert candidate(arr = [1, 3, 5, 4, 2, 3, 4, 5, 3, 1]) == 6\n assert candidate(arr = [2, 2, 2, 3, 4, 5, 4, 3, 2, 1, 1]) == 8\n assert candidate(arr = [0, 2, 1, 0]) == 4\n assert candidate(arr = [1, 2, 3, 4, 5]) == 0\n assert candidate(arr = [1, 3, 1, 4, 5, 2, 1]) == 5\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 0\n assert candidate(arr = [0, 2, 1, 0, 2, 0, 1, 0]) == 4\n assert candidate(arr = [2, 3, 3, 2, 2, 2, 1]) == 0\n assert candidate(arr = [1, 3, 5, 7, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 13\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 9\n assert candidate(arr = [0, 1, 2, 3, 4, 5]) == 0\n assert candidate(arr = [3, 3, 3, 2, 1, 2, 3]) == 0\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 4, 6, 5]) == 3\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 0, -1, -2, -1, 0, 1, 2, 3, 2, 1]) == 10\n assert candidate(arr = [0, 2, 1, 0, 2, 1, 0]) == 4\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5]) == 20\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1]) == 20\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1]) == 9\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 19\n assert candidate(arr = [1, 2, 3, 4, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]) == 11\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 19\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3]) == 20\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 12\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3]) == 11\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 11\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1]) == 12\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5]) == 10\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1]) == 11\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(arr = [1, 1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 9\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1]) == 18\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 19\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0]) == 12\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5]) == 17\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1]) == 9\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1]) == 13\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 13, 11, 9, 7, 5, 3, 1, 3, 5, 7, 9, 11]) == 15\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 18\n assert candidate(arr = [5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 18\n assert candidate(arr = [3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7]) == 15\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 9, 7, 5, 3, 1, 3, 5, 7, 9, 11, 9, 7, 5, 3, 1]) == 11\n assert candidate(arr = [1, 2, 3, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 2, 3, 4, 5, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1]) == 12\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 23\n assert candidate(arr = [1, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3]) == 5\n assert candidate(arr = [1, 3, 5, 4, 2, 3, 4, 5, 3, 1, 5, 6, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 11\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 15\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 11\n assert candidate(arr = [2, 1, 4, 7, 3, 2, 5, 6, 8, 4, 3, 2, 1]) == 8\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 9\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0]) == 13\n assert candidate(arr = [8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 18\n assert candidate(arr = [2, 1, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1]) == 5\n assert candidate(arr = [1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0]) == 7\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5]) == 15\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 17\n assert candidate(arr = [1, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11, 13, 12, 14, 13, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 16\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 20\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 9\n assert candidate(arr = [1, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1]) == 9\n assert candidate(arr = [5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 19\n assert candidate(arr = [5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5]) == 19\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0]) == 17\n assert candidate(arr = [8, 9, 10, 11, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 17\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 17\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 11\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 2, 1]) == 11\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 19\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 11\n assert candidate(arr = [1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3]) == 4\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2]) == 20\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0]) == 12\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 19\n assert candidate(arr = [2, 1, 4, 7, 3, 2, 5, 6, 8, 4, 3, 1]) == 7\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 19\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 19\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1]) == 13\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 3\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 6, 7, 8, 9, 10]) == 11\n assert candidate(arr = [1, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 11\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 9\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5]) == 20\n assert candidate(arr = [1, 1, 1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 9\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 9\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 17\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(arr = [5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0]) == 13\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5]) == 19\n assert candidate(arr = [0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 17\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0]) == 13\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 15, 13, 11, 9, 7, 5, 3, 1, 3, 5, 7, 9, 11, 13, 15, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 17\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 2, 1]) == 12\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 7, 6, 5, 4, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1]) == 13\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 9\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 2, 1]) == 9\n assert candidate(arr = [1, 3, 5, 7, 9, 7, 5, 3, 1, 3, 5, 7, 9, 7, 5, 3, 1, 3, 5, 7, 9, 7, 5, 3, 1]) == 9\n assert candidate(arr = [1, 2, 3, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 2, 1]) == 5\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0]) == 11\n assert candidate(arr = [2, 1, 4, 7, 3, 2, 5, 8, 6, 5, 4, 3, 2, 1, 0]) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1]) == 10\n assert candidate(arr = [1, 2, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1]) == 9\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9]) == 11\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0]) == 13\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 18\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 17\n assert candidate(arr = [1, 2, 1, 3, 2, 1, 4, 3, 2, 1, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1]) == 7\n assert candidate(arr = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 11\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 19\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 18\n assert candidate(arr = [1, 2, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5]) == 11\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1]) == 5\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 3\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5]) == 15\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6]) == 17\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 9, 7, 5, 3, 1, 3, 5, 7, 9, 7, 5, 3, 1, 3, 5, 7, 9, 7, 5, 3, 1]) == 11\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 3, 5, 7, 9, 7, 5, 3, 1]) == 21\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5]) == 12\n assert candidate(arr = [3, 3, 3, 3, 2, 1, 2, 3, 3, 3, 3, 2, 1, 2, 3, 3, 3, 3, 2, 1]) == 0\n assert candidate(arr = [10000, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 9980]) == 0\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0]) == 12\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 17\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6]) == 18\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 11\n assert candidate(arr = [5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 14\n assert candidate(arr = [5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 17\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4]) == 20\n assert candidate(arr = [2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5]) == 9\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5]) == 9\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5]) == 16\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 20\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5]) == 18\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 7, 6, 5, 4, 3, 5, 4, 3, 2, 1, 0]) == 8\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 9\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 19\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0]) == 8\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5]) == 9\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3]) == 19\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 3, 2, 1, 0]) == 11\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().longestMountain", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var longestMountain = function(arr) {", "container": null, "callable": "longestMountain", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 846, "task_id": "hand-of-straights", "difficulty": "Medium", "problem_description": "Alice has some number of cards and she wants to rearrange the cards into groups so that each group is of size groupSize, and consists of groupSize consecutive cards.\nGiven an integer array hand where hand[i] is the value written on the ith card and an integer groupSize, return true if she can rearrange the cards, or false otherwise.\n \nExample 1:\n\nInput: hand = [1,2,3,6,2,3,4,7,8], groupSize = 3\nOutput: true\nExplanation: Alice's hand can be rearranged as [1,2,3],[2,3,4],[6,7,8]\n\nExample 2:\n\nInput: hand = [1,2,3,4,5], groupSize = 4\nOutput: false\nExplanation: Alice's hand can not be rearranged into groups of 4.\n\n\n \nConstraints:\n\n1 <= hand.length <= 104\n0 <= hand[i] <= 109\n1 <= groupSize <= hand.length\n\n \nNote: This question is the same as 1296: https://leetcode.com/problems/divide-array-in-sets-of-k-consecutive-numbers/\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(hand = [1, 2, 3, 4, 5, 6],groupSize = 2) == True\n assert candidate(hand = [1, 1, 2, 2, 3, 3],groupSize = 3) == True\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],groupSize = 4) == True\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],groupSize = 5) == True\n assert candidate(hand = [1, 2, 3, 4, 5, 6],groupSize = 3) == True\n assert candidate(hand = [1, 2, 3, 4, 5],groupSize = 4) == False\n assert candidate(hand = [1, 2, 3, 6, 2, 3, 4, 7, 8],groupSize = 3) == True\n assert candidate(hand = [8, 10, 12],groupSize = 3) == False\n assert candidate(hand = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9],groupSize = 5) == False\n assert candidate(hand = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],groupSize = 10) == True\n assert candidate(hand = [1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13],groupSize = 4) == False\n assert candidate(hand = [1, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12],groupSize = 3) == False\n assert candidate(hand = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120],groupSize = 5) == False\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],groupSize = 10) == True\n assert candidate(hand = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],groupSize = 4) == False\n assert candidate(hand = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24],groupSize = 5) == True\n assert candidate(hand = [5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8],groupSize = 5) == False\n assert candidate(hand = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20],groupSize = 4) == True\n assert candidate(hand = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31],groupSize = 2) == False\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],groupSize = 8) == True\n assert candidate(hand = [1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],groupSize = 5) == False\n assert candidate(hand = [1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32],groupSize = 8) == False\n assert candidate(hand = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],groupSize = 5) == False\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],groupSize = 3) == False\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],groupSize = 2) == True\n assert candidate(hand = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],groupSize = 4) == False\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],groupSize = 5) == True\n assert candidate(hand = [1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],groupSize = 4) == False\n assert candidate(hand = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22],groupSize = 6) == False\n assert candidate(hand = [1, 3, 2, 4, 5, 6, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19],groupSize = 2) == True\n assert candidate(hand = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],groupSize = 4) == True\n assert candidate(hand = [1, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10],groupSize = 3) == True\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],groupSize = 4) == True\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45],groupSize = 5) == True\n assert candidate(hand = [1, 3, 2, 5, 4, 6, 7, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30],groupSize = 2) == False\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60],groupSize = 6) == True\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36],groupSize = 4) == True\n assert candidate(hand = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],groupSize = 5) == False\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34],groupSize = 10) == False\n assert candidate(hand = [1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15],groupSize = 5) == False\n assert candidate(hand = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],groupSize = 5) == False\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],groupSize = 5) == True\n assert candidate(hand = [3, 3, 3, 2, 2, 1, 4, 4, 4],groupSize = 3) == False\n assert candidate(hand = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12],groupSize = 4) == True\n assert candidate(hand = [10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14],groupSize = 4) == False\n assert candidate(hand = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61],groupSize = 6) == False\n assert candidate(hand = [3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10],groupSize = 5) == False\n assert candidate(hand = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28],groupSize = 7) == False\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45],groupSize = 7) == False\n assert candidate(hand = [5, 6, 7, 8, 8, 9, 10, 11, 12, 12, 13, 14],groupSize = 4) == False\n assert candidate(hand = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],groupSize = 2) == True\n assert candidate(hand = [3, 3, 3, 3, 4, 4, 5, 5, 5],groupSize = 3) == False\n assert candidate(hand = [1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10],groupSize = 3) == False\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],groupSize = 5) == True\n assert candidate(hand = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],groupSize = 10) == False\n assert candidate(hand = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15],groupSize = 3) == True\n assert candidate(hand = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14],groupSize = 5) == True\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100],groupSize = 5) == True\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],groupSize = 5) == True\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],groupSize = 3) == True\n assert candidate(hand = [10, 10, 10, 10, 10, 11, 11, 11, 11, 11],groupSize = 5) == False\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100],groupSize = 10) == True\n assert candidate(hand = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8],groupSize = 2) == True\n assert candidate(hand = [1, 3, 2, 5, 4, 6, 9, 8, 7, 12, 11, 10, 15, 14, 13, 18, 17, 16, 21, 20, 19, 24, 23, 22, 27, 26, 25, 30, 29, 28, 33, 32, 31, 36, 35, 34, 39, 38, 37, 42, 41, 40],groupSize = 3) == True\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],groupSize = 10) == True\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],groupSize = 5) == True\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],groupSize = 3) == True\n assert candidate(hand = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10],groupSize = 5) == False\n assert candidate(hand = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],groupSize = 5) == False\n assert candidate(hand = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21],groupSize = 3) == True\n assert candidate(hand = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4],groupSize = 3) == False\n assert candidate(hand = [3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10],groupSize = 3) == False\n assert candidate(hand = [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],groupSize = 4) == False\n assert candidate(hand = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],groupSize = 5) == True\n assert candidate(hand = [1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],groupSize = 2) == True\n assert candidate(hand = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],groupSize = 5) == True\n assert candidate(hand = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115],groupSize = 8) == True\n assert candidate(hand = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10],groupSize = 3) == False\n assert candidate(hand = [1, 3, 2, 4, 5, 6, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15],groupSize = 4) == True\n assert candidate(hand = [1, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11],groupSize = 4) == False\n assert candidate(hand = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6],groupSize = 2) == True\n"}, "metadata": {"canonical_parameter_names": ["hand", "groupSize"], "leetcode_dataset_entry_point": "Solution().isNStraightHand", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isNStraightHand = function(hand, groupSize) {", "container": null, "callable": "isNStraightHand", "parameters": [{"name": "hand", "type": "number[]"}, {"name": "groupSize", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 847, "task_id": "shortest-path-visiting-all-nodes", "difficulty": "Hard", "problem_description": "You have an undirected, connected graph of n nodes labeled from 0 to n - 1. You are given an array graph where graph[i] is a list of all the nodes connected with node i by an edge.\nReturn the length of the shortest path that visits every node. You may start and stop at any node, you may revisit nodes multiple times, and you may reuse edges.\n \nExample 1:\n\n\nInput: graph = [[1,2,3],[0],[0],[0]]\nOutput: 4\nExplanation: One possible path is [1,0,2,0,3]\n\nExample 2:\n\n\nInput: graph = [[1],[0,2,4],[1,3,4],[2],[1,2]]\nOutput: 4\nExplanation: One possible path is [0,1,4,2,3]\n\n \nConstraints:\n\nn == graph.length\n1 <= n <= 12\n0 <= graph[i].length < n\ngraph[i] does not contain i.\nIf graph[a] contains b, then graph[b] contains a.\nThe input graph is always connected.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(graph = [[1, 2], [0, 2, 3], [0, 1], [1]]) == 3\n assert candidate(graph = [[2, 3, 4, 5], [3, 4, 5, 6], [0, 3, 4, 5], [0, 1, 2, 5], [0, 1, 2], [0, 1, 2, 3], [1]]) == 6\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]]) == 15\n assert candidate(graph = [[1, 3, 4, 5], [0, 2, 3, 4, 5], [1, 3, 4, 5], [0, 1, 2, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 3, 4]]) == 5\n assert candidate(graph = [[1, 2, 3], [0], [0], [0]]) == 4\n assert candidate(graph = [[2, 5, 7], [2, 4], [0, 1], [5], [1, 6], [0, 3], [4], [0]]) == 8\n assert candidate(graph = [[1, 2], [0], [0]]) == 2\n assert candidate(graph = [[1], [0, 2, 4], [1, 3, 4], [2], [1, 2]]) == 4\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]) == 10\n assert candidate(graph = [[1, 2, 3, 4], [0, 2, 4], [0, 1, 3], [0, 2, 4], [0, 1, 3, 5], [4, 6, 7], [5, 7], [5, 6]]) == 7\n assert candidate(graph = [[1, 2, 3, 4], [0, 2], [0, 1, 3, 4], [0, 2, 4], [0, 1, 2, 3]]) == 4\n assert candidate(graph = [[1], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [2, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12], [3, 1, 2, 5, 6, 7, 8, 9, 10, 11, 12], [4, 3, 1, 2, 6, 7, 8, 9, 10, 11, 12], [5, 4, 3, 1, 2, 7, 8, 9, 10, 11, 12], [6, 5, 4, 3, 1, 2, 8, 9, 10, 11, 12], [7, 6, 5, 4, 3, 1, 2, 9, 10, 11, 12], [8, 7, 6, 5, 4, 3, 1, 2, 10, 11, 12], [9, 8, 7, 6, 5, 4, 3, 1, 2, 11, 12], [10, 9, 8, 7, 6, 5, 4, 3, 1, 2, 12], [11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2]]) == 12\n assert candidate(graph = [[1, 2, 3], [0, 4, 5], [0, 5, 6], [0, 4, 6], [1, 3, 7], [1, 2, 7], [2, 3, 8], [4, 5, 8], [6, 7]]) == 8\n assert candidate(graph = [[1, 2, 3, 4, 5], [0], [0], [0], [0], [0]]) == 8\n assert candidate(graph = [[1, 4, 5], [0, 2, 4], [1, 3, 4], [2], [0, 1, 2, 6], [0], [4]]) == 7\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [1, 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]]) == 12\n assert candidate(graph = [[1, 2, 3], [0, 4], [0, 5], [0, 6], [1], [2], [3]]) == 8\n assert candidate(graph = [[1, 2, 3, 4, 5], [0, 6, 7], [0, 6, 7], [0, 6, 7], [0, 6, 7], [0, 6, 7], [1, 2, 3, 4, 5, 7], [1, 2, 3, 4, 5, 6]]) == 8\n assert candidate(graph = [[1, 2], [0, 3, 4], [0, 5, 6], [1, 7], [1, 8], [2, 9], [2, 10], [3, 11], [4, 11], [5, 10, 12], [6, 9, 11, 12], [7, 8, 10, 12], [9, 10, 11]]) == 12\n assert candidate(graph = [[1, 2, 3, 4], [0, 2, 5], [0, 1, 3], [0, 2, 4], [0, 3, 5], [1, 4]]) == 5\n assert candidate(graph = [[1, 2, 3, 4, 5], [0, 2, 3, 4, 5], [0, 1, 3, 4, 5], [0, 1, 2, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 3, 4]]) == 5\n assert candidate(graph = [[1, 3, 5], [0, 2, 4, 6], [1, 3, 5, 7], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 11], [2, 4, 6, 8, 10], [3, 5, 7, 9, 11, 13], [4, 6, 8, 10, 12], [5, 7, 9, 11, 13], [6, 8, 10, 12, 14], [7, 9, 11, 13], [8, 10, 12, 14], [9, 11, 13]]) == 14\n assert candidate(graph = [[1, 4], [0, 2, 3, 4], [1, 3, 4], [1, 2, 4], [0, 1, 2, 3]]) == 4\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]) == 11\n assert candidate(graph = [[1, 5], [0, 2], [1, 3], [2, 4], [3, 5], [0, 4, 6], [5]]) == 6\n assert candidate(graph = [[1, 2], [0, 3, 5], [0, 4, 6], [1, 5], [2, 6], [1, 3, 6], [2, 4, 5]]) == 6\n assert candidate(graph = [[1, 3], [0, 2, 4], [1, 5], [0, 4], [1, 3, 5], [2, 4]]) == 5\n assert candidate(graph = [[1, 3], [0, 2, 3, 4, 5], [1, 4, 5], [0, 1, 4, 5], [1, 2, 3, 5], [1, 2, 3, 4]]) == 5\n assert candidate(graph = [[1, 2, 5], [0, 2, 4, 5], [0, 1, 3, 5], [2], [1], [0, 1, 2]]) == 5\n assert candidate(graph = [[1, 5, 7], [0, 2, 6], [1, 3, 6, 7], [2, 4, 6, 7], [3, 5, 6], [0, 1, 4, 6], [1, 2, 3, 4, 5, 7], [0, 2, 3, 6]]) == 7\n assert candidate(graph = [[1, 5], [0, 2, 6], [1, 3, 6], [2, 4, 6], [3, 5, 6], [0, 1, 4, 6], [1, 2, 3, 4, 5]]) == 6\n assert candidate(graph = [[1, 2, 3], [0, 4, 5], [0, 6, 7], [0, 8, 9], [1, 6, 10], [1, 7, 10], [2, 4, 11], [2, 5, 11], [3, 12], [3, 13], [4, 5, 14], [6, 7, 14], [8, 15], [9, 15], [10, 11, 16], [12, 13, 16], [14, 15]]) == 16\n assert candidate(graph = [[1, 2, 3, 4], [0, 5, 6], [0, 7, 8], [0, 9, 10], [0, 11, 12], [1], [1], [2], [2], [3], [3], [4], [4]]) == 20\n assert candidate(graph = [[1, 5], [0, 2, 6], [1, 3], [2, 4], [3, 5], [0, 4, 6], [1, 5]]) == 6\n assert candidate(graph = [[1, 3, 4], [0, 2], [1, 3, 4], [0, 2, 5], [0, 2, 5], [3, 4]]) == 5\n assert candidate(graph = [[1, 2], [0, 3, 4, 5], [0, 6, 7], [1], [1, 7], [1, 8], [2], [2, 3, 4], [5]]) == 9\n assert candidate(graph = [[1, 2, 3, 4], [0, 5, 6, 7], [0, 5, 6, 7], [0, 5, 6, 7], [0, 5, 6, 7], [1, 2, 3, 4, 8], [1, 2, 3, 4, 8], [1, 2, 3, 4, 8], [5, 6, 7]]) == 8\n assert candidate(graph = [[1, 2, 3], [0, 2, 3, 4], [0, 1, 3, 5, 6], [0, 1, 2, 5, 6, 7], [1], [2, 3, 6], [2, 3, 5, 7], [3, 6]]) == 7\n assert candidate(graph = [[1, 5, 6], [0, 3], [3, 6], [1, 2, 6], [5], [0, 4], [0, 2, 3, 1]]) == 6\n assert candidate(graph = [[1, 2], [0, 3, 4, 5], [0, 6, 7], [1], [1], [1, 8], [2], [2], [5]]) == 11\n assert candidate(graph = [[1, 4], [0, 2], [1, 3], [2, 4, 5], [0, 1, 3], [3]]) == 5\n assert candidate(graph = [[1, 2, 5], [0, 3, 6], [0, 3, 7], [1, 2, 8], [5, 6, 7], [0, 4, 8], [1, 4, 8], [2, 4, 8], [3, 5, 6, 7]]) == 8\n assert candidate(graph = [[1, 4], [0, 2, 5], [1, 3, 6], [2, 7], [0, 5, 8], [1, 4, 6, 9], [2, 5, 7, 10], [3, 6, 11], [4, 9, 12], [5, 8, 10, 13], [6, 9, 11, 14], [7, 10, 15], [8, 13], [9, 12, 14], [10, 13, 15], [11, 14]]) == 15\n assert candidate(graph = [[1, 2, 4, 6], [0, 2, 3, 5], [0, 1, 5], [1, 4, 6], [0, 3, 5], [1, 2, 4, 6], [0, 3, 5]]) == 6\n assert candidate(graph = [[1, 2, 3], [0, 4, 5], [0, 6], [0, 7], [1, 5, 7], [1, 4, 6], [2, 5, 7], [3, 4, 6]]) == 7\n assert candidate(graph = [[1, 2, 4], [0, 3, 5], [0, 3, 6], [1, 2, 7], [0, 8], [1, 8], [2, 8], [3, 8], [4, 5, 6, 7]]) == 8\n assert candidate(graph = [[1, 3], [0, 2, 4], [1, 3, 5], [0, 2, 6], [1], [2], [3]]) == 7\n assert candidate(graph = [[1, 2, 3, 4, 5], [0, 2, 3, 4, 5], [0, 1, 3, 4, 5], [0, 1, 2, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 3, 4, 6, 7, 8], [5], [5], [5]]) == 10\n assert candidate(graph = [[1], [0, 2], [1, 3, 4], [2], [2, 5, 6], [4], [4, 7], [6, 8], [7]]) == 10\n assert candidate(graph = [[1, 2, 3], [0, 4, 5], [0, 4, 6], [0, 5, 6], [1, 2, 7, 8], [1, 3, 7, 8], [2, 3, 7, 8], [4, 5, 6, 9], [4, 5, 6, 9], [7, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13]]) == 14\n assert candidate(graph = [[1, 5], [0, 2, 4], [1, 3, 4], [2, 4], [1, 2, 3], [0]]) == 5\n assert candidate(graph = [[1, 3], [0, 2, 4], [1, 3, 5], [0, 2, 6], [1, 5, 7], [2, 4, 8], [3, 8], [4, 8], [5, 6, 7]]) == 8\n assert candidate(graph = [[1, 3], [0, 2], [1, 3, 4], [0, 1, 2], [2, 5], [4]]) == 5\n assert candidate(graph = [[1, 2, 3], [0, 4, 5], [0, 6, 7], [0, 8, 9], [1], [1], [2], [2], [3], [3]]) == 14\n assert candidate(graph = [[1, 5], [0, 2, 6], [1, 3], [2, 5], [5], [0, 1, 3, 4], [1]]) == 7\n assert candidate(graph = [[1, 2, 5], [0, 2, 6], [0, 1, 3], [2], [5], [0, 4, 6], [1, 5]]) == 6\n assert candidate(graph = [[1, 2], [0, 3, 4], [0, 5], [1], [1, 5], [2, 4]]) == 5\n assert candidate(graph = [[1, 3, 4], [0, 2, 4], [1, 3, 4, 5], [0, 2], [0, 1, 2, 5], [2, 4, 6], [5]]) == 6\n assert candidate(graph = [[1], [0, 2, 3, 4], [1, 5], [1, 6], [1, 7], [2], [3], [4, 8], [7]]) == 11\n assert candidate(graph = [[1, 2, 3, 4], [0, 2, 3, 5], [0, 1, 5], [0, 1, 4, 6], [0, 3, 6], [1, 2, 6], [3, 4, 5]]) == 6\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]]) == 12\n assert candidate(graph = [[1, 2, 3, 4, 5], [0, 2, 3, 6, 7], [0, 1, 4, 7, 8], [0, 1, 4, 7, 9], [0, 2, 3, 8, 9, 10], [0, 6, 7, 11], [1, 5, 8, 11], [1, 5, 6, 10, 11], [2, 4, 6, 10], [3, 4, 7, 10, 11], [4, 6, 7, 8, 9, 11], [5, 6, 7, 8, 9, 10]]) == 11\n assert candidate(graph = [[1, 2], [0, 3, 4], [0, 5, 6], [1], [1, 6], [2], [2, 4, 3]]) == 6\n"}, "metadata": {"canonical_parameter_names": ["graph"], "leetcode_dataset_entry_point": "Solution().shortestPathLength", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shortestPathLength = function(graph) {", "container": null, "callable": "shortestPathLength", "parameters": [{"name": "graph", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 848, "task_id": "shifting-letters", "difficulty": "Medium", "problem_description": "You are given a string s of lowercase English letters and an integer array shifts of the same length.\nCall the shift() of a letter, the next letter in the alphabet, (wrapping around so that 'z' becomes 'a').\n\nFor example, shift('a') = 'b', shift('t') = 'u', and shift('z') = 'a'.\n\nNow for each shifts[i] = x, we want to shift the first i + 1 letters of s, x times.\nReturn the final string after all such shifts to s are applied.\n \nExample 1:\n\nInput: s = \"abc\", shifts = [3,5,9]\nOutput: \"rpl\"\nExplanation: We start with \"abc\".\nAfter shifting the first 1 letters of s by 3, we have \"dbc\".\nAfter shifting the first 2 letters of s by 5, we have \"igc\".\nAfter shifting the first 3 letters of s by 9, we have \"rpl\", the answer.\n\nExample 2:\n\nInput: s = \"aaa\", shifts = [1,2,3]\nOutput: \"gfd\"\n\n \nConstraints:\n\n1 <= s.length <= 105\ns consists of lowercase English letters.\nshifts.length == s.length\n0 <= shifts[i] <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"aaa\",shifts = [1, 2, 3]) == \"gfd\"\n assert candidate(s = \"abc\",shifts = [26, 52, 78]) == \"abc\"\n assert candidate(s = \"a\",shifts = [25]) == \"z\"\n assert candidate(s = \"abcdef\",shifts = [0, 0, 0, 0, 0, 0]) == \"abcdef\"\n assert candidate(s = \"abcd\",shifts = [10, 20, 30, 40]) == \"wnur\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",shifts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == \"nnmkhdysldukznamxhqyflquxz\"\n assert candidate(s = \"abcdef\",shifts = [1, 2, 3, 4, 5, 6]) == \"vvuspl\"\n assert candidate(s = \"abcd\",shifts = [0, 0, 0, 0]) == \"abcd\"\n assert candidate(s = \"abc\",shifts = [3, 5, 9]) == \"rpl\"\n assert candidate(s = \"aaa\",shifts = [1000000000, 1000000000, 1000000000]) == \"kym\"\n assert candidate(s = \"a\",shifts = [1000000000]) == \"m\"\n assert candidate(s = \"z\",shifts = [1]) == \"a\"\n assert candidate(s = \"zzz\",shifts = [1000000000, 1000000000, 1000000000]) == \"jxl\"\n assert candidate(s = \"xyz\",shifts = [1, 2, 3]) == \"ddc\"\n assert candidate(s = \"abcdef\",shifts = [1, 1, 1, 1, 1, 1]) == \"gggggg\"\n assert candidate(s = \"zzz\",shifts = [1000000000, 1000000000, 1000000000]) == \"jxl\"\n assert candidate(s = \"abcd\",shifts = [1, 1, 1, 1]) == \"eeee\"\n assert candidate(s = \"qzcvxnbtrslkjhgf\",shifts = [97, 86, 75, 64, 53, 42, 31, 20, 9, 8, 7, 6, 5, 4, 3, 2]) == \"iytpfusfjbmexqlh\"\n assert candidate(s = \"aaaabbbbcccc\",shifts = [97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108]) == \"ipvafiklmljg\"\n assert candidate(s = \"abcabcabc\",shifts = [1, 2, 3, 1, 2, 3, 1, 2, 3]) == \"ssrmmlggf\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",shifts = [26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26]) == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"programming\",shifts = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == \"programming\"\n assert candidate(s = \"abcdefgh\",shifts = [1000000000, 500000000, 250000000, 125000000, 62500000, 31250000, 15625000, 7812500]) == \"etozspob\"\n assert candidate(s = \"hello\",shifts = [5, 5, 5, 5, 5]) == \"gyavt\"\n assert candidate(s = \"abcd\",shifts = [25, 24, 23, 22]) == \"qsvz\"\n assert candidate(s = \"python\",shifts = [97, 97, 97, 97, 97, 97]) == \"zprmag\"\n assert candidate(s = \"hello\",shifts = [25, 98, 23, 56, 78]) == \"bzmpo\"\n assert candidate(s = \"abc\",shifts = [26, 52, 78]) == \"abc\"\n assert candidate(s = \"rollingupdates\",shifts = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7]) == \"ybfntimmuwirtz\"\n assert candidate(s = \"xyz\",shifts = [26, 52, 78]) == \"xyz\"\n assert candidate(s = \"python\",shifts = [1000000000, 999999999, 888888888, 777777777, 666666666, 555555555]) == \"mjtdnw\"\n assert candidate(s = \"programming\",shifts = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21]) == \"ghbosstgnbb\"\n assert candidate(s = \"xyzabc\",shifts = [3, 2, 1, 0, 5, 4]) == \"mkjjkg\"\n assert candidate(s = \"aabbccdd\",shifts = [9, 8, 7, 6, 5, 4, 3, 2]) == \"sjcvqlif\"\n assert candidate(s = \"python\",shifts = [2147483647, 2147483646, 2147483645, 2147483644, 2147483643, 2147483642]) == \"iutmzf\"\n assert candidate(s = \"qponmlkjihgfedcba\",shifts = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == \"ttuwzdiovdmwhtguj\"\n assert candidate(s = \"thisisaverylongstring\",shifts = [5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113]) == \"enhgjcrpvdzxjnfkcljtl\"\n assert candidate(s = \"abcdefg\",shifts = [100000000, 200000000, 300000000, 400000000, 500000000, 600000000, 700000000]) == \"sxgtkfe\"\n assert candidate(s = \"abcdabcdabcd\",shifts = [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]) == \"eedbuutrkkjh\"\n assert candidate(s = \"zzzzzzzzzz\",shifts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == \"cbzwsnhasj\"\n assert candidate(s = \"zzzzzz\",shifts = [1000000000, 999999999, 888888888, 777777777, 666666666, 555555555]) == \"wkzvyi\"\n assert candidate(s = \"a\",shifts = [0]) == \"a\"\n assert candidate(s = \"zzzzzzzzzz\",shifts = [999999999, 888888888, 777777777, 666666666, 555555555, 444444444, 333333333, 222222222, 111111111, 100000000]) == \"ynjmwnlqcv\"\n assert candidate(s = \"abcdefghijklmnop\",shifts = [1000000000, 2000000000, 3000000000, 4000000000, 5000000000, 6000000000, 7000000000, 8000000000, 9000000000, 10000000000, 11000000000, 12000000000, 13000000000, 14000000000, 15000000000, 16000000000]) == \"ujmdibidmjutghwz\"\n assert candidate(s = \"zzzzzzzzzz\",shifts = [1000000000, 900000000, 800000000, 700000000, 600000000, 500000000, 400000000, 300000000, 200000000, 100000000]) == \"nblrtrlbnv\"\n assert candidate(s = \"xyzxyzxyz\",shifts = [25, 24, 23, 22, 21, 20, 19, 18, 17]) == \"egjkpvzhq\"\n assert candidate(s = \"hello\",shifts = [1, 2, 3, 4, 5]) == \"wsxut\"\n assert candidate(s = \"a\",shifts = [1]) == \"b\"\n assert candidate(s = \"abcdef\",shifts = [1000000000, 2000000000, 3000000000, 4000000000, 5000000000, 6000000000]) == \"shkbgz\"\n assert candidate(s = \"programming\",shifts = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]) == \"herulvducoj\"\n assert candidate(s = \"xyzabc\",shifts = [25, 2, 3, 4, 5, 6]) == \"qsrpmi\"\n assert candidate(s = \"abcde\",shifts = [5, 10, 15, 20, 25]) == \"xtkwd\"\n assert candidate(s = \"shift\",shifts = [97, 98, 99, 100, 101]) == \"tpwyq\"\n assert candidate(s = \"zzzzzzzzzz\",shifts = [100000000, 200000000, 300000000, 400000000, 500000000, 600000000, 700000000, 800000000, 900000000, 1000000000]) == \"nrzlbvtvbl\"\n assert candidate(s = \"hello\",shifts = [10, 20, 30, 40, 50]) == \"bobxm\"\n assert candidate(s = \"testcase\",shifts = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == \"lntnqjxg\"\n assert candidate(s = \"xyz\",shifts = [1000000000, 1000000000, 1]) == \"wla\"\n assert candidate(s = \"teststring\",shifts = [123, 456, 789, 101112, 131415, 161718, 192021, 222324, 252627, 282930, 313233, 343536]) == \"iaastjjpwe\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",shifts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == \"nnmkhdysldukznamxhqyflquxz\"\n assert candidate(s = \"abcd\",shifts = [0, 0, 0, 0]) == \"abcd\"\n assert candidate(s = \"abcdef\",shifts = [26, 52, 78, 104, 130, 156]) == \"abcdef\"\n assert candidate(s = \"abz\",shifts = [1, 1, 25]) == \"bby\"\n assert candidate(s = \"mnopqr\",shifts = [26, 25, 24, 23, 22, 21]) == \"xyadhm\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",shifts = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == \"noonlieztmevlaobnyirzgmrvy\"\n assert candidate(s = \"wraparound\",shifts = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == \"ztamtfwvgn\"\n assert candidate(s = \"hellothere\",shifts = [1000000000, 500000000, 250000000, 125000000, 62500000, 31250000, 15625000, 7812500, 3906250, 1953125]) == \"almwrsengj\"\n assert candidate(s = \"python\",shifts = [25, 24, 23, 22, 21, 20]) == \"uebsdh\"\n assert candidate(s = \"abcdefghij\",shifts = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == \"otcpgbadkv\"\n assert candidate(s = \"zzzzzzzz\",shifts = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000]) == \"rfthvjxl\"\n assert candidate(s = \"mnbvcxzlkjhgfdsapoiuytrewq\",shifts = [26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == \"zaplvubtzgnwgqsoshswtibkzr\"\n assert candidate(s = \"z\",shifts = [26]) == \"z\"\n assert candidate(s = \"aabbccddeeff\",shifts = [1000000000, 900000000, 800000000, 700000000, 600000000, 500000000, 400000000, 300000000, 200000000, 100000000, 50000000, 25000000]) == \"ymxdgezpckpr\"\n assert candidate(s = \"aaaabbbb\",shifts = [1, 2, 3, 4, 5, 6, 7, 8]) == \"kjhebwqj\"\n assert candidate(s = \"aaaaabbbbb\",shifts = [100, 200, 300, 400, 500, 100, 200, 300, 400, 500]) == \"kowiytxfrh\"\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",shifts = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == \"zxvtrpnljhfdbzxvtrpnljhfdb\"\n assert candidate(s = \"abcdefg\",shifts = [1, 2, 3, 4, 5, 6, 7]) == \"ccbzwsn\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",shifts = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == \"npswbhowfpamzncsjbuojfcazz\"\n assert candidate(s = \"abcxyz\",shifts = [0, 1, 2, 25, 50, 75]) == \"xyyrtw\"\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",shifts = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == \"mmnpswbhowfpamzncsjbuojfca\"\n assert candidate(s = \"mnopqr\",shifts = [3, 2, 1, 0, 5, 4]) == \"bzyyzv\"\n assert candidate(s = \"xyz\",shifts = [25, 50, 75]) == \"rtw\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",shifts = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == \"npswbhowfpamzncsjbuojfcazz\"\n assert candidate(s = \"mnopqr\",shifts = [1000000000, 500000000, 250000000, 125000000, 62500000, 31250000, 15625000]) == \"ixsdwt\"\n assert candidate(s = \"programming\",shifts = [1000000000, 500000000, 250000000, 125000000, 62500000, 31250000, 15625000, 7812500, 3906250, 1953125, 976562, 488281, 244140]) == \"kartwblxzui\"\n assert candidate(s = \"qznooo\",shifts = [987654321, 123456789, 987654321, 123456789, 987654321, 123456789]) == \"skxhgp\"\n assert candidate(s = \"bxyz\",shifts = [2, 3, 25, 1]) == \"gaya\"\n assert candidate(s = \"boundary\",shifts = [26, 26, 26, 26, 26, 26, 26, 26]) == \"boundary\"\n assert candidate(s = \"programming\",shifts = [26, 52, 78, 104, 130, 156, 182, 208, 234, 260, 286]) == \"programming\"\n"}, "metadata": {"canonical_parameter_names": ["s", "shifts"], "leetcode_dataset_entry_point": "Solution().shiftingLetters", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shiftingLetters = function(s, shifts) {", "container": null, "callable": "shiftingLetters", "parameters": [{"name": "s", "type": "string"}, {"name": "shifts", "type": "number[]"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 849, "task_id": "maximize-distance-to-closest-person", "difficulty": "Medium", "problem_description": "You are given an array representing a row of seats where seats[i] = 1 represents a person sitting in the ith seat, and seats[i] = 0 represents that the ith seat is empty (0-indexed).\nThere is at least one empty seat, and at least one person sitting.\nAlex wants to sit in the seat such that the distance between him and the closest person to him is maximized. \nReturn that maximum distance to the closest person.\n \nExample 1:\n\n\nInput: seats = [1,0,0,0,1,0,1]\nOutput: 2\nExplanation: \nIf Alex sits in the second open seat (i.e. seats[2]), then the closest person has distance 2.\nIf Alex sits in any other open seat, the closest person has distance 1.\nThus, the maximum distance to the closest person is 2.\n\nExample 2:\n\nInput: seats = [1,0,0,0]\nOutput: 3\nExplanation: \nIf Alex sits in the last seat (i.e. seats[3]), the closest person is 3 seats away.\nThis is the maximum distance possible, so the answer is 3.\n\nExample 3:\n\nInput: seats = [0,1]\nOutput: 1\n\n \nConstraints:\n\n2 <= seats.length <= 2 * 104\nseats[i] is 0 or 1.\nAt least one seat is empty.\nAt least one seat is occupied.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(seats = [0, 0, 0, 1, 0, 1, 0, 0, 0]) == 3\n assert candidate(seats = [0, 0, 1, 0, 0, 0, 0, 1]) == 2\n assert candidate(seats = [0, 0, 0, 1, 0, 0, 0]) == 3\n assert candidate(seats = [1, 0, 0, 0]) == 3\n assert candidate(seats = [0, 1]) == 1\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 1]) == 3\n assert candidate(seats = [0, 0, 1, 0, 0, 0, 0, 1, 0, 0]) == 2\n assert candidate(seats = [1, 1, 0, 0, 0, 0, 1, 1]) == 2\n assert candidate(seats = [0, 0, 0, 1]) == 3\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 1]) == 3\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 1]) == 4\n assert candidate(seats = [1, 0, 0, 1, 0, 0, 1]) == 1\n assert candidate(seats = [1, 0, 0, 0, 1, 0, 1]) == 2\n assert candidate(seats = [1, 0, 1, 0, 1, 0, 1]) == 1\n assert candidate(seats = [0, 0, 1, 0, 1, 0, 1, 0, 0]) == 2\n assert candidate(seats = [0, 0, 1, 0, 1, 0, 0, 0]) == 3\n assert candidate(seats = [1, 0, 0, 1, 0, 0, 0, 0, 1]) == 2\n assert candidate(seats = [0, 0, 0, 1, 0, 0, 0, 0, 0, 1]) == 3\n assert candidate(seats = [1, 0, 0, 1, 0, 0, 0, 1]) == 2\n assert candidate(seats = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 5\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 18\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 19\n assert candidate(seats = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]) == 5\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 19\n assert candidate(seats = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]) == 4\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 27\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 29\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 22\n assert candidate(seats = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 14\n assert candidate(seats = [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]) == 3\n assert candidate(seats = [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1]) == 10\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 13\n assert candidate(seats = [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 6\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 14\n assert candidate(seats = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]) == 6\n assert candidate(seats = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == 1\n assert candidate(seats = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]) == 5\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 7\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 9\n assert candidate(seats = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == 1\n assert candidate(seats = [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]) == 5\n assert candidate(seats = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]) == 6\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 15\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 5\n assert candidate(seats = [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0]) == 3\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]) == 9\n assert candidate(seats = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]) == 9\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 51\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 6\n assert candidate(seats = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 7\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 19\n assert candidate(seats = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 10\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1]) == 3\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 11\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 19\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 7\n assert candidate(seats = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 6\n assert candidate(seats = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 1\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 16\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]) == 4\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 10\n assert candidate(seats = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 10\n assert candidate(seats = [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1]) == 2\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 20\n assert candidate(seats = [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 18\n assert candidate(seats = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 1\n assert candidate(seats = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 5\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 33\n assert candidate(seats = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]) == 3\n assert candidate(seats = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 11\n assert candidate(seats = [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1]) == 3\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 14\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 31\n assert candidate(seats = [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 13\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 11\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 9\n assert candidate(seats = [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]) == 3\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 10\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 7\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]) == 3\n assert candidate(seats = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 1\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]) == 13\n assert candidate(seats = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 6\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 11\n assert candidate(seats = [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1]) == 17\n assert candidate(seats = [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 4\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]) == 3\n assert candidate(seats = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]) == 5\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]) == 5\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]) == 23\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 8\n assert candidate(seats = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == 1\n assert candidate(seats = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 9\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 13\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 6\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 8\n assert candidate(seats = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 1\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 25\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 14\n assert candidate(seats = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]) == 1\n assert candidate(seats = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 1\n assert candidate(seats = [0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1]) == 2\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 71\n assert candidate(seats = [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 9\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 12\n assert candidate(seats = [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 20\n assert candidate(seats = [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 6\n assert candidate(seats = [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 11\n assert candidate(seats = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 1\n assert candidate(seats = [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]) == 8\n assert candidate(seats = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]) == 3\n assert candidate(seats = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]) == 8\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 8\n assert candidate(seats = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 5\n assert candidate(seats = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]) == 6\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 20\n assert candidate(seats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 30\n assert candidate(seats = [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0]) == 3\n assert candidate(seats = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 12\n assert candidate(seats = [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]) == 3\n"}, "metadata": {"canonical_parameter_names": ["seats"], "leetcode_dataset_entry_point": "Solution().maxDistToClosest", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxDistToClosest = function(seats) {", "container": null, "callable": "maxDistToClosest", "parameters": [{"name": "seats", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 850, "task_id": "rectangle-area-ii", "difficulty": "Hard", "problem_description": "You are given a 2D array of axis-aligned rectangles. Each rectangle[i] = [xi1, yi1, xi2, yi2] denotes the ith rectangle where (xi1, yi1) are the coordinates of the bottom-left corner, and (xi2, yi2) are the coordinates of the top-right corner.\nCalculate the total area covered by all rectangles in the plane. Any area covered by two or more rectangles should only be counted once.\nReturn the total area. Since the answer may be too large, return it modulo 109 + 7.\n \nExample 1:\n\n\nInput: rectangles = [[0,0,2,2],[1,0,2,3],[1,0,3,1]]\nOutput: 6\nExplanation: A total area of 6 is covered by all three rectangles, as illustrated in the picture.\nFrom (1,1) to (2,2), the green and red rectangles overlap.\nFrom (1,0) to (2,3), all three rectangles overlap.\n\nExample 2:\n\nInput: rectangles = [[0,0,1000000000,1000000000]]\nOutput: 49\nExplanation: The answer is 1018 modulo (109 + 7), which is 49.\n\n \nConstraints:\n\n1 <= rectangles.length <= 200\nrectanges[i].length == 4\n0 <= xi1, yi1, xi2, yi2 <= 109\nxi1 <= xi2\nyi1 <= yi2\nAll rectangles have non zero area.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(rectangles = [[0, 0, 1, 1], [1, 1, 2, 2], [2, 2, 3, 3]]) == 3\n assert candidate(rectangles = [[0, 0, 1, 10], [0, 0, 10, 1], [1, 1, 2, 11], [1, 1, 11, 2]]) == 38\n assert candidate(rectangles = [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1]]) == 3\n assert candidate(rectangles = [[0, 0, 5, 5], [2, 2, 7, 7], [4, 4, 9, 9]]) == 57\n assert candidate(rectangles = [[0, 0, 3, 3], [1, 1, 4, 4], [2, 2, 5, 5], [3, 3, 6, 6]]) == 24\n assert candidate(rectangles = [[1, 1, 5, 5], [2, 2, 6, 6], [3, 3, 7, 7]]) == 30\n assert candidate(rectangles = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6]]) == 10\n assert candidate(rectangles = [[0, 0, 10, 10], [5, 5, 15, 15], [10, 10, 20, 20]]) == 250\n assert candidate(rectangles = [[0, 0, 2, 2], [1, 0, 2, 3], [1, 0, 3, 1]]) == 6\n assert candidate(rectangles = [[1, 1, 2, 2], [1, 1, 3, 3], [2, 2, 3, 3]]) == 4\n assert candidate(rectangles = [[0, 0, 5, 5], [5, 5, 10, 10], [0, 5, 5, 10]]) == 75\n assert candidate(rectangles = [[0, 0, 5, 5], [5, 5, 10, 10], [0, 5, 10, 10]]) == 75\n assert candidate(rectangles = [[1, 1, 3, 3], [2, 2, 4, 4], [3, 3, 5, 5]]) == 10\n assert candidate(rectangles = [[0, 0, 1000000000, 1000000000]]) == 49\n assert candidate(rectangles = [[10, 10, 20, 20], [15, 15, 25, 25], [20, 20, 30, 30]]) == 250\n assert candidate(rectangles = [[0, 0, 10, 10], [1, 1, 9, 9], [2, 2, 8, 8], [3, 3, 7, 7], [4, 4, 6, 6]]) == 100\n assert candidate(rectangles = [[0, 0, 5, 5], [0, 5, 5, 10], [5, 0, 10, 5], [5, 5, 10, 10], [2, 2, 8, 8]]) == 100\n assert candidate(rectangles = [[10, 10, 20, 20], [15, 15, 25, 25], [20, 20, 30, 30], [25, 25, 35, 35], [30, 30, 40, 40], [35, 35, 45, 45]]) == 475\n assert candidate(rectangles = [[0, 0, 1, 2], [1, 0, 2, 2], [2, 0, 3, 2], [0, 1, 1, 3], [1, 1, 2, 3], [2, 1, 3, 3]]) == 9\n assert candidate(rectangles = [[1, 1, 3, 3], [3, 1, 5, 3], [1, 3, 3, 5], [3, 3, 5, 5], [2, 2, 4, 4]]) == 16\n assert candidate(rectangles = [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1], [0, 1, 1, 2], [1, 1, 2, 2], [2, 1, 3, 2]]) == 6\n assert candidate(rectangles = [[1, 1, 1000, 1000], [2, 2, 999, 999], [3, 3, 998, 998], [4, 4, 997, 997], [5, 5, 996, 996]]) == 998001\n assert candidate(rectangles = [[0, 0, 10, 10], [1, 1, 9, 9], [2, 2, 8, 8], [3, 3, 7, 7], [4, 4, 6, 6], [5, 5, 5, 5]]) == 100\n assert candidate(rectangles = [[1, 1, 10, 10], [2, 2, 9, 9], [3, 3, 8, 8], [4, 4, 7, 7], [5, 5, 6, 6], [6, 6, 5, 5], [7, 7, 4, 4], [8, 8, 3, 3], [9, 9, 2, 2]]) == 81\n assert candidate(rectangles = [[1, 1, 5, 5], [6, 6, 10, 10], [11, 11, 15, 15], [16, 16, 20, 20], [21, 21, 25, 25]]) == 80\n assert candidate(rectangles = [[1, 1, 5, 5], [2, 2, 6, 6], [3, 3, 7, 7], [4, 4, 8, 8], [5, 5, 9, 9], [6, 6, 10, 10], [7, 7, 11, 11], [8, 8, 12, 12], [9, 9, 13, 13]]) == 72\n assert candidate(rectangles = [[0, 0, 10, 5], [5, 0, 15, 10], [10, 5, 20, 15], [15, 10, 25, 20], [20, 15, 30, 25]]) == 350\n assert candidate(rectangles = [[0, 0, 5, 5], [1, 1, 6, 6], [2, 2, 7, 7], [3, 3, 8, 8], [4, 4, 9, 9], [5, 5, 10, 10], [6, 6, 11, 11]]) == 79\n assert candidate(rectangles = [[0, 0, 2, 2], [2, 0, 4, 2], [4, 0, 6, 2], [2, 2, 4, 4], [4, 2, 6, 4], [1, 1, 5, 5], [3, 3, 7, 7]]) == 37\n assert candidate(rectangles = [[0, 0, 10, 10], [1, 2, 11, 12], [2, 1, 12, 11], [3, 3, 13, 13], [4, 4, 14, 14], [5, 5, 15, 15]]) == 197\n assert candidate(rectangles = [[0, 0, 2000000000, 2000000000], [500000000, 500000000, 2500000000, 2500000000], [1000000000, 1000000000, 3000000000, 3000000000]]) == 500000371\n assert candidate(rectangles = [[1, 1, 100, 100], [1, 50, 200, 150], [1, 100, 300, 200], [1, 150, 400, 250], [1, 200, 500, 300]]) == 99601\n assert candidate(rectangles = [[0, 0, 1000000000, 1000000000], [1000000000, 0, 2000000000, 1000000000]]) == 98\n assert candidate(rectangles = [[0, 0, 20, 20], [0, 10, 20, 30], [10, 0, 30, 20], [10, 10, 30, 30]]) == 900\n assert candidate(rectangles = [[0, 0, 1000, 1000], [500, 500, 1500, 1500], [1000, 1000, 2000, 2000], [250, 250, 750, 750], [1250, 1250, 1750, 1750]]) == 2500000\n assert candidate(rectangles = [[0, 0, 10, 10], [2, 2, 8, 8], [4, 4, 12, 12], [6, 6, 14, 14]]) == 156\n assert candidate(rectangles = [[0, 0, 5, 5], [5, 5, 10, 10], [0, 5, 5, 10], [5, 0, 10, 5]]) == 100\n assert candidate(rectangles = [[1, 1, 1000000000, 1000000000], [500000000, 500000000, 1500000000, 1500000000], [1000000000, 1000000000, 2000000000, 2000000000]]) == 500000141\n assert candidate(rectangles = [[0, 0, 10, 10], [0, 10, 10, 20], [0, 20, 10, 30], [0, 30, 10, 40], [0, 40, 10, 50]]) == 500\n assert candidate(rectangles = [[0, 0, 1000000000, 1000000000], [100000000, 100000000, 900000000, 900000000], [200000000, 200000000, 800000000, 800000000]]) == 49\n assert candidate(rectangles = [[0, 0, 100, 50], [10, 10, 90, 40], [20, 20, 80, 30], [30, 30, 70, 20], [40, 40, 60, 10]]) == 5000\n assert candidate(rectangles = [[0, 0, 5, 10], [5, 0, 10, 15], [10, 0, 15, 20], [15, 0, 20, 25], [0, 10, 5, 20], [5, 15, 10, 25], [10, 20, 15, 30], [15, 25, 20, 35]]) == 550\n assert candidate(rectangles = [[0, 0, 10, 5], [5, 0, 15, 10], [10, 0, 20, 5], [5, 5, 15, 15], [10, 5, 20, 10], [15, 5, 25, 15]]) == 300\n assert candidate(rectangles = [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1], [3, 0, 4, 1], [4, 0, 5, 1], [5, 0, 6, 1], [6, 0, 7, 1], [7, 0, 8, 1], [8, 0, 9, 1]]) == 9\n assert candidate(rectangles = [[0, 0, 1000000000, 1000000000], [100, 100, 900, 900], [200, 200, 800, 800]]) == 49\n assert candidate(rectangles = [[1, 1, 2, 2], [3, 3, 4, 4], [5, 5, 6, 6], [1, 3, 2, 4], [3, 1, 4, 2], [3, 5, 4, 6], [5, 3, 6, 4], [5, 1, 6, 2], [1, 5, 2, 6]]) == 9\n assert candidate(rectangles = [[10, 10, 20, 20], [15, 15, 25, 25], [10, 20, 20, 30], [20, 10, 30, 20]]) == 325\n assert candidate(rectangles = [[0, 0, 10, 10], [10, 10, 20, 20], [20, 20, 30, 30], [30, 30, 40, 40], [40, 40, 50, 50]]) == 500\n assert candidate(rectangles = [[1, 1, 5, 5], [2, 2, 6, 6], [3, 3, 7, 7], [4, 4, 8, 8], [5, 5, 9, 9], [6, 6, 10, 10]]) == 51\n assert candidate(rectangles = [[10, 10, 15, 15], [10, 15, 15, 20], [15, 10, 20, 15], [15, 15, 20, 20], [10, 20, 15, 25], [15, 20, 20, 25], [10, 10, 20, 20]]) == 150\n assert candidate(rectangles = [[0, 0, 1000000000, 1000000000], [500000000, 500000000, 1500000000, 1500000000]]) == 750000091\n assert candidate(rectangles = [[0, 0, 1000000000, 1000000000], [1, 1, 999999999, 999999999]]) == 49\n assert candidate(rectangles = [[0, 0, 100, 100], [50, 50, 150, 150], [100, 100, 200, 200], [150, 150, 250, 250]]) == 32500\n assert candidate(rectangles = [[0, 0, 1, 2], [0, 1, 1, 3], [1, 0, 2, 2], [1, 1, 2, 3]]) == 6\n assert candidate(rectangles = [[0, 0, 3, 3], [1, 1, 4, 4], [2, 2, 5, 5], [3, 3, 6, 6], [4, 4, 7, 7], [5, 5, 8, 8]]) == 34\n assert candidate(rectangles = [[1, 1, 2, 2], [2, 2, 3, 3], [3, 3, 4, 4], [1, 3, 4, 4], [3, 1, 4, 3]]) == 7\n assert candidate(rectangles = [[0, 0, 5, 5], [0, 5, 5, 10], [0, 10, 5, 15], [0, 15, 5, 20], [5, 0, 10, 5], [5, 5, 10, 10], [5, 10, 10, 15], [5, 15, 10, 20]]) == 200\n assert candidate(rectangles = [[0, 0, 3, 3], [1, 1, 4, 4], [2, 2, 5, 5], [3, 3, 6, 6], [4, 4, 7, 7]]) == 29\n assert candidate(rectangles = [[0, 0, 10, 10], [1, 1, 9, 9], [2, 2, 8, 8], [3, 3, 7, 7], [4, 4, 6, 6], [0, 0, 5, 5], [5, 5, 10, 10], [0, 5, 5, 10], [5, 0, 10, 5]]) == 100\n assert candidate(rectangles = [[0, 0, 100000000, 100000000], [10000000, 10000000, 90000000, 90000000], [20000000, 20000000, 80000000, 80000000], [30000000, 30000000, 70000000, 70000000], [40000000, 40000000, 60000000, 60000000]]) == 930000007\n assert candidate(rectangles = [[100, 100, 200, 200], [200, 200, 300, 300], [300, 300, 400, 400], [400, 400, 500, 500], [500, 500, 600, 600]]) == 50000\n assert candidate(rectangles = [[0, 0, 100, 100], [25, 25, 75, 75], [50, 50, 125, 125]]) == 13125\n assert candidate(rectangles = [[0, 0, 500, 500], [100, 100, 600, 600], [200, 200, 700, 700], [300, 300, 800, 800], [400, 400, 900, 900]]) == 610000\n assert candidate(rectangles = [[0, 0, 10, 10], [1, 1, 11, 11], [2, 2, 12, 12], [3, 3, 13, 13], [4, 4, 14, 14]]) == 176\n assert candidate(rectangles = [[0, 0, 200, 200], [100, 100, 300, 300], [50, 50, 150, 150], [150, 150, 250, 250], [250, 250, 350, 350], [0, 100, 100, 200], [100, 0, 200, 100]]) == 77500\n assert candidate(rectangles = [[0, 0, 100, 200], [0, 100, 200, 300], [0, 200, 300, 400], [100, 0, 200, 100], [200, 0, 300, 200], [300, 0, 400, 300]]) == 150000\n assert candidate(rectangles = [[0, 0, 1000000, 1000000], [0, 0, 500000, 500000], [500000, 500000, 1000000, 1000000], [250000, 250000, 750000, 750000]]) == 999993007\n assert candidate(rectangles = [[0, 0, 10, 10], [0, 5, 10, 15], [0, 10, 10, 20], [5, 0, 15, 10], [5, 5, 15, 15], [5, 10, 15, 20], [10, 0, 20, 10], [10, 5, 20, 15], [10, 10, 20, 20]]) == 400\n assert candidate(rectangles = [[10, 10, 20, 20], [15, 15, 25, 25], [20, 20, 30, 30], [25, 25, 35, 35]]) == 325\n assert candidate(rectangles = [[0, 0, 50, 50], [0, 50, 50, 100], [50, 0, 100, 50], [50, 50, 100, 100], [25, 25, 75, 75]]) == 10000\n assert candidate(rectangles = [[1, 1, 2, 2], [2, 2, 3, 3], [3, 3, 4, 4], [4, 4, 5, 5], [5, 5, 6, 6], [1, 5, 2, 6], [2, 5, 3, 6], [3, 5, 4, 6], [4, 5, 5, 6], [5, 1, 6, 2], [5, 2, 6, 3], [5, 3, 6, 4]]) == 12\n assert candidate(rectangles = [[1, 1, 2, 2], [2, 2, 3, 3], [3, 3, 4, 4], [4, 4, 5, 5]]) == 4\n assert candidate(rectangles = [[10, 10, 20, 20], [25, 25, 35, 35], [15, 15, 25, 25], [30, 30, 40, 40], [5, 5, 15, 15], [45, 45, 55, 55]]) == 525\n assert candidate(rectangles = [[0, 0, 2, 2], [0, 2, 2, 4], [2, 0, 4, 2], [2, 2, 4, 4]]) == 16\n assert candidate(rectangles = [[1, 1, 10, 10], [2, 2, 9, 9], [3, 3, 8, 8], [4, 4, 7, 7], [5, 5, 6, 6], [6, 6, 5, 5], [7, 7, 4, 4], [8, 8, 3, 3], [9, 9, 2, 2], [10, 10, 1, 1]]) == 81\n assert candidate(rectangles = [[100, 100, 200, 200], [150, 150, 250, 250], [200, 200, 300, 300], [250, 250, 350, 350], [300, 300, 400, 400]]) == 40000\n assert candidate(rectangles = [[0, 0, 100, 100], [50, 50, 150, 150], [100, 100, 200, 200], [125, 125, 175, 175]]) == 25000\n assert candidate(rectangles = [[0, 0, 100, 100], [50, 50, 150, 150], [200, 200, 300, 300], [0, 100, 100, 200], [100, 0, 200, 100], [100, 100, 200, 200]]) == 50000\n assert candidate(rectangles = [[0, 0, 2, 2], [0, 2, 2, 4], [2, 0, 4, 2], [2, 2, 4, 4], [1, 1, 3, 3]]) == 16\n assert candidate(rectangles = [[0, 0, 10, 10], [1, 2, 9, 8], [2, 4, 8, 6], [3, 6, 7, 4], [4, 8, 6, 2]]) == 100\n assert candidate(rectangles = [[0, 0, 5, 10], [5, 5, 15, 15], [10, 0, 20, 5], [0, 10, 20, 20]]) == 350\n assert candidate(rectangles = [[0, 0, 100, 100], [10, 10, 90, 90], [20, 20, 80, 80], [30, 30, 70, 70]]) == 10000\n assert candidate(rectangles = [[0, 0, 10, 10], [0, 0, 10, 5], [5, 0, 10, 10], [0, 5, 10, 10]]) == 100\n assert candidate(rectangles = [[1, 1, 1000000000, 1000000000], [100000000, 100000000, 900000000, 900000000], [200000000, 200000000, 800000000, 800000000], [300000000, 300000000, 700000000, 700000000]]) == 64\n assert candidate(rectangles = [[0, 0, 1000000000, 1000000000], [500000000, 500000000, 1500000000, 1500000000], [1000000000, 1000000000, 2000000000, 2000000000]]) == 500000126\n assert candidate(rectangles = [[0, 0, 10, 10], [2, 2, 12, 12], [5, 5, 15, 15], [8, 8, 18, 18]]) == 238\n assert candidate(rectangles = [[0, 0, 100, 100], [10, 10, 90, 90], [20, 20, 80, 80], [30, 30, 70, 70], [40, 40, 60, 60]]) == 10000\n assert candidate(rectangles = [[0, 0, 100, 100], [50, 0, 150, 100], [100, 0, 200, 100], [150, 0, 250, 100], [200, 0, 300, 100]]) == 30000\n assert candidate(rectangles = [[0, 0, 50, 50], [5, 5, 55, 55], [10, 10, 60, 60], [15, 15, 65, 65], [20, 20, 70, 70]]) == 4400\n assert candidate(rectangles = [[0, 0, 1000000000, 1000000000], [500000000, 500000000, 1500000000, 1500000000], [250000000, 250000000, 750000000, 750000000]]) == 750000091\n assert candidate(rectangles = [[1, 1, 2, 2], [1, 1, 3, 3], [1, 1, 4, 4], [1, 1, 5, 5], [1, 1, 6, 6], [1, 1, 7, 7], [1, 1, 8, 8], [1, 1, 9, 9], [1, 1, 10, 10], [1, 1, 11, 11], [1, 1, 12, 12], [1, 1, 13, 13], [1, 1, 14, 14]]) == 169\n assert candidate(rectangles = [[0, 0, 3, 3], [1, 1, 4, 4], [2, 2, 5, 5], [3, 3, 6, 6], [4, 4, 7, 7], [5, 5, 8, 8], [6, 6, 9, 9]]) == 39\n assert candidate(rectangles = [[0, 0, 10, 1], [1, 1, 20, 2], [2, 2, 30, 3], [3, 3, 40, 4], [4, 4, 50, 5]]) == 140\n assert candidate(rectangles = [[0, 0, 1, 2], [1, 0, 2, 3], [2, 0, 3, 4], [3, 0, 4, 5], [4, 0, 5, 6], [5, 0, 6, 7], [6, 0, 7, 8], [7, 0, 8, 9], [8, 0, 9, 10]]) == 54\n assert candidate(rectangles = [[0, 0, 1, 1], [1, 1, 2, 2], [2, 2, 3, 3], [3, 3, 4, 4], [4, 4, 5, 5]]) == 5\n assert candidate(rectangles = [[100, 100, 200, 200], [200, 200, 300, 300], [300, 300, 400, 400], [150, 150, 250, 250], [250, 250, 350, 350], [350, 350, 450, 450]]) == 47500\n assert candidate(rectangles = [[0, 0, 10, 20], [5, 0, 15, 25], [10, 0, 20, 30], [15, 0, 25, 35], [20, 0, 30, 40]]) == 950\n assert candidate(rectangles = [[0, 0, 3, 3], [0, 3, 3, 6], [3, 0, 6, 3], [3, 3, 6, 6], [1, 1, 5, 5], [1, 4, 5, 8], [4, 1, 8, 5], [4, 4, 8, 8]]) == 60\n assert candidate(rectangles = [[1, 1, 1000000, 1000000], [2, 2, 999999, 999999], [3, 3, 999998, 999998]]) == 997993008\n assert candidate(rectangles = [[100, 100, 200, 200], [150, 150, 250, 250], [200, 200, 300, 300], [250, 250, 350, 350], [300, 300, 400, 400], [350, 350, 450, 450]]) == 47500\n assert candidate(rectangles = [[0, 0, 100, 100], [50, 50, 150, 150], [100, 100, 200, 200], [25, 25, 75, 75]]) == 25000\n assert candidate(rectangles = [[0, 0, 1, 2], [1, 0, 2, 3], [2, 0, 3, 4], [3, 0, 4, 5], [4, 0, 5, 6]]) == 20\n assert candidate(rectangles = [[0, 0, 1, 1], [1, 1, 2, 2], [2, 2, 3, 3], [3, 3, 4, 4], [4, 4, 5, 5], [5, 5, 6, 6], [6, 6, 7, 7], [7, 7, 8, 8], [8, 8, 9, 9], [9, 9, 10, 10]]) == 10\n assert candidate(rectangles = [[0, 0, 10, 10], [0, 5, 5, 15], [5, 0, 15, 5], [5, 5, 15, 15]]) == 225\n assert candidate(rectangles = [[0, 0, 100, 100], [10, 10, 110, 110], [20, 20, 120, 120], [30, 30, 130, 130], [40, 40, 140, 140]]) == 17600\n"}, "metadata": {"canonical_parameter_names": ["rectangles"], "leetcode_dataset_entry_point": "Solution().rectangleArea", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var rectangleArea = function(rectangles) {", "container": null, "callable": "rectangleArea", "parameters": [{"name": "rectangles", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 851, "task_id": "loud-and-rich", "difficulty": "Medium", "problem_description": "There is a group of n people labeled from 0 to n - 1 where each person has a different amount of money and a different level of quietness.\nYou are given an array richer where richer[i] = [ai, bi] indicates that ai has more money than bi and an integer array quiet where quiet[i] is the quietness of the ith person. All the given data in richer are logically correct (i.e., the data will not lead you to a situation where x is richer than y and y is richer than x at the same time).\nReturn an integer array answer where answer[x] = y if y is the least quiet person (that is, the person y with the smallest value of quiet[y]) among all people who definitely have equal to or more money than the person x.\n \nExample 1:\n\nInput: richer = [[1,0],[2,1],[3,1],[3,7],[4,3],[5,3],[6,3]], quiet = [3,2,5,4,6,1,7,0]\nOutput: [5,5,2,5,4,5,6,7]\nExplanation: \nanswer[0] = 5.\nPerson 5 has more money than 3, which has more money than 1, which has more money than 0.\nThe only person who is quieter (has lower quiet[x]) is person 7, but it is not clear if they have more money than person 0.\nanswer[7] = 7.\nAmong all people that definitely have equal to or more money than person 7 (which could be persons 3, 4, 5, 6, or 7), the person who is the quietest (has lower quiet[x]) is person 7.\nThe other answers can be filled out with similar reasoning.\n\nExample 2:\n\nInput: richer = [], quiet = [0]\nOutput: [0]\n\n \nConstraints:\n\nn == quiet.length\n1 <= n <= 500\n0 <= quiet[i] < n\nAll the values of quiet are unique.\n0 <= richer.length <= n * (n - 1) / 2\n0 <= ai, bi < n\nai != bi\nAll the pairs of richer are unique.\nThe observations in richer are all logically consistent.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(richer = [],quiet = [0]) == [0]\n assert candidate(richer = [[1, 0], [0, 2], [2, 3], [1, 3]],quiet = [5, 0, 2, 4]) == [1, 1, 1, 1]\n assert candidate(richer = [[4, 3], [3, 2], [2, 1], [1, 0]],quiet = [4, 3, 2, 1, 0]) == [4, 4, 4, 4, 4]\n assert candidate(richer = [[1, 0], [2, 0], [3, 0]],quiet = [3, 2, 1, 0]) == [3, 1, 2, 3]\n assert candidate(richer = [[2, 0], [2, 1], [3, 1], [3, 7], [4, 3], [5, 3], [6, 3]],quiet = [3, 2, 5, 4, 6, 1, 7, 0]) == [0, 5, 2, 5, 4, 5, 6, 7]\n assert candidate(richer = [[1, 3], [2, 3]],quiet = [3, 2, 5, 1]) == [0, 1, 2, 3]\n assert candidate(richer = [[0, 1], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5]],quiet = [6, 5, 4, 3, 2, 1, 0]) == [0, 6, 6, 6, 6, 6, 6]\n assert candidate(richer = [[1, 3], [2, 3]],quiet = [3, 2, 1, 0]) == [0, 1, 2, 3]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3], [3, 4]],quiet = [0, 1, 2, 3, 4]) == [0, 0, 0, 0, 0]\n assert candidate(richer = [[0, 1], [1, 2], [0, 2]],quiet = [2, 1, 0]) == [0, 1, 2]\n assert candidate(richer = [[1, 0], [2, 0], [3, 0], [4, 0]],quiet = [4, 3, 2, 1, 0]) == [4, 1, 2, 3, 4]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [2, 4]],quiet = [3, 2, 1, 4, 5]) == [0, 1, 2, 1, 2]\n assert candidate(richer = [[1, 0], [2, 1], [0, 2]],quiet = [3, 2, 1]) == [2, 2, 2]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6]],quiet = [5, 4, 3, 2, 1, 0, 6]) == [0, 1, 2, 3, 4, 5, 2]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3]],quiet = [4, 3, 2, 1]) == [0, 1, 2, 3]\n assert candidate(richer = [[0, 1], [0, 2], [0, 3]],quiet = [0, 1, 2, 3]) == [0, 0, 0, 0]\n assert candidate(richer = [[0, 1], [2, 3], [4, 5]],quiet = [5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6]],quiet = [3, 2, 1, 0, 4, 5, 6]) == [0, 1, 2, 3, 1, 2, 2]\n assert candidate(richer = [[0, 1]],quiet = [5, 0]) == [0, 1]\n assert candidate(richer = [[1, 0], [2, 1], [3, 1], [3, 7], [4, 3], [5, 3], [6, 3]],quiet = [3, 2, 5, 4, 6, 1, 7, 0]) == [5, 5, 2, 5, 4, 5, 6, 7]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3]],quiet = [3, 2, 1, 0]) == [0, 1, 2, 3]\n assert candidate(richer = [[1, 0], [0, 2], [2, 3], [4, 5], [5, 6]],quiet = [3, 2, 5, 4, 6, 1, 7]) == [1, 1, 1, 1, 4, 5, 5]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],quiet = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10]],quiet = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n assert candidate(richer = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 8], [10, 9], [11, 10], [12, 11], [13, 12], [14, 13], [15, 14], [16, 15], [17, 16], [18, 17], [19, 18], [20, 19], [0, 20]],quiet = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]\n assert candidate(richer = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0]],quiet = [8, 7, 6, 5, 4, 3, 2, 1, 0]) == [8, 1, 2, 3, 4, 5, 6, 7, 8]\n assert candidate(richer = [[1, 0], [2, 0], [3, 1], [4, 1], [5, 2], [6, 2], [7, 3], [8, 3], [9, 4], [10, 4], [11, 5], [12, 5], [13, 6], [14, 6], [15, 7], [16, 7], [17, 8], [18, 8], [19, 9], [20, 9]],quiet = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [20, 20, 14, 18, 20, 12, 14, 16, 18, 20, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]],quiet = [7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7]\n assert candidate(richer = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6]],quiet = [10, 9, 8, 7, 6, 5, 4, 3]) == [7, 7, 7, 7, 7, 7, 7, 7]\n assert candidate(richer = [[1, 0], [2, 0], [3, 0], [4, 1], [5, 1], [6, 2], [7, 2], [8, 3], [9, 3], [10, 4], [11, 4], [12, 5], [13, 5], [14, 6], [15, 6], [16, 7], [17, 7], [18, 8], [19, 8], [20, 9], [21, 9]],quiet = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 0, 20, 21]) == [19, 5, 7, 19, 4, 5, 6, 7, 19, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [5, 7], [6, 8], [7, 9], [8, 9]],quiet = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(richer = [[5, 3], [3, 1], [3, 0], [1, 2], [2, 4]],quiet = [3, 4, 5, 0, 1, 2]) == [3, 3, 3, 3, 3, 5]\n assert candidate(richer = [[9, 8], [8, 7], [7, 6], [6, 5], [5, 4], [4, 3], [3, 2], [2, 1], [1, 0]],quiet = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(richer = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9]],quiet = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(richer = [[5, 4], [5, 3], [3, 2], [3, 1], [2, 0]],quiet = [5, 4, 3, 2, 1, 0]) == [5, 5, 5, 5, 5, 5]\n assert candidate(richer = [[1, 3], [2, 3], [3, 4], [4, 5], [0, 1], [0, 2], [0, 5], [0, 6], [5, 7], [7, 8]],quiet = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(richer = [[1, 0], [2, 0], [3, 1], [4, 1], [5, 2], [6, 2], [7, 3], [8, 3], [9, 4], [10, 4], [11, 5], [12, 5], [13, 6], [14, 6], [15, 7], [16, 7], [17, 8], [18, 8], [19, 9], [20, 9]],quiet = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 20]) == [0, 10, 11, 3, 10, 11, 13, 15, 17, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [0, 9]],quiet = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [2, 3], [3, 4], [4, 5]],quiet = [5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5]\n assert candidate(richer = [[1, 0], [2, 0], [3, 1], [4, 2], [5, 3], [6, 4], [7, 5]],quiet = [7, 6, 5, 4, 3, 2, 1, 0]) == [7, 7, 6, 7, 6, 7, 6, 7]\n assert candidate(richer = [[1, 0], [2, 0], [3, 1], [4, 1], [5, 2], [6, 2], [7, 3], [8, 3], [9, 4], [10, 4], [11, 5], [12, 5], [13, 6], [14, 6], [15, 7], [16, 7], [17, 8], [18, 8]],quiet = [18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [18, 18, 14, 18, 10, 12, 14, 16, 18, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [2, 4], [0, 5], [1, 6], [2, 7], [3, 8], [4, 9], [5, 10], [6, 11], [7, 12], [8, 13], [9, 14], [10, 15], [11, 16], [12, 17], [13, 18], [14, 19], [15, 20], [16, 21], [17, 22], [18, 23], [19, 24], [20, 25], [21, 26], [22, 27], [23, 28], [24, 29]],quiet = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 6, 7, 8, 9, 5, 6, 7, 8, 9, 5, 6, 7, 8, 9, 5, 6, 7, 8, 9]\n assert candidate(richer = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19]],quiet = [0, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(richer = [[1, 0], [3, 1], [2, 0], [4, 2], [5, 3]],quiet = [7, 6, 5, 4, 3, 2, 1, 0]) == [5, 5, 4, 5, 4, 5, 6, 7]\n assert candidate(richer = [[10, 0], [9, 1], [8, 2], [7, 3], [6, 4], [5, 5], [4, 6], [3, 7], [2, 8], [1, 9], [0, 10]],quiet = [1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 10]) == [0, 1, 8, 7, 6, 5, 6, 7, 8, 1, 0]\n assert candidate(richer = [[1, 0], [2, 1], [3, 2], [3, 4], [5, 3], [6, 4], [7, 5], [8, 6], [9, 7], [10, 8]],quiet = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [9, 9, 9, 9, 10, 9, 10, 9, 10, 9, 10]\n assert candidate(richer = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [2, 6], [2, 7], [3, 8], [3, 9]],quiet = [5, 4, 3, 2, 1, 0, 9, 8, 7, 6]) == [0, 1, 2, 3, 4, 5, 2, 2, 3, 3]\n assert candidate(richer = [[1, 0], [2, 0], [3, 1], [4, 1], [5, 2], [6, 2], [7, 3], [8, 3], [9, 4], [10, 4], [11, 5], [12, 5], [13, 6], [14, 6], [15, 7], [16, 7], [17, 8], [18, 8], [19, 9], [20, 9], [21, 10], [22, 10], [23, 11], [24, 11], [25, 12], [26, 12], [27, 13], [28, 13], [29, 14], [30, 14]],quiet = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [30, 22, 30, 18, 22, 26, 30, 16, 18, 20, 22, 24, 26, 28, 30, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]\n assert candidate(richer = [[1, 0], [2, 0], [3, 1], [4, 1], [5, 2], [6, 2], [7, 3], [8, 4]],quiet = [8, 7, 6, 5, 4, 3, 2, 1, 0]) == [8, 8, 6, 7, 8, 5, 6, 7, 8]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10]],quiet = [9, 3, 4, 5, 6, 2, 7, 1, 8, 0, 11]) == [0, 1, 2, 1, 1, 5, 2, 7, 1, 9, 1]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [4, 7], [5, 7], [6, 7]],quiet = [5, 4, 3, 2, 1, 0, 9, 8]) == [0, 1, 2, 3, 4, 5, 2, 5]\n assert candidate(richer = [[1, 0], [3, 0], [2, 1], [4, 1], [5, 2], [6, 2], [7, 3], [8, 3], [9, 4], [10, 4], [11, 5], [12, 5], [13, 6], [14, 6], [15, 7], [16, 7], [17, 8], [18, 8], [19, 9], [20, 9], [21, 10], [22, 10], [23, 11], [24, 11]],quiet = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]\n assert candidate(richer = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [8, 7]],quiet = [8, 7, 6, 5, 4, 3, 2, 1, 0]) == [8, 8, 8, 8, 8, 8, 8, 8, 8]\n assert candidate(richer = [[1, 0], [2, 1], [3, 1], [4, 2], [5, 2], [6, 3], [7, 3], [8, 4], [9, 4], [10, 5], [11, 5], [12, 6], [13, 6], [14, 7], [15, 7]],quiet = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15, 14, 13, 12, 11, 0]) == [15, 15, 9, 15, 9, 5, 6, 15, 8, 9, 10, 11, 12, 13, 14, 15]\n assert candidate(richer = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 8]],quiet = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(richer = [[1, 0], [2, 0], [3, 1], [4, 1], [5, 2], [6, 2], [7, 3], [8, 4], [9, 5], [10, 6], [11, 7], [12, 8], [13, 9], [14, 10], [15, 11], [16, 12]],quiet = [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [16, 16, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16]\n assert candidate(richer = [[1, 0], [3, 1], [4, 1], [2, 4], [5, 2], [6, 2], [7, 5], [8, 5], [9, 7], [10, 7], [11, 8], [12, 8]],quiet = [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [12, 12, 12, 3, 12, 12, 6, 10, 12, 9, 10, 11, 12]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]],quiet = [5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5]\n assert candidate(richer = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0], [11, 0], [12, 0], [13, 0], [14, 0], [15, 0], [16, 0], [17, 0], [18, 0], [19, 0], [20, 0]],quiet = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n assert candidate(richer = [[3, 0], [3, 1], [3, 2], [3, 4], [5, 0], [5, 1], [5, 2], [5, 3]],quiet = [6, 5, 4, 3, 2, 1, 0]) == [5, 5, 5, 5, 5, 5, 6]\n assert candidate(richer = [[1, 0], [2, 0], [3, 1], [3, 2], [4, 3], [5, 3], [6, 4], [6, 5]],quiet = [3, 2, 5, 4, 6, 1, 7, 0]) == [5, 5, 5, 5, 4, 5, 6, 7]\n assert candidate(richer = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 8], [10, 9], [11, 10], [12, 11]],quiet = [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],quiet = [5, 8, 9, 4, 3, 7, 2, 6, 1, 0]) == [0, 0, 0, 3, 4, 4, 6, 6, 8, 9]\n assert candidate(richer = [[5, 0], [5, 1], [5, 2], [5, 3], [5, 4]],quiet = [10, 9, 8, 7, 6, 5]) == [5, 5, 5, 5, 5, 5]\n assert candidate(richer = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 8], [10, 9], [11, 10], [12, 11], [13, 12], [14, 13], [15, 14], [16, 15], [17, 16], [18, 17], [19, 18], [20, 19]],quiet = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]\n assert candidate(richer = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 8], [0, 9], [1, 8], [2, 7], [3, 6], [4, 5]],quiet = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]\n assert candidate(richer = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20]],quiet = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n assert candidate(richer = [[3, 0], [5, 0], [5, 1], [1, 2], [1, 3], [1, 4], [4, 5]],quiet = [10, 9, 8, 7, 6, 5]) == [5, 5, 5, 5, 4, 5]\n assert candidate(richer = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19]],quiet = [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n assert candidate(richer = [[5, 4], [5, 3], [6, 4], [7, 4], [8, 5], [9, 5]],quiet = [2, 6, 5, 8, 1, 3, 7, 4, 9, 0]) == [0, 1, 2, 9, 9, 9, 6, 7, 8, 9]\n assert candidate(richer = [[1, 0], [2, 0], [3, 1], [4, 1], [5, 2], [6, 2], [7, 3], [8, 3], [9, 4], [10, 4], [11, 5], [12, 5], [13, 6], [14, 6], [15, 7], [16, 7]],quiet = [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [16, 16, 14, 16, 10, 12, 14, 16, 8, 9, 10, 11, 12, 13, 14, 15, 16]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 0]],quiet = [5, 4, 3, 2, 1]) == [4, 1, 2, 3, 4]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [5, 12], [6, 13], [6, 14]],quiet = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [0, 9], [1, 8], [2, 7], [3, 6], [4, 5]],quiet = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [5, 12], [6, 13], [6, 14], [7, 15], [8, 15], [9, 16], [10, 16], [11, 17], [12, 17], [13, 18], [14, 18], [15, 19], [16, 19], [17, 19]],quiet = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [5, 12], [6, 13], [6, 14]],quiet = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]\n assert candidate(richer = [[1, 0], [3, 0], [2, 1], [4, 1], [5, 2], [6, 2], [7, 3], [8, 3], [9, 4], [10, 4], [11, 5], [12, 5]],quiet = [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [12, 12, 12, 8, 10, 12, 6, 7, 8, 9, 10, 11, 12]\n assert candidate(richer = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 8], [10, 9], [11, 10], [12, 11], [13, 12], [14, 13], [15, 14], [16, 15], [17, 16], [18, 17], [19, 18], [20, 19], [21, 20], [22, 21], [23, 22], [24, 23]],quiet = [24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24]\n assert candidate(richer = [[5, 3], [3, 1], [1, 0], [3, 2], [2, 4], [5, 6], [6, 8], [8, 7]],quiet = [5, 4, 3, 2, 1, 0, 11, 10, 9]) == [5, 5, 5, 5, 5, 5, 5, 5, 5]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], [25, 26], [26, 27], [27, 28], [28, 29]],quiet = [29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]\n assert candidate(richer = [[1, 0], [2, 0], [3, 1], [4, 1], [5, 2], [6, 2], [7, 3], [8, 4], [9, 5], [10, 6], [11, 7], [12, 8], [13, 9], [14, 10], [15, 11], [16, 12], [17, 13], [18, 14], [19, 15]],quiet = [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [19, 19, 18, 19, 16, 17, 18, 19, 16, 17, 18, 19, 16, 17, 18, 19, 16, 17, 18, 19]\n assert candidate(richer = [[1, 0], [2, 0], [3, 1], [4, 2], [5, 2], [6, 3], [7, 3], [8, 4], [9, 4]],quiet = [8, 7, 9, 1, 2, 5, 6, 3, 4, 0]) == [9, 3, 9, 3, 9, 5, 6, 7, 8, 9]\n assert candidate(richer = [[1, 0], [2, 1], [3, 1], [4, 2], [5, 2], [6, 3], [7, 3], [8, 4], [9, 4]],quiet = [0, 3, 1, 4, 2, 5, 6, 7, 8, 9]) == [0, 2, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0]],quiet = [5, 4, 3, 2, 1, 0, 9, 8, 7, 6]) == [5, 1, 2, 3, 4, 5, 5, 5, 5, 5]\n assert candidate(richer = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 8], [0, 10], [11, 10], [12, 11], [13, 12], [14, 13]],quiet = [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 14, 14, 14, 14, 14]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [2, 4], [4, 5], [4, 6], [5, 7], [5, 8], [6, 9], [6, 10]],quiet = [3, 2, 1, 5, 0, 10, 9, 8, 7, 6, 4]) == [0, 1, 2, 1, 4, 4, 4, 4, 4, 4, 4]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 13], [10, 14], [11, 15], [12, 16], [13, 17], [14, 18], [15, 19]],quiet = [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n assert candidate(richer = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0]],quiet = [100, 99, 98, 97, 96, 95]) == [5, 1, 2, 3, 4, 5]\n assert candidate(richer = [[0, 1], [0, 2], [0, 3], [0, 4], [1, 5], [1, 6], [1, 7], [2, 8], [2, 9], [2, 10], [3, 11], [3, 12], [4, 13], [4, 14], [5, 15], [5, 16], [6, 17], [6, 18], [7, 19], [8, 20], [8, 21], [9, 22], [10, 23], [10, 24], [11, 25], [11, 26], [12, 27], [12, 28], [13, 29], [13, 30], [14, 31], [14, 32], [15, 33], [15, 34], [16, 35], [16, 36], [17, 37], [17, 38], [18, 39], [18, 40], [19, 41], [20, 42], [20, 43], [21, 44], [21, 45], [22, 46], [22, 47], [23, 48], [23, 49], [24, 50], [24, 51], [25, 52], [25, 53], [26, 54], [26, 55], [27, 56], [27, 57], [28, 58], [28, 59], [29, 60], [29, 61], [30, 62], [30, 63]],quiet = [63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]\n assert candidate(richer = [[1, 2], [1, 3], [3, 4], [4, 5], [2, 6], [6, 7]],quiet = [8, 7, 9, 4, 2, 1, 3, 6]) == [0, 1, 1, 3, 4, 5, 6, 6]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3], [0, 3], [0, 4], [1, 4], [4, 5]],quiet = [3, 4, 5, 1, 2, 0]) == [0, 0, 0, 3, 4, 5]\n assert candidate(richer = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6]],quiet = [10, 9, 8, 7, 6, 5, 4]) == [0, 1, 2, 3, 4, 5, 6]\n assert candidate(richer = [[0, 2], [2, 3], [3, 4], [4, 5], [0, 1], [1, 4], [2, 5], [3, 6], [5, 7]],quiet = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n assert candidate(richer = [[5, 4], [4, 3], [3, 2], [2, 1], [1, 0]],quiet = [8, 7, 6, 5, 4, 3]) == [5, 5, 5, 5, 5, 5]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],quiet = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(richer = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6]],quiet = [7, 6, 5, 4, 3, 2, 1, 0]) == [7, 7, 7, 7, 7, 7, 7, 7]\n assert candidate(richer = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14]],quiet = [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n assert candidate(richer = [[1, 0], [2, 0], [3, 1], [3, 2], [4, 1], [4, 2], [5, 3], [5, 4]],quiet = [5, 3, 4, 2, 1, 0]) == [5, 5, 5, 5, 5, 5]\n assert candidate(richer = [[3, 0], [3, 1], [3, 2], [3, 4], [4, 5], [4, 6], [4, 7], [5, 8], [5, 9], [6, 10], [6, 11], [7, 12], [7, 13], [7, 14]],quiet = [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n assert candidate(richer = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [2, 6], [2, 7], [3, 8], [3, 9], [4, 10], [5, 10], [6, 11], [7, 11], [8, 12], [9, 12], [10, 13], [11, 13], [12, 14], [13, 15], [14, 16]],quiet = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 16]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14]\n"}, "metadata": {"canonical_parameter_names": ["richer", "quiet"], "leetcode_dataset_entry_point": "Solution().loudAndRich", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var loudAndRich = function(richer, quiet) {", "container": null, "callable": "loudAndRich", "parameters": [{"name": "richer", "type": "number[][]"}, {"name": "quiet", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 852, "task_id": "peak-index-in-a-mountain-array", "difficulty": "Medium", "problem_description": "You are given an integer mountain array arr of length n where the values increase to a peak element and then decrease.\nReturn the index of the peak element.\nYour task is to solve it in O(log(n)) time complexity.\n \nExample 1:\n\nInput: arr = [0,1,0]\nOutput: 1\n\nExample 2:\n\nInput: arr = [0,2,1,0]\nOutput: 1\n\nExample 3:\n\nInput: arr = [0,10,5,2]\nOutput: 1\n\n \nConstraints:\n\n3 <= arr.length <= 105\n0 <= arr[i] <= 106\narr is guaranteed to be a mountain array.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 3, 5, 4, 2]) == 2\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 3, 1]) == 5\n assert candidate(arr = [0, 2, 1, 0]) == 1\n assert candidate(arr = [0, 10, 5, 2]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 3, 1]) == 4\n assert candidate(arr = [1, 2, 3, 5, 4, 3, 2, 1]) == 3\n assert candidate(arr = [1, 6, 7, 8, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(arr = [3, 5, 3, 2, 0]) == 1\n assert candidate(arr = [24, 69, 100, 99, 79, 78, 67, 36, 26, 19]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0]) == 4\n assert candidate(arr = [0, 1, 0]) == 1\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 9\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 30\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 50\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 10\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 12\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5]) == 15\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5]) == 19\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 950, 900, 850, 800, 750, 700, 650, 600, 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 50]) == 9\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 8\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 9\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 0, 1, 0, 1, 0]) == 38\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, 590, 589]) == 5\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 14, 12, 10, 8, 6, 4, 2]) == 7\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 8, 6, 4, 2]) == 5\n assert candidate(arr = [100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 900000, 800000, 700000, 600000, 500000, 400000, 300000, 200000, 100000]) == 9\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 15\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 49\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 95, 85, 75, 65, 55, 45, 35, 25, 15, 5]) == 9\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == 5\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 12\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5]) == 19\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1]) == 6\n assert candidate(arr = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0]) == 20\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 8, 6, 4, 2]) == 5\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 9\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 5\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5]) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 39\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 5\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2]) == 20\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1]) == 7\n assert candidate(arr = [1, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 97, 93, 89, 85, 81, 77, 73, 69, 65, 61, 57, 53, 49, 45, 41, 37, 33, 29, 25, 21, 17, 13, 9, 5]) == 25\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 16\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 15\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 10\n assert candidate(arr = [100000, 200000, 300000, 400000, 500000, 450000, 400000, 350000, 300000, 250000, 200000, 150000, 100000]) == 4\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 4\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 29\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 15\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1]) == 4\n assert candidate(arr = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 59, 57, 55, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3]) == 15\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 44\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5]) == 9\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 24\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 10, 8, 6, 4, 2]) == 5\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 55, 45, 35, 25, 15, 5]) == 5\n assert candidate(arr = [1, 10, 20, 30, 40, 50, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5]) == 6\n assert candidate(arr = [10, 20, 30, 40, 50, 45, 35, 25, 15, 10]) == 4\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 29\n assert candidate(arr = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0]) == 15\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 19\n assert candidate(arr = [1, 2, 3, 4, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 4\n assert candidate(arr = [1, 3, 8, 12, 5, 2]) == 3\n assert candidate(arr = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5]) == 10\n assert candidate(arr = [100, 200, 300, 400, 500, 450, 400, 350, 300, 250, 200, 150, 100]) == 4\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 950, 900, 850, 800, 750, 700, 650, 600, 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 50]) == 9\n assert candidate(arr = [1, 3, 5, 10, 8, 7, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 5, 3, 1]) == 9\n assert candidate(arr = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 10\n assert candidate(arr = [1, 3, 8, 12, 17, 20, 19, 15, 10, 5]) == 5\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 14\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == 4\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2]) == 15\n assert candidate(arr = [100000, 200000, 300000, 400000, 500000, 450000, 400000, 350000, 300000, 250000, 200000, 150000, 100000, 50000]) == 4\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 14\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, -30]) == 20\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 30\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 115, 110, 105, 100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10]) == 11\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 5\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 9\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 19\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 48, 46, 44, 42, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2]) == 49\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) == 8\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().peakIndexInMountainArray", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var peakIndexInMountainArray = function(arr) {", "container": null, "callable": "peakIndexInMountainArray", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 853, "task_id": "car-fleet", "difficulty": "Medium", "problem_description": "There are n cars at given miles away from the starting mile 0, traveling to reach the mile target.\nYou are given two integer array position and speed, both of length n, where position[i] is the starting mile of the ith car and speed[i] is the speed of the ith car in miles per hour.\nA car cannot pass another car, but it can catch up and then travel next to it at the speed of the slower car.\nA car fleet is a car or cars driving next to each other. The speed of the car fleet is the minimum speed of any car in the fleet.\nIf a car catches up to a car fleet at the mile target, it will still be considered as part of the car fleet.\nReturn the number of car fleets that will arrive at the destination.\n \nExample 1:\n\nInput: target = 12, position = [10,8,0,5,3], speed = [2,4,1,1,3]\nOutput: 3\nExplanation:\n\nThe cars starting at 10 (speed 2) and 8 (speed 4) become a fleet, meeting each other at 12. The fleet forms at target.\nThe car starting at 0 (speed 1) does not catch up to any other car, so it is a fleet by itself.\nThe cars starting at 5 (speed 1) and 3 (speed 3) become a fleet, meeting each other at 6. The fleet moves at speed 1 until it reaches target.\n\n\nExample 2:\n\nInput: target = 10, position = [3], speed = [3]\nOutput: 1\nExplanation:\nThere is only one car, hence there is only one fleet.\nExample 3:\n\nInput: target = 100, position = [0,2,4], speed = [4,2,1]\nOutput: 1\nExplanation:\n\nThe cars starting at 0 (speed 4) and 2 (speed 2) become a fleet, meeting each other at 4. The car starting at 4 (speed 1) travels to 5.\nThen, the fleet at 4 (speed 2) and the car at position 5 (speed 1) become one fleet, meeting each other at 6. The fleet moves at speed 1 until it reaches target.\n\n\n \nConstraints:\n\nn == position.length == speed.length\n1 <= n <= 105\n0 < target <= 106\n0 <= position[i] < target\nAll the values of position are unique.\n0 < speed[i] <= 106\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(target = 1000,position = [100, 200, 300],speed = [100, 50, 25]) == 1\n assert candidate(target = 100,position = [0, 1, 2, 3, 4],speed = [100, 100, 100, 100, 100]) == 5\n assert candidate(target = 300,position = [0, 50, 100, 150, 200, 250],speed = [50, 40, 30, 20, 10, 5]) == 1\n assert candidate(target = 100,position = [90, 80, 70, 60, 50],speed = [10, 20, 30, 40, 50]) == 1\n assert candidate(target = 50,position = [0, 10, 20, 30, 40],speed = [10, 9, 8, 7, 6]) == 5\n assert candidate(target = 50,position = [10, 20, 30],speed = [1, 2, 3]) == 3\n assert candidate(target = 12,position = [10, 8, 0, 5, 3],speed = [2, 4, 1, 1, 3]) == 3\n assert candidate(target = 10,position = [3],speed = [3]) == 1\n assert candidate(target = 1,position = [0],speed = [1]) == 1\n assert candidate(target = 50,position = [10, 20, 30, 40],speed = [5, 4, 3, 2]) == 4\n assert candidate(target = 100,position = [0, 2, 4],speed = [4, 2, 1]) == 1\n assert candidate(target = 200,position = [50, 60, 70, 80, 90],speed = [10, 9, 8, 7, 6]) == 1\n assert candidate(target = 100,position = [10, 20, 30, 40, 50, 60, 70, 80, 90],speed = [10, 10, 10, 10, 10, 10, 10, 10, 10]) == 9\n assert candidate(target = 20,position = [0, 18, 5],speed = [4, 4, 4]) == 3\n assert candidate(target = 20,position = [6, 2, 17],speed = [3, 9, 2]) == 2\n assert candidate(target = 1000,position = [100, 200, 300, 400],speed = [10, 20, 30, 40]) == 4\n assert candidate(target = 10,position = [6, 8],speed = [3, 2]) == 2\n assert candidate(target = 12,position = [0, 4, 2],speed = [1, 2, 3]) == 2\n assert candidate(target = 20,position = [5, 15, 10],speed = [5, 1, 3]) == 1\n assert candidate(target = 100,position = [10, 20, 30],speed = [1, 2, 3]) == 3\n assert candidate(target = 999999,position = [1, 2, 3, 4, 5],speed = [999998, 999997, 999996, 999995, 999994]) == 1\n assert candidate(target = 200,position = [10, 50, 90, 130, 170],speed = [1, 2, 3, 4, 5]) == 5\n assert candidate(target = 1000,position = [500, 600, 700, 800, 900],speed = [1, 1, 1, 1, 1]) == 5\n assert candidate(target = 100,position = [10, 20, 30, 40, 50, 60, 70, 80, 90],speed = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 9\n assert candidate(target = 600,position = [50, 150, 250, 350, 450, 550],speed = [5, 10, 15, 20, 25, 30]) == 6\n assert candidate(target = 100,position = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],speed = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(target = 1000,position = [100, 200, 300, 400, 500],speed = [10, 20, 30, 40, 50]) == 5\n assert candidate(target = 120,position = [10, 30, 50, 70, 90],speed = [10, 20, 30, 40, 50]) == 5\n assert candidate(target = 100,position = [0, 25, 50, 75, 99],speed = [5, 4, 3, 2, 1]) == 5\n assert candidate(target = 1000,position = [900, 800, 700, 600, 500, 400, 300, 200, 100],speed = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 1\n assert candidate(target = 1000,position = [10, 200, 300, 400, 500, 600, 700, 800, 900],speed = [90, 80, 70, 60, 50, 40, 30, 20, 10]) == 2\n assert candidate(target = 300,position = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190],speed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(target = 250,position = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],speed = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 15\n assert candidate(target = 1234,position = [123, 456, 789],speed = [321, 654, 987]) == 3\n assert candidate(target = 50,position = [10, 20, 30, 40],speed = [1, 1, 1, 1]) == 4\n assert candidate(target = 700,position = [10, 100, 200, 300, 400],speed = [5, 15, 25, 35, 45]) == 5\n assert candidate(target = 200,position = [50, 100, 150, 0],speed = [2, 2, 2, 1]) == 4\n assert candidate(target = 100,position = [10, 20, 30, 40, 50, 60, 70, 80, 90],speed = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(target = 200,position = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],speed = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(target = 100,position = [10, 20, 30, 40, 50],speed = [1, 2, 3, 4, 5]) == 5\n assert candidate(target = 300,position = [0, 50, 100, 150, 200, 250],speed = [1, 2, 3, 4, 5, 6]) == 6\n assert candidate(target = 120,position = [10, 30, 50, 70, 90],speed = [10, 8, 6, 4, 2]) == 1\n assert candidate(target = 120,position = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55],speed = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 10\n assert candidate(target = 10000,position = [9990, 9980, 9970, 9960, 9950, 9940, 9930, 9920, 9910, 9900],speed = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(target = 500,position = [490, 480, 470, 460, 450],speed = [10, 10, 10, 10, 10]) == 5\n assert candidate(target = 200,position = [0, 50, 100, 150],speed = [20, 15, 10, 5]) == 1\n assert candidate(target = 100,position = [5, 15, 25, 35, 45],speed = [2, 4, 6, 8, 10]) == 5\n assert candidate(target = 150,position = [0, 25, 50, 75, 100],speed = [5, 10, 15, 20, 25]) == 5\n assert candidate(target = 150,position = [10, 20, 30, 40, 50, 60],speed = [6, 5, 4, 3, 2, 1]) == 1\n assert candidate(target = 100,position = [90, 80, 70, 60, 50],speed = [10, 10, 10, 10, 10]) == 5\n assert candidate(target = 120,position = [0, 10, 20, 30, 40, 50],speed = [1, 2, 3, 4, 5, 6]) == 6\n assert candidate(target = 2000,position = [500, 1000, 1500],speed = [1, 1, 1]) == 3\n assert candidate(target = 600,position = [0, 150, 300, 450],speed = [600, 300, 150, 100]) == 2\n assert candidate(target = 1000,position = [100, 200, 300, 400],speed = [10, 20, 30, 40]) == 4\n assert candidate(target = 400,position = [20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360, 380],speed = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 19\n assert candidate(target = 120,position = [10, 20, 30, 40, 50, 60],speed = [10, 9, 8, 7, 6, 5]) == 1\n assert candidate(target = 800,position = [10, 30, 50, 70, 90],speed = [10, 20, 30, 40, 50]) == 5\n assert candidate(target = 750,position = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700],speed = [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(target = 1000,position = [0, 100, 200, 300, 400, 500, 600, 700, 800, 900],speed = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(target = 400,position = [10, 30, 50, 70, 90, 110, 130, 150, 170, 190, 210, 230, 250, 270, 290, 310, 330, 350, 370, 390],speed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(target = 500,position = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],speed = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(target = 1000,position = [990, 980, 970, 960, 950, 940, 930, 920, 910],speed = [10, 10, 10, 10, 10, 10, 10, 10, 10]) == 9\n assert candidate(target = 150,position = [5, 10, 20, 30, 40, 50, 60, 70, 80, 90],speed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(target = 200,position = [10, 50, 90, 130, 170],speed = [10, 20, 30, 40, 50]) == 5\n assert candidate(target = 800,position = [100, 200, 300, 400, 500, 600, 700],speed = [1, 2, 3, 4, 5, 6, 7]) == 7\n assert candidate(target = 500,position = [0, 50, 100, 150, 200, 250, 300, 350, 400, 450],speed = [50, 45, 40, 35, 30, 25, 20, 15, 10, 5]) == 1\n assert candidate(target = 1000,position = [10, 50, 90, 130, 170],speed = [10, 10, 10, 10, 10]) == 5\n assert candidate(target = 250,position = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125],speed = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(target = 2000,position = [1900, 1800, 1700, 1600, 1500, 1400, 1300, 1200, 1100, 1000],speed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(target = 1000,position = [0, 250, 500, 750],speed = [50, 100, 150, 200]) == 4\n assert candidate(target = 3000,position = [100, 300, 500, 700, 900, 1100, 1300, 1500, 1700, 1900],speed = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55]) == 10\n assert candidate(target = 150,position = [10, 20, 30, 40, 50],speed = [5, 5, 5, 5, 5]) == 5\n assert candidate(target = 5000,position = [10, 200, 3000, 4000, 4990],speed = [100, 90, 80, 70, 60]) == 4\n assert candidate(target = 100,position = [10, 20, 30, 40, 50],speed = [10, 9, 8, 7, 6]) == 5\n assert candidate(target = 1500,position = [100, 300, 500, 700, 900],speed = [100, 200, 300, 400, 500]) == 5\n assert candidate(target = 600,position = [590, 580, 570, 560, 550],speed = [1, 1, 1, 1, 1]) == 5\n assert candidate(target = 120,position = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],speed = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(target = 600,position = [30, 150, 270, 390, 510],speed = [5, 10, 15, 20, 25]) == 5\n assert candidate(target = 400,position = [100, 200, 300],speed = [1, 1, 1]) == 3\n assert candidate(target = 300,position = [290, 280, 270, 260, 250],speed = [1, 2, 3, 4, 5]) == 1\n assert candidate(target = 200,position = [10, 30, 50, 70, 90],speed = [50, 40, 30, 20, 10]) == 1\n assert candidate(target = 350,position = [50, 100, 150, 200, 250, 300],speed = [10, 20, 30, 40, 50, 60]) == 6\n assert candidate(target = 150,position = [10, 30, 50, 70, 90, 110, 130],speed = [10, 8, 6, 4, 2, 1, 5]) == 2\n assert candidate(target = 200,position = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],speed = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(target = 900,position = [10, 100, 200, 300, 400, 500, 600, 700, 800],speed = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 9\n assert candidate(target = 500,position = [0, 100, 200, 300, 400],speed = [1, 2, 3, 4, 5]) == 5\n assert candidate(target = 500,position = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140],speed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 15\n assert candidate(target = 300,position = [20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280],speed = [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(target = 300,position = [0, 100, 200],speed = [100, 50, 1]) == 1\n assert candidate(target = 1200,position = [900, 600, 300, 0],speed = [10, 20, 30, 40]) == 1\n assert candidate(target = 10000,position = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],speed = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(target = 800,position = [100, 200, 300, 400, 500, 600, 700],speed = [700, 600, 500, 400, 300, 200, 100]) == 1\n assert candidate(target = 500,position = [100, 200, 300, 400],speed = [100, 100, 100, 100]) == 4\n assert candidate(target = 900,position = [800, 700, 600, 500, 400, 300, 200, 100, 0],speed = [5, 10, 15, 20, 25, 30, 35, 40, 45]) == 1\n assert candidate(target = 1000,position = [50, 250, 450, 650, 850],speed = [10, 20, 30, 40, 50]) == 5\n assert candidate(target = 500,position = [100, 150, 200, 250, 300],speed = [5, 10, 15, 20, 25]) == 5\n assert candidate(target = 1000,position = [500, 600, 700, 800, 900],speed = [100, 200, 300, 400, 500]) == 5\n assert candidate(target = 500,position = [10, 100, 200, 300, 400],speed = [1, 2, 3, 4, 5]) == 5\n assert candidate(target = 550,position = [25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 425, 450, 475, 500, 525, 550],speed = [22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 21\n assert candidate(target = 300,position = [10, 50, 90, 130, 170, 210, 250, 290],speed = [1, 2, 3, 4, 5, 6, 7, 8]) == 8\n assert candidate(target = 500,position = [400, 300, 200, 100, 0],speed = [5, 4, 3, 2, 1]) == 5\n assert candidate(target = 300,position = [25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275],speed = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1]) == 2\n assert candidate(target = 500,position = [0, 100, 200, 300, 400],speed = [100, 100, 100, 100, 100]) == 5\n assert candidate(target = 200,position = [50, 100, 150],speed = [1, 2, 3]) == 3\n assert candidate(target = 800,position = [10, 100, 200, 300, 400, 500, 600, 700],speed = [1, 2, 3, 4, 5, 6, 7, 8]) == 8\n assert candidate(target = 1000,position = [50, 150, 250, 350, 450],speed = [100, 200, 300, 400, 500]) == 5\n assert candidate(target = 1000,position = [50, 150, 250, 350, 450, 550, 650, 750, 850, 950],speed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(target = 1500,position = [0, 150, 300, 450, 600, 750, 900, 1050, 1200, 1350],speed = [1, 1, 1, 1, 1, 1, 1, 1, 1, 10]) == 10\n assert candidate(target = 200,position = [0, 20, 40, 60, 80, 100, 120, 140, 160, 180],speed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(target = 200,position = [10, 40, 70, 100],speed = [10, 5, 20, 15]) == 2\n assert candidate(target = 300,position = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],speed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(target = 1000,position = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],speed = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(target = 300,position = [25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275],speed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 11\n assert candidate(target = 2000,position = [1000, 1500],speed = [500, 250]) == 1\n assert candidate(target = 1000,position = [100, 200, 300, 400, 500, 600, 700, 800, 900],speed = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(target = 500,position = [50, 150, 250, 350, 450],speed = [5, 10, 15, 20, 25]) == 5\n assert candidate(target = 700,position = [100, 200, 300, 400, 500, 600],speed = [100, 90, 80, 70, 60, 50]) == 6\n assert candidate(target = 200,position = [10, 50, 90, 130, 170],speed = [10, 20, 30, 40, 50]) == 5\n assert candidate(target = 100,position = [10, 20, 30, 40, 50],speed = [5, 5, 5, 5, 5]) == 5\n assert candidate(target = 200,position = [10, 20, 30, 40, 50],speed = [1, 1, 1, 1, 1]) == 5\n assert candidate(target = 500,position = [10, 50, 90, 130, 170],speed = [10, 20, 30, 40, 50]) == 5\n assert candidate(target = 1000,position = [990, 980, 970, 960, 950],speed = [1, 2, 3, 4, 5]) == 1\n assert candidate(target = 1000,position = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500],speed = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 10\n assert candidate(target = 1000,position = [200, 400, 600, 800],speed = [50, 40, 30, 20]) == 4\n"}, "metadata": {"canonical_parameter_names": ["target", "position", "speed"], "leetcode_dataset_entry_point": "Solution().carFleet", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var carFleet = function(target, position, speed) {", "container": null, "callable": "carFleet", "parameters": [{"name": "target", "type": "number"}, {"name": "position", "type": "number[]"}, {"name": "speed", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 854, "task_id": "k-similar-strings", "difficulty": "Hard", "problem_description": "Strings s1 and s2 are k-similar (for some non-negative integer k) if we can swap the positions of two letters in s1 exactly k times so that the resulting string equals s2.\nGiven two anagrams s1 and s2, return the smallest k for which s1 and s2 are k-similar.\n \nExample 1:\n\nInput: s1 = \"ab\", s2 = \"ba\"\nOutput: 1\nExplanation: The two string are 1-similar because we can use one swap to change s1 to s2: \"ab\" --> \"ba\".\n\nExample 2:\n\nInput: s1 = \"abc\", s2 = \"bca\"\nOutput: 2\nExplanation: The two strings are 2-similar because we can use two swaps to change s1 to s2: \"abc\" --> \"bac\" --> \"bca\".\n\n \nConstraints:\n\n1 <= s1.length <= 20\ns2.length == s1.length\ns1 and s2 contain only lowercase letters from the set {'a', 'b', 'c', 'd', 'e', 'f'}.\ns2 is an anagram of s1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s1 = \"aabbcc\",s2 = \"ccbbaa\") == 2\n assert candidate(s1 = \"abac\",s2 = \"baca\") == 2\n assert candidate(s1 = \"abcd\",s2 = \"dcba\") == 2\n assert candidate(s1 = \"abc\",s2 = \"bca\") == 2\n assert candidate(s1 = \"abcdef\",s2 = \"fedcba\") == 3\n assert candidate(s1 = \"aabc\",s2 = \"abac\") == 1\n assert candidate(s1 = \"abcde\",s2 = \"edcba\") == 2\n assert candidate(s1 = \"ab\",s2 = \"ba\") == 1\n assert candidate(s1 = \"aabbcc\",s2 = \"abcabc\") == 2\n assert candidate(s1 = \"aabbaabbcc\",s2 = \"ccbbaabbaa\") == 2\n assert candidate(s1 = \"aabbccddeeff\",s2 = \"ffeeddccbbaa\") == 6\n assert candidate(s1 = \"abcabcabc\",s2 = \"cbacbacba\") == 3\n assert candidate(s1 = \"abcdeabcde\",s2 = \"edcbaedcba\") == 4\n assert candidate(s1 = \"aabbccddeeff\",s2 = \"fedcbafedcba\") == 7\n assert candidate(s1 = \"aabbcc\",s2 = \"bbaacc\") == 2\n assert candidate(s1 = \"aabbccdd\",s2 = \"ddccbaab\") == 5\n assert candidate(s1 = \"abcdefgh\",s2 = \"hgfedcba\") == 4\n assert candidate(s1 = \"aabbcc\",s2 = \"ccbaab\") == 3\n assert candidate(s1 = \"abcdefabc\",s2 = \"cbadefabc\") == 1\n assert candidate(s1 = \"abcabcabc\",s2 = \"bcbacabac\") == 4\n assert candidate(s1 = \"abcabcabc\",s2 = \"cbaabcabc\") == 1\n assert candidate(s1 = \"abcdabcd\",s2 = \"dcbaabcd\") == 2\n assert candidate(s1 = \"abcdefabc\",s2 = \"fdecbaabc\") == 4\n assert candidate(s1 = \"abcdefghij\",s2 = \"jihgfedcba\") == 5\n assert candidate(s1 = \"abcdabcd\",s2 = \"dcbadcba\") == 4\n assert candidate(s1 = \"abcdef\",s2 = \"fabcde\") == 5\n assert candidate(s1 = \"aabbc\",s2 = \"bbaca\") == 3\n assert candidate(s1 = \"abcdefg\",s2 = \"gfedcba\") == 3\n assert candidate(s1 = \"aabbbccc\",s2 = \"cccbbbaa\") == 3\n assert candidate(s1 = \"aabbcc\",s2 = \"cbacba\") == 3\n assert candidate(s1 = \"abababab\",s2 = \"babababa\") == 4\n assert candidate(s1 = \"abcabcabcabc\",s2 = \"cbacbacbacba\") == 4\n assert candidate(s1 = \"aabbccddeeff\",s2 = \"abcdefabcdef\") == 7\n assert candidate(s1 = \"abcdabcdabcd\",s2 = \"dcbaabcdabcd\") == 2\n assert candidate(s1 = \"aabbccddeeff\",s2 = \"ffeeddccbaab\") == 7\n assert candidate(s1 = \"abcabdc\",s2 = \"dcbaacb\") == 4\n assert candidate(s1 = \"abcabc\",s2 = \"cbacba\") == 2\n assert candidate(s1 = \"abcabc\",s2 = \"bcbaca\") == 3\n assert candidate(s1 = \"abcdefabcdef\",s2 = \"defabcfedcba\") == 6\n assert candidate(s1 = \"abcabc\",s2 = \"cbabac\") == 2\n assert candidate(s1 = \"abcabcabc\",s2 = \"cccbaabba\") == 4\n assert candidate(s1 = \"aabbcdef\",s2 = \"defbbaac\") == 4\n assert candidate(s1 = \"abcdefabcdef\",s2 = \"fedcbafedcba\") == 6\n assert candidate(s1 = \"aaaabbbb\",s2 = \"bbbbaaaa\") == 4\n assert candidate(s1 = \"abac\",s2 = \"caba\") == 2\n assert candidate(s1 = \"abcdefgabcdefg\",s2 = \"gfedcbagfedcba\") == 6\n assert candidate(s1 = \"abcbca\",s2 = \"bcbaca\") == 2\n"}, "metadata": {"canonical_parameter_names": ["s1", "s2"], "leetcode_dataset_entry_point": "Solution().kSimilarity", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var kSimilarity = function(s1, s2) {", "container": null, "callable": "kSimilarity", "parameters": [{"name": "s1", "type": "string"}, {"name": "s2", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 856, "task_id": "score-of-parentheses", "difficulty": "Medium", "problem_description": "Given a balanced parentheses string s, return the score of the string.\nThe score of a balanced parentheses string is based on the following rule:\n\n\"()\" has score 1.\nAB has score A + B, where A and B are balanced parentheses strings.\n(A) has score 2 * A, where A is a balanced parentheses string.\n\n \nExample 1:\n\nInput: s = \"()\"\nOutput: 1\n\nExample 2:\n\nInput: s = \"(())\"\nOutput: 2\n\nExample 3:\n\nInput: s = \"()()\"\nOutput: 2\n\n \nConstraints:\n\n2 <= s.length <= 50\ns consists of only '(' and ')'.\ns is a balanced parentheses string.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"(()())\") == 4\n assert candidate(s = \"(()(()))\") == 6\n assert candidate(s = \"()\") == 1\n assert candidate(s = \"((()))\") == 4\n assert candidate(s = \"((()()()))\") == 12\n assert candidate(s = \"()()(())\") == 4\n assert candidate(s = \"()()\") == 2\n assert candidate(s = \"(()(()(())))\") == 14\n assert candidate(s = \"()(())\") == 3\n assert candidate(s = \"(())\") == 2\n assert candidate(s = \"((())())\") == 6\n assert candidate(s = \"()((()))\") == 5\n assert candidate(s = \"(()(()(()())))\") == 22\n assert candidate(s = \"(((())()))\") == 12\n assert candidate(s = \"(())((()))\") == 6\n assert candidate(s = \"()(((())))\") == 9\n assert candidate(s = \"()()()\") == 3\n assert candidate(s = \"(())(())\") == 4\n assert candidate(s = \"()(()(()(())))\") == 15\n assert candidate(s = \"(()((())()))\") == 14\n assert candidate(s = \"(()())(()())\") == 8\n assert candidate(s = \"(()((()))(()))\") == 14\n assert candidate(s = \"((()()()()))\") == 16\n assert candidate(s = \"((()))()()\") == 6\n assert candidate(s = \"((())(()))\") == 8\n assert candidate(s = \"()(()(()))\") == 7\n assert candidate(s = \"((()())(()))\") == 12\n assert candidate(s = \"((()(()(())))())\") == 30\n assert candidate(s = \"(()(()()(())))\") == 18\n assert candidate(s = \"(((()))(()))\") == 12\n assert candidate(s = \"((()))()\") == 5\n assert candidate(s = \"(()(())(()))\") == 10\n assert candidate(s = \"((()))(())()\") == 7\n assert candidate(s = \"((()(()))())\") == 14\n assert candidate(s = \"()((())())\") == 7\n assert candidate(s = \"(((())))\") == 8\n assert candidate(s = \"(()())(())\") == 6\n assert candidate(s = \"((())()())\") == 8\n assert candidate(s = \"((()(())))\") == 12\n assert candidate(s = \"()(())(()(()))\") == 9\n assert candidate(s = \"((()()(())))\") == 16\n assert candidate(s = \"(((()()())))\") == 24\n assert candidate(s = \"(((()()(()))))\") == 32\n assert candidate(s = \"((((()))))\") == 16\n assert candidate(s = \"(()()(()))\") == 8\n assert candidate(s = \"(()((())))\") == 10\n assert candidate(s = \"()((()()()))\") == 13\n assert candidate(s = \"((()())())\") == 10\n assert candidate(s = \"(())(()(()))\") == 8\n assert candidate(s = \"(((()())()))\") == 20\n assert candidate(s = \"()((())()())\") == 9\n assert candidate(s = \"()()()()\") == 4\n assert candidate(s = \"((()))(())\") == 6\n assert candidate(s = \"((()()))\") == 8\n assert candidate(s = \"()(())(())\") == 5\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().scoreOfParentheses", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var scoreOfParentheses = function(s) {", "container": null, "callable": "scoreOfParentheses", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 857, "task_id": "minimum-cost-to-hire-k-workers", "difficulty": "Hard", "problem_description": "There are n workers. You are given two integer arrays quality and wage where quality[i] is the quality of the ith worker and wage[i] is the minimum wage expectation for the ith worker.\nWe want to hire exactly k workers to form a paid group. To hire a group of k workers, we must pay them according to the following rules:\n\nEvery worker in the paid group must be paid at least their minimum wage expectation.\nIn the group, each worker's pay must be directly proportional to their quality. This means if a worker’s quality is double that of another worker in the group, then they must be paid twice as much as the other worker.\n\nGiven the integer k, return the least amount of money needed to form a paid group satisfying the above conditions. Answers within 10-5 of the actual answer will be accepted.\n \nExample 1:\n\nInput: quality = [10,20,5], wage = [70,50,30], k = 2\nOutput: 105.00000\nExplanation: We pay 70 to 0th worker and 35 to 2nd worker.\n\nExample 2:\n\nInput: quality = [3,1,10,10,1], wage = [4,8,2,2,7], k = 3\nOutput: 30.66667\nExplanation: We pay 4 to 0th worker, 13.33333 to 2nd and 3rd workers separately.\n\n \nConstraints:\n\nn == quality.length == wage.length\n1 <= k <= n <= 104\n1 <= quality[i], wage[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(quality = [1, 2, 3, 4, 5],wage = [5, 4, 3, 2, 1],k = 3) == 12.0\n assert candidate(quality = [1, 1, 1, 1, 1],wage = [1, 1, 1, 1, 1],k = 2) == 2.0\n assert candidate(quality = [100, 200, 300, 400, 500],wage = [1000, 2000, 3000, 4000, 5000],k = 4) == 10000.0\n assert candidate(quality = [1, 1, 1, 1],wage = [1, 2, 3, 4],k = 2) == 4.0\n assert candidate(quality = [100, 200, 300, 400, 500],wage = [500, 400, 300, 200, 100],k = 2) == 450.0\n assert candidate(quality = [10, 10, 10, 10],wage = [10, 10, 10, 10],k = 4) == 40.0\n assert candidate(quality = [3, 1, 10, 10, 1],wage = [4, 8, 2, 2, 7],k = 3) == 30.666666666666664\n assert candidate(quality = [1, 2, 3, 4, 5],wage = [1, 2, 3, 4, 5],k = 4) == 10.0\n assert candidate(quality = [10, 10, 10, 10, 10],wage = [10, 10, 10, 10, 10],k = 5) == 50.0\n assert candidate(quality = [4, 1, 3, 2],wage = [20, 10, 30, 20],k = 2) == 30.0\n assert candidate(quality = [6, 12, 10, 10],wage = [48, 48, 30, 60],k = 3) == 192.0\n assert candidate(quality = [10, 20, 5],wage = [70, 50, 30],k = 2) == 105.0\n assert candidate(quality = [15, 10, 25, 5, 30, 20, 35, 40],wage = [150, 100, 250, 50, 300, 200, 350, 400],k = 4) == 500.0\n assert candidate(quality = [100, 200, 300, 400, 500],wage = [500, 1000, 1500, 2000, 2500],k = 2) == 1500.0\n assert candidate(quality = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],wage = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 6) == 36.0\n assert candidate(quality = [100, 200, 300, 400, 500],wage = [500, 1000, 1500, 2000, 2500],k = 4) == 5000.0\n assert candidate(quality = [7, 5, 3, 8, 2],wage = [70, 50, 30, 80, 20],k = 2) == 50.0\n assert candidate(quality = [12, 15, 18, 21, 24, 27, 30],wage = [60, 75, 90, 105, 120, 135, 150],k = 4) == 330.0\n assert candidate(quality = [50, 40, 30, 20, 10],wage = [200, 160, 120, 80, 40],k = 2) == 120.0\n assert candidate(quality = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],wage = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110],k = 6) == 420.0\n assert candidate(quality = [15, 20, 5, 10, 30],wage = [105, 150, 30, 70, 210],k = 3) == 210.0\n assert candidate(quality = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],wage = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],k = 5) == 250.0\n assert candidate(quality = [9, 18, 27, 36, 45, 54, 63],wage = [81, 162, 243, 324, 405, 486, 567],k = 5) == 1215.0\n assert candidate(quality = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8],wage = [32, 32, 32, 32, 32, 32, 32, 32, 32, 32],k = 5) == 160.0\n assert candidate(quality = [5, 15, 25, 35, 45, 55],wage = [35, 105, 175, 245, 315, 385],k = 4) == 560.0\n assert candidate(quality = [20, 10, 30, 40, 50, 60, 70, 80, 90, 100],wage = [140, 70, 210, 280, 350, 420, 490, 560, 630, 700],k = 6) == 1470.0\n assert candidate(quality = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],wage = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],k = 5) == 15000.0\n assert candidate(quality = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],wage = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 100.0\n assert candidate(quality = [1, 3, 2, 5, 4, 6],wage = [1, 9, 4, 25, 16, 36],k = 5) == 75.0\n assert candidate(quality = [15, 20, 5, 10, 25],wage = [120, 160, 40, 80, 200],k = 5) == 600.0\n assert candidate(quality = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],wage = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],k = 8) == 360.0\n assert candidate(quality = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],wage = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225],k = 7) == 196.0\n assert candidate(quality = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],wage = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 25.0\n assert candidate(quality = [1, 3, 5, 7, 9, 11, 13],wage = [2, 6, 10, 14, 18, 22, 26],k = 5) == 50.0\n assert candidate(quality = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],wage = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 7) == 49.0\n assert candidate(quality = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],wage = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 8) == 3600.0\n assert candidate(quality = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],wage = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 5) == 1500.0\n assert candidate(quality = [1, 3, 5, 7, 9, 11, 13],wage = [2, 6, 10, 14, 18, 22, 26],k = 4) == 32.0\n assert candidate(quality = [4, 7, 2, 5, 6],wage = [32, 56, 16, 40, 48],k = 2) == 48.0\n assert candidate(quality = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],wage = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 25.0\n assert candidate(quality = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30],wage = [6, 12, 18, 24, 30, 36, 42, 48, 54, 60],k = 9) == 270.0\n assert candidate(quality = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3],wage = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 3) == 6.0\n assert candidate(quality = [4, 5, 1, 2, 3],wage = [40, 50, 10, 20, 30],k = 2) == 30.0\n assert candidate(quality = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],wage = [25, 50, 75, 100, 125, 150, 175, 200, 225, 250],k = 7) == 700.0\n assert candidate(quality = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],wage = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 5) == 1500.0\n assert candidate(quality = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],wage = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750],k = 8) == 1800.0\n assert candidate(quality = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],wage = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 7) == 28.0\n assert candidate(quality = [10, 12, 14, 16, 18, 20],wage = [70, 84, 98, 112, 126, 140],k = 5) == 490.0\n assert candidate(quality = [2, 3, 5, 7, 11, 13],wage = [14, 21, 35, 49, 77, 91],k = 4) == 119.0\n assert candidate(quality = [30, 10, 40, 20, 50],wage = [90, 30, 120, 60, 150],k = 3) == 180.0\n assert candidate(quality = [2, 4, 6, 8, 10],wage = [10, 20, 30, 40, 50],k = 3) == 60.0\n assert candidate(quality = [100, 200, 300, 400, 500],wage = [1000, 2000, 3000, 4000, 5000],k = 4) == 10000.0\n assert candidate(quality = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],wage = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 25.0\n assert candidate(quality = [4, 5, 6, 7, 8, 9],wage = [24, 30, 36, 42, 48, 54],k = 4) == 132.0\n assert candidate(quality = [4, 3, 2, 1],wage = [16, 12, 8, 4],k = 2) == 12.0\n assert candidate(quality = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],wage = [19, 17, 15, 13, 11, 9, 7, 5, 3, 1],k = 4) == 34.46153846153846\n assert candidate(quality = [20, 30, 10, 40, 50],wage = [100, 150, 50, 200, 250],k = 4) == 500.0\n assert candidate(quality = [15, 25, 35, 45, 55],wage = [105, 175, 245, 315, 385],k = 3) == 525.0\n assert candidate(quality = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],wage = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 3) == 30.0\n assert candidate(quality = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],wage = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11],k = 5) == 27.0\n assert candidate(quality = [7, 14, 21, 28, 35, 42, 49, 56, 63],wage = [14, 28, 42, 56, 70, 84, 98, 112, 126],k = 6) == 294.0\n assert candidate(quality = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],wage = [70, 140, 210, 280, 350, 420, 490, 560, 630, 700],k = 7) == 1960.0\n assert candidate(quality = [10, 20, 30, 40, 50],wage = [50, 40, 30, 20, 10],k = 3) == 120.0\n assert candidate(quality = [4, 2, 8, 5, 10, 7],wage = [40, 20, 80, 50, 100, 70],k = 4) == 180.0\n assert candidate(quality = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],wage = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 3) == 33.75\n assert candidate(quality = [10, 20, 30, 40, 50, 60],wage = [50, 100, 150, 200, 250, 300],k = 6) == 1050.0\n assert candidate(quality = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],wage = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 6) == 210.0\n assert candidate(quality = [5, 3, 8, 6, 2],wage = [45, 30, 60, 48, 12],k = 3) == 100.0\n assert candidate(quality = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],wage = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],k = 5) == 25.0\n assert candidate(quality = [5, 10, 15, 20, 25, 30, 35],wage = [50, 100, 150, 200, 250, 300, 350],k = 4) == 500.0\n assert candidate(quality = [1, 1, 1, 1, 1, 1, 1, 1],wage = [1, 2, 3, 4, 5, 6, 7, 8],k = 5) == 25.0\n assert candidate(quality = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],wage = [700, 1400, 2100, 2800, 3500, 4200, 4900, 5600, 6300, 7000],k = 7) == 19600.0\n assert candidate(quality = [15, 30, 45, 60, 75, 90, 105],wage = [45, 90, 135, 180, 225, 270, 315],k = 5) == 675.0\n assert candidate(quality = [5, 2, 10, 15, 20, 1],wage = [100, 60, 200, 300, 400, 50],k = 3) == 400.0\n assert candidate(quality = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],wage = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 7) == 2800.0\n assert candidate(quality = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],wage = [200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000],k = 5) == 3000.0\n assert candidate(quality = [100, 200, 150, 50, 250],wage = [500, 1000, 750, 250, 1250],k = 3) == 1500.0\n assert candidate(quality = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],wage = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 7) == 280.0\n assert candidate(quality = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],wage = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 5) == 150.0\n assert candidate(quality = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],wage = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],k = 6) == 180.0\n assert candidate(quality = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],wage = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 8) == 360.0\n assert candidate(quality = [1, 3, 2, 4, 5],wage = [3, 9, 6, 12, 15],k = 3) == 18.0\n assert candidate(quality = [3, 6, 15, 20, 12],wage = [9, 18, 45, 60, 36],k = 3) == 63.0\n assert candidate(quality = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],wage = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 3) == 9.0\n assert candidate(quality = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],wage = [14, 28, 42, 56, 70, 84, 98, 112, 126, 140, 154, 168, 182, 196, 210],k = 7) == 392.0\n assert candidate(quality = [5, 15, 10, 20, 25],wage = [75, 225, 150, 300, 375],k = 3) == 450.0\n assert candidate(quality = [2, 4, 6, 8, 10],wage = [10, 20, 30, 40, 50],k = 4) == 100.0\n assert candidate(quality = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],wage = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500],k = 6) == 1050.0\n assert candidate(quality = [1, 2, 4, 8, 16, 32, 64],wage = [1, 2, 4, 8, 16, 32, 64],k = 4) == 15.0\n assert candidate(quality = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30],wage = [6, 12, 18, 24, 30, 36, 42, 48, 54, 60],k = 6) == 126.0\n assert candidate(quality = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],wage = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145],k = 6) == 180.0\n assert candidate(quality = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],wage = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],k = 5) == 31.0\n assert candidate(quality = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],wage = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 10) == 100.0\n assert candidate(quality = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41],wage = [4, 6, 10, 14, 22, 26, 34, 38, 46, 58, 62, 74, 82],k = 8) == 154.0\n assert candidate(quality = [5, 8, 12, 15, 20, 25, 30],wage = [10, 16, 24, 30, 40, 50, 60],k = 3) == 50.0\n assert candidate(quality = [15, 10, 5, 25, 20],wage = [90, 60, 30, 150, 120],k = 3) == 180.0\n assert candidate(quality = [15, 25, 10, 40, 30],wage = [105, 175, 70, 280, 210],k = 3) == 350.0\n assert candidate(quality = [6, 12, 18, 24, 30, 36, 42, 48, 54, 60],wage = [12, 24, 36, 48, 60, 72, 84, 96, 108, 120],k = 8) == 432.0\n assert candidate(quality = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],wage = [10, 40, 90, 160, 250, 360, 490, 640, 810, 1000],k = 6) == 1260.0\n assert candidate(quality = [8, 6, 4, 2, 10],wage = [96, 72, 48, 24, 120],k = 4) == 240.0\n assert candidate(quality = [7, 14, 3, 11, 9],wage = [28, 56, 12, 44, 36],k = 4) == 120.0\n assert candidate(quality = [100, 200, 300, 400, 500, 600, 700],wage = [700, 1400, 2100, 2800, 3500, 4200, 4900],k = 5) == 10500.0\n assert candidate(quality = [3, 5, 2, 8, 7],wage = [6, 10, 4, 16, 14],k = 3) == 20.0\n assert candidate(quality = [5, 3, 10, 2, 4],wage = [50, 30, 100, 20, 40],k = 3) == 90.0\n"}, "metadata": {"canonical_parameter_names": ["quality", "wage", "k"], "leetcode_dataset_entry_point": "Solution().mincostToHireWorkers", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var mincostToHireWorkers = function(quality, wage, k) {", "container": null, "callable": "mincostToHireWorkers", "parameters": [{"name": "quality", "type": "number[]"}, {"name": "wage", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 858, "task_id": "mirror-reflection", "difficulty": "Medium", "problem_description": "There is a special square room with mirrors on each of the four walls. Except for the southwest corner, there are receptors on each of the remaining corners, numbered 0, 1, and 2.\nThe square room has walls of length p and a laser ray from the southwest corner first meets the east wall at a distance q from the 0th receptor.\nGiven the two integers p and q, return the number of the receptor that the ray meets first.\nThe test cases are guaranteed so that the ray will meet a receptor eventually.\n \nExample 1:\n\n\nInput: p = 2, q = 1\nOutput: 2\nExplanation: The ray meets receptor 2 the first time it gets reflected back to the left wall.\n\nExample 2:\n\nInput: p = 3, q = 1\nOutput: 1\n\n \nConstraints:\n\n1 <= q <= p <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(p = 2,q = 1) == 2\n assert candidate(p = 10,q = 3) == 2\n assert candidate(p = 6,q = 2) == 1\n assert candidate(p = 4,q = 2) == 2\n assert candidate(p = 10,q = 4) == 0\n assert candidate(p = 5,q = 3) == 1\n assert candidate(p = 3,q = 1) == 1\n assert candidate(p = 7,q = 5) == 1\n assert candidate(p = 5,q = 2) == 0\n assert candidate(p = 6,q = 4) == 0\n assert candidate(p = 10,q = 7) == 2\n assert candidate(p = 72,q = 27) == 2\n assert candidate(p = 75,q = 33) == 1\n assert candidate(p = 500,q = 250) == 2\n assert candidate(p = 720,q = 180) == 2\n assert candidate(p = 999,q = 499) == 1\n assert candidate(p = 999,q = 333) == 1\n assert candidate(p = 999,q = 1) == 1\n assert candidate(p = 997,q = 333) == 1\n assert candidate(p = 450,q = 135) == 2\n assert candidate(p = 500,q = 200) == 0\n assert candidate(p = 500,q = 249) == 2\n assert candidate(p = 64,q = 15) == 2\n assert candidate(p = 999,q = 421) == 1\n assert candidate(p = 1000,q = 333) == 2\n assert candidate(p = 123,q = 45) == 1\n assert candidate(p = 640,q = 160) == 2\n assert candidate(p = 100,q = 37) == 2\n assert candidate(p = 999,q = 998) == 0\n assert candidate(p = 888,q = 352) == 0\n assert candidate(p = 100,q = 33) == 2\n assert candidate(p = 667,q = 222) == 0\n assert candidate(p = 600,q = 150) == 2\n assert candidate(p = 1000,q = 500) == 2\n assert candidate(p = 300,q = 220) == 1\n assert candidate(p = 85,q = 21) == 1\n assert candidate(p = 199,q = 71) == 1\n assert candidate(p = 987,q = 123) == 1\n assert candidate(p = 500,q = 450) == 2\n assert candidate(p = 800,q = 300) == 2\n assert candidate(p = 97,q = 42) == 0\n assert candidate(p = 550,q = 110) == 1\n assert candidate(p = 999,q = 999) == 1\n assert candidate(p = 360,q = 121) == 2\n assert candidate(p = 81,q = 27) == 1\n assert candidate(p = 777,q = 388) == 0\n assert candidate(p = 600,q = 161) == 2\n assert candidate(p = 720,q = 199) == 2\n assert candidate(p = 625,q = 125) == 1\n assert candidate(p = 997,q = 1) == 1\n assert candidate(p = 400,q = 100) == 2\n assert candidate(p = 45,q = 18) == 0\n assert candidate(p = 725,q = 297) == 1\n assert candidate(p = 750,q = 250) == 1\n assert candidate(p = 20,q = 3) == 2\n assert candidate(p = 501,q = 167) == 1\n assert candidate(p = 880,q = 198) == 2\n assert candidate(p = 450,q = 125) == 2\n assert candidate(p = 777,q = 333) == 1\n assert candidate(p = 120,q = 49) == 2\n assert candidate(p = 450,q = 225) == 2\n assert candidate(p = 450,q = 181) == 2\n assert candidate(p = 25,q = 15) == 1\n assert candidate(p = 999,q = 777) == 1\n assert candidate(p = 450,q = 150) == 1\n assert candidate(p = 15,q = 6) == 0\n assert candidate(p = 50,q = 12) == 0\n assert candidate(p = 700,q = 175) == 2\n assert candidate(p = 555,q = 111) == 1\n assert candidate(p = 819,q = 273) == 1\n assert candidate(p = 256,q = 192) == 2\n assert candidate(p = 100,q = 1) == 2\n assert candidate(p = 80,q = 21) == 2\n assert candidate(p = 99,q = 66) == 0\n assert candidate(p = 576,q = 384) == 0\n assert candidate(p = 200,q = 77) == 2\n assert candidate(p = 500,q = 125) == 2\n assert candidate(p = 729,q = 243) == 1\n assert candidate(p = 600,q = 400) == 0\n assert candidate(p = 450,q = 113) == 2\n assert candidate(p = 600,q = 200) == 1\n assert candidate(p = 800,q = 150) == 2\n assert candidate(p = 256,q = 128) == 2\n assert candidate(p = 256,q = 93) == 2\n"}, "metadata": {"canonical_parameter_names": ["p", "q"], "leetcode_dataset_entry_point": "Solution().mirrorReflection", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var mirrorReflection = function(p, q) {", "container": null, "callable": "mirrorReflection", "parameters": [{"name": "p", "type": "number"}, {"name": "q", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 859, "task_id": "buddy-strings", "difficulty": "Easy", "problem_description": "Given two strings s and goal, return true if you can swap two letters in s so the result is equal to goal, otherwise, return false.\nSwapping letters is defined as taking two indices i and j (0-indexed) such that i != j and swapping the characters at s[i] and s[j].\n\nFor example, swapping at indices 0 and 2 in \"abcd\" results in \"cbad\".\n\n \nExample 1:\n\nInput: s = \"ab\", goal = \"ba\"\nOutput: true\nExplanation: You can swap s[0] = 'a' and s[1] = 'b' to get \"ba\", which is equal to goal.\n\nExample 2:\n\nInput: s = \"ab\", goal = \"ab\"\nOutput: false\nExplanation: The only letters you can swap are s[0] = 'a' and s[1] = 'b', which results in \"ba\" != goal.\n\nExample 3:\n\nInput: s = \"aa\", goal = \"aa\"\nOutput: true\nExplanation: You can swap s[0] = 'a' and s[1] = 'a' to get \"aa\", which is equal to goal.\n\n \nConstraints:\n\n1 <= s.length, goal.length <= 2 * 104\ns and goal consist of lowercase letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"abcd\",goal = \"dcba\") == False\n assert candidate(s = \"xyy\",goal = \"xyx\") == False\n assert candidate(s = \"abac\",goal = \"abad\") == False\n assert candidate(s = \"aa\",goal = \"aa\") == True\n assert candidate(s = \"abcde\",goal = \"edcba\") == False\n assert candidate(s = \"aaaa\",goal = \"aaaa\") == True\n assert candidate(s = \"abab\",goal = \"abab\") == True\n assert candidate(s = \"ab\",goal = \"ab\") == False\n assert candidate(s = \"xyz\",goal = \"zyx\") == True\n assert candidate(s = \"aabbcc\",goal = \"ccbbaa\") == False\n assert candidate(s = \"abcd\",goal = \"cbad\") == True\n assert candidate(s = \"abcd\",goal = \"abdc\") == True\n assert candidate(s = \"xy\",goal = \"yx\") == True\n assert candidate(s = \"aabbcc\",goal = \"aabbcc\") == True\n assert candidate(s = \"abcde\",goal = \"abced\") == True\n assert candidate(s = \"ab\",goal = \"bba\") == False\n assert candidate(s = \"abcd\",goal = \"abcd\") == False\n assert candidate(s = \"abab\",goal = \"baba\") == False\n assert candidate(s = \"xx\",goal = \"xx\") == True\n assert candidate(s = \"aba\",goal = \"aba\") == True\n assert candidate(s = \"abcde\",goal = \"abcde\") == False\n assert candidate(s = \"abc\",goal = \"acb\") == True\n assert candidate(s = \"ab\",goal = \"ba\") == True\n assert candidate(s = \"abcdefghij\",goal = \"bacdefghij\") == True\n assert candidate(s = \"abcdefghi\",goal = \"abcdefghj\") == False\n assert candidate(s = \"xyzabc\",goal = \"zyxabc\") == True\n assert candidate(s = \"aabbccddeeff\",goal = \"aabbccdeeff\") == False\n assert candidate(s = \"abcabcabcabc\",goal = \"abcabcabcaba\") == False\n assert candidate(s = \"abacabad\",goal = \"abacabad\") == True\n assert candidate(s = \"aabbccdd\",goal = \"aabbcccc\") == False\n assert candidate(s = \"xyzz\",goal = \"zzyx\") == False\n assert candidate(s = \"aabb\",goal = \"bbaa\") == False\n assert candidate(s = \"xyzz\",goal = \"zzxy\") == False\n assert candidate(s = \"xyzzxyzz\",goal = \"zzxyzzxy\") == False\n assert candidate(s = \"abacab\",goal = \"babaab\") == False\n assert candidate(s = \"abcdefgh\",goal = \"efabcdgh\") == False\n assert candidate(s = \"abcdabcdabcd\",goal = \"abcdabcdabcd\") == True\n assert candidate(s = \"abcabcabc\",goal = \"abcabcabc\") == True\n assert candidate(s = \"abcaa\",goal = \"acbaa\") == True\n assert candidate(s = \"abcabcabc\",goal = \"abcabcbac\") == True\n assert candidate(s = \"aabbcc\",goal = \"abcabc\") == False\n assert candidate(s = \"aaaaaaa\",goal = \"aaaaaaa\") == True\n assert candidate(s = \"mississippi\",goal = \"ssimmisippi\") == False\n assert candidate(s = \"abcdefgh\",goal = \"abcdefgh\") == False\n assert candidate(s = \"aabbc\",goal = \"aabcb\") == True\n assert candidate(s = \"abcdefghi\",goal = \"abcdefghij\") == False\n assert candidate(s = \"aabbcc\",goal = \"aaccbb\") == False\n assert candidate(s = \"abracadabra\",goal = \"abracadabra\") == True\n assert candidate(s = \"aabbaa\",goal = \"aabbba\") == False\n assert candidate(s = \"aabbccddeeff\",goal = \"bbaaddeeccff\") == False\n assert candidate(s = \"abcdefghij\",goal = \"abcdefghij\") == False\n assert candidate(s = \"xyzz\",goal = \"zzxz\") == False\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",goal = \"abcdefghijklmnopqrstuvwxzy\") == True\n assert candidate(s = \"abacabad\",goal = \"abacabda\") == True\n assert candidate(s = \"mississippi\",goal = \"misssipii\") == False\n assert candidate(s = \"xyzz\",goal = \"yxzz\") == True\n assert candidate(s = \"aabbccddeeff\",goal = \"bbaaddeeffcc\") == False\n assert candidate(s = \"abcdef\",goal = \"fedcba\") == False\n assert candidate(s = \"xyzz\",goal = \"zyzz\") == False\n assert candidate(s = \"abcab\",goal = \"abcab\") == True\n assert candidate(s = \"mississippi\",goal = \"mpississii\") == False\n assert candidate(s = \"aabbccdd\",goal = \"aabbccdd\") == True\n assert candidate(s = \"abcabcabc\",goal = \"cbaabcabc\") == True\n assert candidate(s = \"abcdabcd\",goal = \"abcdabcd\") == True\n assert candidate(s = \"abac\",goal = \"acba\") == False\n assert candidate(s = \"aabbccddeeff\",goal = \"ffeeddccbbaa\") == False\n assert candidate(s = \"aabb\",goal = \"abab\") == True\n assert candidate(s = \"aabbccddeeffgg\",goal = \"aabbcdddeeffgg\") == False\n assert candidate(s = \"xyzxyz\",goal = \"zyxzyx\") == False\n assert candidate(s = \"xyzxyzxyz\",goal = \"zyxzyxzyx\") == False\n assert candidate(s = \"a\",goal = \"a\") == False\n assert candidate(s = \"abcdef\",goal = \"abdefc\") == False\n assert candidate(s = \"abccba\",goal = \"bacbca\") == False\n assert candidate(s = \"abcabcabc\",goal = \"bacbacbac\") == False\n assert candidate(s = \"xyzz\",goal = \"zyzx\") == True\n assert candidate(s = \"abcdefg\",goal = \"gfedcba\") == False\n assert candidate(s = \"abac\",goal = \"abca\") == True\n assert candidate(s = \"aabbccddeeff\",goal = \"aabbccddffee\") == False\n assert candidate(s = \"abcdexyz\",goal = \"abcdefyz\") == False\n assert candidate(s = \"abacaxbada\",goal = \"abacaxbada\") == True\n assert candidate(s = \"aabcc\",goal = \"acaab\") == False\n assert candidate(s = \"aabbccddeeffgg\",goal = \"aabbccddeeffgg\") == True\n assert candidate(s = \"xyzz\",goal = \"zyxz\") == True\n assert candidate(s = \"abcdeabcde\",goal = \"abcdeabcde\") == True\n assert candidate(s = \"abcdefgh\",goal = \"efghabcd\") == False\n assert candidate(s = \"xyzz\",goal = \"xyzz\") == True\n assert candidate(s = \"abcabcabc\",goal = \"bcaabcabc\") == False\n assert candidate(s = \"xyxyxyxyxy\",goal = \"yxyxyxyxyx\") == False\n assert candidate(s = \"abcdefghij\",goal = \"abcdefghik\") == False\n assert candidate(s = \"abababab\",goal = \"babababa\") == False\n assert candidate(s = \"abcdef\",goal = \"fabcde\") == False\n assert candidate(s = \"ababab\",goal = \"bababa\") == False\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",goal = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == True\n assert candidate(s = \"aaaabbbbcccc\",goal = \"ccccaaaabbbb\") == False\n assert candidate(s = \"aab\",goal = \"aba\") == True\n assert candidate(s = \"aabbc\",goal = \"aacbb\") == True\n assert candidate(s = \"xyzz\",goal = \"zzzx\") == False\n assert candidate(s = \"zzzzzzzz\",goal = \"zzzzzzzz\") == True\n assert candidate(s = \"abcdefghij\",goal = \"abcdefghji\") == True\n assert candidate(s = \"abcdeabcde\",goal = \"abcdebacde\") == True\n assert candidate(s = \"abcdefg\",goal = \"abcdefg\") == False\n assert candidate(s = \"abacabadabacaba\",goal = \"abacabadabacabb\") == False\n assert candidate(s = \"mississippi\",goal = \"mississippi\") == True\n assert candidate(s = \"abcdxy\",goal = \"abcdyx\") == True\n assert candidate(s = \"abcdexyz\",goal = \"xyzabcdexyz\") == False\n assert candidate(s = \"xyzz\",goal = \"zyyz\") == False\n assert candidate(s = \"abcabcabc\",goal = \"cbacbacba\") == False\n assert candidate(s = \"aabbccddeeff\",goal = \"aabbccddfeef\") == True\n assert candidate(s = \"aabbccddeeff\",goal = \"aabbccdeeef\") == False\n assert candidate(s = \"abacabadabacaba\",goal = \"babacabadabacab\") == False\n assert candidate(s = \"aabbccddeeff\",goal = \"aabbccddeeff\") == True\n assert candidate(s = \"aabbccddeeff\",goal = \"aabbccddeffg\") == False\n assert candidate(s = \"aabbb\",goal = \"bbaaa\") == False\n assert candidate(s = \"mississippi\",goal = \"mississipp\") == False\n assert candidate(s = \"abacabadabacaba\",goal = \"abacabadabacaba\") == True\n assert candidate(s = \"abcabcabcabc\",goal = \"abcabcabcabc\") == True\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",goal = \"zzxxwwvvuuttsrqponmlkjihgfedcbaabbccddeeffgg\") == False\n assert candidate(s = \"abcdabcd\",goal = \"dcbaabcd\") == False\n assert candidate(s = \"aabbccdd\",goal = \"bbaaddcc\") == False\n assert candidate(s = \"abcdefgh\",goal = \"hgfedcba\") == False\n assert candidate(s = \"abacaba\",goal = \"abacaba\") == True\n assert candidate(s = \"abcxy\",goal = \"abcyx\") == True\n assert candidate(s = \"abcdefgh\",goal = \"abcdefhg\") == True\n assert candidate(s = \"abacabad\",goal = \"abacabdc\") == False\n assert candidate(s = \"aaaaaa\",goal = \"aaaaaa\") == True\n assert candidate(s = \"abcdefghij\",goal = \"aibcdefghj\") == False\n"}, "metadata": {"canonical_parameter_names": ["s", "goal"], "leetcode_dataset_entry_point": "Solution().buddyStrings", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var buddyStrings = function(s, goal) {", "container": null, "callable": "buddyStrings", "parameters": [{"name": "s", "type": "string"}, {"name": "goal", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 860, "task_id": "lemonade-change", "difficulty": "Easy", "problem_description": "At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you and order one at a time (in the order specified by bills). Each customer will only buy one lemonade and pay with either a $5, $10, or $20 bill. You must provide the correct change to each customer so that the net transaction is that the customer pays $5.\nNote that you do not have any change in hand at first.\nGiven an integer array bills where bills[i] is the bill the ith customer pays, return true if you can provide every customer with the correct change, or false otherwise.\n \nExample 1:\n\nInput: bills = [5,5,5,10,20]\nOutput: true\nExplanation: \nFrom the first 3 customers, we collect three $5 bills in order.\nFrom the fourth customer, we collect a $10 bill and give back a $5.\nFrom the fifth customer, we give a $10 bill and a $5 bill.\nSince all customers got correct change, we output true.\n\nExample 2:\n\nInput: bills = [5,5,10,10,20]\nOutput: false\nExplanation: \nFrom the first two customers in order, we collect two $5 bills.\nFor the next two customers in order, we collect a $10 bill and give back a $5 bill.\nFor the last customer, we can not give the change of $15 back because we only have two $10 bills.\nSince not every customer received the correct change, the answer is false.\n\n \nConstraints:\n\n1 <= bills.length <= 105\nbills[i] is either 5, 10, or 20.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(bills = [5, 5, 5, 5, 20, 20, 5, 5, 20, 5]) == False\n assert candidate(bills = [5, 5, 10, 10, 5, 20]) == True\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 10, 10, 10, 20, 20, 20]) == True\n assert candidate(bills = [5, 5, 5, 5, 20, 5, 5, 5, 10, 5, 20]) == True\n assert candidate(bills = [5, 5, 10, 10, 20]) == False\n assert candidate(bills = [5, 5, 10, 10, 5, 20, 10, 5, 5, 20]) == False\n assert candidate(bills = [5, 10, 5, 5, 20]) == True\n assert candidate(bills = [5, 5, 5, 5, 10, 5, 10, 20]) == True\n assert candidate(bills = [5, 10, 5, 10, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 20]) == True\n assert candidate(bills = [10, 10]) == False\n assert candidate(bills = [5, 5, 5, 10, 20]) == True\n assert candidate(bills = [5, 5, 5, 5, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 10]) == True\n assert candidate(bills = [5, 10, 20, 10, 5]) == False\n assert candidate(bills = [5, 10, 5, 20]) == True\n assert candidate(bills = [5, 5, 5, 5, 20, 5, 10, 5, 20]) == True\n assert candidate(bills = [5, 20, 5, 5, 10, 10, 5, 10, 20, 5, 5, 10, 10, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 10, 10, 10, 5, 5, 10, 10, 5, 10, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 10, 5, 10, 20, 10, 5, 5, 20, 5, 5, 5, 10, 10, 5, 20, 10, 20, 5]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 5, 5, 5, 5, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 10, 5, 20, 5, 10, 5, 20, 5, 10, 5, 20, 5, 10, 5, 20]) == True\n assert candidate(bills = [5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 10, 5, 5, 5, 10, 5, 5, 10, 20, 5, 5, 10, 5, 5, 20, 10, 5, 20, 5, 5, 20]) == True\n assert candidate(bills = [5, 5, 10, 5, 5, 10, 5, 10, 20, 20, 5, 10, 20, 5]) == False\n assert candidate(bills = [20, 5, 5, 10, 5, 10, 20, 5, 10, 5, 10, 20, 5, 10, 5, 10, 20, 5, 10, 5, 10, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 10, 10, 10, 20, 5, 10, 10, 20, 5, 10, 20, 5, 10, 20, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == False\n assert candidate(bills = [5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20]) == True\n assert candidate(bills = [5, 10, 10, 20, 20, 20, 5, 5, 5, 5, 10, 10, 10, 10, 20, 20, 20, 5, 5, 5, 5, 10, 10, 10, 10, 20, 20, 20, 5, 5, 5, 5, 10, 10, 10, 10, 20, 20, 20]) == False\n assert candidate(bills = [5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5]) == False\n assert candidate(bills = [5, 10, 20, 10, 5, 20, 10, 5, 10, 20, 5, 5, 5, 10, 10, 5, 20, 10, 20, 5, 5, 10, 10, 10, 20, 5, 10]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 10, 10, 5, 10, 5, 5, 20, 20, 5, 5, 10, 10, 20, 5, 5, 10, 10, 20, 20, 5, 5, 10, 10, 20, 5, 5, 10, 10, 20, 20]) == False\n assert candidate(bills = [5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20]) == True\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 10, 10, 10, 20, 20, 20, 5, 5, 5, 5, 10, 10, 10, 20, 20, 20, 5, 5, 5, 5, 10, 10, 10, 20, 20, 20, 5, 5, 5, 5, 10, 10, 10, 20, 20, 20, 5, 5, 5, 5, 10, 10, 10, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 10, 10, 10, 20, 5, 10, 5, 10, 20, 10, 5, 5, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 10, 10, 5, 20, 10, 5, 5, 20, 20, 5, 10, 5, 10, 5, 20, 10, 20, 10, 20, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(bills = [5, 10, 10, 10, 10, 20, 20, 20, 20, 5, 5, 5, 5, 10, 10]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 10, 10, 5, 10, 20, 5, 10, 10, 20, 5, 5, 5, 10, 20]) == False\n assert candidate(bills = [5, 5, 10, 5, 10, 20, 5, 10, 10, 20, 5, 10, 20, 10, 5, 5, 5, 20, 20, 20]) == False\n assert candidate(bills = [5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [20, 5, 5, 5, 10, 10, 20, 5, 5, 10, 5, 10, 20, 20, 5, 5, 10, 5, 10, 20, 5, 5, 10, 5, 10, 20, 20, 5, 5, 10, 5, 10, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 10, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20]) == True\n assert candidate(bills = [5, 10, 20, 5, 10, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20, 5, 5, 10, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 10, 5, 5, 10, 20, 5, 10, 5, 5, 10, 10, 5, 5, 10, 20, 5, 10, 5, 5, 10, 20, 5, 10]) == True\n assert candidate(bills = [5, 5, 5, 5, 10, 10, 10, 20, 20, 20, 5, 5, 10, 10, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 10, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 10, 10, 10, 20, 20, 20, 5, 5, 5, 10, 10, 20, 5, 5, 5, 10, 10, 20, 5, 5, 5, 10, 10, 20, 5, 5, 5, 5, 10, 10, 10, 20, 20]) == False\n assert candidate(bills = [5, 5, 10, 5, 10, 20, 10, 5, 20, 5, 10, 5, 5, 10, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20, 5, 10, 20]) == False\n assert candidate(bills = [5, 5, 5, 10, 10, 10, 10, 10, 10, 5, 5, 5, 5, 10, 10, 20, 20, 20, 10, 10, 10, 10, 10, 10, 5, 5, 5]) == False\n assert candidate(bills = [5, 20, 5, 5, 5, 10, 10, 10, 5, 5, 5, 5, 10, 10, 10, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 10, 10, 10, 10, 20, 20, 20, 20, 5, 5, 5, 5, 10, 10, 10, 10, 20, 20, 20, 20, 5, 5, 5, 5, 10, 10, 10, 10, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 10, 5, 20, 10, 10, 20, 5, 10, 5, 20, 5, 10, 5, 20, 5, 10, 5, 20]) == False\n assert candidate(bills = [5, 5, 10, 10, 5, 10, 5, 5, 20, 20, 5, 10, 5, 5, 20, 20, 5, 10, 5, 5, 20, 20, 5, 10, 5, 5, 20, 20, 5, 10, 5, 5, 20, 20]) == False\n assert candidate(bills = [5, 10, 5, 20, 10, 20, 5, 10, 5, 20, 10, 20, 5, 10, 5, 20, 10, 20, 5, 10, 5, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 10, 10, 20, 20, 5, 10, 5, 5, 20, 20, 5, 10, 5, 5, 20, 20, 5, 10, 5, 5, 20, 20, 5, 10, 5, 5, 20, 20, 5, 5, 10, 10, 20, 20]) == False\n assert candidate(bills = [5, 5, 10, 10, 20, 5, 10, 10, 20, 5, 5, 10, 10, 20]) == False\n assert candidate(bills = [5, 5, 5, 10, 10, 20, 20, 5, 5, 10, 10, 20, 5, 5, 10]) == False\n assert candidate(bills = [20, 5, 5, 5, 10, 10, 5, 5, 20, 5, 10, 5, 5, 20, 10, 5, 10, 20, 5, 10, 20, 5, 5, 5, 5, 10, 10, 10, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 10, 10, 10, 10, 20, 20, 20, 20, 10, 10, 10, 20, 20, 20, 20, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(bills = [5, 10, 5, 10, 5, 10, 5, 10, 20, 20, 20, 5, 5, 10, 10, 20]) == False\n assert candidate(bills = [20, 5, 5, 5, 10, 10, 5, 20, 10, 5, 10, 20, 10, 5, 20, 5, 10, 10, 20, 5, 5]) == False\n assert candidate(bills = [5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 10, 10, 20, 5, 10, 10, 20, 5, 10, 10, 20, 5, 10, 10, 20]) == False\n assert candidate(bills = [5, 5, 5, 10, 10, 10, 20, 20, 20, 5, 5, 5, 10, 10, 10, 20, 20, 20, 5, 5, 5, 10, 10, 10, 20, 20, 20, 5, 5, 5, 10, 10, 10, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [20, 5, 5, 5, 10, 10, 20, 5, 5, 10, 5, 10, 20, 20]) == False\n assert candidate(bills = [5, 20, 5, 5, 10, 5, 20, 10, 10, 20, 5, 10, 5, 20, 10, 5, 5, 10, 20, 5, 5]) == False\n assert candidate(bills = [5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20, 5, 20]) == False\n assert candidate(bills = [5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 10, 20, 10, 5, 20, 10, 20, 10, 5, 20, 10, 5, 20, 10, 5, 20, 10, 5, 20, 10, 5, 20, 10, 5, 20, 10, 5, 20, 10, 5, 20, 10, 5, 20, 10, 5, 20, 10, 5, 20, 10, 5, 20, 10, 5, 20]) == False\n assert candidate(bills = [20, 5, 5, 5, 10, 10, 5, 5, 5, 10, 10, 5, 5, 5, 10, 10, 5, 5, 5, 10, 10, 5, 5, 5, 10, 10, 5, 5, 5, 10, 10, 5, 5, 5, 10, 10, 5, 5, 5, 10, 10]) == False\n assert candidate(bills = [5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 20, 20, 20]) == False\n assert candidate(bills = [5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10]) == True\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 10, 10, 10, 20, 5, 5, 5, 10, 10, 20, 5, 5, 5, 10, 10, 20, 5, 5, 5, 10, 10, 20, 5, 5]) == True\n assert candidate(bills = [5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 10, 10, 10, 10, 20, 20, 20, 20, 5, 5, 10, 10, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 5, 10, 20, 5, 10, 10, 20, 5, 5, 5, 10, 20, 20]) == False\n assert candidate(bills = [5, 10, 20, 20, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5]) == False\n assert candidate(bills = [5, 10, 10, 20, 5, 5, 5, 10, 20, 10, 5, 5, 10, 20, 5, 5, 5, 10, 20, 10, 5, 5, 10, 20, 5, 5, 5, 10, 20]) == False\n assert candidate(bills = [20, 5, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 20, 5, 10, 5, 10, 5, 10, 5, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(bills = [5, 5, 10, 5, 10, 10, 20, 5, 10, 10, 20, 5, 10, 10, 20, 5, 10, 10, 20, 5, 10, 10, 20]) == False\n assert candidate(bills = [5, 5, 10, 20, 20, 20, 20, 5, 5, 5, 10, 10, 10, 20, 20, 20, 20, 10, 10, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(bills = [5, 5, 10, 10, 5, 20, 10, 5, 5, 20, 10, 5, 5, 20, 10, 5, 5, 5, 10, 20]) == False\n assert candidate(bills = [5, 10, 5, 10, 5, 10, 20, 5, 10, 20, 5, 10, 20]) == False\n assert candidate(bills = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20]) == False\n assert candidate(bills = [5, 20, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10]) == False\n"}, "metadata": {"canonical_parameter_names": ["bills"], "leetcode_dataset_entry_point": "Solution().lemonadeChange", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var lemonadeChange = function(bills) {", "container": null, "callable": "lemonadeChange", "parameters": [{"name": "bills", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 861, "task_id": "score-after-flipping-matrix", "difficulty": "Medium", "problem_description": "You are given an m x n binary matrix grid.\nA move consists of choosing any row or column and toggling each value in that row or column (i.e., changing all 0's to 1's, and all 1's to 0's).\nEvery row of the matrix is interpreted as a binary number, and the score of the matrix is the sum of these numbers.\nReturn the highest possible score after making any number of moves (including zero moves).\n \nExample 1:\n\n\nInput: grid = [[0,0,1,1],[1,0,1,0],[1,1,0,0]]\nOutput: 39\nExplanation: 0b1111 + 0b1001 + 0b1111 = 15 + 9 + 15 = 39\n\nExample 2:\n\nInput: grid = [[0]]\nOutput: 1\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m, n <= 20\ngrid[i][j] is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[0, 0, 1, 1], [1, 0, 1, 0], [1, 1, 0, 0]]) == 39\n assert candidate(grid = [[1, 0, 0], [0, 1, 1], [1, 1, 0]]) == 19\n assert candidate(grid = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 0, 0, 0, 0]]) == 83\n assert candidate(grid = [[1, 0, 0, 1, 0], [1, 0, 1, 0, 1], [0, 0, 1, 0, 0]]) == 78\n assert candidate(grid = [[1, 1, 1], [0, 0, 0], [1, 0, 1]]) == 19\n assert candidate(grid = [[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == 45\n assert candidate(grid = [[1, 1, 1, 1], [0, 0, 0, 0], [1, 0, 1, 0]]) == 40\n assert candidate(grid = [[0]]) == 1\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 45\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 21\n assert candidate(grid = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) == 18\n assert candidate(grid = [[1, 0, 0, 1], [0, 1, 1, 0], [1, 0, 0, 1], [0, 1, 1, 0]]) == 60\n assert candidate(grid = [[1, 1, 1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 3370\n assert candidate(grid = [[1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1], [1, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1]]) == 270\n assert candidate(grid = [[1, 0, 0, 0, 1, 1, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 0, 1, 1, 0, 1, 1, 0]]) == 3453\n assert candidate(grid = [[0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0]]) == 816\n assert candidate(grid = [[1, 1, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0]]) == 211\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 3508\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 3410\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 2044\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2097150\n assert candidate(grid = [[1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 406\n assert candidate(grid = [[0, 0, 1, 1, 1, 1, 0, 0], [1, 1, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 810\n assert candidate(grid = [[0, 0, 1, 1, 0, 1], [1, 1, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0], [0, 1, 0, 1, 0, 1]]) == 267\n assert candidate(grid = [[1, 1, 0, 0, 1, 1, 0, 1], [0, 0, 1, 1, 0, 0, 1, 0], [1, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1, 1, 0]]) == 852\n assert candidate(grid = [[0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == 252\n assert candidate(grid = [[0, 0, 1, 0, 1], [1, 0, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 0, 1]]) == 99\n assert candidate(grid = [[1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 135\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 16380\n assert candidate(grid = [[0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1]]) == 210\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 3495250\n assert candidate(grid = [[0, 1, 1, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0]]) == 850\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 1, 1, 0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1, 0, 0, 1, 1]]) == 3684\n assert candidate(grid = [[0, 1, 1, 0, 1], [1, 0, 1, 1, 0], [0, 1, 0, 0, 1], [1, 1, 1, 0, 0]]) == 110\n assert candidate(grid = [[1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0], [1, 1, 0, 1, 0, 0], [0, 0, 0, 0, 1, 1]]) == 210\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1]]) == 508\n assert candidate(grid = [[0, 1, 1, 0, 1], [1, 0, 1, 0, 0], [0, 0, 0, 1, 1], [1, 1, 1, 1, 0]]) == 100\n assert candidate(grid = [[0, 1, 1, 0, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 0, 1, 0, 1]]) == 2044\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]]) == 635\n assert candidate(grid = [[1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 418\n assert candidate(grid = [[1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 0, 1, 1, 0]]) == 257\n assert candidate(grid = [[1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 8188\n assert candidate(grid = [[0, 0, 1, 1, 0, 1], [1, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == 204\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2044\n assert candidate(grid = [[1, 0, 1], [0, 1, 0], [1, 0, 1], [0, 1, 0], [1, 0, 1]]) == 35\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 1530\n assert candidate(grid = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 1, 0, 1], [1, 0, 0, 1, 0]]) == 110\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 1704\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 635\n assert candidate(grid = [[1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1], [1, 1, 0, 1, 1, 0], [0, 0, 1, 0, 1, 1]]) == 218\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 3410\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1]]) == 918\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0]]) == 228\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 1, 0, 0, 1], [0, 0, 1, 1, 0]]) == 100\n assert candidate(grid = [[1, 0, 0, 1, 1, 0, 1, 0], [0, 1, 1, 0, 0, 1, 0, 1], [1, 1, 0, 1, 1, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 1]]) == 892\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 508\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]]) == 210\n assert candidate(grid = [[0, 1, 1, 0, 0, 1, 1, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 1, 1, 0, 1], [0, 0, 1, 1, 1, 0, 0, 1, 0]]) == 1662\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 0]]) == 508\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0]]) == 424\n assert candidate(grid = [[1, 1, 1, 0, 1], [0, 0, 0, 0, 1], [1, 1, 0, 1, 1], [0, 0, 1, 0, 0]]) == 113\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 13650\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 0], [1, 0, 0, 1, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0], [1, 0, 1, 0, 0, 1, 1]]) == 433\n assert candidate(grid = [[1, 1, 0, 0, 1, 0], [0, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 204\n assert candidate(grid = [[1, 0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 0, 1]]) == 787\n assert candidate(grid = [[0, 1, 1, 1, 0], [1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 116\n assert candidate(grid = [[1, 1, 1, 0, 0, 1, 1, 0, 0, 1], [0, 0, 0, 1, 1, 0, 0, 1, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 3478\n assert candidate(grid = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == 60\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 1020\n assert candidate(grid = [[0, 0, 1, 1, 1], [1, 0, 0, 1, 0], [1, 1, 0, 0, 0], [0, 1, 1, 0, 1]]) == 104\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 850\n assert candidate(grid = [[1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 1], [1, 1, 1, 0, 1, 1, 1], [0, 0, 0, 1, 0, 0, 0]]) == 418\n assert candidate(grid = [[1, 1, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1, 1, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 3274\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 155\n assert candidate(grid = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 124\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [1, 1, 1, 1, 1]]) == 125\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 124\n assert candidate(grid = [[0, 0, 1, 1, 1, 0, 1], [1, 1, 0, 0, 0, 1, 0], [0, 1, 1, 0, 1, 0, 0], [1, 0, 0, 1, 0, 1, 1]]) == 426\n assert candidate(grid = [[0, 1, 0, 1, 1], [1, 0, 1, 0, 0], [1, 1, 0, 1, 1], [0, 0, 1, 1, 0]]) == 96\n assert candidate(grid = [[1, 1, 0, 1, 0, 0], [0, 1, 0, 0, 1, 1], [1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1]]) == 208\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().matrixScore", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var matrixScore = function(grid) {", "container": null, "callable": "matrixScore", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 862, "task_id": "shortest-subarray-with-sum-at-least-k", "difficulty": "Hard", "problem_description": "Given an integer array nums and an integer k, return the length of the shortest non-empty subarray of nums with a sum of at least k. If there is no such subarray, return -1.\nA subarray is a contiguous part of an array.\n \nExample 1:\nInput: nums = [1], k = 1\nOutput: 1\nExample 2:\nInput: nums = [1,2], k = 4\nOutput: -1\nExample 3:\nInput: nums = [2,-1,2], k = 3\nOutput: 3\n\n \nConstraints:\n\n1 <= nums.length <= 105\n-105 <= nums[i] <= 105\n1 <= k <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [-1, 2, -3, 4, -5],k = 3) == 1\n assert candidate(nums = [-1, 2],k = 2) == 1\n assert candidate(nums = [2, -1, 2],k = 3) == 3\n assert candidate(nums = [2, 1, 5, 1, 3, 2],k = 7) == 3\n assert candidate(nums = [-1, -2, -3, -4, -5],k = 3) == -1\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 25) == 5\n assert candidate(nums = [2, -2, 2, -4, 3, -1, 2, -1, 2, -4, 3, -1],k = 5) == 5\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 5\n assert candidate(nums = [1],k = 1) == 1\n assert candidate(nums = [5, 4, 3, 2, 1],k = 5) == 1\n assert candidate(nums = [5, 1, 3, 5, 10, 7, 4, 9, 2, 8],k = 15) == 2\n assert candidate(nums = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10],k = 15) == -1\n assert candidate(nums = [1, 2, 3, 4, 5],k = 16) == -1\n assert candidate(nums = [48, 99, 37, 4, -31],k = 140) == 2\n assert candidate(nums = [10, 20, 30, 40, 50],k = 100) == 3\n assert candidate(nums = [8],k = 8) == 1\n assert candidate(nums = [8, 2, 4, -6, 7, -4, 3, 5],k = 10) == 2\n assert candidate(nums = [1, 2],k = 4) == -1\n assert candidate(nums = [2, -2, 2, 2, -2, 2, 2, -2, 2, 2],k = 4) == 2\n assert candidate(nums = [8],k = 10) == -1\n assert candidate(nums = [2, -1, 2],k = 2) == 1\n assert candidate(nums = [5],k = 5) == 1\n assert candidate(nums = [1, 2, 3, 4, 5],k = 15) == 5\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 250) == 3\n assert candidate(nums = [10, 5, 2, 7],k = 15) == 2\n assert candidate(nums = [10, -2, 5, -1, 3, -1, -2, 4, 7, -5, 2],k = 10) == 1\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 55) == 10\n assert candidate(nums = [100000, 100000, 100000, 100000, 100000, 100000],k = 500000) == 5\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10],k = -15) == 1\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10],k = 5) == -1\n assert candidate(nums = [1, 2, -1, 2, -1, 2, -1, 2, -1],k = 3) == 2\n assert candidate(nums = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 150) == 10\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 550) == 10\n assert candidate(nums = [8, 2, 4, -2, 3, 1, 5],k = 10) == 2\n assert candidate(nums = [100, -25, 100, -25, 100, -25, 100, -25, 100, -25],k = 200) == 5\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 25) == 3\n assert candidate(nums = [10, 20, -30, 40, 50, -60, 70, -80],k = 150) == -1\n assert candidate(nums = [-1, 2, 3, 4, -10, 5, 6],k = 10) == 2\n assert candidate(nums = [10000, 20000, -30000, 40000, 50000, -60000, 70000, -80000],k = 100000) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 20) == 3\n assert candidate(nums = [10, -1, -2, 3, 4, -5, 6, -7, 8, -9],k = 15) == 7\n assert candidate(nums = [100000, -50000, 50000, -25000, 25000, -12500, 12500, 6250],k = 250000) == -1\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 1500) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 55) == 5\n assert candidate(nums = [100000, -50000, 200000, -150000, 300000],k = 600000) == -1\n assert candidate(nums = [1, 0, 1, 1, 1, 0, 1, -1, 1, 1, 1],k = 4) == 5\n assert candidate(nums = [50, 40, 30, 20, 10],k = 90) == 2\n assert candidate(nums = [100000, -100000, 100000, -100000, 100000],k = 100000) == 1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 55) == 10\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 55) == 10\n assert candidate(nums = [-5, -4, -3, -2, -1],k = -15) == 1\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 100) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 1) == 1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 10\n assert candidate(nums = [8, 2, -4, 1, 6, -5, 4],k = 10) == 2\n assert candidate(nums = [10, -10, 10, -10, 10],k = 20) == -1\n assert candidate(nums = [100000, -50000, 50000, -25000, 25000, -12500, 12500],k = 100000) == 1\n assert candidate(nums = [5, -1, 5, -1, 5, -1, 5, -1, 5, -1],k = 15) == 7\n assert candidate(nums = [1000000000, 1000000000, 1000000000, 1000000000],k = 4000000000) == 4\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 5) == -1\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 500) == 8\n assert candidate(nums = [100000, -99999, 100000, -99999, 100000],k = 1) == 1\n assert candidate(nums = [-1, -2, -3, 10, -5, 2, -1, 3],k = 5) == 1\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 1) == 1\n assert candidate(nums = [84, -37, 32, 40, 95],k = 167) == 3\n assert candidate(nums = [10, 20, 30, 40, 50],k = 150) == 5\n assert candidate(nums = [5, -1, 5, -1, 5, -1],k = 10) == 5\n assert candidate(nums = [100, 200, 300, 400, 500],k = 1500) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 15) == 2\n assert candidate(nums = [1, 2, -3, 4, -5, 6, -7, 8, -9, 10],k = 7) == 1\n assert candidate(nums = [-100, 150, -200, 250, -300, 350, -400, 450, -500, 550],k = 1500) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, -1, -2, -3, -4, -5],k = 9) == 2\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 100) == 6\n assert candidate(nums = [3, -2, 5, -1, 2, -3, 1, 4],k = 7) == 5\n assert candidate(nums = [8, 2, -5, 7, 11, -10, 15, 1],k = 15) == 1\n assert candidate(nums = [3, 4, 5, 1, 2, 7, 8, 9, 10, 1],k = 25) == 3\n assert candidate(nums = [-10, 20, -30, 40, -50, 60, -70, 80, -90, 100],k = 100) == 1\n assert candidate(nums = [8, 2, 4, -1, 0, 5, -3, 2],k = 16) == 6\n assert candidate(nums = [5, 1, 3, 5, 2, 4, 6, 1, 7, 8],k = 20) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 15) == 2\n assert candidate(nums = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10],k = 15) == -1\n assert candidate(nums = [3, -2, 5, -1, 4],k = 6) == 3\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5],k = 5) == 1\n assert candidate(nums = [10, 20, 30, -10, -20, -30, 40, 50, 60],k = 100) == 2\n assert candidate(nums = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10],k = 1) == 1\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10],k = 5) == -1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 10\n assert candidate(nums = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10],k = 5) == 1\n assert candidate(nums = [5, -2, 4, 6, -1, 3, -3, 2, 7, -8],k = 12) == 4\n assert candidate(nums = [5, 1, -1, 5, 10, -10, 20, -20, 30, -30],k = 15) == 1\n assert candidate(nums = [1, -1, 5, -2, 3],k = 3) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 75) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 50) == 3\n assert candidate(nums = [10, 20, 30, -10, -20, -30, 40, 50, -40, -50, 60, 70],k = 100) == 2\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 5500) == 10\n assert candidate(nums = [1, 0, 2, 0, 3, 0, 4, 0, 5, 0],k = 10) == 5\n assert candidate(nums = [5, 2, 3, -2, 4, 5, 1, -1, 2, -3, 6, 7, 8, -4, 5, 6],k = 20) == 3\n assert candidate(nums = [100, -25, 25, -25, 25, -25, 25, -25, 25],k = 50) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 120) == 15\n assert candidate(nums = [2, -2, 2, -2, 2, -2, 2, -2, 2, -2],k = 1) == 1\n assert candidate(nums = [8, 2, -3, 7, 2, -4, 6, -8],k = 5) == 1\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 1) == 1\n assert candidate(nums = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10],k = 5) == 1\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 1) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 90) == 8\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 100) == -1\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10],k = 10) == -1\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 25) == 5\n assert candidate(nums = [5, -2, 3, 8, -4, 7],k = 10) == 2\n assert candidate(nums = [10, -1, 20, -2, 30, -3, 40, -4, 50, -5],k = 100) == 5\n assert candidate(nums = [-1, 1, 1, -1, 1, 1, 1, -1, 1],k = 2) == 2\n assert candidate(nums = [100000],k = 100000) == 1\n assert candidate(nums = [10, -20, 30, -40, 50, -60, 70, -80, 90, -100],k = 50) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 100) == 6\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 45) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 55) == 10\n assert candidate(nums = [1, 2, 3, 4, 5],k = 15) == 5\n assert candidate(nums = [5, -2, 5, -2, 5, -2, 5, -2, 5, -2],k = 10) == 5\n assert candidate(nums = [-1, -2, -3, -4, -5],k = 1) == -1\n assert candidate(nums = [-100000, -100000, -100000, -100000, -100000],k = 100000) == -1\n assert candidate(nums = [1, 2, 3, -6, 4, 5, -3, 2, 1, 0, -1, 2, 3, -5, 6, 7],k = 15) == 9\n assert candidate(nums = [8, 2, -3, 4, 6, -5, 2, 7],k = 15) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 100) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 100) == -1\n assert candidate(nums = [5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5],k = 20) == 5\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 550) == 10\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().shortestSubarray", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shortestSubarray = function(nums, k) {", "container": null, "callable": "shortestSubarray", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 864, "task_id": "shortest-path-to-get-all-keys", "difficulty": "Hard", "problem_description": "You are given an m x n grid grid where:\n\n'.' is an empty cell.\n'#' is a wall.\n'@' is the starting point.\nLowercase letters represent keys.\nUppercase letters represent locks.\n\nYou start at the starting point and one move consists of walking one space in one of the four cardinal directions. You cannot walk outside the grid, or walk into a wall.\nIf you walk over a key, you can pick it up and you cannot walk over a lock unless you have its corresponding key.\nFor some 1 <= k <= 6, there is exactly one lowercase and one uppercase letter of the first k letters of the English alphabet in the grid. This means that there is exactly one key for each lock, and one lock for each key; and also that the letters used to represent the keys and locks were chosen in the same order as the English alphabet.\nReturn the lowest number of moves to acquire all keys. If it is impossible, return -1.\n \nExample 1:\n\n\nInput: grid = [\"@.a..\",\"###.#\",\"b.A.B\"]\nOutput: 8\nExplanation: Note that the goal is to obtain all the keys not to open all the locks.\n\nExample 2:\n\n\nInput: grid = [\"@..aA\",\"..B#.\",\"....b\"]\nOutput: 6\n\nExample 3:\n\n\nInput: grid = [\"@Aa\"]\nOutput: -1\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m, n <= 30\ngrid[i][j] is either an English letter, '.', '#', or '@'. \nThere is exactly one '@' in the grid.\nThe number of keys in the grid is in the range [1, 6].\nEach key in the grid is unique.\nEach key in the grid has a matching lock.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = ['@.b..', '###.#', 'A.B.c']) == -1\n assert candidate(grid = ['@.b', '#.A', 'aBc']) == 8\n assert candidate(grid = ['@Aa']) == -1\n assert candidate(grid = ['@.b..', '#.A#.', 'a.c.C']) == 8\n assert candidate(grid = ['@...a', '#.#B.', '.....', 'b.cC.', '.....']) == 11\n assert candidate(grid = ['@...a', '.#.b.', '....A', '#..B.', '....b']) == -1\n assert candidate(grid = ['@...a', '#.###', 'b.BA.']) == 10\n assert candidate(grid = ['@........a', '........B', '.........', '.......C.', '.........', '.....D...']) == 9\n assert candidate(grid = ['aA.b', '@.B#', '....']) == 4\n assert candidate(grid = ['@.a..', '###.#', 'b.A.B']) == 8\n assert candidate(grid = ['@.aA', 'b.Bb', '....']) == -1\n assert candidate(grid = ['@..aA', '..B#.', '....b']) == 6\n assert candidate(grid = ['@abc', '###.', 'A#B.', 'C...']) == 3\n assert candidate(grid = ['@abc', '###.', 'A.BC']) == 3\n assert candidate(grid = ['@.....', '.....a', '#.....', '.....b', '#.....', '.....A', '#.....', '.....B']) == 8\n assert candidate(grid = ['@abcdef', '###GHI.', 'JKLMNO.', 'PQRST.', 'UVWXY.', 'Z.....']) == 6\n assert candidate(grid = ['@.....', '.....a', '#.....', '.....b', '#.....', '.....A', '#.....', '.....B', '......c', '......C']) == -1\n assert candidate(grid = ['@.abc', '###.#', 'A#B#C', 'D.E.F', 'G.H.I', 'J.K.L', 'M.N.O', 'P.Q.R', 'S.T.U', 'V.W.X', 'Y.Z.']) == 4\n assert candidate(grid = ['@..a..', '###.B.', '....C.', '#.D.E.', '....F.', '#.G.H.', '....I.', '#.J.K.', '....L.', '#.M.N.', '....O.', '#.P.Q.', '....R.', '#.S.T.', '....U.', '#.V.W.', '....X.', '#.Y.Z.', '.....']) == 3\n assert candidate(grid = ['@.a...', '#.bC..', 'D#E.F', 'G...H', '...IJ', '....K']) == 3\n assert candidate(grid = ['@..a..', '###.#B', '...c.C', '#####.', '..b..A']) == 12\n assert candidate(grid = ['@...a', '.#.b.', '....A', '#..B.', '....b', 'c...#', '...C.']) == -1\n assert candidate(grid = ['@.....', '.#...B', 'A...#.', '.c..#.', '.....d']) == -1\n assert candidate(grid = ['@.a..', '###.#', 'b.A.B', 'C#dE.', 'f...G', '#H..i', 'j...K', 'L....']) == -1\n assert candidate(grid = ['@abc', '###.', 'A.BC', 'D#..', '...E', 'f...', '#G..', 'hI..']) == -1\n assert candidate(grid = ['@...a', '###.#', 'b.A.B', '###.#', '....b', 'C...c', 'd.D.e']) == -1\n assert candidate(grid = ['@...a', '###b.', 'A#B..', 'C...d', '###D.', '...eE', 'f..#.', '..F..']) == -1\n assert candidate(grid = ['@.a###', '.....#', 'b...A#', '....#B', '.....c', '.....C']) == 13\n assert candidate(grid = ['@.......', '......#.', 'b.....A.', '....#B..', '.......c', '......C.']) == -1\n assert candidate(grid = ['@abcdef', '###GHIJ', 'KLMNO.', 'PQRST.', 'UVWXY.', 'Z.....', '....AB', 'CDEFGH']) == 6\n assert candidate(grid = ['@.a...', '#.bC..', 'D#E.F', 'G...H', '...IJ', '....K', '....L', '....M']) == 3\n assert candidate(grid = ['@...a', '###b.', 'A....', '#B...']) == 6\n assert candidate(grid = ['@.......', '..a.....', '......b.', '......B.', '......A.', '......c.', '......C.', '.......@']) == 11\n assert candidate(grid = ['@.a.....', '.#####', '#.B.C.D', '#.E.F.G', '#.H.I.J', '#.K.L.M', '#.N.O.P', '#.Q.R.S', '#.T.U.V', '#.W.X.Y', '#.Z....', '........']) == 2\n assert candidate(grid = ['@..aB', '###.#', '..c.C', '#####', '..bA.']) == -1\n assert candidate(grid = ['@.a.b', '##..#', '.C...', 'A###.', '....B']) == 4\n assert candidate(grid = ['@abcABC', '......', '......', '......', '......', '......']) == 3\n assert candidate(grid = ['@.aBc', '###D.', 'E...F', 'G#b.H', '....I']) == -1\n assert candidate(grid = ['@.a.B', '###.#', 'cA.BC', '###d.', '....D']) == -1\n assert candidate(grid = ['@.a.B', '###.#', 'cA.BC', '###d.', '....D', '.efE.', '#F...', 'g....']) == -1\n assert candidate(grid = ['@.a..', '###B.', '....A', 'b....']) == 11\n assert candidate(grid = ['@.abc', '###.#', 'A#B#C', 'd.e.f', 'D.E.F', '...gH', '...ih']) == -1\n assert candidate(grid = ['@.a.b', '#.C.D', '....E', 'F.G.H', 'I.J.K', 'L.M.N', 'O.P.@']) == 4\n assert candidate(grid = ['@.aB', '.###', 'C#b.', 'c...', '....']) == -1\n assert candidate(grid = ['@...a', '###.#', 'b.A.B', '###.#', '....b', 'C...c']) == -1\n assert candidate(grid = ['@.a...', '#.....', 'b.....', '#.....', '.....A', '.....B']) == 6\n assert candidate(grid = ['@.aB', '###C', 'D#bE', 'F...', '.G.H']) == -1\n assert candidate(grid = ['@...a', '###b.', '#B...', '....A', '....b']) == -1\n assert candidate(grid = ['@....', '#.aB.', 'C#b.D', '.FEG.', '....H']) == 4\n assert candidate(grid = ['@...a', '###.#', 'b.A.B', '###.#', '....b', 'C...c', 'D...d', 'E...e', 'F...f']) == -1\n assert candidate(grid = ['@abc', '###.', 'A.BC', 'D...', '..EF', 'G...', '.H..', 'IJKL']) == 3\n assert candidate(grid = ['@.aBc', '##D..', 'E...C', 'F#bA.', '....G']) == -1\n assert candidate(grid = ['@.a..', '#.B..', '...cA', 'd.B.c', 'A.#..']) == -1\n assert candidate(grid = ['@......', '###...#', '.....B.', '#####.', '.....A', '#####.', '.....c', '.....C', '.....d', '.....D']) == -1\n assert candidate(grid = ['@...a', '#.b.B', '#.#.#', 'A.B.a', '.B...', 'c....']) == -1\n assert candidate(grid = ['@.#.a', '#..b.', '...A.', '#..B.', '....b', 'c....', 'C...d']) == -1\n assert candidate(grid = ['@.....', '.A.B.C', '######', '.D.E.F', '######', '.G.H.I', '######', '.J.K.L', '######', '.M.N.O', '######', '.P.Q.R', '.....@', '.....S', '.....T', '.....U', '.....V', '.....W', '.....X', '.....Y', '.....Z']) == 0\n assert candidate(grid = ['@abc', '###.', 'A.BC', 'D...', '..EF', 'G...', '.H..', 'IJKL', '#...', 'M...']) == 3\n assert candidate(grid = ['@.a.b', '##C..', 'D#E.F', 'G...H', '...IJ', '....K', '....L', '....M', '....N']) == 4\n assert candidate(grid = ['@.....', '.A.B..', '#####.', '..C.D.', 'E.F.G.', 'H.I.J.', 'K.L.M.', 'N.O.P.', 'Q.R.S.', 'T.U.V.', 'W.X.Y.', 'Z......']) == 0\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().shortestPathAllKeys", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shortestPathAllKeys = function(grid) {", "container": null, "callable": "shortestPathAllKeys", "parameters": [{"name": "grid", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 865, "task_id": "smallest-subtree-with-all-the-deepest-nodes", "difficulty": "Medium", "problem_description": "Given the root of a binary tree, the depth of each node is the shortest distance to the root.\nReturn the smallest subtree such that it contains all the deepest nodes in the original tree.\nA node is called the deepest if it has the largest depth possible among any node in the entire tree.\nThe subtree of a node is a tree consisting of that node, plus the set of all descendants of that node.\n \nExample 1:\n\n\nInput: root = [3,5,1,6,2,0,8,null,null,7,4]\nOutput: [2,7,4]\nExplanation: We return the node with value 2, colored in yellow in the diagram.\nThe nodes coloured in blue are the deepest nodes of the tree.\nNotice that nodes 5, 3 and 2 contain the deepest nodes in the tree but node 2 is the smallest subtree among them, so we return it.\n\nExample 2:\n\nInput: root = [1]\nOutput: [1]\nExplanation: The root is the deepest node in the tree.\n\nExample 3:\n\nInput: root = [0,1,3,null,2]\nOutput: [2]\nExplanation: The deepest node in the tree is 2, the valid subtrees are the subtrees of nodes 2, 1 and 0 but the subtree of node 2 is the smallest.\n\n \nConstraints:\n\nThe number of nodes in the tree will be in the range [1, 500].\n0 <= Node.val <= 500\nThe values of the nodes in the tree are unique.\n\n \nNote: This question is the same as 1123: https://leetcode.com/problems/lowest-common-ancestor-of-deepest-leaves/\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7])), tree_node([1, 2, 3, 4, 5, 6, 7]))\n assert is_same_tree(candidate(root = tree_node([0, 1, None, 3, 2, None, None, None, 4])), tree_node([4]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]))\n assert is_same_tree(candidate(root = tree_node([2, 7, 4])), tree_node([2, 7, 4]))\n assert is_same_tree(candidate(root = tree_node([0, 2, 1, 3, None, None, None, 4, None, None, 5])), tree_node([5]))\n assert is_same_tree(candidate(root = tree_node([0, 1, None, 3, 2, 4, None, None, 5])), tree_node([1, 3, 2, 4, None, None, 5]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 3, None, 2])), tree_node([2]))\n assert is_same_tree(candidate(root = tree_node([4, 7, 8, 9, 2, None, None, None, None, 3, 1])), tree_node([2, 3, 1]))\n assert is_same_tree(candidate(root = tree_node([1, 2, None, 3, 4, 5])), tree_node([5]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3])), tree_node([2, 1, 3]))\n assert is_same_tree(candidate(root = tree_node([3, 1, 2, None, None, 4, 5, None, 6, None, 7])), tree_node([2, 4, 5, None, 6, None, 7]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8])), tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, None, None, 3, 4])), tree_node([2, 3, 4]))\n assert is_same_tree(candidate(root = tree_node([0, 2, 3, None, 1, 4, None, None, None, 5])), tree_node([5]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4])), tree_node([2, 7, 4]))\n assert is_same_tree(candidate(root = tree_node([1])), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, 4, None, None, 5, 6, None, None, None, None, 7, 8])), tree_node([6, 7, 8]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14])), tree_node([14]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])), tree_node([1, 3, 4, 7, 8, 9, 10, 15, 16, 17, 18, 19, 20, 21, 22, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64])), tree_node([64]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])), tree_node([10]))\n assert is_same_tree(candidate(root = tree_node([10, 20, 30, 40, 50, None, 60, 70, 80, 90, None, None, None, None, None, 100, None, None, None, None, 110, None, None, 120])), tree_node([110]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13, None, None, None, None, None, 9, 2, None, None, None, None, 5, None, None, None, None, None, None, None, 11])), tree_node([13, 9, 2]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, None, 4, None, None, 5, None, None, None, None, 6, None, None, None, None, 7])), tree_node([5]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])), tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, None, None, None, 18, 19, None, None, 20, 21])), tree_node([2, 7, 4, None, 18, 19, None, None, 20, 21]))\n assert is_same_tree(candidate(root = tree_node([6, 0, 3, None, None, 1, 5, None, 2, None, None, None, None, None, 4])), tree_node([2]))\n assert is_same_tree(candidate(root = tree_node([2, 1, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])), tree_node([10]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9, 10, 11])), tree_node([6, 10, 11]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, None, None, 12, 13, None, 14, 15])), tree_node([15]))\n assert is_same_tree(candidate(root = tree_node([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5])), tree_node([4, 3, 5]))\n assert is_same_tree(candidate(root = tree_node([20, 8, 22, 4, 12, None, None, 2, 10, 14, None, None, 1, None, 6, 8, None, None, None, None, 9])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([4, 2, None, 3, 1, None, None, 5, None, None, 6])), tree_node([6]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, 1, None, None, None, 8])), tree_node([5, 3, 6, 2, 4, None, 7, 1, None, None, None, 8]))\n assert is_same_tree(candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15])), tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, None, 4, 6, 9, 16, None, None, None, None, None, 11, 12, 13, None, None, None, None, None, None, 17])), tree_node([17]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8])), tree_node([8]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, None, None, 8, 9, 10, 11])), tree_node([1, 2, 3, 4, 5, 6, 7]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, 12, None, None, 13, 14, 15, None, None, 16, 17, None, None, 18, 19, None, None, None, 20, None, None, None, None, 21, 22, None, None, 23, None, None, None, 24])), tree_node([24]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, 15, 16, 17, None, None, 18, None, None, 19])), tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, 15, 16, 17, None, None, 18, None, None, 19]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, 16])), tree_node([16]))\n assert is_same_tree(candidate(root = tree_node([1, 2, None, 3, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])), tree_node([2, 3, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4, None, 5, 6, None, 7, None, 8, None, 9])), tree_node([1, 2, 3, None, 4, None, 5, 6, None, 7, None, 8, None, 9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])), tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, 10, 11, 12, None, None, 13, None, None, 14])), tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, 10, 11, 12, None, None, 13, None, None, 14]))\n assert is_same_tree(candidate(root = tree_node([0, 1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8])), tree_node([8]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, None, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28])), tree_node([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]))\n assert is_same_tree(candidate(root = tree_node([5, 1, 4, None, 2, None, 3])), tree_node([5, 1, 4, None, 2, None, 3]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, None, None, 16, 17])), tree_node([14, 16, 17]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9, None, None, 10, 11, 12, 13, None, None, None, None, 14])), tree_node([14]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 3, None, 2, None, None, None, 4, None, None, None, None, None, None, None, 5])), tree_node([4]))\n assert is_same_tree(candidate(root = tree_node([30, 10, 20, 5, 15, None, 25, 3, 7, 12, None, 18, None, 1, None, 9, 13, None, None, 17, None, None, 23, None, None, 28, None, None, 2, None, None, 8, None, None, 11, None, None, 14, None, None, 16, None, None, 19, None, None, 22, None, None, 27, None, None, 4, None, None, 6, None, None, 10, None, None, 21, None, None, 26, None, None, 31, None, None, 29, None, None, 24, None, None, 33, None, None, 35, None, None, 37, None, None, 32, None, None, 34, None, None, 36, None, None, 38, None, None, 39, None, None, 40])), tree_node([16]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, None, None, 9, 20])), tree_node([15, 9, 20]))\n assert is_same_tree(candidate(root = tree_node([100, 90, 110, 80, 95, 105, 120, 70, 85, 92, 98, 102, 115, 130, 140, 60, 75, 82, 88, 91, 93, 97, 99, 101, 103, 107, 112, 125, 135, 145, 150])), tree_node([100, 90, 110, 80, 95, 105, 120, 70, 85, 92, 98, 102, 115, 130, 140, 60, 75, 82, 88, 91, 93, 97, 99, 101, 103, 107, 112, 125, 135, 145, 150]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 10])), tree_node([4, 8, 9]))\n assert is_same_tree(candidate(root = tree_node([5, 1, 4, None, 2, None, 3, None, None, None, None, 6, 7])), tree_node([5, 1, 4, None, 2, None, 3]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, 10, 11])), tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, 10, 11]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, 4, 5, None, None, 6, 7, 8, 9, None, None, None, None, None, 10])), tree_node([10]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, 16, 17, 18, 19, 20, None, None, None, None, None, None, 21])), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, 16, 17, 18, 19, 20, None, None, None, None, None, None, 21]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, 9, None, None, None, None, 10, None, None, None, None, None, 11, None, None, None, None, 12])), tree_node([11]))\n assert is_same_tree(candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13])), tree_node([13]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 8, 2, 4, None, 9, 1, None, None, None, None, 7, None, 10, 11, 12])), tree_node([5, 3, 8, 2, 4, None, 9, 1, None, None, None, None, 7, None, 10, 11, 12]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6])), tree_node([5, 3, 7, 1, None, 6]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, None, None, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])), tree_node([14, 22, 23, 38, 39, 40]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, 4, None, 5, 6, 7, None, None, None, None, 8, 9])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, None, 6])), tree_node([5, 3, 7, 1, None, None, 6]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8])), tree_node([0, 1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, 1, None, None, None, None, None, None, 8])), tree_node([8]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, 6, None, None, 7, None, 8, None, None, 9, None, 10])), tree_node([8]))\n assert is_same_tree(candidate(root = tree_node([1, 2, None, None, 3, None, None, None, 4, None, None, None, 5, None, None, None, 6, None, None, None, 7, None, None, None, 8, None, None, None, 9, None, None, None, 10])), tree_node([3]))\n assert is_same_tree(candidate(root = tree_node([1, 2, None, 3, 4, None, 5, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17])), tree_node([17]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, None, 4, 5, None, 6, 7, None, 8, None, 9])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, None, 4, 5, None, None, 6, 7, None, None, None, None, 8, 9])), tree_node([7, 8, 9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, 8, 9, None, None, None, None, None, None, None, 10])), tree_node([10]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 8, 1, 4, 9, 10, None, None, 2, 5, None, None, None, 6, None, None, 11, 12])), tree_node([5, 11, 12]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, None, 7, None, None, None, 8, None, 9])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9, None, None, None, None, 10, 11, 12, 13, None, None, None, None, None, None, 14, 15])), tree_node([13, 14, 15]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 8, None, 9, 10, None, 11, None, None, 12, None, None, 13, None, None, None, None, None, 14])), tree_node([14]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])), tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, None, 4, 5, None, 6, 7, 8, 9, 10])), tree_node([0, 1, 2, 3, None, 4, 5, None, 6, 7, 8, 9, 10]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])), tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, None, None, None, 16])), tree_node([16]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, None, 17, None, 23, 27, 40, None, None, 6, None, 16, 18, None, 21, 24, 28, 37, None, None, None, 45])), tree_node([45]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, 8, 9, None, None, None, None, None, 10])), tree_node([10]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32])), tree_node([32]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, None, 4, None, 5, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])), tree_node([3, 5, 6, None, 8, None, 9, None, 11, None, 12, None, 14, None, 15]))\n assert is_same_tree(candidate(root = tree_node([8, 3, None, 1, None, 6, 7, 4, 5, None, None, None, None, None, None, 9, 2])), tree_node([6, 4, 5]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, None, None, None, 7, 8, None, None, None, 9])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 10, None, None, 45, 55, None, None, None, 5, None, None])), tree_node([5]))\n assert is_same_tree(candidate(root = tree_node([4, 2, None, 3, None, 1, None, None, 5, None, 6])), tree_node([6]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 2, 3, 3, None, None, 4, 4, 5, 5])), tree_node([2, 3, 3, 4, 4, 5, 5]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 9, 2, 4, None, 8, None, None, None, None, 5, 6])), tree_node([8, 5, 6]))\n assert is_same_tree(candidate(root = tree_node([6, 0, 8, 2, 7, 9, 10, None, None, 1, 4, 3, 5])), tree_node([6, 0, 8, 2, 7, 9, 10, None, None, 1, 4, 3, 5]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, None, None, None, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])), tree_node([5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, 16, 17, 18, None, None, None, 19, None, None, None, 20, None, None, None, None, 21, None, None, 22, 23, None, None, 24, None, None, 25])), tree_node([25]))\n assert is_same_tree(candidate(root = tree_node([5, 1, 3, None, None, 2, 4, None, None, None, None, 6, 7, 8, 9, None, None, None, None, 10, 11, None, None, None, 12, 13])), tree_node([3, 2, 4]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11])), tree_node([11]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, 11, 12])), tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, 11, 12]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8])), tree_node([8]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, None, None, 4, 5, 6, 7, None, None, None, None, None, 8])), tree_node([8]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, None, None, 16, None, None, None, 17, None, None, None, 18, None, None, None, 19, None, None, None, 20, None, None, None, None, 21, 22, None, None, 23, None, None, 24, None, None, 25])), tree_node([19]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, None, None, 4, 5, 6, 7, None, None, None, None, None, 8, 9, 10, None, None, 11, 12, None, None, 13])), tree_node([7, 8, 9, 10, None, None, 11, 12, None, None, 13]))\n assert is_same_tree(candidate(root = tree_node([5, 1, 4, None, 2, None, 6, None, 3, None, None, 7, 8, None, None, None, 9])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, None, None, None, 14])), tree_node([14]))\n assert is_same_tree(candidate(root = tree_node([6, 2, 3, None, None, 4, 5, None, None, None, None, 7, None, None, None, None, 8, None, 9])), tree_node([3, 4, 5]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])), tree_node([31]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 9, 14, 19, 13, 17])), tree_node([1, 13, 17]))\n assert is_same_tree(candidate(root = tree_node([15, 11, 20, 7, 12, 17, 25, 6, 8, 10, 13, None, 18, 16, None, None, None, 9, None, None, None, None, None, None, None, None, 14, None, 19])), tree_node([19]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12])), tree_node([0, 1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, None, None, None, None, None, None, None, None, None, 14])), tree_node([14]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, 7, None, None, 8, 9, None, None, 10, 11, None, None, 12, 13, None, None, 14, 15, None, None, 16, 17, None, None, 18, 19, None, None, 20, 21, None, None, 22, 23, None, None, 24, 25, None, None, 26, 27, None, None, 28, 29, None, None, 30, 31, None, None, 32, 33, None, None, 34, 35, None, None, 36, 37, None, None, 38, 39, None, None, 40, 41, None, None, 42, 43, None, None, 44, 45, None, None, 46, 47, None, None, 48, 49, None, None, 50])), tree_node([50]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, None, None, 4, None, None, 5, None, 6, None, 7, None, 8])), tree_node([8]))\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().subtreeWithAllDeepest", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var subtreeWithAllDeepest = function(root) {", "container": null, "callable": "subtreeWithAllDeepest", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 866, "task_id": "prime-palindrome", "difficulty": "Medium", "problem_description": "Given an integer n, return the smallest prime palindrome greater than or equal to n.\nAn integer is prime if it has exactly two divisors: 1 and itself. Note that 1 is not a prime number.\n\nFor example, 2, 3, 5, 7, 11, and 13 are all primes.\n\nAn integer is a palindrome if it reads the same from left to right as it does from right to left.\n\nFor example, 101 and 12321 are palindromes.\n\nThe test cases are generated so that the answer always exists and is in the range [2, 2 * 108].\n \nExample 1:\nInput: n = 6\nOutput: 7\nExample 2:\nInput: n = 8\nOutput: 11\nExample 3:\nInput: n = 13\nOutput: 101\n\n \nConstraints:\n\n1 <= n <= 108\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 101) == 101\n assert candidate(n = 8) == 11\n assert candidate(n = 10000000) == 100030001\n assert candidate(n = 10007) == 10301\n assert candidate(n = 999) == 10301\n assert candidate(n = 6) == 7\n assert candidate(n = 999983) == 1003001\n assert candidate(n = 2) == 2\n assert candidate(n = 100000000) == 100030001\n assert candidate(n = 9989900) == 100030001\n assert candidate(n = 100030001) == 100030001\n assert candidate(n = 100) == 101\n assert candidate(n = 10) == 11\n assert candidate(n = 1000) == 10301\n assert candidate(n = 20000000) == 100030001\n assert candidate(n = 1) == 2\n assert candidate(n = 13) == 101\n assert candidate(n = 12345678) == 100030001\n assert candidate(n = 99999) == 1003001\n assert candidate(n = 789789789) == 789868987\n assert candidate(n = 9999999) == 100030001\n assert candidate(n = 66666666) == 100030001\n assert candidate(n = 100000001) == 100030001\n assert candidate(n = 12321) == 12421\n assert candidate(n = 10111011101) == 10111311101\n assert candidate(n = 80000000) == 100030001\n assert candidate(n = 8999998) == 9002009\n assert candidate(n = 75000000) == 100030001\n assert candidate(n = 1003001) == 1003001\n assert candidate(n = 899989) == 1003001\n assert candidate(n = 50000000) == 100030001\n assert candidate(n = 100003) == 1003001\n assert candidate(n = 98765432) == 100030001\n assert candidate(n = 99999999) == 100030001\n assert candidate(n = 55555555) == 100030001\n assert candidate(n = 9999) == 10301\n assert candidate(n = 90000000) == 100030001\n assert candidate(n = 111111111) == 111181111\n assert candidate(n = 987654321) == 987757789\n assert candidate(n = 9988999) == 9989899\n assert candidate(n = 998899) == 1003001\n assert candidate(n = 150000000) == 150070051\n assert candidate(n = 11111111) == 100030001\n assert candidate(n = 1000000) == 1003001\n assert candidate(n = 88888888) == 100030001\n assert candidate(n = 123456789) == 123484321\n assert candidate(n = 989) == 10301\n assert candidate(n = 1000001) == 1003001\n assert candidate(n = 999999) == 1003001\n assert candidate(n = 1234567) == 1235321\n assert candidate(n = 100001) == 1003001\n assert candidate(n = 1000003) == 1003001\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().primePalindrome", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var primePalindrome = function(n) {", "container": null, "callable": "primePalindrome", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 867, "task_id": "transpose-matrix", "difficulty": "Easy", "problem_description": "Given a 2D integer array matrix, return the transpose of matrix.\nThe transpose of a matrix is the matrix flipped over its main diagonal, switching the matrix's row and column indices.\n\n \nExample 1:\n\nInput: matrix = [[1,2,3],[4,5,6],[7,8,9]]\nOutput: [[1,4,7],[2,5,8],[3,6,9]]\n\nExample 2:\n\nInput: matrix = [[1,2,3],[4,5,6]]\nOutput: [[1,4],[2,5],[3,6]]\n\n \nConstraints:\n\nm == matrix.length\nn == matrix[i].length\n1 <= m, n <= 1000\n1 <= m * n <= 105\n-109 <= matrix[i][j] <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(matrix = [[1]]) == [(1,)]\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6]]) == [(1, 3, 5), (2, 4, 6)]\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == [(1, 4, 7), (2, 5, 8), (3, 6, 9)]\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6]]) == [(1, 4), (2, 5), (3, 6)]\n assert candidate(matrix = [[-1000, 1000], [2000, -2000]]) == [(-1000, 2000), (1000, -2000)]\n assert candidate(matrix = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]]) == [(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)]\n assert candidate(matrix = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]) == [(1, 6, 11, 16, 21), (2, 7, 12, 17, 22), (3, 8, 13, 18, 23), (4, 9, 14, 19, 24), (5, 10, 15, 20, 25)]\n assert candidate(matrix = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]]) == [(-1, -4, -7), (-2, -5, -8), (-3, -6, -9)]\n assert candidate(matrix = [[1000000000, -1000000000], [1000000000, 1000000000], [-1000000000, -1000000000]]) == [(1000000000, 1000000000, -1000000000), (-1000000000, 1000000000, -1000000000)]\n assert candidate(matrix = [[-1, 0, 1], [-2, 0, 2], [-3, 0, 3]]) == [(-1, -2, -3), (0, 0, 0), (1, 2, 3)]\n assert candidate(matrix = [[1000000000, -1000000000], [1000000000, -1000000000], [1000000000, -1000000000]]) == [(1000000000, 1000000000, 1000000000), (-1000000000, -1000000000, -1000000000)]\n assert candidate(matrix = [[1, 0, -1, 2], [3, 4, 5, 6], [7, -8, 9, -10]]) == [(1, 3, 7), (0, 4, -8), (-1, 5, 9), (2, 6, -10)]\n assert candidate(matrix = [[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3]]) == [(1, 2, 3), (1, 2, 3), (1, 2, 3), (1, 2, 3), (1, 2, 3)]\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == [(1, 3, 5, 7, 9), (2, 4, 6, 8, 10)]\n assert candidate(matrix = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]]) == [(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)]\n assert candidate(matrix = [[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4], [5, 5, 5, 5, 5], [6, 6, 6, 6, 6]]) == [(1, 2, 3, 4, 5, 6), (1, 2, 3, 4, 5, 6), (1, 2, 3, 4, 5, 6), (1, 2, 3, 4, 5, 6), (1, 2, 3, 4, 5, 6)]\n assert candidate(matrix = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]) == [(1, 6, 11, 16), (2, 7, 12, 17), (3, 8, 13, 18), (4, 9, 14, 19), (5, 10, 15, 20)]\n assert candidate(matrix = [[1, 2, 3, 4, 5], [0, 0, 0, 0, 0], [9, 8, 7, 6, 5], [4, 3, 2, 1, 0]]) == [(1, 0, 9, 4), (2, 0, 8, 3), (3, 0, 7, 2), (4, 0, 6, 1), (5, 0, 5, 0)]\n assert candidate(matrix = [[9]]) == [(9,)]\n assert candidate(matrix = [[1, -1, 2, -2], [-3, 3, -4, 4], [5, -5, 6, -6]]) == [(1, -3, 5), (-1, 3, -5), (2, -4, 6), (-2, 4, -6)]\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]]) == [(1, 2, 3), (1, 2, 3), (1, 2, 3), (1, 2, 3), (1, 2, 3), (1, 2, 3), (1, 2, 3), (1, 2, 3), (1, 2, 3), (1, 2, 3)]\n assert candidate(matrix = [[9, 8, 7], [6, 5, 4], [3, 2, 1], [0, -1, -2]]) == [(9, 6, 3, 0), (8, 5, 2, -1), (7, 4, 1, -2)]\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) == [(1, 5, 9, 13), (2, 6, 10, 14), (3, 7, 11, 15), (4, 8, 12, 16)]\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) == [(1, 5, 9, 13), (2, 6, 10, 14), (3, 7, 11, 15), (4, 8, 12, 16)]\n assert candidate(matrix = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9], [-10, -11, -12]]) == [(-1, -4, -7, -10), (-2, -5, -8, -11), (-3, -6, -9, -12)]\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16], [17, 18, 19, 20]]) == [(1, 5, 9, 13, 17), (2, 6, 10, 14, 18), (3, 7, 11, 15, 19), (4, 8, 12, 16, 20)]\n assert candidate(matrix = [[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4], [5, 5, 5, 5, 5]]) == [(1, 2, 3, 4, 5), (1, 2, 3, 4, 5), (1, 2, 3, 4, 5), (1, 2, 3, 4, 5), (1, 2, 3, 4, 5)]\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]) == [(1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,)]\n assert candidate(matrix = [[1000000, 2000000], [3000000, 4000000], [5000000, 6000000], [7000000, 8000000]]) == [(1000000, 3000000, 5000000, 7000000), (2000000, 4000000, 6000000, 8000000)]\n assert candidate(matrix = [[7, 8, 9, 10], [11, 12, 13, 14], [15, 16, 17, 18]]) == [(7, 11, 15), (8, 12, 16), (9, 13, 17), (10, 14, 18)]\n assert candidate(matrix = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == [(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)]\n assert candidate(matrix = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]) == [(0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0)]\n assert candidate(matrix = [[1000000000, 1000000000, 1000000000], [1000000000, 1000000000, 1000000000]]) == [(1000000000, 1000000000), (1000000000, 1000000000), (1000000000, 1000000000)]\n assert candidate(matrix = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == [(0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0)]\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]) == [(1, 4, 7, 10, 13), (2, 5, 8, 11, 14), (3, 6, 9, 12, 15)]\n assert candidate(matrix = [[10, 20], [30, 40], [50, 60], [70, 80]]) == [(10, 30, 50, 70), (20, 40, 60, 80)]\n assert candidate(matrix = [[10, 20, 30, 40, 50], [5, 15, 25, 35, 45], [1, 11, 21, 31, 41]]) == [(10, 5, 1), (20, 15, 11), (30, 25, 21), (40, 35, 31), (50, 45, 41)]\n assert candidate(matrix = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == [(0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0)]\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]]) == [(1, 11), (2, 12), (3, 13), (4, 14), (5, 15), (6, 16), (7, 17), (8, 18), (9, 19), (10, 20)]\n assert candidate(matrix = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9], [-10, -11, -12]]) == [(-1, -4, -7, -10), (-2, -5, -8, -11), (-3, -6, -9, -12)]\n assert candidate(matrix = [[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2], [3, 3, 3, 3, 3, 3]]) == [(0, 1, 2, 3), (0, 1, 2, 3), (0, 1, 2, 3), (0, 1, 2, 3), (0, 1, 2, 3), (0, 1, 2, 3)]\n assert candidate(matrix = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) == [(1, 0, 0), (0, 1, 0), (0, 0, 1)]\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]) == [(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]\n assert candidate(matrix = [[-999999999, -999999999], [-999999999, -999999999], [999999999, 999999999]]) == [(-999999999, -999999999, 999999999), (-999999999, -999999999, 999999999)]\n assert candidate(matrix = [[-10, 20, -30, 40], [10, -20, 30, -40], [-5, 5, -15, 15], [25, -25, 35, -35]]) == [(-10, 10, -5, 25), (20, -20, 5, -25), (-30, 30, -15, 35), (40, -40, 15, -35)]\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14]]) == [(1, 3, 5, 7, 9, 11, 13), (2, 4, 6, 8, 10, 12, 14)]\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]) == [(1, 4, 7, 10, 13), (2, 5, 8, 11, 14), (3, 6, 9, 12, 15)]\n assert candidate(matrix = [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7]]) == [(1, 2, 3, 4, 5), (2, 3, 4, 5, 6), (3, 4, 5, 6, 7)]\n assert candidate(matrix = [[-1, 2, -3, 4], [5, -6, 7, -8], [9, -10, 11, -12]]) == [(-1, 5, 9), (2, -6, -10), (-3, 7, 11), (4, -8, -12)]\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]) == [(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]\n assert candidate(matrix = [[0, 1, 2], [3, 0, 4], [5, 6, 0]]) == [(0, 3, 5), (1, 0, 6), (2, 4, 0)]\n assert candidate(matrix = [[1, 0, 1], [0, 1, 0], [1, 0, 1]]) == [(1, 0, 1), (0, 1, 0), (1, 0, 1)]\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18]]) == [(1, 4, 7, 10, 13, 16), (2, 5, 8, 11, 14, 17), (3, 6, 9, 12, 15, 18)]\n assert candidate(matrix = [[1000000000, -1000000000], [1000000000, -1000000000], [1000000000, -1000000000]]) == [(1000000000, 1000000000, 1000000000), (-1000000000, -1000000000, -1000000000)]\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]]) == [(1, 11, 21), (2, 12, 22), (3, 13, 23), (4, 14, 24), (5, 15, 25), (6, 16, 26), (7, 17, 27), (8, 18, 28), (9, 19, 29), (10, 20, 30)]\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]) == [(1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,)]\n assert candidate(matrix = [[1000000000, 0], [-1000000000, 1000000000]]) == [(1000000000, -1000000000), (0, 1000000000)]\n assert candidate(matrix = [[1, 0, 0], [0, 1, 0], [0, 0, 1], [0, 0, 0]]) == [(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0)]\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]]) == [(1, 3, 5, 7, 9, 11, 13, 15, 17, 19), (2, 4, 6, 8, 10, 12, 14, 16, 18, 20)]\n assert candidate(matrix = [[-999999999, 999999999, -999999999], [999999999, -999999999, 999999999], [-999999999, 999999999, -999999999]]) == [(-999999999, 999999999, -999999999), (999999999, -999999999, 999999999), (-999999999, 999999999, -999999999)]\n assert candidate(matrix = [[-999999999, 999999999], [0, 1], [2, -2], [3, -3]]) == [(-999999999, 0, 2, 3), (999999999, 1, -2, -3)]\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6], [7, 8]]) == [(1, 3, 5, 7), (2, 4, 6, 8)]\n assert candidate(matrix = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == [(0, 0, 0, 0, 0), (0, 0, 0, 0, 0), (0, 0, 0, 0, 0), (0, 0, 0, 0, 0), (0, 0, 0, 0, 0)]\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]]) == [(1, 3, 5, 7, 9, 11, 13, 15, 17, 19), (2, 4, 6, 8, 10, 12, 14, 16, 18, 20)]\n assert candidate(matrix = [[-999999999, 999999999], [-888888888, 888888888]]) == [(-999999999, -888888888), (999999999, 888888888)]\n assert candidate(matrix = [[-1, 0, 1], [-2, 0, 2], [-3, 0, 3], [-4, 0, 4], [-5, 0, 5]]) == [(-1, -2, -3, -4, -5), (0, 0, 0, 0, 0), (1, 2, 3, 4, 5)]\n assert candidate(matrix = [[1, 0, -1], [2, 0, -2], [3, 0, -3], [4, 0, -4]]) == [(1, 2, 3, 4), (0, 0, 0, 0), (-1, -2, -3, -4)]\n assert candidate(matrix = [[1000000000, -1000000000], [-1000000000, 1000000000], [1000000000, -1000000000]]) == [(1000000000, -1000000000, 1000000000), (-1000000000, 1000000000, -1000000000)]\n assert candidate(matrix = [[999999999, 888888888, 777777777], [666666666, 555555555, 444444444], [333333333, 222222222, 111111111]]) == [(999999999, 666666666, 333333333), (888888888, 555555555, 222222222), (777777777, 444444444, 111111111)]\n assert candidate(matrix = [[10, 20, 30], [40, 50, 60], [70, 80, 90], [100, 110, 120]]) == [(10, 40, 70, 100), (20, 50, 80, 110), (30, 60, 90, 120)]\n assert candidate(matrix = [[1, 2, 3, 4, 5]]) == [(1,), (2,), (3,), (4,), (5,)]\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == [(1, 3, 5, 7, 9), (2, 4, 6, 8, 10)]\n assert candidate(matrix = [[999, 998, 997], [996, 995, 994], [993, 992, 991], [990, 989, 988]]) == [(999, 996, 993, 990), (998, 995, 992, 989), (997, 994, 991, 988)]\n assert candidate(matrix = [[1], [2], [3], [4], [5]]) == [(1, 2, 3, 4, 5)]\n"}, "metadata": {"canonical_parameter_names": ["matrix"], "leetcode_dataset_entry_point": "Solution().transpose", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var transpose = function(matrix) {", "container": null, "callable": "transpose", "parameters": [{"name": "matrix", "type": "number[][]"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 868, "task_id": "binary-gap", "difficulty": "Easy", "problem_description": "Given a positive integer n, find and return the longest distance between any two adjacent 1's in the binary representation of n. If there are no two adjacent 1's, return 0.\nTwo 1's are adjacent if there are only 0's separating them (possibly no 0's). The distance between two 1's is the absolute difference between their bit positions. For example, the two 1's in \"1001\" have a distance of 3.\n \nExample 1:\n\nInput: n = 22\nOutput: 2\nExplanation: 22 in binary is \"10110\".\nThe first adjacent pair of 1's is \"10110\" with a distance of 2.\nThe second adjacent pair of 1's is \"10110\" with a distance of 1.\nThe answer is the largest of these two distances, which is 2.\nNote that \"10110\" is not a valid pair since there is a 1 separating the two 1's underlined.\n\nExample 2:\n\nInput: n = 8\nOutput: 0\nExplanation: 8 in binary is \"1000\".\nThere are not any adjacent pairs of 1's in the binary representation of 8, so we return 0.\n\nExample 3:\n\nInput: n = 5\nOutput: 2\nExplanation: 5 in binary is \"101\".\n\n \nConstraints:\n\n1 <= n <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 8) == 0\n assert candidate(n = 3) == 1\n assert candidate(n = 1041) == 6\n assert candidate(n = 15) == 1\n assert candidate(n = 22) == 2\n assert candidate(n = 32) == 0\n assert candidate(n = 6) == 1\n assert candidate(n = 1) == 0\n assert candidate(n = 1000000000) == 3\n assert candidate(n = 7) == 1\n assert candidate(n = 13) == 2\n assert candidate(n = 5) == 2\n assert candidate(n = 29) == 2\n assert candidate(n = 1001001001) == 7\n assert candidate(n = 131071) == 1\n assert candidate(n = 999999999) == 3\n assert candidate(n = 8589934591) == 1\n assert candidate(n = 47) == 2\n assert candidate(n = 67890) == 5\n assert candidate(n = 67108863) == 1\n assert candidate(n = 2147483647) == 1\n assert candidate(n = 100111011000110001) == 6\n assert candidate(n = 1001001001001001001001001001001) == 8\n assert candidate(n = 536870913) == 29\n assert candidate(n = 511) == 1\n assert candidate(n = 21845) == 2\n assert candidate(n = 536870912) == 0\n assert candidate(n = 1177777777) == 4\n assert candidate(n = 1879048192) == 1\n assert candidate(n = 10000100001) == 7\n assert candidate(n = 665772) == 4\n assert candidate(n = 6754321) == 8\n assert candidate(n = 67) == 5\n assert candidate(n = 134217727) == 1\n assert candidate(n = 37) == 3\n assert candidate(n = 33) == 5\n assert candidate(n = 8388607) == 1\n assert candidate(n = 983041) == 16\n assert candidate(n = 1001) == 3\n assert candidate(n = 134217729) == 27\n assert candidate(n = 1000010000100001) == 8\n assert candidate(n = 101010101) == 7\n assert candidate(n = 1024) == 0\n assert candidate(n = 16777215) == 1\n assert candidate(n = 777777777) == 4\n assert candidate(n = 1073741824) == 0\n assert candidate(n = 4194305) == 22\n assert candidate(n = 1048576) == 0\n assert candidate(n = 807798533) == 7\n assert candidate(n = 18) == 3\n assert candidate(n = 131073) == 17\n assert candidate(n = 1010101010101010101) == 7\n assert candidate(n = 65535) == 1\n assert candidate(n = 127) == 1\n assert candidate(n = 10011001100110011001100110011001) == 8\n assert candidate(n = 987654321) == 4\n assert candidate(n = 1111111111) == 5\n assert candidate(n = 999999937) == 6\n assert candidate(n = 500000000) == 3\n assert candidate(n = 31) == 1\n assert candidate(n = 123456789) == 4\n assert candidate(n = 1073741825) == 30\n assert candidate(n = 33554431) == 1\n assert candidate(n = 10011001100110011001) == 5\n assert candidate(n = 11001100110011001100110011001100) == 5\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().binaryGap", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var binaryGap = function(n) {", "container": null, "callable": "binaryGap", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 869, "task_id": "reordered-power-of-2", "difficulty": "Medium", "problem_description": "You are given an integer n. We reorder the digits in any order (including the original order) such that the leading digit is not zero.\nReturn true if and only if we can do this so that the resulting number is a power of two.\n \nExample 1:\n\nInput: n = 1\nOutput: true\n\nExample 2:\n\nInput: n = 10\nOutput: false\n\n \nConstraints:\n\n1 <= n <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 46875) == False\n assert candidate(n = 3245) == False\n assert candidate(n = 86) == False\n assert candidate(n = 10) == False\n assert candidate(n = 4326) == False\n assert candidate(n = 16) == True\n assert candidate(n = 82084) == False\n assert candidate(n = 1024) == True\n assert candidate(n = 128) == True\n assert candidate(n = 821) == True\n assert candidate(n = 8192) == True\n assert candidate(n = 65536) == True\n assert candidate(n = 46) == True\n assert candidate(n = 256) == True\n assert candidate(n = 1000000000) == False\n assert candidate(n = 24) == False\n assert candidate(n = 987654321) == False\n assert candidate(n = 512) == True\n assert candidate(n = 4102) == True\n assert candidate(n = 1) == True\n assert candidate(n = 462) == False\n assert candidate(n = 862467834) == False\n assert candidate(n = 8258) == False\n assert candidate(n = 2097152) == True\n assert candidate(n = 786432) == False\n assert candidate(n = 3145728) == False\n assert candidate(n = 885842624) == False\n assert candidate(n = 999999999) == False\n assert candidate(n = 2359296) == False\n assert candidate(n = 67108864) == True\n assert candidate(n = 4096) == True\n assert candidate(n = 891891891) == False\n assert candidate(n = 2147483647) == False\n assert candidate(n = 8256) == False\n assert candidate(n = 683184) == False\n assert candidate(n = 536870912) == True\n assert candidate(n = 111222333) == False\n assert candidate(n = 524288) == True\n assert candidate(n = 82944) == False\n assert candidate(n = 94371840) == False\n assert candidate(n = 16384) == True\n assert candidate(n = 393216) == False\n assert candidate(n = 16777216) == True\n assert candidate(n = 258048) == False\n assert candidate(n = 125874) == False\n assert candidate(n = 78125) == False\n assert candidate(n = 1024576) == False\n assert candidate(n = 2415919) == False\n assert candidate(n = 134217728) == True\n assert candidate(n = 46340) == False\n assert candidate(n = 9437184) == False\n assert candidate(n = 33554432) == True\n assert candidate(n = 900000000) == False\n assert candidate(n = 1073741824) == False\n assert candidate(n = 2176782336) == False\n assert candidate(n = 24681357) == False\n assert candidate(n = 333333333) == False\n assert candidate(n = 2621440) == False\n assert candidate(n = 1048576) == True\n assert candidate(n = 9876543210) == False\n assert candidate(n = 2048) == True\n assert candidate(n = 22448811) == False\n assert candidate(n = 112233445566778899) == False\n assert candidate(n = 327684) == False\n assert candidate(n = 18) == False\n assert candidate(n = 768) == False\n assert candidate(n = 196608) == False\n assert candidate(n = 27962028) == False\n assert candidate(n = 894784864) == False\n assert candidate(n = 43112) == False\n assert candidate(n = 262144) == True\n assert candidate(n = 131072) == True\n assert candidate(n = 82128) == False\n assert candidate(n = 111111111) == False\n assert candidate(n = 31415926) == False\n assert candidate(n = 499999999) == False\n assert candidate(n = 318666) == False\n assert candidate(n = 180) == False\n assert candidate(n = 8589934592) == False\n assert candidate(n = 32768) == True\n assert candidate(n = 3221225472) == False\n assert candidate(n = 4104) == False\n assert candidate(n = 35184372088832) == False\n assert candidate(n = 123456789) == False\n assert candidate(n = 555555) == False\n assert candidate(n = 4608) == False\n assert candidate(n = 8388608) == True\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().reorderedPowerOf2", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var reorderedPowerOf2 = function(n) {", "container": null, "callable": "reorderedPowerOf2", "parameters": [{"name": "n", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 870, "task_id": "advantage-shuffle", "difficulty": "Medium", "problem_description": "You are given two integer arrays nums1 and nums2 both of the same length. The advantage of nums1 with respect to nums2 is the number of indices i for which nums1[i] > nums2[i].\nReturn any permutation of nums1 that maximizes its advantage with respect to nums2.\n \nExample 1:\nInput: nums1 = [2,7,11,15], nums2 = [1,10,4,11]\nOutput: [2,11,7,15]\nExample 2:\nInput: nums1 = [12,24,8,32], nums2 = [13,25,32,11]\nOutput: [24,32,8,12]\n\n \nConstraints:\n\n1 <= nums1.length <= 105\nnums2.length == nums1.length\n0 <= nums1[i], nums2[i] <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums1 = [10, 20, 30, 40, 50],nums2 = [5, 15, 25, 35, 45]) == [10, 20, 30, 40, 50]\n assert candidate(nums1 = [5, 15, 25, 35],nums2 = [10, 20, 30, 40]) == [15, 25, 35, 5]\n assert candidate(nums1 = [2, 7, 11, 15],nums2 = [1, 10, 4, 11]) == [2, 11, 7, 15]\n assert candidate(nums1 = [100, 90, 80, 70, 60],nums2 = [60, 70, 80, 90, 100]) == [70, 80, 90, 100, 60]\n assert candidate(nums1 = [9, 12, 24, 22, 15],nums2 = [14, 13, 25, 17, 22]) == [22, 15, 9, 24, 12]\n assert candidate(nums1 = [5, 6, 7, 8, 9],nums2 = [1, 2, 3, 4, 5]) == [5, 6, 7, 8, 9]\n assert candidate(nums1 = [5, 6, 7, 8],nums2 = [4, 5, 6, 7]) == [5, 6, 7, 8]\n assert candidate(nums1 = [100, 200, 300, 400],nums2 = [50, 150, 250, 350]) == [100, 200, 300, 400]\n assert candidate(nums1 = [12, 24, 8, 32],nums2 = [13, 25, 32, 11]) == [24, 32, 8, 12]\n assert candidate(nums1 = [10, 10, 10, 10],nums2 = [1, 1, 1, 1]) == [10, 10, 10, 10]\n assert candidate(nums1 = [1, 2, 3, 4],nums2 = [1, 2, 3, 4]) == [2, 3, 4, 1]\n assert candidate(nums1 = [100, 90, 80, 70],nums2 = [60, 70, 80, 90]) == [70, 80, 90, 100]\n assert candidate(nums1 = [1, 2, 3, 4, 5],nums2 = [5, 4, 3, 2, 1]) == [1, 5, 4, 3, 2]\n assert candidate(nums1 = [1, 2, 3, 4],nums2 = [4, 3, 2, 1]) == [1, 4, 3, 2]\n assert candidate(nums1 = [1, 2, 3, 4, 5],nums2 = [9, 8, 7, 6, 5]) == [1, 2, 3, 4, 5]\n assert candidate(nums1 = [5, 6, 7, 8],nums2 = [1, 2, 3, 4]) == [5, 6, 7, 8]\n assert candidate(nums1 = [1, 2, 3, 4],nums2 = [5, 6, 7, 8]) == [4, 3, 2, 1]\n assert candidate(nums1 = [8, 24, 15, 3, 17, 22],nums2 = [25, 18, 9, 13, 22, 6]) == [3, 22, 15, 17, 24, 8]\n assert candidate(nums1 = [100, 200, 300, 400, 500],nums2 = [450, 350, 250, 150, 50]) == [500, 400, 300, 200, 100]\n assert candidate(nums1 = [8, 6, 4, 2, 0, 1, 3, 5, 7, 9],nums2 = [9, 7, 5, 3, 1, 0, 2, 4, 6, 8]) == [0, 8, 6, 4, 2, 1, 3, 5, 7, 9]\n assert candidate(nums1 = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],nums2 = [10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000]) == [1000, 10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000]\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],nums2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 1]\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],nums2 = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]\n assert candidate(nums1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],nums2 = [105, 205, 305, 405, 505, 605, 705, 805, 905, 1005]) == [200, 300, 400, 500, 600, 700, 800, 900, 1000, 100]\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(nums1 = [47, 29, 22, 18, 4, 37, 30, 25, 36, 42, 3, 20, 5, 11, 13, 27, 8, 2, 24, 17],nums2 = [16, 33, 12, 38, 34, 19, 35, 32, 46, 31, 45, 40, 28, 43, 39, 44, 26, 23, 14, 41]) == [18, 42, 13, 25, 47, 20, 30, 37, 2, 36, 3, 11, 29, 5, 22, 4, 27, 24, 17, 8]\n assert candidate(nums1 = [20, 17, 13, 8, 15, 11, 10, 9],nums2 = [18, 16, 14, 12, 10, 9, 8, 7]) == [20, 17, 15, 13, 11, 10, 9, 8]\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums1 = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],nums2 = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]\n assert candidate(nums1 = [8, 11, 13, 18, 12, 14, 10, 17, 15, 16],nums2 = [9, 11, 10, 13, 12, 15, 14, 17, 18, 16]) == [10, 12, 11, 14, 13, 16, 15, 18, 8, 17]\n assert candidate(nums1 = [7, 14, 21, 28, 35, 42, 49, 56],nums2 = [8, 16, 24, 32, 40, 48, 54, 60]) == [14, 21, 28, 35, 42, 49, 56, 7]\n assert candidate(nums1 = [1000000000, 999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992, 999999991],nums2 = [999999992, 999999995, 999999991, 999999998, 999999997, 999999994, 999999993, 999999996, 1000000000, 999999999]) == [999999993, 999999996, 999999992, 999999999, 999999998, 999999995, 999999994, 999999997, 999999991, 1000000000]\n assert candidate(nums1 = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91],nums2 = [90, 91, 92, 93, 94, 95, 96, 97, 98, 99]) == [91, 92, 93, 94, 95, 96, 97, 98, 99, 100]\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],nums2 = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [2, 4, 6, 8, 10, 12, 14, 15, 13, 11, 9, 7, 5, 3, 1]) == [3, 5, 7, 9, 11, 13, 15, 1, 14, 12, 10, 8, 6, 4, 2]\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],nums2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == [3, 5, 7, 9, 11, 13, 15, 17, 19, 1]\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],nums2 = [95, 85, 75, 65, 55, 45, 35, 25, 15, 5]) == [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]\n assert candidate(nums1 = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],nums2 = [95, 85, 75, 65, 55, 45, 35, 25, 15, 5]) == [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]\n assert candidate(nums1 = [3, 6, 7, 8, 13, 22, 24, 45, 50, 60],nums2 = [9, 12, 25, 32, 35, 40, 46, 51, 61, 62]) == [13, 22, 45, 50, 60, 24, 8, 7, 6, 3]\n assert candidate(nums1 = [50, 40, 30, 20, 10],nums2 = [45, 35, 25, 15, 5]) == [50, 40, 30, 20, 10]\n assert candidate(nums1 = [1, 10, 100, 1000, 10000],nums2 = [5000, 500, 50, 5, 50000]) == [10000, 1000, 100, 10, 1]\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],nums2 = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37]) == [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]\n assert candidate(nums1 = [100, 50, 75, 25, 60, 90],nums2 = [55, 80, 65, 40, 95, 30]) == [75, 100, 90, 60, 25, 50]\n assert candidate(nums1 = [50, 40, 30, 20, 10],nums2 = [1, 2, 3, 4, 5]) == [10, 20, 30, 40, 50]\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],nums2 = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(nums1 = [1000000000, 999999999, 999999998, 999999997, 999999996],nums2 = [999999995, 999999994, 999999993, 999999992, 999999991]) == [1000000000, 999999999, 999999998, 999999997, 999999996]\n assert candidate(nums1 = [1000000000, 500000000, 250000000, 125000000, 62500000, 31250000, 15625000],nums2 = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000]) == [1000000000, 500000000, 250000000, 125000000, 62500000, 31250000, 15625000]\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],nums2 = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]\n assert candidate(nums1 = [5, 21, 17, 13, 29, 3, 19, 11],nums2 = [6, 25, 18, 14, 28, 4, 20, 12]) == [11, 29, 19, 17, 3, 5, 21, 13]\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 1]\n assert candidate(nums1 = [5, 21, 17, 19, 13, 25, 18],nums2 = [10, 15, 20, 24, 22, 21, 19]) == [13, 17, 25, 5, 18, 19, 21]\n assert candidate(nums1 = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],nums2 = [9, 19, 29, 39, 49, 59, 69, 79, 89, 99]) == [15, 25, 35, 45, 55, 65, 75, 85, 95, 5]\n assert candidate(nums1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],nums2 = [950, 850, 750, 650, 550, 450, 350, 250, 150, 50]) == [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100]\n assert candidate(nums1 = [1, 2, 2, 3, 4, 5, 5, 5, 6, 7, 8, 9, 9, 10, 10],nums2 = [10, 10, 9, 9, 8, 7, 6, 5, 5, 5, 4, 3, 2, 2, 1]) == [2, 1, 10, 5, 10, 9, 9, 6, 7, 8, 5, 5, 3, 4, 2]\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],nums2 = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19]) == [3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 1, 20]\n assert candidate(nums1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],nums2 = [150, 250, 350, 450, 550, 650, 750, 850, 950, 1050]) == [200, 300, 400, 500, 600, 700, 800, 900, 1000, 100]\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 10, 9, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(nums1 = [2, 2, 2, 5, 5, 5, 7, 7, 7, 11, 11, 11, 13, 13, 13],nums2 = [1, 3, 4, 4, 6, 8, 9, 10, 10, 12, 12, 14, 15, 16, 17]) == [2, 5, 5, 5, 7, 11, 11, 11, 13, 13, 13, 7, 7, 2, 2]\n assert candidate(nums1 = [5, 3, 8, 9, 1, 7, 6, 2, 4, 10],nums2 = [8, 7, 6, 5, 4, 3, 2, 1, 10, 9]) == [9, 8, 7, 6, 5, 4, 3, 2, 1, 10]\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],nums2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]) == [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 1]\n assert candidate(nums1 = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1],nums2 = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == [2, 1, 2, 1, 2, 1, 2, 1, 2, 1]\n assert candidate(nums1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500],nums2 = [99, 199, 299, 399, 499, 599, 699, 799, 899, 999, 1099, 1199, 1299, 1399, 1499]) == [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]\n assert candidate(nums1 = [999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992, 999999991, 999999990],nums2 = [999999990, 999999991, 999999992, 999999993, 999999994, 999999995, 999999996, 999999997, 999999998, 999999999]) == [999999991, 999999992, 999999993, 999999994, 999999995, 999999996, 999999997, 999999998, 999999999, 999999990]\n assert candidate(nums1 = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119],nums2 = [119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100]) == [100, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101]\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],nums2 = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == [10, 100, 90, 80, 70, 60, 50, 40, 30, 20]\n assert candidate(nums1 = [25, 15, 35, 5, 45, 10, 55, 20, 65, 30],nums2 = [23, 24, 25, 26, 27, 28, 29, 30, 31, 32]) == [25, 30, 35, 45, 55, 65, 20, 15, 10, 5]\n assert candidate(nums1 = [23, 34, 45, 56, 67, 78, 89, 90, 101, 112],nums2 = [12, 23, 34, 45, 56, 67, 78, 89, 90, 101]) == [23, 34, 45, 56, 67, 78, 89, 90, 101, 112]\n assert candidate(nums1 = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],nums2 = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums1 = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36],nums2 = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35]) == [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36]\n assert candidate(nums1 = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000],nums2 = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000]) == [1000000000, 1000000000, 1000000000, 1000000000, 1000000000]\n assert candidate(nums1 = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50],nums2 = [49, 49, 49, 49, 49, 49, 49, 49, 49, 49]) == [50, 50, 50, 50, 50, 50, 50, 50, 50, 50]\n assert candidate(nums1 = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],nums2 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]\n assert candidate(nums1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],nums2 = [99, 199, 299, 399, 499, 599, 699, 799, 899, 999]) == [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]\n assert candidate(nums1 = [3, 3, 3, 3, 3],nums2 = [2, 2, 2, 2, 2]) == [3, 3, 3, 3, 3]\n assert candidate(nums1 = [3, 10, 7, 8, 9, 5, 2, 1, 4, 6],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 10, 9, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(nums1 = [29, 14, 37, 18, 25, 19, 40, 32],nums2 = [26, 35, 33, 28, 31, 17, 41, 16]) == [29, 25, 40, 32, 37, 19, 14, 18]\n assert candidate(nums1 = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1]\n assert candidate(nums1 = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],nums2 = [3, 2, 6, 4, 1, 9, 7, 8, 5, 10]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49],nums2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50]) == [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 1]\n assert candidate(nums1 = [1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 10, 11],nums2 = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == [6, 7, 8, 8, 9, 10, 10, 11, 5, 5, 4, 3, 2, 2, 1]\n assert candidate(nums1 = [8, 18, 11, 19, 22, 17, 9, 13, 15, 12, 14, 20, 7, 21, 10, 16, 5, 6, 4, 3, 2, 1],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 25, 24, 23]) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1, 0, 0]\n assert candidate(nums1 = [8, 5, 12, 19, 22, 31, 42, 55, 60, 65],nums2 = [10, 9, 20, 21, 30, 35, 50, 54, 56, 61]) == [19, 12, 22, 31, 42, 55, 60, 65, 8, 5]\n assert candidate(nums1 = [41, 39, 33, 21, 32, 30, 25, 14, 17, 13, 27, 22, 15, 20, 26],nums2 = [24, 7, 29, 38, 5, 44, 3, 12, 10, 22, 13, 26, 23, 46, 6]) == [27, 17, 32, 39, 14, 41, 13, 21, 20, 25, 22, 30, 26, 33, 15]\n assert candidate(nums1 = [1000000000, 999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992, 999999991],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [999999991, 999999992, 999999993, 999999994, 999999995, 999999996, 999999997, 999999998, 999999999, 1000000000]\n assert candidate(nums1 = [5, 14, 13, 21, 24, 17, 8, 16],nums2 = [18, 20, 19, 16, 15, 14, 13, 12]) == [24, 5, 8, 21, 17, 16, 14, 13]\n assert candidate(nums1 = [5, 23, 15, 32, 6, 9, 18, 20],nums2 = [17, 30, 25, 16, 10, 2, 19, 8]) == [20, 6, 32, 18, 15, 5, 23, 9]\n assert candidate(nums1 = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],nums2 = [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24]) == [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],nums2 = [200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == [10, 200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20]\n assert candidate(nums1 = [3, 5, 8, 2, 1, 9, 7, 4, 6],nums2 = [6, 7, 8, 2, 1, 5, 4, 3, 9]) == [7, 8, 9, 3, 2, 6, 5, 4, 1]\n assert candidate(nums1 = [9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99, 108, 117, 126, 135],nums2 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == [18, 27, 36, 45, 54, 63, 72, 81, 99, 108, 117, 126, 135, 90, 9]\n assert candidate(nums1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],nums2 = [500, 400, 300, 200, 100, 1100, 900, 800, 700, 600]) == [600, 500, 400, 300, 200, 100, 1000, 900, 800, 700]\n assert candidate(nums1 = [1000000000, 500000000, 750000000, 250000000, 600000000, 900000000],nums2 = [550000000, 800000000, 650000000, 400000000, 950000000, 300000000]) == [750000000, 1000000000, 900000000, 600000000, 250000000, 500000000]\n assert candidate(nums1 = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5],nums2 = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]) == [4, 2, 5, 3, 6, 1, 3, 1, 9, 5, 5]\n assert candidate(nums1 = [7, 5, 6, 4, 3, 8, 2, 9, 1, 10],nums2 = [6, 7, 8, 5, 4, 9, 3, 10, 1, 2]) == [7, 8, 9, 6, 5, 10, 4, 1, 2, 3]\n assert candidate(nums1 = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],nums2 = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]\n assert candidate(nums1 = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75],nums2 = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125]) == [6, 12, 18, 21, 27, 33, 36, 42, 48, 51, 57, 63, 66, 72, 75, 69, 60, 54, 45, 39, 30, 24, 15, 9, 3]\n"}, "metadata": {"canonical_parameter_names": ["nums1", "nums2"], "leetcode_dataset_entry_point": "Solution().advantageCount", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var advantageCount = function(nums1, nums2) {", "container": null, "callable": "advantageCount", "parameters": [{"name": "nums1", "type": "number[]"}, {"name": "nums2", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 871, "task_id": "minimum-number-of-refueling-stops", "difficulty": "Hard", "problem_description": "A car travels from a starting position to a destination which is target miles east of the starting position.\nThere are gas stations along the way. The gas stations are represented as an array stations where stations[i] = [positioni, fueli] indicates that the ith gas station is positioni miles east of the starting position and has fueli liters of gas.\nThe car starts with an infinite tank of gas, which initially has startFuel liters of fuel in it. It uses one liter of gas per one mile that it drives. When the car reaches a gas station, it may stop and refuel, transferring all the gas from the station into the car.\nReturn the minimum number of refueling stops the car must make in order to reach its destination. If it cannot reach the destination, return -1.\nNote that if the car reaches a gas station with 0 fuel left, the car can still refuel there. If the car reaches the destination with 0 fuel left, it is still considered to have arrived.\n \nExample 1:\n\nInput: target = 1, startFuel = 1, stations = []\nOutput: 0\nExplanation: We can reach the target without refueling.\n\nExample 2:\n\nInput: target = 100, startFuel = 1, stations = [[10,100]]\nOutput: -1\nExplanation: We can not reach the target (or even the first gas station).\n\nExample 3:\n\nInput: target = 100, startFuel = 10, stations = [[10,60],[20,30],[30,30],[60,40]]\nOutput: 2\nExplanation: We start with 10 liters of fuel.\nWe drive to position 10, expending 10 liters of fuel. We refuel from 0 liters to 60 liters of gas.\nThen, we drive from position 10 to position 60 (expending 50 liters of fuel),\nand refuel from 10 liters to 50 liters of gas. We then drive to and reach the target.\nWe made 2 refueling stops along the way, so we return 2.\n\n \nConstraints:\n\n1 <= target, startFuel <= 109\n0 <= stations.length <= 500\n1 <= positioni < positioni+1 < target\n1 <= fueli < 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(target = 100,startFuel = 100,stations = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50]]) == 0\n assert candidate(target = 150,startFuel = 50,stations = [[25, 25], [50, 50], [75, 25]]) == 3\n assert candidate(target = 150,startFuel = 50,stations = [[10, 60], [20, 30], [30, 30], [60, 40], [80, 50]]) == 2\n assert candidate(target = 1,startFuel = 1,stations = []) == 0\n assert candidate(target = 100,startFuel = 1,stations = [[10, 100]]) == -1\n assert candidate(target = 100,startFuel = 10,stations = [[10, 60], [20, 30], [30, 30], [60, 40]]) == 2\n assert candidate(target = 150,startFuel = 50,stations = [[25, 25], [50, 25], [75, 50], [100, 100]]) == 3\n assert candidate(target = 1000,startFuel = 500,stations = [[100, 100], [200, 100], [300, 100], [400, 100], [500, 100], [600, 100], [700, 100], [800, 100], [900, 100]]) == 5\n assert candidate(target = 100,startFuel = 50,stations = [[25, 25], [50, 25], [75, 25]]) == 2\n assert candidate(target = 50,startFuel = 1,stations = [[10, 10], [20, 20], [30, 30], [40, 40]]) == -1\n assert candidate(target = 200,startFuel = 25,stations = [[10, 60], [20, 30], [30, 30], [60, 40], [80, 50], [100, 25]]) == 4\n assert candidate(target = 50,startFuel = 50,stations = [[10, 20], [20, 30], [30, 40], [40, 50]]) == 0\n assert candidate(target = 150,startFuel = 50,stations = [[10, 20], [30, 50], [50, 10], [60, 20], [80, 30], [110, 40]]) == 3\n assert candidate(target = 75,startFuel = 25,stations = [[20, 20], [30, 30], [50, 10], [60, 20]]) == 2\n assert candidate(target = 300,startFuel = 50,stations = [[50, 150], [100, 150], [150, 150], [200, 150], [250, 150]]) == 2\n assert candidate(target = 500,startFuel = 100,stations = [[25, 10], [50, 20], [75, 30], [100, 40], [125, 50], [150, 60]]) == -1\n assert candidate(target = 1200,startFuel = 200,stations = [[100, 50], [200, 100], [300, 150], [400, 200], [500, 250], [600, 300], [700, 350], [800, 400], [900, 450], [1000, 500]]) == 5\n assert candidate(target = 500,startFuel = 50,stations = [[50, 50], [100, 100], [150, 50], [200, 150], [250, 50], [300, 50], [350, 50], [400, 50], [450, 50]]) == 6\n assert candidate(target = 200,startFuel = 50,stations = [[25, 30], [50, 50], [75, 20], [100, 100], [150, 50]]) == 2\n assert candidate(target = 500,startFuel = 100,stations = [[25, 100], [100, 50], [150, 150], [300, 100], [400, 200]]) == 4\n assert candidate(target = 1500,startFuel = 500,stations = [[100, 50], [200, 100], [300, 200], [400, 250], [500, 300], [600, 400], [700, 350], [800, 400], [900, 300], [1000, 200], [1100, 150], [1200, 100], [1300, 50], [1400, 250]]) == 3\n assert candidate(target = 1000,startFuel = 300,stations = [[100, 100], [200, 100], [300, 100], [400, 100], [500, 100], [600, 100], [700, 100], [800, 100], [900, 100]]) == 7\n assert candidate(target = 1000,startFuel = 500,stations = [[250, 100], [500, 200], [750, 300], [1000, 400]]) == 3\n assert candidate(target = 1000,startFuel = 1,stations = [[10, 100], [20, 150], [30, 200], [40, 50], [50, 50], [60, 50], [70, 50], [80, 50], [90, 50], [100, 50], [110, 50], [120, 50], [130, 50], [140, 50], [150, 50], [160, 50], [170, 50], [180, 50], [190, 50], [200, 50]]) == -1\n assert candidate(target = 500,startFuel = 200,stations = [[150, 50], [250, 100], [350, 100], [450, 150]]) == 4\n assert candidate(target = 350,startFuel = 20,stations = [[20, 100], [40, 80], [60, 70], [80, 60], [100, 50], [120, 40], [140, 30], [160, 20], [180, 10]]) == 5\n assert candidate(target = 100,startFuel = 50,stations = [[25, 25], [50, 25], [75, 25], [100, 25]]) == 2\n assert candidate(target = 800,startFuel = 200,stations = [[50, 300], [100, 200], [150, 100], [200, 50], [250, 300], [300, 200], [350, 150], [400, 100], [450, 50], [500, 200], [550, 300], [600, 150], [650, 200], [700, 50], [750, 300], [800, 100]]) == 2\n assert candidate(target = 600,startFuel = 100,stations = [[20, 50], [40, 100], [60, 150], [80, 200], [100, 250], [120, 300], [140, 350], [160, 400], [180, 450], [200, 500], [220, 550], [240, 600], [260, 650], [280, 700], [300, 750], [320, 800], [340, 850], [360, 900], [380, 950], [400, 1000], [420, 1050], [440, 1100], [460, 1150], [480, 1200], [500, 1250], [520, 1300], [540, 1350], [560, 1400], [580, 1450]]) == 2\n assert candidate(target = 1000,startFuel = 100,stations = [[100, 200], [200, 150], [300, 50], [400, 100], [500, 250], [600, 100], [700, 200], [800, 50], [900, 100]]) == 5\n assert candidate(target = 1000,startFuel = 300,stations = [[50, 100], [150, 50], [250, 200], [350, 100], [450, 150], [550, 50], [650, 200], [750, 100], [850, 150], [950, 50]]) == 4\n assert candidate(target = 150,startFuel = 100,stations = [[50, 30], [100, 20]]) == 2\n assert candidate(target = 500,startFuel = 100,stations = [[100, 150], [200, 100], [300, 100], [400, 200]]) == 4\n assert candidate(target = 600,startFuel = 100,stations = [[150, 50], [250, 100], [450, 150], [550, 100]]) == -1\n assert candidate(target = 1200,startFuel = 50,stations = [[50, 100], [100, 200], [150, 150], [200, 100], [250, 50], [300, 200], [350, 150], [400, 100], [450, 50], [500, 200], [550, 100], [600, 150], [650, 200], [700, 50], [750, 200], [800, 100], [850, 150], [900, 200], [950, 50], [1000, 200], [1050, 150], [1100, 100]]) == 7\n assert candidate(target = 600,startFuel = 200,stations = [[50, 50], [100, 100], [150, 150], [200, 200], [250, 250], [300, 300], [350, 350], [400, 400], [450, 450], [500, 500], [550, 500]]) == 2\n assert candidate(target = 200,startFuel = 100,stations = [[50, 50], [100, 100], [150, 100], [180, 50]]) == 1\n assert candidate(target = 1000,startFuel = 500,stations = [[200, 100], [300, 150], [500, 200], [600, 300]]) == 2\n assert candidate(target = 300,startFuel = 20,stations = [[10, 40], [20, 30], [30, 50], [40, 20], [50, 60], [60, 10], [70, 70], [80, 25], [90, 25], [100, 20], [110, 20], [120, 20], [130, 20], [140, 20], [150, 20], [160, 20], [170, 20], [180, 20], [190, 20], [200, 20], [210, 20], [220, 20], [230, 20], [240, 20], [250, 20], [260, 20], [270, 20], [280, 20], [290, 20]]) == 7\n assert candidate(target = 1000,startFuel = 500,stations = [[150, 300], [300, 250], [700, 150]]) == 2\n assert candidate(target = 750,startFuel = 250,stations = [[100, 50], [200, 150], [300, 100], [400, 50], [500, 200], [600, 300], [700, 100]]) == 4\n assert candidate(target = 1000,startFuel = 150,stations = [[100, 50], [200, 100], [300, 200], [400, 300], [500, 400], [600, 500], [700, 600], [800, 700], [900, 800]]) == 5\n assert candidate(target = 300,startFuel = 100,stations = [[10, 60], [50, 50], [100, 40], [150, 30], [200, 20], [250, 10]]) == 5\n assert candidate(target = 1000,startFuel = 200,stations = [[50, 100], [150, 100], [250, 100], [350, 100], [450, 100], [550, 100], [650, 100], [750, 100], [850, 100], [950, 100]]) == 8\n assert candidate(target = 150,startFuel = 10,stations = [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100]]) == 3\n assert candidate(target = 450,startFuel = 100,stations = [[20, 100], [40, 120], [60, 140], [80, 160], [100, 180], [120, 200], [140, 220], [160, 240], [180, 260], [200, 280], [220, 300], [240, 320], [260, 340], [280, 360], [300, 380], [320, 400], [340, 420], [360, 440]]) == 2\n assert candidate(target = 400,startFuel = 20,stations = [[10, 30], [30, 40], [50, 50], [70, 60], [90, 70], [110, 80], [130, 90], [150, 100], [170, 110], [190, 120]]) == 5\n assert candidate(target = 600,startFuel = 200,stations = [[50, 10], [100, 10], [150, 10], [200, 10], [250, 10], [300, 10], [350, 10], [400, 10], [450, 10], [500, 10], [550, 400]]) == -1\n assert candidate(target = 1000,startFuel = 500,stations = [[50, 50], [100, 100], [150, 150], [200, 200], [250, 250], [300, 300], [350, 350], [400, 400], [450, 450], [500, 500], [550, 550], [600, 600], [650, 650], [700, 700], [750, 750], [800, 800], [850, 850], [900, 900], [950, 950]]) == 1\n assert candidate(target = 500,startFuel = 150,stations = [[50, 50], [150, 200], [250, 100], [350, 50], [450, 30]]) == 3\n assert candidate(target = 1000,startFuel = 1000,stations = [[100, 100], [200, 100], [300, 100], [400, 100], [500, 100], [600, 100], [700, 100], [800, 100], [900, 100]]) == 0\n assert candidate(target = 300,startFuel = 40,stations = [[20, 100], [40, 50], [60, 30], [100, 20], [150, 50], [250, 75]]) == 5\n assert candidate(target = 700,startFuel = 100,stations = [[100, 50], [200, 75], [300, 100], [400, 125], [500, 150], [600, 175]]) == -1\n assert candidate(target = 500,startFuel = 100,stations = [[100, 100], [200, 100], [300, 100], [400, 100]]) == 4\n assert candidate(target = 500,startFuel = 25,stations = [[25, 25], [50, 50], [75, 75], [100, 100], [125, 125], [150, 150], [175, 175], [200, 200], [225, 225], [250, 250], [275, 275], [300, 300], [325, 325], [350, 350], [375, 375], [400, 400], [425, 425], [450, 450], [475, 475]]) == 5\n assert candidate(target = 600,startFuel = 100,stations = [[50, 100], [150, 100], [250, 100], [350, 100], [450, 100], [550, 100]]) == 5\n assert candidate(target = 1000,startFuel = 1,stations = [[10, 100], [20, 200], [30, 300], [40, 400], [50, 500], [60, 600], [70, 700], [80, 800], [90, 900]]) == -1\n assert candidate(target = 200,startFuel = 50,stations = [[25, 30], [50, 10], [75, 20], [100, 50], [150, 40]]) == 5\n assert candidate(target = 1500,startFuel = 400,stations = [[200, 100], [300, 200], [500, 150], [700, 50], [1200, 300], [1400, 100]]) == -1\n assert candidate(target = 500,startFuel = 1,stations = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [21, 22], [23, 24], [25, 26], [27, 28], [29, 30], [31, 32], [33, 34], [35, 36], [37, 38], [39, 40], [41, 42], [43, 44], [45, 46], [47, 48], [49, 49], [51, 50], [53, 51], [55, 52], [57, 53], [59, 54], [61, 55], [63, 56], [65, 57], [67, 58], [69, 59], [71, 60], [73, 61], [75, 62], [77, 63], [79, 64], [81, 65], [83, 66], [85, 67], [87, 68], [89, 69], [91, 70], [93, 71], [95, 72], [97, 73], [99, 74], [101, 75], [103, 76], [105, 77], [107, 78], [109, 79], [111, 80], [113, 81], [115, 82], [117, 83], [119, 84], [121, 85], [123, 86], [125, 87], [127, 88], [129, 89], [131, 90], [133, 91], [135, 92], [137, 93], [139, 94], [141, 95], [143, 96], [145, 97], [147, 98], [149, 99], [151, 100], [153, 101], [155, 102], [157, 103], [159, 104], [161, 105], [163, 106], [165, 107], [167, 108], [169, 109], [171, 110], [173, 111], [175, 112], [177, 113], [179, 114], [181, 115], [183, 116], [185, 117], [187, 118], [189, 119], [191, 120], [193, 121], [195, 122], [197, 123], [199, 124], [201, 125], [203, 126], [205, 127], [207, 128], [209, 129], [211, 130], [213, 131], [215, 132], [217, 133], [219, 134], [221, 135], [223, 136], [225, 137], [227, 138], [229, 139], [231, 140], [233, 141], [235, 142], [237, 143], [239, 144], [241, 145], [243, 146], [245, 147], [247, 148], [249, 149], [251, 150], [253, 151], [255, 152], [257, 153], [259, 154], [261, 155], [263, 156], [265, 157], [267, 158], [269, 159], [271, 160], [273, 161], [275, 162], [277, 163], [279, 164], [281, 165], [283, 166], [285, 167], [287, 168], [289, 169], [291, 170], [293, 171], [295, 172], [297, 173], [299, 174], [301, 175], [303, 176], [305, 177], [307, 178], [309, 179], [311, 180], [313, 181], [315, 182], [317, 183], [319, 184], [321, 185], [323, 186], [325, 187], [327, 188], [329, 189], [331, 190], [333, 191], [335, 192], [337, 193], [339, 194], [341, 195], [343, 196], [345, 197], [347, 198], [349, 199], [351, 200], [353, 201], [355, 202], [357, 203], [359, 204], [361, 205], [363, 206], [365, 207], [367, 208], [369, 209], [371, 210], [373, 211], [375, 212], [377, 213], [379, 214], [381, 215], [383, 216], [385, 217], [387, 218], [389, 219], [391, 220], [393, 221], [395, 222], [397, 223], [399, 224], [401, 225], [403, 226], [405, 227], [407, 228], [409, 229], [411, 230], [413, 231], [415, 232], [417, 233], [419, 234], [421, 235], [423, 236], [425, 237], [427, 238], [429, 239], [431, 240], [433, 241], [435, 242], [437, 243], [439, 244], [441, 245], [443, 246], [445, 247], [447, 248], [449, 249], [451, 250], [453, 251], [455, 252], [457, 253], [459, 254], [461, 255], [463, 256], [465, 257], [467, 258], [469, 259], [471, 260], [473, 261], [475, 262], [477, 263], [479, 264], [481, 265], [483, 266], [485, 267], [487, 268], [489, 269], [491, 270], [493, 271], [495, 272], [497, 273], [499, 274]]) == 9\n assert candidate(target = 800,startFuel = 200,stations = [[150, 80], [300, 100], [450, 120], [600, 140], [750, 160]]) == -1\n assert candidate(target = 1500,startFuel = 100,stations = [[100, 300], [200, 200], [300, 100], [400, 50], [500, 200], [600, 300], [700, 150], [800, 200], [900, 50], [1000, 300], [1100, 200], [1200, 150], [1300, 100], [1400, 50]]) == 6\n assert candidate(target = 200,startFuel = 100,stations = [[50, 50], [100, 50], [150, 50], [175, 25]]) == 2\n assert candidate(target = 500,startFuel = 250,stations = [[100, 100], [200, 150], [300, 200]]) == 2\n assert candidate(target = 1000,startFuel = 100,stations = [[100, 200], [200, 150], [300, 100], [400, 250], [500, 200]]) == 5\n assert candidate(target = 1000,startFuel = 200,stations = [[100, 100], [200, 150], [300, 200], [400, 250], [500, 300], [600, 400]]) == 4\n assert candidate(target = 400,startFuel = 30,stations = [[20, 10], [30, 20], [40, 30], [50, 40], [60, 50], [70, 60], [80, 70], [90, 80], [100, 90]]) == 7\n assert candidate(target = 2000,startFuel = 200,stations = [[100, 150], [200, 100], [300, 50], [400, 200], [500, 250], [600, 150], [700, 100], [800, 200], [900, 250], [1000, 150], [1100, 100], [1200, 200], [1300, 250], [1400, 150], [1500, 100], [1600, 200], [1700, 250], [1800, 150], [1900, 100]]) == 9\n assert candidate(target = 1500,startFuel = 300,stations = [[100, 100], [200, 150], [300, 200], [400, 250], [500, 300], [600, 350], [700, 400], [800, 450], [900, 500]]) == 4\n assert candidate(target = 1200,startFuel = 50,stations = [[50, 50], [150, 50], [250, 50], [350, 50], [450, 50], [550, 50], [650, 50], [750, 50], [850, 50], [950, 50], [1050, 50], [1150, 50]]) == -1\n assert candidate(target = 1000,startFuel = 100,stations = [[100, 200], [200, 100], [300, 50], [400, 300], [500, 200], [600, 100], [700, 500], [800, 100], [900, 100]]) == 4\n assert candidate(target = 1500,startFuel = 400,stations = [[300, 300], [600, 300], [900, 300], [1200, 300]]) == 4\n assert candidate(target = 250,startFuel = 50,stations = [[20, 40], [40, 40], [60, 30], [80, 20], [100, 50], [150, 30], [200, 20]]) == 6\n assert candidate(target = 1000,startFuel = 100,stations = [[50, 30], [100, 50], [150, 100], [200, 150], [250, 200], [300, 250], [350, 300], [400, 350], [450, 400], [500, 450], [550, 500], [600, 550], [650, 600], [700, 650], [750, 700], [800, 750], [850, 800], [900, 850], [950, 900]]) == 5\n assert candidate(target = 3000,startFuel = 250,stations = [[100, 100], [200, 150], [300, 200], [400, 250], [500, 300], [600, 350], [700, 400], [800, 450], [900, 500], [1000, 550], [1100, 600], [1200, 650], [1300, 700], [1400, 750], [1500, 800], [1600, 850], [1700, 900], [1800, 950], [1900, 1000], [2000, 1050], [2100, 1100], [2200, 1150], [2300, 1200], [2400, 1250], [2500, 1300], [2600, 1350], [2700, 1400], [2800, 1450], [2900, 1500]]) == 6\n assert candidate(target = 1200,startFuel = 200,stations = [[200, 300], [400, 200], [600, 400], [800, 100], [1000, 200]]) == 4\n assert candidate(target = 2000,startFuel = 300,stations = [[100, 500], [300, 500], [500, 500], [700, 500], [900, 500], [1100, 500], [1300, 500], [1500, 500], [1700, 500], [1900, 500]]) == 4\n assert candidate(target = 500,startFuel = 10,stations = [[10, 50], [20, 100], [30, 50], [40, 30], [50, 40], [60, 50], [70, 100], [80, 40], [90, 10], [100, 200]]) == 5\n assert candidate(target = 800,startFuel = 400,stations = [[100, 100], [200, 150], [300, 100], [400, 50], [500, 300], [600, 200], [700, 100]]) == 2\n assert candidate(target = 150,startFuel = 50,stations = [[10, 20], [30, 30], [50, 50], [100, 100]]) == 2\n assert candidate(target = 2000,startFuel = 100,stations = [[100, 100], [200, 100], [300, 100], [400, 100], [500, 100], [600, 100], [700, 100], [800, 100], [900, 100], [1000, 100], [1100, 100], [1200, 100], [1300, 100], [1400, 100], [1500, 100], [1600, 100], [1700, 100], [1800, 100], [1900, 100]]) == 19\n assert candidate(target = 500,startFuel = 100,stations = [[50, 200], [100, 50], [150, 150], [200, 100], [300, 200], [400, 150]]) == 2\n assert candidate(target = 1000,startFuel = 50,stations = [[50, 200], [150, 150], [250, 100], [350, 50], [450, 200], [550, 100], [650, 150], [750, 100], [850, 50], [950, 200]]) == 7\n assert candidate(target = 1000,startFuel = 500,stations = [[100, 200], [300, 300], [450, 250], [600, 400], [800, 100]]) == 2\n assert candidate(target = 1000,startFuel = 500,stations = [[200, 100], [300, 150], [400, 50], [800, 200]]) == 4\n assert candidate(target = 800,startFuel = 100,stations = [[100, 50], [200, 50], [300, 50], [400, 50], [500, 50], [600, 50], [700, 50]]) == -1\n assert candidate(target = 100,startFuel = 90,stations = [[10, 10], [20, 10], [30, 10], [40, 10], [50, 10], [60, 10], [70, 10], [80, 10], [90, 10]]) == 1\n assert candidate(target = 2500,startFuel = 500,stations = [[100, 200], [200, 100], [300, 150], [400, 100], [500, 150], [600, 200], [700, 250], [800, 300], [900, 350], [1000, 400], [1100, 450], [1200, 500], [1300, 550], [1400, 600], [1500, 650], [1600, 700], [1700, 750], [1800, 800], [1900, 850], [2000, 900], [2100, 950], [2200, 1000], [2300, 1050], [2400, 1100]]) == 5\n assert candidate(target = 400,startFuel = 20,stations = [[20, 50], [40, 60], [60, 70], [80, 80], [100, 90], [120, 100], [140, 110], [160, 120], [180, 130]]) == 5\n assert candidate(target = 2000,startFuel = 100,stations = [[100, 150], [200, 200], [300, 100], [400, 50], [500, 300], [600, 250], [700, 150], [800, 200], [900, 100], [1000, 150], [1100, 200], [1200, 50], [1300, 250], [1400, 150], [1500, 50], [1600, 100], [1700, 200], [1800, 150], [1900, 50]]) == 10\n assert candidate(target = 200,startFuel = 10,stations = [[10, 60], [40, 20], [70, 10], [150, 50]]) == -1\n assert candidate(target = 100,startFuel = 25,stations = [[10, 20], [20, 10], [30, 10], [60, 50]]) == 4\n assert candidate(target = 600,startFuel = 150,stations = [[50, 250], [100, 100], [150, 100], [200, 100], [250, 100], [300, 100], [350, 100], [400, 100], [450, 100], [500, 100]]) == 3\n assert candidate(target = 300,startFuel = 100,stations = [[50, 50], [100, 30], [150, 70], [200, 20], [250, 30]]) == 5\n assert candidate(target = 600,startFuel = 150,stations = [[150, 200], [200, 250], [300, 300], [400, 350], [500, 400]]) == 2\n assert candidate(target = 500,startFuel = 100,stations = [[50, 100], [150, 100], [250, 50], [350, 50], [450, 50]]) == -1\n"}, "metadata": {"canonical_parameter_names": ["target", "startFuel", "stations"], "leetcode_dataset_entry_point": "Solution().minRefuelStops", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minRefuelStops = function(target, startFuel, stations) {", "container": null, "callable": "minRefuelStops", "parameters": [{"name": "target", "type": "number"}, {"name": "startFuel", "type": "number"}, {"name": "stations", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 872, "task_id": "leaf-similar-trees", "difficulty": "Easy", "problem_description": "Consider all the leaves of a binary tree, from left to right order, the values of those leaves form a leaf value sequence.\n\nFor example, in the given tree above, the leaf value sequence is (6, 7, 4, 9, 8).\nTwo binary trees are considered leaf-similar if their leaf value sequence is the same.\nReturn true if and only if the two given trees with head nodes root1 and root2 are leaf-similar.\n \nExample 1:\n\n\nInput: root1 = [3,5,1,6,2,9,8,null,null,7,4], root2 = [3,5,1,6,7,4,2,null,null,null,null,null,null,9,8]\nOutput: true\n\nExample 2:\n\n\nInput: root1 = [1,2,3], root2 = [1,3,2]\nOutput: false\n\n \nConstraints:\n\nThe number of nodes in each tree will be in the range [1, 200].\nBoth of the given trees will have values in the range [0, 200].\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root1 = tree_node([1, 2, 3]),root2 = tree_node([1, 3, 2])) == False\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4]),root2 = tree_node([3, 5, 1, 6, 7, 4, 2, None, None, None, None, None, None, 9, 8])) == True\n assert candidate(root1 = tree_node([5, 3, 8, 1, 4, 7, 9, None, 2, 6, None, None, None, None, None, None, None]),root2 = tree_node([5, 3, 8, 1, 4, 7, 9, None, 2, 6, None, None, None, None, None, None, None])) == True\n assert candidate(root1 = tree_node([5, 1, 4, None, 2, None, 3]),root2 = tree_node([5, 1, 3, None, 2, None, 4])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, 8]),root2 = tree_node([1, 2, 3, 4, 5, 7, 6, None, None, None, None, None, 8])) == False\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13, 14, 15]),root2 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13, 14, 15])) == True\n assert candidate(root1 = tree_node([5, 1, 5, 5, None, 5, None, 5, 5, None, 5]),root2 = tree_node([5, 5, 1, None, 5, 5, None, 5, 5, None, 5])) == True\n assert candidate(root1 = tree_node([1, 2, None, 3, None, 4, None, 5]),root2 = tree_node([1, 2, None, 4, None, 3, None, 5])) == True\n assert candidate(root1 = tree_node([1, None, 2, None, 3, None, 4, None, 5]),root2 = tree_node([1, 2, 3, 4, 5])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, None, 5, None, None, 6]),root2 = tree_node([1, 2, 3, None, 5, 4, None, None, None, 6])) == False\n assert candidate(root1 = tree_node([4, 3, None, 1, 2]),root2 = tree_node([4, 3, None, 2, 1])) == False\n assert candidate(root1 = tree_node([1, 2, 3, None, None, None, 4]),root2 = tree_node([1, 2, 3, None, 4])) == False\n assert candidate(root1 = tree_node([4, 2, 7, 1, 3, 6, 9]),root2 = tree_node([4, 2, 7, 1, 3, 9, 6])) == False\n assert candidate(root1 = tree_node([5, 3, 8, 1, 4, None, 9, None, None, 2, 6, None, None, None, None, None, 7]),root2 = tree_node([5, 3, 8, 1, None, None, 9, None, 4, None, 7, None, None, 2, 6])) == False\n assert candidate(root1 = tree_node([5, 4, 6, 3, 8, 7, 9, 2, None, None, None, None, None, None, 1]),root2 = tree_node([5, 4, 7, 3, 8, 6, 9, 2, None, None, None, None, None, None, 1])) == False\n assert candidate(root1 = tree_node([2, 1, 4, None, None, 3, 6]),root2 = tree_node([2, 1, 6, None, None, 3, 4])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21])) == False\n assert candidate(root1 = tree_node([15, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]),root2 = tree_node([15, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8, 9, 10, 11, 12, None, None, 13, 14, 15, 16]),root2 = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, 11, 8, 9, 10, None, None, None, 12, 13, 14, 15, 16])) == False\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11]),root2 = tree_node([3, 5, 1, 6, 10, 11, 2, None, None, None, None, None, 7, 4, 9, 8])) == False\n assert candidate(root1 = tree_node([8, 5, 9, 3, 7, None, None, 1, 4, 6, None]),root2 = tree_node([8, 5, 9, 3, 7, None, None, 1, None, 4, 6])) == True\n assert candidate(root1 = tree_node([5, 1, 9, None, 4, 3, None, 7, 6, None, 8, None, None, 2, None]),root2 = tree_node([9, 5, 1, 3, 4, None, None, 2, 6, None, 7, None, None, None, 8])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, None, 10]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, 9, None, None, None, None, 10])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, None, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 2, 3, 4, None, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 19])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, 16, 17, 18, 19, 20]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == True\n assert candidate(root1 = tree_node([7, 13, 10, 1, 2, None, 5, None, None, None, None, None, 4]),root2 = tree_node([10, 13, 5, 1, None, 2, 4, 7])) == False\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13, 14, 15, None, None, None, None, 16, None, None, 17, None, None, None, 18]),root2 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13, 14, 15, None, None, None, None, 16, None, None, 17, None, None, None, 18])) == True\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 11, 12]),root2 = tree_node([3, 5, 1, 6, 7, 4, 2, None, None, None, None, None, None, 9, 8, None, None, 11, 12])) == False\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13, 14, 15, None, None, None, None, 16]),root2 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13, 14, 15, None, None, None, None, 16])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9]),root2 = tree_node([1, 3, 2, 6, 7, 4, 5, None, None, None, None, 8, 9])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, 8, 9, 10, None, None, 11, 12]),root2 = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, 8, 9, 10, None, None, 11, 13])) == False\n assert candidate(root1 = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) == False\n assert candidate(root1 = tree_node([2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, None, None, None, 10]),root2 = tree_node([2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, None, None, 10, None])) == False\n assert candidate(root1 = tree_node([10, 5, 15, None, None, 6, 20]),root2 = tree_node([10, 5, 15, None, None, 20, 6])) == False\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13]),root2 = tree_node([3, 5, 1, 6, 7, 4, 2, 10, 11, 12, 13, None, None, None, None, None, None, 9, 8])) == False\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, None, None, 11]),root2 = tree_node([3, 5, 1, 6, 7, 4, 2, None, None, None, None, None, None, 9, 8, 11, 10])) == False\n assert candidate(root1 = tree_node([5, None, 3, None, 4, None, 6]),root2 = tree_node([5, None, 3, None, 4, None, 7])) == False\n assert candidate(root1 = tree_node([1, None, 2, None, 3, None, 4, None, 5]),root2 = tree_node([5, 4, 3, 2, 1])) == False\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13, 14, 15, None, None, None, None, 16, None, None, 17, None, None, None, 18, 19]),root2 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13, 14, 15, None, None, None, None, 16, None, None, 17, None, None, None, 18, 19])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9]),root2 = tree_node([1, 2, 3, 4, 5, None, None, 9, 8, None, None, 7, 6])) == False\n assert candidate(root1 = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 35, 65, 85, 115, 135, 165, 185]),root2 = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 35, 65, 85, 115, 135, 165, 185])) == True\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4]),root2 = tree_node([5, 1, 5, 6, 2, 9, 8, None, None, 7, 4])) == True\n assert candidate(root1 = tree_node([1]),root2 = tree_node([1])) == True\n assert candidate(root1 = tree_node([5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75]),root2 = tree_node([5, 15, 10, 25, 20, 35, 30, 55, 50, 65, 60, 75, 70, 45, 40])) == False\n assert candidate(root1 = tree_node([5, 1, 4, None, None, 3, 6]),root2 = tree_node([5, 1, 4, None, None, 3, None, None, 6])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, 8, 9, 10, None, None, 11, 12]),root2 = tree_node([1, 2, 3, None, 4, 5, 6, 7, 8, 9, 10, None, None, 11, 12])) == False\n assert candidate(root1 = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None]),root2 = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7])) == True\n assert candidate(root1 = tree_node([4, 10, None, 3, 2]),root2 = tree_node([4, 10, None, 3, None, None, 2])) == False\n assert candidate(root1 = tree_node([1, 2, 3, None, 4, None, 5, None, 6]),root2 = tree_node([1, 2, 3, None, 4, None, 5, None, 6])) == True\n assert candidate(root1 = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6]),root2 = tree_node([6, 5, 4, 3, 2, 1])) == False\n assert candidate(root1 = tree_node([10, 5, 6, None, None, 3, 7, None, None, None, 4]),root2 = tree_node([10, 5, 6, None, None, 3, None, None, 4, None, 7])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == True\n assert candidate(root1 = tree_node([4, 2, 6, 1, 3, 5, 7]),root2 = tree_node([4, 2, 6, 1, None, 5, None, 3, None, 7])) == False\n assert candidate(root1 = tree_node([7, 5, 6, 1, 4, 3, 2, None, None, None, None, None, None, 8, 9]),root2 = tree_node([7, 5, 6, 1, 4, 3, None, 8, 9, None, None, 2])) == False\n assert candidate(root1 = tree_node([1, 2, 3, None, 4, 5, 6, 7, 8, 9, 10, 11, 12]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])) == False\n assert candidate(root1 = tree_node([4, 2, 6, 1, 3, 5, 7]),root2 = tree_node([4, 1, 6, None, 2, 5, 7])) == False\n assert candidate(root1 = tree_node([1, 2, None, 3, 4, 5, 6, 7, 8, 9, 10]),root2 = tree_node([1, 2, None, 3, 10, 4, 5, 6, 7, 8, 9])) == False\n assert candidate(root1 = tree_node([1, 2, None, 3, None, 4, None, 5]),root2 = tree_node([1, None, 2, None, 3, None, 4, None, 5])) == True\n assert candidate(root1 = tree_node([10, 20, 30, 40, 50, 60, 70, None, 80, 90, 100, 110, 120, 130, 140]),root2 = tree_node([10, 20, 30, 40, 50, 60, 70, None, 80, 90, 100, 110, 120, 130, 140])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == True\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 11, 12]),root2 = tree_node([3, 5, 1, 6, 7, 4, 2, None, None, None, None, None, None, 9, 8, 11, 12])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == True\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13, 14, 15, None, None, None, None, 16, None, None, 17]),root2 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13, 14, 15, None, None, None, None, 16, None, None, 17])) == True\n assert candidate(root1 = tree_node([8, 3, 5, 6, 7, 9, 2, 10, None, None, 1, None, None, None, None, 11]),root2 = tree_node([8, 3, 5, 6, 7, 9, 2, None, None, None, None, None, None, 10, 11])) == False\n assert candidate(root1 = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7]),root2 = tree_node([7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1])) == False\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13, 14, 15, None, None, None, None, 16, None, None, 17, None, None, None, 18, 19, 20]),root2 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11, 12, 13, 14, 15, None, None, None, None, 16, None, None, 17, None, None, None, 18, 19, 20])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, None, None, 5, 6, 7, 8, 9]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9])) == False\n assert candidate(root1 = tree_node([2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10]),root2 = tree_node([2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == True\n assert candidate(root1 = tree_node([2, 1, None, 3]),root2 = tree_node([2, None, 1, None, 3])) == True\n assert candidate(root1 = tree_node([1, 2, None, 3, 4, None, 5, 6, None, 7]),root2 = tree_node([1, 2, None, 3, 4, None, 5, 6, None, 7])) == True\n assert candidate(root1 = tree_node([10, 5, 15, 3, 7, 13, 18, 1, 4, None, None, 11, 14, None, None, None, None, None]),root2 = tree_node([10, 5, 15, 3, 7, None, 18, 1, 4, None, 13, None, None, 11, 14])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]),root2 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 29])) == False\n assert candidate(root1 = tree_node([10, 5, 15, 3, 7, None, 18]),root2 = tree_node([10, 5, 15, None, 7, 18, None, 3])) == False\n assert candidate(root1 = tree_node([3, 5, 1, 6, 2, 9, 8, None, None, 7, 4, 10, 11]),root2 = tree_node([3, 5, 1, 6, 7, 4, 2, 10, 11, None, None, None, None, None, None, 9, 8])) == False\n assert candidate(root1 = tree_node([1, 2, None, 3, 4]),root2 = tree_node([1, None, 2, 3, 4])) == True\n assert candidate(root1 = tree_node([8, 6, 7, None, 5, None, 4, None, 3, None, 2, None, 1]),root2 = tree_node([8, 7, 6, None, 5, None, 4, None, 3, None, 2, None, 1])) == True\n assert candidate(root1 = tree_node([10, 5, 15, 3, 7, None, 18]),root2 = tree_node([10, 15, 5, 18, None, 3, 7])) == False\n assert candidate(root1 = tree_node([3, 9, 20, None, None, 15, 7]),root2 = tree_node([3, 9, 20, None, None, 15, 7])) == True\n assert candidate(root1 = tree_node([2, 3, None, 1]),root2 = tree_node([2, 1, None, 3])) == False\n assert candidate(root1 = tree_node([1, 2, None, 3, None, 4, None, 5, None]),root2 = tree_node([1, 2, None, 3, None, 5, None, 4, None])) == False\n assert candidate(root1 = tree_node([4, 2, 7, 1, 3, 6, 9]),root2 = tree_node([4, 2, 7, 3, 1, 9, 6])) == False\n assert candidate(root1 = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6]),root2 = tree_node([10, 5, 15, 3, 6, 7, None, 1, None, 13, 18])) == False\n assert candidate(root1 = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15]),root2 = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == False\n assert candidate(root1 = tree_node([10, 5, 15, 3, 7, 13, 18, 1, 4, 6, 8, 12, 14, 17, 19]),root2 = tree_node([10, 5, 15, 1, 4, 3, 7, 6, 8, 13, 18, 12, 14, 17, 19])) == False\n assert candidate(root1 = tree_node([4, 7, 11, 5, 8, 14, None, None, None, None, 2, None, 9, 1, 12, None, None, None, 6, 10, 13, None, None, None, None, None, None, None, None, 3]),root2 = tree_node([4, 7, 11, 5, 8, 14, None, None, None, None, 3, None, 9, 1, 12, None, None, None, 6, 10, 13, None, None, None, None, None, None, None, None, 2])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 3, 2, 6, 7, 5, 4, 15, 14, 13, 12, 11, 10, 9, 8])) == False\n"}, "metadata": {"canonical_parameter_names": ["root1", "root2"], "leetcode_dataset_entry_point": "Solution().leafSimilar", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var leafSimilar = function(root1, root2) {", "container": null, "callable": "leafSimilar", "parameters": [{"name": "root1", "type": "TreeNode"}, {"name": "root2", "type": "TreeNode"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 873, "task_id": "length-of-longest-fibonacci-subsequence", "difficulty": "Medium", "problem_description": "A sequence x1, x2, ..., xn is Fibonacci-like if:\n\nn >= 3\nxi + xi+1 == xi+2 for all i + 2 <= n\n\nGiven a strictly increasing array arr of positive integers forming a sequence, return the length of the longest Fibonacci-like subsequence of arr. If one does not exist, return 0.\nA subsequence is derived from another sequence arr by deleting any number of elements (including none) from arr, without changing the order of the remaining elements. For example, [3, 5, 8] is a subsequence of [3, 4, 5, 6, 7, 8].\n \nExample 1:\n\nInput: arr = [1,2,3,4,5,6,7,8]\nOutput: 5\nExplanation: The longest subsequence that is fibonacci-like: [1,2,3,5,8].\nExample 2:\n\nInput: arr = [1,3,7,11,12,14,18]\nOutput: 3\nExplanation: The longest subsequence that is fibonacci-like: [1,11,12], [3,11,14] or [7,11,18].\n \nConstraints:\n\n3 <= arr.length <= 1000\n1 <= arr[i] < arr[i + 1] <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 2, 3, 4, 6, 9, 13, 19, 28, 41, 60, 88]) == 3\n assert candidate(arr = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946]) == 20\n assert candidate(arr = [2, 4, 7, 11, 18, 29, 47, 76]) == 7\n assert candidate(arr = [1, 3, 4, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(arr = [1, 4, 7, 10, 13, 16, 19]) == 0\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8]) == 5\n assert candidate(arr = [1, 4, 5, 6, 8, 10, 13, 21]) == 4\n assert candidate(arr = [2, 4, 5, 6, 7, 8, 10, 13, 21]) == 4\n assert candidate(arr = [2, 4, 7, 8, 9, 10, 14, 15, 21, 25, 30]) == 3\n assert candidate(arr = [1, 5, 6, 7, 10, 13, 19, 26, 42]) == 4\n assert candidate(arr = [1, 2, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377]) == 10\n assert candidate(arr = [1, 3, 7, 11, 12, 14, 18]) == 3\n assert candidate(arr = [2, 4, 7, 8, 10, 14, 22, 39]) == 3\n assert candidate(arr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]) == 3\n assert candidate(arr = [1, 3, 4, 7, 11, 18, 29, 47, 76, 123]) == 10\n assert candidate(arr = [1, 2, 4, 8, 13, 21, 34]) == 4\n assert candidate(arr = [1, 2, 3, 5, 8, 13, 21]) == 7\n assert candidate(arr = [1, 2, 4, 7, 11, 18, 29]) == 5\n assert candidate(arr = [1, 2, 6, 7, 13, 20, 33, 54, 87, 141, 228, 369, 597, 966, 1563, 2529, 4092, 6621, 10713, 17334]) == 14\n assert candidate(arr = [1, 4, 7, 13, 20, 33, 54, 87]) == 4\n assert candidate(arr = [1, 2, 3, 5, 8, 13, 21, 34, 55]) == 9\n assert candidate(arr = [1, 9, 10, 11, 12, 13, 14, 15]) == 3\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) == 0\n assert candidate(arr = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55]) == 4\n assert candidate(arr = [1, 2, 5, 13, 34, 89, 233, 610, 1597, 4181, 10946]) == 0\n assert candidate(arr = [1, 2, 3, 6, 9, 18, 30, 54, 84, 144, 228, 372, 600, 972, 1572, 2544, 4116, 6660, 10776, 17436]) == 12\n assert candidate(arr = [1, 5, 6, 11, 17, 28, 45, 73, 118, 191, 309, 500, 809]) == 13\n assert candidate(arr = [3, 8, 11, 19, 30, 49, 79, 128, 207, 335, 542, 877, 1419, 2296, 3715, 6011, 9726, 15737, 25453, 41190]) == 18\n assert candidate(arr = [4, 6, 10, 16, 26, 42, 68, 110, 178, 288, 466, 754]) == 12\n assert candidate(arr = [1, 8, 9, 17, 25, 32, 47, 63, 82, 105, 140, 185, 248]) == 4\n assert candidate(arr = [1, 3, 5, 6, 8, 9, 10, 12, 13, 15, 18, 21, 24, 27, 30, 33, 36, 40, 45, 48]) == 5\n assert candidate(arr = [1, 4, 6, 9, 10, 11, 12, 15, 16, 17, 20, 21, 22, 25, 28, 30, 32, 35, 38, 41]) == 5\n assert candidate(arr = [1, 5, 6, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711]) == 18\n assert candidate(arr = [10, 13, 23, 36, 59, 95, 154, 249, 403, 652, 1055, 1707]) == 12\n assert candidate(arr = [1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199]) == 11\n assert candidate(arr = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81]) == 7\n assert candidate(arr = [5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711]) == 18\n assert candidate(arr = [1, 4, 5, 9, 13, 22, 35, 57, 92, 149, 241, 390]) == 10\n assert candidate(arr = [2, 5, 7, 12, 19, 31, 50, 81, 131, 212, 343, 555, 898, 1453, 2351, 3804]) == 16\n assert candidate(arr = [1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843]) == 14\n assert candidate(arr = [3, 7, 10, 17, 27, 44, 71, 115, 186, 301, 487, 788]) == 12\n assert candidate(arr = [5, 11, 16, 27, 43, 70, 113, 183, 296, 479, 772, 1251, 2033]) == 10\n assert candidate(arr = [2, 9, 11, 20, 31, 51, 82, 133, 215, 348, 563, 911, 1474, 2385, 3859, 6234, 10113, 16367, 26480, 42847, 69227]) == 15\n assert candidate(arr = [3, 6, 9, 15, 24, 39, 63, 102, 165, 267]) == 10\n assert candidate(arr = [1, 2, 4, 5, 8, 9, 12, 13, 16, 18, 21, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50, 53, 56, 59, 62, 65, 68]) == 4\n assert candidate(arr = [3, 10, 13, 23, 36, 59, 92, 151, 243, 394, 637, 1030, 1667, 2697, 4324, 7021, 11348, 18379, 29727, 48076]) == 6\n assert candidate(arr = [2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711]) == 20\n assert candidate(arr = [1, 4, 5, 9, 13, 22, 35, 57, 92, 149, 241, 390, 631, 1021, 1652, 2673, 4325, 7008, 11343, 18361]) == 15\n assert candidate(arr = [5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368]) == 20\n assert candidate(arr = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50, 53, 56, 59]) == 0\n assert candidate(arr = [1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843, 1364]) == 15\n assert candidate(arr = [5, 9, 14, 23, 37, 60, 97, 157, 254, 411]) == 10\n assert candidate(arr = [2, 7, 9, 16, 25, 41, 66, 107, 173, 280, 453, 733, 1186, 1919, 3102]) == 14\n assert candidate(arr = [2, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]) == 13\n assert candidate(arr = [1, 4, 5, 7, 11, 18, 29, 47, 76, 123, 199]) == 9\n assert candidate(arr = [1, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41]) == 0\n assert candidate(arr = [5, 9, 14, 23, 37, 60, 97, 157, 254, 411, 665, 1076, 1741, 2817, 4558, 7375, 11933, 19308]) == 18\n assert candidate(arr = [1, 4, 6, 7, 9, 11, 16, 25, 41, 66, 107, 173, 280]) == 9\n assert candidate(arr = [7, 12, 19, 31, 50, 81, 131, 212, 343, 555, 898, 1453, 2351, 3804, 6155, 9959, 16064, 26023, 42083, 68106, 110189, 178292, 288481, 466773, 755254, 1224027, 1979281, 3204308, 5183589, 8382897, 13566496, 21949493, 35536090, 57485583]) == 16\n assert candidate(arr = [1, 4, 5, 7, 11, 18, 29, 47, 76, 123, 199, 322]) == 10\n assert candidate(arr = [1, 7, 12, 18, 25, 33, 42, 51, 61, 72, 84, 97, 111, 126, 142, 159, 177, 196, 216, 237, 259, 282, 306, 331, 357]) == 4\n assert candidate(arr = [1, 4, 5, 7, 12, 17, 29, 46, 75, 121]) == 7\n assert candidate(arr = [1, 2, 6, 9, 15, 24, 41, 65, 106, 171, 277, 448, 725, 1173, 1901, 3076]) == 9\n assert candidate(arr = [2, 8, 10, 18, 28, 46, 74, 120, 194, 314, 508, 822, 1330, 2152, 3482, 5634, 9086, 14718, 23804, 38522]) == 16\n assert candidate(arr = [2, 11, 26, 47, 74, 107, 146, 189, 238, 293, 354, 421, 494, 573, 658, 749, 846, 949, 1058, 1173, 1294, 1421, 1554, 1693]) == 0\n assert candidate(arr = [2, 5, 7, 12, 19, 31, 50, 81, 131, 212, 343]) == 11\n assert candidate(arr = [1, 5, 6, 7, 12, 13, 19, 21, 34, 55, 89]) == 5\n assert candidate(arr = [3, 7, 10, 17, 27, 44, 71, 115, 186, 301, 487, 788, 1275, 2063]) == 14\n assert candidate(arr = [1, 4, 5, 6, 8, 9, 11, 15, 17, 20, 23, 27, 30, 33, 37, 40]) == 5\n assert candidate(arr = [8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]) == 12\n assert candidate(arr = [6, 11, 17, 28, 45, 73, 118, 191, 309, 500, 809, 1309, 2108, 3417]) == 12\n assert candidate(arr = [10, 15, 25, 40, 65, 105, 170, 275, 445, 720, 1165, 1885, 3050, 4935, 8000, 12945, 20980, 33925, 54915, 88940, 143865, 232805, 376670, 610535, 987345, 1607920, 2588465, 4196405, 6784370, 10982835, 17777205, 28760040, 46532845]) == 14\n assert candidate(arr = [1, 5, 6, 8, 11, 16, 27, 43, 70, 113, 183, 296, 479, 772, 1251, 2023, 3274, 5297, 8571, 13868]) == 10\n assert candidate(arr = [1, 6, 7, 13, 20, 33, 53, 86, 139, 225, 364, 599, 963, 1562, 2525, 4087, 6612, 10699, 17311, 27910, 45301]) == 11\n assert candidate(arr = [1, 3, 4, 5, 7, 9, 12, 14, 17, 20, 23, 27, 31, 35, 39, 44, 49, 54, 59, 64, 69, 74, 79, 84, 89]) == 6\n assert candidate(arr = [5, 8, 10, 13, 18, 21, 26, 31, 37, 43, 49, 56, 63, 71, 79, 87, 95, 104, 113, 122, 131, 141]) == 5\n assert candidate(arr = [1, 4, 5, 9, 14, 23, 37, 60, 97, 157, 254, 411, 665, 1076, 1741]) == 15\n assert candidate(arr = [1, 2, 3, 6, 9, 11, 16, 25, 36, 51, 67, 88, 116, 154, 201, 258, 326, 407, 498, 602, 721, 856, 1009, 1181, 1374, 1588, 1825, 2086, 2373, 2687, 3028, 3400]) == 3\n assert candidate(arr = [1, 6, 7, 13, 20, 33, 53, 86, 139, 225]) == 10\n assert candidate(arr = [1, 6, 7, 13, 20, 33, 53, 86, 139, 225, 364, 590, 954, 1544, 2498]) == 11\n assert candidate(arr = [1, 7, 8, 15, 23, 38, 61, 99, 160, 259, 419, 678, 1097, 1776, 2873, 4669, 7542]) == 13\n assert candidate(arr = [1, 5, 6, 11, 17, 28, 45, 73, 118, 191, 309, 500, 809, 1309, 2118]) == 15\n assert candidate(arr = [3, 7, 10, 17, 27, 44, 71, 115, 186, 301, 487, 788, 1275, 2063, 3338, 5401, 8739, 14140, 22879, 36929]) == 19\n assert candidate(arr = [10, 15, 25, 40, 65, 105, 170, 275, 445, 720, 1165, 1885]) == 12\n assert candidate(arr = [3, 5, 6, 7, 10, 11, 13, 14, 16, 17, 18, 20, 23, 25, 29, 32, 36, 39, 41, 43]) == 5\n assert candidate(arr = [5, 10, 15, 25, 40, 65, 105, 170, 275, 445, 720, 1165, 1990, 3355]) == 12\n assert candidate(arr = [10, 15, 25, 40, 65, 105, 170, 275, 445, 720, 1165, 1885, 3050, 4935, 8015, 12950, 20965]) == 14\n assert candidate(arr = [2, 3, 5, 6, 7, 9, 11, 14, 18, 23, 29, 35, 44, 58, 73]) == 4\n assert candidate(arr = [1, 2, 4, 7, 13, 24, 44, 81, 149, 274, 504, 927, 1705, 3136]) == 0\n assert candidate(arr = [2, 6, 8, 14, 22, 36, 58, 94, 152, 246, 408, 654, 1062, 1716, 2778]) == 10\n assert candidate(arr = [1, 2, 4, 8, 15, 27, 50, 92, 170, 312]) == 0\n assert candidate(arr = [2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70, 74, 78, 82, 86, 90, 94, 98]) == 0\n assert candidate(arr = [1, 5, 6, 7, 9, 11, 18, 20, 26, 29, 31, 38, 41, 47, 50, 59, 62, 68, 75, 82, 89, 96, 103, 110, 117, 124, 131, 138, 145, 152]) == 5\n assert candidate(arr = [1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322]) == 12\n assert candidate(arr = [1, 2, 3, 6, 9, 18, 27, 45, 72, 117, 192, 309, 501]) == 6\n assert candidate(arr = [5, 7, 10, 13, 17, 21, 25, 30, 35, 41, 47, 53, 60, 67, 74, 81, 88, 95, 103, 111, 119, 127, 135, 143, 151]) == 5\n assert candidate(arr = [3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765]) == 17\n assert candidate(arr = [2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657]) == 21\n assert candidate(arr = [3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181]) == 16\n assert candidate(arr = [1, 2, 3, 4, 6, 9, 11, 14, 18, 22, 26, 30, 34, 39, 44, 49, 54, 59, 64, 69, 74]) == 4\n assert candidate(arr = [1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86, 91, 96]) == 0\n assert candidate(arr = [2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377]) == 12\n assert candidate(arr = [1, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 17, 20, 21, 22, 25, 27, 30, 33]) == 6\n assert candidate(arr = [1, 2, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765]) == 16\n assert candidate(arr = [2, 6, 8, 14, 22, 36, 60, 98, 158, 256, 414, 670]) == 6\n assert candidate(arr = [1, 7, 8, 15, 23, 38, 61, 99, 160, 259, 419, 678, 1097, 1775, 2872, 4647, 7519, 12266, 19885, 32151, 52036, 84287, 136333, 220620, 356953, 577573, 934526, 1512479, 2447005, 3961584, 6398589, 10359593, 16758182, 27117775, 43876357, 71094132, 114970909, 186065041, 300135150, 486200191, 786235341, 1272435532, 2058665873]) == 17\n assert candidate(arr = [10, 15, 25, 40, 65, 105, 170, 275, 445, 720, 1165]) == 11\n assert candidate(arr = [1, 2, 3, 4, 6, 9, 15, 24, 39, 63]) == 7\n assert candidate(arr = [10, 15, 25, 40, 65, 105, 170, 275, 445, 720, 1165, 1885, 3045, 4930]) == 12\n assert candidate(arr = [2, 5, 7, 12, 19, 31, 50, 81, 131, 212, 343, 555, 898, 1453, 2351]) == 15\n assert candidate(arr = [1, 8, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025]) == 18\n assert candidate(arr = [1, 4, 5, 9, 14, 23, 37, 60, 97, 157, 254, 411, 665, 1076, 1741, 2817, 4558, 7375, 11933, 19288]) == 19\n assert candidate(arr = [5, 9, 14, 23, 37, 60, 97, 157, 254, 411, 665, 1076]) == 12\n assert candidate(arr = [6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70, 74, 78, 82, 86, 90, 94, 98, 102]) == 0\n assert candidate(arr = [5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181]) == 15\n assert candidate(arr = [2, 5, 7, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110]) == 7\n assert candidate(arr = [1, 9, 25, 49, 81, 121, 169, 225, 289, 361, 441, 529, 625, 729, 841, 961, 1089, 1225, 1369, 1521, 1681, 1849, 2025, 2209]) == 0\n assert candidate(arr = [4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843, 1364, 2207, 3571, 5778]) == 16\n assert candidate(arr = [1, 2, 5, 7, 12, 19, 31, 50, 81, 131, 212, 343, 554]) == 11\n assert candidate(arr = [3, 6, 9, 15, 24, 39, 63, 102, 165, 267, 432, 700]) == 11\n assert candidate(arr = [1, 2, 4, 8, 15, 27, 50, 92, 174, 336, 633, 1212, 2245, 4207, 7920]) == 0\n assert candidate(arr = [2, 9, 11, 20, 31, 51, 82, 133, 215, 348, 563, 901, 1464]) == 11\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().lenLongestFibSubseq", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var lenLongestFibSubseq = function(arr) {", "container": null, "callable": "lenLongestFibSubseq", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 874, "task_id": "walking-robot-simulation", "difficulty": "Medium", "problem_description": "A robot on an infinite XY-plane starts at point (0, 0) facing north. The robot receives an array of integers commands, which represents a sequence of moves that it needs to execute. There are only three possible types of instructions the robot can receive:\n\n-2: Turn left 90 degrees.\n-1: Turn right 90 degrees.\n1 <= k <= 9: Move forward k units, one unit at a time.\n\nSome of the grid squares are obstacles. The ith obstacle is at grid point obstacles[i] = (xi, yi). If the robot runs into an obstacle, it will stay in its current location (on the block adjacent to the obstacle) and move onto the next command.\nReturn the maximum squared Euclidean distance that the robot reaches at any point in its path (i.e. if the distance is 5, return 25).\nNote:\n\nThere can be an obstacle at (0, 0). If this happens, the robot will ignore the obstacle until it has moved off the origin. However, it will be unable to return to (0, 0) due to the obstacle.\nNorth means +Y direction.\nEast means +X direction.\nSouth means -Y direction.\nWest means -X direction.\n\n \nExample 1:\n\nInput: commands = [4,-1,3], obstacles = []\nOutput: 25\nExplanation: \nThe robot starts at (0, 0):\n\nMove north 4 units to (0, 4).\nTurn right.\nMove east 3 units to (3, 4).\n\nThe furthest point the robot ever gets from the origin is (3, 4), which squared is 32 + 42 = 25 units away.\n\nExample 2:\n\nInput: commands = [4,-1,4,-2,4], obstacles = [[2,4]]\nOutput: 65\nExplanation:\nThe robot starts at (0, 0):\n\nMove north 4 units to (0, 4).\nTurn right.\nMove east 1 unit and get blocked by the obstacle at (2, 4), robot is at (1, 4).\nTurn left.\nMove north 4 units to (1, 8).\n\nThe furthest point the robot ever gets from the origin is (1, 8), which squared is 12 + 82 = 65 units away.\n\nExample 3:\n\nInput: commands = [6,-1,-1,6], obstacles = [[0,0]]\nOutput: 36\nExplanation:\nThe robot starts at (0, 0):\n\nMove north 6 units to (0, 6).\nTurn right.\nTurn right.\nMove south 5 units and get blocked by the obstacle at (0,0), robot is at (0, 1).\n\nThe furthest point the robot ever gets from the origin is (0, 6), which squared is 62 = 36 units away.\n\n \nConstraints:\n\n1 <= commands.length <= 104\ncommands[i] is either -2, -1, or an integer in the range [1, 9].\n0 <= obstacles.length <= 104\n-3 * 104 <= xi, yi <= 3 * 104\nThe answer is guaranteed to be less than 231.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(commands = [5, -2, 5, -2, 5, -2, 5],obstacles = [[-1, -1], [1, 1]]) == 50\n assert candidate(commands = [1, -2, 1, -2, 1, -2, 1, -2],obstacles = [[0, 1], [1, 0], [-1, 0], [0, -1]]) == 0\n assert candidate(commands = [5, -2, 5, -2, 5],obstacles = [[0, 2], [0, -2], [2, 0], [-2, 0]]) == 41\n assert candidate(commands = [4, -1, 3],obstacles = []) == 25\n assert candidate(commands = [5, -2, 5, -2, 5],obstacles = [[-1, 0], [1, 0], [0, -1], [0, 1]]) == 0\n assert candidate(commands = [-2, -1, 10],obstacles = [[1, 0]]) == 100\n assert candidate(commands = [1, 1, 1, 1],obstacles = [[1, 1]]) == 16\n assert candidate(commands = [1, -2, 3, -1, 4],obstacles = [[-1, -1], [0, -1], [1, -1], [1, 0]]) == 34\n assert candidate(commands = [1, 1, 1, 1, 1, 1, 1, 1, 1],obstacles = [[2, 2]]) == 81\n assert candidate(commands = [4, -1, 4, -2, 4],obstacles = [[2, 4]]) == 65\n assert candidate(commands = [3, -2, 3, -1, 3, -2, 3],obstacles = [[-2, 3], [-1, 3], [0, 3], [1, 3], [2, 3], [-2, -3], [-1, -3], [0, -3], [1, -3], [2, -3]]) == 61\n assert candidate(commands = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],obstacles = [[5, 5]]) == 8100\n assert candidate(commands = [-2, -2, -2, -2],obstacles = [[0, 1], [0, -1], [1, 0], [-1, 0]]) == 0\n assert candidate(commands = [-2, -2, -2, -2],obstacles = []) == 0\n assert candidate(commands = [6, -1, -1, 6],obstacles = [[0, 0]]) == 36\n assert candidate(commands = [1, 2, 3, 4, -2, -2, -1, -1],obstacles = [[1, 1], [2, 2]]) == 100\n assert candidate(commands = [9, 9, -2, 9, -2, 9, -2, 9],obstacles = [[2, 2]]) == 405\n assert candidate(commands = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],obstacles = [[0, 1]]) == 0\n assert candidate(commands = [9, 9, 9, 9, -2, -2, -2, -2, 9, 9, 9, 9],obstacles = [[2, 2], [2, -2], [-2, -2], [-2, 2]]) == 5184\n assert candidate(commands = [1, 2, 3, 4],obstacles = [[1, 1], [2, 2], [3, 3]]) == 100\n assert candidate(commands = [1, -2, 1, -2, 1, -2, 1, -2],obstacles = [[0, 2], [2, 0], [0, -2], [-2, 0]]) == 2\n assert candidate(commands = [1, 2, 3, 4, 5],obstacles = [[1, 1], [2, 2], [3, 3]]) == 225\n assert candidate(commands = [1, -2, 2, -2, 3, -2, 4, -2, 5, -2, 6, -2, 7, -2, 8, -2, 9, -2],obstacles = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]]) == 125\n assert candidate(commands = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],obstacles = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 400\n assert candidate(commands = [7, -1, 6, -2, 5, -1, 4, -2, 3, -1, 2, -2, 1],obstacles = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]]) == 0\n assert candidate(commands = [1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1],obstacles = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 13\n assert candidate(commands = [8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8],obstacles = [[-5, -5], [-4, -4], [-3, -3], [-2, -2], [-1, -1], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 145\n assert candidate(commands = [7, -2, 8, -1, 9, -2, 1, -1, 2, -2, 3, -1, 4, -2, 5, -1, 6, -2, 7, -1],obstacles = [[0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0]]) == 1201\n assert candidate(commands = [5, -2, 6, -1, 7, -2, 8, -1, 9],obstacles = [[2, 3], [3, 4], [4, 5], [5, 6], [6, 7]]) == 637\n assert candidate(commands = [9, -2, 8, -1, 7, -2, 6, -1, 5, -2, 4, -1, 3, -2, 2, -1, 1, -2],obstacles = [[-3, 0], [-2, 0], [-1, 0], [0, 0], [1, 0], [2, 0], [3, 0]]) == 1025\n assert candidate(commands = [5, -2, 4, -1, 3, -2, 2, -1, 1, -2],obstacles = [[-1, 1], [0, 0], [1, -1], [2, -2], [3, -3], [4, -4], [5, -5], [6, -6], [7, -7]]) == 117\n assert candidate(commands = [1, -2, 2, -1, 3, -2, 4, -1, 5, -2, 6, -1, 7, -2, 8, -1, 9, -2, 1, -1],obstacles = [[-3, 3], [-2, 2], [-1, 1], [0, 0], [1, -1], [2, -2], [3, -3]]) == 986\n assert candidate(commands = [3, -2, 2, -1, 5, -2, 5, -1, 3, -2, 3, -1, 3, -2, 3, -1],obstacles = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]) == 365\n assert candidate(commands = [6, -1, 6, -2, 6, -1, 6, -2, 6, -1, 6, -2],obstacles = [[0, 6], [6, 0], [3, 3], [2, 2], [4, 4], [5, 5]]) == 545\n assert candidate(commands = [5, -2, 5, -2, 5, -2, 5, -2, 5, -2],obstacles = [[-2, -2], [-3, -3], [-4, -4], [-5, -5], [-6, -6], [-7, -7]]) == 50\n assert candidate(commands = [8, -2, 6, -1, 5, -2, 7, -1, 4],obstacles = [[-2, 3], [0, 2], [1, 1], [2, 0], [3, -1], [2, -2]]) == 269\n assert candidate(commands = [1, 2, 3, 4, 5, 6, 7, 8, 9, -2, -1, 8, 7, 6, 5, 4, 3, 2, 1],obstacles = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 6561\n assert candidate(commands = [8, -2, 7, -1, 6, -2, 5, -1, 4, -2, 3, -1, 2, -2, 1],obstacles = [[-1, -2], [-2, -3], [-3, -4], [-4, -5], [-5, -6], [-6, -7], [-7, -8]]) == 656\n assert candidate(commands = [7, -2, 7, -2, 7, -2, 7, -2, 7, -2, 7, -2],obstacles = [[3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 98\n assert candidate(commands = [4, 4, -2, 4, 4, -2, 4, 4, -2, 4, 4],obstacles = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9]]) == 128\n assert candidate(commands = [7, 1, 2, -2, 3, -1, 4, -2, 5, -1],obstacles = [[2, 2], [2, 3], [2, 4], [3, 3], [4, 3]]) == 260\n assert candidate(commands = [2, -2, 3, -1, 4, -2, 5, -1, 6, -2, 7, -1, 8, -2, 9],obstacles = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5], [-6, -6], [-7, -7], [-8, -8], [-9, -9]]) == 976\n assert candidate(commands = [4, -2, 4, -1, 4, -2, 4, -1, 4, -2, 4, -1],obstacles = [[0, 2], [1, 1], [2, 0], [-1, -1], [-2, -2], [-3, -3], [0, -2], [2, 2]]) == 225\n assert candidate(commands = [5, -1, 5, -1, 5, -2, 5, -2, 5, -1, 5, -1, 5, -2, 5, -2, 5, -1, 5],obstacles = [[1, 2], [2, 1], [3, 0], [4, -1], [5, -2]]) == 650\n assert candidate(commands = [8, -1, 7, -2, 5, -1, 4, -2, 3, -1, 2, -2, 1],obstacles = [[2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]]) == 458\n assert candidate(commands = [3, -1, 3, -2, 3, -1, 3, -2, 3, -1, 3, -2, 3, -1, 3, -2, 3, -1, 3, -2],obstacles = [[-3, -3], [-4, -2], [-5, -1], [-6, 0], [-7, 1]]) == 450\n assert candidate(commands = [5, -1, 4, -1, 3, -1, 2, -1, 1, -2, 1, -2, 2, -2, 3, -2, 4, -2, 5, -2],obstacles = [[-2, 5], [-1, 4], [0, 3], [1, 2], [2, 1], [3, 0], [4, -1]]) == 29\n assert candidate(commands = [4, -2, 4, -1, 4, -2, 4, -1, 4, -2, 4, -1, 4, -2, 4, -1, 4, -2, 4, -1],obstacles = [[2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 800\n assert candidate(commands = [9, -2, 8, -1, 7, -2, 6, -1, 5, -2, 4, -1, 3, -2, 2, -1, 1, -2],obstacles = [[-4, -4], [-4, -3], [-3, -4], [-3, -3], [-2, -2], [-2, -1], [-1, -2], [-1, -1]]) == 1025\n assert candidate(commands = [5, 5, -1, 5, -1, 5, -1, 5],obstacles = [[2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]) == 125\n assert candidate(commands = [5, -1, 5, -1, 5, -1, 5, -1, 5, -1, 5, -1, 5, -1, 5, -1, 5, -1],obstacles = [[-1, 1], [-1, 2], [-1, 3], [-1, 4], [-1, 5], [-1, 6], [-1, 7], [-1, 8]]) == 50\n assert candidate(commands = [5, -2, 5, -1, 5, -2, 5, -1, 5, -2, 5, -1, 5, -2, 5, -1, 5, -2, 5, -1],obstacles = [[-2, -2], [-2, -3], [-2, -4], [-2, -5], [-2, -6], [-2, -7], [-2, -8], [-2, -9], [-2, -10]]) == 1250\n assert candidate(commands = [8, -2, 8, -1, 8, -2, 8, -1],obstacles = [[-2, 0], [0, -2], [2, 0], [0, 2], [1, 1]]) == 337\n assert candidate(commands = [1, -1, 2, -2, 3, -1, 4, -2, 5, -1, 6, -2, 7, -1, 8, -2, 9, -1, 10, -2],obstacles = [[-3, -3], [-2, -2], [-1, -1], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == 1354\n assert candidate(commands = [9, -2, 8, -1, 7, -2, 6, -1, 5, -2, 4, -1, 3, -2, 2, -1, 1],obstacles = [[0, -5], [1, -4], [2, -3], [3, -2], [4, -1], [5, 0]]) == 1025\n assert candidate(commands = [6, -2, 4, -1, 3, -2, 2, -1, 1],obstacles = [[-2, 3], [-3, 2], [-1, 4], [-1, -4], [4, -1], [3, -2]]) == 136\n assert candidate(commands = [1, 2, 3, 4, 5, 6, 7, 8, 9, -2, 9, 8, 7, 6, 5, 4, 3, 2, 1, -1],obstacles = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 4050\n assert candidate(commands = [9, -1, 8, -1, 7, -1, 6, -1, 5, -1, 4, -1, 3, -1, 2, -1, 1, -1],obstacles = [[-1, -2], [-2, -3], [-3, -4], [-4, -5], [-5, -6], [-6, -7]]) == 145\n assert candidate(commands = [1, -2, 2, -2, 3, -2, 4, -2, 5, -2, 6, -2, 7, -2, 8, -2, 9, -2, 10, -2],obstacles = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 136\n assert candidate(commands = [5, -1, 5, -1, 5, -1, 5, -1, 5, -1, 5],obstacles = [[3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9]]) == 34\n assert candidate(commands = [9, -2, 8, -1, 7, -2, 6, -1, 5, -2, 4, -1, 3, -2, 2, -1, 1],obstacles = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 1025\n assert candidate(commands = [9, 9, 9, 9, 9, -2, 9, 9, 9, 9, 9, -2, 9, 9, 9, 9, 9],obstacles = [[4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]) == 4050\n assert candidate(commands = [3, 3, 3, -1, 3, 3, 3, -1, 3, 3, 3, -1, 3, 3, 3, -1, 3],obstacles = [[2, 2], [3, 3], [4, 4], [2, 4], [4, 2], [3, 1], [3, 5]]) == 162\n assert candidate(commands = [9, 9, 9, -2, 9, 9, 9, -2, 9, 9, 9, -2, 9, 9, 9, -2, 9],obstacles = [[5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [4, 5], [3, 5], [2, 5], [1, 5]]) == 1458\n assert candidate(commands = [8, -2, 5, -1, 3, -2, 4, -1, 2],obstacles = [[2, 3], [3, 2], [2, 1], [1, 2], [0, 0]]) == 250\n assert candidate(commands = [10, -1, 9, -2, 8, -1, 7, -2, 6, -1, 5],obstacles = [[0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0]]) == 16\n assert candidate(commands = [8, -2, 7, -2, 8, -1, 7, -1, 6, -2, 5, -1, 4, -2, 3, -1, 2],obstacles = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 628\n assert candidate(commands = [9, -2, 8, -1, 7, -2, 6, -1, 5, -2, 4, -1, 3, -2, 2, -1, 1, -2],obstacles = [[-9, -9], [-8, -8], [-7, -7], [-6, -6], [-5, -5], [-4, -4], [-3, -3], [-2, -2], [-1, -1], [0, 0]]) == 1025\n assert candidate(commands = [9, 9, 9, 9, -2, 9, 9, 9, 9, -2, 9, 9, 9, 9, -2, 9, 9, 9, 9, -2, 9, 9, 9, 9],obstacles = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 2592\n assert candidate(commands = [9, -1, 8, -1, 7, -1, 6, -1, 5, -1, 4, -1, 3, -1, 2, -1, 1, -1],obstacles = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 232\n assert candidate(commands = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],obstacles = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15]]) == 3600\n assert candidate(commands = [1, -2, 1, -1, 2, -2, 2, -1, 3, -2, 3, -1, 4, -2, 4, -1, 5, -2, 5, -1],obstacles = [[-1, -2], [-1, -3], [-1, -4], [-1, -5], [-1, -6], [-1, -7], [-1, -8], [-1, -9]]) == 450\n assert candidate(commands = [9, -2, 8, -1, 7, -2, 6, -1, 5, -2, 4, -1, 3, -2, 2, -1, 1, -2],obstacles = [[0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9]]) == 724\n assert candidate(commands = [9, 9, 9, 9, -1, 9, 9, 9, 9, -1, 9, 9, 9, 9, -1, 9, 9, 9, 9, -1],obstacles = [[2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11]]) == 2592\n assert candidate(commands = [4, -2, 4, -2, 4, -1, 4, -1, 4, -2, 4, -1, 4, -2, 4, -1, 4],obstacles = [[0, 0], [1, 1], [-1, -1], [2, 2], [-2, -2]]) == 400\n assert candidate(commands = [1, -2, 2, -1, 3, -2, 4, -1, 5, -2, 6, -1, 7, -2, 8, -1, 9, -2, 10, -1],obstacles = [[2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 1525\n assert candidate(commands = [1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -1, -2, -1, -2, -1, -2, -1, -2],obstacles = [[2, 1], [4, 2], [6, 3], [8, 4], [10, 5]]) == 2025\n assert candidate(commands = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9],obstacles = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == 1853\n assert candidate(commands = [4, -2, 3, -2, 2, -2, 1, -2],obstacles = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == 25\n assert candidate(commands = [1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2],obstacles = [[0, 1], [1, 0], [-1, 0], [0, -1], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 0\n assert candidate(commands = [3, -2, 4, -1, 2, -2, 1, -1, 0, -2, 3, -1, 4],obstacles = [[-2, -1], [-3, 0], [-4, 1], [-5, 2], [-6, 3]]) == 145\n assert candidate(commands = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9],obstacles = [[0, 1], [1, 0], [-1, 0], [0, -1], [1, 2], [2, 1], [-2, 1], [1, -2], [2, -1], [-2, -1], [0, 2], [2, 0], [-2, 0], [0, -2], [-2, -2], [2, -2], [2, 2], [0, 3], [3, 0], [-3, 0], [0, -3], [-3, -3], [3, -3], [3, 3]]) == 0\n assert candidate(commands = [9, -1, 8, -2, 7, -1, 6, -2, 5, -1, 4, -2, 3, -1, 2, -2, 1, -1, 0],obstacles = [[2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0]]) == 1025\n assert candidate(commands = [5, -2, 6, -2, 5, -1, 4, -1, 3],obstacles = [[2, 3], [-2, -3], [0, 0]]) == 109\n assert candidate(commands = [1, -2, 3, -1, 5, -2, 7, -1, 9, -2, 11, -1, 13, -2, 15, -1, 17, -2, 19, -1],obstacles = [[-5, 5], [-4, 4], [-3, 3], [-2, 2], [-1, 1], [0, 0], [1, -1], [2, -2], [3, -3], [4, -4]]) == 4729\n assert candidate(commands = [6, -2, 4, -1, 2, -2, 5, -1, 1, -2, 3, -1],obstacles = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]) == 153\n assert candidate(commands = [8, -2, 6, -1, 4, -2, 2, -1, 5],obstacles = [[0, 3], [1, 2], [2, 1], [3, 0]]) == 185\n assert candidate(commands = [10, -2, 9, -1, 8, -2, 7, -1, 6, -2, 5, -1, 4, -2, 3, -1, 2, -2, 1, -1],obstacles = [[2, 5], [3, 6], [4, 7], [5, 8]]) == 1525\n assert candidate(commands = [1, -2, 3, -1, 5, -2, 7, -1, 9, -2, 11, -1, 13, -2, 15, -1],obstacles = [[2, 1], [4, 3], [6, 5], [8, 7], [10, 9], [12, 11], [14, 13]]) == 2080\n assert candidate(commands = [9, -2, 9, -2, 9, -1, 9, -1, 9, -2, 9, -1, 9, -2, 9],obstacles = [[-3, 3], [-2, 2], [-1, 1], [1, 1], [2, 2], [3, 3]]) == 1620\n assert candidate(commands = [3, -1, 4, -2, 5, -1, 2, -2, 1],obstacles = [[1, 2], [2, 1], [2, 3], [3, 2], [0, 1]]) == 72\n assert candidate(commands = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],obstacles = [[-5, -5], [-4, -4], [-3, -3], [-2, -2], [-1, -1], [0, -1], [1, -1], [2, -1], [3, -1], [4, -1], [5, -5], [-5, 5], [-4, 4], [-3, 3], [-2, 2], [-1, 1], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 5000\n assert candidate(commands = [10, -1, 10, -1, 10, -1, 10, -1, 10, -1, 10, -1, 10, -1, 10, -1, 10, -1],obstacles = [[5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [9, 11], [8, 12], [7, 13], [6, 14], [5, 15]]) == 565\n assert candidate(commands = [10, -2, 9, -1, 8, -2, 7, -1, 6, -2, 5, -1, 4, -2, 3, -1, 2, -2, 1, -1],obstacles = [[-4, -4], [-3, -3], [-2, -2], [-1, -1], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == 1525\n assert candidate(commands = [10, -2, 10, -1, 10, -2, 10, -1, 10],obstacles = [[0, 5], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [6, 5], [7, 5], [8, 5], [9, 5]]) == 976\n assert candidate(commands = [9, -1, 8, -1, 7, -1, 6, -1, 5, -1, 4, -1, 3, -1, 2, -1, 1, -1],obstacles = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == 221\n assert candidate(commands = [1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -1, -2, -1, -2],obstacles = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 2025\n assert candidate(commands = [5, -2, 5, -2, 5, -2, 5],obstacles = [[0, 2], [1, 3], [-2, 1], [3, -2], [0, 0]]) == 32\n assert candidate(commands = [1, -2, 3, -1, 5, -2, 7, -1, 9, -2, 11, -1, 13, -2, 15, -1, 17, -2, 19],obstacles = [[-1, -2], [-3, -4], [-5, -6], [-7, -8], [-9, -10]]) == 5050\n assert candidate(commands = [1, -1, 2, -1, 3, -1, 4, -1, 5, -1, 6, -1, 7, -1, 8, -1, 9, -1, 10, -1],obstacles = [[-10, -10], [-9, -9], [-8, -8], [-7, -7], [-6, -6], [-5, -5], [-4, -4], [-3, -3], [-2, -2], [-1, -1]]) == 106\n assert candidate(commands = [8, 8, 8, -2, 8, 8, 8, -2, 8, 8, 8, -2, 8, 8, 8, -2, 8, -1, 8, -1, 8, -1, 8, -1],obstacles = [[4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [5, 4], [6, 4], [7, 4], [8, 4]]) == 1152\n assert candidate(commands = [1, -1, 2, -2, 3, -1, 4, -2, 5, -1, 6, -2, 7, -1, 8],obstacles = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5]]) == 656\n assert candidate(commands = [9, -1, 8, -1, 7, -1, 6, -1, 5, -1, 4, -1, 3, -1, 2, -1, 1, -2, 9, -2, 8, -2, 7, -2, 6, -2, 5, -2, 4, -2, 3, -2, 2, -2, 1],obstacles = [[0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [0, 2], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2], [8, 2], [9, 2]]) == 169\n assert candidate(commands = [9, -1, 8, -2, 7, -1, 6, -2, 5, -1, 4, -2, 3, -1, 2, -2, 1, -1],obstacles = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 1025\n assert candidate(commands = [5, 5, 5, 5, -2, 5, 5, 5, 5, -1],obstacles = [[1, 1], [1, 2], [1, 3], [1, 4], [2, 2], [3, 2], [4, 2]]) == 800\n assert candidate(commands = [9, -1, 8, -1, 7, -1, 6, -1, 5, -1, 4, -1, 3, -1, 2, -1, 1, -1, 0],obstacles = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0]]) == 145\n assert candidate(commands = [1, -2, 3, -1, 4, -2, 5, -1, 6, -2, 7, -1, 8, -2, 9, -1],obstacles = [[-1, -1], [0, -1], [1, -1], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [5, 1], [5, 2], [5, 3]]) == 937\n assert candidate(commands = [8, -2, 7, -1, 6, -2, 5, -1, 4, -2, 3, -1, 2, -2, 1, -1],obstacles = [[3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3]]) == 656\n assert candidate(commands = [1, -1, 2, -2, 3, -1, 4, -2, 5, -1, 6, -2, 7, -1, 8, -2],obstacles = [[-1, -1], [0, -1], [1, -1], [1, 0], [1, 1], [0, 1], [-1, 1]]) == 0\n assert candidate(commands = [1, 2, 3, 4, 5, 4, 3, 2, 1, -1, -2, -1, -2, -1, -2, 2, 4, 6, 8, 10],obstacles = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1]]) == 3025\n assert candidate(commands = [2, -1, 2, -1, 2, -2, 2, -2, 2, -1, 2, -1, 2, -2, 2, -2, 2, -1, 2],obstacles = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]) == 100\n assert candidate(commands = [5, -2, 5, -1, 5, -2, 5, -1, 5, -2, 5, -1, 5, -2, 5, -1, 5, -2, 5, -1, 5],obstacles = [[0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1]]) == 1250\n assert candidate(commands = [9, -1, 9, -2, 9, -1, 9, -2, 9, -1, 9, -2],obstacles = [[3, 4], [4, 3], [5, 2], [2, 5], [1, 6], [6, 1]]) == 1458\n assert candidate(commands = [5, -2, 5, -1, 5, -2, 5, -1, 5, -2, 5, -1, 5, -2, 5, -1, 5, -2, 5, -1],obstacles = [[0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0], [4, -1], [3, -2], [2, -3], [1, -4], [0, -5]]) == 1201\n"}, "metadata": {"canonical_parameter_names": ["commands", "obstacles"], "leetcode_dataset_entry_point": "Solution().robotSim", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var robotSim = function(commands, obstacles) {", "container": null, "callable": "robotSim", "parameters": [{"name": "commands", "type": "number[]"}, {"name": "obstacles", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 875, "task_id": "koko-eating-bananas", "difficulty": "Medium", "problem_description": "Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours.\nKoko can decide her bananas-per-hour eating speed of k. Each hour, she chooses some pile of bananas and eats k bananas from that pile. If the pile has less than k bananas, she eats all of them instead and will not eat any more bananas during this hour.\nKoko likes to eat slowly but still wants to finish eating all the bananas before the guards return.\nReturn the minimum integer k such that she can eat all the bananas within h hours.\n \nExample 1:\n\nInput: piles = [3,6,7,11], h = 8\nOutput: 4\n\nExample 2:\n\nInput: piles = [30,11,23,4,20], h = 5\nOutput: 30\n\nExample 3:\n\nInput: piles = [30,11,23,4,20], h = 6\nOutput: 23\n\n \nConstraints:\n\n1 <= piles.length <= 104\npiles.length <= h <= 109\n1 <= piles[i] <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(piles = [1, 2, 3],h = 5) == 2\n assert candidate(piles = [805306400, 805306400, 805306400],h = 3000000000) == 1\n assert candidate(piles = [1000000000],h = 1000000000) == 1\n assert candidate(piles = [805306457, 805306457, 805306457],h = 1000000000) == 3\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],h = 5) == 2\n assert candidate(piles = [30, 11, 23, 4, 20],h = 5) == 30\n assert candidate(piles = [805306457, 933693859, 908256970, 820324087, 610103336],h = 5) == 933693859\n assert candidate(piles = [1, 1, 1, 1],h = 4) == 1\n assert candidate(piles = [10, 10, 10, 10],h = 10) == 5\n assert candidate(piles = [3, 3, 3, 3, 3],h = 5) == 3\n assert candidate(piles = [3, 3, 3, 3, 3],h = 10) == 2\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],h = 10) == 1\n assert candidate(piles = [3, 6, 7, 11],h = 10) == 3\n assert candidate(piles = [1],h = 1) == 1\n assert candidate(piles = [3, 6, 7, 11],h = 8) == 4\n assert candidate(piles = [8, 9, 7, 4, 2],h = 3) == 10\n assert candidate(piles = [1, 999999999],h = 2) == 999999999\n assert candidate(piles = [1, 2, 3],h = 3) == 3\n assert candidate(piles = [805306368, 805306368, 805306368],h = 1000000000) == 3\n assert candidate(piles = [1000000000, 1000000000, 1000000000],h = 3) == 1000000000\n assert candidate(piles = [30, 11, 23, 4, 20],h = 6) == 23\n assert candidate(piles = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3],h = 10) == 3\n assert candidate(piles = [1, 1, 1, 1, 1],h = 5) == 1\n assert candidate(piles = [30, 11, 23, 4, 20, 35],h = 7) == 30\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],h = 10) == 10\n assert candidate(piles = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],h = 20) == 35\n assert candidate(piles = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000],h = 5) == 1000000000\n assert candidate(piles = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],h = 10) == 19\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],h = 10) == 10\n assert candidate(piles = [5, 8, 6, 29, 33, 12],h = 9) == 15\n assert candidate(piles = [5, 8, 6, 12, 20],h = 5) == 20\n assert candidate(piles = [5, 8, 10, 12, 15, 17, 20, 23, 25, 28, 30, 33, 35, 38, 40],h = 15) == 40\n assert candidate(piles = [332484035, 524908576, 855865114, 632739624, 265801521],h = 8) == 427932557\n assert candidate(piles = [312884470],h = 312884469) == 2\n assert candidate(piles = [3, 6, 7, 11, 30, 20],h = 15) == 6\n assert candidate(piles = [5, 8, 6, 3],h = 15) == 2\n assert candidate(piles = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],h = 5) == 11\n assert candidate(piles = [1000000000, 999999999, 888888888, 777777777],h = 10) == 444444444\n assert candidate(piles = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000],h = 9) == 100000000\n assert candidate(piles = [1, 10, 100, 1000, 10000, 100000],h = 6) == 100000\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],h = 100) == 1\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],h = 10) == 10\n assert candidate(piles = [3, 6, 7, 11, 20, 25, 30],h = 15) == 9\n assert candidate(piles = [50, 25, 75, 25, 100, 50, 25, 75, 25, 100, 50, 25, 75, 25, 100, 50, 25, 75, 25, 100],h = 50) == 25\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],h = 15) == 15\n assert candidate(piles = [9, 8, 7, 6, 5, 4, 3, 2, 1],h = 9) == 9\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],h = 20) == 20\n assert candidate(piles = [1, 10, 100, 1000, 10000, 100000, 1000000],h = 14) == 125000\n assert candidate(piles = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000],h = 25) == 66666667\n assert candidate(piles = [10, 20, 30, 40, 50],h = 100) == 2\n assert candidate(piles = [5, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],h = 15) == 26\n assert candidate(piles = [1000000000, 1, 1000000000, 1, 1000000000],h = 1000000000) == 4\n assert candidate(piles = [3, 6, 7, 11, 11, 11, 11, 11, 11, 11],h = 10) == 11\n assert candidate(piles = [3, 6, 7, 11, 20, 30, 40, 50, 60, 70, 80, 90, 100],h = 15) == 80\n assert candidate(piles = [5, 8, 6, 7, 1, 2, 3, 4, 5],h = 9) == 8\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],h = 100) == 3\n assert candidate(piles = [9, 8, 7, 6, 5, 4, 3, 2, 1],h = 5) == 10\n assert candidate(piles = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],h = 20) == 10\n assert candidate(piles = [100, 200, 300, 400, 500],h = 50) == 32\n assert candidate(piles = [1000000000, 1000000000, 1000000000],h = 3) == 1000000000\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],h = 10) == 10\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],h = 10) == 2\n assert candidate(piles = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],h = 100) == 234\n assert candidate(piles = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],h = 10) == 6\n assert candidate(piles = [300000000, 100000000, 200000000, 400000000, 500000000],h = 1000000000) == 2\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],h = 100) == 1\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],h = 5) == 11\n assert candidate(piles = [5, 4, 3, 2, 1],h = 15) == 1\n assert candidate(piles = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],h = 10) == 100\n assert candidate(piles = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],h = 9) == 20\n assert candidate(piles = [1, 10, 100, 1000, 10000],h = 10) == 1667\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],h = 1) == 2\n assert candidate(piles = [100, 150, 200, 250, 300, 350, 400],h = 15) == 150\n assert candidate(piles = [100000000, 200000000, 300000000, 400000000, 500000000],h = 5) == 500000000\n assert candidate(piles = [3, 6, 7, 11, 100, 101, 200],h = 20) == 26\n assert candidate(piles = [8, 5, 6, 10, 12],h = 7) == 8\n assert candidate(piles = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],h = 10) == 100\n assert candidate(piles = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],h = 50) == 120\n assert candidate(piles = [100, 100, 100, 100, 100],h = 10) == 50\n assert candidate(piles = [1000000000, 1000000000, 1000000000],h = 1000000000) == 4\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],h = 19) == 2\n assert candidate(piles = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50],h = 100) == 5\n assert candidate(piles = [332484035, 524900671, 855865114, 632088198, 232463062],h = 8) == 427932557\n assert candidate(piles = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],h = 10) == 5\n assert candidate(piles = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],h = 15) == 10\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],h = 9) == 11\n assert candidate(piles = [10, 15, 20, 25, 30, 35, 40],h = 20) == 10\n assert candidate(piles = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],h = 10000) == 1\n assert candidate(piles = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],h = 5) == 101\n assert candidate(piles = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],h = 15) == 50\n assert candidate(piles = [805306368, 805306368, 805306368],h = 1000000000) == 3\n assert candidate(piles = [900000000, 800000000, 700000000, 600000000, 500000000],h = 5) == 900000000\n assert candidate(piles = [8, 5, 4, 10, 7, 9, 6],h = 15) == 4\n assert candidate(piles = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],h = 15) == 25\n assert candidate(piles = [10, 15, 7, 30],h = 6) == 15\n assert candidate(piles = [3, 6, 7, 11, 33, 45, 55],h = 25) == 7\n assert candidate(piles = [8, 12, 15, 18, 22],h = 12) == 8\n assert candidate(piles = [3, 6, 7, 11, 11, 11, 11, 11, 11, 11],h = 20) == 6\n assert candidate(piles = [10, 20, 30, 40, 50],h = 20) == 9\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],h = 9) == 11\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],h = 5) == 2\n assert candidate(piles = [1000000000, 1000000000, 1000000000],h = 3000000000) == 1\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],h = 20) == 1\n assert candidate(piles = [3, 6, 7, 11, 20, 25, 30],h = 25) == 5\n assert candidate(piles = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000],h = 32) == 250000000\n assert candidate(piles = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],h = 5) == 20\n assert candidate(piles = [999999999, 999999998, 999999997, 999999996, 999999995],h = 10) == 500000000\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],h = 15) == 21\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],h = 5) == 11\n assert candidate(piles = [33, 41, 17, 29, 38, 36, 40, 9, 66, 27],h = 13) == 38\n assert candidate(piles = [1000000000, 1, 1, 1, 1, 1, 1, 1, 1, 1],h = 10) == 1000000000\n assert candidate(piles = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],h = 9) == 20\n assert candidate(piles = [30, 11, 23, 4, 20],h = 7) == 20\n assert candidate(piles = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8],h = 5) == 9\n assert candidate(piles = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],h = 20) == 20\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],h = 5) == 11\n assert candidate(piles = [987654321, 123456789, 987654321, 123456789, 987654321],h = 5) == 987654321\n assert candidate(piles = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],h = 1) == 11\n assert candidate(piles = [2, 4, 9, 16, 25, 36, 49, 64, 81, 100],h = 15) == 41\n assert candidate(piles = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],h = 25) == 27\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],h = 10) == 1\n assert candidate(piles = [1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100],h = 20) == 100\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],h = 1) == 11\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],h = 20) == 4\n"}, "metadata": {"canonical_parameter_names": ["piles", "h"], "leetcode_dataset_entry_point": "Solution().minEatingSpeed", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minEatingSpeed = function(piles, h) {", "container": null, "callable": "minEatingSpeed", "parameters": [{"name": "piles", "type": "number[]"}, {"name": "h", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 876, "task_id": "middle-of-the-linked-list", "difficulty": "Easy", "problem_description": "Given the head of a singly linked list, return the middle node of the linked list.\nIf there are two middle nodes, return the second middle node.\n \nExample 1:\n\n\nInput: head = [1,2,3,4,5]\nOutput: [3,4,5]\nExplanation: The middle node of the list is node 3.\n\nExample 2:\n\n\nInput: head = [1,2,3,4,5,6]\nOutput: [4,5,6]\nExplanation: Since the list has two middle nodes with values 3 and 4, we return the second one.\n\n \nConstraints:\n\nThe number of nodes in the list is in the range [1, 100].\n1 <= Node.val <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7])), list_node([4, 5, 6, 7]))\n assert is_same_list(candidate(head = list_node([1, 2, 3])), list_node([2, 3]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5])), list_node([3, 4, 5]))\n assert is_same_list(candidate(head = list_node([1])), list_node([1]))\n assert is_same_list(candidate(head = list_node([1, 2])), list_node([2]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4])), list_node([3, 4]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6])), list_node([4, 5, 6]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8])), list_node([5, 6, 7, 8]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21])), list_node([11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]))\n assert is_same_list(candidate(head = list_node([5, 4, 3, 2, 1])), list_node([3, 2, 1]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])), list_node([21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]))\n assert is_same_list(candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59])), list_node([31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]))\n assert is_same_list(candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21])), list_node([11, 13, 15, 17, 19, 21]))\n assert is_same_list(candidate(head = list_node([42])), list_node([42]))\n assert is_same_list(candidate(head = list_node([2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24])), list_node([14, 16, 18, 20, 22, 24]))\n assert is_same_list(candidate(head = list_node([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97])), list_node([41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]))\n assert is_same_list(candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21])), list_node([11, 13, 15, 17, 19, 21]))\n assert is_same_list(candidate(head = list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1])), list_node([5, 4, 3, 2, 1]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])), list_node([16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]))\n assert is_same_list(candidate(head = list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])), list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])), list_node([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]))\n assert is_same_list(candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49])), list_node([25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])), list_node([6, 7, 8, 9, 10, 11]))\n assert is_same_list(candidate(head = list_node([5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125])), list_node([65, 75, 85, 95, 105, 115, 125]))\n assert is_same_list(candidate(head = list_node([1, 2, 2, 1])), list_node([2, 1]))\n assert is_same_list(candidate(head = list_node([10, 20, 30, 40, 50, 60, 70, 80, 90, 100])), list_node([60, 70, 80, 90, 100]))\n assert is_same_list(candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 50])), list_node([27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 50]))\n assert is_same_list(candidate(head = list_node([100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10, -20, -30])), list_node([30, 20, 10, 0, -10, -20, -30]))\n assert is_same_list(candidate(head = list_node([99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70])), list_node([84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70]))\n assert is_same_list(candidate(head = list_node([5])), list_node([5]))\n assert is_same_list(candidate(head = list_node([100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500])), list_node([800, 900, 1000, 1100, 1200, 1300, 1400, 1500]))\n assert is_same_list(candidate(head = list_node([101, 202, 303, 404, 505, 606, 707, 808, 909, 1010, 1111, 1212, 1313, 1414, 1515, 1616, 1717, 1818, 1919, 2020, 2121, 2222, 2323, 2424, 2525, 2626, 2727, 2828, 2929, 3030, 3131, 3232, 3333, 3434, 3535, 3636, 3737, 3838, 3939, 4040, 4141, 4242, 4343, 4444, 4545, 4646, 4747, 4848, 4949, 5050])), list_node([2626, 2727, 2828, 2929, 3030, 3131, 3232, 3333, 3434, 3535, 3636, 3737, 3838, 3939, 4040, 4141, 4242, 4343, 4444, 4545, 4646, 4747, 4848, 4949, 5050]))\n assert is_same_list(candidate(head = list_node([7])), list_node([7]))\n assert is_same_list(candidate(head = list_node([41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85])), list_node([63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85]))\n assert is_same_list(candidate(head = list_node([2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24])), list_node([14, 16, 18, 20, 22, 24]))\n assert is_same_list(candidate(head = list_node([7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91])), list_node([49, 56, 63, 70, 77, 84, 91]))\n assert is_same_list(candidate(head = list_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])), list_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])), list_node([7, 8, 9, 10, 11, 12]))\n assert is_same_list(candidate(head = list_node([31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100])), list_node([66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100])), list_node([51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]))\n assert is_same_list(candidate(head = list_node([5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5])), list_node([0, -1, -2, -3, -4, -5]))\n assert is_same_list(candidate(head = list_node([5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])), list_node([11, 12, 13, 14, 15, 16]))\n assert is_same_list(candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31])), list_node([17, 19, 21, 23, 25, 27, 29, 31]))\n assert is_same_list(candidate(head = list_node([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110])), list_node([60, 70, 80, 90, 100, 110]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])), list_node([8, 9, 10, 11, 12, 13, 14, 15]))\n assert is_same_list(candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39])), list_node([21, 23, 25, 27, 29, 31, 33, 35, 37, 39]))\n assert is_same_list(candidate(head = list_node([100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81])), list_node([90, 89, 88, 87, 86, 85, 84, 83, 82, 81]))\n assert is_same_list(candidate(head = list_node([100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1])), list_node([50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]))\n assert is_same_list(candidate(head = list_node([100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600, 3700, 3800, 3900, 4000, 4100, 4200, 4300, 4400, 4500, 4600, 4700, 4800, 4900, 5000])), list_node([2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600, 3700, 3800, 3900, 4000, 4100, 4200, 4300, 4400, 4500, 4600, 4700, 4800, 4900, 5000]))\n assert is_same_list(candidate(head = list_node([50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1])), list_node([25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]))\n assert is_same_list(candidate(head = list_node([5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150])), list_node([80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150]))\n assert is_same_list(candidate(head = list_node([9, 8, 7, 6, 5, 4, 3, 2, 1])), list_node([5, 4, 3, 2, 1]))\n assert is_same_list(candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29])), list_node([15, 17, 19, 21, 23, 25, 27, 29]))\n assert is_same_list(candidate(head = list_node([88, 77, 66, 55, 44, 33, 22, 11, 0, 11, 22, 33, 44, 55, 66, 77, 88])), list_node([0, 11, 22, 33, 44, 55, 66, 77, 88]))\n assert is_same_list(candidate(head = list_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])), list_node([5, 5, 5, 5, 5, 5, 5, 5]))\n assert is_same_list(candidate(head = list_node([99, 98, 97, 96, 95, 94, 93, 92, 91])), list_node([95, 94, 93, 92, 91]))\n assert is_same_list(candidate(head = list_node([10, 20, 30, 40, 50, 60, 70, 80, 90])), list_node([50, 60, 70, 80, 90]))\n assert is_same_list(candidate(head = list_node([10, 20, 30, 40, 50, 60, 70, 80, 90])), list_node([50, 60, 70, 80, 90]))\n assert is_same_list(candidate(head = list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])), list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]))\n assert is_same_list(candidate(head = list_node([5, 15, 25, 35, 45, 55, 65])), list_node([35, 45, 55, 65]))\n assert is_same_list(candidate(head = list_node([8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])), list_node([19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 2, 1])), list_node([3, 2, 1]))\n assert is_same_list(candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41])), list_node([21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])), list_node([6, 7, 8, 9, 10]))\n assert is_same_list(candidate(head = list_node([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120])), list_node([70, 80, 90, 100, 110, 120]))\n assert is_same_list(candidate(head = list_node([1, 3, 2, 3, 1])), list_node([2, 3, 1]))\n assert is_same_list(candidate(head = list_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99])), list_node([51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])), list_node([9, 10, 11, 12, 13, 14, 15, 16]))\n assert is_same_list(candidate(head = list_node([5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65])), list_node([35, 40, 45, 50, 55, 60, 65]))\n assert is_same_list(candidate(head = list_node([99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1])), list_node([50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50])), list_node([26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]))\n assert is_same_list(candidate(head = list_node([9, 18, 27, 36, 45, 54, 63, 72, 81, 90])), list_node([54, 63, 72, 81, 90]))\n assert is_same_list(candidate(head = list_node([2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62])), list_node([32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62]))\n assert is_same_list(candidate(head = list_node([2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100])), list_node([52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100]))\n assert is_same_list(candidate(head = list_node([99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80])), list_node([89, 88, 87, 86, 85, 84, 83, 82, 81, 80]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])), list_node([8, 9, 10, 11, 12, 13, 14, 15]))\n"}, "metadata": {"canonical_parameter_names": ["head"], "leetcode_dataset_entry_point": "Solution().middleNode", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var middleNode = function(head) {", "container": null, "callable": "middleNode", "parameters": [{"name": "head", "type": "ListNode"}], "return_type": "ListNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 877, "task_id": "stone-game", "difficulty": "Medium", "problem_description": "Alice and Bob play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of stones piles[i].\nThe objective of the game is to end with the most stones. The total number of stones across all the piles is odd, so there are no ties.\nAlice and Bob take turns, with Alice starting first. Each turn, a player takes the entire pile of stones either from the beginning or from the end of the row. This continues until there are no more piles left, at which point the person with the most stones wins.\nAssuming Alice and Bob play optimally, return true if Alice wins the game, or false if Bob wins.\n \nExample 1:\n\nInput: piles = [5,3,4,5]\nOutput: true\nExplanation: \nAlice starts first, and can only take the first 5 or the last 5.\nSay she takes the first 5, so that the row becomes [3, 4, 5].\nIf Bob takes 3, then the board is [4, 5], and Alice takes 5 to win with 10 points.\nIf Bob takes the last 5, then the board is [3, 4], and Alice takes 4 to win with 9 points.\nThis demonstrated that taking the first 5 was a winning move for Alice, so we return true.\n\nExample 2:\n\nInput: piles = [3,7,2,3]\nOutput: true\n\n \nConstraints:\n\n2 <= piles.length <= 500\npiles.length is even.\n1 <= piles[i] <= 500\nsum(piles[i]) is odd.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(piles = [15, 30, 5, 10, 20, 25]) == True\n assert candidate(piles = [8, 15, 3, 7]) == True\n assert candidate(piles = [7, 3, 8, 5, 12, 10]) == True\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8]) == True\n assert candidate(piles = [1, 100, 1, 100, 1, 100, 1, 100]) == True\n assert candidate(piles = [2, 2, 2, 2, 2, 2]) == False\n assert candidate(piles = [10, 20, 30, 40, 50, 60]) == True\n assert candidate(piles = [8, 6, 5, 1, 7, 9]) == True\n assert candidate(piles = [10, 20, 30, 40]) == True\n assert candidate(piles = [1, 5, 2, 4, 6, 3]) == True\n assert candidate(piles = [1, 2, 3, 4]) == True\n assert candidate(piles = [2, 2, 2, 2, 2, 2, 2, 2]) == False\n assert candidate(piles = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == True\n assert candidate(piles = [3, 6, 9, 12, 15, 18]) == True\n assert candidate(piles = [8, 9, 7, 6, 5, 4]) == True\n assert candidate(piles = [1, 3, 5, 7, 9, 11]) == True\n assert candidate(piles = [10, 5, 1, 2, 3, 7, 4, 8]) == True\n assert candidate(piles = [1, 2, 3, 4, 5, 6]) == True\n assert candidate(piles = [1, 100, 1, 100, 1, 100]) == True\n assert candidate(piles = [4, 3, 2, 1, 6, 5, 8, 7]) == True\n assert candidate(piles = [7, 2, 5, 10, 14, 3, 1, 2]) == True\n assert candidate(piles = [8, 9, 7, 6]) == False\n assert candidate(piles = [1, 2, 100, 3]) == True\n assert candidate(piles = [4, 1, 5, 2, 6, 3]) == True\n assert candidate(piles = [1, 2, 3, 5, 4, 6]) == True\n assert candidate(piles = [5, 3, 4, 5]) == True\n assert candidate(piles = [100, 100, 100, 100, 100, 100]) == False\n assert candidate(piles = [2, 4, 6, 8, 10, 12]) == True\n assert candidate(piles = [3, 3, 3, 3, 3, 3, 3, 3]) == False\n assert candidate(piles = [3, 7, 2, 3]) == True\n assert candidate(piles = [100, 1, 100, 1, 100, 1]) == True\n assert candidate(piles = [7, 9, 8, 6]) == False\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(piles = [29, 18, 17, 26, 34, 15, 45, 13, 50, 25, 30, 10, 35, 40, 5, 20]) == True\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == False\n assert candidate(piles = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]) == True\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]) == True\n assert candidate(piles = [5, 1, 100, 4, 10, 8, 6, 2]) == True\n assert candidate(piles = [10, 23, 5, 2, 7, 8, 3, 12, 15, 6]) == True\n assert candidate(piles = [1, 100, 2, 99, 3, 98, 4, 97]) == True\n assert candidate(piles = [8, 15, 3, 7, 6, 9, 5, 10, 4, 12, 11, 14, 2, 13]) == True\n assert candidate(piles = [100, 50, 200, 150, 300, 250, 400, 350, 500, 450]) == True\n assert candidate(piles = [150, 120, 180, 160, 200, 140, 220, 190, 210, 170]) == True\n assert candidate(piles = [50, 100, 75, 25, 120, 150, 80, 60]) == True\n assert candidate(piles = [200, 100, 150, 50, 250, 125, 300, 150, 350, 175, 400, 200, 450, 225, 500, 250]) == True\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == True\n assert candidate(piles = [1, 100, 2, 99, 3, 98, 4, 97, 5, 96]) == True\n assert candidate(piles = [123, 456, 789, 101, 202, 303, 404, 505]) == True\n assert candidate(piles = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]) == True\n assert candidate(piles = [12, 34, 56, 78, 90, 23, 45, 67, 89, 101, 123, 145]) == True\n assert candidate(piles = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == True\n assert candidate(piles = [15, 23, 12, 18, 35, 10, 42, 8, 20, 14]) == True\n assert candidate(piles = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == True\n assert candidate(piles = [10, 15, 3, 7, 8, 2, 1, 5]) == True\n assert candidate(piles = [8, 9, 5, 7, 2, 3, 4, 6, 1, 10]) == True\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == True\n assert candidate(piles = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14]) == True\n assert candidate(piles = [5, 4, 3, 2, 1, 6, 7, 8, 9, 10, 15, 14, 13, 12, 11, 20, 19, 18, 17, 16]) == True\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(piles = [100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1]) == True\n assert candidate(piles = [2, 8, 4, 6, 10, 14, 12, 16, 18, 20]) == True\n assert candidate(piles = [1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000]) == True\n assert candidate(piles = [999, 1, 998, 2, 997, 3, 996, 4, 995, 5, 994, 6]) == True\n assert candidate(piles = [17, 23, 42, 35, 29, 49, 31, 47, 53, 41]) == True\n assert candidate(piles = [23, 45, 12, 34, 56, 78, 90, 12, 34, 56]) == True\n assert candidate(piles = [200, 300, 100, 400, 50, 600, 150, 700, 200, 800, 250, 900, 300, 1000, 350, 1100, 400, 1200, 450, 1300]) == True\n assert candidate(piles = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23]) == True\n assert candidate(piles = [8, 6, 4, 2, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23]) == True\n assert candidate(piles = [3, 1, 2, 5, 4, 6, 9, 7, 8, 10]) == True\n assert candidate(piles = [55, 65, 25, 30, 40, 50, 15, 20, 35, 45]) == True\n assert candidate(piles = [45, 55, 65, 75, 85, 95, 105, 115, 125, 135]) == True\n assert candidate(piles = [500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1]) == True\n assert candidate(piles = [3, 2, 1, 6, 5, 4, 9, 8, 7, 12, 11, 10, 15, 14, 13, 18, 17, 16, 21, 20]) == True\n assert candidate(piles = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]) == True\n assert candidate(piles = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6]) == True\n assert candidate(piles = [300, 200, 100, 50, 400, 350, 150, 250, 600, 550, 450, 100, 300, 200, 700, 650]) == True\n assert candidate(piles = [400, 10, 300, 20, 200, 30, 100, 40, 150, 50, 250, 60, 500, 5, 1, 800, 350, 450, 15, 25]) == True\n assert candidate(piles = [45, 22, 33, 11, 55, 66, 77, 88, 99, 111, 222, 333]) == True\n assert candidate(piles = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000]) == True\n assert candidate(piles = [250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250]) == False\n assert candidate(piles = [48, 32, 15, 22, 39, 28, 33, 27, 19, 25]) == True\n assert candidate(piles = [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150]) == False\n assert candidate(piles = [10, 23, 15, 70, 6, 18, 40, 5]) == True\n assert candidate(piles = [150, 200, 50, 100, 350, 400, 150, 200, 50, 100, 350, 400, 150, 200, 50, 100]) == True\n assert candidate(piles = [500, 1, 500, 1, 500, 1, 500, 1, 500, 1]) == True\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == True\n assert candidate(piles = [500, 1, 500, 2, 500, 3, 500, 4, 500, 5]) == True\n assert candidate(piles = [9, 3, 15, 2, 11, 8, 6, 10, 5, 4]) == True\n assert candidate(piles = [500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1]) == True\n assert candidate(piles = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == True\n assert candidate(piles = [10, 100, 10, 100, 10, 100, 10, 100, 10, 100, 10, 100, 10, 100, 10, 100]) == True\n assert candidate(piles = [101, 102, 103, 104, 105, 106, 107, 108, 109, 110]) == True\n assert candidate(piles = [12, 24, 36, 48, 60, 72, 84, 96, 108, 120]) == True\n assert candidate(piles = [3, 2, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == True\n assert candidate(piles = [23, 34, 56, 45, 78, 89, 12, 11, 22, 33, 44, 55]) == True\n assert candidate(piles = [250, 100, 300, 200, 400, 150, 350, 25]) == True\n assert candidate(piles = [5, 1, 9, 4, 8, 2, 7, 3, 6, 11]) == True\n assert candidate(piles = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == True\n assert candidate(piles = [10, 20, 30, 40, 50, 60, 70, 80]) == True\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 12, 11, 20, 19, 18, 17, 16, 15, 14, 13]) == True\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == True\n assert candidate(piles = [150, 100, 50, 200, 25, 300, 75, 175, 125, 120, 60, 180, 220, 30, 240, 80]) == True\n assert candidate(piles = [100, 200, 101, 201, 102, 202, 103, 203, 104, 204]) == True\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11, 12, 13, 14, 15, 16]) == True\n assert candidate(piles = [5, 8, 6, 3, 4, 2, 7, 9, 1, 10]) == True\n assert candidate(piles = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200]) == True\n assert candidate(piles = [1, 1000, 2, 999, 3, 998, 4, 997, 5, 996]) == True\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(piles = [20, 40, 30, 60, 50, 70, 80, 100, 90, 110]) == True\n assert candidate(piles = [8, 15, 3, 7, 12, 9, 6, 11, 2, 10, 5, 14]) == True\n assert candidate(piles = [250, 100, 300, 50, 400, 150, 600, 200, 700, 50, 800, 25]) == True\n assert candidate(piles = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12]) == False\n assert candidate(piles = [1, 3, 2, 4, 5, 7, 6, 8, 9, 11, 10, 12, 13, 15, 14, 16, 17, 19, 18, 20]) == True\n assert candidate(piles = [5, 8, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]) == True\n assert candidate(piles = [12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == True\n assert candidate(piles = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 11, 12, 13, 14]) == True\n assert candidate(piles = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(piles = [42, 33, 24, 15, 6, 17, 28, 39, 50, 61, 72, 83]) == True\n assert candidate(piles = [12, 22, 32, 42, 52, 62, 72, 82, 92, 102]) == True\n"}, "metadata": {"canonical_parameter_names": ["piles"], "leetcode_dataset_entry_point": "Solution().stoneGame", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var stoneGame = function(piles) {", "container": null, "callable": "stoneGame", "parameters": [{"name": "piles", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 878, "task_id": "nth-magical-number", "difficulty": "Hard", "problem_description": "A positive integer is magical if it is divisible by either a or b.\nGiven the three integers n, a, and b, return the nth magical number. Since the answer may be very large, return it modulo 109 + 7.\n \nExample 1:\n\nInput: n = 1, a = 2, b = 3\nOutput: 2\n\nExample 2:\n\nInput: n = 4, a = 2, b = 3\nOutput: 6\n\n \nConstraints:\n\n1 <= n <= 109\n2 <= a, b <= 4 * 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 5,a = 6,b = 5) == 15\n assert candidate(n = 10,a = 3,b = 7) == 24\n assert candidate(n = 1000000000,a = 2,b = 3) == 499999993\n assert candidate(n = 10,a = 7,b = 3) == 24\n assert candidate(n = 5,a = 3,b = 5) == 10\n assert candidate(n = 5,a = 7,b = 5) == 15\n assert candidate(n = 10,a = 3,b = 5) == 21\n assert candidate(n = 500000000,a = 40000,b = 40001) == 249930000\n assert candidate(n = 4,a = 2,b = 3) == 6\n assert candidate(n = 10,a = 7,b = 11) == 44\n assert candidate(n = 1,a = 2,b = 3) == 2\n assert candidate(n = 10,a = 12,b = 18) == 90\n assert candidate(n = 1000000000,a = 40000,b = 40000) == 999720007\n assert candidate(n = 234567890,a = 66666,b = 99999) == 277133959\n assert candidate(n = 750000000,a = 8000,b = 16000) == 999958007\n assert candidate(n = 600000000,a = 29,b = 37) == 904615333\n assert candidate(n = 500000000,a = 10000,b = 10000) == 999965007\n assert candidate(n = 100,a = 234,b = 567) == 16848\n assert candidate(n = 500000000,a = 33333,b = 44444) == 999922230\n assert candidate(n = 500,a = 100,b = 300) == 50000\n assert candidate(n = 1000000000,a = 39999,b = 40000) == 999860007\n assert candidate(n = 999999999,a = 3,b = 11) == 538461521\n assert candidate(n = 750000000,a = 20001,b = 30002) == 689943000\n assert candidate(n = 120000000,a = 11,b = 23) == 920000000\n assert candidate(n = 900000000,a = 89,b = 127) == 314883394\n assert candidate(n = 999999999,a = 3,b = 5) == 142857126\n assert candidate(n = 100000000,a = 12345,b = 67890) == 754478652\n assert candidate(n = 800000000,a = 7999,b = 8000) == 999977607\n assert candidate(n = 800000000,a = 789,b = 321) == 30893061\n assert candidate(n = 75000000,a = 8888,b = 9999) == 962497382\n assert candidate(n = 500000000,a = 23,b = 47) == 833333281\n assert candidate(n = 400000000,a = 13579,b = 24680) == 891663244\n assert candidate(n = 300000000,a = 11111,b = 22222) == 299976669\n assert candidate(n = 250000000,a = 50000,b = 50001) == 124956250\n assert candidate(n = 500000000,a = 10000,b = 10001) == 249982500\n assert candidate(n = 5000000,a = 3456,b = 7890) == 22857132\n assert candidate(n = 200000000,a = 23456,b = 34567) == 814186778\n assert candidate(n = 654321098,a = 55555,b = 88888) == 872244777\n assert candidate(n = 600000000,a = 5000,b = 5001) == 299989500\n assert candidate(n = 900000000,a = 13,b = 19) == 170967696\n assert candidate(n = 345678901,a = 11111,b = 22222) == 838242131\n assert candidate(n = 1,a = 3,b = 5) == 3\n assert candidate(n = 250000000,a = 89756,b = 34213) == 771543424\n assert candidate(n = 1000000000,a = 2,b = 2) == 999999993\n assert candidate(n = 500000000,a = 2,b = 5) == 833333334\n assert candidate(n = 100000000,a = 10000,b = 20000) == 999993007\n assert candidate(n = 987654321,a = 27182,b = 31415) == 137264409\n assert candidate(n = 999999999,a = 33333,b = 66666) == 999733343\n assert candidate(n = 750000000,a = 11,b = 29) == 134615346\n assert candidate(n = 123456789,a = 4321,b = 9876) == 119975644\n assert candidate(n = 999999999,a = 37,b = 41) == 701298547\n assert candidate(n = 456789012,a = 14142,b = 17320) == 441321430\n assert candidate(n = 999999999,a = 12345,b = 67890) == 544786471\n assert candidate(n = 1000000000,a = 29,b = 31) == 237288036\n assert candidate(n = 400000000,a = 34567,b = 45678) == 751276078\n assert candidate(n = 100000,a = 11111,b = 22222) == 111099993\n assert candidate(n = 150000000,a = 40000,b = 40003) == 149973375\n assert candidate(n = 750000000,a = 456,b = 789) == 260868172\n assert candidate(n = 999999999,a = 37,b = 100) == 205882140\n assert candidate(n = 100000000,a = 11111,b = 22222) == 99992223\n assert candidate(n = 200000000,a = 100,b = 101) == 99999930\n assert candidate(n = 123456789,a = 1234,b = 5678) == 183610385\n assert candidate(n = 150000000,a = 11111,b = 22222) == 649988338\n assert candidate(n = 600000000,a = 111,b = 222) == 599999538\n assert candidate(n = 999999999,a = 2,b = 3) == 499999991\n assert candidate(n = 500000001,a = 8000,b = 8001) == 249994000\n assert candidate(n = 200000000,a = 15000,b = 17000) == 161273485\n assert candidate(n = 500000000,a = 10000,b = 12345) == 981180666\n assert candidate(n = 1000,a = 2,b = 3) == 1500\n assert candidate(n = 250000000,a = 10000,b = 10003) == 249963753\n assert candidate(n = 300000000,a = 34567,b = 98765) == 656326046\n assert candidate(n = 300000000,a = 15000,b = 16000) == 999983207\n assert candidate(n = 150000000,a = 17,b = 23) == 503846139\n assert candidate(n = 789012345,a = 1111,b = 2222) == 592709163\n assert candidate(n = 500000000,a = 37337,b = 49249) == 524562485\n assert candidate(n = 600000000,a = 9000,b = 18000) == 999962207\n assert candidate(n = 400000000,a = 20001,b = 20002) == 399972000\n assert candidate(n = 800000000,a = 12345,b = 67890) == 35841519\n assert candidate(n = 100000000,a = 12345,b = 54321) == 944440755\n assert candidate(n = 678901234,a = 12345,b = 12346) == 857288152\n assert candidate(n = 123456789,a = 12345,b = 67890) == 820330907\n assert candidate(n = 600000000,a = 23456,b = 78901) == 617619200\n assert candidate(n = 500000000,a = 10001,b = 10007) == 124765147\n assert candidate(n = 50000000,a = 789,b = 1234) == 75815670\n assert candidate(n = 650000000,a = 46810,b = 57921) == 397052571\n assert candidate(n = 1000000000,a = 40000,b = 40001) == 499860000\n assert candidate(n = 345678912,a = 2345,b = 6789) == 570799481\n assert candidate(n = 500000000,a = 12345,b = 67890) == 772393239\n assert candidate(n = 876543210,a = 23456,b = 78901) == 803519554\n assert candidate(n = 123456789,a = 13579,b = 24680) == 448025793\n assert candidate(n = 50000000,a = 10000,b = 10001) == 24998250\n assert candidate(n = 100000000,a = 10001,b = 10002) == 99996500\n assert candidate(n = 999999999,a = 10000,b = 10001) == 499955000\n assert candidate(n = 800000000,a = 41,b = 53) == 692472990\n assert candidate(n = 1000000,a = 1234,b = 5678) == 13987665\n assert candidate(n = 300000000,a = 12345,b = 23456) == 516628373\n assert candidate(n = 250000000,a = 50000,b = 75000) == 999934382\n assert candidate(n = 123456789,a = 20000,b = 30000) == 851827043\n assert candidate(n = 500000000,a = 4,b = 6) == 499999993\n assert candidate(n = 100000,a = 10001,b = 10002) == 500100000\n assert candidate(n = 765432109,a = 33333,b = 44444) == 432218246\n assert candidate(n = 800000000,a = 10001,b = 20002) == 799944000\n assert candidate(n = 456789123,a = 2020,b = 3030) == 35515996\n assert candidate(n = 450000000,a = 17,b = 29) == 929999972\n"}, "metadata": {"canonical_parameter_names": ["n", "a", "b"], "leetcode_dataset_entry_point": "Solution().nthMagicalNumber", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var nthMagicalNumber = function(n, a, b) {", "container": null, "callable": "nthMagicalNumber", "parameters": [{"name": "n", "type": "number"}, {"name": "a", "type": "number"}, {"name": "b", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 879, "task_id": "profitable-schemes", "difficulty": "Hard", "problem_description": "There is a group of n members, and a list of various crimes they could commit. The ith crime generates a profit[i] and requires group[i] members to participate in it. If a member participates in one crime, that member can't participate in another crime.\nLet's call a profitable scheme any subset of these crimes that generates at least minProfit profit, and the total number of members participating in that subset of crimes is at most n.\nReturn the number of schemes that can be chosen. Since the answer may be very large, return it modulo 109 + 7.\n \nExample 1:\n\nInput: n = 5, minProfit = 3, group = [2,2], profit = [2,3]\nOutput: 2\nExplanation: To make a profit of at least 3, the group could either commit crimes 0 and 1, or just crime 1.\nIn total, there are 2 schemes.\nExample 2:\n\nInput: n = 10, minProfit = 5, group = [2,3,5], profit = [6,7,8]\nOutput: 7\nExplanation: To make a profit of at least 5, the group could commit any crimes, as long as they commit one.\nThere are 7 possible schemes: (0), (1), (2), (0,1), (0,2), (1,2), and (0,1,2).\n \nConstraints:\n\n1 <= n <= 100\n0 <= minProfit <= 100\n1 <= group.length <= 100\n1 <= group[i] <= 100\nprofit.length == group.length\n0 <= profit[i] <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 4,minProfit = 4,group = [4],profit = [5]) == 1\n assert candidate(n = 3,minProfit = 0,group = [1, 2],profit = [0, 0]) == 4\n assert candidate(n = 100,minProfit = 100,group = [100],profit = [100]) == 1\n assert candidate(n = 10,minProfit = 0,group = [1, 2, 3, 4],profit = [1, 1, 1, 1]) == 16\n assert candidate(n = 4,minProfit = 1,group = [1, 2, 3],profit = [1, 2, 3]) == 5\n assert candidate(n = 1,minProfit = 1,group = [1],profit = [1]) == 1\n assert candidate(n = 10,minProfit = 1,group = [1, 2, 3],profit = [1, 2, 3]) == 7\n assert candidate(n = 3,minProfit = 0,group = [1, 1, 1],profit = [0, 0, 0]) == 8\n assert candidate(n = 10,minProfit = 5,group = [2, 3, 5],profit = [6, 7, 8]) == 7\n assert candidate(n = 5,minProfit = 3,group = [2, 2],profit = [2, 3]) == 2\n assert candidate(n = 50,minProfit = 50,group = [10, 20, 30],profit = [5, 10, 15]) == 0\n assert candidate(n = 4,minProfit = 4,group = [4],profit = [4]) == 1\n assert candidate(n = 50,minProfit = 25,group = [10, 10, 10, 10, 10],profit = [5, 5, 5, 5, 5]) == 1\n assert candidate(n = 20,minProfit = 10,group = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(n = 80,minProfit = 40,group = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(n = 50,minProfit = 25,group = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],profit = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 36\n assert candidate(n = 90,minProfit = 90,group = [18, 18, 18, 18, 18],profit = [18, 18, 18, 18, 18]) == 1\n assert candidate(n = 50,minProfit = 30,group = [10, 20, 30, 40, 50],profit = [5, 10, 15, 20, 25]) == 0\n assert candidate(n = 100,minProfit = 50,group = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],profit = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 1\n assert candidate(n = 99,minProfit = 99,group = [10, 20, 30, 40, 50, 60, 70, 80, 90],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90]) == 0\n assert candidate(n = 70,minProfit = 40,group = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70],profit = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28]) == 0\n assert candidate(n = 50,minProfit = 50,group = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],profit = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 638\n assert candidate(n = 60,minProfit = 20,group = [10, 15, 20, 5, 25],profit = [6, 8, 10, 2, 12]) == 13\n assert candidate(n = 90,minProfit = 30,group = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15],profit = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 838\n assert candidate(n = 100,minProfit = 5,group = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 449666\n assert candidate(n = 50,minProfit = 50,group = [5, 10, 15, 20],profit = [10, 20, 30, 40]) == 9\n assert candidate(n = 60,minProfit = 20,group = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],profit = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 1128\n assert candidate(n = 60,minProfit = 30,group = [15, 10, 25, 5, 30, 20],profit = [12, 8, 15, 3, 20, 18]) == 22\n assert candidate(n = 70,minProfit = 20,group = [5, 10, 15, 20, 25, 30, 35, 40],profit = [1, 2, 3, 4, 5, 6, 7, 8]) == 0\n assert candidate(n = 50,minProfit = 10,group = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],profit = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 638\n assert candidate(n = 100,minProfit = 100,group = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(n = 95,minProfit = 50,group = [19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19],profit = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 0\n assert candidate(n = 75,minProfit = 50,group = [10, 20, 15, 25, 5],profit = [10, 30, 20, 40, 5]) == 18\n assert candidate(n = 10,minProfit = 4,group = [2, 3, 5, 1],profit = [3, 4, 6, 1]) == 12\n assert candidate(n = 60,minProfit = 20,group = [3, 4, 5, 6, 7, 8, 9, 10],profit = [4, 5, 6, 7, 8, 9, 10, 11]) == 210\n assert candidate(n = 100,minProfit = 75,group = [10, 20, 30, 40, 50, 60, 70, 80, 90],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90]) == 23\n assert candidate(n = 100,minProfit = 100,group = [20, 20, 20, 20, 20],profit = [20, 20, 20, 20, 20]) == 1\n assert candidate(n = 90,minProfit = 30,group = [10, 20, 30, 40, 50, 60, 70, 80, 90],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90]) == 30\n assert candidate(n = 100,minProfit = 50,group = [10, 20, 30, 40, 50],profit = [5, 15, 25, 35, 45]) == 14\n assert candidate(n = 50,minProfit = 30,group = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],profit = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 0\n assert candidate(n = 50,minProfit = 50,group = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],profit = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]) == 20215\n assert candidate(n = 65,minProfit = 30,group = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 807231\n assert candidate(n = 60,minProfit = 20,group = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 803\n assert candidate(n = 100,minProfit = 70,group = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],profit = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70]) == 10\n assert candidate(n = 75,minProfit = 40,group = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15],profit = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(n = 90,minProfit = 0,group = [9, 18, 27, 36, 45],profit = [0, 0, 0, 0, 0]) == 25\n assert candidate(n = 100,minProfit = 100,group = [20, 30, 40, 50, 10, 20],profit = [25, 35, 45, 55, 5, 15]) == 8\n assert candidate(n = 90,minProfit = 45,group = [10, 20, 30, 40, 50, 60, 70, 80],profit = [5, 10, 15, 20, 25, 30, 35, 40]) == 7\n assert candidate(n = 70,minProfit = 25,group = [7, 14, 21, 28, 35, 42, 49],profit = [4, 8, 12, 16, 20, 24, 28]) == 23\n assert candidate(n = 80,minProfit = 30,group = [10, 20, 30, 40, 50],profit = [5, 7, 9, 11, 13]) == 0\n assert candidate(n = 100,minProfit = 50,group = [10, 20, 30, 40, 50],profit = [20, 30, 40, 50, 60]) == 21\n assert candidate(n = 50,minProfit = 15,group = [5, 10, 15, 20, 25, 30],profit = [3, 6, 9, 12, 15, 18]) == 25\n assert candidate(n = 100,minProfit = 100,group = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 784438408\n assert candidate(n = 55,minProfit = 25,group = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],profit = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(n = 90,minProfit = 30,group = [9, 18, 27, 36, 45, 54, 63, 72, 81, 90],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(n = 75,minProfit = 35,group = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 0\n assert candidate(n = 75,minProfit = 40,group = [5, 10, 15, 20, 25, 30, 35],profit = [2, 4, 6, 8, 10, 12, 14]) == 0\n assert candidate(n = 60,minProfit = 60,group = [12, 12, 12, 12, 12],profit = [12, 12, 12, 12, 12]) == 1\n assert candidate(n = 80,minProfit = 25,group = [8, 16, 24, 32, 40, 48, 56, 64, 72, 80],profit = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 0\n assert candidate(n = 100,minProfit = 100,group = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],profit = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(n = 90,minProfit = 50,group = [10, 20, 30, 40, 50, 60],profit = [10, 20, 30, 40, 50, 60]) == 20\n assert candidate(n = 70,minProfit = 30,group = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(n = 60,minProfit = 30,group = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 0\n assert candidate(n = 99,minProfit = 99,group = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(n = 85,minProfit = 60,group = [12, 18, 24, 30, 36, 42, 48, 54, 60],profit = [9, 12, 15, 18, 21, 24, 27, 30, 33]) == 0\n assert candidate(n = 100,minProfit = 75,group = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 0\n assert candidate(n = 80,minProfit = 80,group = [16, 16, 16, 16, 16],profit = [16, 16, 16, 16, 16]) == 1\n assert candidate(n = 60,minProfit = 0,group = [6, 12, 18, 24, 30],profit = [0, 0, 0, 0, 0]) == 25\n assert candidate(n = 85,minProfit = 40,group = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30],profit = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30]) == 470\n assert candidate(n = 100,minProfit = 80,group = [10, 20, 30, 40, 50, 60, 70, 80, 90, 10],profit = [5, 15, 25, 35, 45, 55, 65, 75, 85, 5]) == 23\n assert candidate(n = 70,minProfit = 70,group = [14, 14, 14, 14, 14],profit = [14, 14, 14, 14, 14]) == 1\n assert candidate(n = 50,minProfit = 50,group = [10, 10, 10, 10, 10],profit = [10, 10, 10, 10, 10]) == 1\n assert candidate(n = 85,minProfit = 45,group = [17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17],profit = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(n = 70,minProfit = 20,group = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70],profit = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 10\n assert candidate(n = 100,minProfit = 0,group = [10, 20, 30, 40, 50],profit = [0, 0, 0, 0, 0]) == 25\n assert candidate(n = 50,minProfit = 20,group = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 796\n assert candidate(n = 90,minProfit = 60,group = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15],profit = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 210\n assert candidate(n = 100,minProfit = 50,group = [10, 20, 30, 40, 50],profit = [10, 20, 30, 40, 50]) == 18\n assert candidate(n = 100,minProfit = 50,group = [10, 20, 30, 40, 50, 10, 20, 30, 40, 50],profit = [5, 10, 15, 20, 25, 5, 10, 15, 20, 25]) == 51\n assert candidate(n = 70,minProfit = 35,group = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(n = 50,minProfit = 20,group = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(n = 50,minProfit = 0,group = [5, 10, 15, 20, 25],profit = [0, 0, 0, 0, 0]) == 25\n assert candidate(n = 95,minProfit = 55,group = [8, 16, 24, 32, 40, 48, 56, 64, 72, 80],profit = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 11\n assert candidate(n = 95,minProfit = 45,group = [10, 20, 30, 40, 50, 60, 70, 80, 90],profit = [5, 10, 15, 20, 25, 30, 35, 40, 45]) == 8\n assert candidate(n = 70,minProfit = 30,group = [10, 20, 30, 40],profit = [10, 20, 30, 40]) == 10\n assert candidate(n = 100,minProfit = 100,group = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(n = 75,minProfit = 40,group = [5, 15, 25, 35, 45],profit = [5, 15, 25, 35, 45]) == 14\n assert candidate(n = 60,minProfit = 20,group = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(n = 95,minProfit = 55,group = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],profit = [15, 16, 17, 18, 19, 20, 21, 22, 23, 24]) == 773\n assert candidate(n = 100,minProfit = 0,group = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 1024\n assert candidate(n = 85,minProfit = 45,group = [8, 16, 24, 32, 40, 48, 56, 64, 72, 80],profit = [4, 8, 12, 16, 20, 24, 28, 32, 36, 40]) == 0\n assert candidate(n = 80,minProfit = 60,group = [10, 15, 20, 25, 30, 35, 40],profit = [5, 10, 15, 20, 25, 30, 35]) == 13\n assert candidate(n = 75,minProfit = 25,group = [5, 10, 15, 20, 25, 30, 35],profit = [1, 2, 3, 4, 5, 6, 7]) == 0\n assert candidate(n = 95,minProfit = 70,group = [10, 20, 30, 40, 50, 60, 70, 80, 90],profit = [7, 14, 21, 28, 35, 42, 49, 56, 63]) == 0\n assert candidate(n = 80,minProfit = 40,group = [5, 10, 15, 20, 25, 30, 35, 40],profit = [3, 6, 9, 12, 15, 18, 21, 24]) == 38\n assert candidate(n = 80,minProfit = 20,group = [10, 20, 30, 40],profit = [10, 20, 30, 40]) == 12\n assert candidate(n = 50,minProfit = 10,group = [10, 15, 20, 25, 30],profit = [5, 7, 9, 11, 13]) == 13\n assert candidate(n = 90,minProfit = 45,group = [20, 15, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],profit = [10, 8, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(n = 80,minProfit = 0,group = [8, 16, 24, 32, 40],profit = [0, 0, 0, 0, 0]) == 25\n assert candidate(n = 50,minProfit = 15,group = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],profit = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 56\n assert candidate(n = 90,minProfit = 45,group = [5, 15, 10, 20, 25, 30, 5, 10],profit = [3, 8, 6, 12, 15, 20, 4, 7]) == 62\n assert candidate(n = 80,minProfit = 60,group = [10, 10, 10, 10, 10, 10, 10, 10],profit = [10, 10, 10, 10, 10, 10, 10, 10]) == 37\n assert candidate(n = 70,minProfit = 0,group = [7, 14, 21, 28, 35],profit = [0, 0, 0, 0, 0]) == 25\n assert candidate(n = 60,minProfit = 20,group = [5, 15, 25, 35, 45],profit = [3, 6, 9, 12, 15]) == 3\n assert candidate(n = 75,minProfit = 75,group = [10, 20, 30, 40, 5, 15, 25, 35],profit = [5, 15, 25, 35, 1, 3, 5, 7]) == 0\n assert candidate(n = 80,minProfit = 40,group = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(n = 65,minProfit = 28,group = [4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60],profit = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == 80\n assert candidate(n = 75,minProfit = 50,group = [5, 10, 15, 20, 25],profit = [10, 20, 30, 40, 50]) == 25\n assert candidate(n = 55,minProfit = 25,group = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25],profit = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65]) == 1199\n assert candidate(n = 90,minProfit = 70,group = [10, 15, 20, 25, 30, 35, 40],profit = [5, 10, 15, 20, 25, 30, 35]) == 11\n assert candidate(n = 100,minProfit = 100,group = [5, 10, 15, 20, 25, 30],profit = [5, 15, 25, 35, 45, 55]) == 27\n assert candidate(n = 50,minProfit = 10,group = [3, 5, 7, 9, 11, 13],profit = [2, 4, 6, 8, 10, 12]) == 57\n assert candidate(n = 80,minProfit = 30,group = [2, 3, 4, 5, 6, 7, 8, 9, 10],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 109\n assert candidate(n = 60,minProfit = 20,group = [5, 10, 15, 20, 25, 30],profit = [1, 2, 3, 4, 5, 6]) == 0\n assert candidate(n = 20,minProfit = 8,group = [3, 5, 7, 4, 2],profit = [5, 7, 9, 6, 4]) == 26\n assert candidate(n = 150,minProfit = 75,group = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 100\n assert candidate(n = 60,minProfit = 15,group = [5, 10, 15, 20, 25, 30],profit = [3, 6, 9, 12, 15, 18]) == 35\n"}, "metadata": {"canonical_parameter_names": ["n", "minProfit", "group", "profit"], "leetcode_dataset_entry_point": "Solution().profitableSchemes", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var profitableSchemes = function(n, minProfit, group, profit) {", "container": null, "callable": "profitableSchemes", "parameters": [{"name": "n", "type": "number"}, {"name": "minProfit", "type": "number"}, {"name": "group", "type": "number[]"}, {"name": "profit", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 880, "task_id": "decoded-string-at-index", "difficulty": "Medium", "problem_description": "You are given an encoded string s. To decode the string to a tape, the encoded string is read one character at a time and the following steps are taken:\n\nIf the character read is a letter, that letter is written onto the tape.\nIf the character read is a digit d, the entire current tape is repeatedly written d - 1 more times in total.\n\nGiven an integer k, return the kth letter (1-indexed) in the decoded string.\n \nExample 1:\n\nInput: s = \"leet2code3\", k = 10\nOutput: \"o\"\nExplanation: The decoded string is \"leetleetcodeleetleetcodeleetleetcode\".\nThe 10th letter in the string is \"o\".\n\nExample 2:\n\nInput: s = \"ha22\", k = 5\nOutput: \"h\"\nExplanation: The decoded string is \"hahahaha\".\nThe 5th letter is \"h\".\n\nExample 3:\n\nInput: s = \"a2345678999999999999999\", k = 1\nOutput: \"a\"\nExplanation: The decoded string is \"a\" repeated 8301530446056247680 times.\nThe 1st letter is \"a\".\n\n \nConstraints:\n\n2 <= s.length <= 100\ns consists of lowercase English letters and digits 2 through 9.\ns starts with a letter.\n1 <= k <= 109\nIt is guaranteed that k is less than or equal to the length of the decoded string.\nThe decoded string is guaranteed to have less than 263 letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"x5\",k = 15) == \"x\"\n assert candidate(s = \"y959q969u3hb22\",k = 200) == \"y\"\n assert candidate(s = \"abc2d3\",k = 7) == \"d\"\n assert candidate(s = \"y959q969u3hb22\",k = 94921609) == \"y\"\n assert candidate(s = \"xyz4\",k = 10) == \"x\"\n assert candidate(s = \"y959q969u3hb22\",k = 53563622) == \"y\"\n assert candidate(s = \"a2345678999999999999999\",k = 1) == \"a\"\n assert candidate(s = \"v7\",k = 6) == \"v\"\n assert candidate(s = \"a2b2c2\",k = 5) == \"a\"\n assert candidate(s = \"abc2\",k = 2) == \"b\"\n assert candidate(s = \"abcd\",k = 1) == \"a\"\n assert candidate(s = \"abc2def3\",k = 6) == \"c\"\n assert candidate(s = \"x2y3\",k = 5) == \"x\"\n assert candidate(s = \"vzpp636m8y\",k = 88699223) == \"v\"\n assert candidate(s = \"ha22\",k = 5) == \"h\"\n assert candidate(s = \"a2b3\",k = 4) == \"a\"\n assert candidate(s = \"abc2\",k = 3) == \"c\"\n assert candidate(s = \"a9b9\",k = 80) == \"b\"\n assert candidate(s = \"ab2c3\",k = 7) == \"b\"\n assert candidate(s = \"abc2def3\",k = 7) == \"d\"\n assert candidate(s = \"x123\",k = 3) == \"x\"\n assert candidate(s = \"leet2code3\",k = 10) == \"o\"\n assert candidate(s = \"abcd2\",k = 7) == \"c\"\n assert candidate(s = \"vk7\",k = 17) == \"v\"\n assert candidate(s = \"large100string3\",k = 250) == \"i\"\n assert candidate(s = \"a2b2c3d4e5f6g7h8i9j1k2l3m4n5o6p7q8r9s1t2u3v4w5x6y7z8\",k = 1000000) == \"a\"\n assert candidate(s = \"abc3xyz2\",k = 13) == \"a\"\n assert candidate(s = \"hello2world3\",k = 19) == \"l\"\n assert candidate(s = \"abcdefg8\",k = 1000000000) == \"f\"\n assert candidate(s = \"abcde2xyz3\",k = 11) == \"x\"\n assert candidate(s = \"abcd2efg3hij4\",k = 50) == \"c\"\n assert candidate(s = \"nested2brackets3\",k = 25) == \"e\"\n assert candidate(s = \"abcd2efg3hij4klm5nop6qrst7uvw8xyz9\",k = 1000) == \"c\"\n assert candidate(s = \"abcdefgh9\",k = 999999999) == \"g\"\n assert candidate(s = \"ab2cd3ef4gh5ij6kl7mn8op9qr0st1uv2wx3yz4\",k = 750) == \"v\"\n assert candidate(s = \"z9y8x7w6v5u4t3s2r1\",k = 362880) == \"z\"\n assert candidate(s = \"abc2def3ghi4jkl5\",k = 90) == \"i\"\n assert candidate(s = \"leet2code3xyz4\",k = 25) == \"l\"\n assert candidate(s = \"mnop2qrst3uvw4\",k = 75) == \"t\"\n assert candidate(s = \"hello2world3\",k = 18) == \"l\"\n assert candidate(s = \"z9y8x7w6v5u4t3s2r1\",k = 987654321) == \"z\"\n assert candidate(s = \"a2b2c2d2e2f2g2h2i2j2\",k = 20) == \"a\"\n assert candidate(s = \"a2b2c3d4e5f6g7h8i9j1\",k = 500) == \"b\"\n assert candidate(s = \"hello2world3\",k = 17) == \"e\"\n assert candidate(s = \"a2b3c4d5e6f7g8h9i10j11k12l13m14n15o16\",k = 1000) == \"j\"\n assert candidate(s = \"ab2c3d4e5f6\",k = 200) == \"c\"\n assert candidate(s = \"repeat2twice3\",k = 27) == \"e\"\n assert candidate(s = \"xyz2abc3def4\",k = 85) == \"a\"\n assert candidate(s = \"xyz9\",k = 25) == \"x\"\n assert candidate(s = \"a9b8c7d6e5f4g3h2i1\",k = 362880) == \"a\"\n assert candidate(s = \"abcdefg2hijklm2nopqr2stuv2wxyz2\",k = 50) == \"e\"\n assert candidate(s = \"abc2def3ghi4\",k = 46) == \"d\"\n assert candidate(s = \"xyz9abc8\",k = 100) == \"x\"\n assert candidate(s = \"leet2code3\",k = 15) == \"e\"\n assert candidate(s = \"leet2code3\",k = 20) == \"t\"\n assert candidate(s = \"a2b3c4d5\",k = 50) == \"b\"\n assert candidate(s = \"abc123\",k = 200) == \"b\"\n assert candidate(s = \"complex2nested3structure4\",k = 150) == \"l\"\n assert candidate(s = \"a2b3c4d5e6f7g8h9i10j11k12l13m14n15o16p17q18r19s20t21u22v23w24x25y26z27\",k = 2000) == \"u\"\n assert candidate(s = \"abcd2efgh3ijkl4mnop5\",k = 1000) == \"d\"\n assert candidate(s = \"abcdefgh23456789\",k = 876543210) == \"b\"\n assert candidate(s = \"abcdefg2hijklm3nopqr4stuv5wxyz6\",k = 2000) == \"k\"\n assert candidate(s = \"hello5world2\",k = 45) == \"o\"\n assert candidate(s = \"xyz9\",k = 27) == \"z\"\n assert candidate(s = \"repeat2many3times4\",k = 120) == \"a\"\n assert candidate(s = \"abc2def3ghi4\",k = 30) == \"i\"\n assert candidate(s = \"a12b3\",k = 35) == \"a\"\n assert candidate(s = \"abcd2efgh3ijkl4mnop5qrst6uvw7xyz8\",k = 1000) == \"h\"\n assert candidate(s = \"x9y8z7\",k = 200) == \"x\"\n assert candidate(s = \"z9y8x7w6v5u4t3s2r1q9p8o7n6m5l4k3j2i1h9g8f7e6d5c4b3a2\",k = 5000) == \"y\"\n assert candidate(s = \"a2b3c4d5\",k = 11) == \"a\"\n assert candidate(s = \"abcde2fghi3\",k = 25) == \"f\"\n assert candidate(s = \"a2b3c4d5e6\",k = 50) == \"b\"\n assert candidate(s = \"abcd2efgh3ijkl4mnop5qrst6uvw7xyz8abcd2efgh3ijkl4mnop5qrst6uvw7xyz8\",k = 3000) == \"h\"\n assert candidate(s = \"abc2def3ghi4\",k = 150) == \"i\"\n assert candidate(s = \"abc3def4gh5\",k = 100) == \"h\"\n assert candidate(s = \"xyz9abc3\",k = 30) == \"c\"\n assert candidate(s = \"a2b3c4\",k = 10) == \"c\"\n assert candidate(s = \"abc3def2ghi4\",k = 40) == \"a\"\n assert candidate(s = \"ab12c3\",k = 20) == \"c\"\n assert candidate(s = \"a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y6z7\",k = 1000) == \"t\"\n assert candidate(s = \"abc123\",k = 240) == \"c\"\n assert candidate(s = \"xy2z3a4b5\",k = 120) == \"y\"\n assert candidate(s = \"a2b3c4d5\",k = 100) == \"a\"\n assert candidate(s = \"x9y8z7\",k = 500) == \"x\"\n assert candidate(s = \"xyz12\",k = 35) == \"y\"\n assert candidate(s = \"a2b3c4d5\",k = 40) == \"c\"\n assert candidate(s = \"hello5world3\",k = 75) == \"o\"\n assert candidate(s = \"abc2def3ghi4\",k = 50) == \"b\"\n assert candidate(s = \"abc2def3ghi4\",k = 60) == \"i\"\n assert candidate(s = \"hello2world2hello2world2\",k = 20) == \"o\"\n assert candidate(s = \"mnopqr2stuv3wxyz4\",k = 120) == \"v\"\n assert candidate(s = \"leet2code3abc4\",k = 40) == \"l\"\n assert candidate(s = \"a2b2c2d2e2f2g2h2i2j2k2l2m2n2o2p2q2r2s2t2u2v2w2x2y2z2\",k = 52) == \"b\"\n assert candidate(s = \"abc123\",k = 100) == \"a\"\n assert candidate(s = \"abcd2efgh3ijkl4mnop5qrst6uvw7xyz8\",k = 500) == \"d\"\n assert candidate(s = \"leet12code34\",k = 100) == \"t\"\n assert candidate(s = \"nested1nested2nested3\",k = 1000) == \"t\"\n assert candidate(s = \"a2b3c4\",k = 15) == \"a\"\n assert candidate(s = \"ab12cd34\",k = 1234) == \"b\"\n assert candidate(s = \"hello2world3\",k = 14) == \"l\"\n"}, "metadata": {"canonical_parameter_names": ["s", "k"], "leetcode_dataset_entry_point": "Solution().decodeAtIndex", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var decodeAtIndex = function(s, k) {", "container": null, "callable": "decodeAtIndex", "parameters": [{"name": "s", "type": "string"}, {"name": "k", "type": "number"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 881, "task_id": "boats-to-save-people", "difficulty": "Medium", "problem_description": "You are given an array people where people[i] is the weight of the ith person, and an infinite number of boats where each boat can carry a maximum weight of limit. Each boat carries at most two people at the same time, provided the sum of the weight of those people is at most limit.\nReturn the minimum number of boats to carry every given person.\n \nExample 1:\n\nInput: people = [1,2], limit = 3\nOutput: 1\nExplanation: 1 boat (1, 2)\n\nExample 2:\n\nInput: people = [3,2,2,1], limit = 3\nOutput: 3\nExplanation: 3 boats (1, 2), (2) and (3)\n\nExample 3:\n\nInput: people = [3,5,3,4], limit = 5\nOutput: 4\nExplanation: 4 boats (3), (3), (4), (5)\n\n \nConstraints:\n\n1 <= people.length <= 5 * 104\n1 <= people[i] <= limit <= 3 * 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],limit = 11) == 5\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],limit = 15) == 5\n assert candidate(people = [3, 2, 2, 1],limit = 3) == 3\n assert candidate(people = [5, 5, 5, 5, 5],limit = 10) == 3\n assert candidate(people = [10, 20, 30, 40, 50],limit = 50) == 3\n assert candidate(people = [3, 5, 3, 4],limit = 5) == 4\n assert candidate(people = [1, 2],limit = 3) == 1\n assert candidate(people = [30, 20, 10],limit = 50) == 2\n assert candidate(people = [1, 3, 5, 7, 9],limit = 10) == 3\n assert candidate(people = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],limit = 2) == 5\n assert candidate(people = [3, 2, 3, 2, 2],limit = 6) == 3\n assert candidate(people = [1, 1, 1, 1, 1, 1],limit = 2) == 3\n assert candidate(people = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],limit = 10) == 5\n assert candidate(people = [10, 20, 30, 40, 50],limit = 60) == 3\n assert candidate(people = [3, 3, 3, 3, 3, 3],limit = 6) == 3\n assert candidate(people = [1, 2, 3, 4, 5],limit = 5) == 3\n assert candidate(people = [1, 1, 2, 2, 3, 3],limit = 4) == 3\n assert candidate(people = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18],limit = 19) == 18\n assert candidate(people = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],limit = 10) == 5\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],limit = 30) == 16\n assert candidate(people = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],limit = 2) == 15\n assert candidate(people = [1, 99, 2, 98, 3, 97, 4, 96, 5, 95, 6, 94, 7, 93, 8, 92, 9, 91, 10, 90],limit = 100) == 10\n assert candidate(people = [1, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9],limit = 11) == 18\n assert candidate(people = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],limit = 6) == 10\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],limit = 30) == 16\n assert candidate(people = [1, 10, 100, 1000, 10000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000],limit = 10000) == 8\n assert candidate(people = [15, 20, 15, 25, 30, 35, 5, 10],limit = 40) == 4\n assert candidate(people = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],limit = 11) == 10\n assert candidate(people = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15],limit = 30) == 10\n assert candidate(people = [1, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10],limit = 15) == 26\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],limit = 20) == 16\n assert candidate(people = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],limit = 150) == 5\n assert candidate(people = [29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29],limit = 29) == 20\n assert candidate(people = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],limit = 2) == 49\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],limit = 15) == 8\n assert candidate(people = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],limit = 150) == 5\n assert candidate(people = [30, 20, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],limit = 40) == 10\n assert candidate(people = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10],limit = 10) == 34\n assert candidate(people = [30000, 30000, 30000, 30000, 30000, 30000, 30000, 30000, 30000, 30000],limit = 30000) == 10\n assert candidate(people = [20, 40, 20, 40, 10, 30, 20, 10, 50, 30],limit = 60) == 5\n assert candidate(people = [1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9],limit = 10) == 15\n assert candidate(people = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],limit = 6) == 8\n assert candidate(people = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],limit = 6) == 8\n assert candidate(people = [15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000],limit = 30000) == 8\n assert candidate(people = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],limit = 2) == 10\n assert candidate(people = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],limit = 4) == 10\n assert candidate(people = [30, 40, 50, 20, 10, 60],limit = 80) == 3\n assert candidate(people = [30000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],limit = 30000) == 11\n assert candidate(people = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],limit = 22) == 5\n assert candidate(people = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],limit = 5) == 20\n assert candidate(people = [1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10],limit = 11) == 15\n assert candidate(people = [1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10],limit = 12) == 6\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],limit = 21) == 10\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],limit = 20) == 8\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],limit = 26) == 13\n assert candidate(people = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],limit = 10) == 15\n assert candidate(people = [5, 1, 4, 2, 3, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5],limit = 10) == 8\n assert candidate(people = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71],limit = 80) == 10\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],limit = 30) == 10\n assert candidate(people = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],limit = 10) == 8\n assert candidate(people = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],limit = 3) == 41\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],limit = 21) == 10\n assert candidate(people = [30, 40, 50, 20, 30, 40, 50, 20, 30, 40, 50],limit = 100) == 6\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],limit = 16) == 8\n assert candidate(people = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],limit = 11) == 10\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],limit = 20) == 11\n assert candidate(people = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],limit = 10) == 8\n assert candidate(people = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5],limit = 6) == 11\n assert candidate(people = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],limit = 2) == 67\n assert candidate(people = [1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9],limit = 10) == 10\n assert candidate(people = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250],limit = 300) == 13\n assert candidate(people = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],limit = 190) == 5\n assert candidate(people = [1, 2, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17],limit = 18) == 17\n assert candidate(people = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10],limit = 10) == 22\n assert candidate(people = [3, 6, 7, 9, 10, 12, 13, 15, 18, 20],limit = 25) == 5\n assert candidate(people = [3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],limit = 25) == 11\n assert candidate(people = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],limit = 20) == 11\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],limit = 25) == 13\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],limit = 20) == 11\n assert candidate(people = [1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],limit = 11) == 11\n assert candidate(people = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],limit = 6) == 133\n assert candidate(people = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],limit = 110) == 5\n assert candidate(people = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],limit = 10) == 19\n assert candidate(people = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],limit = 2) == 16\n assert candidate(people = [15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000, 15000],limit = 30000) == 10\n assert candidate(people = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],limit = 30) == 11\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],limit = 31) == 15\n assert candidate(people = [15, 20, 25, 30, 35, 40, 45, 50, 55, 60],limit = 80) == 5\n assert candidate(people = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],limit = 25) == 13\n"}, "metadata": {"canonical_parameter_names": ["people", "limit"], "leetcode_dataset_entry_point": "Solution().numRescueBoats", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numRescueBoats = function(people, limit) {", "container": null, "callable": "numRescueBoats", "parameters": [{"name": "people", "type": "number[]"}, {"name": "limit", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 882, "task_id": "reachable-nodes-in-subdivided-graph", "difficulty": "Hard", "problem_description": "You are given an undirected graph (the \"original graph\") with n nodes labeled from 0 to n - 1. You decide to subdivide each edge in the graph into a chain of nodes, with the number of new nodes varying between each edge.\nThe graph is given as a 2D array of edges where edges[i] = [ui, vi, cnti] indicates that there is an edge between nodes ui and vi in the original graph, and cnti is the total number of new nodes that you will subdivide the edge into. Note that cnti == 0 means you will not subdivide the edge.\nTo subdivide the edge [ui, vi], replace it with (cnti + 1) new edges and cnti new nodes. The new nodes are x1, x2, ..., xcnti, and the new edges are [ui, x1], [x1, x2], [x2, x3], ..., [xcnti-1, xcnti], [xcnti, vi].\nIn this new graph, you want to know how many nodes are reachable from the node 0, where a node is reachable if the distance is maxMoves or less.\nGiven the original graph and maxMoves, return the number of nodes that are reachable from node 0 in the new graph.\n \nExample 1:\n\n\nInput: edges = [[0,1,10],[0,2,1],[1,2,2]], maxMoves = 6, n = 3\nOutput: 13\nExplanation: The edge subdivisions are shown in the image above.\nThe nodes that are reachable are highlighted in yellow.\n\nExample 2:\n\nInput: edges = [[0,1,4],[1,2,6],[0,2,8],[1,3,1]], maxMoves = 10, n = 4\nOutput: 23\n\nExample 3:\n\nInput: edges = [[1,2,4],[1,4,5],[1,3,1],[2,3,4],[3,4,5]], maxMoves = 17, n = 5\nOutput: 1\nExplanation: Node 0 is disconnected from the rest of the graph, so only node 0 is reachable.\n\n \nConstraints:\n\n0 <= edges.length <= min(n * (n - 1) / 2, 104)\nedges[i].length == 3\n0 <= ui < vi < n\nThere are no multiple edges in the graph.\n0 <= cnti <= 104\n0 <= maxMoves <= 109\n1 <= n <= 3000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(edges = [[0, 1, 4], [1, 2, 6], [0, 2, 8], [1, 3, 1]],maxMoves = 10,n = 4) == 23\n assert candidate(edges = [[0, 1, 0], [1, 2, 0]],maxMoves = 3,n = 3) == 3\n assert candidate(edges = [[0, 1, 5]],maxMoves = 5,n = 2) == 6\n assert candidate(edges = [[1, 2, 4], [1, 4, 5], [1, 3, 1], [2, 3, 4], [3, 4, 5]],maxMoves = 17,n = 5) == 1\n assert candidate(edges = [[0, 1, 5]],maxMoves = 10,n = 2) == 7\n assert candidate(edges = [[0, 1, 0], [1, 2, 0]],maxMoves = 1,n = 3) == 2\n assert candidate(edges = [[0, 1, 3], [0, 2, 2], [1, 2, 2]],maxMoves = 10,n = 3) == 10\n assert candidate(edges = [[0, 1, 0], [1, 2, 0], [2, 3, 0]],maxMoves = 3,n = 4) == 4\n assert candidate(edges = [[0, 1, 0], [0, 2, 0], [1, 2, 0]],maxMoves = 1,n = 3) == 3\n assert candidate(edges = [],maxMoves = 0,n = 1) == 1\n assert candidate(edges = [[0, 1, 10], [0, 2, 1], [1, 2, 2]],maxMoves = 6,n = 3) == 13\n assert candidate(edges = [],maxMoves = 5,n = 1) == 1\n assert candidate(edges = [],maxMoves = 10,n = 1) == 1\n assert candidate(edges = [[0, 1, 5], [0, 2, 5], [0, 3, 5], [1, 2, 5], [1, 3, 5], [2, 3, 5], [3, 4, 5], [4, 5, 5], [5, 0, 5]],maxMoves = 15,n = 6) == 51\n assert candidate(edges = [[0, 1, 1], [1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 0, 1], [0, 5, 1], [5, 6, 1], [6, 7, 1], [7, 0, 1], [0, 8, 1], [8, 9, 1], [9, 0, 1]],maxMoves = 20,n = 10) == 22\n assert candidate(edges = [[0, 1, 10], [0, 2, 10], [0, 3, 10], [0, 4, 10]],maxMoves = 15,n = 5) == 45\n assert candidate(edges = [[0, 1, 100], [0, 2, 200], [1, 3, 300], [2, 4, 400], [3, 5, 500], [4, 6, 600], [5, 7, 700], [6, 8, 800], [7, 9, 900]],maxMoves = 1500,n = 10) == 3001\n assert candidate(edges = [[0, 1, 100], [1, 2, 100], [2, 3, 100], [3, 4, 100], [4, 5, 100], [5, 0, 100]],maxMoves = 50,n = 6) == 101\n assert candidate(edges = [[0, 1, 1], [0, 2, 1], [0, 3, 1], [1, 4, 1], [1, 5, 1], [2, 6, 1], [2, 7, 1], [3, 8, 1], [3, 9, 1]],maxMoves = 5,n = 10) == 19\n assert candidate(edges = [[0, 1, 10], [0, 2, 10], [0, 3, 10], [1, 2, 10], [1, 3, 10], [2, 3, 10]],maxMoves = 20,n = 4) == 64\n assert candidate(edges = [[0, 1, 3], [0, 2, 2], [1, 2, 1]],maxMoves = 5,n = 3) == 9\n assert candidate(edges = [[0, 1, 2], [0, 3, 4], [1, 2, 1], [2, 3, 2], [3, 4, 3]],maxMoves = 10,n = 5) == 17\n assert candidate(edges = [[0, 1, 1], [1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [7, 8, 1], [8, 9, 1]],maxMoves = 9,n = 10) == 10\n assert candidate(edges = [[0, 1, 3], [1, 2, 2], [2, 3, 1], [0, 3, 4]],maxMoves = 7,n = 4) == 14\n assert candidate(edges = [[0, 1, 100], [0, 2, 100], [1, 2, 100], [1, 3, 100], [2, 3, 100], [3, 4, 100], [4, 5, 100], [5, 6, 100], [6, 7, 100], [7, 8, 100], [8, 9, 100]],maxMoves = 300,n = 10) == 602\n assert candidate(edges = [[0, 1, 0], [1, 2, 0], [2, 3, 0], [3, 4, 0], [4, 5, 0], [5, 6, 0], [6, 0, 0]],maxMoves = 6,n = 7) == 7\n assert candidate(edges = [[0, 1, 1], [0, 2, 1], [0, 3, 1], [1, 2, 1], [1, 3, 1], [2, 3, 1]],maxMoves = 1,n = 4) == 4\n assert candidate(edges = [[0, 1, 0], [1, 2, 0], [2, 3, 0], [3, 4, 0], [4, 5, 0], [5, 6, 0], [6, 7, 0], [7, 8, 0], [8, 9, 0]],maxMoves = 5,n = 10) == 6\n assert candidate(edges = [[0, 1, 1], [0, 2, 2], [1, 2, 3], [1, 3, 4], [2, 3, 5], [2, 4, 6], [3, 4, 7], [3, 5, 8], [4, 5, 9]],maxMoves = 20,n = 6) == 51\n assert candidate(edges = [[0, 1, 3], [1, 2, 2], [0, 2, 4]],maxMoves = 5,n = 3) == 11\n assert candidate(edges = [[0, 1, 3], [1, 2, 3], [2, 3, 3], [3, 0, 3], [0, 4, 3], [4, 5, 3], [5, 6, 3], [6, 0, 3], [1, 7, 3], [7, 8, 3], [8, 1, 3], [2, 9, 3], [9, 10, 3], [10, 2, 3]],maxMoves = 10,n = 11) == 46\n assert candidate(edges = [[0, 1, 1], [1, 2, 2], [2, 3, 3], [3, 4, 4], [4, 5, 5], [5, 0, 6]],maxMoves = 12,n = 6) == 25\n assert candidate(edges = [[0, 1, 0], [1, 2, 0], [2, 3, 0], [3, 4, 0], [4, 5, 0]],maxMoves = 5,n = 6) == 6\n assert candidate(edges = [[0, 1, 5], [0, 2, 5], [1, 2, 5], [1, 3, 5], [2, 3, 5]],maxMoves = 15,n = 4) == 29\n assert candidate(edges = [[0, 1, 1], [0, 2, 2], [1, 2, 3], [0, 3, 4], [1, 3, 5], [2, 3, 6], [0, 4, 7], [1, 4, 8], [2, 4, 9], [3, 4, 10]],maxMoves = 15,n = 5) == 60\n assert candidate(edges = [[0, 1, 4], [1, 2, 6], [0, 2, 8], [1, 3, 1], [3, 4, 5], [2, 5, 3]],maxMoves = 15,n = 6) == 33\n assert candidate(edges = [[0, 1, 3], [0, 2, 4], [1, 2, 5]],maxMoves = 7,n = 3) == 15\n assert candidate(edges = [[0, 1, 5], [1, 2, 3], [2, 3, 2], [3, 0, 4], [0, 4, 1]],maxMoves = 9,n = 5) == 20\n assert candidate(edges = [[0, 1, 5], [0, 2, 5], [0, 3, 5], [0, 4, 5], [1, 2, 5], [1, 3, 5], [1, 4, 5], [2, 3, 5], [2, 4, 5], [3, 4, 5]],maxMoves = 15,n = 5) == 55\n assert candidate(edges = [[0, 1, 1], [1, 2, 2], [2, 3, 3], [3, 0, 4], [0, 2, 5], [1, 3, 6]],maxMoves = 10,n = 4) == 25\n assert candidate(edges = [[0, 1, 0], [1, 2, 0], [2, 3, 0], [3, 4, 0], [4, 0, 0]],maxMoves = 1,n = 5) == 3\n assert candidate(edges = [[0, 1, 10], [0, 2, 5], [2, 3, 3], [1, 4, 4]],maxMoves = 15,n = 5) == 26\n assert candidate(edges = [[0, 1, 0], [1, 2, 0], [2, 3, 0], [3, 4, 0], [4, 5, 0], [5, 6, 0], [6, 7, 0], [7, 8, 0], [8, 9, 0], [9, 0, 0]],maxMoves = 5,n = 10) == 10\n assert candidate(edges = [[0, 1, 2], [0, 2, 3], [1, 2, 1], [1, 3, 4], [2, 4, 2]],maxMoves = 8,n = 5) == 17\n assert candidate(edges = [[0, 1, 10], [1, 2, 10], [2, 3, 10], [3, 4, 10], [4, 0, 10], [0, 5, 10], [5, 6, 10], [6, 7, 10], [7, 0, 10], [0, 8, 10], [8, 9, 10], [9, 0, 10]],maxMoves = 30,n = 10) == 130\n assert candidate(edges = [[0, 1, 10], [0, 2, 5], [1, 2, 10], [1, 3, 7], [2, 4, 3], [3, 4, 8]],maxMoves = 20,n = 5) == 48\n assert candidate(edges = [[0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 0, 6], [0, 5, 7], [5, 6, 8], [6, 7, 9], [7, 8, 10], [8, 5, 11]],maxMoves = 30,n = 9) == 74\n assert candidate(edges = [[0, 1, 1], [0, 2, 1], [0, 3, 1], [0, 4, 1], [0, 5, 1], [0, 6, 1], [0, 7, 1], [0, 8, 1], [0, 9, 1], [0, 10, 1]],maxMoves = 1,n = 11) == 11\n assert candidate(edges = [[0, 1, 5], [1, 2, 5], [2, 3, 5], [3, 4, 5], [4, 5, 5], [5, 0, 5]],maxMoves = 15,n = 6) == 31\n assert candidate(edges = [[0, 1, 1000], [1, 2, 2000], [2, 3, 3000], [3, 4, 4000]],maxMoves = 10000,n = 5) == 10001\n assert candidate(edges = [[0, 1, 2], [0, 2, 3], [1, 3, 4], [2, 4, 5], [3, 5, 6], [4, 6, 7]],maxMoves = 15,n = 7) == 31\n assert candidate(edges = [[0, 1, 2], [1, 2, 2], [2, 3, 2], [3, 4, 2], [4, 0, 2], [0, 5, 2], [5, 6, 2], [6, 7, 2], [7, 0, 2]],maxMoves = 10,n = 8) == 26\n assert candidate(edges = [[0, 1, 3], [0, 2, 3], [1, 2, 3], [1, 3, 3], [2, 3, 3], [0, 4, 3], [1, 4, 3], [2, 4, 3], [3, 4, 3]],maxMoves = 5,n = 5) == 22\n assert candidate(edges = [[0, 1, 10], [0, 2, 20], [1, 3, 30], [2, 4, 40], [3, 4, 50]],maxMoves = 35,n = 5) == 71\n assert candidate(edges = [[0, 1, 1], [1, 2, 2], [2, 3, 3], [3, 4, 4], [4, 5, 5], [5, 6, 6]],maxMoves = 15,n = 7) == 16\n assert candidate(edges = [[0, 1, 2], [0, 2, 3], [1, 3, 4], [1, 4, 5], [2, 5, 6], [2, 6, 7], [3, 7, 8], [3, 8, 9], [4, 8, 10], [5, 9, 11], [6, 9, 12]],maxMoves = 30,n = 10) == 87\n assert candidate(edges = [[0, 1, 100], [1, 2, 100], [2, 3, 100], [3, 4, 100], [4, 0, 100]],maxMoves = 250,n = 5) == 501\n assert candidate(edges = [[0, 1, 1], [1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 0, 1], [1, 3, 1], [2, 4, 1]],maxMoves = 5,n = 5) == 12\n assert candidate(edges = [[0, 1, 100], [0, 2, 50], [1, 3, 25], [1, 4, 75], [2, 5, 20], [2, 6, 40], [3, 7, 30], [4, 8, 60], [5, 9, 10], [6, 10, 15], [7, 11, 20], [8, 12, 25], [9, 13, 30], [10, 14, 35], [11, 15, 40], [12, 16, 45], [13, 17, 50], [14, 18, 55], [15, 19, 60]],maxMoves = 300,n = 20) == 795\n assert candidate(edges = [[0, 1, 5], [1, 2, 3], [2, 3, 4], [3, 4, 2], [4, 0, 6]],maxMoves = 15,n = 5) == 25\n assert candidate(edges = [[0, 1, 1], [1, 2, 2], [2, 3, 3], [3, 4, 4], [4, 5, 5], [5, 6, 6], [6, 7, 7], [7, 8, 8], [8, 9, 9]],maxMoves = 25,n = 10) == 26\n assert candidate(edges = [[0, 1, 10], [0, 2, 5], [1, 2, 3], [1, 3, 4], [2, 3, 2]],maxMoves = 15,n = 4) == 28\n assert candidate(edges = [[0, 1, 1], [0, 2, 2], [0, 3, 3], [1, 2, 4], [2, 3, 5]],maxMoves = 10,n = 4) == 19\n assert candidate(edges = [[0, 1, 5], [1, 2, 5], [2, 3, 5], [3, 4, 5], [4, 0, 5], [0, 5, 5], [5, 6, 5], [6, 7, 5], [7, 0, 5]],maxMoves = 15,n = 8) == 53\n assert candidate(edges = [[0, 1, 0], [0, 2, 0], [1, 2, 0], [1, 3, 0], [2, 3, 0]],maxMoves = 5,n = 4) == 4\n assert candidate(edges = [[0, 1, 1], [0, 2, 2], [1, 2, 1], [1, 3, 2], [2, 3, 1], [2, 4, 2], [3, 4, 1], [3, 5, 2], [4, 5, 1]],maxMoves = 5,n = 6) == 13\n assert candidate(edges = [[0, 1, 100], [0, 2, 50], [1, 2, 50], [1, 3, 30], [2, 3, 20], [2, 4, 40], [3, 4, 50]],maxMoves = 200,n = 5) == 345\n assert candidate(edges = [[0, 1, 3], [1, 2, 2], [2, 3, 1], [3, 4, 4], [4, 5, 5], [5, 6, 6], [6, 7, 7], [7, 8, 8]],maxMoves = 30,n = 9) == 31\n assert candidate(edges = [[0, 1, 5], [1, 2, 5], [2, 3, 5], [3, 0, 5], [0, 4, 5], [1, 4, 5], [2, 4, 5], [3, 4, 5]],maxMoves = 10,n = 5) == 41\n assert candidate(edges = [[0, 1, 5], [0, 2, 5], [0, 3, 5], [0, 4, 5], [0, 5, 5], [0, 6, 5], [0, 7, 5], [0, 8, 5], [0, 9, 5], [0, 10, 5]],maxMoves = 20,n = 11) == 61\n assert candidate(edges = [[0, 1, 10], [0, 2, 1], [1, 2, 2], [2, 3, 5], [3, 4, 3]],maxMoves = 12,n = 5) == 26\n assert candidate(edges = [[0, 1, 0], [1, 2, 0], [2, 3, 0], [3, 4, 0], [4, 0, 0]],maxMoves = 3,n = 5) == 5\n assert candidate(edges = [[0, 1, 0], [1, 2, 0], [2, 3, 0], [3, 4, 0], [4, 0, 0]],maxMoves = 0,n = 5) == 1\n assert candidate(edges = [[0, 1, 2], [0, 2, 2], [0, 3, 2], [0, 4, 2], [1, 5, 2], [2, 6, 2], [3, 7, 2], [4, 8, 2], [5, 6, 2], [6, 7, 2], [7, 8, 2]],maxMoves = 5,n = 9) == 21\n assert candidate(edges = [[0, 1, 20], [0, 2, 15], [1, 2, 10], [1, 3, 25], [2, 4, 30], [3, 4, 5]],maxMoves = 50,n = 5) == 110\n assert candidate(edges = [[0, 1, 4], [0, 2, 4], [1, 2, 5], [1, 3, 2], [2, 3, 3]],maxMoves = 10,n = 4) == 22\n assert candidate(edges = [[0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 0, 7]],maxMoves = 25,n = 6) == 33\n assert candidate(edges = [[0, 1, 1], [2, 3, 1], [4, 5, 1]],maxMoves = 3,n = 6) == 3\n assert candidate(edges = [[0, 1, 1], [0, 2, 2], [0, 3, 3], [0, 4, 4], [0, 5, 5], [0, 6, 6], [0, 7, 7], [0, 8, 8], [0, 9, 9]],maxMoves = 15,n = 10) == 55\n assert candidate(edges = [[0, 1, 100], [1, 2, 200], [2, 3, 300], [3, 0, 400]],maxMoves = 800,n = 4) == 1004\n assert candidate(edges = [[0, 1, 3], [1, 2, 3], [2, 3, 3], [3, 0, 3]],maxMoves = 6,n = 4) == 13\n assert candidate(edges = [[0, 1, 1], [0, 2, 1], [0, 3, 1], [0, 4, 1], [0, 5, 1], [1, 2, 1], [1, 3, 1], [1, 4, 1], [1, 5, 1]],maxMoves = 5,n = 6) == 15\n assert candidate(edges = [[0, 1, 0], [1, 2, 3], [2, 3, 0], [3, 4, 0], [4, 5, 0], [5, 0, 0]],maxMoves = 10,n = 6) == 9\n assert candidate(edges = [[0, 1, 2], [0, 2, 4], [0, 3, 3], [1, 2, 1], [1, 3, 2], [2, 3, 5], [3, 4, 2], [4, 5, 3], [5, 6, 4], [6, 7, 1]],maxMoves = 25,n = 8) == 35\n assert candidate(edges = [[0, 1, 1], [1, 2, 1], [2, 3, 1], [3, 0, 1], [0, 4, 1], [4, 5, 1], [5, 6, 1], [6, 0, 1]],maxMoves = 3,n = 7) == 13\n assert candidate(edges = [[0, 1, 5], [0, 2, 5], [0, 3, 5], [1, 2, 5], [1, 3, 5], [2, 3, 5]],maxMoves = 10,n = 4) == 34\n assert candidate(edges = [[0, 1, 1], [1, 2, 2], [2, 3, 3], [3, 4, 4], [4, 5, 5], [5, 6, 6], [6, 7, 7], [7, 8, 8], [8, 9, 9], [9, 10, 10]],maxMoves = 55,n = 11) == 56\n assert candidate(edges = [[0, 1, 10], [0, 2, 5], [1, 3, 3], [2, 3, 7], [3, 4, 2]],maxMoves = 20,n = 5) == 32\n assert candidate(edges = [[0, 1, 5], [0, 2, 5], [1, 2, 5], [1, 3, 5], [2, 3, 5], [2, 4, 5], [3, 4, 5], [3, 5, 5], [4, 5, 5]],maxMoves = 10,n = 6) == 30\n assert candidate(edges = [[0, 1, 10], [1, 2, 10], [2, 3, 10], [3, 4, 10], [4, 5, 10], [5, 6, 10], [6, 7, 10], [7, 8, 10], [8, 9, 10], [9, 0, 10]],maxMoves = 50,n = 10) == 101\n assert candidate(edges = [[0, 1, 1000], [1, 2, 1000], [2, 3, 1000], [3, 4, 1000], [4, 0, 1000]],maxMoves = 2000,n = 5) == 4001\n assert candidate(edges = [[0, 1, 1000], [0, 2, 1000], [1, 2, 1000], [1, 3, 1000], [2, 3, 1000], [2, 4, 1000], [3, 4, 1000], [3, 5, 1000], [4, 5, 1000]],maxMoves = 3000,n = 6) == 9001\n assert candidate(edges = [[0, 1, 3], [0, 2, 2], [0, 3, 1], [1, 4, 2], [2, 5, 3], [3, 6, 4], [4, 7, 1], [5, 8, 2], [6, 9, 3]],maxMoves = 20,n = 10) == 31\n assert candidate(edges = [[0, 1, 0], [1, 2, 0], [2, 3, 0], [3, 4, 0], [4, 5, 0], [5, 6, 0], [6, 7, 0], [7, 8, 0], [8, 9, 0], [9, 10, 0], [10, 0, 0]],maxMoves = 5,n = 11) == 11\n assert candidate(edges = [[0, 1, 2], [0, 2, 2], [0, 3, 2], [1, 2, 2], [1, 3, 2], [2, 3, 2], [0, 4, 2], [1, 4, 2], [2, 4, 2], [3, 4, 2]],maxMoves = 3,n = 5) == 13\n assert candidate(edges = [[0, 1, 10], [0, 2, 1], [1, 2, 2], [1, 3, 5], [2, 3, 3], [3, 4, 7]],maxMoves = 20,n = 5) == 33\n assert candidate(edges = [[0, 1, 0], [1, 2, 0], [2, 3, 0], [3, 4, 0], [4, 5, 0], [5, 6, 0], [6, 7, 0], [7, 8, 0], [8, 9, 0], [9, 10, 0]],maxMoves = 5,n = 11) == 6\n assert candidate(edges = [[0, 1, 1], [1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [7, 8, 1], [8, 9, 1]],maxMoves = 5,n = 10) == 6\n assert candidate(edges = [[0, 1, 1000], [0, 2, 1000], [1, 3, 1000], [1, 4, 1000], [2, 5, 1000], [2, 6, 1000], [3, 7, 1000], [4, 8, 1000], [5, 9, 1000], [6, 10, 1000], [7, 11, 1000], [8, 12, 1000], [9, 13, 1000], [10, 14, 1000], [11, 15, 1000], [12, 16, 1000], [13, 17, 1000], [14, 18, 1000], [15, 19, 1000]],maxMoves = 10000,n = 20) == 19020\n assert candidate(edges = [[0, 1, 1], [1, 2, 2], [2, 3, 3], [3, 4, 4], [4, 5, 5], [5, 0, 6]],maxMoves = 20,n = 6) == 27\n assert candidate(edges = [[0, 1, 4], [1, 2, 6], [0, 2, 8], [1, 3, 1], [3, 4, 2], [4, 5, 7]],maxMoves = 20,n = 6) == 34\n assert candidate(edges = [[0, 1, 10], [0, 2, 5], [1, 2, 5], [1, 3, 3], [2, 3, 2], [2, 4, 4], [3, 4, 5]],maxMoves = 15,n = 5) == 39\n assert candidate(edges = [[0, 1, 1], [1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [7, 8, 1], [8, 0, 1]],maxMoves = 8,n = 9) == 17\n"}, "metadata": {"canonical_parameter_names": ["edges", "maxMoves", "n"], "leetcode_dataset_entry_point": "Solution().reachableNodes", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var reachableNodes = function(edges, maxMoves, n) {", "container": null, "callable": "reachableNodes", "parameters": [{"name": "edges", "type": "number[][]"}, {"name": "maxMoves", "type": "number"}, {"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 883, "task_id": "projection-area-of-3d-shapes", "difficulty": "Easy", "problem_description": "You are given an n x n grid where we place some 1 x 1 x 1 cubes that are axis-aligned with the x, y, and z axes.\nEach value v = grid[i][j] represents a tower of v cubes placed on top of the cell (i, j).\nWe view the projection of these cubes onto the xy, yz, and zx planes.\nA projection is like a shadow, that maps our 3-dimensional figure to a 2-dimensional plane. We are viewing the \"shadow\" when looking at the cubes from the top, the front, and the side.\nReturn the total area of all three projections.\n \nExample 1:\n\n\nInput: grid = [[1,2],[3,4]]\nOutput: 17\nExplanation: Here are the three projections (\"shadows\") of the shape made with each axis-aligned plane.\n\nExample 2:\n\nInput: grid = [[2]]\nOutput: 5\n\nExample 3:\n\nInput: grid = [[1,0],[0,2]]\nOutput: 8\n\n \nConstraints:\n\nn == grid.length == grid[i].length\n1 <= n <= 50\n0 <= grid[i][j] <= 50\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[2, 2, 2], [2, 1, 2], [2, 2, 2]]) == 21\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 14\n assert candidate(grid = [[2]]) == 5\n assert candidate(grid = [[1, 2], [3, 4]]) == 17\n assert candidate(grid = [[1, 0], [0, 2]]) == 8\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 2, 1], [2, 1, 0, 2], [1, 0, 2, 1], [2, 1, 0, 2]]) == 27\n assert candidate(grid = [[5, 0, 0, 1], [0, 5, 0, 2], [0, 0, 5, 3], [1, 2, 3, 4]]) == 48\n assert candidate(grid = [[1, 0, 2, 0, 1], [0, 0, 0, 0, 0], [2, 0, 1, 0, 2], [0, 0, 0, 0, 0], [1, 0, 2, 0, 1]]) == 21\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 3, 1], [5, 3, 1, 3, 5], [1, 5, 3, 5, 1]]) == 75\n assert candidate(grid = [[5, 5, 5, 5], [5, 5, 5, 5], [5, 5, 5, 5], [5, 5, 5, 5]]) == 56\n assert candidate(grid = [[0, 1, 2, 3, 4], [1, 0, 3, 2, 4], [2, 3, 0, 4, 1], [3, 2, 4, 0, 2], [4, 4, 1, 2, 0]]) == 60\n assert candidate(grid = [[4, 3, 2], [3, 2, 1], [2, 1, 0]]) == 26\n assert candidate(grid = [[4, 1, 1, 1], [1, 4, 1, 1], [1, 1, 4, 1], [1, 1, 1, 4]]) == 48\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) == 15\n assert candidate(grid = [[3, 0, 1], [1, 2, 3], [4, 5, 6]]) == 35\n assert candidate(grid = [[3, 0, 0, 0], [0, 2, 0, 0], [0, 0, 4, 0], [0, 0, 0, 1]]) == 24\n assert candidate(grid = [[9, 0, 0, 0], [0, 9, 0, 0], [0, 0, 9, 0], [0, 0, 0, 9]]) == 76\n assert candidate(grid = [[10, 5, 5, 3], [4, 7, 6, 2], [1, 3, 4, 0], [3, 1, 2, 5]]) == 69\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 3, 1], [2, 4, 6, 4, 2], [3, 5, 7, 5, 3]]) == 80\n assert candidate(grid = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) == 9\n assert candidate(grid = [[0, 0, 5, 0, 0], [0, 0, 5, 0, 0], [5, 5, 5, 5, 5], [0, 0, 5, 0, 0], [0, 0, 5, 0, 0]]) == 59\n assert candidate(grid = [[1, 0, 1], [0, 1, 0], [1, 0, 1]]) == 11\n assert candidate(grid = [[3, 3, 3, 3], [3, 3, 3, 3], [3, 3, 3, 3], [3, 3, 3, 3]]) == 40\n assert candidate(grid = [[10, 10, 10], [10, 1, 10], [10, 10, 10]]) == 69\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == 15\n assert candidate(grid = [[0, 1, 2, 3], [1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6]]) == 51\n assert candidate(grid = [[3, 0, 0, 0], [0, 3, 0, 0], [0, 0, 3, 0], [0, 0, 0, 3]]) == 28\n assert candidate(grid = [[3, 3, 3, 3], [3, 3, 3, 3], [3, 3, 3, 3], [3, 3, 3, 3]]) == 40\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 3, 1], [2, 4, 6, 4, 2], [3, 5, 7, 5, 3]]) == 80\n assert candidate(grid = [[5, 0, 0, 0, 0], [0, 5, 0, 0, 0], [0, 0, 5, 0, 0], [0, 0, 0, 5, 0], [0, 0, 0, 0, 5]]) == 55\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 3, 1], [4, 2, 1, 2, 4], [2, 4, 2, 4, 2]]) == 71\n assert candidate(grid = [[10, 10, 10], [10, 0, 10], [10, 10, 10]]) == 68\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 35\n assert candidate(grid = [[5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5]]) == 75\n assert candidate(grid = [[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]]) == 16\n assert candidate(grid = [[5, 0, 0], [0, 5, 0], [0, 0, 5]]) == 33\n assert candidate(grid = [[5, 5, 5, 5], [5, 1, 1, 5], [5, 1, 1, 5], [5, 5, 5, 5]]) == 56\n assert candidate(grid = [[5, 8, 3], [3, 7, 2], [6, 4, 1]]) == 47\n assert candidate(grid = [[5, 1, 3], [0, 2, 4], [6, 0, 0]]) == 33\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 5, 2, 4, 3], [3, 4, 1, 5, 2], [2, 1, 4, 3, 5]]) == 74\n assert candidate(grid = [[4, 4, 4], [4, 0, 4], [4, 4, 4]]) == 32\n assert candidate(grid = [[3, 0, 4, 0], [0, 2, 0, 0], [1, 0, 3, 0], [0, 0, 0, 3]]) == 30\n assert candidate(grid = [[3, 3, 3, 3, 3], [3, 3, 3, 3, 3], [3, 3, 3, 3, 3], [3, 3, 3, 3, 3], [3, 3, 3, 3, 3]]) == 55\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 3, 1], [5, 3, 1, 3, 5], [2, 4, 6, 4, 2]]) == 75\n assert candidate(grid = [[3, 1, 4], [1, 5, 9], [2, 6, 5]]) == 46\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 0]]) == 14\n assert candidate(grid = [[10, 0, 0, 0], [0, 20, 0, 0], [0, 0, 30, 0], [0, 0, 0, 40]]) == 204\n assert candidate(grid = [[5, 3, 1], [4, 2, 0], [1, 4, 2]]) == 32\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 7, 9], [9, 7, 5, 3, 1], [2, 4, 6, 8, 10]]) == 103\n assert candidate(grid = [[1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 11], [11, 9, 7, 5, 3, 1], [2, 4, 6, 8, 10, 12], [12, 11, 10, 9, 8, 7]]) == 158\n assert candidate(grid = [[0, 1, 2, 3, 4], [5, 4, 3, 2, 1], [4, 5, 6, 7, 8], [3, 2, 1, 0, 9], [2, 3, 4, 5, 6]]) == 87\n assert candidate(grid = [[1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 11], [11, 9, 7, 5, 3, 1], [1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1]]) == 136\n assert candidate(grid = [[2, 2, 2, 2], [2, 1, 1, 2], [2, 1, 1, 2], [2, 2, 2, 2]]) == 32\n assert candidate(grid = [[3, 0, 3], [0, 4, 0], [3, 0, 3]]) == 25\n assert candidate(grid = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]]) == 105\n assert candidate(grid = [[5, 0, 0], [0, 5, 0], [0, 0, 5]]) == 33\n assert candidate(grid = [[4, 0, 0, 0], [0, 4, 0, 0], [0, 0, 4, 0], [0, 0, 0, 4]]) == 36\n assert candidate(grid = [[3, 0, 0, 3, 3], [0, 2, 0, 0, 0], [0, 0, 4, 0, 0], [3, 0, 0, 3, 3], [3, 0, 0, 3, 3]]) == 41\n assert candidate(grid = [[1, 0, 0, 1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [1, 0, 0, 1, 0], [0, 1, 0, 0, 1]]) == 19\n assert candidate(grid = [[3, 0, 0], [0, 3, 0], [0, 0, 3]]) == 21\n assert candidate(grid = [[4, 0, 0], [0, 0, 0], [0, 0, 4]]) == 18\n assert candidate(grid = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) == 12\n assert candidate(grid = [[5, 4, 3, 2, 1], [4, 3, 2, 1, 0], [3, 2, 1, 0, 4], [2, 1, 0, 4, 3], [1, 0, 4, 3, 2]]) == 63\n assert candidate(grid = [[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == 16\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 24\n assert candidate(grid = [[9, 8, 7, 6], [5, 4, 3, 2], [1, 2, 3, 4], [8, 7, 6, 5]]) == 72\n assert candidate(grid = [[5, 0, 0, 0], [0, 5, 0, 0], [0, 0, 5, 0], [0, 0, 0, 5]]) == 44\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == 51\n assert candidate(grid = [[3, 1, 4], [2, 5, 6], [7, 8, 9]]) == 52\n assert candidate(grid = [[0, 1, 2, 3], [3, 2, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == 28\n assert candidate(grid = [[10, 20, 30], [20, 30, 40], [30, 40, 50]]) == 249\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().projectionArea", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var projectionArea = function(grid) {", "container": null, "callable": "projectionArea", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 884, "task_id": "uncommon-words-from-two-sentences", "difficulty": "Easy", "problem_description": "A sentence is a string of single-space separated words where each word consists only of lowercase letters.\nA word is uncommon if it appears exactly once in one of the sentences, and does not appear in the other sentence.\nGiven two sentences s1 and s2, return a list of all the uncommon words. You may return the answer in any order.\n \nExample 1:\n\nInput: s1 = \"this apple is sweet\", s2 = \"this apple is sour\"\nOutput: [\"sweet\",\"sour\"]\nExplanation:\nThe word \"sweet\" appears only in s1, while the word \"sour\" appears only in s2.\n\nExample 2:\n\nInput: s1 = \"apple apple\", s2 = \"banana\"\nOutput: [\"banana\"]\n\n \nConstraints:\n\n1 <= s1.length, s2.length <= 200\ns1 and s2 consist of lowercase English letters and spaces.\ns1 and s2 do not have leading or trailing spaces.\nAll the words in s1 and s2 are separated by a single space.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s1 = \"overlap words here\",s2 = \"words here\") == ['overlap']\n assert candidate(s1 = \"hello world\",s2 = \"hold the door\") == ['hello', 'world', 'hold', 'the', 'door']\n assert candidate(s1 = \"hello world\",s2 = \"hello there\") == ['world', 'there']\n assert candidate(s1 = \"cat dog\",s2 = \"fish bird\") == ['cat', 'dog', 'fish', 'bird']\n assert candidate(s1 = \"unique words here\",s2 = \"some unique there\") == ['words', 'here', 'some', 'there']\n assert candidate(s1 = \"unique words\",s2 = \"different words\") == ['unique', 'different']\n assert candidate(s1 = \"single\",s2 = \"word\") == ['single', 'word']\n assert candidate(s1 = \"one two three\",s2 = \"four five six\") == ['one', 'two', 'three', 'four', 'five', 'six']\n assert candidate(s1 = \"same same\",s2 = \"same same\") == []\n assert candidate(s1 = \"apple apple\",s2 = \"banana\") == ['banana']\n assert candidate(s1 = \"a b c\",s2 = \"d e f\") == ['a', 'b', 'c', 'd', 'e', 'f']\n assert candidate(s1 = \"exclusive to s1\",s2 = \"exclusive to s2\") == ['s1', 's2']\n assert candidate(s1 = \"hello world\",s2 = \"world is great\") == ['hello', 'is', 'great']\n assert candidate(s1 = \"a b c\",s2 = \"a b d\") == ['c', 'd']\n assert candidate(s1 = \"a b c d\",s2 = \"d e f g\") == ['a', 'b', 'c', 'e', 'f', 'g']\n assert candidate(s1 = \"one two three\",s2 = \"three two one\") == []\n assert candidate(s1 = \"this apple is sweet\",s2 = \"this apple is sour\") == ['sweet', 'sour']\n assert candidate(s1 = \"hello from the other side\",s2 = \"hello from this side\") == ['the', 'other', 'this']\n assert candidate(s1 = \"long sentence with multiple occurrences of words\",s2 = \"words occurrences sentence\") == ['long', 'with', 'multiple', 'of']\n assert candidate(s1 = \"shared unique shared\",s2 = \"unique shared unique\") == []\n assert candidate(s1 = \"abc def ghi jkl mno pqr stu vwx yz\",s2 = \"stu vwx yz abc def ghi jkl mno pqr\") == []\n assert candidate(s1 = \"python is great\",s2 = \"great language python\") == ['is', 'language']\n assert candidate(s1 = \"alpha beta gamma\",s2 = \"delta epsilon zeta\") == ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta']\n assert candidate(s1 = \"common common words in both\",s2 = \"common words in both sentences\") == ['sentences']\n assert candidate(s1 = \"repeat repeat repeat repeat\",s2 = \"single\") == ['single']\n assert candidate(s1 = \"hello world from python\",s2 = \"hello world from java\") == ['python', 'java']\n assert candidate(s1 = \"same same same same\",s2 = \"same\") == []\n assert candidate(s1 = \"multiple words in a sentence\",s2 = \"multiple unique words\") == ['in', 'a', 'sentence', 'unique']\n assert candidate(s1 = \"alpha beta gamma delta\",s2 = \"delta epsilon zeta\") == ['alpha', 'beta', 'gamma', 'epsilon', 'zeta']\n assert candidate(s1 = \"\",s2 = \"single word\") == ['single', 'word']\n assert candidate(s1 = \"repeated repeated words\",s2 = \"words words repeated\") == []\n assert candidate(s1 = \"repeated repeated repeated\",s2 = \"unique word\") == ['unique', 'word']\n assert candidate(s1 = \"unique words only here\",s2 = \"completely different set of words\") == ['unique', 'only', 'here', 'completely', 'different', 'set', 'of']\n assert candidate(s1 = \"one two three four five six seven eight nine ten eleven twelve\",s2 = \"twelve eleven ten nine eight seven six five four three two one\") == []\n assert candidate(s1 = \"one two one\",s2 = \"three two three\") == []\n assert candidate(s1 = \"apple orange banana\",s2 = \"banana orange grape\") == ['apple', 'grape']\n assert candidate(s1 = \"a quick brown fox jumps over the lazy dog\",s2 = \"the quick brown dog jumps over a lazy\") == ['fox']\n assert candidate(s1 = \"common words appear here\",s2 = \"here common words appear\") == []\n assert candidate(s1 = \"common common common\",s2 = \"uncommon\") == ['uncommon']\n assert candidate(s1 = \"single\",s2 = \"different\") == ['single', 'different']\n assert candidate(s1 = \"one two three four five six seven eight nine ten\",s2 = \"ten nine eight seven six five four three two one\") == []\n assert candidate(s1 = \"overlap this is a test\",s2 = \"this is another test\") == ['overlap', 'a', 'another']\n assert candidate(s1 = \"longer sentence with many uncommon words\",s2 = \"many uncommon words longer sentence\") == ['with']\n assert candidate(s1 = \"common words in both\",s2 = \"common words in both\") == []\n assert candidate(s1 = \"abc def ghi jkl mno pqr stu vwx yza\",s2 = \"stu vwx yza abc def ghi jkl\") == ['mno', 'pqr']\n assert candidate(s1 = \"python java cplusplus\",s2 = \"java csharp python\") == ['cplusplus', 'csharp']\n assert candidate(s1 = \"same same same\",s2 = \"different different different\") == []\n assert candidate(s1 = \"hello world hello\",s2 = \"world world\") == []\n assert candidate(s1 = \"test test test\",s2 = \"unique test\") == ['unique']\n assert candidate(s1 = \"distinct words only\",s2 = \"entirely distinct words\") == ['only', 'entirely']\n assert candidate(s1 = \"\",s2 = \"single\") == ['single']\n assert candidate(s1 = \"repeated repeated words\",s2 = \"unique words in second sentence\") == ['unique', 'in', 'second', 'sentence']\n assert candidate(s1 = \"test test test\",s2 = \"test test test test\") == []\n assert candidate(s1 = \"single\",s2 = \"unique\") == ['single', 'unique']\n assert candidate(s1 = \"repeated repeated word\",s2 = \"word unique\") == ['unique']\n assert candidate(s1 = \"unique word in first sentence\",s2 = \"unique word in second sentence\") == ['first', 'second']\n assert candidate(s1 = \"many many words in this sentence\",s2 = \"many words\") == ['in', 'this', 'sentence']\n assert candidate(s1 = \"unique words only\",s2 = \"completely different set\") == ['unique', 'words', 'only', 'completely', 'different', 'set']\n assert candidate(s1 = \"unique words only\",s2 = \"different set words\") == ['unique', 'only', 'different', 'set']\n assert candidate(s1 = \"this is a test\",s2 = \"this is another test\") == ['a', 'another']\n assert candidate(s1 = \"same same same\",s2 = \"same\") == []\n assert candidate(s1 = \"unique word in sentence one\",s2 = \"unique word in sentence two\") == ['one', 'two']\n assert candidate(s1 = \"multiple words are present\",s2 = \"multiple words are missing\") == ['present', 'missing']\n assert candidate(s1 = \"overlap words in both\",s2 = \"overlap words in both\") == []\n assert candidate(s1 = \"longer sentence with more words\",s2 = \"shorter with\") == ['longer', 'sentence', 'more', 'words', 'shorter']\n assert candidate(s1 = \"identical identical identical\",s2 = \"identical identical identical\") == []\n assert candidate(s1 = \"this is a test sentence\",s2 = \"sentence is a this\") == ['test']\n assert candidate(s1 = \"common common words in both\",s2 = \"common words\") == ['in', 'both']\n assert candidate(s1 = \"overlapping words in both\",s2 = \"overlapping words in both\") == []\n assert candidate(s1 = \"repeated repeated words here\",s2 = \"different words here\") == ['different']\n assert candidate(s1 = \"distinctive words in each sentence\",s2 = \"each sentence has distinctive words\") == ['in', 'has']\n assert candidate(s1 = \"a a a b b c d e f g h i j k l m n o p q r s t u v w x y z\",s2 = \"a b c\") == ['d', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n assert candidate(s1 = \"a b c d e f g h i j\",s2 = \"k l m n o p q r s t\") == ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't']\n assert candidate(s1 = \"unique words only here\",s2 = \"unique words are everywhere\") == ['only', 'here', 'are', 'everywhere']\n assert candidate(s1 = \"one two three four five six\",s2 = \"six five four three two one\") == []\n assert candidate(s1 = \"longer sentence with multiple uncommon words here\",s2 = \"here are some uncommon words\") == ['longer', 'sentence', 'with', 'multiple', 'are', 'some']\n assert candidate(s1 = \"first sentence here\",s2 = \"second unique sentence\") == ['first', 'here', 'second', 'unique']\n assert candidate(s1 = \"same same same same\",s2 = \"different different\") == []\n assert candidate(s1 = \"unique words in each sentence\",s2 = \"other unique words\") == ['in', 'each', 'sentence', 'other']\n assert candidate(s1 = \"common words and unique\",s2 = \"unique words and common\") == []\n assert candidate(s1 = \"shared words words\",s2 = \"words shared\") == []\n assert candidate(s1 = \"python java c++\",s2 = \"java c++ python\") == []\n assert candidate(s1 = \"overlap overlap words\",s2 = \"words overlap\") == []\n assert candidate(s1 = \"some common words here\",s2 = \"here some unique\") == ['common', 'words', 'unique']\n assert candidate(s1 = \"unique word only\",s2 = \"entirely different\") == ['unique', 'word', 'only', 'entirely', 'different']\n assert candidate(s1 = \"multiple multiple words in first\",s2 = \"words in second\") == ['first', 'second']\n assert candidate(s1 = \"repeated repeated words\",s2 = \"unique single\") == ['words', 'unique', 'single']\n assert candidate(s1 = \"one two three four five\",s2 = \"six seven eight nine ten\") == ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']\n assert candidate(s1 = \"complexity in first\",s2 = \"complexity in second\") == ['first', 'second']\n assert candidate(s1 = \"\",s2 = \"\") == []\n assert candidate(s1 = \"same same same\",s2 = \"same same\") == []\n assert candidate(s1 = \"no overlap\",s2 = \"no common words\") == ['overlap', 'common', 'words']\n assert candidate(s1 = \"shared words shared\",s2 = \"shared words unique\") == ['unique']\n assert candidate(s1 = \"common word common\",s2 = \"word common unique\") == ['unique']\n assert candidate(s1 = \"shared words are common\",s2 = \"common shared words\") == ['are']\n assert candidate(s1 = \"singleword\",s2 = \"singleword\") == []\n assert candidate(s1 = \"a a a a a a a a a a\",s2 = \"b b b b b b b b b b\") == []\n assert candidate(s1 = \"repeated repeated repeated\",s2 = \"repeated unique\") == ['unique']\n assert candidate(s1 = \"hello world hello\",s2 = \"world hello universe\") == ['universe']\n assert candidate(s1 = \"repeated repeated word\",s2 = \"word\") == []\n assert candidate(s1 = \"common words in both sentences\",s2 = \"common words in both sentences\") == []\n assert candidate(s1 = \"a b c d e f g h i j\",s2 = \"j i h g f e d c b a\") == []\n assert candidate(s1 = \"overlap overlap here\",s2 = \"here overlap\") == []\n assert candidate(s1 = \"exclusive to first\",s2 = \"exclusive to second\") == ['first', 'second']\n assert candidate(s1 = \"multiple unique words here\",s2 = \"here multiple\") == ['unique', 'words']\n assert candidate(s1 = \"one two three four\",s2 = \"five six seven eight\") == ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight']\n assert candidate(s1 = \"singleword\",s2 = \"differentword\") == ['singleword', 'differentword']\n assert candidate(s1 = \"unique words only\",s2 = \"completely different\") == ['unique', 'words', 'only', 'completely', 'different']\n assert candidate(s1 = \"a b c d e\",s2 = \"f g h i j\") == ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']\n assert candidate(s1 = \"overlap words here and there\",s2 = \"there and words\") == ['overlap', 'here']\n assert candidate(s1 = \"single\",s2 = \"\") == ['single']\n assert candidate(s1 = \"apple banana cherry\",s2 = \"banana cherry date\") == ['apple', 'date']\n assert candidate(s1 = \"a b c d e f g\",s2 = \"h i j k l m n o p q r s t u v w x y z\") == ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n assert candidate(s1 = \"\",s2 = \"singleword\") == ['singleword']\n assert candidate(s1 = \"uncommon word one\",s2 = \"uncommon word two\") == ['one', 'two']\n assert candidate(s1 = \"single\",s2 = \"single single\") == []\n assert candidate(s1 = \"a b c d e f g h i j k l m n o p q r s t u v w x y z\",s2 = \"a b c\") == ['d', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n assert candidate(s1 = \"repeated repeated repeated\",s2 = \"unique\") == ['unique']\n assert candidate(s1 = \"a b c d e f g\",s2 = \"h i j k l m n\") == ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n']\n assert candidate(s1 = \"longer sentence with more words included\",s2 = \"included more words with longer sentence\") == []\n assert candidate(s1 = \"overlap many words here\",s2 = \"many words overlap\") == ['here']\n assert candidate(s1 = \"singleword\",s2 = \"different\") == ['singleword', 'different']\n assert candidate(s1 = \"multiple same words here and here\",s2 = \"here and\") == ['multiple', 'same', 'words']\n assert candidate(s1 = \"python programming language\",s2 = \"programming language for python\") == ['for']\n assert candidate(s1 = \"abc def ghi jkl mno\",s2 = \"pqr stu vwx yza\") == ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yza']\n assert candidate(s1 = \"single\",s2 = \"single unique\") == ['unique']\n assert candidate(s1 = \"many different words in this sentence\",s2 = \"completely different words in this sentence\") == ['many', 'completely']\n assert candidate(s1 = \"only one word\",s2 = \"\") == ['only', 'one', 'word']\n assert candidate(s1 = \"singleword\",s2 = \"\") == ['singleword']\n assert candidate(s1 = \"common words overlap\",s2 = \"overlap common words\") == []\n"}, "metadata": {"canonical_parameter_names": ["s1", "s2"], "leetcode_dataset_entry_point": "Solution().uncommonFromSentences", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var uncommonFromSentences = function(s1, s2) {", "container": null, "callable": "uncommonFromSentences", "parameters": [{"name": "s1", "type": "string"}, {"name": "s2", "type": "string"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 885, "task_id": "spiral-matrix-iii", "difficulty": "Medium", "problem_description": "You start at the cell (rStart, cStart) of an rows x cols grid facing east. The northwest corner is at the first row and column in the grid, and the southeast corner is at the last row and column.\nYou will walk in a clockwise spiral shape to visit every position in this grid. Whenever you move outside the grid's boundary, we continue our walk outside the grid (but may return to the grid boundary later.). Eventually, we reach all rows * cols spaces of the grid.\nReturn an array of coordinates representing the positions of the grid in the order you visited them.\n \nExample 1:\n\n\nInput: rows = 1, cols = 4, rStart = 0, cStart = 0\nOutput: [[0,0],[0,1],[0,2],[0,3]]\n\nExample 2:\n\n\nInput: rows = 5, cols = 6, rStart = 1, cStart = 4\nOutput: [[1,4],[1,5],[2,5],[2,4],[2,3],[1,3],[0,3],[0,4],[0,5],[3,5],[3,4],[3,3],[3,2],[2,2],[1,2],[0,2],[4,5],[4,4],[4,3],[4,2],[4,1],[3,1],[2,1],[1,1],[0,1],[4,0],[3,0],[2,0],[1,0],[0,0]]\n\n \nConstraints:\n\n1 <= rows, cols <= 100\n0 <= rStart < rows\n0 <= cStart < cols\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(rows = 5,cols = 6,rStart = 1,cStart = 4) == [[1, 4], [1, 5], [2, 5], [2, 4], [2, 3], [1, 3], [0, 3], [0, 4], [0, 5], [3, 5], [3, 4], [3, 3], [3, 2], [2, 2], [1, 2], [0, 2], [4, 5], [4, 4], [4, 3], [4, 2], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 3,cols = 3,rStart = 1,cStart = 1) == [[1, 1], [1, 2], [2, 2], [2, 1], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2]]\n assert candidate(rows = 10,cols = 10,rStart = 5,cStart = 5) == [[5, 5], [5, 6], [6, 6], [6, 5], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [5, 7], [6, 7], [7, 7], [7, 6], [7, 5], [7, 4], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8], [8, 8], [8, 7], [8, 6], [8, 5], [8, 4], [8, 3], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [3, 9], [4, 9], [5, 9], [6, 9], [7, 9], [8, 9], [9, 9], [9, 8], [9, 7], [9, 6], [9, 5], [9, 4], [9, 3], [9, 2], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9]]\n assert candidate(rows = 1,cols = 4,rStart = 0,cStart = 0) == [[0, 0], [0, 1], [0, 2], [0, 3]]\n assert candidate(rows = 7,cols = 8,rStart = 3,cStart = 2) == [[3, 2], [3, 3], [4, 3], [4, 2], [4, 1], [3, 1], [2, 1], [2, 2], [2, 3], [2, 4], [3, 4], [4, 4], [5, 4], [5, 3], [5, 2], [5, 1], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [6, 5], [6, 4], [6, 3], [6, 2], [6, 1], [6, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [6, 6], [0, 7], [1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7]]\n assert candidate(rows = 4,cols = 4,rStart = 2,cStart = 2) == [[2, 2], [2, 3], [3, 3], [3, 2], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3]]\n assert candidate(rows = 2,cols = 3,rStart = 0,cStart = 1) == [[0, 1], [0, 2], [1, 2], [1, 1], [1, 0], [0, 0]]\n assert candidate(rows = 15,cols = 20,rStart = 10,cStart = 10) == [[10, 10], [10, 11], [11, 11], [11, 10], [11, 9], [10, 9], [9, 9], [9, 10], [9, 11], [9, 12], [10, 12], [11, 12], [12, 12], [12, 11], [12, 10], [12, 9], [12, 8], [11, 8], [10, 8], [9, 8], [8, 8], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [9, 13], [10, 13], [11, 13], [12, 13], [13, 13], [13, 12], [13, 11], [13, 10], [13, 9], [13, 8], [13, 7], [12, 7], [11, 7], [10, 7], [9, 7], [8, 7], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [8, 14], [9, 14], [10, 14], [11, 14], [12, 14], [13, 14], [14, 14], [14, 13], [14, 12], [14, 11], [14, 10], [14, 9], [14, 8], [14, 7], [14, 6], [13, 6], [12, 6], [11, 6], [10, 6], [9, 6], [8, 6], [7, 6], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [6, 14], [6, 15], [7, 15], [8, 15], [9, 15], [10, 15], [11, 15], [12, 15], [13, 15], [14, 15], [14, 5], [13, 5], [12, 5], [11, 5], [10, 5], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [5, 15], [5, 16], [6, 16], [7, 16], [8, 16], [9, 16], [10, 16], [11, 16], [12, 16], [13, 16], [14, 16], [14, 4], [13, 4], [12, 4], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [4, 15], [4, 16], [4, 17], [5, 17], [6, 17], [7, 17], [8, 17], [9, 17], [10, 17], [11, 17], [12, 17], [13, 17], [14, 17], [14, 3], [13, 3], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [3, 15], [3, 16], [3, 17], [3, 18], [4, 18], [5, 18], [6, 18], [7, 18], [8, 18], [9, 18], [10, 18], [11, 18], [12, 18], [13, 18], [14, 18], [14, 2], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [2, 16], [2, 17], [2, 18], [2, 19], [3, 19], [4, 19], [5, 19], [6, 19], [7, 19], [8, 19], [9, 19], [10, 19], [11, 19], [12, 19], [13, 19], [14, 19], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19]]\n assert candidate(rows = 9,cols = 9,rStart = 8,cStart = 8) == [[8, 8], [8, 7], [7, 7], [7, 8], [8, 6], [7, 6], [6, 6], [6, 7], [6, 8], [8, 5], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8]]\n assert candidate(rows = 30,cols = 30,rStart = 29,cStart = 29) == [[29, 29], [29, 28], [28, 28], [28, 29], [29, 27], [28, 27], [27, 27], [27, 28], [27, 29], [29, 26], [28, 26], [27, 26], [26, 26], [26, 27], [26, 28], [26, 29], [29, 25], [28, 25], [27, 25], [26, 25], [25, 25], [25, 26], [25, 27], [25, 28], [25, 29], [29, 24], [28, 24], [27, 24], [26, 24], [25, 24], [24, 24], [24, 25], [24, 26], [24, 27], [24, 28], [24, 29], [29, 23], [28, 23], [27, 23], [26, 23], [25, 23], [24, 23], [23, 23], [23, 24], [23, 25], [23, 26], [23, 27], [23, 28], [23, 29], [29, 22], [28, 22], [27, 22], [26, 22], [25, 22], [24, 22], [23, 22], [22, 22], [22, 23], [22, 24], [22, 25], [22, 26], [22, 27], [22, 28], [22, 29], [29, 21], [28, 21], [27, 21], [26, 21], [25, 21], [24, 21], [23, 21], [22, 21], [21, 21], [21, 22], [21, 23], [21, 24], [21, 25], [21, 26], [21, 27], [21, 28], [21, 29], [29, 20], [28, 20], [27, 20], [26, 20], [25, 20], [24, 20], [23, 20], [22, 20], [21, 20], [20, 20], [20, 21], [20, 22], [20, 23], [20, 24], [20, 25], [20, 26], [20, 27], [20, 28], [20, 29], [29, 19], [28, 19], [27, 19], [26, 19], [25, 19], [24, 19], [23, 19], [22, 19], [21, 19], [20, 19], [19, 19], [19, 20], [19, 21], [19, 22], [19, 23], [19, 24], [19, 25], [19, 26], [19, 27], [19, 28], [19, 29], [29, 18], [28, 18], [27, 18], [26, 18], [25, 18], [24, 18], [23, 18], [22, 18], [21, 18], [20, 18], [19, 18], [18, 18], [18, 19], [18, 20], [18, 21], [18, 22], [18, 23], [18, 24], [18, 25], [18, 26], [18, 27], [18, 28], [18, 29], [29, 17], [28, 17], [27, 17], [26, 17], [25, 17], [24, 17], [23, 17], [22, 17], [21, 17], [20, 17], [19, 17], [18, 17], [17, 17], [17, 18], [17, 19], [17, 20], [17, 21], [17, 22], [17, 23], [17, 24], [17, 25], [17, 26], [17, 27], [17, 28], [17, 29], [29, 16], [28, 16], [27, 16], [26, 16], [25, 16], [24, 16], [23, 16], [22, 16], [21, 16], [20, 16], [19, 16], [18, 16], [17, 16], [16, 16], [16, 17], [16, 18], [16, 19], [16, 20], [16, 21], [16, 22], [16, 23], [16, 24], [16, 25], [16, 26], [16, 27], [16, 28], [16, 29], [29, 15], [28, 15], [27, 15], [26, 15], [25, 15], [24, 15], [23, 15], [22, 15], [21, 15], [20, 15], [19, 15], [18, 15], [17, 15], [16, 15], [15, 15], [15, 16], [15, 17], [15, 18], [15, 19], [15, 20], [15, 21], [15, 22], [15, 23], [15, 24], [15, 25], [15, 26], [15, 27], [15, 28], [15, 29], [29, 14], [28, 14], [27, 14], [26, 14], [25, 14], [24, 14], [23, 14], [22, 14], [21, 14], [20, 14], [19, 14], [18, 14], [17, 14], [16, 14], [15, 14], [14, 14], [14, 15], [14, 16], [14, 17], [14, 18], [14, 19], [14, 20], [14, 21], [14, 22], [14, 23], [14, 24], [14, 25], [14, 26], [14, 27], [14, 28], [14, 29], [29, 13], [28, 13], [27, 13], [26, 13], [25, 13], [24, 13], [23, 13], [22, 13], [21, 13], [20, 13], [19, 13], [18, 13], [17, 13], [16, 13], [15, 13], [14, 13], [13, 13], [13, 14], [13, 15], [13, 16], [13, 17], [13, 18], [13, 19], [13, 20], [13, 21], [13, 22], [13, 23], [13, 24], [13, 25], [13, 26], [13, 27], [13, 28], [13, 29], [29, 12], [28, 12], [27, 12], [26, 12], [25, 12], [24, 12], [23, 12], [22, 12], [21, 12], [20, 12], [19, 12], [18, 12], [17, 12], [16, 12], [15, 12], [14, 12], [13, 12], [12, 12], [12, 13], [12, 14], [12, 15], [12, 16], [12, 17], [12, 18], [12, 19], [12, 20], [12, 21], [12, 22], [12, 23], [12, 24], [12, 25], [12, 26], [12, 27], [12, 28], [12, 29], [29, 11], [28, 11], [27, 11], [26, 11], [25, 11], [24, 11], [23, 11], [22, 11], [21, 11], [20, 11], [19, 11], [18, 11], [17, 11], [16, 11], [15, 11], [14, 11], [13, 11], [12, 11], [11, 11], [11, 12], [11, 13], [11, 14], [11, 15], [11, 16], [11, 17], [11, 18], [11, 19], [11, 20], [11, 21], [11, 22], [11, 23], [11, 24], [11, 25], [11, 26], [11, 27], [11, 28], [11, 29], [29, 10], [28, 10], [27, 10], [26, 10], [25, 10], [24, 10], [23, 10], [22, 10], [21, 10], [20, 10], [19, 10], [18, 10], [17, 10], [16, 10], [15, 10], [14, 10], [13, 10], [12, 10], [11, 10], [10, 10], [10, 11], [10, 12], [10, 13], [10, 14], [10, 15], [10, 16], [10, 17], [10, 18], [10, 19], [10, 20], [10, 21], [10, 22], [10, 23], [10, 24], [10, 25], [10, 26], [10, 27], [10, 28], [10, 29], [29, 9], [28, 9], [27, 9], [26, 9], [25, 9], [24, 9], [23, 9], [22, 9], [21, 9], [20, 9], [19, 9], [18, 9], [17, 9], [16, 9], [15, 9], [14, 9], [13, 9], [12, 9], [11, 9], [10, 9], [9, 9], [9, 10], [9, 11], [9, 12], [9, 13], [9, 14], [9, 15], [9, 16], [9, 17], [9, 18], [9, 19], [9, 20], [9, 21], [9, 22], [9, 23], [9, 24], [9, 25], [9, 26], [9, 27], [9, 28], [9, 29], [29, 8], [28, 8], [27, 8], [26, 8], [25, 8], [24, 8], [23, 8], [22, 8], [21, 8], [20, 8], [19, 8], [18, 8], [17, 8], [16, 8], [15, 8], [14, 8], [13, 8], [12, 8], [11, 8], [10, 8], [9, 8], [8, 8], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [8, 14], [8, 15], [8, 16], [8, 17], [8, 18], [8, 19], [8, 20], [8, 21], [8, 22], [8, 23], [8, 24], [8, 25], [8, 26], [8, 27], [8, 28], [8, 29], [29, 7], [28, 7], [27, 7], [26, 7], [25, 7], [24, 7], [23, 7], [22, 7], [21, 7], [20, 7], [19, 7], [18, 7], [17, 7], [16, 7], [15, 7], [14, 7], [13, 7], [12, 7], [11, 7], [10, 7], [9, 7], [8, 7], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [7, 15], [7, 16], [7, 17], [7, 18], [7, 19], [7, 20], [7, 21], [7, 22], [7, 23], [7, 24], [7, 25], [7, 26], [7, 27], [7, 28], [7, 29], [29, 6], [28, 6], [27, 6], [26, 6], [25, 6], [24, 6], [23, 6], [22, 6], [21, 6], [20, 6], [19, 6], [18, 6], [17, 6], [16, 6], [15, 6], [14, 6], [13, 6], [12, 6], [11, 6], [10, 6], [9, 6], [8, 6], [7, 6], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [6, 14], [6, 15], [6, 16], [6, 17], [6, 18], [6, 19], [6, 20], [6, 21], [6, 22], [6, 23], [6, 24], [6, 25], [6, 26], [6, 27], [6, 28], [6, 29], [29, 5], [28, 5], [27, 5], [26, 5], [25, 5], [24, 5], [23, 5], [22, 5], [21, 5], [20, 5], [19, 5], [18, 5], [17, 5], [16, 5], [15, 5], [14, 5], [13, 5], [12, 5], [11, 5], [10, 5], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [5, 15], [5, 16], [5, 17], [5, 18], [5, 19], [5, 20], [5, 21], [5, 22], [5, 23], [5, 24], [5, 25], [5, 26], [5, 27], [5, 28], [5, 29], [29, 4], [28, 4], [27, 4], [26, 4], [25, 4], [24, 4], [23, 4], [22, 4], [21, 4], [20, 4], [19, 4], [18, 4], [17, 4], [16, 4], [15, 4], [14, 4], [13, 4], [12, 4], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [4, 15], [4, 16], [4, 17], [4, 18], [4, 19], [4, 20], [4, 21], [4, 22], [4, 23], [4, 24], [4, 25], [4, 26], [4, 27], [4, 28], [4, 29], [29, 3], [28, 3], [27, 3], [26, 3], [25, 3], [24, 3], [23, 3], [22, 3], [21, 3], [20, 3], [19, 3], [18, 3], [17, 3], [16, 3], [15, 3], [14, 3], [13, 3], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [3, 15], [3, 16], [3, 17], [3, 18], [3, 19], [3, 20], [3, 21], [3, 22], [3, 23], [3, 24], [3, 25], [3, 26], [3, 27], [3, 28], [3, 29], [29, 2], [28, 2], [27, 2], [26, 2], [25, 2], [24, 2], [23, 2], [22, 2], [21, 2], [20, 2], [19, 2], [18, 2], [17, 2], [16, 2], [15, 2], [14, 2], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [2, 16], [2, 17], [2, 18], [2, 19], [2, 20], [2, 21], [2, 22], [2, 23], [2, 24], [2, 25], [2, 26], [2, 27], [2, 28], [2, 29], [29, 1], [28, 1], [27, 1], [26, 1], [25, 1], [24, 1], [23, 1], [22, 1], [21, 1], [20, 1], [19, 1], [18, 1], [17, 1], [16, 1], [15, 1], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [1, 24], [1, 25], [1, 26], [1, 27], [1, 28], [1, 29], [29, 0], [28, 0], [27, 0], [26, 0], [25, 0], [24, 0], [23, 0], [22, 0], [21, 0], [20, 0], [19, 0], [18, 0], [17, 0], [16, 0], [15, 0], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29]]\n assert candidate(rows = 20,cols = 10,rStart = 15,cStart = 5) == [[15, 5], [15, 6], [16, 6], [16, 5], [16, 4], [15, 4], [14, 4], [14, 5], [14, 6], [14, 7], [15, 7], [16, 7], [17, 7], [17, 6], [17, 5], [17, 4], [17, 3], [16, 3], [15, 3], [14, 3], [13, 3], [13, 4], [13, 5], [13, 6], [13, 7], [13, 8], [14, 8], [15, 8], [16, 8], [17, 8], [18, 8], [18, 7], [18, 6], [18, 5], [18, 4], [18, 3], [18, 2], [17, 2], [16, 2], [15, 2], [14, 2], [13, 2], [12, 2], [12, 3], [12, 4], [12, 5], [12, 6], [12, 7], [12, 8], [12, 9], [13, 9], [14, 9], [15, 9], [16, 9], [17, 9], [18, 9], [19, 9], [19, 8], [19, 7], [19, 6], [19, 5], [19, 4], [19, 3], [19, 2], [19, 1], [18, 1], [17, 1], [16, 1], [15, 1], [14, 1], [13, 1], [12, 1], [11, 1], [11, 2], [11, 3], [11, 4], [11, 5], [11, 6], [11, 7], [11, 8], [11, 9], [19, 0], [18, 0], [17, 0], [16, 0], [15, 0], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 6], [10, 7], [10, 8], [10, 9], [9, 0], [9, 1], [9, 2], [9, 3], [9, 4], [9, 5], [9, 6], [9, 7], [9, 8], [9, 9], [8, 0], [8, 1], [8, 2], [8, 3], [8, 4], [8, 5], [8, 6], [8, 7], [8, 8], [8, 9], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6], [7, 7], [7, 8], [7, 9], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6], [6, 7], [6, 8], [6, 9], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9]]\n assert candidate(rows = 4,cols = 8,rStart = 2,cStart = 3) == [[2, 3], [2, 4], [3, 4], [3, 3], [3, 2], [2, 2], [1, 2], [1, 3], [1, 4], [1, 5], [2, 5], [3, 5], [3, 1], [2, 1], [1, 1], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 6], [2, 6], [3, 6], [3, 0], [2, 0], [1, 0], [0, 0], [0, 7], [1, 7], [2, 7], [3, 7]]\n assert candidate(rows = 9,cols = 6,rStart = 4,cStart = 2) == [[4, 2], [4, 3], [5, 3], [5, 2], [5, 1], [4, 1], [3, 1], [3, 2], [3, 3], [3, 4], [4, 4], [5, 4], [6, 4], [6, 3], [6, 2], [6, 1], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [3, 5], [4, 5], [5, 5], [6, 5], [7, 5], [7, 4], [7, 3], [7, 2], [7, 1], [7, 0], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [8, 5], [8, 4], [8, 3], [8, 2], [8, 1], [8, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]\n assert candidate(rows = 14,cols = 14,rStart = 13,cStart = 13) == [[13, 13], [13, 12], [12, 12], [12, 13], [13, 11], [12, 11], [11, 11], [11, 12], [11, 13], [13, 10], [12, 10], [11, 10], [10, 10], [10, 11], [10, 12], [10, 13], [13, 9], [12, 9], [11, 9], [10, 9], [9, 9], [9, 10], [9, 11], [9, 12], [9, 13], [13, 8], [12, 8], [11, 8], [10, 8], [9, 8], [8, 8], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [13, 7], [12, 7], [11, 7], [10, 7], [9, 7], [8, 7], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [13, 6], [12, 6], [11, 6], [10, 6], [9, 6], [8, 6], [7, 6], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [13, 5], [12, 5], [11, 5], [10, 5], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [13, 4], [12, 4], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [13, 3], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13]]\n assert candidate(rows = 7,cols = 7,rStart = 3,cStart = 3) == [[3, 3], [3, 4], [4, 4], [4, 3], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [3, 5], [4, 5], [5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [6, 6], [6, 5], [6, 4], [6, 3], [6, 2], [6, 1], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6]]\n assert candidate(rows = 15,cols = 20,rStart = 14,cStart = 0) == [[14, 0], [14, 1], [13, 0], [13, 1], [13, 2], [14, 2], [12, 0], [12, 1], [12, 2], [12, 3], [13, 3], [14, 3], [11, 0], [11, 1], [11, 2], [11, 3], [11, 4], [12, 4], [13, 4], [14, 4], [10, 0], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [11, 5], [12, 5], [13, 5], [14, 5], [9, 0], [9, 1], [9, 2], [9, 3], [9, 4], [9, 5], [9, 6], [10, 6], [11, 6], [12, 6], [13, 6], [14, 6], [8, 0], [8, 1], [8, 2], [8, 3], [8, 4], [8, 5], [8, 6], [8, 7], [9, 7], [10, 7], [11, 7], [12, 7], [13, 7], [14, 7], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6], [7, 7], [7, 8], [8, 8], [9, 8], [10, 8], [11, 8], [12, 8], [13, 8], [14, 8], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6], [6, 7], [6, 8], [6, 9], [7, 9], [8, 9], [9, 9], [10, 9], [11, 9], [12, 9], [13, 9], [14, 9], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10], [10, 10], [11, 10], [12, 10], [13, 10], [14, 10], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [5, 11], [6, 11], [7, 11], [8, 11], [9, 11], [10, 11], [11, 11], [12, 11], [13, 11], [14, 11], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [4, 12], [5, 12], [6, 12], [7, 12], [8, 12], [9, 12], [10, 12], [11, 12], [12, 12], [13, 12], [14, 12], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [3, 13], [4, 13], [5, 13], [6, 13], [7, 13], [8, 13], [9, 13], [10, 13], [11, 13], [12, 13], [13, 13], [14, 13], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 14], [3, 14], [4, 14], [5, 14], [6, 14], [7, 14], [8, 14], [9, 14], [10, 14], [11, 14], [12, 14], [13, 14], [14, 14], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [1, 15], [2, 15], [3, 15], [4, 15], [5, 15], [6, 15], [7, 15], [8, 15], [9, 15], [10, 15], [11, 15], [12, 15], [13, 15], [14, 15], [0, 16], [1, 16], [2, 16], [3, 16], [4, 16], [5, 16], [6, 16], [7, 16], [8, 16], [9, 16], [10, 16], [11, 16], [12, 16], [13, 16], [14, 16], [0, 17], [1, 17], [2, 17], [3, 17], [4, 17], [5, 17], [6, 17], [7, 17], [8, 17], [9, 17], [10, 17], [11, 17], [12, 17], [13, 17], [14, 17], [0, 18], [1, 18], [2, 18], [3, 18], [4, 18], [5, 18], [6, 18], [7, 18], [8, 18], [9, 18], [10, 18], [11, 18], [12, 18], [13, 18], [14, 18], [0, 19], [1, 19], [2, 19], [3, 19], [4, 19], [5, 19], [6, 19], [7, 19], [8, 19], [9, 19], [10, 19], [11, 19], [12, 19], [13, 19], [14, 19]]\n assert candidate(rows = 9,cols = 18,rStart = 4,cStart = 8) == [[4, 8], [4, 9], [5, 9], [5, 8], [5, 7], [4, 7], [3, 7], [3, 8], [3, 9], [3, 10], [4, 10], [5, 10], [6, 10], [6, 9], [6, 8], [6, 7], [6, 6], [5, 6], [4, 6], [3, 6], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [3, 11], [4, 11], [5, 11], [6, 11], [7, 11], [7, 10], [7, 9], [7, 8], [7, 7], [7, 6], [7, 5], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [2, 12], [3, 12], [4, 12], [5, 12], [6, 12], [7, 12], [8, 12], [8, 11], [8, 10], [8, 9], [8, 8], [8, 7], [8, 6], [8, 5], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [3, 4], [2, 4], [1, 4], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [1, 13], [2, 13], [3, 13], [4, 13], [5, 13], [6, 13], [7, 13], [8, 13], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [2, 3], [1, 3], [0, 3], [0, 14], [1, 14], [2, 14], [3, 14], [4, 14], [5, 14], [6, 14], [7, 14], [8, 14], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [0, 15], [1, 15], [2, 15], [3, 15], [4, 15], [5, 15], [6, 15], [7, 15], [8, 15], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [0, 16], [1, 16], [2, 16], [3, 16], [4, 16], [5, 16], [6, 16], [7, 16], [8, 16], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 17], [1, 17], [2, 17], [3, 17], [4, 17], [5, 17], [6, 17], [7, 17], [8, 17]]\n assert candidate(rows = 8,cols = 5,rStart = 2,cStart = 2) == [[2, 2], [2, 3], [3, 3], [3, 2], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [2, 4], [3, 4], [4, 4], [4, 3], [4, 2], [4, 1], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [5, 4], [5, 3], [5, 2], [5, 1], [5, 0], [6, 4], [6, 3], [6, 2], [6, 1], [6, 0], [7, 4], [7, 3], [7, 2], [7, 1], [7, 0]]\n assert candidate(rows = 8,cols = 3,rStart = 2,cStart = 1) == [[2, 1], [2, 2], [3, 2], [3, 1], [3, 0], [2, 0], [1, 0], [1, 1], [1, 2], [4, 2], [4, 1], [4, 0], [0, 0], [0, 1], [0, 2], [5, 2], [5, 1], [5, 0], [6, 2], [6, 1], [6, 0], [7, 2], [7, 1], [7, 0]]\n assert candidate(rows = 25,cols = 25,rStart = 12,cStart = 12) == [[12, 12], [12, 13], [13, 13], [13, 12], [13, 11], [12, 11], [11, 11], [11, 12], [11, 13], [11, 14], [12, 14], [13, 14], [14, 14], [14, 13], [14, 12], [14, 11], [14, 10], [13, 10], [12, 10], [11, 10], [10, 10], [10, 11], [10, 12], [10, 13], [10, 14], [10, 15], [11, 15], [12, 15], [13, 15], [14, 15], [15, 15], [15, 14], [15, 13], [15, 12], [15, 11], [15, 10], [15, 9], [14, 9], [13, 9], [12, 9], [11, 9], [10, 9], [9, 9], [9, 10], [9, 11], [9, 12], [9, 13], [9, 14], [9, 15], [9, 16], [10, 16], [11, 16], [12, 16], [13, 16], [14, 16], [15, 16], [16, 16], [16, 15], [16, 14], [16, 13], [16, 12], [16, 11], [16, 10], [16, 9], [16, 8], [15, 8], [14, 8], [13, 8], [12, 8], [11, 8], [10, 8], [9, 8], [8, 8], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [8, 14], [8, 15], [8, 16], [8, 17], [9, 17], [10, 17], [11, 17], [12, 17], [13, 17], [14, 17], [15, 17], [16, 17], [17, 17], [17, 16], [17, 15], [17, 14], [17, 13], [17, 12], [17, 11], [17, 10], [17, 9], [17, 8], [17, 7], [16, 7], [15, 7], [14, 7], [13, 7], [12, 7], [11, 7], [10, 7], [9, 7], [8, 7], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [7, 15], [7, 16], [7, 17], [7, 18], [8, 18], [9, 18], [10, 18], [11, 18], [12, 18], [13, 18], [14, 18], [15, 18], [16, 18], [17, 18], [18, 18], [18, 17], [18, 16], [18, 15], [18, 14], [18, 13], [18, 12], [18, 11], [18, 10], [18, 9], [18, 8], [18, 7], [18, 6], [17, 6], [16, 6], [15, 6], [14, 6], [13, 6], [12, 6], [11, 6], [10, 6], [9, 6], [8, 6], [7, 6], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [6, 14], [6, 15], [6, 16], [6, 17], [6, 18], [6, 19], [7, 19], [8, 19], [9, 19], [10, 19], [11, 19], [12, 19], [13, 19], [14, 19], [15, 19], [16, 19], [17, 19], [18, 19], [19, 19], [19, 18], [19, 17], [19, 16], [19, 15], [19, 14], [19, 13], [19, 12], [19, 11], [19, 10], [19, 9], [19, 8], [19, 7], [19, 6], [19, 5], [18, 5], [17, 5], [16, 5], [15, 5], [14, 5], [13, 5], [12, 5], [11, 5], [10, 5], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [5, 15], [5, 16], [5, 17], [5, 18], [5, 19], [5, 20], [6, 20], [7, 20], [8, 20], [9, 20], [10, 20], [11, 20], [12, 20], [13, 20], [14, 20], [15, 20], [16, 20], [17, 20], [18, 20], [19, 20], [20, 20], [20, 19], [20, 18], [20, 17], [20, 16], [20, 15], [20, 14], [20, 13], [20, 12], [20, 11], [20, 10], [20, 9], [20, 8], [20, 7], [20, 6], [20, 5], [20, 4], [19, 4], [18, 4], [17, 4], [16, 4], [15, 4], [14, 4], [13, 4], [12, 4], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [4, 15], [4, 16], [4, 17], [4, 18], [4, 19], [4, 20], [4, 21], [5, 21], [6, 21], [7, 21], [8, 21], [9, 21], [10, 21], [11, 21], [12, 21], [13, 21], [14, 21], [15, 21], [16, 21], [17, 21], [18, 21], [19, 21], [20, 21], [21, 21], [21, 20], [21, 19], [21, 18], [21, 17], [21, 16], [21, 15], [21, 14], [21, 13], [21, 12], [21, 11], [21, 10], [21, 9], [21, 8], [21, 7], [21, 6], [21, 5], [21, 4], [21, 3], [20, 3], [19, 3], [18, 3], [17, 3], [16, 3], [15, 3], [14, 3], [13, 3], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [3, 15], [3, 16], [3, 17], [3, 18], [3, 19], [3, 20], [3, 21], [3, 22], [4, 22], [5, 22], [6, 22], [7, 22], [8, 22], [9, 22], [10, 22], [11, 22], [12, 22], [13, 22], [14, 22], [15, 22], [16, 22], [17, 22], [18, 22], [19, 22], [20, 22], [21, 22], [22, 22], [22, 21], [22, 20], [22, 19], [22, 18], [22, 17], [22, 16], [22, 15], [22, 14], [22, 13], [22, 12], [22, 11], [22, 10], [22, 9], [22, 8], [22, 7], [22, 6], [22, 5], [22, 4], [22, 3], [22, 2], [21, 2], [20, 2], [19, 2], [18, 2], [17, 2], [16, 2], [15, 2], [14, 2], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [2, 16], [2, 17], [2, 18], [2, 19], [2, 20], [2, 21], [2, 22], [2, 23], [3, 23], [4, 23], [5, 23], [6, 23], [7, 23], [8, 23], [9, 23], [10, 23], [11, 23], [12, 23], [13, 23], [14, 23], [15, 23], [16, 23], [17, 23], [18, 23], [19, 23], [20, 23], [21, 23], [22, 23], [23, 23], [23, 22], [23, 21], [23, 20], [23, 19], [23, 18], [23, 17], [23, 16], [23, 15], [23, 14], [23, 13], [23, 12], [23, 11], [23, 10], [23, 9], [23, 8], [23, 7], [23, 6], [23, 5], [23, 4], [23, 3], [23, 2], [23, 1], [22, 1], [21, 1], [20, 1], [19, 1], [18, 1], [17, 1], [16, 1], [15, 1], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [1, 24], [2, 24], [3, 24], [4, 24], [5, 24], [6, 24], [7, 24], [8, 24], [9, 24], [10, 24], [11, 24], [12, 24], [13, 24], [14, 24], [15, 24], [16, 24], [17, 24], [18, 24], [19, 24], [20, 24], [21, 24], [22, 24], [23, 24], [24, 24], [24, 23], [24, 22], [24, 21], [24, 20], [24, 19], [24, 18], [24, 17], [24, 16], [24, 15], [24, 14], [24, 13], [24, 12], [24, 11], [24, 10], [24, 9], [24, 8], [24, 7], [24, 6], [24, 5], [24, 4], [24, 3], [24, 2], [24, 1], [24, 0], [23, 0], [22, 0], [21, 0], [20, 0], [19, 0], [18, 0], [17, 0], [16, 0], [15, 0], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24]]\n assert candidate(rows = 12,cols = 12,rStart = 6,cStart = 6) == [[6, 6], [6, 7], [7, 7], [7, 6], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [6, 8], [7, 8], [8, 8], [8, 7], [8, 6], [8, 5], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [5, 9], [6, 9], [7, 9], [8, 9], [9, 9], [9, 8], [9, 7], [9, 6], [9, 5], [9, 4], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10], [10, 10], [10, 9], [10, 8], [10, 7], [10, 6], [10, 5], [10, 4], [10, 3], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [3, 11], [4, 11], [5, 11], [6, 11], [7, 11], [8, 11], [9, 11], [10, 11], [11, 11], [11, 10], [11, 9], [11, 8], [11, 7], [11, 6], [11, 5], [11, 4], [11, 3], [11, 2], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11]]\n assert candidate(rows = 12,cols = 7,rStart = 6,cStart = 3) == [[6, 3], [6, 4], [7, 4], [7, 3], [7, 2], [6, 2], [5, 2], [5, 3], [5, 4], [5, 5], [6, 5], [7, 5], [8, 5], [8, 4], [8, 3], [8, 2], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [5, 6], [6, 6], [7, 6], [8, 6], [9, 6], [9, 5], [9, 4], [9, 3], [9, 2], [9, 1], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [10, 6], [10, 5], [10, 4], [10, 3], [10, 2], [10, 1], [10, 0], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [11, 6], [11, 5], [11, 4], [11, 3], [11, 2], [11, 1], [11, 0], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6]]\n assert candidate(rows = 8,cols = 5,rStart = 0,cStart = 4) == [[0, 4], [1, 4], [1, 3], [0, 3], [2, 4], [2, 3], [2, 2], [1, 2], [0, 2], [3, 4], [3, 3], [3, 2], [3, 1], [2, 1], [1, 1], [0, 1], [4, 4], [4, 3], [4, 2], [4, 1], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [5, 4], [5, 3], [5, 2], [5, 1], [5, 0], [6, 4], [6, 3], [6, 2], [6, 1], [6, 0], [7, 4], [7, 3], [7, 2], [7, 1], [7, 0]]\n assert candidate(rows = 7,cols = 7,rStart = 3,cStart = 4) == [[3, 4], [3, 5], [4, 5], [4, 4], [4, 3], [3, 3], [2, 3], [2, 4], [2, 5], [2, 6], [3, 6], [4, 6], [5, 6], [5, 5], [5, 4], [5, 3], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [6, 6], [6, 5], [6, 4], [6, 3], [6, 2], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 12,cols = 15,rStart = 0,cStart = 14) == [[0, 14], [1, 14], [1, 13], [0, 13], [2, 14], [2, 13], [2, 12], [1, 12], [0, 12], [3, 14], [3, 13], [3, 12], [3, 11], [2, 11], [1, 11], [0, 11], [4, 14], [4, 13], [4, 12], [4, 11], [4, 10], [3, 10], [2, 10], [1, 10], [0, 10], [5, 14], [5, 13], [5, 12], [5, 11], [5, 10], [5, 9], [4, 9], [3, 9], [2, 9], [1, 9], [0, 9], [6, 14], [6, 13], [6, 12], [6, 11], [6, 10], [6, 9], [6, 8], [5, 8], [4, 8], [3, 8], [2, 8], [1, 8], [0, 8], [7, 14], [7, 13], [7, 12], [7, 11], [7, 10], [7, 9], [7, 8], [7, 7], [6, 7], [5, 7], [4, 7], [3, 7], [2, 7], [1, 7], [0, 7], [8, 14], [8, 13], [8, 12], [8, 11], [8, 10], [8, 9], [8, 8], [8, 7], [8, 6], [7, 6], [6, 6], [5, 6], [4, 6], [3, 6], [2, 6], [1, 6], [0, 6], [9, 14], [9, 13], [9, 12], [9, 11], [9, 10], [9, 9], [9, 8], [9, 7], [9, 6], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5], [0, 5], [10, 14], [10, 13], [10, 12], [10, 11], [10, 10], [10, 9], [10, 8], [10, 7], [10, 6], [10, 5], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [3, 4], [2, 4], [1, 4], [0, 4], [11, 14], [11, 13], [11, 12], [11, 11], [11, 10], [11, 9], [11, 8], [11, 7], [11, 6], [11, 5], [11, 4], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [2, 3], [1, 3], [0, 3], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 3,cols = 7,rStart = 1,cStart = 3) == [[1, 3], [1, 4], [2, 4], [2, 3], [2, 2], [1, 2], [0, 2], [0, 3], [0, 4], [0, 5], [1, 5], [2, 5], [2, 1], [1, 1], [0, 1], [0, 6], [1, 6], [2, 6], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 11,cols = 11,rStart = 2,cStart = 2) == [[2, 2], [2, 3], [3, 3], [3, 2], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [2, 4], [3, 4], [4, 4], [4, 3], [4, 2], [4, 1], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [5, 0], [0, 6], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [6, 6], [6, 5], [6, 4], [6, 3], [6, 2], [6, 1], [6, 0], [0, 7], [1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7], [7, 6], [7, 5], [7, 4], [7, 3], [7, 2], [7, 1], [7, 0], [0, 8], [1, 8], [2, 8], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8], [8, 8], [8, 7], [8, 6], [8, 5], [8, 4], [8, 3], [8, 2], [8, 1], [8, 0], [0, 9], [1, 9], [2, 9], [3, 9], [4, 9], [5, 9], [6, 9], [7, 9], [8, 9], [9, 9], [9, 8], [9, 7], [9, 6], [9, 5], [9, 4], [9, 3], [9, 2], [9, 1], [9, 0], [0, 10], [1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10], [10, 10], [10, 9], [10, 8], [10, 7], [10, 6], [10, 5], [10, 4], [10, 3], [10, 2], [10, 1], [10, 0]]\n assert candidate(rows = 8,cols = 3,rStart = 4,cStart = 1) == [[4, 1], [4, 2], [5, 2], [5, 1], [5, 0], [4, 0], [3, 0], [3, 1], [3, 2], [6, 2], [6, 1], [6, 0], [2, 0], [2, 1], [2, 2], [7, 2], [7, 1], [7, 0], [1, 0], [1, 1], [1, 2], [0, 0], [0, 1], [0, 2]]\n assert candidate(rows = 1,cols = 10,rStart = 0,cStart = 5) == [[0, 5], [0, 6], [0, 4], [0, 7], [0, 3], [0, 8], [0, 2], [0, 9], [0, 1], [0, 0]]\n assert candidate(rows = 20,cols = 15,rStart = 0,cStart = 14) == [[0, 14], [1, 14], [1, 13], [0, 13], [2, 14], [2, 13], [2, 12], [1, 12], [0, 12], [3, 14], [3, 13], [3, 12], [3, 11], [2, 11], [1, 11], [0, 11], [4, 14], [4, 13], [4, 12], [4, 11], [4, 10], [3, 10], [2, 10], [1, 10], [0, 10], [5, 14], [5, 13], [5, 12], [5, 11], [5, 10], [5, 9], [4, 9], [3, 9], [2, 9], [1, 9], [0, 9], [6, 14], [6, 13], [6, 12], [6, 11], [6, 10], [6, 9], [6, 8], [5, 8], [4, 8], [3, 8], [2, 8], [1, 8], [0, 8], [7, 14], [7, 13], [7, 12], [7, 11], [7, 10], [7, 9], [7, 8], [7, 7], [6, 7], [5, 7], [4, 7], [3, 7], [2, 7], [1, 7], [0, 7], [8, 14], [8, 13], [8, 12], [8, 11], [8, 10], [8, 9], [8, 8], [8, 7], [8, 6], [7, 6], [6, 6], [5, 6], [4, 6], [3, 6], [2, 6], [1, 6], [0, 6], [9, 14], [9, 13], [9, 12], [9, 11], [9, 10], [9, 9], [9, 8], [9, 7], [9, 6], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5], [0, 5], [10, 14], [10, 13], [10, 12], [10, 11], [10, 10], [10, 9], [10, 8], [10, 7], [10, 6], [10, 5], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [3, 4], [2, 4], [1, 4], [0, 4], [11, 14], [11, 13], [11, 12], [11, 11], [11, 10], [11, 9], [11, 8], [11, 7], [11, 6], [11, 5], [11, 4], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [2, 3], [1, 3], [0, 3], [12, 14], [12, 13], [12, 12], [12, 11], [12, 10], [12, 9], [12, 8], [12, 7], [12, 6], [12, 5], [12, 4], [12, 3], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [13, 14], [13, 13], [13, 12], [13, 11], [13, 10], [13, 9], [13, 8], [13, 7], [13, 6], [13, 5], [13, 4], [13, 3], [13, 2], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [14, 14], [14, 13], [14, 12], [14, 11], [14, 10], [14, 9], [14, 8], [14, 7], [14, 6], [14, 5], [14, 4], [14, 3], [14, 2], [14, 1], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [15, 14], [15, 13], [15, 12], [15, 11], [15, 10], [15, 9], [15, 8], [15, 7], [15, 6], [15, 5], [15, 4], [15, 3], [15, 2], [15, 1], [15, 0], [16, 14], [16, 13], [16, 12], [16, 11], [16, 10], [16, 9], [16, 8], [16, 7], [16, 6], [16, 5], [16, 4], [16, 3], [16, 2], [16, 1], [16, 0], [17, 14], [17, 13], [17, 12], [17, 11], [17, 10], [17, 9], [17, 8], [17, 7], [17, 6], [17, 5], [17, 4], [17, 3], [17, 2], [17, 1], [17, 0], [18, 14], [18, 13], [18, 12], [18, 11], [18, 10], [18, 9], [18, 8], [18, 7], [18, 6], [18, 5], [18, 4], [18, 3], [18, 2], [18, 1], [18, 0], [19, 14], [19, 13], [19, 12], [19, 11], [19, 10], [19, 9], [19, 8], [19, 7], [19, 6], [19, 5], [19, 4], [19, 3], [19, 2], [19, 1], [19, 0]]\n assert candidate(rows = 20,cols = 10,rStart = 10,cStart = 5) == [[10, 5], [10, 6], [11, 6], [11, 5], [11, 4], [10, 4], [9, 4], [9, 5], [9, 6], [9, 7], [10, 7], [11, 7], [12, 7], [12, 6], [12, 5], [12, 4], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [8, 4], [8, 5], [8, 6], [8, 7], [8, 8], [9, 8], [10, 8], [11, 8], [12, 8], [13, 8], [13, 7], [13, 6], [13, 5], [13, 4], [13, 3], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6], [7, 7], [7, 8], [7, 9], [8, 9], [9, 9], [10, 9], [11, 9], [12, 9], [13, 9], [14, 9], [14, 8], [14, 7], [14, 6], [14, 5], [14, 4], [14, 3], [14, 2], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6], [6, 7], [6, 8], [6, 9], [15, 9], [15, 8], [15, 7], [15, 6], [15, 5], [15, 4], [15, 3], [15, 2], [15, 1], [15, 0], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [16, 9], [16, 8], [16, 7], [16, 6], [16, 5], [16, 4], [16, 3], [16, 2], [16, 1], [16, 0], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [17, 9], [17, 8], [17, 7], [17, 6], [17, 5], [17, 4], [17, 3], [17, 2], [17, 1], [17, 0], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [18, 9], [18, 8], [18, 7], [18, 6], [18, 5], [18, 4], [18, 3], [18, 2], [18, 1], [18, 0], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [19, 9], [19, 8], [19, 7], [19, 6], [19, 5], [19, 4], [19, 3], [19, 2], [19, 1], [19, 0], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9]]\n assert candidate(rows = 6,cols = 6,rStart = 3,cStart = 3) == [[3, 3], [3, 4], [4, 4], [4, 3], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [3, 5], [4, 5], [5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]\n assert candidate(rows = 9,cols = 7,rStart = 2,cStart = 3) == [[2, 3], [2, 4], [3, 4], [3, 3], [3, 2], [2, 2], [1, 2], [1, 3], [1, 4], [1, 5], [2, 5], [3, 5], [4, 5], [4, 4], [4, 3], [4, 2], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [6, 6], [6, 5], [6, 4], [6, 3], [6, 2], [6, 1], [6, 0], [7, 6], [7, 5], [7, 4], [7, 3], [7, 2], [7, 1], [7, 0], [8, 6], [8, 5], [8, 4], [8, 3], [8, 2], [8, 1], [8, 0]]\n assert candidate(rows = 18,cols = 18,rStart = 17,cStart = 0) == [[17, 0], [17, 1], [16, 0], [16, 1], [16, 2], [17, 2], [15, 0], [15, 1], [15, 2], [15, 3], [16, 3], [17, 3], [14, 0], [14, 1], [14, 2], [14, 3], [14, 4], [15, 4], [16, 4], [17, 4], [13, 0], [13, 1], [13, 2], [13, 3], [13, 4], [13, 5], [14, 5], [15, 5], [16, 5], [17, 5], [12, 0], [12, 1], [12, 2], [12, 3], [12, 4], [12, 5], [12, 6], [13, 6], [14, 6], [15, 6], [16, 6], [17, 6], [11, 0], [11, 1], [11, 2], [11, 3], [11, 4], [11, 5], [11, 6], [11, 7], [12, 7], [13, 7], [14, 7], [15, 7], [16, 7], [17, 7], [10, 0], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 6], [10, 7], [10, 8], [11, 8], [12, 8], [13, 8], [14, 8], [15, 8], [16, 8], [17, 8], [9, 0], [9, 1], [9, 2], [9, 3], [9, 4], [9, 5], [9, 6], [9, 7], [9, 8], [9, 9], [10, 9], [11, 9], [12, 9], [13, 9], [14, 9], [15, 9], [16, 9], [17, 9], [8, 0], [8, 1], [8, 2], [8, 3], [8, 4], [8, 5], [8, 6], [8, 7], [8, 8], [8, 9], [8, 10], [9, 10], [10, 10], [11, 10], [12, 10], [13, 10], [14, 10], [15, 10], [16, 10], [17, 10], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [8, 11], [9, 11], [10, 11], [11, 11], [12, 11], [13, 11], [14, 11], [15, 11], [16, 11], [17, 11], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [7, 12], [8, 12], [9, 12], [10, 12], [11, 12], [12, 12], [13, 12], [14, 12], [15, 12], [16, 12], [17, 12], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [6, 13], [7, 13], [8, 13], [9, 13], [10, 13], [11, 13], [12, 13], [13, 13], [14, 13], [15, 13], [16, 13], [17, 13], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [5, 14], [6, 14], [7, 14], [8, 14], [9, 14], [10, 14], [11, 14], [12, 14], [13, 14], [14, 14], [15, 14], [16, 14], [17, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [3, 15], [4, 15], [5, 15], [6, 15], [7, 15], [8, 15], [9, 15], [10, 15], [11, 15], [12, 15], [13, 15], [14, 15], [15, 15], [16, 15], [17, 15], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [2, 16], [3, 16], [4, 16], [5, 16], [6, 16], [7, 16], [8, 16], [9, 16], [10, 16], [11, 16], [12, 16], [13, 16], [14, 16], [15, 16], [16, 16], [17, 16], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [2, 17], [3, 17], [4, 17], [5, 17], [6, 17], [7, 17], [8, 17], [9, 17], [10, 17], [11, 17], [12, 17], [13, 17], [14, 17], [15, 17], [16, 17], [17, 17], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17]]\n assert candidate(rows = 8,cols = 7,rStart = 2,cStart = 3) == [[2, 3], [2, 4], [3, 4], [3, 3], [3, 2], [2, 2], [1, 2], [1, 3], [1, 4], [1, 5], [2, 5], [3, 5], [4, 5], [4, 4], [4, 3], [4, 2], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [6, 6], [6, 5], [6, 4], [6, 3], [6, 2], [6, 1], [6, 0], [7, 6], [7, 5], [7, 4], [7, 3], [7, 2], [7, 1], [7, 0]]\n assert candidate(rows = 4,cols = 4,rStart = 1,cStart = 1) == [[1, 1], [1, 2], [2, 2], [2, 1], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [1, 3], [2, 3], [3, 3], [3, 2], [3, 1], [3, 0]]\n assert candidate(rows = 9,cols = 13,rStart = 4,cStart = 12) == [[4, 12], [5, 12], [5, 11], [4, 11], [3, 11], [3, 12], [6, 12], [6, 11], [6, 10], [5, 10], [4, 10], [3, 10], [2, 10], [2, 11], [2, 12], [7, 12], [7, 11], [7, 10], [7, 9], [6, 9], [5, 9], [4, 9], [3, 9], [2, 9], [1, 9], [1, 10], [1, 11], [1, 12], [8, 12], [8, 11], [8, 10], [8, 9], [8, 8], [7, 8], [6, 8], [5, 8], [4, 8], [3, 8], [2, 8], [1, 8], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [8, 7], [7, 7], [6, 7], [5, 7], [4, 7], [3, 7], [2, 7], [1, 7], [0, 7], [8, 6], [7, 6], [6, 6], [5, 6], [4, 6], [3, 6], [2, 6], [1, 6], [0, 6], [8, 5], [7, 5], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5], [0, 5], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [3, 4], [2, 4], [1, 4], [0, 4], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [2, 3], [1, 3], [0, 3], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 15,cols = 10,rStart = 7,cStart = 5) == [[7, 5], [7, 6], [8, 6], [8, 5], [8, 4], [7, 4], [6, 4], [6, 5], [6, 6], [6, 7], [7, 7], [8, 7], [9, 7], [9, 6], [9, 5], [9, 4], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [6, 8], [7, 8], [8, 8], [9, 8], [10, 8], [10, 7], [10, 6], [10, 5], [10, 4], [10, 3], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [5, 9], [6, 9], [7, 9], [8, 9], [9, 9], [10, 9], [11, 9], [11, 8], [11, 7], [11, 6], [11, 5], [11, 4], [11, 3], [11, 2], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [12, 9], [12, 8], [12, 7], [12, 6], [12, 5], [12, 4], [12, 3], [12, 2], [12, 1], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [13, 9], [13, 8], [13, 7], [13, 6], [13, 5], [13, 4], [13, 3], [13, 2], [13, 1], [13, 0], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [14, 9], [14, 8], [14, 7], [14, 6], [14, 5], [14, 4], [14, 3], [14, 2], [14, 1], [14, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9]]\n assert candidate(rows = 20,cols = 20,rStart = 10,cStart = 10) == [[10, 10], [10, 11], [11, 11], [11, 10], [11, 9], [10, 9], [9, 9], [9, 10], [9, 11], [9, 12], [10, 12], [11, 12], [12, 12], [12, 11], [12, 10], [12, 9], [12, 8], [11, 8], [10, 8], [9, 8], [8, 8], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [9, 13], [10, 13], [11, 13], [12, 13], [13, 13], [13, 12], [13, 11], [13, 10], [13, 9], [13, 8], [13, 7], [12, 7], [11, 7], [10, 7], [9, 7], [8, 7], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [8, 14], [9, 14], [10, 14], [11, 14], [12, 14], [13, 14], [14, 14], [14, 13], [14, 12], [14, 11], [14, 10], [14, 9], [14, 8], [14, 7], [14, 6], [13, 6], [12, 6], [11, 6], [10, 6], [9, 6], [8, 6], [7, 6], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [6, 14], [6, 15], [7, 15], [8, 15], [9, 15], [10, 15], [11, 15], [12, 15], [13, 15], [14, 15], [15, 15], [15, 14], [15, 13], [15, 12], [15, 11], [15, 10], [15, 9], [15, 8], [15, 7], [15, 6], [15, 5], [14, 5], [13, 5], [12, 5], [11, 5], [10, 5], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [5, 15], [5, 16], [6, 16], [7, 16], [8, 16], [9, 16], [10, 16], [11, 16], [12, 16], [13, 16], [14, 16], [15, 16], [16, 16], [16, 15], [16, 14], [16, 13], [16, 12], [16, 11], [16, 10], [16, 9], [16, 8], [16, 7], [16, 6], [16, 5], [16, 4], [15, 4], [14, 4], [13, 4], [12, 4], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [4, 15], [4, 16], [4, 17], [5, 17], [6, 17], [7, 17], [8, 17], [9, 17], [10, 17], [11, 17], [12, 17], [13, 17], [14, 17], [15, 17], [16, 17], [17, 17], [17, 16], [17, 15], [17, 14], [17, 13], [17, 12], [17, 11], [17, 10], [17, 9], [17, 8], [17, 7], [17, 6], [17, 5], [17, 4], [17, 3], [16, 3], [15, 3], [14, 3], [13, 3], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [3, 15], [3, 16], [3, 17], [3, 18], [4, 18], [5, 18], [6, 18], [7, 18], [8, 18], [9, 18], [10, 18], [11, 18], [12, 18], [13, 18], [14, 18], [15, 18], [16, 18], [17, 18], [18, 18], [18, 17], [18, 16], [18, 15], [18, 14], [18, 13], [18, 12], [18, 11], [18, 10], [18, 9], [18, 8], [18, 7], [18, 6], [18, 5], [18, 4], [18, 3], [18, 2], [17, 2], [16, 2], [15, 2], [14, 2], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [2, 16], [2, 17], [2, 18], [2, 19], [3, 19], [4, 19], [5, 19], [6, 19], [7, 19], [8, 19], [9, 19], [10, 19], [11, 19], [12, 19], [13, 19], [14, 19], [15, 19], [16, 19], [17, 19], [18, 19], [19, 19], [19, 18], [19, 17], [19, 16], [19, 15], [19, 14], [19, 13], [19, 12], [19, 11], [19, 10], [19, 9], [19, 8], [19, 7], [19, 6], [19, 5], [19, 4], [19, 3], [19, 2], [19, 1], [18, 1], [17, 1], [16, 1], [15, 1], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [19, 0], [18, 0], [17, 0], [16, 0], [15, 0], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19]]\n assert candidate(rows = 16,cols = 16,rStart = 8,cStart = 8) == [[8, 8], [8, 9], [9, 9], [9, 8], [9, 7], [8, 7], [7, 7], [7, 8], [7, 9], [7, 10], [8, 10], [9, 10], [10, 10], [10, 9], [10, 8], [10, 7], [10, 6], [9, 6], [8, 6], [7, 6], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [7, 11], [8, 11], [9, 11], [10, 11], [11, 11], [11, 10], [11, 9], [11, 8], [11, 7], [11, 6], [11, 5], [10, 5], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [6, 12], [7, 12], [8, 12], [9, 12], [10, 12], [11, 12], [12, 12], [12, 11], [12, 10], [12, 9], [12, 8], [12, 7], [12, 6], [12, 5], [12, 4], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [5, 13], [6, 13], [7, 13], [8, 13], [9, 13], [10, 13], [11, 13], [12, 13], [13, 13], [13, 12], [13, 11], [13, 10], [13, 9], [13, 8], [13, 7], [13, 6], [13, 5], [13, 4], [13, 3], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [4, 14], [5, 14], [6, 14], [7, 14], [8, 14], [9, 14], [10, 14], [11, 14], [12, 14], [13, 14], [14, 14], [14, 13], [14, 12], [14, 11], [14, 10], [14, 9], [14, 8], [14, 7], [14, 6], [14, 5], [14, 4], [14, 3], [14, 2], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [3, 15], [4, 15], [5, 15], [6, 15], [7, 15], [8, 15], [9, 15], [10, 15], [11, 15], [12, 15], [13, 15], [14, 15], [15, 15], [15, 14], [15, 13], [15, 12], [15, 11], [15, 10], [15, 9], [15, 8], [15, 7], [15, 6], [15, 5], [15, 4], [15, 3], [15, 2], [15, 1], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [15, 0], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15]]\n assert candidate(rows = 50,cols = 50,rStart = 25,cStart = 25) == [[25, 25], [25, 26], [26, 26], [26, 25], [26, 24], [25, 24], [24, 24], [24, 25], [24, 26], [24, 27], [25, 27], [26, 27], [27, 27], [27, 26], [27, 25], [27, 24], [27, 23], [26, 23], [25, 23], [24, 23], [23, 23], [23, 24], [23, 25], [23, 26], [23, 27], [23, 28], [24, 28], [25, 28], [26, 28], [27, 28], [28, 28], [28, 27], [28, 26], [28, 25], [28, 24], [28, 23], [28, 22], [27, 22], [26, 22], [25, 22], [24, 22], [23, 22], [22, 22], [22, 23], [22, 24], [22, 25], [22, 26], [22, 27], [22, 28], [22, 29], [23, 29], [24, 29], [25, 29], [26, 29], [27, 29], [28, 29], [29, 29], [29, 28], [29, 27], [29, 26], [29, 25], [29, 24], [29, 23], [29, 22], [29, 21], [28, 21], [27, 21], [26, 21], [25, 21], [24, 21], [23, 21], [22, 21], [21, 21], [21, 22], [21, 23], [21, 24], [21, 25], [21, 26], [21, 27], [21, 28], [21, 29], [21, 30], [22, 30], [23, 30], [24, 30], [25, 30], [26, 30], [27, 30], [28, 30], [29, 30], [30, 30], [30, 29], [30, 28], [30, 27], [30, 26], [30, 25], [30, 24], [30, 23], [30, 22], [30, 21], [30, 20], [29, 20], [28, 20], [27, 20], [26, 20], [25, 20], [24, 20], [23, 20], [22, 20], [21, 20], [20, 20], [20, 21], [20, 22], [20, 23], [20, 24], [20, 25], [20, 26], [20, 27], [20, 28], [20, 29], [20, 30], [20, 31], [21, 31], [22, 31], [23, 31], [24, 31], [25, 31], [26, 31], [27, 31], [28, 31], [29, 31], [30, 31], [31, 31], [31, 30], [31, 29], [31, 28], [31, 27], [31, 26], [31, 25], [31, 24], [31, 23], [31, 22], [31, 21], [31, 20], [31, 19], [30, 19], [29, 19], [28, 19], [27, 19], [26, 19], [25, 19], [24, 19], [23, 19], [22, 19], [21, 19], [20, 19], [19, 19], [19, 20], [19, 21], [19, 22], [19, 23], [19, 24], [19, 25], [19, 26], [19, 27], [19, 28], [19, 29], [19, 30], [19, 31], [19, 32], [20, 32], [21, 32], [22, 32], [23, 32], [24, 32], [25, 32], [26, 32], [27, 32], [28, 32], [29, 32], [30, 32], [31, 32], [32, 32], [32, 31], [32, 30], [32, 29], [32, 28], [32, 27], [32, 26], [32, 25], [32, 24], [32, 23], [32, 22], [32, 21], [32, 20], [32, 19], [32, 18], [31, 18], [30, 18], [29, 18], [28, 18], [27, 18], [26, 18], [25, 18], [24, 18], [23, 18], [22, 18], [21, 18], [20, 18], [19, 18], [18, 18], [18, 19], [18, 20], [18, 21], [18, 22], [18, 23], [18, 24], [18, 25], [18, 26], [18, 27], [18, 28], [18, 29], [18, 30], [18, 31], [18, 32], [18, 33], [19, 33], [20, 33], [21, 33], [22, 33], [23, 33], [24, 33], [25, 33], [26, 33], [27, 33], [28, 33], [29, 33], [30, 33], [31, 33], [32, 33], [33, 33], [33, 32], [33, 31], [33, 30], [33, 29], [33, 28], [33, 27], [33, 26], [33, 25], [33, 24], [33, 23], [33, 22], [33, 21], [33, 20], [33, 19], [33, 18], [33, 17], [32, 17], [31, 17], [30, 17], [29, 17], [28, 17], [27, 17], [26, 17], [25, 17], [24, 17], [23, 17], [22, 17], [21, 17], [20, 17], [19, 17], [18, 17], [17, 17], [17, 18], [17, 19], [17, 20], [17, 21], [17, 22], [17, 23], [17, 24], [17, 25], [17, 26], [17, 27], [17, 28], [17, 29], [17, 30], [17, 31], [17, 32], [17, 33], [17, 34], [18, 34], [19, 34], [20, 34], [21, 34], [22, 34], [23, 34], [24, 34], [25, 34], [26, 34], [27, 34], [28, 34], [29, 34], [30, 34], [31, 34], [32, 34], [33, 34], [34, 34], [34, 33], [34, 32], [34, 31], [34, 30], [34, 29], [34, 28], [34, 27], [34, 26], [34, 25], [34, 24], [34, 23], [34, 22], [34, 21], [34, 20], [34, 19], [34, 18], [34, 17], [34, 16], [33, 16], [32, 16], [31, 16], [30, 16], [29, 16], [28, 16], [27, 16], [26, 16], [25, 16], [24, 16], [23, 16], [22, 16], [21, 16], [20, 16], [19, 16], [18, 16], [17, 16], [16, 16], [16, 17], [16, 18], [16, 19], [16, 20], [16, 21], [16, 22], [16, 23], [16, 24], [16, 25], [16, 26], [16, 27], [16, 28], [16, 29], [16, 30], [16, 31], [16, 32], [16, 33], [16, 34], [16, 35], [17, 35], [18, 35], [19, 35], [20, 35], [21, 35], [22, 35], [23, 35], [24, 35], [25, 35], [26, 35], [27, 35], [28, 35], [29, 35], [30, 35], [31, 35], [32, 35], [33, 35], [34, 35], [35, 35], [35, 34], [35, 33], [35, 32], [35, 31], [35, 30], [35, 29], [35, 28], [35, 27], [35, 26], [35, 25], [35, 24], [35, 23], [35, 22], [35, 21], [35, 20], [35, 19], [35, 18], [35, 17], [35, 16], [35, 15], [34, 15], [33, 15], [32, 15], [31, 15], [30, 15], [29, 15], [28, 15], [27, 15], [26, 15], [25, 15], [24, 15], [23, 15], [22, 15], [21, 15], [20, 15], [19, 15], [18, 15], [17, 15], [16, 15], [15, 15], [15, 16], [15, 17], [15, 18], [15, 19], [15, 20], [15, 21], [15, 22], [15, 23], [15, 24], [15, 25], [15, 26], [15, 27], [15, 28], [15, 29], [15, 30], [15, 31], [15, 32], [15, 33], [15, 34], [15, 35], [15, 36], [16, 36], [17, 36], [18, 36], [19, 36], [20, 36], [21, 36], [22, 36], [23, 36], [24, 36], [25, 36], [26, 36], [27, 36], [28, 36], [29, 36], [30, 36], [31, 36], [32, 36], [33, 36], [34, 36], [35, 36], [36, 36], [36, 35], [36, 34], [36, 33], [36, 32], [36, 31], [36, 30], [36, 29], [36, 28], [36, 27], [36, 26], [36, 25], [36, 24], [36, 23], [36, 22], [36, 21], [36, 20], [36, 19], [36, 18], [36, 17], [36, 16], [36, 15], [36, 14], [35, 14], [34, 14], [33, 14], [32, 14], [31, 14], [30, 14], [29, 14], [28, 14], [27, 14], [26, 14], [25, 14], [24, 14], [23, 14], [22, 14], [21, 14], [20, 14], [19, 14], [18, 14], [17, 14], [16, 14], [15, 14], [14, 14], [14, 15], [14, 16], [14, 17], [14, 18], [14, 19], [14, 20], [14, 21], [14, 22], [14, 23], [14, 24], [14, 25], [14, 26], [14, 27], [14, 28], [14, 29], [14, 30], [14, 31], [14, 32], [14, 33], [14, 34], [14, 35], [14, 36], [14, 37], [15, 37], [16, 37], [17, 37], [18, 37], [19, 37], [20, 37], [21, 37], [22, 37], [23, 37], [24, 37], [25, 37], [26, 37], [27, 37], [28, 37], [29, 37], [30, 37], [31, 37], [32, 37], [33, 37], [34, 37], [35, 37], [36, 37], [37, 37], [37, 36], [37, 35], [37, 34], [37, 33], [37, 32], [37, 31], [37, 30], [37, 29], [37, 28], [37, 27], [37, 26], [37, 25], [37, 24], [37, 23], [37, 22], [37, 21], [37, 20], [37, 19], [37, 18], [37, 17], [37, 16], [37, 15], [37, 14], [37, 13], [36, 13], [35, 13], [34, 13], [33, 13], [32, 13], [31, 13], [30, 13], [29, 13], [28, 13], [27, 13], [26, 13], [25, 13], [24, 13], [23, 13], [22, 13], [21, 13], [20, 13], [19, 13], [18, 13], [17, 13], [16, 13], [15, 13], [14, 13], [13, 13], [13, 14], [13, 15], [13, 16], [13, 17], [13, 18], [13, 19], [13, 20], [13, 21], [13, 22], [13, 23], [13, 24], [13, 25], [13, 26], [13, 27], [13, 28], [13, 29], [13, 30], [13, 31], [13, 32], [13, 33], [13, 34], [13, 35], [13, 36], [13, 37], [13, 38], [14, 38], [15, 38], [16, 38], [17, 38], [18, 38], [19, 38], [20, 38], [21, 38], [22, 38], [23, 38], [24, 38], [25, 38], [26, 38], [27, 38], [28, 38], [29, 38], [30, 38], [31, 38], [32, 38], [33, 38], [34, 38], [35, 38], [36, 38], [37, 38], [38, 38], [38, 37], [38, 36], [38, 35], [38, 34], [38, 33], [38, 32], [38, 31], [38, 30], [38, 29], [38, 28], [38, 27], [38, 26], [38, 25], [38, 24], [38, 23], [38, 22], [38, 21], [38, 20], [38, 19], [38, 18], [38, 17], [38, 16], [38, 15], [38, 14], [38, 13], [38, 12], [37, 12], [36, 12], [35, 12], [34, 12], [33, 12], [32, 12], [31, 12], [30, 12], [29, 12], [28, 12], [27, 12], [26, 12], [25, 12], [24, 12], [23, 12], [22, 12], [21, 12], [20, 12], [19, 12], [18, 12], [17, 12], [16, 12], [15, 12], [14, 12], [13, 12], [12, 12], [12, 13], [12, 14], [12, 15], [12, 16], [12, 17], [12, 18], [12, 19], [12, 20], [12, 21], [12, 22], [12, 23], [12, 24], [12, 25], [12, 26], [12, 27], [12, 28], [12, 29], [12, 30], [12, 31], [12, 32], [12, 33], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [13, 39], [14, 39], [15, 39], [16, 39], [17, 39], [18, 39], [19, 39], [20, 39], [21, 39], [22, 39], [23, 39], [24, 39], [25, 39], [26, 39], [27, 39], [28, 39], [29, 39], [30, 39], [31, 39], [32, 39], [33, 39], [34, 39], [35, 39], [36, 39], [37, 39], [38, 39], [39, 39], [39, 38], [39, 37], [39, 36], [39, 35], [39, 34], [39, 33], [39, 32], [39, 31], [39, 30], [39, 29], [39, 28], [39, 27], [39, 26], [39, 25], [39, 24], [39, 23], [39, 22], [39, 21], [39, 20], [39, 19], [39, 18], [39, 17], [39, 16], [39, 15], [39, 14], [39, 13], [39, 12], [39, 11], [38, 11], [37, 11], [36, 11], [35, 11], [34, 11], [33, 11], [32, 11], [31, 11], [30, 11], [29, 11], [28, 11], [27, 11], [26, 11], [25, 11], [24, 11], [23, 11], [22, 11], [21, 11], [20, 11], [19, 11], [18, 11], [17, 11], [16, 11], [15, 11], [14, 11], [13, 11], [12, 11], [11, 11], [11, 12], [11, 13], [11, 14], [11, 15], [11, 16], [11, 17], [11, 18], [11, 19], [11, 20], [11, 21], [11, 22], [11, 23], [11, 24], [11, 25], [11, 26], [11, 27], [11, 28], [11, 29], [11, 30], [11, 31], [11, 32], [11, 33], [11, 34], [11, 35], [11, 36], [11, 37], [11, 38], [11, 39], [11, 40], [12, 40], [13, 40], [14, 40], [15, 40], [16, 40], [17, 40], [18, 40], [19, 40], [20, 40], [21, 40], [22, 40], [23, 40], [24, 40], [25, 40], [26, 40], [27, 40], [28, 40], [29, 40], [30, 40], [31, 40], [32, 40], [33, 40], [34, 40], [35, 40], [36, 40], [37, 40], [38, 40], [39, 40], [40, 40], [40, 39], [40, 38], [40, 37], [40, 36], [40, 35], [40, 34], [40, 33], [40, 32], [40, 31], [40, 30], [40, 29], [40, 28], [40, 27], [40, 26], [40, 25], [40, 24], [40, 23], [40, 22], [40, 21], [40, 20], [40, 19], [40, 18], [40, 17], [40, 16], [40, 15], [40, 14], [40, 13], [40, 12], [40, 11], [40, 10], [39, 10], [38, 10], [37, 10], [36, 10], [35, 10], [34, 10], [33, 10], [32, 10], [31, 10], [30, 10], [29, 10], [28, 10], [27, 10], [26, 10], [25, 10], [24, 10], [23, 10], [22, 10], [21, 10], [20, 10], [19, 10], [18, 10], [17, 10], [16, 10], [15, 10], [14, 10], [13, 10], [12, 10], [11, 10], [10, 10], [10, 11], [10, 12], [10, 13], [10, 14], [10, 15], [10, 16], [10, 17], [10, 18], [10, 19], [10, 20], [10, 21], [10, 22], [10, 23], [10, 24], [10, 25], [10, 26], [10, 27], [10, 28], [10, 29], [10, 30], [10, 31], [10, 32], [10, 33], [10, 34], [10, 35], [10, 36], [10, 37], [10, 38], [10, 39], [10, 40], [10, 41], [11, 41], [12, 41], [13, 41], [14, 41], [15, 41], [16, 41], [17, 41], [18, 41], [19, 41], [20, 41], [21, 41], [22, 41], [23, 41], [24, 41], [25, 41], [26, 41], [27, 41], [28, 41], [29, 41], [30, 41], [31, 41], [32, 41], [33, 41], [34, 41], [35, 41], [36, 41], [37, 41], [38, 41], [39, 41], [40, 41], [41, 41], [41, 40], [41, 39], [41, 38], [41, 37], [41, 36], [41, 35], [41, 34], [41, 33], [41, 32], [41, 31], [41, 30], [41, 29], [41, 28], [41, 27], [41, 26], [41, 25], [41, 24], [41, 23], [41, 22], [41, 21], [41, 20], [41, 19], [41, 18], [41, 17], [41, 16], [41, 15], [41, 14], [41, 13], [41, 12], [41, 11], [41, 10], [41, 9], [40, 9], [39, 9], [38, 9], [37, 9], [36, 9], [35, 9], [34, 9], [33, 9], [32, 9], [31, 9], [30, 9], [29, 9], [28, 9], [27, 9], [26, 9], [25, 9], [24, 9], [23, 9], [22, 9], [21, 9], [20, 9], [19, 9], [18, 9], [17, 9], [16, 9], [15, 9], [14, 9], [13, 9], [12, 9], [11, 9], [10, 9], [9, 9], [9, 10], [9, 11], [9, 12], [9, 13], [9, 14], [9, 15], [9, 16], [9, 17], [9, 18], [9, 19], [9, 20], [9, 21], [9, 22], [9, 23], [9, 24], [9, 25], [9, 26], [9, 27], [9, 28], [9, 29], [9, 30], [9, 31], [9, 32], [9, 33], [9, 34], [9, 35], [9, 36], [9, 37], [9, 38], [9, 39], [9, 40], [9, 41], [9, 42], [10, 42], [11, 42], [12, 42], [13, 42], [14, 42], [15, 42], [16, 42], [17, 42], [18, 42], [19, 42], [20, 42], [21, 42], [22, 42], [23, 42], [24, 42], [25, 42], [26, 42], [27, 42], [28, 42], [29, 42], [30, 42], [31, 42], [32, 42], [33, 42], [34, 42], [35, 42], [36, 42], [37, 42], [38, 42], [39, 42], [40, 42], [41, 42], [42, 42], [42, 41], [42, 40], [42, 39], [42, 38], [42, 37], [42, 36], [42, 35], [42, 34], [42, 33], [42, 32], [42, 31], [42, 30], [42, 29], [42, 28], [42, 27], [42, 26], [42, 25], [42, 24], [42, 23], [42, 22], [42, 21], [42, 20], [42, 19], [42, 18], [42, 17], [42, 16], [42, 15], [42, 14], [42, 13], [42, 12], [42, 11], [42, 10], [42, 9], [42, 8], [41, 8], [40, 8], [39, 8], [38, 8], [37, 8], [36, 8], [35, 8], [34, 8], [33, 8], [32, 8], [31, 8], [30, 8], [29, 8], [28, 8], [27, 8], [26, 8], [25, 8], [24, 8], [23, 8], [22, 8], [21, 8], [20, 8], [19, 8], [18, 8], [17, 8], [16, 8], [15, 8], [14, 8], [13, 8], [12, 8], [11, 8], [10, 8], [9, 8], [8, 8], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [8, 14], [8, 15], [8, 16], [8, 17], [8, 18], [8, 19], [8, 20], [8, 21], [8, 22], [8, 23], [8, 24], [8, 25], [8, 26], [8, 27], [8, 28], [8, 29], [8, 30], [8, 31], [8, 32], [8, 33], [8, 34], [8, 35], [8, 36], [8, 37], [8, 38], [8, 39], [8, 40], [8, 41], [8, 42], [8, 43], [9, 43], [10, 43], [11, 43], [12, 43], [13, 43], [14, 43], [15, 43], [16, 43], [17, 43], [18, 43], [19, 43], [20, 43], [21, 43], [22, 43], [23, 43], [24, 43], [25, 43], [26, 43], [27, 43], [28, 43], [29, 43], [30, 43], [31, 43], [32, 43], [33, 43], [34, 43], [35, 43], [36, 43], [37, 43], [38, 43], [39, 43], [40, 43], [41, 43], [42, 43], [43, 43], [43, 42], [43, 41], [43, 40], [43, 39], [43, 38], [43, 37], [43, 36], [43, 35], [43, 34], [43, 33], [43, 32], [43, 31], [43, 30], [43, 29], [43, 28], [43, 27], [43, 26], [43, 25], [43, 24], [43, 23], [43, 22], [43, 21], [43, 20], [43, 19], [43, 18], [43, 17], [43, 16], [43, 15], [43, 14], [43, 13], [43, 12], [43, 11], [43, 10], [43, 9], [43, 8], [43, 7], [42, 7], [41, 7], [40, 7], [39, 7], [38, 7], [37, 7], [36, 7], [35, 7], [34, 7], [33, 7], [32, 7], [31, 7], [30, 7], [29, 7], [28, 7], [27, 7], [26, 7], [25, 7], [24, 7], [23, 7], [22, 7], [21, 7], [20, 7], [19, 7], [18, 7], [17, 7], [16, 7], [15, 7], [14, 7], [13, 7], [12, 7], [11, 7], [10, 7], [9, 7], [8, 7], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [7, 15], [7, 16], [7, 17], [7, 18], [7, 19], [7, 20], [7, 21], [7, 22], [7, 23], [7, 24], [7, 25], [7, 26], [7, 27], [7, 28], [7, 29], [7, 30], [7, 31], [7, 32], [7, 33], [7, 34], [7, 35], [7, 36], [7, 37], [7, 38], [7, 39], [7, 40], [7, 41], [7, 42], [7, 43], [7, 44], [8, 44], [9, 44], [10, 44], [11, 44], [12, 44], [13, 44], [14, 44], [15, 44], [16, 44], [17, 44], [18, 44], [19, 44], [20, 44], [21, 44], [22, 44], [23, 44], [24, 44], [25, 44], [26, 44], [27, 44], [28, 44], [29, 44], [30, 44], [31, 44], [32, 44], [33, 44], [34, 44], [35, 44], [36, 44], [37, 44], [38, 44], [39, 44], [40, 44], [41, 44], [42, 44], [43, 44], [44, 44], [44, 43], [44, 42], [44, 41], [44, 40], [44, 39], [44, 38], [44, 37], [44, 36], [44, 35], [44, 34], [44, 33], [44, 32], [44, 31], [44, 30], [44, 29], [44, 28], [44, 27], [44, 26], [44, 25], [44, 24], [44, 23], [44, 22], [44, 21], [44, 20], [44, 19], [44, 18], [44, 17], [44, 16], [44, 15], [44, 14], [44, 13], [44, 12], [44, 11], [44, 10], [44, 9], [44, 8], [44, 7], [44, 6], [43, 6], [42, 6], [41, 6], [40, 6], [39, 6], [38, 6], [37, 6], [36, 6], [35, 6], [34, 6], [33, 6], [32, 6], [31, 6], [30, 6], [29, 6], [28, 6], [27, 6], [26, 6], [25, 6], [24, 6], [23, 6], [22, 6], [21, 6], [20, 6], [19, 6], [18, 6], [17, 6], [16, 6], [15, 6], [14, 6], [13, 6], [12, 6], [11, 6], [10, 6], [9, 6], [8, 6], [7, 6], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [6, 14], [6, 15], [6, 16], [6, 17], [6, 18], [6, 19], [6, 20], [6, 21], [6, 22], [6, 23], [6, 24], [6, 25], [6, 26], [6, 27], [6, 28], [6, 29], [6, 30], [6, 31], [6, 32], [6, 33], [6, 34], [6, 35], [6, 36], [6, 37], [6, 38], [6, 39], [6, 40], [6, 41], [6, 42], [6, 43], [6, 44], [6, 45], [7, 45], [8, 45], [9, 45], [10, 45], [11, 45], [12, 45], [13, 45], [14, 45], [15, 45], [16, 45], [17, 45], [18, 45], [19, 45], [20, 45], [21, 45], [22, 45], [23, 45], [24, 45], [25, 45], [26, 45], [27, 45], [28, 45], [29, 45], [30, 45], [31, 45], [32, 45], [33, 45], [34, 45], [35, 45], [36, 45], [37, 45], [38, 45], [39, 45], [40, 45], [41, 45], [42, 45], [43, 45], [44, 45], [45, 45], [45, 44], [45, 43], [45, 42], [45, 41], [45, 40], [45, 39], [45, 38], [45, 37], [45, 36], [45, 35], [45, 34], [45, 33], [45, 32], [45, 31], [45, 30], [45, 29], [45, 28], [45, 27], [45, 26], [45, 25], [45, 24], [45, 23], [45, 22], [45, 21], [45, 20], [45, 19], [45, 18], [45, 17], [45, 16], [45, 15], [45, 14], [45, 13], [45, 12], [45, 11], [45, 10], [45, 9], [45, 8], [45, 7], [45, 6], [45, 5], [44, 5], [43, 5], [42, 5], [41, 5], [40, 5], [39, 5], [38, 5], [37, 5], [36, 5], [35, 5], [34, 5], [33, 5], [32, 5], [31, 5], [30, 5], [29, 5], [28, 5], [27, 5], [26, 5], [25, 5], [24, 5], [23, 5], [22, 5], [21, 5], [20, 5], [19, 5], [18, 5], [17, 5], [16, 5], [15, 5], [14, 5], [13, 5], [12, 5], [11, 5], [10, 5], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [5, 15], [5, 16], [5, 17], [5, 18], [5, 19], [5, 20], [5, 21], [5, 22], [5, 23], [5, 24], [5, 25], [5, 26], [5, 27], [5, 28], [5, 29], [5, 30], [5, 31], [5, 32], [5, 33], [5, 34], [5, 35], [5, 36], [5, 37], [5, 38], [5, 39], [5, 40], [5, 41], [5, 42], [5, 43], [5, 44], [5, 45], [5, 46], [6, 46], [7, 46], [8, 46], [9, 46], [10, 46], [11, 46], [12, 46], [13, 46], [14, 46], [15, 46], [16, 46], [17, 46], [18, 46], [19, 46], [20, 46], [21, 46], [22, 46], [23, 46], [24, 46], [25, 46], [26, 46], [27, 46], [28, 46], [29, 46], [30, 46], [31, 46], [32, 46], [33, 46], [34, 46], [35, 46], [36, 46], [37, 46], [38, 46], [39, 46], [40, 46], [41, 46], [42, 46], [43, 46], [44, 46], [45, 46], [46, 46], [46, 45], [46, 44], [46, 43], [46, 42], [46, 41], [46, 40], [46, 39], [46, 38], [46, 37], [46, 36], [46, 35], [46, 34], [46, 33], [46, 32], [46, 31], [46, 30], [46, 29], [46, 28], [46, 27], [46, 26], [46, 25], [46, 24], [46, 23], [46, 22], [46, 21], [46, 20], [46, 19], [46, 18], [46, 17], [46, 16], [46, 15], [46, 14], [46, 13], [46, 12], [46, 11], [46, 10], [46, 9], [46, 8], [46, 7], [46, 6], [46, 5], [46, 4], [45, 4], [44, 4], [43, 4], [42, 4], [41, 4], [40, 4], [39, 4], [38, 4], [37, 4], [36, 4], [35, 4], [34, 4], [33, 4], [32, 4], [31, 4], [30, 4], [29, 4], [28, 4], [27, 4], [26, 4], [25, 4], [24, 4], [23, 4], [22, 4], [21, 4], [20, 4], [19, 4], [18, 4], [17, 4], [16, 4], [15, 4], [14, 4], [13, 4], [12, 4], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [4, 15], [4, 16], [4, 17], [4, 18], [4, 19], [4, 20], [4, 21], [4, 22], [4, 23], [4, 24], [4, 25], [4, 26], [4, 27], [4, 28], [4, 29], [4, 30], [4, 31], [4, 32], [4, 33], [4, 34], [4, 35], [4, 36], [4, 37], [4, 38], [4, 39], [4, 40], [4, 41], [4, 42], [4, 43], [4, 44], [4, 45], [4, 46], [4, 47], [5, 47], [6, 47], [7, 47], [8, 47], [9, 47], [10, 47], [11, 47], [12, 47], [13, 47], [14, 47], [15, 47], [16, 47], [17, 47], [18, 47], [19, 47], [20, 47], [21, 47], [22, 47], [23, 47], [24, 47], [25, 47], [26, 47], [27, 47], [28, 47], [29, 47], [30, 47], [31, 47], [32, 47], [33, 47], [34, 47], [35, 47], [36, 47], [37, 47], [38, 47], [39, 47], [40, 47], [41, 47], [42, 47], [43, 47], [44, 47], [45, 47], [46, 47], [47, 47], [47, 46], [47, 45], [47, 44], [47, 43], [47, 42], [47, 41], [47, 40], [47, 39], [47, 38], [47, 37], [47, 36], [47, 35], [47, 34], [47, 33], [47, 32], [47, 31], [47, 30], [47, 29], [47, 28], [47, 27], [47, 26], [47, 25], [47, 24], [47, 23], [47, 22], [47, 21], [47, 20], [47, 19], [47, 18], [47, 17], [47, 16], [47, 15], [47, 14], [47, 13], [47, 12], [47, 11], [47, 10], [47, 9], [47, 8], [47, 7], [47, 6], [47, 5], [47, 4], [47, 3], [46, 3], [45, 3], [44, 3], [43, 3], [42, 3], [41, 3], [40, 3], [39, 3], [38, 3], [37, 3], [36, 3], [35, 3], [34, 3], [33, 3], [32, 3], [31, 3], [30, 3], [29, 3], [28, 3], [27, 3], [26, 3], [25, 3], [24, 3], [23, 3], [22, 3], [21, 3], [20, 3], [19, 3], [18, 3], [17, 3], [16, 3], [15, 3], [14, 3], [13, 3], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [3, 15], [3, 16], [3, 17], [3, 18], [3, 19], [3, 20], [3, 21], [3, 22], [3, 23], [3, 24], [3, 25], [3, 26], [3, 27], [3, 28], [3, 29], [3, 30], [3, 31], [3, 32], [3, 33], [3, 34], [3, 35], [3, 36], [3, 37], [3, 38], [3, 39], [3, 40], [3, 41], [3, 42], [3, 43], [3, 44], [3, 45], [3, 46], [3, 47], [3, 48], [4, 48], [5, 48], [6, 48], [7, 48], [8, 48], [9, 48], [10, 48], [11, 48], [12, 48], [13, 48], [14, 48], [15, 48], [16, 48], [17, 48], [18, 48], [19, 48], [20, 48], [21, 48], [22, 48], [23, 48], [24, 48], [25, 48], [26, 48], [27, 48], [28, 48], [29, 48], [30, 48], [31, 48], [32, 48], [33, 48], [34, 48], [35, 48], [36, 48], [37, 48], [38, 48], [39, 48], [40, 48], [41, 48], [42, 48], [43, 48], [44, 48], [45, 48], [46, 48], [47, 48], [48, 48], [48, 47], [48, 46], [48, 45], [48, 44], [48, 43], [48, 42], [48, 41], [48, 40], [48, 39], [48, 38], [48, 37], [48, 36], [48, 35], [48, 34], [48, 33], [48, 32], [48, 31], [48, 30], [48, 29], [48, 28], [48, 27], [48, 26], [48, 25], [48, 24], [48, 23], [48, 22], [48, 21], [48, 20], [48, 19], [48, 18], [48, 17], [48, 16], [48, 15], [48, 14], [48, 13], [48, 12], [48, 11], [48, 10], [48, 9], [48, 8], [48, 7], [48, 6], [48, 5], [48, 4], [48, 3], [48, 2], [47, 2], [46, 2], [45, 2], [44, 2], [43, 2], [42, 2], [41, 2], [40, 2], [39, 2], [38, 2], [37, 2], [36, 2], [35, 2], [34, 2], [33, 2], [32, 2], [31, 2], [30, 2], [29, 2], [28, 2], [27, 2], [26, 2], [25, 2], [24, 2], [23, 2], [22, 2], [21, 2], [20, 2], [19, 2], [18, 2], [17, 2], [16, 2], [15, 2], [14, 2], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [2, 16], [2, 17], [2, 18], [2, 19], [2, 20], [2, 21], [2, 22], [2, 23], [2, 24], [2, 25], [2, 26], [2, 27], [2, 28], [2, 29], [2, 30], [2, 31], [2, 32], [2, 33], [2, 34], [2, 35], [2, 36], [2, 37], [2, 38], [2, 39], [2, 40], [2, 41], [2, 42], [2, 43], [2, 44], [2, 45], [2, 46], [2, 47], [2, 48], [2, 49], [3, 49], [4, 49], [5, 49], [6, 49], [7, 49], [8, 49], [9, 49], [10, 49], [11, 49], [12, 49], [13, 49], [14, 49], [15, 49], [16, 49], [17, 49], [18, 49], [19, 49], [20, 49], [21, 49], [22, 49], [23, 49], [24, 49], [25, 49], [26, 49], [27, 49], [28, 49], [29, 49], [30, 49], [31, 49], [32, 49], [33, 49], [34, 49], [35, 49], [36, 49], [37, 49], [38, 49], [39, 49], [40, 49], [41, 49], [42, 49], [43, 49], [44, 49], [45, 49], [46, 49], [47, 49], [48, 49], [49, 49], [49, 48], [49, 47], [49, 46], [49, 45], [49, 44], [49, 43], [49, 42], [49, 41], [49, 40], [49, 39], [49, 38], [49, 37], [49, 36], [49, 35], [49, 34], [49, 33], [49, 32], [49, 31], [49, 30], [49, 29], [49, 28], [49, 27], [49, 26], [49, 25], [49, 24], [49, 23], [49, 22], [49, 21], [49, 20], [49, 19], [49, 18], [49, 17], [49, 16], [49, 15], [49, 14], [49, 13], [49, 12], [49, 11], [49, 10], [49, 9], [49, 8], [49, 7], [49, 6], [49, 5], [49, 4], [49, 3], [49, 2], [49, 1], [48, 1], [47, 1], [46, 1], [45, 1], [44, 1], [43, 1], [42, 1], [41, 1], [40, 1], [39, 1], [38, 1], [37, 1], [36, 1], [35, 1], [34, 1], [33, 1], [32, 1], [31, 1], [30, 1], [29, 1], [28, 1], [27, 1], [26, 1], [25, 1], [24, 1], [23, 1], [22, 1], [21, 1], [20, 1], [19, 1], [18, 1], [17, 1], [16, 1], [15, 1], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [1, 24], [1, 25], [1, 26], [1, 27], [1, 28], [1, 29], [1, 30], [1, 31], [1, 32], [1, 33], [1, 34], [1, 35], [1, 36], [1, 37], [1, 38], [1, 39], [1, 40], [1, 41], [1, 42], [1, 43], [1, 44], [1, 45], [1, 46], [1, 47], [1, 48], [1, 49], [49, 0], [48, 0], [47, 0], [46, 0], [45, 0], [44, 0], [43, 0], [42, 0], [41, 0], [40, 0], [39, 0], [38, 0], [37, 0], [36, 0], [35, 0], [34, 0], [33, 0], [32, 0], [31, 0], [30, 0], [29, 0], [28, 0], [27, 0], [26, 0], [25, 0], [24, 0], [23, 0], [22, 0], [21, 0], [20, 0], [19, 0], [18, 0], [17, 0], [16, 0], [15, 0], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [0, 34], [0, 35], [0, 36], [0, 37], [0, 38], [0, 39], [0, 40], [0, 41], [0, 42], [0, 43], [0, 44], [0, 45], [0, 46], [0, 47], [0, 48], [0, 49]]\n assert candidate(rows = 3,cols = 8,rStart = 1,cStart = 4) == [[1, 4], [1, 5], [2, 5], [2, 4], [2, 3], [1, 3], [0, 3], [0, 4], [0, 5], [0, 6], [1, 6], [2, 6], [2, 2], [1, 2], [0, 2], [0, 7], [1, 7], [2, 7], [2, 1], [1, 1], [0, 1], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 6,cols = 6,rStart = 3,cStart = 0) == [[3, 0], [3, 1], [4, 1], [4, 0], [2, 0], [2, 1], [2, 2], [3, 2], [4, 2], [5, 2], [5, 1], [5, 0], [1, 0], [1, 1], [1, 2], [1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 4], [2, 4], [3, 4], [4, 4], [5, 4], [0, 5], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5]]\n assert candidate(rows = 18,cols = 20,rStart = 9,cStart = 10) == [[9, 10], [9, 11], [10, 11], [10, 10], [10, 9], [9, 9], [8, 9], [8, 10], [8, 11], [8, 12], [9, 12], [10, 12], [11, 12], [11, 11], [11, 10], [11, 9], [11, 8], [10, 8], [9, 8], [8, 8], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [8, 13], [9, 13], [10, 13], [11, 13], [12, 13], [12, 12], [12, 11], [12, 10], [12, 9], [12, 8], [12, 7], [11, 7], [10, 7], [9, 7], [8, 7], [7, 7], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [6, 14], [7, 14], [8, 14], [9, 14], [10, 14], [11, 14], [12, 14], [13, 14], [13, 13], [13, 12], [13, 11], [13, 10], [13, 9], [13, 8], [13, 7], [13, 6], [12, 6], [11, 6], [10, 6], [9, 6], [8, 6], [7, 6], [6, 6], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [5, 15], [6, 15], [7, 15], [8, 15], [9, 15], [10, 15], [11, 15], [12, 15], [13, 15], [14, 15], [14, 14], [14, 13], [14, 12], [14, 11], [14, 10], [14, 9], [14, 8], [14, 7], [14, 6], [14, 5], [13, 5], [12, 5], [11, 5], [10, 5], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [4, 15], [4, 16], [5, 16], [6, 16], [7, 16], [8, 16], [9, 16], [10, 16], [11, 16], [12, 16], [13, 16], [14, 16], [15, 16], [15, 15], [15, 14], [15, 13], [15, 12], [15, 11], [15, 10], [15, 9], [15, 8], [15, 7], [15, 6], [15, 5], [15, 4], [14, 4], [13, 4], [12, 4], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [3, 15], [3, 16], [3, 17], [4, 17], [5, 17], [6, 17], [7, 17], [8, 17], [9, 17], [10, 17], [11, 17], [12, 17], [13, 17], [14, 17], [15, 17], [16, 17], [16, 16], [16, 15], [16, 14], [16, 13], [16, 12], [16, 11], [16, 10], [16, 9], [16, 8], [16, 7], [16, 6], [16, 5], [16, 4], [16, 3], [15, 3], [14, 3], [13, 3], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [2, 16], [2, 17], [2, 18], [3, 18], [4, 18], [5, 18], [6, 18], [7, 18], [8, 18], [9, 18], [10, 18], [11, 18], [12, 18], [13, 18], [14, 18], [15, 18], [16, 18], [17, 18], [17, 17], [17, 16], [17, 15], [17, 14], [17, 13], [17, 12], [17, 11], [17, 10], [17, 9], [17, 8], [17, 7], [17, 6], [17, 5], [17, 4], [17, 3], [17, 2], [16, 2], [15, 2], [14, 2], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [2, 19], [3, 19], [4, 19], [5, 19], [6, 19], [7, 19], [8, 19], [9, 19], [10, 19], [11, 19], [12, 19], [13, 19], [14, 19], [15, 19], [16, 19], [17, 19], [17, 1], [16, 1], [15, 1], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [17, 0], [16, 0], [15, 0], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 12,cols = 12,rStart = 11,cStart = 11) == [[11, 11], [11, 10], [10, 10], [10, 11], [11, 9], [10, 9], [9, 9], [9, 10], [9, 11], [11, 8], [10, 8], [9, 8], [8, 8], [8, 9], [8, 10], [8, 11], [11, 7], [10, 7], [9, 7], [8, 7], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [11, 6], [10, 6], [9, 6], [8, 6], [7, 6], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [11, 5], [10, 5], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11]]\n assert candidate(rows = 12,cols = 9,rStart = 0,cStart = 8) == [[0, 8], [1, 8], [1, 7], [0, 7], [2, 8], [2, 7], [2, 6], [1, 6], [0, 6], [3, 8], [3, 7], [3, 6], [3, 5], [2, 5], [1, 5], [0, 5], [4, 8], [4, 7], [4, 6], [4, 5], [4, 4], [3, 4], [2, 4], [1, 4], [0, 4], [5, 8], [5, 7], [5, 6], [5, 5], [5, 4], [5, 3], [4, 3], [3, 3], [2, 3], [1, 3], [0, 3], [6, 8], [6, 7], [6, 6], [6, 5], [6, 4], [6, 3], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [7, 8], [7, 7], [7, 6], [7, 5], [7, 4], [7, 3], [7, 2], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [8, 8], [8, 7], [8, 6], [8, 5], [8, 4], [8, 3], [8, 2], [8, 1], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [9, 8], [9, 7], [9, 6], [9, 5], [9, 4], [9, 3], [9, 2], [9, 1], [9, 0], [10, 8], [10, 7], [10, 6], [10, 5], [10, 4], [10, 3], [10, 2], [10, 1], [10, 0], [11, 8], [11, 7], [11, 6], [11, 5], [11, 4], [11, 3], [11, 2], [11, 1], [11, 0]]\n assert candidate(rows = 20,cols = 10,rStart = 3,cStart = 9) == [[3, 9], [4, 9], [4, 8], [3, 8], [2, 8], [2, 9], [5, 9], [5, 8], [5, 7], [4, 7], [3, 7], [2, 7], [1, 7], [1, 8], [1, 9], [6, 9], [6, 8], [6, 7], [6, 6], [5, 6], [4, 6], [3, 6], [2, 6], [1, 6], [0, 6], [0, 7], [0, 8], [0, 9], [7, 9], [7, 8], [7, 7], [7, 6], [7, 5], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5], [0, 5], [8, 9], [8, 8], [8, 7], [8, 6], [8, 5], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [3, 4], [2, 4], [1, 4], [0, 4], [9, 9], [9, 8], [9, 7], [9, 6], [9, 5], [9, 4], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [2, 3], [1, 3], [0, 3], [10, 9], [10, 8], [10, 7], [10, 6], [10, 5], [10, 4], [10, 3], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [11, 9], [11, 8], [11, 7], [11, 6], [11, 5], [11, 4], [11, 3], [11, 2], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [12, 9], [12, 8], [12, 7], [12, 6], [12, 5], [12, 4], [12, 3], [12, 2], [12, 1], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [13, 9], [13, 8], [13, 7], [13, 6], [13, 5], [13, 4], [13, 3], [13, 2], [13, 1], [13, 0], [14, 9], [14, 8], [14, 7], [14, 6], [14, 5], [14, 4], [14, 3], [14, 2], [14, 1], [14, 0], [15, 9], [15, 8], [15, 7], [15, 6], [15, 5], [15, 4], [15, 3], [15, 2], [15, 1], [15, 0], [16, 9], [16, 8], [16, 7], [16, 6], [16, 5], [16, 4], [16, 3], [16, 2], [16, 1], [16, 0], [17, 9], [17, 8], [17, 7], [17, 6], [17, 5], [17, 4], [17, 3], [17, 2], [17, 1], [17, 0], [18, 9], [18, 8], [18, 7], [18, 6], [18, 5], [18, 4], [18, 3], [18, 2], [18, 1], [18, 0], [19, 9], [19, 8], [19, 7], [19, 6], [19, 5], [19, 4], [19, 3], [19, 2], [19, 1], [19, 0]]\n assert candidate(rows = 8,cols = 12,rStart = 7,cStart = 5) == [[7, 5], [7, 6], [7, 4], [6, 4], [6, 5], [6, 6], [6, 7], [7, 7], [7, 3], [6, 3], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [6, 8], [7, 8], [7, 2], [6, 2], [5, 2], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [5, 9], [6, 9], [7, 9], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [3, 11], [4, 11], [5, 11], [6, 11], [7, 11], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11]]\n assert candidate(rows = 8,cols = 6,rStart = 1,cStart = 1) == [[1, 1], [1, 2], [2, 2], [2, 1], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [1, 3], [2, 3], [3, 3], [3, 2], [3, 1], [3, 0], [0, 4], [1, 4], [2, 4], [3, 4], [4, 4], [4, 3], [4, 2], [4, 1], [4, 0], [0, 5], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [5, 0], [6, 5], [6, 4], [6, 3], [6, 2], [6, 1], [6, 0], [7, 5], [7, 4], [7, 3], [7, 2], [7, 1], [7, 0]]\n assert candidate(rows = 15,cols = 15,rStart = 7,cStart = 7) == [[7, 7], [7, 8], [8, 8], [8, 7], [8, 6], [7, 6], [6, 6], [6, 7], [6, 8], [6, 9], [7, 9], [8, 9], [9, 9], [9, 8], [9, 7], [9, 6], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10], [10, 10], [10, 9], [10, 8], [10, 7], [10, 6], [10, 5], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [5, 11], [6, 11], [7, 11], [8, 11], [9, 11], [10, 11], [11, 11], [11, 10], [11, 9], [11, 8], [11, 7], [11, 6], [11, 5], [11, 4], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [4, 12], [5, 12], [6, 12], [7, 12], [8, 12], [9, 12], [10, 12], [11, 12], [12, 12], [12, 11], [12, 10], [12, 9], [12, 8], [12, 7], [12, 6], [12, 5], [12, 4], [12, 3], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [3, 13], [4, 13], [5, 13], [6, 13], [7, 13], [8, 13], [9, 13], [10, 13], [11, 13], [12, 13], [13, 13], [13, 12], [13, 11], [13, 10], [13, 9], [13, 8], [13, 7], [13, 6], [13, 5], [13, 4], [13, 3], [13, 2], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 14], [3, 14], [4, 14], [5, 14], [6, 14], [7, 14], [8, 14], [9, 14], [10, 14], [11, 14], [12, 14], [13, 14], [14, 14], [14, 13], [14, 12], [14, 11], [14, 10], [14, 9], [14, 8], [14, 7], [14, 6], [14, 5], [14, 4], [14, 3], [14, 2], [14, 1], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14]]\n assert candidate(rows = 5,cols = 5,rStart = 1,cStart = 1) == [[1, 1], [1, 2], [2, 2], [2, 1], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [1, 3], [2, 3], [3, 3], [3, 2], [3, 1], [3, 0], [0, 4], [1, 4], [2, 4], [3, 4], [4, 4], [4, 3], [4, 2], [4, 1], [4, 0]]\n assert candidate(rows = 9,cols = 9,rStart = 4,cStart = 4) == [[4, 4], [4, 5], [5, 5], [5, 4], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [4, 6], [5, 6], [6, 6], [6, 5], [6, 4], [6, 3], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7], [7, 6], [7, 5], [7, 4], [7, 3], [7, 2], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [2, 8], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8], [8, 8], [8, 7], [8, 6], [8, 5], [8, 4], [8, 3], [8, 2], [8, 1], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8]]\n assert candidate(rows = 5,cols = 5,rStart = 0,cStart = 0) == [[0, 0], [0, 1], [1, 1], [1, 0], [0, 2], [1, 2], [2, 2], [2, 1], [2, 0], [0, 3], [1, 3], [2, 3], [3, 3], [3, 2], [3, 1], [3, 0], [0, 4], [1, 4], [2, 4], [3, 4], [4, 4], [4, 3], [4, 2], [4, 1], [4, 0]]\n assert candidate(rows = 6,cols = 6,rStart = 5,cStart = 5) == [[5, 5], [5, 4], [4, 4], [4, 5], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]\n assert candidate(rows = 20,cols = 15,rStart = 14,cStart = 7) == [[14, 7], [14, 8], [15, 8], [15, 7], [15, 6], [14, 6], [13, 6], [13, 7], [13, 8], [13, 9], [14, 9], [15, 9], [16, 9], [16, 8], [16, 7], [16, 6], [16, 5], [15, 5], [14, 5], [13, 5], [12, 5], [12, 6], [12, 7], [12, 8], [12, 9], [12, 10], [13, 10], [14, 10], [15, 10], [16, 10], [17, 10], [17, 9], [17, 8], [17, 7], [17, 6], [17, 5], [17, 4], [16, 4], [15, 4], [14, 4], [13, 4], [12, 4], [11, 4], [11, 5], [11, 6], [11, 7], [11, 8], [11, 9], [11, 10], [11, 11], [12, 11], [13, 11], [14, 11], [15, 11], [16, 11], [17, 11], [18, 11], [18, 10], [18, 9], [18, 8], [18, 7], [18, 6], [18, 5], [18, 4], [18, 3], [17, 3], [16, 3], [15, 3], [14, 3], [13, 3], [12, 3], [11, 3], [10, 3], [10, 4], [10, 5], [10, 6], [10, 7], [10, 8], [10, 9], [10, 10], [10, 11], [10, 12], [11, 12], [12, 12], [13, 12], [14, 12], [15, 12], [16, 12], [17, 12], [18, 12], [19, 12], [19, 11], [19, 10], [19, 9], [19, 8], [19, 7], [19, 6], [19, 5], [19, 4], [19, 3], [19, 2], [18, 2], [17, 2], [16, 2], [15, 2], [14, 2], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [9, 3], [9, 4], [9, 5], [9, 6], [9, 7], [9, 8], [9, 9], [9, 10], [9, 11], [9, 12], [9, 13], [10, 13], [11, 13], [12, 13], [13, 13], [14, 13], [15, 13], [16, 13], [17, 13], [18, 13], [19, 13], [19, 1], [18, 1], [17, 1], [16, 1], [15, 1], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [8, 2], [8, 3], [8, 4], [8, 5], [8, 6], [8, 7], [8, 8], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [8, 14], [9, 14], [10, 14], [11, 14], [12, 14], [13, 14], [14, 14], [15, 14], [16, 14], [17, 14], [18, 14], [19, 14], [19, 0], [18, 0], [17, 0], [16, 0], [15, 0], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [6, 14], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14]]\n assert candidate(rows = 7,cols = 14,rStart = 3,cStart = 7) == [[3, 7], [3, 8], [4, 8], [4, 7], [4, 6], [3, 6], [2, 6], [2, 7], [2, 8], [2, 9], [3, 9], [4, 9], [5, 9], [5, 8], [5, 7], [5, 6], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [6, 9], [6, 8], [6, 7], [6, 6], [6, 5], [6, 4], [5, 4], [4, 4], [3, 4], [2, 4], [1, 4], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [1, 11], [2, 11], [3, 11], [4, 11], [5, 11], [6, 11], [6, 3], [5, 3], [4, 3], [3, 3], [2, 3], [1, 3], [0, 3], [0, 12], [1, 12], [2, 12], [3, 12], [4, 12], [5, 12], [6, 12], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [0, 13], [1, 13], [2, 13], [3, 13], [4, 13], [5, 13], [6, 13], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 5,cols = 5,rStart = 4,cStart = 4) == [[4, 4], [4, 3], [3, 3], [3, 4], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4]]\n assert candidate(rows = 20,cols = 15,rStart = 19,cStart = 14) == [[19, 14], [19, 13], [18, 13], [18, 14], [19, 12], [18, 12], [17, 12], [17, 13], [17, 14], [19, 11], [18, 11], [17, 11], [16, 11], [16, 12], [16, 13], [16, 14], [19, 10], [18, 10], [17, 10], [16, 10], [15, 10], [15, 11], [15, 12], [15, 13], [15, 14], [19, 9], [18, 9], [17, 9], [16, 9], [15, 9], [14, 9], [14, 10], [14, 11], [14, 12], [14, 13], [14, 14], [19, 8], [18, 8], [17, 8], [16, 8], [15, 8], [14, 8], [13, 8], [13, 9], [13, 10], [13, 11], [13, 12], [13, 13], [13, 14], [19, 7], [18, 7], [17, 7], [16, 7], [15, 7], [14, 7], [13, 7], [12, 7], [12, 8], [12, 9], [12, 10], [12, 11], [12, 12], [12, 13], [12, 14], [19, 6], [18, 6], [17, 6], [16, 6], [15, 6], [14, 6], [13, 6], [12, 6], [11, 6], [11, 7], [11, 8], [11, 9], [11, 10], [11, 11], [11, 12], [11, 13], [11, 14], [19, 5], [18, 5], [17, 5], [16, 5], [15, 5], [14, 5], [13, 5], [12, 5], [11, 5], [10, 5], [10, 6], [10, 7], [10, 8], [10, 9], [10, 10], [10, 11], [10, 12], [10, 13], [10, 14], [19, 4], [18, 4], [17, 4], [16, 4], [15, 4], [14, 4], [13, 4], [12, 4], [11, 4], [10, 4], [9, 4], [9, 5], [9, 6], [9, 7], [9, 8], [9, 9], [9, 10], [9, 11], [9, 12], [9, 13], [9, 14], [19, 3], [18, 3], [17, 3], [16, 3], [15, 3], [14, 3], [13, 3], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [8, 4], [8, 5], [8, 6], [8, 7], [8, 8], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [8, 14], [19, 2], [18, 2], [17, 2], [16, 2], [15, 2], [14, 2], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [19, 1], [18, 1], [17, 1], [16, 1], [15, 1], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [6, 14], [19, 0], [18, 0], [17, 0], [16, 0], [15, 0], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14]]\n assert candidate(rows = 15,cols = 20,rStart = 7,cStart = 10) == [[7, 10], [7, 11], [8, 11], [8, 10], [8, 9], [7, 9], [6, 9], [6, 10], [6, 11], [6, 12], [7, 12], [8, 12], [9, 12], [9, 11], [9, 10], [9, 9], [9, 8], [8, 8], [7, 8], [6, 8], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [6, 13], [7, 13], [8, 13], [9, 13], [10, 13], [10, 12], [10, 11], [10, 10], [10, 9], [10, 8], [10, 7], [9, 7], [8, 7], [7, 7], [6, 7], [5, 7], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [5, 14], [6, 14], [7, 14], [8, 14], [9, 14], [10, 14], [11, 14], [11, 13], [11, 12], [11, 11], [11, 10], [11, 9], [11, 8], [11, 7], [11, 6], [10, 6], [9, 6], [8, 6], [7, 6], [6, 6], [5, 6], [4, 6], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [3, 15], [4, 15], [5, 15], [6, 15], [7, 15], [8, 15], [9, 15], [10, 15], [11, 15], [12, 15], [12, 14], [12, 13], [12, 12], [12, 11], [12, 10], [12, 9], [12, 8], [12, 7], [12, 6], [12, 5], [11, 5], [10, 5], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [2, 16], [3, 16], [4, 16], [5, 16], [6, 16], [7, 16], [8, 16], [9, 16], [10, 16], [11, 16], [12, 16], [13, 16], [13, 15], [13, 14], [13, 13], [13, 12], [13, 11], [13, 10], [13, 9], [13, 8], [13, 7], [13, 6], [13, 5], [13, 4], [12, 4], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [3, 4], [2, 4], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [2, 17], [3, 17], [4, 17], [5, 17], [6, 17], [7, 17], [8, 17], [9, 17], [10, 17], [11, 17], [12, 17], [13, 17], [14, 17], [14, 16], [14, 15], [14, 14], [14, 13], [14, 12], [14, 11], [14, 10], [14, 9], [14, 8], [14, 7], [14, 6], [14, 5], [14, 4], [14, 3], [13, 3], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [2, 3], [1, 3], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [1, 18], [2, 18], [3, 18], [4, 18], [5, 18], [6, 18], [7, 18], [8, 18], [9, 18], [10, 18], [11, 18], [12, 18], [13, 18], [14, 18], [14, 2], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [0, 19], [1, 19], [2, 19], [3, 19], [4, 19], [5, 19], [6, 19], [7, 19], [8, 19], [9, 19], [10, 19], [11, 19], [12, 19], [13, 19], [14, 19], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 9,cols = 7,rStart = 4,cStart = 6) == [[4, 6], [5, 6], [5, 5], [4, 5], [3, 5], [3, 6], [6, 6], [6, 5], [6, 4], [5, 4], [4, 4], [3, 4], [2, 4], [2, 5], [2, 6], [7, 6], [7, 5], [7, 4], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [2, 3], [1, 3], [1, 4], [1, 5], [1, 6], [8, 6], [8, 5], [8, 4], [8, 3], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 15,cols = 20,rStart = 0,cStart = 0) == [[0, 0], [0, 1], [1, 1], [1, 0], [0, 2], [1, 2], [2, 2], [2, 1], [2, 0], [0, 3], [1, 3], [2, 3], [3, 3], [3, 2], [3, 1], [3, 0], [0, 4], [1, 4], [2, 4], [3, 4], [4, 4], [4, 3], [4, 2], [4, 1], [4, 0], [0, 5], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [5, 0], [0, 6], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [6, 6], [6, 5], [6, 4], [6, 3], [6, 2], [6, 1], [6, 0], [0, 7], [1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7], [7, 6], [7, 5], [7, 4], [7, 3], [7, 2], [7, 1], [7, 0], [0, 8], [1, 8], [2, 8], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8], [8, 8], [8, 7], [8, 6], [8, 5], [8, 4], [8, 3], [8, 2], [8, 1], [8, 0], [0, 9], [1, 9], [2, 9], [3, 9], [4, 9], [5, 9], [6, 9], [7, 9], [8, 9], [9, 9], [9, 8], [9, 7], [9, 6], [9, 5], [9, 4], [9, 3], [9, 2], [9, 1], [9, 0], [0, 10], [1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10], [10, 10], [10, 9], [10, 8], [10, 7], [10, 6], [10, 5], [10, 4], [10, 3], [10, 2], [10, 1], [10, 0], [0, 11], [1, 11], [2, 11], [3, 11], [4, 11], [5, 11], [6, 11], [7, 11], [8, 11], [9, 11], [10, 11], [11, 11], [11, 10], [11, 9], [11, 8], [11, 7], [11, 6], [11, 5], [11, 4], [11, 3], [11, 2], [11, 1], [11, 0], [0, 12], [1, 12], [2, 12], [3, 12], [4, 12], [5, 12], [6, 12], [7, 12], [8, 12], [9, 12], [10, 12], [11, 12], [12, 12], [12, 11], [12, 10], [12, 9], [12, 8], [12, 7], [12, 6], [12, 5], [12, 4], [12, 3], [12, 2], [12, 1], [12, 0], [0, 13], [1, 13], [2, 13], [3, 13], [4, 13], [5, 13], [6, 13], [7, 13], [8, 13], [9, 13], [10, 13], [11, 13], [12, 13], [13, 13], [13, 12], [13, 11], [13, 10], [13, 9], [13, 8], [13, 7], [13, 6], [13, 5], [13, 4], [13, 3], [13, 2], [13, 1], [13, 0], [0, 14], [1, 14], [2, 14], [3, 14], [4, 14], [5, 14], [6, 14], [7, 14], [8, 14], [9, 14], [10, 14], [11, 14], [12, 14], [13, 14], [14, 14], [14, 13], [14, 12], [14, 11], [14, 10], [14, 9], [14, 8], [14, 7], [14, 6], [14, 5], [14, 4], [14, 3], [14, 2], [14, 1], [14, 0], [0, 15], [1, 15], [2, 15], [3, 15], [4, 15], [5, 15], [6, 15], [7, 15], [8, 15], [9, 15], [10, 15], [11, 15], [12, 15], [13, 15], [14, 15], [0, 16], [1, 16], [2, 16], [3, 16], [4, 16], [5, 16], [6, 16], [7, 16], [8, 16], [9, 16], [10, 16], [11, 16], [12, 16], [13, 16], [14, 16], [0, 17], [1, 17], [2, 17], [3, 17], [4, 17], [5, 17], [6, 17], [7, 17], [8, 17], [9, 17], [10, 17], [11, 17], [12, 17], [13, 17], [14, 17], [0, 18], [1, 18], [2, 18], [3, 18], [4, 18], [5, 18], [6, 18], [7, 18], [8, 18], [9, 18], [10, 18], [11, 18], [12, 18], [13, 18], [14, 18], [0, 19], [1, 19], [2, 19], [3, 19], [4, 19], [5, 19], [6, 19], [7, 19], [8, 19], [9, 19], [10, 19], [11, 19], [12, 19], [13, 19], [14, 19]]\n assert candidate(rows = 10,cols = 1,rStart = 9,cStart = 0) == [[9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 15,cols = 12,rStart = 7,cStart = 3) == [[7, 3], [7, 4], [8, 4], [8, 3], [8, 2], [7, 2], [6, 2], [6, 3], [6, 4], [6, 5], [7, 5], [8, 5], [9, 5], [9, 4], [9, 3], [9, 2], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [6, 6], [7, 6], [8, 6], [9, 6], [10, 6], [10, 5], [10, 4], [10, 3], [10, 2], [10, 1], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [5, 7], [6, 7], [7, 7], [8, 7], [9, 7], [10, 7], [11, 7], [11, 6], [11, 5], [11, 4], [11, 3], [11, 2], [11, 1], [11, 0], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8], [8, 8], [9, 8], [10, 8], [11, 8], [12, 8], [12, 7], [12, 6], [12, 5], [12, 4], [12, 3], [12, 2], [12, 1], [12, 0], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [3, 9], [4, 9], [5, 9], [6, 9], [7, 9], [8, 9], [9, 9], [10, 9], [11, 9], [12, 9], [13, 9], [13, 8], [13, 7], [13, 6], [13, 5], [13, 4], [13, 3], [13, 2], [13, 1], [13, 0], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10], [10, 10], [11, 10], [12, 10], [13, 10], [14, 10], [14, 9], [14, 8], [14, 7], [14, 6], [14, 5], [14, 4], [14, 3], [14, 2], [14, 1], [14, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [1, 11], [2, 11], [3, 11], [4, 11], [5, 11], [6, 11], [7, 11], [8, 11], [9, 11], [10, 11], [11, 11], [12, 11], [13, 11], [14, 11]]\n assert candidate(rows = 9,cols = 14,rStart = 4,cStart = 7) == [[4, 7], [4, 8], [5, 8], [5, 7], [5, 6], [4, 6], [3, 6], [3, 7], [3, 8], [3, 9], [4, 9], [5, 9], [6, 9], [6, 8], [6, 7], [6, 6], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [7, 9], [7, 8], [7, 7], [7, 6], [7, 5], [7, 4], [6, 4], [5, 4], [4, 4], [3, 4], [2, 4], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [2, 11], [3, 11], [4, 11], [5, 11], [6, 11], [7, 11], [8, 11], [8, 10], [8, 9], [8, 8], [8, 7], [8, 6], [8, 5], [8, 4], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [2, 3], [1, 3], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [1, 12], [2, 12], [3, 12], [4, 12], [5, 12], [6, 12], [7, 12], [8, 12], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [0, 13], [1, 13], [2, 13], [3, 13], [4, 13], [5, 13], [6, 13], [7, 13], [8, 13], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 30,cols = 15,rStart = 29,cStart = 14) == [[29, 14], [29, 13], [28, 13], [28, 14], [29, 12], [28, 12], [27, 12], [27, 13], [27, 14], [29, 11], [28, 11], [27, 11], [26, 11], [26, 12], [26, 13], [26, 14], [29, 10], [28, 10], [27, 10], [26, 10], [25, 10], [25, 11], [25, 12], [25, 13], [25, 14], [29, 9], [28, 9], [27, 9], [26, 9], [25, 9], [24, 9], [24, 10], [24, 11], [24, 12], [24, 13], [24, 14], [29, 8], [28, 8], [27, 8], [26, 8], [25, 8], [24, 8], [23, 8], [23, 9], [23, 10], [23, 11], [23, 12], [23, 13], [23, 14], [29, 7], [28, 7], [27, 7], [26, 7], [25, 7], [24, 7], [23, 7], [22, 7], [22, 8], [22, 9], [22, 10], [22, 11], [22, 12], [22, 13], [22, 14], [29, 6], [28, 6], [27, 6], [26, 6], [25, 6], [24, 6], [23, 6], [22, 6], [21, 6], [21, 7], [21, 8], [21, 9], [21, 10], [21, 11], [21, 12], [21, 13], [21, 14], [29, 5], [28, 5], [27, 5], [26, 5], [25, 5], [24, 5], [23, 5], [22, 5], [21, 5], [20, 5], [20, 6], [20, 7], [20, 8], [20, 9], [20, 10], [20, 11], [20, 12], [20, 13], [20, 14], [29, 4], [28, 4], [27, 4], [26, 4], [25, 4], [24, 4], [23, 4], [22, 4], [21, 4], [20, 4], [19, 4], [19, 5], [19, 6], [19, 7], [19, 8], [19, 9], [19, 10], [19, 11], [19, 12], [19, 13], [19, 14], [29, 3], [28, 3], [27, 3], [26, 3], [25, 3], [24, 3], [23, 3], [22, 3], [21, 3], [20, 3], [19, 3], [18, 3], [18, 4], [18, 5], [18, 6], [18, 7], [18, 8], [18, 9], [18, 10], [18, 11], [18, 12], [18, 13], [18, 14], [29, 2], [28, 2], [27, 2], [26, 2], [25, 2], [24, 2], [23, 2], [22, 2], [21, 2], [20, 2], [19, 2], [18, 2], [17, 2], [17, 3], [17, 4], [17, 5], [17, 6], [17, 7], [17, 8], [17, 9], [17, 10], [17, 11], [17, 12], [17, 13], [17, 14], [29, 1], [28, 1], [27, 1], [26, 1], [25, 1], [24, 1], [23, 1], [22, 1], [21, 1], [20, 1], [19, 1], [18, 1], [17, 1], [16, 1], [16, 2], [16, 3], [16, 4], [16, 5], [16, 6], [16, 7], [16, 8], [16, 9], [16, 10], [16, 11], [16, 12], [16, 13], [16, 14], [29, 0], [28, 0], [27, 0], [26, 0], [25, 0], [24, 0], [23, 0], [22, 0], [21, 0], [20, 0], [19, 0], [18, 0], [17, 0], [16, 0], [15, 0], [15, 1], [15, 2], [15, 3], [15, 4], [15, 5], [15, 6], [15, 7], [15, 8], [15, 9], [15, 10], [15, 11], [15, 12], [15, 13], [15, 14], [14, 0], [14, 1], [14, 2], [14, 3], [14, 4], [14, 5], [14, 6], [14, 7], [14, 8], [14, 9], [14, 10], [14, 11], [14, 12], [14, 13], [14, 14], [13, 0], [13, 1], [13, 2], [13, 3], [13, 4], [13, 5], [13, 6], [13, 7], [13, 8], [13, 9], [13, 10], [13, 11], [13, 12], [13, 13], [13, 14], [12, 0], [12, 1], [12, 2], [12, 3], [12, 4], [12, 5], [12, 6], [12, 7], [12, 8], [12, 9], [12, 10], [12, 11], [12, 12], [12, 13], [12, 14], [11, 0], [11, 1], [11, 2], [11, 3], [11, 4], [11, 5], [11, 6], [11, 7], [11, 8], [11, 9], [11, 10], [11, 11], [11, 12], [11, 13], [11, 14], [10, 0], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 6], [10, 7], [10, 8], [10, 9], [10, 10], [10, 11], [10, 12], [10, 13], [10, 14], [9, 0], [9, 1], [9, 2], [9, 3], [9, 4], [9, 5], [9, 6], [9, 7], [9, 8], [9, 9], [9, 10], [9, 11], [9, 12], [9, 13], [9, 14], [8, 0], [8, 1], [8, 2], [8, 3], [8, 4], [8, 5], [8, 6], [8, 7], [8, 8], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [8, 14], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [6, 14], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14]]\n assert candidate(rows = 20,cols = 5,rStart = 10,cStart = 2) == [[10, 2], [10, 3], [11, 3], [11, 2], [11, 1], [10, 1], [9, 1], [9, 2], [9, 3], [9, 4], [10, 4], [11, 4], [12, 4], [12, 3], [12, 2], [12, 1], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [8, 1], [8, 2], [8, 3], [8, 4], [13, 4], [13, 3], [13, 2], [13, 1], [13, 0], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [14, 4], [14, 3], [14, 2], [14, 1], [14, 0], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [15, 4], [15, 3], [15, 2], [15, 1], [15, 0], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [16, 4], [16, 3], [16, 2], [16, 1], [16, 0], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [17, 4], [17, 3], [17, 2], [17, 1], [17, 0], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [18, 4], [18, 3], [18, 2], [18, 1], [18, 0], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [19, 4], [19, 3], [19, 2], [19, 1], [19, 0], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4]]\n assert candidate(rows = 20,cols = 15,rStart = 10,cStart = 8) == [[10, 8], [10, 9], [11, 9], [11, 8], [11, 7], [10, 7], [9, 7], [9, 8], [9, 9], [9, 10], [10, 10], [11, 10], [12, 10], [12, 9], [12, 8], [12, 7], [12, 6], [11, 6], [10, 6], [9, 6], [8, 6], [8, 7], [8, 8], [8, 9], [8, 10], [8, 11], [9, 11], [10, 11], [11, 11], [12, 11], [13, 11], [13, 10], [13, 9], [13, 8], [13, 7], [13, 6], [13, 5], [12, 5], [11, 5], [10, 5], [9, 5], [8, 5], [7, 5], [7, 6], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [8, 12], [9, 12], [10, 12], [11, 12], [12, 12], [13, 12], [14, 12], [14, 11], [14, 10], [14, 9], [14, 8], [14, 7], [14, 6], [14, 5], [14, 4], [13, 4], [12, 4], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [6, 5], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [7, 13], [8, 13], [9, 13], [10, 13], [11, 13], [12, 13], [13, 13], [14, 13], [15, 13], [15, 12], [15, 11], [15, 10], [15, 9], [15, 8], [15, 7], [15, 6], [15, 5], [15, 4], [15, 3], [14, 3], [13, 3], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [6, 14], [7, 14], [8, 14], [9, 14], [10, 14], [11, 14], [12, 14], [13, 14], [14, 14], [15, 14], [16, 14], [16, 13], [16, 12], [16, 11], [16, 10], [16, 9], [16, 8], [16, 7], [16, 6], [16, 5], [16, 4], [16, 3], [16, 2], [15, 2], [14, 2], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [17, 14], [17, 13], [17, 12], [17, 11], [17, 10], [17, 9], [17, 8], [17, 7], [17, 6], [17, 5], [17, 4], [17, 3], [17, 2], [17, 1], [16, 1], [15, 1], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [18, 14], [18, 13], [18, 12], [18, 11], [18, 10], [18, 9], [18, 8], [18, 7], [18, 6], [18, 5], [18, 4], [18, 3], [18, 2], [18, 1], [18, 0], [17, 0], [16, 0], [15, 0], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [19, 14], [19, 13], [19, 12], [19, 11], [19, 10], [19, 9], [19, 8], [19, 7], [19, 6], [19, 5], [19, 4], [19, 3], [19, 2], [19, 1], [19, 0], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14]]\n assert candidate(rows = 5,cols = 20,rStart = 2,cStart = 19) == [[2, 19], [3, 19], [3, 18], [2, 18], [1, 18], [1, 19], [4, 19], [4, 18], [4, 17], [3, 17], [2, 17], [1, 17], [0, 17], [0, 18], [0, 19], [4, 16], [3, 16], [2, 16], [1, 16], [0, 16], [4, 15], [3, 15], [2, 15], [1, 15], [0, 15], [4, 14], [3, 14], [2, 14], [1, 14], [0, 14], [4, 13], [3, 13], [2, 13], [1, 13], [0, 13], [4, 12], [3, 12], [2, 12], [1, 12], [0, 12], [4, 11], [3, 11], [2, 11], [1, 11], [0, 11], [4, 10], [3, 10], [2, 10], [1, 10], [0, 10], [4, 9], [3, 9], [2, 9], [1, 9], [0, 9], [4, 8], [3, 8], [2, 8], [1, 8], [0, 8], [4, 7], [3, 7], [2, 7], [1, 7], [0, 7], [4, 6], [3, 6], [2, 6], [1, 6], [0, 6], [4, 5], [3, 5], [2, 5], [1, 5], [0, 5], [4, 4], [3, 4], [2, 4], [1, 4], [0, 4], [4, 3], [3, 3], [2, 3], [1, 3], [0, 3], [4, 2], [3, 2], [2, 2], [1, 2], [0, 2], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0]]\n assert candidate(rows = 12,cols = 8,rStart = 0,cStart = 0) == [[0, 0], [0, 1], [1, 1], [1, 0], [0, 2], [1, 2], [2, 2], [2, 1], [2, 0], [0, 3], [1, 3], [2, 3], [3, 3], [3, 2], [3, 1], [3, 0], [0, 4], [1, 4], [2, 4], [3, 4], [4, 4], [4, 3], [4, 2], [4, 1], [4, 0], [0, 5], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [5, 0], [0, 6], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [6, 6], [6, 5], [6, 4], [6, 3], [6, 2], [6, 1], [6, 0], [0, 7], [1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7], [7, 6], [7, 5], [7, 4], [7, 3], [7, 2], [7, 1], [7, 0], [8, 7], [8, 6], [8, 5], [8, 4], [8, 3], [8, 2], [8, 1], [8, 0], [9, 7], [9, 6], [9, 5], [9, 4], [9, 3], [9, 2], [9, 1], [9, 0], [10, 7], [10, 6], [10, 5], [10, 4], [10, 3], [10, 2], [10, 1], [10, 0], [11, 7], [11, 6], [11, 5], [11, 4], [11, 3], [11, 2], [11, 1], [11, 0]]\n assert candidate(rows = 8,cols = 5,rStart = 7,cStart = 0) == [[7, 0], [7, 1], [6, 0], [6, 1], [6, 2], [7, 2], [5, 0], [5, 1], [5, 2], [5, 3], [6, 3], [7, 3], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [5, 4], [6, 4], [7, 4], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4]]\n assert candidate(rows = 7,cols = 7,rStart = 3,cStart = 0) == [[3, 0], [3, 1], [4, 1], [4, 0], [2, 0], [2, 1], [2, 2], [3, 2], [4, 2], [5, 2], [5, 1], [5, 0], [1, 0], [1, 1], [1, 2], [1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [6, 3], [6, 2], [6, 1], [6, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 4], [2, 4], [3, 4], [4, 4], [5, 4], [6, 4], [0, 5], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [6, 5], [0, 6], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [6, 6]]\n assert candidate(rows = 30,cols = 30,rStart = 15,cStart = 15) == [[15, 15], [15, 16], [16, 16], [16, 15], [16, 14], [15, 14], [14, 14], [14, 15], [14, 16], [14, 17], [15, 17], [16, 17], [17, 17], [17, 16], [17, 15], [17, 14], [17, 13], [16, 13], [15, 13], [14, 13], [13, 13], [13, 14], [13, 15], [13, 16], [13, 17], [13, 18], [14, 18], [15, 18], [16, 18], [17, 18], [18, 18], [18, 17], [18, 16], [18, 15], [18, 14], [18, 13], [18, 12], [17, 12], [16, 12], [15, 12], [14, 12], [13, 12], [12, 12], [12, 13], [12, 14], [12, 15], [12, 16], [12, 17], [12, 18], [12, 19], [13, 19], [14, 19], [15, 19], [16, 19], [17, 19], [18, 19], [19, 19], [19, 18], [19, 17], [19, 16], [19, 15], [19, 14], [19, 13], [19, 12], [19, 11], [18, 11], [17, 11], [16, 11], [15, 11], [14, 11], [13, 11], [12, 11], [11, 11], [11, 12], [11, 13], [11, 14], [11, 15], [11, 16], [11, 17], [11, 18], [11, 19], [11, 20], [12, 20], [13, 20], [14, 20], [15, 20], [16, 20], [17, 20], [18, 20], [19, 20], [20, 20], [20, 19], [20, 18], [20, 17], [20, 16], [20, 15], [20, 14], [20, 13], [20, 12], [20, 11], [20, 10], [19, 10], [18, 10], [17, 10], [16, 10], [15, 10], [14, 10], [13, 10], [12, 10], [11, 10], [10, 10], [10, 11], [10, 12], [10, 13], [10, 14], [10, 15], [10, 16], [10, 17], [10, 18], [10, 19], [10, 20], [10, 21], [11, 21], [12, 21], [13, 21], [14, 21], [15, 21], [16, 21], [17, 21], [18, 21], [19, 21], [20, 21], [21, 21], [21, 20], [21, 19], [21, 18], [21, 17], [21, 16], [21, 15], [21, 14], [21, 13], [21, 12], [21, 11], [21, 10], [21, 9], [20, 9], [19, 9], [18, 9], [17, 9], [16, 9], [15, 9], [14, 9], [13, 9], [12, 9], [11, 9], [10, 9], [9, 9], [9, 10], [9, 11], [9, 12], [9, 13], [9, 14], [9, 15], [9, 16], [9, 17], [9, 18], [9, 19], [9, 20], [9, 21], [9, 22], [10, 22], [11, 22], [12, 22], [13, 22], [14, 22], [15, 22], [16, 22], [17, 22], [18, 22], [19, 22], [20, 22], [21, 22], [22, 22], [22, 21], [22, 20], [22, 19], [22, 18], [22, 17], [22, 16], [22, 15], [22, 14], [22, 13], [22, 12], [22, 11], [22, 10], [22, 9], [22, 8], [21, 8], [20, 8], [19, 8], [18, 8], [17, 8], [16, 8], [15, 8], [14, 8], [13, 8], [12, 8], [11, 8], [10, 8], [9, 8], [8, 8], [8, 9], [8, 10], [8, 11], [8, 12], [8, 13], [8, 14], [8, 15], [8, 16], [8, 17], [8, 18], [8, 19], [8, 20], [8, 21], [8, 22], [8, 23], [9, 23], [10, 23], [11, 23], [12, 23], [13, 23], [14, 23], [15, 23], [16, 23], [17, 23], [18, 23], [19, 23], [20, 23], [21, 23], [22, 23], [23, 23], [23, 22], [23, 21], [23, 20], [23, 19], [23, 18], [23, 17], [23, 16], [23, 15], [23, 14], [23, 13], [23, 12], [23, 11], [23, 10], [23, 9], [23, 8], [23, 7], [22, 7], [21, 7], [20, 7], [19, 7], [18, 7], [17, 7], [16, 7], [15, 7], [14, 7], [13, 7], [12, 7], [11, 7], [10, 7], [9, 7], [8, 7], [7, 7], [7, 8], [7, 9], [7, 10], [7, 11], [7, 12], [7, 13], [7, 14], [7, 15], [7, 16], [7, 17], [7, 18], [7, 19], [7, 20], [7, 21], [7, 22], [7, 23], [7, 24], [8, 24], [9, 24], [10, 24], [11, 24], [12, 24], [13, 24], [14, 24], [15, 24], [16, 24], [17, 24], [18, 24], [19, 24], [20, 24], [21, 24], [22, 24], [23, 24], [24, 24], [24, 23], [24, 22], [24, 21], [24, 20], [24, 19], [24, 18], [24, 17], [24, 16], [24, 15], [24, 14], [24, 13], [24, 12], [24, 11], [24, 10], [24, 9], [24, 8], [24, 7], [24, 6], [23, 6], [22, 6], [21, 6], [20, 6], [19, 6], [18, 6], [17, 6], [16, 6], [15, 6], [14, 6], [13, 6], [12, 6], [11, 6], [10, 6], [9, 6], [8, 6], [7, 6], [6, 6], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12], [6, 13], [6, 14], [6, 15], [6, 16], [6, 17], [6, 18], [6, 19], [6, 20], [6, 21], [6, 22], [6, 23], [6, 24], [6, 25], [7, 25], [8, 25], [9, 25], [10, 25], [11, 25], [12, 25], [13, 25], [14, 25], [15, 25], [16, 25], [17, 25], [18, 25], [19, 25], [20, 25], [21, 25], [22, 25], [23, 25], [24, 25], [25, 25], [25, 24], [25, 23], [25, 22], [25, 21], [25, 20], [25, 19], [25, 18], [25, 17], [25, 16], [25, 15], [25, 14], [25, 13], [25, 12], [25, 11], [25, 10], [25, 9], [25, 8], [25, 7], [25, 6], [25, 5], [24, 5], [23, 5], [22, 5], [21, 5], [20, 5], [19, 5], [18, 5], [17, 5], [16, 5], [15, 5], [14, 5], [13, 5], [12, 5], [11, 5], [10, 5], [9, 5], [8, 5], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10], [5, 11], [5, 12], [5, 13], [5, 14], [5, 15], [5, 16], [5, 17], [5, 18], [5, 19], [5, 20], [5, 21], [5, 22], [5, 23], [5, 24], [5, 25], [5, 26], [6, 26], [7, 26], [8, 26], [9, 26], [10, 26], [11, 26], [12, 26], [13, 26], [14, 26], [15, 26], [16, 26], [17, 26], [18, 26], [19, 26], [20, 26], [21, 26], [22, 26], [23, 26], [24, 26], [25, 26], [26, 26], [26, 25], [26, 24], [26, 23], [26, 22], [26, 21], [26, 20], [26, 19], [26, 18], [26, 17], [26, 16], [26, 15], [26, 14], [26, 13], [26, 12], [26, 11], [26, 10], [26, 9], [26, 8], [26, 7], [26, 6], [26, 5], [26, 4], [25, 4], [24, 4], [23, 4], [22, 4], [21, 4], [20, 4], [19, 4], [18, 4], [17, 4], [16, 4], [15, 4], [14, 4], [13, 4], [12, 4], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [4, 14], [4, 15], [4, 16], [4, 17], [4, 18], [4, 19], [4, 20], [4, 21], [4, 22], [4, 23], [4, 24], [4, 25], [4, 26], [4, 27], [5, 27], [6, 27], [7, 27], [8, 27], [9, 27], [10, 27], [11, 27], [12, 27], [13, 27], [14, 27], [15, 27], [16, 27], [17, 27], [18, 27], [19, 27], [20, 27], [21, 27], [22, 27], [23, 27], [24, 27], [25, 27], [26, 27], [27, 27], [27, 26], [27, 25], [27, 24], [27, 23], [27, 22], [27, 21], [27, 20], [27, 19], [27, 18], [27, 17], [27, 16], [27, 15], [27, 14], [27, 13], [27, 12], [27, 11], [27, 10], [27, 9], [27, 8], [27, 7], [27, 6], [27, 5], [27, 4], [27, 3], [26, 3], [25, 3], [24, 3], [23, 3], [22, 3], [21, 3], [20, 3], [19, 3], [18, 3], [17, 3], [16, 3], [15, 3], [14, 3], [13, 3], [12, 3], [11, 3], [10, 3], [9, 3], [8, 3], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14], [3, 15], [3, 16], [3, 17], [3, 18], [3, 19], [3, 20], [3, 21], [3, 22], [3, 23], [3, 24], [3, 25], [3, 26], [3, 27], [3, 28], [4, 28], [5, 28], [6, 28], [7, 28], [8, 28], [9, 28], [10, 28], [11, 28], [12, 28], [13, 28], [14, 28], [15, 28], [16, 28], [17, 28], [18, 28], [19, 28], [20, 28], [21, 28], [22, 28], [23, 28], [24, 28], [25, 28], [26, 28], [27, 28], [28, 28], [28, 27], [28, 26], [28, 25], [28, 24], [28, 23], [28, 22], [28, 21], [28, 20], [28, 19], [28, 18], [28, 17], [28, 16], [28, 15], [28, 14], [28, 13], [28, 12], [28, 11], [28, 10], [28, 9], [28, 8], [28, 7], [28, 6], [28, 5], [28, 4], [28, 3], [28, 2], [27, 2], [26, 2], [25, 2], [24, 2], [23, 2], [22, 2], [21, 2], [20, 2], [19, 2], [18, 2], [17, 2], [16, 2], [15, 2], [14, 2], [13, 2], [12, 2], [11, 2], [10, 2], [9, 2], [8, 2], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [2, 16], [2, 17], [2, 18], [2, 19], [2, 20], [2, 21], [2, 22], [2, 23], [2, 24], [2, 25], [2, 26], [2, 27], [2, 28], [2, 29], [3, 29], [4, 29], [5, 29], [6, 29], [7, 29], [8, 29], [9, 29], [10, 29], [11, 29], [12, 29], [13, 29], [14, 29], [15, 29], [16, 29], [17, 29], [18, 29], [19, 29], [20, 29], [21, 29], [22, 29], [23, 29], [24, 29], [25, 29], [26, 29], [27, 29], [28, 29], [29, 29], [29, 28], [29, 27], [29, 26], [29, 25], [29, 24], [29, 23], [29, 22], [29, 21], [29, 20], [29, 19], [29, 18], [29, 17], [29, 16], [29, 15], [29, 14], [29, 13], [29, 12], [29, 11], [29, 10], [29, 9], [29, 8], [29, 7], [29, 6], [29, 5], [29, 4], [29, 3], [29, 2], [29, 1], [28, 1], [27, 1], [26, 1], [25, 1], [24, 1], [23, 1], [22, 1], [21, 1], [20, 1], [19, 1], [18, 1], [17, 1], [16, 1], [15, 1], [14, 1], [13, 1], [12, 1], [11, 1], [10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [1, 24], [1, 25], [1, 26], [1, 27], [1, 28], [1, 29], [29, 0], [28, 0], [27, 0], [26, 0], [25, 0], [24, 0], [23, 0], [22, 0], [21, 0], [20, 0], [19, 0], [18, 0], [17, 0], [16, 0], [15, 0], [14, 0], [13, 0], [12, 0], [11, 0], [10, 0], [9, 0], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29]]\n assert candidate(rows = 8,cols = 4,rStart = 7,cStart = 3) == [[7, 3], [7, 2], [6, 2], [6, 3], [7, 1], [6, 1], [5, 1], [5, 2], [5, 3], [7, 0], [6, 0], [5, 0], [4, 0], [4, 1], [4, 2], [4, 3], [3, 0], [3, 1], [3, 2], [3, 3], [2, 0], [2, 1], [2, 2], [2, 3], [1, 0], [1, 1], [1, 2], [1, 3], [0, 0], [0, 1], [0, 2], [0, 3]]\n assert candidate(rows = 8,cols = 8,rStart = 7,cStart = 7) == [[7, 7], [7, 6], [6, 6], [6, 7], [7, 5], [6, 5], [5, 5], [5, 6], [5, 7], [7, 4], [6, 4], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [2, 0], [1, 0], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7]]\n"}, "metadata": {"canonical_parameter_names": ["rows", "cols", "rStart", "cStart"], "leetcode_dataset_entry_point": "Solution().spiralMatrixIII", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var spiralMatrixIII = function(rows, cols, rStart, cStart) {", "container": null, "callable": "spiralMatrixIII", "parameters": [{"name": "rows", "type": "number"}, {"name": "cols", "type": "number"}, {"name": "rStart", "type": "number"}, {"name": "cStart", "type": "number"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 886, "task_id": "possible-bipartition", "difficulty": "Medium", "problem_description": "We want to split a group of n people (labeled from 1 to n) into two groups of any size. Each person may dislike some other people, and they should not go into the same group.\nGiven the integer n and the array dislikes where dislikes[i] = [ai, bi] indicates that the person labeled ai does not like the person labeled bi, return true if it is possible to split everyone into two groups in this way.\n \nExample 1:\n\nInput: n = 4, dislikes = [[1,2],[1,3],[2,4]]\nOutput: true\nExplanation: The first group has [1,4], and the second group has [2,3].\n\nExample 2:\n\nInput: n = 3, dislikes = [[1,2],[1,3],[2,3]]\nOutput: false\nExplanation: We need at least 3 groups to divide them. We cannot put them in two groups.\n\n \nConstraints:\n\n1 <= n <= 2000\n0 <= dislikes.length <= 104\ndislikes[i].length == 2\n1 <= ai < bi <= n\nAll the pairs of dislikes are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 4,dislikes = [[1, 2], [1, 3], [2, 4]]) == True\n assert candidate(n = 5,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [1, 5]]) == False\n assert candidate(n = 3,dislikes = [[1, 2]]) == True\n assert candidate(n = 3,dislikes = [[1, 2], [2, 3]]) == True\n assert candidate(n = 10,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [1, 3], [5, 7], [9, 2]]) == True\n assert candidate(n = 1,dislikes = []) == True\n assert candidate(n = 6,dislikes = [[1, 2], [3, 4], [5, 6]]) == True\n assert candidate(n = 3,dislikes = [[1, 2], [1, 3], [2, 3]]) == False\n assert candidate(n = 5,dislikes = [[1, 2], [3, 4]]) == True\n assert candidate(n = 6,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 1]]) == True\n assert candidate(n = 5,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5]]) == True\n assert candidate(n = 5,dislikes = [[1, 2], [3, 4], [4, 5], [3, 5]]) == False\n assert candidate(n = 10,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [1, 3], [4, 6], [7, 9], [2, 10]]) == True\n assert candidate(n = 20,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [1, 3], [5, 7], [9, 11], [13, 15], [17, 19], [2, 4], [6, 8], [10, 12], [14, 16], [18, 20]]) == True\n assert candidate(n = 15,dislikes = [[1, 15], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 1], [1, 13], [5, 9], [7, 11]]) == False\n assert candidate(n = 15,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [1, 15]]) == False\n assert candidate(n = 7,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [1, 7]]) == False\n assert candidate(n = 7,dislikes = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 7], [7, 4], [1, 5], [2, 6], [3, 7]]) == False\n assert candidate(n = 10,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [1, 3], [5, 7], [9, 2], [6, 4], [8, 10]]) == True\n assert candidate(n = 10,dislikes = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [7, 8], [8, 9], [9, 10], [10, 7]]) == False\n assert candidate(n = 12,dislikes = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 1], [12, 2]]) == True\n assert candidate(n = 7,dislikes = [[1, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 1], [7, 2]]) == False\n assert candidate(n = 12,dislikes = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [7, 8], [8, 9], [9, 7], [10, 11], [11, 12], [12, 10]]) == False\n assert candidate(n = 15,dislikes = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [6, 12], [7, 13], [8, 14], [9, 15]]) == True\n assert candidate(n = 7,dislikes = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6]]) == False\n assert candidate(n = 2000,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], [25, 26], [26, 27], [27, 28], [28, 29], [29, 30], [30, 1]]) == True\n assert candidate(n = 9,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [1, 9], [1, 3], [3, 5], [5, 7], [2, 4], [4, 6], [6, 8]]) == False\n assert candidate(n = 6,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 1], [1, 3], [4, 6]]) == False\n assert candidate(n = 7,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [1, 7], [1, 3], [2, 4], [5, 7]]) == False\n assert candidate(n = 6,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [1, 6]]) == True\n assert candidate(n = 6,dislikes = [[1, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 6]]) == True\n assert candidate(n = 8,dislikes = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [7, 8], [8, 7], [1, 4], [2, 5], [3, 6], [1, 5], [2, 6], [3, 4], [7, 4], [8, 5], [7, 5], [8, 6]]) == False\n assert candidate(n = 12,dislikes = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [7, 8], [8, 9], [9, 7], [10, 11], [11, 12], [12, 10], [1, 4], [2, 7], [3, 8], [5, 9], [6, 10], [11, 1], [12, 2]]) == False\n assert candidate(n = 8,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [1, 3], [2, 4], [5, 7], [6, 8]]) == True\n assert candidate(n = 10,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [1, 3], [2, 4], [5, 7], [6, 8], [7, 9], [8, 10], [9, 1]]) == True\n assert candidate(n = 20,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19]]) == True\n assert candidate(n = 10,dislikes = [[1, 3], [1, 5], [2, 4], [2, 6], [3, 5], [3, 7], [4, 6], [4, 8], [5, 7], [5, 9], [6, 8], [6, 10], [7, 9], [8, 10]]) == False\n assert candidate(n = 12,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 1]]) == True\n assert candidate(n = 10,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [1, 3], [2, 4], [5, 7], [6, 8], [9, 2], [10, 4]]) == True\n assert candidate(n = 9,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [1, 9], [2, 8], [3, 7], [4, 6]]) == False\n assert candidate(n = 2000,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [1, 15]]) == False\n assert candidate(n = 16,dislikes = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16]]) == True\n assert candidate(n = 6,dislikes = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [1, 4], [2, 5], [3, 6]]) == False\n assert candidate(n = 9,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 1], [1, 4], [2, 5], [3, 6], [7, 9], [8, 2]]) == False\n assert candidate(n = 8,dislikes = [[1, 2], [2, 3], [3, 4], [4, 1], [1, 5], [5, 6], [6, 7], [7, 8], [8, 1], [5, 3], [6, 4], [7, 2]]) == False\n assert candidate(n = 15,dislikes = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [7, 8], [8, 9], [9, 7], [10, 11], [11, 12], [12, 10], [13, 14], [14, 15], [15, 13]]) == False\n assert candidate(n = 15,dislikes = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [7, 8], [8, 9], [9, 7], [10, 11], [11, 12], [12, 10], [13, 14], [14, 15], [15, 13], [1, 10], [2, 11], [3, 12], [4, 13], [5, 14], [6, 15], [7, 14], [8, 15], [9, 13], [1, 13], [2, 14], [3, 15], [4, 10], [5, 11], [6, 12]]) == False\n assert candidate(n = 20,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 1], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 16], [15, 17], [16, 18], [17, 19], [18, 20], [19, 1], [20, 2]]) == False\n assert candidate(n = 8,dislikes = [[1, 2], [2, 3], [3, 4], [4, 1], [5, 6], [6, 7], [7, 8], [8, 5], [1, 5], [2, 6], [3, 7], [4, 8]]) == True\n assert candidate(n = 15,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [1, 13], [14, 3], [5, 7], [2, 12], [15, 1]]) == True\n assert candidate(n = 12,dislikes = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [7, 8], [8, 9], [9, 7], [10, 11], [11, 12], [12, 10], [1, 4], [2, 5], [3, 6], [7, 10], [8, 11], [9, 12]]) == False\n assert candidate(n = 7,dislikes = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [7, 1], [7, 4]]) == False\n assert candidate(n = 15,dislikes = [[1, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 1]]) == True\n assert candidate(n = 7,dislikes = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [7, 1]]) == False\n assert candidate(n = 15,dislikes = [[1, 14], [2, 15], [3, 13], [4, 12], [5, 11], [6, 10], [7, 9], [8, 8], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15]]) == False\n assert candidate(n = 8,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [1, 3], [2, 4], [5, 7], [6, 8], [1, 5], [2, 6], [3, 7], [4, 8]]) == True\n assert candidate(n = 10,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [6, 7], [7, 8], [8, 9], [9, 10], [10, 6], [1, 6], [2, 7], [3, 8], [4, 9], [5, 10]]) == False\n assert candidate(n = 10,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [1, 3], [3, 5], [5, 7], [7, 9], [2, 4], [4, 6], [6, 8], [8, 10]]) == False\n assert candidate(n = 16,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [1, 3], [2, 4], [5, 7], [6, 8], [9, 11], [10, 12], [13, 15], [14, 16]]) == True\n assert candidate(n = 15,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 1]]) == False\n assert candidate(n = 10,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1]]) == True\n assert candidate(n = 10,dislikes = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [2, 3], [4, 5], [6, 7], [8, 9], [9, 10]]) == False\n assert candidate(n = 8,dislikes = [[1, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 1], [8, 2]]) == True\n assert candidate(n = 20,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 1]]) == True\n assert candidate(n = 10,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [1, 10], [2, 9], [3, 8], [4, 7], [5, 2], [6, 3]]) == True\n assert candidate(n = 10,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [6, 7], [7, 8], [8, 9], [9, 10], [10, 6]]) == False\n assert candidate(n = 8,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 1], [1, 4], [2, 5], [3, 6], [7, 1]]) == False\n assert candidate(n = 10,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [1, 3], [4, 6], [7, 9], [2, 8], [5, 10]]) == True\n assert candidate(n = 14,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 1], [1, 3], [2, 4], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 2]]) == False\n assert candidate(n = 12,dislikes = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11]]) == False\n assert candidate(n = 18,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [1, 3], [2, 4], [5, 7], [6, 8], [9, 11], [10, 12], [13, 15], [14, 16], [17, 1], [18, 2]]) == True\n assert candidate(n = 8,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 1]]) == True\n assert candidate(n = 18,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 1]]) == True\n assert candidate(n = 20,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [1, 3], [2, 4], [5, 7], [6, 8], [9, 11], [10, 12], [13, 15], [14, 16], [17, 19], [18, 20], [1, 5], [2, 6], [3, 7], [4, 8], [9, 13], [10, 14], [11, 15], [12, 16], [17, 1], [18, 2], [19, 3], [20, 4]]) == True\n assert candidate(n = 8,dislikes = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 1], [8, 2]]) == True\n assert candidate(n = 10,dislikes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [1, 3], [2, 4], [5, 7], [6, 8], [7, 9], [8, 10]]) == True\n"}, "metadata": {"canonical_parameter_names": ["n", "dislikes"], "leetcode_dataset_entry_point": "Solution().possibleBipartition", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var possibleBipartition = function(n, dislikes) {", "container": null, "callable": "possibleBipartition", "parameters": [{"name": "n", "type": "number"}, {"name": "dislikes", "type": "number[][]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 887, "task_id": "super-egg-drop", "difficulty": "Hard", "problem_description": "You are given k identical eggs and you have access to a building with n floors labeled from 1 to n.\nYou know that there exists a floor f where 0 <= f <= n such that any egg dropped at a floor higher than f will break, and any egg dropped at or below floor f will not break.\nEach move, you may take an unbroken egg and drop it from any floor x (where 1 <= x <= n). If the egg breaks, you can no longer use it. However, if the egg does not break, you may reuse it in future moves.\nReturn the minimum number of moves that you need to determine with certainty what the value of f is.\n \nExample 1:\n\nInput: k = 1, n = 2\nOutput: 2\nExplanation: \nDrop the egg from floor 1. If it breaks, we know that f = 0.\nOtherwise, drop the egg from floor 2. If it breaks, we know that f = 1.\nIf it does not break, then we know f = 2.\nHence, we need at minimum 2 moves to determine with certainty what the value of f is.\n\nExample 2:\n\nInput: k = 2, n = 6\nOutput: 3\n\nExample 3:\n\nInput: k = 3, n = 14\nOutput: 4\n\n \nConstraints:\n\n1 <= k <= 100\n1 <= n <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(k = 2,n = 1) == 1\n assert candidate(k = 5,n = 1000) == 11\n assert candidate(k = 1,n = 100) == 100\n assert candidate(k = 1,n = 2) == 2\n assert candidate(k = 2,n = 6) == 3\n assert candidate(k = 50,n = 10000) == 14\n assert candidate(k = 10,n = 5000) == 13\n assert candidate(k = 10,n = 1000) == 10\n assert candidate(k = 2,n = 100) == 14\n assert candidate(k = 2,n = 1000) == 45\n assert candidate(k = 3,n = 5) == 3\n assert candidate(k = 100,n = 10000) == 14\n assert candidate(k = 3,n = 25) == 5\n assert candidate(k = 10,n = 10000) == 14\n assert candidate(k = 3,n = 14) == 4\n assert candidate(k = 1,n = 1) == 1\n assert candidate(k = 8,n = 9000) == 14\n assert candidate(k = 3,n = 20) == 5\n assert candidate(k = 7,n = 5000) == 13\n assert candidate(k = 3,n = 50) == 7\n assert candidate(k = 2,n = 10) == 4\n assert candidate(k = 10,n = 200) == 8\n assert candidate(k = 3,n = 1000) == 19\n assert candidate(k = 4,n = 25) == 5\n assert candidate(k = 24,n = 450) == 9\n assert candidate(k = 15,n = 3000) == 12\n assert candidate(k = 6,n = 3000) == 13\n assert candidate(k = 10,n = 500) == 9\n assert candidate(k = 50,n = 7500) == 13\n assert candidate(k = 20,n = 3000) == 12\n assert candidate(k = 5,n = 100) == 7\n assert candidate(k = 5,n = 5000) == 16\n assert candidate(k = 50,n = 750) == 10\n assert candidate(k = 75,n = 9000) == 14\n assert candidate(k = 70,n = 950) == 10\n assert candidate(k = 50,n = 1000) == 10\n assert candidate(k = 75,n = 9900) == 14\n assert candidate(k = 90,n = 9999) == 14\n assert candidate(k = 4,n = 2000) == 16\n assert candidate(k = 25,n = 8000) == 13\n assert candidate(k = 4,n = 20) == 5\n assert candidate(k = 25,n = 7500) == 13\n assert candidate(k = 4,n = 30) == 5\n assert candidate(k = 50,n = 7000) == 13\n assert candidate(k = 20,n = 4000) == 12\n assert candidate(k = 40,n = 650) == 10\n assert candidate(k = 60,n = 8000) == 13\n assert candidate(k = 8,n = 150) == 8\n assert candidate(k = 90,n = 10000) == 14\n assert candidate(k = 3,n = 1234) == 20\n assert candidate(k = 5,n = 10000) == 18\n assert candidate(k = 3,n = 100) == 9\n assert candidate(k = 25,n = 6000) == 13\n assert candidate(k = 25,n = 500) == 9\n assert candidate(k = 4,n = 4096) == 19\n assert candidate(k = 75,n = 10000) == 14\n assert candidate(k = 4,n = 256) == 10\n assert candidate(k = 5,n = 500) == 10\n assert candidate(k = 30,n = 550) == 10\n assert candidate(k = 60,n = 9500) == 14\n assert candidate(k = 75,n = 8000) == 13\n assert candidate(k = 10,n = 3000) == 12\n assert candidate(k = 50,n = 9000) == 14\n assert candidate(k = 10,n = 2000) == 11\n assert candidate(k = 60,n = 850) == 10\n assert candidate(k = 2,n = 32) == 8\n assert candidate(k = 80,n = 9999) == 14\n assert candidate(k = 5,n = 50) == 6\n assert candidate(k = 20,n = 8000) == 13\n assert candidate(k = 100,n = 5000) == 13\n assert candidate(k = 99,n = 9999) == 14\n assert candidate(k = 4,n = 100) == 8\n assert candidate(k = 4,n = 700) == 12\n assert candidate(k = 100,n = 9999) == 14\n assert candidate(k = 75,n = 7500) == 13\n assert candidate(k = 6,n = 2000) == 12\n assert candidate(k = 8,n = 4000) == 13\n assert candidate(k = 100,n = 1) == 1\n assert candidate(k = 8,n = 8192) == 14\n assert candidate(k = 8,n = 200) == 8\n assert candidate(k = 50,n = 5000) == 13\n assert candidate(k = 3,n = 250) == 12\n assert candidate(k = 90,n = 9000) == 14\n assert candidate(k = 90,n = 9500) == 14\n assert candidate(k = 2,n = 10000) == 141\n assert candidate(k = 12,n = 250) == 8\n assert candidate(k = 15,n = 5000) == 13\n assert candidate(k = 20,n = 9000) == 14\n assert candidate(k = 18,n = 350) == 9\n assert candidate(k = 6,n = 70) == 7\n assert candidate(k = 20,n = 5000) == 13\n assert candidate(k = 7,n = 3456) == 13\n"}, "metadata": {"canonical_parameter_names": ["k", "n"], "leetcode_dataset_entry_point": "Solution().superEggDrop", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var superEggDrop = function(k, n) {", "container": null, "callable": "superEggDrop", "parameters": [{"name": "k", "type": "number"}, {"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 888, "task_id": "fair-candy-swap", "difficulty": "Easy", "problem_description": "Alice and Bob have a different total number of candies. You are given two integer arrays aliceSizes and bobSizes where aliceSizes[i] is the number of candies of the ith box of candy that Alice has and bobSizes[j] is the number of candies of the jth box of candy that Bob has.\nSince they are friends, they would like to exchange one candy box each so that after the exchange, they both have the same total amount of candy. The total amount of candy a person has is the sum of the number of candies in each box they have.\nReturn an integer array answer where answer[0] is the number of candies in the box that Alice must exchange, and answer[1] is the number of candies in the box that Bob must exchange. If there are multiple answers, you may return any one of them. It is guaranteed that at least one answer exists.\n \nExample 1:\n\nInput: aliceSizes = [1,1], bobSizes = [2,2]\nOutput: [1,2]\n\nExample 2:\n\nInput: aliceSizes = [1,2], bobSizes = [2,3]\nOutput: [1,2]\n\nExample 3:\n\nInput: aliceSizes = [2], bobSizes = [1,3]\nOutput: [2,3]\n\n \nConstraints:\n\n1 <= aliceSizes.length, bobSizes.length <= 104\n1 <= aliceSizes[i], bobSizes[j] <= 105\nAlice and Bob have a different total number of candies.\nThere will be at least one valid answer for the given input.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(aliceSizes = [3, 7],bobSizes = [1, 9]) == None\n assert candidate(aliceSizes = [10, 20, 30],bobSizes = [5, 15, 25]) == None\n assert candidate(aliceSizes = [1, 1],bobSizes = [2, 2]) == [1, 2]\n assert candidate(aliceSizes = [5, 4, 3],bobSizes = [7, 8, 9]) == [3, 9]\n assert candidate(aliceSizes = [4, 1, 2, 1],bobSizes = [1, 2, 2, 10]) == None\n assert candidate(aliceSizes = [1, 3, 5, 7],bobSizes = [2, 4, 6, 8]) == None\n assert candidate(aliceSizes = [1, 2, 5],bobSizes = [2, 4]) == [5, 4]\n assert candidate(aliceSizes = [35, 17, 4, 24, 19],bobSizes = [68, 32, 20, 92, 21]) == None\n assert candidate(aliceSizes = [1, 2],bobSizes = [2, 3]) == [1, 2]\n assert candidate(aliceSizes = [3, 4],bobSizes = [2, 5]) == None\n assert candidate(aliceSizes = [2],bobSizes = [1, 3]) == [2, 3]\n assert candidate(aliceSizes = [35, 17, 4, 24, 10],bobSizes = [66, 56, 5, 1, 58]) == [10, 58]\n assert candidate(aliceSizes = [4, 1, 2, 1],bobSizes = [1, 2, 2, 3]) == [1, 1]\n assert candidate(aliceSizes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],bobSizes = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == None\n assert candidate(aliceSizes = [1, 3, 5, 7, 9, 11, 13, 15],bobSizes = [2, 4, 6, 8, 10, 12, 14, 16]) == None\n assert candidate(aliceSizes = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],bobSizes = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == [5, 30]\n assert candidate(aliceSizes = [10000, 20000, 30000, 40000],bobSizes = [5000, 15000, 25000, 35000]) == None\n assert candidate(aliceSizes = [12345, 67890, 54321, 98765],bobSizes = [23456, 78901, 1234, 5678]) == None\n assert candidate(aliceSizes = [55555, 44444, 33333, 22222, 11111],bobSizes = [99999, 88888, 77777, 66666, 55555]) == None\n assert candidate(aliceSizes = [100, 200, 300, 400, 500],bobSizes = [90, 190, 290, 390, 490]) == None\n assert candidate(aliceSizes = [100, 200, 300, 400],bobSizes = [150, 250, 350, 450]) == None\n assert candidate(aliceSizes = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120],bobSizes = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115]) == None\n assert candidate(aliceSizes = [5, 20, 10, 30],bobSizes = [15, 25, 35, 5]) == None\n assert candidate(aliceSizes = [2, 4, 6, 8, 10, 12],bobSizes = [1, 3, 5, 7, 9, 11, 13]) == None\n assert candidate(aliceSizes = [100, 200, 300, 400],bobSizes = [150, 250, 350, 450, 550]) == None\n assert candidate(aliceSizes = [50000, 25000, 12500, 6250, 3125],bobSizes = [45000, 22500, 11250, 5625, 2812]) == None\n assert candidate(aliceSizes = [100, 200, 300, 400],bobSizes = [50, 150, 250, 350]) == None\n assert candidate(aliceSizes = [101, 202, 303, 404, 505, 606, 707, 808, 909],bobSizes = [99, 198, 297, 396, 495, 594, 693, 792, 891]) == None\n assert candidate(aliceSizes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],bobSizes = [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54]) == None\n assert candidate(aliceSizes = [100000, 50000, 25000, 12500, 6250],bobSizes = [105000, 55000, 27500, 13750, 6875]) == None\n assert candidate(aliceSizes = [100000, 1, 2, 3],bobSizes = [99999, 4, 5, 6]) == [1, 5]\n assert candidate(aliceSizes = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],bobSizes = [50, 150, 250, 350, 450, 550, 650, 750, 850, 950]) == [300, 50]\n assert candidate(aliceSizes = [9, 18, 27, 36, 45],bobSizes = [12, 24, 36, 48, 60]) == None\n assert candidate(aliceSizes = [100, 200, 300, 400, 500],bobSizes = [50, 150, 250, 350, 450]) == None\n assert candidate(aliceSizes = [9, 18, 27, 36, 45],bobSizes = [10, 20, 30, 40, 50]) == None\n assert candidate(aliceSizes = [99, 198, 297, 396, 495],bobSizes = [100, 200, 300, 400, 500]) == None\n assert candidate(aliceSizes = [100, 200, 300, 400, 500, 600, 700],bobSizes = [75, 175, 275, 375, 475, 575, 675]) == None\n assert candidate(aliceSizes = [50, 51, 52, 53, 54, 55, 56, 57, 58, 59],bobSizes = [49, 48, 47, 46, 45, 44, 43, 42, 41, 40]) == None\n assert candidate(aliceSizes = [10, 20, 30, 40, 50],bobSizes = [5, 15, 25, 35, 45]) == None\n assert candidate(aliceSizes = [1000, 2000, 3000, 4000, 5000],bobSizes = [1500, 2500, 3500, 4500, 5500]) == None\n assert candidate(aliceSizes = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],bobSizes = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == [8, 1]\n assert candidate(aliceSizes = [10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000],bobSizes = [5000, 15000, 25000, 35000, 45000, 55000, 65000, 75000, 85000]) == None\n assert candidate(aliceSizes = [100, 200, 300, 400, 500, 600, 700, 800],bobSizes = [150, 250, 350, 450, 550, 650, 750, 850, 950]) == None\n assert candidate(aliceSizes = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],bobSizes = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == [1, 6]\n assert candidate(aliceSizes = [99999, 88888, 77777, 66666, 55555],bobSizes = [11111, 22222, 33333, 44444, 66666, 77777, 88888]) == [99999, 77777]\n assert candidate(aliceSizes = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],bobSizes = [1500, 2500, 3500, 4500, 5500, 6500, 7500, 8500, 9500, 10500]) == [1000, 3500]\n assert candidate(aliceSizes = [101, 203, 305, 407, 509],bobSizes = [102, 204, 306, 408, 510]) == None\n assert candidate(aliceSizes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],bobSizes = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == None\n assert candidate(aliceSizes = [10, 20, 30, 40],bobSizes = [5, 15, 25, 35, 45, 55]) == None\n assert candidate(aliceSizes = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],bobSizes = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105]) == None\n assert candidate(aliceSizes = [1, 5, 9, 13, 17, 21],bobSizes = [2, 6, 10, 14, 18, 22]) == None\n assert candidate(aliceSizes = [50, 51, 52, 53, 54, 55, 56],bobSizes = [49, 50, 51, 52, 53, 54, 55]) == [52, 49]\n assert candidate(aliceSizes = [88, 44, 22, 11, 55, 33, 66, 99, 77],bobSizes = [132, 66, 33, 22, 110, 44, 88, 11, 77]) == [88, 132]\n assert candidate(aliceSizes = [23456, 78901, 34567, 89012],bobSizes = [65432, 12345, 54321, 98765]) == None\n assert candidate(aliceSizes = [10000, 20000, 30000, 40000, 50000, 60000],bobSizes = [15000, 25000, 35000, 45000, 55000, 65000]) == [10000, 25000]\n assert candidate(aliceSizes = [1000, 2000, 3000, 4000, 5000],bobSizes = [5500, 6500, 7500, 8500]) == [1000, 7500]\n assert candidate(aliceSizes = [500, 600, 700, 800, 900],bobSizes = [100, 200, 300, 400, 1400]) == None\n assert candidate(aliceSizes = [99, 199, 299, 399, 499, 599, 699, 799, 899, 999],bobSizes = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == None\n assert candidate(aliceSizes = [3, 5, 7, 9, 11, 13, 15, 17, 19],bobSizes = [4, 6, 8, 10, 12, 14, 16, 18, 20]) == [3, 8]\n assert candidate(aliceSizes = [12345, 6789, 2468, 1357, 9753],bobSizes = [8642, 7531, 9513, 5791, 6842]) == None\n assert candidate(aliceSizes = [23, 45, 67, 89, 101, 123, 145],bobSizes = [34, 56, 78, 90, 112, 134, 156]) == None\n assert candidate(aliceSizes = [100000, 100000, 100000, 100000, 100000],bobSizes = [50000, 50000, 50000, 50000, 50000, 50000, 50000]) == None\n assert candidate(aliceSizes = [50, 100, 150, 200, 250, 300],bobSizes = [60, 110, 160, 210, 260, 310]) == None\n assert candidate(aliceSizes = [10000, 20000, 30000, 40000],bobSizes = [5000, 6000, 7000, 8000]) == None\n assert candidate(aliceSizes = [100000, 1, 2, 3, 4, 5, 6, 7, 8, 9],bobSizes = [99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991, 99990]) == None\n assert candidate(aliceSizes = [10000, 20000, 30000, 40000, 50000],bobSizes = [5000, 15000, 25000, 35000, 45000, 55000]) == [10000, 25000]\n assert candidate(aliceSizes = [5, 7, 9, 11, 13, 15, 17, 19, 21, 23],bobSizes = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == [17, 2]\n assert candidate(aliceSizes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],bobSizes = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == None\n assert candidate(aliceSizes = [1000, 2000, 3000, 4000],bobSizes = [500, 1500, 2500, 3500]) == None\n assert candidate(aliceSizes = [1000, 2000, 3000, 4000, 5000],bobSizes = [1100, 2100, 3100, 4100, 5100]) == None\n assert candidate(aliceSizes = [1, 3, 5, 7, 9, 11],bobSizes = [2, 4, 6, 8, 10, 12]) == [1, 4]\n assert candidate(aliceSizes = [1, 1, 1, 1, 10000],bobSizes = [5000, 5000, 5000, 5000, 5000]) == None\n assert candidate(aliceSizes = [99990, 1, 2, 3, 4, 5],bobSizes = [100000, 6, 7, 8, 9, 10]) == None\n assert candidate(aliceSizes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 100000],bobSizes = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1]) == None\n assert candidate(aliceSizes = [10000, 20000, 30000],bobSizes = [15000, 25000, 35000]) == None\n assert candidate(aliceSizes = [7, 2, 5, 3, 8, 1, 4, 6, 9, 10],bobSizes = [12, 15, 14, 11, 13, 10, 9, 8, 7, 6]) == None\n assert candidate(aliceSizes = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],bobSizes = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == [1, 6]\n assert candidate(aliceSizes = [50000, 10000, 30000, 20000, 40000],bobSizes = [15000, 25000, 35000, 45000, 55000]) == None\n assert candidate(aliceSizes = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200],bobSizes = [50, 150, 250, 350, 450, 550, 650, 750, 850, 950, 1050, 1150]) == None\n assert candidate(aliceSizes = [100, 200, 300],bobSizes = [50, 100, 150, 200, 250, 300]) == None\n assert candidate(aliceSizes = [5, 10, 15, 20, 25, 30, 35],bobSizes = [7, 14, 21, 28, 35, 42, 49]) == None\n assert candidate(aliceSizes = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000],bobSizes = [500, 1500, 2500, 3500, 4500, 5500, 6500, 7500, 8500, 9500, 10500, 11500, 12500, 13500]) == [4000, 500]\n assert candidate(aliceSizes = [8, 16, 24, 32, 40, 48, 56, 64, 72, 80],bobSizes = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == None\n assert candidate(aliceSizes = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],bobSizes = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == [30, 5]\n assert candidate(aliceSizes = [1000, 2000, 3000, 4000],bobSizes = [1500, 2500, 3500, 500]) == None\n assert candidate(aliceSizes = [100000, 200000, 300000, 400000, 500000],bobSizes = [50000, 150000, 250000, 350000, 450000]) == None\n assert candidate(aliceSizes = [1000, 2000, 3000, 4000, 5000],bobSizes = [500, 1500, 2500, 3500, 4500]) == None\n assert candidate(aliceSizes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],bobSizes = [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == None\n assert candidate(aliceSizes = [10, 20, 30, 40, 50],bobSizes = [5, 15, 25, 35, 45]) == None\n assert candidate(aliceSizes = [15, 25, 35, 45, 55, 65],bobSizes = [14, 24, 34, 44, 54, 64]) == None\n assert candidate(aliceSizes = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105],bobSizes = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110]) == None\n assert candidate(aliceSizes = [10, 20, 30, 40, 50],bobSizes = [15, 25, 35, 45, 55]) == None\n assert candidate(aliceSizes = [1, 10, 100, 1000, 10000],bobSizes = [2, 20, 200, 2000, 20000]) == None\n"}, "metadata": {"canonical_parameter_names": ["aliceSizes", "bobSizes"], "leetcode_dataset_entry_point": "Solution().fairCandySwap", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var fairCandySwap = function(aliceSizes, bobSizes) {", "container": null, "callable": "fairCandySwap", "parameters": [{"name": "aliceSizes", "type": "number[]"}, {"name": "bobSizes", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 889, "task_id": "construct-binary-tree-from-preorder-and-postorder-traversal", "difficulty": "Medium", "problem_description": "Given two integer arrays, preorder and postorder where preorder is the preorder traversal of a binary tree of distinct values and postorder is the postorder traversal of the same tree, reconstruct and return the binary tree.\nIf there exist multiple answers, you can return any of them.\n \nExample 1:\n\n\nInput: preorder = [1,2,4,5,3,6,7], postorder = [4,5,2,6,7,3,1]\nOutput: [1,2,3,4,5,6,7]\n\nExample 2:\n\nInput: preorder = [1], postorder = [1]\nOutput: [1]\n\n \nConstraints:\n\n1 <= preorder.length <= 30\n1 <= preorder[i] <= preorder.length\nAll the values of preorder are unique.\npostorder.length == preorder.length\n1 <= postorder[i] <= postorder.length\nAll the values of postorder are unique.\nIt is guaranteed that preorder and postorder are the preorder traversal and postorder traversal of the same binary tree.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(preorder = [1, 3, 2],postorder = [3, 2, 1]), tree_node([1, 3, 2]))\n assert is_same_tree(candidate(preorder = [1],postorder = [1]), tree_node([1]))\n assert is_same_tree(candidate(preorder = [1, 2, 3],postorder = [2, 3, 1]), tree_node([1, 2, 3]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 5, 3, 6, 7],postorder = [4, 5, 2, 6, 7, 3, 1]), tree_node([1, 2, 3, 4, 5, 6, 7]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 5, 3],postorder = [4, 5, 2, 3, 1]), tree_node([1, 2, 3, 4, 5]))\n assert is_same_tree(candidate(preorder = [1, 2, 3, 4, 5],postorder = [4, 5, 3, 2, 1]), tree_node([1, 2, None, 3, None, 4, 5]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 5, 3, 6, 8, 9, 7],postorder = [4, 5, 2, 8, 9, 6, 7, 3, 1]), tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, 8, 9]))\n assert is_same_tree(candidate(preorder = [1, 3, 6, 11, 12, 7, 13, 2, 4, 8, 9, 5, 10],postorder = [11, 12, 6, 13, 7, 3, 8, 9, 4, 10, 5, 2, 1]), tree_node([1, 3, 2, 6, 7, 4, 5, 11, 12, 13, None, 8, 9, 10]))\n assert is_same_tree(candidate(preorder = [1, 3, 2, 5, 4, 6],postorder = [3, 4, 5, 2, 6, 1]), tree_node([1, 3, 2, None, None, 5, 6, 4]))\n assert is_same_tree(candidate(preorder = [1, 3, 5, 6, 2, 4, 7],postorder = [5, 6, 3, 7, 4, 2, 1]), tree_node([1, 3, 2, 5, 6, 4, None, None, None, None, None, 7]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 7, 8, 5, 9, 3, 6],postorder = [7, 8, 4, 9, 5, 2, 6, 3, 1]), tree_node([1, 2, 3, 4, 5, 6, None, 7, 8, 9]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 8, 9, 5, 10, 11, 3, 6, 12, 7, 13, 14],postorder = [8, 9, 4, 10, 11, 5, 2, 12, 6, 13, 14, 7, 3, 1]), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, None, 13, 14]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 8, 9, 5, 10, 3, 6, 11, 12, 7, 13, 14],postorder = [8, 9, 4, 10, 5, 2, 11, 12, 6, 13, 14, 7, 3, 1]), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, 11, 12, 13, 14]))\n assert is_same_tree(candidate(preorder = [6, 2, 1, 0, 3, 5, 4, 8, 7, 9],postorder = [0, 1, 5, 4, 3, 2, 7, 9, 8, 6]), tree_node([6, 2, 8, 1, 3, 7, 9, 0, None, 5, 4]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 8, 5, 9, 3, 6, 10, 7, 11],postorder = [8, 4, 9, 5, 2, 10, 6, 11, 7, 3, 1]), tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, 9, None, 10, None, 11]))\n assert is_same_tree(candidate(preorder = [1, 3, 6, 5, 2, 4, 7, 8, 9],postorder = [6, 5, 3, 8, 9, 7, 4, 2, 1]), tree_node([1, 3, 2, 6, 5, 4, None, None, None, None, None, 7, None, 8, 9]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 8, 9, 5, 3, 6, 7],postorder = [8, 9, 4, 5, 2, 6, 7, 3, 1]), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9]))\n assert is_same_tree(candidate(preorder = [5, 4, 2, 1, 3, 6, 7, 8, 9, 10],postorder = [1, 3, 2, 4, 10, 9, 8, 7, 6, 5]), tree_node([5, 4, 6, 2, None, 7, None, 1, 3, 8, None, None, None, None, None, 9, None, 10]))\n assert is_same_tree(candidate(preorder = [1, 3, 2, 5, 4, 6],postorder = [2, 4, 6, 5, 3, 1]), tree_node([1, 3, None, 2, 5, None, None, 4, 6]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 5, 3, 6, 8, 7, 9],postorder = [4, 5, 2, 8, 6, 9, 7, 3, 1]), tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, 8, None, 9]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 5, 3, 6, 7, 8, 9],postorder = [4, 5, 2, 6, 8, 9, 7, 3, 1]), tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, 8, 9]))\n assert is_same_tree(candidate(preorder = [1, 3, 5, 4, 2, 6, 7],postorder = [5, 4, 3, 6, 7, 2, 1]), tree_node([1, 3, 2, 5, 4, 6, 7]))\n assert is_same_tree(candidate(preorder = [1, 3, 2, 6, 5, 4, 7, 9, 8, 11, 10],postorder = [2, 5, 6, 4, 3, 9, 10, 11, 8, 7, 1]), tree_node([1, 3, 7, 2, 6, 9, 8, None, None, 5, 4, None, None, 11, None, None, None, None, None, 10]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 3, 5, 6],postorder = [4, 2, 6, 5, 3, 1]), tree_node([1, 2, 3, 4, None, 5, None, None, None, 6]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 8, 9, 5, 10, 3, 6, 7],postorder = [8, 9, 4, 10, 5, 2, 6, 7, 3, 1]), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 5, 3, 6, 8, 9, 7, 10, 11],postorder = [4, 5, 2, 8, 9, 6, 10, 11, 7, 3, 1]), tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, 8, 9, 10, 11]))\n assert is_same_tree(candidate(preorder = [1, 2, 3, 5, 6, 4, 7, 8],postorder = [5, 6, 3, 7, 8, 4, 2, 1]), tree_node([1, 2, None, 3, 4, 5, 6, 7, 8]))\n assert is_same_tree(candidate(preorder = [1, 2, 5, 9, 10, 6, 7, 3, 8, 4],postorder = [9, 10, 5, 7, 6, 2, 8, 4, 3, 1]), tree_node([1, 2, 3, 5, 6, 8, 4, 9, 10, 7]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 7, 8, 5, 9, 6, 3, 10, 11],postorder = [7, 8, 4, 9, 5, 6, 2, 10, 11, 3, 1]), tree_node([1, 2, 3, 4, 5, 10, 11, 7, 8, 9, 6]))\n"}, "metadata": {"canonical_parameter_names": ["preorder", "postorder"], "leetcode_dataset_entry_point": "Solution().constructFromPrePost", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var constructFromPrePost = function(preorder, postorder) {", "container": null, "callable": "constructFromPrePost", "parameters": [{"name": "preorder", "type": "number[]"}, {"name": "postorder", "type": "number[]"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 890, "task_id": "find-and-replace-pattern", "difficulty": "Medium", "problem_description": "Given a list of strings words and a string pattern, return a list of words[i] that match pattern. You may return the answer in any order.\nA word matches the pattern if there exists a permutation of letters p so that after replacing every letter x in the pattern with p(x), we get the desired word.\nRecall that a permutation of letters is a bijection from letters to letters: every letter maps to another letter, and no two letters map to the same letter.\n \nExample 1:\n\nInput: words = [\"abc\",\"deq\",\"mee\",\"aqq\",\"dkd\",\"ccc\"], pattern = \"abb\"\nOutput: [\"mee\",\"aqq\"]\nExplanation: \"mee\" matches the pattern because there is a permutation {a -> m, b -> e, ...}. \n\"ccc\" does not match the pattern because {a -> c, b -> c, ...} is not a permutation, since a and b map to the same letter.\n\nExample 2:\n\nInput: words = [\"a\",\"b\",\"c\"], pattern = \"a\"\nOutput: [\"a\",\"b\",\"c\"]\n\n \nConstraints:\n\n1 <= pattern.length <= 20\n1 <= words.length <= 50\nwords[i].length == pattern.length\npattern and words[i] are lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['hello', 'world', 'leetcode'],pattern = \"aaaaa\") == []\n assert candidate(words = ['abc', 'deq', 'mee', 'aqq', 'dkd', 'ccc'],pattern = \"abb\") == ['mee', 'aqq']\n assert candidate(words = ['abb', 'abb', 'abb'],pattern = \"abc\") == []\n assert candidate(words = ['abb', 'abc', 'abz', 'xyz', 'xyy'],pattern = \"abb\") == ['abb', 'xyy']\n assert candidate(words = ['aaa', 'bbb', 'ccc'],pattern = \"aaa\") == ['aaa', 'bbb', 'ccc']\n assert candidate(words = ['a', 'b', 'c'],pattern = \"a\") == ['a', 'b', 'c']\n assert candidate(words = ['hello', 'world', 'abcde', 'uvwxy'],pattern = \"abcde\") == ['world', 'abcde', 'uvwxy']\n assert candidate(words = ['abb', 'abb', 'abb', 'abb'],pattern = \"abc\") == []\n assert candidate(words = ['abb', 'abc', 'aab'],pattern = \"abb\") == ['abb']\n assert candidate(words = ['aba', 'bcb', 'bab'],pattern = \"aba\") == ['aba', 'bcb', 'bab']\n assert candidate(words = ['abb', 'abc', 'aab', 'aba'],pattern = \"abb\") == ['abb']\n assert candidate(words = ['abb', 'abc', 'xyz', 'xyy'],pattern = \"abb\") == ['abb', 'xyy']\n assert candidate(words = ['abb', 'aaa', 'aab'],pattern = \"abb\") == ['abb']\n assert candidate(words = ['abba', 'abab', 'baab', 'baba', 'aaaa'],pattern = \"aabb\") == []\n assert candidate(words = ['abac', 'bcad', 'aacc', 'bbdd', 'aabb'],pattern = \"abab\") == []\n assert candidate(words = ['abcdefg', 'hijklmn', 'opqrstu', 'vwxyzab', 'cdefghi'],pattern = \"abcdefg\") == ['abcdefg', 'hijklmn', 'opqrstu', 'vwxyzab', 'cdefghi']\n assert candidate(words = ['abcabc', 'bcbcbc', 'dedede', 'aiaiai', 'jkjkjk'],pattern = \"abcabc\") == ['abcabc']\n assert candidate(words = ['abcde', 'bcdef', 'cdefg', 'defgh', 'efghi'],pattern = \"abcde\") == ['abcde', 'bcdef', 'cdefg', 'defgh', 'efghi']\n assert candidate(words = ['zyx', 'yxz', 'xyz', 'zyz', 'yzy', 'zzy', 'zzz', 'zzz'],pattern = \"zyx\") == ['zyx', 'yxz', 'xyz']\n assert candidate(words = ['xyx', 'yxy', 'xyz', 'zyz'],pattern = \"aba\") == ['xyx', 'yxy', 'zyz']\n assert candidate(words = ['abcde', 'bcdea', 'cdeab', 'deabc', 'eabcd'],pattern = \"abcde\") == ['abcde', 'bcdea', 'cdeab', 'deabc', 'eabcd']\n assert candidate(words = ['abcd', 'efgh', 'ijkl'],pattern = \"abcd\") == ['abcd', 'efgh', 'ijkl']\n assert candidate(words = ['aaaaabbbbbcccccdddddeeeeeffffffggggghhhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooo', 'zzzzzyyyyyxxxxxwwwwwvvvvvtttttsssssrrrrrqqqqqppppoonnnnnmmmmmlllllkkkkkjjjjjiiiii', 'tttttsssssrrrrrqqqqqppppponnnnnmmmmmlllllkkkkkjjjjjiiiiihhhhhhgggggffffffeeeeedddddeeecccbbbaaaaa'],pattern = \"tttttsssssrrrrrqqqqqppppponnnnnmmmmmlllllkkkkkjjjjjiiiiihhhhhhgggggffffffeeeeedddddeeecccbbbaaaaa\") == ['tttttsssssrrrrrqqqqqppppponnnnnmmmmmlllllkkkkkjjjjjiiiiihhhhhhgggggffffffeeeeedddddeeecccbbbaaaaa']\n assert candidate(words = ['abcd', 'abcc', 'abbc', 'abcb', 'acbb', 'adbb'],pattern = \"abbc\") == ['abbc']\n assert candidate(words = ['xyx', 'yxy', 'xyy', 'yyy', 'xyxy'],pattern = \"xxyx\") == []\n assert candidate(words = ['abcd', 'dcba', 'abab', 'dcdc', 'aabb'],pattern = \"abcd\") == ['abcd', 'dcba']\n assert candidate(words = ['aabbcc', 'ddeeff', 'gghhii', 'jjkkll', 'mmnnoo'],pattern = \"aabbcc\") == ['aabbcc', 'ddeeff', 'gghhii', 'jjkkll', 'mmnnoo']\n assert candidate(words = ['zzzz', 'zzzz', 'zzzz', 'zzzz'],pattern = \"aaaa\") == ['zzzz', 'zzzz', 'zzzz', 'zzzz']\n assert candidate(words = ['abbc', 'deee', 'zzzz'],pattern = \"aabb\") == []\n assert candidate(words = ['abcde', 'bcdea', 'cdeab', 'deabc', 'eabcd', 'fghij'],pattern = \"abcde\") == ['abcde', 'bcdea', 'cdeab', 'deabc', 'eabcd', 'fghij']\n assert candidate(words = ['abcdef', 'fedcba', 'ghijkl', 'lkjihg', 'mnopqr', 'rqponm'],pattern = \"abcdef\") == ['abcdef', 'fedcba', 'ghijkl', 'lkjihg', 'mnopqr', 'rqponm']\n assert candidate(words = ['ijkl', 'ikjl', 'ijlk', 'ijlk', 'ikjl'],pattern = \"ijkl\") == ['ijkl', 'ikjl', 'ijlk', 'ijlk', 'ikjl']\n assert candidate(words = ['mnop', 'qrst', 'uvwx'],pattern = \"mnop\") == ['mnop', 'qrst', 'uvwx']\n assert candidate(words = ['xyzx', 'yzxy', 'zxyx', 'yxzy', 'xzyz', 'zyzx', 'yzyz', 'zyzy'],pattern = \"abcb\") == ['zxyx', 'xzyz']\n assert candidate(words = ['mnop', 'mnop', 'mnop', 'mnop', 'mnop', 'mnop', 'mnop', 'mnop'],pattern = \"mnop\") == ['mnop', 'mnop', 'mnop', 'mnop', 'mnop', 'mnop', 'mnop', 'mnop']\n assert candidate(words = ['tttt', 'tqtq', 'ttqt', 'qtqt', 'qtqq'],pattern = \"aaaa\") == ['tttt']\n assert candidate(words = ['xyy', 'yxx', 'xyz', 'xyx', 'xxy'],pattern = \"aba\") == ['xyx']\n assert candidate(words = ['qrst', 'qstr', 'qrts', 'qtsr', 'qtpr', 'qrsp'],pattern = \"qrst\") == ['qrst', 'qstr', 'qrts', 'qtsr', 'qtpr', 'qrsp']\n assert candidate(words = ['xyzy', 'zyxy', 'yzyx', 'zyxz'],pattern = \"xyzy\") == ['xyzy', 'zyxy']\n assert candidate(words = ['mnop', 'qrst', 'uvwx', 'yzxy', 'qrst'],pattern = \"abcd\") == ['mnop', 'qrst', 'uvwx', 'qrst']\n assert candidate(words = ['qrst', 'rstq', 'stqr', 'tqrs', 'qrst', 'rstq', 'stqr', 'tqrs'],pattern = \"abcd\") == ['qrst', 'rstq', 'stqr', 'tqrs', 'qrst', 'rstq', 'stqr', 'tqrs']\n assert candidate(words = ['mnop', 'nopm', 'opmn', 'pqrs', 'qrst', 'stuv', 'tuvw', 'uvwx'],pattern = \"mnop\") == ['mnop', 'nopm', 'opmn', 'pqrs', 'qrst', 'stuv', 'tuvw', 'uvwx']\n assert candidate(words = ['xxy', 'xyy', 'yxx', 'yyx', 'xyx', 'yxy'],pattern = \"xyy\") == ['xyy', 'yxx']\n assert candidate(words = ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh', 'ghi', 'hij', 'ijk'],pattern = \"abc\") == ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh', 'ghi', 'hij', 'ijk']\n assert candidate(words = ['abacabadabacaba', 'babcbabcbbabcbb', 'abacabadabcadaa'],pattern = \"abacabadabacaba\") == ['abacabadabacaba']\n assert candidate(words = ['abbcc', 'aabbb', 'aabbcc', 'abbbaa', 'abacba', 'abcabc'],pattern = \"abbcc\") == ['abbcc']\n assert candidate(words = ['xyyx', 'mnop', 'qrst'],pattern = \"mnop\") == ['mnop', 'qrst']\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'abcdefghijkabcdefghijk'],pattern = \"abcdefghijklmnopqrstuvwxyz\") == ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba']\n assert candidate(words = ['deq', 'mee', 'aqq', 'dkd', 'ccc', 'eii', 'fff', 'ggh'],pattern = \"abb\") == ['mee', 'aqq', 'eii']\n assert candidate(words = ['abcde', 'vwxyz', 'pqrst'],pattern = \"uvwxy\") == ['abcde', 'vwxyz', 'pqrst']\n assert candidate(words = ['qrst', 'uvwx', 'yzab'],pattern = \"abcd\") == ['qrst', 'uvwx', 'yzab']\n assert candidate(words = ['xyx', 'yxy', 'zaz', 'azz', 'bzb', 'abb'],pattern = \"aba\") == ['xyx', 'yxy', 'zaz', 'bzb']\n assert candidate(words = ['xyz', 'xyy', 'xzy', 'yxy', 'yzy', 'zyx'],pattern = \"xyz\") == ['xyz', 'xzy', 'zyx']\n assert candidate(words = ['mnop', 'nmop', 'mnop', 'npom', 'mnop'],pattern = \"abcd\") == ['mnop', 'nmop', 'mnop', 'npom', 'mnop']\n assert candidate(words = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yzabcf'],pattern = \"abcdef\") == ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yzabcf']\n assert candidate(words = ['mnop', 'nomp', 'mpon', 'mnop', 'mnoo', 'mmno'],pattern = \"mnop\") == ['mnop', 'nomp', 'mpon', 'mnop']\n assert candidate(words = ['abca', 'decd', 'mefm', 'aqqz', 'dkdf', 'ccca'],pattern = \"abba\") == []\n assert candidate(words = ['aabbcc', 'bbccdd', 'ccddaa', 'ddeeff', 'eefggh'],pattern = \"aabbcc\") == ['aabbcc', 'bbccdd', 'ccddaa', 'ddeeff']\n assert candidate(words = ['abcd', 'bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij', 'hijk'],pattern = \"abcd\") == ['abcd', 'bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij', 'hijk']\n assert candidate(words = ['abba', 'abab', 'aabb', 'baba', 'baab', 'bbaa'],pattern = \"abba\") == ['abba', 'baab']\n assert candidate(words = ['abacaba', 'cabadab', 'bacabac', 'adabaad', 'abaabab'],pattern = \"abacaba\") == ['abacaba']\n assert candidate(words = ['ijkl', 'jklm', 'klmn', 'lmno', 'mnop', 'nopq', 'opqr', 'pqrs'],pattern = \"mnop\") == ['ijkl', 'jklm', 'klmn', 'lmno', 'mnop', 'nopq', 'opqr', 'pqrs']\n assert candidate(words = ['zzzzz', 'yyyyy', 'xxxxx', 'wwwww', 'vvvvv'],pattern = \"aaaaa\") == ['zzzzz', 'yyyyy', 'xxxxx', 'wwwww', 'vvvvv']\n assert candidate(words = ['mnoonm', 'mnoono', 'mmnnoo', 'noonmm'],pattern = \"mnoonm\") == ['mnoonm']\n assert candidate(words = ['xyyx', 'mnop', 'qrst'],pattern = \"abba\") == ['xyyx']\n assert candidate(words = ['zzz', 'aaa', 'zzz', 'aaa'],pattern = \"abc\") == []\n assert candidate(words = ['abcde', 'edcba', 'abcde', 'edcba'],pattern = \"abcde\") == ['abcde', 'edcba', 'abcde', 'edcba']\n assert candidate(words = ['abcd', 'abca', 'abcb', 'abcc', 'abdd'],pattern = \"abba\") == []\n assert candidate(words = ['baba', 'abab', 'aaaa', 'bbbb', 'abcd'],pattern = \"abba\") == []\n assert candidate(words = ['abcd', 'abab', 'abac', 'aabb', 'abba', 'aaaa', 'bbbb', 'abac'],pattern = \"abcd\") == ['abcd']\n assert candidate(words = ['abcabcabcabcabcabcabcabc', 'bcbcbcbcbcbcbcbcbcbcbcbcbcbcb', 'cbbccbbccbbccbbccbbccbbccbbcc', 'abcbbccbbccbbccbbccbbccbbccbb'],pattern = \"abcabcabcabcabcabcabcabc\") == ['abcabcabcabcabcabcabcabc']\n assert candidate(words = ['abac', 'deed', 'zaff'],pattern = \"deed\") == ['deed']\n assert candidate(words = ['abcdefgh', 'hgfedcba', 'ijklmnop', 'ponmlkji', 'qrstuvwx', 'xwvutsrq'],pattern = \"abcdefgh\") == ['abcdefgh', 'hgfedcba', 'ijklmnop', 'ponmlkji', 'qrstuvwx', 'xwvutsrq']\n assert candidate(words = ['abcde', 'vwxyz', 'pqrst'],pattern = \"vwxyz\") == ['abcde', 'vwxyz', 'pqrst']\n assert candidate(words = ['abac', 'baba', 'abca', 'baac', 'caba', 'dada'],pattern = \"abac\") == ['abac']\n assert candidate(words = ['efgh', 'efgi', 'efgh', 'efgi', 'efgh'],pattern = \"abcd\") == ['efgh', 'efgi', 'efgh', 'efgi', 'efgh']\n assert candidate(words = ['ababab', 'bababa', 'cdcdcd', 'dcdcdc', 'efefef', 'fefefe'],pattern = \"ababab\") == ['ababab', 'bababa', 'cdcdcd', 'dcdcdc', 'efefef', 'fefefe']\n assert candidate(words = ['abab', 'baba', 'abba', 'aaaa', 'bbbb', 'cccc', 'aabb', 'abab'],pattern = \"abab\") == ['abab', 'baba', 'abab']\n assert candidate(words = ['abab', 'baba', 'abba', 'baab', 'aaaa', 'bbbb'],pattern = \"abab\") == ['abab', 'baba']\n assert candidate(words = ['aabbcc', 'bbccdd', 'ccddaa', 'ddeeff', 'eeffgg', 'ffggee'],pattern = \"abcdef\") == []\n assert candidate(words = ['zzzz', 'zzyz', 'zyzy', 'zyyz'],pattern = \"aaaa\") == ['zzzz']\n assert candidate(words = ['aaaaaa', 'bbbbbb', 'cccccc', 'dddddd', 'eeeeee', 'ffffff'],pattern = \"aaaaaa\") == ['aaaaaa', 'bbbbbb', 'cccccc', 'dddddd', 'eeeeee', 'ffffff']\n assert candidate(words = ['aab', 'aba', 'aab', 'aba', 'aab'],pattern = \"aba\") == ['aba', 'aba']\n assert candidate(words = ['aaaaa', 'bbbbb', 'ccccc'],pattern = \"abcde\") == []\n assert candidate(words = ['abcde', 'vwxyz', 'mnopq', 'rstuv', 'fghij'],pattern = \"abcde\") == ['abcde', 'vwxyz', 'mnopq', 'rstuv', 'fghij']\n assert candidate(words = ['aab', 'aba', 'baa', 'aaa'],pattern = \"aab\") == ['aab']\n assert candidate(words = ['abac', 'debd', 'mee', 'aqq', 'dkd', 'ccc'],pattern = \"abac\") == ['abac', 'dkd']\n assert candidate(words = ['aabb', 'bbcc', 'ccdd'],pattern = \"aabb\") == ['aabb', 'bbcc', 'ccdd']\n assert candidate(words = ['aabbccdd', 'bbaaddcc', 'ccddaabb', 'ddccaabb'],pattern = \"aabbccdd\") == ['aabbccdd', 'bbaaddcc', 'ccddaabb', 'ddccaabb']\n assert candidate(words = ['abcdefgh', 'hgfedcba', 'abcdefgh', 'hgfedcba'],pattern = \"abcdefgh\") == ['abcdefgh', 'hgfedcba', 'abcdefgh', 'hgfedcba']\n assert candidate(words = ['wxyz', 'wyxz', 'wyzx', 'wxzy', 'wxyz'],pattern = \"wxyz\") == ['wxyz', 'wyxz', 'wyzx', 'wxzy', 'wxyz']\n assert candidate(words = ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', 'zzzzyyyyxxxxwwwwvvvvuuuuttssrrqqppoonnmmllkkjjiihhggee', 'mnopmnopmnopmnopmnopmnopmnopmnopmnopmnopmnop'],pattern = \"abcdefghijklmnopqrstuvwxyzzz\") == []\n assert candidate(words = ['zzzz', 'yyyy', 'xxxx', 'wwww', 'vvvv', 'uuuu'],pattern = \"aaaa\") == ['zzzz', 'yyyy', 'xxxx', 'wwww', 'vvvv', 'uuuu']\n assert candidate(words = ['ab', 'ba', 'aa', 'bb', 'cc', 'dd'],pattern = \"ab\") == ['ab', 'ba']\n assert candidate(words = ['xxyy', 'xyyx', 'xxyx', 'yxyx'],pattern = \"abab\") == ['yxyx']\n assert candidate(words = ['abac', 'abcd', 'abca', 'abac'],pattern = \"abac\") == ['abac', 'abac']\n assert candidate(words = ['uvw', 'uvw', 'uvw', 'uvw', 'uvw', 'uvw'],pattern = \"uvw\") == ['uvw', 'uvw', 'uvw', 'uvw', 'uvw', 'uvw']\n assert candidate(words = ['abcbacbacbacbacbac', 'bcabcabcabcabcabc', 'cbacbacbacbacbacba', 'bacbacbacbacbacbac'],pattern = \"abcbacbacbacbacbac\") == ['abcbacbacbacbacbac']\n assert candidate(words = ['pqrs', 'prqs', 'psqr', 'psrq', 'pqsr'],pattern = \"qrst\") == ['pqrs', 'prqs', 'psqr', 'psrq', 'pqsr']\n assert candidate(words = ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh'],pattern = \"abc\") == ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh']\n assert candidate(words = ['aabcb', 'bbaab', 'cbbaa', 'ababa'],pattern = \"aabcb\") == ['aabcb']\n assert candidate(words = ['abababababababababab', 'bababababababababa', 'aabbaabbaabbaabb', 'bbabbaabbaabbabb'],pattern = \"abababababababababab\") == ['abababababababababab', 'bababababababababa']\n assert candidate(words = ['abbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', 'zyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyx', 'mnopmnopmnopmnopmnopmnopmnopmnopmnopmnopmnop'],pattern = \"abcdefghijklmnopqrstuvwxyzz\") == []\n assert candidate(words = ['aaaabbbb', 'ccccdddd', 'eeeeffff', 'ggggaaaa', 'bbbbcccc'],pattern = \"aabbccdd\") == []\n assert candidate(words = ['aaaaa', 'bbbbb', 'ccccc'],pattern = \"zzzzz\") == ['aaaaa', 'bbbbb', 'ccccc']\n assert candidate(words = ['mxyz', 'yzxy', 'zxyz', 'yzzx', 'zzzz'],pattern = \"wxyz\") == ['mxyz']\n assert candidate(words = ['aabb', 'bbcc', 'ccdd', 'aacc', 'abab'],pattern = \"aabb\") == ['aabb', 'bbcc', 'ccdd', 'aacc']\n assert candidate(words = ['abcabc', 'defdef', 'ghighi', 'jkljkl', 'mnopmn', 'opqropqr'],pattern = \"abcabc\") == ['abcabc', 'defdef', 'ghighi', 'jkljkl']\n assert candidate(words = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba'],pattern = \"abc\") == ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']\n assert candidate(words = ['abcd', 'abdc', 'acbd', 'acdb'],pattern = \"acdb\") == ['abcd', 'abdc', 'acbd', 'acdb']\n assert candidate(words = ['aabbcc', 'bbccdd', 'ccddeeff', 'ddeeffgg', 'eeffgghh'],pattern = \"aabbc\") == ['aabbcc', 'bbccdd', 'ccddeeff', 'ddeeffgg', 'eeffgghh']\n assert candidate(words = ['stuv', 'stvu', 'tuvv', 'stvv', 'stvu'],pattern = \"stvu\") == ['stuv', 'stvu', 'stvu']\n assert candidate(words = ['abac', 'deed', 'zaff'],pattern = \"abab\") == []\n assert candidate(words = ['ababab', 'bababa', 'ababba', 'bababb', 'aabbab', 'bbaaab', 'abbaab', 'babaab'],pattern = \"ababab\") == ['ababab', 'bababa']\n assert candidate(words = ['mnop', 'ponm', 'mpon', 'mnop', 'nmop'],pattern = \"mnop\") == ['mnop', 'ponm', 'mpon', 'mnop', 'nmop']\n assert candidate(words = ['abac', 'baca', 'caab', 'acab', 'caba'],pattern = \"abac\") == ['abac', 'acab']\n assert candidate(words = ['aabb', 'bbaa', 'abab', 'baab', 'aaaa', 'bbbb', 'abba', 'baba'],pattern = \"aabb\") == ['aabb', 'bbaa']\n assert candidate(words = ['abcabc', 'defdef', 'ghighi', 'jkljkl', 'mnopqr'],pattern = \"abcabc\") == ['abcabc', 'defdef', 'ghighi', 'jkljkl']\n"}, "metadata": {"canonical_parameter_names": ["words", "pattern"], "leetcode_dataset_entry_point": "Solution().findAndReplacePattern", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findAndReplacePattern = function(words, pattern) {", "container": null, "callable": "findAndReplacePattern", "parameters": [{"name": "words", "type": "string[]"}, {"name": "pattern", "type": "string"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 891, "task_id": "sum-of-subsequence-widths", "difficulty": "Hard", "problem_description": "The width of a sequence is the difference between the maximum and minimum elements in the sequence.\nGiven an array of integers nums, return the sum of the widths of all the non-empty subsequences of nums. Since the answer may be very large, return it modulo 109 + 7.\nA subsequence is a sequence that can be derived from an array by deleting some or no elements without changing the order of the remaining elements. For example, [3,6,2,7] is a subsequence of the array [0,3,1,6,2,2,7].\n \nExample 1:\n\nInput: nums = [2,1,3]\nOutput: 6\nExplanation: The subsequences are [1], [2], [3], [2,1], [2,3], [1,3], [2,1,3].\nThe corresponding widths are 0, 0, 0, 1, 1, 2, 2.\nThe sum of these widths is 6.\n\nExample 2:\n\nInput: nums = [2]\nOutput: 0\n\n \nConstraints:\n\n1 <= nums.length <= 105\n1 <= nums[i] <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 20, 30]) == 60\n assert candidate(nums = [9, 7, 5, 3, 1]) == 144\n assert candidate(nums = [1, 2, 4, 8, 16]) == 261\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 3084\n assert candidate(nums = [1, 3, 5, 7, 9]) == 144\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 7181\n assert candidate(nums = [1]) == 0\n assert candidate(nums = [1, 2, 3, 4]) == 23\n assert candidate(nums = [2, 1, 3]) == 6\n assert candidate(nums = [2]) == 0\n assert candidate(nums = [10, 20, 30, 40, 50]) == 720\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 71810\n assert candidate(nums = [5, 5, 5, 5]) == 0\n assert candidate(nums = [1, 100000]) == 99999\n assert candidate(nums = [1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [5, 2, 4, 1, 3]) == 72\n assert candidate(nums = [100000, 100000, 100000, 100000, 100000]) == 0\n assert candidate(nums = [100000]) == 0\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 2345\n assert candidate(nums = [100000, 100000, 100000]) == 0\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384]) == 357668181\n assert candidate(nums = [99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991, 99990, 99989, 99988, 99987, 99986, 99985, 99984, 99983, 99982, 99981, 99980]) == 17825815\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000]) == 782581493\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 929942988\n assert candidate(nums = [100000, 99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992]) == 3084\n assert candidate(nums = [99999, 1, 99998, 2, 99997, 3, 99996, 4, 99995, 5]) == 96096610\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 89129075\n assert candidate(nums = [100000, 90000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000]) == 71810000\n assert candidate(nums = [5, 2, 9, 1, 5, 6, 7, 8, 4, 3, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == 16810038\n assert candidate(nums = [2, 1, 3, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]) == 393234\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == 39323400\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 991029085\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) == 344405\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 35651630\n assert candidate(nums = [200000, 199999, 199998, 199997, 199996, 199995, 199994, 199993, 199992, 199991, 199990, 199989, 199988, 199987, 199986, 199985, 199984, 199983, 199982, 199981]) == 17825815\n assert candidate(nums = [1, 100000, 2, 99999, 3, 99998, 4, 99997, 5, 99996]) == 96097571\n assert candidate(nums = [99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991, 99990]) == 7181\n assert candidate(nums = [7, 5, 3, 1, 9, 11, 13, 15, 17, 19]) == 14362\n assert candidate(nums = [50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000]) == 0\n assert candidate(nums = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 991029085\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 17825815\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 14362\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256]) == 85077\n assert candidate(nums = [100000, 99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991]) == 7181\n assert candidate(nums = [100000, 1, 99999, 2, 99998, 3, 99997, 4, 99996, 5]) == 96097571\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 316557572\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [50000, 50001, 50002, 50003, 50004, 50005, 50006, 50007, 50008, 50009]) == 7181\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 738197532\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 8738145\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 3420\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000]) == 3243429\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 393234\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 393234\n assert candidate(nums = [50, 40, 30, 20, 10, 60, 70, 80, 90, 100]) == 71810\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 108954\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 7181\n assert candidate(nums = [10, 10, 20, 20, 30, 30, 40, 40, 50, 50]) == 34200\n assert candidate(nums = [5, 1, 9, 3, 7, 2, 8, 4, 6]) == 3084\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 178258150\n assert candidate(nums = [100000, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 51102071\n assert candidate(nums = [1, 3, 2, 5, 4, 7, 6, 9, 8, 10]) == 7181\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 35651630\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == 982058163\n assert candidate(nums = [50000, 40000, 30000, 20000, 10000, 90000, 80000, 70000, 60000, 55000, 54000, 53000, 52000, 51000, 56000, 57000, 58000, 59000, 61000, 62000]) == 945879552\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096]) == 22316373\n assert candidate(nums = [5, 3, 8, 6, 2, 7, 4, 1]) == 1291\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 991029085\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == 356892986\n assert candidate(nums = [100, 200, 150, 300, 250, 400, 350, 500, 450]) == 154200\n assert candidate(nums = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 20]) == 17825815\n assert candidate(nums = [100000, 99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991]) == 7181\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1, 10, 100, 1000, 10000, 100000]) == 314578971\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == 393234\n assert candidate(nums = [29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]) == 3801600\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000]) == 393234000\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20]) == 713034816\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110]) == 90876700\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 17825815\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 3932340\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 0\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75]) == 1966170\n assert candidate(nums = [50000, 49999, 49998, 49997, 49996, 49995, 49994, 49993, 49992, 49991, 49990, 49989, 49988, 49987, 49986, 49985, 49984, 49983, 49982, 49981]) == 17825815\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().sumSubseqWidths", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sumSubseqWidths = function(nums) {", "container": null, "callable": "sumSubseqWidths", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 892, "task_id": "surface-area-of-3d-shapes", "difficulty": "Easy", "problem_description": "You are given an n x n grid where you have placed some 1 x 1 x 1 cubes. Each value v = grid[i][j] represents a tower of v cubes placed on top of cell (i, j).\nAfter placing these cubes, you have decided to glue any directly adjacent cubes to each other, forming several irregular 3D shapes.\nReturn the total surface area of the resulting shapes.\nNote: The bottom face of each shape counts toward its surface area.\n \nExample 1:\n\n\nInput: grid = [[1,2],[3,4]]\nOutput: 34\n\nExample 2:\n\n\nInput: grid = [[1,1,1],[1,0,1],[1,1,1]]\nOutput: 32\n\nExample 3:\n\n\nInput: grid = [[2,2,2],[2,1,2],[2,2,2]]\nOutput: 46\n\n \nConstraints:\n\nn == grid.length == grid[i].length\n1 <= n <= 50\n0 <= grid[i][j] <= 50\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[3, 3, 3], [3, 3, 3], [3, 3, 3]]) == 54\n assert candidate(grid = [[2, 2, 2], [2, 1, 2], [2, 2, 2]]) == 46\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 32\n assert candidate(grid = [[50, 50, 50], [50, 50, 50], [50, 50, 50]]) == 618\n assert candidate(grid = [[1, 2], [3, 4]]) == 34\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) == 18\n assert candidate(grid = [[1, 2, 3, 4], [4, 3, 2, 1], [1, 4, 2, 3], [3, 2, 4, 1]]) == 110\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 0, 1]]) == 54\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]) == 204\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 78\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 3, 1], [5, 3, 1, 3, 5], [1, 5, 3, 5, 1]]) == 188\n assert candidate(grid = [[5, 5, 5, 5], [5, 5, 5, 5], [5, 5, 5, 5], [5, 5, 5, 5]]) == 112\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]) == 78\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]]) == 48\n assert candidate(grid = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) == 228\n assert candidate(grid = [[1, 2, 3, 4, 5], [0, 9, 8, 7, 6], [1, 2, 3, 4, 5], [6, 7, 8, 9, 0], [5, 4, 3, 2, 1]]) == 218\n assert candidate(grid = [[3, 2, 1], [1, 3, 2], [2, 1, 3]]) == 58\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) == 30\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 32\n assert candidate(grid = [[2, 2, 2, 2, 2], [2, 1, 1, 1, 2], [2, 1, 2, 1, 2], [2, 1, 1, 1, 2], [2, 2, 2, 2, 2]]) == 106\n assert candidate(grid = [[2, 2, 2, 2, 2], [2, 1, 1, 1, 2], [2, 1, 0, 1, 2], [2, 1, 1, 1, 2], [2, 2, 2, 2, 2]]) == 104\n assert candidate(grid = [[10, 0, 10, 0, 10], [0, 10, 0, 10, 0], [10, 0, 10, 0, 10], [0, 10, 0, 10, 0], [10, 0, 10, 0, 10]]) == 546\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 70\n assert candidate(grid = [[10, 10, 10], [10, 1, 10], [10, 10, 10]]) == 174\n assert candidate(grid = [[5, 4, 3, 2, 1], [4, 3, 2, 1, 0], [3, 2, 1, 0, 0], [2, 1, 0, 0, 0], [1, 0, 0, 0, 0]]) == 90\n assert candidate(grid = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 72\n assert candidate(grid = [[0, 0, 1, 1], [0, 0, 1, 1], [1, 1, 0, 0], [1, 1, 0, 0]]) == 32\n assert candidate(grid = [[5, 0, 0, 5], [0, 5, 5, 0], [0, 5, 5, 0], [5, 0, 0, 5]]) == 136\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 2, 3, 2, 0], [0, 2, 3, 4, 3, 0], [0, 1, 2, 3, 2, 0], [0, 0, 0, 0, 0, 0]]) == 68\n assert candidate(grid = [[0, 0, 0, 0], [0, 9, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 38\n assert candidate(grid = [[5, 5, 5], [5, 0, 5], [5, 5, 5]]) == 96\n assert candidate(grid = [[4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15], [16, 17, 18, 19]]) == 276\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 2, 3, 4, 5]]) == 178\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 16\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]]) == 96\n assert candidate(grid = [[0, 0, 0, 0], [0, 1, 2, 0], [0, 2, 1, 0], [0, 0, 0, 0]]) == 24\n assert candidate(grid = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0\n assert candidate(grid = [[5, 3, 5, 4], [3, 2, 3, 1], [5, 1, 5, 3], [4, 1, 4, 2]]) == 132\n assert candidate(grid = [[4, 3, 2, 1, 0], [3, 2, 1, 0, 4], [2, 1, 0, 4, 3], [1, 0, 4, 3, 2], [0, 4, 3, 2, 1]]) == 144\n assert candidate(grid = [[3, 2, 1, 0], [1, 1, 1, 1], [0, 1, 2, 3], [4, 3, 2, 1]]) == 82\n assert candidate(grid = [[10, 0, 10], [0, 20, 0], [10, 0, 10]]) == 250\n assert candidate(grid = [[1, 2, 3], [2, 3, 4], [3, 4, 5]]) == 66\n assert candidate(grid = [[4, 0, 0, 0, 0], [0, 4, 0, 0, 0], [0, 0, 4, 0, 0], [0, 0, 0, 4, 0], [0, 0, 0, 0, 4]]) == 90\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 1, 2, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0]]) == 26\n assert candidate(grid = [[0, 1, 2, 3, 4], [1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8]]) == 168\n assert candidate(grid = [[3, 3, 3, 3], [3, 0, 0, 3], [3, 0, 0, 3], [3, 3, 3, 3]]) == 96\n assert candidate(grid = [[1, 2, 3, 4], [4, 3, 2, 1], [1, 2, 3, 4], [4, 3, 2, 1]]) == 108\n assert candidate(grid = [[1, 2, 3, 4, 5], [0, 0, 0, 0, 0], [5, 4, 3, 2, 1], [1, 1, 1, 1, 1], [2, 3, 4, 5, 6]]) == 164\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]]) == 86\n assert candidate(grid = [[4, 3, 2, 1], [3, 2, 1, 4], [2, 1, 4, 3], [1, 4, 3, 2]]) == 108\n assert candidate(grid = [[3, 0, 2, 4], [0, 1, 3, 0], [2, 0, 1, 1], [4, 0, 0, 2]]) == 92\n assert candidate(grid = [[3, 4, 5, 6], [5, 6, 7, 8], [7, 8, 9, 10], [9, 10, 11, 12]]) == 188\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]]) == 98\n assert candidate(grid = [[3, 3, 3, 3], [3, 2, 2, 3], [3, 2, 2, 3], [3, 3, 3, 3]]) == 88\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 0, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]]) == 88\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9]]) == 734\n assert candidate(grid = [[4, 0, 4, 0, 4], [0, 3, 0, 3, 0], [4, 0, 4, 0, 4], [0, 3, 0, 3, 0], [4, 0, 4, 0, 4]]) == 218\n assert candidate(grid = [[3, 0, 3], [0, 4, 0], [3, 0, 3]]) == 74\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 3, 1], [2, 4, 6, 4, 2], [1, 3, 5, 3, 1]]) == 160\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]]) == 46\n assert candidate(grid = [[0, 0, 5, 0], [0, 0, 5, 0], [0, 0, 5, 0], [0, 0, 5, 0]]) == 58\n assert candidate(grid = [[5, 5, 5, 5, 5, 5], [5, 0, 0, 0, 0, 5], [5, 0, 1, 1, 0, 5], [5, 0, 1, 1, 0, 5], [5, 0, 0, 0, 0, 5], [5, 5, 5, 5, 5, 5]]) == 256\n assert candidate(grid = [[4, 3, 2, 1], [3, 2, 1, 0], [2, 1, 0, 1], [1, 0, 1, 2]]) == 78\n assert candidate(grid = [[5, 0, 0, 0, 5], [0, 3, 0, 3, 0], [0, 0, 4, 0, 0], [0, 3, 0, 3, 0], [5, 0, 0, 0, 5]]) == 162\n assert candidate(grid = [[0, 1, 2, 3], [3, 2, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == 66\n assert candidate(grid = [[10, 20, 30], [40, 50, 60], [70, 80, 90]]) == 858\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 48\n assert candidate(grid = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]]) == 16\n assert candidate(grid = [[5, 0, 0, 0], [0, 5, 0, 0], [0, 0, 5, 0], [0, 0, 0, 5]]) == 88\n assert candidate(grid = [[3, 0, 2, 1], [1, 2, 0, 3], [4, 1, 2, 2], [2, 0, 3, 4]]) == 104\n assert candidate(grid = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1]]) == 40\n assert candidate(grid = [[0, 5, 0, 5], [5, 0, 5, 0], [0, 5, 0, 5], [5, 0, 5, 0]]) == 176\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 2, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 34\n assert candidate(grid = [[5, 0, 5, 0, 5], [0, 5, 0, 5, 0], [5, 0, 5, 0, 5], [0, 5, 0, 5, 0], [5, 0, 5, 0, 5]]) == 286\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 2, 3, 2, 0], [0, 2, 3, 4, 3, 0], [0, 3, 4, 5, 4, 0], [0, 2, 3, 4, 3, 0], [0, 0, 0, 0, 0, 0]]) == 96\n assert candidate(grid = [[5, 5, 5, 5, 5], [5, 4, 4, 4, 5], [5, 4, 3, 4, 5], [5, 4, 4, 4, 5], [5, 5, 5, 5, 5]]) == 166\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().surfaceArea", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var surfaceArea = function(grid) {", "container": null, "callable": "surfaceArea", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 893, "task_id": "groups-of-special-equivalent-strings", "difficulty": "Medium", "problem_description": "You are given an array of strings of the same length words.\nIn one move, you can swap any two even indexed characters or any two odd indexed characters of a string words[i].\nTwo strings words[i] and words[j] are special-equivalent if after any number of moves, words[i] == words[j].\n\nFor example, words[i] = \"zzxy\" and words[j] = \"xyzz\" are special-equivalent because we may make the moves \"zzxy\" -> \"xzzy\" -> \"xyzz\".\n\nA group of special-equivalent strings from words is a non-empty subset of words such that:\n\nEvery pair of strings in the group are special equivalent, and\nThe group is the largest size possible (i.e., there is not a string words[i] not in the group such that words[i] is special-equivalent to every string in the group).\n\nReturn the number of groups of special-equivalent strings from words.\n \nExample 1:\n\nInput: words = [\"abcd\",\"cdab\",\"cbad\",\"xyzz\",\"zzxy\",\"zzyx\"]\nOutput: 3\nExplanation: \nOne group is [\"abcd\", \"cdab\", \"cbad\"], since they are all pairwise special equivalent, and none of the other strings is all pairwise special equivalent to these.\nThe other two groups are [\"xyzz\", \"zzxy\"] and [\"zzyx\"].\nNote that in particular, \"zzxy\" is not special equivalent to \"zzyx\".\n\nExample 2:\n\nInput: words = [\"abc\",\"acb\",\"bac\",\"bca\",\"cab\",\"cba\"]\nOutput: 3\n\n \nConstraints:\n\n1 <= words.length <= 1000\n1 <= words[i].length <= 20\nwords[i] consist of lowercase English letters.\nAll the strings are of the same length.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['abcd', 'abdc', 'cdab', 'cdba', 'dcba', 'bacd']) == 4\n assert candidate(words = ['abcd', 'abdc', 'cdab', 'cdba']) == 3\n assert candidate(words = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr']) == 6\n assert candidate(words = ['aabb', 'bbaa', 'abab', 'baba', 'abba', 'baab']) == 3\n assert candidate(words = ['aabb', 'abab', 'baba', 'bbaa', 'abba', 'baab']) == 3\n assert candidate(words = ['abcde', 'edcba', 'acebd', 'decab', 'bdeca', 'cabed']) == 4\n assert candidate(words = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']) == 3\n assert candidate(words = ['abcde', 'abced', 'adcbe', 'aebcd', 'eabcd', 'ebacd']) == 5\n assert candidate(words = ['aabb', 'bbaa', 'abab', 'baba', 'aaaa', 'bbbb']) == 5\n assert candidate(words = ['abcd', 'cdab', 'cbad', 'xyzz', 'zzxy', 'zzyx']) == 3\n assert candidate(words = ['abcde', 'edcba', 'abced', 'decba']) == 2\n assert candidate(words = ['aabb', 'bbaa', 'abab', 'baba']) == 3\n assert candidate(words = ['mnopqr', 'nopqr', 'opqr', 'pqr', 'qr', 'r', 'mnopqrs', 'nopqrs', 'opqrs', 'pqr', 'qr', 'r', 'mnopqrst', 'nopqrst', 'opqrst', 'pqrst', 'qrst', 'rst', 'st', 't']) == 17\n assert candidate(words = ['abcdeabcde', 'cdeabcdeab', 'deabcdeabc', 'eabcdeabcd', 'abcdecdeab', 'bacdecdeba', 'cabdecdeab', 'cbadecdeba', 'abcdefedcb', 'fedcbaedcb', 'gfedcbedcb', 'bacdefedcb', 'defabcdecb', 'cabfedecba', 'cbafedecba', 'dcbaefdcba', 'efabcdecba', 'fedcbaecba', 'gfedcbedcb', 'bacdefecba']) == 12\n assert candidate(words = ['abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij']) == 1\n assert candidate(words = ['xxyyzz', 'yyzzxx', 'zzxxyy', 'yxzyxz', 'yzyxzx', 'zyzyyx', 'zyxzyx', 'xyzzyx']) == 3\n assert candidate(words = ['aabbcc', 'bbaacc', 'ccabba', 'aabbcc', 'bbaacc', 'ccabba', 'aabbcc', 'bbaacc']) == 1\n assert candidate(words = ['aabbcc', 'bbaacc', 'ababcc', 'babcac', 'cabcab', 'acbacb']) == 3\n assert candidate(words = ['zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz']) == 1\n assert candidate(words = ['abcdef', 'bacdef', 'decfab', 'fedcba', 'fedbac', 'defacb']) == 6\n assert candidate(words = ['aabbccddeeff', 'bbaaccddeeff', 'aacbbddeeff', 'ddffeeaabbbc', 'effeeddabbcc', 'bbccddfeea', 'ccddeeffaabb', 'effddcbaabbb']) == 6\n assert candidate(words = ['abcdefg', 'gfedcba', 'bdfhace', 'fhdbaec', 'acegfb', 'bfhacd', 'fhbdcae', 'gacfbde']) == 7\n assert candidate(words = ['xyzzxy', 'zzxyxy', 'zxyzyx', 'xyzyzx', 'zyxzyx', 'yxzyxz', 'zyxzyx', 'zxzyzx']) == 5\n assert candidate(words = ['xyxzyxzyx', 'yxzyxzyxy', 'xzyxzyxzy', 'zyxzyxzyx', 'yxyxzyxzy', 'xyzzyxzyx']) == 4\n assert candidate(words = ['aabbcc', 'bbaacc', 'abacbc', 'babcac', 'aabbccdd', 'ddccbb', 'abcdabcd', 'cdabcdab', 'abcdabdc', 'abcdabcd', 'abcdabcd', 'abcdabcd', 'abcdabcd', 'abcdabcd', 'abcdabcd', 'abcdabcd', 'abcdabcd', 'abcdabcd', 'abcdabcd', 'abcdabcd']) == 7\n assert candidate(words = ['abcdefghij', 'abcdefghji', 'jihgfedcba', 'ihgfedcbaj', 'jihgfedabc', 'abcdefghij', 'cbadefghij']) == 3\n assert candidate(words = ['aaaabbbb', 'bbbaaa', 'abababab', 'babaabab', 'bababaab', 'abababba']) == 5\n assert candidate(words = ['abcdabcd', 'cdabcdab', 'bacdbacd', 'dcbadabc', 'badcabcd', 'dcababcd', 'abcdadcb']) == 5\n assert candidate(words = ['abcdef', 'fedcba', 'gfedcb', 'bacdef', 'defabc', 'cabfed', 'cbafed', 'dcbaef', 'efabcd', 'fedabc', 'gfedcb', 'bacdef', 'defabc', 'cabfed', 'cbafed', 'dcbaef', 'efabcd', 'fedabc', 'gfedcb', 'bacdef']) == 5\n assert candidate(words = ['abcdefghij', 'bacdefghij', 'cbadefghij', 'abcdefghij', 'ijabcdefgh', 'hgfedcba', 'abcdefghij', 'bacdefghij']) == 3\n assert candidate(words = ['aabbcc', 'bbaaccaabb', 'ababcc', 'aabcbcba', 'ccbaab', 'bccabaab', 'abccbaab', 'baccbaab', 'aabbccba', 'bbaabbcc']) == 7\n assert candidate(words = ['abcdabcd', 'cdabcdab', 'cbadabcd', 'xyzzxyzz', 'zzxyzzxy', 'zzyxzzyx']) == 3\n assert candidate(words = ['abac', 'baca', 'caba', 'acba', 'abca', 'baca', 'caba', 'acba']) == 4\n assert candidate(words = ['abcdef', 'bacdef', 'cbadef', 'abcdefg', 'gfedcba', 'fedcbag', 'gfedabc', 'gfdecba']) == 5\n assert candidate(words = ['abcdefgh', 'ghfedcba', 'abcdghfe', 'bacdefgh', 'hgfedcba', 'abcdefgh', 'ghfedcba', 'bacdefgh']) == 5\n assert candidate(words = ['aabbcc', 'bbaacc', 'abacbc', 'accabb', 'abcabc', 'cbaabc']) == 2\n assert candidate(words = ['mnopqr', 'qrpmno', 'pqmron', 'opmqrn', 'rnmqpo', 'nqrpom', 'mnopqr', 'qrpmno', 'pqmron', 'opmqrn', 'rnmqpo', 'nqrpom']) == 6\n assert candidate(words = ['abcdef', 'acbedf', 'abefcd', 'efabcd', 'cbadef', 'fedcba']) == 3\n assert candidate(words = ['abcdefghij', 'jihgfedcba', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij']) == 2\n assert candidate(words = ['abcde', 'edcba', 'deabc', 'cdeab', 'bcdea', 'aebcd', 'abced', 'bcdea', 'cdeab', 'deabc', 'edcba', 'abcde']) == 4\n assert candidate(words = ['abcdefg', 'bacdefg', 'cbadefg', 'dcbaefg', 'edcbafg', 'fedcgb', 'gfedcba']) == 4\n assert candidate(words = ['aabbccddeeff', 'bbaaccddeeff', 'aacbbddeeff', 'deeffaabbcc', 'efdeaabbcc', 'ccddeeffaabb']) == 4\n assert candidate(words = ['aabbccddeeff', 'bbaaccddeeff', 'abbaccddeeff', 'aabbccceeffd', 'aabbccddeff', 'bbaaccddeeff', 'abbaccddeeff', 'aabbccceeffd', 'aabbccddeff', 'bbaaccddeeff', 'abbaccddeeff', 'aabbccceeffd', 'aabbccddeff', 'bbaaccddeeff', 'abbaccddeeff', 'aabbccceeffd', 'aabbccddeff', 'bbaaccddeeff', 'abbaccddeeff', 'aabbccceeffd']) == 3\n assert candidate(words = ['abcdef', 'defabc', 'bcdefa', 'efabcd', 'fabcde', 'abcdefg', 'defabce', 'bcdefag', 'efabcdg', 'fabcdeg', 'abcdefh', 'defabceg', 'bcdefagh', 'efabcdgh', 'fabcdegh', 'abcdef', 'defabc', 'bcdefa', 'efabcd', 'fabcde', 'abcdefg', 'defabce', 'bcdefag', 'efabcdg', 'fabcdeg', 'abcdefh', 'defabceg', 'bcdefagh', 'efabcdgh', 'fabcdegh']) == 9\n assert candidate(words = ['abcdef', 'fedcba', 'bdfeca', 'fdbeca', 'acefbd', 'bfecad', 'fdbeca', 'gacfbde', 'abcdefg', 'gfedcba', 'bdfhace', 'fhdbaec', 'acegfb', 'bfhacd', 'fhbdcae', 'gacfbde', 'mnopqr', 'qrpmno', 'pqmron', 'opmqrn', 'rnmqpo', 'nqrpom', 'mnopqr', 'qrpmno', 'pqmron', 'opmqrn', 'rnmqpo', 'nqrpom']) == 17\n assert candidate(words = ['aabbccddeeff', 'bbaaddccffee', 'aacccbbbddffee', 'ddffeeaaabbbcc', 'bbccddaaffee', 'ffeeddaabbcc', 'ccddeeffaabbbb', 'ddeeffaacccbbbbb']) == 5\n assert candidate(words = ['abcabc', 'bacbac', 'cababc', 'abcbac', 'baccab', 'acbacb', 'acbbac', 'bacbac']) == 4\n assert candidate(words = ['abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh']) == 1\n assert candidate(words = ['pqrstuvw', 'qrstuvwp', 'rstuvwqp', 'stuvwqpr', 'tuvwqprs', 'uvwqprst', 'vwqprstu', 'wqprstuv', 'qprstuvw', 'prstuvqw', 'rstuvqwp', 'stuvqprw', 'tuvqprws', 'uvqprwst', 'vqprwstu', 'qprwstuv']) == 8\n assert candidate(words = ['mnopqr', 'opqrmn', 'pqrmon', 'qrmpno', 'rmpnoq', 'mpnoqr', 'nqrmpo', 'qrpmno']) == 5\n assert candidate(words = ['abcdef', 'defabc', 'bcadef', 'fedcba', 'defacb', 'efabcd']) == 4\n assert candidate(words = ['abcdef', 'fedcba', 'efabcd', 'cdefab', 'bacdef', 'defabc', 'fabcde', 'abcdefg', 'gfedcba', 'zzzzzz', 'zzzzzz', 'zzzzzz', 'zzzzzz', 'zzzzzz', 'zzzzzz', 'zzzzzz', 'zzzzzz', 'zzzzzz', 'zzzzzz', 'zzzzzz']) == 5\n assert candidate(words = ['abcdefgh', 'efghabcd', 'hgfedcba', 'cdabefgh', 'bacdefgh', 'cbadefgh', 'fedcbaab', 'ghfedcba', 'abcdabef', 'efghabcdab']) == 7\n assert candidate(words = ['abcdefg', 'gfedcba', 'cdabefg', 'efgabcd', 'fedcbag', 'bacdefg']) == 4\n assert candidate(words = ['abcdefghijk', 'abcdefghijk', 'abcdefghijk', 'abcdefghijk', 'abcdefghijk', 'abcdefghijk']) == 1\n assert candidate(words = ['abcdefg', 'gfedcba', 'cebgfad', 'bacdfeg', 'adgfceb', 'fdgecab']) == 4\n assert candidate(words = ['aaabbbccc', 'bbbaaaccc', 'aabbccabb', 'bbccaaabb', 'ccbbbaaab', 'aabbbccc', 'bbbaaaccc', 'aabbccabb']) == 5\n assert candidate(words = ['xyzxyz', 'zyxzyx', 'yzxyzx', 'xzyzxz', 'zyxzxy', 'zxyxzy']) == 4\n assert candidate(words = ['aabbccdd', 'bbaaddcc', 'ababcdcd', 'babcadcd', 'cbadcbad', 'dcbadabc', 'abcdabcd', 'badcabcd']) == 4\n assert candidate(words = ['abcdabcd', 'cdabcdab', 'bacdbacd', 'abcdcdab', 'cdababcd', 'bacdabcd', 'abcdabcd', 'cdabcdab']) == 3\n assert candidate(words = ['zzzzzzzz', 'zzzzzzzz', 'zzzzzzzz', 'zzzzzzzz', 'zzzzzzzz', 'zzzzzzzz']) == 1\n assert candidate(words = ['abcdefgh', 'bacdefgh', 'decfghab', 'fedghabc', 'fedcbagh', 'defghacb', 'gfedcbah', 'hgfedcba']) == 6\n assert candidate(words = ['aabbccddeeff', 'bbaaddeeccff', 'ababcdcdefef', 'babaabcdcdef', 'ccddeeffabcd', 'ddaabbccdefe', 'abcdccddeeff', 'ccddeeffaabb', 'bbccddeeffaa', 'aabbddeeffcc', 'fedcbafedcba', 'defcbafedcba', 'efcbadfedcba', 'cdefbafedcba', 'bacdefedcba', 'abcdefedcba', 'fedcbadefcba', 'defcbadefcba', 'efcbadfedcba', 'cdefbafedcba', 'bacdefedcba', 'abcdebcdfa', 'defcbedabcfa', 'efcbadefabcf', 'cdefbafedabcf', 'bacdefedabcf', 'abcdebcfabcf']) == 14\n assert candidate(words = ['abcdefgh', 'hgfedcba', 'efghabcd', 'cdefghab', 'bacdefgh', 'defghcab', 'fghabcde', 'ghabcdef', 'habcdefg', 'abcdefghg', 'gfedcbaa', 'efghabcd', 'cdefghab', 'bacdefgh', 'defghcab', 'fghabcde', 'ghabcdef', 'habcdefg', 'abcdefghh', 'gfedcbab']) == 8\n assert candidate(words = ['abcdefghij', 'jihgfedcba', 'bacdefghij', 'jihgfedcba', 'bacdefghij', 'jihgfedcba']) == 3\n assert candidate(words = ['abcdefghij', 'jihgfedcba', 'bdfhjacegi', 'fhjdgbacae', 'acegfbidhj', 'bfhacdijeg', 'fhbdcaejg', 'gacfbdehji']) == 8\n assert candidate(words = ['aabbcc', 'bbaacc', 'abacbc', 'cababc', 'acbacb', 'bcabac', 'cabcab', 'abcabc']) == 3\n assert candidate(words = ['aabbccdd', 'bbaaddcc', 'ababcdcd', 'babaabcd', 'ccddabcd', 'ddaabbcc', 'abcdccdd', 'ccddabba', 'bbccddaa', 'aabbddcc']) == 4\n assert candidate(words = ['abcdefgh', 'bacdefgh', 'cbadefgh', 'abcdfehg', 'gfedcba', 'hgfedcba', 'abcdefgh', 'bacdefgh']) == 5\n assert candidate(words = ['aabbccddeeff', 'bbaacceeddff', 'aabcbceddeff', 'aabbccddfeef', 'bbaacceeddff', 'aabcbceddeff', 'aabbccddeeff', 'bbaacceeddff']) == 2\n assert candidate(words = ['abcdefgh', 'acegbdfh', 'agbfcehd', 'hgfedcba', 'efghabcd', 'ceafghbd']) == 5\n assert candidate(words = ['aabbccddeeff', 'ffeeddccbbaa', 'bbaaccddffee', 'ffeeddccbbaa', 'aabbccddeeff', 'ffeeddccbbaa']) == 1\n assert candidate(words = ['zzzzzz', 'zzzzzz', 'zzzzzz', 'zzzzzz', 'zzzzzz', 'zzzzzz']) == 1\n assert candidate(words = ['abcdef', 'bacdef', 'cbadef', 'defabc', 'fedcba', 'efdcba', 'fabced']) == 5\n assert candidate(words = ['abcdefgh', 'bacdefgh', 'cbadefgh', 'defghabc', 'fedcbagh', 'efdcgbah', 'gahfedcb', 'hgfedcba']) == 6\n assert candidate(words = ['aabbccddeeff', 'bbaaccddeeff', 'ababccddeeff', 'bbacacddeeff', 'aabbccddeeff', 'aabbcdeeffcc', 'aaabbbcccddd']) == 5\n assert candidate(words = ['xyzxyz', 'yzxzyx', 'zxyxyz', 'xyzyxz', 'yzxyzx', 'zxyzxy', 'xyzxzy', 'yzzxyx', 'zyxxyz', 'xzyzyx']) == 5\n assert candidate(words = ['xyzabc', 'yzxcba', 'zxcbya', 'zyxcba', 'yxzabc', 'yxzcba', 'zxycba']) == 4\n assert candidate(words = ['abcdefg', 'gfedcba', 'bacdefg', 'gfedcba', 'bacdefg', 'gfedcba']) == 2\n assert candidate(words = ['ababab', 'bababa', 'ababab', 'bababa', 'ababab', 'bababa', 'ababab', 'bababa', 'ababab', 'bababa', 'ababab', 'bababa']) == 2\n assert candidate(words = ['mnopqr', 'mopnqr', 'mpnoqr', 'mnopqr', 'pmonqr', 'pmqnor', 'npoqmr', 'qmonpr']) == 5\n"}, "metadata": {"canonical_parameter_names": ["words"], "leetcode_dataset_entry_point": "Solution().numSpecialEquivGroups", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numSpecialEquivGroups = function(words) {", "container": null, "callable": "numSpecialEquivGroups", "parameters": [{"name": "words", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 896, "task_id": "monotonic-array", "difficulty": "Easy", "problem_description": "An array is monotonic if it is either monotone increasing or monotone decreasing.\nAn array nums is monotone increasing if for all i <= j, nums[i] <= nums[j]. An array nums is monotone decreasing if for all i <= j, nums[i] >= nums[j].\nGiven an integer array nums, return true if the given array is monotonic, or false otherwise.\n \nExample 1:\n\nInput: nums = [1,2,2,3]\nOutput: true\n\nExample 2:\n\nInput: nums = [6,5,4,4]\nOutput: true\n\nExample 3:\n\nInput: nums = [1,3,2]\nOutput: false\n\n \nConstraints:\n\n1 <= nums.length <= 105\n-105 <= nums[i] <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 2, 3]) == True\n assert candidate(nums = [1, 2, 4, 5]) == True\n assert candidate(nums = [-1, -2, -2, -3]) == True\n assert candidate(nums = [1, 1, 1, 1]) == True\n assert candidate(nums = [1, 1, 1]) == True\n assert candidate(nums = [10, -10, -20, -30]) == True\n assert candidate(nums = [-100, 0, 100]) == True\n assert candidate(nums = [-100000, 100000]) == True\n assert candidate(nums = [1, 2, 2, 1]) == False\n assert candidate(nums = [1]) == True\n assert candidate(nums = [5, 3, 3, 2, 1]) == True\n assert candidate(nums = [-1, -5, -10, -10]) == True\n assert candidate(nums = [6, 5, 4, 4]) == True\n assert candidate(nums = [100000, -100000, 0]) == False\n assert candidate(nums = [1, 3, 2]) == False\n assert candidate(nums = [100000, -100000]) == True\n assert candidate(nums = [4, 4, 4, 4]) == True\n assert candidate(nums = [-100000, 0, 100000]) == True\n assert candidate(nums = [-1, -2, -3, -4]) == True\n assert candidate(nums = [5, 5, 4, 4, 3, 3, 2, 2]) == True\n assert candidate(nums = [100, 90, 90, 80, 70, 60, 50]) == True\n assert candidate(nums = [5, 3, 2, 4, 1]) == False\n assert candidate(nums = [1, 2, 4, 5, 6, 7, 8]) == True\n assert candidate(nums = [5]) == True\n assert candidate(nums = [1, 2, 4, 5, 3]) == False\n assert candidate(nums = [1, 3, 5, 4, 4, 3, 2, 1]) == False\n assert candidate(nums = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(nums = [9, 8, 8, 7, 7, 7, 6, 5, 5, 5, 4, 3, 2, 2, 1]) == True\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [1, 2, 2, 2, 3, 4, 5, 5, 5, 6, 7, 8, 8, 8, 9, 10]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 2, 2, 1, 1, 0, 0, -1, -1]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 5, 5, 5, 4, 3, 2, 1]) == False\n assert candidate(nums = [1, 3, 2, 4, 3, 5, 4]) == False\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == True\n assert candidate(nums = [1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [1, 3, 2, 4, 3, 5, 4, 6, 5]) == False\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [-1, 0, 1, 0, -1, 0, 1]) == False\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == True\n assert candidate(nums = [100, 200, 300, 400, 500, 400, 300, 200, 100, 0, -100, -200, -300, -400, -500]) == False\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [1, 3, 2, 2, 3, 4, 5, 5, 5, 4, 3, 2, 1, 0, 0, 0, 1, 1, 1]) == False\n assert candidate(nums = [-100000, -99999, -99998, -99997, -99996]) == True\n assert candidate(nums = [-100000, -90000, -80000, -70000, -60000, -50000, -40000, -30000, -20000, -10000, 0]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10]) == True\n assert candidate(nums = [1, 2, 2, 2, 3, 4, 5, 5, 5, 6, 7, 8, 8, 9, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == True\n assert candidate(nums = [10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6]) == True\n assert candidate(nums = [10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2, -3, -3]) == True\n assert candidate(nums = [5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(nums = [-100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000, -100000]) == True\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == True\n assert candidate(nums = [10, 10, 10, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 2, 2, 2, 1, 1, 1]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == True\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5]) == False\n assert candidate(nums = [100000, 90000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000, 0]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 10, 10]) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5]) == True\n assert candidate(nums = [0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4]) == True\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == False\n assert candidate(nums = [10, 9, 8, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1]) == True\n assert candidate(nums = [4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [100, 100, 100, 100, 100]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == True\n assert candidate(nums = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10]) == False\n assert candidate(nums = [4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 4, 3, 2, 1]) == False\n assert candidate(nums = [5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == True\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(nums = [100000, 100000, 100000, 99999, 99998, 99997, 99996]) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == True\n assert candidate(nums = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == True\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == True\n assert candidate(nums = [-50000, -50000, -50000, -50000, -50000, -50000]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10]) == True\n assert candidate(nums = [100, 200, 300, 400, 500, 400, 300, 200, 100]) == False\n assert candidate(nums = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == True\n assert candidate(nums = [-50000, -50000, -50000, -50000, -50000]) == True\n assert candidate(nums = [1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 10, 10, 10, 10]) == True\n assert candidate(nums = [-1, 0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 3]) == False\n assert candidate(nums = [100000, 99999, 99998, 99997, 99996]) == True\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10]) == True\n assert candidate(nums = [100000, 99999, 99998, 99997, 99996, 99995]) == True\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 5, 4, 3, 2, 1]) == True\n assert candidate(nums = [0, 1, 2, 3, 4, 3, 2, 1, 0, -1, -2, -3, -4, -3, -2, -1, 0]) == False\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == True\n assert candidate(nums = [100000, -100000, 100000, -100000, 100000]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5]) == False\n assert candidate(nums = [1, 2, 3, 4, 3, 2, 1]) == False\n assert candidate(nums = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == True\n assert candidate(nums = [9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == True\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 1, 2]) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 2, 2, 1, 1, 2, 2, 3, 3, 2, 2, 1, 1, 2, 2, 3]) == False\n assert candidate(nums = [-1, -1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 1, 1]) == False\n assert candidate(nums = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == True\n assert candidate(nums = [100000, -100000, 0, 0, 0, 0, 100000]) == False\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 5, 4, 3, 2, 1, 1, 0, -1, -1, -2, -3, -3, -4, -5]) == True\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]) == True\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == True\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9, 9, 9, 9]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == False\n assert candidate(nums = [1, 2, 2, 2, 3, 4, 5, 5, 5, 5, 6, 7, 8, 8, 9]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8]) == False\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [100, 200, 300, 400, 500, 400, 300, 200, 100]) == False\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [-5, -5, -5, -5, 0, 0, 0, 0, 5, 5, 5, 5]) == True\n assert candidate(nums = [100000, 99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991, 99990]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10]) == True\n assert candidate(nums = [100000, 100000, 100000, 100000]) == True\n assert candidate(nums = [100000, 100000, 99999, 99998, 99997]) == True\n assert candidate(nums = [100000, 90000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000, 0, -10000, -20000, -30000, -40000, -50000, -60000, -70000, -80000, -90000, -100000]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6]) == True\n assert candidate(nums = [5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]) == False\n assert candidate(nums = [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000]) == True\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [0, 1, 2, 3, 4, 3, 2, 1, 0]) == False\n assert candidate(nums = [-1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6, -7, -7, -8, -8, -9, -9, -10, -10]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10]) == True\n assert candidate(nums = [5, 4, 3, 2, 1, 1, 1, 1, 1, 2, 3, 4, 5, 5, 5, 5, 5]) == False\n assert candidate(nums = [-100000, -99999, -99998, -99997, -99996, -99995]) == True\n assert candidate(nums = [-100000, -99999, -99998, -99997, -99996, -99995, -99994, -99993, -99992, -99991, -99990]) == True\n assert candidate(nums = [5, 5, 5, 4, 4, 4, 3, 3, 3]) == True\n assert candidate(nums = [1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 3]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [9, 9, 9, 9, 9, 8, 7, 6, 5, 5, 4, 3, 2, 1]) == True\n assert candidate(nums = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().isMonotonic", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isMonotonic = function(nums) {", "container": null, "callable": "isMonotonic", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 897, "task_id": "increasing-order-search-tree", "difficulty": "Easy", "problem_description": "Given the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child.\n \nExample 1:\n\n\nInput: root = [5,3,6,2,4,null,8,1,null,null,null,7,9]\nOutput: [1,null,2,null,3,null,4,null,5,null,6,null,7,null,8,null,9]\n\nExample 2:\n\n\nInput: root = [5,1,7]\nOutput: [1,null,5,null,7]\n\n \nConstraints:\n\nThe number of nodes in the given tree will be in the range [1, 100].\n0 <= Node.val <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18])), tree_node([3, None, 5, None, 7, None, 10, None, 15, None, 18]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 4, None, None, 3])), tree_node([1, None, 2, None, 3, None, 4]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, 8, 1, None, None, None, 7, 9])), tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9]))\n assert is_same_tree(candidate(root = tree_node([5, 1, 7])), tree_node([1, None, 5, None, 7]))\n assert is_same_tree(candidate(root = tree_node([1])), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([15, 10, 20, 8, 12, 17, 25, 7, 9, 11, 13, 16, 18, 23, 27, 6, None, None, None, None, None, None, None, None, None, 19, 21, 24, 26, 28, None, None, None, None, None, None, None, None, None, None])), tree_node([6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 15, None, 16, None, 17, None, 19, None, 18, None, 21, None, 20, None, 24, None, 23, None, 26, None, 25, None, 28, None, 27]))\n assert is_same_tree(candidate(root = tree_node([15, 10, 20, 5, 12, 18, 25, 3, 7, None, 14, 16, 19, 22, None, None, None, None, 11, None, None, None, 13])), tree_node([3, None, 5, None, 7, None, 11, None, 10, None, 12, None, 14, None, 15, None, 16, None, 13, None, 18, None, 19, None, 20, None, 22, None, 25]))\n assert is_same_tree(candidate(root = tree_node([8, 5, 12, 3, 7, 10, 14, 1, None, 6, 8, 9, 11, 13, 15])), tree_node([1, None, 3, None, 5, None, 6, None, 7, None, 8, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15]))\n assert is_same_tree(candidate(root = tree_node([50, 25, 75, 10, 35, 60, 85, 5, 15, 27, 45, 55, 65, 80, 90, 3, 8, 12, 18, 30, 40, 47, 52, 63, 67, 72, 77, 83, 88, 93, None, 7, None, None, None, None, None, None, None, 14, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])), tree_node([7, None, 3, None, 5, None, 8, None, 10, None, 12, None, 15, None, 18, None, 25, None, 14, None, 30, None, 27, None, 40, None, 35, None, 47, None, 45, None, 52, None, 50, None, 63, None, 55, None, 67, None, 60, None, 72, None, 65, None, 77, None, 75, None, 83, None, 80, None, 88, None, 85, None, 93, None, 90]))\n assert is_same_tree(candidate(root = tree_node([8, 5, 12, 3, 7, 10, 15, 1, 4, 6, None, 9, 11, 13, 17, None, 2, 14, 16, None, None, None, None, None, None, None, 18])), tree_node([1, None, 2, None, 3, None, 14, None, 4, None, 16, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 18, None, 15, None, 17]))\n assert is_same_tree(candidate(root = tree_node([15, 10, 20, 5, 12, 17, 25, 3, 7, 11, 13, 16, 18, 23, 27, 1, 4, 6, 8, 9, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19, 21, 22, 24, 26, 28])), tree_node([22, None, 1, None, 24, None, 3, None, 26, None, 4, None, 28, None, 5, None, 6, None, 7, None, 8, None, 10, None, 9, None, 11, None, 10.5, None, 12, None, 11.5, None, 13, None, 12.5, None, 15, None, 13.5, None, 16, None, 14.5, None, 17, None, 15.5, None, 18, None, 16.5, None, 20, None, 17.5, None, 23, None, 18.5, None, 25, None, 19, None, 27, None, 21]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18, 1, None, None, 9, None, 13, 17, 19])), tree_node([1, None, 3, None, 5, None, 7, None, 9, None, 10, None, 12, None, 13, None, 15, None, 17, None, 18, None, 19]))\n assert is_same_tree(candidate(root = tree_node([15, 10, 20, 5, 12, 18, 25, 3, 7, 11, 13, 16, 19, 22, 27, 1, 4, 6, 8, 9, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])), tree_node([1, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 10, None, 9, None, 11, None, 12, None, 13, None, 15, None, 16, None, 18, None, 19, None, 20, None, 22, None, 25, None, 27]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, 7, 13, 17, 23, 27, 33, 37])), tree_node([1, None, 5, None, 7, None, 10, None, 13, None, 15, None, 17, None, 20, None, 23, None, 25, None, 27, None, 30, None, 33, None, 35, None, 37]))\n assert is_same_tree(candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 18, 25, 35, 42, 48, 55])), tree_node([5, None, 10, None, 12, None, 15, None, 18, None, 20, None, 25, None, 30, None, 35, None, 40, None, 42, None, 45, None, 48, None, 50, None, 55]))\n assert is_same_tree(candidate(root = tree_node([15, 10, 20, 5, 12, None, 25, 3, 7, 11, 14, 19, 28, 17, 21, 23, 30])), tree_node([17, None, 3, None, 21, None, 5, None, 23, None, 7, None, 30, None, 10, None, 11, None, 12, None, 14, None, 15, None, 20, None, 19, None, 25, None, 28]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 18, 23, 28, 33, 38, 1, 3, 6, 8, 9, 11, 13, 14, 16, 17, 19, 21, 22, 24, 26, 27, 29, 31, 32, 34, 36, 37, 39, 40])), tree_node([29, None, 1, None, 31, None, 2, None, 32, None, 3, None, 34, None, 5, None, 36, None, 6, None, 37, None, 7, None, 39, None, 8, None, 40, None, 10, None, 9, None, 12, None, 11, None, 15, None, 13, None, 18, None, 14, None, 20, None, 16, None, 23, None, 17, None, 25, None, 19, None, 28, None, 21, None, 30, None, 22, None, 33, None, 24, None, 35, None, 26, None, 38, None, 27]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 40, 60, 85, 110, 140, 160, 190, 5, 15, 30, 45, 55, 65, 70, 80, 90, 105, 115, 120, 130, 135, 145, 155, 165, 180, 185, 195, 200])), tree_node([165, None, 5, None, 180, None, 10, None, 185, None, 15, None, 195, None, 25, None, 200, None, 30, None, 40, None, 45, None, 50, None, 55, None, 60, None, 65, None, 75, None, 70, None, 85, None, 80, None, 100, None, 90, None, 110, None, 105, None, 125, None, 115, None, 140, None, 120, None, 150, None, 130, None, 160, None, 135, None, 175, None, 145, None, 190, None, 155]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 12, 17, 22, 27, 32, 37, 1, 4, 6, 8, 11, 13, 16, 18, 21, 23, 26, 28, 31, 33, 36, 38, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])), tree_node([1, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 10, None, 11, None, 12, None, 13, None, 15, None, 16, None, 17, None, 18, None, 20, None, 21, None, 22, None, 23, None, 25, None, 26, None, 27, None, 28, None, 30, None, 31, None, 32, None, 33, None, 35, None, 36, None, 37, None, 38]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13, None])), tree_node([1, None, 3, None, 4, None, 6, None, 7, None, 8, None, 10, None, 13, None, 14]))\n assert is_same_tree(candidate(root = tree_node([9, 6, 15, 4, 8, 12, 20, 2, 5, 7, 11, 13, 18, 1, None, None, 3, None, None, None, None, None, 9, 10, 14, 16, None, 17, None, 19, 21, 22, None, None, None, None])), tree_node([2, None, 19, None, 3, None, 21, None, 4, None, 5, None, 6, None, 7, None, 8, None, 11, None, 22, None, 9, None, 9, None, 10, None, 13, None, 14, None, 12, None, 16, None, 18, None, 15, None, 17, None, 1, None, 20]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, 1, 5, 9, 20, None, None, None, 6, None, 18])), tree_node([1, None, 3, None, 5, None, 6, None, 7, None, 9, None, 18, None, 15, None, 20]))\n assert is_same_tree(candidate(root = tree_node([6, 2, 8, 0, 4, 7, 9, None, 3, 5])), tree_node([0, None, 3, None, 2, None, 5, None, 4, None, 6, None, 7, None, 8, None, 9]))\n assert is_same_tree(candidate(root = tree_node([50, 25, 75, 12, 37, 62, 87, 6, 18, 31, 43, 55, 68, 82, 93, 3, 9, None, 15, None, 22, None, 29, None, 35, None, 40, None, 46, None, 51, None, 59, None, 65, None, 71, None, 78, None, 84, None, 90, None, 96])), tree_node([3, None, 59, None, 6, None, 9, None, 65, None, 12, None, 18, None, 15, None, 71, None, 25, None, 31, None, 22, None, 78, None, 37, None, 43, None, 29, None, 84, None, 50, None, 55, None, 35, None, 90, None, 62, None, 68, None, 40, None, 96, None, 75, None, 82, None, 46, None, 87, None, 93, None, 51]))\n assert is_same_tree(candidate(root = tree_node([50, 25, 75, 10, 35, 60, 90, 5, 15, 30, 40, 55, 65, 85, 100, 3, 7, 12, 18, 28, 33, 45, 53, 58, 63, 68, 78, 83, 88, 95, 98, 105])), tree_node([105, None, 3, None, 5, None, 7, None, 10, None, 12, None, 15, None, 18, None, 25, None, 28, None, 30, None, 33, None, 35, None, 45, None, 40, None, 53, None, 50, None, 58, None, 55, None, 63, None, 60, None, 68, None, 65, None, 78, None, 75, None, 83, None, 85, None, 88, None, 90, None, 95, None, 100, None, 98]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, 1, 5, 9, 20, 0, 2, 4, 6, 8, 12, 18, 25, None, None, None, None, None, None, None, None, None, None, 10, None, None, 11, 13, 14, 16, None, None, None, None, None, 17, None, None, None, None, None, None, None, 19, 21, None, None, 22, 23, None, 24, None, None, None, 26, None, None, None, None, 27, None, None, None, None, None, None, 28])), tree_node([0, None, 1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 16, None, 10, None, 12, None, 15, None, 18, None, 11, None, 20, None, 13, None, 25, None, 17, None, 14]))\n assert is_same_tree(candidate(root = tree_node([50, 25, 75, 10, 35, 60, 85, 5, 15, 30, 40, 55, 65, 80, 90, 1, 7, None, 12, 18, 27, 33, 38, 45, 52, 58, 63, 68, 72, 78, 83, 88, 93, 2, 3, 6, 8, 9, 11, 13, 14, 16, 17, 19, 20, 21, 22, 23, 24, 26, 28, 29, 31, 32, 34, 36, 37, 39, 41, 42, 43, 44, 46, 47, 48, 49, 51, 53, 54, 56, 57, 59, 61, 62, 64, 66, 67, 69, 70, 71, 73, 74, 75, 76, 77, 79, 81, 82, 84, 86, 87, 89, 91, 92, 94, 95, 96, 97, 98, 99])), tree_node([44, None, 88, None, 46, None, 1, None, 47, None, 93, None, 48, None, 5, None, 49, None, 2, None, 51, None, 7, None, 53, None, 3, None, 54, None, 10, None, 15, None, 56, None, 6, None, 57, None, 12, None, 59, None, 8, None, 61, None, 25, None, 62, None, 9, None, 64, None, 18, None, 66, None, 11, None, 67, None, 30, None, 69, None, 13, None, 70, None, 27, None, 71, None, 14, None, 73, None, 35, None, 74, None, 16, None, 75, None, 33, None, 76, None, 17, None, 77, None, 40, None, 79, None, 19, None, 81, None, 38, None, 82, None, 20, None, 84, None, 50, None, 86, None, 21, None, 87, None, 45, None, 89, None, 22, None, 91, None, 55, None, 92, None, 23, None, 94, None, 52, None, 95, None, 24, None, 96, None, 60, None, 97, None, 26, None, 98, None, 58, None, 99, None, 28, None, 65, None, 29, None, 63, None, 31, None, 75, None, 32, None, 68, None, 34, None, 80, None, 36, None, 72, None, 37, None, 85, None, 39, None, 78, None, 41, None, 90, None, 42, None, 83, None, 43]))\n assert is_same_tree(candidate(root = tree_node([15, 10, 20, 5, 12, 17, 25, 3, 7, 11, 13, 16, 18, 23, 27, 2, 4, 6, 8, 9, 10, 14, 19, 21, 22, 24, 26, 28, 29, 30])), tree_node([2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 10, None, 9, None, 11, None, 10, None, 12, None, 14, None, 13, None, 19, None, 15, None, 21, None, 16, None, 22, None, 17, None, 24, None, 18, None, 26, None, 20, None, 28, None, 23, None, 29, None, 25, None, 30, None, 27]))\n assert is_same_tree(candidate(root = tree_node([40, 20, 60, 10, 30, 50, 70, 5, 15, 25, 35, 45, 55, 65, 75, 1, None, 9, None, 19, None, 29, None, 39, None, 49, None, 59, None, 69, None, 79])), tree_node([79, None, 1, None, 5, None, 10, None, 9, None, 15, None, 20, None, 19, None, 25, None, 30, None, 29, None, 35, None, 40, None, 39, None, 45, None, 50, None, 49, None, 55, None, 60, None, 59, None, 65, None, 70, None, 69, None, 75]))\n assert is_same_tree(candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 18, 25, 35, 48, 1, None, None, None, 11, None, None, None, 16, 19, None, None, 23, 29, 33, None, None, None, None, None, None, 38, None, 43, None, None, None, None, 47, None, None, None, 49])), tree_node([5, None, 10, None, 11, None, 12, None, 15, None, 18, None, 20, None, 16, None, 25, None, 19, None, 49, None, 47, None, 38, None, 30, None, 35, None, 40, None, 23, None, 43, None, 48, None, 29, None, 45, None, 33, None, 1, None, 50]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, None, None, 9, 20, 8, None, 11, None, None, None, 17])), tree_node([3, None, 7, None, 8, None, 9, None, 15, None, 17, None, 11, None, 20]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13])), tree_node([1, None, 3, None, 4, None, 6, None, 7, None, 8, None, 10, None, 13, None, 14]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 8, 12, 17, None, None, 16])), tree_node([1, None, 3, None, 5, None, 16, None, 6, None, 7, None, 8, None, 10, None, 15, None, 12, None, 18, None, 17]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18, 1, None, 6, 8, None, 13, None, None, 16, 19])), tree_node([16, None, 1, None, 19, None, 3, None, 5, None, 6, None, 7, None, 8, None, 10, None, 12, None, 13, None, 15, None, 18]))\n assert is_same_tree(candidate(root = tree_node([60, 20, 80, 10, 40, 70, 90, 5, 15, 30, 50, 65, 75, 85, 95, 1, None, 9, None, 14, None, 25, None, 35, None, 45, None, 63, None, 67, None, 73, None, 77, None, 83, None, 87, None, 93, None, 97])), tree_node([73, None, 1, None, 5, None, 10, None, 77, None, 9, None, 15, None, 20, None, 83, None, 14, None, 30, None, 40, None, 87, None, 25, None, 50, None, 60, None, 93, None, 35, None, 65, None, 70, None, 97, None, 45, None, 75, None, 80, None, 63, None, 85, None, 90, None, 67, None, 95]))\n assert is_same_tree(candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 17, 25, 35, 42, 48, 55, 1, None, 9, None, 13, None, 19, None, 23, None, 28, None, 33, None, 38, None, 44, None, 47, None, 49, None, 53, None, 57])), tree_node([44, None, 1, None, 5, None, 10, None, 47, None, 9, None, 12, None, 15, None, 49, None, 13, None, 17, None, 20, None, 53, None, 19, None, 25, None, 30, None, 57, None, 23, None, 35, None, 40, None, 28, None, 42, None, 45, None, 33, None, 48, None, 50, None, 38, None, 55]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 8, 12, 20, 11, 19])), tree_node([11, None, 1, None, 19, None, 3, None, 5, None, 6, None, 7, None, 8, None, 10, None, 15, None, 12, None, 18, None, 20]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18, 1, None, 6, 8, 11, 13, 17, 19])), tree_node([1, None, 3, None, 5, None, 6, None, 7, None, 8, None, 10, None, 11, None, 12, None, 13, None, 15, None, 17, None, 18, None, 19]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, 12, 18, 22, 28, 33, 38, 45, 1, 7, 11, 14, 16, 19, 21, 23, 27, 29, 31, 32, 34, 37, 39, 41, 43, 44, 46, 47])), tree_node([43, None, 1, None, 44, None, 5, None, 46, None, 7, None, 47, None, 10, None, 11, None, 12, None, 14, None, 15, None, 16, None, 18, None, 19, None, 20, None, 21, None, 22, None, 23, None, 25, None, 27, None, 28, None, 29, None, 30, None, 31, None, 33, None, 32, None, 35, None, 34, None, 38, None, 37, None, 40, None, 39, None, 45, None, 41]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, 1, 5, 9, 20, None, None, 4, 6, 8, 13, 18, None, None, 2, 2.5, None, None, None, None, 11, 14, 16, 17, None, None, None, None, None, None, None, 19])), tree_node([1, None, 3, None, 4, None, 17, None, 2, None, 5, None, 2.5, None, 6, None, 7, None, 8, None, 9, None, 13, None, 11, None, 15, None, 14, None, 18, None, 19, None, 16, None, 20]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, 12, 18, 22, 28, 32, 38, 45, None, None, None, 8, None, None, 13, None, None, None, None, None, None, None, None, None, None, None, None, None, 14, None, 21, 26, None, 31, 34, 36, None, 39, None, 41, None, 43, None, None, None, None, None, None, 47, None, 48, None, 49])), tree_node([5, None, 10, None, 12, None, 8, None, 15, None, 18, None, 20, None, 13, None, 22, None, 25, None, 28, None, 30, None, 32, None, 35, None, 38, None, 40, None, 45]))\n assert is_same_tree(candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 18, 22, 35, 48, 2, 7, 11, 13, 17, 19, 21, 23, 29, 31, 33, 37, 39, 42, 43, 46, 47, 49, 51])), tree_node([51, None, 11, None, 5, None, 13, None, 10, None, 17, None, 12, None, 19, None, 15, None, 21, None, 18, None, 23, None, 20, None, 29, None, 22, None, 31, None, 30, None, 33, None, 35, None, 37, None, 40, None, 39, None, 48, None, 42, None, 45, None, 43, None, 2, None, 46, None, 50, None, 47, None, 7, None, 49]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, 12, 18, 22, 28, 32, 38, 45, 3, 7, 11, 13, 16, 19, 21, 23, 26, 27, 31, 33, 34, 36, 37, 39, 41, 42, 43, 44, 46, 47, 48, 49])), tree_node([41, None, 3, None, 42, None, 5, None, 43, None, 7, None, 44, None, 10, None, 46, None, 11, None, 47, None, 12, None, 48, None, 13, None, 49, None, 15, None, 16, None, 18, None, 19, None, 20, None, 21, None, 22, None, 23, None, 25, None, 26, None, 28, None, 27, None, 30, None, 31, None, 32, None, 33, None, 35, None, 34, None, 38, None, 36, None, 40, None, 37, None, 45, None, 39]))\n assert is_same_tree(candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 18, 25, 35, 42, 48, 55, 3, 7, 9, 11, 14, 16, 19, 22, 28, 32, 38, 41, 43, 47, 49, 53, 58, 62, 67, 69, 73, 78, 83, 88, 92, 97, 102])), tree_node([58, None, 3, None, 62, None, 5, None, 67, None, 7, None, 69, None, 10, None, 73, None, 9, None, 78, None, 12, None, 83, None, 11, None, 88, None, 15, None, 92, None, 14, None, 97, None, 18, None, 102, None, 16, None, 20, None, 19, None, 25, None, 22, None, 30, None, 28, None, 35, None, 32, None, 40, None, 38, None, 42, None, 41, None, 45, None, 43, None, 48, None, 47, None, 50, None, 49, None, 55, None, 53]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13, None, None, 11])), tree_node([1, None, 3, None, 4, None, 11, None, 6, None, 7, None, 8, None, 10, None, 13, None, 14]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13, None, None, None, None, 15])), tree_node([1, None, 3, None, 4, None, 6, None, 7, None, 15, None, 8, None, 10, None, 13, None, 14]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 40, 60, 85, 110, 140, 160, 190, 5, 15, 35, 45, 55, 70, 90, 80, 95, 105, 135, 145, 155, 170, 180, 185, 195, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])), tree_node([195, None, 5, None, 10, None, 15, None, 25, None, 35, None, 40, None, 45, None, 50, None, 55, None, 60, None, 70, None, 75, None, 90, None, 85, None, 80, None, 100, None, 95, None, 110, None, 105, None, 125, None, 135, None, 140, None, 145, None, 150, None, 155, None, 160, None, 170, None, 175, None, 180, None, 190, None, 185]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 8])), tree_node([1, None, 3, None, 5, None, 6, None, 7, None, 8, None, 10, None, 15, None, 18]))\n assert is_same_tree(candidate(root = tree_node([40, 20, 60, 10, 30, 50, 70, 5, 15, 25, 35, 45, 55, 65, 75])), tree_node([5, None, 10, None, 15, None, 20, None, 25, None, 30, None, 35, None, 40, None, 45, None, 50, None, 55, None, 60, None, 65, None, 70, None, 75]))\n assert is_same_tree(candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15])), tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, 12, 18, 22, 28, 32, 38, 45])), tree_node([5, None, 10, None, 12, None, 15, None, 18, None, 20, None, 22, None, 25, None, 28, None, 30, None, 32, None, 35, None, 38, None, 40, None, 45]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 18, 22, 27, 32, 38, 1, 3, 6, 8, 9, 11, 13, 14, 16, 17, 19, 21, 23, 24, 26, 28, 29, 30.5, 31, 33, 34, 36, 37, 39, 40])), tree_node([29, None, 1, None, 30.5, None, 2, None, 31, None, 3, None, 33, None, 5, None, 34, None, 6, None, 36, None, 7, None, 37, None, 8, None, 39, None, 10, None, 40, None, 9, None, 12, None, 11, None, 15, None, 13, None, 18, None, 14, None, 20, None, 16, None, 22, None, 17, None, 25, None, 19, None, 27, None, 21, None, 30, None, 23, None, 32, None, 24, None, 35, None, 26, None, 38, None, 28]))\n assert is_same_tree(candidate(root = tree_node([12, 8, 18, 6, 10, 15, 20, 4, 7, 9, 11, 13, 17, 19, 22, 2, 5, None, None, None, None, None, None, None, None, None, 14, 16, None, None, None, None, None, None, None, None, 21])), tree_node([2, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 15, None, 17, None, 14, None, 21, None, 18, None, 16, None, 19, None, 20, None, 22]))\n assert is_same_tree(candidate(root = tree_node([7, 4, 9, 2, 6, 8, 10, 1, 3, 5])), tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10]))\n assert is_same_tree(candidate(root = tree_node([45, 25, 65, 15, 35, 55, 75, 10, 20, 30, 40, 50, 60, 70, 80])), tree_node([10, None, 15, None, 20, None, 25, None, 30, None, 35, None, 40, None, 45, None, 50, None, 55, None, 60, None, 65, None, 70, None, 75, None, 80]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 18, 23, 27, 32, 37, 1, None, 6, None, 11, None, 16, None, 19, 21, 24, None, 26, None, 28, None, 31, None, 33, None, 36, None, 38])), tree_node([31, None, 1, None, 2, None, 5, None, 33, None, 6, None, 7, None, 10, None, 36, None, 11, None, 12, None, 15, None, 38, None, 16, None, 18, None, 20, None, 19, None, 23, None, 21, None, 25, None, 24, None, 27, None, 30, None, 26, None, 32, None, 35, None, 28, None, 37]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, None, 18, 22, 28, 32, None, None, 3, None, 9, None, 12, None, 16, None, 21, None, 24, None, 27, None, 31, None, 33, None, 37, None, 39, None])), tree_node([39, None, 24, None, 3, None, 5, None, 10, None, 15, None, 27, None, 9, None, 18, None, 20, None, 31, None, 12, None, 22, None, 25, None, 33, None, 16, None, 28, None, 30, None, 37, None, 21, None, 32, None, 35, None, 40]))\n assert is_same_tree(candidate(root = tree_node([7, 4, 10, 3, 5, 9, 11, 2, 6, 8, None, None, None, None, None, None, None, 1, None, None])), tree_node([2, None, 3, None, 1, None, 6, None, 4, None, 8, None, 5, None, 7, None, 9, None, 10, None, 11]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, 1, 5, 9, 20, None, None, 4, 6, 8, 12, 18, 22, None, None, 2, 10, 14, 16, 19, 21, 23, None, None, None, None, None, None, 11, 13, 17, 18])), tree_node([1, None, 3, None, 4, None, 5, None, 2, None, 6, None, 10, None, 11, None, 7, None, 13, None, 14, None, 17, None, 8, None, 18, None, 16, None, 9, None, 19, None, 12, None, 21, None, 15, None, 23, None, 18, None, 20, None, 22]))\n assert is_same_tree(candidate(root = tree_node([90, 45, 135, 20, 70, 110, 160, 10, 30, 50, 80, 100, 120, 140, 170])), tree_node([10, None, 20, None, 30, None, 45, None, 50, None, 70, None, 80, None, 90, None, 100, None, 110, None, 120, None, 135, None, 140, None, 160, None, 170]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, None, 4, 9, 12, None, None, 5, 7, 11, 13])), tree_node([3, None, 4, None, 8, None, 5, None, 9, None, 7, None, 10, None, 11, None, 12, None, 13]))\n assert is_same_tree(candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 10, None, 25, 35, 55, 65, 75, 90])), tree_node([10, None, 20, None, 30, None, 25, None, 40, None, 35, None, 50, None, 55, None, 60, None, 65, None, 70, None, 75, None, 80, None, 90]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 17, 23, 28, 32, 40, 1, None, 6, 8, 11, 13, 16, 18, 21, 24, 27, 29, 31, 33, 39])), tree_node([1, None, 2, None, 5, None, 6, None, 7, None, 8, None, 10, None, 11, None, 12, None, 13, None, 15, None, 16, None, 17, None, 18, None, 20, None, 21, None, 23, None, 24, None, 25, None, 27, None, 28, None, 29, None, 30, None, 31, None, 32, None, 33, None, 35, None, 39, None, 40]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 2, 7, None, 20, 1, None, 6, 8])), tree_node([1, None, 2, None, 5, None, 6, None, 7, None, 8, None, 10, None, 15, None, 20]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 18, 23, 28, 33, 38, 1, 3, 6, 8, 9, 11, 13, 14, 16, 17, 19, 21, 22, 24, 26, 27, 29, 31, 32, 34, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50])), tree_node([29, None, 1, None, 31, None, 2, None, 32, None, 3, None, 34, None, 5, None, 36, None, 6, None, 37, None, 7, None, 39, None, 8, None, 40, None, 10, None, 41, None, 9, None, 42, None, 12, None, 43, None, 11, None, 44, None, 15, None, 45, None, 13, None, 46, None, 18, None, 47, None, 14, None, 48, None, 20, None, 49, None, 16, None, 50, None, 23, None, 17, None, 25, None, 19, None, 28, None, 21, None, 30, None, 22, None, 33, None, 24, None, 35, None, 26, None, 38, None, 27]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13, 17, None, None, None, None, None, None, 18])), tree_node([1, None, 3, None, 4, None, 6, None, 7, None, 8, None, 10, None, 13, None, 14, None, 18, None, 17]))\n assert is_same_tree(candidate(root = tree_node([18, 9, 27, 6, 15, 24, 30, 3, 8, 12, 17, 21, 26, 29, 31])), tree_node([3, None, 6, None, 8, None, 9, None, 12, None, 15, None, 17, None, 18, None, 21, None, 24, None, 26, None, 27, None, 29, None, 30, None, 31]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])), tree_node([8, None, 4, None, 9, None, 2, None, 10, None, 5, None, 11, None, 1, None, 12, None, 6, None, 13, None, 3, None, 14, None, 7, None, 15]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, 4, 7, 9, 13, 17, 12])), tree_node([1, None, 12, None, 4, None, 3, None, 7, None, 6, None, 9, None, 8, None, 10, None, 13, None, 14, None, 17]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 12, 20, 1, None, 6, 8, 11, 13, 18, 22, 0, 2, None, None, None, None, None, None, 9, None, None, 14, None, 16, 17, None, None, None, None, 19, None, None, None, 21, None, None, None, None, None, None])), tree_node([17, None, 0, None, 1, None, 2, None, 3, None, 5, None, 6, None, 7, None, 8, None, 10, None, 11, None, 12, None, 9, None, 19, None, 13, None, 15, None, 18, None, 14, None, 20, None, 22, None, 16, None, 21]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, 1, 5, 10, 20, None, None, 2, 6, 8, 12, 17, None, None, None, None, 11, 13, 16, 19, 18, None, 21])), tree_node([1, None, 3, None, 2, None, 5, None, 6, None, 11, None, 7, None, 13, None, 8, None, 16, None, 10, None, 19, None, 12, None, 18, None, 15, None, 17, None, 21, None, 20]))\n assert is_same_tree(candidate(root = tree_node([20, 15, 25, 10, 18, 22, 30, 5, 13, 17, 19, 21, 23, 27, 35, 3, 7, 11, 14, 16, 12, 18, 20, 24, 26, 31, 34, 36])), tree_node([3, None, 5, None, 7, None, 10, None, 11, None, 13, None, 14, None, 15, None, 16, None, 17, None, 12, None, 18, None, 18, None, 19, None, 20, None, 20, None, 24, None, 21, None, 26, None, 22, None, 31, None, 23, None, 34, None, 25, None, 36, None, 27, None, 30, None, 35]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 18, 23, 27, 32, 38, 1, None, None, 6, 8, 11, 13, 17, 19, 22, 24, 26, 28, 31, 33, 36, 39])), tree_node([39, None, 1, None, 2, None, 5, None, 7, None, 6, None, 10, None, 8, None, 12, None, 11, None, 15, None, 13, None, 18, None, 17, None, 20, None, 19, None, 23, None, 22, None, 25, None, 24, None, 27, None, 26, None, 30, None, 28, None, 32, None, 31, None, 35, None, 33, None, 38, None, 36]))\n assert is_same_tree(candidate(root = tree_node([60, 20, 80, 10, 30, 70, 90, 5, 15, 25, 35, 65, 75, 85, 95])), tree_node([5, None, 10, None, 15, None, 20, None, 25, None, 30, None, 35, None, 60, None, 65, None, 70, None, 75, None, 80, None, 85, None, 90, None, 95]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, 6, 8, 9, 12, 17, None, None, 11, 13, 16, 19])), tree_node([1, None, 3, None, 11, None, 6, None, 13, None, 5, None, 16, None, 8, None, 19, None, 7, None, 9, None, 10, None, 15, None, 12, None, 18, None, 17]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, 1, 5, 9, 20, None, 2, None, None, 6, 12, None, None, None, 19])), tree_node([1, None, 2, None, 19, None, 3, None, 5, None, 7, None, 6, None, 9, None, 12, None, 15, None, 20]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 8, 16, 20])), tree_node([1, None, 3, None, 5, None, 6, None, 7, None, 8, None, 10, None, 15, None, 16, None, 18, None, 20]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 30, 10, 20, 28, 35, 5, 12, 18, 22, 26, 29, 32, 38, 3, 7, 11, 13, 16, 19, 21, 23, 24, 27, 30.5, 31, 33, 34, 36, 37, 39, 40])), tree_node([39, None, 3, None, 40, None, 5, None, 7, None, 10, None, 11, None, 12, None, 13, None, 15, None, 16, None, 18, None, 19, None, 20, None, 21, None, 22, None, 23, None, 25, None, 24, None, 26, None, 27, None, 28, None, 30.5, None, 29, None, 31, None, 30, None, 33, None, 32, None, 34, None, 35, None, 36, None, 38, None, 37]))\n assert is_same_tree(candidate(root = tree_node([9, 6, 15, 3, 8, 12, 18, 1, 5, 7, 10, 11, 13, 17, 20])), tree_node([1, None, 3, None, 5, None, 6, None, 7, None, 8, None, 10, None, 9, None, 11, None, 12, None, 13, None, 15, None, 17, None, 18, None, 20]))\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().increasingBST", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var increasingBST = function(root) {", "container": null, "callable": "increasingBST", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 898, "task_id": "bitwise-ors-of-subarrays", "difficulty": "Medium", "problem_description": "Given an integer array arr, return the number of distinct bitwise ORs of all the non-empty subarrays of arr.\nThe bitwise OR of a subarray is the bitwise OR of each integer in the subarray. The bitwise OR of a subarray of one integer is that integer.\nA subarray is a contiguous non-empty sequence of elements within an array.\n \nExample 1:\n\nInput: arr = [0]\nOutput: 1\nExplanation: There is only one possible result: 0.\n\nExample 2:\n\nInput: arr = [1,1,2]\nOutput: 3\nExplanation: The possible subarrays are [1], [1], [2], [1, 1], [1, 2], [1, 1, 2].\nThese yield the results 1, 1, 2, 1, 3, 3.\nThere are 3 unique values, so the answer is 3.\n\nExample 3:\n\nInput: arr = [1,2,4]\nOutput: 6\nExplanation: The possible results are 1, 2, 3, 4, 6, and 7.\n\n \nConstraints:\n\n1 <= arr.length <= 5 * 104\n0 <= arr[i] <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [0, 1, 1, 3]) == 3\n assert candidate(arr = [2, 1, 0, 3, 2]) == 4\n assert candidate(arr = [5, 5, 5, 5, 5, 5]) == 1\n assert candidate(arr = [8, 16, 32]) == 6\n assert candidate(arr = [1, 1, 2]) == 3\n assert candidate(arr = [10, 20, 30, 40, 50]) == 7\n assert candidate(arr = [0]) == 1\n assert candidate(arr = [8, 16, 32, 64, 128]) == 15\n assert candidate(arr = [1, 0, 1]) == 2\n assert candidate(arr = [1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [1, 3, 7, 15, 31]) == 5\n assert candidate(arr = [1, 2, 3, 4, 5]) == 6\n assert candidate(arr = [1, 2, 4]) == 6\n assert candidate(arr = [3, 2, 1, 5, 4]) == 6\n assert candidate(arr = [3, 2, 1, 1, 2, 3]) == 3\n assert candidate(arr = [0, 0, 0]) == 1\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0]) == 1\n assert candidate(arr = [0, 1, 2, 3, 4]) == 6\n assert candidate(arr = [5, 1, 4, 2, 1]) == 7\n assert candidate(arr = [0, 1, 2, 3]) == 4\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7]) == 7\n assert candidate(arr = [1023, 511, 255, 127, 63, 31, 15, 7, 3, 1, 0]) == 11\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 11\n assert candidate(arr = [1, 3, 7, 15, 31, 63, 127, 255]) == 8\n assert candidate(arr = [8, 4, 2, 1, 0, 1, 2, 4, 8, 16]) == 16\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 1\n assert candidate(arr = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]) == 15\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 15\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128]) == 36\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 11\n assert candidate(arr = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]) == 55\n assert candidate(arr = [89, 55, 34, 21, 13, 8, 5, 3, 2, 1, 1]) == 16\n assert candidate(arr = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 2\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 15\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 15\n assert candidate(arr = [255, 127, 63, 31, 15, 7, 3, 1]) == 8\n assert candidate(arr = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]) == 16\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60]) == 17\n assert candidate(arr = [1, 3, 7, 15, 31, 63, 127, 255]) == 8\n assert candidate(arr = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000]) == 1\n assert candidate(arr = [1000000000, 500000000, 250000000, 125000000, 62500000, 31250000, 15625000, 7812500, 3906250, 1953125]) == 55\n assert candidate(arr = [255, 127, 63, 31, 15, 7, 3, 1, 0]) == 9\n assert candidate(arr = [29, 17, 3, 19, 23, 5, 11, 2, 7, 29, 17, 3, 19, 23, 5, 11, 2, 7]) == 11\n assert candidate(arr = [13, 14, 15, 16, 17, 18, 19, 20, 21, 22]) == 12\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]) == 78\n assert candidate(arr = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987]) == 29\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) == 55\n assert candidate(arr = [1, 3, 7, 15, 31, 63, 127, 255, 511, 1023]) == 10\n assert candidate(arr = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == 1\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256]) == 45\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [0, 1, 3, 7, 15, 31, 63, 127]) == 8\n assert candidate(arr = [0, 1, 3, 7, 15, 31, 63]) == 7\n assert candidate(arr = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28]) == 15\n assert candidate(arr = [123, 456, 789, 123, 456, 789, 123, 456, 789, 123]) == 7\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6]) == 7\n assert candidate(arr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]) == 24\n assert candidate(arr = [255, 127, 63, 31, 15, 7, 3, 1, 0, 1, 3, 7, 15, 31, 63, 127, 255]) == 9\n assert candidate(arr = [2147483647, 2147483646, 2147483645, 2147483644, 2147483643, 2147483642, 2147483641, 2147483640, 2147483639, 2147483638]) == 10\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]) == 210\n assert candidate(arr = [1, 3, 7, 15, 31, 63, 127]) == 7\n assert candidate(arr = [1, 3, 2, 7, 6, 14, 13, 31, 30, 29]) == 11\n assert candidate(arr = [99, 88, 77, 66, 55, 44, 33, 22, 11, 0, 11, 22, 33, 44, 55, 66, 77, 88, 99]) == 19\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 22\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 24\n assert candidate(arr = [13, 7, 14, 13, 7, 14, 13, 7, 14, 13]) == 4\n assert candidate(arr = [1023, 511, 255, 127, 63, 31, 15, 7, 3, 1]) == 10\n assert candidate(arr = [1, 10, 100, 1000, 10000, 100000, 1000000]) == 28\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 11\n assert candidate(arr = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1]) == 2\n assert candidate(arr = [1000000000, 500000000, 250000000, 125000000, 62500000]) == 15\n assert candidate(arr = [2147483647, 2147483647, 2147483647, 2147483647]) == 1\n assert candidate(arr = [8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096]) == 55\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 6\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8]) == 9\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == 2\n assert candidate(arr = [0, 1, 3, 7, 15, 31, 63, 127, 255]) == 9\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 16\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096]) == 91\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 13\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 19\n assert candidate(arr = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]) == 55\n assert candidate(arr = [31, 15, 7, 3, 1, 3, 7, 15, 31, 63]) == 6\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384]) == 120\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 1\n assert candidate(arr = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768]) == 120\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 1\n assert candidate(arr = [1023, 511, 255, 127, 63, 31, 15, 7, 3, 1, 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023]) == 11\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 1\n assert candidate(arr = [255, 127, 63, 31, 15, 7, 3, 1, 0]) == 9\n assert candidate(arr = [999, 888, 777, 666, 555, 444, 333, 222, 111, 0, 111, 222, 333, 444, 555, 666, 777, 888, 999]) == 21\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().subarrayBitwiseORs", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var subarrayBitwiseORs = function(arr) {", "container": null, "callable": "subarrayBitwiseORs", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 899, "task_id": "orderly-queue", "difficulty": "Hard", "problem_description": "You are given a string s and an integer k. You can choose one of the first k letters of s and append it at the end of the string.\nReturn the lexicographically smallest string you could have after applying the mentioned step any number of moves.\n \nExample 1:\n\nInput: s = \"cba\", k = 1\nOutput: \"acb\"\nExplanation: \nIn the first move, we move the 1st character 'c' to the end, obtaining the string \"bac\".\nIn the second move, we move the 1st character 'b' to the end, obtaining the final result \"acb\".\n\nExample 2:\n\nInput: s = \"baaca\", k = 3\nOutput: \"aaabc\"\nExplanation: \nIn the first move, we move the 1st character 'b' to the end, obtaining the string \"aacab\".\nIn the second move, we move the 3rd character 'c' to the end, obtaining the final result \"aaabc\".\n\n \nConstraints:\n\n1 <= k <= s.length <= 1000\ns consist of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"aaab\",k = 1) == \"aaab\"\n assert candidate(s = \"aaa\",k = 3) == \"aaa\"\n assert candidate(s = \"zxy\",k = 3) == \"xyz\"\n assert candidate(s = \"zxy\",k = 1) == \"xyz\"\n assert candidate(s = \"ccccc\",k = 4) == \"ccccc\"\n assert candidate(s = \"abcd\",k = 2) == \"abcd\"\n assert candidate(s = \"cba\",k = 1) == \"acb\"\n assert candidate(s = \"aaa\",k = 1) == \"aaa\"\n assert candidate(s = \"zyx\",k = 2) == \"xyz\"\n assert candidate(s = \"zyx\",k = 1) == \"xzy\"\n assert candidate(s = \"baaca\",k = 3) == \"aaabc\"\n assert candidate(s = \"mississippi\",k = 1) == \"imississipp\"\n assert candidate(s = \"abcdef\",k = 6) == \"abcdef\"\n assert candidate(s = \"aaaabbbbcccc\",k = 3) == \"aaaabbbbcccc\"\n assert candidate(s = \"zzzzzzzzzz\",k = 1) == \"zzzzzzzzzz\"\n assert candidate(s = \"leetcodeleetcode\",k = 6) == \"ccddeeeeeelloott\"\n assert candidate(s = \"mississippi\",k = 4) == \"iiiimppssss\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",k = 1) == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(s = \"aabbccddeeff\",k = 1) == \"aabbccddeeff\"\n assert candidate(s = \"xyzxyzxyzxyz\",k = 4) == \"xxxxyyyyzzzz\"\n assert candidate(s = \"pqrsrstp\",k = 1) == \"ppqrsrst\"\n assert candidate(s = \"abcdefedcba\",k = 20) == \"aabbccddeef\"\n assert candidate(s = \"abcdedcba\",k = 1) == \"aabcdedcb\"\n assert candidate(s = \"pqrsrstp\",k = 3) == \"ppqrrsst\"\n assert candidate(s = \"bananaananab\",k = 2) == \"aaaaaabbnnnn\"\n assert candidate(s = \"cbbca\",k = 2) == \"abbcc\"\n assert candidate(s = \"banana\",k = 2) == \"aaabnn\"\n assert candidate(s = \"leetcode\",k = 4) == \"cdeeelot\"\n assert candidate(s = \"abcdxyz\",k = 5) == \"abcdxyz\"\n assert candidate(s = \"abracadabra\",k = 1) == \"aabracadabr\"\n assert candidate(s = \"mnopqr\",k = 4) == \"mnopqr\"\n assert candidate(s = \"abcdedcba\",k = 9) == \"aabbccdde\"\n assert candidate(s = \"abababab\",k = 2) == \"aaaabbbb\"\n assert candidate(s = \"zyxcba\",k = 1) == \"azyxcb\"\n assert candidate(s = \"aabbccddeeff\",k = 6) == \"aabbccddeeff\"\n assert candidate(s = \"aaaabbbb\",k = 1) == \"aaaabbbb\"\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",k = 1) == \"azyxwvutsrqponmlkjihgfedcb\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",k = 25) == \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\"\n assert candidate(s = \"fedcbabcd\",k = 2) == \"abbccddef\"\n assert candidate(s = \"fedcba\",k = 1) == \"afedcb\"\n assert candidate(s = \"banana\",k = 1) == \"abanan\"\n assert candidate(s = \"mnopqrsmnopqrsmnopqr\",k = 4) == \"mmmnnnooopppqqqrrrss\"\n assert candidate(s = \"aaaaabbbbbcccc\",k = 2) == \"aaaaabbbbbcccc\"\n assert candidate(s = \"mnopqrstuvw\",k = 3) == \"mnopqrstuvw\"\n assert candidate(s = \"abababababab\",k = 6) == \"aaaaaabbbbbb\"\n assert candidate(s = \"abcdedcba\",k = 2) == \"aabbccdde\"\n assert candidate(s = \"pqrsqponmlkjihgfedcba\",k = 1) == \"apqrsqponmlkjihgfedcb\"\n assert candidate(s = \"defabc\",k = 1) == \"abcdef\"\n assert candidate(s = \"abcdexyz\",k = 3) == \"abcdexyz\"\n assert candidate(s = \"aaaaaabbbbb\",k = 2) == \"aaaaaabbbbb\"\n assert candidate(s = \"fghijklmnopqrstuvwxyzabcdef\",k = 10) == \"abcdeffghijklmnopqrstuvwxyz\"\n assert candidate(s = \"abababab\",k = 3) == \"aaaabbbb\"\n assert candidate(s = \"rotation\",k = 2) == \"ainoortt\"\n assert candidate(s = \"mnopqr\",k = 6) == \"mnopqr\"\n assert candidate(s = \"acbacbacbacb\",k = 3) == \"aaaabbbbcccc\"\n assert candidate(s = \"kjihgfedcbazyxwvutsrqponml\",k = 5) == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"aaaabbbbcccc\",k = 2) == \"aaaabbbbcccc\"\n assert candidate(s = \"abcabcabc\",k = 3) == \"aaabbbccc\"\n assert candidate(s = \"zzzzzzzzyy\",k = 2) == \"yyzzzzzzzz\"\n assert candidate(s = \"aabbbccccddddeeeeffffgggg\",k = 10) == \"aabbbccccddddeeeeffffgggg\"\n assert candidate(s = \"aaaabbbbcccc\",k = 1) == \"aaaabbbbcccc\"\n assert candidate(s = \"abcdfe\",k = 1) == \"abcdfe\"\n assert candidate(s = \"thisisaverylongstringwithrandomcharacters\",k = 1) == \"actersthisisaverylongstringwithrandomchar\"\n assert candidate(s = \"zzzzzzzzzzzzzzz\",k = 10) == \"zzzzzzzzzzzzzzz\"\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",k = 1000) == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"thisisatest\",k = 4) == \"aehiisssttt\"\n assert candidate(s = \"banana\",k = 3) == \"aaabnn\"\n assert candidate(s = \"rotor\",k = 1) == \"orrot\"\n assert candidate(s = \"fedcba\",k = 2) == \"abcdef\"\n assert candidate(s = \"ppqpp\",k = 2) == \"ppppq\"\n assert candidate(s = \"abcde\",k = 5) == \"abcde\"\n assert candidate(s = \"abcdfe\",k = 3) == \"abcdef\"\n assert candidate(s = \"zzzzzzzzzzyyyyyyyyxxxxxxxxxx\",k = 25) == \"xxxxxxxxxxyyyyyyyyzzzzzzzzzz\"\n assert candidate(s = \"bananaananab\",k = 1) == \"aananabbanan\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",k = 13) == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"abcdxyz\",k = 2) == \"abcdxyz\"\n assert candidate(s = \"acbxyz\",k = 2) == \"abcxyz\"\n assert candidate(s = \"xyzzyx\",k = 3) == \"xxyyzz\"\n assert candidate(s = \"abcdeabcde\",k = 5) == \"aabbccddee\"\n assert candidate(s = \"qazwsxedcrfvtgbyhnujmikolp\",k = 1) == \"azwsxedcrfvtgbyhnujmikolpq\"\n assert candidate(s = \"abcdabcd\",k = 2) == \"aabbccdd\"\n assert candidate(s = \"rotation\",k = 1) == \"ationrot\"\n assert candidate(s = \"mnopqrstuvwxyz\",k = 13) == \"mnopqrstuvwxyz\"\n assert candidate(s = \"aabbccddeeffgg\",k = 4) == \"aabbccddeeffgg\"\n assert candidate(s = \"xyzzyx\",k = 2) == \"xxyyzz\"\n assert candidate(s = \"abcabcabc\",k = 1) == \"abcabcabc\"\n assert candidate(s = \"leetcodeleetcode\",k = 5) == \"ccddeeeeeelloott\"\n assert candidate(s = \"aaabbbccc\",k = 1) == \"aaabbbccc\"\n assert candidate(s = \"abracadabra\",k = 5) == \"aaaaabbcdrr\"\n assert candidate(s = \"fedcba\",k = 3) == \"abcdef\"\n assert candidate(s = \"aaabbbccc\",k = 3) == \"aaabbbccc\"\n assert candidate(s = \"xyzxyzxyz\",k = 3) == \"xxxyyyzzz\"\n assert candidate(s = \"zzzzzzzzzzyyyyyyyyxxxxxxxxxx\",k = 1) == \"xxxxxxxxxxzzzzzzzzzzyyyyyyyy\"\n assert candidate(s = \"leetcodeleetcode\",k = 8) == \"ccddeeeeeelloott\"\n assert candidate(s = \"zyxcba\",k = 5) == \"abcxyz\"\n assert candidate(s = \"qwertyuiop\",k = 5) == \"eiopqrtuwy\"\n assert candidate(s = \"rotation\",k = 6) == \"ainoortt\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",k = 1) == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"abacabadabacaba\",k = 3) == \"aaaaaaaabbbbccd\"\n assert candidate(s = \"bananaappleorange\",k = 7) == \"aaaaabeeglnnnoppr\"\n assert candidate(s = \"abacabadabacaba\",k = 5) == \"aaaaaaaabbbbccd\"\n assert candidate(s = \"abcdefghihgfedcba\",k = 1) == \"aabcdefghihgfedcb\"\n assert candidate(s = \"qazwsxedcrfvtgbyhnujmikolp\",k = 15) == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"aaaaabbbbbaaaa\",k = 2) == \"aaaaaaaaabbbbb\"\n assert candidate(s = \"zzzyyy\",k = 2) == \"yyyzzz\"\n assert candidate(s = \"qwertyuiop\",k = 10) == \"eiopqrtuwy\"\n assert candidate(s = \"xyzxyzxyz\",k = 9) == \"xxxyyyzzz\"\n assert candidate(s = \"abacabadabacaba\",k = 7) == \"aaaaaaaabbbbccd\"\n assert candidate(s = \"racecar\",k = 1) == \"acecarr\"\n assert candidate(s = \"xyzxyzxyz\",k = 2) == \"xxxyyyzzz\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",k = 26) == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"zyxzyxzyxzyx\",k = 5) == \"xxxxyyyyzzzz\"\n assert candidate(s = \"thisisaverylongstringwithrandomcharacters\",k = 5) == \"aaaaccdeegghhhiiiilmnnnoorrrrrssssttttvwy\"\n assert candidate(s = \"hellohellohello\",k = 4) == \"eeehhhllllllooo\"\n assert candidate(s = \"mvvuuz\",k = 3) == \"muuvvz\"\n assert candidate(s = \"aabbcc\",k = 1) == \"aabbcc\"\n assert candidate(s = \"abcdexyz\",k = 1) == \"abcdexyz\"\n assert candidate(s = \"aabbcc\",k = 2) == \"aabbcc\"\n"}, "metadata": {"canonical_parameter_names": ["s", "k"], "leetcode_dataset_entry_point": "Solution().orderlyQueue", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var orderlyQueue = function(s, k) {", "container": null, "callable": "orderlyQueue", "parameters": [{"name": "s", "type": "string"}, {"name": "k", "type": "number"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 902, "task_id": "numbers-at-most-n-given-digit-set", "difficulty": "Hard", "problem_description": "Given an array of digits which is sorted in non-decreasing order. You can write numbers using each digits[i] as many times as we want. For example, if digits = ['1','3','5'], we may write numbers such as '13', '551', and '1351315'.\nReturn the number of positive integers that can be generated that are less than or equal to a given integer n.\n \nExample 1:\n\nInput: digits = [\"1\",\"3\",\"5\",\"7\"], n = 100\nOutput: 20\nExplanation: \nThe 20 numbers that can be written are:\n1, 3, 5, 7, 11, 13, 15, 17, 31, 33, 35, 37, 51, 53, 55, 57, 71, 73, 75, 77.\n\nExample 2:\n\nInput: digits = [\"1\",\"4\",\"9\"], n = 1000000000\nOutput: 29523\nExplanation: \nWe can write 3 one digit numbers, 9 two digit numbers, 27 three digit numbers,\n81 four digit numbers, 243 five digit numbers, 729 six digit numbers,\n2187 seven digit numbers, 6561 eight digit numbers, and 19683 nine digit numbers.\nIn total, this is 29523 integers that can be written using the digits array.\n\nExample 3:\n\nInput: digits = [\"7\"], n = 8\nOutput: 1\n\n \nConstraints:\n\n1 <= digits.length <= 9\ndigits[i].length == 1\ndigits[i] is a digit from '1' to '9'.\nAll the values in digits are unique.\ndigits is sorted in non-decreasing order.\n1 <= n <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(digits = ['1', '4', '9'],n = 1000000000) == 29523\n assert candidate(digits = ['7'],n = 8) == 1\n assert candidate(digits = ['1', '2', '3'],n = 123) == 18\n assert candidate(digits = ['2', '3', '5'],n = 250) == 18\n assert candidate(digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9'],n = 999) == 819\n assert candidate(digits = ['3', '4', '5'],n = 1000) == 39\n assert candidate(digits = ['1', '3', '5', '7'],n = 100) == 20\n assert candidate(digits = ['1', '2', '3'],n = 123456789) == 14214\n assert candidate(digits = ['1', '3', '5', '7'],n = 100000000) == 87380\n assert candidate(digits = ['2', '4', '6', '8'],n = 5000) == 212\n assert candidate(digits = ['2', '4'],n = 100) == 6\n assert candidate(digits = ['2', '4', '6', '8'],n = 468246824) == 198406\n assert candidate(digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9'],n = 1000000000) == 435848049\n assert candidate(digits = ['1', '3', '5', '7', '9'],n = 99999) == 3905\n assert candidate(digits = ['1', '5', '9'],n = 99999) == 363\n assert candidate(digits = ['2', '3', '6', '7', '8'],n = 123456789) == 488280\n assert candidate(digits = ['1', '2', '3', '4'],n = 1000) == 84\n assert candidate(digits = ['5', '9'],n = 555555555) == 511\n assert candidate(digits = ['2', '5', '9'],n = 10000) == 120\n assert candidate(digits = ['2', '4', '8'],n = 888888888) == 29523\n assert candidate(digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9'],n = 999999999) == 435848049\n assert candidate(digits = ['3', '6', '9'],n = 333699) == 381\n assert candidate(digits = ['1', '2', '3'],n = 10000) == 120\n assert candidate(digits = ['1', '2', '3', '4'],n = 5000) == 340\n assert candidate(digits = ['2', '4', '6', '8'],n = 1000000) == 5460\n assert candidate(digits = ['1', '3', '5', '7', '9'],n = 555555555) == 1464843\n assert candidate(digits = ['1', '2', '3', '4', '5'],n = 9999) == 780\n assert candidate(digits = ['4', '5', '6'],n = 456) == 18\n assert candidate(digits = ['1', '3', '5', '7', '9'],n = 500000000) == 1269530\n assert candidate(digits = ['1', '2', '5'],n = 100000) == 363\n assert candidate(digits = ['1', '2'],n = 212121212) == 852\n assert candidate(digits = ['1', '2', '3'],n = 111111111) == 9841\n assert candidate(digits = ['2', '3', '7', '8'],n = 5000) == 212\n assert candidate(digits = ['2', '6', '9'],n = 123456789) == 9840\n assert candidate(digits = ['1', '3', '7', '9'],n = 123456789) == 103764\n assert candidate(digits = ['2', '6', '8'],n = 100000) == 363\n assert candidate(digits = ['2', '5', '8'],n = 500) == 21\n assert candidate(digits = ['1', '2', '3', '4', '5'],n = 5000) == 655\n assert candidate(digits = ['8', '9'],n = 999999999) == 1022\n assert candidate(digits = ['1', '2', '3', '4'],n = 43210) == 1252\n assert candidate(digits = ['1', '9'],n = 999999999) == 1022\n assert candidate(digits = ['2', '6', '8'],n = 4500) == 66\n assert candidate(digits = ['1', '3', '5'],n = 555555555) == 29523\n assert candidate(digits = ['1', '4', '7', '9'],n = 123456789) == 103764\n assert candidate(digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9'],n = 123456789) == 54481005\n assert candidate(digits = ['5'],n = 1000000000) == 9\n assert candidate(digits = ['1', '9'],n = 1000000000) == 1022\n assert candidate(digits = ['1', '6', '8'],n = 5678) == 66\n assert candidate(digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9'],n = 123456789) == 54481005\n assert candidate(digits = ['1', '3', '5', '7', '9'],n = 99999) == 3905\n assert candidate(digits = ['2', '4', '6', '8'],n = 888888888) == 349524\n assert candidate(digits = ['1', '2', '3', '4', '5'],n = 100000) == 3905\n assert candidate(digits = ['1', '2', '4', '8'],n = 1024) == 84\n assert candidate(digits = ['1', '2', '3', '4'],n = 987654321) == 349524\n assert candidate(digits = ['1', '5', '7', '9'],n = 1579) == 112\n assert candidate(digits = ['2', '6', '8'],n = 2688) == 57\n assert candidate(digits = ['1', '3', '5', '7'],n = 777777777) == 349524\n assert candidate(digits = ['9'],n = 999999999) == 9\n assert candidate(digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9'],n = 111111111) == 48427561\n assert candidate(digits = ['1'],n = 1000000000) == 9\n assert candidate(digits = ['1', '3', '5', '7', '9'],n = 563827194) == 1503905\n assert candidate(digits = ['2', '6', '9'],n = 1000000) == 1092\n assert candidate(digits = ['1', '2', '3'],n = 1111) == 40\n assert candidate(digits = ['1', '6', '8'],n = 1000000000) == 29523\n assert candidate(digits = ['5', '7', '9'],n = 100000) == 363\n assert candidate(digits = ['4', '8'],n = 888) == 14\n assert candidate(digits = ['1', '2', '3'],n = 333) == 39\n assert candidate(digits = ['1', '2', '5'],n = 1111) == 40\n assert candidate(digits = ['1', '2'],n = 1024) == 14\n assert candidate(digits = ['5', '8'],n = 5885) == 21\n assert candidate(digits = ['6', '7', '8'],n = 99999) == 363\n assert candidate(digits = ['1', '2', '3', '4'],n = 9999) == 340\n assert candidate(digits = ['3', '5', '7', '9'],n = 1000000) == 5460\n assert candidate(digits = ['2', '3', '5', '7'],n = 777777777) == 349524\n assert candidate(digits = ['1', '2', '3', '4', '5'],n = 12345) == 975\n assert candidate(digits = ['1', '7', '9'],n = 979797) == 1001\n assert candidate(digits = ['1', '2', '3', '4', '5', '6'],n = 654321) == 54121\n assert candidate(digits = ['1', '3', '5', '7', '9'],n = 987654321) == 2363280\n assert candidate(digits = ['1', '2', '5'],n = 1000000000) == 29523\n assert candidate(digits = ['1', '4', '9'],n = 100000000) == 9840\n assert candidate(digits = ['1', '5', '9'],n = 1000000000) == 29523\n assert candidate(digits = ['3', '9'],n = 393939) == 84\n assert candidate(digits = ['1', '2'],n = 1024) == 14\n assert candidate(digits = ['1', '5', '9'],n = 999999999) == 29523\n assert candidate(digits = ['1', '3', '5', '7'],n = 777777777) == 349524\n assert candidate(digits = ['1', '3', '5', '7', '9'],n = 123456789) == 566405\n assert candidate(digits = ['1', '2', '3', '4', '5'],n = 50000) == 3280\n assert candidate(digits = ['1', '3', '5', '7', '9'],n = 20000) == 1405\n assert candidate(digits = ['1', '3', '7'],n = 77777777) == 9840\n assert candidate(digits = ['5', '7', '9'],n = 888888888) == 22962\n assert candidate(digits = ['1', '2', '4', '8'],n = 999999999) == 349524\n assert candidate(digits = ['3', '7', '8'],n = 378378378) == 13626\n assert candidate(digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9'],n = 999999999) == 435848049\n assert candidate(digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9'],n = 987654321) == 429794605\n assert candidate(digits = ['3', '7', '9'],n = 999999999) == 29523\n assert candidate(digits = ['1', '2', '3'],n = 321) == 34\n assert candidate(digits = ['3', '7', '8'],n = 1234) == 39\n assert candidate(digits = ['1', '5', '9'],n = 987654321) == 27336\n assert candidate(digits = ['1', '3', '5', '7', '9'],n = 999999999) == 2441405\n assert candidate(digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9'],n = 987654321) == 429794605\n assert candidate(digits = ['2', '3', '7', '8'],n = 8732) == 313\n assert candidate(digits = ['2', '4', '6', '8'],n = 100000000) == 87380\n assert candidate(digits = ['1'],n = 1000000) == 6\n assert candidate(digits = ['3', '5', '7'],n = 100000000) == 9840\n assert candidate(digits = ['2', '6', '7'],n = 10000) == 120\n assert candidate(digits = ['1', '3', '7', '9'],n = 50000) == 852\n assert candidate(digits = ['1', '2', '3', '4', '5'],n = 222222222) == 976562\n assert candidate(digits = ['1', '9'],n = 500000000) == 766\n assert candidate(digits = ['1', '3', '5'],n = 999999999) == 29523\n assert candidate(digits = ['1', '5', '7', '8'],n = 100000) == 1364\n assert candidate(digits = ['1', '9'],n = 1000000000) == 1022\n assert candidate(digits = ['5', '6', '7'],n = 777777777) == 29523\n assert candidate(digits = ['3', '5', '7'],n = 357357) == 504\n"}, "metadata": {"canonical_parameter_names": ["digits", "n"], "leetcode_dataset_entry_point": "Solution().atMostNGivenDigitSet", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var atMostNGivenDigitSet = function(digits, n) {", "container": null, "callable": "atMostNGivenDigitSet", "parameters": [{"name": "digits", "type": "string[]"}, {"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 903, "task_id": "valid-permutations-for-di-sequence", "difficulty": "Hard", "problem_description": "You are given a string s of length n where s[i] is either:\n\n'D' means decreasing, or\n'I' means increasing.\n\nA permutation perm of n + 1 integers of all the integers in the range [0, n] is called a valid permutation if for all valid i:\n\nIf s[i] == 'D', then perm[i] > perm[i + 1], and\nIf s[i] == 'I', then perm[i] < perm[i + 1].\n\nReturn the number of valid permutations perm. Since the answer may be large, return it modulo 109 + 7.\n \nExample 1:\n\nInput: s = \"DID\"\nOutput: 5\nExplanation: The 5 valid permutations of (0, 1, 2, 3) are:\n(1, 0, 3, 2)\n(2, 0, 3, 1)\n(2, 1, 3, 0)\n(3, 0, 2, 1)\n(3, 1, 2, 0)\n\nExample 2:\n\nInput: s = \"D\"\nOutput: 1\n\n \nConstraints:\n\nn == s.length\n1 <= n <= 200\ns[i] is either 'I' or 'D'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"DDDDDDDDDDDD\") == 1\n assert candidate(s = \"DII\") == 3\n assert candidate(s = \"IIDII\") == 19\n assert candidate(s = \"DIDDDDDD\") == 35\n assert candidate(s = \"IIIIIIIIIIII\") == 1\n assert candidate(s = \"DDI\") == 3\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDIDID\") == 398885199\n assert candidate(s = \"IID\") == 3\n assert candidate(s = \"DIDIDIDIDIDIDIDIDID\") == 185644928\n assert candidate(s = \"DDDDDDDDDDDDD\") == 1\n assert candidate(s = \"IIDID\") == 35\n assert candidate(s = \"DIDI\") == 16\n assert candidate(s = \"IIIIIIIIIII\") == 1\n assert candidate(s = \"IIIIIIIIII\") == 1\n assert candidate(s = \"DID\") == 5\n assert candidate(s = \"IDDD\") == 4\n assert candidate(s = \"DIDIDIDIDID\") == 2702765\n assert candidate(s = \"DDDDDDDD\") == 1\n assert candidate(s = \"DDIDI\") == 35\n assert candidate(s = \"DDDDII\") == 15\n assert candidate(s = \"DDDDDDDDDDD\") == 1\n assert candidate(s = \"IIIIII\") == 1\n assert candidate(s = \"D\") == 1\n assert candidate(s = \"IIII\") == 1\n assert candidate(s = \"ID\") == 2\n assert candidate(s = \"DDIDID\") == 155\n assert candidate(s = \"DDDDDDD\") == 1\n assert candidate(s = \"IDIDIDIDIDIDID\") == 903757305\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDID\") == 955348527\n assert candidate(s = \"DDDDDDDDD\") == 1\n assert candidate(s = \"IIIIID\") == 6\n assert candidate(s = \"DIDIDI\") == 272\n assert candidate(s = \"IDIDID\") == 272\n assert candidate(s = \"IIDIDD\") == 90\n assert candidate(s = \"IDII\") == 9\n assert candidate(s = \"IIDIDID\") == 791\n assert candidate(s = \"DIDIDIDID\") == 50521\n assert candidate(s = \"IDIDIDIDI\") == 50521\n assert candidate(s = \"DDID\") == 9\n assert candidate(s = \"IDIDIDIDID\") == 353792\n assert candidate(s = \"DDIDDD\") == 34\n assert candidate(s = \"DD\") == 1\n assert candidate(s = \"IIIIIIIII\") == 1\n assert candidate(s = \"DI\") == 2\n assert candidate(s = \"IIIIIIII\") == 1\n assert candidate(s = \"DIDIDIDI\") == 7936\n assert candidate(s = \"DDIIDD\") == 71\n assert candidate(s = \"II\") == 1\n assert candidate(s = \"DIDIDIDIDIDIDID\") == 391512012\n assert candidate(s = \"IDDDDD\") == 6\n assert candidate(s = \"III\") == 1\n assert candidate(s = \"IDID\") == 16\n assert candidate(s = \"DDDD\") == 1\n assert candidate(s = \"IDIDIDIDIDI\") == 2702765\n assert candidate(s = \"DIDIDIDIDIDID\") == 199360981\n assert candidate(s = \"IDIDIDIDIDIDI\") == 199360981\n assert candidate(s = \"DIII\") == 4\n assert candidate(s = \"IDIDIDIDIDIDIDIDID\") == 884909216\n assert candidate(s = \"DDDDID\") == 20\n assert candidate(s = \"IDIDIDID\") == 7936\n assert candidate(s = \"IIIIIII\") == 1\n assert candidate(s = \"IIIIIIIIIIIII\") == 1\n assert candidate(s = \"IDDDD\") == 5\n assert candidate(s = \"IDI\") == 5\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 372054302\n assert candidate(s = \"DDIIIDDDID\") == 23409\n assert candidate(s = \"DDDDDDDDIIIIIDIDIDID\") == 673511962\n assert candidate(s = \"DDDDDDDDDDID\") == 77\n assert candidate(s = \"IDDDDDDDDDDDDD\") == 14\n assert candidate(s = \"IIIDIDIDIDDD\") == 1222144\n assert candidate(s = \"IIDIIDIIDIID\") == 3052323\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\") == 1\n assert candidate(s = \"IIIDIIDIIDII\") == 1049476\n assert candidate(s = \"IIDDDDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDD\") == 393265742\n assert candidate(s = \"IIIDDDDDIIIDDDDDIIIDDDD\") == 184972317\n assert candidate(s = \"DDDDIIIIIIII\") == 495\n assert candidate(s = \"IIIIIIDDDDDDIIIIIIDDDDDDIIIIIIDDDDDDIIIIIID\") == 462903546\n assert candidate(s = \"DIIIDIIIDIIIDIIIDIIID\") == 186469344\n assert candidate(s = \"DDDDDDDDID\") == 54\n assert candidate(s = \"DDDDDDDDDIIIIIIIIIIDDDDDDDDDIIIIIIII\") == 441488323\n assert candidate(s = \"IDDDDDDDIDDDDDDDIDDDDDDDIDDDDDDDIDDDDDDDIDDDDDDDIDDDDDDDIDDDDDDDIDDDDDD\") == 89320108\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 1\n assert candidate(s = \"DDDDDDDDDDIIIIIIIIII\") == 184756\n assert candidate(s = \"DDDDDDDDDID\") == 65\n assert candidate(s = \"DDDDDIDDDDDD\") == 1715\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDIDID\") == 814891\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 68280442\n assert candidate(s = \"IIDDDDDDIIIDDDDDIIIDDDDDIIIDDDDDD\") == 320107597\n assert candidate(s = \"IDIDIDIDIDID\") == 22368256\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 179476197\n assert candidate(s = \"IDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDD\") == 211646917\n assert candidate(s = \"IIIIIIIIIIIDDDDDDD\") == 31824\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDI\") == 312030296\n assert candidate(s = \"IIIIIIIDDDDD\") == 792\n assert candidate(s = \"DDDDIDIDIDIDIDIDID\") == 546532656\n assert candidate(s = \"DDDDIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 916895\n assert candidate(s = \"IIIIIIIIIDDDDDDDDIIIIIIIIIDDDDDDDD\") == 7124320\n assert candidate(s = \"IIIIIDDDDDDDDDIIIIIDDDDDDDDDIIIIIDDDDDDDDDIIII\") == 161680825\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 1\n assert candidate(s = \"DIDIDIDIDDDD\") == 1681317\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\") == 1\n assert candidate(s = \"IDDDDDDDDDDDD\") == 13\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIDDDDDDDDDDDDDDDDDDD\") == 978143726\n assert candidate(s = \"DDDDDDIIIIII\") == 924\n assert candidate(s = \"IIIIIIIIIDDDDDDDDD\") == 48620\n assert candidate(s = \"IDIDIDIDDDDDIIIIIIII\") == 673511962\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\") == 1\n assert candidate(s = \"DDDDIIIIIIIIIIIDDDDD\") == 19483036\n assert candidate(s = \"IIIDDDIIIDDDIIIDDD\") == 676402828\n assert candidate(s = \"IIDDDDDIDDDDDIDDDDDIDDDDDIDDDDDIDDD\") == 802666207\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 1\n assert candidate(s = \"IIIIIDIIIIIDIIIIIDIIIIID\") == 397477620\n assert candidate(s = \"DIDIDIDIDIDIDI\") == 903757305\n assert candidate(s = \"DDIDIDIDIDIDIDID\") == 790362656\n assert candidate(s = \"DDDDDDDIIIIIIII\") == 6435\n assert candidate(s = \"DIDDDDDDDDDDDDDIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 327757655\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 559265847\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIDDDDDDDDDDDD\") == 251400487\n assert candidate(s = \"IIIDIDIDIDIDDD\") == 103980032\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 486231764\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\") == 1\n assert candidate(s = \"IIIIIIIDDDDDDDIIIIIIIDDDDDDDIIIIIIIDDDDDDD\") == 586971725\n assert candidate(s = \"IIDDIIDDIIDD\") == 2020656\n assert candidate(s = \"DDDDDDDDDDDDDDD\") == 1\n assert candidate(s = \"IIIIIIIDDDDDDDD\") == 6435\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 1\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\") == 1\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 1\n assert candidate(s = \"IDDDIDDDIDDD\") == 349504\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDIIIIIIIIIIIIIIIIIIIIIDDDDDDDDDDDIIIIIIIIIIIIIIIIII\") == 604465316\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 514024747\n assert candidate(s = \"DDDDDDDDDDDDDIIIIIIIIIIIIIIIIIIIIII\") == 476337793\n assert candidate(s = \"DDDDDDDDDDIDID\") == 6721\n assert candidate(s = \"DIDDDIDDDDDD\") == 23947\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIII\") == 1\n assert candidate(s = \"IIIIIIIDDDDDDDIIIIIIIDDDDDDDIIIIIIIDDDDDDDIIIIIIIDDDDDDDIIIIIIIDDDDDDD\") == 9946124\n assert candidate(s = \"IDDDIIIDDD\") == 11210\n assert candidate(s = \"IIIIIDDDDDIIIIIIIIIIIIIDDDDDDDDDDDIIIIIIIIIIIIIIIDDDDDDDDDDDIIIIII\") == 844233887\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDD\") == 1\n assert candidate(s = \"DIDIDIIDIDID\") == 14253227\n assert candidate(s = \"DDDDDDDDDDIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 469639504\n assert candidate(s = \"IDDDDDDDDDDDDDDDIIIIIIIIIIIIIIIIIII\") == 754901336\n assert candidate(s = \"IDIDIDIIIIIDIDIDIDID\") == 541113001\n assert candidate(s = \"DDDDDDDDDD\") == 1\n assert candidate(s = \"DIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIID\") == 1805\n assert candidate(s = \"DIIIIIIIIIIIIIIIIIIIIIDIIIIIIIIIIIIIIIIIIIIID\") == 444261561\n assert candidate(s = \"DDDDDDDDDIII\") == 220\n assert candidate(s = \"IIDDDIDIDDDI\") == 1231021\n assert candidate(s = \"IIIIIIIIIDDD\") == 220\n assert candidate(s = \"DDIDIDDDII\") == 38160\n assert candidate(s = \"IIDIDIDIDIDIDI\") == 86657396\n assert candidate(s = \"DDDDDDIDDD\") == 329\n assert candidate(s = \"IIIIIIIIID\") == 10\n assert candidate(s = \"IIDDDIIDDDIIDDDIIDDDIIDDDIIDDDIIDDDIIDDD\") == 115670161\n assert candidate(s = \"DIIIDDDDDDDD\") == 1650\n assert candidate(s = \"DDDDDDDDDDIIIIIIII\") == 43758\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDDD\") == 787128653\n assert candidate(s = \"DDDDDDDDDDDDDIIIIIIIIIIIIIIIIIIIIIDDDDDDDDDDDDDIIIIIIIIIIIIIIIIIIII\") == 116643020\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 803806388\n assert candidate(s = \"IIIIIIIIIIIDIIIIIDDD\") == 16458940\n assert candidate(s = \"DDDDDDDIIIIIIIIIDDDDDDIIIIIIIIIDDD\") == 637084962\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIII\") == 1\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 89434740\n assert candidate(s = \"IDDDDDDDID\") == 430\n assert candidate(s = \"DDDDDDDDIIIIIIIIII\") == 43758\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 752033767\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDID\") == 907695790\n assert candidate(s = \"IDDDIDDDIDDDIDDDIDDD\") == 447283659\n assert candidate(s = \"IDDDDDIDID\") == 9470\n assert candidate(s = \"IIIIIIIIIIIIIIIIIDDDDDDDDDDDDDDDDDD\") == 537567622\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 569787174\n assert candidate(s = \"DDIDIDIDIDDD\") == 2983553\n assert candidate(s = \"IIIIIDIIIIIDIIIIIDIIIIIDIIIIIDIIIIIDIIIIIDIIIIIDIIIIID\") == 671217372\n assert candidate(s = \"DDIDIDIDID\") == 201939\n assert candidate(s = \"DDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 827971518\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIID\") == 22\n assert candidate(s = \"DDIDIDIDIDIDDD\") == 253949942\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDDDDD\") == 1\n assert candidate(s = \"IDDDDDDDIIII\") == 3795\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDDID\") == 252\n assert candidate(s = \"IIIIIDIIID\") == 1838\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDID\") == 616527580\n assert candidate(s = \"IIIDDDDDDD\") == 120\n assert candidate(s = \"DDDDIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 135751\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 634392057\n assert candidate(s = \"DDIIDDDIIDDDIIDDDIIDDDIIDDDIIDDDIIDDDIID\") == 282462203\n assert candidate(s = \"IDDDDDDDDDDD\") == 12\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 595888523\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\") == 1\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 399447831\n assert candidate(s = \"DDDDIDIDIDIDIDIDIDID\") == 65867250\n assert candidate(s = \"IIIIIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 210834483\n assert candidate(s = \"IIIIIDIDIDIDIIIIIIII\") == 509306786\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 233702287\n assert candidate(s = \"DDIDIDIDIDID\") == 12767689\n assert candidate(s = \"IIDDDIDDDIII\") == 335765\n assert candidate(s = \"DDDDDDIDDDDDIDDDDDIDDDDD\") == 865768945\n assert candidate(s = \"DIDIDIIDID\") == 226291\n assert candidate(s = \"IIIIIIIIIIIIIII\") == 1\n assert candidate(s = \"DDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIII\") == 340633227\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 277061441\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 105648435\n assert candidate(s = \"DDDDDDIIIIIIIID\") == 43043\n assert candidate(s = \"IDIDDDDDDD\") == 320\n assert candidate(s = \"IIIDIDIDIDIDIDID\") == 45651113\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDDDDDDIIIII\") == 945382435\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 1\n assert candidate(s = \"DDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDD\") == 373242177\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\") == 1\n assert candidate(s = \"IIIIIDDDDDIIIIIDDDDD\") == 190033974\n assert candidate(s = \"DDDDDIIIIIIIDDDDDIIIIIIIDDDDDIIIIIIIDDDDDII\") == 8516027\n assert candidate(s = \"IDIDIDDDDDIIIIIII\") == 103159144\n assert candidate(s = \"DDDIDDDIDDDIDDDIDDDIDDDIDDDIDDDIDDD\") == 456017217\n assert candidate(s = \"IIIIIIIIIDDDDDDDDDDD\") == 167960\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 1\n assert candidate(s = \"DDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIII\") == 553551576\n assert candidate(s = \"IDIDIDIDIDIDIDIDDDDD\") == 256448604\n assert candidate(s = \"IIIIIDDDDDDDDDDDDIIIIIIIIIIIDDDDDDDDDDDDIIIIIIIIIIIDDDDDDDDDDDDIIII\") == 249031970\n assert candidate(s = \"IIIIIIIIIDDDDDDDDIIIIIIIIIDDDDDDDDIIIIIIIIIDDDDDDDD\") == 295177009\n assert candidate(s = \"IIIIIIIIIIIDID\") == 896\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 1\n assert candidate(s = \"IIIDDDDDIIIIIII\") == 286077\n assert candidate(s = \"DIIIDDDDDIIID\") == 882155\n assert candidate(s = \"IDDDDDDDDDDIDDDDDDDDIDDDDDDDDIDDDDDDDDIDDDD\") == 383124231\n assert candidate(s = \"DDDDDDIDDDDDIDDDDDIDDDDDIDDDDDIDDDDDIDDDDDIDDDDD\") == 816732003\n assert candidate(s = \"IIDDDDDIDDDDDIII\") == 28546231\n assert candidate(s = \"IIIDDDDDDDDD\") == 220\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 717149364\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDDD\") == 1\n assert candidate(s = \"IDDDDDDDDDID\") == 768\n assert candidate(s = \"DDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDD\") == 840858142\n assert candidate(s = \"IDDDDDDDIIIDDDDDIIIDDDDDIIIDDDDDDID\") == 643652602\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII\") == 1\n assert candidate(s = \"IDDDDDDDDD\") == 10\n assert candidate(s = \"IIIIIIIIIIID\") == 12\n assert candidate(s = \"DDDDDDDDIIIIIIIIIIIIII\") == 319770\n assert candidate(s = \"IIDDDDDDDD\") == 45\n assert candidate(s = \"IIDIDIDIDIDI\") == 12767689\n assert candidate(s = \"IIDDDDIDIDDDD\") == 973622\n assert candidate(s = \"IIIIIDDDDDIIIIIIIIIDDDDDDDIIIIIIIIIIIDDDDD\") == 439575343\n assert candidate(s = \"IIIIIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIII\") == 396282384\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 434494262\n assert candidate(s = \"DDDDIIIIIDDDIIIIIDDD\") == 322218808\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\") == 1\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDIIIIIIIIIIIIIIIIIIIIDDDDDDDDD\") == 1623769\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDIDID\") == 437003601\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDIDID\") == 200684441\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().numPermsDISequence", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numPermsDISequence = function(s) {", "container": null, "callable": "numPermsDISequence", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 904, "task_id": "fruit-into-baskets", "difficulty": "Medium", "problem_description": "You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array fruits where fruits[i] is the type of fruit the ith tree produces.\nYou want to collect as much fruit as possible. However, the owner has some strict rules that you must follow:\n\nYou only have two baskets, and each basket can only hold a single type of fruit. There is no limit on the amount of fruit each basket can hold.\nStarting from any tree of your choice, you must pick exactly one fruit from every tree (including the start tree) while moving to the right. The picked fruits must fit in one of your baskets.\nOnce you reach a tree with fruit that cannot fit in your baskets, you must stop.\n\nGiven the integer array fruits, return the maximum number of fruits you can pick.\n \nExample 1:\n\nInput: fruits = [1,2,1]\nOutput: 3\nExplanation: We can pick from all 3 trees.\n\nExample 2:\n\nInput: fruits = [0,1,2,2]\nOutput: 3\nExplanation: We can pick from trees [1,2,2].\nIf we had started at the first tree, we would only pick from trees [0,1].\n\nExample 3:\n\nInput: fruits = [1,2,3,2,2]\nOutput: 4\nExplanation: We can pick from trees [2,3,2,2].\nIf we had started at the first tree, we would only pick from trees [1,2].\n\n \nConstraints:\n\n1 <= fruits.length <= 105\n0 <= fruits[i] < fruits.length\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(fruits = [0]) == 1\n assert candidate(fruits = [1, 2, 3, 2, 2]) == 4\n assert candidate(fruits = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 2\n assert candidate(fruits = [1, 0, 1, 4, 1, 4, 1, 2, 3]) == 5\n assert candidate(fruits = [0, 0, 1, 1]) == 4\n assert candidate(fruits = [1]) == 1\n assert candidate(fruits = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 7\n assert candidate(fruits = [1, 2, 3, 4, 5]) == 2\n assert candidate(fruits = [1, 2, 1]) == 3\n assert candidate(fruits = [0, 0, 0, 0, 0]) == 5\n assert candidate(fruits = [1, 2, 1, 2, 1, 2, 1, 2, 1]) == 9\n assert candidate(fruits = [5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7]) == 10\n assert candidate(fruits = [3, 3, 3, 1, 2, 1, 1, 2, 3, 3, 4]) == 5\n assert candidate(fruits = [0, 1, 2, 2]) == 3\n assert candidate(fruits = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1]) == 3\n assert candidate(fruits = [1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 1, 1, 2, 2, 2]) == 6\n assert candidate(fruits = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 22\n assert candidate(fruits = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 2]) == 21\n assert candidate(fruits = [1, 1, 1, 2, 2, 2, 3, 3, 3]) == 6\n assert candidate(fruits = [1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1]) == 20\n assert candidate(fruits = [1, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3]) == 3\n assert candidate(fruits = [5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2]) == 3\n assert candidate(fruits = [1, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1]) == 3\n assert candidate(fruits = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(fruits = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(fruits = [1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 30\n assert candidate(fruits = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 20\n assert candidate(fruits = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3]) == 2\n assert candidate(fruits = [1, 2, 3, 4, 2, 1, 2, 3, 4]) == 3\n assert candidate(fruits = [10, 20, 10, 20, 30, 40, 50, 10, 20, 30, 10, 20, 10, 20, 10]) == 5\n assert candidate(fruits = [1, 2, 3, 4, 5, 5, 5, 4, 4, 4, 3, 3, 2, 2, 1]) == 7\n assert candidate(fruits = [1, 2, 2, 1, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1]) == 10\n assert candidate(fruits = [1, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2]) == 3\n assert candidate(fruits = [5, 5, 5, 6, 6, 5, 6, 5, 5, 5, 7, 7, 7, 5, 5]) == 10\n assert candidate(fruits = [1, 2, 3, 3, 2, 1, 1, 2, 2, 1, 3, 3, 3, 2, 1, 1, 2, 2, 3, 3]) == 6\n assert candidate(fruits = [1, 2, 3, 1, 2, 3, 1, 2, 3]) == 2\n assert candidate(fruits = [1, 2, 3, 4, 5, 3, 4, 5, 6, 7, 8, 9, 5, 6, 7]) == 2\n assert candidate(fruits = [3, 3, 3, 1, 2, 1, 1, 2, 3, 3, 3]) == 5\n assert candidate(fruits = [1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3]) == 7\n assert candidate(fruits = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 1, 2, 2, 3, 3]) == 5\n assert candidate(fruits = [1, 2, 3, 4, 5, 4, 3, 2, 1]) == 3\n assert candidate(fruits = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 4\n assert candidate(fruits = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(fruits = [1, 2, 2, 1, 2, 1, 2, 2, 1, 1, 2, 2]) == 12\n assert candidate(fruits = [1, 2, 1, 2, 1, 2, 3, 4, 5, 3, 4, 5, 6, 7, 8, 9, 5, 6, 7]) == 6\n assert candidate(fruits = [1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2]) == 20\n assert candidate(fruits = [3, 3, 3, 1, 2, 2, 1, 1, 1, 2, 3, 3, 3]) == 7\n assert candidate(fruits = [1, 2, 1, 2, 1, 3, 3, 3, 2, 2, 2, 1, 1, 1, 2, 2, 2]) == 9\n assert candidate(fruits = [1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 29\n assert candidate(fruits = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 10\n assert candidate(fruits = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 4\n assert candidate(fruits = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(fruits = [1, 2, 3, 3, 3, 2, 1, 1, 1, 2, 3, 3, 3, 1, 2, 1]) == 5\n assert candidate(fruits = [1, 2, 1, 1, 2, 1, 2, 2, 2, 2, 1, 1, 1, 2]) == 14\n assert candidate(fruits = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 18\n assert candidate(fruits = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 15\n assert candidate(fruits = [0, 1, 1, 0, 1, 2, 2, 1, 0, 0]) == 5\n assert candidate(fruits = [1, 1, 1, 2, 2, 3, 3, 3, 3, 2, 2, 1, 1]) == 8\n assert candidate(fruits = [1, 1, 2, 2, 3, 3, 2, 2, 1, 1]) == 6\n assert candidate(fruits = [5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6]) == 15\n assert candidate(fruits = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1]) == 16\n assert candidate(fruits = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 46\n assert candidate(fruits = [1, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1]) == 3\n assert candidate(fruits = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]) == 2\n assert candidate(fruits = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 20\n assert candidate(fruits = [1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2]) == 30\n assert candidate(fruits = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]) == 2\n assert candidate(fruits = [1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2]) == 18\n assert candidate(fruits = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 16\n assert candidate(fruits = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4]) == 8\n assert candidate(fruits = [1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2]) == 12\n assert candidate(fruits = [1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 62\n assert candidate(fruits = [1, 2, 1, 2, 1, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 1, 1]) == 10\n assert candidate(fruits = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(fruits = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 12\n assert candidate(fruits = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 2\n assert candidate(fruits = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 4\n assert candidate(fruits = [1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2]) == 24\n assert candidate(fruits = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(fruits = [5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5]) == 3\n assert candidate(fruits = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 4\n assert candidate(fruits = [1, 2, 2, 3, 3, 3, 2, 2, 2, 1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 1, 1]) == 9\n assert candidate(fruits = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 10\n assert candidate(fruits = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 31\n assert candidate(fruits = [1, 2, 2, 3, 3, 3, 2, 1, 1, 1, 1, 1]) == 6\n assert candidate(fruits = [1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3]) == 4\n assert candidate(fruits = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 26\n assert candidate(fruits = [3, 3, 3, 1, 2, 2, 1, 1, 1, 2, 2, 2]) == 9\n assert candidate(fruits = [0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1]) == 6\n assert candidate(fruits = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]) == 2\n assert candidate(fruits = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1]) == 3\n assert candidate(fruits = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(fruits = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0]) == 71\n assert candidate(fruits = [1, 1, 2, 2, 3, 3, 2, 2, 1, 1, 2, 2, 3, 3]) == 6\n assert candidate(fruits = [1, 2, 1, 3, 2, 1, 2, 1, 2]) == 5\n assert candidate(fruits = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]) == 2\n assert candidate(fruits = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1]) == 12\n assert candidate(fruits = [1, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3]) == 4\n"}, "metadata": {"canonical_parameter_names": ["fruits"], "leetcode_dataset_entry_point": "Solution().totalFruit", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var totalFruit = function(fruits) {", "container": null, "callable": "totalFruit", "parameters": [{"name": "fruits", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 905, "task_id": "sort-array-by-parity", "difficulty": "Easy", "problem_description": "Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers.\nReturn any array that satisfies this condition.\n \nExample 1:\n\nInput: nums = [3,1,2,4]\nOutput: [2,4,3,1]\nExplanation: The outputs [4,2,3,1], [2,4,1,3], and [4,2,1,3] would also be accepted.\n\nExample 2:\n\nInput: nums = [0]\nOutput: [0]\n\n \nConstraints:\n\n1 <= nums.length <= 5000\n0 <= nums[i] <= 5000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]) == [0, 8, 6, 4, 2, 9, 7, 5, 3, 1]\n assert candidate(nums = [5, 3, 2, 8, 6, 7, 1, 4]) == [4, 6, 2, 8, 3, 7, 1, 5]\n assert candidate(nums = [2, 1]) == [2, 1]\n assert candidate(nums = [2, 4, 6, 8, 10]) == [2, 4, 6, 8, 10]\n assert candidate(nums = [1, 3, 5, 7, 9]) == [1, 3, 5, 7, 9]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [10, 2, 8, 4, 6, 5, 7, 3, 9, 1]\n assert candidate(nums = [1]) == [1]\n assert candidate(nums = [6, 4, 2, 1, 3, 5]) == [6, 4, 2, 1, 3, 5]\n assert candidate(nums = [2, 4, 6, 8, 10, 1, 3, 5, 7, 9]) == [2, 4, 6, 8, 10, 1, 3, 5, 7, 9]\n assert candidate(nums = [2]) == [2]\n assert candidate(nums = [5000, 2500, 4000, 1000, 3000, 1500]) == [5000, 2500, 4000, 1000, 3000, 1500]\n assert candidate(nums = [1, 3, 5, 7, 2, 4, 6, 8]) == [8, 6, 4, 2, 7, 5, 3, 1]\n assert candidate(nums = [0]) == [0]\n assert candidate(nums = [11, 22, 33, 44, 55, 66, 77, 88, 99, 100]) == [100, 22, 88, 44, 66, 55, 77, 33, 99, 11]\n assert candidate(nums = [5, 4, 3, 2, 1]) == [2, 4, 3, 5, 1]\n assert candidate(nums = [1, 2]) == [2, 1]\n assert candidate(nums = [3, 1, 2, 4]) == [4, 2, 1, 3]\n assert candidate(nums = [2, 4, 6, 8, 1, 3, 5, 7]) == [2, 4, 6, 8, 1, 3, 5, 7]\n assert candidate(nums = [1, 3, 5, 2, 4, 6]) == [6, 4, 2, 5, 3, 1]\n assert candidate(nums = [4, 2, 3, 1, 5, 7]) == [4, 2, 3, 1, 5, 7]\n assert candidate(nums = [2, 4, 6, 8, 0, 1, 3, 5, 7, 9]) == [2, 4, 6, 8, 0, 1, 3, 5, 7, 9]\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]\n assert candidate(nums = [101, 52, 33, 44, 77, 88, 99, 22, 11, 66]) == [66, 52, 22, 44, 88, 77, 99, 33, 11, 101]\n assert candidate(nums = [42, 7, 3, 19, 8, 5, 12, 17, 22, 1]) == [42, 22, 12, 8, 19, 5, 3, 17, 7, 1]\n assert candidate(nums = [1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019]) == [1000, 1018, 1002, 1016, 1004, 1014, 1006, 1012, 1008, 1010, 1009, 1011, 1007, 1013, 1005, 1015, 1003, 1017, 1001, 1019]\n assert candidate(nums = [1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520]) == [1500, 1520, 1502, 1518, 1504, 1516, 1506, 1514, 1508, 1512, 1510, 1511, 1509, 1513, 1507, 1515, 1505, 1517, 1503, 1519, 1501]\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums = [5000, 2500, 1250, 625, 312, 156, 78, 39, 19, 9, 4, 2, 1, 0]) == [5000, 2500, 1250, 0, 312, 156, 78, 2, 4, 9, 19, 39, 1, 625]\n assert candidate(nums = [314, 159, 265, 358, 979, 323, 846, 264, 338, 327, 950, 288, 419, 716, 939, 937, 510, 582, 0, 1]) == [314, 0, 582, 358, 510, 716, 846, 264, 338, 288, 950, 327, 419, 323, 939, 937, 979, 265, 159, 1]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == [100, 2, 98, 4, 96, 6, 94, 8, 92, 10, 90, 12, 88, 14, 86, 16, 84, 18, 82, 20, 80, 22, 78, 24, 76, 26, 74, 28, 72, 30, 70, 32, 68, 34, 66, 36, 64, 38, 62, 40, 60, 42, 58, 44, 56, 46, 54, 48, 52, 50, 51, 49, 53, 47, 55, 45, 57, 43, 59, 41, 61, 39, 63, 37, 65, 35, 67, 33, 69, 31, 71, 29, 73, 27, 75, 25, 77, 23, 79, 21, 81, 19, 83, 17, 85, 15, 87, 13, 89, 11, 91, 9, 93, 7, 95, 5, 97, 3, 99, 1]\n assert candidate(nums = [11, 14, 21, 39, 40, 50, 61, 72, 83, 94]) == [94, 14, 72, 50, 40, 39, 61, 21, 83, 11]\n assert candidate(nums = [5, 3, 8, 6, 2, 7, 4, 1, 9, 10, 0, 12, 14, 16, 18, 20]) == [20, 18, 8, 6, 2, 16, 4, 14, 12, 10, 0, 9, 1, 7, 3, 5]\n assert candidate(nums = [5, 3, 1, 4, 2, 6, 8, 0, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == [0, 8, 6, 4, 2, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]\n assert candidate(nums = [5000, 2500, 1250, 625, 312, 156, 78, 39, 19, 9, 4, 2, 1]) == [5000, 2500, 1250, 2, 312, 156, 78, 4, 19, 9, 39, 625, 1]\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]\n assert candidate(nums = [1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 3, 5, 7, 9, 11, 13, 15]) == [1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 3, 5, 7, 9, 11, 13, 15]\n assert candidate(nums = [42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41]) == [42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums = [4444, 2222, 1111, 3333, 5555, 6666, 7777, 8888, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 500, 100, 200]) == [4444, 2222, 200, 100, 500, 6666, 9000, 8888, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 7777, 5555, 3333, 1111]\n assert candidate(nums = [44, 55, 66, 77, 88, 99, 100, 111, 122, 133, 144, 155, 166, 177, 188, 199, 200, 211, 222, 233, 244, 255]) == [44, 244, 66, 222, 88, 200, 100, 188, 122, 166, 144, 155, 133, 177, 111, 199, 99, 211, 77, 233, 55, 255]\n assert candidate(nums = [42, 84, 126, 168, 210, 252, 294, 336, 378, 420, 1, 3, 5, 7, 9]) == [42, 84, 126, 168, 210, 252, 294, 336, 378, 420, 1, 3, 5, 7, 9]\n assert candidate(nums = [1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519]) == [1500, 1518, 1502, 1516, 1504, 1514, 1506, 1512, 1508, 1510, 1509, 1511, 1507, 1513, 1505, 1515, 1503, 1517, 1501, 1519]\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 9980, 9979, 9978, 9977, 9976, 9975, 9974, 9973, 9972, 9971, 9970, 9969, 9968, 9967, 9966, 9965, 9964, 9963, 9962, 9961, 9960, 9959, 9958, 9957, 9956, 9955, 9954, 9953, 9952, 9951, 9950, 9949, 9948, 9947, 9946, 9945, 9944, 9943, 9942, 9941, 9940, 9939, 9938, 9937, 9936, 9935, 9934, 9933, 9932, 9931, 9930, 9929, 9928, 9927, 9926, 9925, 9924, 9923, 9922, 9921, 9920, 9919, 9918, 9917, 9916, 9915, 9914, 9913, 9912, 9911, 9910, 9909, 9908, 9907, 9906, 9905, 9904, 9903, 9902, 9901, 9900]) == [9900, 9998, 9902, 9996, 9904, 9994, 9906, 9992, 9908, 9990, 9910, 9988, 9912, 9986, 9914, 9984, 9916, 9982, 9918, 9980, 9920, 9978, 9922, 9976, 9924, 9974, 9926, 9972, 9928, 9970, 9930, 9968, 9932, 9966, 9934, 9964, 9936, 9962, 9938, 9960, 9940, 9958, 9942, 9956, 9944, 9954, 9946, 9952, 9948, 9950, 9949, 9951, 9947, 9953, 9945, 9955, 9943, 9957, 9941, 9959, 9939, 9961, 9937, 9963, 9935, 9965, 9933, 9967, 9931, 9969, 9929, 9971, 9927, 9973, 9925, 9975, 9923, 9977, 9921, 9979, 9919, 9981, 9917, 9983, 9915, 9985, 9913, 9987, 9911, 9989, 9909, 9991, 9907, 9993, 9905, 9995, 9903, 9997, 9901, 9999]\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 2, 4, 6, 8]) == [8, 6, 4, 2, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 7, 5, 3, 1]\n assert candidate(nums = [3000, 2999, 2998, 2997, 2996, 2995, 2994, 2993, 2992, 2991, 2990]) == [3000, 2990, 2998, 2992, 2996, 2994, 2995, 2993, 2997, 2991, 2999]\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 1]) == [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 1]\n assert candidate(nums = [5000, 4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991, 4990, 4989, 4988, 4987, 4986, 4985, 4984, 4983, 4982, 4981, 4980, 4979, 4978, 4977, 4976, 4975, 4974, 4973, 4972, 4971, 4970, 4969, 4968, 4967, 4966, 4965, 4964, 4963, 4962, 4961, 4960, 1, 3, 5, 7, 9]) == [5000, 4960, 4998, 4962, 4996, 4964, 4994, 4966, 4992, 4968, 4990, 4970, 4988, 4972, 4986, 4974, 4984, 4976, 4982, 4978, 4980, 4979, 4981, 4977, 4983, 4975, 4985, 4973, 4987, 4971, 4989, 4969, 4991, 4967, 4993, 4965, 4995, 4963, 4997, 4961, 4999, 1, 3, 5, 7, 9]\n assert candidate(nums = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == [20, 18, 16, 14, 12, 2, 4, 6, 8, 10, 9, 7, 5, 3, 1]\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 20, 22, 24, 26, 28, 30]) == [30, 28, 26, 24, 22, 20, 13, 15, 17, 19, 11, 9, 7, 5, 3, 1]\n assert candidate(nums = [5000, 4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991, 4990, 4989, 4988, 4987, 4986, 4985]) == [5000, 4986, 4998, 4988, 4996, 4990, 4994, 4992, 4993, 4991, 4995, 4989, 4997, 4987, 4999, 4985]\n assert candidate(nums = [5000, 2456, 1234, 7890, 1111, 2222, 3333, 4444, 5555, 6666]) == [5000, 2456, 1234, 7890, 6666, 2222, 4444, 3333, 5555, 1111]\n assert candidate(nums = [2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515]) == [2500, 2514, 2502, 2512, 2504, 2510, 2506, 2508, 2507, 2509, 2505, 2511, 2503, 2513, 2501, 2515]\n assert candidate(nums = [1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009]) == [1000, 1008, 1002, 1006, 1004, 1005, 1003, 1007, 1001, 1009]\n assert candidate(nums = [1499, 1497, 1495, 1493, 1491, 1489, 1487, 1485, 1483, 1481, 1479, 1477, 1475, 1473, 1471, 1469, 1467, 1465, 1463, 1461, 1459, 1457, 1455, 1453, 1451, 1449, 1447, 1445, 1443, 1441, 1439, 1437, 1435, 1433, 1431, 1429, 1427, 1425, 1423, 1421, 1419, 1417, 1415, 1413, 1411, 1409, 1407, 1405, 1403, 1401, 1400, 1398, 1396, 1394, 1392, 1390, 1388, 1386, 1384, 1382, 1380, 1378, 1376, 1374, 1372, 1370, 1368, 1366, 1364, 1362, 1360, 1358, 1356, 1354, 1352, 1350, 1348, 1346, 1344, 1342, 1340, 1338, 1336, 1334, 1332, 1330, 1328, 1326, 1324, 1322, 1320]) == [1320, 1322, 1324, 1326, 1328, 1330, 1332, 1334, 1336, 1338, 1340, 1342, 1344, 1346, 1348, 1350, 1352, 1354, 1356, 1358, 1360, 1362, 1364, 1366, 1368, 1370, 1372, 1374, 1376, 1378, 1380, 1382, 1384, 1386, 1388, 1390, 1392, 1394, 1396, 1398, 1400, 1417, 1415, 1413, 1411, 1409, 1407, 1405, 1403, 1401, 1419, 1421, 1423, 1425, 1427, 1429, 1431, 1433, 1435, 1437, 1439, 1441, 1443, 1445, 1447, 1449, 1451, 1453, 1455, 1457, 1459, 1461, 1463, 1465, 1467, 1469, 1471, 1473, 1475, 1477, 1479, 1481, 1483, 1485, 1487, 1489, 1491, 1493, 1495, 1497, 1499]\n assert candidate(nums = [11, 22, 33, 44, 55, 66, 77, 88, 99, 100]) == [100, 22, 88, 44, 66, 55, 77, 33, 99, 11]\n assert candidate(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115]) == [100, 114, 102, 112, 104, 110, 106, 108, 107, 109, 105, 111, 103, 113, 101, 115]\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == [14, 14, 2, 2, 12, 12, 4, 4, 10, 10, 6, 6, 8, 8, 7, 7, 9, 9, 5, 5, 11, 11, 3, 3, 13, 13, 1, 1, 15, 15]\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 2, 4, 6, 8, 10]) == [10, 8, 6, 4, 2, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 9, 7, 5, 3, 1]\n assert candidate(nums = [42, 42, 42, 42, 42, 11, 11, 11, 11, 11]) == [42, 42, 42, 42, 42, 11, 11, 11, 11, 11]\n assert candidate(nums = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]) == [10, 8, 6, 4, 2, 9, 7, 5, 3, 1]\n assert candidate(nums = [500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481]) == [500, 482, 498, 484, 496, 486, 494, 488, 492, 490, 491, 489, 493, 487, 495, 485, 497, 483, 499, 481]\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [0, 8, 2, 6, 4, 5, 3, 7, 1, 9]\n assert candidate(nums = [5000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [5000, 10, 2, 8, 4, 6, 5, 7, 3, 9, 1]\n assert candidate(nums = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 3, 3, 7]) == [4, 8, 4, 8, 2, 0, 2, 6, 2, 8, 4, 6, 2, 6, 4, 2, 8, 3, 3, 9, 7, 9, 5, 3, 3, 3, 3, 5, 7, 9, 5, 9, 5, 1, 1, 3, 1, 9, 7, 1, 3, 3, 7]\n assert candidate(nums = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980]) == [980, 998, 982, 996, 984, 994, 986, 992, 988, 990, 989, 991, 987, 993, 985, 995, 983, 997, 981, 999]\n assert candidate(nums = [4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991, 4990]) == [4990, 4998, 4992, 4996, 4994, 4995, 4993, 4997, 4991, 4999]\n assert candidate(nums = [2500, 2400, 2300, 2200, 2100, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == [2500, 2400, 2300, 2200, 2100, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == [30, 2, 28, 4, 26, 6, 24, 8, 22, 10, 20, 12, 18, 14, 16, 15, 17, 13, 19, 11, 21, 9, 23, 7, 25, 5, 27, 3, 29, 1]\n assert candidate(nums = [14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15]) == [14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15]\n assert candidate(nums = [1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040]) == [1000, 1040, 1002, 1038, 1004, 1036, 1006, 1034, 1008, 1032, 1010, 1030, 1012, 1028, 1014, 1026, 1016, 1024, 1018, 1022, 1020, 1021, 1019, 1023, 1017, 1025, 1015, 1027, 1013, 1029, 1011, 1031, 1009, 1033, 1007, 1035, 1005, 1037, 1003, 1039, 1001]\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums = [29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [2, 28, 4, 26, 6, 24, 8, 22, 10, 20, 12, 18, 14, 16, 15, 17, 13, 19, 11, 21, 9, 23, 7, 25, 5, 27, 3, 29, 1]\n assert candidate(nums = [2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520]) == [2500, 2520, 2502, 2518, 2504, 2516, 2506, 2514, 2508, 2512, 2510, 2511, 2509, 2513, 2507, 2515, 2505, 2517, 2503, 2519, 2501]\n assert candidate(nums = [29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8]) == [8, 6, 4, 2, 0, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 21, 23, 25, 27, 29]\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums = [5000, 4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991]) == [5000, 4992, 4998, 4994, 4996, 4995, 4997, 4993, 4999, 4991]\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 8, 2, 6, 4, 5, 3, 7, 1, 9]\n assert candidate(nums = [1111, 2222, 3333, 4444, 5555, 6666, 7777, 8888, 9999, 10000]) == [10000, 2222, 8888, 4444, 6666, 5555, 7777, 3333, 9999, 1111]\n assert candidate(nums = [5000, 2345, 1234, 1111, 9999, 8765, 6543, 4321, 2109, 1098]) == [5000, 1098, 1234, 1111, 9999, 8765, 6543, 4321, 2109, 2345]\n assert candidate(nums = [3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010, 3011, 3012, 3013, 3014, 3015, 3016, 3017, 3018, 3019]) == [3018, 3002, 3016, 3004, 3014, 3006, 3012, 3008, 3010, 3009, 3011, 3007, 3013, 3005, 3015, 3003, 3017, 3001, 3019]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [20, 2, 18, 4, 16, 6, 14, 8, 12, 10, 11, 9, 13, 7, 15, 5, 17, 3, 19, 1]\n assert candidate(nums = [3, 2, 1, 6, 5, 4, 7, 8, 9, 0]) == [0, 2, 8, 6, 4, 5, 7, 1, 9, 3]\n assert candidate(nums = [47, 32, 5, 18, 23, 42, 11, 30, 7, 60, 9, 54, 13, 27, 88, 46, 19, 35]) == [46, 32, 88, 18, 54, 42, 60, 30, 7, 11, 9, 23, 13, 27, 5, 47, 19, 35]\n assert candidate(nums = [42, 13, 56, 78, 91, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111]) == [42, 110, 56, 78, 108, 100, 106, 102, 104, 103, 105, 101, 107, 91, 109, 13, 111]\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 100]) == [100, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 1]\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == [0, 30, 2, 28, 4, 26, 6, 24, 8, 22, 10, 20, 12, 18, 14, 16, 15, 17, 13, 19, 11, 21, 9, 23, 7, 25, 5, 27, 3, 29, 1]\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == [20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]\n assert candidate(nums = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2]) == [2, 2, 2, 2, 2, 1, 1, 1, 1, 1]\n assert candidate(nums = [3141, 5926, 5358, 9793, 2384, 6264, 3383, 2795, 2884, 1971, 6939, 9375, 1058, 2097, 4944, 5923]) == [4944, 5926, 5358, 1058, 2384, 6264, 2884, 2795, 3383, 1971, 6939, 9375, 9793, 2097, 3141, 5923]\n assert candidate(nums = [11, 13, 15, 17, 19, 21, 23, 2, 4, 6, 8, 10]) == [10, 8, 6, 4, 2, 21, 23, 19, 17, 15, 13, 11]\n assert candidate(nums = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]) == [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]\n assert candidate(nums = [30, 28, 26, 24, 22, 20, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == [30, 28, 26, 24, 22, 20, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [0, 8, 2, 6, 4, 5, 3, 7, 1, 9]\n assert candidate(nums = [4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991, 4990, 4989, 4988, 4987, 4986, 4985, 4984]) == [4984, 4998, 4986, 4996, 4988, 4994, 4990, 4992, 4991, 4993, 4989, 4995, 4987, 4997, 4985, 4999]\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982]) == [9982, 9998, 9984, 9996, 9986, 9994, 9988, 9992, 9990, 9991, 9989, 9993, 9987, 9995, 9985, 9997, 9983, 9999]\n assert candidate(nums = [29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 2, 4, 6, 8, 10]) == [10, 8, 6, 4, 2, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 43, 41, 37, 31, 29]\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == [1000, 2000, 3000, 4000, 5000, 14, 2, 12, 4, 10, 6, 8, 7, 9, 5, 11, 3, 13, 1, 15]\n assert candidate(nums = [4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991, 4990, 4989, 4988, 4987, 4986, 4985, 4984, 4983, 4982, 4981, 4980, 4979, 4978, 4977, 4976, 4975, 4974, 4973, 4972, 4971, 4970, 4969, 4968, 4967, 4966, 4965, 4964, 4963, 4962, 4961, 4960]) == [4960, 4998, 4962, 4996, 4964, 4994, 4966, 4992, 4968, 4990, 4970, 4988, 4972, 4986, 4974, 4984, 4976, 4982, 4978, 4980, 4979, 4981, 4977, 4983, 4975, 4985, 4973, 4987, 4971, 4989, 4969, 4991, 4967, 4993, 4965, 4995, 4963, 4997, 4961, 4999]\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().sortArrayByParity", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sortArrayByParity = function(nums) {", "container": null, "callable": "sortArrayByParity", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 906, "task_id": "super-palindromes", "difficulty": "Hard", "problem_description": "Let's say a positive integer is a super-palindrome if it is a palindrome, and it is also the square of a palindrome.\nGiven two positive integers left and right represented as strings, return the number of super-palindromes integers in the inclusive range [left, right].\n \nExample 1:\n\nInput: left = \"4\", right = \"1000\"\nOutput: 4\nExplanation: 4, 9, 121, and 484 are superpalindromes.\nNote that 676 is not a superpalindrome: 26 * 26 = 676, but 26 is not a palindrome.\n\nExample 2:\n\nInput: left = \"1\", right = \"2\"\nOutput: 1\n\n \nConstraints:\n\n1 <= left.length, right.length <= 18\nleft and right consist of only digits.\nleft and right cannot have leading zeros.\nleft and right represent integers in the range [1, 1018 - 1].\nleft is less than or equal to right.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(left = \"1000000000\",right = \"1000000000000000000\") == 49\n assert candidate(left = \"123\",right = \"456\") == 0\n assert candidate(left = \"50\",right = \"10000\") == 2\n assert candidate(left = \"4\",right = \"1000\") == 4\n assert candidate(left = \"1\",right = \"2\") == 1\n assert candidate(left = \"123\",right = \"456789\") == 6\n assert candidate(left = \"100\",right = \"1000000\") == 7\n assert candidate(left = \"1\",right = \"100000000000000000\") == 70\n assert candidate(left = \"9\",right = \"9\") == 1\n assert candidate(left = \"100000000000000000\",right = \"999999999999999999\") == 0\n assert candidate(left = \"50\",right = \"1000\") == 2\n assert candidate(left = \"999999999999999999\",right = \"999999999999999999\") == 0\n assert candidate(left = \"100000000\",right = \"1000000000000000000\") == 57\n assert candidate(left = \"10\",right = \"100\") == 0\n assert candidate(left = \"123456789\",right = \"987654321\") == 3\n assert candidate(left = \"100000000000000000\",right = \"1000000000000000000\") == 0\n assert candidate(left = \"987654321\",right = \"987654321987654321\") == 49\n assert candidate(left = \"100000000\",right = \"10000000000\") == 8\n assert candidate(left = \"800000000000000000\",right = \"888888888888888888\") == 0\n assert candidate(left = \"987654321098765432\",right = \"999999999999999999\") == 0\n assert candidate(left = \"1000000000000\",right = \"2000000000000\") == 11\n assert candidate(left = \"12345678987654321\",right = \"12345678987654321\") == 1\n assert candidate(left = \"100000000000000\",right = \"1000000000000000\") == 9\n assert candidate(left = \"1\",right = \"1000000000000000000\") == 70\n assert candidate(left = \"123456789012345678\",right = \"876543210987654321\") == 0\n assert candidate(left = \"1000000000\",right = \"1234567890123456789\") == 64\n assert candidate(left = \"1000000000000000000\",right = \"2000000000000000000\") == 15\n assert candidate(left = \"12345678987654321\",right = \"98765432123456789\") == 3\n assert candidate(left = \"2000000000\",right = \"3000000000\") == 0\n assert candidate(left = \"500000000000000000\",right = \"555555555555555555\") == 0\n assert candidate(left = \"12345678987654321\",right = \"12345678987654321987654321987654321\") == 21\n assert candidate(left = \"333333333333333333\",right = \"444444444444444444\") == 0\n assert candidate(left = \"900000000000000000\",right = \"999999999999999999\") == 0\n assert candidate(left = \"9007199254740992\",right = \"900719925474099200\") == 22\n assert candidate(left = \"8765432101234567876543210\",right = \"987654321123456789876543210\") == 0\n assert candidate(left = \"10000000000\",right = \"100000000000000000\") == 49\n assert candidate(left = \"1000000000000\",right = \"9999999999999\") == 13\n assert candidate(left = \"500000000\",right = \"600000000\") == 0\n assert candidate(left = \"499\",right = \"501\") == 0\n assert candidate(left = \"123\",right = \"123456789012345678\") == 66\n assert candidate(left = \"1\",right = \"999999999999999999\") == 70\n assert candidate(left = \"99999999999999998\",right = \"999999999999999999\") == 0\n assert candidate(left = \"999999999\",right = \"10000000000\") == 0\n assert candidate(left = \"9876543210\",right = \"9876543210987654321\") == 65\n assert candidate(left = \"9876543210123456789\",right = \"9876543210123456789\") == 0\n assert candidate(left = \"98000000000000000\",right = \"98100000000000000\") == 0\n assert candidate(left = \"888888888888888888\",right = \"999999999999999999\") == 0\n assert candidate(left = \"123456789123456789\",right = \"987654321987654321\") == 0\n assert candidate(left = \"100000000000000\",right = \"110000000000000\") == 4\n assert candidate(left = \"50000000000\",right = \"60000000000\") == 0\n assert candidate(left = \"12321\",right = \"98789\") == 4\n assert candidate(left = \"9223372036854775807\",right = \"9223372036854775808\") == 0\n assert candidate(left = \"111111111\",right = \"222222222\") == 3\n assert candidate(left = \"100000000000000000\",right = \"18446744073709551615\") == 16\n assert candidate(left = \"100000000000000000\",right = \"100000000000000001\") == 0\n assert candidate(left = \"99999999999999999\",right = \"1000000000000000000\") == 0\n assert candidate(left = \"987654321\",right = \"987654321012345678\") == 49\n assert candidate(left = \"999999999999999999\",right = \"1000000000000000000\") == 0\n assert candidate(left = \"1000000\",right = \"100000000\") == 3\n assert candidate(left = \"100000000000000\",right = \"1000000000000000000\") == 31\n assert candidate(left = \"1000000000000000000\",right = \"9999999999999999999\") == 16\n assert candidate(left = \"10000\",right = \"100000000\") == 8\n assert candidate(left = \"10000000000\",right = \"11000000000\") == 2\n assert candidate(left = \"3000000000000\",right = \"4000000000000\") == 0\n assert candidate(left = \"123456789012345678\",right = \"987654321098765432\") == 0\n assert candidate(left = \"1000000000000000000\",right = \"1000000000000000000\") == 0\n assert candidate(left = \"123\",right = \"12345678987654321\") == 64\n assert candidate(left = \"1000000000\",right = \"999999999999999999\") == 49\n assert candidate(left = \"1234567891011121314\",right = \"15161718192021222324\") == 1\n assert candidate(left = \"100000000000000000\",right = \"900000000000000000\") == 0\n assert candidate(left = \"1000000000\",right = \"1000000000000\") == 5\n assert candidate(left = \"7000000000000000000\",right = \"8000000000000000000\") == 0\n assert candidate(left = \"1000000000000000000\",right = \"1000000000000000001\") == 0\n assert candidate(left = \"1000000000\",right = \"9999999999\") == 0\n assert candidate(left = \"50000000000000000\",right = \"60000000000000000\") == 0\n assert candidate(left = \"555555555555555555\",right = \"666666666666666666\") == 0\n assert candidate(left = \"10000000000000000\",right = \"1000000000000000000\") == 22\n assert candidate(left = \"100000000000000000\",right = \"18014398509481983\") == 0\n assert candidate(left = \"111111111\",right = \"999999999999999\") == 32\n assert candidate(left = \"800000000000000000\",right = \"899999999999999999\") == 0\n assert candidate(left = \"111111111111111111\",right = \"222222222222222222\") == 0\n assert candidate(left = \"500000000000000000\",right = \"600000000000000000\") == 0\n assert candidate(left = \"484\",right = \"576\") == 1\n assert candidate(left = \"999999999999999\",right = \"999999999999999999\") == 22\n assert candidate(left = \"80000000000\",right = \"90000000000\") == 0\n assert candidate(left = \"1000000\",right = \"1000000000\") == 11\n"}, "metadata": {"canonical_parameter_names": ["left", "right"], "leetcode_dataset_entry_point": "Solution().superpalindromesInRange", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var superpalindromesInRange = function(left, right) {", "container": null, "callable": "superpalindromesInRange", "parameters": [{"name": "left", "type": "string"}, {"name": "right", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 907, "task_id": "sum-of-subarray-minimums", "difficulty": "Medium", "problem_description": "Given an array of integers arr, find the sum of min(b), where b ranges over every (contiguous) subarray of arr. Since the answer may be large, return the answer modulo 109 + 7.\n \nExample 1:\n\nInput: arr = [3,1,2,4]\nOutput: 17\nExplanation: \nSubarrays are [3], [1], [2], [4], [3,1], [1,2], [2,4], [3,1,2], [1,2,4], [3,1,2,4]. \nMinimums are 3, 1, 2, 4, 1, 1, 2, 1, 1, 1.\nSum is 17.\n\nExample 2:\n\nInput: arr = [11,81,94,43,3]\nOutput: 444\n\n \nConstraints:\n\n1 <= arr.length <= 3 * 104\n1 <= arr[i] <= 3 * 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [5, 4, 3, 2, 1]) == 35\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 165\n assert candidate(arr = [1, 3, 2, 4, 5, 7, 6, 8, 9]) == 157\n assert candidate(arr = [9, 7, 5, 3, 1]) == 55\n assert candidate(arr = [10, 20, 30, 40, 50]) == 350\n assert candidate(arr = [1, 2, 2, 1]) == 13\n assert candidate(arr = [3, 1, 2, 4, 3]) == 27\n assert candidate(arr = [3, 1, 2, 4, 5]) == 30\n assert candidate(arr = [11, 81, 94, 43, 3]) == 444\n assert candidate(arr = [1]) == 1\n assert candidate(arr = [1, 1, 1, 1, 1]) == 15\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 220\n assert candidate(arr = [1, 3, 5, 2, 4, 6]) == 49\n assert candidate(arr = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 110\n assert candidate(arr = [10000, 9000, 8000, 7000, 6000]) == 110000\n assert candidate(arr = [1, 2, 3, 4, 5]) == 35\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 385\n assert candidate(arr = [3, 1, 2, 4]) == 17\n assert candidate(arr = [3, 3, 3, 3, 3]) == 45\n assert candidate(arr = [10000, 20000, 30000, 40000, 50000]) == 350000\n assert candidate(arr = [1, 3, 5, 7, 9]) == 55\n assert candidate(arr = [30000, 1, 30000, 2, 30000]) == 90016\n assert candidate(arr = [3, 2, 1, 4, 5]) == 29\n assert candidate(arr = [1, 2, 1, 2, 1]) == 17\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 275\n assert candidate(arr = [10, 20, 10, 30, 10, 40, 10, 50, 10, 60]) == 700\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7]) == 155\n assert candidate(arr = [3, 2, 1, 5, 4]) == 29\n assert candidate(arr = [3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3]) == 485\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 680\n assert candidate(arr = [30000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 30230\n assert candidate(arr = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000]) == 550000\n assert candidate(arr = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]) == 94\n assert candidate(arr = [5, 3, 1, 2, 4, 6, 7, 8, 9, 10]) == 183\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 210\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5]) == 305\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1540\n assert candidate(arr = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10]) == 199\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 4960\n assert candidate(arr = [5, 4, 3, 2, 1]) == 35\n assert candidate(arr = [30000, 29999, 29998, 29997, 29996, 29995, 29994, 29993, 29992, 29991]) == 1649670\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 22100\n assert candidate(arr = [10, 20, 10, 30, 10, 40, 10, 50, 10]) == 550\n assert candidate(arr = [5, 3, 8, 6, 2, 7, 4, 1, 9, 10]) == 140\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 1, 2, 3, 4, 5]) == 2285\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 715\n assert candidate(arr = [5, 4, 3, 2, 1, 0]) == 35\n assert candidate(arr = [100000, 100000, 100000, 100000, 100000]) == 1500000\n assert candidate(arr = [1, 3, 2, 4, 5, 4, 3, 2, 1]) == 91\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1]) == 36\n assert candidate(arr = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 95\n assert candidate(arr = [9, 7, 3, 1, 6, 2, 8, 4, 5]) == 107\n assert candidate(arr = [1000, 500, 250, 125, 62, 31, 15, 7, 3, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]) == 8116\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 10]) == 204\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10]) == 240\n assert candidate(arr = [2, 3, 1, 5, 4, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19, 22, 21, 24, 23, 26, 25, 28, 27, 30, 29]) == 4561\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 55\n assert candidate(arr = [2, 3, 1, 1, 3, 2, 2, 1, 3, 1]) == 68\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 2200\n assert candidate(arr = [5, 3, 7, 1, 6, 8, 2, 4, 9, 10]) == 136\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 220\n assert candidate(arr = [1, 10, 1, 10, 1, 10, 1, 10, 1, 10]) == 100\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 165\n assert candidate(arr = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 1555\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 540\n assert candidate(arr = [2, 4, 2, 6, 2, 8, 2, 10]) == 92\n assert candidate(arr = [7, 6, 5, 4, 3, 2, 1]) == 84\n assert candidate(arr = [1, 3, 5, 2, 4, 6, 7, 8, 9, 10]) == 197\n assert candidate(arr = [3, 5, 4, 2, 1, 6, 7, 8, 9, 10]) == 170\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 1540\n assert candidate(arr = [10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000]) == 2200000\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 6800\n assert candidate(arr = [1, 3, 2, 4, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]) == 516\n assert candidate(arr = [10000, 1, 10000, 1, 10000, 1, 10000, 1, 10000, 1]) == 50050\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 330\n assert candidate(arr = [29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 1240\n assert candidate(arr = [1, 3, 2, 3, 1, 2, 1, 3, 2, 1]) == 68\n assert candidate(arr = [5, 3, 8, 6, 2, 7, 4, 1]) == 96\n assert candidate(arr = [30000, 15000, 10000, 5000, 1, 5000, 10000, 15000, 30000]) == 220025\n assert candidate(arr = [1, 10, 2, 9, 3, 8, 4, 7, 5, 6]) == 170\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 1240\n assert candidate(arr = [100, 200, 300, 100, 200, 300, 100, 200, 300, 100, 200, 300]) == 9400\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 125\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 2870\n assert candidate(arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]) == 131\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 22000\n assert candidate(arr = [30000, 29999, 29998, 29997, 29996, 29995]) == 629930\n assert candidate(arr = [30000, 1, 30000, 1, 30000, 1, 30000, 1, 30000, 1]) == 150050\n assert candidate(arr = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 680\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 600\n assert candidate(arr = [100000, 1, 200000, 2, 300000, 3, 400000, 4]) == 1000060\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 550\n assert candidate(arr = [15000, 10000, 20000, 5000, 25000, 22500, 17500, 27500, 30000, 12500]) == 602500\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().sumSubarrayMins", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sumSubarrayMins = function(arr) {", "container": null, "callable": "sumSubarrayMins", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 908, "task_id": "smallest-range-i", "difficulty": "Easy", "problem_description": "You are given an integer array nums and an integer k.\nIn one operation, you can choose any index i where 0 <= i < nums.length and change nums[i] to nums[i] + x where x is an integer from the range [-k, k]. You can apply this operation at most once for each index i.\nThe score of nums is the difference between the maximum and minimum elements in nums.\nReturn the minimum score of nums after applying the mentioned operation at most once for each index in it.\n \nExample 1:\n\nInput: nums = [1], k = 0\nOutput: 0\nExplanation: The score is max(nums) - min(nums) = 1 - 1 = 0.\n\nExample 2:\n\nInput: nums = [0,10], k = 2\nOutput: 6\nExplanation: Change nums to be [2, 8]. The score is max(nums) - min(nums) = 8 - 2 = 6.\n\nExample 3:\n\nInput: nums = [1,3,6], k = 3\nOutput: 0\nExplanation: Change nums to be [4, 4, 4]. The score is max(nums) - min(nums) = 4 - 4 = 0.\n\n \nConstraints:\n\n1 <= nums.length <= 104\n0 <= nums[i] <= 104\n0 <= k <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [100, 200, 300, 400],k = 100) == 100\n assert candidate(nums = [100, 4, 200, 1, 3, 2],k = 3) == 193\n assert candidate(nums = [1, 10000],k = 10000) == 0\n assert candidate(nums = [5, 5, 5, 5],k = 1) == 0\n assert candidate(nums = [5, 5, 5, 5],k = 5) == 0\n assert candidate(nums = [1, 3, 6],k = 3) == 0\n assert candidate(nums = [5, 5, 5, 5, 5],k = 10) == 0\n assert candidate(nums = [0, 0, 0, 0, 0],k = 0) == 0\n assert candidate(nums = [5, 5, 5],k = 5) == 0\n assert candidate(nums = [1, 2, 3, 4, 5],k = 5) == 0\n assert candidate(nums = [4, 8, 15, 16, 23, 42],k = 10) == 18\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3) == 3\n assert candidate(nums = [10, 10, 10, 10],k = 5) == 0\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],k = 1) == 7\n assert candidate(nums = [1],k = 0) == 0\n assert candidate(nums = [4, 7, 8, 9],k = 2) == 1\n assert candidate(nums = [10, 10, 10],k = 5) == 0\n assert candidate(nums = [100, 200, 300, 400, 500],k = 150) == 100\n assert candidate(nums = [5, 5, 5, 5, 5],k = 10000) == 0\n assert candidate(nums = [100, 1000, 10000],k = 500) == 8900\n assert candidate(nums = [1, 10000],k = 5000) == 0\n assert candidate(nums = [10, 15, 20, 25, 30],k = 5) == 10\n assert candidate(nums = [10, 15, 20],k = 5) == 0\n assert candidate(nums = [0, 10],k = 2) == 6\n assert candidate(nums = [100, 200, 300, 400, 500],k = 100) == 200\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 0) == 9\n assert candidate(nums = [1, 2, 3, 4, 5],k = 1) == 2\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 100) == 0\n assert candidate(nums = [1, 1, 1, 1, 1, 1],k = 5) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 7) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 0\n assert candidate(nums = [10, 20, 30, 40, 50],k = 25) == 0\n assert candidate(nums = [1, 5, 9, 13, 17],k = 3) == 10\n assert candidate(nums = [1, 100, 200, 300, 400, 500],k = 150) == 199\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 0\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 1000) == 0\n assert candidate(nums = [1, 100, 200, 300, 400, 500, 600, 700, 800, 900],k = 200) == 499\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4],k = 1) == 1\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],k = 10) == 8\n assert candidate(nums = [1, 10000, 20000, 30000, 40000],k = 5000) == 29999\n assert candidate(nums = [1, 3, 5, 7, 9],k = 4) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 3) == 8\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 15) == 60\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800],k = 100) == 500\n assert candidate(nums = [10, 20, 30, 40, 50],k = 0) == 40\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 350) == 200\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5],k = 3) == 0\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000],k = 1) == 0\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 1) == 0\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],k = 20) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 0\n assert candidate(nums = [1, 1, 1, 1, 2],k = 1) == 0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 300) == 300\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],k = 10) == 8\n assert candidate(nums = [5000, 5000, 5000, 5000, 5000],k = 2500) == 0\n assert candidate(nums = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990],k = 5) == 0\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5],k = 2) == 0\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 0) == 0\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 3) == 0\n assert candidate(nums = [1, 1000, 2000, 3000, 4000],k = 500) == 2999\n assert candidate(nums = [1, 100, 200, 300, 400, 500, 600, 700, 800, 900],k = 250) == 399\n assert candidate(nums = [5, 5, 5, 5, 5],k = 100) == 0\n assert candidate(nums = [2, 4, 6, 8, 10],k = 2) == 4\n assert candidate(nums = [10000, 9999, 9998, 9997, 9996, 9995],k = 5) == 0\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],k = 2500) == 4000\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == 0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70],k = 20) == 20\n assert candidate(nums = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5],k = 2) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 12) == 5\n assert candidate(nums = [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 1) == 0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 150) == 600\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990],k = 500) == 0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 450) == 0\n assert candidate(nums = [5, 10, 15, 20, 25, 30],k = 5) == 15\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],k = 20) == 100\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 1) == 17\n assert candidate(nums = [1, 10000, 1, 10000, 1, 10000, 1, 10000, 1, 10000],k = 5000) == 0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 5) == 80\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],k = 5) == 8\n assert candidate(nums = [7, 2, 5, 10, 8, 12, 4, 6],k = 3) == 4\n assert candidate(nums = [5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000],k = 0) == 0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 20) == 50\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70],k = 15) == 30\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 4) == 1\n assert candidate(nums = [1, 1000, 10000, 100000, 1000000],k = 50000) == 899999\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 50) == 800\n assert candidate(nums = [5, 5, 5, 5, 5],k = 2) == 0\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],k = 2) == 14\n assert candidate(nums = [5, 10, 15, 20, 25],k = 12) == 0\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 1) == 0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1000) == 0\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000],k = 2500) == 0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500],k = 250) == 1900\n assert candidate(nums = [1, 1, 1, 1, 1],k = 10) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 5) == 9\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000],k = 10000) == 0\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 5, 5, 6, 7, 8, 8, 9, 10],k = 2) == 5\n assert candidate(nums = [5, 10, 15, 20, 25, 30],k = 3) == 19\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],k = 1000) == 7000\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 20) == 50\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990],k = 5) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 2) == 10\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 5) == 0\n assert candidate(nums = [5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009],k = 500) == 0\n assert candidate(nums = [1, 10000, 20000, 30000, 40000],k = 9999) == 20001\n assert candidate(nums = [5, 5, 5, 5, 5],k = 1000) == 0\n assert candidate(nums = [1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10],k = 1) == 7\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000],k = 5000) == 0\n assert candidate(nums = [1, 10000],k = 5000) == 0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500],k = 300) == 800\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10) == 0\n assert candidate(nums = [1, 1000, 2000, 3000, 4000, 5000],k = 2500) == 0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],k = 25) == 140\n assert candidate(nums = [1, 3, 5, 7, 9],k = 4) == 0\n assert candidate(nums = [999, 9999, 99999, 999999, 9999999],k = 500000) == 8999000\n assert candidate(nums = [-10, -5, 0, 5, 10],k = 3) == 14\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],k = 1) == 2\n assert candidate(nums = [1, 10, 100, 1000, 10000],k = 1000) == 7999\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 2) == 5\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],k = 20) == 150\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000],k = 500) == 3000\n assert candidate(nums = [1, 2, 3, 4, 5],k = 10) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],k = 10) == 4\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000],k = 2000) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 4) == 1\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],k = 500) == 8000\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().smallestRangeI", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var smallestRangeI = function(nums, k) {", "container": null, "callable": "smallestRangeI", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 909, "task_id": "snakes-and-ladders", "difficulty": "Medium", "problem_description": "You are given an n x n integer matrix board where the cells are labeled from 1 to n2 in a Boustrophedon style starting from the bottom left of the board (i.e. board[n - 1][0]) and alternating direction each row.\nYou start on square 1 of the board. In each move, starting from square curr, do the following:\n\nChoose a destination square next with a label in the range [curr + 1, min(curr + 6, n2)].\n\n\t\nThis choice simulates the result of a standard 6-sided die roll: i.e., there are always at most 6 destinations, regardless of the size of the board.\n\n\nIf next has a snake or ladder, you must move to the destination of that snake or ladder. Otherwise, you move to next.\nThe game ends when you reach the square n2.\n\nA board square on row r and column c has a snake or ladder if board[r][c] != -1. The destination of that snake or ladder is board[r][c]. Squares 1 and n2 are not the starting points of any snake or ladder.\nNote that you only take a snake or ladder at most once per dice roll. If the destination to a snake or ladder is the start of another snake or ladder, you do not follow the subsequent snake or ladder.\n\nFor example, suppose the board is [[-1,4],[-1,3]], and on the first move, your destination square is 2. You follow the ladder to square 3, but do not follow the subsequent ladder to 4.\n\nReturn the least number of dice rolls required to reach the square n2. If it is not possible to reach the square, return -1.\n \nExample 1:\n\n\nInput: board = [[-1,-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1,-1],[-1,35,-1,-1,13,-1],[-1,-1,-1,-1,-1,-1],[-1,15,-1,-1,-1,-1]]\nOutput: 4\nExplanation: \nIn the beginning, you start at square 1 (at row 5, column 0).\nYou decide to move to square 2 and must take the ladder to square 15.\nYou then decide to move to square 17 and must take the snake to square 13.\nYou then decide to move to square 14 and must take the ladder to square 35.\nYou then decide to move to square 36, ending the game.\nThis is the lowest possible number of moves to reach the last square, so return 4.\n\nExample 2:\n\nInput: board = [[-1,-1],[-1,3]]\nOutput: 1\n\n \nConstraints:\n\nn == board.length == board[i].length\n2 <= n <= 20\nboard[i][j] is either -1 or in the range [1, n2].\nThe squares labeled 1 and n2 are not the starting points of any snake or ladder.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(board = [[-1, -1], [-1, 3]]) == 1\n assert candidate(board = [[-1, 2, 15, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, 34, 3, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, 15, -1, -1, -1, -1]]) == 4\n assert candidate(board = [[-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, 35, -1, -1, 13, -1], [-1, -1, -1, -1, -1, -1], [-1, 15, -1, -1, -1, -1]]) == 4\n assert candidate(board = [[-1, 1, 2], [-1, 9, 8], [-1, 8, 9]]) == 1\n assert candidate(board = [[1, 2, 3], [-1, -1, -1], [-1, -1, -1]]) == -1\n assert candidate(board = [[-1, -1, 19, 10, -1], [2, -1, -1, 6, -1], [-1, 17, -1, 19, -1], [22, -1, 15, -1, -1], [-1, -1, -1, -1, 15]]) == 3\n assert candidate(board = [[-1, -1, 30, 14, 15, -1], [23, -1, -1, -1, -1, -1], [9, -1, -1, -1, 8, -1], [-1, 22, -1, -1, 19, -1], [33, -1, 15, -1, -1, 35], [-1, -1, -1, -1, -1, 12]]) == 2\n assert candidate(board = [[1, 1, -1], [-1, 1, 1], [-1, -1, -1]]) == 2\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, -1], [-1, 25, 33, -1, -1, -1, -1], [-1, -1, -1, 29, -1, -1, -1], [-1, -1, 35, -1, -1, -1, 42], [-1, -1, -1, -1, -1, -1, -1], [-1, 17, -1, -1, -1, -1, -1], [-1, -1, -1, 19, -1, -1, -1]]) == 4\n assert candidate(board = [[-1, 15, 13, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, 3, 5, 16], [-1, -1, -1, -1, -1, -1], [25, -1, -1, 19, -1, -1]]) == 4\n assert candidate(board = [[-1, -1, 22, -1, -1, -1], [-1, -1, -1, -1, 8, -1], [-1, -1, 14, -1, -1, -1], [-1, -1, -1, -1, -1, 10], [-1, -1, 2, -1, -1, 6], [-1, -1, -1, -1, -1, -1]]) == 7\n assert candidate(board = [[-1, 2, 3, 4, 5, 6], [7, 8, 9, 10, -1, 12], [-1, 14, 15, 16, 17, 18], [19, 20, 21, -1, 23, 24], [25, 26, 27, 28, 29, 30], [-1, 32, 33, 34, 35, -1]]) == 2\n assert candidate(board = [[-1, -1, -1, -1, -1, 12], [-1, -1, -1, -1, -1, 35], [-1, -1, -1, -1, -1, -1], [-1, -1, 27, -1, -1, -1], [-1, -1, -1, -1, 34, -1], [-1, -1, -1, -1, -1, -1]]) == 3\n assert candidate(board = [[-1, -1, -1, 10, -1, -1], [-1, -1, 17, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 22, -1], [-1, -1, -1, 15, -1, -1], [-1, -1, -1, -1, -1, 28]]) == 3\n assert candidate(board = [[-1, -1, -1, 9, -1, 6], [-1, 13, 5, -1, -1, 3], [10, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 10, -1], [-1, 9, 3, 11, -1, -1], [-1, -1, -1, -1, -1, 1]]) == 7\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, 35, 31, -1, -1], [-1, -1, -1, -1, -1, -1, -1, 17, 16, -1], [-1, -1, -1, -1, 29, -1, -1, -1, -1, 50], [-1, -1, -1, -1, 32, -1, 25, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, 36], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]]) == 17\n assert candidate(board = [[-1, 14, -1, -1, 24, -1, 3], [-1, -1, -1, 9, -1, -1, -1], [-1, -1, -1, -1, 17, -1, -1], [-1, 28, -1, -1, -1, -1, -1], [-1, -1, -1, 19, -1, -1, -1], [-1, -1, 13, -1, -1, 15, -1], [-1, -1, -1, -1, -1, -1, 36]]) == -1\n assert candidate(board = [[-1, -1, -1, -1, -1, -1], [-1, 10, -1, 12, -1, -1], [-1, -1, 17, -1, -1, -1], [-1, -1, -1, 22, -1, 25], [-1, -1, -1, -1, 29, -1], [-1, -1, -1, -1, -1, 36]]) == 1\n assert candidate(board = [[-1, 2, -1, -1, -1, 36], [-1, -1, 35, 18, -1, 27], [-1, -1, -1, 43, -1, -1], [30, 5, -1, -1, 46, -1], [-1, -1, -1, -1, 31, -1], [13, -1, -1, 50, -1, 16]]) == 3\n assert candidate(board = [[-1, -1, -1, -1, -1, 20], [-1, -1, 25, -1, -1, 3], [-1, 13, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [15, -1, -1, -1, 10, -1], [-1, -1, -1, -1, -1, -1]]) == 6\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, 15, -1], [-1, 13, -1, -1, -1, 19, -1], [-1, -1, -1, -1, 25, -1, -1], [-1, -1, -1, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, 36]]) == 4\n assert candidate(board = [[-1, 17, 29, -1, -1, -1], [2, -1, -1, 20, -1, 15], [-1, -1, -1, -1, -1, -1], [-1, -1, 24, 26, -1, -1], [-1, -1, -1, 29, -1, -1], [-1, -1, -1, -1, -1, -1]]) == 4\n assert candidate(board = [[-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, 37], [-1, -1, -1, -1, -1, -1]]) == 6\n assert candidate(board = [[-1, -1, -1, -1, 28, -1], [25, -1, -1, -1, 24, 19], [11, -1, -1, -1, -1, -1], [9, -1, -1, -1, 27, 17], [-1, 21, -1, 20, 16, -1], [-1, -1, -1, 12, -1, -1]]) == 4\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 35, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, 40], [-1, 17, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1]]) == 11\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, 20, -1, -1, 13, -1, -1], [-1, -1, -1, 17, -1, -1, -1, -1], [-1, -1, -1, -1, 19, -1, -1, 36]]) == 7\n assert candidate(board = [[-1, 11, -1, -1, 24, -1], [-1, -1, 17, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, 15, -1, -1, -1, -1], [-1, -1, 19, -1, -1, -1], [-1, -1, -1, -1, -1, 36]]) == 1\n assert candidate(board = [[-1, -1, 11, 12, -1, 14], [-1, -1, -1, -1, 22, -1], [-1, 17, -1, 19, -1, -1], [22, -1, 15, -1, -1, -1], [-1, 27, -1, -1, -1, -1], [-1, -1, -1, -1, 15, 26]]) == 3\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, -1, -1, -1, 54], [-1, -1, -1, -1, 58, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 12, -1, -1, -1, -1, 21], [-1, -1, -1, -1, -1, -1, -1, 18, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]]) == 17\n assert candidate(board = [[-1, 79, -1, -1, -1, -1, -1, -1, 13, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, 87], [-1, -1, -1, -1, -1, -1, -1, -1, -1, 58], [-1, 31, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]]) == 17\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, 12], [-1, -1, -1, -1, -1, 23, -1], [-1, -1, -1, -1, -1, 7, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, 27, -1, 20, -1], [-1, -1, -1, 34, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]]) == -1\n assert candidate(board = [[-1, -1, -1, 45, -1, 27], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, 44, -1, 33], [-1, -1, 30, -1, -1, -1], [-1, 47, -1, -1, 25, -1]]) == 3\n assert candidate(board = [[-1, -1, 15, -1, -1, -1, -1, 12], [7, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1]]) == 11\n assert candidate(board = [[-1, 22, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 26, -1, 31, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, 12, -1, -1, -1, 13, -1, -1], [-1, -1, -1, -1, -1, 29, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, 27, -1], [-1, -1, -1, -1, 21, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1]]) == 13\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, 54, -1, 30, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, -1]]) == 24\n assert candidate(board = [[-1, 14, -1, -1, -1, -1, 36, 5, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 29, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 32, -1, 25, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, 50, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]]) == 17\n assert candidate(board = [[-1, 13, 6, -1, -1, -1], [-1, 14, -1, -1, -1, 14], [-1, -1, -1, -1, 18, -1], [-1, 10, -1, -1, -1, 18], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, 20]]) == 4\n assert candidate(board = [[-1, 10, -1, -1, -1, 13], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 8, -1], [-1, 13, 5, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 16, 18]]) == 4\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, 30, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 16, -1, 20, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, 28, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, 17, -1, -1, -1, -1, -1]]) == 8\n assert candidate(board = [[-1, -1, -1, 29, 4, -1], [-1, 5, -1, 20, -1, 34], [-1, -1, -1, -1, -1, -1], [-1, -1, 33, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, 15]]) == 4\n assert candidate(board = [[-1, 7, 3, -1, 12, -1], [14, -1, -1, 9, 5, 20], [-1, -1, -1, -1, -1, -1], [4, 6, -1, -1, 13, -1], [17, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 15, -1]]) == 5\n assert candidate(board = [[-1, 8, 13, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, 16, -1, -1, -1, 10], [-1, -1, -1, -1, -1, -1], [-1, 16, 10, -1, -1, -1], [-1, -1, -1, -1, -1, -1]]) == 6\n assert candidate(board = [[-1, -1, 8, -1, -1, 22], [-1, -1, -1, -1, 13, -1], [-1, -1, 24, -1, -1, -1], [27, -1, -1, -1, -1, -1], [-1, -1, -1, 26, -1, -1], [-1, 35, -1, -1, 30, -1]]) == 2\n assert candidate(board = [[-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 9, -1], [-1, 15, -1, -1, -1, -1], [-1, -1, -1, 12, -1, -1], [-1, -1, -1, -1, 22, -1], [-1, -1, -1, -1, -1, 36]]) == 1\n assert candidate(board = [[-1, -1, -1, -1, 50, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, 28, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, 24], [-1, 46, -1, -1, -1, 18, -1, -1, -1], [-1, -1, -1, -1, -1, -1, 15, -1, -1], [-1, -1, 31, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, 30, -1, 14, -1], [-1, -1, -1, -1, 27, -1, -1, -1, -1]]) == 9\n assert candidate(board = [[-1, -1, -1, -1, -1, -1], [25, 41, 34, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, 36, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1]]) == 3\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, 40], [-1, -1, -1, -1, -1, -1, 36], [-1, 28, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]]) == -1\n assert candidate(board = [[-1, 7, 1, 1, 1, -1], [15, -1, 19, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, 9, -1, -1, -1, 5], [-1, 22, -1, 1, -1, 9], [-1, -1, -1, -1, -1, 22]]) == 4\n assert candidate(board = [[-1, 7, 31, -1, -1, -1], [-1, -1, -1, 25, 35, 15], [-1, -1, 28, 16, 22, -1], [-1, -1, -1, -1, 17, -1], [-1, 24, -1, 9, -1, -1], [-1, -1, -1, -1, -1, 4]]) == 4\n assert candidate(board = [[-1, -1, -1, 31, -1, -1], [-1, -1, 25, -1, -1, -1], [-1, -1, -1, -1, 24, -1], [-1, -1, -1, -1, -1, 16], [-1, -1, 21, -1, -1, -1], [-1, -1, -1, -1, -1, -1]]) == 5\n assert candidate(board = [[-1, -1, 12, -1, -1, 27], [-1, -1, -1, -1, -1, 20], [-1, 22, -1, 30, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, 15, -1, -1, -1, -1], [-1, -1, -1, 34, -1, -1]]) == 2\n assert candidate(board = [[-1, -1, -1, 12, -1, -1], [-1, -1, -1, -1, -1, 33], [-1, -1, -1, -1, 28, -1], [-1, 30, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [15, -1, 35, -1, -1, 27]]) == 2\n assert candidate(board = [[-1, 49, -1, 19, -1, -1], [-1, -1, -1, -1, -1, 15], [-1, 31, -1, -1, -1, 42], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, 27, -1, -1], [-1, 43, -1, -1, -1, -1]]) == 4\n assert candidate(board = [[-1, -1, -1, -1, 7, -1], [-1, 13, -1, 11, -1, -1], [-1, -1, 15, -1, -1, -1], [-1, -1, -1, -1, -1, 14], [-1, -1, -1, 9, -1, -1], [-1, -1, -1, -1, -1, 36]]) == 1\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, 25, -1, -1, -1, -1, -1], [-1, -1, 17, -1, -1, -1, -1], [-1, -1, -1, -1, -1, 24, -1], [-1, 13, -1, -1, -1, 19, -1], [-1, -1, -1, -1, -1, -1, 36]]) == 4\n assert candidate(board = [[-1, -1, -1, 33, -1, -1, 15], [-1, -1, 24, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [12, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, 18, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, 9, -1, -1, -1, -1]]) == -1\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, -1, -1], [19, -1, -1, -1, -1, -1, 29, -1], [-1, 35, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, 21, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [12, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, 17, -1], [-1, -1, -1, -1, -1, -1, -1, -1]]) == 10\n assert candidate(board = [[-1, -1, 26, 11, 17, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, 22, 23, -1, -1], [-1, -1, -1, 9, -1, -1], [14, -1, -1, -1, -1, 25], [-1, -1, 13, -1, -1, -1]]) == 3\n assert candidate(board = [[-1, -1, 17, 10, -1, -1, -1], [-1, -1, -1, -1, 22, -1, 31], [-1, -1, -1, -1, -1, -1, -1], [22, -1, 15, -1, -1, -1, -1], [-1, -1, -1, -1, 44, -1, 52], [-1, 60, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]]) == 5\n assert candidate(board = [[-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 32, -1], [-1, -1, -1, -1, -1, 20], [-1, -1, 26, -1, -1, -1], [-1, -1, -1, 15, -1, -1], [-1, -1, -1, -1, -1, 35]]) == 2\n assert candidate(board = [[-1, 10, -1, -1, 22, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, 28, -1, -1], [16, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 9, -1], [-1, -1, -1, -1, -1, 36]]) == 1\n assert candidate(board = [[-1, -1, 38, -1, -1, -1], [-1, -1, -1, -1, -1, 15], [-1, -1, -1, 33, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, 20], [-1, -1, -1, -1, -1, -1]]) == 3\n assert candidate(board = [[-1, -1, -1, 24, -1, -1, 7], [-1, -1, -1, -1, 31, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, 43, -1, 17, -1, 35, -1], [-1, -1, -1, -1, -1, 45, -1], [34, -1, -1, 18, -1, -1, -1], [-1, -1, -1, -1, 12, -1, -1]]) == -1\n assert candidate(board = [[-1, -1, 19, 31, 26, -1, 45, 26], [21, 33, -1, -1, -1, -1, -1, -1], [28, -1, -1, -1, 39, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1]]) == 11\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, 41], [-1, -1, -1, -1, 23, -1, -1], [-1, 28, 35, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, 52], [-1, -1, -1, 38, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]]) == 4\n assert candidate(board = [[-1, -1, -1, 18, -1, -1], [-1, -1, 13, -1, 16, 18], [-1, -1, -1, 16, -1, -1], [-1, -1, -1, 16, -1, 12], [-1, -1, 9, -1, -1, 12], [-1, -1, -1, -1, -1, 15]]) == 5\n assert candidate(board = [[-1, -1, -1, 14, 2, -1], [-1, -1, -1, 8, -1, -1], [-1, -1, 15, -1, 10, -1], [18, 7, -1, -1, 13, -1], [-1, 6, -1, -1, -1, -1], [-1, 5, -1, -1, -1, 23]]) == 4\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, 15, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, 21, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, 28, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, 27, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]]) == 17\n assert candidate(board = [[-1, -1, -1, -1, -1, -1], [-1, -1, 25, -1, -1, 10], [-1, -1, -1, -1, -1, -1], [-1, -1, 38, -1, -1, 15], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1]]) == 6\n assert candidate(board = [[-1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1]]) == 14\n assert candidate(board = [[-1, -1, 16, -1, -1, -1], [-1, 32, -1, -1, 29, -1], [-1, 15, -1, 22, -1, -1], [17, -1, -1, -1, -1, -1], [-1, 25, -1, -1, -1, -1], [20, -1, 34, -1, -1, -1]]) == 2\n assert candidate(board = [[-1, 12, -1, 24, -1, 26], [27, -1, -1, 20, -1, -1], [18, -1, 23, -1, -1, -1], [-1, -1, -1, 14, -1, -1], [15, -1, -1, -1, -1, 25], [5, -1, -1, -1, -1, -1]]) == 3\n"}, "metadata": {"canonical_parameter_names": ["board"], "leetcode_dataset_entry_point": "Solution().snakesAndLadders", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var snakesAndLadders = function(board) {", "container": null, "callable": "snakesAndLadders", "parameters": [{"name": "board", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 910, "task_id": "smallest-range-ii", "difficulty": "Medium", "problem_description": "You are given an integer array nums and an integer k.\nFor each index i where 0 <= i < nums.length, change nums[i] to be either nums[i] + k or nums[i] - k.\nThe score of nums is the difference between the maximum and minimum elements in nums.\nReturn the minimum score of nums after changing the values at each index.\n \nExample 1:\n\nInput: nums = [1], k = 0\nOutput: 0\nExplanation: The score is max(nums) - min(nums) = 1 - 1 = 0.\n\nExample 2:\n\nInput: nums = [0,10], k = 2\nOutput: 6\nExplanation: Change nums to be [2, 8]. The score is max(nums) - min(nums) = 8 - 2 = 6.\n\nExample 3:\n\nInput: nums = [1,3,6], k = 3\nOutput: 3\nExplanation: Change nums to be [4, 6, 3]. The score is max(nums) - min(nums) = 6 - 3 = 3.\n\n \nConstraints:\n\n1 <= nums.length <= 104\n0 <= nums[i] <= 104\n0 <= k <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [0, 10],k = 2) == 6\n assert candidate(nums = [1, 5, 8],k = 2) == 3\n assert candidate(nums = [6, 3, 4, 7],k = 3) == 4\n assert candidate(nums = [6, 3, 2, 18, 9, 12, 3, 6, 5, 0],k = 6) == 9\n assert candidate(nums = [4, 9, 6],k = 2) == 2\n assert candidate(nums = [1, 3, 6],k = 3) == 3\n assert candidate(nums = [7, 8, 8, 10],k = 3) == 3\n assert candidate(nums = [1],k = 0) == 0\n assert candidate(nums = [4, 1, 8, 10],k = 2) == 5\n assert candidate(nums = [6, 3, 4, 2],k = 1) == 2\n assert candidate(nums = [100, 200, 300, 400, 500],k = 50) == 300\n assert candidate(nums = [30, 10, 20, 40, 50, 60],k = 15) == 20\n assert candidate(nums = [10, 15, 3, 7, 8, 12],k = 4) == 6\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990],k = 1000) == 9\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],k = 3) == 12\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120],k = 15) == 80\n assert candidate(nums = [5, 8, 12, 15, 20, 25, 30],k = 10) == 15\n assert candidate(nums = [1, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 100) == 799\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],k = 10) == 18\n assert candidate(nums = [10, 15, 20, 25, 30, 35, 40],k = 5) == 20\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],k = 50) == 90\n assert candidate(nums = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500],k = 20) == 410\n assert candidate(nums = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 1) == 8\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49, 56],k = 7) == 35\n assert candidate(nums = [8, 10, 15, 17, 20, 22, 30],k = 10) == 14\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 10) == 70\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60],k = 5) == 47\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 0) == 9\n assert candidate(nums = [100, 200, 300, 400, 500],k = 150) == 200\n assert candidate(nums = [500, 1000, 1500, 2000, 2500, 3000],k = 300) == 1900\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 1) == 7\n assert candidate(nums = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],k = 100) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 1) == 7\n assert candidate(nums = [1, 10, 100, 1000, 10000],k = 500) == 8999\n assert candidate(nums = [8, 23, 45, 12, 19, 32, 55, 60, 48, 37, 28, 17, 7, 5, 3, 1, 2, 4, 6, 9, 11, 13, 15, 18, 20, 21, 22, 24, 25, 26, 27, 29, 30, 31, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 46, 47, 49, 50],k = 8) == 43\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 300) == 500\n assert candidate(nums = [15, 10, 5, 0, 20, 25],k = 10) == 15\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990],k = 1000) == 9\n assert candidate(nums = [10000, 100, 1000, 10, 100000],k = 500) == 98990\n assert candidate(nums = [1, 10000, 2, 9999, 3, 9998, 4, 9997],k = 5000) == 7\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60],k = 10) == 37\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 1) == 12\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],k = 5) == 18\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],k = 20) == 150\n assert candidate(nums = [100, 50, 200, 150, 250],k = 75) == 100\n assert candidate(nums = [5, 8, 12, 15, 17, 20, 22, 25, 27, 30],k = 10) == 17\n assert candidate(nums = [8, 11, 12, 9, 10],k = 3) == 4\n assert candidate(nums = [20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300],k = 15) == 250\n assert candidate(nums = [15, 22, 35, 14, 7, 30],k = 10) == 13\n assert candidate(nums = [3, 5, 7, 9, 11, 13, 15, 17, 19, 21],k = 2) == 14\n assert candidate(nums = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190],k = 20) == 149\n assert candidate(nums = [10, 25, 40, 55, 70, 85, 100, 115, 130, 145, 160, 175, 190, 205, 220],k = 10) == 190\n assert candidate(nums = [100, 200, 150, 50, 250, 300],k = 75) == 100\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 0\n assert candidate(nums = [10, 10, 10, 10, 10],k = 10) == 0\n assert candidate(nums = [23, 45, 12, 78, 45, 90, 34, 56, 78, 90, 12, 34, 56, 78, 90, 12, 34, 56, 78, 90],k = 30) == 44\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 150) == 600\n assert candidate(nums = [1, 1000, 2000, 3000, 4000, 5000, 6000],k = 100) == 5799\n assert candidate(nums = [3, 7, 11, 15, 19, 23, 27, 31, 35, 39],k = 4) == 28\n assert candidate(nums = [5, 2, 11, 14, 7],k = 4) == 5\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60],k = 10) == 35\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 1) == 17\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250],k = 60) == 120\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 0) == 900\n assert candidate(nums = [15, 25, 35, 45, 55, 65, 75],k = 20) == 30\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 2) == 5\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == 0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 20) == 50\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],k = 25) == 90\n assert candidate(nums = [5, 8, 12, 15, 18, 22, 25, 28, 32, 35, 38, 42, 45, 48, 52, 55, 58, 62],k = 10) == 37\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 0) == 0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 0\n assert candidate(nums = [7, 17, 27, 37, 47, 57, 67, 77],k = 15) == 40\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],k = 2) == 14\n assert candidate(nums = [5000, 4000, 3000, 2000, 1000],k = 1000) == 2000\n assert candidate(nums = [5, 8, 12, 15, 20, 25, 30, 35],k = 3) == 24\n assert candidate(nums = [1, 100, 200, 300, 400, 500],k = 25) == 449\n assert candidate(nums = [1, 5, 10, 15, 20, 25, 30, 35, 40, 45],k = 5) == 34\n assert candidate(nums = [2, 5, 1, 8, 9, 10, 11, 12, 15, 20],k = 5) == 9\n assert candidate(nums = [10, 15, 1, 2, 11, 5, 7, 3, 13, 9],k = 4) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 9\n assert candidate(nums = [10, 15, 18, 20, 25, 30, 40, 50],k = 5) == 30\n assert candidate(nums = [5, 1, 9, 17, 13, 2, 8],k = 5) == 8\n assert candidate(nums = [100, 200, 300, 400, 500],k = 50) == 300\n assert candidate(nums = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145],k = 20) == 100\n assert candidate(nums = [1, 100, 200, 300, 400, 500],k = 50) == 399\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000],k = 2000) == 15000\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 20) == 50\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 2) == 10\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140],k = 7) == 119\n assert candidate(nums = [8, 10, 5, 11, 6, 9, 4, 12, 3, 7],k = 3) == 5\n assert candidate(nums = [100, 150, 200, 250, 300, 350, 400, 450, 500],k = 20) == 360\n assert candidate(nums = [9, 18, 27, 36, 45, 54, 63, 72, 81, 90],k = 9) == 63\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 0) == 90\n assert candidate(nums = [1000, 500, 300, 200, 400, 600, 700, 800, 900, 100],k = 50) == 800\n assert candidate(nums = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 3) == 9\n assert candidate(nums = [5, 8, 12, 15, 20, 25, 30, 35, 40, 45, 50],k = 7) == 31\n assert candidate(nums = [2, 8, 15, 18, 3, 5, 7, 10, 12, 14],k = 4) == 8\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 15) == 60\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 25) == 40\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 9980],k = 100) == 19\n assert candidate(nums = [4, 8, 15, 16, 23, 42],k = 5) == 28\n assert candidate(nums = [5, 8, 12, 16, 20, 24, 28],k = 7) == 11\n assert candidate(nums = [100, 50, 30, 20, 40, 60, 70, 80, 90, 10],k = 15) == 60\n assert candidate(nums = [9, 7, 5, 3, 1, 10, 8, 6, 4, 2],k = 1) == 7\n assert candidate(nums = [20, 1, 15, 17, 5, 13, 19, 9, 7, 11],k = 5) == 9\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],k = 10) == 75\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().smallestRangeII", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var smallestRangeII = function(nums, k) {", "container": null, "callable": "smallestRangeII", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 912, "task_id": "sort-an-array", "difficulty": "Medium", "problem_description": "Given an array of integers nums, sort the array in ascending order and return it.\nYou must solve the problem without using any built-in functions in O(nlog(n)) time complexity and with the smallest space complexity possible.\n \nExample 1:\n\nInput: nums = [5,2,3,1]\nOutput: [1,2,3,5]\nExplanation: After sorting the array, the positions of some numbers are not changed (for example, 2 and 3), while the positions of other numbers are changed (for example, 1 and 5).\n\nExample 2:\n\nInput: nums = [5,1,1,2,0,0]\nOutput: [0,0,1,1,2,5]\nExplanation: Note that the values of nums are not necessairly unique.\n\n \nConstraints:\n\n1 <= nums.length <= 5 * 104\n-5 * 104 <= nums[i] <= 5 * 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [0]) == [0]\n assert candidate(nums = [-1]) == [-1]\n assert candidate(nums = [50000]) == [50000]\n assert candidate(nums = [-50000]) == [-50000]\n assert candidate(nums = [1]) == [1]\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().sortArray", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sortArray = function(nums) {", "container": null, "callable": "sortArray", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 913, "task_id": "cat-and-mouse", "difficulty": "Hard", "problem_description": "A game on an undirected graph is played by two players, Mouse and Cat, who alternate turns.\nThe graph is given as follows: graph[a] is a list of all nodes b such that ab is an edge of the graph.\nThe mouse starts at node 1 and goes first, the cat starts at node 2 and goes second, and there is a hole at node 0.\nDuring each player's turn, they must travel along one edge of the graph that meets where they are.  For example, if the Mouse is at node 1, it must travel to any node in graph[1].\nAdditionally, it is not allowed for the Cat to travel to the Hole (node 0).\nThen, the game can end in three ways:\n\nIf ever the Cat occupies the same node as the Mouse, the Cat wins.\nIf ever the Mouse reaches the Hole, the Mouse wins.\nIf ever a position is repeated (i.e., the players are in the same position as a previous turn, and it is the same player's turn to move), the game is a draw.\n\nGiven a graph, and assuming both players play optimally, return\n\n1 if the mouse wins the game,\n2 if the cat wins the game, or\n0 if the game is a draw.\n\n \nExample 1:\n\n\nInput: graph = [[2,5],[3],[0,4,5],[1,4,5],[2,3],[0,2,3]]\nOutput: 0\n\nExample 2:\n\n\nInput: graph = [[1,3],[0],[3],[0,2]]\nOutput: 1\n\n \nConstraints:\n\n3 <= graph.length <= 50\n1 <= graph[i].length < graph.length\n0 <= graph[i][j] < graph.length\ngraph[i][j] != i\ngraph[i] is unique.\nThe mouse and the cat can always move. \n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(graph = [[3, 4], [3, 5], [3], [0, 1, 2], [0], [1]]) == 2\n assert candidate(graph = [[2, 3, 4], [3, 4], [0, 3, 4], [0, 1, 2], [0, 1, 2]]) == 2\n assert candidate(graph = [[6], [4], [9, 6], [5, 6, 7, 9], [1, 5], [3, 4], [0, 2, 3, 7], [3, 8, 9], [7], [2, 3, 6, 7]]) == 2\n assert candidate(graph = [[1, 2, 3], [0], [0], [0]]) == 1\n assert candidate(graph = [[2, 3], [2, 4], [0, 1, 5], [0], [1], [2]]) == 2\n assert candidate(graph = [[2, 5], [3], [0, 4, 5], [1, 4, 5], [2, 3], [0, 2, 3]]) == 0\n assert candidate(graph = [[1, 3], [0], [3], [0, 2]]) == 1\n assert candidate(graph = [[2, 3, 4, 5], [3, 4, 5], [0], [0, 1, 4, 5], [0, 1, 3], [0, 1, 3]]) == 0\n assert candidate(graph = [[1, 4], [0, 2, 3], [1], [1], [0]]) == 1\n assert candidate(graph = [[3, 4, 6], [5], [4, 6, 3], [0, 5, 2], [0, 2], [1, 3], [0, 2]]) == 2\n assert candidate(graph = [[1, 2], [0], [0]]) == 1\n assert candidate(graph = [[2, 3, 4], [3, 4], [0, 3], [0, 1, 4], [0, 1, 3]]) == 0\n assert candidate(graph = [[3, 4], [3, 5], [3], [0, 1, 2, 5], [0], [1, 3]]) == 2\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]) == 1\n assert candidate(graph = [[1, 2, 3, 4], [0, 2, 3, 4, 5], [0, 1, 3, 4, 5], [0, 1, 2, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 3, 4]]) == 1\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]]) == 1\n assert candidate(graph = [[1, 3, 4, 5, 6], [0, 2, 3, 4, 5, 6], [1], [0, 1, 4, 5, 6], [0, 1, 3, 5, 6], [0, 1, 3, 4, 6], [0, 1, 3, 4, 5], [8, 9], [7], [7]]) == 1\n assert candidate(graph = [[1, 2, 3, 4, 5, 6], [0, 2, 3, 4, 5, 6], [0, 1, 3, 4, 5, 6], [0, 1, 2, 4, 5, 6], [0, 1, 2, 3, 5, 6], [0, 1, 2, 3, 4, 6], [0, 1, 2, 3, 4, 5]]) == 1\n assert candidate(graph = [[1, 2, 3], [0, 4, 5], [0, 4, 5], [0, 4, 5], [1, 2, 3, 6], [1, 2, 3, 6], [4]]) == 1\n assert candidate(graph = [[1, 3, 5], [0, 2, 4, 6], [1, 3, 5, 7], [0, 2, 4, 6], [1, 3, 5, 7], [0, 2, 4, 6], [1, 3, 5, 7], [2, 4, 6]]) == 1\n assert candidate(graph = [[1, 3, 4, 5, 6], [0, 2, 4, 5, 6], [1, 3, 4, 5, 6], [0, 1, 4, 5, 6], [0, 1, 2, 3, 5, 6], [0, 1, 2, 3, 4, 6], [0, 1, 2, 3, 4, 5]]) == 1\n assert candidate(graph = [[1, 3, 5], [0, 2, 6], [1, 4, 6], [0, 4, 5], [2, 3, 6], [0, 3, 6], [1, 2, 4, 5]]) == 1\n assert candidate(graph = [[1, 3, 5, 7], [0, 2, 4, 6], [1, 3, 5, 8], [0, 2, 4, 7], [1, 3, 5, 8], [0, 2, 4, 6], [1, 5, 7, 8], [0, 4, 6, 8], [2, 4, 6, 7]]) == 1\n assert candidate(graph = [[1, 2, 3, 4], [0, 2, 3, 5], [0, 1, 4, 6], [0, 1, 5, 6], [0, 2, 6], [1, 3, 6], [2, 3, 4, 5]]) == 1\n assert candidate(graph = [[1, 3, 5], [0, 2, 4, 6], [1, 3, 5], [0, 2, 4, 6], [1, 3, 5], [0, 2, 4, 6], [1, 3, 5]]) == 1\n assert candidate(graph = [[1, 2, 4, 8], [0, 3, 6], [0, 3, 7, 8], [1, 2, 5], [0, 5, 9], [3, 4, 6, 9], [1, 5, 7], [2, 6], [0, 2], [4, 5]]) == 1\n assert candidate(graph = [[1, 5, 6], [0, 2, 3, 7, 8], [1, 3, 4, 8], [1, 2, 5, 9, 10], [2, 6], [0, 3, 11], [0, 4, 7, 11], [1, 6, 8, 10], [1, 2, 7, 9], [3, 8, 11], [3, 7, 11], [5, 6, 9, 10]]) == 1\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8], [0, 2, 3, 4, 5, 6, 7, 8], [0, 1, 3, 4, 5, 6, 7, 8], [0, 1, 2, 4, 5, 6, 7, 8], [0, 1, 2, 3, 5, 6, 7, 8], [0, 1, 2, 3, 4, 6, 7, 8], [0, 1, 2, 3, 4, 5, 7, 8], [0, 1, 2, 3, 4, 5, 6, 8], [0, 1, 2, 3, 4, 5, 6, 7]]) == 1\n assert candidate(graph = [[1, 3, 4, 5], [0, 2, 5, 6], [1, 4, 6], [0, 5, 6, 7], [0, 2], [0, 1, 3, 7], [1, 2, 3], [3, 5, 6]]) == 1\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8], [0, 2, 3, 4, 5, 6, 7, 9], [0, 1, 3, 4, 5, 6, 8, 9], [0, 1, 2, 4, 5, 7, 8, 9], [0, 1, 2, 3, 5, 6, 7, 8], [0, 1, 2, 3, 4, 6, 7, 8], [0, 1, 2, 3, 4, 5, 7, 8], [0, 1, 2, 3, 4, 5, 6, 8], [0, 1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7, 8]]) == 1\n assert candidate(graph = [[1, 2, 3, 4, 5], [0, 2, 3, 4, 5], [0, 1, 3, 4, 5], [0, 1, 2, 4, 5], [0, 1, 2, 3, 5], [0, 1, 2, 3, 4]]) == 1\n assert candidate(graph = [[1, 3, 4, 5, 6, 7, 8, 9, 10], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1], [0, 1, 4, 5, 6, 7, 8, 9, 10], [0, 1, 3, 5, 6, 7, 8, 9, 10], [0, 1, 3, 4, 6, 7, 8, 9, 10], [0, 1, 3, 4, 5, 7, 8, 9, 10], [0, 1, 3, 4, 5, 6, 8, 9, 10], [0, 1, 3, 4, 5, 6, 7, 9, 10], [0, 1, 3, 4, 5, 6, 7, 8, 10], [0, 1, 3, 4, 5, 6, 7, 8, 9]]) == 1\n assert candidate(graph = [[1, 5, 6], [0, 2, 7], [1, 3, 8], [2, 4, 9], [3, 5, 10], [0, 4, 6, 11], [0, 5, 7, 12], [1, 6, 8, 13], [2, 7, 9, 14], [3, 8, 10, 15], [4, 9, 11, 16], [5, 10, 12, 17], [6, 11, 13, 18], [7, 12, 14, 19], [8, 13, 15, 20], [9, 14, 16, 21], [10, 15, 17, 22], [11, 16, 18, 23], [12, 17, 19, 24], [13, 18, 20, 25], [14, 19, 21, 26], [15, 20, 22, 27], [16, 21, 23, 28], [17, 22, 24, 29], [18, 23, 25, 30], [19, 24, 26, 31], [20, 25, 27, 32], [21, 26, 28, 33], [22, 27, 29, 34], [23, 28, 30, 35], [24, 29, 31, 36], [25, 30, 32, 37], [26, 31, 33, 38], [27, 32, 34, 39], [28, 33, 35, 40], [29, 34, 36, 41], [30, 35, 37, 42], [31, 36, 38, 43], [32, 37, 39, 44], [33, 38, 40, 45], [34, 39, 41, 46], [35, 40, 42, 47], [36, 41, 43, 48], [37, 42, 44, 49], [38, 43, 45], [39, 44, 46], [40, 45, 47], [41, 46, 48], [42, 47, 49], [43, 48], [44, 49], [45]]) == 1\n assert candidate(graph = [[1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8]]) == 1\n assert candidate(graph = [[2, 5, 6], [3, 6, 5], [0, 3, 5], [1, 2, 5, 4], [3], [0, 1, 2, 3], [0, 1]]) == 1\n assert candidate(graph = [[1, 3, 4], [0, 2, 5], [1, 6, 7], [0, 4, 8], [0, 3, 9], [1, 6, 10], [2, 5, 11], [2, 8, 12], [3, 7, 13], [4, 10, 14], [5, 9, 11, 15], [6, 10, 12, 16], [7, 11, 13, 17], [8, 12, 14, 18], [9, 13, 15, 19], [10, 14, 16, 20], [11, 15, 17, 21], [12, 16, 18, 22], [13, 17, 19, 23], [14, 18, 20, 24], [15, 19, 21, 25], [16, 20, 22, 26], [17, 21, 23, 27], [18, 22, 24, 28], [19, 23, 25, 29], [20, 24, 26, 30], [21, 25, 27, 31], [22, 26, 28, 32], [23, 27, 29, 33], [24, 28, 30, 34], [25, 29, 31, 35], [26, 30, 32, 36], [27, 31, 33, 37], [28, 32, 34, 38], [29, 33, 35, 39], [30, 34, 36, 40], [31, 35, 37, 41], [32, 36, 38, 42], [33, 37, 39, 43], [34, 38, 40, 44], [35, 39, 41, 45], [36, 40, 42, 46], [37, 41, 43, 47], [38, 42, 44, 48], [39, 43, 45, 49], [40, 44, 46], [41, 45, 47], [42, 46, 48], [43, 47, 49], [44, 48], [45, 49], [46], [47], [48], [49]]) == 1\n assert candidate(graph = [[1, 3, 5, 7, 9], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9]]) == 1\n assert candidate(graph = [[1, 4, 5, 6, 7, 8, 9], [0, 2, 3, 4, 5, 6, 7, 8, 9], [1, 3, 4, 5, 6, 7, 8, 9], [2, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8]]) == 1\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8]]) == 1\n assert candidate(graph = [[2, 5, 7, 9], [3, 4, 8], [0, 4, 5, 6, 10], [1, 4, 5, 6, 11], [1, 2, 3, 10, 11], [0, 2, 3, 12], [2, 3, 7, 12], [0, 6, 13], [1, 13], [0, 10, 11, 13], [2, 4, 9, 12], [3, 4, 9, 12], [5, 6, 10, 11], [7, 8, 9]]) == 1\n assert candidate(graph = [[1, 2, 3], [0, 4], [0, 5], [0, 6], [1, 5, 7], [2, 4, 6, 7], [3, 5, 7], [4, 5, 6]]) == 1\n assert candidate(graph = [[1, 2, 3], [0, 2, 3, 4, 5], [0, 1, 4, 5], [0, 1, 4, 5], [1, 2, 3, 5, 6], [1, 2, 3, 4, 6], [4, 5]]) == 1\n assert candidate(graph = [[3, 5, 6], [4, 6, 5], [5, 4], [0, 5, 6], [1, 2, 6], [0, 1, 2, 3], [0, 1, 3, 4]]) == 1\n assert candidate(graph = [[1, 2, 5], [0, 3, 4], [0, 3, 4, 6], [1, 2, 5, 6], [1, 2, 6], [0, 3, 6], [2, 3, 4, 5]]) == 1\n assert candidate(graph = [[2, 3, 4, 5, 6], [2, 4, 6], [0, 1, 4, 5], [0, 4, 6, 7], [0, 1, 2, 3, 5, 6, 7], [0, 2, 4, 6], [0, 1, 3, 4, 7], [3, 4, 6]]) == 1\n assert candidate(graph = [[2, 5, 7], [3, 4], [0, 4, 5, 6], [1, 4, 5, 6], [1, 2, 3], [0, 2, 3], [2, 3, 7], [0, 6]]) == 1\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7], [0, 2, 3, 4, 5, 6, 7], [0, 1, 3, 4, 5, 6, 7], [0, 1, 2, 4, 5, 6, 7], [0, 1, 2, 3, 5, 6, 7], [0, 1, 2, 3, 4, 6, 7], [0, 1, 2, 3, 4, 5, 7], [0, 1, 2, 3, 4, 5, 6]]) == 1\n assert candidate(graph = [[1, 2, 3, 4], [0, 2, 5], [0, 1, 3, 6], [0, 2, 4, 7], [0, 3, 5, 8], [1, 4, 6, 9], [2, 5, 7, 10], [3, 6, 8, 11], [4, 7, 9, 12], [5, 8, 10, 13], [6, 9, 11, 14], [7, 10, 12, 15], [8, 11, 13, 16], [9, 12, 14, 17], [10, 13, 15, 18], [11, 14, 16, 19], [12, 15, 17, 20], [13, 16, 18, 21], [14, 17, 19, 22], [15, 18, 20, 23], [16, 19, 21, 24], [17, 20, 22, 25], [18, 21, 23, 26], [19, 22, 24, 27], [20, 23, 25, 28], [21, 24, 26, 29], [22, 25, 27, 30], [23, 26, 28, 31], [24, 27, 29, 32], [25, 28, 30, 33], [26, 29, 31, 34], [27, 30, 32, 35], [28, 31, 33, 36], [29, 32, 34, 37], [30, 33, 35, 38], [31, 34, 36, 39], [32, 35, 37, 0], [33, 36, 38, 1], [34, 37, 39, 2], [35, 38, 0, 3], [36, 39, 1, 4], [37, 0, 2, 5], [38, 1, 3, 6], [39, 2, 4, 7]]) == 1\n assert candidate(graph = [[1, 2, 5, 7, 10], [0, 3, 6, 8, 11], [0, 4, 7, 9, 12], [1, 5, 8, 10, 13], [2, 6, 9, 11, 14], [0, 3, 6, 10, 13], [1, 4, 7, 11, 14], [0, 2, 5, 8, 12], [1, 3, 6, 9, 13], [2, 4, 7, 10, 14], [0, 3, 5, 8, 12], [1, 4, 6, 9, 13], [2, 5, 7, 10, 14], [3, 6, 8, 11, 14], [4, 7, 9, 12, 13]]) == 1\n assert candidate(graph = [[1, 5, 6, 7], [0, 2, 3, 4], [1, 3, 4], [1, 2], [1, 2, 5, 7], [0, 4, 6], [0, 5, 7], [0, 4, 6]]) == 1\n assert candidate(graph = [[1, 2, 3, 4], [0, 2, 3, 5], [0, 1, 3, 4, 5, 6, 7], [0, 1, 2, 4, 5, 7], [0, 1, 2, 3, 5, 6, 7], [0, 1, 2, 3, 4, 6, 7], [2, 4, 5, 7], [2, 4, 5, 6]]) == 1\n assert candidate(graph = [[1, 4, 7], [0, 2, 5, 8], [1, 3, 6, 9], [2, 4, 7, 10], [3, 5, 8, 11], [4, 6, 9, 12], [5, 7, 10, 13], [6, 8, 11, 14], [7, 9, 12, 15], [8, 10, 13, 16], [9, 11, 14], [10, 12, 15], [11, 13, 16], [12, 14, 15], [13, 15], [14, 16], [15]]) == 1\n assert candidate(graph = [[2, 3, 4, 5, 6, 7], [8, 9, 10], [0, 3, 4, 5, 11, 12], [0, 2, 5, 6, 13], [0, 2, 6, 7, 14], [0, 2, 3, 4, 15], [0, 3, 4, 5, 16], [0, 4, 17], [1, 18], [1, 18], [1, 18], [2, 18], [2, 18], [3, 18], [4, 18], [5, 18], [6, 18], [7, 18], [8, 9, 10, 11, 12, 13, 14, 15, 16, 17]]) == 2\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 15], [2, 15], [3, 15], [4, 15], [5, 15], [6, 15], [7, 15], [8, 9, 10, 11, 12, 13, 14]]) == 1\n assert candidate(graph = [[1, 4, 5], [0, 2, 6], [1, 3, 7], [2, 4, 8], [0, 3, 9], [0, 6, 9], [1, 5, 10], [2, 8, 10], [3, 7, 10], [4, 5, 11], [6, 7, 8, 11], [9, 10]]) == 1\n assert candidate(graph = [[3, 4, 5, 6], [2, 3, 5], [1], [0, 1, 4, 5, 6, 7], [0, 3, 7], [0, 1, 3, 7, 8], [0, 3, 9], [3, 4, 5, 8, 9], [5, 7], [6, 7]]) == 1\n assert candidate(graph = [[1, 3, 5, 7], [0, 4, 6, 8], [3, 5, 7, 9], [0, 2, 6, 8], [1, 3, 7, 9], [0, 2, 6, 8], [1, 3, 5, 9], [0, 2, 4, 8], [1, 3, 5, 7], [2, 4, 6, 7]]) == 1\n assert candidate(graph = [[2, 5, 7], [3, 6, 8], [0, 4, 7], [1, 5, 9], [2, 6, 8], [0, 3, 7], [1, 4, 8], [0, 2, 5, 9], [1, 4, 6, 9], [3, 7, 8]]) == 0\n assert candidate(graph = [[2, 4, 5], [3, 5, 6], [0, 4, 6], [1, 5, 7], [0, 2], [0, 1, 3, 7], [1, 2, 7], [3, 5, 6]]) == 1\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12], [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12], [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12], [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12], [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12], [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]]) == 1\n assert candidate(graph = [[3, 4, 6, 8], [5], [4, 6, 3, 7], [0, 5, 2, 9], [0, 2, 8], [1, 3, 9], [0, 2], [2], [0], [3, 5]]) == 2\n assert candidate(graph = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 2, 11, 12, 13, 14, 15, 16, 17, 18], [0, 1, 12, 13, 14, 15, 16, 17, 18, 19], [0, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 11, 12, 13, 14, 15, 16, 17, 18, 19], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]) == 1\n assert candidate(graph = [[5, 6, 7], [2, 3], [1, 3, 6, 5, 8], [1, 2, 4], [3, 5, 7], [0, 1, 2, 4, 6, 7], [0, 2, 5], [0, 4, 5], [2]]) == 2\n"}, "metadata": {"canonical_parameter_names": ["graph"], "leetcode_dataset_entry_point": "Solution().catMouseGame", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var catMouseGame = function(graph) {", "container": null, "callable": "catMouseGame", "parameters": [{"name": "graph", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 914, "task_id": "x-of-a-kind-in-a-deck-of-cards", "difficulty": "Easy", "problem_description": "You are given an integer array deck where deck[i] represents the number written on the ith card.\nPartition the cards into one or more groups such that:\n\nEach group has exactly x cards where x > 1, and\nAll the cards in one group have the same integer written on them.\n\nReturn true if such partition is possible, or false otherwise.\n \nExample 1:\n\nInput: deck = [1,2,3,4,4,3,2,1]\nOutput: true\nExplanation: Possible partition [1,1],[2,2],[3,3],[4,4].\n\nExample 2:\n\nInput: deck = [1,1,1,2,2,2,3,3]\nOutput: false\nExplanation: No possible partition.\n\n \nConstraints:\n\n1 <= deck.length <= 104\n0 <= deck[i] < 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(deck = [1, 1, 1, 1, 2, 2, 2, 2, 2, 2]) == True\n assert candidate(deck = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]) == True\n assert candidate(deck = [1, 1, 2, 2, 2, 2]) == True\n assert candidate(deck = [1]) == False\n assert candidate(deck = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2]) == True\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(deck = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3]) == True\n assert candidate(deck = [1, 1, 1, 2, 2, 2, 3, 3]) == False\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(deck = [1, 1]) == True\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(deck = [1, 2, 3, 4, 4, 3, 2, 1]) == True\n assert candidate(deck = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(deck = [1, 2, 3, 3, 3, 3, 4, 6, 6, 6, 6, 6, 6]) == False\n assert candidate(deck = [0, 0, 0, 1, 1, 1, 2, 2, 2]) == True\n assert candidate(deck = [0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2]) == True\n assert candidate(deck = [1, 1, 1]) == True\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == True\n assert candidate(deck = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == False\n assert candidate(deck = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == True\n assert candidate(deck = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(deck = [100, 101, 100, 101, 102, 102, 103, 103, 103, 104, 104, 104, 104, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 107]) == False\n assert candidate(deck = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]) == True\n assert candidate(deck = [2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9]) == False\n assert candidate(deck = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(deck = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(deck = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990]) == True\n assert candidate(deck = [7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11]) == True\n assert candidate(deck = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10]) == True\n assert candidate(deck = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8]) == False\n assert candidate(deck = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == False\n assert candidate(deck = [1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9]) == False\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(deck = [1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6]) == False\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10]) == True\n assert candidate(deck = [1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10]) == True\n assert candidate(deck = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(deck = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18]) == True\n assert candidate(deck = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == True\n assert candidate(deck = [7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 10, 10, 10, 10]) == True\n assert candidate(deck = [1000, 1000, 1000, 1000, 1001, 1001, 1001, 1001, 1002, 1002, 1002, 1002, 1003, 1003, 1003, 1003, 1004, 1004, 1004, 1004]) == True\n assert candidate(deck = [1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(deck = [1000, 1000, 1001, 1001, 1002, 1002, 1003, 1003, 1004, 1004, 1005, 1005, 1006, 1006, 1007, 1007, 1008, 1008, 1009, 1009, 1010, 1010]) == True\n assert candidate(deck = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == False\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(deck = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20]) == True\n assert candidate(deck = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == True\n assert candidate(deck = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002]) == True\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == True\n assert candidate(deck = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == True\n assert candidate(deck = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == True\n assert candidate(deck = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(deck = [1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(deck = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == True\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(deck = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == False\n assert candidate(deck = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6]) == False\n assert candidate(deck = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6]) == True\n assert candidate(deck = [1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == False\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == True\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == True\n assert candidate(deck = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == False\n assert candidate(deck = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8]) == False\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(deck = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(deck = [1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(deck = [1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4]) == True\n assert candidate(deck = [1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == False\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9]) == True\n assert candidate(deck = [2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3]) == True\n assert candidate(deck = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7]) == False\n assert candidate(deck = [1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(deck = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == False\n assert candidate(deck = [1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == False\n assert candidate(deck = [2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(deck = [1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(deck = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == False\n assert candidate(deck = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8]) == False\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == False\n assert candidate(deck = [1, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == False\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(deck = [1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(deck = [1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == True\n assert candidate(deck = [100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108]) == True\n assert candidate(deck = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10]) == True\n assert candidate(deck = [1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10]) == False\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == True\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == True\n assert candidate(deck = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12]) == True\n assert candidate(deck = [7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10]) == True\n assert candidate(deck = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7]) == False\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(deck = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == True\n assert candidate(deck = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8]) == True\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == True\n assert candidate(deck = [1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == True\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == True\n assert candidate(deck = [1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5]) == False\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == True\n assert candidate(deck = [1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(deck = [1, 1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9]) == False\n assert candidate(deck = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11]) == True\n assert candidate(deck = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == False\n assert candidate(deck = [200, 200, 200, 201, 201, 201, 202, 202, 202, 202, 203, 203, 203, 203, 204, 204, 204, 204, 204, 204, 205, 205, 205, 205, 205, 205, 205]) == False\n assert candidate(deck = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12]) == True\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == True\n assert candidate(deck = [2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6]) == False\n assert candidate(deck = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]) == True\n"}, "metadata": {"canonical_parameter_names": ["deck"], "leetcode_dataset_entry_point": "Solution().hasGroupsSizeX", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var hasGroupsSizeX = function(deck) {", "container": null, "callable": "hasGroupsSizeX", "parameters": [{"name": "deck", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 915, "task_id": "partition-array-into-disjoint-intervals", "difficulty": "Medium", "problem_description": "Given an integer array nums, partition it into two (contiguous) subarrays left and right so that:\n\nEvery element in left is less than or equal to every element in right.\nleft and right are non-empty.\nleft has the smallest possible size.\n\nReturn the length of left after such a partitioning.\nTest cases are generated such that partitioning exists.\n \nExample 1:\n\nInput: nums = [5,0,3,8,6]\nOutput: 3\nExplanation: left = [5,0,3], right = [8,6]\n\nExample 2:\n\nInput: nums = [1,1,1,0,6,12]\nOutput: 4\nExplanation: left = [1,1,1,0], right = [6,12]\n\n \nConstraints:\n\n2 <= nums.length <= 105\n0 <= nums[i] <= 106\nThere is at least one valid answer for the given input.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 2, 4, 5]) == 1\n assert candidate(nums = [1, 2, 3, 0, 4, 5, 6, 7, 8, 9]) == 4\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2]) == 1\n assert candidate(nums = [1, 1, 1, 0, 6, 12]) == 4\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 9\n assert candidate(nums = [3, 5, 0, 0, 8, 10, 6, 12, 15]) == 4\n assert candidate(nums = [0, 0, 0, 0, 1, 1, 1, 1]) == 1\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 1\n assert candidate(nums = [10, 10, 10, 0, 10, 10, 10, 10]) == 4\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3]) == 1\n assert candidate(nums = [1, 2, 3, 0, 4, 5, 6, 7, 8]) == 4\n assert candidate(nums = [1, 1, 2, 2, 1, 1, 3, 3, 2, 2]) == 1\n assert candidate(nums = [0, 0, 0, 0, 1, 1, 1, 1, 0, 0]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5]) == 1\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 1\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 1]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 0]) == 6\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 10\n assert candidate(nums = [5, 0, 3, 8, 6]) == 3\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 1]) == 11\n assert candidate(nums = [2, 1, 3, 4, 4, 5]) == 2\n assert candidate(nums = [5, 4, 3, 2, 1, 0]) == 6\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10]) == 10\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 1\n assert candidate(nums = [3, 3, 2, 2, 3, 1, 4, 5, 6]) == 6\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10]) == 12\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums = [5, 4, 3, 2, 1, 6, 7, 8, 9, 10]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 14\n assert candidate(nums = [1, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11]) == 1\n assert candidate(nums = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == 10\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 1\n assert candidate(nums = [5, 2, 1, 3, 4, 6, 7, 8, 9, 10]) == 5\n assert candidate(nums = [2, 1, 3, 4, 3, 5, 6, 7, 8, 9]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 10, 9, 8, 7, 6]) == 1\n assert candidate(nums = [0, 2, 1, 3, 5, 4, 7, 6, 9, 8]) == 1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1]) == 20\n assert candidate(nums = [3, 3, 3, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 6\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 1\n assert candidate(nums = [7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7]) == 14\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 1\n assert candidate(nums = [10, 20, 30, 40, 50, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 15\n assert candidate(nums = [1, 0, 2, 0, 3, 0, 4, 0, 5, 0]) == 10\n assert candidate(nums = [2, 1, 2, 3, 2, 4, 5, 4, 6, 7, 8, 9, 0, 10, 11, 12]) == 13\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]) == 15\n assert candidate(nums = [1, 2, 3, 2, 3, 4, 5, 4, 5, 6]) == 1\n assert candidate(nums = [0, 1, 0, 2, 0, 3, 0, 4, 0, 5]) == 1\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 4]) == 1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 1\n assert candidate(nums = [2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 1]) == 30\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 1\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6]) == 1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums = [5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5]) == 11\n assert candidate(nums = [7, 9, 7, 8, 1, 7, 10, 13, 2, 5, 6, 7, 3, 8, 9, 10]) == 16\n assert candidate(nums = [2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 5]) == 9\n assert candidate(nums = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(nums = [2, 1, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(nums = [4, 3, 2, 1, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 10, 20, 30, 40, 50]) == 10\n assert candidate(nums = [3, 2, 5, 4, 4, 4, 1, 7, 8, 9]) == 7\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 1\n assert candidate(nums = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]) == 18\n assert candidate(nums = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 31\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 1\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 2]) == 11\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 21\n assert candidate(nums = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 20\n assert candidate(nums = [5, 6, 7, 8, 9, 10, 1, 2, 3, 4]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0]) == 15\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 1\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 18\n assert candidate(nums = [5, 1, 4, 3, 2, 6, 7, 8, 10, 9]) == 5\n assert candidate(nums = [7, 6, 5, 4, 3, 2, 1, 8, 9, 10, 11, 12, 13]) == 7\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2]) == 18\n assert candidate(nums = [1, 2, 3, 4, 5, 0, 6, 7, 8, 9]) == 6\n assert candidate(nums = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4]) == 1\n assert candidate(nums = [6, 5, 4, 3, 2, 1, 7, 8, 9, 10]) == 6\n assert candidate(nums = [5, 0, 3, 8, 6, 7, 9, 1, 2, 4, 11, 10, 12, 13, 14]) == 10\n assert candidate(nums = [9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]) == 10\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]) == 1\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 1\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums = [2, 3, 1, 4, 5, 6, 7, 8, 9]) == 3\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 1\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().partitionDisjoint", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var partitionDisjoint = function(nums) {", "container": null, "callable": "partitionDisjoint", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 916, "task_id": "word-subsets", "difficulty": "Medium", "problem_description": "You are given two string arrays words1 and words2.\nA string b is a subset of string a if every letter in b occurs in a including multiplicity.\n\nFor example, \"wrr\" is a subset of \"warrior\" but is not a subset of \"world\".\n\nA string a from words1 is universal if for every string b in words2, b is a subset of a.\nReturn an array of all the universal strings in words1. You may return the answer in any order.\n \nExample 1:\n\nInput: words1 = [\"amazon\",\"apple\",\"facebook\",\"google\",\"leetcode\"], words2 = [\"e\",\"o\"]\nOutput: [\"facebook\",\"google\",\"leetcode\"]\n\nExample 2:\n\nInput: words1 = [\"amazon\",\"apple\",\"facebook\",\"google\",\"leetcode\"], words2 = [\"lc\",\"eo\"]\nOutput: [\"leetcode\"]\n\nExample 3:\n\nInput: words1 = [\"acaac\",\"cccbb\",\"aacbb\",\"caacc\",\"bcbbb\"], words2 = [\"c\",\"cc\",\"b\"]\nOutput: [\"cccbb\"]\n\n \nConstraints:\n\n1 <= words1.length, words2.length <= 104\n1 <= words1[i].length, words2[i].length <= 10\nwords1[i] and words2[i] consist only of lowercase English letters.\nAll the strings of words1 are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words1 = ['acaac', 'cccbb', 'aacbb', 'caacc', 'bcbbb'],words2 = ['c', 'cc', 'b']) == ['cccbb']\n assert candidate(words1 = ['amazon', 'apple', 'facebook', 'google', 'leetcode'],words2 = ['e', 'o']) == ['facebook', 'google', 'leetcode']\n assert candidate(words1 = ['amazon', 'apple', 'facebook', 'google', 'leetcode'],words2 = ['lc', 'eo']) == ['leetcode']\n assert candidate(words1 = ['abcdefg', 'bcdefga', 'cdefgab', 'defgabc', 'efgabcd', 'fgabcde', 'gabcdef'],words2 = ['def', 'efg', 'fgh', 'ghi', 'hij', 'ijk', 'jkl']) == []\n assert candidate(words1 = ['abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij'],words2 = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa', 'aaaaaaaa', 'aaaaaaaaa']) == []\n assert candidate(words1 = ['hello', 'world', 'python', 'programming'],words2 = ['hello', 'world', 'helo', 'rowdl']) == []\n assert candidate(words1 = ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', 'zzzyyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbbaa'],words2 = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz', 'zyx', 'wvu', 'tsr', 'qpo', 'nml', 'kji', 'hgf', 'edc', 'baa', 'ccc', 'bb', 'aa']) == []\n assert candidate(words1 = ['aaaaaa', 'bbbbbb', 'cccccc', 'dddddd', 'eeeeee'],words2 = ['a', 'b', 'c', 'd', 'e']) == []\n assert candidate(words1 = ['aaaaaaaaaa', 'bbbbbbbbbb', 'cccccccccc', 'dddddddddd', 'eeeeeeeeee'],words2 = ['aabbccddeeffgghhii', 'bbaacceeggiikkooss', 'ccccdddddddddddddd', 'eeeeddddccccbbbaaa']) == []\n assert candidate(words1 = ['abacax', 'bacaba', 'caxaba', 'axbaca'],words2 = ['aba', 'bac', 'cab', 'abc']) == ['abacax', 'bacaba', 'caxaba', 'axbaca']\n assert candidate(words1 = ['aabbccddeeff', 'ffeeddccbb', 'aabbccddeeff', 'eeddccbb', 'bbccdd', 'ccddeeff', 'ddeeff', 'eeff', 'ff', 'ffeedd', 'eeddcc', 'bbcc', 'ccdd', 'ddeeff', 'ee', 'ff'],words2 = ['abc', 'def', 'efg', 'fgh', 'ghi', 'hij', 'ijk', 'jkl', 'klm', 'lmn', 'mno', 'nop', 'opq', 'pqr', 'qrs', 'rst', 'stu', 'tuv', 'uvw', 'vwx', 'wxy', 'xyz']) == []\n assert candidate(words1 = ['abcd', 'abdc', 'cabd', 'dabc', 'adbc'],words2 = ['aabb', 'bbcc', 'ccdd', 'aabbccdd']) == []\n assert candidate(words1 = ['unique', 'strings', 'for', 'testing', 'purposes'],words2 = ['un', 'iq', 'st', 'ri', 'gs', 'for', 'tes', 'tin', 'ing', 'pur', 'pose']) == []\n assert candidate(words1 = ['supercalifragilisticexpialidocious', 'pseudopseudohypoparathyroidism', 'floccinaucinihilipilification', 'antidisestablishmentarianism', 'honorificabilitudinitatibus'],words2 = ['super', 'pseudo', 'floccinaucinihilipilification', 'antidisestablishmentarianism', 'honorificabilitudinitatibus']) == []\n assert candidate(words1 = ['zzzzzzzzzz', 'yyyyyyyyyy', 'xxxxxxxxxx', 'wwwwwwwwww', 'vvvvvvvvvv'],words2 = ['zz', 'yy', 'xx', 'ww', 'vv']) == []\n assert candidate(words1 = ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', 'zyxwvutsrqponmlkjihgfedcba', 'bbaacckkddffgghhiijj', 'mmmnnnoooppqqrrsssttuuvvwwxx', 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz'],words2 = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz', 'abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yzab', 'cdef', 'ghij', 'klmn', 'opqr', 'stuv', 'wxyz', 'mnopqr', 'stuvwx', 'yzabcd', 'efghij', 'klmnop', 'qrstuv', 'wxyzab', 'cdefgh', 'ijklmn', 'opqrst', 'vwxyz', 'abcdefghijklmnop', 'qrstuvwxyz', 'mnopqrstuvwx', 'abcdefg', 'hijklmn', 'opqrstu', 'vwxyzab', 'cdefghij', 'klmnopqr', 'stuvwxyz', 'abcdefghijklmnopqr', 'stuvwx', 'yzabcd', 'efghij', 'klmnop', 'qrstuv', 'wxyzab', 'cdefghij', 'klmnopqr', 'stuvwxyz', 'abcdefghijklmnopqr', 'stuvwx', 'yzabcd', 'efghij', 'klmnop', 'qrstuv', 'wxyzab', 'cdefghij', 'klmnopqr', 'stuvwxyz']) == ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', 'zyxwvutsrqponmlkjihgfedcba', 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz']\n assert candidate(words1 = ['zyxwvutsrqponmlkjihgfedcba', 'qwertyuiopasdfghjklzxcvbnm', 'mnbvcxzlkjhgfdsapoiuytrewq'],words2 = ['zzz', 'yyy', 'xxx', 'www']) == []\n assert candidate(words1 = ['supercalifragilisticexpialidocious', 'pneumonoultramicroscopicsilicovolcanoconiosis', 'floccinaucinihilipilification', 'antidisestablishmentarianism'],words2 = ['super', 'cali', 'fragilistic', 'expiali', 'docious', 'pneumo', 'ultra', 'micro', 'scopic', 'silico', 'volcano', 'conio', 'sisi', 'flocci', 'nauci', 'nihili', 'pipili', 'anti', 'dis', 'establish', 'ment', 'aria', 'nism']) == []\n assert candidate(words1 = ['abcdabcdabcd', 'efefefefef', 'ghighighighi', 'jkljkljklj'],words2 = ['abcd', 'ef', 'ghi', 'jkl', 'aabbccdd']) == []\n assert candidate(words1 = ['example', 'samples', 'problems', 'challenges', 'code', 'interview'],words2 = ['e', 'm', 'p', 'l', 'e', 's', 'a', 'm', 'p', 'l', 'e', 's']) == ['samples']\n assert candidate(words1 = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz'],words2 = ['xyz', 'zyx', 'aaa', 'zzz', 'mnopqr']) == []\n assert candidate(words1 = ['aaaaa', 'bbbbbb', 'cccccc', 'dddddddd', 'eeeeeeee'],words2 = ['aa', 'bb', 'cc', 'dd', 'ee', 'abcd']) == []\n assert candidate(words1 = ['programming', 'coding', 'debugging', 'optimization', 'algorithm'],words2 = ['gram', 'code', 'debug', 'algo', 'opti']) == []\n assert candidate(words1 = ['aaaaaaaaaa', 'bbbbbbbbbb', 'cccccccccc', 'dddddddddd', 'eeeeeeeeee', 'ffffffffff', 'gggggggggg', 'hhhhhhhhhh', 'iiiiiiiiii', 'jjjjjjjjjj'],words2 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh', 'ii', 'jj', 'aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff', 'ggg', 'hhh', 'iii', 'jjj', 'aaaa', 'bbbb', 'cccc', 'dddd', 'eeee', 'ffff', 'gggg', 'hhhh', 'iiii', 'jjjj', 'aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee', 'fffff', 'ggggg', 'hhhhh', 'iiiii', 'jjjjj']) == []\n assert candidate(words1 = ['quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dogs'],words2 = ['qu', 'ck', 'bro', 'wn', 'fox', 'jum', 'ps', 'ove', 'r', 'laz', 'y', 'dog', 's']) == []\n assert candidate(words1 = ['abacabacab', 'bacabacaba', 'cabcabcabc', 'ababcabcab', 'bcabcabcab'],words2 = ['abac', 'bcab', 'cabc', 'abcabc']) == ['abacabacab', 'bacabacaba', 'cabcabcabc', 'ababcabcab', 'bcabcabcab']\n assert candidate(words1 = ['abacabadaba', 'bacbab', 'cab', 'abcabcabcabcabc', 'bcabcabcabcabcab'],words2 = ['ab', 'ba', 'abc', 'cba', 'bca']) == ['abacabadaba', 'bacbab', 'cab', 'abcabcabcabcabc', 'bcabcabcabcabcab']\n assert candidate(words1 = ['internationalization', 'universality', 'generalization', 'specificity'],words2 = ['inter', 'nation', 'alize']) == ['internationalization', 'generalization']\n assert candidate(words1 = ['aabbccddeeffgghhii', 'bbaacceeggiikkooss', 'ccccdddddddddddddd', 'eeeeddddccccbbbaaa'],words2 = ['abcdefghi', 'ijklmnopq', 'qrstuvwxyz', 'mnopqrstuvwxyz', 'vwxyzuvwxy', 'stuvwxyzstuvwx', 'rstuvwrstuvw', 'qrsrtqrsrstq']) == []\n assert candidate(words1 = ['abababa', 'bbbbbbb', 'acacaca', 'cacacac', 'abcabcabc'],words2 = ['aab', 'bb', 'ac', 'aaa']) == ['abcabcabc']\n assert candidate(words1 = ['xylophone', 'piano', 'guitar', 'drum', 'violin'],words2 = ['x', 'y', 'p', 'i', 'o']) == []\n assert candidate(words1 = ['aaaaaaaaaa', 'bbbbbbbbbb', 'cccccccccc', 'dddddddddd', 'eeeeeeeeee'],words2 = ['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy']) == []\n assert candidate(words1 = ['xyzz', 'xyzy', 'zzxy', 'zyxz', 'xzzy'],words2 = ['xyz', 'zz', 'xy', 'zyx']) == ['xyzz', 'zzxy', 'zyxz', 'xzzy']\n assert candidate(words1 = ['abracadabra', 'supercalifragilisticexpialidocious', 'antidisestablishmentarianism', 'honorificabilitudinitatibus', 'pneumonoultramicroscopicsilicovolcanoconiosis'],words2 = ['abra', 'supercali', 'disestablish', 'honorifica', 'pneumono', 'microscopic', 'silicovolcano', 'coniosis']) == []\n assert candidate(words1 = ['unique', 'words', 'arrays', 'strings', 'characters'],words2 = ['unique', 'words', 'strings', 'chars', 'arrays']) == []\n assert candidate(words1 = ['aabbccddeeff', 'bbccddeeffgg', 'ccddeeffgghh', 'ddeeffgghhiijj', 'eeffgghhiijjkk'],words2 = ['abc', 'bcd', 'cde', 'def', 'efg']) == []\n assert candidate(words1 = ['xenodochial', 'quisquillious', 'floccinaucinihilipilification', 'antidisestablishmentarianism', 'supercalifragilisticexpialidocious'],words2 = ['xeno', 'dox', 'chial', 'qui', 'squillious', 'floc', 'cinau', 'cinhi', 'lili', 'pipili', 'anti', 'dis', 'est', 'abe', 'lish', 'ment', 'aria', 'nism', 'super', 'cali', 'fragilistic', 'expiali', 'docious']) == []\n assert candidate(words1 = ['abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz'],words2 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == ['abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz']\n assert candidate(words1 = ['abcdefghijklmnop', 'bcdefghijklmno', 'cdefghijklmnop', 'defghijklmnopq', 'efghijklmnopqr'],words2 = ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh', 'ghi', 'hij', 'ijk', 'jkl', 'klm', 'lmn', 'mno', 'nop', 'opq', 'pqr']) == []\n assert candidate(words1 = ['aabb', 'ccdd', 'eefg', 'hhiijj', 'kkll', 'mmnn', 'oopp', 'qqrr', 'sstt', 'uuvv', 'wwxx', 'yyzz'],words2 = ['aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh', 'ii', 'jj', 'kk', 'll', 'mm', 'nn', 'oo', 'pp', 'qq', 'rr', 'ss', 'tt', 'uu', 'vv', 'ww', 'xx', 'yy', 'zz']) == []\n assert candidate(words1 = ['supercalifragilisticexpialidocious', 'antidisestablishmentarianism', 'honorificabilitudinitatibus', 'pneumonoultramicroscopicsilicovolcanoconiosis'],words2 = ['super', 'califragilistic', 'expialidocious', 'anti', 'establishment', 'arianism', 'honorificabilitudinitatibus', 'pneumonoultramicroscopicsilicovolcanoconiosis']) == []\n assert candidate(words1 = ['abcd', 'abdc', 'dabc', 'cabd', 'bcad'],words2 = ['a', 'b', 'c', 'd', 'ab', 'bc', 'cd', 'da', 'ac', 'bd', 'dc', 'ad', 'ba', 'cb']) == ['abcd', 'abdc', 'dabc', 'cabd', 'bcad']\n assert candidate(words1 = ['hello', 'world', 'python', 'programming', 'code', 'challenge'],words2 = ['hello', 'world', 'python', 'programming', 'code', 'challenge', 'cpp', 'java', 'javascript', 'ruby', 'swift', 'go', 'rust', 'typescript', 'php']) == []\n assert candidate(words1 = ['this', 'is', 'a', 'complex', 'testcase'],words2 = ['this', 'is', 'a', 'complex', 'test', 'case']) == []\n assert candidate(words1 = ['aabb', 'ccdd', 'eeff', 'gghh', 'iijj', 'kkll', 'mmnn', 'oopp', 'qqrr', 'sstt', 'uuvv', 'wwxx', 'yyzz'],words2 = ['ab', 'cd', 'ef', 'gh', 'ij', 'kl', 'mn', 'op', 'qr', 'st', 'uv', 'wx', 'yz', 'aab', 'ccd', 'eeff', 'gghh', 'iijj', 'kkll', 'mmnn', 'oopp', 'qqrr', 'sstt', 'uuvv', 'wwxx', 'yyzz']) == []\n assert candidate(words1 = ['universe', 'galaxy', 'cosmos', 'planet', 'star', 'nebula'],words2 = ['u', 'v', 'e', 'r', 's', 'e']) == ['universe']\n assert candidate(words1 = ['zzzzzzzzzz', 'yyyyyyyyyy', 'xxxxxxxxxx', 'wwwwwwwwww', 'vvvvvvvvvv', 'uuuuuuuuuu'],words2 = ['zzzzz', 'yyyyy', 'xxxxx', 'wwwww', 'vvvvv', 'uuuuu']) == []\n assert candidate(words1 = ['alphabet', 'brazil', 'critical', 'dynamic', 'economic'],words2 = ['a', 'b', 'c', 'd', 'e']) == []\n assert candidate(words1 = ['mississippi', 'elephant', 'alligator', 'hippopotamus'],words2 = ['issi', 'lpha', 'gat', 'popo', 'tamu', 'hipo']) == []\n assert candidate(words1 = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz'],words2 = ['zyxwvutsrqponmlkjihgfedcba', 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz']) == ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz']\n assert candidate(words1 = ['aaaabbbbccccddddeeeeffffgggghhhhiiii', 'jjjjkkkkllllmmmmnnnnooooppppqqqqrrrrssssttttuuuuvvvvwwwwwxxxxxyyyyyzzzzz'],words2 = ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh', 'ghi', 'hij', 'ijk', 'jkl', 'klm', 'lmn', 'mno', 'nop', 'opq', 'pqr', 'qrs', 'rst', 'stu', 'tuv', 'uvw', 'vwx', 'wxy', 'xyz']) == []\n assert candidate(words1 = ['abacaxi', 'manga', 'naruto', 'onepiece', 'dragonball'],words2 = ['aba', 'nan', 'ope', 'dra']) == []\n assert candidate(words1 = ['abcdefghijk', 'bcdefghijkl', 'cdefghijklm', 'defghijklmn', 'efghijklmno'],words2 = ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh', 'ghi', 'hij', 'ijk', 'jkl', 'klm', 'lmn', 'mno']) == []\n assert candidate(words1 = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'example', 'universal', 'programming'],words2 = ['abc', 'xyz', 'mnop', 'qrst']) == ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba']\n assert candidate(words1 = ['zebra', 'elephant', 'giraffe', 'hippopotamus', 'antelope'],words2 = ['e', 'ee', 'alp', 'h']) == ['elephant']\n assert candidate(words1 = ['aaaaaaaaaa', 'bbbbbbbbbb', 'cccccccccc', 'dddddddddd', 'eeeeeeeeee'],words2 = ['abc', 'bcd', 'cde', 'def', 'efg']) == []\n assert candidate(words1 = ['programming', 'python', 'java', 'csharp', 'javascript', 'ruby'],words2 = ['pro', 'gram', 'ming', 'py', 'th', 'on', 'java', 'script', 'ruby', 'csharp']) == []\n assert candidate(words1 = ['abcdefghijklmnopqrstuvwxyz', 'zzzzzzzzzz', 'aaaaaaaaaa', 'bbbbbbbbbb'],words2 = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == ['abcdefghijklmnopqrstuvwxyz']\n assert candidate(words1 = ['this', 'is', 'a', 'test', 'of', 'subset', 'matching'],words2 = ['is', 'a', 'test', 'this', 'of', 'subset', 'matching', 'mm', 'ss', 'tt', 'ee']) == []\n assert candidate(words1 = ['mnopqrstuvwxyza', 'nopqrstuvwxyzb', 'opqrstuvwxyzc', 'pqrstuvwxyzd', 'qrstuvwxyze', 'rstuvwxyzf', 'stuvwxy zg', 'tuvwxyzh', 'uvwxyzi', 'vwxyzj', 'wxyzk', 'xyzl', 'yzm', 'zno', 'opq', 'rst', 'uvw', 'xyz'],words2 = ['mnop', 'qrst', 'uvwx', 'yz', 'no', 'pq', 'rs', 'tu', 'vw', 'xy', 'z']) == ['mnopqrstuvwxyza']\n assert candidate(words1 = ['data', 'science', 'machine', 'learning', 'artificial'],words2 = ['data', 'art', 'sci', 'learn']) == []\n assert candidate(words1 = ['onomatopoeia', 'panegyric', 'philanthropy', 'antidisestablishmentarianism', 'supercalifragilisticexpialidocious'],words2 = ['ono', 'mat', 'peo', 'poe', 'i', 'pa', 'ne', 'gy', 'ric', 'ph', 'ila', 'nth', 'ropy', 'dis', 'anti', 'est', 'abe', 'lish', 'ment', 'aria', 'nism', 'super', 'cali', 'fragilistic', 'expiali', 'docious']) == []\n assert candidate(words1 = ['aaaaaaaa', 'bbbbbbbb', 'cccccccc', 'dddddddd', 'eeeeeeee', 'ffffffff'],words2 = ['a', 'b', 'c', 'd', 'e', 'f', 'aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff', 'aaaa', 'bbbb', 'cccc', 'dddd', 'eeee', 'ffff']) == []\n assert candidate(words1 = ['characterization', 'representation', 'classification', 'standardization'],words2 = ['char', 'act', 'repre', 'sent', 'class', 'stan', 'dard', 'iz']) == []\n assert candidate(words1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],words2 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == []\n assert candidate(words1 = ['zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz'],words2 = ['zzzz', 'zzzzz', 'zzzzzz', 'zzzzzzz']) == ['zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz']\n assert candidate(words1 = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz'],words2 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == []\n assert candidate(words1 = ['zzzzzzzzzz', 'zzzzzzzzz', 'zzzzzzzz', 'zzzzzzz', 'zzzzzz', 'zzzzz', 'zzzz', 'zzz', 'zz', 'z'],words2 = ['zzzzzzzzzz', 'zzzzzzzzz', 'zzzzzzzz', 'zzzzzzz', 'zzzzzz', 'zzzzz', 'zzzz', 'zzz', 'zz', 'z']) == ['zzzzzzzzzz']\n assert candidate(words1 = ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', 'zyxwvutsrqponmlkjihgfedcba', 'abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yz'],words2 = ['az', 'bx', 'cy', 'dw', 'ev', 'fu', 'gt', 'hs', 'ir', 'jq', 'kp', 'lo', 'mn', 'op', 'qr', 'st', 'uv', 'wx', 'yz']) == ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', 'zyxwvutsrqponmlkjihgfedcba']\n"}, "metadata": {"canonical_parameter_names": ["words1", "words2"], "leetcode_dataset_entry_point": "Solution().wordSubsets", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var wordSubsets = function(words1, words2) {", "container": null, "callable": "wordSubsets", "parameters": [{"name": "words1", "type": "string[]"}, {"name": "words2", "type": "string[]"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 917, "task_id": "reverse-only-letters", "difficulty": "Easy", "problem_description": "Given a string s, reverse the string according to the following rules:\n\nAll the characters that are not English letters remain in the same position.\nAll the English letters (lowercase or uppercase) should be reversed.\n\nReturn s after reversing it.\n \nExample 1:\nInput: s = \"ab-cd\"\nOutput: \"dc-ba\"\nExample 2:\nInput: s = \"a-bC-dEf-ghIj\"\nOutput: \"j-Ih-gfE-dCba\"\nExample 3:\nInput: s = \"Test1ng-Leet=code-Q!\"\nOutput: \"Qedo1ct-eeLg=ntse-T!\"\n\n \nConstraints:\n\n1 <= s.length <= 100\ns consists of characters with ASCII values in the range [33, 122].\ns does not contain '\\\"' or '\\\\'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"s-123-p\") == \"p-123-s\"\n assert candidate(s = \"Test1ng-Leet=code-Q!\") == \"Qedo1ct-eeLg=ntse-T!\"\n assert candidate(s = \"-a-b-\") == \"-b-a-\"\n assert candidate(s = \"a-bC-dEf-ghIj\") == \"j-Ih-gfE-dCba\"\n assert candidate(s = \"A-b-C-d-E\") == \"E-d-C-b-A\"\n assert candidate(s = \"12345\") == \"12345\"\n assert candidate(s = \"!@#$%^&*()\") == \"!@#$%^&*()\"\n assert candidate(s = \"ab-cd\") == \"dc-ba\"\n assert candidate(s = \"abcdefg\") == \"gfedcba\"\n assert candidate(s = \"!@#$%^&*()_+-=[]{}|\\:;'<>,.?/1234567890\") == \"!@#$%^&*()_+-=[]{}|\\:;'<>,.?/1234567890\"\n assert candidate(s = \"P@y-P@l\") == \"l@P-y@P\"\n assert candidate(s = \"UPPERlower123\") == \"rewolREPPU123\"\n assert candidate(s = \"a-bC-dEf-ghIj-kLmNoP-qRsTuV-wXyZ\") == \"Z-yX-wVu-TsRq-PoNmLk-jIhgfE-dCba\"\n assert candidate(s = \"!a-bC-dEf-ghIj!\") == \"!j-Ih-gfE-dCba!\"\n assert candidate(s = \"a-zA-Z0-9\") == \"Z-Az-a0-9\"\n assert candidate(s = \"No lemon, no melon\") == \"no lemon, no meloN\"\n assert candidate(s = \"Z-y-x-W-v-U-t-S-r-Q-p-O-n-M-l-K-j-I-h-G-f-E-d-C-b-A\") == \"A-b-C-d-E-f-G-h-I-j-K-l-M-n-O-p-Q-r-S-t-U-v-W-x-y-Z\"\n assert candidate(s = \"M-r-2-0-D-1-E-3-N-o-5-r-7-L-8-e-9-t-0-s-1-w-2-e-3-r-4-q-5-u-6-i-7-o-8-n-9-D-0\") == \"D-n-2-0-o-1-i-3-u-q-5-r-7-e-8-w-9-s-0-t-1-e-2-L-3-r-4-o-5-N-6-E-7-D-8-r-9-M-0\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\") == \"ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba\"\n assert candidate(s = \"Reverse!This@String#With$Non%Letters^In&It*\") == \"tInIsre!tteL@noNhti#Wgni$rtS%sihTesr^ev&eR*\"\n assert candidate(s = \"a!b@c#d$e%f^g&h*i(j)k-l+m,n/o\\p;q:rt?u.v[w]x{y}z|\") == \"z!y@x#w$v%u^t&s*r(q)p-o+n,m/l\\k;j:ig?f.e[d]c{b}a|\"\n assert candidate(s = \"Hello, World!\") == \"dlroW, olleH!\"\n assert candidate(s = \"1234567890qwertyuiopasdfghjklzxcvbnm-=-+=!@#$%^&*()\") == \"1234567890mnbvcxzlkjhgfdsapoiuytrewq-=-+=!@#$%^&*()\"\n assert candidate(s = \"Python3.9\") == \"nohtyP3.9\"\n assert candidate(s = \"aAaAaAaAaA\") == \"AaAaAaAaAa\"\n assert candidate(s = \"a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z\") == \"z-y-x-w-v-u-t-s-r-q-p-o-n-m-l-k-j-i-h-g-f-e-d-c-b-a\"\n assert candidate(s = \"A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z\") == \"Z-Y-X-W-V-U-T-S-R-Q-P-O-N-M-L-K-J-I-H-G-F-E-D-C-B-A\"\n assert candidate(s = \"Ae-IoU-aeiou-1-2-3-4-5-6-7-8-9-0\") == \"uo-iea-UoIeA-1-2-3-4-5-6-7-8-9-0\"\n assert candidate(s = \"P3r#G4m!n@G\") == \"G3n#m4G!r@P\"\n assert candidate(s = \"--aZ--\") == \"--Za--\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ\") == \"ZYXWVUTSRQPONMLKJIHGFEDCBA-zyxwvutsrqponmlkjihgfedcba\"\n assert candidate(s = \"A man, a plan, a canal: Panama\") == \"a man, a Plan, a canal: panamA\"\n assert candidate(s = \"Z-y-x-W-v-U-t-S-r-Q-p-O-n-M-l-K-j-I-h-G-f-E-d-C-b-A-1-2-3\") == \"A-b-C-d-E-f-G-h-I-j-K-l-M-n-O-p-Q-r-S-t-U-v-W-x-y-Z-1-2-3\"\n assert candidate(s = \"No'Matter'How'Hard'You'Try\") == \"yr'TuoYdr'aHw'oHre'tta'MoN\"\n assert candidate(s = \"aA-bB-cC-dD-eE-fF-gG-hH-iI-jJ-kK-lL-mM-nN-oO-pP-qQ-rR-sS-tT-uU-vV-wW-xX-yY-zZ\") == \"Zz-Yy-Xx-Ww-Vv-Uu-Tt-Ss-Rr-Qq-Pp-Oo-Nn-Mm-Ll-Kk-Jj-Ii-Hh-Gg-Ff-Ee-Dd-Cc-Bb-Aa\"\n assert candidate(s = \"aBcDeFgHiJkLmNoPqRsTuVwXyZ\") == \"ZyXwVuTsRqPoNmLkJiHgFeDcBa\"\n assert candidate(s = \"a-bC-dEf-ghIj-kLmNoP\") == \"P-oN-mLk-jIhg-fEdCba\"\n assert candidate(s = \"7_28hT!@#%$q9\") == \"7_28qT!@#%$h9\"\n assert candidate(s = \"---abcXYZ---\") == \"---ZYXcba---\"\n assert candidate(s = \"H2O-is-a-good-solvent\") == \"t2n-ev-l-osdo-ogasiOH\"\n assert candidate(s = \"123-abc-456-def-789\") == \"123-fed-456-cba-789\"\n assert candidate(s = \"Hello-World!!!\") == \"dlroW-olleH!!!\"\n assert candidate(s = \"N0-Sc3n4r10-1-f0r-R3v3rs1ng\") == \"g0-ns3r4v10-1-R0r-f3r3nc1SN\"\n assert candidate(s = \"1234567890qwertyuiopasdfghjklzxcvbnm\") == \"1234567890mnbvcxzlkjhgfdsapoiuytrewq\"\n assert candidate(s = \"A1B!C2@D3#E4$F5%G6^H7&I8*J9(L0)\") == \"L1J!I2@H3#G4$F5%E6^D7&C8*B9(A0)\"\n assert candidate(s = \"mIxEd-CaSe-123-!@#\") == \"eSaCd-ExIm-123-!@#\"\n assert candidate(s = \"12345!@#$%\") == \"12345!@#$%\"\n assert candidate(s = \"a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z!@#$%^&*()\") == \"z-y-x-w-v-u-t-s-r-q-p-o-n-m-l-k-j-i-h-g-f-e-d-c-b-a!@#$%^&*()\"\n assert candidate(s = \"a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z-0-9-8-7-6-5-4-3-2-1\") == \"z-y-x-w-v-u-t-s-r-q-p-o-n-m-l-k-j-i-h-g-f-e-d-c-b-a-0-9-8-7-6-5-4-3-2-1\"\n assert candidate(s = \"--a--b--\") == \"--b--a--\"\n assert candidate(s = \"rE9-!vA5#xY2$\") == \"Yx9-!Av5#Er2$\"\n assert candidate(s = \"7_8A-9B-10C-11D\") == \"7_8D-9C-10B-11A\"\n assert candidate(s = \"NoLettersHere123\") == \"ereHsretteLoN123\"\n assert candidate(s = \"a1B2C3D4E5F6G7H8I9J0\") == \"J1I2H3G4F5E6D7C8B9a0\"\n assert candidate(s = \"T1h2i3s4I5s6t7h8e9F1i2n3a4l5T6e7s8t9C0a5s6e7\") == \"e1s2a3C4t5s6e7T8l9a1n2i3F4e5h6t7s8I9s0i5h6T7\"\n assert candidate(s = \"P@y-2-P@l-1-O!n-0-G!a-5-p%e+L-4-5-h%6-.\") == \"h@L-2-e@p-1-a!G-0-n!O-5-l%P+y-4-5-P%6-.\"\n assert candidate(s = \"z-a-y-b-x-c-w-d-v-e-u-t-s-r-q-p-o-n-m-l-k-j-i-h-g-f-e-d-c-b-a\") == \"a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-e-v-d-w-c-x-b-y-a-z\"\n assert candidate(s = \"M-2y-3r-4o-5p\") == \"p-2o-3r-4y-5M\"\n assert candidate(s = \"M-i-c-r-o-s-o-f-t-2-0-2-3\") == \"t-f-o-s-o-r-c-i-M-2-0-2-3\"\n assert candidate(s = \"A1B2C3D4E5\") == \"E1D2C3B4A5\"\n assert candidate(s = \"p-yt_h-nm_g-f_d-c_b-a\") == \"a-bc_d-fg_m-n_h-t_y-p\"\n assert candidate(s = \"a1B2C3d4E5f6G7H8\") == \"H1G2f3E4d5C6B7a8\"\n assert candidate(s = \"123abc-456def-789ghi\") == \"123ihg-456fed-789cba\"\n assert candidate(s = \"x-89y-76z-54w-32v-10u\") == \"u-89v-76w-54z-32y-10x\"\n assert candidate(s = \"a-bC-dEf-ghIj-kLmNoP-qRstUv-wXyz\") == \"z-yX-wvU-tsRq-PoNmLk-jIhgfE-dCba\"\n assert candidate(s = \"12345-abc-67890\") == \"12345-cba-67890\"\n assert candidate(s = \"!@#$%^&*()_+\") == \"!@#$%^&*()_+\"\n assert candidate(s = \"Z-y-x-w-v-u-t-s-r-q-p-o-n-m-l-k-j-i-h-g-f-e-d-c-b-a-Z\") == \"Z-a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-Z\"\n assert candidate(s = \"a1B2c3D4e5F6g7h8i9j0\") == \"j1i2h3g4F5e6D7c8B9a0\"\n assert candidate(s = \"12345-abc!def@gh#ij$kl%mn^op&q*r(s)t+u-v+w,x-y.z/\") == \"12345-zyx!wvu@ts#rq$po%nm^lk&j*i(h)g+f-e+d,c-b.a/\"\n assert candidate(s = \"Zebra-123-Quokka\") == \"akkou-123-QarbeZ\"\n assert candidate(s = \"-a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z-\") == \"-z-y-x-w-v-u-t-s-r-q-p-o-n-m-l-k-j-i-h-g-f-e-d-c-b-a-\"\n assert candidate(s = \"NoChangeHere\") == \"ereHegnahCoN\"\n assert candidate(s = \"1234567890\") == \"1234567890\"\n assert candidate(s = \"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz\") == \"zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA\"\n assert candidate(s = \"--hello-+++world---\") == \"--dlrow-+++olleh---\"\n assert candidate(s = \"M4ng0_Le3t!\") == \"t4eL0_gn3M!\"\n assert candidate(s = \"The quick brown fox jumps over the lazy dog. 123\") == \"god yzale htrev osp mujxo fnwo rbk ciuq ehT. 123\"\n assert candidate(s = \"Z-a-Y-b-X-c-W-d-V-e-U-f-T-g-S-h-R-i-Q-j-P-k-L-m-N-o-M-l-K-j-I-h-G-f-E-d-C-b-A\") == \"A-b-C-d-E-f-G-h-I-j-K-l-M-o-N-m-L-k-P-j-Q-i-R-h-S-g-T-f-U-e-V-d-W-c-X-b-Y-a-Z\"\n assert candidate(s = \"12345abc!@#def$%^ghi&*()\") == \"12345ihg!@#fed$%^cba&*()\"\n assert candidate(s = \"a-bC-dEf-ghIj-klMnOp-QrStUv-WxYz\") == \"z-Yx-WvU-tSrQ-pOnMlk-jIhgfE-dCba\"\n assert candidate(s = \"a!b@c#d$e%f^g&h*i(j)k_l+m-n+o*p*q*r-s*t*u*v*w*x*y*z\") == \"z!y@x#w$v%u^t&s*r(q)p_o+n-m+l*k*j*i-h*g*f*e*d*c*b*a\"\n assert candidate(s = \"---\") == \"---\"\n assert candidate(s = \"sToP-If-YoU-CaN\") == \"NaCU-oY-fIP-oTs\"\n assert candidate(s = \"Test1ng-Leet=code-Q!!@#\") == \"Qedo1ct-eeLg=ntse-T!!@#\"\n assert candidate(s = \"123-abc-456-def\") == \"123-fed-456-cba\"\n assert candidate(s = \"H-e-l-l-o-,-W-o-r-l-d-!\") == \"d-l-r-o-W-,-o-l-l-e-H-!\"\n assert candidate(s = \"!@#$%^&*()_+-=[]{}|;':,.<>?\") == \"!@#$%^&*()_+-=[]{}|;':,.<>?\"\n assert candidate(s = \"a-bC-dEf-ghIj-kLmNoP-qRsTuVwXyZ\") == \"Z-yX-wVu-TsRq-PoNmLk-jIhgfEdCba\"\n assert candidate(s = \"A-man,a-plan,a-canal-Panama!\") == \"a-man,a-Plan,a-canal-panamA!\"\n assert candidate(s = \"123--abcXYZ!\") == \"123--ZYXcba!\"\n assert candidate(s = \"Python3.8\") == \"nohtyP3.8\"\n assert candidate(s = \"M-k-e-e-t-i-n-g-2-0-2-3\") == \"g-n-i-t-e-e-k-M-2-0-2-3\"\n assert candidate(s = \"a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z-A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z\") == \"Z-Y-X-W-V-U-T-S-R-Q-P-O-N-M-L-K-J-I-H-G-F-E-D-C-B-A-z-y-x-w-v-u-t-s-r-q-p-o-n-m-l-k-j-i-h-g-f-e-d-c-b-a\"\n assert candidate(s = \"a-zA-Z0-9!@#$%^&*()_+=-\") == \"Z-Az-a0-9!@#$%^&*()_+=-\"\n assert candidate(s = \"A1B2C3D4E5F6G7H8I9J0\") == \"J1I2H3G4F5E6D7C8B9A0\"\n assert candidate(s = \"Reverse-This-String-123\") == \"gnirtSs-ihTe-sreveR-123\"\n assert candidate(s = \"M-I-L-O-N\") == \"N-O-L-I-M\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().reverseOnlyLetters", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var reverseOnlyLetters = function(s) {", "container": null, "callable": "reverseOnlyLetters", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 918, "task_id": "maximum-sum-circular-subarray", "difficulty": "Medium", "problem_description": "Given a circular integer array nums of length n, return the maximum possible sum of a non-empty subarray of nums.\nA circular array means the end of the array connects to the beginning of the array. Formally, the next element of nums[i] is nums[(i + 1) % n] and the previous element of nums[i] is nums[(i - 1 + n) % n].\nA subarray may only include each element of the fixed buffer nums at most once. Formally, for a subarray nums[i], nums[i + 1], ..., nums[j], there does not exist i <= k1, k2 <= j with k1 % n == k2 % n.\n \nExample 1:\n\nInput: nums = [1,-2,3,-2]\nOutput: 3\nExplanation: Subarray [3] has maximum sum 3.\n\nExample 2:\n\nInput: nums = [5,-3,5]\nOutput: 10\nExplanation: Subarray [5,5] has maximum sum 5 + 5 = 10.\n\nExample 3:\n\nInput: nums = [-3,-2,-3]\nOutput: -2\nExplanation: Subarray [-2] has maximum sum -2.\n\n \nConstraints:\n\nn == nums.length\n1 <= n <= 3 * 104\n-3 * 104 <= nums[i] <= 3 * 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, -2, 3, -2]) == 3\n assert candidate(nums = [10, -2, 5, 1, -4, 3, -1]) == 16\n assert candidate(nums = [2, 3, -4, 5, 7]) == 17\n assert candidate(nums = [5, -3, 5]) == 10\n assert candidate(nums = [3, -1, 2, -1]) == 4\n assert candidate(nums = [2, -2, 2, 7]) == 11\n assert candidate(nums = [-1, -2, -3, 4]) == 4\n assert candidate(nums = [9, -4, 7, 3, -2]) == 17\n assert candidate(nums = [10, 0, 3, 5, -10, 2, 4]) == 24\n assert candidate(nums = [1, 2, 3, 4, 5]) == 15\n assert candidate(nums = [-1, -2, -3, -4]) == -1\n assert candidate(nums = [1, -4, 7, 2]) == 10\n assert candidate(nums = [-1, -2, -3, -4, -5]) == -1\n assert candidate(nums = [9, -4, 7, 2, -1]) == 17\n assert candidate(nums = [-3, -2, -3]) == -2\n assert candidate(nums = [100, -1, -2, -3, -4, -5, -6, -7, -8, -9, 100, 100, -200, 100, 100]) == 455\n assert candidate(nums = [-10, -20, -30, 15, 20, 25, -10, -5]) == 60\n assert candidate(nums = [5, -3, 5, -2, 3, -4, 7, -6, 8, -1]) == 18\n assert candidate(nums = [3, -1, 4, -1, 5, -9, 2, 6, -3, 8]) == 23\n assert candidate(nums = [10, -3, 4, -2, -1, 10, -10, 5, 6, -5, 2]) == 26\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 55\n assert candidate(nums = [2, 4, -2, -3, 8]) == 14\n assert candidate(nums = [1, 2, 3, -6, 4, 5, 6, -10, 7, 8, 9]) == 39\n assert candidate(nums = [1, 2, 3, 4, 5, -20, 1, 2, 3, 4, 5, -20, 1, 2, 3, 4, 5]) == 30\n assert candidate(nums = [3, -2, 2, 5, -3]) == 8\n assert candidate(nums = [1, -10, 3, 4, -2, 5]) == 11\n assert candidate(nums = [100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]) == 100\n assert candidate(nums = [-2, 4, -3, 5, 1, -5, 3, -1, 2, 4, -5]) == 10\n assert candidate(nums = [-1, -1, -1, -1, -1, 100, -1, -1, -1, -1]) == 100\n assert candidate(nums = [-5, -1, -8, 2, 6, -3, 4, 2, -8, 3, 7]) == 13\n assert candidate(nums = [-1, 4, -2, 3, -2, 4, -2, 3, -1, 2, -5, 6]) == 14\n assert candidate(nums = [2, 3, -4, 5, 7, 1, -1, -3, 4]) == 18\n assert candidate(nums = [8, -1, 3, -4, 3, 2, -2, 5, 7, -4, 5, -2, 1, 2, -1, 3, 4, -3, 4, -1, -2, 1, 5]) == 37\n assert candidate(nums = [-1, -2, -3, 20, -1, -2, -3, 20, -1, -2, -3, 20]) == 48\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4]) == 4\n assert candidate(nums = [1, 2, 3, -5, 6, 7, -8, 9, 10, -11, 12]) == 37\n assert candidate(nums = [3, -2, 2, -3, 4, -1, 2, 1, -5, 4]) == 10\n assert candidate(nums = [5, -3, 5, -3, 5, -3, 5, -3, 5, -3]) == 13\n assert candidate(nums = [-1000, 1000, -2000, 2000, -3000, 3000, -4000, 4000, -5000, 5000]) == 5000\n assert candidate(nums = [10000, -1000, 5000, -500, 2000, -300]) == 16200\n assert candidate(nums = [1, -2, 3, -2, 4, -1, 2, 1, -5, 4]) == 10\n assert candidate(nums = [8, -1, 3, -2, 4, -3, 2, 1, -5, 4]) == 16\n assert candidate(nums = [10, -20, 5, 5, -3, 2, -1]) == 18\n assert candidate(nums = [7, 5, -3, 6, -1, 8, -4, 2]) == 24\n assert candidate(nums = [-1, -2, -3, 4, 5, -1, 2, -1]) == 10\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [3, -1, 4, -1, 5, -9, 2, 6, -5, 3, -8]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, -15, 1, 2, 3, 4, 5]) == 30\n assert candidate(nums = [-5, 1, 5, 0, -7, 3, -1, 2]) == 6\n assert candidate(nums = [-1, 0, 1, -2, 2, -3, 3, -4, 4, -5, 5]) == 5\n assert candidate(nums = [-2, -3, 4, -1, -2, 1, 5, -3, 2, -5]) == 7\n assert candidate(nums = [-10, 15, -20, 25, -30, 35, -40, 45, -50, 55]) == 75\n assert candidate(nums = [7, 5, -3, 6, -5, 2, -7, 8, -2, 4, 5]) == 30\n assert candidate(nums = [1, -2, 3, -2, 5, 6, -4, 2]) == 13\n assert candidate(nums = [-2, -3, -1, -4, -5, -7, -8, -6, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20]) == -1\n assert candidate(nums = [1, 2, 3, 4, -10, 1, 2, 3, 4]) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, -1, -2, -3, -4, -5]) == 15\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6]) == 6\n assert candidate(nums = [-1, -2, -3, -4, -5, 5, 4, 3, 2, 1, -1, -2]) == 15\n assert candidate(nums = [-1, -2, -3, 4, 5, -10, 6, 7]) == 16\n assert candidate(nums = [-10, -20, -30, -40, -50, -60, -70, -80, -90, -100, 1000]) == 1000\n assert candidate(nums = [-5, -1, -8, -9, -2, -6, -3, -8, -4, -5]) == -1\n assert candidate(nums = [10, 20, 30, 40, 50, -5, -10, -15, -20, -25, 50, 100, -50, -100, 150, -200, 250, -300, 350, -400]) == 350\n assert candidate(nums = [3, -1, 2, -1, 4, -2, 5, -3, 6, -4, 7, -5, 8, -6, 9, -7, 10, -8]) == 25\n assert candidate(nums = [3, -2, 2, -3, 4, -1, 2, 1, -5, 4, 3, -2, 2, -3, 4, -1, 2, 1, -5, 4]) == 15\n assert candidate(nums = [-5, 5, -5, 5, -5, 5]) == 5\n assert candidate(nums = [10, -10, 20, -20, 30, -30, 40, -40, 50, -50]) == 50\n assert candidate(nums = [-2, 4, -3, 4, -1, -2, 1, 5, -3]) == 8\n assert candidate(nums = [100, -200, 300, -400, 500, -600, 700, -800, 900, -1000, 1000]) == 1500\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9, 10, -10]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, -6, 7, 8, 9, 10]) == 49\n assert candidate(nums = [15, -2, 20, 4, -5, -9, -10]) == 37\n assert candidate(nums = [1, 2, 3, 4, 5, -1, -2, -3, -4, -5, 10]) == 25\n assert candidate(nums = [1, -10, 3, 4, -5, 2, 6, -1, 4]) == 14\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 55\n assert candidate(nums = [3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13]) == 20\n assert candidate(nums = [10, -7, 9, -7, 9, -7, 9, 9, -6, -4, 6]) == 31\n assert candidate(nums = [100, -1, -100, 100, -1, -100, 100, -1, -100, 100]) == 200\n assert candidate(nums = [5, -2, 5, -2, 5, -2, 5, -2]) == 14\n assert candidate(nums = [-10, 2, 3, -2, 5, -6, 7, -8, 9, -10]) == 10\n assert candidate(nums = [5, 10, -20, 5, 10, 5]) == 35\n assert candidate(nums = [8, -1, 3, 4, -2, -3, 6, 1]) == 21\n assert candidate(nums = [5, 5, 5, 5, -10, 5, 5, 5, 5]) == 40\n assert candidate(nums = [10, -5, 4, -1, 12, -3, 7, -2, 8, -6]) == 30\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1]) == -1\n assert candidate(nums = [8, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14, -15]) == 15\n assert candidate(nums = [10, -20, 30, -40, 50, -60, 70, -80, 90, -100]) == 90\n assert candidate(nums = [2, 3, -4, 5, 7, -10, 20, -5, 3, -2, 1, -1, 4, -3, 2, -2, 5, -7, 8, -6]) == 30\n assert candidate(nums = [-1, -2, 3, 4, -5, 6, -7, 8, -9, 10]) == 16\n assert candidate(nums = [1, 2, 3, -6, 1, 2, 3, 4, 5, -10, 1, 2, 3, 4, 5]) == 30\n assert candidate(nums = [-1, -3, -5, 2, 1, -1, -2, 3, 4]) == 7\n assert candidate(nums = [-1, -2, -3, -4, -5, 1, 2, 3, 4, 5]) == 15\n assert candidate(nums = [100, -100, 100, -100, 100, -100, 100]) == 200\n assert candidate(nums = [-5, 5, -5, 5, -5, 5, -5, 5]) == 5\n assert candidate(nums = [3, -1, -1, 3, 5, -7, 5]) == 14\n assert candidate(nums = [1, -2, 3, 5, -6, 4, 2]) == 13\n assert candidate(nums = [0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, -5, -4, -3, -2, -1]) == 15\n assert candidate(nums = [-5000, -1000, -3000, -2000, -4000, -1500]) == -1000\n assert candidate(nums = [10, -10, 20, -20, 30, -30, 40, -40, 50]) == 90\n assert candidate(nums = [1, 2, 3, 4, 5, -1, -2, -3, -4, -5, 1, 2, 3, 4, 5]) == 30\n assert candidate(nums = [1, 2, 3, -6, 4, 5, 6, -10, 1, 2, 3, 4]) == 25\n assert candidate(nums = [5, -1, 5, -2, 3, 4, -5]) == 14\n assert candidate(nums = [-1, -2, -3, -4, -5, 15, 10, 5, -10, -5, 20, 25, -30]) == 60\n assert candidate(nums = [3, -4, 5, 2, -6, 1, 4, -3, 2, -5]) == 7\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == -1\n assert candidate(nums = [-1, -2, -3, -4, -5, 1, 2, 3, 4, 5, -10]) == 15\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, -100, 10, 20, 30, 40, 50]) == 195\n assert candidate(nums = [5, 1, -2, 3, -1, 2]) == 10\n assert candidate(nums = [10, -2, -3, -4, 7, 9, -20, 10, 15]) == 42\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1]) == 1\n assert candidate(nums = [3, -2, 2, 5, -3, 3, 5, -2, 3, 2, 5, -3]) == 21\n assert candidate(nums = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15]) == 22\n assert candidate(nums = [5, -1, 5, -1, 5, -1, 5, -1, 5, -1]) == 21\n assert candidate(nums = [100, -1, 100, -1, 100, -1, 100, -1, 100]) == 497\n assert candidate(nums = [1, -2, 3, 4, -1, 2, 1, -5, 4]) == 12\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, 1]) == 1\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().maxSubarraySumCircular", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxSubarraySumCircular = function(nums) {", "container": null, "callable": "maxSubarraySumCircular", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 920, "task_id": "number-of-music-playlists", "difficulty": "Hard", "problem_description": "Your music player contains n different songs. You want to listen to goal songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that:\n\nEvery song is played at least once.\nA song can only be played again only if k other songs have been played.\n\nGiven n, goal, and k, return the number of possible playlists that you can create. Since the answer can be very large, return it modulo 109 + 7.\n \nExample 1:\n\nInput: n = 3, goal = 3, k = 1\nOutput: 6\nExplanation: There are 6 possible playlists: [1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], and [3, 2, 1].\n\nExample 2:\n\nInput: n = 2, goal = 3, k = 0\nOutput: 6\nExplanation: There are 6 possible playlists: [1, 1, 2], [1, 2, 1], [2, 1, 1], [2, 2, 1], [2, 1, 2], and [1, 2, 2].\n\nExample 3:\n\nInput: n = 2, goal = 3, k = 1\nOutput: 2\nExplanation: There are 2 possible playlists: [1, 2, 1] and [2, 1, 2].\n\n \nConstraints:\n\n0 <= k < n <= goal <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 5,goal = 5,k = 2) == 120\n assert candidate(n = 3,goal = 4,k = 1) == 18\n assert candidate(n = 4,goal = 6,k = 2) == 168\n assert candidate(n = 3,goal = 3,k = 1) == 6\n assert candidate(n = 2,goal = 3,k = 1) == 2\n assert candidate(n = 10,goal = 10,k = 5) == 3628800\n assert candidate(n = 10,goal = 10,k = 0) == 3628800\n assert candidate(n = 100,goal = 100,k = 99) == 437918130\n assert candidate(n = 7,goal = 8,k = 3) == 50400\n assert candidate(n = 6,goal = 6,k = 3) == 720\n assert candidate(n = 4,goal = 5,k = 2) == 72\n assert candidate(n = 2,goal = 3,k = 0) == 6\n assert candidate(n = 10,goal = 15,k = 5) == 314718922\n assert candidate(n = 5,goal = 5,k = 0) == 120\n assert candidate(n = 5,goal = 6,k = 2) == 720\n assert candidate(n = 1,goal = 1,k = 0) == 1\n assert candidate(n = 60,goal = 80,k = 15) == 735857219\n assert candidate(n = 95,goal = 100,k = 50) == 174977625\n assert candidate(n = 70,goal = 100,k = 40) == 538034361\n assert candidate(n = 8,goal = 20,k = 2) == 930652117\n assert candidate(n = 80,goal = 100,k = 40) == 871833725\n assert candidate(n = 40,goal = 50,k = 10) == 865239591\n assert candidate(n = 50,goal = 75,k = 25) == 937903747\n assert candidate(n = 60,goal = 70,k = 30) == 540386145\n assert candidate(n = 5,goal = 10,k = 2) == 115920\n assert candidate(n = 3,goal = 9,k = 1) == 762\n assert candidate(n = 6,goal = 12,k = 0) == 953029440\n assert candidate(n = 4,goal = 6,k = 1) == 600\n assert candidate(n = 25,goal = 35,k = 12) == 371031271\n assert candidate(n = 80,goal = 100,k = 60) == 978677402\n assert candidate(n = 4,goal = 15,k = 2) == 98280\n assert candidate(n = 30,goal = 40,k = 10) == 300617761\n assert candidate(n = 90,goal = 100,k = 80) == 515779794\n assert candidate(n = 50,goal = 75,k = 20) == 512461610\n assert candidate(n = 8,goal = 16,k = 4) == 655720152\n assert candidate(n = 20,goal = 25,k = 10) == 708676825\n assert candidate(n = 55,goal = 75,k = 25) == 829204517\n assert candidate(n = 30,goal = 100,k = 25) == 238440403\n assert candidate(n = 35,goal = 50,k = 10) == 681866396\n assert candidate(n = 50,goal = 50,k = 25) == 318608048\n assert candidate(n = 15,goal = 25,k = 7) == 357904575\n assert candidate(n = 8,goal = 15,k = 4) == 876639965\n assert candidate(n = 70,goal = 80,k = 40) == 172533607\n assert candidate(n = 40,goal = 50,k = 30) == 292538678\n assert candidate(n = 60,goal = 80,k = 40) == 183945178\n assert candidate(n = 30,goal = 40,k = 5) == 922217496\n assert candidate(n = 40,goal = 100,k = 35) == 953525405\n assert candidate(n = 70,goal = 100,k = 50) == 65098072\n assert candidate(n = 10,goal = 15,k = 3) == 694588868\n assert candidate(n = 80,goal = 90,k = 50) == 237760215\n assert candidate(n = 25,goal = 50,k = 10) == 429087363\n assert candidate(n = 35,goal = 50,k = 5) == 198199125\n assert candidate(n = 50,goal = 100,k = 45) == 838158734\n assert candidate(n = 40,goal = 60,k = 10) == 228726453\n assert candidate(n = 50,goal = 100,k = 1) == 80478639\n assert candidate(n = 60,goal = 80,k = 30) == 601847758\n assert candidate(n = 3,goal = 5,k = 1) == 42\n assert candidate(n = 30,goal = 50,k = 10) == 198995152\n assert candidate(n = 40,goal = 45,k = 15) == 496260317\n assert candidate(n = 7,goal = 12,k = 1) == 904614480\n assert candidate(n = 20,goal = 20,k = 10) == 146326063\n assert candidate(n = 5,goal = 20,k = 3) == 7864200\n assert candidate(n = 3,goal = 10,k = 1) == 1530\n assert candidate(n = 20,goal = 30,k = 10) == 681973277\n assert candidate(n = 20,goal = 30,k = 5) == 252498779\n assert candidate(n = 90,goal = 100,k = 70) == 614582964\n assert candidate(n = 10,goal = 20,k = 5) == 993942190\n assert candidate(n = 25,goal = 50,k = 15) == 325370660\n assert candidate(n = 40,goal = 50,k = 20) == 73692427\n assert candidate(n = 50,goal = 70,k = 25) == 598060511\n assert candidate(n = 50,goal = 100,k = 30) == 226791857\n assert candidate(n = 65,goal = 80,k = 35) == 757952334\n assert candidate(n = 20,goal = 40,k = 15) == 504044110\n assert candidate(n = 30,goal = 40,k = 15) == 213845140\n assert candidate(n = 30,goal = 60,k = 20) == 611199752\n assert candidate(n = 30,goal = 50,k = 15) == 745316193\n assert candidate(n = 45,goal = 60,k = 10) == 447565182\n assert candidate(n = 45,goal = 60,k = 25) == 422620880\n assert candidate(n = 80,goal = 90,k = 40) == 803255223\n assert candidate(n = 7,goal = 30,k = 5) == 557163012\n assert candidate(n = 7,goal = 10,k = 3) == 1764000\n assert candidate(n = 30,goal = 90,k = 15) == 707675175\n assert candidate(n = 50,goal = 75,k = 30) == 167112607\n assert candidate(n = 7,goal = 15,k = 3) == 81965019\n assert candidate(n = 6,goal = 12,k = 2) == 24555600\n assert candidate(n = 40,goal = 60,k = 20) == 833839566\n assert candidate(n = 6,goal = 25,k = 4) == 754974000\n assert candidate(n = 40,goal = 80,k = 25) == 764575926\n"}, "metadata": {"canonical_parameter_names": ["n", "goal", "k"], "leetcode_dataset_entry_point": "Solution().numMusicPlaylists", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numMusicPlaylists = function(n, goal, k) {", "container": null, "callable": "numMusicPlaylists", "parameters": [{"name": "n", "type": "number"}, {"name": "goal", "type": "number"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 921, "task_id": "minimum-add-to-make-parentheses-valid", "difficulty": "Medium", "problem_description": "A parentheses string is valid if and only if:\n\nIt is the empty string,\nIt can be written as AB (A concatenated with B), where A and B are valid strings, or\nIt can be written as (A), where A is a valid string.\n\nYou are given a parentheses string s. In one move, you can insert a parenthesis at any position of the string.\n\nFor example, if s = \"()))\", you can insert an opening parenthesis to be \"(()))\" or a closing parenthesis to be \"())))\".\n\nReturn the minimum number of moves required to make s valid.\n \nExample 1:\n\nInput: s = \"())\"\nOutput: 1\n\nExample 2:\n\nInput: s = \"(((\"\nOutput: 3\n\n \nConstraints:\n\n1 <= s.length <= 1000\ns[i] is either '(' or ')'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"(()))\") == 1\n assert candidate(s = \"())\") == 1\n assert candidate(s = \"()\") == 0\n assert candidate(s = \"((((((()))\") == 4\n assert candidate(s = \"())(()\") == 2\n assert candidate(s = \"((()))\") == 0\n assert candidate(s = \"((\") == 2\n assert candidate(s = \"\") == 0\n assert candidate(s = \"(()))(\") == 2\n assert candidate(s = \"(())\") == 0\n assert candidate(s = \"(()))(()\") == 2\n assert candidate(s = \"()))((\") == 4\n assert candidate(s = \"))(()()((()(()))))\") == 2\n assert candidate(s = \"()()(()(()))(()(()(()(()))))\") == 0\n assert candidate(s = \"((((((((((()))))))))\") == 2\n assert candidate(s = \"(())))(()\") == 3\n assert candidate(s = \")(()))()()\") == 2\n assert candidate(s = \"(()((())()()))\") == 0\n assert candidate(s = \"((((((())\") == 5\n assert candidate(s = \"()(()(()))\") == 0\n assert candidate(s = \"(()(()))()()(()(()()()(()())())\") == 1\n assert candidate(s = \"((((()()()(()))))\") == 1\n assert candidate(s = \"(()(()(()(()(()())())))\") == 1\n assert candidate(s = \"(()(()))))((()\") == 4\n assert candidate(s = \"(()(()))(()(()(()(()))))\") == 0\n assert candidate(s = \"(()())((()))\") == 0\n assert candidate(s = \"()))(((((()))))())\") == 2\n assert candidate(s = \"(((()(()(()(()))))))\") == 0\n assert candidate(s = \"((()))(())()(()(()))\") == 0\n assert candidate(s = \"(()(()(()(()(()))))())\") == 0\n assert candidate(s = \"(()())(()())(()())\") == 0\n assert candidate(s = \"()()()(()(()))((()))(()(()(()(())))()(()))\") == 0\n assert candidate(s = \"((()))())((())()())\") == 1\n assert candidate(s = \"()()()()()()()()()()()()()()\") == 0\n assert candidate(s = \"(()))(((()))()()(()(()(()))))(())\") == 1\n assert candidate(s = \"((((((((())))))))()()\") == 1\n assert candidate(s = \"((((((()))))\") == 2\n assert candidate(s = \"))(()(()))\") == 2\n assert candidate(s = \"((((((()))))))\") == 0\n assert candidate(s = \"(()((())()(()))\") == 1\n assert candidate(s = \")((((((((((())\") == 10\n assert candidate(s = \"(()(()(()(()))))\") == 0\n assert candidate(s = \"(()(()(()(()(()()))))(()(()(()))))()\") == 0\n assert candidate(s = \"(()(()(()(()))(()(()))))\") == 0\n assert candidate(s = \"((((((())))))))\") == 1\n assert candidate(s = \"(()))(()((()())(()())))\") == 1\n assert candidate(s = \"(()())())\") == 1\n assert candidate(s = \"())()()()(((())))\") == 1\n assert candidate(s = \"(()(()))(()())(()(()))\") == 0\n assert candidate(s = \"(((()))(()(())))\") == 0\n assert candidate(s = \"()()(()))(()((()())))\") == 1\n assert candidate(s = \"((())(()(()(()))))\") == 0\n assert candidate(s = \"(()()(()))(()(()(()))(()(()))))\") == 1\n assert candidate(s = \"(()(()))\") == 0\n assert candidate(s = \")((((((()())\") == 6\n assert candidate(s = \"(((()))(()(()))(()(()))\") == 1\n assert candidate(s = \")()(()))(()\") == 3\n assert candidate(s = \"()()()()\") == 0\n assert candidate(s = \"(((())(())))\") == 0\n assert candidate(s = \"(()(()(()(()(()(()))))))\") == 0\n assert candidate(s = \"((())())(()(()(()))())\") == 0\n assert candidate(s = \"(()(()(()())))\") == 0\n assert candidate(s = \"())(()))(()(()))\") == 2\n assert candidate(s = \"(()(()(()(()(()(()())())))())())\") == 0\n assert candidate(s = \"(()())((()()(())))\") == 0\n assert candidate(s = \"(()(())))\") == 1\n assert candidate(s = \"(()()(()(())))()(()(()))\") == 0\n assert candidate(s = \"(((((())))))()()()(((()(()))))()()\") == 0\n assert candidate(s = \"(()(()(()(()(()(()(()))))))))\") == 1\n assert candidate(s = \"()(()(()(()(()))))\") == 0\n assert candidate(s = \"(()(()))(()(()))\") == 0\n assert candidate(s = \"()(()(()(()())))\") == 0\n assert candidate(s = \"())(((())))\") == 1\n assert candidate(s = \"()())(()(()))(()\") == 2\n assert candidate(s = \")(()(()(()(()(())))))\") == 1\n assert candidate(s = \"((((((((((()))))))))))\") == 0\n assert candidate(s = \"(())))))(((()()()(()(()))))))\") == 5\n assert candidate(s = \")(()(()(()(()))))\") == 1\n assert candidate(s = \"()(()(()))(()(()(()(()))))\") == 0\n assert candidate(s = \"(((((((())))))))\") == 0\n assert candidate(s = \"())(()))(()(()(()())))((()())())\") == 2\n assert candidate(s = \"(((((((())))))\") == 2\n assert candidate(s = \"(((()())()))\") == 0\n assert candidate(s = \"(()(()(()(()))))())\") == 1\n assert candidate(s = \"(()))(()))(())))\") == 4\n assert candidate(s = \"()()()(()()())()()()()\") == 0\n assert candidate(s = \"(()())(()())\") == 0\n assert candidate(s = \"(()(()))(()(()(()(()(())))))\") == 0\n assert candidate(s = \")()()()()()()\") == 1\n assert candidate(s = \"()(()))((())((())())\") == 2\n assert candidate(s = \"())(()(()))\") == 1\n assert candidate(s = \"())())())())())())\") == 6\n assert candidate(s = \"(()))())(()\") == 3\n assert candidate(s = \"()()()()()()()()\") == 0\n assert candidate(s = \"((())(()))\") == 0\n assert candidate(s = \"(())))))()\") == 4\n assert candidate(s = \"()(()((())))()()(()(()))))\") == 2\n assert candidate(s = \"(()(()))()(()(()))\") == 0\n assert candidate(s = \"(()))(()))\") == 2\n assert candidate(s = \"(((()))(()))\") == 0\n assert candidate(s = \"()()()()()()\") == 0\n assert candidate(s = \")()(()()((()())))\") == 1\n assert candidate(s = \"(()))((())(()(())))\") == 1\n assert candidate(s = \"()(()()(()(()())))\") == 0\n assert candidate(s = \"())((())\") == 2\n assert candidate(s = \"(((((((()))())())())(())))))\") == 2\n assert candidate(s = \"(((((())))))()\") == 0\n assert candidate(s = \"))))))))))))\") == 12\n assert candidate(s = \"()()()(((()))))((()))(()(()))(()())\") == 1\n assert candidate(s = \"((())()(()(()))\") == 1\n assert candidate(s = \"())(()()\") == 2\n assert candidate(s = \"(()(((((((((()))))))\") == 4\n assert candidate(s = \"((((()))))\") == 0\n assert candidate(s = \"(((((())))))()(()(()))\") == 0\n assert candidate(s = \"(()(((())))())\") == 0\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().minAddToMakeValid", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minAddToMakeValid = function(s) {", "container": null, "callable": "minAddToMakeValid", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 922, "task_id": "sort-array-by-parity-ii", "difficulty": "Easy", "problem_description": "Given an array of integers nums, half of the integers in nums are odd, and the other half are even.\nSort the array so that whenever nums[i] is odd, i is odd, and whenever nums[i] is even, i is even.\nReturn any answer array that satisfies this condition.\n \nExample 1:\n\nInput: nums = [4,2,5,7]\nOutput: [4,5,2,7]\nExplanation: [4,7,2,5], [2,5,4,7], [2,7,4,5] would also have been accepted.\n\nExample 2:\n\nInput: nums = [2,3]\nOutput: [2,3]\n\n \nConstraints:\n\n2 <= nums.length <= 2 * 104\nnums.length is even.\nHalf of the integers in nums are even.\n0 <= nums[i] <= 1000\n\n \nFollow Up: Could you solve it in-place?\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [2, 3, 6, 7]) == [2, 3, 6, 7]\n assert candidate(nums = [2, 3]) == [2, 3]\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7]) == [0, 1, 2, 3, 4, 5, 6, 7]\n assert candidate(nums = [8, 11, 6, 9, 5, 10, 7, 2]) == [8, 11, 6, 9, 10, 5, 2, 7]\n assert candidate(nums = [0, 1, 2, 3, 4, 5]) == [0, 1, 2, 3, 4, 5]\n assert candidate(nums = [1, 2, 3, 4]) == [2, 1, 4, 3]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8]) == [2, 1, 4, 3, 6, 5, 8, 7]\n assert candidate(nums = [100, 1, 200, 2, 300, 3, 400, 4]) == [100, 1, 200, 2, 300, 3, 400, 4]\n assert candidate(nums = [8, 13, 6, 3, 10, 5, 7, 2]) == [8, 13, 6, 3, 10, 5, 2, 7]\n assert candidate(nums = [1, 2, 3, 4, 5, 6]) == [2, 1, 4, 3, 6, 5]\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(nums = [4, 2, 5, 7]) == [4, 5, 2, 7]\n assert candidate(nums = [6, 1, 4, 3, 2, 5]) == [6, 1, 4, 3, 2, 5]\n assert candidate(nums = [6, 1, 4, 3]) == [6, 1, 4, 3]\n assert candidate(nums = [2, 3, 4, 1]) == [2, 3, 4, 1]\n assert candidate(nums = [1000, 1, 800, 2, 600, 3]) == [1000, 1, 800, 2, 600, 3]\n assert candidate(nums = [1, 3, 2, 4, 5, 6]) == [4, 3, 2, 1, 6, 5]\n assert candidate(nums = [8, 11, 6, 9, 10, 7]) == [8, 11, 6, 9, 10, 7]\n assert candidate(nums = [200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185]) == [200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185]\n assert candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9]) == [8, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9]\n assert candidate(nums = [10, 1, 20, 3, 30, 5, 40, 7, 50, 9, 60, 11, 70, 13, 80, 15, 90, 17, 100, 19]) == [10, 1, 20, 3, 30, 5, 40, 7, 50, 9, 60, 11, 70, 13, 80, 15, 90, 17, 100, 19]\n assert candidate(nums = [8, 1, 6, 3, 5, 4, 2, 7]) == [8, 1, 6, 3, 4, 5, 2, 7]\n assert candidate(nums = [999, 888, 777, 666, 555, 444, 333, 222, 111, 0]) == [888, 999, 666, 777, 444, 555, 222, 333, 0, 111]\n assert candidate(nums = [20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 1, 3, 5, 7, 9, 11]) == [20, 1, 24, 5, 28, 9, 32, 34, 36, 38, 22, 3, 26, 7, 30, 11]\n assert candidate(nums = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55]) == [10, 15, 20, 25, 30, 35, 40, 45, 50, 55]\n assert candidate(nums = [800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813]) == [800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813]\n assert candidate(nums = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511]) == [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511]\n assert candidate(nums = [1000, 1, 998, 3, 996, 5, 994, 7]) == [1000, 1, 998, 3, 996, 5, 994, 7]\n assert candidate(nums = [8, 13, 18, 23, 28, 33, 38, 43, 48, 53]) == [8, 13, 18, 23, 28, 33, 38, 43, 48, 53]\n assert candidate(nums = [5, 8, 6, 3, 4, 7, 2, 9, 1, 10]) == [8, 5, 6, 3, 4, 7, 2, 9, 10, 1]\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15]) == [2, 1, 6, 5, 10, 9, 14, 13, 4, 3, 8, 7, 12, 11, 16, 15]\n assert candidate(nums = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515]) == [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515]\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n assert candidate(nums = [1000, 1, 999, 2, 998, 3, 997, 4, 996, 5, 995, 6, 994, 7, 993, 8, 992, 9, 991, 10]) == [1000, 1, 2, 999, 998, 3, 4, 997, 996, 5, 6, 995, 994, 7, 8, 993, 992, 9, 10, 991]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [2, 1, 4, 3, 6, 5, 8, 7, 10, 9]\n assert candidate(nums = [1, 3, 2, 4, 5, 6, 7, 8]) == [4, 3, 2, 1, 6, 5, 8, 7]\n assert candidate(nums = [600, 1, 598, 3, 596, 5, 594, 7, 592, 9, 590, 11, 588, 13, 586, 15, 584, 17, 582, 19]) == [600, 1, 598, 3, 596, 5, 594, 7, 592, 9, 590, 11, 588, 13, 586, 15, 584, 17, 582, 19]\n assert candidate(nums = [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]) == [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == [4, 3, 8, 7, 12, 11, 2, 1, 6, 5, 10, 9, 14, 16, 18, 20]\n assert candidate(nums = [2, 1, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17]) == [2, 1, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17]\n assert candidate(nums = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509]) == [500, 501, 502, 503, 504, 505, 506, 507, 508, 509]\n assert candidate(nums = [1000, 501, 701, 10, 20, 400, 300, 301]) == [1000, 501, 10, 701, 20, 400, 300, 301]\n assert candidate(nums = [31, 28, 33, 30, 35, 32, 37, 34, 39, 36, 41, 38, 43, 40, 45, 42]) == [28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41, 40, 43, 42, 45]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == [2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11]\n assert candidate(nums = [1, 3, 5, 7, 2, 4, 6, 8]) == [4, 3, 8, 7, 2, 1, 6, 5]\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]\n assert candidate(nums = [4, 1, 2, 3, 6, 5, 8, 7]) == [4, 1, 2, 3, 6, 5, 8, 7]\n assert candidate(nums = [8, 6, 4, 2, 7, 5, 3, 1, 10, 9, 12, 11, 14, 13, 16, 15]) == [8, 7, 4, 3, 6, 5, 2, 1, 10, 9, 12, 11, 14, 13, 16, 15]\n assert candidate(nums = [7, 2, 5, 8, 3, 10, 9, 6, 11, 4]) == [2, 7, 8, 5, 10, 3, 6, 9, 4, 11]\n assert candidate(nums = [998, 1, 996, 3, 994, 5, 992, 7, 990, 9, 988, 11, 986, 13, 984, 15]) == [998, 1, 996, 3, 994, 5, 992, 7, 990, 9, 988, 11, 986, 13, 984, 15]\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n assert candidate(nums = [42, 3, 18, 35, 40, 45, 52, 57, 60, 65, 70, 75, 82, 87, 90, 95, 100, 105, 110, 115]) == [42, 3, 18, 35, 40, 45, 52, 57, 60, 65, 70, 75, 82, 87, 90, 95, 100, 105, 110, 115]\n assert candidate(nums = [1000, 999, 100, 99, 20, 19, 2, 1]) == [1000, 999, 100, 99, 20, 19, 2, 1]\n assert candidate(nums = [1, 3, 2, 4, 7, 6, 9, 8]) == [4, 3, 2, 1, 6, 7, 8, 9]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == [2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15]\n assert candidate(nums = [500, 499, 498, 497, 496, 495, 494, 493, 492, 491]) == [500, 499, 498, 497, 496, 495, 494, 493, 492, 491]\n assert candidate(nums = [998, 999, 996, 997, 994, 995, 992, 993, 990, 991]) == [998, 999, 996, 997, 994, 995, 992, 993, 990, 991]\n assert candidate(nums = [10, 21, 8, 13, 6, 17, 4, 19]) == [10, 21, 8, 13, 6, 17, 4, 19]\n assert candidate(nums = [500, 1, 498, 3, 496, 5, 494, 7, 492, 9, 490, 11]) == [500, 1, 498, 3, 496, 5, 494, 7, 492, 9, 490, 11]\n assert candidate(nums = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n assert candidate(nums = [44, 1, 3, 2, 10, 5, 8, 7, 6, 9]) == [44, 1, 2, 3, 10, 5, 8, 7, 6, 9]\n assert candidate(nums = [10, 21, 20, 31, 40, 51, 60, 71]) == [10, 21, 20, 31, 40, 51, 60, 71]\n assert candidate(nums = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991]) == [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991]\n assert candidate(nums = [1000, 1, 998, 3, 996, 5, 994, 7, 992, 9, 990, 11, 988, 13, 986, 15]) == [1000, 1, 998, 3, 996, 5, 994, 7, 992, 9, 990, 11, 988, 13, 986, 15]\n assert candidate(nums = [600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629]) == [600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629]\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == [4, 3, 8, 7, 12, 11, 16, 15, 20, 19, 2, 1, 6, 5, 10, 9, 14, 13, 18, 17]\n assert candidate(nums = [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]) == [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]\n assert candidate(nums = [101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == [102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111, 114, 113, 116, 115, 118, 117, 120, 119]\n assert candidate(nums = [2, 1, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19]) == [2, 1, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19]\n assert candidate(nums = [1, 3, 5, 2, 4, 6]) == [2, 3, 6, 1, 4, 5]\n assert candidate(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109]) == [100, 101, 102, 103, 104, 105, 106, 107, 108, 109]\n assert candidate(nums = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970]) == [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970]\n assert candidate(nums = [1000, 1, 2, 999, 4, 3, 6, 8, 7, 5, 12, 11, 14, 13, 16, 15]) == [1000, 1, 2, 999, 4, 3, 6, 7, 8, 5, 12, 11, 14, 13, 16, 15]\n assert candidate(nums = [999, 997, 995, 993, 991, 989, 987, 985, 0, 2, 4, 6, 8, 10, 12, 14]) == [2, 997, 6, 993, 10, 989, 14, 985, 0, 999, 4, 995, 8, 991, 12, 987]\n assert candidate(nums = [3, 6, 1, 8, 5, 10, 7, 12, 9, 14, 11, 16]) == [6, 3, 8, 1, 10, 5, 12, 7, 14, 9, 16, 11]\n assert candidate(nums = [998, 999, 996, 997, 994, 995, 992, 993]) == [998, 999, 996, 997, 994, 995, 992, 993]\n assert candidate(nums = [998, 999, 1000, 0, 2, 4, 6, 8]) == [998, 999, 1000, 0, 2, 4, 6, 8]\n assert candidate(nums = [800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819]) == [800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819]\n assert candidate(nums = [10, 15, 20, 25, 30, 35, 40, 45]) == [10, 15, 20, 25, 30, 35, 40, 45]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19]\n assert candidate(nums = [8, 1, 4, 3, 6, 5, 2, 7, 10, 9]) == [8, 1, 4, 3, 6, 5, 2, 7, 10, 9]\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().sortArrayByParityII", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sortArrayByParityII = function(nums) {", "container": null, "callable": "sortArrayByParityII", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 923, "task_id": "3sum-with-multiplicity", "difficulty": "Medium", "problem_description": "Given an integer array arr, and an integer target, return the number of tuples i, j, k such that i < j < k and arr[i] + arr[j] + arr[k] == target.\nAs the answer can be very large, return it modulo 109 + 7.\n \nExample 1:\n\nInput: arr = [1,1,2,2,3,3,4,4,5,5], target = 8\nOutput: 20\nExplanation: \nEnumerating by the values (arr[i], arr[j], arr[k]):\n(1, 2, 5) occurs 8 times;\n(1, 3, 4) occurs 8 times;\n(2, 2, 4) occurs 2 times;\n(2, 3, 3) occurs 2 times.\n\nExample 2:\n\nInput: arr = [1,1,2,2,2,2], target = 5\nOutput: 12\nExplanation: \narr[i] = 1, arr[j] = arr[k] = 2 occurs 12 times:\nWe choose one 1 from [1,1] in 2 ways,\nand two 2s from [2,2,2,2] in 6 ways.\n\nExample 3:\n\nInput: arr = [2,1,3], target = 6\nOutput: 1\nExplanation: (1, 2, 3) occured one time in the array so we return 1.\n\n \nConstraints:\n\n3 <= arr.length <= 3000\n0 <= arr[i] <= 100\n0 <= target <= 300\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 18) == 11\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5],target = 10) == 74\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9],target = 15) == 8\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],target = 3) == 1140\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 15) == 10\n assert candidate(arr = [100, 100, 100],target = 300) == 1\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],target = 8) == 20\n assert candidate(arr = [2, 1, 3],target = 6) == 1\n assert candidate(arr = [50, 50, 50, 50, 50, 50, 50, 50, 50],target = 150) == 84\n assert candidate(arr = [1, 2, 3, 4, 5],target = 9) == 2\n assert candidate(arr = [1, 1, 2, 2, 2, 2],target = 5) == 12\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],target = 0) == 120\n assert candidate(arr = [50, 50, 50, 50, 50],target = 150) == 10\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],target = 150) == 10\n assert candidate(arr = [0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5],target = 7) == 22\n assert candidate(arr = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],target = 300) == 120\n assert candidate(arr = [0, 0, 0],target = 0) == 1\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6],target = 9) == 63\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],target = 150) == 45\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],target = 15) == 1140\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 36) == 42\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],target = 30) == 50116\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 60) == 105\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],target = 300) == 19\n assert candidate(arr = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],target = 9) == 4495\n assert candidate(arr = [25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25],target = 75) == 4060\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10],target = 12) == 184\n assert candidate(arr = [1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5],target = 7) == 93\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],target = 18) == 88\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10],target = 16) == 224\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],target = 24) == 25\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8],target = 12) == 628\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],target = 9) == 399\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],target = 15) == 1330\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 25) == 38\n assert candidate(arr = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],target = 9) == 455\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],target = 30) == 0\n assert candidate(arr = [10, 10, 10, 20, 20, 20, 30, 30, 30, 40, 40, 40, 50, 50, 50],target = 90) == 73\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19],target = 27) == 1078\n assert candidate(arr = [1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10],target = 18) == 2751\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],target = 15) == 4060\n assert candidate(arr = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],target = 90) == 3276\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],target = 200) == 74\n assert candidate(arr = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],target = 60) == 19\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50],target = 100) == 632\n assert candidate(arr = [1, 3, 3, 3, 5, 5, 6, 6, 6, 7, 7, 7, 9, 9, 10],target = 17) == 39\n assert candidate(arr = [1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5],target = 9) == 49\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],target = 45) == 113\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9],target = 15) == 253\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10],target = 20) == 210\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7],target = 12) == 582\n assert candidate(arr = [0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10],target = 6) == 99\n assert candidate(arr = [1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30],target = 60) == 98\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],target = 20) == 22\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],target = 15) == 20825\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],target = 39) == 72\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4],target = 6) == 525\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],target = 30) == 45\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],target = 18) == 1260\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],target = 35) == 69\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],target = 150) == 0\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10],target = 15) == 307\n assert candidate(arr = [1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10],target = 18) == 929\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150],target = 200) == 98\n assert candidate(arr = [1, 2, 2, 3, 3, 4, 5, 5, 5, 6, 6, 7, 8, 9, 10],target = 12) == 34\n assert candidate(arr = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],target = 150) == 0\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],target = 60) == 0\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],target = 50) == 103\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],target = 60) == 75\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 30) == 45\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10],target = 15) == 277\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],target = 150) == 10\n assert candidate(arr = [10, 10, 20, 20, 30, 30, 40, 40, 50, 50, 60, 60],target = 100) == 30\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],target = 60) == 190\n assert candidate(arr = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],target = 9) == 4060\n assert candidate(arr = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],target = 6) == 24804\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],target = 4) == 450\n assert candidate(arr = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],target = 12) == 46\n assert candidate(arr = [1, 3, 3, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 9, 9, 9, 9, 11, 11, 11, 11],target = 18) == 0\n assert candidate(arr = [10, 10, 20, 20, 30, 30, 40, 40, 50, 50, 60, 60, 70, 70, 80, 80, 90, 90, 100, 100],target = 150) == 88\n assert candidate(arr = [1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10],target = 12) == 1082\n assert candidate(arr = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],target = 60) == 45\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7],target = 6) == 37\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],target = 45) == 105\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4],target = 6) == 37\n assert candidate(arr = [1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],target = 15) == 108\n assert candidate(arr = [0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9],target = 10) == 57\n"}, "metadata": {"canonical_parameter_names": ["arr", "target"], "leetcode_dataset_entry_point": "Solution().threeSumMulti", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var threeSumMulti = function(arr, target) {", "container": null, "callable": "threeSumMulti", "parameters": [{"name": "arr", "type": "number[]"}, {"name": "target", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 924, "task_id": "minimize-malware-spread", "difficulty": "Hard", "problem_description": "You are given a network of n nodes represented as an n x n adjacency matrix graph, where the ith node is directly connected to the jth node if graph[i][j] == 1.\nSome nodes initial are initially infected by malware. Whenever two nodes are directly connected, and at least one of those two nodes is infected by malware, both nodes will be infected by malware. This spread of malware will continue until no more nodes can be infected in this manner.\nSuppose M(initial) is the final number of nodes infected with malware in the entire network after the spread of malware stops. We will remove exactly one node from initial.\nReturn the node that, if removed, would minimize M(initial). If multiple nodes could be removed to minimize M(initial), return such a node with the smallest index.\nNote that if a node was removed from the initial list of infected nodes, it might still be infected later due to the malware spread.\n \nExample 1:\nInput: graph = [[1,1,0],[1,1,0],[0,0,1]], initial = [0,1]\nOutput: 0\nExample 2:\nInput: graph = [[1,0,0],[0,1,0],[0,0,1]], initial = [0,2]\nOutput: 0\nExample 3:\nInput: graph = [[1,1,1],[1,1,1],[1,1,1]], initial = [1,2]\nOutput: 1\n\n \nConstraints:\n\nn == graph.length\nn == graph[i].length\n2 <= n <= 300\ngraph[i][j] is 0 or 1.\ngraph[i][j] == graph[j][i]\ngraph[i][i] == 1\n1 <= initial.length <= n\n0 <= initial[i] <= n - 1\nAll the integers in initial are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(graph = [[1, 1, 1, 1], [1, 1, 0, 0], [1, 0, 1, 1], [1, 0, 1, 1]],initial = [0, 1, 2, 3]) == 0\n assert candidate(graph = [[1, 1, 0, 0], [1, 1, 1, 0], [0, 1, 1, 1], [0, 0, 1, 1]],initial = [0, 1]) == 0\n assert candidate(graph = [[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]],initial = [0, 2]) == 0\n assert candidate(graph = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]],initial = [2, 3]) == 2\n assert candidate(graph = [[1, 1, 0], [1, 1, 0], [0, 0, 1]],initial = [0, 1]) == 0\n assert candidate(graph = [[1, 1, 1, 0], [1, 1, 1, 0], [1, 1, 1, 1], [0, 0, 1, 1]],initial = [0, 1, 3]) == 0\n assert candidate(graph = [[1, 0, 0, 0], [0, 1, 1, 1], [0, 1, 1, 1], [0, 1, 1, 1]],initial = [1, 2]) == 1\n assert candidate(graph = [[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]],initial = [0, 1]) == 0\n assert candidate(graph = [[1, 0, 0, 0], [0, 1, 1, 1], [0, 1, 1, 0], [0, 1, 0, 1]],initial = [1, 2, 3]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1]],initial = [0, 1, 4]) == 4\n assert candidate(graph = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],initial = [1, 2]) == 1\n assert candidate(graph = [[1, 0, 0], [0, 1, 0], [0, 0, 1]],initial = [0, 2]) == 0\n assert candidate(graph = [[1, 1, 1, 0], [1, 1, 0, 0], [1, 0, 1, 1], [0, 0, 1, 1]],initial = [2, 3]) == 2\n assert candidate(graph = [[1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 0, 1], [1, 1, 1, 1, 0, 1], [0, 0, 1, 1, 1, 0], [1, 0, 0, 1, 1, 1], [0, 1, 1, 0, 1, 1]],initial = [1, 3, 5]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0], [1, 1, 1, 0, 0], [0, 1, 1, 1, 0], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1]],initial = [0, 3, 4]) == 0\n assert candidate(graph = [[1, 1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 6, 8]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 3, 5, 7]) == 1\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 6]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [0, 3, 5]) == 0\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1, 1]],initial = [0, 1, 4, 6]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0], [1, 1, 1, 0, 0], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [0, 0, 1, 0, 1]],initial = [1, 2, 4]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 7, 9, 10]) == 0\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 1, 0, 0], [0, 1, 0, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [0, 3, 4]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0], [1, 1, 1, 1, 0], [0, 1, 1, 0, 0], [0, 1, 0, 1, 1], [0, 0, 0, 1, 1]],initial = [1, 3, 4]) == 1\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0], [0, 1, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1, 1]],initial = [2, 4, 6, 7]) == 2\n assert candidate(graph = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0], [0, 1, 1, 0, 0, 0], [0, 1, 0, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [0, 2, 4]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0], [1, 1, 1, 0, 0], [0, 1, 1, 1, 0], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1]],initial = [0, 1, 4]) == 0\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [0, 3, 5]) == 0\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 0], [0, 0, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [0, 2, 4, 6]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 2, 4, 6, 8]) == 0\n assert candidate(graph = [[1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 1, 1, 0, 1, 1], [0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0], [0, 0, 1, 1, 0, 1]],initial = [1, 3, 5]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 4, 6, 9]) == 1\n assert candidate(graph = [[1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 1, 1, 0, 0], [1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 3, 5, 7]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [0, 3, 4, 6]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 3, 5, 8]) == 1\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 0], [0, 1, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]],initial = [2, 3, 6, 7]) == 2\n assert candidate(graph = [[1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 1, 1, 0, 0, 0], [0, 1, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1]],initial = [2, 3, 5]) == 5\n assert candidate(graph = [[1, 0, 0, 0, 0], [0, 1, 1, 1, 1], [0, 1, 1, 0, 0], [0, 1, 0, 1, 1], [0, 1, 0, 1, 1]],initial = [1, 3]) == 1\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0], [0, 1, 0, 1, 0, 0, 0], [0, 0, 1, 0, 1, 1, 1], [0, 0, 1, 0, 1, 1, 0], [0, 0, 0, 0, 1, 0, 1]],initial = [2, 4, 5]) == 2\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 7, 8]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 3, 5, 6]) == 1\n assert candidate(graph = [[1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 4, 7]) == 1\n assert candidate(graph = [[1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [1, 2, 3, 4]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1]],initial = [1, 3, 5, 8]) == 1\n assert candidate(graph = [[1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [1, 3, 5]) == 1\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 1, 0, 0, 0], [0, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1]],initial = [1, 3, 5, 7, 9]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0], [1, 1, 1, 0, 0], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [0, 0, 1, 0, 1]],initial = [0, 2, 3]) == 0\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0, 1]],initial = [1, 5, 7]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [0, 2, 4, 6]) == 0\n assert candidate(graph = [[1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]],initial = [0, 3]) == 0\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [0, 2, 3, 5]) == 0\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 1, 0, 0], [0, 1, 0, 1, 1, 1, 0], [0, 0, 1, 1, 1, 0, 1], [0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 1, 1, 1]],initial = [0, 1, 5]) == 0\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 1, 4, 7]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [0, 1, 5]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [2, 3, 5, 8]) == 2\n assert candidate(graph = [[1, 1, 0, 0, 0], [1, 1, 1, 1, 0], [0, 1, 1, 0, 0], [0, 1, 0, 1, 1], [0, 0, 0, 1, 1]],initial = [1, 2, 3]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 2, 4, 7]) == 0\n assert candidate(graph = [[1, 0, 0, 0, 1], [0, 1, 1, 1, 0], [0, 1, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 0, 1]],initial = [1, 2, 4]) == 4\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 7, 9]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [1, 4, 5]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0], [1, 1, 1, 0, 0], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [0, 0, 1, 0, 1]],initial = [0, 1, 4]) == 0\n assert candidate(graph = [[1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 0, 1], [0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1]],initial = [1, 3, 5]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [0, 2, 5]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 6, 9]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 2, 4, 6, 8]) == 0\n assert candidate(graph = [[1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1]],initial = [0, 1, 3, 5, 6]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [2, 4, 6, 8]) == 2\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 3, 5, 8]) == 0\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 7, 8]) == 0\n"}, "metadata": {"canonical_parameter_names": ["graph", "initial"], "leetcode_dataset_entry_point": "Solution().minMalwareSpread", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minMalwareSpread = function(graph, initial) {", "container": null, "callable": "minMalwareSpread", "parameters": [{"name": "graph", "type": "number[][]"}, {"name": "initial", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 925, "task_id": "long-pressed-name", "difficulty": "Easy", "problem_description": "Your friend is typing his name into a keyboard. Sometimes, when typing a character c, the key might get long pressed, and the character will be typed 1 or more times.\nYou examine the typed characters of the keyboard. Return True if it is possible that it was your friends name, with some characters (possibly none) being long pressed.\n \nExample 1:\n\nInput: name = \"alex\", typed = \"aaleex\"\nOutput: true\nExplanation: 'a' and 'e' in 'alex' were long pressed.\n\nExample 2:\n\nInput: name = \"saeed\", typed = \"ssaaedd\"\nOutput: false\nExplanation: 'e' must have been pressed twice, but it was not in the typed output.\n\n \nConstraints:\n\n1 <= name.length, typed.length <= 1000\nname and typed consist of only lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(name = \"zzzzzzzz\",typed = \"zzzzzzzz\") == True\n assert candidate(name = \"abcd\",typed = \"abcde\") == False\n assert candidate(name = \"test\",typed = \"ttest\") == True\n assert candidate(name = \"dfuyalc\",typed = \"fuuyallc\") == False\n assert candidate(name = \"zzzyyyyy\",typed = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == False\n assert candidate(name = \"abcd\",typed = \"abcddcba\") == False\n assert candidate(name = \"alex\",typed = \"aaleexa\") == False\n assert candidate(name = \"kikcxmvzi\",typed = \"kiikcxxmmvvzzz\") == False\n assert candidate(name = \"pyplrz\",typed = \"ppyypllrz\") == True\n assert candidate(name = \"ggggggg\",typed = \"ggggggg\") == True\n assert candidate(name = \"laiden\",typed = \"laiden\") == True\n assert candidate(name = \"saeed\",typed = \"ssaaedd\") == False\n assert candidate(name = \"a\",typed = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == True\n assert candidate(name = \"a\",typed = \"b\") == False\n assert candidate(name = \"abcd\",typed = \"abc\") == False\n assert candidate(name = \"pyplrz\",typed = \"ppyypllr\") == False\n assert candidate(name = \"a\",typed = \"aaaaaa\") == True\n assert candidate(name = \"leelee\",typed = \"lleeelee\") == True\n assert candidate(name = \"zzzaaa\",typed = \"zzzzzaaaa\") == True\n assert candidate(name = \"alex\",typed = \"aaleex\") == True\n assert candidate(name = \"vtkgn\",typed = \"vttkgnn\") == True\n assert candidate(name = \"alex\",typed = \"ale\") == False\n assert candidate(name = \"hello\",typed = \"hheeelllloo\") == True\n assert candidate(name = \"mississippi\",typed = \"miiiiiiissssssippiiiiii\") == False\n assert candidate(name = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",typed = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzz\") == True\n assert candidate(name = \"repeated\",typed = \"repeeeaatteedd\") == True\n assert candidate(name = \"testing\",typed = \"testings\") == False\n assert candidate(name = \"mississippi\",typed = \"mmiissssippip\") == False\n assert candidate(name = \"aabbcc\",typed = \"aaabbbccc\") == True\n assert candidate(name = \"abcdefghij\",typed = \"aabbccddeeffgghhiijj\") == True\n assert candidate(name = \"mississippi\",typed = \"mmiiisssssiiiippp\") == False\n assert candidate(name = \"flower\",typed = \"ffflowweerrr\") == True\n assert candidate(name = \"consistent\",typed = \"cccooonnsisstiisstteeennnttt\") == False\n assert candidate(name = \"algorithm\",typed = \"aaalgggggorithm\") == True\n assert candidate(name = \"programming\",typed = \"pprooggrammmiinngg\") == True\n assert candidate(name = \"mississippi\",typed = \"mmiiississipppi\") == True\n assert candidate(name = \"friend\",typed = \"ffriiieeeennnd\") == True\n assert candidate(name = \"longpressed\",typed = \"lllooonngggppprrreeesssppeeeedd\") == False\n assert candidate(name = \"longpressed\",typed = \"lllongggppppreeesssssssedd\") == True\n assert candidate(name = \"polygon\",typed = \"pppollooogooonnnggg\") == False\n assert candidate(name = \"unique\",typed = \"uuunnnnuuuuuuuuqeeeuuuuuuuuuueee\") == False\n assert candidate(name = \"consistent\",typed = \"ccoonnsissssttttiinnnsss\") == False\n assert candidate(name = \"mississippi\",typed = \"mmiississippip\") == False\n assert candidate(name = \"xxyyzz\",typed = \"xxyyzzzxxxyyyzzz\") == False\n assert candidate(name = \"alexandria\",typed = \"aaalllexxaandria\") == True\n assert candidate(name = \"qwert\",typed = \"qqqqwweeeerrrttt\") == True\n assert candidate(name = \"vtkgn\",typed = \"vtttkkkgggnnn\") == True\n assert candidate(name = \"rhinoceros\",typed = \"rrrhhiinnoocceerrrsss\") == False\n assert candidate(name = \"longpressed\",typed = \"lllooonngggpppreesssed\") == True\n assert candidate(name = \"qwerty\",typed = \"qqqwwweeeerrrrttyyyy\") == True\n assert candidate(name = \"xylophone\",typed = \"xxyyylloophooneee\") == True\n assert candidate(name = \"rhythm\",typed = \"rhythm\") == True\n assert candidate(name = \"aabbcc\",typed = \"aaabbcccc\") == True\n assert candidate(name = \"mississippi\",typed = \"miiisiiisssiiipppii\") == False\n assert candidate(name = \"queue\",typed = \"qqquuuuuuuuueee\") == False\n assert candidate(name = \"abcdefghij\",typed = \"aabbbbccccddddeeeeffffgggghhhhiiiijjjj\") == True\n assert candidate(name = \"ababab\",typed = \"aabbababb\") == True\n assert candidate(name = \"qlssqwwfw\",typed = \"qqllssqqwwwwwfwf\") == False\n assert candidate(name = \"aabbcc\",typed = \"aabbbcccc\") == True\n assert candidate(name = \"flower\",typed = \"ffffllllooower\") == True\n assert candidate(name = \"programming\",typed = \"ppprroogrraammmmiinngggg\") == True\n assert candidate(name = \"mississippi\",typed = \"mmyisssssippis\") == False\n assert candidate(name = \"longpress\",typed = \"lloongggppppreeessss\") == True\n assert candidate(name = \"aaaabbbbcccc\",typed = \"aaaabbbbbbcccc\") == True\n assert candidate(name = \"xy\",typed = \"xyxyxyxyxyxyxyxy\") == False\n assert candidate(name = \"unique\",typed = \"uunniiquee\") == True\n assert candidate(name = \"longpressed\",typed = \"lllllooonnggggppprrreeesss\") == False\n assert candidate(name = \"abcdefgh\",typed = \"aabbbcccdddddeeeeeffffffgggghhhh\") == True\n assert candidate(name = \"algorithm\",typed = \"aalllgggggoooooorrrriiitthhhhhmmmmm\") == True\n assert candidate(name = \"kikcxmvzi\",typed = \"kiikcxxmmvvvzzzii\") == True\n assert candidate(name = \"abcde\",typed = \"abcdeabcde\") == False\n assert candidate(name = \"keyboard\",typed = \"kkkkeeyyyboooaarrdd\") == True\n assert candidate(name = \"a\",typed = \"aaaaaaaaaaa\") == True\n assert candidate(name = \"qwerty\",typed = \"qqqqwwwwertyyyyy\") == True\n assert candidate(name = \"leetcode\",typed = \"lleettcoodde\") == True\n assert candidate(name = \"laiden\",typed = \"laidenlaiden\") == False\n assert candidate(name = \"aabbcc\",typed = \"aabbbccc\") == True\n assert candidate(name = \"characters\",typed = \"ccccchaarrrrrttaaaaccchhhhheeeersss\") == False\n assert candidate(name = \"xylophone\",typed = \"xyyylloophooneee\") == True\n assert candidate(name = \"keyboard\",typed = \"kkkkeeyyyboaaaarrrddddd\") == True\n assert candidate(name = \"elephant\",typed = \"eleelphhhaannnttt\") == False\n assert candidate(name = \"longnamehere\",typed = \"lllooonnggnnaaammmeehheerrree\") == True\n assert candidate(name = \"zebra\",typed = \"zzzeebrraaa\") == True\n assert candidate(name = \"function\",typed = \"fffuunncctttiooonnnn\") == True\n assert candidate(name = \"abcdefg\",typed = \"abcdeeeefg\") == True\n assert candidate(name = \"qwertyuiop\",typed = \"qqqwwweerrttyyuuiioopp\") == True\n assert candidate(name = \"hello\",typed = \"heeeelllllooo\") == True\n assert candidate(name = \"robert\",typed = \"rroobbeerrtt\") == True\n assert candidate(name = \"repeated\",typed = \"rrreeeepppeeeaaatteeeedd\") == True\n assert candidate(name = \"rhell\",typed = \"rhellllllll\") == True\n assert candidate(name = \"mississippi\",typed = \"mmiisssssippppi\") == False\n assert candidate(name = \"supercalifragilisticexpialidocious\",typed = \"ssuupercccaliiifffragggiilissticceexpiialiiddoouuusss\") == False\n assert candidate(name = \"triangle\",typed = \"tttriiaanngggllee\") == True\n assert candidate(name = \"variable\",typed = \"vvvvvaaarriiiaabbbblllee\") == True\n assert candidate(name = \"aabbc\",typed = \"aabbbcc\") == True\n assert candidate(name = \"abcd\",typed = \"aabbbccccdddd\") == True\n assert candidate(name = \"hello\",typed = \"heeeelllllllllo\") == True\n assert candidate(name = \"typing\",typed = \"ttypiinggggg\") == True\n assert candidate(name = \"longpressed\",typed = \"lllllonggggppppreeeesssssssppppeeeedd\") == False\n assert candidate(name = \"unique\",typed = \"uunniiqueee\") == True\n assert candidate(name = \"aaab\",typed = \"aaaaaabbbb\") == True\n assert candidate(name = \"\",typed = \"\") == True\n assert candidate(name = \"elephant\",typed = \"eeelleeeephhhhaaaalllllltttt\") == False\n assert candidate(name = \"ggg\",typed = \"ggggggggggg\") == True\n assert candidate(name = \"abcd\",typed = \"aabbccddeeffgg\") == False\n assert candidate(name = \"testing\",typed = \"testtinngg\") == True\n assert candidate(name = \"abcdef\",typed = \"aabbccddeeffgg\") == False\n assert candidate(name = \"sequence\",typed = \"sseeqqqquuuuuuennnnccccceee\") == True\n assert candidate(name = \"carlosgomez\",typed = \"cccarllloossgggoommezz\") == True\n assert candidate(name = \"elephant\",typed = \"eeellllepphaaannntt\") == True\n assert candidate(name = \"aaaaaa\",typed = \"aaaaaaaaaaaa\") == True\n assert candidate(name = \"programming\",typed = \"ppprroogggrraammmiinnnggg\") == True\n assert candidate(name = \"aaabbbccc\",typed = \"aabbbccc\") == False\n assert candidate(name = \"algorithm\",typed = \"aalllggggorrrrithhhoonnmmm\") == False\n assert candidate(name = \"abcdabcd\",typed = \"aabbccddeeffgg\") == False\n assert candidate(name = \"programming\",typed = \"pprrrooggggrrraaaaammmmmmiiiiinnnggggggggg\") == True\n assert candidate(name = \"sequence\",typed = \"sseeeequuuuueeeennnnncceeeeee\") == True\n assert candidate(name = \"farruh\",typed = \"faaarrrruuhhhh\") == True\n assert candidate(name = \"abcdefghijk\",typed = \"aabbcdddeeeffggghhhiiiijjjkkk\") == True\n assert candidate(name = \"xylophone\",typed = \"xyyyylloophooneee\") == True\n assert candidate(name = \"xylophone\",typed = \"xxxyyylloooophooooneee\") == True\n assert candidate(name = \"abcdefg\",typed = \"abcdddddeeeffffffggg\") == True\n assert candidate(name = \"carlos\",typed = \"cccaaarlllooss\") == True\n assert candidate(name = \"mississippi\",typed = \"miisissiipppi\") == False\n assert candidate(name = \"challenge\",typed = \"chhaalllaannggeee\") == False\n assert candidate(name = \"abcd\",typed = \"aabbccdd\") == True\n assert candidate(name = \"consistent\",typed = \"ccconinnsisttteeennnsssstt\") == False\n assert candidate(name = \"consistent\",typed = \"cccooonnsiisstteeeennnttt\") == True\n assert candidate(name = \"abababa\",typed = \"aabbaabbaabbaaba\") == False\n assert candidate(name = \"mississippi\",typed = \"mmiissssssiiipppp\") == False\n assert candidate(name = \"example\",typed = \"eexxaammmppllee\") == True\n assert candidate(name = \"testcase\",typed = \"tteeeessttccaaase\") == True\n assert candidate(name = \"aaa\",typed = \"aaaaa\") == True\n assert candidate(name = \"friend\",typed = \"frrriieeedd\") == False\n assert candidate(name = \"algorithm\",typed = \"aalllgggggoooooorrriiithhhhhmmmmm\") == True\n assert candidate(name = \"xyz\",typed = \"xxxyyyzzz\") == True\n assert candidate(name = \"xyz\",typed = \"xxyyyzzz\") == True\n assert candidate(name = \"longpressed\",typed = \"lllllooonngggpppprrreeeesssssseeeedd\") == True\n assert candidate(name = \"complexity\",typed = \"cccomppplleexxiittiityyy\") == False\n assert candidate(name = \"zebra\",typed = \"zzzeeebrrraa\") == True\n"}, "metadata": {"canonical_parameter_names": ["name", "typed"], "leetcode_dataset_entry_point": "Solution().isLongPressedName", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isLongPressedName = function(name, typed) {", "container": null, "callable": "isLongPressedName", "parameters": [{"name": "name", "type": "string"}, {"name": "typed", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 926, "task_id": "flip-string-to-monotone-increasing", "difficulty": "Medium", "problem_description": "A binary string is monotone increasing if it consists of some number of 0's (possibly none), followed by some number of 1's (also possibly none).\nYou are given a binary string s. You can flip s[i] changing it from 0 to 1 or from 1 to 0.\nReturn the minimum number of flips to make s monotone increasing.\n \nExample 1:\n\nInput: s = \"00110\"\nOutput: 1\nExplanation: We flip the last digit to get 00111.\n\nExample 2:\n\nInput: s = \"010110\"\nOutput: 2\nExplanation: We flip to get 011111, or alternatively 000111.\n\nExample 3:\n\nInput: s = \"00011000\"\nOutput: 2\nExplanation: We flip to get 00000000.\n\n \nConstraints:\n\n1 <= s.length <= 105\ns[i] is either '0' or '1'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"1100110\") == 3\n assert candidate(s = \"1111000011110000\") == 8\n assert candidate(s = \"101010101\") == 4\n assert candidate(s = \"111000111000\") == 6\n assert candidate(s = \"000100110\") == 2\n assert candidate(s = \"00011000\") == 2\n assert candidate(s = \"0000000001\") == 0\n assert candidate(s = \"1100001111\") == 2\n assert candidate(s = \"0011110000\") == 4\n assert candidate(s = \"00110011001100\") == 6\n assert candidate(s = \"1000000000\") == 1\n assert candidate(s = \"11111\") == 0\n assert candidate(s = \"0011001100\") == 4\n assert candidate(s = \"11001100110011\") == 6\n assert candidate(s = \"010110\") == 2\n assert candidate(s = \"00110\") == 1\n assert candidate(s = \"1010101010\") == 5\n assert candidate(s = \"1100110011\") == 4\n assert candidate(s = \"0101010101\") == 4\n assert candidate(s = \"0100110011\") == 3\n assert candidate(s = \"0111111111\") == 0\n assert candidate(s = \"00000\") == 0\n assert candidate(s = \"1111111111111100000000000000\") == 14\n assert candidate(s = \"11111111100000000001111111111111110000000\") == 16\n assert candidate(s = \"101010101010101010\") == 9\n assert candidate(s = \"000111000111000111000\") == 9\n assert candidate(s = \"00110100101100110011000011110011\") == 12\n assert candidate(s = \"0000011111000000111111000000111111000000\") == 17\n assert candidate(s = \"10101010100101010101010101\") == 12\n assert candidate(s = \"100110011001100110\") == 8\n assert candidate(s = \"1101010101010101010101010101010101010101\") == 19\n assert candidate(s = \"0000000000000011111111111111\") == 0\n assert candidate(s = \"10101010101010101010101010101010101010101010101010\") == 25\n assert candidate(s = \"000000000000000000000000000000\") == 0\n assert candidate(s = \"0110110110110110110110110110\") == 9\n assert candidate(s = \"0001000100010001\") == 3\n assert candidate(s = \"000111000111000111000111000111000111000111000111\") == 21\n assert candidate(s = \"00000000111111110000000011111111\") == 8\n assert candidate(s = \"10101010101010101010101010\") == 13\n assert candidate(s = \"001100110011001100110011\") == 10\n assert candidate(s = \"00001111000011110000\") == 8\n assert candidate(s = \"100000000000001\") == 1\n assert candidate(s = \"0011010010011001001100100110\") == 11\n assert candidate(s = \"0000000000011111111111111111\") == 0\n assert candidate(s = \"101010101010101010101010\") == 12\n assert candidate(s = \"110100111001101\") == 6\n assert candidate(s = \"1100110011001100110011001100110011001100110011001100\") == 26\n assert candidate(s = \"00000000000000\") == 0\n assert candidate(s = \"101010001010100010101000101\") == 10\n assert candidate(s = \"011111111111111111110\") == 1\n assert candidate(s = \"11001100110011001100110011001100\") == 16\n assert candidate(s = \"101010101010101010101010101010\") == 15\n assert candidate(s = \"1010101010101010\") == 8\n assert candidate(s = \"111100001111000011110000111100001111\") == 16\n assert candidate(s = \"10000011111111000001111\") == 6\n assert candidate(s = \"000011110000111100001111000011110000\") == 16\n assert candidate(s = \"00011010011101110011\") == 6\n assert candidate(s = \"0000111100001111000011110000\") == 12\n assert candidate(s = \"00110011001100110011001100110011\") == 14\n assert candidate(s = \"11110000111100001111\") == 8\n assert candidate(s = \"01010101010101010101010101\") == 12\n assert candidate(s = \"00001111110000111111000011\") == 8\n assert candidate(s = \"10101000001111110010\") == 6\n assert candidate(s = \"11111111111111111111111\") == 0\n assert candidate(s = \"01010101010101010101010101010101010101010101010101\") == 24\n assert candidate(s = \"11111111111111111111\") == 0\n assert candidate(s = \"01100110011001100110011001100110011001100110011001\") == 24\n assert candidate(s = \"11111100000000000000111111111111000000\") == 12\n assert candidate(s = \"1001001101100110011001100110\") == 12\n assert candidate(s = \"00000000001111111111111111110000000\") == 7\n assert candidate(s = \"01011001010110011011\") == 8\n assert candidate(s = \"00000000001111111111\") == 0\n assert candidate(s = \"100000000000000000001\") == 1\n assert candidate(s = \"1111111111100000000000000000\") == 11\n assert candidate(s = \"010101010101010101010101010101\") == 14\n assert candidate(s = \"01000000000000000000010\") == 2\n assert candidate(s = \"01010101010101010101010100\") == 12\n assert candidate(s = \"111000111000111000111\") == 9\n assert candidate(s = \"11001100110011001100\") == 10\n assert candidate(s = \"11111111110000000000\") == 10\n assert candidate(s = \"01010101010101010101010101010101\") == 15\n assert candidate(s = \"11100000111100001111100000111111000000\") == 18\n assert candidate(s = \"11111111111111110000000000000000000000000000000000\") == 16\n assert candidate(s = \"1010101010101010101010101010\") == 14\n assert candidate(s = \"111000111000111000111000111\") == 12\n assert candidate(s = \"01011001010110011011010101011010\") == 14\n assert candidate(s = \"1111000000111100000011110000001111000000\") == 16\n assert candidate(s = \"00000000011111111110000000001111111111111000000000\") == 18\n assert candidate(s = \"10011001100110011001100110\") == 12\n assert candidate(s = \"0000000001111111111000000000\") == 9\n assert candidate(s = \"1111000011110000111100001111000011110000\") == 20\n assert candidate(s = \"1001001001001001001001001001001001001001001001001001001001001\") == 20\n assert candidate(s = \"11101010101010101010\") == 9\n assert candidate(s = \"1100010100111001\") == 6\n assert candidate(s = \"1100110011001100110011001100\") == 14\n assert candidate(s = \"11110000111100001111000011110000\") == 16\n assert candidate(s = \"01001001001001001001001001001001001001001\") == 13\n assert candidate(s = \"111111000000\") == 6\n assert candidate(s = \"11010101010101\") == 6\n assert candidate(s = \"1100101010110010\") == 8\n assert candidate(s = \"1110001110001110001110001110\") == 13\n assert candidate(s = \"0000011111111110\") == 1\n assert candidate(s = \"111100000001111111100000\") == 9\n assert candidate(s = \"0101010101010101010101010101\") == 13\n assert candidate(s = \"00000000000000000000000\") == 0\n assert candidate(s = \"000111000111000111000111000111\") == 12\n assert candidate(s = \"01010101010101010101010100101010101010101010101010\") == 24\n assert candidate(s = \"111110000011110000111111100000\") == 14\n assert candidate(s = \"00000000000000001111111111\") == 0\n assert candidate(s = \"00000011111111111111000000000000111111\") == 12\n assert candidate(s = \"00001111000011110000111100001111\") == 12\n assert candidate(s = \"00000000000000000000\") == 0\n assert candidate(s = \"111111111111111111111111111111\") == 0\n assert candidate(s = \"10101010101010101010101010101010\") == 16\n assert candidate(s = \"10101010100101010101010101010101010101010101010101\") == 24\n assert candidate(s = \"01010101010101010101010101010101010101010101010101010101\") == 27\n assert candidate(s = \"000111000111000111000111000\") == 12\n assert candidate(s = \"00000000000000001111111111111111111111111111111111\") == 0\n assert candidate(s = \"101010101010101010101010101010101010101010101010\") == 24\n assert candidate(s = \"0101010100100100111100001111000011111111\") == 14\n assert candidate(s = \"01010101010101\") == 6\n assert candidate(s = \"01100110011001100110011001\") == 12\n assert candidate(s = \"00110100101100110011\") == 8\n assert candidate(s = \"100011110001111000111100011110001111\") == 13\n assert candidate(s = \"101010101000000000001111111111111010101010\") == 10\n assert candidate(s = \"1010101010101010101010101010101010101010\") == 20\n assert candidate(s = \"1111000011110000111100001111\") == 12\n assert candidate(s = \"00011100011100011100\") == 8\n assert candidate(s = \"011111111111110\") == 1\n assert candidate(s = \"0001110001110001110000011111\") == 9\n assert candidate(s = \"0000111100001111000011110000111100001111\") == 16\n assert candidate(s = \"10101000001111110010101010100000\") == 14\n assert candidate(s = \"0011001100110011001100110011\") == 12\n assert candidate(s = \"01010101010101010101\") == 9\n assert candidate(s = \"11001011100101100110101011100101\") == 14\n assert candidate(s = \"1001001001001001001001001001\") == 9\n assert candidate(s = \"000110011001100110011001100110011001100110\") == 19\n assert candidate(s = \"11111111111111\") == 0\n assert candidate(s = \"10101010101010101010\") == 10\n assert candidate(s = \"10011001100110011001100110011001100110011001100110\") == 24\n assert candidate(s = \"000000111111000000111111000000\") == 12\n assert candidate(s = \"00001111110000111111000011111100001111110000111111\") == 16\n assert candidate(s = \"11111111111111110000000000\") == 10\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().minFlipsMonoIncr", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minFlipsMonoIncr = function(s) {", "container": null, "callable": "minFlipsMonoIncr", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 927, "task_id": "three-equal-parts", "difficulty": "Hard", "problem_description": "You are given an array arr which consists of only zeros and ones, divide the array into three non-empty parts such that all of these parts represent the same binary value.\nIf it is possible, return any [i, j] with i + 1 < j, such that:\n\narr[0], arr[1], ..., arr[i] is the first part,\narr[i + 1], arr[i + 2], ..., arr[j - 1] is the second part, and\narr[j], arr[j + 1], ..., arr[arr.length - 1] is the third part.\nAll three parts have equal binary values.\n\nIf it is not possible, return [-1, -1].\nNote that the entire part is used when considering what binary value it represents. For example, [1,1,0] represents 6 in decimal, not 3. Also, leading zeros are allowed, so [0,1,1] and [1,1] represent the same value.\n \nExample 1:\nInput: arr = [1,0,1,0,1]\nOutput: [0,3]\nExample 2:\nInput: arr = [1,1,0,1,1]\nOutput: [-1,-1]\nExample 3:\nInput: arr = [1,1,0,0,1]\nOutput: [0,2]\n\n \nConstraints:\n\n3 <= arr.length <= 3 * 104\narr[i] is 0 or 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 0, 1, 0, 1]) == [0, 3]\n assert candidate(arr = [0, 0, 0]) == [0, 2]\n assert candidate(arr = [1, 1, 0, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 1, 0, 0, 1, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 1, 0, 0, 1, 0, 0]) == [2, 6]\n assert candidate(arr = [1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1]) == [2, 8]\n assert candidate(arr = [0, 0, 0, 0, 0, 0]) == [0, 5]\n assert candidate(arr = [1, 0, 1, 1, 0, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 0, 0, 1]) == [0, 2]\n assert candidate(arr = [1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [11, 16]\n assert candidate(arr = [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0]) == [-1, -1]\n assert candidate(arr = [1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]) == [4, 13]\n assert candidate(arr = [0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0]) == [-1, -1]\n assert candidate(arr = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]) == [6, 11]\n assert candidate(arr = [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]) == [2, 13]\n assert candidate(arr = [1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1]) == [2, 12]\n assert candidate(arr = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == [0, 13]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0]) == [4, 8]\n assert candidate(arr = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]) == [5, 11]\n assert candidate(arr = [1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [-1, -1]\n assert candidate(arr = [1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1]) == [-1, -1]\n assert candidate(arr = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [3, 8]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0]) == [-1, -1]\n assert candidate(arr = [1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0]) == [7, 14]\n assert candidate(arr = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]) == [3, 10]\n assert candidate(arr = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]) == [-1, -1]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0]) == [-1, -1]\n assert candidate(arr = [0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0]) == [-1, -1]\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [0, 19]\n assert candidate(arr = [1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1]) == [2, 9]\n assert candidate(arr = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0]) == [-1, -1]\n assert candidate(arr = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [3, 8]\n assert candidate(arr = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1]) == [5, 14]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [2, 7]\n assert candidate(arr = [1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]) == [-1, -1]\n assert candidate(arr = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0]) == [-1, -1]\n assert candidate(arr = [0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0]) == [6, 12]\n assert candidate(arr = [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1]) == [0, 13]\n assert candidate(arr = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [6, 15]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [5, 12]\n assert candidate(arr = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]) == [3, 9]\n assert candidate(arr = [0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0]) == [-1, -1]\n assert candidate(arr = [0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]) == [7, 14]\n assert candidate(arr = [1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [-1, -1]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0]) == [7, 16]\n assert candidate(arr = [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0]) == [-1, -1]\n assert candidate(arr = [0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1]) == [4, 10]\n assert candidate(arr = [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]) == [-1, -1]\n assert candidate(arr = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [5, 12]\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().threeEqualParts", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var threeEqualParts = function(arr) {", "container": null, "callable": "threeEqualParts", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 928, "task_id": "minimize-malware-spread-ii", "difficulty": "Hard", "problem_description": "You are given a network of n nodes represented as an n x n adjacency matrix graph, where the ith node is directly connected to the jth node if graph[i][j] == 1.\nSome nodes initial are initially infected by malware. Whenever two nodes are directly connected, and at least one of those two nodes is infected by malware, both nodes will be infected by malware. This spread of malware will continue until no more nodes can be infected in this manner.\nSuppose M(initial) is the final number of nodes infected with malware in the entire network after the spread of malware stops.\nWe will remove exactly one node from initial, completely removing it and any connections from this node to any other node.\nReturn the node that, if removed, would minimize M(initial). If multiple nodes could be removed to minimize M(initial), return such a node with the smallest index.\n \nExample 1:\nInput: graph = [[1,1,0],[1,1,0],[0,0,1]], initial = [0,1]\nOutput: 0\nExample 2:\nInput: graph = [[1,1,0],[1,1,1],[0,1,1]], initial = [0,1]\nOutput: 1\nExample 3:\nInput: graph = [[1,1,0,0],[1,1,1,0],[0,1,1,1],[0,0,1,1]], initial = [0,1]\nOutput: 1\n\n \nConstraints:\n\nn == graph.length\nn == graph[i].length\n2 <= n <= 300\ngraph[i][j] is 0 or 1.\ngraph[i][j] == graph[j][i]\ngraph[i][i] == 1\n1 <= initial.length < n\n0 <= initial[i] <= n - 1\nAll the integers in initial are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(graph = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1]],initial = [3, 4]) == 3\n assert candidate(graph = [[1, 1, 0, 0], [1, 1, 1, 0], [0, 1, 1, 1], [0, 0, 1, 1]],initial = [0, 1]) == 1\n assert candidate(graph = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]],initial = [2, 3]) == 2\n assert candidate(graph = [[1, 0, 0, 0, 0], [0, 1, 1, 0, 0], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [0, 0, 1, 0, 1]],initial = [3, 4]) == 3\n assert candidate(graph = [[1, 1, 0], [1, 1, 0], [0, 0, 1]],initial = [0, 1]) == 0\n assert candidate(graph = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],initial = [0, 1, 2]) == 0\n assert candidate(graph = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],initial = [0, 1]) == 0\n assert candidate(graph = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]],initial = [0, 1, 3]) == 3\n assert candidate(graph = [[1, 1, 1, 0], [1, 1, 0, 1], [1, 0, 1, 1], [0, 1, 1, 1]],initial = [0, 1]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1]],initial = [3, 4]) == 3\n assert candidate(graph = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],initial = [1, 2]) == 1\n assert candidate(graph = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]],initial = [0, 1]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]],initial = [2, 5, 8, 10, 12]) == 2\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 2, 4, 6, 8]) == 2\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 0, 0, 0, 0], [0, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]],initial = [1, 4, 6, 8, 9]) == 1\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1]],initial = [3, 5, 7]) == 3\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 2, 4, 6, 8]) == 8\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 3, 7, 9]) == 0\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 7, 9, 10]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 7]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 2, 4, 5, 7]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 7, 10, 11]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 3, 5, 7]) == 7\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 4, 6, 7]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 0, 1], [0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 1, 1, 1]],initial = [0, 2, 3]) == 0\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [0, 3, 6]) == 0\n assert candidate(graph = [[1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 0, 1, 1]],initial = [0, 2, 5, 7]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [1, 2, 5]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 7, 8]) == 0\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 3, 5, 7, 9]) == 9\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 3, 5, 7]) == 0\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 1, 4, 6]) == 6\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 3, 6, 8, 9]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 3, 5, 7]) == 1\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 1, 1], [0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 0, 1]],initial = [1, 3, 4]) == 4\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 3, 5, 7, 9, 11]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 0, 1]],initial = [1, 3, 5]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1]],initial = [0, 2, 5, 7, 9]) == 0\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [2, 5, 8, 10, 11]) == 2\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [0, 3, 5]) == 5\n assert candidate(graph = [[1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1]],initial = [0, 2, 5]) == 5\n assert candidate(graph = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0], [0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 1, 0], [0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [0, 3, 4]) == 4\n assert candidate(graph = [[1, 1, 0, 0, 1, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1]],initial = [1, 4]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [2, 4, 5]) == 2\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [2, 3, 5, 8]) == 2\n assert candidate(graph = [[1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1]],initial = [0, 3, 5]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]],initial = [2, 5, 7]) == 2\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 3, 5, 7, 9]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 6]) == 0\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [0, 3, 5, 6]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 3, 5, 8, 10]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 2, 4, 6, 8, 10]) == 0\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 1, 1, 0, 0, 0], [1, 0, 1, 0, 1, 1, 0, 0], [0, 1, 0, 1, 0, 0, 1, 1], [0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 1, 0, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0, 1]],initial = [2, 4, 6]) == 2\n assert candidate(graph = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [1, 4, 5]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [0, 1, 5]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [2, 3, 5, 7, 8]) == 2\n assert candidate(graph = [[1, 1, 0, 0, 1, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 0, 1, 1, 0, 0], [1, 0, 1, 0, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [0, 3, 5]) == 0\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1, 1], [0, 0, 1, 0, 1, 0, 0], [0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1]],initial = [1, 3, 4, 5]) == 3\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 7, 8, 10]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]],initial = [0, 2, 5]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]],initial = [1, 3, 4, 6, 8, 10]) == 1\n assert candidate(graph = [[1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [1, 1, 1, 1, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 1]],initial = [2, 3, 4]) == 2\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]],initial = [0, 2, 5, 7, 9, 10]) == 0\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1]],initial = [1, 2, 5]) == 1\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 1], [0, 0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 0, 1, 1]],initial = [0, 5]) == 5\n assert candidate(graph = [[1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1]],initial = [1, 4, 6]) == 1\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 1]],initial = [1, 3, 5, 8]) == 1\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [0, 4, 8]) == 4\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 4, 7, 9]) == 1\n assert candidate(graph = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 0, 1, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [2, 5, 7]) == 7\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1]],initial = [1, 4, 7]) == 1\n assert candidate(graph = [[1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [0, 2, 4, 6]) == 0\n assert candidate(graph = [[1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 1]],initial = [1, 3, 5]) == 5\n assert candidate(graph = [[1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 1, 0, 0], [0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 1, 0], [0, 1, 0, 1, 1, 0, 0], [0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1]],initial = [2, 3, 6]) == 2\n"}, "metadata": {"canonical_parameter_names": ["graph", "initial"], "leetcode_dataset_entry_point": "Solution().minMalwareSpread", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minMalwareSpread = function(graph, initial) {", "container": null, "callable": "minMalwareSpread", "parameters": [{"name": "graph", "type": "number[][]"}, {"name": "initial", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 929, "task_id": "unique-email-addresses", "difficulty": "Easy", "problem_description": "Every valid email consists of a local name and a domain name, separated by the '@' sign. Besides lowercase letters, the email may contain one or more '.' or '+'.\n\nFor example, in \"alice@leetcode.com\", \"alice\" is the local name, and \"leetcode.com\" is the domain name.\n\nIf you add periods '.' between some characters in the local name part of an email address, mail sent there will be forwarded to the same address without dots in the local name. Note that this rule does not apply to domain names.\n\nFor example, \"alice.z@leetcode.com\" and \"alicez@leetcode.com\" forward to the same email address.\n\nIf you add a plus '+' in the local name, everything after the first plus sign will be ignored. This allows certain emails to be filtered. Note that this rule does not apply to domain names.\n\nFor example, \"m.y+name@email.com\" will be forwarded to \"my@email.com\".\n\nIt is possible to use both of these rules at the same time.\nGiven an array of strings emails where we send one email to each emails[i], return the number of different addresses that actually receive mails.\n \nExample 1:\n\nInput: emails = [\"test.email+alex@leetcode.com\",\"test.e.mail+bob.cathy@leetcode.com\",\"testemail+david@lee.tcode.com\"]\nOutput: 2\nExplanation: \"testemail@leetcode.com\" and \"testemail@lee.tcode.com\" actually receive mails.\n\nExample 2:\n\nInput: emails = [\"a@leetcode.com\",\"b@leetcode.com\",\"c@leetcode.com\"]\nOutput: 3\n\n \nConstraints:\n\n1 <= emails.length <= 100\n1 <= emails[i].length <= 100\nemails[i] consist of lowercase English letters, '+', '.' and '@'.\nEach emails[i] contains exactly one '@' character.\nAll local and domain names are non-empty.\nLocal names do not start with a '+' character.\nDomain names end with the \".com\" suffix.\nDomain names must contain at least one character before \".com\" suffix.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(emails = ['user.name+foo@hostname.com', 'user.name+bar@hostname.com', 'user.name@hostname.com']) == 1\n assert candidate(emails = ['m.y+name@email.com', 'my.name@email.com', 'myname@email.com']) == 2\n assert candidate(emails = ['m.y+name@email.com', 'my@email.com', 'm+y.name@email.com']) == 2\n assert candidate(emails = ['me+alex@leetcode.com', 'me@leetcode.com']) == 1\n assert candidate(emails = ['m.y+name@email.com', 'my@email.com']) == 1\n assert candidate(emails = ['alice.z@leetcode.com', 'alicez@leetcode.com']) == 1\n assert candidate(emails = ['foo@bar.com', 'foo@bar.com', 'foo@bar.com']) == 1\n assert candidate(emails = ['test.email+alex@leetcode.com', 'test.e.mail+bob.cathy@leetcode.com', 'testemail+david@lee.tcode.com']) == 2\n assert candidate(emails = ['my.email@gmail.com', 'myemail+foo@gmail.com', 'my_email+bar@gmail.com']) == 2\n assert candidate(emails = ['a+b@leetcode.com', 'a@leetcode.com+b', 'a+b+c+d@leetcode.com']) == 2\n assert candidate(emails = ['my.email+alex@leetcode.com', 'my.e.mail+alex@leetcode.com', 'myemail+alex@leetcode.com']) == 1\n assert candidate(emails = ['foo@gmail.com+foo', 'foo2@gmail.com+bar', 'foo3@gmail.com+baz']) == 3\n assert candidate(emails = ['foo@bar.com', 'foo.bar@bar.com', 'foo.bar.baz@bar.com']) == 3\n assert candidate(emails = ['john.doe@example.com', 'john.doe+foo@example.com', 'johndoe@example.com']) == 1\n assert candidate(emails = ['alice+bob.cathy@leetcode.com', 'alice.bob.cathy@leetcode.com', 'alicebobcathy@leetcode.com']) == 2\n assert candidate(emails = ['alice.z@leetcode.com', 'alicez@leetcode.com', 'al.icez@leetcode.com']) == 1\n assert candidate(emails = ['foo@bar.com', 'foo@bar.com']) == 1\n assert candidate(emails = ['alex@leetcode.com', 'alex+alex@leetcode.com', 'alex.alex@leetcode.com']) == 2\n assert candidate(emails = ['a@leetcode.com', 'b@leetcode.com', 'c@leetcode.com']) == 3\n assert candidate(emails = ['user.name+tag+more@domain.co.uk', 'user.name+tag@domain.co.uk', 'user+tag@domain.co.uk', 'user@domain.co.uk']) == 2\n assert candidate(emails = ['email+filter@domain.com', 'email@domain.com', 'email+filter+ignore@domain.com', 'email.filter@domain.com']) == 2\n assert candidate(emails = ['user.name+tag@domain.com', 'user.name.tag@domain.com', 'user.name@domain.com', 'user.name@sub.domain.com', 'user.name+tag@sub.domain.com', 'user.name.tag@sub.domain.com']) == 4\n assert candidate(emails = ['john.doe+newsletter@domain.com', 'johndoe+offers@domain.com', 'johndoe@sub.domain.com', 'john.doe@domain.co.uk']) == 3\n assert candidate(emails = ['user.name+tag@domain.co', 'user.name@domain.co', 'user.name+tag+another.tag@domain.co']) == 1\n assert candidate(emails = ['john.doe+extra.info@company.org', 'john.doe@company.org', 'john.doe+extra+info@company.org', 'john.doe+extra+info+more@company.org']) == 1\n assert candidate(emails = ['alice..bob.cathy@leetcode.com', 'alice+bob.cathy@leetcode.com', 'alice+bob..cathy@leetcode.com']) == 2\n assert candidate(emails = ['john.doe+notes@leetcode.com', 'john.doe+notes1@leetcode.com', 'johndoe+notes@leetcode.com', 'john.doe@leetcode.com']) == 1\n assert candidate(emails = ['a+b+c+d@domain.com', 'a.b.c.d@domain.com', 'abcd@domain.com', 'a..b.c+d.@domain.com']) == 3\n assert candidate(emails = ['user.name+tag+sorting@example.com', 'user.name@example.com', 'user.name+sorting@example.com', 'user+name@example.com', 'user+name+tag@example.com', 'user+name+tag+sorting@example.com']) == 2\n assert candidate(emails = ['john.doe+some.text@domain.com', 'johndoe+some.text@domain.com', 'johndoe@domain.com', 'john.doe@domain.com']) == 1\n assert candidate(emails = ['multiple+dots.here+ignore@sample.com', 'multiple+dots.here@sample.com', 'multiple.dots+here@sample.com', 'multiple.dots.here@sample.com']) == 3\n assert candidate(emails = ['user.name+foo@domain.com', 'user+name@domain.com', 'user.name+foo.bar@domain.com', 'user+name+foo@domain.com', 'user.name+bar.foo@domain.com', 'user+bar.foo@domain.com']) == 2\n assert candidate(emails = ['multiple+parts+in+the+local@name.com', 'multiple.parts.in.the.local@name.com', 'multiple+parts+in.the+local@name.com', 'multiple.parts+in+the.local@name.com', 'multiplepartsinthe.local@name.com']) == 3\n assert candidate(emails = ['my.email+alex@leetcode.com', 'my.e.mail+alex@leetcode.com', 'myemail+alex@leetcode.com', 'my.email+alex@leetcode.co.uk', 'my.e.mail+alex@leetcode.co.uk', 'myemail+alex@leetcode.co.uk']) == 2\n assert candidate(emails = ['a.b.c.d+e@website.com', 'abcd@website.com', 'a.b.c.d@website.com', 'abc.d+efg@website.com', 'a.b.c.d+efg@website.com', 'a.b.c+defg@website.com']) == 2\n assert candidate(emails = ['alice.z@leetcode.com', 'alicez@leetcode.com', 'al.i.c.e+blog@leetcode.com', 'alic.e@leetcode.com']) == 2\n assert candidate(emails = ['user@my+invalid+input.com', 'user.myinvalid+input@com', 'user.my+invalid@input.com', 'user@myinvalidinput+com']) == 4\n assert candidate(emails = ['email.name+suffix@sub.domain.com', 'email+suffix@sub.domain.com', 'email.name@sub.domain.com']) == 2\n assert candidate(emails = ['user.name+tag1+tag2@domain.com', 'user.name+tag1.tag2@domain.com', 'user+name+tag1.tag2@domain.com']) == 2\n assert candidate(emails = ['example.email+alex@leetcode.com', 'e.x.a.m.p.l.e.e.mail+bob.cathy@leetcode.com', 'ex.ampleemail+david@lee.tcode.com', 'ex.ample.email+david@lee.tcode.com']) == 2\n assert candidate(emails = ['alice+bob.cathy@leetcode.com', 'alice.bob.cathy@leetcode.com', 'alice.bob+cathy@leetcode.com', 'alice+bob+cathy@leetcode.com']) == 3\n assert candidate(emails = ['name@domain.com', 'name@sub.domain.com', 'name+suffix@sub.domain.com', 'name.suffix@domain.com']) == 3\n assert candidate(emails = ['user.name@domain.com', 'user.name+everything_after@domain.com', 'user.name.+everything_after@domain.com']) == 1\n assert candidate(emails = ['my.email+alex@leetcode.com', 'my.e.mail+alex@leetcode.com', 'myemail+alex@leetcode.com', 'my.email+alex@leetcode.co.uk', 'my.e.mail+alex@sub.leetcode.com']) == 3\n assert candidate(emails = ['peter.parker+spiderman@marvel.com', 'peter.parker+spiderman+amazing@marvel.com', 'peter+spiderman@marvel.com', 'spiderman+@marvel.com']) == 3\n assert candidate(emails = ['complex+part.with.dots@complex.com', 'complex.partwithdots@complex.com', 'complexpart+with.dots@complex.com', 'complexpartwithdots@complex.com']) == 3\n assert candidate(emails = ['jane.doe+newsletter@example.com', 'jane.doe@example.com', 'janedoe@example.com', 'jane.doe.+ignore@example.com', 'jane.doe+ignore@example.co.uk', 'jane+doe@example.com']) == 3\n assert candidate(emails = ['long.email.name+with.many.dots.and.tags@longdomain.com', 'long.email+name+with.many.dots.and.tags@longdomain.com', 'longemail+name+with.many.dots.and.tags@longdomain.com', 'longemailname+with.many.dots.and.tags@longdomain.com']) == 2\n assert candidate(emails = ['tom+tommy+tomm@mydomain.com', 'tommy.tom+tom@mydomain.com', 'tom.tommy.tom+tommy@mydomain.com', 'tommy+tom+tommy@mydomain.com', 'tom.tommy@mydomain.com']) == 5\n assert candidate(emails = ['user+ignore@domain.com', 'user+ignore@sub.domain.com', 'user+ignore@subdomain.com', 'user@domain.com', 'user@sub.domain.com', 'user@subdomain.com']) == 3\n assert candidate(emails = ['user.name@sub.domain.com', 'user.name+ignore@sub.domain.com', 'user.name@sub.domain.org', 'user.name+ignore@sub.domain.org']) == 2\n assert candidate(emails = ['user@sub.domain.com', 'user@subdomain.com', 'user.sub@domain.com']) == 3\n assert candidate(emails = ['first.last+tag1+tag2@service.com', 'firstlast+tag1tag2@service.com', 'first.last@service.com']) == 1\n assert candidate(emails = ['a.b.c+d.e.f+g.h.i@website.com', 'a.b.c.d.e.f.g.h.i@website.com', 'a+b+c+d+e+f+g+h+i@website.com']) == 3\n assert candidate(emails = ['abc.d.+def@example.com', 'abc.d+def@example.com', 'abc.def@example.com', 'abc.d.@example.com', 'abc.d+@example.com']) == 2\n assert candidate(emails = ['user+ignore.all.this@mydomain.net', 'user@mydomain.net', 'user.name+ignore@mydomain.net', 'user.name@mydomain.net']) == 2\n assert candidate(emails = ['a.b.c.d.e@domain.com', 'a+b+c+d+e@domain.com', 'abcde@domain.com', 'a.b+c.d+e@domain.com', 'a+b.c.d.e@domain.com']) == 3\n assert candidate(emails = ['user@sub.domain.com', 'user@sub.sub.domain.com', 'user.sub@sub.domain.com', 'user@sub.domain.co', 'user@sub.domain.co.uk']) == 5\n assert candidate(emails = ['user.name+tag+ignore@domain.com', 'user.name+tag_ignore@domain.com', 'user.name+tag_ignore@domain.co.uk']) == 2\n assert candidate(emails = ['user.name+foo@sub.domain.com', 'user.name@sub.domain.com', 'user+name@sub.domain.com', 'user@sub.domain.com']) == 2\n assert candidate(emails = ['user.name+foo@domain.com', 'user+name@domain.com', 'user.name+foo.bar@domain.com', 'user+name+foo@domain.com']) == 2\n assert candidate(emails = ['user.name+tag+info@domain.com', 'user.name+tag@domain.com', 'user.name@domain.com', 'user+name@domain.com', 'username@domain.com']) == 2\n assert candidate(emails = ['x+y.z+@example.com', 'x.y.z.@example.com', 'x.y.z@example.com', 'x+y+z@example.com', 'x.y.z+tag@example.com']) == 2\n assert candidate(emails = ['first.last+alias1@domain.org', 'first.last+alias2@domain.org', 'first.last+alias1@another.org', 'first.last@another.org']) == 2\n assert candidate(emails = ['user.name+tag+sorting@example.com', 'user.name@example.com', 'user.name+sorting@example.com', 'user+name@example.com', 'user+name+tag@example.com']) == 2\n assert candidate(emails = ['nested+dot.and.plus@sub.sub.domain.com', 'nested.dot.and.plus@sub.sub.domain.com', 'nested+dot.and+plus@subdomain.com', 'nested.dot.and.plus@subdomain.com']) == 4\n assert candidate(emails = ['alice+bob.cathy+david@leetcode.com', 'alice.david+bob.cathy@leetcode.com', 'alice+david@leetcode.com']) == 2\n assert candidate(emails = ['user.name+tag+more@sub.domain.com', 'user.name+tag@sub.domain.com', 'user+tag@sub.domain.com', 'user@sub.domain.com']) == 2\n assert candidate(emails = ['user@domain.com', 'user+tag@domain.com', 'user+tag+ignore@domain.com', 'user+tag@domain.co.uk', 'user+tag@sub.domain.com']) == 3\n assert candidate(emails = ['nested+dot.dot.dot@domain.org', 'nested.dot+dot.dot@domain.org', 'nested.dot.dot+dot@domain.org', 'nesteddot.dotdot@domain.org', 'nesteddotdotdot@domain.org']) == 4\n assert candidate(emails = ['john.doe+newsletter@tech.com', 'johndoe+news+letter@tech.com', 'john+doe+news@tech.com', 'johndoe@tech.com']) == 2\n assert candidate(emails = ['contact+info@info.contact.org', 'contact.info@info.contact.org', 'contact.info+more@info.contact.org', 'contact+info+more@info.contact.org']) == 2\n assert candidate(emails = ['user.name+ignore.this.part@domain.co.uk', 'user.name@domain.co.uk', 'user+name@domain.co.uk', 'user@domain.co.uk', 'user.name+another.part@domain.co.uk']) == 2\n assert candidate(emails = ['user.name+tag@domain.co.uk', 'user.name@domain.co.uk', 'user+name@domain.co.uk', 'user.name+@domain.co.uk']) == 2\n assert candidate(emails = ['john.doe+newsletter@tech.com', 'johndoe+news+letter@tech.com', 'john+doe+news@tech.com', 'johndoe@tech.com', 'johndoe+ignore@tech.com', 'john.doe+ignore@tech.com']) == 2\n assert candidate(emails = ['email.with+plus.and.dots@website.com', 'emailwith+plusanddots@website.com', 'emailwithplus.anddots@website.com', 'emailwithplusanddots@website.com']) == 2\n assert candidate(emails = ['a.b.c+d@domain.com', 'a.b.c+e+f@domain.com', 'a+b+c+d@domain.com', 'a.b.c.d@domain.com']) == 3\n assert candidate(emails = ['user+name+with+many+pluses@mydomain.com', 'user+name.with+many+pluses@mydomain.com', 'user.name+with+many+pluses@mydomain.com', 'user.name.with+many+pluses@mydomain.com', 'user.name.with.many+pluses@mydomain.com']) == 4\n assert candidate(emails = ['john.doe+department=mailing@company.com', 'jane.doe+department=hr@company.com', 'johndoe@company.com']) == 2\n assert candidate(emails = ['a.b.c+d.e.f@domain.com', 'a.b.c.d.e.f@domain.com', 'a+b.c+d.e.f@domain.com', 'a+b.c.d.e.f@domain.com', 'a.b+c.d.e+f@domain.com']) == 4\n assert candidate(emails = ['test.email+alex@leetcode.com', 'test.e.mail+bob.cathy@leetcode.com', 'testemail+david@lee.tcode.com', 'test.email+david@lee.tcode.com', 'testemail+david+extra@lee.tcode.com']) == 2\n assert candidate(emails = ['a+@domain.com', 'a@domain.com', 'a+very+long+part+here@domain.com', 'a.very.long.part.here@domain.com']) == 2\n assert candidate(emails = ['a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z@domain.com', 'a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z@domain.com', 'abcdefghijklmnopqrstuvwxyz@domain.com']) == 2\n assert candidate(emails = ['x.y.z+12345@service.net', 'x.y.z@service.net', 'x.y.z+67890@service.net']) == 1\n assert candidate(emails = ['john.doe@example.com', 'john.doe+newsletter@example.com', 'johndoe@example.com', 'john.doe.+ignore@example.com', 'john.doe+ignore@example.co.uk']) == 2\n assert candidate(emails = ['user+filter+ignore@site.com', 'user@site.com', 'user.filter@site.com', 'user+filter@site.com']) == 2\n assert candidate(emails = ['peter.parker+spiderman@marvel.com', 'peter.parker+spiderman+amazing@marvel.com', 'peter+spiderman@marvel.com', 'spiderman+@marvel.com', 'peter.parker@marvel.com', 'peter+spiderman+@marvel.com']) == 3\n assert candidate(emails = ['alice+bob+cathy@domain.com', 'alice+bob.cathy@domain.com', 'alice+bob.cathy@domain.co.uk']) == 2\n assert candidate(emails = ['first.last+middle.name@company.com', 'first.last@company.com', 'first+last@company.com', 'firstlast@company.com', 'first+last+middle@company.com']) == 2\n assert candidate(emails = ['same.name+tag@same.domain.com', 'same.name+another.tag@same.domain.com', 'same.name@same.domain.com', 'same.name+tag@different.domain.com']) == 2\n assert candidate(emails = ['user.name+tag.info@domain.com', 'user.name+taginfo@domain.com', 'user.name+tag+info@domain.co', 'user.name+taginfo@domain.co.uk', 'user.name@domain.com']) == 3\n assert candidate(emails = ['alice.z+ignore@leetcode.com', 'alicez+ignore@leetcode.com', 'alice+ignore@leetcode.com', 'alice.z@leetcode.com', 'alicez@leetcode.com', 'alice@leetcode.com']) == 2\n assert candidate(emails = ['alice.bob.john+foo@mydomain.com', 'alice.bob.john@mydomain.com', 'alice.bob.john+bar@mydomain.com']) == 1\n assert candidate(emails = ['user.name+tag1+tag2@domain.com', 'user.name.tag1+tag2@domain.com', 'user.name+tag1.tag2@domain.com']) == 2\n assert candidate(emails = ['example+ignore.this@domain.net', 'example.ignore.this@domain.net', 'example+ignore+this@domain.net', 'exampleignorethis@domain.net']) == 2\n assert candidate(emails = ['a.b.c.d+e@website.com', 'abcd@website.com', 'a.b.c.d@website.com', 'abc.d+efg@website.com']) == 1\n assert candidate(emails = ['alice.bob+c@site.org', 'alice+offers@site.org', 'alice.bob@site.org', 'alice.b+o+b@site.org']) == 3\n assert candidate(emails = ['complex.email+with+plus@longdomain.com', 'complex.email+with.plus@longdomain.com', 'complex.email@longdomain.com', 'complex+email@longdomain.com']) == 2\n assert candidate(emails = ['john.doe+department=sales+division=west@company.com', 'john.doe+department=hr+division=east@company.com', 'john.doe@company.com']) == 1\n assert candidate(emails = ['user+ignore+ignore@domain.com', 'user.name+ignore+ignore@domain.com', 'user.name+ignore.ignore@domain.com', 'user.name+ignore.ignore+ignore@domain.com']) == 2\n assert candidate(emails = ['user.name+tag1@domain.com', 'user.name+tag2@domain.com', 'user.name+tag1.tag2@domain.com', 'user.name+tag2.tag1@domain.com']) == 1\n assert candidate(emails = ['user.name+tag+more@domain.com', 'user.name+tag@domain.com', 'user+tag@domain.com', 'user@domain.com']) == 2\n assert candidate(emails = ['x+user.name+y@domain.com', 'user.name+z@domain.com', 'user.name+@domain.com', 'user.name@domain.com']) == 2\n assert candidate(emails = ['user+tag@domain.com', 'user@domain.com', 'user.name@domain.com', 'user+tag.name@domain.com']) == 2\n"}, "metadata": {"canonical_parameter_names": ["emails"], "leetcode_dataset_entry_point": "Solution().numUniqueEmails", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numUniqueEmails = function(emails) {", "container": null, "callable": "numUniqueEmails", "parameters": [{"name": "emails", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 930, "task_id": "binary-subarrays-with-sum", "difficulty": "Medium", "problem_description": "Given a binary array nums and an integer goal, return the number of non-empty subarrays with a sum goal.\nA subarray is a contiguous part of the array.\n��\nExample 1:\n\nInput: nums = [1,0,1,0,1], goal = 2\nOutput: 4\nExplanation: The 4 subarrays are bolded and underlined below:\n[1,0,1,0,1]\n[1,0,1,0,1]\n[1,0,1,0,1]\n[1,0,1,0,1]\n\nExample 2:\n\nInput: nums = [0,0,0,0,0], goal = 0\nOutput: 15\n\n \nConstraints:\n\n1 <= nums.length <= 3 * 104\nnums[i] is either 0 or 1.\n0 <= goal <= nums.length\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 0, 1, 1, 0],goal = 1) == 6\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1],goal = 2) == 8\n assert candidate(nums = [0, 0, 0, 0, 0],goal = 0) == 15\n assert candidate(nums = [1, 0, 1, 0, 1],goal = 2) == 4\n assert candidate(nums = [0, 1, 1, 0, 1, 0, 1, 0, 1, 0],goal = 4) == 6\n assert candidate(nums = [1, 1, 1, 1, 1],goal = 3) == 3\n assert candidate(nums = [1, 0, 0, 0, 1],goal = 1) == 8\n assert candidate(nums = [0, 1, 0, 1, 0],goal = 1) == 8\n assert candidate(nums = [0, 1, 1, 0, 1, 1],goal = 2) == 7\n assert candidate(nums = [0, 1, 1, 0, 0, 1],goal = 2) == 7\n assert candidate(nums = [0, 1, 0, 1, 0, 1],goal = 2) == 6\n assert candidate(nums = [1, 0, 0, 1, 0, 1, 1, 0],goal = 2) == 9\n assert candidate(nums = [1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1],goal = 9) == 19\n assert candidate(nums = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],goal = 2) == 23\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],goal = 0) == 528\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],goal = 6) == 53\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],goal = 0) == 595\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],goal = 8) == 27\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],goal = 3) == 52\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],goal = 15) == 20\n assert candidate(nums = [1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1],goal = 6) == 26\n assert candidate(nums = [1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1],goal = 3) == 21\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],goal = 12) == 6\n assert candidate(nums = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0],goal = 3) == 60\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],goal = 5) == 22\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],goal = 3) == 22\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],goal = 5) == 34\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0],goal = 10) == 12\n assert candidate(nums = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],goal = 4) == 68\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],goal = 8) == 26\n assert candidate(nums = [1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1],goal = 4) == 19\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],goal = 1) == 62\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],goal = 6) == 20\n assert candidate(nums = [1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1],goal = 3) == 29\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],goal = 6) == 30\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],goal = 4) == 33\n assert candidate(nums = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0],goal = 5) == 45\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],goal = 5) == 12\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0],goal = 5) == 20\n assert candidate(nums = [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1],goal = 25) == 30\n assert candidate(nums = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],goal = 6) == 43\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],goal = 0) == 210\n assert candidate(nums = [0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0],goal = 9) == 28\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],goal = 6) == 50\n assert candidate(nums = [0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],goal = 2) == 56\n assert candidate(nums = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],goal = 10) == 20\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],goal = 15) == 18\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],goal = 7) == 14\n assert candidate(nums = [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1],goal = 8) == 35\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],goal = 20) == 6\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],goal = 30) == 12\n assert candidate(nums = [0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1],goal = 8) == 25\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],goal = 5) == 24\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],goal = 10) == 2\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],goal = 3) == 89\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],goal = 16) == 8\n assert candidate(nums = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1],goal = 6) == 24\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],goal = 1) == 66\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],goal = 6) == 27\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],goal = 5) == 6\n assert candidate(nums = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],goal = 4) == 63\n assert candidate(nums = [0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0],goal = 4) == 33\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],goal = 5) == 16\n assert candidate(nums = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],goal = 20) == 33\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],goal = 3) == 36\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],goal = 15) == 12\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],goal = 10) == 11\n assert candidate(nums = [1, 1, 0, 0, 0, 1, 1, 0, 0, 1],goal = 3) == 8\n assert candidate(nums = [0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1],goal = 5) == 48\n assert candidate(nums = [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0],goal = 3) == 88\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],goal = 0) == 1275\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],goal = 25) == 1\n"}, "metadata": {"canonical_parameter_names": ["nums", "goal"], "leetcode_dataset_entry_point": "Solution().numSubarraysWithSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numSubarraysWithSum = function(nums, goal) {", "container": null, "callable": "numSubarraysWithSum", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "goal", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 931, "task_id": "minimum-falling-path-sum", "difficulty": "Medium", "problem_description": "Given an n x n array of integers matrix, return the minimum sum of any falling path through matrix.\nA falling path starts at any element in the first row and chooses the element in the next row that is either directly below or diagonally left/right. Specifically, the next element from position (row, col) will be (row + 1, col - 1), (row + 1, col), or (row + 1, col + 1).\n \nExample 1:\n\n\nInput: matrix = [[2,1,3],[6,5,4],[7,8,9]]\nOutput: 13\nExplanation: There are two falling paths with a minimum sum as shown.\n\nExample 2:\n\n\nInput: matrix = [[-19,57],[-40,-5]]\nOutput: -59\nExplanation: The falling path with a minimum sum is shown.\n\n \nConstraints:\n\nn == matrix.length == matrix[i].length\n1 <= n <= 100\n-100 <= matrix[i][j] <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(matrix = [[100, -100, 100], [-100, 100, -100], [100, -100, 100]]) == -300\n assert candidate(matrix = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]]) == -18\n assert candidate(matrix = [[-19, 57], [-40, -5]]) == -59\n assert candidate(matrix = [[2, 1, 3], [6, 5, 4], [7, 8, 9]]) == 13\n assert candidate(matrix = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == 12\n assert candidate(matrix = [[10, -10, 10], [-10, 10, -10], [10, -10, 10]]) == -30\n assert candidate(matrix = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0\n assert candidate(matrix = [[-10, 10, -20, 20, -30, 30], [40, -50, 60, -70, 80, -90], [100, -110, 120, -130, 140, -150], [160, -170, 180, -190, 200, -210], [220, -230, 240, -250, 260, -270], [280, -290, 300, -310, 320, -330]]) == -1080\n assert candidate(matrix = [[-50, 50, -40, 40, -30, 30], [-20, 20, -10, 10, 0, 0], [10, -10, 20, -20, 30, -30], [40, -40, 50, -50, 60, -60], [70, -70, 80, -80, 90, -90], [100, -100, 110, -110, 120, -120]]) == -330\n assert candidate(matrix = [[1], [100]]) == 0\n assert candidate(matrix = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]) == 55\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == 0\n assert candidate(matrix = [[5, -10, 15, -20], [25, 30, -35, 40], [-45, 50, 55, -60], [-65, 70, -75, 80]]) == -190\n assert candidate(matrix = [[-50, -40, -30, -20, -10], [-10, 0, 10, 20, 30], [30, 20, 10, 0, -10], [-10, -20, -30, -40, -50], [50, 40, 30, 20, 10]]) == -70\n assert candidate(matrix = [[3, 8, 7, 1, 9], [5, 6, 9, 1, 8], [5, 9, 7, 6, 9], [5, 4, 7, 6, 9], [1, 6, 7, 6, 9]]) == 14\n assert candidate(matrix = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18], [18, 16, 14, 12, 10, 8, 6, 4, 2, 0], [0, 3, 6, 9, 12, 15, 18, 21, 24, 27], [27, 24, 21, 18, 15, 12, 9, 6, 3, 0], [0, 4, 8, 12, 16, 20, 24, 28, 32, 36], [36, 32, 28, 24, 20, 16, 12, 8, 4, 0], [0, 5, 10, 15, 20, 25, 30, 35, 40, 45], [45, 40, 35, 30, 25, 20, 15, 10, 5, 0]]) == 120\n assert candidate(matrix = [[-5, -3, -4], [-6, -7, -8], [-9, -2, -3]]) == -21\n assert candidate(matrix = [[1000, -1000, 1000], [-1000, 1000, -1000], [1000, -1000, 1000]]) == -3000\n assert candidate(matrix = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 7, 9], [9, 7, 5, 3, 1], [2, 4, 6, 8, 10]]) == 15\n assert candidate(matrix = [[-5, -5, -5], [-5, -5, -5], [-5, -5, -5]]) == -15\n assert candidate(matrix = [[10, 15, 20, 25], [30, 35, 40, 45], [50, 55, 60, 65], [70, 75, 80, 85]]) == 160\n assert candidate(matrix = [[3, 8, 1, 9], [1, 6, 7, 8], [1, 5, 8, 9], [1, 9, 1, 8]]) == 6\n assert candidate(matrix = [[1, 3, 1], [1, 5, 1], [4, 2, 1]]) == 3\n assert candidate(matrix = [[1], [2], [3], [4], [5]]) == 0\n assert candidate(matrix = [[3, 5, 1, 2], [8, 1, 3, 7], [2, 9, 4, 6], [4, 6, 8, 3]]) == 8\n assert candidate(matrix = [[1, -1, 1, -1], [-1, 1, -1, 1], [1, -1, 1, -1], [-1, 1, -1, 1]]) == -4\n assert candidate(matrix = [[-10, 100, -20], [0, -50, 30], [10, 20, -40]]) == -110\n assert candidate(matrix = [[-10, -20, 30, 40], [15, 25, -5, 35], [10, 20, 30, -40], [5, -5, 0, 10]]) == -65\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) == 28\n assert candidate(matrix = [[-10, 10, -10, 10], [-10, 10, -10, 10], [10, -10, 10, -10], [10, -10, 10, -10]]) == -40\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36]]) == 96\n assert candidate(matrix = [[-10, 5, 10], [-20, 15, -25], [30, -40, 50]]) == -70\n assert candidate(matrix = [[-100, -99, -98], [-97, -96, -95], [-94, -93, -92]]) == -291\n assert candidate(matrix = [[10, -10, 10, -10], [20, -20, 20, -20], [30, -30, 30, -30], [40, -40, 40, -40]]) == -100\n assert candidate(matrix = [[-5, -4, -3, -2, -1], [0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19]]) == 25\n assert candidate(matrix = [[-10, -20, -30], [-20, -30, -40], [-30, -40, -50]]) == -120\n assert candidate(matrix = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(matrix = [[5, 3, 2, 4, 1], [8, 2, 1, 3, 7], [3, 9, 6, 8, 5], [7, 4, 8, 1, 2], [9, 6, 5, 3, 8]]) == 13\n assert candidate(matrix = [[3, 8, 6, 4], [5, 0, 2, 9], [6, 4, 3, 8], [2, 3, 7, 4]]) == 9\n assert candidate(matrix = [[1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 11], [11, 9, 7, 5, 3, 1], [2, 4, 6, 8, 10, 12], [12, 10, 8, 6, 4, 2]]) == 28\n assert candidate(matrix = [[10, 20, 30], [20, 10, 40], [30, 40, 50]]) == 50\n assert candidate(matrix = [[-1, 2, 3], [4, -5, 6], [7, 8, -9]]) == -15\n assert candidate(matrix = [[-50, -20, 30, 10], [-80, -60, 40, 20], [90, 70, -10, -30], [5, -45, 25, -65]]) == -185\n assert candidate(matrix = [[-10, -20, -30], [-40, -50, -60], [-70, -80, -90]]) == -180\n assert candidate(matrix = [[10, 20, 30, 40], [50, 60, 70, 80], [90, 100, 110, 120], [130, 140, 150, 160]]) == 280\n assert candidate(matrix = [[9, 8, 7, 6], [5, 4, 3, 2], [1, 0, -1, -2], [-3, -4, -5, -6]]) == 0\n assert candidate(matrix = [[0, 2, 1, 5], [3, 1, 1, 1], [4, 2, 1, 2], [3, 2, 1, 3]]) == 3\n assert candidate(matrix = [[1, -2, -3, 4, -5], [2, -3, -4, 5, -6], [-1, 0, 1, -1, 0], [5, 3, 4, -2, 1], [-2, -4, 3, 2, -1]]) == -15\n assert candidate(matrix = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [2, 3, 4, 5, 6], [6, 5, 4, 3, 2], [1, 3, 5, 7, 9]]) == 13\n assert candidate(matrix = [[10, 3, 4], [1, 2, 10], [4, 3, 7]]) == 7\n assert candidate(matrix = [[10, 15, 5, 20], [10, 25, 15, 10], [10, 10, 25, 5], [20, 10, 15, 10]]) == 30\n assert candidate(matrix = [[1, -2, 3, -4], [5, -6, 7, -8], [9, -10, 11, -12], [13, -14, 15, -16]]) == -40\n assert candidate(matrix = [[0, 1, 1, 0], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == 0\n assert candidate(matrix = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 7, 9], [9, 7, 5, 3, 1], [2, 4, 6, 8, 0]]) == 13\n assert candidate(matrix = [[10, 20, 30, 40, 50], [5, 15, 25, 35, 45], [1, 11, 21, 31, 41], [-1, -11, -21, -31, -41], [-2, -12, -22, -32, -42]]) == -27\n assert candidate(matrix = [[5, 12, -3, -7, 3], [-1, -2, 8, 6, 4], [-10, 1, 7, 2, -1], [8, 9, -5, -3, 6], [4, 3, 0, -2, 1]]) == -11\n assert candidate(matrix = [[5, 3, 7], [2, 6, 8], [4, 1, 9], [6, 4, 3]]) == 0\n assert candidate(matrix = [[-1, -2, -3, -4, -5], [-6, -7, -8, -9, -10], [-11, -12, -13, -14, -15], [-16, -17, -18, -19, -20], [-21, -22, -23, -24, -25]]) == -75\n assert candidate(matrix = [[-2, -1, -3], [-6, -5, -4], [-7, -8, -9]]) == -17\n assert candidate(matrix = [[-10, -20, -30], [-3, -2, -1], [-100, -200, -300]]) == -332\n assert candidate(matrix = [[7, 5, 8, 6], [9, 3, 4, 10], [12, 6, 7, 2], [10, 9, 8, 3]]) == 14\n assert candidate(matrix = [[-20, -10, 5, 10], [-30, 0, 0, 30], [-15, -5, 15, 25], [10, 5, -10, -15]]) == -65\n assert candidate(matrix = [[-1, -2, -3, -4], [-4, -3, -2, -1], [-1, 0, 1, 2], [2, 1, 0, -1]]) == -6\n assert candidate(matrix = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]]) == 40\n assert candidate(matrix = [[100, 100, 100, 100], [0, 0, 0, 0], [100, 100, 100, 100], [0, 0, 0, 0]]) == 200\n assert candidate(matrix = [[100, -200, 300], [400, -500, 600], [-700, 800, -900]]) == -1600\n assert candidate(matrix = [[-10, 5, 1], [-5, 2, -3], [8, -1, 10]]) == -16\n assert candidate(matrix = [[5, 10, 15, 20, 25], [10, 15, 20, 25, 30], [15, 20, 25, 30, 35], [20, 25, 30, 35, 40], [25, 30, 35, 40, 45]]) == 75\n assert candidate(matrix = [[100, 99, 98, 97, 96], [95, 94, 93, 92, 91], [90, 89, 88, 87, 86], [85, 84, 83, 82, 81], [80, 79, 78, 77, 76]]) == 430\n assert candidate(matrix = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]]) == -18\n assert candidate(matrix = [[1, -1, 1, -1, 1], [-1, 1, -1, 1, -1], [1, -1, 1, -1, 1], [-1, 1, -1, 1, -1], [1, -1, 1, -1, 1]]) == -5\n assert candidate(matrix = [[100, 200, 300], [150, 250, 350], [200, 300, 400]]) == 450\n assert candidate(matrix = [[-1, 2, -3], [4, -5, 6], [-7, 8, -9]]) == -17\n assert candidate(matrix = [[-1, 2, 9, 4, -5], [7, -3, 0, 1, -9], [3, 5, 1, -4, -6], [-8, -2, -3, -1, -9], [-2, -5, -3, -6, 9]]) == -35\n assert candidate(matrix = [[-10, 5, 3, 12], [-5, -3, 10, -8], [8, -6, -4, 7], [2, 0, 5, -3]]) == -21\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [3, 3, 3, 3, 3, 3, 3, 3, 3, 3], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [6, 6, 6, 6, 6, 6, 6, 6, 6, 6], [7, 7, 7, 7, 7, 7, 7, 7, 7, 7], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [9, 9, 9, 9, 9, 9, 9, 9, 9, 9], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]]) == 55\n assert candidate(matrix = [[-20, -30, 40], [-60, 50, -80], [90, -100, 120]]) == -210\n assert candidate(matrix = [[-1, 2, -1, 2, -1], [2, -1, 2, -1, 2], [-1, 2, -1, 2, -1], [2, -1, 2, -1, 2], [-1, 2, -1, 2, -1]]) == -5\n"}, "metadata": {"canonical_parameter_names": ["matrix"], "leetcode_dataset_entry_point": "Solution().minFallingPathSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minFallingPathSum = function(matrix) {", "container": null, "callable": "minFallingPathSum", "parameters": [{"name": "matrix", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 932, "task_id": "beautiful-array", "difficulty": "Medium", "problem_description": "An array nums of length n is beautiful if:\n\nnums is a permutation of the integers in the range [1, n].\nFor every 0 <= i < j < n, there is no index k with i < k < j where 2 * nums[k] == nums[i] + nums[j].\n\nGiven the integer n, return any beautiful array nums of length n. There will be at least one valid answer for the given n.\n \nExample 1:\nInput: n = 4\nOutput: [2,1,4,3]\nExample 2:\nInput: n = 5\nOutput: [3,1,2,5,4]\n\n \nConstraints:\n\n1 <= n <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 11) == [1, 9, 5, 3, 11, 7, 2, 10, 6, 4, 8]\n assert candidate(n = 15) == [1, 9, 5, 13, 3, 11, 7, 15, 2, 10, 6, 14, 4, 12, 8]\n assert candidate(n = 4) == [1, 3, 2, 4]\n assert candidate(n = 64) == [1, 33, 17, 49, 9, 41, 25, 57, 5, 37, 21, 53, 13, 45, 29, 61, 3, 35, 19, 51, 11, 43, 27, 59, 7, 39, 23, 55, 15, 47, 31, 63, 2, 34, 18, 50, 10, 42, 26, 58, 6, 38, 22, 54, 14, 46, 30, 62, 4, 36, 20, 52, 12, 44, 28, 60, 8, 40, 24, 56, 16, 48, 32, 64]\n assert candidate(n = 7) == [1, 5, 3, 7, 2, 6, 4]\n assert candidate(n = 9) == [1, 9, 5, 3, 7, 2, 6, 4, 8]\n assert candidate(n = 32) == [1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31, 2, 18, 10, 26, 6, 22, 14, 30, 4, 20, 12, 28, 8, 24, 16, 32]\n assert candidate(n = 6) == [1, 5, 3, 2, 6, 4]\n assert candidate(n = 20) == [1, 17, 9, 5, 13, 3, 19, 11, 7, 15, 2, 18, 10, 6, 14, 4, 20, 12, 8, 16]\n assert candidate(n = 2) == [1, 2]\n assert candidate(n = 100) == [1, 65, 33, 97, 17, 81, 49, 9, 73, 41, 25, 89, 57, 5, 69, 37, 21, 85, 53, 13, 77, 45, 29, 93, 61, 3, 67, 35, 99, 19, 83, 51, 11, 75, 43, 27, 91, 59, 7, 71, 39, 23, 87, 55, 15, 79, 47, 31, 95, 63, 2, 66, 34, 98, 18, 82, 50, 10, 74, 42, 26, 90, 58, 6, 70, 38, 22, 86, 54, 14, 78, 46, 30, 94, 62, 4, 68, 36, 100, 20, 84, 52, 12, 76, 44, 28, 92, 60, 8, 72, 40, 24, 88, 56, 16, 80, 48, 32, 96, 64]\n assert candidate(n = 500) == [1, 257, 129, 385, 65, 321, 193, 449, 33, 289, 161, 417, 97, 353, 225, 481, 17, 273, 145, 401, 81, 337, 209, 465, 49, 305, 177, 433, 113, 369, 241, 497, 9, 265, 137, 393, 73, 329, 201, 457, 41, 297, 169, 425, 105, 361, 233, 489, 25, 281, 153, 409, 89, 345, 217, 473, 57, 313, 185, 441, 121, 377, 249, 5, 261, 133, 389, 69, 325, 197, 453, 37, 293, 165, 421, 101, 357, 229, 485, 21, 277, 149, 405, 85, 341, 213, 469, 53, 309, 181, 437, 117, 373, 245, 13, 269, 141, 397, 77, 333, 205, 461, 45, 301, 173, 429, 109, 365, 237, 493, 29, 285, 157, 413, 93, 349, 221, 477, 61, 317, 189, 445, 125, 381, 253, 3, 259, 131, 387, 67, 323, 195, 451, 35, 291, 163, 419, 99, 355, 227, 483, 19, 275, 147, 403, 83, 339, 211, 467, 51, 307, 179, 435, 115, 371, 243, 499, 11, 267, 139, 395, 75, 331, 203, 459, 43, 299, 171, 427, 107, 363, 235, 491, 27, 283, 155, 411, 91, 347, 219, 475, 59, 315, 187, 443, 123, 379, 251, 7, 263, 135, 391, 71, 327, 199, 455, 39, 295, 167, 423, 103, 359, 231, 487, 23, 279, 151, 407, 87, 343, 215, 471, 55, 311, 183, 439, 119, 375, 247, 15, 271, 143, 399, 79, 335, 207, 463, 47, 303, 175, 431, 111, 367, 239, 495, 31, 287, 159, 415, 95, 351, 223, 479, 63, 319, 191, 447, 127, 383, 255, 2, 258, 130, 386, 66, 322, 194, 450, 34, 290, 162, 418, 98, 354, 226, 482, 18, 274, 146, 402, 82, 338, 210, 466, 50, 306, 178, 434, 114, 370, 242, 498, 10, 266, 138, 394, 74, 330, 202, 458, 42, 298, 170, 426, 106, 362, 234, 490, 26, 282, 154, 410, 90, 346, 218, 474, 58, 314, 186, 442, 122, 378, 250, 6, 262, 134, 390, 70, 326, 198, 454, 38, 294, 166, 422, 102, 358, 230, 486, 22, 278, 150, 406, 86, 342, 214, 470, 54, 310, 182, 438, 118, 374, 246, 14, 270, 142, 398, 78, 334, 206, 462, 46, 302, 174, 430, 110, 366, 238, 494, 30, 286, 158, 414, 94, 350, 222, 478, 62, 318, 190, 446, 126, 382, 254, 4, 260, 132, 388, 68, 324, 196, 452, 36, 292, 164, 420, 100, 356, 228, 484, 20, 276, 148, 404, 84, 340, 212, 468, 52, 308, 180, 436, 116, 372, 244, 500, 12, 268, 140, 396, 76, 332, 204, 460, 44, 300, 172, 428, 108, 364, 236, 492, 28, 284, 156, 412, 92, 348, 220, 476, 60, 316, 188, 444, 124, 380, 252, 8, 264, 136, 392, 72, 328, 200, 456, 40, 296, 168, 424, 104, 360, 232, 488, 24, 280, 152, 408, 88, 344, 216, 472, 56, 312, 184, 440, 120, 376, 248, 16, 272, 144, 400, 80, 336, 208, 464, 48, 304, 176, 432, 112, 368, 240, 496, 32, 288, 160, 416, 96, 352, 224, 480, 64, 320, 192, 448, 128, 384, 256]\n assert candidate(n = 1000) == [1, 513, 257, 769, 129, 641, 385, 897, 65, 577, 321, 833, 193, 705, 449, 961, 33, 545, 289, 801, 161, 673, 417, 929, 97, 609, 353, 865, 225, 737, 481, 993, 17, 529, 273, 785, 145, 657, 401, 913, 81, 593, 337, 849, 209, 721, 465, 977, 49, 561, 305, 817, 177, 689, 433, 945, 113, 625, 369, 881, 241, 753, 497, 9, 521, 265, 777, 137, 649, 393, 905, 73, 585, 329, 841, 201, 713, 457, 969, 41, 553, 297, 809, 169, 681, 425, 937, 105, 617, 361, 873, 233, 745, 489, 25, 537, 281, 793, 153, 665, 409, 921, 89, 601, 345, 857, 217, 729, 473, 985, 57, 569, 313, 825, 185, 697, 441, 953, 121, 633, 377, 889, 249, 761, 505, 5, 517, 261, 773, 133, 645, 389, 901, 69, 581, 325, 837, 197, 709, 453, 965, 37, 549, 293, 805, 165, 677, 421, 933, 101, 613, 357, 869, 229, 741, 485, 997, 21, 533, 277, 789, 149, 661, 405, 917, 85, 597, 341, 853, 213, 725, 469, 981, 53, 565, 309, 821, 181, 693, 437, 949, 117, 629, 373, 885, 245, 757, 501, 13, 525, 269, 781, 141, 653, 397, 909, 77, 589, 333, 845, 205, 717, 461, 973, 45, 557, 301, 813, 173, 685, 429, 941, 109, 621, 365, 877, 237, 749, 493, 29, 541, 285, 797, 157, 669, 413, 925, 93, 605, 349, 861, 221, 733, 477, 989, 61, 573, 317, 829, 189, 701, 445, 957, 125, 637, 381, 893, 253, 765, 509, 3, 515, 259, 771, 131, 643, 387, 899, 67, 579, 323, 835, 195, 707, 451, 963, 35, 547, 291, 803, 163, 675, 419, 931, 99, 611, 355, 867, 227, 739, 483, 995, 19, 531, 275, 787, 147, 659, 403, 915, 83, 595, 339, 851, 211, 723, 467, 979, 51, 563, 307, 819, 179, 691, 435, 947, 115, 627, 371, 883, 243, 755, 499, 11, 523, 267, 779, 139, 651, 395, 907, 75, 587, 331, 843, 203, 715, 459, 971, 43, 555, 299, 811, 171, 683, 427, 939, 107, 619, 363, 875, 235, 747, 491, 27, 539, 283, 795, 155, 667, 411, 923, 91, 603, 347, 859, 219, 731, 475, 987, 59, 571, 315, 827, 187, 699, 443, 955, 123, 635, 379, 891, 251, 763, 507, 7, 519, 263, 775, 135, 647, 391, 903, 71, 583, 327, 839, 199, 711, 455, 967, 39, 551, 295, 807, 167, 679, 423, 935, 103, 615, 359, 871, 231, 743, 487, 999, 23, 535, 279, 791, 151, 663, 407, 919, 87, 599, 343, 855, 215, 727, 471, 983, 55, 567, 311, 823, 183, 695, 439, 951, 119, 631, 375, 887, 247, 759, 503, 15, 527, 271, 783, 143, 655, 399, 911, 79, 591, 335, 847, 207, 719, 463, 975, 47, 559, 303, 815, 175, 687, 431, 943, 111, 623, 367, 879, 239, 751, 495, 31, 543, 287, 799, 159, 671, 415, 927, 95, 607, 351, 863, 223, 735, 479, 991, 63, 575, 319, 831, 191, 703, 447, 959, 127, 639, 383, 895, 255, 767, 511, 2, 514, 258, 770, 130, 642, 386, 898, 66, 578, 322, 834, 194, 706, 450, 962, 34, 546, 290, 802, 162, 674, 418, 930, 98, 610, 354, 866, 226, 738, 482, 994, 18, 530, 274, 786, 146, 658, 402, 914, 82, 594, 338, 850, 210, 722, 466, 978, 50, 562, 306, 818, 178, 690, 434, 946, 114, 626, 370, 882, 242, 754, 498, 10, 522, 266, 778, 138, 650, 394, 906, 74, 586, 330, 842, 202, 714, 458, 970, 42, 554, 298, 810, 170, 682, 426, 938, 106, 618, 362, 874, 234, 746, 490, 26, 538, 282, 794, 154, 666, 410, 922, 90, 602, 346, 858, 218, 730, 474, 986, 58, 570, 314, 826, 186, 698, 442, 954, 122, 634, 378, 890, 250, 762, 506, 6, 518, 262, 774, 134, 646, 390, 902, 70, 582, 326, 838, 198, 710, 454, 966, 38, 550, 294, 806, 166, 678, 422, 934, 102, 614, 358, 870, 230, 742, 486, 998, 22, 534, 278, 790, 150, 662, 406, 918, 86, 598, 342, 854, 214, 726, 470, 982, 54, 566, 310, 822, 182, 694, 438, 950, 118, 630, 374, 886, 246, 758, 502, 14, 526, 270, 782, 142, 654, 398, 910, 78, 590, 334, 846, 206, 718, 462, 974, 46, 558, 302, 814, 174, 686, 430, 942, 110, 622, 366, 878, 238, 750, 494, 30, 542, 286, 798, 158, 670, 414, 926, 94, 606, 350, 862, 222, 734, 478, 990, 62, 574, 318, 830, 190, 702, 446, 958, 126, 638, 382, 894, 254, 766, 510, 4, 516, 260, 772, 132, 644, 388, 900, 68, 580, 324, 836, 196, 708, 452, 964, 36, 548, 292, 804, 164, 676, 420, 932, 100, 612, 356, 868, 228, 740, 484, 996, 20, 532, 276, 788, 148, 660, 404, 916, 84, 596, 340, 852, 212, 724, 468, 980, 52, 564, 308, 820, 180, 692, 436, 948, 116, 628, 372, 884, 244, 756, 500, 12, 524, 268, 780, 140, 652, 396, 908, 76, 588, 332, 844, 204, 716, 460, 972, 44, 556, 300, 812, 172, 684, 428, 940, 108, 620, 364, 876, 236, 748, 492, 28, 540, 284, 796, 156, 668, 412, 924, 92, 604, 348, 860, 220, 732, 476, 988, 60, 572, 316, 828, 188, 700, 444, 956, 124, 636, 380, 892, 252, 764, 508, 8, 520, 264, 776, 136, 648, 392, 904, 72, 584, 328, 840, 200, 712, 456, 968, 40, 552, 296, 808, 168, 680, 424, 936, 104, 616, 360, 872, 232, 744, 488, 1000, 24, 536, 280, 792, 152, 664, 408, 920, 88, 600, 344, 856, 216, 728, 472, 984, 56, 568, 312, 824, 184, 696, 440, 952, 120, 632, 376, 888, 248, 760, 504, 16, 528, 272, 784, 144, 656, 400, 912, 80, 592, 336, 848, 208, 720, 464, 976, 48, 560, 304, 816, 176, 688, 432, 944, 112, 624, 368, 880, 240, 752, 496, 32, 544, 288, 800, 160, 672, 416, 928, 96, 608, 352, 864, 224, 736, 480, 992, 64, 576, 320, 832, 192, 704, 448, 960, 128, 640, 384, 896, 256, 768, 512]\n assert candidate(n = 1) == [1]\n assert candidate(n = 10) == [1, 9, 5, 3, 7, 2, 10, 6, 4, 8]\n assert candidate(n = 5) == [1, 5, 3, 2, 4]\n assert candidate(n = 3) == [1, 3, 2]\n assert candidate(n = 63) == [1, 33, 17, 49, 9, 41, 25, 57, 5, 37, 21, 53, 13, 45, 29, 61, 3, 35, 19, 51, 11, 43, 27, 59, 7, 39, 23, 55, 15, 47, 31, 63, 2, 34, 18, 50, 10, 42, 26, 58, 6, 38, 22, 54, 14, 46, 30, 62, 4, 36, 20, 52, 12, 44, 28, 60, 8, 40, 24, 56, 16, 48, 32]\n assert candidate(n = 61) == [1, 33, 17, 49, 9, 41, 25, 57, 5, 37, 21, 53, 13, 45, 29, 61, 3, 35, 19, 51, 11, 43, 27, 59, 7, 39, 23, 55, 15, 47, 31, 2, 34, 18, 50, 10, 42, 26, 58, 6, 38, 22, 54, 14, 46, 30, 4, 36, 20, 52, 12, 44, 28, 60, 8, 40, 24, 56, 16, 48, 32]\n assert candidate(n = 480) == [1, 257, 129, 385, 65, 321, 193, 449, 33, 289, 161, 417, 97, 353, 225, 17, 273, 145, 401, 81, 337, 209, 465, 49, 305, 177, 433, 113, 369, 241, 9, 265, 137, 393, 73, 329, 201, 457, 41, 297, 169, 425, 105, 361, 233, 25, 281, 153, 409, 89, 345, 217, 473, 57, 313, 185, 441, 121, 377, 249, 5, 261, 133, 389, 69, 325, 197, 453, 37, 293, 165, 421, 101, 357, 229, 21, 277, 149, 405, 85, 341, 213, 469, 53, 309, 181, 437, 117, 373, 245, 13, 269, 141, 397, 77, 333, 205, 461, 45, 301, 173, 429, 109, 365, 237, 29, 285, 157, 413, 93, 349, 221, 477, 61, 317, 189, 445, 125, 381, 253, 3, 259, 131, 387, 67, 323, 195, 451, 35, 291, 163, 419, 99, 355, 227, 19, 275, 147, 403, 83, 339, 211, 467, 51, 307, 179, 435, 115, 371, 243, 11, 267, 139, 395, 75, 331, 203, 459, 43, 299, 171, 427, 107, 363, 235, 27, 283, 155, 411, 91, 347, 219, 475, 59, 315, 187, 443, 123, 379, 251, 7, 263, 135, 391, 71, 327, 199, 455, 39, 295, 167, 423, 103, 359, 231, 23, 279, 151, 407, 87, 343, 215, 471, 55, 311, 183, 439, 119, 375, 247, 15, 271, 143, 399, 79, 335, 207, 463, 47, 303, 175, 431, 111, 367, 239, 31, 287, 159, 415, 95, 351, 223, 479, 63, 319, 191, 447, 127, 383, 255, 2, 258, 130, 386, 66, 322, 194, 450, 34, 290, 162, 418, 98, 354, 226, 18, 274, 146, 402, 82, 338, 210, 466, 50, 306, 178, 434, 114, 370, 242, 10, 266, 138, 394, 74, 330, 202, 458, 42, 298, 170, 426, 106, 362, 234, 26, 282, 154, 410, 90, 346, 218, 474, 58, 314, 186, 442, 122, 378, 250, 6, 262, 134, 390, 70, 326, 198, 454, 38, 294, 166, 422, 102, 358, 230, 22, 278, 150, 406, 86, 342, 214, 470, 54, 310, 182, 438, 118, 374, 246, 14, 270, 142, 398, 78, 334, 206, 462, 46, 302, 174, 430, 110, 366, 238, 30, 286, 158, 414, 94, 350, 222, 478, 62, 318, 190, 446, 126, 382, 254, 4, 260, 132, 388, 68, 324, 196, 452, 36, 292, 164, 420, 100, 356, 228, 20, 276, 148, 404, 84, 340, 212, 468, 52, 308, 180, 436, 116, 372, 244, 12, 268, 140, 396, 76, 332, 204, 460, 44, 300, 172, 428, 108, 364, 236, 28, 284, 156, 412, 92, 348, 220, 476, 60, 316, 188, 444, 124, 380, 252, 8, 264, 136, 392, 72, 328, 200, 456, 40, 296, 168, 424, 104, 360, 232, 24, 280, 152, 408, 88, 344, 216, 472, 56, 312, 184, 440, 120, 376, 248, 16, 272, 144, 400, 80, 336, 208, 464, 48, 304, 176, 432, 112, 368, 240, 32, 288, 160, 416, 96, 352, 224, 480, 64, 320, 192, 448, 128, 384, 256]\n assert candidate(n = 125) == [1, 65, 33, 97, 17, 81, 49, 113, 9, 73, 41, 105, 25, 89, 57, 121, 5, 69, 37, 101, 21, 85, 53, 117, 13, 77, 45, 109, 29, 93, 61, 125, 3, 67, 35, 99, 19, 83, 51, 115, 11, 75, 43, 107, 27, 91, 59, 123, 7, 71, 39, 103, 23, 87, 55, 119, 15, 79, 47, 111, 31, 95, 63, 2, 66, 34, 98, 18, 82, 50, 114, 10, 74, 42, 106, 26, 90, 58, 122, 6, 70, 38, 102, 22, 86, 54, 118, 14, 78, 46, 110, 30, 94, 62, 4, 68, 36, 100, 20, 84, 52, 116, 12, 76, 44, 108, 28, 92, 60, 124, 8, 72, 40, 104, 24, 88, 56, 120, 16, 80, 48, 112, 32, 96, 64]\n assert candidate(n = 511) == [1, 257, 129, 385, 65, 321, 193, 449, 33, 289, 161, 417, 97, 353, 225, 481, 17, 273, 145, 401, 81, 337, 209, 465, 49, 305, 177, 433, 113, 369, 241, 497, 9, 265, 137, 393, 73, 329, 201, 457, 41, 297, 169, 425, 105, 361, 233, 489, 25, 281, 153, 409, 89, 345, 217, 473, 57, 313, 185, 441, 121, 377, 249, 505, 5, 261, 133, 389, 69, 325, 197, 453, 37, 293, 165, 421, 101, 357, 229, 485, 21, 277, 149, 405, 85, 341, 213, 469, 53, 309, 181, 437, 117, 373, 245, 501, 13, 269, 141, 397, 77, 333, 205, 461, 45, 301, 173, 429, 109, 365, 237, 493, 29, 285, 157, 413, 93, 349, 221, 477, 61, 317, 189, 445, 125, 381, 253, 509, 3, 259, 131, 387, 67, 323, 195, 451, 35, 291, 163, 419, 99, 355, 227, 483, 19, 275, 147, 403, 83, 339, 211, 467, 51, 307, 179, 435, 115, 371, 243, 499, 11, 267, 139, 395, 75, 331, 203, 459, 43, 299, 171, 427, 107, 363, 235, 491, 27, 283, 155, 411, 91, 347, 219, 475, 59, 315, 187, 443, 123, 379, 251, 507, 7, 263, 135, 391, 71, 327, 199, 455, 39, 295, 167, 423, 103, 359, 231, 487, 23, 279, 151, 407, 87, 343, 215, 471, 55, 311, 183, 439, 119, 375, 247, 503, 15, 271, 143, 399, 79, 335, 207, 463, 47, 303, 175, 431, 111, 367, 239, 495, 31, 287, 159, 415, 95, 351, 223, 479, 63, 319, 191, 447, 127, 383, 255, 511, 2, 258, 130, 386, 66, 322, 194, 450, 34, 290, 162, 418, 98, 354, 226, 482, 18, 274, 146, 402, 82, 338, 210, 466, 50, 306, 178, 434, 114, 370, 242, 498, 10, 266, 138, 394, 74, 330, 202, 458, 42, 298, 170, 426, 106, 362, 234, 490, 26, 282, 154, 410, 90, 346, 218, 474, 58, 314, 186, 442, 122, 378, 250, 506, 6, 262, 134, 390, 70, 326, 198, 454, 38, 294, 166, 422, 102, 358, 230, 486, 22, 278, 150, 406, 86, 342, 214, 470, 54, 310, 182, 438, 118, 374, 246, 502, 14, 270, 142, 398, 78, 334, 206, 462, 46, 302, 174, 430, 110, 366, 238, 494, 30, 286, 158, 414, 94, 350, 222, 478, 62, 318, 190, 446, 126, 382, 254, 510, 4, 260, 132, 388, 68, 324, 196, 452, 36, 292, 164, 420, 100, 356, 228, 484, 20, 276, 148, 404, 84, 340, 212, 468, 52, 308, 180, 436, 116, 372, 244, 500, 12, 268, 140, 396, 76, 332, 204, 460, 44, 300, 172, 428, 108, 364, 236, 492, 28, 284, 156, 412, 92, 348, 220, 476, 60, 316, 188, 444, 124, 380, 252, 508, 8, 264, 136, 392, 72, 328, 200, 456, 40, 296, 168, 424, 104, 360, 232, 488, 24, 280, 152, 408, 88, 344, 216, 472, 56, 312, 184, 440, 120, 376, 248, 504, 16, 272, 144, 400, 80, 336, 208, 464, 48, 304, 176, 432, 112, 368, 240, 496, 32, 288, 160, 416, 96, 352, 224, 480, 64, 320, 192, 448, 128, 384, 256]\n assert candidate(n = 50) == [1, 33, 17, 49, 9, 41, 25, 5, 37, 21, 13, 45, 29, 3, 35, 19, 11, 43, 27, 7, 39, 23, 15, 47, 31, 2, 34, 18, 50, 10, 42, 26, 6, 38, 22, 14, 46, 30, 4, 36, 20, 12, 44, 28, 8, 40, 24, 16, 48, 32]\n assert candidate(n = 300) == [1, 257, 129, 65, 193, 33, 289, 161, 97, 225, 17, 273, 145, 81, 209, 49, 177, 113, 241, 9, 265, 137, 73, 201, 41, 297, 169, 105, 233, 25, 281, 153, 89, 217, 57, 185, 121, 249, 5, 261, 133, 69, 197, 37, 293, 165, 101, 229, 21, 277, 149, 85, 213, 53, 181, 117, 245, 13, 269, 141, 77, 205, 45, 173, 109, 237, 29, 285, 157, 93, 221, 61, 189, 125, 253, 3, 259, 131, 67, 195, 35, 291, 163, 99, 227, 19, 275, 147, 83, 211, 51, 179, 115, 243, 11, 267, 139, 75, 203, 43, 299, 171, 107, 235, 27, 283, 155, 91, 219, 59, 187, 123, 251, 7, 263, 135, 71, 199, 39, 295, 167, 103, 231, 23, 279, 151, 87, 215, 55, 183, 119, 247, 15, 271, 143, 79, 207, 47, 175, 111, 239, 31, 287, 159, 95, 223, 63, 191, 127, 255, 2, 258, 130, 66, 194, 34, 290, 162, 98, 226, 18, 274, 146, 82, 210, 50, 178, 114, 242, 10, 266, 138, 74, 202, 42, 298, 170, 106, 234, 26, 282, 154, 90, 218, 58, 186, 122, 250, 6, 262, 134, 70, 198, 38, 294, 166, 102, 230, 22, 278, 150, 86, 214, 54, 182, 118, 246, 14, 270, 142, 78, 206, 46, 174, 110, 238, 30, 286, 158, 94, 222, 62, 190, 126, 254, 4, 260, 132, 68, 196, 36, 292, 164, 100, 228, 20, 276, 148, 84, 212, 52, 180, 116, 244, 12, 268, 140, 76, 204, 44, 300, 172, 108, 236, 28, 284, 156, 92, 220, 60, 188, 124, 252, 8, 264, 136, 72, 200, 40, 296, 168, 104, 232, 24, 280, 152, 88, 216, 56, 184, 120, 248, 16, 272, 144, 80, 208, 48, 176, 112, 240, 32, 288, 160, 96, 224, 64, 192, 128, 256]\n assert candidate(n = 60) == [1, 33, 17, 49, 9, 41, 25, 57, 5, 37, 21, 53, 13, 45, 29, 3, 35, 19, 51, 11, 43, 27, 59, 7, 39, 23, 55, 15, 47, 31, 2, 34, 18, 50, 10, 42, 26, 58, 6, 38, 22, 54, 14, 46, 30, 4, 36, 20, 52, 12, 44, 28, 60, 8, 40, 24, 56, 16, 48, 32]\n assert candidate(n = 333) == [1, 257, 129, 65, 321, 193, 33, 289, 161, 97, 225, 17, 273, 145, 81, 209, 49, 305, 177, 113, 241, 9, 265, 137, 73, 329, 201, 41, 297, 169, 105, 233, 25, 281, 153, 89, 217, 57, 313, 185, 121, 249, 5, 261, 133, 69, 325, 197, 37, 293, 165, 101, 229, 21, 277, 149, 85, 213, 53, 309, 181, 117, 245, 13, 269, 141, 77, 333, 205, 45, 301, 173, 109, 237, 29, 285, 157, 93, 221, 61, 317, 189, 125, 253, 3, 259, 131, 67, 323, 195, 35, 291, 163, 99, 227, 19, 275, 147, 83, 211, 51, 307, 179, 115, 243, 11, 267, 139, 75, 331, 203, 43, 299, 171, 107, 235, 27, 283, 155, 91, 219, 59, 315, 187, 123, 251, 7, 263, 135, 71, 327, 199, 39, 295, 167, 103, 231, 23, 279, 151, 87, 215, 55, 311, 183, 119, 247, 15, 271, 143, 79, 207, 47, 303, 175, 111, 239, 31, 287, 159, 95, 223, 63, 319, 191, 127, 255, 2, 258, 130, 66, 322, 194, 34, 290, 162, 98, 226, 18, 274, 146, 82, 210, 50, 306, 178, 114, 242, 10, 266, 138, 74, 330, 202, 42, 298, 170, 106, 234, 26, 282, 154, 90, 218, 58, 314, 186, 122, 250, 6, 262, 134, 70, 326, 198, 38, 294, 166, 102, 230, 22, 278, 150, 86, 214, 54, 310, 182, 118, 246, 14, 270, 142, 78, 206, 46, 302, 174, 110, 238, 30, 286, 158, 94, 222, 62, 318, 190, 126, 254, 4, 260, 132, 68, 324, 196, 36, 292, 164, 100, 228, 20, 276, 148, 84, 212, 52, 308, 180, 116, 244, 12, 268, 140, 76, 332, 204, 44, 300, 172, 108, 236, 28, 284, 156, 92, 220, 60, 316, 188, 124, 252, 8, 264, 136, 72, 328, 200, 40, 296, 168, 104, 232, 24, 280, 152, 88, 216, 56, 312, 184, 120, 248, 16, 272, 144, 80, 208, 48, 304, 176, 112, 240, 32, 288, 160, 96, 224, 64, 320, 192, 128, 256]\n assert candidate(n = 30) == [1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 2, 18, 10, 26, 6, 22, 14, 30, 4, 20, 12, 28, 8, 24, 16]\n assert candidate(n = 99) == [1, 65, 33, 97, 17, 81, 49, 9, 73, 41, 25, 89, 57, 5, 69, 37, 21, 85, 53, 13, 77, 45, 29, 93, 61, 3, 67, 35, 99, 19, 83, 51, 11, 75, 43, 27, 91, 59, 7, 71, 39, 23, 87, 55, 15, 79, 47, 31, 95, 63, 2, 66, 34, 98, 18, 82, 50, 10, 74, 42, 26, 90, 58, 6, 70, 38, 22, 86, 54, 14, 78, 46, 30, 94, 62, 4, 68, 36, 20, 84, 52, 12, 76, 44, 28, 92, 60, 8, 72, 40, 24, 88, 56, 16, 80, 48, 32, 96, 64]\n assert candidate(n = 37) == [1, 33, 17, 9, 25, 5, 37, 21, 13, 29, 3, 35, 19, 11, 27, 7, 23, 15, 31, 2, 34, 18, 10, 26, 6, 22, 14, 30, 4, 36, 20, 12, 28, 8, 24, 16, 32]\n assert candidate(n = 16) == [1, 9, 5, 13, 3, 11, 7, 15, 2, 10, 6, 14, 4, 12, 8, 16]\n assert candidate(n = 17) == [1, 17, 9, 5, 13, 3, 11, 7, 15, 2, 10, 6, 14, 4, 12, 8, 16]\n assert candidate(n = 257) == [1, 257, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241, 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253, 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251, 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255, 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254, 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, 16, 144, 80, 208, 48, 176, 112, 240, 32, 160, 96, 224, 64, 192, 128, 256]\n assert candidate(n = 23) == [1, 17, 9, 5, 21, 13, 3, 19, 11, 7, 23, 15, 2, 18, 10, 6, 22, 14, 4, 20, 12, 8, 16]\n assert candidate(n = 128) == [1, 65, 33, 97, 17, 81, 49, 113, 9, 73, 41, 105, 25, 89, 57, 121, 5, 69, 37, 101, 21, 85, 53, 117, 13, 77, 45, 109, 29, 93, 61, 125, 3, 67, 35, 99, 19, 83, 51, 115, 11, 75, 43, 107, 27, 91, 59, 123, 7, 71, 39, 103, 23, 87, 55, 119, 15, 79, 47, 111, 31, 95, 63, 127, 2, 66, 34, 98, 18, 82, 50, 114, 10, 74, 42, 106, 26, 90, 58, 122, 6, 70, 38, 102, 22, 86, 54, 118, 14, 78, 46, 110, 30, 94, 62, 126, 4, 68, 36, 100, 20, 84, 52, 116, 12, 76, 44, 108, 28, 92, 60, 124, 8, 72, 40, 104, 24, 88, 56, 120, 16, 80, 48, 112, 32, 96, 64, 128]\n assert candidate(n = 101) == [1, 65, 33, 97, 17, 81, 49, 9, 73, 41, 25, 89, 57, 5, 69, 37, 101, 21, 85, 53, 13, 77, 45, 29, 93, 61, 3, 67, 35, 99, 19, 83, 51, 11, 75, 43, 27, 91, 59, 7, 71, 39, 23, 87, 55, 15, 79, 47, 31, 95, 63, 2, 66, 34, 98, 18, 82, 50, 10, 74, 42, 26, 90, 58, 6, 70, 38, 22, 86, 54, 14, 78, 46, 30, 94, 62, 4, 68, 36, 100, 20, 84, 52, 12, 76, 44, 28, 92, 60, 8, 72, 40, 24, 88, 56, 16, 80, 48, 32, 96, 64]\n assert candidate(n = 700) == [1, 513, 257, 129, 641, 385, 65, 577, 321, 193, 449, 33, 545, 289, 161, 673, 417, 97, 609, 353, 225, 481, 17, 529, 273, 145, 657, 401, 81, 593, 337, 209, 465, 49, 561, 305, 177, 689, 433, 113, 625, 369, 241, 497, 9, 521, 265, 137, 649, 393, 73, 585, 329, 201, 457, 41, 553, 297, 169, 681, 425, 105, 617, 361, 233, 489, 25, 537, 281, 153, 665, 409, 89, 601, 345, 217, 473, 57, 569, 313, 185, 697, 441, 121, 633, 377, 249, 505, 5, 517, 261, 133, 645, 389, 69, 581, 325, 197, 453, 37, 549, 293, 165, 677, 421, 101, 613, 357, 229, 485, 21, 533, 277, 149, 661, 405, 85, 597, 341, 213, 469, 53, 565, 309, 181, 693, 437, 117, 629, 373, 245, 501, 13, 525, 269, 141, 653, 397, 77, 589, 333, 205, 461, 45, 557, 301, 173, 685, 429, 109, 621, 365, 237, 493, 29, 541, 285, 157, 669, 413, 93, 605, 349, 221, 477, 61, 573, 317, 189, 445, 125, 637, 381, 253, 509, 3, 515, 259, 131, 643, 387, 67, 579, 323, 195, 451, 35, 547, 291, 163, 675, 419, 99, 611, 355, 227, 483, 19, 531, 275, 147, 659, 403, 83, 595, 339, 211, 467, 51, 563, 307, 179, 691, 435, 115, 627, 371, 243, 499, 11, 523, 267, 139, 651, 395, 75, 587, 331, 203, 459, 43, 555, 299, 171, 683, 427, 107, 619, 363, 235, 491, 27, 539, 283, 155, 667, 411, 91, 603, 347, 219, 475, 59, 571, 315, 187, 699, 443, 123, 635, 379, 251, 507, 7, 519, 263, 135, 647, 391, 71, 583, 327, 199, 455, 39, 551, 295, 167, 679, 423, 103, 615, 359, 231, 487, 23, 535, 279, 151, 663, 407, 87, 599, 343, 215, 471, 55, 567, 311, 183, 695, 439, 119, 631, 375, 247, 503, 15, 527, 271, 143, 655, 399, 79, 591, 335, 207, 463, 47, 559, 303, 175, 687, 431, 111, 623, 367, 239, 495, 31, 543, 287, 159, 671, 415, 95, 607, 351, 223, 479, 63, 575, 319, 191, 447, 127, 639, 383, 255, 511, 2, 514, 258, 130, 642, 386, 66, 578, 322, 194, 450, 34, 546, 290, 162, 674, 418, 98, 610, 354, 226, 482, 18, 530, 274, 146, 658, 402, 82, 594, 338, 210, 466, 50, 562, 306, 178, 690, 434, 114, 626, 370, 242, 498, 10, 522, 266, 138, 650, 394, 74, 586, 330, 202, 458, 42, 554, 298, 170, 682, 426, 106, 618, 362, 234, 490, 26, 538, 282, 154, 666, 410, 90, 602, 346, 218, 474, 58, 570, 314, 186, 698, 442, 122, 634, 378, 250, 506, 6, 518, 262, 134, 646, 390, 70, 582, 326, 198, 454, 38, 550, 294, 166, 678, 422, 102, 614, 358, 230, 486, 22, 534, 278, 150, 662, 406, 86, 598, 342, 214, 470, 54, 566, 310, 182, 694, 438, 118, 630, 374, 246, 502, 14, 526, 270, 142, 654, 398, 78, 590, 334, 206, 462, 46, 558, 302, 174, 686, 430, 110, 622, 366, 238, 494, 30, 542, 286, 158, 670, 414, 94, 606, 350, 222, 478, 62, 574, 318, 190, 446, 126, 638, 382, 254, 510, 4, 516, 260, 132, 644, 388, 68, 580, 324, 196, 452, 36, 548, 292, 164, 676, 420, 100, 612, 356, 228, 484, 20, 532, 276, 148, 660, 404, 84, 596, 340, 212, 468, 52, 564, 308, 180, 692, 436, 116, 628, 372, 244, 500, 12, 524, 268, 140, 652, 396, 76, 588, 332, 204, 460, 44, 556, 300, 172, 684, 428, 108, 620, 364, 236, 492, 28, 540, 284, 156, 668, 412, 92, 604, 348, 220, 476, 60, 572, 316, 188, 700, 444, 124, 636, 380, 252, 508, 8, 520, 264, 136, 648, 392, 72, 584, 328, 200, 456, 40, 552, 296, 168, 680, 424, 104, 616, 360, 232, 488, 24, 536, 280, 152, 664, 408, 88, 600, 344, 216, 472, 56, 568, 312, 184, 696, 440, 120, 632, 376, 248, 504, 16, 528, 272, 144, 656, 400, 80, 592, 336, 208, 464, 48, 560, 304, 176, 688, 432, 112, 624, 368, 240, 496, 32, 544, 288, 160, 672, 416, 96, 608, 352, 224, 480, 64, 576, 320, 192, 448, 128, 640, 384, 256, 512]\n assert candidate(n = 250) == [1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241, 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, 16, 144, 80, 208, 48, 176, 112, 240, 32, 160, 96, 224, 64, 192, 128]\n assert candidate(n = 255) == [1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241, 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253, 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251, 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255, 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254, 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, 16, 144, 80, 208, 48, 176, 112, 240, 32, 160, 96, 224, 64, 192, 128]\n assert candidate(n = 999) == [1, 513, 257, 769, 129, 641, 385, 897, 65, 577, 321, 833, 193, 705, 449, 961, 33, 545, 289, 801, 161, 673, 417, 929, 97, 609, 353, 865, 225, 737, 481, 993, 17, 529, 273, 785, 145, 657, 401, 913, 81, 593, 337, 849, 209, 721, 465, 977, 49, 561, 305, 817, 177, 689, 433, 945, 113, 625, 369, 881, 241, 753, 497, 9, 521, 265, 777, 137, 649, 393, 905, 73, 585, 329, 841, 201, 713, 457, 969, 41, 553, 297, 809, 169, 681, 425, 937, 105, 617, 361, 873, 233, 745, 489, 25, 537, 281, 793, 153, 665, 409, 921, 89, 601, 345, 857, 217, 729, 473, 985, 57, 569, 313, 825, 185, 697, 441, 953, 121, 633, 377, 889, 249, 761, 505, 5, 517, 261, 773, 133, 645, 389, 901, 69, 581, 325, 837, 197, 709, 453, 965, 37, 549, 293, 805, 165, 677, 421, 933, 101, 613, 357, 869, 229, 741, 485, 997, 21, 533, 277, 789, 149, 661, 405, 917, 85, 597, 341, 853, 213, 725, 469, 981, 53, 565, 309, 821, 181, 693, 437, 949, 117, 629, 373, 885, 245, 757, 501, 13, 525, 269, 781, 141, 653, 397, 909, 77, 589, 333, 845, 205, 717, 461, 973, 45, 557, 301, 813, 173, 685, 429, 941, 109, 621, 365, 877, 237, 749, 493, 29, 541, 285, 797, 157, 669, 413, 925, 93, 605, 349, 861, 221, 733, 477, 989, 61, 573, 317, 829, 189, 701, 445, 957, 125, 637, 381, 893, 253, 765, 509, 3, 515, 259, 771, 131, 643, 387, 899, 67, 579, 323, 835, 195, 707, 451, 963, 35, 547, 291, 803, 163, 675, 419, 931, 99, 611, 355, 867, 227, 739, 483, 995, 19, 531, 275, 787, 147, 659, 403, 915, 83, 595, 339, 851, 211, 723, 467, 979, 51, 563, 307, 819, 179, 691, 435, 947, 115, 627, 371, 883, 243, 755, 499, 11, 523, 267, 779, 139, 651, 395, 907, 75, 587, 331, 843, 203, 715, 459, 971, 43, 555, 299, 811, 171, 683, 427, 939, 107, 619, 363, 875, 235, 747, 491, 27, 539, 283, 795, 155, 667, 411, 923, 91, 603, 347, 859, 219, 731, 475, 987, 59, 571, 315, 827, 187, 699, 443, 955, 123, 635, 379, 891, 251, 763, 507, 7, 519, 263, 775, 135, 647, 391, 903, 71, 583, 327, 839, 199, 711, 455, 967, 39, 551, 295, 807, 167, 679, 423, 935, 103, 615, 359, 871, 231, 743, 487, 999, 23, 535, 279, 791, 151, 663, 407, 919, 87, 599, 343, 855, 215, 727, 471, 983, 55, 567, 311, 823, 183, 695, 439, 951, 119, 631, 375, 887, 247, 759, 503, 15, 527, 271, 783, 143, 655, 399, 911, 79, 591, 335, 847, 207, 719, 463, 975, 47, 559, 303, 815, 175, 687, 431, 943, 111, 623, 367, 879, 239, 751, 495, 31, 543, 287, 799, 159, 671, 415, 927, 95, 607, 351, 863, 223, 735, 479, 991, 63, 575, 319, 831, 191, 703, 447, 959, 127, 639, 383, 895, 255, 767, 511, 2, 514, 258, 770, 130, 642, 386, 898, 66, 578, 322, 834, 194, 706, 450, 962, 34, 546, 290, 802, 162, 674, 418, 930, 98, 610, 354, 866, 226, 738, 482, 994, 18, 530, 274, 786, 146, 658, 402, 914, 82, 594, 338, 850, 210, 722, 466, 978, 50, 562, 306, 818, 178, 690, 434, 946, 114, 626, 370, 882, 242, 754, 498, 10, 522, 266, 778, 138, 650, 394, 906, 74, 586, 330, 842, 202, 714, 458, 970, 42, 554, 298, 810, 170, 682, 426, 938, 106, 618, 362, 874, 234, 746, 490, 26, 538, 282, 794, 154, 666, 410, 922, 90, 602, 346, 858, 218, 730, 474, 986, 58, 570, 314, 826, 186, 698, 442, 954, 122, 634, 378, 890, 250, 762, 506, 6, 518, 262, 774, 134, 646, 390, 902, 70, 582, 326, 838, 198, 710, 454, 966, 38, 550, 294, 806, 166, 678, 422, 934, 102, 614, 358, 870, 230, 742, 486, 998, 22, 534, 278, 790, 150, 662, 406, 918, 86, 598, 342, 854, 214, 726, 470, 982, 54, 566, 310, 822, 182, 694, 438, 950, 118, 630, 374, 886, 246, 758, 502, 14, 526, 270, 782, 142, 654, 398, 910, 78, 590, 334, 846, 206, 718, 462, 974, 46, 558, 302, 814, 174, 686, 430, 942, 110, 622, 366, 878, 238, 750, 494, 30, 542, 286, 798, 158, 670, 414, 926, 94, 606, 350, 862, 222, 734, 478, 990, 62, 574, 318, 830, 190, 702, 446, 958, 126, 638, 382, 894, 254, 766, 510, 4, 516, 260, 772, 132, 644, 388, 900, 68, 580, 324, 836, 196, 708, 452, 964, 36, 548, 292, 804, 164, 676, 420, 932, 100, 612, 356, 868, 228, 740, 484, 996, 20, 532, 276, 788, 148, 660, 404, 916, 84, 596, 340, 852, 212, 724, 468, 980, 52, 564, 308, 820, 180, 692, 436, 948, 116, 628, 372, 884, 244, 756, 500, 12, 524, 268, 780, 140, 652, 396, 908, 76, 588, 332, 844, 204, 716, 460, 972, 44, 556, 300, 812, 172, 684, 428, 940, 108, 620, 364, 876, 236, 748, 492, 28, 540, 284, 796, 156, 668, 412, 924, 92, 604, 348, 860, 220, 732, 476, 988, 60, 572, 316, 828, 188, 700, 444, 956, 124, 636, 380, 892, 252, 764, 508, 8, 520, 264, 776, 136, 648, 392, 904, 72, 584, 328, 840, 200, 712, 456, 968, 40, 552, 296, 808, 168, 680, 424, 936, 104, 616, 360, 872, 232, 744, 488, 24, 536, 280, 792, 152, 664, 408, 920, 88, 600, 344, 856, 216, 728, 472, 984, 56, 568, 312, 824, 184, 696, 440, 952, 120, 632, 376, 888, 248, 760, 504, 16, 528, 272, 784, 144, 656, 400, 912, 80, 592, 336, 848, 208, 720, 464, 976, 48, 560, 304, 816, 176, 688, 432, 944, 112, 624, 368, 880, 240, 752, 496, 32, 544, 288, 800, 160, 672, 416, 928, 96, 608, 352, 864, 224, 736, 480, 992, 64, 576, 320, 832, 192, 704, 448, 960, 128, 640, 384, 896, 256, 768, 512]\n assert candidate(n = 375) == [1, 257, 129, 65, 321, 193, 33, 289, 161, 97, 353, 225, 17, 273, 145, 81, 337, 209, 49, 305, 177, 113, 369, 241, 9, 265, 137, 73, 329, 201, 41, 297, 169, 105, 361, 233, 25, 281, 153, 89, 345, 217, 57, 313, 185, 121, 249, 5, 261, 133, 69, 325, 197, 37, 293, 165, 101, 357, 229, 21, 277, 149, 85, 341, 213, 53, 309, 181, 117, 373, 245, 13, 269, 141, 77, 333, 205, 45, 301, 173, 109, 365, 237, 29, 285, 157, 93, 349, 221, 61, 317, 189, 125, 253, 3, 259, 131, 67, 323, 195, 35, 291, 163, 99, 355, 227, 19, 275, 147, 83, 339, 211, 51, 307, 179, 115, 371, 243, 11, 267, 139, 75, 331, 203, 43, 299, 171, 107, 363, 235, 27, 283, 155, 91, 347, 219, 59, 315, 187, 123, 251, 7, 263, 135, 71, 327, 199, 39, 295, 167, 103, 359, 231, 23, 279, 151, 87, 343, 215, 55, 311, 183, 119, 375, 247, 15, 271, 143, 79, 335, 207, 47, 303, 175, 111, 367, 239, 31, 287, 159, 95, 351, 223, 63, 319, 191, 127, 255, 2, 258, 130, 66, 322, 194, 34, 290, 162, 98, 354, 226, 18, 274, 146, 82, 338, 210, 50, 306, 178, 114, 370, 242, 10, 266, 138, 74, 330, 202, 42, 298, 170, 106, 362, 234, 26, 282, 154, 90, 346, 218, 58, 314, 186, 122, 250, 6, 262, 134, 70, 326, 198, 38, 294, 166, 102, 358, 230, 22, 278, 150, 86, 342, 214, 54, 310, 182, 118, 374, 246, 14, 270, 142, 78, 334, 206, 46, 302, 174, 110, 366, 238, 30, 286, 158, 94, 350, 222, 62, 318, 190, 126, 254, 4, 260, 132, 68, 324, 196, 36, 292, 164, 100, 356, 228, 20, 276, 148, 84, 340, 212, 52, 308, 180, 116, 372, 244, 12, 268, 140, 76, 332, 204, 44, 300, 172, 108, 364, 236, 28, 284, 156, 92, 348, 220, 60, 316, 188, 124, 252, 8, 264, 136, 72, 328, 200, 40, 296, 168, 104, 360, 232, 24, 280, 152, 88, 344, 216, 56, 312, 184, 120, 248, 16, 272, 144, 80, 336, 208, 48, 304, 176, 112, 368, 240, 32, 288, 160, 96, 352, 224, 64, 320, 192, 128, 256]\n assert candidate(n = 75) == [1, 65, 33, 17, 49, 9, 73, 41, 25, 57, 5, 69, 37, 21, 53, 13, 45, 29, 61, 3, 67, 35, 19, 51, 11, 75, 43, 27, 59, 7, 71, 39, 23, 55, 15, 47, 31, 63, 2, 66, 34, 18, 50, 10, 74, 42, 26, 58, 6, 70, 38, 22, 54, 14, 46, 30, 62, 4, 68, 36, 20, 52, 12, 44, 28, 60, 8, 72, 40, 24, 56, 16, 48, 32, 64]\n assert candidate(n = 240) == [1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 16, 144, 80, 208, 48, 176, 112, 240, 32, 160, 96, 224, 64, 192, 128]\n assert candidate(n = 875) == [1, 513, 257, 769, 129, 641, 385, 65, 577, 321, 833, 193, 705, 449, 33, 545, 289, 801, 161, 673, 417, 97, 609, 353, 865, 225, 737, 481, 17, 529, 273, 785, 145, 657, 401, 81, 593, 337, 849, 209, 721, 465, 49, 561, 305, 817, 177, 689, 433, 113, 625, 369, 241, 753, 497, 9, 521, 265, 777, 137, 649, 393, 73, 585, 329, 841, 201, 713, 457, 41, 553, 297, 809, 169, 681, 425, 105, 617, 361, 873, 233, 745, 489, 25, 537, 281, 793, 153, 665, 409, 89, 601, 345, 857, 217, 729, 473, 57, 569, 313, 825, 185, 697, 441, 121, 633, 377, 249, 761, 505, 5, 517, 261, 773, 133, 645, 389, 69, 581, 325, 837, 197, 709, 453, 37, 549, 293, 805, 165, 677, 421, 101, 613, 357, 869, 229, 741, 485, 21, 533, 277, 789, 149, 661, 405, 85, 597, 341, 853, 213, 725, 469, 53, 565, 309, 821, 181, 693, 437, 117, 629, 373, 245, 757, 501, 13, 525, 269, 781, 141, 653, 397, 77, 589, 333, 845, 205, 717, 461, 45, 557, 301, 813, 173, 685, 429, 109, 621, 365, 237, 749, 493, 29, 541, 285, 797, 157, 669, 413, 93, 605, 349, 861, 221, 733, 477, 61, 573, 317, 829, 189, 701, 445, 125, 637, 381, 253, 765, 509, 3, 515, 259, 771, 131, 643, 387, 67, 579, 323, 835, 195, 707, 451, 35, 547, 291, 803, 163, 675, 419, 99, 611, 355, 867, 227, 739, 483, 19, 531, 275, 787, 147, 659, 403, 83, 595, 339, 851, 211, 723, 467, 51, 563, 307, 819, 179, 691, 435, 115, 627, 371, 243, 755, 499, 11, 523, 267, 779, 139, 651, 395, 75, 587, 331, 843, 203, 715, 459, 43, 555, 299, 811, 171, 683, 427, 107, 619, 363, 875, 235, 747, 491, 27, 539, 283, 795, 155, 667, 411, 91, 603, 347, 859, 219, 731, 475, 59, 571, 315, 827, 187, 699, 443, 123, 635, 379, 251, 763, 507, 7, 519, 263, 775, 135, 647, 391, 71, 583, 327, 839, 199, 711, 455, 39, 551, 295, 807, 167, 679, 423, 103, 615, 359, 871, 231, 743, 487, 23, 535, 279, 791, 151, 663, 407, 87, 599, 343, 855, 215, 727, 471, 55, 567, 311, 823, 183, 695, 439, 119, 631, 375, 247, 759, 503, 15, 527, 271, 783, 143, 655, 399, 79, 591, 335, 847, 207, 719, 463, 47, 559, 303, 815, 175, 687, 431, 111, 623, 367, 239, 751, 495, 31, 543, 287, 799, 159, 671, 415, 95, 607, 351, 863, 223, 735, 479, 63, 575, 319, 831, 191, 703, 447, 127, 639, 383, 255, 767, 511, 2, 514, 258, 770, 130, 642, 386, 66, 578, 322, 834, 194, 706, 450, 34, 546, 290, 802, 162, 674, 418, 98, 610, 354, 866, 226, 738, 482, 18, 530, 274, 786, 146, 658, 402, 82, 594, 338, 850, 210, 722, 466, 50, 562, 306, 818, 178, 690, 434, 114, 626, 370, 242, 754, 498, 10, 522, 266, 778, 138, 650, 394, 74, 586, 330, 842, 202, 714, 458, 42, 554, 298, 810, 170, 682, 426, 106, 618, 362, 874, 234, 746, 490, 26, 538, 282, 794, 154, 666, 410, 90, 602, 346, 858, 218, 730, 474, 58, 570, 314, 826, 186, 698, 442, 122, 634, 378, 250, 762, 506, 6, 518, 262, 774, 134, 646, 390, 70, 582, 326, 838, 198, 710, 454, 38, 550, 294, 806, 166, 678, 422, 102, 614, 358, 870, 230, 742, 486, 22, 534, 278, 790, 150, 662, 406, 86, 598, 342, 854, 214, 726, 470, 54, 566, 310, 822, 182, 694, 438, 118, 630, 374, 246, 758, 502, 14, 526, 270, 782, 142, 654, 398, 78, 590, 334, 846, 206, 718, 462, 46, 558, 302, 814, 174, 686, 430, 110, 622, 366, 238, 750, 494, 30, 542, 286, 798, 158, 670, 414, 94, 606, 350, 862, 222, 734, 478, 62, 574, 318, 830, 190, 702, 446, 126, 638, 382, 254, 766, 510, 4, 516, 260, 772, 132, 644, 388, 68, 580, 324, 836, 196, 708, 452, 36, 548, 292, 804, 164, 676, 420, 100, 612, 356, 868, 228, 740, 484, 20, 532, 276, 788, 148, 660, 404, 84, 596, 340, 852, 212, 724, 468, 52, 564, 308, 820, 180, 692, 436, 116, 628, 372, 244, 756, 500, 12, 524, 268, 780, 140, 652, 396, 76, 588, 332, 844, 204, 716, 460, 44, 556, 300, 812, 172, 684, 428, 108, 620, 364, 236, 748, 492, 28, 540, 284, 796, 156, 668, 412, 92, 604, 348, 860, 220, 732, 476, 60, 572, 316, 828, 188, 700, 444, 124, 636, 380, 252, 764, 508, 8, 520, 264, 776, 136, 648, 392, 72, 584, 328, 840, 200, 712, 456, 40, 552, 296, 808, 168, 680, 424, 104, 616, 360, 872, 232, 744, 488, 24, 536, 280, 792, 152, 664, 408, 88, 600, 344, 856, 216, 728, 472, 56, 568, 312, 824, 184, 696, 440, 120, 632, 376, 248, 760, 504, 16, 528, 272, 784, 144, 656, 400, 80, 592, 336, 848, 208, 720, 464, 48, 560, 304, 816, 176, 688, 432, 112, 624, 368, 240, 752, 496, 32, 544, 288, 800, 160, 672, 416, 96, 608, 352, 864, 224, 736, 480, 64, 576, 320, 832, 192, 704, 448, 128, 640, 384, 256, 768, 512]\n assert candidate(n = 19) == [1, 17, 9, 5, 13, 3, 19, 11, 7, 15, 2, 18, 10, 6, 14, 4, 12, 8, 16]\n assert candidate(n = 667) == [1, 513, 257, 129, 641, 385, 65, 577, 321, 193, 449, 33, 545, 289, 161, 417, 97, 609, 353, 225, 481, 17, 529, 273, 145, 657, 401, 81, 593, 337, 209, 465, 49, 561, 305, 177, 433, 113, 625, 369, 241, 497, 9, 521, 265, 137, 649, 393, 73, 585, 329, 201, 457, 41, 553, 297, 169, 425, 105, 617, 361, 233, 489, 25, 537, 281, 153, 665, 409, 89, 601, 345, 217, 473, 57, 569, 313, 185, 441, 121, 633, 377, 249, 505, 5, 517, 261, 133, 645, 389, 69, 581, 325, 197, 453, 37, 549, 293, 165, 421, 101, 613, 357, 229, 485, 21, 533, 277, 149, 661, 405, 85, 597, 341, 213, 469, 53, 565, 309, 181, 437, 117, 629, 373, 245, 501, 13, 525, 269, 141, 653, 397, 77, 589, 333, 205, 461, 45, 557, 301, 173, 429, 109, 621, 365, 237, 493, 29, 541, 285, 157, 413, 93, 605, 349, 221, 477, 61, 573, 317, 189, 445, 125, 637, 381, 253, 509, 3, 515, 259, 131, 643, 387, 67, 579, 323, 195, 451, 35, 547, 291, 163, 419, 99, 611, 355, 227, 483, 19, 531, 275, 147, 659, 403, 83, 595, 339, 211, 467, 51, 563, 307, 179, 435, 115, 627, 371, 243, 499, 11, 523, 267, 139, 651, 395, 75, 587, 331, 203, 459, 43, 555, 299, 171, 427, 107, 619, 363, 235, 491, 27, 539, 283, 155, 667, 411, 91, 603, 347, 219, 475, 59, 571, 315, 187, 443, 123, 635, 379, 251, 507, 7, 519, 263, 135, 647, 391, 71, 583, 327, 199, 455, 39, 551, 295, 167, 423, 103, 615, 359, 231, 487, 23, 535, 279, 151, 663, 407, 87, 599, 343, 215, 471, 55, 567, 311, 183, 439, 119, 631, 375, 247, 503, 15, 527, 271, 143, 655, 399, 79, 591, 335, 207, 463, 47, 559, 303, 175, 431, 111, 623, 367, 239, 495, 31, 543, 287, 159, 415, 95, 607, 351, 223, 479, 63, 575, 319, 191, 447, 127, 639, 383, 255, 511, 2, 514, 258, 130, 642, 386, 66, 578, 322, 194, 450, 34, 546, 290, 162, 418, 98, 610, 354, 226, 482, 18, 530, 274, 146, 658, 402, 82, 594, 338, 210, 466, 50, 562, 306, 178, 434, 114, 626, 370, 242, 498, 10, 522, 266, 138, 650, 394, 74, 586, 330, 202, 458, 42, 554, 298, 170, 426, 106, 618, 362, 234, 490, 26, 538, 282, 154, 666, 410, 90, 602, 346, 218, 474, 58, 570, 314, 186, 442, 122, 634, 378, 250, 506, 6, 518, 262, 134, 646, 390, 70, 582, 326, 198, 454, 38, 550, 294, 166, 422, 102, 614, 358, 230, 486, 22, 534, 278, 150, 662, 406, 86, 598, 342, 214, 470, 54, 566, 310, 182, 438, 118, 630, 374, 246, 502, 14, 526, 270, 142, 654, 398, 78, 590, 334, 206, 462, 46, 558, 302, 174, 430, 110, 622, 366, 238, 494, 30, 542, 286, 158, 414, 94, 606, 350, 222, 478, 62, 574, 318, 190, 446, 126, 638, 382, 254, 510, 4, 516, 260, 132, 644, 388, 68, 580, 324, 196, 452, 36, 548, 292, 164, 420, 100, 612, 356, 228, 484, 20, 532, 276, 148, 660, 404, 84, 596, 340, 212, 468, 52, 564, 308, 180, 436, 116, 628, 372, 244, 500, 12, 524, 268, 140, 652, 396, 76, 588, 332, 204, 460, 44, 556, 300, 172, 428, 108, 620, 364, 236, 492, 28, 540, 284, 156, 412, 92, 604, 348, 220, 476, 60, 572, 316, 188, 444, 124, 636, 380, 252, 508, 8, 520, 264, 136, 648, 392, 72, 584, 328, 200, 456, 40, 552, 296, 168, 424, 104, 616, 360, 232, 488, 24, 536, 280, 152, 664, 408, 88, 600, 344, 216, 472, 56, 568, 312, 184, 440, 120, 632, 376, 248, 504, 16, 528, 272, 144, 656, 400, 80, 592, 336, 208, 464, 48, 560, 304, 176, 432, 112, 624, 368, 240, 496, 32, 544, 288, 160, 416, 96, 608, 352, 224, 480, 64, 576, 320, 192, 448, 128, 640, 384, 256, 512]\n assert candidate(n = 77) == [1, 65, 33, 17, 49, 9, 73, 41, 25, 57, 5, 69, 37, 21, 53, 13, 77, 45, 29, 61, 3, 67, 35, 19, 51, 11, 75, 43, 27, 59, 7, 71, 39, 23, 55, 15, 47, 31, 63, 2, 66, 34, 18, 50, 10, 74, 42, 26, 58, 6, 70, 38, 22, 54, 14, 46, 30, 62, 4, 68, 36, 20, 52, 12, 76, 44, 28, 60, 8, 72, 40, 24, 56, 16, 48, 32, 64]\n assert candidate(n = 127) == [1, 65, 33, 97, 17, 81, 49, 113, 9, 73, 41, 105, 25, 89, 57, 121, 5, 69, 37, 101, 21, 85, 53, 117, 13, 77, 45, 109, 29, 93, 61, 125, 3, 67, 35, 99, 19, 83, 51, 115, 11, 75, 43, 107, 27, 91, 59, 123, 7, 71, 39, 103, 23, 87, 55, 119, 15, 79, 47, 111, 31, 95, 63, 127, 2, 66, 34, 98, 18, 82, 50, 114, 10, 74, 42, 106, 26, 90, 58, 122, 6, 70, 38, 102, 22, 86, 54, 118, 14, 78, 46, 110, 30, 94, 62, 126, 4, 68, 36, 100, 20, 84, 52, 116, 12, 76, 44, 108, 28, 92, 60, 124, 8, 72, 40, 104, 24, 88, 56, 120, 16, 80, 48, 112, 32, 96, 64]\n assert candidate(n = 800) == [1, 513, 257, 769, 129, 641, 385, 65, 577, 321, 193, 705, 449, 33, 545, 289, 161, 673, 417, 97, 609, 353, 225, 737, 481, 17, 529, 273, 785, 145, 657, 401, 81, 593, 337, 209, 721, 465, 49, 561, 305, 177, 689, 433, 113, 625, 369, 241, 753, 497, 9, 521, 265, 777, 137, 649, 393, 73, 585, 329, 201, 713, 457, 41, 553, 297, 169, 681, 425, 105, 617, 361, 233, 745, 489, 25, 537, 281, 793, 153, 665, 409, 89, 601, 345, 217, 729, 473, 57, 569, 313, 185, 697, 441, 121, 633, 377, 249, 761, 505, 5, 517, 261, 773, 133, 645, 389, 69, 581, 325, 197, 709, 453, 37, 549, 293, 165, 677, 421, 101, 613, 357, 229, 741, 485, 21, 533, 277, 789, 149, 661, 405, 85, 597, 341, 213, 725, 469, 53, 565, 309, 181, 693, 437, 117, 629, 373, 245, 757, 501, 13, 525, 269, 781, 141, 653, 397, 77, 589, 333, 205, 717, 461, 45, 557, 301, 173, 685, 429, 109, 621, 365, 237, 749, 493, 29, 541, 285, 797, 157, 669, 413, 93, 605, 349, 221, 733, 477, 61, 573, 317, 189, 701, 445, 125, 637, 381, 253, 765, 509, 3, 515, 259, 771, 131, 643, 387, 67, 579, 323, 195, 707, 451, 35, 547, 291, 163, 675, 419, 99, 611, 355, 227, 739, 483, 19, 531, 275, 787, 147, 659, 403, 83, 595, 339, 211, 723, 467, 51, 563, 307, 179, 691, 435, 115, 627, 371, 243, 755, 499, 11, 523, 267, 779, 139, 651, 395, 75, 587, 331, 203, 715, 459, 43, 555, 299, 171, 683, 427, 107, 619, 363, 235, 747, 491, 27, 539, 283, 795, 155, 667, 411, 91, 603, 347, 219, 731, 475, 59, 571, 315, 187, 699, 443, 123, 635, 379, 251, 763, 507, 7, 519, 263, 775, 135, 647, 391, 71, 583, 327, 199, 711, 455, 39, 551, 295, 167, 679, 423, 103, 615, 359, 231, 743, 487, 23, 535, 279, 791, 151, 663, 407, 87, 599, 343, 215, 727, 471, 55, 567, 311, 183, 695, 439, 119, 631, 375, 247, 759, 503, 15, 527, 271, 783, 143, 655, 399, 79, 591, 335, 207, 719, 463, 47, 559, 303, 175, 687, 431, 111, 623, 367, 239, 751, 495, 31, 543, 287, 799, 159, 671, 415, 95, 607, 351, 223, 735, 479, 63, 575, 319, 191, 703, 447, 127, 639, 383, 255, 767, 511, 2, 514, 258, 770, 130, 642, 386, 66, 578, 322, 194, 706, 450, 34, 546, 290, 162, 674, 418, 98, 610, 354, 226, 738, 482, 18, 530, 274, 786, 146, 658, 402, 82, 594, 338, 210, 722, 466, 50, 562, 306, 178, 690, 434, 114, 626, 370, 242, 754, 498, 10, 522, 266, 778, 138, 650, 394, 74, 586, 330, 202, 714, 458, 42, 554, 298, 170, 682, 426, 106, 618, 362, 234, 746, 490, 26, 538, 282, 794, 154, 666, 410, 90, 602, 346, 218, 730, 474, 58, 570, 314, 186, 698, 442, 122, 634, 378, 250, 762, 506, 6, 518, 262, 774, 134, 646, 390, 70, 582, 326, 198, 710, 454, 38, 550, 294, 166, 678, 422, 102, 614, 358, 230, 742, 486, 22, 534, 278, 790, 150, 662, 406, 86, 598, 342, 214, 726, 470, 54, 566, 310, 182, 694, 438, 118, 630, 374, 246, 758, 502, 14, 526, 270, 782, 142, 654, 398, 78, 590, 334, 206, 718, 462, 46, 558, 302, 174, 686, 430, 110, 622, 366, 238, 750, 494, 30, 542, 286, 798, 158, 670, 414, 94, 606, 350, 222, 734, 478, 62, 574, 318, 190, 702, 446, 126, 638, 382, 254, 766, 510, 4, 516, 260, 772, 132, 644, 388, 68, 580, 324, 196, 708, 452, 36, 548, 292, 164, 676, 420, 100, 612, 356, 228, 740, 484, 20, 532, 276, 788, 148, 660, 404, 84, 596, 340, 212, 724, 468, 52, 564, 308, 180, 692, 436, 116, 628, 372, 244, 756, 500, 12, 524, 268, 780, 140, 652, 396, 76, 588, 332, 204, 716, 460, 44, 556, 300, 172, 684, 428, 108, 620, 364, 236, 748, 492, 28, 540, 284, 796, 156, 668, 412, 92, 604, 348, 220, 732, 476, 60, 572, 316, 188, 700, 444, 124, 636, 380, 252, 764, 508, 8, 520, 264, 776, 136, 648, 392, 72, 584, 328, 200, 712, 456, 40, 552, 296, 168, 680, 424, 104, 616, 360, 232, 744, 488, 24, 536, 280, 792, 152, 664, 408, 88, 600, 344, 216, 728, 472, 56, 568, 312, 184, 696, 440, 120, 632, 376, 248, 760, 504, 16, 528, 272, 784, 144, 656, 400, 80, 592, 336, 208, 720, 464, 48, 560, 304, 176, 688, 432, 112, 624, 368, 240, 752, 496, 32, 544, 288, 800, 160, 672, 416, 96, 608, 352, 224, 736, 480, 64, 576, 320, 192, 704, 448, 128, 640, 384, 256, 768, 512]\n assert candidate(n = 200) == [1, 129, 65, 193, 33, 161, 97, 17, 145, 81, 49, 177, 113, 9, 137, 73, 41, 169, 105, 25, 153, 89, 57, 185, 121, 5, 133, 69, 197, 37, 165, 101, 21, 149, 85, 53, 181, 117, 13, 141, 77, 45, 173, 109, 29, 157, 93, 61, 189, 125, 3, 131, 67, 195, 35, 163, 99, 19, 147, 83, 51, 179, 115, 11, 139, 75, 43, 171, 107, 27, 155, 91, 59, 187, 123, 7, 135, 71, 199, 39, 167, 103, 23, 151, 87, 55, 183, 119, 15, 143, 79, 47, 175, 111, 31, 159, 95, 63, 191, 127, 2, 130, 66, 194, 34, 162, 98, 18, 146, 82, 50, 178, 114, 10, 138, 74, 42, 170, 106, 26, 154, 90, 58, 186, 122, 6, 134, 70, 198, 38, 166, 102, 22, 150, 86, 54, 182, 118, 14, 142, 78, 46, 174, 110, 30, 158, 94, 62, 190, 126, 4, 132, 68, 196, 36, 164, 100, 20, 148, 84, 52, 180, 116, 12, 140, 76, 44, 172, 108, 28, 156, 92, 60, 188, 124, 8, 136, 72, 200, 40, 168, 104, 24, 152, 88, 56, 184, 120, 16, 144, 80, 48, 176, 112, 32, 160, 96, 64, 192, 128]\n assert candidate(n = 960) == [1, 513, 257, 769, 129, 641, 385, 897, 65, 577, 321, 833, 193, 705, 449, 33, 545, 289, 801, 161, 673, 417, 929, 97, 609, 353, 865, 225, 737, 481, 17, 529, 273, 785, 145, 657, 401, 913, 81, 593, 337, 849, 209, 721, 465, 49, 561, 305, 817, 177, 689, 433, 945, 113, 625, 369, 881, 241, 753, 497, 9, 521, 265, 777, 137, 649, 393, 905, 73, 585, 329, 841, 201, 713, 457, 41, 553, 297, 809, 169, 681, 425, 937, 105, 617, 361, 873, 233, 745, 489, 25, 537, 281, 793, 153, 665, 409, 921, 89, 601, 345, 857, 217, 729, 473, 57, 569, 313, 825, 185, 697, 441, 953, 121, 633, 377, 889, 249, 761, 505, 5, 517, 261, 773, 133, 645, 389, 901, 69, 581, 325, 837, 197, 709, 453, 37, 549, 293, 805, 165, 677, 421, 933, 101, 613, 357, 869, 229, 741, 485, 21, 533, 277, 789, 149, 661, 405, 917, 85, 597, 341, 853, 213, 725, 469, 53, 565, 309, 821, 181, 693, 437, 949, 117, 629, 373, 885, 245, 757, 501, 13, 525, 269, 781, 141, 653, 397, 909, 77, 589, 333, 845, 205, 717, 461, 45, 557, 301, 813, 173, 685, 429, 941, 109, 621, 365, 877, 237, 749, 493, 29, 541, 285, 797, 157, 669, 413, 925, 93, 605, 349, 861, 221, 733, 477, 61, 573, 317, 829, 189, 701, 445, 957, 125, 637, 381, 893, 253, 765, 509, 3, 515, 259, 771, 131, 643, 387, 899, 67, 579, 323, 835, 195, 707, 451, 35, 547, 291, 803, 163, 675, 419, 931, 99, 611, 355, 867, 227, 739, 483, 19, 531, 275, 787, 147, 659, 403, 915, 83, 595, 339, 851, 211, 723, 467, 51, 563, 307, 819, 179, 691, 435, 947, 115, 627, 371, 883, 243, 755, 499, 11, 523, 267, 779, 139, 651, 395, 907, 75, 587, 331, 843, 203, 715, 459, 43, 555, 299, 811, 171, 683, 427, 939, 107, 619, 363, 875, 235, 747, 491, 27, 539, 283, 795, 155, 667, 411, 923, 91, 603, 347, 859, 219, 731, 475, 59, 571, 315, 827, 187, 699, 443, 955, 123, 635, 379, 891, 251, 763, 507, 7, 519, 263, 775, 135, 647, 391, 903, 71, 583, 327, 839, 199, 711, 455, 39, 551, 295, 807, 167, 679, 423, 935, 103, 615, 359, 871, 231, 743, 487, 23, 535, 279, 791, 151, 663, 407, 919, 87, 599, 343, 855, 215, 727, 471, 55, 567, 311, 823, 183, 695, 439, 951, 119, 631, 375, 887, 247, 759, 503, 15, 527, 271, 783, 143, 655, 399, 911, 79, 591, 335, 847, 207, 719, 463, 47, 559, 303, 815, 175, 687, 431, 943, 111, 623, 367, 879, 239, 751, 495, 31, 543, 287, 799, 159, 671, 415, 927, 95, 607, 351, 863, 223, 735, 479, 63, 575, 319, 831, 191, 703, 447, 959, 127, 639, 383, 895, 255, 767, 511, 2, 514, 258, 770, 130, 642, 386, 898, 66, 578, 322, 834, 194, 706, 450, 34, 546, 290, 802, 162, 674, 418, 930, 98, 610, 354, 866, 226, 738, 482, 18, 530, 274, 786, 146, 658, 402, 914, 82, 594, 338, 850, 210, 722, 466, 50, 562, 306, 818, 178, 690, 434, 946, 114, 626, 370, 882, 242, 754, 498, 10, 522, 266, 778, 138, 650, 394, 906, 74, 586, 330, 842, 202, 714, 458, 42, 554, 298, 810, 170, 682, 426, 938, 106, 618, 362, 874, 234, 746, 490, 26, 538, 282, 794, 154, 666, 410, 922, 90, 602, 346, 858, 218, 730, 474, 58, 570, 314, 826, 186, 698, 442, 954, 122, 634, 378, 890, 250, 762, 506, 6, 518, 262, 774, 134, 646, 390, 902, 70, 582, 326, 838, 198, 710, 454, 38, 550, 294, 806, 166, 678, 422, 934, 102, 614, 358, 870, 230, 742, 486, 22, 534, 278, 790, 150, 662, 406, 918, 86, 598, 342, 854, 214, 726, 470, 54, 566, 310, 822, 182, 694, 438, 950, 118, 630, 374, 886, 246, 758, 502, 14, 526, 270, 782, 142, 654, 398, 910, 78, 590, 334, 846, 206, 718, 462, 46, 558, 302, 814, 174, 686, 430, 942, 110, 622, 366, 878, 238, 750, 494, 30, 542, 286, 798, 158, 670, 414, 926, 94, 606, 350, 862, 222, 734, 478, 62, 574, 318, 830, 190, 702, 446, 958, 126, 638, 382, 894, 254, 766, 510, 4, 516, 260, 772, 132, 644, 388, 900, 68, 580, 324, 836, 196, 708, 452, 36, 548, 292, 804, 164, 676, 420, 932, 100, 612, 356, 868, 228, 740, 484, 20, 532, 276, 788, 148, 660, 404, 916, 84, 596, 340, 852, 212, 724, 468, 52, 564, 308, 820, 180, 692, 436, 948, 116, 628, 372, 884, 244, 756, 500, 12, 524, 268, 780, 140, 652, 396, 908, 76, 588, 332, 844, 204, 716, 460, 44, 556, 300, 812, 172, 684, 428, 940, 108, 620, 364, 876, 236, 748, 492, 28, 540, 284, 796, 156, 668, 412, 924, 92, 604, 348, 860, 220, 732, 476, 60, 572, 316, 828, 188, 700, 444, 956, 124, 636, 380, 892, 252, 764, 508, 8, 520, 264, 776, 136, 648, 392, 904, 72, 584, 328, 840, 200, 712, 456, 40, 552, 296, 808, 168, 680, 424, 936, 104, 616, 360, 872, 232, 744, 488, 24, 536, 280, 792, 152, 664, 408, 920, 88, 600, 344, 856, 216, 728, 472, 56, 568, 312, 824, 184, 696, 440, 952, 120, 632, 376, 888, 248, 760, 504, 16, 528, 272, 784, 144, 656, 400, 912, 80, 592, 336, 848, 208, 720, 464, 48, 560, 304, 816, 176, 688, 432, 944, 112, 624, 368, 880, 240, 752, 496, 32, 544, 288, 800, 160, 672, 416, 928, 96, 608, 352, 864, 224, 736, 480, 64, 576, 320, 832, 192, 704, 448, 960, 128, 640, 384, 896, 256, 768, 512]\n assert candidate(n = 41) == [1, 33, 17, 9, 41, 25, 5, 37, 21, 13, 29, 3, 35, 19, 11, 27, 7, 39, 23, 15, 31, 2, 34, 18, 10, 26, 6, 38, 22, 14, 30, 4, 36, 20, 12, 28, 8, 40, 24, 16, 32]\n assert candidate(n = 31) == [1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31, 2, 18, 10, 26, 6, 22, 14, 30, 4, 20, 12, 28, 8, 24, 16]\n assert candidate(n = 400) == [1, 257, 129, 385, 65, 321, 193, 33, 289, 161, 97, 353, 225, 17, 273, 145, 81, 337, 209, 49, 305, 177, 113, 369, 241, 9, 265, 137, 393, 73, 329, 201, 41, 297, 169, 105, 361, 233, 25, 281, 153, 89, 345, 217, 57, 313, 185, 121, 377, 249, 5, 261, 133, 389, 69, 325, 197, 37, 293, 165, 101, 357, 229, 21, 277, 149, 85, 341, 213, 53, 309, 181, 117, 373, 245, 13, 269, 141, 397, 77, 333, 205, 45, 301, 173, 109, 365, 237, 29, 285, 157, 93, 349, 221, 61, 317, 189, 125, 381, 253, 3, 259, 131, 387, 67, 323, 195, 35, 291, 163, 99, 355, 227, 19, 275, 147, 83, 339, 211, 51, 307, 179, 115, 371, 243, 11, 267, 139, 395, 75, 331, 203, 43, 299, 171, 107, 363, 235, 27, 283, 155, 91, 347, 219, 59, 315, 187, 123, 379, 251, 7, 263, 135, 391, 71, 327, 199, 39, 295, 167, 103, 359, 231, 23, 279, 151, 87, 343, 215, 55, 311, 183, 119, 375, 247, 15, 271, 143, 399, 79, 335, 207, 47, 303, 175, 111, 367, 239, 31, 287, 159, 95, 351, 223, 63, 319, 191, 127, 383, 255, 2, 258, 130, 386, 66, 322, 194, 34, 290, 162, 98, 354, 226, 18, 274, 146, 82, 338, 210, 50, 306, 178, 114, 370, 242, 10, 266, 138, 394, 74, 330, 202, 42, 298, 170, 106, 362, 234, 26, 282, 154, 90, 346, 218, 58, 314, 186, 122, 378, 250, 6, 262, 134, 390, 70, 326, 198, 38, 294, 166, 102, 358, 230, 22, 278, 150, 86, 342, 214, 54, 310, 182, 118, 374, 246, 14, 270, 142, 398, 78, 334, 206, 46, 302, 174, 110, 366, 238, 30, 286, 158, 94, 350, 222, 62, 318, 190, 126, 382, 254, 4, 260, 132, 388, 68, 324, 196, 36, 292, 164, 100, 356, 228, 20, 276, 148, 84, 340, 212, 52, 308, 180, 116, 372, 244, 12, 268, 140, 396, 76, 332, 204, 44, 300, 172, 108, 364, 236, 28, 284, 156, 92, 348, 220, 60, 316, 188, 124, 380, 252, 8, 264, 136, 392, 72, 328, 200, 40, 296, 168, 104, 360, 232, 24, 280, 152, 88, 344, 216, 56, 312, 184, 120, 376, 248, 16, 272, 144, 400, 80, 336, 208, 48, 304, 176, 112, 368, 240, 32, 288, 160, 96, 352, 224, 64, 320, 192, 128, 384, 256]\n assert candidate(n = 750) == [1, 513, 257, 129, 641, 385, 65, 577, 321, 193, 705, 449, 33, 545, 289, 161, 673, 417, 97, 609, 353, 225, 737, 481, 17, 529, 273, 145, 657, 401, 81, 593, 337, 209, 721, 465, 49, 561, 305, 177, 689, 433, 113, 625, 369, 241, 497, 9, 521, 265, 137, 649, 393, 73, 585, 329, 201, 713, 457, 41, 553, 297, 169, 681, 425, 105, 617, 361, 233, 745, 489, 25, 537, 281, 153, 665, 409, 89, 601, 345, 217, 729, 473, 57, 569, 313, 185, 697, 441, 121, 633, 377, 249, 505, 5, 517, 261, 133, 645, 389, 69, 581, 325, 197, 709, 453, 37, 549, 293, 165, 677, 421, 101, 613, 357, 229, 741, 485, 21, 533, 277, 149, 661, 405, 85, 597, 341, 213, 725, 469, 53, 565, 309, 181, 693, 437, 117, 629, 373, 245, 501, 13, 525, 269, 141, 653, 397, 77, 589, 333, 205, 717, 461, 45, 557, 301, 173, 685, 429, 109, 621, 365, 237, 749, 493, 29, 541, 285, 157, 669, 413, 93, 605, 349, 221, 733, 477, 61, 573, 317, 189, 701, 445, 125, 637, 381, 253, 509, 3, 515, 259, 131, 643, 387, 67, 579, 323, 195, 707, 451, 35, 547, 291, 163, 675, 419, 99, 611, 355, 227, 739, 483, 19, 531, 275, 147, 659, 403, 83, 595, 339, 211, 723, 467, 51, 563, 307, 179, 691, 435, 115, 627, 371, 243, 499, 11, 523, 267, 139, 651, 395, 75, 587, 331, 203, 715, 459, 43, 555, 299, 171, 683, 427, 107, 619, 363, 235, 747, 491, 27, 539, 283, 155, 667, 411, 91, 603, 347, 219, 731, 475, 59, 571, 315, 187, 699, 443, 123, 635, 379, 251, 507, 7, 519, 263, 135, 647, 391, 71, 583, 327, 199, 711, 455, 39, 551, 295, 167, 679, 423, 103, 615, 359, 231, 743, 487, 23, 535, 279, 151, 663, 407, 87, 599, 343, 215, 727, 471, 55, 567, 311, 183, 695, 439, 119, 631, 375, 247, 503, 15, 527, 271, 143, 655, 399, 79, 591, 335, 207, 719, 463, 47, 559, 303, 175, 687, 431, 111, 623, 367, 239, 495, 31, 543, 287, 159, 671, 415, 95, 607, 351, 223, 735, 479, 63, 575, 319, 191, 703, 447, 127, 639, 383, 255, 511, 2, 514, 258, 130, 642, 386, 66, 578, 322, 194, 706, 450, 34, 546, 290, 162, 674, 418, 98, 610, 354, 226, 738, 482, 18, 530, 274, 146, 658, 402, 82, 594, 338, 210, 722, 466, 50, 562, 306, 178, 690, 434, 114, 626, 370, 242, 498, 10, 522, 266, 138, 650, 394, 74, 586, 330, 202, 714, 458, 42, 554, 298, 170, 682, 426, 106, 618, 362, 234, 746, 490, 26, 538, 282, 154, 666, 410, 90, 602, 346, 218, 730, 474, 58, 570, 314, 186, 698, 442, 122, 634, 378, 250, 506, 6, 518, 262, 134, 646, 390, 70, 582, 326, 198, 710, 454, 38, 550, 294, 166, 678, 422, 102, 614, 358, 230, 742, 486, 22, 534, 278, 150, 662, 406, 86, 598, 342, 214, 726, 470, 54, 566, 310, 182, 694, 438, 118, 630, 374, 246, 502, 14, 526, 270, 142, 654, 398, 78, 590, 334, 206, 718, 462, 46, 558, 302, 174, 686, 430, 110, 622, 366, 238, 750, 494, 30, 542, 286, 158, 670, 414, 94, 606, 350, 222, 734, 478, 62, 574, 318, 190, 702, 446, 126, 638, 382, 254, 510, 4, 516, 260, 132, 644, 388, 68, 580, 324, 196, 708, 452, 36, 548, 292, 164, 676, 420, 100, 612, 356, 228, 740, 484, 20, 532, 276, 148, 660, 404, 84, 596, 340, 212, 724, 468, 52, 564, 308, 180, 692, 436, 116, 628, 372, 244, 500, 12, 524, 268, 140, 652, 396, 76, 588, 332, 204, 716, 460, 44, 556, 300, 172, 684, 428, 108, 620, 364, 236, 748, 492, 28, 540, 284, 156, 668, 412, 92, 604, 348, 220, 732, 476, 60, 572, 316, 188, 700, 444, 124, 636, 380, 252, 508, 8, 520, 264, 136, 648, 392, 72, 584, 328, 200, 712, 456, 40, 552, 296, 168, 680, 424, 104, 616, 360, 232, 744, 488, 24, 536, 280, 152, 664, 408, 88, 600, 344, 216, 728, 472, 56, 568, 312, 184, 696, 440, 120, 632, 376, 248, 504, 16, 528, 272, 144, 656, 400, 80, 592, 336, 208, 720, 464, 48, 560, 304, 176, 688, 432, 112, 624, 368, 240, 496, 32, 544, 288, 160, 672, 416, 96, 608, 352, 224, 736, 480, 64, 576, 320, 192, 704, 448, 128, 640, 384, 256, 512]\n assert candidate(n = 120) == [1, 65, 33, 97, 17, 81, 49, 113, 9, 73, 41, 105, 25, 89, 57, 5, 69, 37, 101, 21, 85, 53, 117, 13, 77, 45, 109, 29, 93, 61, 3, 67, 35, 99, 19, 83, 51, 115, 11, 75, 43, 107, 27, 91, 59, 7, 71, 39, 103, 23, 87, 55, 119, 15, 79, 47, 111, 31, 95, 63, 2, 66, 34, 98, 18, 82, 50, 114, 10, 74, 42, 106, 26, 90, 58, 6, 70, 38, 102, 22, 86, 54, 118, 14, 78, 46, 110, 30, 94, 62, 4, 68, 36, 100, 20, 84, 52, 116, 12, 76, 44, 108, 28, 92, 60, 8, 72, 40, 104, 24, 88, 56, 120, 16, 80, 48, 112, 32, 96, 64]\n assert candidate(n = 499) == [1, 257, 129, 385, 65, 321, 193, 449, 33, 289, 161, 417, 97, 353, 225, 481, 17, 273, 145, 401, 81, 337, 209, 465, 49, 305, 177, 433, 113, 369, 241, 497, 9, 265, 137, 393, 73, 329, 201, 457, 41, 297, 169, 425, 105, 361, 233, 489, 25, 281, 153, 409, 89, 345, 217, 473, 57, 313, 185, 441, 121, 377, 249, 5, 261, 133, 389, 69, 325, 197, 453, 37, 293, 165, 421, 101, 357, 229, 485, 21, 277, 149, 405, 85, 341, 213, 469, 53, 309, 181, 437, 117, 373, 245, 13, 269, 141, 397, 77, 333, 205, 461, 45, 301, 173, 429, 109, 365, 237, 493, 29, 285, 157, 413, 93, 349, 221, 477, 61, 317, 189, 445, 125, 381, 253, 3, 259, 131, 387, 67, 323, 195, 451, 35, 291, 163, 419, 99, 355, 227, 483, 19, 275, 147, 403, 83, 339, 211, 467, 51, 307, 179, 435, 115, 371, 243, 499, 11, 267, 139, 395, 75, 331, 203, 459, 43, 299, 171, 427, 107, 363, 235, 491, 27, 283, 155, 411, 91, 347, 219, 475, 59, 315, 187, 443, 123, 379, 251, 7, 263, 135, 391, 71, 327, 199, 455, 39, 295, 167, 423, 103, 359, 231, 487, 23, 279, 151, 407, 87, 343, 215, 471, 55, 311, 183, 439, 119, 375, 247, 15, 271, 143, 399, 79, 335, 207, 463, 47, 303, 175, 431, 111, 367, 239, 495, 31, 287, 159, 415, 95, 351, 223, 479, 63, 319, 191, 447, 127, 383, 255, 2, 258, 130, 386, 66, 322, 194, 450, 34, 290, 162, 418, 98, 354, 226, 482, 18, 274, 146, 402, 82, 338, 210, 466, 50, 306, 178, 434, 114, 370, 242, 498, 10, 266, 138, 394, 74, 330, 202, 458, 42, 298, 170, 426, 106, 362, 234, 490, 26, 282, 154, 410, 90, 346, 218, 474, 58, 314, 186, 442, 122, 378, 250, 6, 262, 134, 390, 70, 326, 198, 454, 38, 294, 166, 422, 102, 358, 230, 486, 22, 278, 150, 406, 86, 342, 214, 470, 54, 310, 182, 438, 118, 374, 246, 14, 270, 142, 398, 78, 334, 206, 462, 46, 302, 174, 430, 110, 366, 238, 494, 30, 286, 158, 414, 94, 350, 222, 478, 62, 318, 190, 446, 126, 382, 254, 4, 260, 132, 388, 68, 324, 196, 452, 36, 292, 164, 420, 100, 356, 228, 484, 20, 276, 148, 404, 84, 340, 212, 468, 52, 308, 180, 436, 116, 372, 244, 12, 268, 140, 396, 76, 332, 204, 460, 44, 300, 172, 428, 108, 364, 236, 492, 28, 284, 156, 412, 92, 348, 220, 476, 60, 316, 188, 444, 124, 380, 252, 8, 264, 136, 392, 72, 328, 200, 456, 40, 296, 168, 424, 104, 360, 232, 488, 24, 280, 152, 408, 88, 344, 216, 472, 56, 312, 184, 440, 120, 376, 248, 16, 272, 144, 400, 80, 336, 208, 464, 48, 304, 176, 432, 112, 368, 240, 496, 32, 288, 160, 416, 96, 352, 224, 480, 64, 320, 192, 448, 128, 384, 256]\n assert candidate(n = 13) == [1, 9, 5, 13, 3, 11, 7, 2, 10, 6, 4, 12, 8]\n assert candidate(n = 25) == [1, 17, 9, 25, 5, 21, 13, 3, 19, 11, 7, 23, 15, 2, 18, 10, 6, 22, 14, 4, 20, 12, 8, 24, 16]\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().beautifulArray", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var beautifulArray = function(n) {", "container": null, "callable": "beautifulArray", "parameters": [{"name": "n", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 934, "task_id": "shortest-bridge", "difficulty": "Medium", "problem_description": "You are given an n x n binary matrix grid where 1 represents land and 0 represents water.\nAn island is a 4-directionally connected group of 1's not connected to any other 1's. There are exactly two islands in grid.\nYou may change 0's to 1's to connect the two islands to form one island.\nReturn the smallest number of 0's you must flip to connect the two islands.\n \nExample 1:\n\nInput: grid = [[0,1],[1,0]]\nOutput: 1\n\nExample 2:\n\nInput: grid = [[0,1,0],[0,0,0],[0,0,1]]\nOutput: 2\n\nExample 3:\n\nInput: grid = [[1,1,1,1,1],[1,0,0,0,1],[1,0,1,0,1],[1,0,0,0,1],[1,1,1,1,1]]\nOutput: 1\n\n \nConstraints:\n\nn == grid.length == grid[i].length\n2 <= n <= 100\ngrid[i][j] is either 0 or 1.\nThere are exactly two islands in grid.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[0, 1], [1, 0]]) == 1\n assert candidate(grid = [[0, 1, 0], [0, 0, 0], [0, 0, 1]]) == 2\n assert candidate(grid = [[0, 0, 0, 1, 1], [0, 0, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0], [1, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 0, 0, 0, 1], [0, 0, 0, 1, 1]]) == 4\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0]]) == 5\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0]]) == 1\n assert candidate(grid = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 12\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 1]]) == 6\n assert candidate(grid = [[0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 7\n assert candidate(grid = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 7\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 1, 0]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0]]) == 4\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 3\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 0]]) == 4\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1, 1]]) == 3\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0]]) == 10\n assert candidate(grid = [[1, 1, 0, 1, 1], [1, 1, 0, 1, 0], [0, 0, 0, 0, 0], [0, 0, 0, 1, 0], [0, 0, 1, 0, 0]]) == 1\n assert candidate(grid = [[1, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1]]) == 3\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 1, 0, 0, 1], [1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 1, 0, 1, 1]]) == 2\n assert candidate(grid = [[0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0]]) == 2\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 2\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) == 3\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 1, 0, 1, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1]]) == 1\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 20\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 1], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 2\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1]]) == 7\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 1, 0, 0, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1]]) == 5\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 3\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [1, 0, 0, 0, 1]]) == 3\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 4\n assert candidate(grid = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 18\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 0, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 0, 1]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 10\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 0, 1, 1], [1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [1, 1, 0, 1, 1]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0]]) == 1\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().shortestBridge", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shortestBridge = function(grid) {", "container": null, "callable": "shortestBridge", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 935, "task_id": "knight-dialer", "difficulty": "Medium", "problem_description": "The chess knight has a unique movement, it may move two squares vertically and one square horizontally, or two squares horizontally and one square vertically (with both forming the shape of an L). The possible movements of chess knight are shown in this diagram:\nA chess knight can move as indicated in the chess diagram below:\n\nWe have a chess knight and a phone pad as shown below, the knight can only stand on a numeric cell (i.e. blue cell).\n\nGiven an integer n, return how many distinct phone numbers of length n we can dial.\nYou are allowed to place the knight on any numeric cell initially and then you should perform n - 1 jumps to dial a number of length n. All jumps should be valid knight jumps.\nAs the answer may be very large, return the answer modulo 109 + 7.\n \nExample 1:\n\nInput: n = 1\nOutput: 10\nExplanation: We need to dial a number of length 1, so placing the knight over any numeric cell of the 10 cells is sufficient.\n\nExample 2:\n\nInput: n = 2\nOutput: 20\nExplanation: All the valid number we can dial are [04, 06, 16, 18, 27, 29, 34, 38, 40, 43, 49, 60, 61, 67, 72, 76, 81, 83, 92, 94]\n\nExample 3:\n\nInput: n = 3131\nOutput: 136006598\nExplanation: Please take care of the mod.\n\n \nConstraints:\n\n1 <= n <= 5000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 3) == 46\n assert candidate(n = 100) == 540641702\n assert candidate(n = 50) == 267287516\n assert candidate(n = 2500) == 851996060\n assert candidate(n = 5000) == 406880451\n assert candidate(n = 2) == 20\n assert candidate(n = 1) == 10\n assert candidate(n = 500) == 84202957\n assert candidate(n = 1000) == 88106097\n assert candidate(n = 10) == 14912\n assert candidate(n = 5) == 240\n assert candidate(n = 3131) == 136006598\n assert candidate(n = 4000) == 315083963\n assert candidate(n = 1600) == 585618181\n assert candidate(n = 4750) == 955420830\n assert candidate(n = 4600) == 152432289\n assert candidate(n = 2000) == 71794716\n assert candidate(n = 3750) == 17358003\n assert candidate(n = 2400) == 248946071\n assert candidate(n = 3333) == 857043783\n assert candidate(n = 3500) == 624537543\n assert candidate(n = 3000) == 447863713\n assert candidate(n = 30) == 986742198\n assert candidate(n = 1200) == 823605881\n assert candidate(n = 4900) == 790356323\n assert candidate(n = 2750) == 49052199\n assert candidate(n = 1800) == 159765442\n assert candidate(n = 2800) == 779464575\n assert candidate(n = 250) == 296754066\n assert candidate(n = 4250) == 12437801\n assert candidate(n = 20) == 58689536\n assert candidate(n = 1250) == 926597988\n assert candidate(n = 3132) == 915594565\n assert candidate(n = 800) == 709497038\n assert candidate(n = 15) == 944000\n assert candidate(n = 4999) == 659158877\n assert candidate(n = 200) == 38950354\n assert candidate(n = 400) == 23117445\n assert candidate(n = 1234) == 758728301\n assert candidate(n = 750) == 185434245\n assert candidate(n = 4500) == 756988614\n assert candidate(n = 1500) == 487569438\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().knightDialer", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var knightDialer = function(n) {", "container": null, "callable": "knightDialer", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 936, "task_id": "stamping-the-sequence", "difficulty": "Hard", "problem_description": "You are given two strings stamp and target. Initially, there is a string s of length target.length with all s[i] == '?'.\nIn one turn, you can place stamp over s and replace every letter in the s with the corresponding letter from stamp.\n\nFor example, if stamp = \"abc\" and target = \"abcba\", then s is \"?????\" initially. In one turn you can:\n\n\t\nplace stamp at index 0 of s to obtain \"abc??\",\nplace stamp at index 1 of s to obtain \"?abc?\", or\nplace stamp at index 2 of s to obtain \"??abc\".\n\n\tNote that stamp must be fully contained in the boundaries of s in order to stamp (i.e., you cannot place stamp at index 3 of s).\n\nWe want to convert s to target using at most 10 * target.length turns.\nReturn an array of the index of the left-most letter being stamped at each turn. If we cannot obtain target from s within 10 * target.length turns, return an empty array.\n \nExample 1:\n\nInput: stamp = \"abc\", target = \"ababc\"\nOutput: [0,2]\nExplanation: Initially s = \"?????\".\n- Place stamp at index 0 to get \"abc??\".\n- Place stamp at index 2 to get \"ababc\".\n[1,0,2] would also be accepted as an answer, as well as some other answers.\n\nExample 2:\n\nInput: stamp = \"abca\", target = \"aabcaca\"\nOutput: [3,0,1]\nExplanation: Initially s = \"???????\".\n- Place stamp at index 3 to get \"???abca\".\n- Place stamp at index 0 to get \"abcabca\".\n- Place stamp at index 1 to get \"aabcaca\".\n\n \nConstraints:\n\n1 <= stamp.length <= target.length <= 1000\nstamp and target consist of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(stamp = \"world\",target = \"worldworldworld\") == [9, 8, 7, 6, 4, 3, 2, 1, 10, 5, 0]\n assert candidate(stamp = \"abc\",target = \"abcababcbcababc\") == [11, 9, 8, 6, 4, 2, 1, 10, 7, 3, 12, 5, 0]\n assert candidate(stamp = \"abcde\",target = \"abcdeabcde\") == [4, 3, 2, 1, 5, 0]\n assert candidate(stamp = \"abc\",target = \"abc????\") == []\n assert candidate(stamp = \"a\",target = \"aaaaaaaa\") == [7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(stamp = \"abcde\",target = \"abcdeabcdeabcde\") == [9, 8, 7, 6, 4, 3, 2, 1, 10, 5, 0]\n assert candidate(stamp = \"abc\",target = \"????abc???\") == []\n assert candidate(stamp = \"abc\",target = \"abcabc????????\") == []\n assert candidate(stamp = \"abc\",target = \"?????\") == []\n assert candidate(stamp = \"abc\",target = \"ab?bc\") == []\n assert candidate(stamp = \"hello\",target = \"hellohellohello\") == [9, 8, 7, 6, 4, 3, 2, 1, 10, 5, 0]\n assert candidate(stamp = \"abc\",target = \"abc????abc\") == []\n assert candidate(stamp = \"ab\",target = \"abababab\") == [5, 3, 1, 6, 4, 2, 0]\n assert candidate(stamp = \"abcdef\",target = \"abcdefabcdef\") == [5, 4, 3, 2, 1, 6, 0]\n assert candidate(stamp = \"a\",target = \"aaaaaaaaa\") == [8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(stamp = \"abc\",target = \"abcabcabc\") == [5, 4, 2, 1, 6, 3, 0]\n assert candidate(stamp = \"abc\",target = \"abc????????abc\") == []\n assert candidate(stamp = \"abc\",target = \"abcabc\") == [2, 1, 3, 0]\n assert candidate(stamp = \"a\",target = \"aaaaaaaaaa\") == [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(stamp = \"test\",target = \"testtesttest\") == [7, 6, 5, 3, 2, 1, 8, 4, 0]\n assert candidate(stamp = \"abcd\",target = \"abcdabcd\") == [3, 2, 1, 4, 0]\n assert candidate(stamp = \"abca\",target = \"aabcaca\") == [2, 3, 0, 1]\n assert candidate(stamp = \"abc\",target = \"????abc\") == []\n assert candidate(stamp = \"abc\",target = \"??abc??\") == []\n assert candidate(stamp = \"abc\",target = \"ababc\") == [1, 0, 2]\n assert candidate(stamp = \"xyz\",target = \"xyzxyzxyz\") == [5, 4, 2, 1, 6, 3, 0]\n assert candidate(stamp = \"abc\",target = \"????????abcabc\") == []\n assert candidate(stamp = \"abc\",target = \"abcabcabcabcabc\") == [11, 10, 8, 7, 5, 4, 2, 1, 12, 9, 6, 3, 0]\n assert candidate(stamp = \"abcde\",target = \"abcde\") == [0]\n assert candidate(stamp = \"abc\",target = \"ababcbababcbababc\") == [11, 9, 5, 3, 13, 10, 7, 4, 1, 12, 6, 0, 14, 8, 2]\n assert candidate(stamp = \"mnopqr\",target = \"mnopqrmnopqrmnopqrmnopqrmnopqr\") == [23, 22, 21, 20, 19, 17, 16, 15, 14, 13, 11, 10, 9, 8, 7, 5, 4, 3, 2, 1, 24, 18, 12, 6, 0]\n assert candidate(stamp = \"efgh\",target = \"efghefghefghefghefghefghefgh\") == [23, 22, 21, 19, 18, 17, 15, 14, 13, 11, 10, 9, 7, 6, 5, 3, 2, 1, 24, 20, 16, 12, 8, 4, 0]\n assert candidate(stamp = \"aabbcc\",target = \"aabbccaaabbccaaabbcc\") == [11, 10, 9, 8, 4, 3, 2, 1, 13, 12, 6, 5, 14, 7, 0]\n assert candidate(stamp = \"abcd\",target = \"ddddddddddddddddddddddddddddabcd\") == []\n assert candidate(stamp = \"xyz\",target = \"xyxyxyxyxyxyxyxyxyxy\") == []\n assert candidate(stamp = \"zzz\",target = \"zzzzzzzzzzzzzzzzzzzz\") == [17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(stamp = \"abcdef\",target = \"abcdefabcdefabcdefabcdefabcdefabcdef\") == [29, 28, 27, 26, 25, 23, 22, 21, 20, 19, 17, 16, 15, 14, 13, 11, 10, 9, 8, 7, 5, 4, 3, 2, 1, 30, 24, 18, 12, 6, 0]\n assert candidate(stamp = \"xyz\",target = \"xyxyxyxyxyxyxyxyxyxyxyx\") == []\n assert candidate(stamp = \"abcabc\",target = \"abcabcabcabcabcabcabcd\") == []\n assert candidate(stamp = \"aabbcc\",target = \"aabbccaaabbccaaabbccaaabbcc\") == [18, 17, 16, 15, 11, 10, 9, 8, 4, 3, 2, 1, 20, 19, 13, 12, 6, 5, 21, 14, 7, 0]\n assert candidate(stamp = \"xyz\",target = \"xyzxyzxyzxyzxyz\") == [11, 10, 8, 7, 5, 4, 2, 1, 12, 9, 6, 3, 0]\n assert candidate(stamp = \"abcd\",target = \"abcdabcdeabcdabcd\") == []\n assert candidate(stamp = \"aaaa\",target = \"aaaaaaaaaaaaaaaa\") == [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(stamp = \"abcde\",target = \"abcdeabcdeabcdeabcdef\") == []\n assert candidate(stamp = \"abc\",target = \"xyzabcxyzabcxyz\") == []\n assert candidate(stamp = \"abcd\",target = \"abcdabcdabcdabcd\") == [11, 10, 9, 7, 6, 5, 3, 2, 1, 12, 8, 4, 0]\n assert candidate(stamp = \"xyz\",target = \"xyzxyzxyzxyz\") == [8, 7, 5, 4, 2, 1, 9, 6, 3, 0]\n assert candidate(stamp = \"qrstuv\",target = \"qrstuvqrstuvqrstuvqrstuvqrstuvqrstuvqrstuv\") == [35, 34, 33, 32, 31, 29, 28, 27, 26, 25, 23, 22, 21, 20, 19, 17, 16, 15, 14, 13, 11, 10, 9, 8, 7, 5, 4, 3, 2, 1, 36, 30, 24, 18, 12, 6, 0]\n assert candidate(stamp = \"aaa\",target = \"aaaaaaaaaaaaaaaaaaaa\") == [17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(stamp = \"a\",target = \"aaaaaaaaaaaaaaaaaaaa\") == [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(stamp = \"xyzabc\",target = \"xyzabcxyzabcxyzabcxyzabc\") == [17, 16, 15, 14, 13, 11, 10, 9, 8, 7, 5, 4, 3, 2, 1, 18, 12, 6, 0]\n assert candidate(stamp = \"abcabc\",target = \"abcabcabcabcabcabcabc\") == [14, 13, 11, 10, 8, 7, 5, 4, 2, 1, 15, 12, 9, 6, 3, 0]\n assert candidate(stamp = \"abcde\",target = \"edcbaedcbaedcba\") == []\n assert candidate(stamp = \"abcabc\",target = \"abcabcabcabcabcabcabcabc\") == [17, 16, 14, 13, 11, 10, 8, 7, 5, 4, 2, 1, 18, 15, 12, 9, 6, 3, 0]\n assert candidate(stamp = \"xyz\",target = \"xyzxyzxyzxyzxyzxyz\") == [14, 13, 11, 10, 8, 7, 5, 4, 2, 1, 15, 12, 9, 6, 3, 0]\n assert candidate(stamp = \"qrst\",target = \"qrstqrstqrstqrstqrstqrstqrstqrst\") == [27, 26, 25, 23, 22, 21, 19, 18, 17, 15, 14, 13, 11, 10, 9, 7, 6, 5, 3, 2, 1, 28, 24, 20, 16, 12, 8, 4, 0]\n assert candidate(stamp = \"mnop\",target = \"mnopmnopmnopmnopmnopmnopmnopmnop\") == [27, 26, 25, 23, 22, 21, 19, 18, 17, 15, 14, 13, 11, 10, 9, 7, 6, 5, 3, 2, 1, 28, 24, 20, 16, 12, 8, 4, 0]\n assert candidate(stamp = \"abc\",target = \"abcabcabcabcabcabc\") == [14, 13, 11, 10, 8, 7, 5, 4, 2, 1, 15, 12, 9, 6, 3, 0]\n assert candidate(stamp = \"abac\",target = \"abacabacabacabacabac\") == [15, 14, 13, 11, 10, 9, 7, 6, 5, 3, 2, 1, 16, 12, 8, 4, 0]\n assert candidate(stamp = \"abc\",target = \"aaaaaaaaaaabcabcaaaaaaaaaa\") == []\n assert candidate(stamp = \"ab\",target = \"abababababababababab\") == [17, 15, 13, 11, 9, 7, 5, 3, 1, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0]\n assert candidate(stamp = \"stamp\",target = \"stampstampstamp\") == [9, 8, 7, 6, 4, 3, 2, 1, 10, 5, 0]\n assert candidate(stamp = \"abcdefg\",target = \"abcdefgabcdefgabcdefgabcdefg\") == [20, 19, 18, 17, 16, 15, 13, 12, 11, 10, 9, 8, 6, 5, 4, 3, 2, 1, 21, 14, 7, 0]\n assert candidate(stamp = \"abcde\",target = \"abcdeabcdeabcdeabcdeabc\") == []\n assert candidate(stamp = \"abab\",target = \"abababababababab\") == [11, 9, 7, 5, 3, 1, 12, 10, 8, 6, 4, 2, 0]\n assert candidate(stamp = \"ab\",target = \"abaabaabaab\") == [7, 4, 1, 8, 5, 2, 9, 6, 3, 0]\n assert candidate(stamp = \"hello\",target = \"hellohellohellohello\") == [14, 13, 12, 11, 9, 8, 7, 6, 4, 3, 2, 1, 15, 10, 5, 0]\n assert candidate(stamp = \"mnopqr\",target = \"mnopqrnopqrmonpqrnonqrmpnoqrmnoprqmnopqr\") == []\n assert candidate(stamp = \"abc\",target = \"ababababababababc\") == [1, 3, 0, 5, 2, 7, 4, 9, 6, 11, 8, 13, 10, 12, 14]\n assert candidate(stamp = \"xyzxyz\",target = \"xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz\") == [29, 28, 26, 25, 23, 22, 20, 19, 17, 16, 14, 13, 11, 10, 8, 7, 5, 4, 2, 1, 30, 27, 24, 21, 18, 15, 12, 9, 6, 3, 0]\n assert candidate(stamp = \"hello\",target = \"hellohellohellohelloh\") == []\n assert candidate(stamp = \"abcd\",target = \"abcabcabcabc\") == []\n assert candidate(stamp = \"abcd\",target = \"abcdeabcd\") == []\n assert candidate(stamp = \"mnopqr\",target = \"mnopqrmnopqrmnopqr\") == [11, 10, 9, 8, 7, 5, 4, 3, 2, 1, 12, 6, 0]\n assert candidate(stamp = \"aabbcc\",target = \"aabbccaaabbccaaabbccabc\") == []\n assert candidate(stamp = \"abcdef\",target = \"fedcbafedcbafedcba\") == []\n assert candidate(stamp = \"abcdef\",target = \"abcdefabcdefabcdefabcdef\") == [17, 16, 15, 14, 13, 11, 10, 9, 8, 7, 5, 4, 3, 2, 1, 18, 12, 6, 0]\n assert candidate(stamp = \"stamp\",target = \"stampstampstampstam\") == []\n assert candidate(stamp = \"abcdefg\",target = \"abcdefgabcdefgabcdefgabcdefgabcdefgabcdefg\") == [34, 33, 32, 31, 30, 29, 27, 26, 25, 24, 23, 22, 20, 19, 18, 17, 16, 15, 13, 12, 11, 10, 9, 8, 6, 5, 4, 3, 2, 1, 35, 28, 21, 14, 7, 0]\n assert candidate(stamp = \"abcd\",target = \"abcdabcdabcdabcdabcd\") == [15, 14, 13, 11, 10, 9, 7, 6, 5, 3, 2, 1, 16, 12, 8, 4, 0]\n assert candidate(stamp = \"abcd\",target = \"abcdabcabcd\") == [6, 5, 3, 2, 1, 4, 7, 0]\n assert candidate(stamp = \"xyzyx\",target = \"xyzyxyzyxyzyxyzyxyzyxyzyxyzyxyzyxyzyxyzyxyzyxyzyxyzyxyzyxyzyxyzyxyzyxyzyx\") == [67, 66, 65, 63, 62, 61, 59, 58, 57, 55, 54, 53, 51, 50, 49, 47, 46, 45, 43, 42, 41, 39, 38, 37, 35, 34, 33, 31, 30, 29, 27, 26, 25, 23, 22, 21, 19, 18, 17, 15, 14, 13, 11, 10, 9, 7, 6, 5, 3, 2, 1, 68, 64, 60, 56, 52, 48, 44, 40, 36, 32, 28, 24, 20, 16, 12, 8, 4, 0]\n assert candidate(stamp = \"ab\",target = \"ababababababababababh\") == []\n assert candidate(stamp = \"abcde\",target = \"abcdeabcdeabcdeabcde\") == [14, 13, 12, 11, 9, 8, 7, 6, 4, 3, 2, 1, 15, 10, 5, 0]\n assert candidate(stamp = \"abcd\",target = \"dabcdabc\") == []\n assert candidate(stamp = \"aabbcc\",target = \"aabbccaabbccaaabbccaaabbccaaabbccaaabbcc\") == [31, 30, 29, 28, 24, 23, 22, 21, 17, 16, 15, 14, 10, 9, 8, 7, 33, 32, 26, 25, 19, 18, 12, 11, 5, 4, 3, 2, 1, 34, 27, 20, 13, 6, 0]\n assert candidate(stamp = \"aabbcc\",target = \"aabbccaabbccaabbcc\") == [11, 10, 9, 8, 7, 5, 4, 3, 2, 1, 12, 6, 0]\n assert candidate(stamp = \"abcdef\",target = \"fedcbafedcbafedcbafedcbafedcbafedcbafedcba\") == []\n"}, "metadata": {"canonical_parameter_names": ["stamp", "target"], "leetcode_dataset_entry_point": "Solution().movesToStamp", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var movesToStamp = function(stamp, target) {", "container": null, "callable": "movesToStamp", "parameters": [{"name": "stamp", "type": "string"}, {"name": "target", "type": "string"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 937, "task_id": "reorder-data-in-log-files", "difficulty": "Medium", "problem_description": "You are given an array of logs. Each log is a space-delimited string of words, where the first word is the identifier.\nThere are two types of logs:\n\nLetter-logs: All words (except the identifier) consist of lowercase English letters.\nDigit-logs: All words (except the identifier) consist of digits.\n\nReorder these logs so that:\n\nThe letter-logs come before all digit-logs.\nThe letter-logs are sorted lexicographically by their contents. If their contents are the same, then sort them lexicographically by their identifiers.\nThe digit-logs maintain their relative ordering.\n\nReturn the final order of the logs.\n \nExample 1:\n\nInput: logs = [\"dig1 8 1 5 1\",\"let1 art can\",\"dig2 3 6\",\"let2 own kit dig\",\"let3 art zero\"]\nOutput: [\"let1 art can\",\"let3 art zero\",\"let2 own kit dig\",\"dig1 8 1 5 1\",\"dig2 3 6\"]\nExplanation:\nThe letter-log contents are all different, so their ordering is \"art can\", \"art zero\", \"own kit dig\".\nThe digit-logs have a relative order of \"dig1 8 1 5 1\", \"dig2 3 6\".\n\nExample 2:\n\nInput: logs = [\"a1 9 2 3 1\",\"g1 act car\",\"zo4 4 7\",\"ab1 off key dog\",\"a8 act zoo\"]\nOutput: [\"g1 act car\",\"a8 act zoo\",\"ab1 off key dog\",\"a1 9 2 3 1\",\"zo4 4 7\"]\n\n \nConstraints:\n\n1 <= logs.length <= 100\n3 <= logs[i].length <= 100\nAll the tokens of logs[i] are separated by a single space.\nlogs[i] is guaranteed to have an identifier and at least one word after the identifier.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(logs = ['dig1 8 1 5 1', 'let1 art can', 'dig2 3 6', 'let2 own kit dig', 'let3 art zero']) == ['let1 art can', 'let3 art zero', 'let2 own kit dig', 'dig1 8 1 5 1', 'dig2 3 6']\n assert candidate(logs = ['a1 9 2 3 1', 'g1 act car', 'zo4 4 7', 'ab1 off key dog', 'a8 act zoo']) == ['g1 act car', 'a8 act zoo', 'ab1 off key dog', 'a1 9 2 3 1', 'zo4 4 7']\n assert candidate(logs = ['x1 2 3', 'y1 2 4', 'z1 2 5', 'a1 act car', 'b1 act zoo', 'c1 off key dog', 'd1 art can', 'e1 8 1 5 1', 'f1 own kit dig', 'g1 art zero', 'h1 3 6', 'i1 act car', 'j1 act zoo', 'k1 off key dog', 'l1 art can', 'm1 8 1 5 1', 'n1 own kit dig', 'o1 art zero', 'p1 3 6']) == ['a1 act car', 'i1 act car', 'b1 act zoo', 'j1 act zoo', 'd1 art can', 'l1 art can', 'g1 art zero', 'o1 art zero', 'c1 off key dog', 'k1 off key dog', 'f1 own kit dig', 'n1 own kit dig', 'x1 2 3', 'y1 2 4', 'z1 2 5', 'e1 8 1 5 1', 'h1 3 6', 'm1 8 1 5 1', 'p1 3 6']\n assert candidate(logs = ['log1 123', 'log2 def', 'log3 def', 'log4 def', 'log5 abc', 'log6 abc', 'log7 abc', 'log8 abc', 'log9 xyz', 'log10 xyz', 'log11 xyz', 'log12 xyz', 'log13 xyz', 'log14 xyz', 'log15 xyz', 'log16 xyz', 'log17 xyz', 'log18 xyz', 'log19 xyz', 'log20 xyz', 'log21 xyz', 'log22 xyz', 'log23 xyz', 'log24 xyz', 'log25 xyz', 'log26 xyz', 'log27 xyz', 'log28 xyz', 'log29 xyz', 'log30 xyz', 'log31 xyz', 'log32 xyz', 'log33 xyz', 'log34 xyz', 'log35 xyz', 'log36 xyz', 'log37 xyz', 'log38 xyz', 'log39 xyz', 'log40 xyz', 'log41 xyz', 'log42 xyz', 'log43 xyz', 'log44 xyz', 'log45 xyz', 'log46 xyz', 'log47 xyz', 'log48 xyz', 'log49 xyz', 'log50 xyz', 'log51 456', 'd1 1', 'd2 2', 'd3 3', 'd4 4', 'd5 5', 'd6 6', 'd7 7', 'd8 8', 'd9 9', 'd10 10']) == ['log5 abc', 'log6 abc', 'log7 abc', 'log8 abc', 'log2 def', 'log3 def', 'log4 def', 'log10 xyz', 'log11 xyz', 'log12 xyz', 'log13 xyz', 'log14 xyz', 'log15 xyz', 'log16 xyz', 'log17 xyz', 'log18 xyz', 'log19 xyz', 'log20 xyz', 'log21 xyz', 'log22 xyz', 'log23 xyz', 'log24 xyz', 'log25 xyz', 'log26 xyz', 'log27 xyz', 'log28 xyz', 'log29 xyz', 'log30 xyz', 'log31 xyz', 'log32 xyz', 'log33 xyz', 'log34 xyz', 'log35 xyz', 'log36 xyz', 'log37 xyz', 'log38 xyz', 'log39 xyz', 'log40 xyz', 'log41 xyz', 'log42 xyz', 'log43 xyz', 'log44 xyz', 'log45 xyz', 'log46 xyz', 'log47 xyz', 'log48 xyz', 'log49 xyz', 'log50 xyz', 'log9 xyz', 'log1 123', 'log51 456', 'd1 1', 'd2 2', 'd3 3', 'd4 4', 'd5 5', 'd6 6', 'd7 7', 'd8 8', 'd9 9', 'd10 10']\n assert candidate(logs = ['f1 10 20 30', 'e2 9 18 27', 'd3 8 16 24', 'c4 7 14 21', 'b5 6 12 18', 'a6 5 10 15', 'z7 4 8 12', 'y8 3 6 9', 'x9 2 4 6', 'w10 1 2 3', 'v11 11 22 33', 'u12 10 20 30']) == ['f1 10 20 30', 'e2 9 18 27', 'd3 8 16 24', 'c4 7 14 21', 'b5 6 12 18', 'a6 5 10 15', 'z7 4 8 12', 'y8 3 6 9', 'x9 2 4 6', 'w10 1 2 3', 'v11 11 22 33', 'u12 10 20 30']\n assert candidate(logs = ['z1 1 1', 'y2 2 2', 'x3 3 3', 'w4 4 4', 'v5 5 5', 'u6 6 6', 't7 7 7', 's8 8 8', 'r9 9 9', 'q10 10 10', 'p11 11 11', 'o12 12 12', 'n13 13 13', 'm14 14 14', 'l15 15 15', 'k16 16 16', 'j17 17 17', 'i18 18 18', 'h19 19 19', 'g20 20 20', 'f21 21 21', 'e22 22 22', 'd23 23 23', 'c24 24 24', 'b25 25 25', 'a26 abc', 'a27 def', 'a28 ghi', 'a29 jkl', 'a30 mno']) == ['a26 abc', 'a27 def', 'a28 ghi', 'a29 jkl', 'a30 mno', 'z1 1 1', 'y2 2 2', 'x3 3 3', 'w4 4 4', 'v5 5 5', 'u6 6 6', 't7 7 7', 's8 8 8', 'r9 9 9', 'q10 10 10', 'p11 11 11', 'o12 12 12', 'n13 13 13', 'm14 14 14', 'l15 15 15', 'k16 16 16', 'j17 17 17', 'i18 18 18', 'h19 19 19', 'g20 20 20', 'f21 21 21', 'e22 22 22', 'd23 23 23', 'c24 24 24', 'b25 25 25']\n assert candidate(logs = ['log6 123 456', 'log5 789', 'log4 abc def', 'log3 xyz', 'log2 mno pqr', 'log1 def ghi', 'log0 def']) == ['log4 abc def', 'log0 def', 'log1 def ghi', 'log2 mno pqr', 'log3 xyz', 'log6 123 456', 'log5 789']\n assert candidate(logs = ['a1 abc def', 'b2 def abc', 'c3 abc abc', 'd1 1 2 3', 'e2 4 5 6', 'f3 7 8 9', 'g4 1 2 3 4', 'h5 5 6 7 8', 'i6 9 0 1 2', 'j7 3 4 5 6', 'k8 7 8 9 0', 'l9 1 2 3 4 5', 'm10 5 6 7 8 9', 'n11 9 0 1 2 3', 'o12 3 4 5 6 7', 'p13 7 8 9 0 1', 'q14 1 2 3 4 5 6', 'r15 5 6 7 8 9 0', 's16 9 0 1 2 3 4', 't17 3 4 5 6 7 8', 'u18 7 8 9 0 1 2', 'v19 1 2 3 4 5 6 7', 'w20 5 6 7 8 9 0 1']) == ['c3 abc abc', 'a1 abc def', 'b2 def abc', 'd1 1 2 3', 'e2 4 5 6', 'f3 7 8 9', 'g4 1 2 3 4', 'h5 5 6 7 8', 'i6 9 0 1 2', 'j7 3 4 5 6', 'k8 7 8 9 0', 'l9 1 2 3 4 5', 'm10 5 6 7 8 9', 'n11 9 0 1 2 3', 'o12 3 4 5 6 7', 'p13 7 8 9 0 1', 'q14 1 2 3 4 5 6', 'r15 5 6 7 8 9 0', 's16 9 0 1 2 3 4', 't17 3 4 5 6 7 8', 'u18 7 8 9 0 1 2', 'v19 1 2 3 4 5 6 7', 'w20 5 6 7 8 9 0 1']\n assert candidate(logs = ['x1 1 2 3', 'x2 1 2 4', 'y1 1 2 3 4', 'y2 1 2 3 5', 'y3 1 2 3 6', 'x3 1 2 3 5', 'x4 1 2 3 7']) == ['x1 1 2 3', 'x2 1 2 4', 'y1 1 2 3 4', 'y2 1 2 3 5', 'y3 1 2 3 6', 'x3 1 2 3 5', 'x4 1 2 3 7']\n assert candidate(logs = ['log12 mix foo', 'log42 12 34', 'log33 bar foo', 'log22 mix bar', 'log55 99 88', 'log11 bar foo']) == ['log11 bar foo', 'log33 bar foo', 'log22 mix bar', 'log12 mix foo', 'log42 12 34', 'log55 99 88']\n assert candidate(logs = ['id1 z', 'id2 y', 'id3 x', 'id4 w', 'id5 v', 'id6 u', 'id7 t', 'id8 s', 'id9 r', 'id10 q', 'id11 p', 'id12 o', 'id13 n', 'id14 m', 'id15 l', 'id16 k', 'id17 j', 'id18 i', 'id19 h', 'id20 g', 'id21 f', 'id22 e', 'id23 d', 'id24 c', 'id25 b', 'id26 a']) == ['id26 a', 'id25 b', 'id24 c', 'id23 d', 'id22 e', 'id21 f', 'id20 g', 'id19 h', 'id18 i', 'id17 j', 'id16 k', 'id15 l', 'id14 m', 'id13 n', 'id12 o', 'id11 p', 'id10 q', 'id9 r', 'id8 s', 'id7 t', 'id6 u', 'id5 v', 'id4 w', 'id3 x', 'id2 y', 'id1 z']\n assert candidate(logs = ['abc1 def ghi', '123 456 789', 'xyz2 jkl mno', 'def3 opq rst', 'uvw4 123 456', 'uvw4 123 456', 'xyz1 jkl mno', 'xyz3 mno pqr']) == ['abc1 def ghi', 'xyz1 jkl mno', 'xyz2 jkl mno', 'xyz3 mno pqr', 'def3 opq rst', '123 456 789', 'uvw4 123 456', 'uvw4 123 456']\n assert candidate(logs = ['d1 2 3', 'l1 xx', 'l2 xx', 'l3 xx a', 'l4 xx b', 'd2 4 5', 'd3 1 2', 'l5 yy', 'l6 yy z', 'l7 zz', 'l8 zz a', 'l9 zz b']) == ['l1 xx', 'l2 xx', 'l3 xx a', 'l4 xx b', 'l5 yy', 'l6 yy z', 'l7 zz', 'l8 zz a', 'l9 zz b', 'd1 2 3', 'd2 4 5', 'd3 1 2']\n assert candidate(logs = ['c1 f k g', 'c2 m g p', 'c3 t e x', 'd1 1 2 3', 'd2 5 6 7', 'c4 g m t', 'c5 a b c', 'd3 9 0 1', 'c6 m g p', 'd4 5 6 7 8 9', 'c7 x y z', 'c8 q w e', 'd5 0 0 0 0', 'c9 t e x', 'd6 1 2 3 4 5', 'c10 a b c', 'd7 5 6 7 8', 'c11 m g p', 'c12 x y z', 'd8 9 0 1 2']) == ['c10 a b c', 'c5 a b c', 'c1 f k g', 'c4 g m t', 'c11 m g p', 'c2 m g p', 'c6 m g p', 'c8 q w e', 'c3 t e x', 'c9 t e x', 'c12 x y z', 'c7 x y z', 'd1 1 2 3', 'd2 5 6 7', 'd3 9 0 1', 'd4 5 6 7 8 9', 'd5 0 0 0 0', 'd6 1 2 3 4 5', 'd7 5 6 7 8', 'd8 9 0 1 2']\n assert candidate(logs = ['c1 hi ho ha', 'd1 0 0 0', 'c2 ab', 'd2 1', 'c3 cd ef', 'c4 gh', 'd3 2 2 2 2', 'c5 ij kl', 'c6 mn', 'd4 3', 'c7 op', 'd5 4 4 4 4 4 4', 'c8 qr st', 'd6 5 5', 'c9 uv', 'd7 6 6 6 6 6 6 6', 'd8 7 7 7 7 7 7 7 7 7', 'd9 8 8 8 8 8 8 8 8 8 8', 'd10 9 9 9 9 9 9 9 9 9 9 9 9 9 9', 'c10 wx yz', 'c11 za', 'c12 zb', 'c13 zc', 'c14 zd']) == ['c2 ab', 'c3 cd ef', 'c4 gh', 'c1 hi ho ha', 'c5 ij kl', 'c6 mn', 'c7 op', 'c8 qr st', 'c9 uv', 'c10 wx yz', 'c11 za', 'c12 zb', 'c13 zc', 'c14 zd', 'd1 0 0 0', 'd2 1', 'd3 2 2 2 2', 'd4 3', 'd5 4 4 4 4 4 4', 'd6 5 5', 'd7 6 6 6 6 6 6 6', 'd8 7 7 7 7 7 7 7 7 7', 'd9 8 8 8 8 8 8 8 8 8 8', 'd10 9 9 9 9 9 9 9 9 9 9 9 9 9 9']\n assert candidate(logs = ['m1 5 5 5', 'm2 4 4 4', 'm3 3 3 3', 'm4 2 2 2', 'm5 1 1 1', 'n1 one two', 'n2 one two', 'n3 one two', 'n4 one two', 'n5 one two', 'o1 three four', 'o2 three four', 'o3 three four', 'o4 three four', 'o5 three four', 'p1 five six', 'p2 five six', 'p3 five six', 'p4 five six', 'p5 five six']) == ['p1 five six', 'p2 five six', 'p3 five six', 'p4 five six', 'p5 five six', 'n1 one two', 'n2 one two', 'n3 one two', 'n4 one two', 'n5 one two', 'o1 three four', 'o2 three four', 'o3 three four', 'o4 three four', 'o5 three four', 'm1 5 5 5', 'm2 4 4 4', 'm3 3 3 3', 'm4 2 2 2', 'm5 1 1 1']\n assert candidate(logs = ['alpha 123', 'beta 456', 'gamma 789', 'delta 101112', 'epsilon 131415', 'zeta 161718', 'eta 192021', 'theta 222324', 'iota 252627', 'kappa 282930', 'lambda 313233', 'mu 343536', 'nu 373839', 'xi 404142', 'omicron 434445', 'pi 464748', 'rho 495051', 'sigma 525354', 'tau 555657', 'upsilon 585960', 'phi 616263', 'chi 646566', 'psi 676869', 'omega 707172', 'digA 1 2 3', 'digB 4 5 6', 'digC 7 8 9', 'digD 10 11 12', 'digE 13 14 15']) == ['alpha 123', 'beta 456', 'gamma 789', 'delta 101112', 'epsilon 131415', 'zeta 161718', 'eta 192021', 'theta 222324', 'iota 252627', 'kappa 282930', 'lambda 313233', 'mu 343536', 'nu 373839', 'xi 404142', 'omicron 434445', 'pi 464748', 'rho 495051', 'sigma 525354', 'tau 555657', 'upsilon 585960', 'phi 616263', 'chi 646566', 'psi 676869', 'omega 707172', 'digA 1 2 3', 'digB 4 5 6', 'digC 7 8 9', 'digD 10 11 12', 'digE 13 14 15']\n assert candidate(logs = ['log1 abc def', 'log2 def abc', 'log3 ghi', 'log4 123 456', 'log5 789', 'log6 ghi jkl', 'log7 111 222', 'log8 abc def', 'log9 def abc', 'log10 ghi jkl']) == ['log1 abc def', 'log8 abc def', 'log2 def abc', 'log9 def abc', 'log3 ghi', 'log10 ghi jkl', 'log6 ghi jkl', 'log4 123 456', 'log5 789', 'log7 111 222']\n assert candidate(logs = ['d1 5 6 7', 'c1 abc def', 'd2 4 3 2', 'c2 abc def ghi', 'd3 1 2 3', 'c3 abc def', 'c4 xyz']) == ['c1 abc def', 'c3 abc def', 'c2 abc def ghi', 'c4 xyz', 'd1 5 6 7', 'd2 4 3 2', 'd3 1 2 3']\n assert candidate(logs = ['log1 one two three', 'log2 abc def', 'log3 123 456', 'log4 ghi jkl', 'log5 mno pqr', 'log6 stu vwx', 'log7 yza abc', 'log8 def ghi', 'log9 jkl mno', 'log10 pqr stu', 'log11 vwx yza', 'log12 abc def', 'log13 ghi jkl', 'log14 mno pqr', 'log15 stu vwx', 'log16 yza abc', 'log17 def ghi', 'log18 jkl mno', 'log19 pqr stu', 'log20 vwx yza', 'log21 456 789', 'log22 123 456', 'log23 789 012', 'log24 321 654', 'log25 654 321', 'log26 012 987']) == ['log12 abc def', 'log2 abc def', 'log17 def ghi', 'log8 def ghi', 'log13 ghi jkl', 'log4 ghi jkl', 'log18 jkl mno', 'log9 jkl mno', 'log14 mno pqr', 'log5 mno pqr', 'log1 one two three', 'log10 pqr stu', 'log19 pqr stu', 'log15 stu vwx', 'log6 stu vwx', 'log11 vwx yza', 'log20 vwx yza', 'log16 yza abc', 'log7 yza abc', 'log3 123 456', 'log21 456 789', 'log22 123 456', 'log23 789 012', 'log24 321 654', 'log25 654 321', 'log26 012 987']\n assert candidate(logs = ['1 a', '2 b', '3 c', '4 d', '5 e', 'f 1', 'g 2', 'h 3', 'i 4', 'j 5', 'k 6', 'l 7', 'm 8', 'n 9', 'o 10']) == ['1 a', '2 b', '3 c', '4 d', '5 e', 'f 1', 'g 2', 'h 3', 'i 4', 'j 5', 'k 6', 'l 7', 'm 8', 'n 9', 'o 10']\n assert candidate(logs = ['d1 0 0', 'd2 0 0 0', 'l1 aa aa', 'l2 aa ab', 'l3 aa aa aa', 'l4 ab aa', 'l5 aa bb', 'd3 0 0', 'l6 aa aa', 'd4 0 0 0 0 0']) == ['l1 aa aa', 'l6 aa aa', 'l3 aa aa aa', 'l2 aa ab', 'l5 aa bb', 'l4 ab aa', 'd1 0 0', 'd2 0 0 0', 'd3 0 0', 'd4 0 0 0 0 0']\n assert candidate(logs = ['d5 4 5 6', 'd4 3 4 5', 'd3 2 3 4', 'd2 1 2 3', 'd1 0 1 2', 'l1 info log', 'l2 info log', 'l3 info log']) == ['l1 info log', 'l2 info log', 'l3 info log', 'd5 4 5 6', 'd4 3 4 5', 'd3 2 3 4', 'd2 1 2 3', 'd1 0 1 2']\n assert candidate(logs = ['x7 1 1 1', 'x6 2 2 2', 'x5 3 3 3', 'x4 4 4 4', 'x3 5 5 5', 'x2 6 6 6', 'x1 7 7 7', 'y1 debug msg', 'y2 debug msg', 'y3 debug msg', 'y4 debug msg']) == ['y1 debug msg', 'y2 debug msg', 'y3 debug msg', 'y4 debug msg', 'x7 1 1 1', 'x6 2 2 2', 'x5 3 3 3', 'x4 4 4 4', 'x3 5 5 5', 'x2 6 6 6', 'x1 7 7 7']\n assert candidate(logs = ['logA 100', 'logB 99', 'logC 98', 'logD 97', 'logE 96', 'logF 95', 'logG 94', 'logH 93', 'logI 92', 'logJ 91', 'logK 90', 'logL 89', 'logM 88', 'logN 87', 'logO 86', 'logP 85', 'logQ 84', 'logR 83', 'logS 82', 'logT 81', 'logU 80', 'logV 79', 'logW 78', 'logX 77', 'logY 76', 'logZ 75', 'a1 abc', 'b2 def', 'c3 ghi', 'd4 jkl']) == ['a1 abc', 'b2 def', 'c3 ghi', 'd4 jkl', 'logA 100', 'logB 99', 'logC 98', 'logD 97', 'logE 96', 'logF 95', 'logG 94', 'logH 93', 'logI 92', 'logJ 91', 'logK 90', 'logL 89', 'logM 88', 'logN 87', 'logO 86', 'logP 85', 'logQ 84', 'logR 83', 'logS 82', 'logT 81', 'logU 80', 'logV 79', 'logW 78', 'logX 77', 'logY 76', 'logZ 75']\n assert candidate(logs = ['a10 9 2 3 1', 'g1 act car', 'zo4 4 7', 'ab1 off key dog', 'a8 act zoo', 'b1 2 2 2', 'c1 1 1 1', 'd1 0 0 0']) == ['g1 act car', 'a8 act zoo', 'ab1 off key dog', 'a10 9 2 3 1', 'zo4 4 7', 'b1 2 2 2', 'c1 1 1 1', 'd1 0 0 0']\n assert candidate(logs = ['z9 9', 'z8 8', 'z7 7', 'z6 6', 'z5 5', 'z4 4', 'z3 3', 'z2 2', 'z1 1', 'a1 1', 'a2 2', 'a3 3', 'a4 4', 'a5 5', 'a6 6', 'a7 7', 'a8 8', 'a9 9']) == ['z9 9', 'z8 8', 'z7 7', 'z6 6', 'z5 5', 'z4 4', 'z3 3', 'z2 2', 'z1 1', 'a1 1', 'a2 2', 'a3 3', 'a4 4', 'a5 5', 'a6 6', 'a7 7', 'a8 8', 'a9 9']\n assert candidate(logs = ['a1 9 2 3 1', 'z1 9 2 3 1', 'g1 act car', 'zo4 4 7', 'ab1 off key dog', 'a8 act zoo', 'z2 1 2 3 4', 'b1 1 2 3 4']) == ['g1 act car', 'a8 act zoo', 'ab1 off key dog', 'a1 9 2 3 1', 'z1 9 2 3 1', 'zo4 4 7', 'z2 1 2 3 4', 'b1 1 2 3 4']\n assert candidate(logs = ['1a 1 2 3', '1z 9 8 7', '1b 5 6', '2c art car', '2d act zoo', '2e off key dog', '2f art can', '2g 8 1 5 1', '2h own kit dig', '2i art zero', '2j 3 6']) == ['2d act zoo', '2f art can', '2c art car', '2i art zero', '2e off key dog', '2h own kit dig', '1a 1 2 3', '1z 9 8 7', '1b 5 6', '2g 8 1 5 1', '2j 3 6']\n assert candidate(logs = ['log001 error found', 'log002 error found', 'log003 warning check', 'log004 info start', 'log005 info start', 'log006 error found', 'log007 warning check', 'log008 debug init', 'log009 debug init', 'log010 info start', 'log011 warning check', 'log012 debug init', 'log013 info start', 'log014 warning check', 'log015 debug init', 'log016 error found', 'log017 warning check', 'log018 debug init', 'log019 info start', 'log020 warning check', 'log021 debug init', 'log022 error found', 'log023 warning check', 'log024 debug init', 'log025 info start', 'log026 warning check', 'log027 debug init', 'log028 error found', 'log029 warning check', 'log030 debug init']) == ['log008 debug init', 'log009 debug init', 'log012 debug init', 'log015 debug init', 'log018 debug init', 'log021 debug init', 'log024 debug init', 'log027 debug init', 'log030 debug init', 'log001 error found', 'log002 error found', 'log006 error found', 'log016 error found', 'log022 error found', 'log028 error found', 'log004 info start', 'log005 info start', 'log010 info start', 'log013 info start', 'log019 info start', 'log025 info start', 'log003 warning check', 'log007 warning check', 'log011 warning check', 'log014 warning check', 'log017 warning check', 'log020 warning check', 'log023 warning check', 'log026 warning check', 'log029 warning check']\n assert candidate(logs = ['zz1 1', 'aa1 1', 'yy1 1', 'xx1 1', 'bb1 act car', 'cc1 act zoo', 'dd1 off key dog', 'ee1 art can', 'ff1 8 1 5 1', 'gg1 own kit dig', 'hh1 art zero', 'ii1 3 6', 'jj1 act car', 'kk1 act zoo', 'll1 off key dog', 'mm1 art can', 'nn1 8 1 5 1', 'oo1 own kit dig', 'pp1 art zero', 'qq1 3 6', 'rr1 4 5', 'ss1 6 7', 'tt1 8 9']) == ['bb1 act car', 'jj1 act car', 'cc1 act zoo', 'kk1 act zoo', 'ee1 art can', 'mm1 art can', 'hh1 art zero', 'pp1 art zero', 'dd1 off key dog', 'll1 off key dog', 'gg1 own kit dig', 'oo1 own kit dig', 'zz1 1', 'aa1 1', 'yy1 1', 'xx1 1', 'ff1 8 1 5 1', 'ii1 3 6', 'nn1 8 1 5 1', 'qq1 3 6', 'rr1 4 5', 'ss1 6 7', 'tt1 8 9']\n assert candidate(logs = ['x1 zzz', 'x2 yyy', 'x3 zzz', 'x4 yyy', 'x5 zzz', 'x6 yyy', 'x7 zzz', 'x8 yyy', 'x9 zzz', 'x10 yyy', 'd1 1 2', 'd2 3 4', 'd3 5 6', 'd4 7 8', 'd5 9 0']) == ['x10 yyy', 'x2 yyy', 'x4 yyy', 'x6 yyy', 'x8 yyy', 'x1 zzz', 'x3 zzz', 'x5 zzz', 'x7 zzz', 'x9 zzz', 'd1 1 2', 'd2 3 4', 'd3 5 6', 'd4 7 8', 'd5 9 0']\n assert candidate(logs = ['x1 100 200', 'y1 abc def', 'x2 300', 'y2 ghi jkl', 'x3 400 500', 'y3 mno pqr', 'y4 def', 'y5 abc', 'x4 600']) == ['y5 abc', 'y1 abc def', 'y4 def', 'y2 ghi jkl', 'y3 mno pqr', 'x1 100 200', 'x2 300', 'x3 400 500', 'x4 600']\n assert candidate(logs = ['a10 9 2 3 1', 'g1 act car', 'zo4 4 7', 'ab1 off key dog', 'a8 act zoo', 'let1 art can', 'dig1 8 1 5 1', 'let2 own kit dig', 'let3 art zero', 'dig2 3 6']) == ['g1 act car', 'a8 act zoo', 'let1 art can', 'let3 art zero', 'ab1 off key dog', 'let2 own kit dig', 'a10 9 2 3 1', 'zo4 4 7', 'dig1 8 1 5 1', 'dig2 3 6']\n assert candidate(logs = ['log5 10 20', 'log2 three', 'log8 nine', 'log1 two', 'log6 30 40', 'log4 four', 'log3 one', 'log7 eight', 'log9 50 60', 'log0 zero']) == ['log7 eight', 'log4 four', 'log8 nine', 'log3 one', 'log2 three', 'log1 two', 'log0 zero', 'log5 10 20', 'log6 30 40', 'log9 50 60']\n assert candidate(logs = ['a1 9 2 3 1', 'g1 act car', 'zo4 4 7', 'ab1 off key dog', 'a8 act zoo', 'b1 act car', 'b2 act car zoo']) == ['b1 act car', 'g1 act car', 'b2 act car zoo', 'a8 act zoo', 'ab1 off key dog', 'a1 9 2 3 1', 'zo4 4 7']\n assert candidate(logs = ['log12 10 20 30', 'log11 1 2 3', 'log10 9 8 7', 'log9 6 5 4', 'log8 3 2 1']) == ['log12 10 20 30', 'log11 1 2 3', 'log10 9 8 7', 'log9 6 5 4', 'log8 3 2 1']\n assert candidate(logs = ['log1 one two three', 'log2 four five', 'log3 six', 'log4 seven eight nine', 'log5 ten eleven twelve', 'log6 thirteen fourteen fifteen', 'log7 1 2', 'log8 3 4 5', 'log9 6 7 8', 'log10 9 10 11', 'log11 12 13 14']) == ['log2 four five', 'log1 one two three', 'log4 seven eight nine', 'log3 six', 'log5 ten eleven twelve', 'log6 thirteen fourteen fifteen', 'log7 1 2', 'log8 3 4 5', 'log9 6 7 8', 'log10 9 10 11', 'log11 12 13 14']\n assert candidate(logs = ['id1 abc def', 'id2 ghi jkl', 'id3 mno pqr', 'id4 stu vwx', 'id5 123 456', 'id6 789 012', 'id7 abc def', 'id8 ghi jkl', 'id9 mno pqr', 'id10 stu vwx', 'id11 321 654']) == ['id1 abc def', 'id7 abc def', 'id2 ghi jkl', 'id8 ghi jkl', 'id3 mno pqr', 'id9 mno pqr', 'id10 stu vwx', 'id4 stu vwx', 'id5 123 456', 'id6 789 012', 'id11 321 654']\n assert candidate(logs = ['log12 456 789', 'abc 123 def', 'xyz 456', 'ghi 789', 'jkl 101', 'log2 456 789', 'mno 123 456', 'pqr 789 012']) == ['log12 456 789', 'abc 123 def', 'xyz 456', 'ghi 789', 'jkl 101', 'log2 456 789', 'mno 123 456', 'pqr 789 012']\n assert candidate(logs = ['x1 abc def', 'x2 abc', 'x3 def', 'x4 def', 'x5 abc', 'x6 def', 'x7 def', 'x8 abc', 'x9 abc', 'x10 abc', 'y1 1 1 1', 'y2 2 2 2', 'y3 3 3 3', 'y4 4 4 4', 'y5 5 5 5', 'y6 6 6 6', 'y7 7 7 7', 'y8 8 8 8', 'y9 9 9 9', 'y10 10 10 10', 'y11 11 11 11', 'y12 12 12 12', 'y13 13 13 13', 'y14 14 14 14', 'y15 15 15 15', 'y16 16 16 16', 'y17 17 17 17', 'y18 18 18 18', 'y19 19 19 19', 'y20 20 20 20', 'z1 abc', 'z2 def', 'z3 ghi', 'z4 jkl', 'z5 mno', 'z6 pqr', 'z7 stu', 'z8 vwx', 'z9 yza', 'z10 bcde']) == ['x10 abc', 'x2 abc', 'x5 abc', 'x8 abc', 'x9 abc', 'z1 abc', 'x1 abc def', 'z10 bcde', 'x3 def', 'x4 def', 'x6 def', 'x7 def', 'z2 def', 'z3 ghi', 'z4 jkl', 'z5 mno', 'z6 pqr', 'z7 stu', 'z8 vwx', 'z9 yza', 'y1 1 1 1', 'y2 2 2 2', 'y3 3 3 3', 'y4 4 4 4', 'y5 5 5 5', 'y6 6 6 6', 'y7 7 7 7', 'y8 8 8 8', 'y9 9 9 9', 'y10 10 10 10', 'y11 11 11 11', 'y12 12 12 12', 'y13 13 13 13', 'y14 14 14 14', 'y15 15 15 15', 'y16 16 16 16', 'y17 17 17 17', 'y18 18 18 18', 'y19 19 19 19', 'y20 20 20 20']\n assert candidate(logs = ['c1 100 200 300', 'd2 hello world', 'b3 hi there', 'a4 hello world', 'e5 test log']) == ['a4 hello world', 'd2 hello world', 'b3 hi there', 'e5 test log', 'c1 100 200 300']\n assert candidate(logs = ['log01 2021 01 01', 'log02 2021 01 02', 'log03 2021 01 03', 'log04 2021 01 04', 'log05 2021 01 05', 'log06 2021 01 06', 'log07 2021 01 07', 'log08 2021 01 08', 'log09 2021 01 09', 'log10 2021 01 10', 'log11 2021 01 11', 'log12 2021 01 12', 'log13 2021 01 13', 'log14 2021 01 14', 'log15 2021 01 15', 'log16 2021 01 16', 'log17 2021 01 17', 'log18 2021 01 18', 'log19 2021 01 19', 'log20 2021 01 20', 'a1 abc', 'a2 def', 'a3 ghi', 'a4 jkl', 'a5 mno', 'a6 pqr', 'a7 stu', 'a8 vwx', 'a9 yza', 'b1 abc def', 'b2 ghi jkl', 'b3 mno pqr', 'b4 stu vwx', 'b5 yza bcd']) == ['a1 abc', 'b1 abc def', 'a2 def', 'a3 ghi', 'b2 ghi jkl', 'a4 jkl', 'a5 mno', 'b3 mno pqr', 'a6 pqr', 'a7 stu', 'b4 stu vwx', 'a8 vwx', 'a9 yza', 'b5 yza bcd', 'log01 2021 01 01', 'log02 2021 01 02', 'log03 2021 01 03', 'log04 2021 01 04', 'log05 2021 01 05', 'log06 2021 01 06', 'log07 2021 01 07', 'log08 2021 01 08', 'log09 2021 01 09', 'log10 2021 01 10', 'log11 2021 01 11', 'log12 2021 01 12', 'log13 2021 01 13', 'log14 2021 01 14', 'log15 2021 01 15', 'log16 2021 01 16', 'log17 2021 01 17', 'log18 2021 01 18', 'log19 2021 01 19', 'log20 2021 01 20']\n assert candidate(logs = ['id001 abc def', 'id002 ghi', 'id003 1 2', 'id004 jkl', 'id005 abc def', 'id006 mno', 'id007 3 4', 'id008 pqr', 'id009 stu', 'id010 5 6', 'id011 vwx', 'id012 yza', 'id013 abc def']) == ['id001 abc def', 'id005 abc def', 'id013 abc def', 'id002 ghi', 'id004 jkl', 'id006 mno', 'id008 pqr', 'id009 stu', 'id011 vwx', 'id012 yza', 'id003 1 2', 'id007 3 4', 'id010 5 6']\n assert candidate(logs = ['z9 2 3 4', 'b2 run let', 'a1 1 2 3', 'x3 jump high', 'y8 run let']) == ['x3 jump high', 'b2 run let', 'y8 run let', 'z9 2 3 4', 'a1 1 2 3']\n assert candidate(logs = ['z9 1 2', 'a9 1 2', 'y9 1 2', 'x9 1 2', 'b9 act car', 'c9 act zoo', 'd9 off key dog', 'e9 art can', 'f9 8 1 5 1', 'g9 own kit dig', 'h9 art zero', 'i9 3 6', 'j9 act car', 'k9 act zoo', 'l9 off key dog', 'm9 art can', 'n9 8 1 5 1', 'o9 own kit dig', 'p9 art zero', 'q9 3 6']) == ['b9 act car', 'j9 act car', 'c9 act zoo', 'k9 act zoo', 'e9 art can', 'm9 art can', 'h9 art zero', 'p9 art zero', 'd9 off key dog', 'l9 off key dog', 'g9 own kit dig', 'o9 own kit dig', 'z9 1 2', 'a9 1 2', 'y9 1 2', 'x9 1 2', 'f9 8 1 5 1', 'i9 3 6', 'n9 8 1 5 1', 'q9 3 6']\n assert candidate(logs = ['logX abc', 'logY abc', 'logZ abc', 'logW abc', 'logV abc', 'logU abc', 'logT abc', 'logS abc', 'logR abc', 'logQ abc', 'logP abc', 'logO abc', 'logN abc', 'logM abc', 'logL abc', 'logK abc', 'logJ abc', 'logI abc', 'logH abc', 'logG abc', 'logF abc', 'logE abc', 'logD abc', 'logC abc', 'logB abc', 'logA abc', 'digX 1 2 3', 'digY 4 5 6', 'digZ 7 8 9', 'digW 10 11 12', 'digV 13 14 15', 'digU 16 17 18', 'digT 19 20 21', 'digS 22 23 24', 'digR 25 26 27', 'digQ 28 29 30', 'digP 31 32 33', 'digO 34 35 36', 'digN 37 38 39', 'digM 40 41 42', 'digL 43 44 45', 'digK 46 47 48', 'digJ 49 50 51', 'digI 52 53 54', 'digH 55 56 57', 'digG 58 59 60', 'digF 61 62 63', 'digE 64 65 66', 'digD 67 68 69', 'digC 70 71 72', 'digB 73 74 75', 'digA 76 77 78']) == ['logA abc', 'logB abc', 'logC abc', 'logD abc', 'logE abc', 'logF abc', 'logG abc', 'logH abc', 'logI abc', 'logJ abc', 'logK abc', 'logL abc', 'logM abc', 'logN abc', 'logO abc', 'logP abc', 'logQ abc', 'logR abc', 'logS abc', 'logT abc', 'logU abc', 'logV abc', 'logW abc', 'logX abc', 'logY abc', 'logZ abc', 'digX 1 2 3', 'digY 4 5 6', 'digZ 7 8 9', 'digW 10 11 12', 'digV 13 14 15', 'digU 16 17 18', 'digT 19 20 21', 'digS 22 23 24', 'digR 25 26 27', 'digQ 28 29 30', 'digP 31 32 33', 'digO 34 35 36', 'digN 37 38 39', 'digM 40 41 42', 'digL 43 44 45', 'digK 46 47 48', 'digJ 49 50 51', 'digI 52 53 54', 'digH 55 56 57', 'digG 58 59 60', 'digF 61 62 63', 'digE 64 65 66', 'digD 67 68 69', 'digC 70 71 72', 'digB 73 74 75', 'digA 76 77 78']\n assert candidate(logs = ['alpha 1 2 3', 'beta 3 2 1', 'gamma 1 1 1', 'delta 4 4 4', 'epsilon 2 2 2', 'zeta 3 3 3', 'eta 1 2 1', 'theta 1 1 2', 'iota 2 1 1', 'kappa 2 1 2']) == ['alpha 1 2 3', 'beta 3 2 1', 'gamma 1 1 1', 'delta 4 4 4', 'epsilon 2 2 2', 'zeta 3 3 3', 'eta 1 2 1', 'theta 1 1 2', 'iota 2 1 1', 'kappa 2 1 2']\n assert candidate(logs = ['d1 1 2', 'l1 act car toy', 'd2 2 3', 'l2 art car toy', 'l3 act zoo', 'd3 3 4', 'l4 zoo act', 'd4 4 5', 'l5 art zoo car']) == ['l1 act car toy', 'l3 act zoo', 'l2 art car toy', 'l5 art zoo car', 'l4 zoo act', 'd1 1 2', 'd2 2 3', 'd3 3 4', 'd4 4 5']\n assert candidate(logs = ['x1 5 7 9', 'y1 abc def', 'x2 3 6 8', 'y2 def abc', 'x3 1 4 7', 'y3 abc def', 'x4 2 5 8', 'y4 def abc', 'y5 abc def', 'x5 6 9 10']) == ['y1 abc def', 'y3 abc def', 'y5 abc def', 'y2 def abc', 'y4 def abc', 'x1 5 7 9', 'x2 3 6 8', 'x3 1 4 7', 'x4 2 5 8', 'x5 6 9 10']\n assert candidate(logs = ['d1 2 3', 'l1 one two three', 'l2 one two', 'l3 one', 'd2 4 5 6', 'l4 two three four', 'd3 7 8 9 10', 'l5 one two three four five']) == ['l3 one', 'l2 one two', 'l1 one two three', 'l5 one two three four five', 'l4 two three four', 'd1 2 3', 'd2 4 5 6', 'd3 7 8 9 10']\n assert candidate(logs = ['x1 1 2 3', 'x2 3 4 5', 'x3 5 6 7', 'x4 7 8 9', 'y1 a b c', 'y2 d e f', 'y3 g h i', 'y4 j k l', 'y5 m n o', 'y6 p q r', 'y7 s t u', 'y8 v w x', 'y9 y z', 'z1 0 0 0']) == ['y1 a b c', 'y2 d e f', 'y3 g h i', 'y4 j k l', 'y5 m n o', 'y6 p q r', 'y7 s t u', 'y8 v w x', 'y9 y z', 'x1 1 2 3', 'x2 3 4 5', 'x3 5 6 7', 'x4 7 8 9', 'z1 0 0 0']\n assert candidate(logs = ['logA 987', 'logB 654', 'logC 321', 'logD 000', 'logE def', 'logF ghi', 'logG jkl', 'logH mno', 'logI pqr', 'logJ stu', 'logK vwx', 'logL yza', 'logM abc', 'logN def', 'logO ghi', 'logP jkl', 'logQ mno', 'logR pqr', 'logS stu', 'logT vwx', 'logU yza', 'logV abc', 'logW def', 'logX ghi', 'logY jkl', 'logZ mno']) == ['logM abc', 'logV abc', 'logE def', 'logN def', 'logW def', 'logF ghi', 'logO ghi', 'logX ghi', 'logG jkl', 'logP jkl', 'logY jkl', 'logH mno', 'logQ mno', 'logZ mno', 'logI pqr', 'logR pqr', 'logJ stu', 'logS stu', 'logK vwx', 'logT vwx', 'logL yza', 'logU yza', 'logA 987', 'logB 654', 'logC 321', 'logD 000']\n"}, "metadata": {"canonical_parameter_names": ["logs"], "leetcode_dataset_entry_point": "Solution().reorderLogFiles", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var reorderLogFiles = function(logs) {", "container": null, "callable": "reorderLogFiles", "parameters": [{"name": "logs", "type": "string[]"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 938, "task_id": "range-sum-of-bst", "difficulty": "Easy", "problem_description": "Given the root node of a binary search tree and two integers low and high, return the sum of values of all nodes with a value in the inclusive range [low, high].\n \nExample 1:\n\n\nInput: root = [10,5,15,3,7,null,18], low = 7, high = 15\nOutput: 32\nExplanation: Nodes 7, 10, and 15 are in the range [7, 15]. 7 + 10 + 15 = 32.\n\nExample 2:\n\n\nInput: root = [10,5,15,3,7,13,18,1,null,6], low = 6, high = 10\nOutput: 23\nExplanation: Nodes 6, 7, and 10 are in the range [6, 10]. 6 + 7 + 10 = 23.\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 2 * 104].\n1 <= Node.val <= 105\n1 <= low <= high <= 105\nAll Node.val are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6]),low = 6,high = 10) == 23\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),low = 7,high = 15) == 32\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 12, 17, 23, 27, 32, 38]),low = 10,high = 30) == 179\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, 7, 13, 17, 22, 27, 32, 37]),low = 10,high = 27) == 149\n assert candidate(root = tree_node([50, 30, 80, 15, 40, 60, 90, 10, 20, 35, 45, 55, 65, 85, 95]),low = 1,high = 100) == 775\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 40, 60, 90, 110, 140, 160, 190, 5, 15, 30, 45, 55, 65, 85, 95, 105, 115, 135, 145, 155, 165, 185, 195, 1, 9, 13, 18, 22, 35, 42, 48, 52, 58, 63, 67, 72, 78, 82, 88, 92, 98, 102, 108, 112, 118, 122, 128, 132, 138, 142, 148, 152, 158, 162, 168, 172, 178, 182, 188, 192, 198]),low = 40,high = 160) == 3900\n assert candidate(root = tree_node([50, 30, 80, 15, 40, 60, 90, 10, 20, 35, 45, 55, 65, 85, 95]),low = 50,high = 90) == 485\n assert candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 10, None, None, 45, 55, 65, 75, None]),low = 30,high = 70) == 415\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 18, 22, 28, 32, 40]),low = 10,high = 30) == 180\n assert candidate(root = tree_node([50, 30, 80, 15, 40, 60, 90, 10, 20, 35, 45, 55, 65, 85, 95]),low = 100,high = 200) == 0\n assert candidate(root = tree_node([2, 1, 3, None, None, None, 4]),low = 3,high = 4) == 7\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 35, 50, 5, 12, 18, 25, 32, 40, 48, 55]),low = 10,high = 50) == 380\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 35, 60, 80, 110, 130, 160, 180]),low = 60,high = 140) == 680\n assert candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15]),low = 2,high = 13) == 90\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 85, 110, 140, 160, 180]),low = 30,high = 140) == 775\n assert candidate(root = tree_node([50, 25, 75, 10, 35, 60, 80, 5, 15, 30, 40, 55, 65, 70, 85]),low = 20,high = 70) == 360\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),low = 4,high = 12) == 7\n assert candidate(root = tree_node([25, 15, 30, 10, 20, 28, 35, 5, 12, 17, 22, 27, 32, 38, 1, 7, 11, 14, 16, 19, 21, 24, 26, 29, 31, 33, 37, 39]),low = 15,high = 25) == 163\n assert candidate(root = tree_node([5, 3, 7, 2, 4, 6, 8, None, None, None, None, None, None, None, None]),low = 2,high = 8) == 35\n assert candidate(root = tree_node([15, 14, 16, 13, 15, 15, 17, 12, 14, 14, 15, 16, 16, 17, 18]),low = 13,high = 17) == 197\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 190]),low = 50,high = 150) == 900\n assert candidate(root = tree_node([75, 50, 100, 25, 60, 80, 125, 10, 30, 55, 65, 70, 85, 105, 150, 5, 15, 20, 28, 40, 57, 63, 68, 72, 82, 88, 102, 110, 130, 140, 160, 175, 3, 8, 12, 18, 22, 27, 32, 42, 51, 59, 62, 66, 71, 74, 76, 81, 87, 90, 95, 101, 108, 112, 115, 120, 127, 132, 135, 138, 142, 145, 148, 152, 155, 158, 162, 165, 168, 170, 178, 182, 185, 188, 190, 192, 195, 198, 200]),low = 60,high = 130) == 2803\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 15, 35, 65, 85, 115, 135, 165, 185, 10, 20, 40, 55, 70, 80, 90, 110, 120, 130, 140, 150, 160, 170, 180, 190]),low = 50,high = 150) == 1790\n assert candidate(root = tree_node([40, 20, 60, 10, 30, 50, 70, 5, 15, 25, 35, 45, 55, 65, 75]),low = 25,high = 65) == 405\n assert candidate(root = tree_node([15, 9, 25, 7, 12, 22, 30, 5, 8, 11, 13, 20, 24, 27, 33]),low = 12,high = 24) == 106\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 17, 22, 28, 32, 38]),low = 15,high = 35) == 224\n assert candidate(root = tree_node([2, 1, 3]),low = 1,high = 3) == 6\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),low = 5,high = 10) == 7\n assert candidate(root = tree_node([50, 30, 70, 10, 40, 60, 80, 5, 15, 35, 45, 55, 65, 75, 85]),low = 20,high = 70) == 450\n assert candidate(root = tree_node([20, 15, 25, 10, 18, 22, 30, 5, 12, 16, 19, 21, 24, 28, 35]),low = 15,high = 25) == 180\n assert candidate(root = tree_node([200, 100, 300, 50, 250, 350, 450, 25, 75, 150, 225, 275, 325, 375, 425, 475]),low = 75,high = 325) == 1575\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 18, 25, 35, 45, 48, 55]),low = 20,high = 45) == 240\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6, 8, None, None, 11, 14]),low = 3,high = 14) == 52\n assert candidate(root = tree_node([1, 0, 2]),low = 1,high = 3) == 3\n assert candidate(root = tree_node([60, 30, 90, 20, 40, 70, 100, 10, 25, 35, 50, 65, 85, 95, 110]),low = 50,high = 90) == 420\n assert candidate(root = tree_node([80, 40, 120, 20, 60, 100, 140, 10, 30, 50, 70, 90, 110, 130, 150]),low = 50,high = 110) == 560\n assert candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13]),low = 5,high = 13) == 44\n assert candidate(root = tree_node([15, 10, 20, 5, 12, 18, 25, 3, 7, 11, 14, 16, 19, 22, 28]),low = 10,high = 20) == 135\n assert candidate(root = tree_node([10, 15, 3, 7, None, 18]),low = 7,high = 15) == 32\n assert candidate(root = tree_node([1, 0, 2, None, 3, None, None]),low = 1,high = 2) == 3\n assert candidate(root = tree_node([50, 25, 75, 10, 35, 60, 90, 5, 15, 30, 40, 55, 65, 80, 95]),low = 20,high = 80) == 515\n assert candidate(root = tree_node([50, 30, 80, 15, 40, 60, 90, 10, 20, 35, 45, 55, 65, 85, 95]),low = 55,high = 85) == 345\n assert candidate(root = tree_node([5, 3, 8, 2, 4, 6, 9, 1, None, None, None, None, None, None, 10]),low = 3,high = 8) == 26\n assert candidate(root = tree_node([50, 25, 75, 12, 37, 62, 87, 6, 20, 30, 45, 55, 68, 80, 93, 3, 9, 15, 22, 28, 35, 40, 50, 60, 65, 70, 78, 85, 90, 96, 4, 8, 11, 13, 18, 24, 26, 29, 32, 34, 36, 39, 42, 48, 52, 58, 63, 67, 72, 75, 77, 82, 88, 91, 94, 98, 1, 5, 7, 10, 14, 17, 19, 21, 23, 25, 27, 31, 33, 38, 41, 43, 47, 51, 53, 57, 61, 64, 66, 69, 71, 73, 74, 76, 79, 81, 83, 86, 89, 92, 95, 97, 99]),low = 20,high = 60) == 924\n assert candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 15, 25, 35, 45, 55, 65, 75, 85]),low = 35,high = 65) == 350\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 35, 60, 85, 110, 140, 160, 180]),low = 40,high = 140) == 745\n assert candidate(root = tree_node([40, 20, 60, 10, 30, 50, 70, 5, 15, 25, 35, 45, 55, 65, 75]),low = 10,high = 80) == 595\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 35, 50, 5, 12, 17, 22, 32, 38, 40, 55, None, None, None, None, None, None, 9, None, 14, None, None, 16, None, None, None, None, 31, None, None, 37, None, None, 39, None, None, None, 53, None, None, None, 58]),low = 25,high = 40) == 172\n assert candidate(root = tree_node([8, 3, 10, None, 1, 6, None, 4, 7, 13, None, None, 14]),low = 2,high = 15) == 47\n assert candidate(root = tree_node([20, 15, 25, 10, 17, 22, 30, 5, 12, None, None, 18, 23, None, None, None, None, 2, 11]),low = 10,high = 23) == 148\n assert candidate(root = tree_node([9, 4, 17, 3, 6, 15, 22, None, None, None, 8, None, 16, None, None, 20]),low = 5,high = 16) == 54\n assert candidate(root = tree_node([50, 30, 80, 15, 40, 60, 90, 10, 20, 35, 45, 55, 65, 85, 95]),low = 45,high = 65) == 275\n assert candidate(root = tree_node([1, 3, 2]),low = 1,high = 3) == 3\n assert candidate(root = tree_node([30, 20, 40, 15, 25, 35, 45, 10, 18, 23, 27, 33, 37, 42, 47]),low = 25,high = 35) == 150\n assert candidate(root = tree_node([10, 5, None, 3, 7, 6, None]),low = 5,high = 10) == 22\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 17, 22, 35, 43, 48, 55, 2, 7, 11, 14, 16, 18, 21, 23, 32, 37, 41, 44, 47, 49, 52, 53, 57, 58, 60]),low = 15,high = 50) == 693\n assert candidate(root = tree_node([20, 15, 25, 10, 18, 22, 30, 5, 12, None, 16, None, None, 19, None]),low = 15,high = 25) == 116\n assert candidate(root = tree_node([50, 30, 80, 15, 40, 60, 90, 10, 20, 35, 45, 55, 65, 85, 95]),low = 15,high = 40) == 140\n assert candidate(root = tree_node([4, 2, 9, 1, 3, 8, 10, None, None, None, None, 5, 7]),low = 3,high = 8) == 20\n assert candidate(root = tree_node([50, 25, 75, 10, 30, 60, 90, 5, 15, 27, 35, 55, 65, 85, 100]),low = 20,high = 70) == 347\n assert candidate(root = tree_node([50, 30, 80, 15, 40, 60, 90, 10, 20, 35, 45, 55, 65, 85, 95]),low = 35,high = 80) == 430\n assert candidate(root = tree_node([70, 35, 105, 15, 55, 85, 120, 10, 25, 45, 65, 75, 95, 110, 130, 8, 12, 22, 40, 50, 60, 72, 78, 88, 92, 108, 115, 125, 135]),low = 20,high = 115) == 1490\n assert candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, 12, 18, 23, 28, 33, 38, 45]),low = 12,high = 38) == 277\n assert candidate(root = tree_node([1, 0, 2, 3, None, None, None, None, 4]),low = 0,high = 3) == 3\n assert candidate(root = tree_node([50, 30, 80, 15, 40, 60, 90, 10, 20, 35, 45, 55, 65, 85, 95]),low = 5,high = 50) == 245\n assert candidate(root = tree_node([50, 30, 80, 15, 40, 60, 90, 10, 20, 35, 45, 55, 65, 85, 95]),low = 10,high = 95) == 775\n assert candidate(root = tree_node([50, 30, 80, 15, 40, 60, 90, 10, 20, 35, 45, 55, 65, 85, 95]),low = 30,high = 60) == 315\n assert candidate(root = tree_node([15, 9, 20, 7, 13, 18, 23, 5, 8, 11, 14, 17, 21, 22, 24]),low = 10,high = 20) == 108\n assert candidate(root = tree_node([50, 20, 70, 10, 30, 60, 80, 5, 15, 25, 35, 55, 65, 75, 85, 2, 8, None, None, None, 18, None, None, 28, None, 32, 38, None, None, None, None, 52, 58, None, None, None, 62, 68, None, None, None, 72, 78, None, None, None, 82, None, 88]),low = 15,high = 65) == 495\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 18, 25, 35, 43, 48, 55]),low = 15,high = 50) == 369\n assert candidate(root = tree_node([500, 250, 750, 125, 375, 625, 875, 63, 188, 313, 438, 563, 688, 813, 938, 42, 94]),low = 125,high = 750) == 4815\n assert candidate(root = tree_node([1]),low = 1,high = 1) == 1\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 130, 160, 180]),low = 30,high = 160) == 1070\n assert candidate(root = tree_node([3, 1, 4, None, 2]),low = 1,high = 3) == 6\n assert candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13]),low = 6,high = 10) == 31\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 18, 25, 35, 48, None, None, None, None, None, None, None, None, None, None]),low = 12,high = 40) == 195\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 18, 25, 35, 48, 3, 7, 11, 16, 23, 28, 37, 42, 47, 49]),low = 10,high = 45) == 380\n assert candidate(root = tree_node([75, 50, 100, 25, 60, 80, 120, 10, 35, 55, 65, 78, 90, 110, 130]),low = 40,high = 100) == 653\n assert candidate(root = tree_node([7, 3, 15, None, None, 9, 20]),low = 1,high = 20) == 54\n assert candidate(root = tree_node([50, 25, 75, 10, 35, 60, 90, 5, 15, 30, 40, 55, 65, 80, 95]),low = 25,high = 75) == 435\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 40, 60, 90, 110, 140, 160, 180]),low = 40,high = 140) == 790\n"}, "metadata": {"canonical_parameter_names": ["root", "low", "high"], "leetcode_dataset_entry_point": "Solution().rangeSumBST", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var rangeSumBST = function(root, low, high) {", "container": null, "callable": "rangeSumBST", "parameters": [{"name": "root", "type": "TreeNode"}, {"name": "low", "type": "number"}, {"name": "high", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 939, "task_id": "minimum-area-rectangle", "difficulty": "Medium", "problem_description": "You are given an array of points in the X-Y plane points where points[i] = [xi, yi].\nReturn the minimum area of a rectangle formed from these points, with sides parallel to the X and Y axes. If there is not any such rectangle, return 0.\n \nExample 1:\n\n\nInput: points = [[1,1],[1,3],[3,1],[3,3],[2,2]]\nOutput: 4\n\nExample 2:\n\n\nInput: points = [[1,1],[1,3],[3,1],[3,3],[4,1],[4,3]]\nOutput: 2\n\n \nConstraints:\n\n1 <= points.length <= 500\npoints[i].length == 2\n0 <= xi, yi <= 4 * 104\nAll the given points are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(points = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [2, 3]]) == 1\n assert candidate(points = [[1, 1], [1, 3], [3, 1], [3, 3], [4, 1], [4, 3]]) == 2\n assert candidate(points = [[1, 1], [1, 3], [3, 1], [3, 3], [2, 2]]) == 4\n assert candidate(points = [[0, 0], [0, 2], [2, 2], [2, 0], [1, 1], [1, 0], [0, 1], [2, 1]]) == 1\n assert candidate(points = [[1, 1], [2, 2], [3, 3]]) == 0\n assert candidate(points = [[0, 0], [0, 40000], [40000, 0], [40000, 40000], [20000, 20000], [10000, 10000], [30000, 30000], [5000, 5000], [35000, 35000], [15000, 15000], [25000, 25000], [500, 500], [39500, 39500]]) == 1600000000\n assert candidate(points = [[0, 0], [10, 0], [0, 10], [10, 10], [5, 5], [2, 2], [8, 8], [3, 3], [7, 7]]) == 100\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 0\n assert candidate(points = [[0, 0], [0, 4], [4, 0], [4, 4], [1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]) == 1\n assert candidate(points = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]) == 1\n assert candidate(points = [[1, 1], [1, 4], [4, 1], [4, 4], [2, 2], [3, 3], [5, 5], [6, 6], [7, 7], [8, 8]]) == 9\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [1, 14], [14, 1], [7, 2]]) == 0\n assert candidate(points = [[1, 1], [3, 1], [1, 3], [3, 3], [2, 2], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15], [16, 16], [17, 17], [18, 18], [19, 19], [20, 20]]) == 4\n assert candidate(points = [[0, 0], [0, 20], [20, 0], [20, 20], [5, 5], [5, 15], [15, 5], [15, 15], [10, 10], [10, 15], [15, 10], [5, 10], [10, 5]]) == 25\n assert candidate(points = [[1, 1], [1, 4], [4, 1], [4, 4], [2, 2], [2, 3], [3, 2], [3, 3], [5, 5], [5, 6], [6, 5], [6, 6]]) == 1\n assert candidate(points = [[1, 1], [2, 3], [3, 1], [4, 5], [5, 4], [6, 6], [7, 2], [8, 7], [9, 3], [10, 10]]) == 0\n assert candidate(points = [[0, 0], [0, 2], [0, 4], [2, 0], [2, 2], [2, 4], [4, 0], [4, 2], [4, 4]]) == 4\n assert candidate(points = [[1, 1], [1, 4], [4, 1], [4, 4], [2, 2], [2, 3], [3, 2], [3, 3], [5, 5], [5, 7], [7, 5], [7, 7]]) == 1\n assert candidate(points = [[0, 0], [0, 3], [3, 0], [3, 3], [1, 1], [1, 2], [2, 1], [2, 2], [1, 3], [3, 1]]) == 1\n assert candidate(points = [[1, 2], [1, 5], [2, 1], [2, 6], [3, 3], [3, 8], [4, 4], [4, 9], [5, 5], [5, 10], [6, 6], [6, 11]]) == 0\n assert candidate(points = [[1, 1], [1, 5], [5, 1], [5, 5], [2, 2], [2, 3], [3, 2], [3, 3], [4, 4], [4, 6], [6, 4], [6, 6]]) == 1\n assert candidate(points = [[1, 1], [1, 40], [40, 1], [40, 40], [20, 20], [20, 30], [30, 20], [30, 30], [15, 15], [15, 25], [25, 15], [25, 25]]) == 100\n assert candidate(points = [[0, 0], [0, 2], [2, 0], [2, 2], [1, 1], [1, 2], [2, 1]]) == 1\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15], [16, 16], [17, 17], [18, 18], [19, 19], [20, 20], [21, 21], [22, 22], [23, 23], [24, 24], [25, 25], [26, 26], [27, 27], [28, 28], [29, 29], [30, 30], [31, 31], [32, 32], [33, 33], [34, 34], [35, 35], [36, 36], [37, 37], [38, 38], [39, 39], [40, 40]]) == 0\n assert candidate(points = [[5, 5], [5, 10], [10, 5], [10, 10], [15, 15], [15, 20], [20, 15], [20, 20], [25, 25], [25, 30], [30, 25], [30, 30]]) == 25\n assert candidate(points = [[1, 1], [1, 10], [10, 1], [10, 10], [5, 5], [2, 2], [2, 8], [8, 2], [8, 8], [3, 3], [3, 6], [6, 3], [6, 6]]) == 9\n assert candidate(points = [[1, 2], [2, 1], [3, 4], [4, 3], [1, 4], [4, 1], [2, 3], [3, 2], [5, 5], [5, 0], [0, 5]]) == 4\n assert candidate(points = [[0, 0], [0, 2], [1, 1], [1, 3], [2, 2], [2, 4], [3, 0], [3, 2], [3, 4], [4, 1], [4, 3]]) == 2\n assert candidate(points = [[1, 1], [1, 5], [5, 1], [5, 5], [3, 3], [3, 4], [4, 3], [4, 4], [2, 2], [2, 6], [6, 2], [6, 6], [7, 7], [8, 8], [9, 9], [1, 9], [9, 1], [1, 7], [7, 1], [1, 8], [8, 1]]) == 1\n assert candidate(points = [[1, 1], [1, 2], [1, 3], [1, 4], [2, 1], [2, 2], [2, 3], [2, 4], [3, 1], [3, 2], [3, 3], [3, 4], [4, 1], [4, 2], [4, 3], [4, 4]]) == 1\n assert candidate(points = [[0, 0], [0, 3], [3, 0], [3, 3], [1, 1], [1, 2], [2, 1], [2, 2], [4, 4], [4, 5], [5, 4], [5, 5]]) == 1\n assert candidate(points = [[0, 0], [0, 5], [5, 0], [5, 5], [1, 2], [1, 3], [4, 2], [4, 3], [2, 1], [2, 4], [3, 1], [3, 4]]) == 3\n assert candidate(points = [[1, 1], [1, 10], [10, 1], [10, 10], [2, 2], [2, 9], [9, 2], [9, 9], [3, 3], [3, 8], [8, 3], [8, 8], [4, 4], [4, 7], [7, 4], [7, 7], [5, 5], [5, 6], [6, 5], [6, 6], [1, 6], [6, 1], [2, 5], [5, 2], [3, 4], [4, 3], [5, 4], [4, 5]]) == 1\n assert candidate(points = [[0, 0], [0, 10000], [10000, 0], [10000, 10000], [5000, 5000], [5000, 6000], [6000, 5000], [6000, 6000]]) == 1000000\n assert candidate(points = [[0, 0], [0, 2], [2, 0], [2, 2], [1, 1], [3, 3], [4, 4], [1, 4], [4, 1]]) == 4\n assert candidate(points = [[0, 0], [40000, 40000], [20000, 20000], [10000, 10000], [30000, 30000], [5000, 5000], [25000, 25000], [15000, 15000], [35000, 35000]]) == 0\n assert candidate(points = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [0, 2], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [0, 3], [1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [0, 4], [1, 4], [2, 4], [3, 4], [4, 4], [5, 4], [0, 5], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5]]) == 1\n assert candidate(points = [[1, 1], [1, 4], [1, 7], [4, 1], [4, 4], [4, 7], [7, 1], [7, 4], [7, 7], [10, 10], [11, 11]]) == 9\n assert candidate(points = [[10, 10], [10, 15], [15, 10], [15, 15], [20, 20], [20, 25], [25, 20], [25, 25], [5, 5], [5, 10], [10, 5], [10, 10]]) == 0\n assert candidate(points = [[1, 1], [1, 5], [5, 1], [5, 5], [2, 2], [2, 3], [3, 2], [3, 3], [4, 4]]) == 1\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15]]) == 0\n assert candidate(points = [[1, 2], [2, 1], [1, 3], [3, 1], [2, 2], [3, 2], [2, 3], [3, 3]]) == 1\n assert candidate(points = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 3], [3, 4], [4, 3], [4, 4], [5, 5], [5, 6], [6, 5], [6, 6]]) == 1\n assert candidate(points = [[10000, 10000], [10000, 20000], [20000, 10000], [20000, 20000], [15000, 15000], [5000, 5000], [25000, 25000]]) == 100000000\n assert candidate(points = [[1, 1], [1, 5], [5, 1], [5, 5], [3, 3], [3, 7], [7, 3], [7, 7], [2, 2], [2, 8], [8, 2], [8, 8]]) == 16\n assert candidate(points = [[0, 0], [0, 5], [5, 0], [5, 5], [1, 2], [2, 1], [3, 4], [4, 3]]) == 25\n assert candidate(points = [[0, 0], [5, 0], [0, 5], [5, 5], [2, 2], [3, 3], [4, 4], [7, 7], [8, 8], [9, 9], [10, 10]]) == 25\n assert candidate(points = [[1, 1], [2, 1], [3, 1], [1, 2], [2, 2], [3, 2], [1, 3], [2, 3], [3, 3], [4, 4], [5, 4], [6, 4], [4, 5], [5, 5], [6, 5], [4, 6], [5, 6], [6, 6]]) == 1\n assert candidate(points = [[1, 1], [1, 4], [2, 1], [2, 4], [3, 1], [3, 4], [4, 1], [4, 4], [5, 1], [5, 4]]) == 3\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [1, 0], [0, 1], [2, 1], [1, 2], [3, 2], [2, 3], [4, 3], [3, 4], [5, 4], [4, 5]]) == 1\n assert candidate(points = [[1000, 2000], [2000, 3000], [1000, 3000], [2000, 2000], [1500, 2500], [1500, 2000], [1000, 2500], [2000, 2500], [1500, 3000]]) == 250000\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11]]) == 0\n assert candidate(points = [[1, 1], [1, 7], [1, 13], [7, 1], [7, 7], [7, 13], [13, 1], [13, 7], [13, 13], [3, 3], [3, 6], [6, 3], [6, 6], [9, 9], [9, 12], [12, 9], [12, 12]]) == 9\n assert candidate(points = [[1, 1], [1, 5], [5, 1], [5, 5], [2, 2], [2, 4], [4, 2], [4, 4], [3, 3], [3, 6], [6, 3], [6, 6]]) == 4\n assert candidate(points = [[1, 1], [1, 5], [1, 9], [5, 1], [5, 5], [5, 9], [9, 1], [9, 5], [9, 9], [2, 2], [2, 8], [8, 2], [8, 8], [4, 4], [4, 8], [8, 4]]) == 16\n assert candidate(points = [[0, 0], [0, 2], [2, 0], [2, 2], [4, 0], [4, 2], [6, 0], [6, 2], [8, 0], [8, 2]]) == 4\n assert candidate(points = [[0, 0], [0, 50], [50, 0], [50, 50], [25, 25], [25, 35], [35, 25], [35, 35], [10, 10], [10, 40], [40, 10], [40, 40]]) == 100\n assert candidate(points = [[1, 1], [2, 1], [1, 2], [2, 2], [3, 1], [4, 1], [3, 2], [4, 2], [1, 3], [2, 3], [3, 3], [4, 3], [1, 4], [2, 4], [3, 4], [4, 4], [5, 5]]) == 1\n assert candidate(points = [[0, 0], [0, 2], [2, 0], [2, 2], [1, 1], [1, 3], [3, 1], [3, 3], [4, 4], [5, 5]]) == 4\n assert candidate(points = [[0, 0], [0, 5], [5, 0], [5, 5], [2, 2], [2, 3], [3, 2], [3, 3]]) == 1\n assert candidate(points = [[0, 0], [0, 15], [15, 0], [15, 15], [5, 5], [5, 10], [10, 5], [10, 10], [3, 3], [3, 12], [12, 3], [12, 12]]) == 25\n assert candidate(points = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [2, 3], [3, 2], [3, 3], [4, 4], [4, 5], [5, 4], [5, 5]]) == 1\n assert candidate(points = [[5, 5], [5, 8], [8, 5], [8, 8], [10, 10], [10, 15], [15, 10], [15, 15], [3, 3], [3, 6], [6, 3], [6, 6]]) == 9\n assert candidate(points = [[1, 1], [2, 1], [3, 1], [4, 1], [1, 2], [2, 2], [3, 2], [4, 2], [1, 3], [2, 3], [3, 3], [4, 3], [1, 4], [2, 4], [3, 4], [4, 4], [1, 5], [2, 5], [3, 5], [4, 5], [1, 6], [2, 6], [3, 6], [4, 6], [1, 7], [2, 7], [3, 7], [4, 7], [1, 8], [2, 8], [3, 8], [4, 8], [1, 9], [2, 9], [3, 9], [4, 9]]) == 1\n assert candidate(points = [[0, 0], [0, 10], [10, 0], [10, 10], [2, 2], [2, 4], [4, 2], [4, 4], [3, 3], [3, 7], [7, 3], [7, 7]]) == 4\n assert candidate(points = [[10, 10], [10, 20], [20, 10], [20, 20], [15, 15], [15, 25], [25, 15], [25, 25], [5, 5], [5, 25], [25, 5], [15, 10], [10, 15]]) == 25\n assert candidate(points = [[1, 1], [1, 25], [25, 1], [25, 25], [10, 10], [10, 15], [15, 10], [15, 15], [8, 8], [8, 17], [17, 8], [17, 17]]) == 25\n assert candidate(points = [[0, 0], [0, 4], [4, 0], [4, 4], [1, 1], [1, 3], [3, 1], [3, 3]]) == 4\n assert candidate(points = [[1, 1], [1, 5], [5, 1], [5, 5], [2, 2], [2, 4], [4, 2], [4, 4], [3, 3]]) == 4\n assert candidate(points = [[1, 1], [1, 20], [20, 1], [20, 20], [5, 5], [5, 15], [15, 5], [15, 15], [7, 7], [7, 13], [13, 7], [13, 13]]) == 36\n assert candidate(points = [[0, 0], [0, 5], [5, 0], [5, 5], [1, 1], [1, 4], [4, 1], [4, 4], [2, 2], [2, 3], [3, 2], [3, 3]]) == 1\n assert candidate(points = [[0, 0], [4, 4], [1, 2], [2, 1], [3, 3], [2, 3], [3, 2]]) == 0\n assert candidate(points = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3], [4, 4], [5, 5]]) == 1\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 0\n assert candidate(points = [[0, 0], [0, 2], [2, 0], [2, 2], [4, 4], [4, 6], [6, 4], [6, 6]]) == 4\n assert candidate(points = [[0, 0], [0, 10], [10, 0], [10, 10], [2, 2], [2, 8], [8, 2], [8, 8], [4, 4], [4, 6], [6, 4], [6, 6], [1, 5], [5, 1], [9, 5], [5, 9]]) == 4\n assert candidate(points = [[0, 0], [10, 0], [10, 10], [0, 10], [2, 2], [8, 2], [2, 8], [8, 8], [5, 5], [3, 7], [7, 3], [4, 6], [6, 4]]) == 36\n assert candidate(points = [[0, 0], [0, 30], [30, 0], [30, 30], [10, 10], [10, 20], [20, 10], [20, 20], [6, 6], [6, 24], [24, 6], [24, 24]]) == 100\n assert candidate(points = [[1, 1], [1, 6], [6, 1], [6, 6], [2, 2], [2, 5], [5, 2], [5, 5], [3, 3], [3, 4], [4, 3], [4, 4], [7, 7], [7, 8], [8, 7], [8, 8]]) == 1\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == 0\n assert candidate(points = [[0, 0], [0, 10000], [10000, 0], [10000, 10000], [5000, 5000], [2500, 2500], [7500, 7500], [1000, 1000], [9000, 9000], [500, 500], [9500, 9500]]) == 100000000\n"}, "metadata": {"canonical_parameter_names": ["points"], "leetcode_dataset_entry_point": "Solution().minAreaRect", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minAreaRect = function(points) {", "container": null, "callable": "minAreaRect", "parameters": [{"name": "points", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 940, "task_id": "distinct-subsequences-ii", "difficulty": "Hard", "problem_description": "Given a string s, return the number of distinct non-empty subsequences of s. Since the answer may be very large, return it modulo 109 + 7.\nA subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., \"ace\" is a subsequence of \"abcde\" while \"aec\" is not.\n \nExample 1:\n\nInput: s = \"abc\"\nOutput: 7\nExplanation: The 7 distinct subsequences are \"a\", \"b\", \"c\", \"ab\", \"ac\", \"bc\", and \"abc\".\n\nExample 2:\n\nInput: s = \"aba\"\nOutput: 6\nExplanation: The 6 distinct subsequences are \"a\", \"b\", \"ab\", \"aa\", \"ba\", and \"aba\".\n\nExample 3:\n\nInput: s = \"aaa\"\nOutput: 3\nExplanation: The 3 distinct subsequences are \"a\", \"aa\" and \"aaa\".\n\n \nConstraints:\n\n1 <= s.length <= 2000\ns consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\") == 67108863\n assert candidate(s = \"abac\") == 13\n assert candidate(s = \"abababababababababab\") == 28655\n assert candidate(s = \"a\") == 1\n assert candidate(s = \"abracadabra\") == 1303\n assert candidate(s = \"zzzz\") == 4\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == 402155530\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcd\") == 552430184\n assert candidate(s = \"aaa\") == 3\n assert candidate(s = \"abcabc\") == 51\n assert candidate(s = \"aabb\") == 8\n assert candidate(s = \"zzzzzzzzzz\") == 10\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == 398\n assert candidate(s = \"abc\") == 7\n assert candidate(s = \"abcdeabcdeabcdeabcde\") == 814295\n assert candidate(s = \"abcd\") == 15\n assert candidate(s = \"aba\") == 6\n assert candidate(s = \"aaaaaaaabbbbbbbbcccccccc\") == 728\n assert candidate(s = \"aabbcc\") == 26\n assert candidate(s = \"mississippi\") == 477\n assert candidate(s = \"abcdabc\") == 115\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == 865810541\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\") == 67108863\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzzzzzzzz\") == 174638632\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == 100\n assert candidate(s = \"abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij\") == 330026179\n assert candidate(s = \"abcdbacdbacdabcdbacdbacdabcdbacdbacdabcdbacdbacdabcdbacdbacdabcdbacdbacdabcdbacdbacdabcdbacdbacd\") == 411786355\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\") == 854978287\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == 254\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == 136\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == 30\n assert candidate(s = \"abacabadabacaba\") == 9426\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == 90\n assert candidate(s = \"thisisalongstringthatwilltestthealgorithmwithvariouscharacters\") == 733715667\n assert candidate(s = \"abacabadabacabadabacabadabacabad\") == 270841387\n assert candidate(s = \"thisisaverylongstringwithrepeatedcharactersandlongsubsequences\") == 484250120\n assert candidate(s = \"longstringthatweneedtogenenatetobemorecomplexandcheckouralgorithmwithaverylongstring\") == 45372177\n assert candidate(s = \"aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd\") == 14640\n assert candidate(s = \"racecar\") == 106\n assert candidate(s = \"aabaaabbbaababaabaaabbbabbaabbabbaababaaabbabaaababbabbaabab\") == 330918185\n assert candidate(s = \"aabbccaaaabbccaaaabbcc\") == 41594\n assert candidate(s = \"xyzxyzxyz\") == 325\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == 723430077\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == 992025290\n assert candidate(s = \"aaaaaaaaaabbbbbbbbccccccccddddddddddeeeeeeeeeffffffffggggggggghhhhhhhhhiiiiiiiiiijjjjjjjjjkkkkkkkkklllllllllmmmmmmmmmnnnnnnnnnooooooooooppppppppppqqqqqqqqqqrrrrrrrrrrssssssssssttttttttttuuuuuuuuuuvvvvvvvvvvwwwwwwwwwxxxxxxxxxyyyyyyyyyyzzzzzzzzzz\") == 627058992\n assert candidate(s = \"aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabb\") == 580349510\n assert candidate(s = \"abababababababababababababababababababababababababababababababababababababababababababababababababab\") == 252403354\n assert candidate(s = \"abcdxyzabcdxyzabcdxyzabcdxyzabcdxyzabcdxyzabcdxyz\") == 843562901\n assert candidate(s = \"ababababababababababababababababababababababababababababababab\") == 680057394\n assert candidate(s = \"repeatedrepeatedrepeatedrepeatedrepeatedrepeatedrepeatedrepeatedrepeatedrepeated\") == 462028482\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == 208\n assert candidate(s = \"abababababababababababababab\") == 1346267\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcd\") == 112454975\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().distinctSubseqII", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var distinctSubseqII = function(s) {", "container": null, "callable": "distinctSubseqII", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 941, "task_id": "valid-mountain-array", "difficulty": "Easy", "problem_description": "Given an array of integers arr, return true if and only if it is a valid mountain array.\nRecall that arr is a mountain array if and only if:\n\narr.length >= 3\nThere exists some i with 0 < i < arr.length - 1 such that:\n\t\narr[0] < arr[1] < ... < arr[i - 1] < arr[i] \narr[i] > arr[i + 1] > ... > arr[arr.length - 1]\n\n\n\n\n \nExample 1:\nInput: arr = [2,1]\nOutput: false\nExample 2:\nInput: arr = [3,5,5]\nOutput: false\nExample 3:\nInput: arr = [0,3,2,1]\nOutput: true\n\n \nConstraints:\n\n1 <= arr.length <= 104\n0 <= arr[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [5, 4, 3, 2, 1]) == False\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == False\n assert candidate(arr = [3, 1, 2]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 2]) == False\n assert candidate(arr = [0, 2, 3, 3, 2, 1]) == False\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [0, 3, 2, 1]) == True\n assert candidate(arr = [0, 1, 2, 1, 2]) == False\n assert candidate(arr = [0, 1, 2, 3, 1]) == True\n assert candidate(arr = [0, 2, 3, 4, 5, 3, 2, 1]) == True\n assert candidate(arr = [1]) == False\n assert candidate(arr = [1, 1, 1, 1, 1]) == False\n assert candidate(arr = [2, 1]) == False\n assert candidate(arr = [0, 1, 2, 3, 1, 0]) == True\n assert candidate(arr = [0, 2, 3, 3, 2, 0]) == False\n assert candidate(arr = [3, 5, 5]) == False\n assert candidate(arr = [1, 2, 3, 4, 5]) == False\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == False\n assert candidate(arr = [1, 3, 2]) == True\n assert candidate(arr = [0, 2, 3, 4, 5, 3, 1]) == True\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1]) == True\n assert candidate(arr = [0, 2, 3, 4, 5]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 3, 2, 1]) == True\n assert candidate(arr = [0, 1, 0]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3]) == True\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 5]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1]) == False\n assert candidate(arr = [1, 2, 2, 1]) == False\n assert candidate(arr = [1, 2, 2, 3, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 3, 5, 7, 9, 8, 6, 4, 2, 0]) == True\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 14, 12, 10, 8, 6, 4, 2, 0]) == True\n assert candidate(arr = [1, 1, 1, 1, 1]) == False\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11]) == True\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 3, 2, 3, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 4, 7, 9, 10, 8, 6, 4, 2]) == True\n assert candidate(arr = [1, 3, 5, 7, 6, 4, 2]) == True\n assert candidate(arr = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [1, 4, 7, 9, 11, 10, 8, 6, 4, 2, 0]) == True\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 0, -1, -2]) == True\n assert candidate(arr = [1, 3, 2, 1, 3, 2, 1]) == False\n assert candidate(arr = [1, 3, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4]) == True\n assert candidate(arr = [8, 9, 10, 10, 9, 8]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20]) == True\n assert candidate(arr = [1, 3, 2, 1, 2, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 2, 3, 4, 5]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [0, 1, 2, 3, 4, 3, 2, 1, 0]) == True\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == True\n assert candidate(arr = [2, 3, 1, 2, 3, 4, 5]) == False\n assert candidate(arr = [1, 3, 5, 4, 3, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 3, 5, 7, 9, 7, 5, 3, 1]) == True\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]) == True\n assert candidate(arr = [1, 2, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0]) == True\n assert candidate(arr = [1, 3, 2, 1, 0, -1, -2, -1, 0, 1, 2, 3, 2, 1, 0]) == False\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100]) == True\n assert candidate(arr = [1, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == True\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 2, 1]) == False\n assert candidate(arr = [1, 5, 4, 3, 2, 1, 0, 2, 3]) == False\n assert candidate(arr = [1, 1, 1, 2, 3, 4, 3, 2, 1, 1, 1]) == False\n assert candidate(arr = [1, 2, 2, 3, 4, 5, 6, 7, 8, 9]) == False\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5]) == False\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0]) == True\n assert candidate(arr = [1, 2, 3, 4, 3, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == True\n assert candidate(arr = [1, 3, 5, 7, 6, 4, 2]) == True\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6]) == True\n assert candidate(arr = [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3]) == True\n assert candidate(arr = [5, 6, 7, 8, 9, 8, 7, 6, 5]) == True\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [10, 20, 30, 40, 50, 45, 40, 35, 30, 25, 20, 15, 10]) == True\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 3, 2, 1, 0]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 10, 8, 6, 4, 2, 0, -2, -4, -6]) == True\n assert candidate(arr = [1, 2, 3, 2, 3, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1]) == False\n assert candidate(arr = [1, 3, 2, 1, 0, -1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15]) == True\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0]) == True\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 12, 11, 9, 7, 5, 3, 1]) == True\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1]) == False\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 0, 1, 0, 1, 0]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 3, 4, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, -1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == True\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == True\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12]) == True\n assert candidate(arr = [1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [3, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == True\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 14, 12, 10, 8, 6, 4, 2]) == True\n assert candidate(arr = [1, 3, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 0, -1, -2, -3, -4]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == True\n assert candidate(arr = [1, 3, 2, 4, 3, 2]) == False\n assert candidate(arr = [10, 20, 30, 25, 20, 15, 10, 5, 0, -5, -10]) == True\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 11, 9, 7, 5, 3, 1]) == True\n assert candidate(arr = [10, 9, 8, 7, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1]) == False\n assert candidate(arr = [1, 3, 2, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [0, 1, 2, 3, 4, 3, 2, 1, 0, -1, -2, -3, -4]) == True\n assert candidate(arr = [1, 3, 2, 1, 0, -1, -2]) == True\n assert candidate(arr = [9, 8, 7, 6, 5, 6, 7, 8, 9]) == False\n assert candidate(arr = [1, 2, 3, 2, 1, 0, -1, -2]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 5, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 2, 3, 4, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == True\n assert candidate(arr = [1, 2, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3]) == False\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().validMountainArray", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var validMountainArray = function(arr) {", "container": null, "callable": "validMountainArray", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 942, "task_id": "di-string-match", "difficulty": "Easy", "problem_description": "A permutation perm of n + 1 integers of all the integers in the range [0, n] can be represented as a string s of length n where:\n\ns[i] == 'I' if perm[i] < perm[i + 1], and\ns[i] == 'D' if perm[i] > perm[i + 1].\n\nGiven a string s, reconstruct the permutation perm and return it. If there are multiple valid permutations perm, return any of them.\n \nExample 1:\nInput: s = \"IDID\"\nOutput: [0,4,1,3,2]\nExample 2:\nInput: s = \"III\"\nOutput: [0,1,2,3]\nExample 3:\nInput: s = \"DDI\"\nOutput: [3,2,0,1]\n\n \nConstraints:\n\n1 <= s.length <= 105\ns[i] is either 'I' or 'D'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"DDI\") == [3, 2, 0, 1]\n assert candidate(s = \"DDIDDI\") == [6, 5, 0, 4, 3, 1, 2]\n assert candidate(s = \"IDDD\") == [0, 4, 3, 2, 1]\n assert candidate(s = \"DDDDDDDD\") == [8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"I\") == [0, 1]\n assert candidate(s = \"IIIIII\") == [0, 1, 2, 3, 4, 5, 6]\n assert candidate(s = \"D\") == [1, 0]\n assert candidate(s = \"IIII\") == [0, 1, 2, 3, 4]\n assert candidate(s = \"IDDDIII\") == [0, 7, 6, 5, 1, 2, 3, 4]\n assert candidate(s = \"DDII\") == [4, 3, 0, 1, 2]\n assert candidate(s = \"IDIDIDIDID\") == [0, 10, 1, 9, 2, 8, 3, 7, 4, 6, 5]\n assert candidate(s = \"IIIIIIII\") == [0, 1, 2, 3, 4, 5, 6, 7, 8]\n assert candidate(s = \"DDDDDD\") == [6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"III\") == [0, 1, 2, 3]\n assert candidate(s = \"IDID\") == [0, 4, 1, 3, 2]\n assert candidate(s = \"DDDD\") == [4, 3, 2, 1, 0]\n assert candidate(s = \"DDIDDID\") == [7, 6, 0, 5, 4, 1, 3, 2]\n assert candidate(s = \"IDIDIDID\") == [0, 8, 1, 7, 2, 6, 3, 5, 4]\n assert candidate(s = \"IIDDD\") == [0, 1, 5, 4, 3, 2]\n assert candidate(s = \"DDDII\") == [5, 4, 3, 0, 1, 2]\n assert candidate(s = \"IIIIIIIIIIIIIIII\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]\n assert candidate(s = \"IDDDDDDDDDDDDD\") == [0, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n assert candidate(s = \"DDIIIDDDIIID\") == [12, 11, 0, 1, 2, 10, 9, 8, 3, 4, 5, 7, 6]\n assert candidate(s = \"IDDDDDDDII\") == [0, 10, 9, 8, 7, 6, 5, 4, 1, 2, 3]\n assert candidate(s = \"DDDDDDIIIII\") == [11, 10, 9, 8, 7, 6, 0, 1, 2, 3, 4, 5]\n assert candidate(s = \"IDDDDDDDDIIIII\") == [0, 14, 13, 12, 11, 10, 9, 8, 7, 1, 2, 3, 4, 5, 6]\n assert candidate(s = \"IIDIIDIIDI\") == [0, 1, 10, 2, 3, 9, 4, 5, 8, 6, 7]\n assert candidate(s = \"DDIDDIDDID\") == [10, 9, 0, 8, 7, 1, 6, 5, 2, 4, 3]\n assert candidate(s = \"DDDDDDIDID\") == [10, 9, 8, 7, 6, 5, 0, 4, 1, 3, 2]\n assert candidate(s = \"DDDDDDDDDIDDDD\") == [14, 13, 12, 11, 10, 9, 8, 7, 6, 0, 5, 4, 3, 2, 1]\n assert candidate(s = \"IIIIIIIIII\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n assert candidate(s = \"IDDDDDIIIIII\") == [0, 12, 11, 10, 9, 8, 1, 2, 3, 4, 5, 6, 7]\n assert candidate(s = \"DDDDDDDDDDDDDDDD\") == [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"DDDDDDIII\") == [9, 8, 7, 6, 5, 4, 0, 1, 2, 3]\n assert candidate(s = \"IIDDDDIIIDDD\") == [0, 1, 12, 11, 10, 9, 2, 3, 4, 8, 7, 6, 5]\n assert candidate(s = \"DDDDDDDDDIIIII\") == [14, 13, 12, 11, 10, 9, 8, 7, 6, 0, 1, 2, 3, 4, 5]\n assert candidate(s = \"DDDDIIIID\") == [9, 8, 7, 6, 0, 1, 2, 3, 5, 4]\n assert candidate(s = \"IDIDIDIDIDIDID\") == [0, 14, 1, 13, 2, 12, 3, 11, 4, 10, 5, 9, 6, 8, 7]\n assert candidate(s = \"DDDDDDDDDI\") == [10, 9, 8, 7, 6, 5, 4, 3, 2, 0, 1]\n assert candidate(s = \"DDDIDIDIDI\") == [10, 9, 8, 0, 7, 1, 6, 2, 5, 3, 4]\n assert candidate(s = \"DDDDDDDDDID\") == [11, 10, 9, 8, 7, 6, 5, 4, 3, 0, 2, 1]\n assert candidate(s = \"DDDDIDIDIDID\") == [12, 11, 10, 9, 0, 8, 1, 7, 2, 6, 3, 5, 4]\n assert candidate(s = \"IIDIIIIIIIIDIDDDDD\") == [0, 1, 18, 2, 3, 4, 5, 6, 7, 8, 9, 17, 10, 16, 15, 14, 13, 12, 11]\n assert candidate(s = \"IDDDIIIIIIII\") == [0, 12, 11, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(s = \"DDDDIIIIIIIDIDIDIDIDID\") == [22, 21, 20, 19, 0, 1, 2, 3, 4, 5, 6, 18, 7, 17, 8, 16, 9, 15, 10, 14, 11, 13, 12]\n assert candidate(s = \"IIIIIIIIIIIIID\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 13]\n assert candidate(s = \"IDIDIDIDIDID\") == [0, 12, 1, 11, 2, 10, 3, 9, 4, 8, 5, 7, 6]\n assert candidate(s = \"IIIIIIIDDDDD\") == [0, 1, 2, 3, 4, 5, 6, 12, 11, 10, 9, 8, 7]\n assert candidate(s = \"IDDDDDDDDDDDID\") == [0, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 1, 3, 2]\n assert candidate(s = \"IIDIIIDDD\") == [0, 1, 9, 2, 3, 4, 8, 7, 6, 5]\n assert candidate(s = \"IIIIIIIIIID\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 10]\n assert candidate(s = \"IIIIIIIDDD\") == [0, 1, 2, 3, 4, 5, 6, 10, 9, 8, 7]\n assert candidate(s = \"DDDDDDDDDDIIIIIIIIIID\") == [21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 10]\n assert candidate(s = \"IDIDIDIDIDI\") == [0, 11, 1, 10, 2, 9, 3, 8, 4, 7, 5, 6]\n assert candidate(s = \"DDDDDDDDDDII\") == [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 0, 1, 2]\n assert candidate(s = \"IDDDIIDDDIIDDDIIII\") == [0, 18, 17, 16, 1, 2, 15, 14, 13, 3, 4, 12, 11, 10, 5, 6, 7, 8, 9]\n assert candidate(s = \"DDDDIIIIDDDD\") == [12, 11, 10, 9, 0, 1, 2, 3, 8, 7, 6, 5, 4]\n assert candidate(s = \"IIIIIIIIIIIII\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]\n assert candidate(s = \"IDIDIDDDDD\") == [0, 10, 1, 9, 2, 8, 7, 6, 5, 4, 3]\n assert candidate(s = \"IIIIIIIIIIIDDDDDDDDIIIIIIIII\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 28, 27, 26, 25, 24, 23, 22, 21, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n assert candidate(s = \"IDIDIDIDDDD\") == [0, 11, 1, 10, 2, 9, 3, 8, 7, 6, 5, 4]\n assert candidate(s = \"DDDDDDDDDDDD\") == [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"IIIIIDDDDDID\") == [0, 1, 2, 3, 4, 12, 11, 10, 9, 8, 5, 7, 6]\n assert candidate(s = \"IDDDDDDDDDDDDIIIIIIIII\") == [0, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n assert candidate(s = \"IIDIDIDIDI\") == [0, 1, 10, 2, 9, 3, 8, 4, 7, 5, 6]\n assert candidate(s = \"IIIIIDDDDDDDDD\") == [0, 1, 2, 3, 4, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5]\n assert candidate(s = \"IIDIDIDIDID\") == [0, 1, 11, 2, 10, 3, 9, 4, 8, 5, 7, 6]\n assert candidate(s = \"DDDIDIDIDID\") == [11, 10, 9, 0, 8, 1, 7, 2, 6, 3, 5, 4]\n assert candidate(s = \"IIIDDDIIID\") == [0, 1, 2, 10, 9, 8, 3, 4, 5, 7, 6]\n assert candidate(s = \"IIIIIIIIIIIIIIIIIID\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 18]\n assert candidate(s = \"DDIIDDIDID\") == [10, 9, 0, 1, 8, 7, 2, 6, 3, 5, 4]\n assert candidate(s = \"DDDDIDDDDDDD\") == [12, 11, 10, 9, 0, 8, 7, 6, 5, 4, 3, 2, 1]\n assert candidate(s = \"DDDDDDDDDDDDDDD\") == [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"DIIDIDIDID\") == [10, 0, 1, 9, 2, 8, 3, 7, 4, 6, 5]\n assert candidate(s = \"IDDDDDDDDIII\") == [0, 12, 11, 10, 9, 8, 7, 6, 5, 1, 2, 3, 4]\n assert candidate(s = \"DDDDDDDDD\") == [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"DDDIDDDDDDDD\") == [12, 11, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n assert candidate(s = \"IIIIDDDDIII\") == [0, 1, 2, 3, 11, 10, 9, 8, 4, 5, 6, 7]\n assert candidate(s = \"IIDIDID\") == [0, 1, 7, 2, 6, 3, 5, 4]\n assert candidate(s = \"IIIIIIIIIIIIIIIIIIII\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n assert candidate(s = \"IDIDDDIDID\") == [0, 10, 1, 9, 8, 7, 2, 6, 3, 5, 4]\n assert candidate(s = \"DDDDDDDDDDDDDDDDDDDD\") == [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"DDDDDDDDDD\") == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"DDDDDDDDDDI\") == [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 0, 1]\n assert candidate(s = \"IDIDIDIDIDIDIDID\") == [0, 16, 1, 15, 2, 14, 3, 13, 4, 12, 5, 11, 6, 10, 7, 9, 8]\n assert candidate(s = \"DDDDDDDDDDDII\") == [13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 0, 1, 2]\n assert candidate(s = \"IIIIIDIIIIII\") == [0, 1, 2, 3, 4, 12, 5, 6, 7, 8, 9, 10, 11]\n assert candidate(s = \"IIDDDDDDDDDD\") == [0, 1, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(s = \"IIIIIIIDDDD\") == [0, 1, 2, 3, 4, 5, 6, 11, 10, 9, 8, 7]\n assert candidate(s = \"IIIIDDDDDDID\") == [0, 1, 2, 3, 12, 11, 10, 9, 8, 7, 4, 6, 5]\n assert candidate(s = \"DDDDDIDDDDD\") == [11, 10, 9, 8, 7, 0, 6, 5, 4, 3, 2, 1]\n assert candidate(s = \"DDDDIIII\") == [8, 7, 6, 5, 0, 1, 2, 3, 4]\n assert candidate(s = \"IIIIIIIIIIII\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n assert candidate(s = \"IIIIIIIIIIIDDDDDDDDDD\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11]\n assert candidate(s = \"DDDDDDDIIIII\") == [12, 11, 10, 9, 8, 7, 6, 0, 1, 2, 3, 4, 5]\n assert candidate(s = \"IDIDIDIDDDDD\") == [0, 12, 1, 11, 2, 10, 3, 9, 8, 7, 6, 5, 4]\n assert candidate(s = \"DDIDIDIDID\") == [10, 9, 0, 8, 1, 7, 2, 6, 3, 5, 4]\n assert candidate(s = \"DDIIDDDIIID\") == [11, 10, 0, 1, 9, 8, 7, 2, 3, 4, 6, 5]\n assert candidate(s = \"IIDDDDDDII\") == [0, 1, 10, 9, 8, 7, 6, 5, 2, 3, 4]\n assert candidate(s = \"IIDIDIDID\") == [0, 1, 9, 2, 8, 3, 7, 4, 6, 5]\n assert candidate(s = \"DDDDDDDIIIIIII\") == [14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 7]\n assert candidate(s = \"IIIIIIIIIIIIIIDDDDDDDDDDDD\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14]\n assert candidate(s = \"IIIIIDDDDIII\") == [0, 1, 2, 3, 4, 12, 11, 10, 9, 5, 6, 7, 8]\n assert candidate(s = \"DIDIDIDIDIDIDIDIDIDIDIDID\") == [25, 0, 24, 1, 23, 2, 22, 3, 21, 4, 20, 5, 19, 6, 18, 7, 17, 8, 16, 9, 15, 10, 14, 11, 13, 12]\n assert candidate(s = \"DDDDIIIIIIIDDDIIIIIDDDIIII\") == [26, 25, 24, 23, 0, 1, 2, 3, 4, 5, 6, 22, 21, 20, 7, 8, 9, 10, 11, 19, 18, 17, 12, 13, 14, 15, 16]\n assert candidate(s = \"IIIDDDDDDD\") == [0, 1, 2, 10, 9, 8, 7, 6, 5, 4, 3]\n assert candidate(s = \"IIIIIDDDDD\") == [0, 1, 2, 3, 4, 10, 9, 8, 7, 6, 5]\n assert candidate(s = \"DDDDDDDDDDIIII\") == [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 0, 1, 2, 3, 4]\n assert candidate(s = \"IDDDDDDDDDDD\") == [0, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n assert candidate(s = \"DDDDIIIIIIIIIIIIDDDDD\") == [21, 20, 19, 18, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 17, 16, 15, 14, 13, 12]\n assert candidate(s = \"IIIIIDDDDDD\") == [0, 1, 2, 3, 4, 11, 10, 9, 8, 7, 6, 5]\n assert candidate(s = \"IIDIIIIIDDDD\") == [0, 1, 12, 2, 3, 4, 5, 6, 11, 10, 9, 8, 7]\n assert candidate(s = \"DDDDDDDDIII\") == [11, 10, 9, 8, 7, 6, 5, 4, 0, 1, 2, 3]\n assert candidate(s = \"DDIDIDIDIDID\") == [12, 11, 0, 10, 1, 9, 2, 8, 3, 7, 4, 6, 5]\n assert candidate(s = \"DDDDDDDDDIDIDID\") == [15, 14, 13, 12, 11, 10, 9, 8, 7, 0, 6, 1, 5, 2, 4, 3]\n assert candidate(s = \"IIIIIIIIIIIIIII\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]\n assert candidate(s = \"IIDDDIIIDDD\") == [0, 1, 11, 10, 9, 2, 3, 4, 8, 7, 6, 5]\n assert candidate(s = \"DIDIDIDIDI\") == [10, 0, 9, 1, 8, 2, 7, 3, 6, 4, 5]\n assert candidate(s = \"DDDDDDDDDDDDDD\") == [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"DDDDDDIDDDII\") == [12, 11, 10, 9, 8, 7, 0, 6, 5, 4, 1, 2, 3]\n assert candidate(s = \"IDIDDDDDDD\") == [0, 10, 1, 9, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDIDIDID\") == [0, 24, 1, 23, 2, 22, 3, 21, 4, 20, 5, 19, 6, 18, 7, 17, 8, 16, 9, 15, 10, 14, 11, 13, 12]\n assert candidate(s = \"DDDDIIIIIII\") == [11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 7]\n assert candidate(s = \"DDDDDDIIID\") == [10, 9, 8, 7, 6, 5, 0, 1, 2, 4, 3]\n assert candidate(s = \"IDIDIDIDIDIDIDIDIDID\") == [0, 20, 1, 19, 2, 18, 3, 17, 4, 16, 5, 15, 6, 14, 7, 13, 8, 12, 9, 11, 10]\n assert candidate(s = \"DDDDDDDDDDDDD\") == [13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"IIDDDDDDID\") == [0, 1, 10, 9, 8, 7, 6, 5, 2, 4, 3]\n assert candidate(s = \"IIIIIIIIIII\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n assert candidate(s = \"DDDDDDIIII\") == [10, 9, 8, 7, 6, 5, 0, 1, 2, 3, 4]\n assert candidate(s = \"DDDDIIDDII\") == [10, 9, 8, 7, 0, 1, 6, 5, 2, 3, 4]\n assert candidate(s = \"DIDIDIDIDID\") == [11, 0, 10, 1, 9, 2, 8, 3, 7, 4, 6, 5]\n assert candidate(s = \"DDDDDDDDDDDID\") == [13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 0, 2, 1]\n assert candidate(s = \"DDDDDDDDDDD\") == [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(s = \"DDIIIDDDII\") == [10, 9, 0, 1, 2, 8, 7, 6, 3, 4, 5]\n assert candidate(s = \"DDDDDDDDDIIIIIIIIIIDDDDDDDD\") == [27, 26, 25, 24, 23, 22, 21, 20, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 18, 17, 16, 15, 14, 13, 12, 11, 10]\n assert candidate(s = \"DDDDDIIIIII\") == [11, 10, 9, 8, 7, 0, 1, 2, 3, 4, 5, 6]\n assert candidate(s = \"IIDDDDDIII\") == [0, 1, 10, 9, 8, 7, 6, 2, 3, 4, 5]\n assert candidate(s = \"IDIDDDDDDDDDDD\") == [0, 14, 1, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(s = \"DDDDDDDDDDDDDIIIIIIIIIIIII\") == [26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]\n assert candidate(s = \"IIDDDDIIID\") == [0, 1, 10, 9, 8, 7, 2, 3, 4, 6, 5]\n assert candidate(s = \"IIIIIIIIIIIID\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 12]\n assert candidate(s = \"DDIIDDDIID\") == [10, 9, 0, 1, 8, 7, 6, 2, 3, 5, 4]\n assert candidate(s = \"DIDIDIDID\") == [9, 0, 8, 1, 7, 2, 6, 3, 5, 4]\n assert candidate(s = \"IIIIIIIDDDDDDD\") == [0, 1, 2, 3, 4, 5, 6, 14, 13, 12, 11, 10, 9, 8, 7]\n assert candidate(s = \"IDDDDDDDDD\") == [0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n assert candidate(s = \"IIIIIIIIIIIIII\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n assert candidate(s = \"IIIIIIIIIIID\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 11]\n assert candidate(s = \"IDIDIDDDDDD\") == [0, 11, 1, 10, 2, 9, 8, 7, 6, 5, 4, 3]\n assert candidate(s = \"IIDDDDDDDD\") == [0, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(s = \"IIDDDDDDDDID\") == [0, 1, 12, 11, 10, 9, 8, 7, 6, 5, 2, 4, 3]\n assert candidate(s = \"IIIIIIIII\") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(s = \"IDDDDDDDDDD\") == [0, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n assert candidate(s = \"IIIIIDIDIDIDIDIDIDDD\") == [0, 1, 2, 3, 4, 20, 5, 19, 6, 18, 7, 17, 8, 16, 9, 15, 10, 14, 13, 12, 11]\n assert candidate(s = \"DDDDDDDDDDDDDDDIDDD\") == [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 0, 4, 3, 2, 1]\n assert candidate(s = \"DDDDDDDDDDDIII\") == [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 0, 1, 2, 3]\n assert candidate(s = \"DIIIDDDIIIID\") == [12, 0, 1, 2, 11, 10, 9, 3, 4, 5, 6, 8, 7]\n assert candidate(s = \"IDDDIDDDID\") == [0, 10, 9, 8, 1, 7, 6, 5, 2, 4, 3]\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().diStringMatch", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var diStringMatch = function(s) {", "container": null, "callable": "diStringMatch", "parameters": [{"name": "s", "type": "string"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 943, "task_id": "find-the-shortest-superstring", "difficulty": "Hard", "problem_description": "Given an array of strings words, return the smallest string that contains each string in words as a substring. If there are multiple valid strings of the smallest length, return any of them.\nYou may assume that no string in words is a substring of another string in words.\n \nExample 1:\n\nInput: words = [\"alex\",\"loves\",\"leetcode\"]\nOutput: \"alexlovesleetcode\"\nExplanation: All permutations of \"alex\",\"loves\",\"leetcode\" would also be accepted.\n\nExample 2:\n\nInput: words = [\"catg\",\"ctaagt\",\"gcta\",\"ttca\",\"atgcatc\"]\nOutput: \"gctaagttcatgcatc\"\n\n \nConstraints:\n\n1 <= words.length <= 12\n1 <= words[i].length <= 20\nwords[i] consists of lowercase English letters.\nAll the strings of words are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['a', 'ab', 'abc']) == \"abc\"\n assert candidate(words = ['abcde', 'bcdef', 'cdefg']) == \"abcdefg\"\n assert candidate(words = ['a', 'b', 'c']) == \"abc\"\n assert candidate(words = ['shortest', 'superstring', 'string', 'abc']) == \"superstringshortestabc\"\n assert candidate(words = ['abc', 'bcd', 'xyz', 'zyx']) == \"zyxyzabcd\"\n assert candidate(words = ['aaa', 'bbb', 'ccc']) == \"aaabbbccc\"\n assert candidate(words = ['abcd', 'cde', 'efg', 'ghij']) == \"abcdefghij\"\n assert candidate(words = ['catg', 'ctaagt', 'gcta', 'ttca', 'atgcatc']) == \"gctaagttcatgcatc\"\n assert candidate(words = ['apple', 'plea', 'peach']) == \"appleapeach\"\n assert candidate(words = ['unique', 'ness', 'super', 'set']) == \"nessuperuniqueset\"\n assert candidate(words = ['abcd', 'cdab', 'bcda', 'dabc']) == \"bcdabcd\"\n assert candidate(words = ['ab', 'bc', 'cd']) == \"abcd\"\n assert candidate(words = ['hello', 'world', 'abc']) == \"helloworldabc\"\n assert candidate(words = ['alex', 'loves', 'leetcode']) == \"alexlovesleetcode\"\n assert candidate(words = ['abc', 'bcd', 'cde', 'def', 'efg']) == \"abcdefg\"\n assert candidate(words = ['short', 'longer', 'longest']) == \"shortlongerlongest\"\n assert candidate(words = ['one', 'two', 'three', 'four']) == \"twonethreefour\"\n assert candidate(words = ['abc', 'bca', 'cab']) == \"bcabc\"\n assert candidate(words = ['hello', 'world', 'word', 'dlrow', 'row']) == \"wordlroworldhello\"\n assert candidate(words = ['abcd', 'cdef', 'efab', 'fabc']) == \"cdefabcd\"\n assert candidate(words = ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh', 'ghi', 'hij', 'ijk', 'jkl', 'klm', 'lmn', 'mno', 'nop']) == \"abcdefghijklmnop\"\n assert candidate(words = ['abcd', 'cdabcd', 'bcdaabcd', 'dabcabcd', 'abcdabcd', 'bcabcd', 'cdababcd', 'dababcd', 'abcabcd', 'bcdabc', 'cdabc', 'dabc']) == \"cdababcdabcabcdaabcdabcd\"\n assert candidate(words = ['aaaa', 'bbba', 'abbb', 'baaa']) == \"abbbaaaa\"\n assert candidate(words = ['abcde', 'bcdef', 'cdefg', 'defgh', 'efghi']) == \"abcdefghi\"\n assert candidate(words = ['abcdef', 'bcdefg', 'cdefgh', 'defghi', 'efghij', 'fghijk', 'ghijkl', 'hijklm', 'ijklmn']) == \"abcdefghijklmn\"\n assert candidate(words = ['abcd', 'cdab', 'bcda', 'dabc', 'abdc', 'dcba', 'cadb', 'bdac']) == \"bdacadbdabcdabdcba\"\n assert candidate(words = ['abcdefghij', 'bcdefghijk', 'cdefghijkl', 'defghijklm', 'efghijklmn', 'fghijklmno', 'ghijklmnop', 'hijklmnopq', 'ijklmnopqr', 'jklmnopqrs', 'klmnopqrst', 'lmnopqrstu']) == \"abcdefghijklmnopqrstu\"\n assert candidate(words = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']) == \"sevenineightensixfivefourthreetwone\"\n assert candidate(words = ['aabb', 'bbcc', 'ccdd', 'ddee', 'eeff', 'ffgg', 'ggaa', 'aacc', 'ccbb', 'ddeeff', 'ffggaa', 'aabbcc']) == \"aaccddeeffggaabbccbb\"\n assert candidate(words = ['abcd', 'cdab', 'bcda', 'dabc', 'abcd', 'cdab', 'bcda', 'dabc', 'abcd', 'cdab']) == \"bcdabcd\"\n assert candidate(words = ['abcd', 'cdab', 'bcda', 'dabc', 'abcdabc', 'bcdbcd']) == \"abcdabcdbcdab\"\n assert candidate(words = ['unique', 'words', 'here', 'are', 'some', 'more', 'complex', 'test', 'cases']) == \"casesomeareherewordsuniquemorecomplextest\"\n assert candidate(words = ['abcde', 'bcdef', 'cdefg', 'defgh', 'efghi', 'fghij', 'ghijk', 'hijkl', 'ijklm']) == \"abcdefghijklm\"\n assert candidate(words = ['ab', 'bc', 'ca', 'ac', 'ba']) == \"bacabc\"\n assert candidate(words = ['xyz', 'yzabc', 'abcde', 'cdefg', 'efghi', 'fghij', 'ghijk', 'hijkl', 'ijklm', 'jklmn', 'klmno', 'lmnop']) == \"xyzabcdefghijklmnop\"\n assert candidate(words = ['abcd', 'bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij', 'hijk', 'ijkl', 'jklm', 'klmn', 'lmno']) == \"abcdefghijklmno\"\n assert candidate(words = ['overlap', 'lapover', 'lover', 'verlap', 'overla', 'verlapo', 'verlapov', 'overlapov', 'verlapove', 'lapoverla']) == \"loverlapoverlapo\"\n assert candidate(words = ['prefix', 'fixpre', 'refixp', 'fixpref', 'refixpr', 'fixprefi', 'refixpre', 'fixprefix', 'refixpref', 'fixprefix']) == \"fixprefixpref\"\n assert candidate(words = ['algorithm', 'rhythm', 'myth', 'throttle', 'thorn', 'horn']) == \"thornrhythmythrottlealgorithm\"\n assert candidate(words = ['aabbccdd', 'bbccddaa', 'ccddaabb', 'ddaaaabb', 'aaaabbbb', 'bbbbaaaa']) == \"ddaaaabbbbaaaabbccddaabb\"\n assert candidate(words = ['prefix', 'refix', 'fix', 'ix', 'x', 'suffix', 'uffix', 'ffix', 'fixy', 'xylophone', 'phone', 'honeymoon']) == \"suffixylophoneymoonprefix\"\n assert candidate(words = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve']) == \"twelvelevenineightensevensixfivefourthreetwone\"\n assert candidate(words = ['pqr', 'qrs', 'rst', 'stu', 'tuv', 'uvw', 'vwx', 'wxy', 'xyz']) == \"pqrstuvwxyz\"\n assert candidate(words = ['aaaa', 'aabb', 'abbb', 'bbaa', 'baab', 'baba', 'abba', 'abaa', 'baba', 'abab', 'baba', 'abab']) == \"ababaabbaaaabbb\"\n assert candidate(words = ['xyz', 'yzw', 'wxy', 'uvw', 'vwxy', 'wxyz', 'xyzu']) == \"xyzuvwxyzw\"\n assert candidate(words = ['overlap', 'laplong', 'longer', 'ergonomic', 'nomics', 'micronix', 'nixos', 'xenon', 'nonya', 'yonder', 'nder', 'derivation']) == \"yonderivationxenonyamicronixosoverlaplongergonomics\"\n assert candidate(words = ['abcd', 'cdab', 'bcda', 'dabc', 'abcd', 'cdab', 'bcda', 'dabc', 'abcd', 'cdab', 'bcda', 'dabc']) == \"bcdabcd\"\n assert candidate(words = ['abcdef', 'defghi', 'ghijkl', 'jklmno', 'mnopqr', 'nopqrs']) == \"abcdefghijklmnopqrs\"\n assert candidate(words = ['hello', 'world', 'foobar', 'barfoo', 'foobaz', 'bazfoo', 'bazbar', 'bazoof', 'foobazoo', 'oofbazfo']) == \"bazbarfoobazoofbazfoobarworldhello\"\n assert candidate(words = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve']) == \"twelvelevenineightensevensixfivefourthreetwone\"\n assert candidate(words = ['xyz', 'yzab', 'zabc', 'abcd', 'bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij']) == \"xyzabcdefghij\"\n assert candidate(words = ['abcd', 'bcd', 'cde', 'def', 'efg', 'fgh', 'ghi', 'hij', 'ijk', 'jkl', 'klm', 'lmn']) == \"abcdefghijklmn\"\n assert candidate(words = ['abc', 'bca', 'cab', 'acb', 'bac', 'cba', 'ab', 'bc', 'ca', 'ba', 'ac', 'cb']) == \"cbacbcabc\"\n assert candidate(words = ['aabbcc', 'bbccdd', 'ccddee', 'ddeeff', 'eefggh', 'fgghii']) == \"eefgghiiaabbccddeeff\"\n assert candidate(words = ['abcde', 'bcdef', 'cdefg', 'defgh', 'efghi', 'fghij', 'ghijk', 'hijkl', 'ijklm', 'jklmn', 'klmno', 'lmnop']) == \"abcdefghijklmnop\"\n assert candidate(words = ['prefix', 'refixa', 'fixato', 'fixatra', 'ixatrace', 'xatracer', 'atracerp', 'tracerpx', 'racerpxy', 'acerpxyz', 'cerpxyzl', 'erpxyzlh', 'rpxyzlhe', 'pxyzlhet', 'xyzlhetr']) == \"fixatracerpxyzlhetrprefixato\"\n assert candidate(words = ['ab', 'bc', 'cd', 'da']) == \"bcdab\"\n assert candidate(words = ['overlap', 'lapping', 'ping', 'pingpong', 'ong', 'overlaplap', 'laplaplap', 'pingping']) == \"overlaplaplappingpingpong\"\n assert candidate(words = ['aabbcc', 'bbccdd', 'ccddeeff', 'ddeeffgg', 'eeffgghh']) == \"aabbccddeeffgghh\"\n assert candidate(words = ['abcd', 'bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij', 'hijk', 'ijkl', 'jklm', 'klmn', 'lmno']) == \"abcdefghijklmno\"\n assert candidate(words = ['xyz', 'yzx', 'zxy', 'xyx', 'yxy', 'xyy', 'yxx', 'yzy', 'zyz', 'zyx', 'xzy', 'yxz']) == \"yxzyzyxxyxyzxyy\"\n assert candidate(words = ['one', 'two', 'three', 'four', 'five', 'six']) == \"twonethreefourfivesix\"\n assert candidate(words = ['abcdef', 'defabc', 'bcdefa', 'cdefab', 'defabc', 'efabcd', 'fabcde']) == \"bcdefabcdef\"\n assert candidate(words = ['aabbcc', 'bccdda', 'cdddee', 'ddeeff', 'effggg', 'ffgggh', 'ggghhh', 'hhhiii', 'iiiijj', 'jjjkkl', 'kkllmm', 'llmmnn']) == \"cdddeeffggghhhiiiijjjkkllmmnnaabbccdda\"\n assert candidate(words = ['abcde', 'bcdef', 'cdefg', 'defgh', 'efghi', 'fghij', 'ghijk', 'hijkl', 'ijklm', 'jklmn', 'klmno', 'lmnop']) == \"abcdefghijklmnop\"\n assert candidate(words = ['longest', 'string', 'that', 'contains', 'overlapping', 'parts']) == \"longestringthatcontainsoverlappingparts\"\n assert candidate(words = ['abcdef', 'defghi', 'ghijkl', 'ijklmn', 'mnopqr']) == \"abcdefghijklmnopqr\"\n assert candidate(words = ['abcdef', 'defghi', 'ghijkl', 'ijklmn', 'mnopqr']) == \"abcdefghijklmnopqr\"\n assert candidate(words = ['abcdefgh', 'efghijkl', 'ghijklmn', 'ijklmnop', 'jklmnopq', 'klmnopqr', 'mnopqrst', 'nopqrstu', 'opqrstuv', 'pqrstuvw', 'qrstuvwx', 'rstuvxyz']) == \"abcdefghijklmnopqrstuvwxrstuvxyz\"\n assert candidate(words = ['abcd', 'bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij', 'hijk']) == \"abcdefghijk\"\n assert candidate(words = ['aabbcc', 'bbccdd', 'ccddeeff', 'ddeeffgg', 'effgghh', 'ffgghhiijj', 'gghhiijjkk', 'hhiijjkkll', 'iijjkkllmm', 'jjkkllmmnn', 'kkllmmnnoo', 'llmmnnoopp']) == \"aabbccddeeffgghhiijjkkllmmnnoopp\"\n assert candidate(words = ['overlap', 'lapping', 'ping', 'pingpong', 'ong']) == \"overlappingpong\"\n assert candidate(words = ['pqr', 'qrp', 'rqp', 'prq', 'rpq', 'pqq', 'qqp']) == \"pqrpqqprqp\"\n assert candidate(words = ['abcxyz', 'xyzuvw', 'uvwdef', 'defghj', 'ghjklm', 'klmnop', 'mnopqr']) == \"abcxyzuvwdefghjklmnopqr\"\n assert candidate(words = ['overlap', 'laptime', 'timefly', 'flyby', 'bymy', 'myself']) == \"overlaptimeflybymyself\"\n assert candidate(words = ['rotation', 'otationr', 'tationro', 'ationrot', 'tionrota', 'ionrotat', 'onrotate', 'nrotate', 'rotate']) == \"rotationrotate\"\n assert candidate(words = ['aaa', 'aab', 'aba', 'abb', 'baa', 'bab', 'bba', 'bbb', 'aabbaa', 'bbbaab']) == \"bbababbbaabbaaa\"\n assert candidate(words = ['abcdef', 'defabc', 'bcdefa', 'cdefab']) == \"abcdefabc\"\n assert candidate(words = ['abcd', 'bcde', 'cdef', 'defg']) == \"abcdefg\"\n assert candidate(words = ['aaaa', 'bbbb', 'cccc', 'dddd', 'eeee', 'ffff', 'gggg', 'hhhh', 'iiii', 'jjjj', 'kkkk', 'llll']) == \"aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllll\"\n assert candidate(words = ['qwerty', 'wertyu', 'ertyui', 'rtyuiop', 'tyuiopq', 'yuiopqr']) == \"qwertyuiopqr\"\n assert candidate(words = ['abcdefg', 'bcdefgh', 'cdefghi', 'defghij', 'efghijk', 'fghijkl', 'ghijklm', 'hijklmn', 'ijklmno', 'jklmnop', 'klmnopq', 'lmnopqr', 'mnopqrs', 'nopqrst']) == \"abcdefghijklmnopqrst\"\n assert candidate(words = ['unique', 'strings', 'for', 'this', 'problem', 'are', 'here', 'and', 'there', 'everywhere']) == \"thereverywhereareproblemforthistringsuniqueand\"\n assert candidate(words = ['abcdef', 'cdefgh', 'efghij', 'ghijkl']) == \"abcdefghijkl\"\n assert candidate(words = ['aabb', 'bbaa', 'abab', 'baba', 'abba', 'baab']) == \"bababbaabb\"\n assert candidate(words = ['apple', 'pleas', 'please', 'ease', 'asean', 'anean', 'nean', 'east']) == \"appleaseaneaneast\"\n assert candidate(words = ['pqr', 'qrs', 'rst', 'stu', 'tuv', 'uvw', 'vwx', 'wxy', 'xyz', 'yza', 'zab']) == \"pqrstuvwxyzab\"\n assert candidate(words = ['ab', 'ba', 'ac', 'ca', 'ad', 'da', 'ae', 'ea', 'af', 'fa', 'ag', 'ga', 'ah', 'ha', 'ai', 'ia']) == \"baiahagafaeadacab\"\n assert candidate(words = ['abcxyz', 'xyzuvw', 'uvwdef', 'defghi', 'ghijkl', 'jklmno', 'mnopqr', 'nopqrs', 'pqrsuv', 'qrstuv', 'vwxyza']) == \"qrstuvwxyzabcxyzuvwdefghijklmnopqrsuv\"\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l']) == \"abcdefghijkl\"\n assert candidate(words = ['aaaa', 'bbb', 'cccc', 'dddd', 'eeee', 'ffff', 'gggg', 'hhhh', 'iiii', 'jjjj', 'kkkk', 'llll']) == \"aaaabbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllll\"\n assert candidate(words = ['abcdef', 'defghi', 'ghijkl', 'jklmno', 'mnopqr', 'nopqrs', 'pqrsuv', 'qrstuv']) == \"abcdefghijklmnopqrsuvqrstuv\"\n assert candidate(words = ['abcd', 'cdab', 'bcda', 'dabc', 'abcd', 'cdab', 'bcda', 'dabc']) == \"bcdabcd\"\n assert candidate(words = ['abcdef', 'bcdegh', 'cdefij', 'defgkl', 'efghmn', 'fghnop', 'ghnopq', 'hnoqrs', 'noqrst', 'qrstuv', 'rstuvw', 'stuvwx']) == \"bcdeghnoqrstuvwxfghnopqefghmndefgklabcdefij\"\n assert candidate(words = ['ab', 'bc', 'cd', 'de', 'ef', 'fa']) == \"bcdefab\"\n assert candidate(words = ['abcdefgh', 'ghijklmn', 'mnopqrst', 'rstuvwxy', 'xyzabcde']) == \"ghijklmnopqrstuvwxyzabcdefgh\"\n"}, "metadata": {"canonical_parameter_names": ["words"], "leetcode_dataset_entry_point": "Solution().shortestSuperstring", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shortestSuperstring = function(words) {", "container": null, "callable": "shortestSuperstring", "parameters": [{"name": "words", "type": "string[]"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 944, "task_id": "delete-columns-to-make-sorted", "difficulty": "Easy", "problem_description": "You are given an array of n strings strs, all of the same length.\nThe strings can be arranged such that there is one on each line, making a grid.\n\nFor example, strs = [\"abc\", \"bce\", \"cae\"] can be arranged as follows:\n\n\nabc\nbce\ncae\n\nYou want to delete the columns that are not sorted lexicographically. In the above example (0-indexed), columns 0 ('a', 'b', 'c') and 2 ('c', 'e', 'e') are sorted, while column 1 ('b', 'c', 'a') is not, so you would delete column 1.\nReturn the number of columns that you will delete.\n \nExample 1:\n\nInput: strs = [\"cba\",\"daf\",\"ghi\"]\nOutput: 1\nExplanation: The grid looks as follows:\n cba\n daf\n ghi\nColumns 0 and 2 are sorted, but column 1 is not, so you only need to delete 1 column.\n\nExample 2:\n\nInput: strs = [\"a\",\"b\"]\nOutput: 0\nExplanation: The grid looks as follows:\n a\n b\nColumn 0 is the only column and is sorted, so you will not delete any columns.\n\nExample 3:\n\nInput: strs = [\"zyx\",\"wvu\",\"tsr\"]\nOutput: 3\nExplanation: The grid looks as follows:\n zyx\n wvu\n tsr\nAll 3 columns are not sorted, so you will delete all 3.\n\n \nConstraints:\n\nn == strs.length\n1 <= n <= 100\n1 <= strs[i].length <= 1000\nstrs[i] consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(strs = ['zaz', 'zbz', 'zcz']) == 0\n assert candidate(strs = ['a', 'b']) == 0\n assert candidate(strs = ['zzz', 'zzz', 'zzz']) == 0\n assert candidate(strs = ['xyz', 'yza', 'zab']) == 2\n assert candidate(strs = ['abc', 'bcd', 'cde']) == 0\n assert candidate(strs = ['abc', 'abc', 'abc']) == 0\n assert candidate(strs = ['abcd', 'efgh', 'ijkl']) == 0\n assert candidate(strs = ['cba', 'daf', 'ghi']) == 1\n assert candidate(strs = ['abc', 'bce', 'cae']) == 1\n assert candidate(strs = ['zyx', 'wvu', 'tsr']) == 3\n assert candidate(strs = ['abcd', 'abce', 'abcf', 'abcg', 'abch', 'abci', 'abcj', 'abck', 'abcl', 'abcm', 'abcn', 'abco', 'abcp', 'abcq', 'abcr', 'abcs', 'abct', 'abcd', 'abce', 'abcf', 'abcg', 'abch', 'abci', 'abcj', 'abck', 'abcl', 'abcm', 'abcn', 'abco', 'abcp', 'abcq', 'abcr', 'abcs', 'abct']) == 1\n assert candidate(strs = ['xyz', 'yza', 'zab', 'abc', 'bcd', 'cde']) == 3\n assert candidate(strs = ['xyz', 'uvw', 'rst', 'qpo', 'nml', 'klm', 'jih', 'fed', 'cba']) == 3\n assert candidate(strs = ['qwe', 'wer', 'ert', 'rty', 'tyu', 'yui', 'uio', 'iop', 'opq', 'pqa', 'qaz', 'wsx', 'edc', 'rfv', 'tgb', 'yhn', 'ujm', 'ikl', 'olk', 'pvc', 'bnm']) == 3\n assert candidate(strs = ['xyz', 'xyx', 'xzy']) == 1\n assert candidate(strs = ['zyx', 'yxw', 'xwv', 'uvw']) == 3\n assert candidate(strs = ['abcd', 'dbca', 'efgh', 'hgfj']) == 2\n assert candidate(strs = ['abcd', 'abce', 'abcf', 'abcg', 'abch']) == 0\n assert candidate(strs = ['zz', 'zy', 'yx', 'xz', 'yz', 'zx']) == 2\n assert candidate(strs = ['abcd', 'dcba', 'abcd', 'dcba', 'abcd', 'dcba']) == 4\n assert candidate(strs = ['aabbcc', 'bbccdd', 'ccddee', 'ddeeff']) == 0\n assert candidate(strs = ['zzzz', 'zzzy', 'zzzx', 'zzxw']) == 2\n assert candidate(strs = ['mnop', 'mnoq', 'mnop']) == 1\n assert candidate(strs = ['aabbcc', 'abacbc', 'abcabc', 'acbacb', 'accbab', 'babcac', 'bbacab', 'bbcaab', 'bcabca', 'bcacab', 'bcbaca', 'bcbcaa', 'cacaba', 'cacbaa', 'caacab', 'caacba', 'cababc', 'cabacb', 'cabbac', 'cabcab', 'cabcba', 'cacabc', 'cacbba', 'cbabac', 'cbabca', 'cbacab', 'cbacba', 'cbbaca', 'cbbcaa', 'ccabab', 'ccabac', 'ccabba', 'ccbaab', 'ccbaca', 'ccbacb']) == 5\n assert candidate(strs = ['abcd', 'abdc', 'acdb']) == 1\n assert candidate(strs = ['aaaa', 'aaab', 'aabb', 'abbb']) == 0\n assert candidate(strs = ['abc', 'bac', 'bca', 'cab', 'cba', 'acb']) == 3\n assert candidate(strs = ['same', 'sake', 'sage', 'sage', 'sane', 'sane', 'sane']) == 1\n assert candidate(strs = ['abcdef', 'bcdefg', 'cdefgh', 'defghi']) == 0\n assert candidate(strs = ['abc', 'bac', 'cab', 'cba', 'bca', 'acb']) == 3\n assert candidate(strs = ['cat', 'dog', 'bat', 'rat', 'hat', 'mat', 'eat', 'tat', 'sat', 'pat']) == 3\n assert candidate(strs = ['abcd', 'dcba', 'abcd', 'dcba']) == 4\n assert candidate(strs = ['aaaa', 'bbbb', 'cccc', 'dddd', 'eeee', 'ffff']) == 0\n assert candidate(strs = ['apple', 'apply', 'appla']) == 1\n assert candidate(strs = ['zzzz', 'zzyx', 'zzyv', 'zzyu', 'zzyt', 'zzyr', 'zzys', 'zzyr', 'zzyp', 'zzyq', 'zzxo', 'zzxn', 'zzxm', 'zzxl', 'zzxk', 'zzxj', 'zzxi', 'zzxh', 'zzxg', 'zzxf', 'zzxe', 'zzxd', 'zzxc', 'zzwb', 'zzwa', 'zzza']) == 2\n assert candidate(strs = ['leetcode', 'loveleetcode', 'leetcodeer', 'leetcodexx']) == 7\n assert candidate(strs = ['abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij']) == 0\n assert candidate(strs = ['ab', 'ba', 'ab', 'ba', 'ab']) == 2\n assert candidate(strs = ['hello', 'helpp', 'hells']) == 1\n assert candidate(strs = ['abcdef', 'bcdefg', 'cdefgh', 'defghi', 'efghij', 'fghijk']) == 0\n assert candidate(strs = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yzc']) == 1\n assert candidate(strs = ['mnop', 'qrst', 'uvwx', 'yzab']) == 2\n assert candidate(strs = ['abcd', 'abdc', 'acbd', 'adbc']) == 2\n assert candidate(strs = ['xyzz', 'wvut', 'qrst', 'ponm', 'lkji', 'hgfed', 'cbazyx', 'abcdefgh']) == 4\n assert candidate(strs = ['qrst', 'qrsu', 'qrsu']) == 0\n assert candidate(strs = ['abcd', 'abcf', 'abce', 'abcd', 'abcf', 'abcd']) == 1\n assert candidate(strs = ['qrst', 'abcd', 'mnop', 'efgh']) == 4\n assert candidate(strs = ['abcd', 'dddd', 'abcd', 'dddd']) == 3\n assert candidate(strs = ['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a']) == 1\n assert candidate(strs = ['hello', 'hallo', 'hullo', 'hella']) == 2\n assert candidate(strs = ['aabbccdd', 'bbaaccee', 'ccddeeff', 'ddeeffgg']) == 2\n assert candidate(strs = ['zyxwvu', 'utsrqo', 'ponmlk', 'jihgfed', 'cba']) == 6\n assert candidate(strs = ['abc', 'bca', 'cab', 'acb']) == 3\n assert candidate(strs = ['pqr', 'stu', 'vwx', 'yzp']) == 1\n assert candidate(strs = ['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy']) == 0\n assert candidate(strs = ['mnop', 'mlkj', 'ihgf', 'edcb']) == 4\n assert candidate(strs = ['xyz', 'zyx', 'yzz', 'xzz']) == 2\n assert candidate(strs = ['zzzz', 'yyyy', 'xxxx', 'wwww']) == 4\n assert candidate(strs = ['abcdefg', 'bcdefgh', 'cdefghi', 'defghij', 'efghijk', 'fghijkl', 'ghijklm']) == 0\n assert candidate(strs = ['xyz', 'wxy', 'uvw', 'stu']) == 3\n assert candidate(strs = ['mnop', 'mnop', 'mnop', 'mnop']) == 0\n assert candidate(strs = ['a', 'z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a']) == 1\n assert candidate(strs = ['abcd', 'acbd', 'adbc', 'dabc', 'dbac', 'dcab', 'dcba']) == 3\n assert candidate(strs = ['abcd', 'acfg', 'aegi', 'afih']) == 1\n assert candidate(strs = ['aabbcc', 'bbccdd', 'ccddeeff', 'ddeeffgg', 'eeffgghh', 'ffgghhii']) == 0\n assert candidate(strs = ['xyz', 'uvw', 'rst', 'qpo']) == 3\n assert candidate(strs = ['abcd', 'abdc', 'acbd', 'acdb', 'adbc', 'adcb', 'bacd', 'badc', 'bcad', 'bcda', 'bdac', 'bdca', 'cabd', 'cadb', 'cbad', 'cbda', 'cdab', 'cdba', 'dabc', 'dacb', 'dbac', 'dbca', 'dcab', 'dcba']) == 3\n assert candidate(strs = ['abcdefgh', 'hgfedcba', 'abcdefgh', 'hgfedcba', 'abcdefgh', 'hgfedcba']) == 8\n assert candidate(strs = ['mnop', 'mnoq', 'mnop', 'mnop']) == 1\n assert candidate(strs = ['abcd', 'abcf', 'abce', 'abch', 'abcd', 'abci', 'abcd', 'abck']) == 1\n assert candidate(strs = ['aeg', 'bdf', 'cce']) == 2\n assert candidate(strs = ['mnop', 'qrst', 'uvwx', 'yzab', 'cdef', 'ghij', 'klmn', 'opqr', 'stuv', 'wxyz']) == 4\n assert candidate(strs = ['abcd', 'bcde', 'cdef', 'defg']) == 0\n assert candidate(strs = ['abcdef', 'acdefg', 'aeghij']) == 0\n assert candidate(strs = ['abcd', 'bfgh', 'cgij', 'dhjk']) == 0\n assert candidate(strs = ['banana', 'bandana', 'bananna']) == 2\n assert candidate(strs = ['abcd', 'abdc', 'abcc']) == 2\n assert candidate(strs = ['abcd', 'bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij', 'hijk', 'ijkl', 'jklm', 'klmn', 'lmno', 'mnop', 'nopq', 'opqr', 'pqrs', 'qrst', 'rstu', 'stuv', 'tuvw', 'uvwx', 'vwxy', 'wxyz']) == 0\n assert candidate(strs = ['aabbcc', 'bbccdd', 'ccddeeff', 'ddeeffgg']) == 0\n assert candidate(strs = ['pqr', 'pqs', 'pqt', 'pqu', 'pqv', 'pqw', 'pqx', 'pqy', 'pqz']) == 0\n assert candidate(strs = ['abcdef', 'fghijk', 'lmnopq', 'rstuvw', 'xyzuvw', 'vwxyzw', 'utrewq', 'ponmlk', 'jihgfedcba']) == 6\n assert candidate(strs = ['zyxwv', 'utsrq', 'ponml', 'kjihg', 'fedcba']) == 5\n assert candidate(strs = ['zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz']) == 0\n assert candidate(strs = ['abcdefg', 'bcdefgh', 'cdefghi', 'defghij', 'efghijk']) == 0\n assert candidate(strs = ['water', 'waste', 'wider']) == 3\n assert candidate(strs = ['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff', 'ggg', 'hhh', 'iii', 'jjj', 'kkk']) == 0\n assert candidate(strs = ['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff', 'ggg', 'hhh', 'iii', 'jjj', 'kkk', 'lll', 'mmm', 'nnn', 'ooo', 'ppp', 'qqq', 'rrr', 'sss', 'ttt', 'uuu', 'vvv', 'www', 'xxx', 'yyy', 'zzz']) == 0\n assert candidate(strs = ['abcd', 'acfg', 'aegh']) == 0\n assert candidate(strs = ['zzzzzzzz', 'zzyyyyxx', 'zyxwvutu', 'zyxwvuts']) == 7\n assert candidate(strs = ['xzy', 'uvw', 'rst', 'qpo', 'nml', 'klm', 'jih', 'fed', 'cba', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yzx']) == 3\n assert candidate(strs = ['abcdefghijklmnopqrstuvwxyz', 'bcdefghijklmnopqrstuvwxyza', 'cdefghijklmnopqrstuvwxyzab', 'defghijklmnopqrstuvwxyzabcde', 'efghijklmnopqrstuvwxyzabcdefg', 'fghijklmnopqrstuvwxyzabcdefg hijklmnopqrstuvwxyzabcdefg hijklmnopqrstuvwxyzabcdefg hijklmnopqrstuvwxyzabcdefg hijklmnopqrstuvwxyzabcdefg hijklmnopqrstuvwxyzabcdefg hijklmnopqrstuvwxyzabcdefg']) == 5\n assert candidate(strs = ['abc', 'bca', 'cab', 'bac']) == 3\n assert candidate(strs = ['aab', 'aac', 'aab', 'aac']) == 1\n assert candidate(strs = ['abcd', 'bfgh', 'cgij', 'dhkj']) == 0\n assert candidate(strs = ['aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee', 'fffff', 'ggggg', 'hhhhh', 'iiiii', 'jjjjj']) == 0\n assert candidate(strs = ['abcd', 'efgh', 'ijkl', 'mnop']) == 0\n assert candidate(strs = ['abcd', 'bfgh', 'cijj', 'dklm']) == 0\n assert candidate(strs = ['abcdefg', 'bcdefga', 'cdefgab', 'defgabc']) == 3\n assert candidate(strs = ['aaaa', 'bbbb', 'cccc', 'dddd', 'eeee']) == 0\n"}, "metadata": {"canonical_parameter_names": ["strs"], "leetcode_dataset_entry_point": "Solution().minDeletionSize", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minDeletionSize = function(strs) {", "container": null, "callable": "minDeletionSize", "parameters": [{"name": "strs", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 945, "task_id": "minimum-increment-to-make-array-unique", "difficulty": "Medium", "problem_description": "You are given an integer array nums. In one move, you can pick an index i where 0 <= i < nums.length and increment nums[i] by 1.\nReturn the minimum number of moves to make every value in nums unique.\nThe test cases are generated so that the answer fits in a 32-bit integer.\n \nExample 1:\n\nInput: nums = [1,2,2]\nOutput: 1\nExplanation: After 1 move, the array could be [1, 2, 3].\n\nExample 2:\n\nInput: nums = [3,2,1,2,1,7]\nOutput: 6\nExplanation: After 6 moves, the array could be [3, 4, 1, 2, 5, 7].\nIt can be shown that it is impossible for the array to have all unique values with 5 or less moves.\n\n \nConstraints:\n\n1 <= nums.length <= 105\n0 <= nums[i] <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4]) == 16\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 45\n assert candidate(nums = [5, 3, 5, 3, 5]) == 4\n assert candidate(nums = [1, 2, 2]) == 1\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 0\n assert candidate(nums = [1, 3, 2, 2, 3, 3, 4]) == 10\n assert candidate(nums = [10, 20, 30, 40, 50]) == 0\n assert candidate(nums = [5, 5, 5, 5, 5]) == 10\n assert candidate(nums = [0, 0, 0, 0, 0]) == 10\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1]) == 21\n assert candidate(nums = [1, 2, 3, 4, 5]) == 0\n assert candidate(nums = [1, 3, 5, 7, 9, 11]) == 0\n assert candidate(nums = [1, 3, 2, 2, 3, 1, 4, 4, 5, 5]) == 25\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 45\n assert candidate(nums = [0, 0, 0, 0]) == 6\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 0\n assert candidate(nums = [5, 3, 5, 5, 5]) == 6\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 45\n assert candidate(nums = [1, 3, 3, 3, 3, 3, 3]) == 15\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 45\n assert candidate(nums = [1, 1, 1, 1, 1, 1]) == 15\n assert candidate(nums = [3, 2, 1, 2, 1, 7]) == 6\n assert candidate(nums = [10, 10, 10, 10, 10]) == 10\n assert candidate(nums = [100000, 100000, 100000]) == 3\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == 140\n assert candidate(nums = [2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9]) == 192\n assert candidate(nums = [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000]) == 45\n assert candidate(nums = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15]) == 300\n assert candidate(nums = [100, 100, 100, 101, 101, 101, 102, 102, 102, 103, 103, 103]) == 48\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 190\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10]) == 110\n assert candidate(nums = [20, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28]) == 137\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 10\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 528\n assert candidate(nums = [100000, 100000, 100000, 100000, 100000]) == 10\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 170\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 25\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7]) == 462\n assert candidate(nums = [100, 100, 99, 99, 98, 98, 97, 97, 96, 96]) == 25\n assert candidate(nums = [1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15]) == 7\n assert candidate(nums = [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000]) == 435\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5]) == 140\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == 225\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 0\n assert candidate(nums = [5, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 11]) == 163\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 496\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 685\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 100\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12]) == 121\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4]) == 89\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 285\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 100\n assert candidate(nums = [0, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 150\n assert candidate(nums = [100000, 100000, 100000, 100000, 100000, 100000]) == 15\n assert candidate(nums = [2, 3, 3, 4, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 16]) == 43\n assert candidate(nums = [5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8]) == 160\n assert candidate(nums = [1, 1, 1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 38\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 121\n assert candidate(nums = [100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105]) == 36\n assert candidate(nums = [1, 2, 2, 2, 2, 3, 4, 5, 5, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10]) == 89\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 64\n assert candidate(nums = [5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7]) == 45\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == 0\n assert candidate(nums = [0, 0, 1, 1, 1, 2, 2, 2, 2, 2]) == 32\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 0\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 100\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 163\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 65\n assert candidate(nums = [0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 81\n assert candidate(nums = [100, 100, 100, 99, 99, 98, 97, 97, 96, 96, 95, 95, 94, 94, 93, 93, 92, 92, 91, 91]) == 98\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 100\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0]) == 50\n assert candidate(nums = [0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == 145\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1]) == 119\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 0\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 90\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11]) == 144\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 100\n assert candidate(nums = [10, 20, 30, 40, 50, 10, 20, 30, 40, 50, 10, 20, 30, 40, 50]) == 15\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 100, 100, 100, 100, 100]) == 15\n assert candidate(nums = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]) == 45\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 100\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, 25]) == 3\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 190\n assert candidate(nums = [50, 40, 30, 20, 10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250]) == 5\n assert candidate(nums = [2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6]) == 94\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 5]) == 55\n assert candidate(nums = [1, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5]) == 99\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10]) == 15\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 190\n assert candidate(nums = [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000]) == 45\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 225\n assert candidate(nums = [1, 3, 2, 3, 2, 4, 5, 4, 6, 7, 8, 9, 9]) == 28\n assert candidate(nums = [5, 3, 2, 2, 3, 3, 4, 4, 4, 5]) == 30\n assert candidate(nums = [0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 60\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4]) == 48\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 180\n assert candidate(nums = [1, 3, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5]) == 135\n assert candidate(nums = [5, 3, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 40\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10]) == 10\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7]) == 147\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 20, 20]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 250\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 105\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().minIncrementForUnique", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minIncrementForUnique = function(nums) {", "container": null, "callable": "minIncrementForUnique", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 946, "task_id": "validate-stack-sequences", "difficulty": "Medium", "problem_description": "Given two integer arrays pushed and popped each with distinct values, return true if this could have been the result of a sequence of push and pop operations on an initially empty stack, or false otherwise.\n \nExample 1:\n\nInput: pushed = [1,2,3,4,5], popped = [4,5,3,2,1]\nOutput: true\nExplanation: We might do the following sequence:\npush(1), push(2), push(3), push(4),\npop() -> 4,\npush(5),\npop() -> 5, pop() -> 3, pop() -> 2, pop() -> 1\n\nExample 2:\n\nInput: pushed = [1,2,3,4,5], popped = [4,3,5,1,2]\nOutput: false\nExplanation: 1 cannot be popped before 2.\n\n \nConstraints:\n\n1 <= pushed.length <= 1000\n0 <= pushed[i] <= 1000\nAll the elements of pushed are unique.\npopped.length == pushed.length\npopped is a permutation of pushed.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [4, 5, 3, 2, 1]) == True\n assert candidate(pushed = [2, 1, 0],popped = [0, 1, 2]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [1, 3, 2, 5, 4]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [5, 4, 3, 2, 1]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [4, 3, 5, 1, 2]) == False\n assert candidate(pushed = [1],popped = [1]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [3, 5, 4, 2, 1]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [2, 1, 5, 4, 3]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [2, 3, 4, 5, 1]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [1, 2, 3, 4, 5]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [3, 2, 1, 5, 4]) == True\n assert candidate(pushed = [1, 2, 3],popped = [1, 3, 2]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [5, 1, 2, 3, 4]) == False\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [1, 5, 4, 3, 2]) == True\n assert candidate(pushed = [1, 2, 3],popped = [3, 2, 1]) == True\n assert candidate(pushed = [1, 4, 5, 6, 3, 2],popped = [2, 3, 6, 5, 4, 1]) == True\n assert candidate(pushed = [1, 3, 2, 5, 4, 6, 8, 7, 10, 9],popped = [3, 2, 1, 5, 4, 8, 7, 10, 9, 6]) == True\n assert candidate(pushed = [5, 4, 3, 2, 1],popped = [1, 2, 3, 4, 5]) == True\n assert candidate(pushed = [5, 1, 2, 4, 3],popped = [1, 5, 3, 4, 2]) == True\n assert candidate(pushed = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],popped = [2, 4, 6, 8, 10, 12, 14, 16, 18, 1]) == False\n assert candidate(pushed = [1, 3, 2, 4, 5, 6, 7, 8, 9],popped = [3, 1, 4, 2, 5, 6, 7, 8, 9]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [1, 3, 2, 5, 4, 8, 7, 6, 10, 9]) == True\n assert candidate(pushed = [1, 3, 2, 5, 4, 6],popped = [2, 5, 6, 4, 3, 1]) == True\n assert candidate(pushed = [7, 6, 5, 4, 3, 2, 1],popped = [1, 2, 3, 4, 5, 6, 7]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [1, 4, 3, 2, 5, 8, 7, 6, 10, 9]) == True\n assert candidate(pushed = [5, 3, 1, 2, 4, 6, 7],popped = [7, 6, 4, 2, 1, 3, 5]) == True\n assert candidate(pushed = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],popped = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(pushed = [2, 1, 5, 4, 3, 6],popped = [3, 1, 6, 5, 2, 4]) == False\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [5, 4, 3, 2, 1, 10, 9, 8, 7, 6]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],popped = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(pushed = [5, 1, 2, 4, 3],popped = [5, 3, 4, 2, 1]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9],popped = [4, 3, 2, 1, 8, 7, 6, 5, 9]) == True\n assert candidate(pushed = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10],popped = [1, 3, 2, 5, 4, 7, 6, 9, 8, 10]) == False\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [3, 1, 2, 4, 5, 7, 6, 9, 10, 8]) == False\n assert candidate(pushed = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],popped = [30, 20, 40, 60, 50, 100, 90, 80, 70, 10]) == True\n assert candidate(pushed = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],popped = [1, 3, 2, 5, 4, 8, 7, 6, 10, 9]) == False\n assert candidate(pushed = [4, 3, 5, 1, 2],popped = [1, 5, 2, 4, 3]) == False\n assert candidate(pushed = [1, 5, 3, 2, 4, 6],popped = [2, 3, 1, 5, 4, 6]) == False\n assert candidate(pushed = [5, 3, 2, 1, 4],popped = [3, 1, 2, 4, 5]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [5, 3, 2, 1, 6, 4, 9, 8, 10, 7]) == False\n assert candidate(pushed = [1, 3, 5, 2, 4, 6, 8, 7, 9, 10],popped = [1, 5, 3, 4, 2, 6, 7, 8, 10, 9]) == True\n assert candidate(pushed = [9, 8, 7, 6, 5, 4, 3, 2, 1],popped = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [3, 5, 1, 4, 2, 7, 6, 9, 8, 10]) == False\n assert candidate(pushed = [6, 2, 3, 1, 5, 4],popped = [6, 3, 2, 1, 4, 5]) == True\n assert candidate(pushed = [2, 1, 3, 5, 4, 6],popped = [2, 1, 4, 5, 3, 6]) == True\n assert candidate(pushed = [1, 2, 3, 5, 4, 6, 7, 8, 9, 10],popped = [2, 3, 1, 5, 4, 6, 7, 8, 10, 9]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [10, 9, 8, 7, 6, 5, 2, 4, 3, 1]) == False\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [3, 4, 2, 1, 8, 9, 6, 7, 10, 5]) == False\n assert candidate(pushed = [2, 1, 3, 4, 5],popped = [1, 2, 3, 4, 5]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [3, 1, 2, 5, 4, 6, 7, 10, 9, 8]) == False\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [1, 3, 2, 5, 4, 7, 6, 9, 8, 10]) == True\n assert candidate(pushed = [3, 2, 1, 5, 4, 6],popped = [2, 3, 1, 5, 4, 6]) == True\n assert candidate(pushed = [1, 3, 2, 4, 5],popped = [3, 1, 5, 4, 2]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [3, 2, 1, 6, 5, 4, 9, 8, 7, 10]) == True\n assert candidate(pushed = [1, 3, 5, 7, 9, 11],popped = [11, 9, 7, 5, 3, 1]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [1, 2, 3, 4, 5, 10, 9, 8, 7, 6]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [10, 8, 6, 4, 2, 1, 3, 5, 7, 9]) == False\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [1, 5, 4, 3, 2, 6, 7, 8, 10, 9]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == False\n assert candidate(pushed = [1, 3, 2, 5, 4],popped = [2, 3, 1, 5, 4]) == True\n assert candidate(pushed = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],popped = [1, 3, 2, 4, 5, 7, 6, 8, 10, 9]) == False\n assert candidate(pushed = [1, 5, 7, 9, 11, 13, 15, 17, 19],popped = [19, 17, 15, 13, 11, 9, 7, 5, 1]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],popped = [7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6]) == False\n assert candidate(pushed = [3, 1, 2, 4, 5],popped = [1, 2, 3, 4, 5]) == True\n assert candidate(pushed = [1, 3, 2, 4, 5, 7, 6, 8, 9, 10],popped = [2, 3, 1, 6, 7, 5, 10, 9, 8, 4]) == True\n assert candidate(pushed = [1, 3, 5, 2, 4, 6],popped = [2, 4, 6, 3, 5, 1]) == False\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(pushed = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],popped = [30, 50, 100, 90, 80, 70, 60, 40, 20, 10]) == True\n assert candidate(pushed = [1, 2, 5, 3, 4, 6],popped = [2, 1, 5, 6, 4, 3]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]) == False\n assert candidate(pushed = [5, 1, 3, 4, 2],popped = [1, 2, 3, 4, 5]) == False\n assert candidate(pushed = [1, 4, 3, 2, 5, 6],popped = [2, 3, 4, 1, 6, 5]) == True\n assert candidate(pushed = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10],popped = [10, 9, 8, 7, 6, 5, 4, 2, 3, 1]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],popped = [1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 14, 13, 12, 11, 10]) == True\n assert candidate(pushed = [1, 3, 2, 5, 4, 6],popped = [2, 3, 4, 5, 6, 1]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [5, 3, 4, 1, 2]) == False\n assert candidate(pushed = [10, 20, 30, 40, 50],popped = [20, 10, 50, 30, 40]) == False\n assert candidate(pushed = [1, 3, 2, 4, 5],popped = [2, 3, 1, 5, 4]) == True\n assert candidate(pushed = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],popped = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(pushed = [1, 2, 5, 3, 6, 4, 7, 8, 9, 10],popped = [1, 2, 3, 4, 6, 5, 7, 8, 10, 9]) == True\n assert candidate(pushed = [1, 3, 5, 4, 2],popped = [2, 4, 5, 3, 1]) == True\n assert candidate(pushed = [8, 9, 7, 6, 10, 11, 12, 13, 14],popped = [12, 14, 13, 11, 10, 7, 6, 9, 8]) == False\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [2, 4, 6, 8, 10, 9, 7, 5, 3, 1]) == True\n assert candidate(pushed = [1, 2, 3, 5, 4],popped = [5, 1, 4, 2, 3]) == False\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [3, 1, 2, 5, 4, 7, 6, 8, 10, 9]) == False\n assert candidate(pushed = [7, 8, 9, 10, 11],popped = [9, 11, 10, 8, 7]) == True\n assert candidate(pushed = [1, 4, 5, 3, 2, 6],popped = [2, 3, 4, 5, 1, 6]) == False\n assert candidate(pushed = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10],popped = [2, 4, 6, 8, 10, 5, 7, 9, 3, 1]) == False\n assert candidate(pushed = [1, 3, 2, 5, 4, 6],popped = [3, 2, 5, 1, 4, 6]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [6, 5, 4, 3, 2, 1, 7, 8, 9, 10]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],popped = [8, 9, 6, 7, 4, 5, 2, 3, 10, 11, 12, 15, 14, 1, 13]) == False\n assert candidate(pushed = [1, 2, 3, 5, 4, 6, 7, 9, 8, 10],popped = [1, 2, 3, 6, 5, 4, 8, 7, 10, 9]) == False\n assert candidate(pushed = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10],popped = [2, 4, 6, 8, 10, 1, 3, 5, 7, 9]) == False\n assert candidate(pushed = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],popped = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == True\n assert candidate(pushed = [1, 3, 5, 7, 2, 4, 6, 8],popped = [1, 3, 2, 5, 4, 7, 6, 8]) == False\n assert candidate(pushed = [1, 3, 2, 5, 4],popped = [5, 4, 2, 3, 1]) == True\n assert candidate(pushed = [2, 1, 3, 5, 4],popped = [3, 1, 2, 4, 5]) == True\n assert candidate(pushed = [1, 3, 2, 4, 5],popped = [3, 2, 1, 5, 4]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],popped = [6, 5, 4, 3, 2, 1, 10, 9, 8, 7]) == True\n"}, "metadata": {"canonical_parameter_names": ["pushed", "popped"], "leetcode_dataset_entry_point": "Solution().validateStackSequences", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var validateStackSequences = function(pushed, popped) {", "container": null, "callable": "validateStackSequences", "parameters": [{"name": "pushed", "type": "number[]"}, {"name": "popped", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 947, "task_id": "most-stones-removed-with-same-row-or-column", "difficulty": "Medium", "problem_description": "On a 2D plane, we place n stones at some integer coordinate points. Each coordinate point may have at most one stone.\nA stone can be removed if it shares either the same row or the same column as another stone that has not been removed.\nGiven an array stones of length n where stones[i] = [xi, yi] represents the location of the ith stone, return the largest possible number of stones that can be removed.\n \nExample 1:\n\nInput: stones = [[0,0],[0,1],[1,0],[1,2],[2,1],[2,2]]\nOutput: 5\nExplanation: One way to remove 5 stones is as follows:\n1. Remove stone [2,2] because it shares the same row as [2,1].\n2. Remove stone [2,1] because it shares the same column as [0,1].\n3. Remove stone [1,2] because it shares the same row as [1,0].\n4. Remove stone [1,0] because it shares the same column as [0,0].\n5. Remove stone [0,1] because it shares the same row as [0,0].\nStone [0,0] cannot be removed since it does not share a row/column with another stone still on the plane.\n\nExample 2:\n\nInput: stones = [[0,0],[0,2],[1,1],[2,0],[2,2]]\nOutput: 3\nExplanation: One way to make 3 moves is as follows:\n1. Remove stone [2,2] because it shares the same row as [2,0].\n2. Remove stone [2,0] because it shares the same column as [0,0].\n3. Remove stone [0,2] because it shares the same row as [0,0].\nStones [0,0] and [1,1] cannot be removed since they do not share a row/column with another stone still on the plane.\n\nExample 3:\n\nInput: stones = [[0,0]]\nOutput: 0\nExplanation: [0,0] is the only stone on the plane, so you cannot remove it.\n\n \nConstraints:\n\n1 <= stones.length <= 1000\n0 <= xi, yi <= 104\nNo two stones are at the same coordinate point.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(stones = [[4, 8], [4, 4], [4, 4], [9, 2], [3, 8], [8, 0], [7, 5], [0, 8], [5, 7], [6, 9], [3, 0], [4, 7], [8, 5], [5, 9], [7, 4], [6, 0], [6, 4], [4, 2], [6, 3]]) == 18\n assert candidate(stones = [[0, 0], [0, 2], [1, 1], [2, 0], [2, 2]]) == 3\n assert candidate(stones = [[3, 2], [2, 3], [3, 1], [2, 2]]) == 3\n assert candidate(stones = [[1, 2], [2, 3], [3, 4]]) == 0\n assert candidate(stones = [[4, 0], [4, 2], [1, 1], [0, 0], [0, 2], [2, 0], [2, 2]]) == 5\n assert candidate(stones = [[0, 0]]) == 0\n assert candidate(stones = [[0, 0], [0, 1], [1, 0], [1, 2], [2, 1], [2, 2]]) == 5\n assert candidate(stones = [[3, 4], [3, 2], [4, 2], [0, 0], [1, 2]]) == 3\n assert candidate(stones = [[4, 8], [4, 4], [4, 4], [9, 2], [8, 7], [2, 3], [8, 7], [5, 0], [3, 1], [0, 5], [8, 5], [7, 2], [5, 3], [1, 7], [8, 0], [2, 6], [0, 1], [1, 0], [5, 8], [6, 4]]) == 18\n assert candidate(stones = [[1, 2], [2, 3], [3, 4], [4, 5]]) == 0\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]) == 0\n assert candidate(stones = [[4, 8], [4, 4], [4, 4], [9, 2], [8, 8], [4, 5], [0, 7], [5, 7], [1, 8], [9, 2], [9, 7], [4, 9], [4, 8]]) == 11\n assert candidate(stones = [[1, 2], [2, 1], [3, 2], [4, 2], [5, 3], [4, 4]]) == 3\n assert candidate(stones = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6]]) == 4\n assert candidate(stones = [[0, 1], [1, 0], [1, 2], [2, 1], [2, 2], [3, 3]]) == 4\n assert candidate(stones = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6]]) == 0\n assert candidate(stones = [[4, 0], [4, 2], [1, 1], [0, 2], [1, 2], [2, 2], [3, 2]]) == 6\n assert candidate(stones = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15]]) == 0\n assert candidate(stones = [[1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7], [9, 10], [10, 9], [11, 12], [12, 11], [13, 14], [14, 13]]) == 0\n assert candidate(stones = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [0, 0], [11, 11]]) == 0\n assert candidate(stones = [[10, 10], [10, 20], [20, 10], [20, 20], [10, 30], [30, 10], [30, 20], [20, 30], [30, 30], [10, 40], [40, 10]]) == 10\n assert candidate(stones = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]) == 8\n assert candidate(stones = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14]]) == 0\n assert candidate(stones = [[1, 1], [2, 2], [3, 3], [1, 3], [2, 3], [3, 1], [1, 2], [2, 1], [3, 2], [2, 4], [4, 2], [3, 4], [4, 3], [4, 4]]) == 13\n assert candidate(stones = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [2, 3], [3, 2]]) == 5\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [0, 3], [3, 0], [0, 2], [2, 0], [1, 2], [2, 1], [1, 3], [3, 1], [2, 3], [3, 2]]) == 13\n assert candidate(stones = [[1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 6], [10, 7], [10, 8], [10, 9]]) == 16\n assert candidate(stones = [[1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3], [4, 5], [5, 4], [5, 6], [6, 5], [6, 7], [7, 6]]) == 10\n assert candidate(stones = [[1, 1], [1, 2], [2, 1], [2, 2], [1, 3], [3, 1], [2, 3], [3, 2], [1, 4], [4, 1], [2, 4], [4, 2], [3, 3], [3, 4], [4, 3], [4, 4]]) == 15\n assert candidate(stones = [[1, 1], [2, 2], [3, 3], [4, 4], [1, 2], [2, 3], [3, 4], [4, 5], [1, 3], [2, 4], [3, 5], [4, 6]]) == 11\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 9], [9, 0]]) == 3\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15]]) == 0\n assert candidate(stones = [[0, 0], [0, 2], [2, 0], [2, 2], [4, 4], [4, 6], [6, 4], [6, 6], [8, 8], [8, 10], [10, 8], [10, 10]]) == 9\n assert candidate(stones = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 0\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0]]) == 19\n assert candidate(stones = [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2], [2, 3], [3, 2], [3, 3]]) == 9\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [0, 1], [1, 0], [2, 3], [3, 2], [0, 3], [3, 0], [1, 2], [2, 1]]) == 11\n assert candidate(stones = [[0, 1], [1, 0], [1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3], [4, 5], [5, 4]]) == 8\n assert candidate(stones = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 4], [6, 7], [7, 6], [8, 9], [9, 8], [0, 1], [1, 0]]) == 2\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [0, 5], [5, 0]]) == 3\n assert candidate(stones = [[1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3], [4, 5], [5, 4], [5, 6], [6, 5], [6, 7], [7, 6], [7, 8], [8, 7], [8, 9], [9, 8]]) == 14\n assert candidate(stones = [[1, 1], [2, 2], [3, 3], [4, 4], [1, 2], [2, 1], [3, 2], [2, 3]]) == 6\n assert candidate(stones = [[0, 0], [1, 0], [2, 0], [3, 0], [0, 1], [1, 1], [2, 1], [3, 1], [0, 2], [1, 2], [2, 2], [3, 2]]) == 11\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [0, 1], [1, 0], [2, 1], [1, 2]]) == 6\n assert candidate(stones = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]) == 3\n assert candidate(stones = [[1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5]]) == 0\n assert candidate(stones = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [0, 1], [1, 1], [2, 1], [3, 1], [4, 1]]) == 14\n assert candidate(stones = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [3, 3], [3, 4], [4, 3]]) == 5\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12]]) == 0\n assert candidate(stones = [[0, 0], [0, 2], [2, 0], [2, 2], [1, 1], [3, 3], [3, 5], [5, 3]]) == 5\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 0]]) == 31\n assert candidate(stones = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]) == 15\n assert candidate(stones = [[0, 1], [1, 0], [1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3]]) == 6\n assert candidate(stones = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 3\n assert candidate(stones = [[1, 1], [2, 1], [3, 1], [1, 2], [2, 2], [3, 2], [1, 3], [2, 3], [3, 3], [1, 4], [2, 4], [3, 4]]) == 11\n assert candidate(stones = [[1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7], [9, 10], [10, 9]]) == 0\n assert candidate(stones = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [2, 3], [3, 2], [3, 3]]) == 6\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]]) == 0\n assert candidate(stones = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 0]]) == 0\n assert candidate(stones = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) == 8\n assert candidate(stones = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3]]) == 7\n assert candidate(stones = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1]]) == 7\n assert candidate(stones = [[1, 2], [1, 3], [1, 4], [1, 5], [2, 1], [2, 3], [2, 4], [2, 5], [3, 1], [3, 2], [3, 4], [3, 5]]) == 11\n assert candidate(stones = [[0, 0], [0, 2], [2, 0], [1, 1], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]) == 2\n assert candidate(stones = [[0, 1], [1, 0], [1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3], [4, 5], [5, 4], [5, 6], [6, 5], [6, 7], [7, 6], [7, 8], [8, 7], [8, 9], [9, 8]]) == 16\n assert candidate(stones = [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 0], [3, 3]]) == 6\n assert candidate(stones = [[0, 10], [1, 9], [2, 8], [3, 7], [4, 6], [5, 5], [6, 4], [7, 3], [8, 2], [9, 1], [10, 0]]) == 0\n assert candidate(stones = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6], [6, 4], [7, 8], [8, 7], [9, 10], [10, 9]]) == 0\n assert candidate(stones = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 3], [3, 4], [4, 3], [4, 4], [5, 5], [5, 6], [6, 5], [6, 6]]) == 9\n assert candidate(stones = [[1, 1], [1, 3], [1, 5], [1, 7], [2, 2], [2, 4], [2, 6], [2, 8], [3, 1], [3, 3], [3, 5], [3, 7], [4, 2], [4, 4], [4, 6], [4, 8]]) == 14\n assert candidate(stones = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == 0\n assert candidate(stones = [[0, 0], [0, 2], [1, 1], [1, 3], [2, 0], [2, 2], [3, 1], [3, 3]]) == 6\n assert candidate(stones = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [2, 3], [3, 2], [3, 3], [4, 4], [4, 5], [5, 4], [5, 5], [6, 6], [6, 7], [7, 6], [7, 7]]) == 12\n assert candidate(stones = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == 0\n assert candidate(stones = [[5, 5], [5, 6], [5, 7], [6, 5], [6, 6], [6, 7], [7, 5], [7, 6], [7, 7], [8, 8], [8, 9], [9, 8], [9, 9]]) == 11\n assert candidate(stones = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [2, 3], [3, 2], [3, 3], [4, 4], [4, 5], [5, 4], [5, 5]]) == 9\n assert candidate(stones = [[0, 1], [1, 2], [2, 0], [2, 3], [3, 1], [3, 4], [4, 2], [4, 5], [5, 3]]) == 6\n assert candidate(stones = [[0, 0], [1, 2], [2, 1], [3, 3], [4, 4], [5, 6], [6, 5], [7, 7]]) == 0\n assert candidate(stones = [[10, 1], [11, 2], [12, 3], [13, 4], [14, 5], [15, 6], [16, 7], [17, 8], [18, 9], [19, 10], [10, 19], [11, 18], [12, 17], [13, 16], [14, 15]]) == 5\n assert candidate(stones = [[0, 0], [1, 0], [2, 0], [3, 0], [0, 1], [1, 1], [2, 1], [3, 1], [0, 2], [1, 2], [2, 2], [3, 2], [0, 3], [1, 3], [2, 3], [3, 3]]) == 15\n assert candidate(stones = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3], [4, 4], [4, 5], [4, 6], [5, 4], [5, 5], [5, 6], [6, 4], [6, 5], [6, 6]]) == 16\n assert candidate(stones = [[0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]) == 16\n assert candidate(stones = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3], [4, 1], [4, 2], [4, 3], [5, 1], [5, 2], [5, 3]]) == 14\n assert candidate(stones = [[0, 0], [0, 2], [1, 1], [2, 0], [2, 2], [2, 4], [3, 3], [4, 2], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 6\n assert candidate(stones = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0]]) == 7\n assert candidate(stones = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 0\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [0, 1], [1, 2], [2, 0], [3, 3], [4, 4], [5, 5], [3, 4], [4, 5], [5, 3]]) == 10\n assert candidate(stones = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 3], [3, 4], [4, 3], [4, 4]]) == 6\n assert candidate(stones = [[1, 1], [2, 1], [3, 1], [4, 1], [1, 2], [1, 3], [1, 4], [2, 2], [2, 3], [2, 4], [3, 2], [3, 3], [3, 4], [4, 2], [4, 3], [4, 4]]) == 15\n assert candidate(stones = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 2], [2, 0], [2, 1], [3, 3], [3, 4], [4, 3], [4, 4]]) == 9\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [0, 1], [1, 2], [2, 0], [1, 0], [0, 2], [2, 1]]) == 8\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 0\n assert candidate(stones = [[0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) == 8\n assert candidate(stones = [[0, 0], [0, 2], [1, 1], [2, 0], [2, 2], [3, 3], [3, 4], [4, 3], [4, 4], [5, 5], [5, 6], [6, 5], [6, 6]]) == 9\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == 20\n assert candidate(stones = [[0, 0], [1, 0], [2, 0], [0, 1], [1, 1], [2, 1], [0, 2], [1, 2], [2, 2], [1, 3], [2, 3], [3, 3]]) == 11\n assert candidate(stones = [[1, 1], [1, 2], [1, 3], [1, 4], [2, 1], [2, 2], [2, 3], [2, 4], [3, 1], [3, 2], [3, 3], [3, 4], [4, 1], [4, 2], [4, 3], [4, 4]]) == 15\n assert candidate(stones = [[0, 0], [1, 1], [0, 2], [1, 3], [0, 4], [1, 5], [0, 6], [1, 7]]) == 6\n assert candidate(stones = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 3], [3, 4], [3, 5], [4, 3], [4, 4], [4, 5], [5, 3], [5, 4], [5, 5]]) == 16\n assert candidate(stones = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 4], [4, 0], [0, 2], [2, 0], [2, 4], [4, 2], [0, 3], [3, 0], [3, 4], [4, 3]]) == 13\n"}, "metadata": {"canonical_parameter_names": ["stones"], "leetcode_dataset_entry_point": "Solution().removeStones", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var removeStones = function(stones) {", "container": null, "callable": "removeStones", "parameters": [{"name": "stones", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 948, "task_id": "bag-of-tokens", "difficulty": "Medium", "problem_description": "You start with an initial power of power, an initial score of 0, and a bag of tokens given as an integer array tokens, where each tokens[i] denotes the value of tokeni.\nYour goal is to maximize the total score by strategically playing these tokens. In one move, you can play an unplayed token in one of the two ways (but not both for the same token):\n\nFace-up: If your current power is at least tokens[i], you may play tokeni, losing tokens[i] power and gaining 1 score.\nFace-down: If your current score is at least 1, you may play tokeni, gaining tokens[i] power and losing 1 score.\n\nReturn the maximum possible score you can achieve after playing any number of tokens.\n \nExample 1:\n\nInput: tokens = [100], power = 50\nOutput: 0\nExplanation: Since your score is 0 initially, you cannot play the token face-down. You also cannot play it face-up since your power (50) is less than tokens[0] (100).\n\nExample 2:\n\nInput: tokens = [200,100], power = 150\nOutput: 1\nExplanation: Play token1 (100) face-up, reducing your power to 50 and increasing your score to 1.\nThere is no need to play token0, since you cannot play it face-up to add to your score. The maximum score achievable is 1.\n\nExample 3:\n\nInput: tokens = [100,200,300,400], power = 200\nOutput: 2\nExplanation: Play the tokens in this order to get a score of 2:\n\nPlay token0 (100) face-up, reducing power to 100 and increasing score to 1.\nPlay token3 (400) face-down, increasing power to 500 and reducing score to 0.\nPlay token1 (200) face-up, reducing power to 300 and increasing score to 1.\nPlay token2 (300) face-up, reducing power to 0 and increasing score to 2.\n\nThe maximum score achievable is 2.\n\n \nConstraints:\n\n0 <= tokens.length <= 1000\n0 <= tokens[i], power < 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(tokens = [100, 200, 300, 400],power = 200) == 2\n assert candidate(tokens = [100, 200, 300, 400],power = 100) == 1\n assert candidate(tokens = [71, 55, 82],power = 54) == 0\n assert candidate(tokens = [100, 200, 300, 400],power = 500) == 2\n assert candidate(tokens = [100],power = 50) == 0\n assert candidate(tokens = [],power = 0) == 0\n assert candidate(tokens = [50, 50, 50, 50, 50],power = 150) == 3\n assert candidate(tokens = [100, 200, 300, 400, 500],power = 250) == 2\n assert candidate(tokens = [50, 100, 150, 200, 250],power = 200) == 2\n assert candidate(tokens = [80, 90, 95],power = 100) == 1\n assert candidate(tokens = [100, 150, 200, 250, 300],power = 100) == 1\n assert candidate(tokens = [100, 200, 300, 400, 500],power = 300) == 2\n assert candidate(tokens = [],power = 1000) == 0\n assert candidate(tokens = [1000, 2000, 3000, 4000],power = 1500) == 1\n assert candidate(tokens = [1, 2, 3, 4, 5],power = 3) == 2\n assert candidate(tokens = [100, 200, 300, 400],power = 300) == 2\n assert candidate(tokens = [200, 100],power = 150) == 1\n assert candidate(tokens = [50, 100, 150, 200, 250],power = 200) == 2\n assert candidate(tokens = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],power = 5) == 5\n assert candidate(tokens = [50, 50, 50, 50],power = 150) == 3\n assert candidate(tokens = [71, 55, 82],power = 54) == 0\n assert candidate(tokens = [500],power = 1000) == 1\n assert candidate(tokens = [200, 100],power = 150) == 1\n assert candidate(tokens = [75, 150, 225, 300, 375, 450],power = 225) == 2\n assert candidate(tokens = [5, 10, 15, 20],power = 50) == 4\n assert candidate(tokens = [],power = 100) == 0\n assert candidate(tokens = [7, 8, 9, 10, 11],power = 20) == 2\n assert candidate(tokens = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],power = 0) == 0\n assert candidate(tokens = [100, 100, 100, 100, 100, 100],power = 300) == 3\n assert candidate(tokens = [1, 2, 3, 4, 5],power = 5) == 3\n assert candidate(tokens = [100, 100, 100, 100],power = 300) == 3\n assert candidate(tokens = [100, 200, 300, 400],power = 400) == 2\n assert candidate(tokens = [100, 200, 300, 400],power = 200) == 2\n assert candidate(tokens = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],power = 10) == 3\n assert candidate(tokens = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],power = 250) == 4\n assert candidate(tokens = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],power = 1500) == 16\n assert candidate(tokens = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100],power = 500) == 4\n assert candidate(tokens = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],power = 500) == 9\n assert candidate(tokens = [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000],power = 1000) == 8\n assert candidate(tokens = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],power = 200) == 6\n assert candidate(tokens = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],power = 30) == 7\n assert candidate(tokens = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],power = 550) == 4\n assert candidate(tokens = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],power = 50) == 4\n assert candidate(tokens = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100],power = 5000) == 9\n assert candidate(tokens = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],power = 10) == 6\n assert candidate(tokens = [25, 50, 75, 100, 125, 150, 175, 200],power = 100) == 3\n assert candidate(tokens = [25, 50, 75, 100, 125, 150, 175, 200, 225, 250],power = 100) == 4\n assert candidate(tokens = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71],power = 100) == 11\n assert candidate(tokens = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],power = 1000) == 14\n assert candidate(tokens = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],power = 5) == 5\n assert candidate(tokens = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990],power = 10000) == 1\n assert candidate(tokens = [1, 10, 100, 1000, 10000, 100000],power = 50000) == 5\n assert candidate(tokens = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100],power = 1500) == 5\n assert candidate(tokens = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],power = 75) == 9\n assert candidate(tokens = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024],power = 1000) == 9\n assert candidate(tokens = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],power = 100) == 13\n assert candidate(tokens = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105],power = 100) == 5\n assert candidate(tokens = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100],power = 1000) == 5\n assert candidate(tokens = [5, 10, 20, 25, 50, 100],power = 55) == 4\n assert candidate(tokens = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],power = 50) == 4\n assert candidate(tokens = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],power = 1024) == 10\n assert candidate(tokens = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100],power = 500) == 5\n assert candidate(tokens = [5, 7, 8, 10, 12],power = 15) == 2\n assert candidate(tokens = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],power = 25) == 5\n assert candidate(tokens = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],power = 1000) == 9\n assert candidate(tokens = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],power = 10) == 8\n assert candidate(tokens = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2],power = 10) == 5\n assert candidate(tokens = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],power = 250) == 6\n assert candidate(tokens = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],power = 100) == 4\n assert candidate(tokens = [100, 200, 300, 400, 500],power = 1) == 0\n assert candidate(tokens = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],power = 75) == 6\n assert candidate(tokens = [300, 200, 100, 400, 500],power = 250) == 2\n assert candidate(tokens = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50],power = 200) == 4\n assert candidate(tokens = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],power = 10) == 9\n assert candidate(tokens = [500, 400, 300, 200, 100, 50, 25, 10],power = 1000) == 6\n assert candidate(tokens = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024],power = 1023) == 10\n assert candidate(tokens = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],power = 500) == 4\n assert candidate(tokens = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75],power = 250) == 10\n assert candidate(tokens = [90, 95, 100, 105, 110, 115, 120, 125, 130, 135],power = 100) == 1\n assert candidate(tokens = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],power = 70) == 6\n assert candidate(tokens = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],power = 100) == 6\n assert candidate(tokens = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],power = 100) == 11\n assert candidate(tokens = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],power = 15) == 5\n assert candidate(tokens = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],power = 50) == 11\n assert candidate(tokens = [300, 200, 100, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200],power = 500) == 5\n assert candidate(tokens = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],power = 1000) == 13\n assert candidate(tokens = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],power = 20) == 7\n assert candidate(tokens = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],power = 10) == 4\n assert candidate(tokens = [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20],power = 200) == 10\n assert candidate(tokens = [1, 10, 100, 1000, 10000],power = 5000) == 4\n assert candidate(tokens = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],power = 10) == 4\n assert candidate(tokens = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],power = 100) == 14\n assert candidate(tokens = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],power = 100) == 6\n assert candidate(tokens = [99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110],power = 100) == 1\n assert candidate(tokens = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],power = 150) == 5\n assert candidate(tokens = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],power = 5) == 4\n assert candidate(tokens = [300, 200, 400, 100, 500],power = 250) == 2\n assert candidate(tokens = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],power = 25) == 6\n assert candidate(tokens = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100],power = 300) == 4\n assert candidate(tokens = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],power = 15) == 6\n assert candidate(tokens = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50],power = 200) == 4\n assert candidate(tokens = [500, 200, 300, 100, 400, 600, 700, 800, 900, 1000],power = 400) == 4\n assert candidate(tokens = [300, 200, 100, 400, 500, 600],power = 350) == 2\n"}, "metadata": {"canonical_parameter_names": ["tokens", "power"], "leetcode_dataset_entry_point": "Solution().bagOfTokensScore", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var bagOfTokensScore = function(tokens, power) {", "container": null, "callable": "bagOfTokensScore", "parameters": [{"name": "tokens", "type": "number[]"}, {"name": "power", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 949, "task_id": "largest-time-for-given-digits", "difficulty": "Medium", "problem_description": "Given an array arr of 4 digits, find the latest 24-hour time that can be made using each digit exactly once.\n24-hour times are formatted as \"HH:MM\", where HH is between 00 and 23, and MM is between 00 and 59. The earliest 24-hour time is 00:00, and the latest is 23:59.\nReturn the latest 24-hour time in \"HH:MM\" format. If no valid time can be made, return an empty string.\n \nExample 1:\n\nInput: arr = [1,2,3,4]\nOutput: \"23:41\"\nExplanation: The valid 24-hour times are \"12:34\", \"12:43\", \"13:24\", \"13:42\", \"14:23\", \"14:32\", \"21:34\", \"21:43\", \"23:14\", and \"23:41\". Of these times, \"23:41\" is the latest.\n\nExample 2:\n\nInput: arr = [5,5,5,5]\nOutput: \"\"\nExplanation: There are no valid 24-hour times as \"55:55\" is not valid.\n\n \nConstraints:\n\narr.length == 4\n0 <= arr[i] <= 9\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [2, 9, 0, 3]) == \"23:09\"\n assert candidate(arr = [1, 9, 6, 0]) == \"19:06\"\n assert candidate(arr = [0, 2, 6, 6]) == \"06:26\"\n assert candidate(arr = [4, 2, 4, 4]) == \"\"\n assert candidate(arr = [2, 2, 9, 6]) == \"\"\n assert candidate(arr = [2, 3, 5, 9]) == \"23:59\"\n assert candidate(arr = [4, 2, 0, 0]) == \"20:40\"\n assert candidate(arr = [1, 9, 9, 9]) == \"\"\n assert candidate(arr = [9, 1, 6, 0]) == \"19:06\"\n assert candidate(arr = [1, 9, 6, 3]) == \"19:36\"\n assert candidate(arr = [5, 5, 5, 5]) == \"\"\n assert candidate(arr = [2, 0, 6, 6]) == \"06:26\"\n assert candidate(arr = [1, 2, 3, 4]) == \"23:41\"\n assert candidate(arr = [0, 4, 0, 0]) == \"04:00\"\n assert candidate(arr = [0, 1, 5, 9]) == \"19:50\"\n assert candidate(arr = [0, 0, 1, 0]) == \"10:00\"\n assert candidate(arr = [0, 9, 5, 7]) == \"09:57\"\n assert candidate(arr = [0, 0, 0, 0]) == \"00:00\"\n assert candidate(arr = [3, 9, 5, 6]) == \"\"\n assert candidate(arr = [1, 9, 6, 8]) == \"\"\n assert candidate(arr = [9, 6, 3, 2]) == \"\"\n assert candidate(arr = [5, 0, 7, 0]) == \"07:50\"\n assert candidate(arr = [3, 0, 7, 0]) == \"07:30\"\n assert candidate(arr = [1, 3, 5, 7]) == \"17:53\"\n assert candidate(arr = [9, 9, 9, 0]) == \"\"\n assert candidate(arr = [9, 0, 4, 3]) == \"09:43\"\n assert candidate(arr = [9, 0, 8, 7]) == \"\"\n assert candidate(arr = [9, 9, 8, 8]) == \"\"\n assert candidate(arr = [1, 2, 8, 9]) == \"19:28\"\n assert candidate(arr = [1, 2, 3, 3]) == \"23:31\"\n assert candidate(arr = [4, 2, 6, 9]) == \"\"\n assert candidate(arr = [2, 2, 3, 4]) == \"23:42\"\n assert candidate(arr = [2, 2, 3, 3]) == \"23:32\"\n assert candidate(arr = [3, 4, 9, 1]) == \"19:43\"\n assert candidate(arr = [2, 9, 3, 4]) == \"23:49\"\n assert candidate(arr = [5, 0, 9, 2]) == \"20:59\"\n assert candidate(arr = [2, 9, 5, 1]) == \"21:59\"\n assert candidate(arr = [6, 6, 6, 6]) == \"\"\n assert candidate(arr = [2, 4, 0, 6]) == \"20:46\"\n assert candidate(arr = [2, 2, 2, 2]) == \"22:22\"\n assert candidate(arr = [4, 5, 9, 8]) == \"\"\n assert candidate(arr = [3, 9, 1, 0]) == \"19:30\"\n assert candidate(arr = [2, 2, 4, 4]) == \"22:44\"\n assert candidate(arr = [0, 1, 2, 3]) == \"23:10\"\n assert candidate(arr = [4, 1, 4, 0]) == \"14:40\"\n assert candidate(arr = [1, 1, 1, 1]) == \"11:11\"\n assert candidate(arr = [8, 4, 2, 1]) == \"21:48\"\n assert candidate(arr = [0, 4, 2, 3]) == \"23:40\"\n assert candidate(arr = [2, 9, 0, 5]) == \"20:59\"\n assert candidate(arr = [3, 8, 4, 1]) == \"18:43\"\n assert candidate(arr = [3, 8, 4, 7]) == \"\"\n assert candidate(arr = [2, 3, 0, 3]) == \"23:30\"\n assert candidate(arr = [3, 5, 0, 7]) == \"07:53\"\n assert candidate(arr = [2, 3, 0, 0]) == \"23:00\"\n assert candidate(arr = [2, 4, 0, 0]) == \"20:40\"\n assert candidate(arr = [1, 2, 5, 9]) == \"21:59\"\n assert candidate(arr = [3, 9, 4, 0]) == \"09:43\"\n assert candidate(arr = [1, 1, 9, 9]) == \"19:19\"\n assert candidate(arr = [1, 8, 8, 8]) == \"\"\n assert candidate(arr = [1, 8, 4, 6]) == \"18:46\"\n assert candidate(arr = [1, 0, 7, 6]) == \"17:06\"\n assert candidate(arr = [2, 0, 6, 4]) == \"20:46\"\n assert candidate(arr = [5, 8, 5, 8]) == \"\"\n assert candidate(arr = [2, 3, 4, 5]) == \"23:54\"\n assert candidate(arr = [8, 7, 7, 9]) == \"\"\n assert candidate(arr = [1, 1, 1, 2]) == \"21:11\"\n assert candidate(arr = [2, 7, 6, 0]) == \"07:26\"\n assert candidate(arr = [0, 2, 6, 4]) == \"20:46\"\n assert candidate(arr = [4, 1, 4, 2]) == \"21:44\"\n assert candidate(arr = [0, 0, 1, 2]) == \"21:00\"\n assert candidate(arr = [5, 9, 5, 9]) == \"\"\n assert candidate(arr = [2, 3, 6, 8]) == \"\"\n assert candidate(arr = [0, 7, 6, 6]) == \"\"\n assert candidate(arr = [4, 1, 3, 5]) == \"15:43\"\n assert candidate(arr = [8, 5, 9, 0]) == \"09:58\"\n assert candidate(arr = [7, 6, 4, 0]) == \"07:46\"\n assert candidate(arr = [2, 3, 2, 3]) == \"23:32\"\n assert candidate(arr = [0, 9, 0, 9]) == \"09:09\"\n assert candidate(arr = [7, 9, 5, 2]) == \"\"\n assert candidate(arr = [1, 0, 0, 0]) == \"10:00\"\n assert candidate(arr = [0, 3, 5, 5]) == \"05:53\"\n assert candidate(arr = [3, 8, 4, 5]) == \"\"\n assert candidate(arr = [0, 5, 9, 6]) == \"09:56\"\n assert candidate(arr = [0, 0, 0, 1]) == \"10:00\"\n assert candidate(arr = [5, 8, 5, 9]) == \"\"\n assert candidate(arr = [1, 1, 1, 1]) == \"11:11\"\n assert candidate(arr = [8, 8, 8, 8]) == \"\"\n assert candidate(arr = [2, 4, 6, 8]) == \"\"\n assert candidate(arr = [3, 3, 3, 3]) == \"\"\n assert candidate(arr = [1, 8, 7, 7]) == \"\"\n assert candidate(arr = [6, 8, 5, 4]) == \"\"\n assert candidate(arr = [6, 6, 9, 0]) == \"\"\n assert candidate(arr = [2, 2, 2, 2]) == \"22:22\"\n assert candidate(arr = [7, 8, 6, 1]) == \"\"\n assert candidate(arr = [5, 3, 6, 0]) == \"06:53\"\n assert candidate(arr = [0, 3, 5, 9]) == \"09:53\"\n assert candidate(arr = [3, 0, 7, 0]) == \"07:30\"\n assert candidate(arr = [5, 9, 6, 4]) == \"\"\n assert candidate(arr = [0, 9, 3, 5]) == \"09:53\"\n assert candidate(arr = [7, 7, 7, 7]) == \"\"\n assert candidate(arr = [2, 3, 3, 2]) == \"23:32\"\n assert candidate(arr = [5, 9, 6, 3]) == \"\"\n assert candidate(arr = [0, 9, 1, 1]) == \"19:10\"\n assert candidate(arr = [5, 0, 5, 2]) == \"20:55\"\n assert candidate(arr = [3, 3, 3, 3]) == \"\"\n assert candidate(arr = [0, 5, 5, 9]) == \"09:55\"\n assert candidate(arr = [1, 2, 8, 9]) == \"19:28\"\n assert candidate(arr = [2, 2, 1, 1]) == \"22:11\"\n assert candidate(arr = [1, 2, 3, 0]) == \"23:10\"\n assert candidate(arr = [0, 4, 0, 0]) == \"04:00\"\n assert candidate(arr = [3, 3, 0, 1]) == \"13:30\"\n assert candidate(arr = [6, 1, 4, 2]) == \"21:46\"\n assert candidate(arr = [0, 4, 4, 5]) == \"05:44\"\n assert candidate(arr = [9, 0, 0, 0]) == \"09:00\"\n assert candidate(arr = [0, 0, 1, 1]) == \"11:00\"\n assert candidate(arr = [5, 6, 7, 8]) == \"\"\n assert candidate(arr = [1, 2, 9, 0]) == \"21:09\"\n assert candidate(arr = [3, 3, 4, 5]) == \"\"\n assert candidate(arr = [9, 9, 9, 9]) == \"\"\n assert candidate(arr = [5, 2, 8, 9]) == \"\"\n assert candidate(arr = [9, 8, 7, 6]) == \"\"\n assert candidate(arr = [9, 9, 9, 9]) == \"\"\n assert candidate(arr = [0, 1, 7, 7]) == \"17:07\"\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().largestTimeFromDigits", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var largestTimeFromDigits = function(arr) {", "container": null, "callable": "largestTimeFromDigits", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 950, "task_id": "reveal-cards-in-increasing-order", "difficulty": "Medium", "problem_description": "You are given an integer array deck. There is a deck of cards where every card has a unique integer. The integer on the ith card is deck[i].\nYou can order the deck in any order you want. Initially, all the cards start face down (unrevealed) in one deck.\nYou will do the following steps repeatedly until all cards are revealed:\n\nTake the top card of the deck, reveal it, and take it out of the deck.\nIf there are still cards in the deck then put the next top card of the deck at the bottom of the deck.\nIf there are still unrevealed cards, go back to step 1. Otherwise, stop.\n\nReturn an ordering of the deck that would reveal the cards in increasing order.\nNote that the first entry in the answer is considered to be the top of the deck.\n \nExample 1:\n\nInput: deck = [17,13,11,2,3,5,7]\nOutput: [2,13,3,11,5,17,7]\nExplanation: \nWe get the deck in the order [17,13,11,2,3,5,7] (this order does not matter), and reorder it.\nAfter reordering, the deck starts as [2,13,3,11,5,17,7], where 2 is the top of the deck.\nWe reveal 2, and move 13 to the bottom. The deck is now [3,11,5,17,7,13].\nWe reveal 3, and move 11 to the bottom. The deck is now [5,17,7,13,11].\nWe reveal 5, and move 17 to the bottom. The deck is now [7,13,11,17].\nWe reveal 7, and move 13 to the bottom. The deck is now [11,17,13].\nWe reveal 11, and move 17 to the bottom. The deck is now [13,17].\nWe reveal 13, and move 17 to the bottom. The deck is now [17].\nWe reveal 17.\nSince all the cards revealed are in increasing order, the answer is correct.\n\nExample 2:\n\nInput: deck = [1,1000]\nOutput: [1,1000]\n\n \nConstraints:\n\n1 <= deck.length <= 1000\n1 <= deck[i] <= 106\nAll the values of deck are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(deck = [10, 1, 6, 7, 8, 2, 3, 4, 5, 9]) == [1, 6, 2, 10, 3, 7, 4, 9, 5, 8]\n assert candidate(deck = [5, 2, 3, 1, 4]) == [1, 5, 2, 4, 3]\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 6, 2, 10, 3, 7, 4, 9, 5, 8]\n assert candidate(deck = [1, 1000]) == [1, 1000]\n assert candidate(deck = [2, 14, 19, 3, 17, 13, 11, 5, 7]) == [2, 19, 3, 13, 5, 17, 7, 14, 11]\n assert candidate(deck = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 6, 2, 10, 3, 7, 4, 9, 5, 8]\n assert candidate(deck = [5, 4, 3, 2, 1]) == [1, 5, 2, 4, 3]\n assert candidate(deck = [10]) == [10]\n assert candidate(deck = [17, 13, 11, 2, 3, 5, 7]) == [2, 13, 3, 11, 5, 17, 7]\n assert candidate(deck = [3, 2, 1]) == [1, 3, 2]\n assert candidate(deck = [5, 2, 9, 1, 10, 3, 7, 8, 6, 4]) == [1, 6, 2, 10, 3, 7, 4, 9, 5, 8]\n assert candidate(deck = [5]) == [5]\n assert candidate(deck = [2, 14, 4, 13, 1, 6, 7, 10, 3, 8, 11, 12, 9, 5]) == [1, 8, 2, 13, 3, 9, 4, 12, 5, 10, 6, 14, 7, 11]\n assert candidate(deck = [1, 2, 3, 4, 5]) == [1, 5, 2, 4, 3]\n assert candidate(deck = [8, 6, 4, 2, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34]) == [2, 34, 4, 20, 6, 28, 8, 22, 10, 32, 12, 24, 14, 30, 16, 26, 18]\n assert candidate(deck = [500, 250, 750, 375, 875, 125, 625, 312, 937, 187, 468, 974, 25, 687, 343]) == [25, 750, 125, 500, 187, 937, 250, 625, 312, 875, 343, 687, 375, 974, 468]\n assert candidate(deck = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 51, 2, 76, 3, 52, 4, 99, 5, 53, 6, 77, 7, 54, 8, 89, 9, 55, 10, 78, 11, 56, 12, 95, 13, 57, 14, 79, 15, 58, 16, 90, 17, 59, 18, 80, 19, 60, 20, 98, 21, 61, 22, 81, 23, 62, 24, 91, 25, 63, 26, 82, 27, 64, 28, 96, 29, 65, 30, 83, 31, 66, 32, 92, 33, 67, 34, 84, 35, 68, 36, 100, 37, 69, 38, 85, 39, 70, 40, 93, 41, 71, 42, 86, 43, 72, 44, 97, 45, 73, 46, 87, 47, 74, 48, 94, 49, 75, 50, 88]\n assert candidate(deck = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 5, 1, 0, 5, 8, 2, 0, 9, 7, 4, 9, 4, 4, 5, 9, 2, 3, 0, 7, 8, 1, 6, 4, 0, 6, 2, 8, 6, 2, 0, 4, 9, 0]) == [0, 9, 0, 5, 0, 8, 0, 5, 0, 9, 0, 5, 0, 8, 1, 5, 1, 9, 1, 5, 1, 8, 1, 5, 1, 9, 2, 5, 2, 8, 2, 6, 2, 9, 2, 6, 2, 8, 2, 6, 2, 9, 2, 6, 3, 8, 3, 6, 3, 9, 3, 6, 3, 8, 3, 6, 3, 9, 3, 7, 3, 8, 3, 7, 4, 9, 4, 7, 4, 9, 4, 7, 4, 9, 4, 7, 4, 9, 4, 7, 4]\n assert candidate(deck = [47, 101, 23, 79, 61, 89, 31, 59, 29, 43, 13, 71, 83, 53, 11, 17, 19, 37, 41, 67, 97]) == [11, 89, 13, 53, 17, 79, 19, 59, 23, 101, 29, 61, 31, 83, 37, 67, 41, 97, 43, 71, 47]\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52]) == [1, 27, 2, 40, 3, 28, 4, 51, 5, 29, 6, 41, 7, 30, 8, 47, 9, 31, 10, 42, 11, 32, 12, 50, 13, 33, 14, 43, 15, 34, 16, 48, 17, 35, 18, 44, 19, 36, 20, 52, 21, 37, 22, 45, 23, 38, 24, 49, 25, 39, 26, 46]\n assert candidate(deck = [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 15, 2, 11, 3, 19, 4, 12, 5, 16, 6, 13, 7, 18, 8, 14, 9, 17, 10]\n assert candidate(deck = [34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657]) == [34, 6765, 55, 1597, 89, 17711, 144, 2584, 233, 10946, 377, 4181, 610, 28657, 987]\n assert candidate(deck = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == [10, 60, 20, 100, 30, 70, 40, 90, 50, 80]\n assert candidate(deck = [41, 59, 37, 43, 19, 23, 29, 31, 53, 61, 7, 11, 13, 17, 2, 8]) == [2, 29, 7, 43, 8, 31, 11, 59, 13, 37, 17, 53, 19, 41, 23, 61]\n assert candidate(deck = [5, 1, 9, 14, 3, 10, 12, 7, 6, 8, 4, 13, 11, 15, 2]) == [1, 12, 2, 9, 3, 14, 4, 10, 5, 13, 6, 11, 7, 15, 8]\n assert candidate(deck = [3, 2, 1, 6, 5, 4, 9, 8, 7]) == [1, 9, 2, 6, 3, 8, 4, 7, 5]\n assert candidate(deck = [101, 202, 303, 404, 505, 606, 707, 808, 909, 1010, 1111, 1212, 1313, 1414, 1515, 1616, 1717, 1818, 1919, 2020]) == [101, 1111, 202, 1616, 303, 1212, 404, 2020, 505, 1313, 606, 1717, 707, 1414, 808, 1919, 909, 1515, 1010, 1818]\n assert candidate(deck = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000]) == [100, 1100, 200, 1600, 300, 1200, 400, 2000, 500, 1300, 600, 1700, 700, 1400, 800, 1900, 900, 1500, 1000, 1800]\n assert candidate(deck = [29, 1, 43, 23, 5, 19, 31, 7, 3, 11, 13, 17, 18, 2, 21, 25, 27, 37, 41]) == [1, 29, 2, 21, 3, 43, 5, 23, 7, 31, 11, 25, 13, 41, 17, 27, 18, 37, 19]\n assert candidate(deck = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155]) == [5, 85, 15, 125, 25, 95, 35, 145, 45, 105, 55, 135, 65, 115, 75, 155]\n assert candidate(deck = [9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99]) == [9, 81, 18, 63, 27, 99, 36, 72, 45, 90, 54]\n assert candidate(deck = [50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 8, 2, 40, 3, 9, 4, 30, 5, 10, 6, 50, 7, 20]\n assert candidate(deck = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == [100, 1200, 200, 900, 300, 1400, 400, 1000, 500, 1300, 600, 1100, 700, 1500, 800]\n assert candidate(deck = [51, 78, 9, 7, 60, 69, 21, 68, 64, 12, 24, 81, 70, 55, 4, 49, 35, 34, 63, 27, 95, 59, 72, 3, 32, 33, 29, 65, 48, 19, 6, 56, 97, 94, 57, 85, 5, 92, 77, 22, 14, 67, 16, 91, 30, 76, 52, 83, 82, 44, 41, 89, 99, 90, 39, 26, 75, 88, 8, 96, 18, 46, 45, 71, 98, 74, 43, 54, 87, 25, 38, 1, 47, 31, 28, 23, 73, 66, 86, 84, 20, 11, 53, 37, 62, 93, 79, 17, 42, 13, 58, 100, 50, 15, 80, 10, 2, 61]) == [1, 52, 2, 99, 3, 53, 4, 77, 5, 54, 6, 89, 7, 55, 8, 78, 9, 56, 10, 95, 11, 57, 12, 79, 13, 58, 14, 90, 15, 59, 16, 80, 17, 60, 18, 98, 19, 61, 20, 81, 21, 62, 22, 91, 23, 63, 24, 82, 25, 64, 26, 96, 27, 65, 28, 83, 29, 66, 30, 92, 31, 67, 32, 84, 33, 68, 34, 100, 35, 69, 37, 85, 38, 70, 39, 93, 41, 71, 42, 86, 43, 72, 44, 97, 45, 73, 46, 87, 47, 74, 48, 94, 49, 75, 50, 88, 51, 76]\n assert candidate(deck = [47, 23, 69, 145, 82, 164, 91, 183, 99, 198, 106, 205, 113, 212, 120, 221, 127, 228, 134, 235, 140, 241, 146, 246, 152, 251, 158, 257, 164, 262, 170, 268, 176, 274, 182, 279, 188, 285, 194, 291, 200, 296, 206, 302, 212, 308, 218, 314, 224, 320, 230, 326, 236, 332, 242, 338, 248, 344, 254, 350, 260, 356, 266, 362, 272, 368, 278, 374, 284, 380, 290, 386, 296, 392, 302, 398, 308, 404, 314, 410, 320, 416, 326, 422, 332, 428, 338, 434, 344, 440, 350, 446, 356, 452, 362, 458, 368, 464, 374, 470, 380, 476, 386, 482, 392, 488, 404, 494, 410, 500]) == [23, 291, 47, 422, 69, 296, 82, 374, 91, 296, 99, 464, 106, 302, 113, 380, 120, 302, 127, 428, 134, 308, 140, 380, 145, 308, 146, 494, 152, 314, 158, 386, 164, 314, 164, 434, 170, 320, 176, 386, 182, 320, 183, 470, 188, 326, 194, 392, 198, 326, 200, 440, 205, 332, 206, 392, 212, 332, 212, 488, 218, 338, 221, 398, 224, 338, 228, 446, 230, 344, 235, 404, 236, 344, 241, 476, 242, 350, 246, 404, 248, 350, 251, 452, 254, 356, 257, 410, 260, 356, 262, 500, 266, 362, 268, 410, 272, 362, 274, 458, 278, 368, 279, 416, 284, 368, 285, 482, 290, 374]\n assert candidate(deck = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980]) == [980, 990, 981, 995, 982, 991, 983, 999, 984, 992, 985, 996, 986, 993, 987, 998, 988, 994, 989, 997]\n assert candidate(deck = [19, 38, 57, 76, 95, 114, 133, 152, 171, 190, 209, 228, 247, 266, 285, 304, 323, 342, 361, 380, 399, 418, 437, 456, 475, 494]) == [19, 266, 38, 475, 57, 285, 76, 399, 95, 304, 114, 456, 133, 323, 152, 418, 171, 342, 190, 494, 209, 361, 228, 437, 247, 380]\n assert candidate(deck = [3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99]) == [3, 95, 7, 55, 11, 79, 15, 59, 19, 91, 23, 63, 27, 83, 31, 67, 35, 99, 39, 71, 43, 87, 47, 75, 51]\n assert candidate(deck = [23, 17, 11, 2, 3, 5, 7, 13, 19]) == [2, 23, 3, 13, 5, 19, 7, 17, 11]\n assert candidate(deck = [25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205, 215]) == [25, 125, 35, 175, 45, 135, 55, 215, 65, 145, 75, 185, 85, 155, 95, 205, 105, 165, 115, 195]\n assert candidate(deck = [23, 5, 3, 17, 11, 7, 13, 19, 2, 29, 31, 41, 43, 53, 61, 67, 71]) == [2, 71, 3, 29, 5, 53, 7, 31, 11, 67, 13, 41, 17, 61, 19, 43, 23]\n assert candidate(deck = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 26, 2, 49, 3, 27, 4, 39, 5, 28, 6, 45, 7, 29, 8, 40, 9, 30, 10, 48, 11, 31, 12, 41, 13, 32, 14, 46, 15, 33, 16, 42, 17, 34, 18, 50, 19, 35, 20, 43, 21, 36, 22, 47, 23, 37, 24, 44, 25, 38]\n assert candidate(deck = [3, 5, 1, 7, 9, 2, 8, 6, 4]) == [1, 9, 2, 6, 3, 8, 4, 7, 5]\n assert candidate(deck = [23, 47, 2, 19, 31, 53, 7, 13, 41, 59, 11, 61, 17, 29, 37, 43]) == [2, 31, 7, 47, 11, 37, 13, 59, 17, 41, 19, 53, 23, 43, 29, 61]\n assert candidate(deck = [30, 20, 10, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == [10, 110, 20, 160, 30, 120, 40, 200, 50, 130, 60, 170, 70, 140, 80, 190, 90, 150, 100, 180]\n assert candidate(deck = [83, 91, 100, 93, 28, 45, 34, 39, 35, 60, 87, 98, 27, 32, 54, 10, 80, 12, 19, 61, 63, 53, 85, 88, 18, 8, 36, 21, 82, 59, 46, 95, 58, 99, 2, 24, 42, 86, 69, 50, 20, 17, 4, 72, 49, 15, 31, 90, 67, 64, 29, 70, 3, 68, 75, 84, 79, 55, 92, 71, 96, 37, 65, 22, 57, 97, 47, 13, 81, 74, 52, 77, 26, 56, 40, 73, 78, 94, 76, 14, 41, 5, 89, 66, 11, 16, 62, 48, 38, 9, 51, 30, 33, 1]) == [1, 54, 2, 89, 3, 55, 4, 78, 5, 56, 8, 95, 9, 57, 10, 79, 11, 58, 12, 90, 13, 59, 14, 80, 15, 60, 16, 98, 17, 61, 18, 81, 19, 62, 20, 91, 21, 63, 22, 82, 24, 64, 26, 96, 27, 65, 28, 83, 29, 66, 30, 92, 31, 67, 32, 84, 33, 68, 34, 100, 35, 69, 36, 85, 37, 70, 38, 93, 39, 71, 40, 86, 41, 72, 42, 97, 45, 73, 46, 87, 47, 74, 48, 94, 49, 75, 50, 88, 51, 76, 52, 99, 53, 77]\n assert candidate(deck = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]) == [2, 89, 3, 43, 5, 71, 7, 47, 11, 83, 13, 53, 17, 73, 19, 59, 23, 97, 29, 61, 31, 79, 37, 67, 41]\n assert candidate(deck = [33, 29, 23, 19, 17, 13, 11, 7, 5, 2, 3, 21, 31, 41, 53, 67, 83, 97, 101, 103]) == [2, 29, 3, 67, 5, 31, 7, 103, 11, 33, 13, 83, 17, 41, 19, 101, 21, 53, 23, 97]\n assert candidate(deck = [829, 821, 811, 809, 797, 787, 773, 769, 761, 751, 743, 733, 727, 719, 709, 691, 683, 677, 673, 661, 659, 653, 647, 643, 641, 631, 619, 617, 613, 607, 599, 593, 587, 577, 571, 569, 563, 557, 547, 541, 523, 521, 509, 503, 499, 491, 487, 83]) == [83, 643, 487, 733, 491, 647, 499, 787, 503, 653, 509, 743, 521, 659, 523, 811, 541, 661, 547, 751, 557, 673, 563, 797, 569, 677, 571, 761, 577, 683, 587, 829, 593, 691, 599, 769, 607, 709, 613, 809, 617, 719, 619, 773, 631, 727, 641, 821]\n assert candidate(deck = [5, 3, 8, 6, 2, 7, 4, 1, 9]) == [1, 9, 2, 6, 3, 8, 4, 7, 5]\n assert candidate(deck = [47, 35, 29, 11, 19, 23, 2, 31, 3, 41, 5, 17, 13, 7, 43]) == [2, 35, 3, 23, 5, 43, 7, 29, 11, 41, 13, 31, 17, 47, 19]\n assert candidate(deck = [19, 2, 31, 45, 6, 11, 8, 27, 3, 14, 18, 23, 37, 41, 5, 17, 29, 33, 39, 47]) == [2, 23, 3, 37, 5, 27, 6, 47, 8, 29, 11, 39, 14, 31, 17, 45, 18, 33, 19, 41]\n assert candidate(deck = [47, 29, 18, 63, 41, 35, 22, 58, 30, 7, 54, 67, 8, 4, 6, 37, 3, 26, 31, 15, 13, 27, 62, 55, 33, 23, 57, 12, 43, 59, 20, 50, 65, 9, 39, 60, 61, 45, 21, 38, 32, 44, 16, 24, 51, 48, 49, 68, 56, 53, 10, 46, 42, 25, 14, 5, 11, 19, 40, 28, 17, 34, 36, 52]) == [3, 35, 4, 51, 5, 36, 6, 59, 7, 37, 8, 52, 9, 38, 10, 63, 11, 39, 12, 53, 13, 40, 14, 60, 15, 41, 16, 54, 17, 42, 18, 67, 19, 43, 20, 55, 21, 44, 22, 61, 23, 45, 24, 56, 25, 46, 26, 65, 27, 47, 28, 57, 29, 48, 30, 62, 31, 49, 32, 58, 33, 50, 34, 68]\n assert candidate(deck = [26, 34, 30, 38, 22, 42, 28, 46, 18, 48, 24, 50, 32, 52, 20, 54, 36, 56, 25, 58, 31, 60, 37, 62, 23, 64, 39, 66, 21, 68, 43, 70, 29, 72, 45, 74, 19, 76, 47, 78, 27, 80, 49, 82, 26, 84, 51, 86, 30, 88, 53, 90, 32, 92, 55, 94, 34, 96, 57, 98, 36, 100, 59, 102, 38, 104, 61, 106, 40, 108, 63, 110, 42, 112, 65, 114, 44, 116, 67, 118, 46, 120, 69, 122, 48, 124, 71, 126, 50, 128, 73, 130, 52, 132, 75, 134, 54, 136, 77, 138, 56, 140, 79, 142, 58, 144, 81, 146, 60, 148, 83, 150, 62, 152, 85, 154, 64, 156, 87, 158, 66, 160, 89, 162, 68, 164, 91, 166, 70, 168, 93, 170, 72, 172, 95, 174, 74, 176, 97, 178, 76, 180, 99, 182, 78, 184, 101, 186, 80, 188, 103, 190, 82, 192, 105, 194, 84, 196, 107, 198, 86, 200, 109, 202, 88, 204, 111, 206, 90, 208, 113, 210]) == [18, 82, 19, 126, 20, 82, 21, 190, 22, 83, 23, 128, 24, 84, 25, 170, 26, 84, 26, 130, 27, 85, 28, 206, 29, 86, 30, 132, 30, 86, 31, 172, 32, 87, 32, 134, 34, 88, 34, 192, 36, 88, 36, 136, 37, 89, 38, 174, 38, 90, 39, 138, 40, 90, 42, 202, 42, 91, 43, 140, 44, 92, 45, 176, 46, 93, 46, 142, 47, 94, 48, 194, 48, 95, 49, 144, 50, 96, 50, 178, 51, 97, 52, 146, 52, 98, 53, 210, 54, 99, 54, 148, 55, 100, 56, 180, 56, 101, 57, 150, 58, 102, 58, 196, 59, 103, 60, 152, 60, 104, 61, 182, 62, 105, 62, 154, 63, 106, 64, 204, 64, 107, 65, 156, 66, 108, 66, 184, 67, 109, 68, 158, 68, 110, 69, 198, 70, 111, 70, 160, 71, 112, 72, 186, 72, 113, 73, 162, 74, 114, 74, 208, 75, 116, 76, 164, 76, 118, 77, 188, 78, 120, 78, 166, 79, 122, 80, 200, 80, 124, 81, 168]\n assert candidate(deck = [97, 89, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2]) == [2, 41, 3, 67, 5, 43, 7, 79, 11, 47, 13, 71, 17, 53, 19, 97, 23, 59, 29, 73, 31, 61, 37, 89]\n assert candidate(deck = [50, 40, 30, 20, 10, 0, -10, -20, -30, -40, -50]) == [-50, 30, -40, 10, -30, 50, -20, 20, -10, 40, 0]\n assert candidate(deck = [97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2]) == [2, 89, 3, 43, 5, 71, 7, 47, 11, 83, 13, 53, 17, 73, 19, 59, 23, 97, 29, 61, 31, 79, 37, 67, 41]\n assert candidate(deck = [500, 250, 750, 125, 375, 625, 875, 63, 126, 189, 252, 315, 378, 441, 504, 567, 630, 693, 756, 819, 882, 945]) == [63, 504, 125, 875, 126, 567, 189, 756, 250, 625, 252, 945, 315, 630, 375, 819, 378, 693, 441, 882, 500, 750]\n assert candidate(deck = [101, 202, 303, 404, 505, 606, 707, 808, 909, 1010]) == [101, 606, 202, 1010, 303, 707, 404, 909, 505, 808]\n assert candidate(deck = [9, 1, 8, 2, 7, 3, 6, 4, 5]) == [1, 9, 2, 6, 3, 8, 4, 7, 5]\n assert candidate(deck = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100]) == [2, 52, 4, 98, 6, 54, 8, 78, 10, 56, 12, 90, 14, 58, 16, 80, 18, 60, 20, 96, 22, 62, 24, 82, 26, 64, 28, 92, 30, 66, 32, 84, 34, 68, 36, 100, 38, 70, 40, 86, 42, 72, 44, 94, 46, 74, 48, 88, 50, 76]\n assert candidate(deck = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]) == [1, 12, 2, 9, 3, 14, 4, 10, 5, 13, 6, 11, 7, 15, 8]\n assert candidate(deck = [8, 6, 4, 2, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]) == [1, 43, 2, 23, 3, 37, 4, 25, 5, 47, 6, 27, 7, 39, 8, 29, 9, 45, 11, 31, 13, 41, 15, 33, 17, 49, 19, 35, 21]\n assert candidate(deck = [101, 202, 303, 404, 505, 606, 707, 808, 909, 1010]) == [101, 606, 202, 1010, 303, 707, 404, 909, 505, 808]\n assert candidate(deck = [5, 1, 9, 8, 2, 7, 3, 6, 4]) == [1, 9, 2, 6, 3, 8, 4, 7, 5]\n assert candidate(deck = [45, 21, 33, 67, 19, 2, 89, 53, 7, 100]) == [2, 45, 7, 100, 19, 53, 21, 89, 33, 67]\n assert candidate(deck = [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]) == [15, 38, 16, 55, 17, 39, 18, 50, 19, 40, 20, 58, 21, 41, 22, 51, 23, 42, 24, 56, 25, 43, 26, 52, 27, 44, 28, 60, 29, 45, 30, 53, 31, 46, 32, 57, 33, 47, 34, 54, 35, 48, 36, 59, 37, 49]\n assert candidate(deck = [1000, 500, 250, 125, 625, 312, 156, 78, 39, 19, 9, 4, 2, 1]) == [1, 125, 2, 625, 4, 156, 9, 500, 19, 250, 39, 1000, 78, 312]\n assert candidate(deck = [1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1]) == [1, 256, 2, 64, 4, 1024, 8, 128, 16, 512, 32]\n assert candidate(deck = [37, 56, 42, 8, 29, 13, 71, 23, 31, 99]) == [8, 37, 13, 99, 23, 42, 29, 71, 31, 56]\n assert candidate(deck = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == [100, 600, 200, 1000, 300, 700, 400, 900, 500, 800]\n assert candidate(deck = [13, 11, 2, 5, 7, 3, 17, 1, 19, 23, 29, 31, 37, 41, 43, 47, 53]) == [1, 53, 2, 23, 3, 41, 5, 29, 7, 47, 11, 31, 13, 43, 17, 37, 19]\n assert candidate(deck = [3, 7, 11, 15, 19, 23, 27, 31]) == [3, 19, 7, 27, 11, 23, 15, 31]\n assert candidate(deck = [8, 6, 7, 5, 3, 0, 9]) == [0, 8, 3, 7, 5, 9, 6]\n assert candidate(deck = [503, 251, 757, 1009, 1259, 1511, 1777, 2039, 2293, 2549, 2801, 3059, 3319, 3571, 3823, 4079, 4331, 4583, 4831, 5077, 5333]) == [251, 4831, 503, 3059, 757, 4331, 1009, 3319, 1259, 5333, 1511, 3571, 1777, 4583, 2039, 3823, 2293, 5077, 2549, 4079, 2801]\n assert candidate(deck = [93, 45, 78, 12, 89, 34, 67, 23, 56, 1, 8, 64, 3, 72, 99, 85, 11, 59, 70, 61, 52, 46, 27, 94, 96, 60, 95, 6, 18, 5, 19, 47, 37, 26, 79, 80, 17, 54, 24, 97, 86, 83, 20, 28, 91, 42, 65, 81, 51, 9, 88, 33, 75, 68, 57, 41, 39, 92, 66, 76, 4, 77, 38, 74, 10, 69, 31, 30, 14, 98, 73, 50, 49, 36, 84, 62, 15, 55, 82, 32, 25, 53, 2, 29, 58, 40, 16, 71, 22, 48, 43, 63, 13, 44, 35, 87, 21, 7, 57, 90, 60, 11, 100, 34]) == [1, 51, 2, 75, 3, 52, 4, 88, 5, 53, 6, 76, 7, 54, 8, 99, 9, 55, 10, 77, 11, 56, 11, 89, 12, 57, 13, 78, 14, 57, 15, 95, 16, 58, 17, 79, 18, 59, 19, 90, 20, 60, 21, 80, 22, 60, 23, 98, 24, 61, 25, 81, 26, 62, 27, 91, 28, 63, 29, 82, 30, 64, 31, 96, 32, 65, 33, 83, 34, 66, 34, 92, 35, 67, 36, 84, 37, 68, 38, 100, 39, 69, 40, 85, 41, 70, 42, 93, 43, 71, 44, 86, 45, 72, 46, 97, 47, 73, 48, 87, 49, 74, 50, 94]\n assert candidate(deck = [50, 20, 30, 40, 10, 70, 60, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == [10, 110, 20, 160, 30, 120, 40, 200, 50, 130, 60, 170, 70, 140, 80, 190, 90, 150, 100, 180]\n assert candidate(deck = [22, 11, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143]) == [11, 132, 22, 88, 33, 121, 44, 99, 55, 143, 66, 110, 77]\n"}, "metadata": {"canonical_parameter_names": ["deck"], "leetcode_dataset_entry_point": "Solution().deckRevealedIncreasing", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var deckRevealedIncreasing = function(deck) {", "container": null, "callable": "deckRevealedIncreasing", "parameters": [{"name": "deck", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 951, "task_id": "flip-equivalent-binary-trees", "difficulty": "Medium", "problem_description": "For a binary tree T, we can define a flip operation as follows: choose any node, and swap the left and right child subtrees.\nA binary tree X is flip equivalent to a binary tree Y if and only if we can make X equal to Y after some number of flip operations.\nGiven the roots of two binary trees root1 and root2, return true if the two trees are flip equivalent or false otherwise.\n \nExample 1:\n\n\nInput: root1 = [1,2,3,4,5,6,null,null,null,7,8], root2 = [1,3,2,null,6,4,5,null,null,null,null,8,7]\nOutput: true\nExplanation: We flipped at nodes with values 1, 3, and 5.\n\nExample 2:\n\nInput: root1 = [], root2 = []\nOutput: true\n\nExample 3:\n\nInput: root1 = [], root2 = [1]\nOutput: false\n\n \nConstraints:\n\nThe number of nodes in each tree is in the range [0, 100].\nEach tree will have unique node values in the range [0, 99].\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root1 = tree_node([1, 2, 3]),root2 = tree_node([1, 3, 2])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5]),root2 = tree_node([1, 3, 2, 5, 4])) == False\n assert candidate(root1 = tree_node([]),root2 = tree_node([1])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7]),root2 = tree_node([1, 3, 2, 7, 6, 5, 4])) == True\n assert candidate(root1 = tree_node([]),root2 = tree_node([])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, None, None, None, 7, 8]),root2 = tree_node([1, 3, 2, None, 6, 4, 5, None, None, None, None, 8, 7])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4]),root2 = tree_node([1, 3, 2, 4])) == False\n assert candidate(root1 = tree_node([1]),root2 = tree_node([1])) == True\n assert candidate(root1 = tree_node([1, 2]),root2 = tree_node([1, None, 2])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4]),root2 = tree_node([1, 3, 2, None, 4])) == False\n assert candidate(root1 = tree_node([1, None, 2, None, 3]),root2 = tree_node([1, 2, None, 3])) == True\n assert candidate(root1 = tree_node([0, 1, None]),root2 = tree_node([0, None, 1])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 3, 2, 6, 5, 4, 7, 13, 12, 11, 10, 15, 14, 9, 8])) == False\n assert candidate(root1 = tree_node([10, 5, 15, 3, 7, None, 18, None, None, 6, None, None, None, 16, 17]),root2 = tree_node([10, 15, 5, None, 18, 7, None, None, None, None, 16, None, None, 3, 6, None, None, 17])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]),root2 = tree_node([1, 3, 2, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4])) == False\n assert candidate(root1 = tree_node([10, 5, 15, 3, 7, 12, 20, 1, 4, 6, 8, 11, 13, 18, 25]),root2 = tree_node([10, 15, 5, 25, 18, 12, 7, 20, 13, 11, 6, 8, 4, 3, 1])) == False\n assert candidate(root1 = tree_node([10, 5, 15, 3, 7, 12, 18, 1, 4, 6, 8, 11, 13, 16, 20, None, None, 2, 9, None, None, None, None, None, None, None, None, None, None, None]),root2 = tree_node([10, 15, 5, 20, 16, 18, 12, 9, None, None, None, None, 2, None, None, 13, 11, 8, 6, 4, 3, 7, None, 1])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]),root2 = tree_node([1, 3, 2, 7, 6, 5, 4, 15, 14, 13, 12, 11, 10, 9, 8, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16])) == False\n assert candidate(root1 = tree_node([3, 2, None, 1]),root2 = tree_node([3, None, 2, None, 1])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]),root2 = tree_node([1, 3, 2, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]),root2 = tree_node([1, 32, 3, 4, 5, 30, 2, 31, 33, 29, 49, 28, 50, 10, 27, 11, 26, 12, 25, 13, 24, 14, 23, 15, 22, 16, 21, 17, 20, 18, 19, 34, 35, 36, 37, 38, 9, 8, 7, 6, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]),root2 = tree_node([1, 3, 2, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4])) == False\n assert candidate(root1 = tree_node([5, 4, 7, 3, None, 2, None, -1, -3, None, None, None, None, -2, None]),root2 = tree_node([5, 7, 4, None, 2, None, 3, None, None, -1, -2, None, -3, None])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 3, 2, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4])) == False\n assert candidate(root1 = tree_node([1, 2, 3, None, 4, 5, 6, None, None, 7, 8, 9, 10]),root2 = tree_node([1, 3, 2, 6, 5, 4, None, None, 10, 9, 8, 7, None])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 3, 2, 7, 6, 5, 4, 15, 14, 13, 12, 11, 10, 9, 8])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, None, 6, 7, 8, 9]),root2 = tree_node([1, 3, 2, 7, 6, None, 5, 9, 8])) == False\n assert candidate(root1 = tree_node([8, 1, 3, 7, 9, 4, 5, 2, None, None, None, None, None, None, None]),root2 = tree_node([8, 3, 1, 5, 4, None, 9, None, 2, None, None, None, None, 7, None])) == False\n assert candidate(root1 = tree_node([1, 2, None, 3, None, 4, None, 5]),root2 = tree_node([1, None, 2, None, 3, None, 4, None, 5])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, 11, None, None, None, None, 14, 15]),root2 = tree_node([1, 3, 2, 7, 6, 5, 4, None, None, None, 15, 14, None, None, None, 9, 11])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 3, 2, 7, 6, 5, 4, 15, 14, 13, 12, 11, 10, 9, 8, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]),root2 = tree_node([1, 3, 2, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, None, 6, 7, 8, None, 10, None, 12, 13, None, None, 16]),root2 = tree_node([1, 3, 2, None, 7, 6, 4, 13, None, 12, None, 10, None, 8, 16])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, None, 7, None, None, 8, None, None, 9, 10, None]),root2 = tree_node([1, 3, 2, None, 6, 4, 5, None, 9, None, None, 10, 8, None, None, None, None])) == False\n assert candidate(root1 = tree_node([1, 2, None, 4, 5, 6, 7]),root2 = tree_node([1, 2, None, 5, 4, 7, 6])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, None, 8, 9, None, None, 10, 11, None, None, None, None, None]),root2 = tree_node([1, 3, 2, None, 6, 5, 4, None, 11, None, 10, None, None, 9, 8])) == False\n assert candidate(root1 = tree_node([5, 1, 7, None, 3, None, 6, None, 4]),root2 = tree_node([5, 7, 1, 6, None, None, 3, None, None, 4])) == True\n assert candidate(root1 = tree_node([5, 3, 8, 2, 4, 7, 9, 1, None, None, None, None, 10, None, None, 11]),root2 = tree_node([5, 8, 3, 9, 7, 4, 2, None, None, 10, None, None, None, None, 1, None, 11])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, None, 6, 7, 8, None, None, None, None, 11]),root2 = tree_node([1, 3, 2, None, 6, 4, 7, None, None, 11, None, 8])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, None, 6, 7, None, None, 8, 9, 10, 11, None, None, 12, 13, None, 14]),root2 = tree_node([1, 3, 2, None, 6, 4, 7, None, None, 11, 10, 9, 8, None, None, 14, None, 13, 12])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, 16, 17, None, 18, 19, 20, 21, 22, None, 23, None, 24, 25, 26, None, None, None, 27]),root2 = tree_node([1, 3, 2, 7, 6, 5, 4, 15, 14, 13, 12, 11, 10, 9, 8, None, None, None, None, None, None, 19, 18, None, 24, 23, None, 22, 21, 20, 17, None, 16, None, 27, None, 26, None, 25])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9]),root2 = tree_node([1, 3, 2, None, None, 5, 4, None, None, 9, 8, 7, 6])) == False\n assert candidate(root1 = tree_node([2, 1, None, 3, 4, None, 5, 6]),root2 = tree_node([2, 3, 1, None, 5, 4, None, 6])) == False\n assert candidate(root1 = tree_node([1, 2, 3, None, None, 4, 5]),root2 = tree_node([1, 3, 2, 5, 4])) == True\n assert candidate(root1 = tree_node([5, 3, 6, 2, 4, None, 7, 1, None, None, None, 8, 9]),root2 = tree_node([5, 6, 3, None, 7, 4, None, None, 1, 9, 8, 2])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, None, 6, 7, None, 5, 8, 9]),root2 = tree_node([1, 3, 2, 7, 6, None, 4, None, 9, 8, 5])) == False\n assert candidate(root1 = tree_node([5, 1, 3, None, 2, None, 6]),root2 = tree_node([5, 3, 1, 6, None, 2, None])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]),root2 = tree_node([1, 3, 2, 7, 6, 5, 4, 13, 12, 11, 10, 9, 8, 15, 14, 23, 22, 21, 20, 19, 18, 17, 16, 27, 26, 25, 24, 31, 30, 29])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]),root2 = tree_node([1, 3, 2, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5])) == False\n assert candidate(root1 = tree_node([1, 2, 3, None, 4, 5, 6, None, None, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 3, 2, 6, 5, 4, None, None, None, None, 15, 14, 13, 12, 11, 10, 9, 8, 7])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 2, 3, 8, 7, 6, 5, 4, 9, 10, 11, 12, 13, 14, 15])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, 16, 17, None, 18, 19, 20, 21, 22, None, 23, 24]),root2 = tree_node([1, 3, 2, 7, 6, 5, 4, 15, 14, 13, 12, 11, 10, 9, 8, None, None, None, None, None, None, 19, 18, None, 24, 23, None, 22, 21, 20, 17, None, 16])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, None, 6, 7, None, None, None, None, 8, 9, None, 10, None, None, 11]),root2 = tree_node([1, 3, 2, 7, None, 6, 4, 10, None, 9, None, 11, None, 8, None])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, None, None, None, None, None, None, 11, 12]),root2 = tree_node([1, 3, 2, 7, 6, 5, 4, 12, 11, None, None, None, None, None, 9, 8])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 3, 2, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 3, 2, 15, 14, 13, 12, 7, 6, 5, 4, 11, 10, 9, 8])) == False\n assert candidate(root1 = tree_node([10, 5, 15, 3, 7, 12, 18, 1, 4, 6, 8, 11, 13, 17, 19]),root2 = tree_node([10, 15, 5, 19, 17, 13, 11, 18, 12, 8, 6, 4, 3, 7, 1])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9]),root2 = tree_node([1, 3, 2, None, None, 6, 7, 9, 8, None, None, 5, 4])) == False\n assert candidate(root1 = tree_node([1, 2, 3, None, 4, None, 5, None, 6]),root2 = tree_node([1, 3, 2, 5, None, 4, None, None, None, 6])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, None, None, 8, 9, None, None, 10]),root2 = tree_node([1, 3, 2, None, None, 5, 4, 10, None, None, 9, 8])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),root2 = tree_node([1, 3, 2, 5, 6, 4, 7, 9, 10, 11, 12, 13, 14, 8, 15])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, None, None, 6, 7]),root2 = tree_node([1, 3, 2, None, None, 7, 6, 5, 4])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]),root2 = tree_node([1, 3, 2, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, None, None, 5, None, None, 6, 7]),root2 = tree_node([1, 3, 2, None, 5, None, 4, 7, 6])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]),root2 = tree_node([1, 3, 2, None, 6, 4, 5, 15, 14, 13, 12, 11, 10, 9, 8, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]),root2 = tree_node([1, 3, 2, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4])) == False\n assert candidate(root1 = tree_node([8, 3, 5, 1, 2, 6, 9, None, None, None, None, None, None, 7, 4]),root2 = tree_node([8, 5, 3, 9, 6, 2, 1, None, None, 7, 4, None, None, None, None])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, None, None, 5, 6, None, None, 7, 8, None, None, 9]),root2 = tree_node([1, 3, 2, None, 5, None, 4, None, 9, None, 8, None, 7, 6])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, 12, None, 14, 15]),root2 = tree_node([1, 3, 2, 7, 6, 5, 4, 15, 14, 12, None, 10, None, 9, 8])) == True\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, None, None, None, 7, 8, 9, 10]),root2 = tree_node([1, 3, 2, None, 6, 4, 5, 10, 9, None, None, None, None, 8, 7])) == False\n assert candidate(root1 = tree_node([8, 5, 12, 3, 7, 9, 15, 1, 4, 6, 8, 10, 11, 13, 16]),root2 = tree_node([8, 12, 5, 16, 13, 11, 10, 15, 9, 7, 6, 4, 3, 8, 1])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, None, 6, 7, 8, None, None, 9, 10]),root2 = tree_node([1, 3, 2, None, 6, 4, 5, 10, 9, None, None, 8, 7])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, None, None, None, None, 6, 7]),root2 = tree_node([1, 3, 2, None, None, None, None, 4, 5, 7, 6])) == False\n assert candidate(root1 = tree_node([2, 3, 5, None, 8, None, 7, 4, 9, None, 1, None, None, None, None, 6]),root2 = tree_node([2, 5, 3, 7, None, None, 8, 1, None, None, 4, None, None, 9, 6])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, None, 7, 8, 9, None, None, None, None, None, 14]),root2 = tree_node([1, 3, 2, None, 5, 4, 7, None, None, 9, None, None, 8, None, 14])) == False\n assert candidate(root1 = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, 11, None, None, 12, None, 13, None, None, 14, None, None, 15, None]),root2 = tree_node([1, 3, 2, None, 7, 6, 5, None, None, 12, None, 11, None, None, 9, 4, None, None, 15, 13, None, None, 14, None, 8])) == False\n"}, "metadata": {"canonical_parameter_names": ["root1", "root2"], "leetcode_dataset_entry_point": "Solution().flipEquiv", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var flipEquiv = function(root1, root2) {", "container": null, "callable": "flipEquiv", "parameters": [{"name": "root1", "type": "TreeNode"}, {"name": "root2", "type": "TreeNode"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 952, "task_id": "largest-component-size-by-common-factor", "difficulty": "Hard", "problem_description": "You are given an integer array of unique positive integers nums. Consider the following graph:\n\nThere are nums.length nodes, labeled nums[0] to nums[nums.length - 1],\nThere is an undirected edge between nums[i] and nums[j] if nums[i] and nums[j] share a common factor greater than 1.\n\nReturn the size of the largest connected component in the graph.\n \nExample 1:\n\n\nInput: nums = [4,6,15,35]\nOutput: 4\n\nExample 2:\n\n\nInput: nums = [20,50,9,63]\nOutput: 2\n\nExample 3:\n\n\nInput: nums = [2,3,6,7,4,12,21,39]\nOutput: 8\n\n \nConstraints:\n\n1 <= nums.length <= 2 * 104\n1 <= nums[i] <= 105\nAll the values of nums are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [20, 50, 9, 63]) == 2\n assert candidate(nums = [2, 3, 6, 7, 4, 12, 21, 39]) == 8\n assert candidate(nums = [30, 60, 20, 5, 15]) == 5\n assert candidate(nums = [5, 7, 11, 13]) == 1\n assert candidate(nums = [30, 42, 70, 28, 10, 5]) == 6\n assert candidate(nums = [30, 42, 66, 55]) == 4\n assert candidate(nums = [7, 3, 5, 23, 31, 37, 41, 43, 47, 53]) == 1\n assert candidate(nums = [4, 6, 15, 35]) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 8\n assert candidate(nums = [30, 42, 70, 28]) == 4\n assert candidate(nums = [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 8\n assert candidate(nums = [8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96]) == 23\n assert candidate(nums = [33, 66, 99, 132, 165, 198, 231, 264, 297, 330]) == 10\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]) == 10\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == 15\n assert candidate(nums = [105, 210, 315, 420, 525, 630]) == 6\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70]) == 10\n assert candidate(nums = [45, 90, 120, 135, 180, 225, 270, 315, 360, 405, 450, 495]) == 12\n assert candidate(nums = [1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015]) == 11\n assert candidate(nums = [30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240]) == 15\n assert candidate(nums = [100, 150, 200, 250, 300, 350]) == 6\n assert candidate(nums = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]) == 10\n assert candidate(nums = [8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48]) == 11\n assert candidate(nums = [8, 12, 18, 24, 30, 36, 42, 48, 54, 60]) == 10\n assert candidate(nums = [60, 30, 90, 120, 180, 210, 240, 300]) == 8\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]) == 1\n assert candidate(nums = [28, 49, 98, 147, 196, 245, 294, 343, 392, 441, 490, 539, 588, 637, 686]) == 15\n assert candidate(nums = [101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197]) == 1\n assert candidate(nums = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73]) == 1\n assert candidate(nums = [44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 220, 231, 242, 253]) == 20\n assert candidate(nums = [6, 10, 14, 15, 21, 22, 26, 33, 35, 38, 39, 44, 45, 46, 51, 55, 57, 58, 62, 65, 66, 69, 74, 77, 82, 85, 86, 87, 91, 93, 94, 95, 106]) == 33\n assert candidate(nums = [30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255, 270, 285, 300]) == 19\n assert candidate(nums = [21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98]) == 12\n assert candidate(nums = [121, 132, 143, 154, 165, 176, 187, 198, 209, 220, 231, 242, 253, 264, 275, 286, 297, 308, 319, 330]) == 20\n assert candidate(nums = [81, 135, 189, 243, 315, 378, 459, 513, 567, 639, 693, 756, 819, 873, 945]) == 15\n assert candidate(nums = [840, 1680, 2520, 3360, 4200, 5040, 5880, 6720, 7560, 8400, 9240, 10080, 10920, 11760, 12600]) == 15\n assert candidate(nums = [121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140]) == 16\n assert candidate(nums = [961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980]) == 16\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000]) == 20\n assert candidate(nums = [100000, 99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991]) == 8\n assert candidate(nums = [56, 84, 112, 140, 168, 196, 224, 252, 280, 308, 336, 364, 392]) == 13\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]) == 1\n assert candidate(nums = [100, 150, 200, 250, 300, 350, 400, 450, 500]) == 9\n assert candidate(nums = [101, 202, 303, 404, 505, 606, 707, 808, 909, 1010, 1111, 1212, 1313, 1414, 1515]) == 15\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]) == 1\n assert candidate(nums = [56, 98, 168, 224, 231, 252, 336, 392, 441, 462, 504, 539, 616, 672, 784, 882, 924, 1008, 1092, 1176, 1260, 1344, 1428, 1512, 1596, 1680, 1764, 1848, 1932, 2016, 2100]) == 31\n assert candidate(nums = [2520, 5040, 10080, 20160, 40320]) == 5\n assert candidate(nums = [21, 42, 63, 84, 105, 126, 147, 168, 189, 210, 231, 252, 273, 294, 315, 336, 357, 378, 399, 420]) == 20\n assert candidate(nums = [6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108]) == 18\n assert candidate(nums = [36, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255]) == 16\n assert candidate(nums = [44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 220, 231, 242, 253, 264, 275, 286, 297, 308, 319, 330, 341, 352, 363, 374, 385, 396, 407, 418, 429, 440, 451, 462, 473, 484, 495]) == 42\n assert candidate(nums = [30030, 30031, 30032, 30033, 30034, 30035, 30036, 30037, 30038, 30039, 30040, 30041, 30042, 30043, 30044, 30045, 30046, 30047, 30048, 30049, 30050, 30051, 30052, 30053, 30054, 30055]) == 22\n assert candidate(nums = [1000, 1024, 1050, 1080, 1100, 1120, 1140, 1150, 1170, 1190, 1200, 1230, 1260, 1290, 1320, 1350, 1380, 1410, 1440, 1470]) == 20\n assert candidate(nums = [17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]) == 1\n assert candidate(nums = [60, 100, 150, 200, 250, 300]) == 6\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]) == 20\n assert candidate(nums = [101, 202, 303, 404, 505, 606, 707, 808, 909, 1010]) == 10\n assert candidate(nums = [97, 194, 291, 388, 485, 582, 679, 776, 873, 970, 1067, 1164, 1261, 1358, 1455, 1552, 1649, 1746, 1843, 1940]) == 20\n assert candidate(nums = [8, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90]) == 15\n assert candidate(nums = [105, 115, 130, 140, 154, 165, 170, 182, 187, 195, 210, 220, 221, 231, 238, 247, 253, 260, 273, 286, 299]) == 21\n assert candidate(nums = [210, 420, 630, 840, 1050, 1260, 1470, 1680, 1890, 2100, 2310, 2520, 2730, 2940, 3150]) == 15\n assert candidate(nums = [99, 121, 143, 165, 187, 209, 231, 253, 275, 297, 319, 330, 352, 374, 396, 418, 440, 462, 484, 506]) == 20\n assert candidate(nums = [210, 231, 252, 273, 294, 315, 336, 357, 378, 399, 420, 441, 462, 483, 504, 525, 546, 567, 588, 609]) == 20\n assert candidate(nums = [10001, 20002, 30003, 40004, 50005, 60006, 70007, 80008, 90009, 100010]) == 10\n assert candidate(nums = [60, 120, 180, 240, 300, 360, 420, 480, 540, 600]) == 10\n assert candidate(nums = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536]) == 16\n assert candidate(nums = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]) == 10\n assert candidate(nums = [21, 35, 55, 77, 91, 119, 143, 165, 187, 209, 231, 253, 286, 308, 330]) == 15\n assert candidate(nums = [210, 330, 462, 594, 726, 858, 990, 1122, 1254, 1386, 1518, 1650, 1782, 1914, 2046]) == 15\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]) == 1\n assert candidate(nums = [60, 65, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140, 143, 154, 165, 182, 210, 231, 252]) == 20\n assert candidate(nums = [44, 66, 100, 121, 143, 165]) == 6\n assert candidate(nums = [60, 100, 140, 210, 280, 350, 420, 500, 560, 630, 700, 770, 840, 910, 980, 1050, 1120, 1190, 1260, 1330, 1400, 1470, 1540, 1610, 1680, 1750, 1820, 1890, 1960, 2030]) == 30\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]) == 1\n assert candidate(nums = [121, 132, 143, 154, 165, 176, 187, 198, 209, 220, 231, 242, 253, 264, 275, 286, 297, 308, 319, 330, 341, 352, 363, 374, 385, 396, 407, 418, 429, 440, 451, 462, 473, 484, 495, 506, 517, 528, 539, 550]) == 40\n assert candidate(nums = [840, 924, 1008, 1092, 1176, 1260, 1344, 1428, 1512, 1596, 1680, 1764, 1848, 1932, 2016, 2100, 2184, 2268, 2352, 2436, 2520]) == 21\n assert candidate(nums = [15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205]) == 20\n assert candidate(nums = [15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345, 375, 405, 435, 465, 495, 525, 555, 585]) == 20\n assert candidate(nums = [210, 231, 252, 273, 294, 315, 336, 357, 378, 399, 420, 441, 462, 483, 504, 525, 546, 567, 588, 609, 630, 651, 672, 693, 714, 735, 756, 777, 798, 819, 840, 861, 882, 903, 924, 945, 966, 987, 1008, 1029]) == 40\n assert candidate(nums = [104729, 104731, 104743, 104759, 104761, 104771, 104773, 104777, 104783, 104791, 104797, 104801, 104807, 104813, 104819, 104831, 104833, 104837, 104839, 104843, 104857, 104858, 104861, 104863, 104867, 104869]) == 9\n assert candidate(nums = [6, 10, 14, 15, 21, 22, 26, 28, 33, 35, 39, 44, 45, 55, 65, 77, 88, 99, 105, 110]) == 20\n assert candidate(nums = [81, 121, 169, 225, 289, 361, 441, 529, 625, 729]) == 5\n assert candidate(nums = [104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == 14\n assert candidate(nums = [100, 102, 105, 108, 110, 112, 114, 115, 117, 119]) == 10\n assert candidate(nums = [3, 5, 15, 25, 45, 75, 105, 125, 135, 175, 225, 245, 315, 375, 525]) == 15\n assert candidate(nums = [44, 88, 132, 176, 220, 264, 308, 352, 396, 440, 484, 528, 572, 616, 660]) == 15\n assert candidate(nums = [210, 231, 252, 273, 294, 315, 336, 357, 378, 399]) == 10\n assert candidate(nums = [100, 102, 104, 105, 106, 108, 110, 112, 114, 115, 117, 119, 121, 122, 123, 124, 126, 128, 130, 132, 133, 134, 135, 136, 138, 140, 141, 142, 143, 145]) == 30\n assert candidate(nums = [100, 105, 110, 115, 120]) == 5\n assert candidate(nums = [154, 308, 462, 616, 770, 924, 1078, 1232, 1386, 1540, 1694, 1848, 2002, 2156, 2310]) == 15\n assert candidate(nums = [60, 120, 180, 240, 300, 360, 420, 480, 540, 600]) == 10\n assert candidate(nums = [30, 42, 70, 105, 210]) == 5\n assert candidate(nums = [8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84]) == 20\n assert candidate(nums = [101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157]) == 1\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]) == 10\n assert candidate(nums = [49, 63, 77, 91, 105, 119, 133, 147, 161, 175, 189, 203, 217, 231, 245]) == 15\n assert candidate(nums = [18, 24, 30, 42, 56, 72, 84, 90]) == 8\n assert candidate(nums = [77, 91, 119, 133, 143, 161, 187, 209, 221, 231, 247, 253, 287, 299, 319]) == 15\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().largestComponentSize", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var largestComponentSize = function(nums) {", "container": null, "callable": "largestComponentSize", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 953, "task_id": "verifying-an-alien-dictionary", "difficulty": "Easy", "problem_description": "In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters.\nGiven a sequence of words written in the alien language, and the order of the alphabet, return true if and only if the given words are sorted lexicographically in this alien language.\n \nExample 1:\n\nInput: words = [\"hello\",\"leetcode\"], order = \"hlabcdefgijkmnopqrstuvwxyz\"\nOutput: true\nExplanation: As 'h' comes before 'l' in this language, then the sequence is sorted.\n\nExample 2:\n\nInput: words = [\"word\",\"world\",\"row\"], order = \"worldabcefghijkmnpqstuvxyz\"\nOutput: false\nExplanation: As 'd' comes after 'l' in this language, then words[0] > words[1], hence the sequence is unsorted.\n\nExample 3:\n\nInput: words = [\"apple\",\"app\"], order = \"abcdefghijklmnopqrstuvwxyz\"\nOutput: false\nExplanation: The first three characters \"app\" match, and the second string is shorter (in size.) According to lexicographical rules \"apple\" > \"app\", because 'l' > '∅', where '∅' is defined as the blank character which is less than any other character (More info).\n\n \nConstraints:\n\n1 <= words.length <= 100\n1 <= words[i].length <= 20\norder.length == 26\nAll characters in words[i] and order are English lowercase letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['a', 'b', 'c', 'd', 'e'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['kuvp', 'q'],order = \"ngxlkthsjuoqcpavbfdermiyzw\") == True\n assert candidate(words = ['zzz', 'zzzz'],order = \"zyxwvutsrqponmlkjihgfedcba\") == True\n assert candidate(words = ['abc', 'ab'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['hello', 'hello', 'hello'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['apple', 'app'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['app', 'apple'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['aaa'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['hello', 'leetcode'],order = \"hlabcdefgijkmnopqrstuvwxyz\") == True\n assert candidate(words = ['zoo', 'zoop'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['a', 'b', 'c'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['abc', 'acb'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['kz', 'kzc'],order = \"zabklmncopqrstuvwxy\") == True\n assert candidate(words = ['a', 'b', 'c'],order = \"cba\") == False\n assert candidate(words = ['kuvp', 'q'],order = \"ngxlkthsjuoqcpavbfderimyzw\") == True\n assert candidate(words = ['zzz', 'zaz'],order = \"zyxwvutsrqponmlkjihgfedcba\") == True\n assert candidate(words = ['z', 'z'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['aaa', 'aa'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['word', 'world', 'row'],order = \"worldabcefghijkmnpqstuvxyz\") == False\n assert candidate(words = ['abc', 'acb', 'bac'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['wrt', 'wrf', 'er', 'ett', 'rftt'],order = \"wertfabcghijklmnopqsudvyxz\") == False\n assert candidate(words = ['banana', 'apple', 'orange'],order = \"zyxcbaedfghijklmnopqrstuvw\") == True\n assert candidate(words = ['abcd', 'abcde', 'abcd'],order = \"fedcbazyxwvutsrqponmlkjhig\") == False\n assert candidate(words = ['aaa', 'aab', 'aac'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['cat', 'dog', 'bird'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['same', 'sake', 'saki'],order = \"askdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['aaa', 'aaab', 'aaac'],order = \"abcdefghijkmnopqrstuvwxyzl\") == True\n assert candidate(words = ['banana', 'bandana', 'bandwidth'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['xyz', 'xyzz', 'xyza'],order = \"zyxwvutsrqponmlkjihgfedcba\") == True\n assert candidate(words = ['a', 'b', 'c', 'd', 'e'],order = \"edcba\") == False\n assert candidate(words = ['short', 'shorter', 'shortest'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['banana', 'bandana', 'bandit'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['a', 'b', 'c', 'd'],order = \"cbaedfghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['xyz', 'xyy', 'xyx'],order = \"xyzabcdefghijklmnopqrstuvw\") == False\n assert candidate(words = ['a', 'b', 'c', 'd', 'e'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['mismatch', 'mis', 'misleading'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['dog', 'cat'],order = \"zyxwvutsrqponmlkjihgfedcba\") == True\n assert candidate(words = ['zebra', 'dog', 'cat'],order = \"dogcatzebraabcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['abc', 'abz', 'abcde'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['long', 'longer', 'longest'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['app', 'apple', 'apples'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['word', 'world', 'wor'],order = \"worldabcefghijkmnpqstuvxyz\") == False\n assert candidate(words = ['apple', 'apples', 'app', 'appl'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['dog', 'cat', 'bird'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['alien', 'algorithm', 'all'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['aa', 'a'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['zebra', 'zebraa'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['banana', 'bandana', 'apple'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['zebra', 'zoo', 'zoom', 'zoology'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['same', 'same', 'same'],order = \"fedcbazyxwvutsrqponmlkjhig\") == True\n assert candidate(words = ['abcd', 'abce', 'abcf'],order = \"acegbdfhijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['one', 'only', 'on', 'once'],order = \"onabcdefghijkmplqstuvxyzwer\") == False\n assert candidate(words = ['aaa', 'aa', 'aaaa', 'aaaaa'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['abc', 'acb', 'bac'],order = \"cbafehidgjklmponqrstuvwxzy\") == False\n assert candidate(words = ['zzz', 'zz', 'z', ''],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['aaa', 'aab', 'aac'],order = \"cbafehidgjklmponqrstuvwxzy\") == False\n assert candidate(words = ['xylophone', 'xylometer', 'xylography'],order = \"zyxwvutsrqponmlkjihgfedcba\") == True\n assert candidate(words = ['abcd', 'abcde', 'abcdeg', 'abcdef', 'abcdefg'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['same', 'same', 'same'],order = \"zyxwvutsrqponmlkjihgfedcba\") == True\n assert candidate(words = ['zebra', 'dog', 'duck', 'dove'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['zz', 'zzz', 'zzzz', 'zzzzz'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['word', 'wor', 'worl', 'world'],order = \"worldabcefghijkmnpqstuvxyz\") == False\n assert candidate(words = ['abcd', 'abce', 'abcf'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['short', 'shorter', 'shortest'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['cat', 'bat', 'rat'],order = \"abcdefghirjklmnopqrstuvwxyzct\") == False\n assert candidate(words = ['zebra', 'zealot', 'zest'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['a', 'b', 'c'],order = \"cbaz\") == False\n assert candidate(words = ['zebra', 'zebr', 'zebraa'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['apple', 'apples', 'app'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['xww', 'xwx', 'xw'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['xyz', 'xy', 'x'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['word', 'world', 'wor', 'worl'],order = \"worldabcefghijkmnpqstuvxyz\") == False\n assert candidate(words = ['zyx', 'zy', 'zxy'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['xyz', 'xya', 'xyb'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['word', 'world', 'worlds', 'worldwide'],order = \"worldabcdefghijklnmpqstuvxyz\") == False\n assert candidate(words = ['word', 'world', 'wordly'],order = \"worldabcefghijkmnpqstuvxyz\") == False\n assert candidate(words = ['long', 'longer', 'longest'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['aa', 'a'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['longest', 'longer', 'long'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['a', 'b', 'a'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['a', 'b', 'c', 'd', 'e'],order = \"edcba\") == False\n assert candidate(words = ['same', 'same', 'same'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['special', 'spectacular', 'spectacularly'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['special', 'spectacular', 'spectacularly'],order = \"abcdefghijklmnopqrstuvwxyze\") == False\n assert candidate(words = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba'],order = \"abcdefghijkmnopqrstuvwxyzl\") == False\n assert candidate(words = ['zz', 'z', 'zzz'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a'],order = \"zyxwvutsrqponmlkjihgfedcba\") == True\n assert candidate(words = ['banana', 'bandana', 'band', 'bad'],order = \"badnecghijklmopqrstuvwxyzf\") == False\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['one', 'onetwo', 'onefour'],order = \"onetwofourmnbvcxzlkjhgfdsapq\") == True\n assert candidate(words = ['zyx', 'zy', 'z', ''],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['this', 'thisis', 'thisisatest'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['abc', 'ab', 'abcd'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['jjg', 'jja', 'jj', 'jjb'],order = \"jgfedcbaopqrstuvwxyznhimkl\") == False\n assert candidate(words = ['banana', 'bandana', 'band'],order = \"banxyzklmnopqrstuvwedcfghij\") == False\n assert candidate(words = ['racecar', 'racecars', 'racecarx'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['abcd', 'abce', 'abcf'],order = \"mnopqrstuvwxyzabcdefghijkl\") == True\n assert candidate(words = ['apple', 'app', 'application'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['zz', 'zzz', 'zzzz', 'zzzzz'],order = \"zyxwvutsrqponmlkjihgfedcba\") == True\n assert candidate(words = ['aaa', 'aa', 'a'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['apple', 'apples', 'banana'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['apple', 'app', 'application'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['abcd', 'dcba', 'abcd'],order = \"abcdexyz\") == False\n assert candidate(words = ['abc', 'ab', 'a'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['abc', 'abcd', 'ab'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['abcd', 'abc'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['aaa', 'aa', 'a'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['abc', 'abb', 'aaa'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['abcd', 'abc', 'ab', 'a'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['mismatch', 'mis', 'misleading'],order = \"abcdefghijklmnopqrstuvwxyze\") == False\n assert candidate(words = ['aaa', 'aab', 'aac', 'aad'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['prefix', 'pre', 'prelude'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['apple', 'apples', 'app'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['apple', 'app', 'application'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['word', 'world', 'wordplay'],order = \"worldabcefghijkmnpqstuvxyz\") == False\n assert candidate(words = ['zz', 'za', 'zb'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['z', 'za', 'zb', 'zab'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['dog', 'cat', 'bird'],order = \"dogcatbirdwxyzefghijklmnpqrstuvwxyz\") == False\n assert candidate(words = ['ab', 'abc', 'abcd', 'abcde'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['apple', 'apples', 'app'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['zzzz', 'zzz', 'zzzzz'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['longer', 'long', 'lon'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['hello', 'hallo', 'halloween'],order = \"hlabcdefgijkmnopqrstuvwxyz\") == False\n assert candidate(words = ['hello', 'helloo', 'hell', 'hellp'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['interstellar', 'inter', 'intergalactic'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['banana', 'apple', 'orange'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['word', 'world', 'wordld'],order = \"worldabcefghijkmnpqstuvxyz\") == False\n assert candidate(words = ['abc', 'ab', 'abcd'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['aaaa', 'bbbb', 'cccc', 'ddd'],order = \"abcdefgihjklmnopqrstuvwxyz\") == True\n assert candidate(words = ['a', 'b', 'a'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['cba', 'cbcd'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['same', 'sam', 'samesame'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['ab', 'abc', 'abcd', 'abcde'],order = \"edcba\") == True\n assert candidate(words = ['apple', 'apples', 'application'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['xx', 'xy', 'xz', 'ya', 'yb', 'yc'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['word', 'world', 'row', 'wordz'],order = \"worldabcefghijkmnpqstuvxyz\") == False\n assert candidate(words = ['hello', 'hell', 'he', 'h'],order = \"hlabcdefgijkmnopqrstuvwxyz\") == False\n assert candidate(words = ['aaa', 'aa', 'a'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['hello', 'hell', 'hel', 'he', 'h'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['same', 'same', 'same'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['zyx', 'zy', 'z'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba'],order = \"bacdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['abc', 'abd', 'abcd'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['hello', 'hallo', 'hella'],order = \"hlabcdefgijkmnopqrstuvwxyz\") == False\n assert candidate(words = ['alien', 'algorithm', 'alliance'],order = \"abcdefghijklmonpqrsuvwxyztefgh\") == False\n assert candidate(words = ['abc', 'abcd', 'ab'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['same', 'some', 'sand'],order = \"samponedcbjklfgtqrhxvziwuy\") == False\n assert candidate(words = ['aaaaa', 'aaaab', 'aaaba'],order = \"abcdefghijklmnopqrstuvwzyx\") == False\n assert candidate(words = ['same', 'samee', 'sameee'],order = \"zyxwvutsrqponmlkjihgfedcba\") == True\n assert candidate(words = ['abc', 'abb', 'ab'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['xylophone', 'xylo', 'xylophones'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['fgh', 'fg', 'f'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['prefix', 'pre', 'prelude'],order = \"abcdefghijklmnopqrstuvwxyze\") == False\n assert candidate(words = ['apple', 'apply', 'app'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n assert candidate(words = ['banana', 'bandana', 'bandanaa'],order = \"zyxwvutsrqponmlkjihgfedcba\") == False\n assert candidate(words = ['aab', 'aac', 'aaa', 'aad'],order = \"abcdefghijklmnopqrstuvwxyz\") == False\n"}, "metadata": {"canonical_parameter_names": ["words", "order"], "leetcode_dataset_entry_point": "Solution().isAlienSorted", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isAlienSorted = function(words, order) {", "container": null, "callable": "isAlienSorted", "parameters": [{"name": "words", "type": "string[]"}, {"name": "order", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 954, "task_id": "array-of-doubled-pairs", "difficulty": "Medium", "problem_description": "Given an integer array of even length arr, return true if it is possible to reorder arr such that arr[2 * i + 1] = 2 * arr[2 * i] for every 0 <= i < len(arr) / 2, or false otherwise.\n \nExample 1:\n\nInput: arr = [3,1,3,6]\nOutput: false\n\nExample 2:\n\nInput: arr = [2,1,2,6]\nOutput: false\n\nExample 3:\n\nInput: arr = [4,-2,2,-4]\nOutput: true\nExplanation: We can take two groups, [-2,-4] and [2,4] to form [-2,-4,2,4] or [2,4,-2,-4].\n\n \nConstraints:\n\n2 <= arr.length <= 3 * 104\narr.length is even.\n-105 <= arr[i] <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 4, 2, 2]) == True\n assert candidate(arr = [1, 2, 4, 16, 8, 4]) == False\n assert candidate(arr = [-5, -2, -10, -1, -1, -5]) == False\n assert candidate(arr = [5, -3, 3, -2, 2, -4]) == False\n assert candidate(arr = [0, 0]) == True\n assert candidate(arr = [4, -2, 2, -4]) == True\n assert candidate(arr = [1, 2, 3, 6, 4, 8]) == True\n assert candidate(arr = [1, 2, 4, 16, 8, 32]) == True\n assert candidate(arr = [1, 2, 2, 4]) == True\n assert candidate(arr = [2, 1, 2, 6]) == False\n assert candidate(arr = [0, 0, 0, 0]) == True\n assert candidate(arr = [-2, 4, -2, 4]) == False\n assert candidate(arr = [-1, -2, -3, -6, -6, -12]) == True\n assert candidate(arr = [-2, 4, -8, 16, -32, 64]) == False\n assert candidate(arr = [1, 2, 3, 6, 6, 12]) == True\n assert candidate(arr = [3, 1, 3, 6]) == False\n assert candidate(arr = [1, 2, 3, 6]) == True\n assert candidate(arr = [-1, -2, -2, -4]) == True\n assert candidate(arr = [1, 2, 4, 8]) == True\n assert candidate(arr = [1, 2, 2, 4, 4, 8]) == True\n assert candidate(arr = [1, 2, 3, 6, 5, 10, 15, 30, 4, 8, 12, 24, 20, 40, 60, 120]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 18]) == False\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(arr = [1, 3, 5, 7, 9, 18, 15, 12, 6, 10]) == False\n assert candidate(arr = [1, 2, 3, 6, 5, 10, 15, 30, 4, 8, 12, 24, 20, 40, 60, 120, 7, 14, 21, 42]) == True\n assert candidate(arr = [5, 10, 10, 20, 25, 50]) == True\n assert candidate(arr = [7, 14, 28, 56, 112, 224, 448, 896, 1792, 3584]) == True\n assert candidate(arr = [5, 2, 1, 10, 5, 20, 2, 4]) == False\n assert candidate(arr = [1, 2, 2, 4, 4, 8, 8, 16]) == True\n assert candidate(arr = [-1, 1, -1, 1, -2, 2, -2, 2, -4, 4, -4, 4]) == False\n assert candidate(arr = [-8, -4, -2, -1, -16, -32, -2, -4]) == True\n assert candidate(arr = [-1, 2, -2, 4, -4, 8]) == False\n assert candidate(arr = [-1, -2, -3, -6, -5, -10, -15, -30, -4, -8, -12, -24, -20, -40, -60, -120, -7, -14, -21, -42]) == True\n assert candidate(arr = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]) == True\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) == True\n assert candidate(arr = [3, 6, 3, 6, 12, 24]) == True\n assert candidate(arr = [1, 2, 4, 8, 16, 32]) == True\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128]) == True\n assert candidate(arr = [-1, 2, -2, 1, -4, 4]) == False\n assert candidate(arr = [100000, -100000, 50000, -50000, 25000, -25000, 12500, -12500]) == True\n assert candidate(arr = [5, 10, 15, 20, 25, 50]) == False\n assert candidate(arr = [100000, -100000, 50000, -50000, 25000, -25000]) == False\n assert candidate(arr = [-100000, 100000, -50000, 50000, -25000, 25000, -12500, 12500]) == True\n assert candidate(arr = [-1, 3, 6, 12, 24, 48, 96, 192, 384, 768]) == False\n assert candidate(arr = [-2, -4, -8, -16, -32, -64, -128, -256]) == True\n assert candidate(arr = [5, -5, 10, -10, 20, -20, 40, -40]) == True\n assert candidate(arr = [-5, -10, -15, -20, -25, -50]) == False\n assert candidate(arr = [-2, 4, 1, -1, 2, -2, -4, 8]) == True\n assert candidate(arr = [1, 3, 6, 12, 24, 48, 96, 192, 384, 768]) == False\n assert candidate(arr = [100000, -100000, 50000, -50000, 25000, -25000, 12500, -12500, 6250, -6250]) == False\n assert candidate(arr = [0, 0, 0, 0, 0, 0]) == True\n assert candidate(arr = [1, 2, 3, 4, 6, 8, 12, 16, 24, 32]) == True\n assert candidate(arr = [10, 20, 20, 40, 80, 160, 320, 640]) == True\n assert candidate(arr = [1, 4, 2, 8, 4, 2]) == True\n assert candidate(arr = [1, 3, 5, 7, 2, 6, 10, 14, 4, 12]) == False\n assert candidate(arr = [-3, 3, -6, 6, -12, 12, -24, 24]) == True\n assert candidate(arr = [100000, -100000, 50000, -50000, 25000, -25000, 12500, -12500, 6250, -6250, 3125, -3125, 15625, -15625, 78125, -78125]) == False\n assert candidate(arr = [3, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144]) == True\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]) == True\n assert candidate(arr = [5, 10, 15, 20, 25, 50, 100, 150, 200, 250]) == False\n assert candidate(arr = [10, 5, 5, 15, 20, 10]) == False\n assert candidate(arr = [1, 2, 3, 6, 4, 8, 9, 18, 12, 24]) == True\n assert candidate(arr = [-4, -8, -2, -1, -16, -2]) == True\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 6, 6, 12, 12]) == False\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 10, 20, 30, 40, 50, 60]) == False\n assert candidate(arr = [1, 1, 2, 2, 4, 4, 8, 8, 16, 16, 32, 32]) == True\n assert candidate(arr = [5, 10, 5, 20, 10, 40, 20, 80]) == False\n assert candidate(arr = [1, 3, 3, 6, 9, 18, 27, 54]) == False\n assert candidate(arr = [-1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 4, 6, 8, 10, 20]) == False\n assert candidate(arr = [3, 6, 1, 2, 18, 9, 27, 54]) == True\n assert candidate(arr = [6, 3, 3, 12, 2, 4]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 40, 5, 15, 30, 60]) == False\n assert candidate(arr = [1, 1, 2, 2, 4, 4, 8, 8]) == True\n assert candidate(arr = [1, 2, 2, 4, 4, 8, 8, 16, 16, 32, 32, 64]) == True\n assert candidate(arr = [1, 3, 2, 6, 4, 8, 5, 10, 7, 14, 9, 18, 11, 22, 12, 24]) == True\n assert candidate(arr = [-1, 1, -2, 2, -4, 4, -8, 8]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 4, 8, 16, 32, 64]) == False\n assert candidate(arr = [-1, 2, -2, 1, -4, 4, -8, 8, 16, -16]) == False\n assert candidate(arr = [3, 9, 1, 27, 3, 9, 27, 81]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == True\n assert candidate(arr = [1, 1, 2, 2, 4, 4, 8, 8, 16, 16]) == False\n assert candidate(arr = [-1, -2, -4, -8, -16, -32, -64, -128]) == True\n assert candidate(arr = [-1, 2, -2, 1]) == True\n assert candidate(arr = [1, -1, 2, -2, 4, -4, 8, -8]) == True\n assert candidate(arr = [6, 3, 12, 24, 48, 96, 192, 384, 768, 1536, 3, 6, 12, 24, 48, 96, 192, 384, 768, 1536]) == True\n assert candidate(arr = [-3, -6, -12, -24, -48, -96, -192, -384, -768, -1536]) == True\n assert candidate(arr = [-1, -2, -4, -8, 1, 2, 4, 8]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [3, 6, 12, 24, 48, 96, 192, 384]) == True\n assert candidate(arr = [1, 1, 2, 2, 4, 4, 8, 8, 16, 16, 32, 32, 64, 64, 128, 128]) == True\n assert candidate(arr = [3, 6, 9, 18, 27, 54]) == True\n assert candidate(arr = [-1, -2, -3, -6, -5, -10, -15, -30, -4, -8, -12, -24, -20, -40, -60, -120]) == True\n assert candidate(arr = [-10, 10, -20, 20, -30, 30, -40, 40, -50, 50]) == False\n assert candidate(arr = [1, 1, 1, 2, 2, 4, 4, 8, 8, 16]) == False\n assert candidate(arr = [-5, 5, -10, 10, -20, 20, -40, 40, -80, 80]) == False\n assert candidate(arr = [-5, -10, -20, -2, -4, -8, -1, -2, -4, -8]) == False\n assert candidate(arr = [10, 5, 3, 6, 2, 4, 8, 1]) == True\n assert candidate(arr = [-1, -2, -3, -6, -4, -8, -9, -18, -12, -24]) == True\n assert candidate(arr = [8, 4, 2, 1, 16, 32, 64, 128, 256, 512]) == True\n assert candidate(arr = [1, 2, 2, 4, 4, 4, 8, 8, 8, 8, 16, 16, 16, 16, 32, 32, 32, 32]) == False\n assert candidate(arr = [-2, 4, -8, 16, -32, 64, -128, 256]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == False\n assert candidate(arr = [4, 8, 4, 16, 8, 32, 2, 1]) == True\n assert candidate(arr = [-1, -3, -6, -12, -24, -48, -96, -192, -384, -768]) == False\n assert candidate(arr = [3, 6, 12, 24, 48, 96, 192, 384, 768, 1536]) == True\n assert candidate(arr = [-1, 1, -2, 2, -3, 3, -4, 4, -6, 6, -12, 12, -24, 24, -48, 48]) == False\n assert candidate(arr = [3, 6, 1, 2, 18, 9, 36, 18]) == True\n assert candidate(arr = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -18]) == False\n assert candidate(arr = [-1, -2, -3, -6, -3, -6]) == True\n assert candidate(arr = [5, 10, 15, 30, 60, 120, 240, 480]) == True\n assert candidate(arr = [1, 3, 2, 6, 4, 12, 8, 24]) == True\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().canReorderDoubled", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var canReorderDoubled = function(arr) {", "container": null, "callable": "canReorderDoubled", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 955, "task_id": "delete-columns-to-make-sorted-ii", "difficulty": "Medium", "problem_description": "You are given an array of n strings strs, all of the same length.\nWe may choose any deletion indices, and we delete all the characters in those indices for each string.\nFor example, if we have strs = [\"abcdef\",\"uvwxyz\"] and deletion indices {0, 2, 3}, then the final array after deletions is [\"bef\", \"vyz\"].\nSuppose we chose a set of deletion indices answer such that after deletions, the final array has its elements in lexicographic order (i.e., strs[0] <= strs[1] <= strs[2] <= ... <= strs[n - 1]). Return the minimum possible value of answer.length.\n \nExample 1:\n\nInput: strs = [\"ca\",\"bb\",\"ac\"]\nOutput: 1\nExplanation: \nAfter deleting the first column, strs = [\"a\", \"b\", \"c\"].\nNow strs is in lexicographic order (ie. strs[0] <= strs[1] <= strs[2]).\nWe require at least 1 deletion since initially strs was not in lexicographic order, so the answer is 1.\n\nExample 2:\n\nInput: strs = [\"xc\",\"yb\",\"za\"]\nOutput: 0\nExplanation: \nstrs is already in lexicographic order, so we do not need to delete anything.\nNote that the rows of strs are not necessarily in lexicographic order:\ni.e., it is NOT necessarily true that (strs[0][0] <= strs[0][1] <= ...)\n\nExample 3:\n\nInput: strs = [\"zyx\",\"wvu\",\"tsr\"]\nOutput: 3\nExplanation: We have to delete every column.\n\n \nConstraints:\n\nn == strs.length\n1 <= n <= 100\n1 <= strs[i].length <= 100\nstrs[i] consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(strs = ['ppp', 'qqq', 'rrr']) == 0\n assert candidate(strs = ['az', 'za']) == 0\n assert candidate(strs = ['xc', 'yb', 'za']) == 0\n assert candidate(strs = ['dog', 'cat', 'bat']) == 2\n assert candidate(strs = ['abcdef', 'uvwxyz']) == 0\n assert candidate(strs = ['abcd', 'abce', 'abcf']) == 0\n assert candidate(strs = ['aaa', 'aaa', 'aaa']) == 0\n assert candidate(strs = ['abc', 'bcd', 'cde']) == 0\n assert candidate(strs = ['zzz', 'aaa', 'zzz']) == 3\n assert candidate(strs = ['abc', 'acd', 'acc']) == 1\n assert candidate(strs = ['zyx', 'wvu', 'tsr']) == 3\n assert candidate(strs = ['axz', 'byz', 'cxz']) == 0\n assert candidate(strs = ['abc', 'acd', 'ace']) == 0\n assert candidate(strs = ['a', 'b', 'c']) == 0\n assert candidate(strs = ['abc', 'bca', 'cab']) == 0\n assert candidate(strs = ['zzz', 'zzz', 'zzz', 'zzz']) == 0\n assert candidate(strs = ['dddd', 'ddda', 'dddd', 'dddd']) == 1\n assert candidate(strs = ['aab', 'abc', 'aaa']) == 2\n assert candidate(strs = ['ca', 'bb', 'ac']) == 1\n assert candidate(strs = ['abcd', 'efgh', 'ijkl']) == 0\n assert candidate(strs = ['az', 'by', 'cx']) == 0\n assert candidate(strs = ['cba', 'daf', 'ghi']) == 0\n assert candidate(strs = ['aab', 'aac', 'aba']) == 0\n assert candidate(strs = ['ghi', 'daf', 'cba']) == 3\n assert candidate(strs = ['abcd', 'efgh', 'ijkl', 'mnop']) == 0\n assert candidate(strs = ['aaa', 'bbb', 'ccc']) == 0\n assert candidate(strs = ['a', 'b', 'c', 'd']) == 0\n assert candidate(strs = ['cba', 'bca', 'cab']) == 2\n assert candidate(strs = ['pqrs', 'qrsn', 'rsnp', 'snpq']) == 0\n assert candidate(strs = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yzabcd']) == 0\n assert candidate(strs = ['aax', 'aba', 'aca', 'ada']) == 0\n assert candidate(strs = ['aab', 'bac', 'aaa']) == 2\n assert candidate(strs = ['xyz', 'yza', 'zab', 'abc', 'bcd']) == 3\n assert candidate(strs = ['xyzz', 'yxzz', 'zxyy', 'zyyx']) == 0\n assert candidate(strs = ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh', 'ghi', 'hij', 'ijk', 'jkl', 'klm', 'lmn', 'mno', 'nop', 'opq', 'pqr', 'qrs', 'rst', 'stu', 'tuv', 'uvw', 'vwx', 'wxy', 'xyz']) == 0\n assert candidate(strs = ['abc', 'cab', 'bca', 'bac', 'acb', 'cba']) == 3\n assert candidate(strs = ['fgh', 'ghi', 'hij', 'ijk', 'jkl']) == 0\n assert candidate(strs = ['abcdef', 'bcdefg', 'cdefgh', 'defghi', 'efghij']) == 0\n assert candidate(strs = ['aaaaa', 'aaabb', 'aabaa', 'aabbb', 'abaaa', 'ababb', 'abaab', 'ababa', 'abbaa', 'abbab', 'abbba', 'abbbb', 'baaaa', 'baaab', 'baaba', 'baabb', 'bbaaa', 'bbaab', 'bbaba', 'bbbaa', 'bbbb', 'caaaa', 'caaab', 'caaba', 'caabb', 'cbaaa', 'cbaab', 'cbaba', 'cbbaa', 'cbbbb', 'daaaa', 'daaab', 'daaba', 'daabb', 'dbaaa', 'dbaab', 'dbaba', 'dbbaa', 'dbbbb', 'eaaaa', 'eaab', 'eaaba', 'eaabb', 'ebaaa', 'ebaab', 'ebaba', 'ebbaa', 'ebbbb', 'faaaa', 'faaab', 'faaba', 'faabb', 'fbaaa', 'fbaab', 'fbaba', 'fbbaa', 'fbbbb']) == 2\n assert candidate(strs = ['zzzzz', 'zzzzx', 'zzzzy', 'zzzzz', 'zzzzz']) == 1\n assert candidate(strs = ['abcde', 'bcdef', 'cdefg', 'defgh', 'efghi']) == 0\n assert candidate(strs = ['abcd', 'bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij']) == 0\n assert candidate(strs = ['abc', 'bac', 'bca', 'cab', 'cba', 'acb']) == 3\n assert candidate(strs = ['banana', 'bandana', 'bandanna']) == 0\n assert candidate(strs = ['zzzzz', 'zzzzz', 'zzzzz', 'zzzzz', 'zzzzz', 'zzzzz', 'zzzzz', 'zzzzz', 'zzzzz']) == 0\n assert candidate(strs = ['qrst', 'prst', 'qrst', 'qrst', 'qrst']) == 1\n assert candidate(strs = ['ghijkl', 'hijklm', 'ijklmn', 'jklmno', 'klmnop']) == 0\n assert candidate(strs = ['random', 'ranbom', 'randam', 'randbm', 'randmm']) == 2\n assert candidate(strs = ['lmno', 'mnop', 'opqr', 'pqrs', 'qrst']) == 0\n assert candidate(strs = ['xyz', 'zyx', 'wxy', 'uvw']) == 3\n assert candidate(strs = ['xyzz', 'yxzz', 'zxyz', 'zzxy', 'zzzx']) == 0\n assert candidate(strs = ['abcd', 'abdc', 'acdb', 'adbc']) == 0\n assert candidate(strs = ['banana', 'banaba', 'banaaa', 'banbaa']) == 1\n assert candidate(strs = ['zzzz', 'zzzy', 'zzzx', 'zzxw', 'zzvw', 'zxvw', 'xvwu']) == 4\n assert candidate(strs = ['pqrst', 'qrstu', 'rstuv', 'stuvw', 'tuvwx', 'uvwxy', 'vwxyz']) == 0\n assert candidate(strs = ['abcd', 'dcba', 'abcd', 'dcba']) == 4\n assert candidate(strs = ['mnopqr', 'zyxwvu', 'tsrqup', 'lkjihg', 'fedcba']) == 6\n assert candidate(strs = ['abcde', 'bcdea', 'cdeab', 'deabc', 'eabcd']) == 0\n assert candidate(strs = ['apple', 'apply', 'appla']) == 1\n assert candidate(strs = ['zzzz', 'zzzy', 'zzzx', 'zzxw', 'zzvw', 'zzuv', 'zztu']) == 2\n assert candidate(strs = ['abcd', 'acbd', 'adbc', 'dabc', 'bdac']) == 4\n assert candidate(strs = ['xyz', 'xzy', 'yxz', 'yzx', 'zxy', 'zyx']) == 0\n assert candidate(strs = ['apple', 'apply', 'appla', 'apple', 'applq']) == 1\n assert candidate(strs = ['nmop', 'mnop', 'mnop', 'mnop']) == 1\n assert candidate(strs = ['xyz', 'xyw', 'xyv', 'xyu', 'xyt', 'xys', 'xyr', 'xyp', 'xyo', 'xyn', 'xym', 'xyl', 'xyk', 'xyj', 'xyi', 'xyh', 'xyg', 'xyf', 'xye', 'xyd', 'xyc', 'xyb', 'xya']) == 1\n assert candidate(strs = ['abcde', 'abcdf', 'abcef', 'abceg', 'abcde']) == 2\n assert candidate(strs = ['zzzz', 'zzzy', 'zzyy', 'zyyy', 'yyyy', 'yyyz']) == 4\n assert candidate(strs = ['random', 'randome', 'randomly', 'randomly', 'randomly']) == 0\n assert candidate(strs = ['mnop', 'lmno', 'opqr', 'pqrs', 'qrst']) == 4\n assert candidate(strs = ['aab', 'abc', 'abc']) == 0\n assert candidate(strs = ['qwerty', 'asdfgh', 'zxcvbn']) == 6\n assert candidate(strs = ['x', 'y', 'z', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a']) == 1\n assert candidate(strs = ['aabbcc', 'aabbbc', 'aabccc', 'aabccc', 'aabccc']) == 1\n assert candidate(strs = ['abc', 'bce', 'cae']) == 0\n assert candidate(strs = ['zebra', 'zaxar', 'zecos', 'zabba']) == 4\n assert candidate(strs = ['abcdef', 'bcdegh', 'cdefgh', 'defghi', 'efghij', 'fghijk']) == 0\n assert candidate(strs = ['aaaa', 'bbbb', 'cccc', 'dddd', 'eeee', 'ffff', 'gggg', 'hhhh']) == 0\n assert candidate(strs = ['apple', 'apply', 'appla', 'apppa']) == 1\n assert candidate(strs = ['abac', 'acba', 'baca', 'bcaa', 'cab', 'cba']) == 0\n assert candidate(strs = ['abcd', 'bcad', 'acbd']) == 1\n assert candidate(strs = ['abcd', 'adcb', 'bacd']) == 0\n assert candidate(strs = ['abcdabcd', 'bcdbcdbd', 'cdcddcdc', 'dedededc', 'eeedeeec']) == 0\n assert candidate(strs = ['aaaa', 'aaab', 'aaba', 'aabb', 'abaa', 'abab', 'abba', 'abbb', 'baaa', 'baab', 'baba', 'babb', 'bbaa', 'bbab', 'bbba', 'bbbb']) == 0\n assert candidate(strs = ['abcd', 'abdc', 'acdb', 'acbd']) == 2\n assert candidate(strs = ['abcd', 'abdc', 'acbd', 'acdb', 'adbc', 'adcb', 'bacd', 'badc', 'bcad', 'bcda', 'bdac', 'bdca', 'cabd', 'cadb', 'cbad', 'cbda', 'cdab', 'cdba', 'dabc', 'dacb', 'dbac', 'dbca', 'dcab', 'dcba']) == 0\n assert candidate(strs = ['aaaabbbb', 'bbbbaaaa', 'aabbaabb', 'abababab', 'bbaabbaa']) == 8\n assert candidate(strs = ['acbac', 'bcbac', 'cbbac', 'dcbac', 'ecbac', 'fcbac']) == 0\n assert candidate(strs = ['moon', 'moan', 'moon', 'mane']) == 3\n assert candidate(strs = ['aabbcc', 'ababcc', 'aaccbb']) == 2\n assert candidate(strs = ['aabbcc', 'abacbc', 'abcabc', 'aabcbc', 'aacbbc']) == 4\n assert candidate(strs = ['aaa', 'aba', 'aaa', 'aca', 'aaa']) == 1\n assert candidate(strs = ['aa', 'bb', 'aa', 'bb', 'aa', 'bb', 'aa', 'bb', 'aa', 'bb']) == 2\n assert candidate(strs = ['aaaaa', 'aaabb', 'aabaa', 'aabab', 'aaced', 'aacef', 'aaceg', 'aaceh', 'aacei', 'aacej', 'aacek', 'aacei', 'aacej', 'aacek', 'aacei', 'aacej', 'aacek', 'aacei', 'aacej', 'aacek']) == 1\n assert candidate(strs = ['aaa', 'aab', 'aac', 'aad', 'aae', 'aaf', 'aag', 'aah', 'aai', 'aaj', 'aak', 'aal', 'aam', 'aan', 'aao', 'aap', 'aaq', 'aar', 'aas', 'aat', 'aau', 'aav', 'aaw', 'aax', 'aay', 'aaz']) == 0\n assert candidate(strs = ['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yzab']) == 0\n assert candidate(strs = ['abcdef', 'bcdefa', 'cdefab', 'defabc', 'efabcd', 'fabcde']) == 0\n assert candidate(strs = ['abcdef', 'uvwxyz', 'ghijkl']) == 6\n assert candidate(strs = ['aaaa', 'aaab', 'aaac', 'aaba', 'aabb', 'aabc', 'aaca', 'aacb', 'aacc', 'abaa', 'abab', 'abac', 'abba', 'abbb', 'abbc', 'abca', 'abcb', 'abcc', 'acaa', 'acab', 'acac', 'acba', 'acbb', 'acbc', 'acca', 'accb', 'accc', 'baaa', 'baab', 'baac', 'baba', 'babb', 'babc', 'baca', 'bacb', 'bacc', 'bbaa', 'bbab', 'bbac', 'bbba', 'bbbb', 'bbbc', 'bbca', 'bbcb', 'bbcc', 'bcaa', 'bcab', 'bcac', 'bcba', 'bcbb', 'bcbc', 'bccb', 'bccc', 'caaa', 'caab', 'caac', 'caba', 'cabb', 'cabc', 'caca', 'cacb', 'cacc', 'cbaa', 'cbab', 'cbac', 'cbba', 'cbbb', 'cbbc', 'cbca', 'cbcb', 'cbcc', 'ccaa', 'ccab', 'ccac', 'ccba', 'ccbb', 'ccbc', 'ccca', 'cccb', 'cccc']) == 0\n assert candidate(strs = ['mnop', 'mnop', 'mnop', 'mnop', 'mnop']) == 0\n assert candidate(strs = ['pqrs', 'psrq', 'qrst', 'rpsq', 'srqp', 'tqrs']) == 0\n assert candidate(strs = ['aabc', 'abac', 'abca', 'acba', 'acab', 'baca', 'bacb', 'baac', 'bcaa', 'cab', 'cbab', 'caba', 'cbba', 'cbaa']) == 3\n assert candidate(strs = ['lkjihg', 'kjihgf', 'jihgfe', 'ihgfed', 'hgfedc']) == 6\n assert candidate(strs = ['abcdef', 'bcdefa', 'cdefab']) == 0\n assert candidate(strs = ['qwe', 'qaz', 'qwr']) == 2\n assert candidate(strs = ['aaa', 'aab', 'aac', 'aad', 'baa', 'aba', 'aca', 'ada', 'baa', 'aba', 'aca', 'ada', 'baa', 'aba', 'aca', 'ada']) == 3\n assert candidate(strs = ['banana', 'bandana', 'bandanna', 'bandanna']) == 0\n assert candidate(strs = ['zzzz', 'zzyz', 'zzyy', 'zzyx', 'zzyw']) == 2\n assert candidate(strs = ['qwer', 'qweq', 'qwew', 'qwea', 'qwqa', 'qwaq', 'qwaq', 'qwaa', 'qaaa', 'qqaa', 'qqqa', 'qqqw', 'qqqq', 'qwqw', 'qwwq', 'qwqw', 'qqqw']) == 3\n assert candidate(strs = ['abcdefgh', 'hgfedcba', 'abcdefgh', 'hgfedcba']) == 8\n assert candidate(strs = ['aabcc', 'abcab', 'acaba', 'cacab', 'ccaba']) == 0\n assert candidate(strs = ['baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab', 'baab']) == 0\n assert candidate(strs = ['abcd', 'abdc', 'acdb', 'adbc', 'aebc', 'afdc', 'agdb', 'ahbc']) == 0\n assert candidate(strs = ['abcdef', 'bcdegh', 'cdefij']) == 0\n assert candidate(strs = ['abcd', 'abce', 'abcf', 'abcd']) == 1\n assert candidate(strs = ['abcdefg', 'bcdefga', 'cdefgab']) == 0\n assert candidate(strs = ['abcd', 'abce', 'abcf', 'abcg']) == 0\n assert candidate(strs = ['xyz', 'xyw', 'xyv', 'xyu', 'xyt', 'xys', 'xyr', 'xqq', 'xpp', 'xoo', 'xnn', 'xmm', 'xll', 'xkk', 'xjj', 'xii', 'xhh', 'xgg', 'xff', 'xee', 'xed', 'xec', 'xeb', 'xea']) == 2\n assert candidate(strs = ['abcd', 'azxy', 'abcy']) == 2\n assert candidate(strs = ['abcd', 'bcde', 'cdef', 'defg', 'efgh']) == 0\n assert candidate(strs = ['hello', 'hellp', 'helpp', 'helpq']) == 0\n assert candidate(strs = ['qpwoeiruty', 'asdfghjklz', 'xcvbnm']) == 4\n assert candidate(strs = ['aabbcc', 'bbccdd', 'ccddeeff', 'ddeeffgg', 'eeffgghh', 'ffgghhii', 'gghhiijj', 'hhiijjkk', 'iijjkkll', 'jjkkllmm', 'kkllmmnn', 'llmmnnoo', 'mmnnoopq', 'nnoopqrs', 'oopqrstu', 'pqrstuvw', 'qrstuvwx', 'rstuvwxy', 'stuvwxyz']) == 0\n assert candidate(strs = ['aaaa', 'aaba', 'aabb', 'abaa', 'abab', 'abbb', 'baaa', 'baab', 'baba', 'babb', 'bbaa', 'bbab', 'bbbb']) == 0\n assert candidate(strs = ['abc', 'bca', 'cab', 'bac', 'acb', 'cba']) == 3\n assert candidate(strs = ['dog', 'cat', 'bat']) == 2\n assert candidate(strs = ['aaaa', 'abaa', 'acaa', 'aada', 'abca', 'abda', 'acba', 'acda', 'aaca', 'aada', 'aaca', 'aaba', 'abba', 'abca', 'acca', 'adca', 'aada', 'aaca', 'aaca', 'aaba']) == 2\n assert candidate(strs = ['zebra', 'zorro', 'zebra']) == 3\n assert candidate(strs = ['aaaa', 'bbbb', 'cccc', 'dddd', 'eeee']) == 0\n assert candidate(strs = ['pqrs', 'qrst', 'rstu', 'stuv']) == 0\n assert candidate(strs = ['ghi', 'ghi', 'ghi']) == 0\n assert candidate(strs = ['leetcode', 'lintcode', 'testcode']) == 0\n assert candidate(strs = ['abcd', 'abdc', 'acbd']) == 0\n assert candidate(strs = ['abcd', 'bcad', 'cdab']) == 0\n assert candidate(strs = ['abcd', 'abdc', 'abcf']) == 2\n assert candidate(strs = ['hello', 'helps', 'helpp']) == 1\n assert candidate(strs = ['xga', 'xfb', 'yfa']) == 1\n assert candidate(strs = ['aab', 'aac', 'aba', 'aca', 'baa', 'bac', 'bba', 'bbc']) == 0\n assert candidate(strs = ['fed', 'efd', 'eef']) == 2\n assert candidate(strs = ['cba', 'bca', 'abc']) == 2\n assert candidate(strs = ['abc', 'def', 'ghi']) == 0\n assert candidate(strs = ['xyz', 'xyw', 'xyv']) == 1\n assert candidate(strs = ['cba', 'bac', 'bca']) == 3\n assert candidate(strs = ['hello', 'helps', 'heroes']) == 0\n assert candidate(strs = ['zzz', 'aaa', 'zzz']) == 3\n assert candidate(strs = ['zyx', 'wvu', 'tsr']) == 3\n assert candidate(strs = ['zzz', 'zyz', 'zxz']) == 1\n assert candidate(strs = ['aab', 'aac', 'abc']) == 0\n assert candidate(strs = ['abcd', 'dcba', 'abdc']) == 4\n assert candidate(strs = ['zzz', 'zyx', 'zyy']) == 2\n assert candidate(strs = ['zzzz', 'zzyy', 'zyzy', 'zyyz']) == 3\n assert candidate(strs = ['aab', 'aac', 'aba', 'aca']) == 0\n assert candidate(strs = ['dog', 'cat', 'bat']) == 2\n assert candidate(strs = ['abcd', 'abdc', 'acdb']) == 0\n assert candidate(strs = ['zyxw', 'zyxv', 'zyxu']) == 1\n assert candidate(strs = ['fed', 'efd', 'gfd']) == 1\n assert candidate(strs = ['a', 'a', 'a', 'a']) == 0\n assert candidate(strs = ['ghi', 'jkl', 'mno']) == 0\n assert candidate(strs = ['zzz', 'zyx', 'zyw']) == 2\n assert candidate(strs = ['abc', 'acd', 'aab']) == 2\n assert candidate(strs = ['zzzz', 'zzzz', 'zzzz']) == 0\n assert candidate(strs = ['zzzz', 'zzyz', 'zzyy', 'zzyx']) == 2\n assert candidate(strs = ['aaa', 'bbb', 'aaa']) == 3\n assert candidate(strs = ['c', 'b', 'a']) == 1\n assert candidate(strs = ['abcd', 'dcba', 'abcd']) == 4\n assert candidate(strs = ['e', 'd', 'c', 'b', 'a']) == 1\n assert candidate(strs = ['abcd', 'abcf', 'abcg']) == 0\n assert candidate(strs = ['zzz', 'zyz', 'zyx']) == 2\n assert candidate(strs = ['apple', 'apricot', 'banana']) == 0\n assert candidate(strs = ['aabbbabbb', 'bbbaabaab', 'aabbbbaab', 'abbbababa', 'bbaaabbbb', 'bbabaabab', 'abababbaa']) == 9\n assert candidate(strs = ['abcd', 'dcba', 'mnop']) == 0\n assert candidate(strs = ['fed', 'cab', 'dba']) == 3\n assert candidate(strs = ['abcd', 'abcf', 'abce']) == 1\n assert candidate(strs = ['cba', 'fed', 'ihg']) == 0\n assert candidate(strs = ['abcd', 'abdc', 'acbd', 'dacb']) == 0\n assert candidate(strs = ['zzz', 'zyz', 'yzz']) == 2\n assert candidate(strs = ['hello', 'helps', 'heaps']) == 1\n assert candidate(strs = ['zzz', 'zzz', 'zzz']) == 0\n assert candidate(strs = ['same', 'same', 'same']) == 0\n assert candidate(strs = ['abc', 'abc', 'abc']) == 0\n assert candidate(strs = ['xyp', 'ypp', 'xyp']) == 2\n assert candidate(strs = ['aab', 'aac', 'aab']) == 1\n assert candidate(strs = ['zz', 'zy', 'zx']) == 1\n assert candidate(strs = ['az', 'za', 'zz', 'aa']) == 2\n assert candidate(strs = ['abcd', 'acbd', 'dabc', 'dbca']) == 0\n assert candidate(strs = ['aaa', 'aab', 'aac']) == 0\n assert candidate(strs = ['cba', 'cab', 'bac']) == 2\n assert candidate(strs = ['hello', 'hilll', 'hillo']) == 0\n assert candidate(strs = ['rrjk', 'furt', 'guzm']) == 1\n assert candidate(strs = ['fed', 'dbc', 'cba']) == 3\n assert candidate(strs = ['a', 'b', 'c', 'd', 'e']) == 0\n assert candidate(strs = ['hello', 'helps', 'hero']) == 0\n assert candidate(strs = ['abc', 'acd', 'aec']) == 0\n assert candidate(strs = ['ghi', 'def', 'abc']) == 3\n assert candidate(strs = ['fedcba', 'fedcba', 'fedcba']) == 0\n assert candidate(strs = ['azx', 'byy', 'czz']) == 0\n assert candidate(strs = ['xc', 'yb', 'za']) == 0\n assert candidate(strs = ['abcd', 'abcc', 'abcb', 'abca']) == 1\n assert candidate(strs = ['xzxbxyzz', 'xzyxzzzx', 'xzyxzzyz', 'zyzzzxzx']) == 1\n assert candidate(strs = ['ca', 'bb', 'ac']) == 1\n assert candidate(strs = ['fed', 'efd', 'efd']) == 1\n assert candidate(strs = ['axb', 'ayb', 'azb']) == 0\n assert candidate(strs = ['pqrs', 'qrst', 'rstu']) == 0\n assert candidate(strs = ['hello', 'helli', 'hellp']) == 1\n assert candidate(strs = ['abc', 'acd', 'aab']) == 2\n assert candidate(strs = ['a', 'b', 'c']) == 0\n"}, "metadata": {"canonical_parameter_names": ["strs"], "leetcode_dataset_entry_point": "Solution().minDeletionSize", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minDeletionSize = function(strs) {", "container": null, "callable": "minDeletionSize", "parameters": [{"name": "strs", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 956, "task_id": "tallest-billboard", "difficulty": "Hard", "problem_description": "You are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one on each side. Each steel support must be an equal height.\nYou are given a collection of rods that can be welded together. For example, if you have rods of lengths 1, 2, and 3, you can weld them together to make a support of length 6.\nReturn the largest possible height of your billboard installation. If you cannot support the billboard, return 0.\n \nExample 1:\n\nInput: rods = [1,2,3,6]\nOutput: 6\nExplanation: We have two disjoint subsets {1,2,3} and {6}, which have the same sum = 6.\n\nExample 2:\n\nInput: rods = [1,2,3,4,5,6]\nOutput: 10\nExplanation: We have two disjoint subsets {2,3,5} and {4,6}, which have the same sum = 10.\n\nExample 3:\n\nInput: rods = [1,2]\nOutput: 0\nExplanation: The billboard cannot be supported, so we return 0.\n\n \nConstraints:\n\n1 <= rods.length <= 20\n1 <= rods[i] <= 1000\nsum(rods[i]) <= 5000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(rods = [10, 20, 30, 40]) == 50\n assert candidate(rods = [100, 200, 300]) == 300\n assert candidate(rods = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(rods = [10, 20, 30, 40, 50]) == 70\n assert candidate(rods = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 50\n assert candidate(rods = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 20\n assert candidate(rods = [1, 3, 5, 7, 9]) == 12\n assert candidate(rods = [1]) == 0\n assert candidate(rods = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000]) == 10500\n assert candidate(rods = [100, 200, 300, 400, 500]) == 700\n assert candidate(rods = [1, 2, 3, 6]) == 6\n assert candidate(rods = [10, 10, 10, 10, 10, 10, 10, 10]) == 40\n assert candidate(rods = [3, 9, 7, 3, 5, 1, 100]) == 14\n assert candidate(rods = [5, 5, 5, 5, 5, 5]) == 15\n assert candidate(rods = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 50\n assert candidate(rods = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 105\n assert candidate(rods = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000]) == 10000\n assert candidate(rods = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 5\n assert candidate(rods = [1, 2]) == 0\n assert candidate(rods = [1, 2, 3, 4, 5, 6]) == 10\n assert candidate(rods = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73]) == 355\n assert candidate(rods = [10, 21, 32, 43, 54, 65, 76, 87, 98]) == 238\n assert candidate(rods = [500, 1500, 1000, 2000, 2500, 3000, 3500, 4000, 4500, 5000]) == 13500\n assert candidate(rods = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 232\n assert candidate(rods = [2, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 135\n assert candidate(rods = [100, 150, 200, 250, 300, 350, 400]) == 800\n assert candidate(rods = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200, 1250, 1300, 1350, 1400, 1450, 1500, 1550, 1600, 1650, 1700, 1750, 1800, 1850, 1900, 1950, 2000, 2050, 2100, 2150, 2200, 2250, 2300, 2350, 2400, 2450, 2500]) == 31850\n assert candidate(rods = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 55\n assert candidate(rods = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 135\n assert candidate(rods = [250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250]) == 2500\n assert candidate(rods = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946]) == 14326\n assert candidate(rods = [8, 15, 30, 10, 20, 25, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170]) == 785\n assert candidate(rods = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 1050\n assert candidate(rods = [12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96]) == 396\n assert candidate(rods = [999, 1000, 1001, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982]) == 9915\n assert candidate(rods = [100, 200, 300, 400, 500, 600]) == 1000\n assert candidate(rods = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]) == 210\n assert candidate(rods = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105]) == 420\n assert candidate(rods = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 162\n assert candidate(rods = [5, 25, 45, 65, 85, 105, 125, 145, 165, 185, 205, 225, 245, 265, 285, 305, 325, 345, 365, 385]) == 1950\n assert candidate(rods = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 525\n assert candidate(rods = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == 6000\n assert candidate(rods = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 500\n assert candidate(rods = [7, 14, 28, 56, 112, 224, 448, 896, 1792, 3584, 1, 2, 3, 4, 5]) == 3588\n assert candidate(rods = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210, 217, 224, 231, 238, 245, 252, 259, 266, 273, 280, 287, 294, 301, 308, 315]) == 3619\n assert candidate(rods = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000]) == 10500\n assert candidate(rods = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980]) == 9895\n assert candidate(rods = [1, 2, 5, 10, 20, 25]) == 30\n assert candidate(rods = [100, 200, 150, 300, 400, 500, 600, 700]) == 1400\n assert candidate(rods = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 525\n assert candidate(rods = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 105\n assert candidate(rods = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) == 0\n assert candidate(rods = [1, 10, 100, 1000, 10, 100, 1, 1000, 100, 10]) == 1111\n assert candidate(rods = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 600\n assert candidate(rods = [8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304]) == 0\n assert candidate(rods = [5, 10, 15, 20, 25, 30, 35, 40]) == 90\n assert candidate(rods = [10, 21, 32, 43, 54, 65, 76, 87, 98, 109, 120, 131, 142, 153, 164, 175, 186, 197, 208, 219]) == 1145\n assert candidate(rods = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]) == 0\n assert candidate(rods = [33, 66, 99, 132, 165, 198, 231, 264, 297, 330, 363, 396, 429, 462, 495]) == 1980\n assert candidate(rods = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519]) == 5095\n assert candidate(rods = [100, 150, 200, 250, 300, 350, 400, 450, 500]) == 1350\n assert candidate(rods = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 2700\n assert candidate(rods = [300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200]) == 12500\n assert candidate(rods = [101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367]) == 5453\n assert candidate(rods = [5, 15, 10, 20, 25, 30, 35, 40, 45, 50]) == 135\n assert candidate(rods = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]) == 0\n assert candidate(rods = [23, 37, 41, 53, 67, 89, 97, 101, 113, 131, 139, 149, 151, 163, 173, 181, 191, 193, 197, 199]) == 1244\n assert candidate(rods = [101, 202, 303, 404, 505, 606, 707, 808, 909, 1010, 1111, 1212, 1313, 1414, 1515, 1616, 1717, 1818, 1919, 2020]) == 10605\n assert candidate(rods = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 270\n assert candidate(rods = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 112\n assert candidate(rods = [999, 1000, 998, 1001, 997, 1002, 996, 1003, 995, 1004, 994, 1005, 993, 1006, 992, 1007, 991, 1008, 990, 1009]) == 9995\n assert candidate(rods = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]) == 0\n assert candidate(rods = [5, 15, 20, 25, 30, 35, 40]) == 85\n assert candidate(rods = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5]) == 30\n assert candidate(rods = [100, 200, 150, 50, 300, 400, 250, 100, 50, 150, 400, 300, 200, 100, 50, 150, 250, 300, 400, 100]) == 2000\n assert candidate(rods = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60]) == 195\n assert candidate(rods = [17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255, 272, 289, 306, 323, 340]) == 1785\n assert candidate(rods = [50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 425, 450, 475, 500]) == 2575\n assert candidate(rods = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]) == 195\n assert candidate(rods = [15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60]) == 300\n assert candidate(rods = [10, 15, 20, 25, 30, 35, 40, 45, 50]) == 135\n assert candidate(rods = [5, 5, 10, 10, 20, 20, 30, 30, 40, 40]) == 105\n assert candidate(rods = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 2700\n assert candidate(rods = [11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 220]) == 1155\n assert candidate(rods = [3, 9, 1, 4, 7, 2, 5, 6, 8, 10]) == 27\n assert candidate(rods = [123, 456, 789, 1011, 1213, 1415, 1617, 1819, 2021, 2223, 2425, 2627, 2829, 3031, 3233, 3435, 3637, 3839, 4041, 4243]) == 21824\n assert candidate(rods = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 200\n assert candidate(rods = [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11]) == 65\n assert candidate(rods = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77]) == 390\n assert candidate(rods = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 270\n assert candidate(rods = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 75\n assert candidate(rods = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 30\n assert candidate(rods = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]) == 318\n assert candidate(rods = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 1050\n assert candidate(rods = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 50, 75, 125, 150, 175, 225, 250, 275, 325, 350]) == 3750\n assert candidate(rods = [11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 220]) == 1155\n assert candidate(rods = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140]) == 735\n assert candidate(rods = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600]) == 1950\n"}, "metadata": {"canonical_parameter_names": ["rods"], "leetcode_dataset_entry_point": "Solution().tallestBillboard", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var tallestBillboard = function(rods) {", "container": null, "callable": "tallestBillboard", "parameters": [{"name": "rods", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 957, "task_id": "prison-cells-after-n-days", "difficulty": "Medium", "problem_description": "There are 8 prison cells in a row and each cell is either occupied or vacant.\nEach day, whether the cell is occupied or vacant changes according to the following rules:\n\nIf a cell has two adjacent neighbors that are both occupied or both vacant, then the cell becomes occupied.\nOtherwise, it becomes vacant.\n\nNote that because the prison is a row, the first and the last cells in the row can't have two adjacent neighbors.\nYou are given an integer array cells where cells[i] == 1 if the ith cell is occupied and cells[i] == 0 if the ith cell is vacant, and you are given an integer n.\nReturn the state of the prison after n days (i.e., n such changes described above).\n \nExample 1:\n\nInput: cells = [0,1,0,1,1,0,0,1], n = 7\nOutput: [0,0,1,1,0,0,0,0]\nExplanation: The following table summarizes the state of the prison on each day:\nDay 0: [0, 1, 0, 1, 1, 0, 0, 1]\nDay 1: [0, 1, 1, 0, 0, 0, 0, 0]\nDay 2: [0, 0, 0, 0, 1, 1, 1, 0]\nDay 3: [0, 1, 1, 0, 0, 1, 0, 0]\nDay 4: [0, 0, 0, 0, 0, 1, 0, 0]\nDay 5: [0, 1, 1, 1, 0, 1, 0, 0]\nDay 6: [0, 0, 1, 0, 1, 1, 0, 0]\nDay 7: [0, 0, 1, 1, 0, 0, 0, 0]\n\nExample 2:\n\nInput: cells = [1,0,0,1,0,0,1,0], n = 1000000000\nOutput: [0,0,1,1,1,1,1,0]\n\n \nConstraints:\n\ncells.length == 8\ncells[i] is either 0 or 1.\n1 <= n <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(cells = [0, 0, 0, 0, 0, 0, 0, 0],n = 5) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [1, 1, 1, 1, 1, 1, 1, 1],n = 2) == [0, 0, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [1, 1, 1, 1, 1, 1, 1, 1],n = 15) == [0, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(cells = [1, 0, 1, 0, 1, 0, 1, 0],n = 1) == [0, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(cells = [0, 1, 1, 0, 1, 1, 1, 0],n = 2) == [0, 1, 0, 1, 1, 1, 0, 0]\n assert candidate(cells = [0, 0, 0, 0, 0, 0, 0, 0],n = 15) == [0, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(cells = [1, 1, 0, 1, 0, 0, 1, 1],n = 15) == [0, 0, 1, 1, 0, 0, 0, 0]\n assert candidate(cells = [1, 0, 0, 1, 0, 0, 1, 0],n = 1000000000) == [0, 0, 1, 1, 1, 1, 1, 0]\n assert candidate(cells = [0, 0, 0, 0, 0, 0, 0, 0],n = 2) == [0, 0, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [0, 1, 1, 0, 1, 1, 0, 0],n = 15) == [0, 0, 0, 1, 0, 0, 0, 0]\n assert candidate(cells = [1, 1, 1, 1, 1, 1, 1, 1],n = 3) == [0, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(cells = [0, 0, 0, 0, 0, 1, 0, 0],n = 5) == [0, 1, 1, 1, 0, 0, 0, 0]\n assert candidate(cells = [1, 1, 1, 1, 1, 1, 1, 1],n = 1) == [0, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(cells = [0, 1, 1, 1, 1, 1, 1, 0],n = 14) == [0, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(cells = [0, 1, 0, 1, 1, 0, 0, 1],n = 7) == [0, 0, 1, 1, 0, 0, 0, 0]\n assert candidate(cells = [1, 0, 0, 0, 0, 0, 0, 1],n = 30) == [0, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(cells = [0, 1, 1, 0, 0, 1, 1, 0],n = 20) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [1, 0, 0, 1, 0, 0, 1, 0],n = 28) == [0, 0, 1, 1, 1, 0, 0, 0]\n assert candidate(cells = [1, 1, 0, 1, 0, 1, 0, 1],n = 15) == [0, 0, 1, 1, 1, 1, 1, 0]\n assert candidate(cells = [1, 1, 0, 1, 1, 0, 1, 1],n = 7) == [0, 0, 1, 0, 0, 1, 0, 0]\n assert candidate(cells = [0, 1, 1, 1, 1, 1, 1, 0],n = 1000) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(cells = [1, 1, 0, 0, 0, 0, 1, 1],n = 10) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [1, 0, 1, 0, 0, 0, 1, 1],n = 100) == [0, 0, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [1, 0, 0, 0, 0, 0, 0, 1],n = 20) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(cells = [0, 1, 0, 0, 1, 0, 0, 1],n = 1000) == [0, 1, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [0, 1, 1, 1, 0, 1, 1, 0],n = 500) == [0, 1, 1, 0, 1, 0, 0, 0]\n assert candidate(cells = [0, 0, 1, 0, 0, 1, 0, 0],n = 1000000000) == [0, 0, 1, 0, 0, 1, 0, 0]\n assert candidate(cells = [0, 0, 1, 1, 1, 1, 0, 0],n = 50) == [0, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(cells = [0, 0, 0, 1, 1, 1, 1, 0],n = 10) == [0, 1, 1, 1, 1, 0, 1, 0]\n assert candidate(cells = [0, 1, 0, 0, 0, 1, 0, 1],n = 300) == [0, 0, 1, 1, 0, 1, 1, 0]\n assert candidate(cells = [1, 0, 1, 1, 0, 0, 1, 0],n = 10) == [0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(cells = [0, 1, 1, 1, 0, 1, 1, 0],n = 2000000000) == [0, 1, 0, 0, 0, 1, 1, 0]\n assert candidate(cells = [0, 0, 0, 1, 1, 1, 0, 0],n = 999999999) == [0, 1, 0, 1, 0, 1, 0, 0]\n assert candidate(cells = [1, 0, 0, 1, 1, 0, 0, 1],n = 1250) == [0, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(cells = [1, 1, 1, 0, 0, 1, 1, 1],n = 25) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(cells = [0, 1, 1, 1, 0, 1, 1, 0],n = 20) == [0, 0, 0, 0, 1, 0, 1, 0]\n assert candidate(cells = [1, 0, 0, 0, 0, 1, 0, 0],n = 1000) == [0, 0, 0, 0, 0, 1, 0, 0]\n assert candidate(cells = [1, 0, 1, 0, 1, 0, 1, 0],n = 1000000000) == [0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(cells = [1, 1, 0, 0, 1, 0, 0, 1],n = 1000) == [0, 1, 0, 1, 1, 1, 1, 0]\n assert candidate(cells = [1, 1, 1, 1, 1, 1, 1, 1],n = 1000000) == [0, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(cells = [1, 1, 1, 0, 1, 0, 1, 1],n = 1000000000) == [0, 1, 1, 1, 0, 1, 1, 0]\n assert candidate(cells = [1, 1, 0, 1, 0, 1, 0, 1],n = 5) == [0, 1, 0, 0, 1, 1, 1, 0]\n assert candidate(cells = [1, 1, 0, 0, 1, 1, 0, 0],n = 500000000) == [0, 0, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [0, 1, 0, 1, 0, 1, 0, 1],n = 30) == [0, 0, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [1, 1, 0, 0, 1, 1, 0, 0],n = 67890) == [0, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(cells = [0, 1, 0, 1, 0, 1, 0, 1],n = 200) == [0, 1, 0, 0, 0, 0, 1, 0]\n assert candidate(cells = [1, 0, 0, 0, 0, 0, 0, 1],n = 100000000) == [0, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(cells = [0, 0, 1, 1, 1, 1, 1, 0],n = 100) == [0, 1, 0, 0, 1, 0, 0, 0]\n assert candidate(cells = [0, 1, 0, 1, 0, 1, 0, 1],n = 50) == [0, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(cells = [0, 0, 0, 0, 0, 0, 0, 0],n = 1000000000) == [0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(cells = [0, 1, 1, 1, 1, 1, 1, 0],n = 10000) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [1, 0, 0, 0, 0, 0, 0, 1],n = 1000000000) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(cells = [1, 1, 1, 0, 0, 0, 1, 1],n = 50) == [0, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(cells = [1, 1, 1, 1, 0, 0, 0, 0],n = 50) == [0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(cells = [0, 0, 1, 0, 0, 1, 0, 0],n = 30) == [0, 0, 1, 0, 0, 1, 0, 0]\n assert candidate(cells = [0, 0, 0, 1, 0, 0, 0, 0],n = 500) == [0, 1, 0, 0, 1, 1, 0, 0]\n assert candidate(cells = [1, 1, 0, 0, 0, 1, 1, 0],n = 15) == [0, 0, 0, 1, 0, 0, 0, 0]\n assert candidate(cells = [1, 1, 0, 0, 0, 1, 0, 0],n = 15) == [0, 0, 0, 1, 0, 1, 0, 0]\n assert candidate(cells = [1, 0, 1, 0, 0, 1, 0, 1],n = 1000000) == [0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(cells = [0, 0, 1, 1, 1, 1, 1, 0],n = 50) == [0, 0, 1, 1, 1, 0, 0, 0]\n assert candidate(cells = [1, 1, 0, 1, 0, 1, 0, 1],n = 999999999) == [0, 1, 0, 0, 1, 1, 1, 0]\n assert candidate(cells = [1, 1, 0, 0, 1, 1, 0, 1],n = 15) == [0, 0, 0, 0, 0, 0, 1, 0]\n assert candidate(cells = [0, 0, 1, 1, 0, 0, 1, 1],n = 1000) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [1, 0, 1, 0, 1, 0, 1, 0],n = 78654321) == [0, 1, 0, 0, 0, 0, 1, 0]\n assert candidate(cells = [1, 0, 1, 0, 1, 0, 1, 0],n = 1500000000) == [0, 0, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [1, 0, 0, 0, 0, 0, 0, 1],n = 50) == [0, 0, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [0, 1, 1, 0, 1, 0, 1, 0],n = 1000000000) == [0, 0, 0, 1, 0, 0, 0, 0]\n assert candidate(cells = [1, 1, 0, 1, 0, 1, 0, 0],n = 200) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [1, 0, 0, 1, 1, 0, 0, 1],n = 1000000000) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [0, 1, 0, 0, 1, 1, 0, 1],n = 10) == [0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(cells = [0, 0, 1, 0, 1, 0, 1, 0],n = 1000000) == [0, 1, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [1, 0, 0, 0, 0, 0, 0, 1],n = 100) == [0, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(cells = [1, 1, 1, 0, 0, 1, 1, 1],n = 15) == [0, 1, 0, 0, 0, 0, 1, 0]\n assert candidate(cells = [0, 1, 0, 1, 0, 1, 0, 1],n = 14) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(cells = [0, 1, 0, 1, 0, 1, 0, 1],n = 1000) == [0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(cells = [1, 0, 1, 0, 1, 0, 1, 0],n = 999999999) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [0, 1, 1, 0, 0, 1, 1, 0],n = 1000) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [0, 1, 0, 0, 1, 0, 1, 0],n = 14) == [0, 1, 0, 0, 1, 0, 1, 0]\n assert candidate(cells = [1, 0, 1, 1, 1, 1, 0, 1],n = 10) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(cells = [1, 0, 1, 0, 0, 1, 0, 1],n = 60) == [0, 0, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [0, 0, 0, 1, 1, 0, 0, 0],n = 30) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [0, 1, 0, 1, 0, 1, 0, 1],n = 100) == [0, 0, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [0, 1, 0, 1, 0, 1, 0, 1],n = 500000000) == [0, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(cells = [1, 0, 1, 1, 0, 0, 1, 0],n = 150) == [0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(cells = [0, 0, 1, 1, 1, 1, 0, 0],n = 1500) == [0, 1, 0, 0, 0, 0, 1, 0]\n assert candidate(cells = [0, 0, 1, 1, 1, 1, 0, 0],n = 7) == [0, 0, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [1, 0, 1, 1, 0, 1, 0, 1],n = 1000000000) == [0, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(cells = [1, 0, 1, 1, 0, 0, 1, 1],n = 100000) == [0, 1, 1, 0, 1, 0, 1, 0]\n assert candidate(cells = [1, 1, 0, 0, 0, 0, 1, 1],n = 50) == [0, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(cells = [0, 0, 1, 1, 0, 0, 1, 1],n = 30) == [0, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(cells = [0, 0, 1, 1, 1, 1, 0, 0],n = 20) == [0, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(cells = [0, 1, 1, 0, 1, 0, 1, 0],n = 1000000) == [0, 1, 1, 1, 1, 0, 0, 0]\n assert candidate(cells = [1, 1, 0, 1, 0, 1, 0, 1],n = 750) == [0, 1, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [1, 1, 1, 0, 1, 0, 1, 1],n = 12) == [0, 0, 0, 0, 1, 0, 1, 0]\n assert candidate(cells = [1, 1, 1, 1, 1, 1, 1, 1],n = 100) == [0, 0, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [1, 1, 0, 0, 1, 1, 0, 0],n = 20) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [1, 0, 0, 1, 1, 0, 0, 1],n = 1000) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [1, 1, 0, 0, 0, 0, 1, 1],n = 10000) == [0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(cells = [1, 1, 0, 0, 0, 0, 0, 1],n = 8) == [0, 0, 1, 1, 1, 0, 0, 0]\n assert candidate(cells = [0, 0, 0, 1, 1, 0, 0, 0],n = 500000000) == [0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(cells = [1, 0, 1, 1, 0, 1, 1, 1],n = 20) == [0, 0, 1, 1, 1, 0, 0, 0]\n assert candidate(cells = [0, 0, 1, 1, 0, 0, 1, 1],n = 100) == [0, 1, 1, 1, 1, 1, 1, 0]\n"}, "metadata": {"canonical_parameter_names": ["cells", "n"], "leetcode_dataset_entry_point": "Solution().prisonAfterNDays", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var prisonAfterNDays = function(cells, n) {", "container": null, "callable": "prisonAfterNDays", "parameters": [{"name": "cells", "type": "number[]"}, {"name": "n", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 958, "task_id": "check-completeness-of-a-binary-tree", "difficulty": "Medium", "problem_description": "Given the root of a binary tree, determine if it is a complete binary tree.\nIn a complete binary tree, every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between 1 and 2h nodes inclusive at the last level h.\n \nExample 1:\n\n\nInput: root = [1,2,3,4,5,6]\nOutput: true\nExplanation: Every level before the last is full (ie. levels with node-values {1} and {2, 3}), and all nodes in the last level ({4, 5, 6}) are as far left as possible.\n\nExample 2:\n\n\nInput: root = [1,2,3,4,5,null,7]\nOutput: false\nExplanation: The node with value 7 isn't as far left as possible.\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 100].\n1 <= Node.val <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7])) == True\n assert candidate(root = tree_node([1, 2, 3, None, None, 6, 7])) == False\n assert candidate(root = tree_node([1, 2, 3, 4])) == True\n assert candidate(root = tree_node([1, 2])) == True\n assert candidate(root = tree_node([1, None, 2])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6])) == False\n assert candidate(root = tree_node([1])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None, 8])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7])) == False\n assert candidate(root = tree_node([1, None, 3])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 6])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 7])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, None, 5, 6, 7])) == False\n assert candidate(root = tree_node([1, 2, 3, None, 5])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, None])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 8, 9, None, None, 12, 13])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, None, None, None, None, 30])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, None, None, 7, 8, 9, 10, 11, 12, None, None, 13, 14, 15, 16, 17, 18, 19, 20, 21, None, None, None, None, 22, 23, 24, 25])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 22, 23, 24])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None, 8, 9, 10, 11, 12, 13, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7, 8, 9, 10, None, None, 13, 14, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, 24])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 23, 24])) == False\n assert candidate(root = tree_node([1, 2, None, 3, 4, 5, None, None, None, None, 6])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 7, 8, None, None, None, None, None, None, 9])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, None, None, 13, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, 10, 11])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 8, 9, 10, 11, None, None, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 7, 8, 9, 10, None, None, 13, None, 15, None, None, None, None, 24, None, 26, None, 28, None, 30])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 7, 8, None, None, 11, 12, None, None, 16])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 21, 22, 23, 24])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7, None, None, None, None, None, None, None, 14, None, None, None, 18])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, None, None, None, None, 16, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 7, 8, 9, 10, None, None, 13, None, 15, None, None, None, None, 24, None, 26, None, 28])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])) == True\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5, 6, 7, 8, 9, 10, 11, 12])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, None, 9, None, None, None, None, None, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, None, None, None, None, None, 19, 20, 21])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 8, 9, 10, 11, 12, 13, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, None, 5, 6, 7, None, None, None, None, None, None, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, None, None, None, None, None, 16, 17])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None, 8, 9, 10, 11, None, 14, 15, 16])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 24])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None, 8, 9, 10, 11, 12, None, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9, 10, 11, None, None, 12, 13])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, 12, 13, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7, None, 9, 10, 11, None, None, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7, 8, 9, None, 11, None, 13])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, None, None, 9, 10])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, None, None, 6])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, 15, None, None, None, 16, 17, 18, 19, 20])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, None, 14, 15, 16, 17, 18, 19, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, None, None, None, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, None])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, 7, 8, None, None, 9, None, None, None, 10])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, None, None, None, 13])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, None, None])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, 15, None, None, None, None, None, None, 24, 25])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, None, None, None, None, None, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, 8, None, None, None, None, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, 13, None, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, None, 14, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 31])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, None, None, 9, 10, None, None, 15, 16])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, 13, None, 15, 16])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, 10, 11, None, 12])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None, 8, 9, 10, 11, None, None, None, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, 8, 9, None, 11, 12, 13, None, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None, 7, 8, 9, 10, 11, 12, 13, 14, None, None, None, None, None, None, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7, 8, 9, 10, 11, 12, None, 13, None, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, None, None, 25, None, None, None, None, None, None, None, None, None, None, None, 26])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, 8, None, 11, None, None, None, 15, 16])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, 16, 17, None, None, None, None, None, None, None, None, 32])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, 13, 14, 15, None, 17])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7, 8, 9, 10, 11, 12, 13, None, 15, None, None, None, 32, 33, 34, None, None, None, None, None, 64, 65, 66, 67, None, None, None, None, None, 128, 129, 130, 131, 132, None, None, None, None, None, None, None, None, None, 256, 257, 258, 259, 260, 261, 262, 263])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 7, 8, None, None, None, None, 14])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7, 8, 9, 10, 11, 12, 13, None, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, 8])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, None, 13, None, None, 17, 18, None, None, 21, 22])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, 11, 12, 13])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, 10, 11, 12, None, None, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, 6, 7, None, None, None, 8, 9])) == False\n assert candidate(root = tree_node([1, 2, None, 3, 4, None, 5, None, None, None, 6, None, None, None, None, 7])) == False\n assert candidate(root = tree_node([1, 2, 3, None, 5, 6, 7, 8, 9, None, 10, 11, 12, None, None, None, None, 13])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None, None, None, None, None, 13, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, None, None, None, None, None, 16])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, 16, 17, 18, 19])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, None, None, 16, 17, 18])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 8, 9, 10, 11, 12, 13, None, None, 16, 17, 18, 19, None, None, 24, 25, 26, None, None, 32, 33, 34, 35, 36, None, None, None, None, None, None, None, None, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, 8, 9, 10, None, None, 13, None, 15, None, None, None, None, 24, 25, None, 27])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, 16, 17])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, None, 8, None, 12, None, 15, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None, 7, 8, 9, 10, 11, 12, 13, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100])) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, 16, 17, 18, 19, 20])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, None, None, 13, None, 14])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, None, None, 16])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, None, None, None, 16, 17, 18, 19, None, None, None, None, None, 26])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, 8, None, 11, None, None, 15, None, None, None, 21, 22, 23])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None, 8, 9, None, 11, None, 13, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None, None, 9, 10, 11, 12, 13, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, 12, 13, None, 15, None, 17, 18, None, 20, 21])) == False\n assert candidate(root = tree_node([1, 2, 3, None, 5, 6, None, 8, 9, None, None, 12, 13, None, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, 8, None, None, None, None, None, None, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, 6, 7, None, None, 8, 9, None, None, None, None, None, 10, 11])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 9, 10, 11, 12, 13, 14, 15])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, None, None, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7, 8, 9, 10, 11, 12, 13, 14])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, None, 31])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, None, 7, None, None, None, None, None, 8, None, None, 9])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, None, None, 16, 17, None, None, 21, 22])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, None, 10])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11, None, None, None, None, None, 12])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, None, 7, 8, 9, 10, 11, 12, None, 14])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, None, None, None, None, None, None, None, None, None, None, 26])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 7, None, 9, None, None, 12, None, 14, None])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 7, 8, 9, None, None, 14, 15, 16, 17])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 8, 9, 10, 11, 12, 13, 14])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, 15, 16])) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, 14, 15, 16])) == False\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().isCompleteTree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isCompleteTree = function(root) {", "container": null, "callable": "isCompleteTree", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 959, "task_id": "regions-cut-by-slashes", "difficulty": "Medium", "problem_description": "An n x n grid is composed of 1 x 1 squares where each 1 x 1 square consists of a '/', '\\', or blank space ' '. These characters divide the square into contiguous regions.\nGiven the grid grid represented as a string array, return the number of regions.\nNote that backslash characters are escaped, so a '\\' is represented as '\\\\'.\n \nExample 1:\n\n\nInput: grid = [\" /\",\"/ \"]\nOutput: 2\n\nExample 2:\n\n\nInput: grid = [\" /\",\" \"]\nOutput: 1\n\nExample 3:\n\n\nInput: grid = [\"/\\\\\",\"\\\\/\"]\nOutput: 5\nExplanation: Recall that because \\ characters are escaped, \"\\\\/\" refers to \\/, and \"/\\\\\" refers to /\\.\n\n \nConstraints:\n\nn == grid.length == grid[i].length\n1 <= n <= 30\ngrid[i][j] is either '/', '\\', or ' '.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = ['\\\\/', '\\\\/', '\\\\/']) == 14\n assert candidate(grid = ['///', '///', '///']) == 6\n assert candidate(grid = ['\\\\\\\\', '\\\\\\\\', '\\\\\\\\']) == 14\n assert candidate(grid = ['/', '/', '/']) == 25\n assert candidate(grid = ['/\\\\', '/\\\\', '/\\\\']) == 14\n assert candidate(grid = ['\\\\/', '/\\\\', '\\\\/']) == 15\n assert candidate(grid = [' /', '/ ']) == 2\n assert candidate(grid = ['/\\\\', '\\\\/']) == 5\n assert candidate(grid = ['\\\\', '/']) == 9\n assert candidate(grid = [' /', ' ']) == 1\n assert candidate(grid = [' ', ' ', ' ']) == 1\n assert candidate(grid = ['//', '\\\\']) == 6\n assert candidate(grid = [' / ', '/ \\\\/', ' \\\\ ', '\\\\ / ']) == 10\n assert candidate(grid = [' ', '\\\\/', '/\\\\', ' ']) == 32\n assert candidate(grid = ['/\\\\/', '\\\\/\\\\', '/\\\\/', '\\\\/\\\\']) == 22\n assert candidate(grid = ['/\\\\/\\\\', '\\\\/\\\\/', '/\\\\/\\\\', '\\\\/\\\\/']) == 13\n assert candidate(grid = ['\\\\/', ' \\\\/', '\\\\/', '\\\\/', '/\\\\', '/\\\\', '/\\\\', '\\\\/']) == 191\n assert candidate(grid = ['\\\\ ', '\\\\ ', '\\\\ ', '\\\\ ']) == 30\n assert candidate(grid = ['/\\\\', '\\\\/', '/\\\\']) == 15\n assert candidate(grid = ['\\\\', '\\\\', '\\\\']) == 25\n assert candidate(grid = ['/\\\\ ', '\\\\/ ', '/\\\\ ', '\\\\/ ']) == 18\n assert candidate(grid = ['/ ', '\\\\ ', '/ ', '\\\\ ']) == 32\n assert candidate(grid = ['\\\\ ', ' / ', '\\\\ ']) == 7\n assert candidate(grid = ['\\\\/\\\\', '\\\\/\\\\', '\\\\/\\\\']) == 6\n assert candidate(grid = ['/\\\\/', '\\\\/\\\\', '/\\\\/']) == 8\n assert candidate(grid = ['\\\\/', ' / ', '/\\\\']) == 9\n assert candidate(grid = ['/\\\\', '\\\\/', '/\\\\']) == 15\n assert candidate(grid = ['\\\\/', '/\\\\', ' / ', '\\\\/']) == 29\n assert candidate(grid = ['\\\\/\\\\', '/\\\\/', '\\\\/\\\\']) == 8\n assert candidate(grid = ['\\\\\\\\', '/\\\\/', '\\\\/\\\\', '/\\\\\\\\']) == 24\n assert candidate(grid = [' ', ' ', ' ', ' ']) == 29\n assert candidate(grid = [' ', ' ', ' ', ' ', ' ']) == 1\n assert candidate(grid = ['/\\\\', '\\\\/', ' / ', '/\\\\', '\\\\/']) == 58\n assert candidate(grid = ['/\\\\/', '\\\\\\\\', '/\\\\/', '////']) == 21\n assert candidate(grid = [' ', ' ', ' ', ' ']) == 1\n assert candidate(grid = [' / ', '/\\\\/', ' / ']) == 4\n assert candidate(grid = ['\\\\ ', '/ ', '\\\\ ', '/ ']) == 31\n assert candidate(grid = ['/\\\\/', '/\\\\/', '/\\\\/']) == 6\n assert candidate(grid = [' ', '\\\\/', ' ']) == 4\n assert candidate(grid = ['\\\\/\\\\', '/\\\\/\\\\', '\\\\/\\\\', '/\\\\/\\\\']) == 17\n assert candidate(grid = ['\\\\ ', ' / ', ' / ', '\\\\ ']) == 21\n assert candidate(grid = [' ', ' ', ' ']) == 1\n assert candidate(grid = ['\\\\/', '/\\\\', '\\\\/', '/\\\\']) == 35\n assert candidate(grid = [' /\\\\', '/\\\\ ', '\\\\/ ', ' \\\\ /']) == 15\n assert candidate(grid = ['///', ' ', '\\\\\\\\', '///']) == 20\n assert candidate(grid = ['////', '////', '////', '////']) == 8\n assert candidate(grid = ['/\\\\ ', ' \\\\ ', '/\\\\ ', ' \\\\ ']) == 14\n assert candidate(grid = ['\\\\ \\\\/', '/ \\\\/', '\\\\ /', '/\\\\ ']) == 11\n assert candidate(grid = ['/ /', ' \\\\ ', '/ /', ' \\\\ ']) == 14\n assert candidate(grid = ['/\\\\/\\\\', '\\\\/\\\\/\\\\', '/\\\\/\\\\/', '\\\\/\\\\/\\\\', '/\\\\/\\\\']) == 22\n assert candidate(grid = ['\\\\/', '/\\\\', '\\\\/']) == 15\n assert candidate(grid = [' /', ' //', '///', '/\\\\']) == 20\n assert candidate(grid = ['\\\\', '\\\\', '\\\\']) == 25\n assert candidate(grid = ['/// ', '\\\\\\\\', '\\\\\\\\']) == 10\n assert candidate(grid = ['\\\\/\\\\', '\\\\/\\\\', '\\\\/\\\\', '\\\\/\\\\']) == 19\n assert candidate(grid = ['\\\\/\\\\', '\\\\/\\\\', '\\\\/\\\\']) == 6\n assert candidate(grid = [' /', '\\\\', ' ']) == 19\n assert candidate(grid = ['\\\\ ', '/ ', ' \\\\/', '/\\\\']) == 27\n assert candidate(grid = ['\\\\\\\\', '\\\\\\\\', '\\\\\\\\', '\\\\\\\\']) == 34\n assert candidate(grid = ['\\\\/\\\\', '/\\\\/\\\\', '\\\\/\\\\', '/\\\\/\\\\']) == 17\n assert candidate(grid = ['///', '///', ' ']) == 3\n assert candidate(grid = ['/\\\\\\\\', '\\\\/\\\\\\\\', '/\\\\\\\\', '\\\\/\\\\\\\\']) == 16\n assert candidate(grid = ['/\\\\/', '\\\\/\\\\', '/\\\\/', '\\\\/\\\\']) == 22\n assert candidate(grid = ['/\\\\ ', ' /\\\\ ', ' \\\\/\\\\', ' \\\\/ ']) == 7\n assert candidate(grid = ['\\\\\\\\ ', '\\\\\\\\ ', '\\\\\\\\ ', '\\\\\\\\ ', '\\\\\\\\ ']) == 38\n assert candidate(grid = ['\\\\/', '/\\\\', '\\\\/', '/\\\\']) == 35\n assert candidate(grid = ['\\\\\\\\', '////', '\\\\\\\\', '////']) == 22\n assert candidate(grid = [' //', '\\\\/', ' ']) == 8\n assert candidate(grid = ['/\\\\/', '\\\\///', '/\\\\/', '\\\\///']) == 16\n assert candidate(grid = [' /\\\\', '\\\\/ ', ' /\\\\', '\\\\/ ']) == 15\n assert candidate(grid = ['\\\\ ', '/\\\\', ' / ']) == 10\n assert candidate(grid = ['\\\\\\\\', '\\\\\\\\', '\\\\\\\\', '\\\\\\\\']) == 34\n assert candidate(grid = ['/\\\\/', '\\\\/\\\\', '\\\\/\\\\', '/\\\\/']) == 21\n assert candidate(grid = ['/\\\\/', '/\\\\/', '/\\\\/', '/\\\\/']) == 19\n assert candidate(grid = ['\\\\\\\\', '/\\\\/', '\\\\/\\\\', '/\\\\/']) == 25\n assert candidate(grid = ['\\\\\\\\', '\\\\\\\\', '\\\\\\\\', ' ']) == 25\n assert candidate(grid = [' \\\\/ ', '/\\\\/', ' \\\\/ ', '\\\\/ ']) == 9\n assert candidate(grid = ['\\\\\\\\', '\\\\ ', ' / ', '\\\\\\\\']) == 27\n assert candidate(grid = ['\\\\\\\\\\\\', '\\\\\\\\\\\\', '\\\\\\\\\\\\', '\\\\\\\\\\\\']) == 19\n assert candidate(grid = ['/\\\\/', ' / ', '\\\\/\\\\']) == 5\n assert candidate(grid = ['\\\\/\\\\', ' / ', '\\\\/\\\\', ' / ', '\\\\/\\\\']) == 41\n assert candidate(grid = ['\\\\\\\\', '///', '\\\\\\\\', '///']) == 27\n assert candidate(grid = ['\\\\/\\\\/', '\\\\/\\\\/', '\\\\/\\\\/', '\\\\/\\\\/']) == 8\n assert candidate(grid = ['/\\\\', '\\\\/', '/\\\\', '\\\\/']) == 36\n assert candidate(grid = ['/\\\\/', '\\\\/\\\\', '/\\\\/']) == 8\n assert candidate(grid = ['\\\\\\\\', '\\\\\\\\', '\\\\\\\\', '\\\\\\\\', '\\\\\\\\']) == 62\n assert candidate(grid = ['\\\\\\\\', ' ', ' ', '\\\\\\\\']) == 15\n assert candidate(grid = ['/ /', ' / ', ' / ', '/ /']) == 15\n assert candidate(grid = ['\\\\/\\\\', '/\\\\/', '\\\\/\\\\', '/\\\\/', '\\\\/\\\\']) == 47\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().regionsBySlashes", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var regionsBySlashes = function(grid) {", "container": null, "callable": "regionsBySlashes", "parameters": [{"name": "grid", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 960, "task_id": "delete-columns-to-make-sorted-iii", "difficulty": "Hard", "problem_description": "You are given an array of n strings strs, all of the same length.\nWe may choose any deletion indices, and we delete all the characters in those indices for each string.\nFor example, if we have strs = [\"abcdef\",\"uvwxyz\"] and deletion indices {0, 2, 3}, then the final array after deletions is [\"bef\", \"vyz\"].\nSuppose we chose a set of deletion indices answer such that after deletions, the final array has every string (row) in lexicographic order. (i.e., (strs[0][0] <= strs[0][1] <= ... <= strs[0][strs[0].length - 1]), and (strs[1][0] <= strs[1][1] <= ... <= strs[1][strs[1].length - 1]), and so on). Return the minimum possible value of answer.length.\n \nExample 1:\n\nInput: strs = [\"babca\",\"bbazb\"]\nOutput: 3\nExplanation: After deleting columns 0, 1, and 4, the final array is strs = [\"bc\", \"az\"].\nBoth these rows are individually in lexicographic order (ie. strs[0][0] <= strs[0][1] and strs[1][0] <= strs[1][1]).\nNote that strs[0] > strs[1] - the array strs is not necessarily in lexicographic order.\nExample 2:\n\nInput: strs = [\"edcba\"]\nOutput: 4\nExplanation: If we delete less than 4 columns, the only row will not be lexicographically sorted.\n\nExample 3:\n\nInput: strs = [\"ghi\",\"def\",\"abc\"]\nOutput: 0\nExplanation: All rows are already lexicographically sorted.\n\n \nConstraints:\n\nn == strs.length\n1 <= n <= 100\n1 <= strs[i].length <= 100\nstrs[i] consists of lowercase English letters.\n\n\n \n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(strs = ['zyx', 'zyx', 'zyx']) == 2\n assert candidate(strs = ['rrjk', 'furt', 'guzm']) == 2\n assert candidate(strs = ['axx', 'ggs', 'zzz']) == 0\n assert candidate(strs = ['ghi', 'def', 'abc']) == 0\n assert candidate(strs = ['aaa', 'bbb', 'ccc']) == 0\n assert candidate(strs = ['abc', 'bcd', 'cde']) == 0\n assert candidate(strs = ['abc', 'abc', 'abc']) == 0\n assert candidate(strs = ['a', 'b', 'c', 'd']) == 0\n assert candidate(strs = ['abcdef', 'uvwxyz']) == 0\n assert candidate(strs = ['zzz', 'aaa', 'zzz']) == 0\n assert candidate(strs = ['zyx', 'wvu', 'tsr']) == 2\n assert candidate(strs = ['edcba']) == 4\n assert candidate(strs = ['abcd', 'abdc', 'acdb']) == 1\n assert candidate(strs = ['abcd', 'dbca', 'adcb', 'cbad']) == 3\n assert candidate(strs = ['babca', 'bbazb']) == 3\n assert candidate(strs = ['a', 'b', 'c']) == 0\n assert candidate(strs = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yzabcd']) == 2\n assert candidate(strs = ['abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij']) == 0\n assert candidate(strs = ['fedcb', 'edcba', 'dcbae', 'cbade', 'baced', 'acbed']) == 4\n assert candidate(strs = ['zyxwvutsrqponmlkjihgfedcba', 'zyxwvutsrqponmlkjihgfedcba', 'zyxwvutsrqponmlkjihgfedcba']) == 25\n assert candidate(strs = ['abcd', 'adbc', 'bacd', 'bdac']) == 2\n assert candidate(strs = ['abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij', 'abcdefghij']) == 0\n assert candidate(strs = ['abacabad', 'babacaba', 'cacabada', 'dacabada']) == 5\n assert candidate(strs = ['abcdabcd', 'dcbaabcd', 'abcdabdc', 'abdcabcd', 'abcdcdab', 'cdabcdab', 'abcdabcd', 'cdababcd', 'abcdcdab', 'dcabcdab']) == 6\n assert candidate(strs = ['abcdefgh', 'hgfedcba', 'abcdefgh', 'hgfedcba', 'abcdefgh']) == 7\n assert candidate(strs = ['leetcode', 'leetcoed', 'leetcdeo', 'leetcodeo', 'leetcodeo', 'leetcodeo']) == 5\n assert candidate(strs = ['zyx', 'yxz', 'xyz']) == 2\n assert candidate(strs = ['aabbaa', 'abcabc', 'acbacb', 'bacbac', 'bbacab']) == 4\n assert candidate(strs = ['zzz', 'yyy', 'xxx', 'www', 'vvv', 'uuu']) == 0\n assert candidate(strs = ['abcdefgh', 'bcadegfh', 'cgdbefha', 'dgfbceha', 'egfdcbha', 'fgecadhb']) == 5\n assert candidate(strs = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'abcdefghijklnmopqrstuvwxyz']) == 25\n assert candidate(strs = ['abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh']) == 0\n assert candidate(strs = ['zabc', 'zcad', 'zdba', 'zeac', 'zfcd', 'zgda', 'zhec', 'zida', 'zjea', 'zkcf']) == 3\n assert candidate(strs = ['abcd', 'bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij', 'hijk', 'ijkl', 'jklm']) == 0\n assert candidate(strs = ['azazaz', 'bababa', 'cacaca', 'dadada', 'eaeaea']) == 3\n assert candidate(strs = ['abcdefg', 'bcefgij', 'acdfhij']) == 0\n assert candidate(strs = ['abcd', 'abdc', 'acdb', 'cadb', 'dabc']) == 2\n assert candidate(strs = ['xyz', 'zyx', 'wvu', 'tsr', 'qpo', 'nml', 'kji', 'hgf', 'edc', 'baa']) == 2\n assert candidate(strs = ['aeg', 'bdh', 'cfi', 'egj', 'fhk', 'gjl']) == 0\n assert candidate(strs = ['qrst', 'mnop', 'ijkl', 'efgh', 'abcd', 'mnop', 'qrst', 'efgh', 'ijkl', 'abcd', 'mnop', 'qrst', 'efgh', 'ijkl', 'abcd', 'mnop', 'qrst', 'efgh', 'ijkl', 'abcd']) == 0\n assert candidate(strs = ['zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz']) == 0\n assert candidate(strs = ['zzzzzzzz', 'zzzzzzzy', 'zzzzzzzx', 'zzzzzzyx', 'zzzzzyxy', 'zzzzyxxy', 'zzzyxxyx', 'zzyxxyxy']) == 6\n assert candidate(strs = ['abcdefghij', 'abcdefghik', 'abcdefghij', 'abcdefghim', 'abcdefghin']) == 0\n assert candidate(strs = ['aabbcc', 'bbccaa', 'ccaabb', 'aabbbc']) == 4\n assert candidate(strs = ['abcdefg', 'bceghik', 'acegikm', 'adegimn']) == 0\n assert candidate(strs = ['qwertyuiop', 'asdfghjklz', 'zxcvbnmqwe', 'qwertyuiop', 'asdfghjklz']) == 7\n assert candidate(strs = ['qrst', 'rstu', 'stuv', 'tuvw', 'uvwx']) == 0\n assert candidate(strs = ['aabbccdd', 'bbaaccee', 'ccaabbee', 'ddeebbaa', 'eeccbbdd']) == 6\n assert candidate(strs = ['zyxwvutsrqponmlkjihgfedcba', 'zyxwvutsrqponmlkjihgfedcba', 'zyxwvutsrqponmlkjihgfedcba']) == 25\n assert candidate(strs = ['zzzz', 'zzzz', 'zzzz', 'zzzz', 'zzzz', 'zzzz', 'zzzz']) == 0\n assert candidate(strs = ['qwerty', 'wertyq', 'ertyqw', 'rtyqwe', 'tyqwer', 'yqwret']) == 5\n assert candidate(strs = ['cba', 'bca', 'bac', 'acb']) == 2\n assert candidate(strs = ['aebf', 'accf', 'bdgf', 'cddg', 'defh', 'edgh', 'feih', 'gjih', 'hkji']) == 2\n assert candidate(strs = ['aabbcc', 'bbaacc', 'ccabba', 'aababc', 'bbacab', 'abcabc', 'cbaabc', 'abacba', 'bacabc', 'cababc']) == 4\n assert candidate(strs = ['zyxwvu', 'utsrqpon', 'mlkjihgf', 'edcba']) == 5\n assert candidate(strs = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == 0\n assert candidate(strs = ['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy']) == 0\n assert candidate(strs = ['cba', 'daf', 'gee']) == 2\n assert candidate(strs = ['abc', 'bac', 'cab', 'bca', 'cab', 'cba']) == 2\n assert candidate(strs = ['leetcode', 'leetcede', 'leotcede']) == 5\n assert candidate(strs = ['zyxwvutsrqponmlkjihgfedcba', 'zyxwvutsrqponmlkjihgfedcba']) == 25\n assert candidate(strs = ['zzzz', 'zzzz', 'zzzz', 'zzzz', 'zzzz']) == 0\n assert candidate(strs = ['abcd', 'adcb', 'bacd', 'bdac', 'cabd', 'cdab', 'dcba', 'dcab', 'dabc', 'dacb']) == 3\n assert candidate(strs = ['zzzz', 'zzyz', 'zyyz', 'yzzz', 'yzyz', 'yyyz', 'yyyx', 'yyxx', 'yxxx', 'xxxx']) == 3\n assert candidate(strs = ['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yzab']) == 2\n assert candidate(strs = ['aabbcc', 'bbaacc', 'bbacac', 'aabcbc', 'cababc', 'bcbacc']) == 3\n assert candidate(strs = ['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff']) == 0\n assert candidate(strs = ['xyz', 'zyx', 'yxz', 'xzy', 'yzx', 'zxy']) == 2\n assert candidate(strs = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'mnopqrstuvwxyzabcdefghijkl', 'fedcbazyxwvutsrqponmlkjihg']) == 25\n assert candidate(strs = ['mnopqr', 'opqrst', 'pqrstu', 'qrstuv']) == 0\n assert candidate(strs = ['abcdef', 'bcdefg', 'cdefgh', 'defghi', 'efghij', 'fghijk', 'ghijkl', 'hijklm', 'ijklmn']) == 0\n assert candidate(strs = ['abcd', 'dcba', 'abcd', 'dcba']) == 3\n assert candidate(strs = ['aabbcc', 'bbccaa', 'ccaabb', 'aabbbc', 'bbccaa', 'ccaabb', 'aabbbc']) == 4\n assert candidate(strs = ['abcdefg', 'gfedcba', 'bacdefg', 'ihgfedc', 'jklmnop']) == 6\n assert candidate(strs = ['pqr', 'qrs', 'rst', 'stu', 'tuv', 'uvw', 'vwx', 'wxy', 'xyz']) == 0\n assert candidate(strs = ['qpwoeiruty', 'qpwoeiruty', 'qpwoeiruty']) == 5\n assert candidate(strs = ['mnop', 'qrst', 'uvwx', 'yzab', 'cdef', 'ghij', 'klmn', 'opqr', 'stuv', 'wxyz']) == 2\n assert candidate(strs = ['abcd', 'bcde', 'cdef', 'defg']) == 0\n assert candidate(strs = ['aabbcc', 'abbccc', 'abcccc', 'bcccdd', 'cccddd', 'ccdddd', 'cddddd', 'dddddd']) == 0\n assert candidate(strs = ['aabbccddeeff', 'abcdefabcdef', 'fedcbafedcba', 'abcdefabcdef', 'aabbccddeeff']) == 10\n assert candidate(strs = ['abcdefghij', 'jihgfedcba', 'abcdefghij', 'jihgfedcba', 'abcdefghij', 'jihgfedcba']) == 9\n assert candidate(strs = ['zyxwvutsrqponmlkjihgfedcba', 'zyxwvutsrqponmlkjihgfedcba', 'zyxwvutsrqponmlkjihgfedcba', 'zyxwvutsrqponmlkjihgfedcba', 'zyxwvutsrqponmlkjihgfedcba']) == 25\n assert candidate(strs = ['abcd', 'bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij', 'hijk', 'ijkl', 'jklm', 'klmn', 'lmno', 'mnop', 'nopq', 'opqr', 'pqrs', 'qrst', 'rstu', 'stuv', 'tuvw', 'uvwx', 'vwxy', 'wxyz']) == 0\n assert candidate(strs = ['aabbcc', 'bbccdd', 'ccddeeff', 'ddeeffgg']) == 0\n assert candidate(strs = ['abcdabcd', 'bcdbcdcd', 'cdcdcdcd', 'dcdcdcdc', 'efefefef', 'fefefefe', 'gfefefef', 'hfhfhfhf', 'ihihihih']) == 5\n assert candidate(strs = ['xyzuvw', 'wvuxyz', 'uvwxyx', 'vxyzwu', 'uzwvxy', 'zwxyuv', 'yxwvuz', 'zyxuvw', 'wvuzxy', 'uvwxyx', 'vxyzwu', 'uzwvxy', 'zwxyuv', 'yxwvuz', 'zyxuvw', 'wvuzxy', 'uvwxyx', 'vxyzwu', 'uzwvxy', 'zwxyuv', 'yxwvuz', 'zyxuvw']) == 5\n assert candidate(strs = ['abcde', 'bcdef', 'cdefg', 'defgh', 'efghi', 'fghij', 'ghijk', 'hijkl', 'ijklm', 'jklmn']) == 0\n assert candidate(strs = ['zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzz']) == 0\n assert candidate(strs = ['ba', 'ab', 'ba', 'ab', 'ba', 'ab']) == 1\n assert candidate(strs = ['zab', 'bac', 'cab', 'dcb']) == 2\n assert candidate(strs = ['abcde', 'edcba', 'fghij', 'jihgf', 'klmno', 'onmlk']) == 4\n assert candidate(strs = ['abcdef', 'fedcba', 'dcbaef', 'bacfed', 'efabcd', 'fedcba']) == 5\n assert candidate(strs = ['aaaaaaaaaa', 'aabbaabbcc', 'aabbaabbcc', 'aabbaabbcc', 'aabbaabbcc', 'aabbaabbcc']) == 2\n assert candidate(strs = ['abcd', 'dcba', 'abcd', 'dcba', 'abcd']) == 3\n assert candidate(strs = ['aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee', 'fffff', 'ggggg', 'hhhhh', 'iiiii', 'jjjjj']) == 0\n assert candidate(strs = ['aabb', 'bbaa', 'abab', 'baba', 'abba', 'baab']) == 3\n assert candidate(strs = ['abcd', 'abdc', 'acbd', 'bacd', 'badc', 'bcad', 'bcda', 'bdac', 'bdca', 'cabd', 'cadb', 'cbad', 'cbda', 'cdab', 'cdba', 'dabc', 'dacb', 'dbac', 'dbca', 'dcab', 'dcba']) == 3\n assert candidate(strs = ['abcde', 'edcba', 'fghij', 'jihgf', 'klmno', 'onmlk', 'pqrst', 'tsrqp', 'uvwxy', 'yxwvu', 'z', 'z', 'z', 'z', 'z']) == 4\n assert candidate(strs = ['abcd', 'efgh', 'ijkl', 'mnop']) == 0\n assert candidate(strs = ['abcdefg', 'gfedcba', 'hijklmn', 'nmolkji', 'opqrstu', 'utsrqpo']) == 6\n"}, "metadata": {"canonical_parameter_names": ["strs"], "leetcode_dataset_entry_point": "Solution().minDeletionSize", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minDeletionSize = function(strs) {", "container": null, "callable": "minDeletionSize", "parameters": [{"name": "strs", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 961, "task_id": "n-repeated-element-in-size-2n-array", "difficulty": "Easy", "problem_description": "You are given an integer array nums with the following properties:\n\nnums.length == 2 * n.\nnums contains n + 1 unique elements.\nExactly one element of nums is repeated n times.\n\nReturn the element that is repeated n times.\n \nExample 1:\nInput: nums = [1,2,3,3]\nOutput: 3\nExample 2:\nInput: nums = [2,1,2,5,3,2]\nOutput: 2\nExample 3:\nInput: nums = [5,1,5,2,5,3,5,4]\nOutput: 5\n\n \nConstraints:\n\n2 <= n <= 5000\nnums.length == 2 * n\n0 <= nums[i] <= 104\nnums contains n + 1 unique elements and one of them is repeated exactly n times.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 20, 30, 10, 40, 50]) == 10\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 9]) == 9\n assert candidate(nums = [21, 22, 23, 24, 21, 25, 26, 27]) == 21\n assert candidate(nums = [14, 15, 16, 17, 18, 19, 14, 20]) == 14\n assert candidate(nums = [35, 36, 37, 38, 39, 40, 35, 41]) == 35\n assert candidate(nums = [100, 200, 300, 400, 100, 500]) == 100\n assert candidate(nums = [999, 888, 777, 666, 555, 444, 333, 222, 111, 999]) == 999\n assert candidate(nums = [1, 1, 2, 3, 4, 5, 6, 7]) == 1\n assert candidate(nums = [8, 9, 10, 8, 11, 12, 13, 8]) == 8\n assert candidate(nums = [100, 200, 100, 300, 400, 500, 600, 700]) == 100\n assert candidate(nums = [6, 1, 6, 3, 4, 5, 6, 7]) == 6\n assert candidate(nums = [0, 1, 0, 2, 3, 4]) == 0\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 100, 700]) == 100\n assert candidate(nums = [5, 1, 5, 2, 5, 3, 5, 4]) == 5\n assert candidate(nums = [1234, 5678, 9101, 1112, 1314, 1516, 1234, 1718]) == 1234\n assert candidate(nums = [0, 1, 0, 2]) == 0\n assert candidate(nums = [2, 1, 2, 5, 3, 2]) == 2\n assert candidate(nums = [28, 29, 30, 31, 32, 28, 33, 34]) == 28\n assert candidate(nums = [42, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 42\n assert candidate(nums = [1, 2, 3, 3]) == 3\n assert candidate(nums = [7, 8, 9, 7, 10, 11, 12, 7]) == 7\n assert candidate(nums = [8, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 8\n assert candidate(nums = [7, 8, 9, 7, 10, 11, 12, 13]) == 7\n assert candidate(nums = [2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2000]) == 2000\n assert candidate(nums = [7, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7]) == 7\n assert candidate(nums = [456, 789, 101, 202, 303, 404, 505, 606, 707, 808, 909, 1010, 456]) == 456\n assert candidate(nums = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 7]) == 7\n assert candidate(nums = [42, 84, 168, 336, 672, 1344, 2688, 5376, 10752, 21504, 43008, 42]) == 42\n assert candidate(nums = [1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1234]) == 1234\n assert candidate(nums = [9876, 5432, 1234, 8765, 4321, 1234, 9876, 5432, 8765, 4321, 9876, 1234]) == 1234\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 2000, 5000]) == 2000\n assert candidate(nums = [5000, 4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991, 4990, 4989, 4988, 4987, 4986, 5000]) == 5000\n assert candidate(nums = [5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5020, 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029, 5000]) == 5000\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019]) == 1000\n assert candidate(nums = [1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1000]) == 1000\n assert candidate(nums = [9999, 8888, 7777, 6666, 5555, 4444, 3333, 2222, 1111, 1111, 1000, 9999]) == 1111\n assert candidate(nums = [1234, 5678, 9101, 1121, 1341, 1561, 1781, 1901, 2121, 2341, 2561, 1234]) == 1234\n assert candidate(nums = [300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 300, 330, 331, 332, 333, 334]) == 300\n assert candidate(nums = [2500, 2499, 2498, 2497, 2496, 2495, 2494, 2493, 2492, 2491, 2490, 2489, 2488, 2487, 2486, 2500]) == 2500\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 900]) == 900\n assert candidate(nums = [5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012, 5013, 5014, 5000, 5016, 5017, 5018, 5019, 5020, 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029]) == 5000\n assert candidate(nums = [2499, 2498, 2497, 2496, 2495, 2494, 2493, 2492, 2491, 2490, 2489, 2488, 2487, 2486, 2485, 2484, 2483, 2482, 2481, 2480, 2479, 2478, 2477, 2476, 2475, 2474, 2473, 2472, 2471, 2499]) == 2499\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 1]) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == None\n assert candidate(nums = [104, 204, 304, 404, 504, 604, 704, 804, 904, 1004, 1104, 1204, 1304, 1404, 1504, 1604, 1704, 1804, 1904, 2004, 2104, 2204, 2304, 2404, 2504, 104, 2604, 2704, 2804, 2904, 3004, 3104, 3204, 3304, 3404, 3504, 3604, 3704, 3804, 3904, 4004, 4104, 4204, 4304, 4404, 4504, 4604, 4704, 4804, 4904, 5004]) == 104\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 9980, 9999]) == 9999\n assert candidate(nums = [10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9]) == 10\n assert candidate(nums = [4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991, 4990, 4989, 4988, 4987, 4986, 4985, 4984, 4983, 4982, 4981, 4980, 4979, 4978, 4977, 4976, 4975, 4974, 4973, 4972, 4971, 4970, 4970]) == 4970\n assert candidate(nums = [5000, 5000, 4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991, 4990, 4989, 4988, 4987, 4986]) == 5000\n assert candidate(nums = [42, 43, 44, 45, 46, 47, 48, 49, 50, 42, 51, 52, 53, 54, 55, 56]) == 42\n assert candidate(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 100, 114]) == 100\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1]) == 1\n assert candidate(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 100]) == 100\n assert candidate(nums = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 500]) == 500\n assert candidate(nums = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 7]) == 7\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 9980, 9980]) == 9980\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30]) == 30\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 100]) == 100\n assert candidate(nums = [2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528, 2500]) == 2500\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 100]) == 100\n assert candidate(nums = [5000, 4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991, 4990, 5000]) == 5000\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1]) == 1\n assert candidate(nums = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 500]) == 500\n assert candidate(nums = [9999, 0, 9998, 1, 9997, 2, 9996, 3, 9995, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 9999]) == 9999\n assert candidate(nums = [4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4000]) == 4000\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 9980, 9979, 9978, 9977, 9976, 9975, 9974, 9973, 9972, 9971, 9999]) == 9999\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 20]) == 20\n assert candidate(nums = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 500]) == 500\n assert candidate(nums = [4999, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 4999]) == 4999\n assert candidate(nums = [5000, 4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991, 4990, 4989, 4988, 4987, 4986, 4985, 4984, 4983, 4982, 4981, 4980, 4979, 5000]) == 5000\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 1]) == 1\n assert candidate(nums = [4500, 4501, 4502, 4503, 4504, 4505, 4506, 4500, 4507, 4508]) == 4500\n assert candidate(nums = [4999, 4998, 4997, 4996, 4995, 4994, 4993, 4992, 4991, 4990, 4989, 4988, 4987, 4986, 4985, 4999]) == 4999\n assert candidate(nums = [1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1004, 1010]) == 1004\n assert candidate(nums = [10000, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 10000]) == 10000\n assert candidate(nums = [1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1500]) == 1500\n assert candidate(nums = [2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2500]) == 2500\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 1]) == 1\n assert candidate(nums = [2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2500, 2515]) == 2500\n assert candidate(nums = [42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 42]) == 42\n assert candidate(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 100]) == 100\n assert candidate(nums = [42, 42, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41]) == 42\n assert candidate(nums = [42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 42, 54, 55, 56]) == 42\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0]) == 0\n assert candidate(nums = [1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1500, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, 1539]) == 1500\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1]) == 1\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 1000]) == 1000\n assert candidate(nums = [3000, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010, 3011, 3012, 3013, 3014, 3015, 3016, 3017, 3018, 3019, 3020, 3021, 3022, 3023, 3024, 3025, 3026, 3027, 3028, 3029, 3030, 3000]) == 3000\n assert candidate(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 100]) == 100\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 10]) == 10\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9999]) == 9999\n assert candidate(nums = [5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5000, 5020, 5021, 5022, 5023, 5024]) == 5000\n assert candidate(nums = [2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2000, 2013, 2014, 2015, 2016, 2017, 2018]) == 2000\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().repeatedNTimes", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var repeatedNTimes = function(nums) {", "container": null, "callable": "repeatedNTimes", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 962, "task_id": "maximum-width-ramp", "difficulty": "Medium", "problem_description": "A ramp in an integer array nums is a pair (i, j) for which i < j and nums[i] <= nums[j]. The width of such a ramp is j - i.\nGiven an integer array nums, return the maximum width of a ramp in nums. If there is no ramp in nums, return 0.\n \nExample 1:\n\nInput: nums = [6,0,8,2,1,5]\nOutput: 4\nExplanation: The maximum width ramp is achieved at (i, j) = (1, 5): nums[1] = 0 and nums[5] = 5.\n\nExample 2:\n\nInput: nums = [9,8,1,0,1,9,4,0,4,1]\nOutput: 7\nExplanation: The maximum width ramp is achieved at (i, j) = (2, 9): nums[2] = 1 and nums[9] = 1.\n\n \nConstraints:\n\n2 <= nums.length <= 5 * 104\n0 <= nums[i] <= 5 * 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 2, 2, 3, 3, 7, 5, 2, 4]) == 9\n assert candidate(nums = [1, 5, 2, 5, 6, 3, 5, 4]) == 7\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 9\n assert candidate(nums = [1, 5, 5, 5, 5, 5]) == 5\n assert candidate(nums = [1, 5, 2, 5, 6, 6, 1, 3, 2, 5]) == 9\n assert candidate(nums = [25, 20, 15, 11, 10, 9, 7, 6, 3, 1]) == 0\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 0\n assert candidate(nums = [0, 0, 0, 0, 0]) == 4\n assert candidate(nums = [1, 2, 9, 10, 1, 3, 5, 6, 4, 8, 7]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5]) == 4\n assert candidate(nums = [6, 0, 8, 2, 1, 5]) == 4\n assert candidate(nums = [0, 5, 4, 3, 2, 1]) == 5\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 9\n assert candidate(nums = [1, 1, 1, 1, 1]) == 4\n assert candidate(nums = [5, 4, 3, 2, 1]) == 0\n assert candidate(nums = [6, 6, 6, 6, 6, 6]) == 5\n assert candidate(nums = [8, 1, 5, 2, 3, 4, 8, 7, 2]) == 7\n assert candidate(nums = [9, 8, 1, 0, 1, 9, 4, 0, 4, 1]) == 7\n assert candidate(nums = [1, 3, 6, 7, 9, 10, 11, 15, 20, 25]) == 9\n assert candidate(nums = [1, 2, 3, 2, 1]) == 4\n assert candidate(nums = [1, 1, 1, 1, 2]) == 4\n assert candidate(nums = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5]) == 10\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 19\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 11\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 0]) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 5]) == 19\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 18\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 19\n assert candidate(nums = [45, 23, 11, 33, 22, 55, 44, 33, 22, 11, 77, 88, 99, 66, 55]) == 14\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 20\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 25\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 50\n assert candidate(nums = [1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11]) == 19\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 19\n assert candidate(nums = [50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000, 50000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50000]) == 20\n assert candidate(nums = [0, 10000, 0, 9999, 0, 9998, 0, 9997, 0, 9996, 0, 9995, 0, 9994, 0, 9993, 0, 9992, 0, 9991]) == 19\n assert candidate(nums = [100000, 99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 18\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11]) == 20\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 19\n assert candidate(nums = [1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0]) == 18\n assert candidate(nums = [4, 8, 6, 5, 1, 0, 5, 9, 10, 11, 12, 13, 14, 15]) == 13\n assert candidate(nums = [10000, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 9\n assert candidate(nums = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12]) == 19\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 20\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 36\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 0]) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 29\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18]) == 29\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 19\n assert candidate(nums = [50, 40, 30, 20, 10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140]) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 29\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 29\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 20\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1]) == 20\n assert candidate(nums = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 29\n assert candidate(nums = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 18\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 0]) == 29\n assert candidate(nums = [45000, 44999, 44998, 44997, 44996, 44995, 44994, 44993, 44992, 44991, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 18\n assert candidate(nums = [1, 3, 2, 4, 2, 5, 3, 6, 4, 7, 5, 8, 6, 9, 7, 10, 8, 11, 9, 12, 10]) == 20\n assert candidate(nums = [50000, 49999, 49998, 49997, 49996, 49995, 49994, 49993, 49992, 49991, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 9\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 20\n assert candidate(nums = [100, 0, 99, 1, 98, 2, 97, 3, 96, 4, 95, 5, 94, 6, 93, 7, 92, 8, 91, 9]) == 18\n assert candidate(nums = [50000, 49999, 49998, 49997, 49996, 49995, 49994, 49993, 49992, 49991, 49990, 49989, 49988, 49987, 49986, 49985, 49984, 49983, 49982, 49981]) == 0\n assert candidate(nums = [50000, 49999, 49998, 49997, 49996, 49995, 49994, 49993, 49992, 49991, 49990, 49989, 49988, 49987, 49986, 49985, 49984, 49983, 49982, 49981, 0]) == 0\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 19\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().maxWidthRamp", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxWidthRamp = function(nums) {", "container": null, "callable": "maxWidthRamp", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 963, "task_id": "minimum-area-rectangle-ii", "difficulty": "Medium", "problem_description": "You are given an array of points in the X-Y plane points where points[i] = [xi, yi].\nReturn the minimum area of any rectangle formed from these points, with sides not necessarily parallel to the X and Y axes. If there is not any such rectangle, return 0.\nAnswers within 10-5 of the actual answer will be accepted.\n \nExample 1:\n\n\nInput: points = [[1,2],[2,1],[1,0],[0,1]]\nOutput: 2.00000\nExplanation: The minimum area rectangle occurs at [1,2],[2,1],[1,0],[0,1], with an area of 2.\n\nExample 2:\n\n\nInput: points = [[0,1],[2,1],[1,1],[1,0],[2,0]]\nOutput: 1.00000\nExplanation: The minimum area rectangle occurs at [1,0],[1,1],[2,1],[2,0], with an area of 1.\n\nExample 3:\n\n\nInput: points = [[0,3],[1,2],[3,1],[1,3],[2,1]]\nOutput: 0\nExplanation: There is no possible rectangle to form from these points.\n\n \nConstraints:\n\n1 <= points.length <= 50\npoints[i].length == 2\n0 <= xi, yi <= 4 * 104\nAll the given points are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(points = [[0, 0], [1, 1], [1, 0], [0, 1], [2, 2], [2, 1], [1, 2]]) == 1.0\n assert candidate(points = [[4, 10], [2, 8], [5, 3], [3, 0], [0, 5], [7, 1], [1, 2], [2, 6], [8, 0], [9, 7]]) == 0\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4]]) == 0\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == 0\n assert candidate(points = [[0, 1], [2, 1], [1, 1], [1, 0], [2, 0]]) == 1.0\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8]]) == 0\n assert candidate(points = [[1, 1], [2, 2], [3, 3]]) == 0\n assert candidate(points = [[1, 1], [1, 3], [3, 1], [3, 3], [2, 2]]) == 4.0\n assert candidate(points = [[0, 3], [1, 2], [3, 1], [1, 3], [2, 1]]) == 0\n assert candidate(points = [[1, 2], [2, 1], [1, 0], [0, 1]]) == 2.0000000000000004\n assert candidate(points = [[0, 0], [4, 0], [0, 4], [4, 4], [1, 2], [3, 2], [2, 1], [2, 3], [1, 3], [3, 1], [2, 2], [0, 2], [2, 0], [4, 2], [2, 4]]) == 1.0\n assert candidate(points = [[0, 0], [10, 0], [0, 10], [10, 10], [2, 2], [8, 2], [2, 8], [8, 8], [1, 1], [9, 1], [1, 9], [9, 9], [5, 5], [5, 6], [6, 5], [6, 6]]) == 1.0\n assert candidate(points = [[1, 2], [2, 1], [1, 0], [0, 1], [5, 6], [6, 5], [5, 4], [4, 5], [3, 3]]) == 2.0000000000000004\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [2, 3], [4, 5], [6, 7], [8, 9]]) == 0\n assert candidate(points = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14]]) == 1.0\n assert candidate(points = [[2, 4], [4, 2], [4, 6], [6, 4], [8, 8], [6, 8], [8, 6], [10, 10], [8, 10], [10, 8], [12, 12], [10, 12], [12, 10], [14, 14], [12, 14], [14, 12]]) == 4.0\n assert candidate(points = [[0, 0], [10, 10], [20, 20], [10, 20], [20, 10], [5, 5], [15, 15], [25, 25], [15, 25], [25, 15]]) == 50.00000000000001\n assert candidate(points = [[0, 0], [10, 10], [5, 5], [15, 15], [20, 20], [10, 0], [20, 10], [5, 15]]) == 100.00000000000001\n assert candidate(points = [[10, 10], [10, 20], [20, 10], [20, 20], [30, 30], [30, 40], [40, 30], [40, 40], [25, 25]]) == 100.0\n assert candidate(points = [[0, 0], [0, 2], [2, 0], [2, 2], [1, 1], [3, 1], [1, 3], [3, 3], [4, 4], [4, 5], [5, 4], [5, 5], [6, 6], [6, 7], [7, 6], [7, 7], [8, 8], [8, 9], [9, 8], [9, 9]]) == 1.0\n assert candidate(points = [[1, 2], [2, 1], [1, 0], [0, 1], [4, 5], [5, 4], [4, 3], [3, 4]]) == 2.0000000000000004\n assert candidate(points = [[0, 1], [1, 0], [2, 1], [1, 2], [3, 2], [2, 3], [4, 3], [3, 4], [5, 4], [4, 5]]) == 2.0000000000000004\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 0\n assert candidate(points = [[1, 1], [2, 1], [3, 1], [1, 2], [2, 2], [3, 2], [1, 3], [2, 3], [3, 3]]) == 1.0\n assert candidate(points = [[5, 5], [5, 6], [6, 5], [6, 6], [8, 8], [8, 9], [9, 8], [9, 9], [10, 10], [10, 11], [11, 10], [11, 11]]) == 1.0\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 0\n assert candidate(points = [[0, 0], [0, 10], [10, 0], [10, 10], [5, 5], [5, 15], [15, 5], [15, 15], [7, 7], [7, 13], [13, 7], [13, 13]]) == 36.0\n assert candidate(points = [[0, 1], [1, 0], [2, 1], [1, 2], [0, 3], [1, 4], [2, 3], [3, 2], [3, 1], [4, 0]]) == 2.0000000000000004\n assert candidate(points = [[1, 1], [5, 5], [1, 5], [5, 1], [2, 2], [4, 4], [2, 4], [4, 2], [3, 3], [3, 5], [5, 3], [1, 3]]) == 2.0000000000000004\n assert candidate(points = [[1, 1], [3, 1], [1, 3], [3, 3], [2, 2], [2, 4], [4, 2], [4, 4], [1, 2], [2, 1], [3, 2], [2, 3]]) == 1.0\n assert candidate(points = [[1, 1], [3, 3], [5, 5], [7, 7], [9, 9], [1, 2], [2, 1], [8, 8]]) == 0\n assert candidate(points = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7], [9, 10], [10, 9]]) == 1.0\n assert candidate(points = [[0, 0], [4, 4], [4, 0], [0, 4], [1, 1], [3, 3], [3, 1], [1, 3]]) == 4.0\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [2, 1], [4, 3], [6, 5], [8, 7], [10, 9]]) == 4.000000000000001\n assert candidate(points = [[1, 1], [2, 3], [3, 1], [4, 3], [5, 1], [6, 3], [7, 1]]) == 0\n assert candidate(points = [[1, 2], [2, 1], [1, 0], [0, 1], [3, 4], [4, 3], [3, 2], [2, 3]]) == 2.0000000000000004\n assert candidate(points = [[1, 2], [2, 1], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [1, 9], [9, 1]]) == 0\n assert candidate(points = [[2, 2], [3, 3], [4, 4], [5, 5], [1, 1], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12]]) == 0\n assert candidate(points = [[0, 0], [4, 0], [0, 4], [4, 4], [1, 1], [2, 2], [3, 3], [1, 3], [3, 1]]) == 4.0\n assert candidate(points = [[1, 1], [4, 5], [7, 9], [10, 13], [2, 3], [5, 7], [8, 11], [11, 15]]) == 0\n assert candidate(points = [[10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15], [16, 16], [17, 17], [18, 18]]) == 0\n assert candidate(points = [[0, 0], [0, 5], [5, 0], [5, 5], [1, 1], [1, 4], [4, 1], [4, 4], [2, 2], [2, 3], [3, 2], [3, 3], [6, 6], [6, 7], [7, 6], [7, 7]]) == 1.0\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11]]) == 0\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [0, 1], [1, 0], [2, 1], [1, 2], [3, 2], [2, 3]]) == 1.0\n assert candidate(points = [[1, 1], [3, 3], [4, 4], [2, 2], [5, 5], [6, 6], [7, 7]]) == 0\n assert candidate(points = [[-1, -1], [1, 1], [1, -1], [-1, 1], [0, 0], [0, 2], [2, 0]]) == 2.0000000000000004\n assert candidate(points = [[0, 0], [0, 4], [4, 0], [4, 4], [1, 1], [1, 3], [3, 1], [3, 3], [2, 2]]) == 4.0\n assert candidate(points = [[1, 1], [1, 4], [4, 1], [4, 4], [2, 2], [3, 3], [2, 3], [3, 2], [5, 5], [5, 8], [8, 5], [8, 8], [6, 6], [7, 7], [6, 7], [7, 6]]) == 1.0\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]]) == 0\n assert candidate(points = [[10, 10], [10, 20], [20, 10], [20, 20], [15, 15], [15, 25], [25, 15], [25, 25], [12, 12], [12, 18], [18, 12], [18, 18], [14, 14], [14, 16], [16, 14], [16, 16]]) == 4.0\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [1, 4], [4, 1], [2, 3], [3, 2], [5, 5], [5, 6], [6, 5], [6, 6], [1, 5], [5, 1], [3, 6], [6, 3]]) == 1.0\n assert candidate(points = [[0, 0], [4, 4], [4, 0], [0, 4], [1, 1], [3, 3], [2, 2], [2, 0], [0, 2], [2, 4], [4, 2], [3, 1], [1, 3]]) == 2.0000000000000004\n assert candidate(points = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13]]) == 1.0\n assert candidate(points = [[0, 0], [1, 1], [1, 0], [0, 1], [2, 2], [3, 3], [3, 2], [2, 3], [4, 4], [4, 3], [3, 4]]) == 1.0\n assert candidate(points = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [2, 3], [3, 2], [3, 3]]) == 1.0\n assert candidate(points = [[5, 5], [7, 7], [8, 9], [6, 10], [2, 2], [4, 4], [3, 3], [1, 1]]) == 0\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [0, 1], [1, 2], [2, 3], [3, 4], [0, 2], [1, 3], [2, 4], [3, 5], [0, 3], [1, 4], [2, 5], [3, 6]]) == 1.0\n assert candidate(points = [[0, 0], [5, 5], [10, 10], [15, 15], [20, 20], [25, 25], [30, 30], [5, 0], [10, 5], [15, 10], [20, 15], [25, 20]]) == 0\n assert candidate(points = [[1, 2], [2, 3], [3, 2], [4, 3], [2, 4], [3, 5], [4, 4], [5, 5]]) == 2.0\n assert candidate(points = [[0, 0], [0, 5], [5, 0], [5, 5], [1, 1], [1, 4], [4, 1], [4, 4], [2, 2], [2, 3], [3, 2], [3, 3]]) == 1.0\n assert candidate(points = [[1, 1], [2, 1], [1, 2], [2, 2], [1, 3], [2, 3], [3, 1], [3, 2], [3, 3]]) == 1.0\n assert candidate(points = [[1, 1], [3, 1], [1, 3], [3, 3], [2, 2], [4, 2], [2, 4], [4, 4], [5, 5], [5, 6], [6, 5], [6, 6]]) == 1.0\n assert candidate(points = [[0, 0], [0, 5], [5, 0], [5, 5], [1, 2], [2, 1], [4, 3], [3, 4], [2, 3], [3, 2], [1, 4], [4, 1]]) == 2.0000000000000004\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]]) == 0\n assert candidate(points = [[1, 1], [2, 1], [1, 2], [2, 2], [1, 3], [2, 3], [1, 4], [2, 4], [3, 1], [3, 2], [3, 3], [3, 4], [4, 1], [4, 2], [4, 3], [4, 4]]) == 1.0\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [4, 3], [3, 2], [2, 1], [1, 0], [0, 1]]) == 2.0000000000000004\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [2, 3], [4, 5], [6, 7], [8, 9], [3, 5], [5, 7], [7, 9], [9, 11]]) == 0\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [2, 1], [4, 3], [6, 5], [8, 7], [10, 9], [1, 3], [3, 1]]) == 4.000000000000001\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]) == 0\n assert candidate(points = [[0, 0], [1, 1], [1, 0], [0, 1], [2, 2], [2, 1], [1, 2], [3, 3], [3, 2], [2, 3]]) == 1.0\n assert candidate(points = [[1, 0], [0, 1], [1, 2], [2, 1], [2, 2], [0, 2], [2, 0], [0, 0]]) == 2.0\n assert candidate(points = [[10, 10], [11, 11], [12, 10], [11, 9], [14, 14], [15, 15], [16, 14], [15, 13]]) == 2.0000000000000004\n assert candidate(points = [[0, 0], [4, 4], [4, 0], [0, 4], [2, 2], [1, 1], [3, 3], [3, 1], [1, 3]]) == 4.0\n assert candidate(points = [[0, 0], [4, 0], [4, 4], [0, 4], [1, 1], [3, 1], [3, 3], [1, 3], [2, 2], [5, 5], [9, 5], [9, 9], [5, 9], [7, 7], [7, 3], [3, 7], [10, 10], [14, 10], [14, 14], [10, 14]]) == 4.0\n assert candidate(points = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [2, 3], [3, 2], [3, 3], [4, 4], [4, 5], [5, 4], [5, 5], [6, 6], [6, 7], [7, 6], [7, 7]]) == 1.0\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 0\n assert candidate(points = [[0, 0], [1, 0], [0, 1], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13]]) == 1.0\n assert candidate(points = [[10, 10], [20, 20], [10, 20], [20, 10], [15, 15], [15, 25], [25, 15], [25, 25]]) == 50.00000000000001\n assert candidate(points = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0]]) == 0\n assert candidate(points = [[1, 1], [2, 3], [3, 1], [4, 3], [5, 1], [6, 3], [1, 5], [2, 7], [3, 5], [4, 7], [5, 5], [6, 7]]) == 8.0\n assert candidate(points = [[0, 0], [4, 0], [2, 2], [0, 4], [4, 4], [2, 6], [6, 2], [6, 6], [1, 1], [3, 3], [5, 5], [7, 7]]) == 8.000000000000002\n assert candidate(points = [[1, 1], [1, 4], [4, 1], [4, 4], [2, 2], [2, 3], [3, 2], [3, 3], [5, 5], [5, 6], [6, 5], [6, 6]]) == 1.0\n assert candidate(points = [[1, 1], [1, 2], [1, 3], [1, 4], [2, 1], [2, 2], [2, 3], [2, 4], [3, 1], [3, 2], [3, 3], [3, 4], [4, 1], [4, 2], [4, 3], [4, 4], [2, 3], [3, 2], [3, 4], [4, 3]]) == 0.0\n assert candidate(points = [[0, 0], [10, 0], [10, 10], [0, 10], [5, 5], [6, 6], [7, 7], [4, 4]]) == 100.0\n assert candidate(points = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3], [0, 0], [0, 3], [3, 0]]) == 1.0\n assert candidate(points = [[1, 1], [1, 2], [2, 1], [2, 2], [3, 3], [3, 4], [4, 3], [4, 4], [5, 5], [5, 6], [6, 5], [6, 6]]) == 1.0\n assert candidate(points = [[0, 0], [1, 1], [2, 0], [1, 2], [2, 2], [0, 2], [2, 1]]) == 1.0\n assert candidate(points = [[0, 0], [0, 1], [1, 1], [1, 0], [2, 2], [3, 3], [4, 4], [5, 5]]) == 1.0\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 0], [0, 1], [1, 0]]) == 1.0\n assert candidate(points = [[1, 1], [2, 1], [1, 2], [2, 2], [1, 3], [2, 3], [1, 4], [2, 4], [3, 3], [4, 3], [3, 4], [4, 4], [5, 3], [5, 4], [6, 3], [6, 4]]) == 1.0\n assert candidate(points = [[5, 5], [6, 5], [5, 6], [6, 6], [7, 7], [8, 7], [7, 8], [8, 8], [9, 9]]) == 1.0\n assert candidate(points = [[5, 5], [10, 10], [15, 15], [20, 20], [7, 7], [12, 12], [17, 17], [22, 22]]) == 0\n assert candidate(points = [[0, 0], [0, 2], [2, 0], [2, 2], [1, 1], [1, 3], [3, 1], [3, 3]]) == 2.0000000000000004\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [2, 1], [3, 2], [4, 3], [1, 3], [2, 4], [3, 5]]) == 2.0000000000000004\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [21, 22], [23, 24], [25, 26], [27, 28], [29, 30]]) == 0\n assert candidate(points = [[0, 0], [2, 0], [2, 2], [0, 2], [1, 1], [3, 3], [4, 4], [5, 5]]) == 4.0\n assert candidate(points = [[0, 0], [4, 4], [4, 0], [0, 4], [1, 2], [3, 2], [2, 1], [2, 3]]) == 2.0000000000000004\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 4], [4, 3], [3, 2], [2, 1]]) == 2.0000000000000004\n assert candidate(points = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 1.0\n assert candidate(points = [[1, 1], [1, 3], [3, 1], [3, 3], [2, 2], [4, 4], [4, 2], [2, 4], [5, 5], [5, 7], [7, 5], [7, 7], [6, 6], [6, 8], [8, 6], [8, 8]]) == 2.0000000000000004\n"}, "metadata": {"canonical_parameter_names": ["points"], "leetcode_dataset_entry_point": "Solution().minAreaFreeRect", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minAreaFreeRect = function(points) {", "container": null, "callable": "minAreaFreeRect", "parameters": [{"name": "points", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 964, "task_id": "least-operators-to-express-number", "difficulty": "Hard", "problem_description": "Given a single positive integer x, we will write an expression of the form x (op1) x (op2) x (op3) x ... where each operator op1, op2, etc. is either addition, subtraction, multiplication, or division (+, -, *, or /). For example, with x = 3, we might write 3 * 3 / 3 + 3 - 3 which is a value of 3.\nWhen writing such an expression, we adhere to the following conventions:\n\nThe division operator (/) returns rational numbers.\nThere are no parentheses placed anywhere.\nWe use the usual order of operations: multiplication and division happen before addition and subtraction.\nIt is not allowed to use the unary negation operator (-). For example, \"x - x\" is a valid expression as it only uses subtraction, but \"-x + x\" is not because it uses negation.\n\nWe would like to write an expression with the least number of operators such that the expression equals the given target. Return the least number of operators used.\n \nExample 1:\n\nInput: x = 3, target = 19\nOutput: 5\nExplanation: 3 * 3 + 3 * 3 + 3 / 3.\nThe expression contains 5 operations.\n\nExample 2:\n\nInput: x = 5, target = 501\nOutput: 8\nExplanation: 5 * 5 * 5 * 5 - 5 * 5 * 5 + 5 / 5.\nThe expression contains 8 operations.\n\nExample 3:\n\nInput: x = 100, target = 100000000\nOutput: 3\nExplanation: 100 * 100 * 100 * 100.\nThe expression contains 3 operations.\n\n \nConstraints:\n\n2 <= x <= 100\n1 <= target <= 2 * 108\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(x = 2,target = 123456) == 44\n assert candidate(x = 2,target = 3) == 2\n assert candidate(x = 3,target = 81) == 3\n assert candidate(x = 10,target = 1001) == 4\n assert candidate(x = 2,target = 10) == 3\n assert candidate(x = 2,target = 100) == 12\n assert candidate(x = 4,target = 30) == 7\n assert candidate(x = 5,target = 1) == 1\n assert candidate(x = 5,target = 501) == 8\n assert candidate(x = 4,target = 63) == 4\n assert candidate(x = 10,target = 10000) == 3\n assert candidate(x = 2,target = 127) == 8\n assert candidate(x = 3,target = 19) == 5\n assert candidate(x = 50,target = 1250) == 24\n assert candidate(x = 7,target = 49) == 1\n assert candidate(x = 50,target = 2500) == 1\n assert candidate(x = 100,target = 100000000) == 3\n assert candidate(x = 10,target = 1000) == 2\n assert candidate(x = 10,target = 1000000) == 5\n assert candidate(x = 3,target = 1) == 1\n assert candidate(x = 7,target = 300) == 7\n assert candidate(x = 41,target = 753195728) == 246\n assert candidate(x = 37,target = 1874161) == 3\n assert candidate(x = 11,target = 1111111111) == 88\n assert candidate(x = 13,target = 31254) == 17\n assert candidate(x = 7,target = 100) == 7\n assert candidate(x = 3,target = 1234567) == 66\n assert candidate(x = 6,target = 999999) == 73\n assert candidate(x = 4,target = 1000000) == 35\n assert candidate(x = 6,target = 7776) == 4\n assert candidate(x = 41,target = 2825761) == 3\n assert candidate(x = 7,target = 343) == 2\n assert candidate(x = 11,target = 214358881) == 7\n assert candidate(x = 13,target = 169) == 1\n assert candidate(x = 8,target = 512) == 2\n assert candidate(x = 4,target = 1023) == 6\n assert candidate(x = 19,target = 361) == 1\n assert candidate(x = 25,target = 123456789012) == 207\n assert candidate(x = 10,target = 1000000001) == 10\n assert candidate(x = 97,target = 22138067) == 231\n assert candidate(x = 9,target = 6561) == 3\n assert candidate(x = 23,target = 123456) == 60\n assert candidate(x = 49,target = 1174711139839679) == 325\n assert candidate(x = 30,target = 987654321098) == 265\n assert candidate(x = 25,target = 625) == 1\n assert candidate(x = 7,target = 10000000) == 50\n assert candidate(x = 5,target = 243) == 10\n assert candidate(x = 67,target = 3521614606207) == 405\n assert candidate(x = 6,target = 216000) == 32\n assert candidate(x = 20,target = 87654321) == 95\n assert candidate(x = 8,target = 200000) == 28\n assert candidate(x = 25,target = 10000000) == 38\n assert candidate(x = 7,target = 3430) == 12\n assert candidate(x = 8,target = 2048) == 11\n assert candidate(x = 11,target = 1771561) == 5\n assert candidate(x = 4,target = 65536) == 7\n assert candidate(x = 4,target = 65535) == 9\n assert candidate(x = 97,target = 88629381196525010959293) == 1536\n assert candidate(x = 59,target = 511116753300699300624) == 340\n assert candidate(x = 99,target = 11032558) == 144\n assert candidate(x = 11,target = 121121) == 25\n assert candidate(x = 5,target = 123456) == 45\n assert candidate(x = 10,target = 99999) == 6\n assert candidate(x = 15,target = 1000000) == 61\n assert candidate(x = 30,target = 299999) == 50\n assert candidate(x = 8,target = 32768) == 4\n assert candidate(x = 83,target = 44349085) == 172\n assert candidate(x = 12,target = 1728) == 2\n assert candidate(x = 20,target = 999999) == 40\n assert candidate(x = 31,target = 887503681) == 5\n assert candidate(x = 2,target = 1048575) == 21\n assert candidate(x = 4,target = 100000000) == 86\n assert candidate(x = 80,target = 9876543210987654) == 341\n assert candidate(x = 8,target = 5000000) == 60\n assert candidate(x = 17,target = 1444) == 11\n assert candidate(x = 17,target = 2458624) == 72\n assert candidate(x = 17,target = 24137569) == 5\n assert candidate(x = 11,target = 146410) == 8\n assert candidate(x = 59,target = 420746139) == 269\n assert candidate(x = 29,target = 87654321) == 78\n assert candidate(x = 9,target = 98765) == 34\n assert candidate(x = 7,target = 123456) == 31\n assert candidate(x = 3,target = 1000) == 15\n assert candidate(x = 37,target = 864197532) == 157\n assert candidate(x = 15,target = 1000000000) == 104\n assert candidate(x = 11,target = 987654321) == 153\n assert candidate(x = 67,target = 208653121) == 188\n assert candidate(x = 73,target = 66560103) == 142\n assert candidate(x = 12,target = 9876543210) == 121\n assert candidate(x = 31,target = 1999999999) == 139\n assert candidate(x = 9,target = 81000) == 27\n assert candidate(x = 5,target = 999) == 14\n assert candidate(x = 53,target = 418195493) == 4\n assert candidate(x = 5,target = 12345) == 16\n assert candidate(x = 25,target = 97654321) == 65\n assert candidate(x = 4,target = 1024) == 4\n assert candidate(x = 8,target = 5000) == 14\n assert candidate(x = 9,target = 8100) == 11\n assert candidate(x = 7,target = 4913) == 15\n assert candidate(x = 25,target = 9765625) == 4\n assert candidate(x = 9,target = 387420489) == 8\n assert candidate(x = 19,target = 987654) == 65\n assert candidate(x = 6,target = 7777) == 6\n assert candidate(x = 47,target = 642839175) == 146\n assert candidate(x = 40,target = 12345678901234) == 251\n assert candidate(x = 5,target = 123) == 6\n assert candidate(x = 60,target = 98765432109876) == 523\n assert candidate(x = 61,target = 309699630) == 232\n assert candidate(x = 79,target = 55454594) == 233\n assert candidate(x = 19,target = 99999) == 35\n assert candidate(x = 20,target = 200000) == 18\n assert candidate(x = 8,target = 56789) == 31\n assert candidate(x = 23,target = 2222222222) == 121\n assert candidate(x = 6,target = 129600) == 30\n assert candidate(x = 9,target = 87654321) == 59\n assert candidate(x = 3,target = 100000) == 52\n assert candidate(x = 15,target = 123456789) == 99\n assert candidate(x = 13,target = 16913) == 27\n assert candidate(x = 3,target = 4096) == 25\n assert candidate(x = 19,target = 9876543210) == 138\n assert candidate(x = 71,target = 1804229351) == 4\n assert candidate(x = 17,target = 256256256) == 140\n assert candidate(x = 23,target = 279841) == 3\n assert candidate(x = 9,target = 88888888) == 81\n assert candidate(x = 3,target = 98765) == 41\n assert candidate(x = 70,target = 1234567890123456) == 435\n assert candidate(x = 9,target = 59049) == 4\n assert candidate(x = 13,target = 16901) == 28\n assert candidate(x = 10,target = 9999999) == 8\n assert candidate(x = 5,target = 100000) == 22\n assert candidate(x = 7,target = 200) == 14\n assert candidate(x = 19,target = 2476099) == 4\n assert candidate(x = 7,target = 499) == 13\n assert candidate(x = 3,target = 40) == 7\n assert candidate(x = 6,target = 46655) == 7\n assert candidate(x = 15,target = 10000000) == 65\n assert candidate(x = 9,target = 88888) == 48\n assert candidate(x = 3,target = 12345) == 29\n assert candidate(x = 19,target = 923521) == 65\n assert candidate(x = 5,target = 123456789) == 101\n assert candidate(x = 19,target = 999999999) == 88\n assert candidate(x = 3,target = 987654) == 73\n assert candidate(x = 50,target = 123456789) == 185\n assert candidate(x = 5,target = 987654) == 60\n assert candidate(x = 25,target = 625000) == 37\n assert candidate(x = 4,target = 16777216) == 11\n assert candidate(x = 13,target = 13131313) == 69\n assert candidate(x = 31,target = 28829) == 6\n assert candidate(x = 20,target = 123456) == 51\n assert candidate(x = 11,target = 275) == 6\n assert candidate(x = 23,target = 345345345) == 105\n assert candidate(x = 13,target = 1690) == 8\n assert candidate(x = 89,target = 33243576) == 225\n assert candidate(x = 17,target = 1234567890) == 109\n assert candidate(x = 8,target = 134217728) == 8\n assert candidate(x = 29,target = 40353607) == 64\n assert candidate(x = 25,target = 15625000) == 49\n assert candidate(x = 20,target = 1000000) == 38\n assert candidate(x = 8,target = 1048576) == 23\n assert candidate(x = 53,target = 531792648) == 196\n assert candidate(x = 71,target = 107606612) == 148\n"}, "metadata": {"canonical_parameter_names": ["x", "target"], "leetcode_dataset_entry_point": "Solution().leastOpsExpressTarget", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var leastOpsExpressTarget = function(x, target) {", "container": null, "callable": "leastOpsExpressTarget", "parameters": [{"name": "x", "type": "number"}, {"name": "target", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 965, "task_id": "univalued-binary-tree", "difficulty": "Easy", "problem_description": "A binary tree is uni-valued if every node in the tree has the same value.\nGiven the root of a binary tree, return true if the given tree is uni-valued, or false otherwise.\n \nExample 1:\n\n\nInput: root = [1,1,1,1,1,null,1]\nOutput: true\n\nExample 2:\n\n\nInput: root = [2,2,2,5,2]\nOutput: false\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 100].\n0 <= Node.val < 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 1, 1, 1, 1, None, 1])) == True\n assert candidate(root = tree_node([2, 2, 2, 5, 2])) == False\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 2])) == False\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0])) == True\n assert candidate(root = tree_node([1, 1, 2])) == False\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5])) == True\n assert candidate(root = tree_node([1, 2, 1, 1, 1, None, 1])) == False\n assert candidate(root = tree_node([0])) == True\n assert candidate(root = tree_node([5])) == True\n assert candidate(root = tree_node([6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, None, 6, 6, 6, 6, 6, 6, 6])) == True\n assert candidate(root = tree_node([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4])) == True\n assert candidate(root = tree_node([2, 2, 2, 2, 2, 2, 2, None, 2, 2, None, 2, None, 2, None, 2, 2])) == True\n assert candidate(root = tree_node([9, 9, 9, 9, 9, 9, 9, None, None, 9, None, 9, None, 9, None])) == True\n assert candidate(root = tree_node([9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, None, 9, None, 9])) == True\n assert candidate(root = tree_node([10, 10, 10, None, 10, 10, None, 10, None, 10, 10, 10, None, 10])) == True\n assert candidate(root = tree_node([4, 4, 4, 4, 4, None, 4, 4, None, None, 4, 4, None, 4, 4, 4, None, 4, 4, None, None, 4])) == True\n assert candidate(root = tree_node([9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9])) == True\n assert candidate(root = tree_node([6, 6, 6, 6, 6, 6, 6, None, 6, 6, 6, None, None, 6, 6, 6, None, 6, 6, 6, 6])) == True\n assert candidate(root = tree_node([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4])) == True\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, None, None, None, 1, 1, 1, 1])) == True\n assert candidate(root = tree_node([6, 6, 6, 6, None, 6, 6, 6, None, 6, 6, 6, 6, None, 6, 6, 6, 6])) == True\n assert candidate(root = tree_node([2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, None, 2])) == True\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, None, None, None, None, None, None, None, 1, 1])) == True\n assert candidate(root = tree_node([9, 9, 9, 9, None, 9, 9, 9, 9, None, 9, None, 9, 9, 9, 9, 9])) == True\n assert candidate(root = tree_node([7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7])) == True\n assert candidate(root = tree_node([6, 6, 6, 6, 6, 6, 6, 6, None, None, 6, 6, 6, 6, 6])) == True\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3, None, 3, None, 3, None, 3])) == True\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, None, 3, 3, None, 3, 3, 3, None, 3])) == True\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3])) == True\n assert candidate(root = tree_node([8, 8, 8, 8, 8, 8, 8, None, 8, 8, 8, None, 8, 8, 8, None, 8, 8, 8, None, 8, 8, 8, None, 8, 8, 8, None, 8, 8, 8])) == True\n assert candidate(root = tree_node([10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, None, 10, None, 10, None, 10])) == True\n assert candidate(root = tree_node([7, 7, 7, 7, 7, 7, 7, 7, None, 7, None, 7, None, 7, None, 7])) == True\n assert candidate(root = tree_node([4, 4, 4, 4, 4, None, 4, None, 4, None, 4, None, 4, 4, 4])) == True\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3])) == True\n assert candidate(root = tree_node([7, 7, 7, 7, 7, 7, 7, None, None, 7, 7, None, None, 7, 7])) == True\n assert candidate(root = tree_node([10, 10, 10, 10, 10, 10, 10, None, None, 10, None, 10, None, 10, None, 10, None, 10, None, 10])) == True\n assert candidate(root = tree_node([6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, None, 6, None, 6, None, 6, None, 6, None, 6, None, 6, None, 6, None, 6, 7])) == False\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, None, 3, None, 3, None, 3, None, 3, None, 3, None, 3, None, 3, None, 3, None, 3, 4])) == False\n assert candidate(root = tree_node([6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, None, 6])) == True\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, None, 1])) == True\n assert candidate(root = tree_node([8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])) == True\n assert candidate(root = tree_node([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, None, 4, None, 4, None, 4, None, 4, None, 4, None, 4, None, 4, None, 4, 5])) == False\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, None, 5, None, 5, None, 5, None, 5, None, 5, None, 5, None, 5, None, 5, 6])) == False\n assert candidate(root = tree_node([1, 1, 2, 1, 1, 1, 1, None, 1, 1, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1, None, 1])) == False\n assert candidate(root = tree_node([1, 2, None, 1, None, 1, None, 1, None, 1])) == False\n assert candidate(root = tree_node([3, 3, 3, 3, None, 3, 3, 3, None, None, 3])) == True\n assert candidate(root = tree_node([8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])) == True\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == True\n assert candidate(root = tree_node([1, 1, 2, 1, 1, None, None, None, None, 1, 1, 1, 1])) == False\n assert candidate(root = tree_node([2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, None, 2])) == True\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2])) == False\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3])) == True\n assert candidate(root = tree_node([1, 1, 2, 1, 1, None, 1, None, 1, None, 1, None, 1])) == False\n assert candidate(root = tree_node([10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10])) == True\n assert candidate(root = tree_node([7, 7, 7, 7, 7, 7, 7, 7, None, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7])) == True\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == True\n assert candidate(root = tree_node([1, 2, 1, 1, 1, None, 1, None, 1, None, 1, None, 1])) == False\n assert candidate(root = tree_node([4, 4, 4, 4, 4, 4, 4, None, 4, 4, 4, None, 4, 4, 4, None, 4, 4, 4, None, 4, 4, 4, None, 4, 4, 5])) == False\n assert candidate(root = tree_node([2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, None, None, None, None, 2, 2, 2, 2, 2, 2, 2, 2])) == True\n assert candidate(root = tree_node([9, 9, 9, 9, None, 9, 9, 9, None, None, 9, 9, 9, 9, 9])) == True\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == True\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == True\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, None, 5, 5, 5, 5, 5])) == True\n assert candidate(root = tree_node([8, 8, None, 8, None, 8, None, 8, None, 8])) == True\n assert candidate(root = tree_node([2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2, None, 2])) == True\n assert candidate(root = tree_node([8, 8, 8, 8, 8, 8, None, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])) == True\n assert candidate(root = tree_node([7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7])) == True\n assert candidate(root = tree_node([9, 9, 9, 9, None, 9, 9, None, 9, 9, 9, 9, 9, 9, 9])) == True\n assert candidate(root = tree_node([6, 6, 6, 6, 6, 6, None, 6, 6, None, 6, 6, None, 6, 6])) == True\n assert candidate(root = tree_node([11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, None, 11, None, 11, None, 11, None, 11, None, 11])) == True\n assert candidate(root = tree_node([11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, None, 11, None, 11, None, 11, None, 11])) == True\n assert candidate(root = tree_node([4, 4, 4, 4, 4, None, 4, None, None, 4, 4, None, None, 4])) == True\n assert candidate(root = tree_node([10, 10, 10, 10, 10, 10, 10, None, 10, 10, 10, None, 10, 10, 10, None, 10, 10, 10, None, 10, 10, 10, None, 10, 10, 10, None, 10, 10, 10])) == True\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == True\n assert candidate(root = tree_node([7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, None, 7, None, 7, None, 7, None, 7, None, 7, None, 7, None, 7, None, 7, 8])) == False\n assert candidate(root = tree_node([8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, None, 8, None, 8])) == True\n assert candidate(root = tree_node([7, 7, 7, 7, 7, 7, 7, 7, None, 7, 7, 7, 7, 7, 7])) == True\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().isUnivalTree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isUnivalTree = function(root) {", "container": null, "callable": "isUnivalTree", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 966, "task_id": "vowel-spellchecker", "difficulty": "Medium", "problem_description": "Given a wordlist, we want to implement a spellchecker that converts a query word into a correct word.\nFor a given query word, the spell checker handles two categories of spelling mistakes:\n\nCapitalization: If the query matches a word in the wordlist (case-insensitive), then the query word is returned with the same case as the case in the wordlist.\n\n\t\nExample: wordlist = [\"yellow\"], query = \"YellOw\": correct = \"yellow\"\nExample: wordlist = [\"Yellow\"], query = \"yellow\": correct = \"Yellow\"\nExample: wordlist = [\"yellow\"], query = \"yellow\": correct = \"yellow\"\n\n\nVowel Errors: If after replacing the vowels ('a', 'e', 'i', 'o', 'u') of the query word with any vowel individually, it matches a word in the wordlist (case-insensitive), then the query word is returned with the same case as the match in the wordlist.\n\t\nExample: wordlist = [\"YellOw\"], query = \"yollow\": correct = \"YellOw\"\nExample: wordlist = [\"YellOw\"], query = \"yeellow\": correct = \"\" (no match)\nExample: wordlist = [\"YellOw\"], query = \"yllw\": correct = \"\" (no match)\n\n\n\nIn addition, the spell checker operates under the following precedence rules:\n\nWhen the query exactly matches a word in the wordlist (case-sensitive), you should return the same word back.\nWhen the query matches a word up to capitlization, you should return the first such match in the wordlist.\nWhen the query matches a word up to vowel errors, you should return the first such match in the wordlist.\nIf the query has no matches in the wordlist, you should return the empty string.\n\nGiven some queries, return a list of words answer, where answer[i] is the correct word for query = queries[i].\n \nExample 1:\nInput: wordlist = [\"KiTe\",\"kite\",\"hare\",\"Hare\"], queries = [\"kite\",\"Kite\",\"KiTe\",\"Hare\",\"HARE\",\"Hear\",\"hear\",\"keti\",\"keet\",\"keto\"]\nOutput: [\"kite\",\"KiTe\",\"KiTe\",\"Hare\",\"hare\",\"\",\"\",\"KiTe\",\"\",\"KiTe\"]\nExample 2:\nInput: wordlist = [\"yellow\"], queries = [\"YellOw\"]\nOutput: [\"yellow\"]\n\n \nConstraints:\n\n1 <= wordlist.length, queries.length <= 5000\n1 <= wordlist[i].length, queries[i].length <= 7\nwordlist[i] and queries[i] consist only of only English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(wordlist = ['aeiou', 'AEIOU'],queries = ['aeio', 'aeiou', 'AEIOU', 'eioua']) == ['', 'aeiou', 'AEIOU', 'aeiou']\n assert candidate(wordlist = ['aaaaa', 'Aaaaa'],queries = ['Aaaaa', 'aaaaa', 'aaAaa', 'aAaaa', 'AaAaa']) == ['Aaaaa', 'aaaaa', 'aaaaa', 'aaaaa', 'aaaaa']\n assert candidate(wordlist = ['yellow'],queries = ['YellOw']) == ['yellow']\n assert candidate(wordlist = ['apple', 'Apple', 'apples'],queries = ['apples', 'APPLES', 'applesa', 'applee']) == ['apples', 'apples', '', '']\n assert candidate(wordlist = ['KiTe', 'kite', 'hare', 'Hare'],queries = ['kite', 'Kite', 'KiTe', 'Hare', 'HARE', 'Hear', 'hear', 'keti', 'keet', 'keto']) == ['kite', 'KiTe', 'KiTe', 'Hare', 'hare', '', '', 'KiTe', '', 'KiTe']\n assert candidate(wordlist = ['onomatopoeia', 'ONOMATOPOEIA', 'Onomatopoeia', 'oNomatopoeia'],queries = ['onomatopoeia', 'ONOMATOPOEIA', 'Onomatopoeia', 'oNomatopoeia', 'onomatopeiaa', 'onomatopoei']) == ['onomatopoeia', 'ONOMATOPOEIA', 'Onomatopoeia', 'oNomatopoeia', 'onomatopoeia', '']\n assert candidate(wordlist = ['umbrella', 'university', 'underground', 'unicorn', 'uppercut'],queries = ['UMBRELLA', 'UNIVERSITY', 'UNDERGROUND', 'UNICORN', 'UPPERCUT', 'umbrlla', 'universit', 'undergroand', 'unicor', 'upperct', 'Umbrella', 'Unversity', 'Uderground', 'Uinicorn', 'Uppercut']) == ['umbrella', 'university', 'underground', 'unicorn', 'uppercut', '', '', 'underground', '', '', 'umbrella', '', '', '', 'uppercut']\n assert candidate(wordlist = ['bicycle', 'Bicycle', 'BIcycle', 'bIcycle', 'biCycle', 'bicyCLE'],queries = ['bicycle', 'Bicycle', 'BIcycle', 'bIcycle', 'biCycle', 'bicyCLE', 'bicyclE', 'bicyclE', 'bicycLe', 'bicyclE', 'bicycleE']) == ['bicycle', 'Bicycle', 'BIcycle', 'bIcycle', 'biCycle', 'bicyCLE', 'bicycle', 'bicycle', 'bicycle', 'bicycle', '']\n assert candidate(wordlist = ['dictionary', 'Dictionary', 'DICTIONARY', 'DictIoNaRy'],queries = ['dictioNary', 'DICTIONARY', 'dictionary', 'dIctionarY', 'DictioNaryy', 'dictionar']) == ['dictionary', 'DICTIONARY', 'dictionary', 'dictionary', '', '']\n assert candidate(wordlist = ['banana', 'Banana', 'BANANA', 'banAnA'],queries = ['banana', 'Banana', 'BANANA', 'banAnA', 'bananA', 'bananaa', 'BANANAS']) == ['banana', 'Banana', 'BANANA', 'banAnA', 'banana', '', '']\n assert candidate(wordlist = ['interview', 'INTERVIEW', 'Interview', 'inTerView'],queries = ['interview', 'INTERVIEW', 'Interview', 'inTerView', 'interviw', 'intervew']) == ['interview', 'INTERVIEW', 'Interview', 'inTerView', '', '']\n assert candidate(wordlist = ['university', 'UNIVERSITY', 'University', 'universitry', 'universitie'],queries = ['university', 'UNIVERSITY', 'University', 'universitry', 'universitie', 'universitry']) == ['university', 'UNIVERSITY', 'University', 'universitry', 'universitie', 'universitry']\n assert candidate(wordlist = ['AbCdE', 'abcdE', 'aBcDe', 'abCDE', 'abcde'],queries = ['AbCdE', 'Abcde', 'abcde', 'aBcDe', 'abCDE', 'ABCDE', 'abcde', 'AbCdF', 'AbCdEe']) == ['AbCdE', 'AbCdE', 'abcde', 'aBcDe', 'abCDE', 'AbCdE', 'abcde', '', '']\n assert candidate(wordlist = ['AbCdE', 'abCDe', 'aBcDe', 'ABCDe', 'abcde', 'aBcde', 'abCde', 'ABCDE'],queries = ['abcde', 'ABCDE', 'AbCdE', 'abcde', 'aBcDe', 'ABcDe', 'abcdef', 'aBcde', 'ABCDe', 'abCDe']) == ['abcde', 'ABCDE', 'AbCdE', 'abcde', 'aBcDe', 'AbCdE', '', 'aBcde', 'ABCDe', 'abCDe']\n assert candidate(wordlist = ['xylophone', 'Xylophone', 'XYLOPHONE', 'xYlOpHoNe'],queries = ['xylophone', 'Xylophone', 'XYLOPHONE', 'xYlOpHoNe', 'xylopon', 'xylofon']) == ['xylophone', 'Xylophone', 'XYLOPHONE', 'xYlOpHoNe', '', '']\n assert candidate(wordlist = ['umbrella', 'UmBrella', 'Umbrella', 'UMBRELLA'],queries = ['UMBRELLA', 'umbrELLA', 'umbrelLA', 'umbrella', 'UmBrelLA', 'UMBRELLAA', 'umbrellaa']) == ['UMBRELLA', 'umbrella', 'umbrella', 'umbrella', 'umbrella', '', '']\n assert candidate(wordlist = ['umbrella', 'Umbrella', 'UMBRELLA', 'umbralla', 'Umbralla'],queries = ['umbrella', 'Umbrella', 'UMBRELLA', 'umbralla', 'Umbralla', 'umbrallaS', 'umbrellA', 'UmbrallA', 'UMbralla', 'UmbrAlla']) == ['umbrella', 'Umbrella', 'UMBRELLA', 'umbralla', 'Umbralla', '', 'umbrella', 'umbralla', 'umbralla', 'umbralla']\n assert candidate(wordlist = ['beautiful', 'Beautiful', 'BEAUTIFUL', 'beautifull', 'beautifu', 'beautifulll'],queries = ['beautiful', 'Beautiful', 'BEAUTIFUL', 'beautifull', 'beautifu', 'beautifulll', 'beautifulll', 'beautifull', 'beautifuul', 'beautiul']) == ['beautiful', 'Beautiful', 'BEAUTIFUL', 'beautifull', 'beautifu', 'beautifulll', 'beautifulll', 'beautifull', '', '']\n assert candidate(wordlist = ['banana', 'Banana', 'BANANA', 'bandana', 'BandAna'],queries = ['banana', 'Banana', 'BANANA', 'bandana', 'BANDANA', 'bandanna', 'bandanna', 'bndn', 'bandn']) == ['banana', 'Banana', 'BANANA', 'bandana', 'bandana', '', '', '', '']\n assert candidate(wordlist = ['beautiful', 'BeAuTiFuL', 'BEautiful', 'bEAUtIfUl', 'bEAUtIFuL'],queries = ['beautiful', 'BeAuTiFuL', 'BEautiful', 'bEAUtIfUl', 'bEAUtIFuL', 'beautifuls', 'BeAuTiFuLs', 'BEautifuls', 'bEAUtIfUls']) == ['beautiful', 'BeAuTiFuL', 'BEautiful', 'bEAUtIfUl', 'bEAUtIFuL', '', '', '', '']\n assert candidate(wordlist = ['environment', 'ENVIRONMENT', 'EnViRonMeNt', 'ENvIrOnMeNt', 'ENvIrOnMeNT'],queries = ['environment', 'ENVIRONMENT', 'EnViRonMeNt', 'ENvIrOnMeNt', 'ENvIrOnMeNT', 'environments', 'ENVIRONMENTs', 'EnViRonMeNts', 'ENvIrOnMeNts']) == ['environment', 'ENVIRONMENT', 'EnViRonMeNt', 'ENvIrOnMeNt', 'ENvIrOnMeNT', '', '', '', '']\n assert candidate(wordlist = ['algorithm', 'Algorithm', 'ALGORITHM', 'algorithem', 'algoritum', 'algorith', 'algorithmmm'],queries = ['algorithm', 'Algorithm', 'ALGORITHM', 'algorithem', 'algoritum', 'algorith', 'algorithmmm', 'algorithmmm', 'algorithmm', 'algorithmm']) == ['algorithm', 'Algorithm', 'ALGORITHM', 'algorithem', 'algoritum', 'algorith', 'algorithmmm', 'algorithmmm', '', '']\n assert candidate(wordlist = ['education', 'environment', 'elevation', 'excavation', 'explanation'],queries = ['Education', 'Environment', 'Elevation', 'Excavation', 'Explanation', 'edication', 'enviroment', 'elevatoin', 'exacation', 'explanatoin', 'educatio', 'environmnt', 'elevatn', 'excavtn', 'explntion', 'educatoin', 'enivornment', 'elevtn', 'excavatn', 'explanatn', 'educati', 'environmt', 'elevtn', 'excavtn', 'explntn']) == ['education', 'environment', 'elevation', 'excavation', 'explanation', 'education', '', 'elevation', '', 'explanation', '', '', '', '', '', 'education', '', '', '', '', '', '', '', '', '']\n assert candidate(wordlist = ['education', 'EDUCATION', 'Education', 'edUcation'],queries = ['EDUCATION', 'education', 'Education', 'edUcation', 'educatiion', 'eduCation']) == ['EDUCATION', 'education', 'Education', 'edUcation', '', 'education']\n assert candidate(wordlist = ['elephant', 'ElEphant', 'ELEPHANT', 'elePHANT', 'eLePHANT'],queries = ['elephant', 'elePHANT', 'eLePHANT', 'elePHAN', 'ElePHAN', 'eLEPHAN', 'ELephAN', 'elePHANt']) == ['elephant', 'elePHANT', 'eLePHANT', '', '', '', '', 'elephant']\n assert candidate(wordlist = ['education', 'EDUCATION', 'EduCation', 'educate', 'educating'],queries = ['education', 'EDUCATION', 'EduCation', 'educate', 'educatin', 'Educating']) == ['education', 'EDUCATION', 'EduCation', 'educate', '', 'educating']\n assert candidate(wordlist = ['elephant', 'giraffe', 'hippo', 'rhino', 'zebra', 'lemur'],queries = ['Elephant', 'Giraffe', 'Hippo', 'Rhino', 'Zebra', 'Lemur', 'elphant', 'giraff', 'hippo', 'rhin', 'zebr', 'lemr', 'elphantt', 'giraffe', 'hippp', 'rhinno', 'zebraa', 'lemur', 'elephant', 'giraffe', 'hippo', 'rhino', 'zebra', 'lemur', 'elephants', 'giraffes', 'hippos', 'rhinos', 'zebras', 'lemurs']) == ['elephant', 'giraffe', 'hippo', 'rhino', 'zebra', 'lemur', '', '', 'hippo', '', '', '', '', 'giraffe', '', '', '', 'lemur', 'elephant', 'giraffe', 'hippo', 'rhino', 'zebra', 'lemur', '', '', '', '', '', '']\n assert candidate(wordlist = ['algorithm', 'AlgoritHM', 'aLgoRitHm', 'alGoRiThM'],queries = ['algorithm', 'AlgoritHM', 'aLgoRitHm', 'alGoRiThM', 'algoriTHM', 'AlgoRiThM', 'aLGorIthM', 'AlGorIthM', 'algOrIthM']) == ['algorithm', 'AlgoritHM', 'aLgoRitHm', 'alGoRiThM', 'algorithm', 'algorithm', 'algorithm', 'algorithm', 'algorithm']\n assert candidate(wordlist = ['education', 'EDUCATION', 'EducAtion', 'eDUCAtion'],queries = ['EDUCATION', 'educAtion', 'eDUCAtion', 'EDucAtion', 'educAtioN', 'EDucAtioN', 'educatiOn', 'EDucatiOn']) == ['EDUCATION', 'education', 'eDUCAtion', 'education', 'education', 'education', 'education', 'education']\n assert candidate(wordlist = ['education', 'EDUCATION', 'EduCatiOn', 'eDUCaTIOn', 'EDuCAtIoN'],queries = ['education', 'EDUCATION', 'EduCatiOn', 'eDUCaTIOn', 'EDuCAtIoN', 'educations', 'EDUCATIONS', 'EduCatiOns', 'eDUCaTIOns']) == ['education', 'EDUCATION', 'EduCatiOn', 'eDUCaTIOn', 'EDuCAtIoN', '', '', '', '']\n assert candidate(wordlist = ['umbrella', 'uMBrElLa', 'UMBRELLA', 'umbrellA', 'umbralla'],queries = ['umbrella', 'uMBrElLa', 'UMBRELLA', 'umbrellA', 'umbralla', 'UMBRELLAA', 'uMBrElLAA', 'UMBRELLAAA', 'umbrallaA']) == ['umbrella', 'uMBrElLa', 'UMBRELLA', 'umbrellA', 'umbralla', '', '', '', '']\n assert candidate(wordlist = ['elephant', 'Elephant', 'ELEPHANT', 'elevnt', 'elphant', 'elefant', 'elephantt'],queries = ['elephant', 'Elephant', 'ELEPHANT', 'elevnt', 'elphant', 'elefant', 'elephantt', 'elphnt', 'elphntt', 'elphnta']) == ['elephant', 'Elephant', 'ELEPHANT', 'elevnt', 'elphant', 'elefant', 'elephantt', '', '', '']\n assert candidate(wordlist = ['environment', 'Environment', 'ENVIRONMENT', 'environmnt', 'Environmnt', 'environMent'],queries = ['environment', 'Environment', 'ENVIRONMENT', 'environmnt', 'Environmnt', 'environMent', 'environMnt', 'environmEnt', 'environmEnts', 'environmEnt']) == ['environment', 'Environment', 'ENVIRONMENT', 'environmnt', 'Environmnt', 'environMent', 'environmnt', 'environment', '', 'environment']\n assert candidate(wordlist = ['beautiful', 'Beautiful', 'BEAUTIFUL', 'beautifull', 'beautifu'],queries = ['beautiful', 'Beautiful', 'BEAUTIFUL', 'beautifull', 'beautifu', 'beautifull']) == ['beautiful', 'Beautiful', 'BEAUTIFUL', 'beautifull', 'beautifu', 'beautifull']\n assert candidate(wordlist = ['baNana', 'Banana', 'BANANA', 'baNANa'],queries = ['banana', 'BANANA', 'BaNaNa', 'bananA', 'baNANaa', 'bAnanaa']) == ['baNana', 'BANANA', 'baNana', 'baNana', '', '']\n assert candidate(wordlist = ['dictionary', 'Dictionary', 'DICTIONARY', 'dictionry', 'Dictionry'],queries = ['dictionary', 'Dictionary', 'DICTIONARY', 'dictionry', 'Dictionry', 'dictionryS', 'dictionryY', 'dictiOnary', 'dictioNary', 'dictionry']) == ['dictionary', 'Dictionary', 'DICTIONARY', 'dictionry', 'Dictionry', '', '', 'dictionary', 'dictionary', 'dictionry']\n assert candidate(wordlist = ['programming', 'Programming', 'PROGRAMMING', 'proGramMinG'],queries = ['programming', 'Programming', 'PROGRAMMING', 'proGramMinG', 'prograMMing', 'ProgramMiNG', 'PROgRaMMiNG', 'pRoGrAmMiNg', 'programmingg', 'proGramming']) == ['programming', 'Programming', 'PROGRAMMING', 'proGramMinG', 'programming', 'programming', 'programming', 'programming', '', 'programming']\n assert candidate(wordlist = ['keyboard', 'KeyboArD', 'KEYBOARD', 'keyboARd'],queries = ['keyboard', 'keyboarD', 'KEYBOArd', 'KEYboArd', 'keyboARd', 'KEYboARd', 'keyboArD', 'KEYBOArD']) == ['keyboard', 'keyboard', 'keyboard', 'keyboard', 'keyboARd', 'keyboard', 'keyboard', 'keyboard']\n assert candidate(wordlist = ['sequence', 'Sequence', 'SEQUENCE', 'sequense', 'sequnce', 'sequenec', 'sequencee'],queries = ['sequence', 'Sequence', 'SEQUENCE', 'sequense', 'sequnce', 'sequenec', 'sequencee', 'seqeunce', 'sequnce', 'sequnc']) == ['sequence', 'Sequence', 'SEQUENCE', 'sequense', 'sequnce', 'sequenec', 'sequencee', 'sequence', 'sequnce', '']\n assert candidate(wordlist = ['umbrella', 'Umbrella', 'UMBRELLA', 'UmBReLlA'],queries = ['umbrella', 'UMBRELLA', 'Umbrella', 'umBReLlA', 'Umbr3lla', 'umbrellaa', 'UMBRELLAA']) == ['umbrella', 'UMBRELLA', 'Umbrella', 'umbrella', '', '', '']\n assert candidate(wordlist = ['programming', 'ProgramMING', 'proGRaMMiNG', 'prograMMiNG', 'proGRammING'],queries = ['programming', 'ProgramMING', 'proGRaMMiNG', 'prograMMiNG', 'proGRammING', 'progrAMMING', 'prograMmING', 'progrAmmiNG']) == ['programming', 'ProgramMING', 'proGRaMMiNG', 'prograMMiNG', 'proGRammING', 'programming', 'programming', 'programming']\n assert candidate(wordlist = ['cAt', 'cAts', 'bAt', 'bat', 'bats', 'cAtBat'],queries = ['cats', 'CATS', 'cat', 'bat', 'bAts', 'CATBAT', 'caTbAt', 'batS', 'CAT', 'bAt']) == ['cAts', 'cAts', 'cAt', 'bat', 'bats', 'cAtBat', 'cAtBat', 'bats', 'cAt', 'bAt']\n assert candidate(wordlist = ['queue', 'Queue', 'QUEUE', 'qUeUe'],queries = ['queue', 'Queue', 'QUEUE', 'qUeUe', 'queuE', 'QUeUe', 'qUEUe', 'QUEue', 'quEUe', 'qUeue']) == ['queue', 'Queue', 'QUEUE', 'qUeUe', 'queue', 'queue', 'queue', 'queue', 'queue', 'queue']\n assert candidate(wordlist = ['kiwi', 'Kiwi', 'KIWI', 'kIWi', 'KiwI'],queries = ['kiwi', 'Kiwi', 'KIWI', 'kIWi', 'KiwI', 'kiw', 'KIW', 'kiwiwi', 'kiwii']) == ['kiwi', 'Kiwi', 'KIWI', 'kIWi', 'KiwI', '', '', '', '']\n assert candidate(wordlist = ['strawberry', 'Strawberry', 'STRAWBERRY', 'stRawberry', 'strAWberry', 'strawbERRY'],queries = ['strawberry', 'Strawberry', 'STRAWBERRY', 'stRawberry', 'strAWberry', 'strawbERRY', 'straw', 'strawberryy', 'strawberrrry']) == ['strawberry', 'Strawberry', 'STRAWBERRY', 'stRawberry', 'strAWberry', 'strawbERRY', '', '', '']\n assert candidate(wordlist = ['programming', 'PROGRAMMING', 'ProgRaMmInG', 'PROgRaMMiNg', 'pROgRaMMiNG'],queries = ['programming', 'PROGRAMMING', 'ProgRaMmInG', 'PROgRaMMiNg', 'pROgRaMMiNG', 'programmings', 'PROGRAMMINGs', 'ProgRaMmInGs', 'PROgRaMMiNgs']) == ['programming', 'PROGRAMMING', 'ProgRaMmInG', 'PROgRaMMiNg', 'pROgRaMMiNG', '', '', '', '']\n assert candidate(wordlist = ['orange', 'Orange', 'ORANGE', 'oRANGE', 'orANGE'],queries = ['orange', 'Orange', 'ORANGE', 'oRANGE', 'orANGE', 'orang', 'ORANG', 'oranje', 'orng']) == ['orange', 'Orange', 'ORANGE', 'oRANGE', 'orANGE', '', '', '', '']\n assert candidate(wordlist = ['success', 'SUCCESS', 'Success', 'succes', 'succesful'],queries = ['success', 'SUCCESS', 'Success', 'succes', 'succesful', 'succesful']) == ['success', 'SUCCESS', 'Success', 'succes', 'succesful', 'succesful']\n assert candidate(wordlist = ['apple', 'orange', 'banana', 'grape', 'kiwi'],queries = ['Apple', 'ORANGE', 'BANANA', 'Grape', 'KIWI', 'aple', 'oranje', 'bananna', 'grapee', 'kiwii', 'appl', 'orang', 'banan', 'grap', 'kiw']) == ['apple', 'orange', 'banana', 'grape', 'kiwi', '', '', '', '', '', '', '', '', '', '']\n assert candidate(wordlist = ['algorithm', 'ALGORITHM', 'AlGORITHM', 'alGORITHM'],queries = ['algorithm', 'ALGORITHM', 'AlGORITHM', 'alGORITHM', 'algorithM', 'algorithmm']) == ['algorithm', 'ALGORITHM', 'AlGORITHM', 'alGORITHM', 'algorithm', '']\n assert candidate(wordlist = ['necessary', 'NECESSARY', 'Necessary', 'nessecary', 'nessecery'],queries = ['necessary', 'NECESSARY', 'Necessary', 'nessecary', 'nessecery', 'nessecery']) == ['necessary', 'NECESSARY', 'Necessary', 'nessecary', 'nessecery', 'nessecery']\n assert candidate(wordlist = ['pneumonoultramicroscopicsilicovolcanoconiosis', 'pneumOnoultramicroscopicsilicovolcanoconiosis', 'Pneumonoultramicroscopicsilicovolcanoconiosis'],queries = ['pneumonoultramicroscopicsilicovolcanoconiosis', 'PNEUMONoultramicroscopicsilicovolcanoconiosis', 'pneumOnoultramicroscopicsilicovolcanoconiosis', 'PNEUMOnoultramicroscopicsilicovolcanoconiosis', 'pneumOnoultramicroscopicsilicovolcanoconiosa']) == ['pneumonoultramicroscopicsilicovolcanoconiosis', 'pneumonoultramicroscopicsilicovolcanoconiosis', 'pneumOnoultramicroscopicsilicovolcanoconiosis', 'pneumonoultramicroscopicsilicovolcanoconiosis', '']\n assert candidate(wordlist = ['CompUter', 'compuTer', 'COMPUTer', 'compuTER', 'comPUTER', 'computER', 'COMputer', 'computeR'],queries = ['COMPUTER', 'computor', 'COMpuTer', 'compuTER', 'compUter', 'computerr']) == ['CompUter', 'CompUter', 'CompUter', 'compuTER', 'CompUter', '']\n assert candidate(wordlist = ['umbrella', 'Umbrella', 'UMBRELLA', 'umberella', 'UmbereLLa'],queries = ['umbrella', 'Umbrella', 'UMBRELLA', 'umberella', 'UmbereLLa', 'umbrrella', 'umbralla', 'umrellla', 'umbrela', 'umbrelal']) == ['umbrella', 'Umbrella', 'UMBRELLA', 'umberella', 'UmbereLLa', '', 'umbrella', '', '', '']\n assert candidate(wordlist = ['grape', 'Grape', 'GRape', 'gRAPE', 'grAPE'],queries = ['grape', 'Grape', 'GRape', 'gRAPE', 'grAPE', 'grapE', 'GrapeS']) == ['grape', 'Grape', 'GRape', 'gRAPE', 'grAPE', 'grape', '']\n assert candidate(wordlist = ['watermelon', 'Watermelon', 'WATERMELON', 'watERmelon', 'waterMELON'],queries = ['watermelon', 'Watermelon', 'WATERMELON', 'watERmelon', 'waterMELON', 'wtermelon', 'WATERMELLO', 'watermelonn', 'watermelont']) == ['watermelon', 'Watermelon', 'WATERMELON', 'watERmelon', 'waterMELON', '', '', '', '']\n assert candidate(wordlist = ['intelligence', 'Intelligence', 'INTELLIGENCE', 'intelligENce', 'intelligenCE', 'INTElligenCE'],queries = ['intelligence', 'Intelligence', 'INTELLIGENCE', 'intelligENce', 'intelligenCE', 'INTElligenCE', 'intelligenCe', 'INTElligenCe', 'INTElligence']) == ['intelligence', 'Intelligence', 'INTELLIGENCE', 'intelligENce', 'intelligenCE', 'INTElligenCE', 'intelligence', 'intelligence', 'intelligence']\n assert candidate(wordlist = ['relationship', 'Relationship', 'RELATIONSHIP', 'relashionship', 'Relashionship'],queries = ['relationship', 'Relationship', 'RELATIONSHIP', 'relashionship', 'Relashionship', 'relaship', 'relashionships', 'Relashionships', 'RELashionship', 'relashionship']) == ['relationship', 'Relationship', 'RELATIONSHIP', 'relashionship', 'Relashionship', '', '', '', 'relashionship', 'relashionship']\n assert candidate(wordlist = ['education', 'EDUCATION', 'eDucAtIoN', 'educatiOn', 'edUcatioN', 'edUcatioN', 'educAtiOn', 'edUcaTion', 'eDUCatiOn'],queries = ['education', 'EDUCATION', 'eDucAtIoN', 'educatiOn', 'edUcatioN', 'edUcatioN', 'educAtiOn', 'edUcaTion', 'eDUCatiOn', 'educatioN']) == ['education', 'EDUCATION', 'eDucAtIoN', 'educatiOn', 'edUcatioN', 'edUcatioN', 'educAtiOn', 'edUcaTion', 'eDUCatiOn', 'education']\n assert candidate(wordlist = ['elephant', 'Elephant', 'elePHant', 'ELEPHANT'],queries = ['elephant', 'Elephant', 'elePHant', 'ELEPHANT', 'elphant', 'ELPHNT', 'elefant', 'elphantt']) == ['elephant', 'Elephant', 'elePHant', 'ELEPHANT', '', '', '', '']\n assert candidate(wordlist = ['developer', 'DEVELOPER', 'DevEloPer', 'develoPER', 'develoPer', 'DEveloPer'],queries = ['developer', 'DEVELOPER', 'DevEloPer', 'develoPER', 'develoPer', 'DEveloPer', 'devEloPer', 'DEvelOpEr']) == ['developer', 'DEVELOPER', 'DevEloPer', 'develoPER', 'develoPer', 'DEveloPer', 'developer', 'developer']\n assert candidate(wordlist = ['flying', 'FLYING', 'FlyIng', 'FLyInG', 'fLyInG', 'FLYing'],queries = ['flying', 'FLYING', 'flyIng', 'FLyInG', 'fLyInG', 'FLYing', 'FLyInG', 'FLYINGg', 'FLYINGgg']) == ['flying', 'FLYING', 'flying', 'FLyInG', 'fLyInG', 'FLYing', 'FLyInG', '', '']\n assert candidate(wordlist = ['algorithm', 'algoritm', 'algorithmic', 'algorithem', 'algoritm', 'algorit', 'algorithmically'],queries = ['Algorithm', 'Algoritm', 'Algorithmic', 'Algorithem', 'Algoritm', 'Algorit', 'Algorithmically', 'alorithm', 'algrthm', 'algorithmc', 'algrthm', 'algrthm', 'algorithmiclly', 'alorithm', 'algrthm', 'algorithmc', 'algrthm', 'algrthm', 'algorithmc', 'alorithm', 'algrthm', 'algorithmc', 'algrthm', 'algrthm', 'algorithmc']) == ['algorithm', 'algoritm', 'algorithmic', 'algorithem', 'algoritm', 'algorit', 'algorithmically', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']\n assert candidate(wordlist = ['fantastic', 'Fantastic', 'FANTASTIC', 'fantastiv', 'Fantastiv'],queries = ['fantastic', 'Fantastic', 'FANTASTIC', 'fantastiv', 'Fantastiv', 'fantasticv', 'fantastivv', 'Fantastiv', 'fantasticIv', 'FANTASTIc']) == ['fantastic', 'Fantastic', 'FANTASTIC', 'fantastiv', 'Fantastiv', '', '', 'Fantastiv', '', 'fantastic']\n assert candidate(wordlist = ['important', 'IMPORTANT', 'Important', 'imporant', 'impotant'],queries = ['important', 'IMPORTANT', 'Important', 'imporant', 'impotant', 'imporant']) == ['important', 'IMPORTANT', 'Important', 'imporant', 'impotant', 'imporant']\n assert candidate(wordlist = ['machine', 'MACHINE', 'MachInE', 'MACHiNe'],queries = ['machine', 'MACHINE', 'MachInE', 'MACHiNe', 'machines', 'MACHINES', 'MachInES', 'MACHiNES', 'machinne']) == ['machine', 'MACHINE', 'MachInE', 'MACHiNe', '', '', '', '', '']\n assert candidate(wordlist = ['community', 'COMMUNITY', 'Community', 'commuinty', 'communiti'],queries = ['community', 'COMMUNITY', 'Community', 'commuinty', 'communiti', 'commuinty']) == ['community', 'COMMUNITY', 'Community', 'commuinty', 'communiti', 'commuinty']\n assert candidate(wordlist = ['orchid', 'Orchid', 'ORCHID', 'orchd', 'orhid', 'orckid', 'orchidd'],queries = ['orchid', 'Orchid', 'ORCHID', 'orchd', 'orhid', 'orckid', 'orchidd', 'orchiddd', 'orchidd', 'orchidds']) == ['orchid', 'Orchid', 'ORCHID', 'orchd', 'orhid', 'orckid', 'orchidd', '', 'orchidd', '']\n assert candidate(wordlist = ['grape', 'Grape', 'GRAPE', 'grapefruit', 'GrapeFruit'],queries = ['grape', 'Grape', 'GRAPE', 'grapefruit', 'GrapeFruit', 'grApE', 'Grapefruit', 'grapeFruit', 'GRape', 'grapeFruitS']) == ['grape', 'Grape', 'GRAPE', 'grapefruit', 'GrapeFruit', 'grape', 'grapefruit', 'grapefruit', 'grape', '']\n assert candidate(wordlist = ['intelligent', 'Intelligent', 'INTELLIGENT', 'inteligent', 'inteligents'],queries = ['intelligent', 'Intelligent', 'INTELLIGENT', 'inteligent', 'inteligents', 'intilignt']) == ['intelligent', 'Intelligent', 'INTELLIGENT', 'inteligent', 'inteligents', '']\n assert candidate(wordlist = ['aabbcc', 'abc', 'aebec', 'accbba', 'aabbccaa'],queries = ['aabbcc', 'abc', 'aebec', 'accbba', 'aabbccaa', 'AABBCC', 'ABC', 'AEBEC', 'ACCBBA', 'AABBCCAA', 'aabbc', 'abcc', 'aebc', 'accbb', 'aabbc', 'abcc', 'aebc', 'accbb', 'aabbc', 'abcc', 'aebc', 'accbb', 'aabbc', 'abcc', 'aebc', 'accbb', 'aabbc', 'abcc', 'aebc', 'accbb']) == ['aabbcc', 'abc', 'aebec', 'accbba', 'aabbccaa', 'aabbcc', 'abc', 'aebec', 'accbba', 'aabbccaa', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']\n assert candidate(wordlist = ['water', 'Water', 'WATER', 'waTer', 'wateR', 'watER', 'wAtEr', 'waTEr'],queries = ['water', 'Water', 'WATER', 'waTer', 'wateR', 'watER', 'wAtEr', 'waTEr', 'wateR', 'waTer', 'watER', 'wAtEr', 'waTEr', 'wAter']) == ['water', 'Water', 'WATER', 'waTer', 'wateR', 'watER', 'wAtEr', 'waTEr', 'wateR', 'waTer', 'watER', 'wAtEr', 'waTEr', 'water']\n assert candidate(wordlist = ['banana', 'Banana', 'BANANA', 'banAna'],queries = ['banana', 'Banana', 'BANANA', 'banAna', 'BaNANA', 'bAnAnA', 'bananA', 'BaNANa']) == ['banana', 'Banana', 'BANANA', 'banAna', 'banana', 'banana', 'banana', 'banana']\n assert candidate(wordlist = ['umbrella', 'Umbrella', 'uMbReLlA', 'UMbrella'],queries = ['umbrella', 'Umbrella', 'uMbReLlA', 'UMbrella', 'umbrellA', 'UmBrella', 'UMBRELLA', 'umBRELLa', 'umbrela']) == ['umbrella', 'Umbrella', 'uMbReLlA', 'UMbrella', 'umbrella', 'umbrella', 'umbrella', 'umbrella', '']\n assert candidate(wordlist = ['environment', 'ENVIRONMENT', 'Environment', 'enviroment', 'evniroment'],queries = ['environment', 'ENVIRONMENT', 'Environment', 'enviroment', 'evniroment', 'envirnoment']) == ['environment', 'ENVIRONMENT', 'Environment', 'enviroment', 'evniroment', '']\n assert candidate(wordlist = ['umbrella', 'uMBrElLa', 'UMBRELLA', 'umbrellA'],queries = ['umbrella', 'uMBrElLa', 'UMBRELLA', 'umbrellA', 'umbrellaA', 'UMBRELLAa', 'uMBrElLaa', 'umbrellaa', 'umbrellaAA']) == ['umbrella', 'uMBrElLa', 'UMBRELLA', 'umbrellA', '', '', '', '', '']\n assert candidate(wordlist = ['umbrella', 'UMBRELLA', 'Umbrella', 'umBrella'],queries = ['Umbrella', 'umbrella', 'UMBRELLA', 'uMBRELLA', 'umbralla', 'umbrellaa']) == ['Umbrella', 'umbrella', 'UMBRELLA', 'umbrella', 'umbrella', '']\n assert candidate(wordlist = ['education', 'Education', 'EDUCATION', 'educatin', 'Educatin', 'educatiOn'],queries = ['education', 'Education', 'EDUCATION', 'educatin', 'Educatin', 'educatiOn', 'edUcation', 'educAtion', 'educatiOns', 'educatiOn']) == ['education', 'Education', 'EDUCATION', 'educatin', 'Educatin', 'educatiOn', 'education', 'education', '', 'educatiOn']\n assert candidate(wordlist = ['rhythm', 'Rhythm', 'RYTHM', 'rhythem', 'rythum'],queries = ['rhythm', 'Rhythm', 'RYTHM', 'rhythem', 'rythum', 'rhythmm', 'rhyth', 'rythmm', 'rhythmz', 'rhythmzz']) == ['rhythm', 'Rhythm', 'RYTHM', 'rhythem', 'rythum', '', '', '', '', '']\n assert candidate(wordlist = ['sequence', 'Sequence', 'SEQUENCE', 'sequnce', 'Sequnce', 'sequeNce'],queries = ['sequence', 'Sequence', 'SEQUENCE', 'sequnce', 'Sequnce', 'sequeNce', 'sequnce', 'Sequense', 'SEQUENSe', 'sequenze']) == ['sequence', 'Sequence', 'SEQUENCE', 'sequnce', 'Sequnce', 'sequeNce', 'sequnce', '', '', '']\n assert candidate(wordlist = ['communication', 'Communication', 'COMMUNICATION', 'commnication', 'Commnication'],queries = ['communication', 'Communication', 'COMMUNICATION', 'commnication', 'Commnication', 'communiCation', 'commNicAtion', 'ComMunication', 'COMMunIcAtion', 'communIcAtion']) == ['communication', 'Communication', 'COMMUNICATION', 'commnication', 'Commnication', 'communication', 'commnication', 'communication', 'communication', 'communication']\n assert candidate(wordlist = ['quIckBrOwnFox', 'QUICKBROWNFOX', 'QuickBrownFox', 'quiCKBrOwnFoX', 'QUICKbrownfox'],queries = ['quickbrownfox', 'QUICKBROWNFOX', 'QuiCKBrOwnFoX', 'QUICKbrownfox', 'quickBRownfox', 'quickbrownfoX', 'quickbrOwnfox', 'QUICKBROWNfOX']) == ['quIckBrOwnFox', 'QUICKBROWNFOX', 'quIckBrOwnFox', 'QUICKbrownfox', 'quIckBrOwnFox', 'quIckBrOwnFox', 'quIckBrOwnFox', 'quIckBrOwnFox']\n assert candidate(wordlist = ['elephant', 'Elephant', 'ELEPHANT', 'eLEPHANT', 'eLEpHANT'],queries = ['elephant', 'Elephant', 'ELEPHANT', 'eLEPHANT', 'eLEpHANT', 'elephants', 'Elephants', 'ELEPHANTs', 'eLEPHANTs']) == ['elephant', 'Elephant', 'ELEPHANT', 'eLEPHANT', 'eLEpHANT', '', '', '', '']\n assert candidate(wordlist = ['Supercalifragilisticexpialidocious', 'supercalifragilisticexpialidocious', 'SuPeRcAlIfRaGiLiStIcExPiAlIdOcIoUs', 'SUPErcALifRAGilistiCexpiALIdOcIOUs'],queries = ['supercalifragilisticexpialidocious', 'SUPErcALifRAGilistiCexpiALIdOcIOUs', 'SuPeRcAlIfRaGiLiStIcExPiAlIdOcIoUs', 'supercalifragilisticexpialidociosa']) == ['supercalifragilisticexpialidocious', 'SUPErcALifRAGilistiCexpiALIdOcIOUs', 'SuPeRcAlIfRaGiLiStIcExPiAlIdOcIoUs', '']\n assert candidate(wordlist = ['ambiguity', 'ambiguos', 'Ambiguity', 'AMBIGUITY', 'ambiguous', 'amgibuity'],queries = ['ambiguity', 'AMBIGUITY', 'Ambiguity', 'ambiguous', 'AmbiguiTy', 'amgibuity']) == ['ambiguity', 'AMBIGUITY', 'Ambiguity', 'ambiguous', 'ambiguity', 'amgibuity']\n assert candidate(wordlist = ['supercalifragilisticexpialidocious', 'SUPERCALIFRAGILISTICEXPIALIDOCIOUS', 'Supercalifragilisticexpialidocious', 'suPercalifragilisticexpialidocious'],queries = ['supercalifragilisticexpialidocious', 'SUPERCALIFRAGILISTICEXPIALIDOCIOUS', 'Supercalifragilisticexpialidocious', 'suPercalifragilisticexpialidocious', 'supercalifragilisticexpialido', 'supercalifragilisticexpialidocius']) == ['supercalifragilisticexpialidocious', 'SUPERCALIFRAGILISTICEXPIALIDOCIOUS', 'Supercalifragilisticexpialidocious', 'suPercalifragilisticexpialidocious', '', '']\n assert candidate(wordlist = ['algorithm', 'AlgorithM', 'ALGORITHM', 'algoritm', 'Algoritm'],queries = ['algorithm', 'AlgorithM', 'ALGORITHM', 'algoritm', 'Algoritm', 'algorithM', 'algoritm', 'AlgorIthm', 'algoRitm', 'AlgoRithm']) == ['algorithm', 'AlgorithM', 'ALGORITHM', 'algoritm', 'Algoritm', 'algorithm', 'algoritm', 'algorithm', 'algoritm', 'algorithm']\n"}, "metadata": {"canonical_parameter_names": ["wordlist", "queries"], "leetcode_dataset_entry_point": "Solution().spellchecker", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var spellchecker = function(wordlist, queries) {", "container": null, "callable": "spellchecker", "parameters": [{"name": "wordlist", "type": "string[]"}, {"name": "queries", "type": "string[]"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 967, "task_id": "numbers-with-same-consecutive-differences", "difficulty": "Medium", "problem_description": "Given two integers n and k, return an array of all the integers of length n where the difference between every two consecutive digits is k. You may return the answer in any order.\nNote that the integers should not have leading zeros. Integers as 02 and 043 are not allowed.\n \nExample 1:\n\nInput: n = 3, k = 7\nOutput: [181,292,707,818,929]\nExplanation: Note that 070 is not a valid number, because it has leading zeroes.\n\nExample 2:\n\nInput: n = 2, k = 1\nOutput: [10,12,21,23,32,34,43,45,54,56,65,67,76,78,87,89,98]\n\n \nConstraints:\n\n2 <= n <= 9\n0 <= k <= 9\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 3,k = 0) == [111, 222, 333, 444, 555, 666, 777, 888, 999]\n assert candidate(n = 9,k = 5) == [161616161, 272727272, 383838383, 494949494, 505050505, 616161616, 727272727, 838383838, 949494949]\n assert candidate(n = 2,k = 1) == [12, 10, 23, 21, 34, 32, 45, 43, 56, 54, 67, 65, 78, 76, 89, 87, 98]\n assert candidate(n = 9,k = 9) == [909090909]\n assert candidate(n = 2,k = 9) == [90]\n assert candidate(n = 5,k = 5) == [16161, 27272, 38383, 49494, 50505, 61616, 72727, 83838, 94949]\n assert candidate(n = 3,k = 2) == [135, 131, 246, 242, 202, 357, 353, 313, 468, 464, 424, 420, 579, 575, 535, 531, 686, 646, 642, 797, 757, 753, 868, 864, 979, 975]\n assert candidate(n = 2,k = 0) == [11, 22, 33, 44, 55, 66, 77, 88, 99]\n assert candidate(n = 9,k = 1) == [123456789, 123456787, 123456767, 123456765, 123456567, 123456565, 123456545, 123456543, 123454567, 123454565, 123454545, 123454543, 123454345, 123454343, 123454323, 123454321, 123434567, 123434565, 123434545, 123434543, 123434345, 123434343, 123434323, 123434321, 123432345, 123432343, 123432323, 123432321, 123432123, 123432121, 123432101, 123234567, 123234565, 123234545, 123234543, 123234345, 123234343, 123234323, 123234321, 123232345, 123232343, 123232323, 123232321, 123232123, 123232121, 123232101, 123212345, 123212343, 123212323, 123212321, 123212123, 123212121, 123212101, 123210123, 123210121, 123210101, 121234567, 121234565, 121234545, 121234543, 121234345, 121234343, 121234323, 121234321, 121232345, 121232343, 121232323, 121232321, 121232123, 121232121, 121232101, 121212345, 121212343, 121212323, 121212321, 121212123, 121212121, 121212101, 121210123, 121210121, 121210101, 121012345, 121012343, 121012323, 121012321, 121012123, 121012121, 121012101, 121010123, 121010121, 121010101, 101234567, 101234565, 101234545, 101234543, 101234345, 101234343, 101234323, 101234321, 101232345, 101232343, 101232323, 101232321, 101232123, 101232121, 101232101, 101212345, 101212343, 101212323, 101212321, 101212123, 101212121, 101212101, 101210123, 101210121, 101210101, 101012345, 101012343, 101012323, 101012321, 101012123, 101012121, 101012101, 101010123, 101010121, 101010101, 234567898, 234567878, 234567876, 234567678, 234567676, 234567656, 234567654, 234565678, 234565676, 234565656, 234565654, 234565456, 234565454, 234565434, 234565432, 234545678, 234545676, 234545656, 234545654, 234545456, 234545454, 234545434, 234545432, 234543456, 234543454, 234543434, 234543432, 234543234, 234543232, 234543212, 234543210, 234345678, 234345676, 234345656, 234345654, 234345456, 234345454, 234345434, 234345432, 234343456, 234343454, 234343434, 234343432, 234343234, 234343232, 234343212, 234343210, 234323456, 234323454, 234323434, 234323432, 234323234, 234323232, 234323212, 234323210, 234321234, 234321232, 234321212, 234321210, 234321012, 234321010, 232345678, 232345676, 232345656, 232345654, 232345456, 232345454, 232345434, 232345432, 232343456, 232343454, 232343434, 232343432, 232343234, 232343232, 232343212, 232343210, 232323456, 232323454, 232323434, 232323432, 232323234, 232323232, 232323212, 232323210, 232321234, 232321232, 232321212, 232321210, 232321012, 232321010, 232123456, 232123454, 232123434, 232123432, 232123234, 232123232, 232123212, 232123210, 232121234, 232121232, 232121212, 232121210, 232121012, 232121010, 232101234, 232101232, 232101212, 232101210, 232101012, 232101010, 212345678, 212345676, 212345656, 212345654, 212345456, 212345454, 212345434, 212345432, 212343456, 212343454, 212343434, 212343432, 212343234, 212343232, 212343212, 212343210, 212323456, 212323454, 212323434, 212323432, 212323234, 212323232, 212323212, 212323210, 212321234, 212321232, 212321212, 212321210, 212321012, 212321010, 212123456, 212123454, 212123434, 212123432, 212123234, 212123232, 212123212, 212123210, 212121234, 212121232, 212121212, 212121210, 212121012, 212121010, 212101234, 212101232, 212101212, 212101210, 212101012, 212101010, 210123456, 210123454, 210123434, 210123432, 210123234, 210123232, 210123212, 210123210, 210121234, 210121232, 210121212, 210121210, 210121012, 210121010, 210101234, 210101232, 210101212, 210101210, 210101012, 210101010, 345678989, 345678987, 345678789, 345678787, 345678767, 345678765, 345676789, 345676787, 345676767, 345676765, 345676567, 345676565, 345676545, 345676543, 345656789, 345656787, 345656767, 345656765, 345656567, 345656565, 345656545, 345656543, 345654567, 345654565, 345654545, 345654543, 345654345, 345654343, 345654323, 345654321, 345456789, 345456787, 345456767, 345456765, 345456567, 345456565, 345456545, 345456543, 345454567, 345454565, 345454545, 345454543, 345454345, 345454343, 345454323, 345454321, 345434567, 345434565, 345434545, 345434543, 345434345, 345434343, 345434323, 345434321, 345432345, 345432343, 345432323, 345432321, 345432123, 345432121, 345432101, 343456789, 343456787, 343456767, 343456765, 343456567, 343456565, 343456545, 343456543, 343454567, 343454565, 343454545, 343454543, 343454345, 343454343, 343454323, 343454321, 343434567, 343434565, 343434545, 343434543, 343434345, 343434343, 343434323, 343434321, 343432345, 343432343, 343432323, 343432321, 343432123, 343432121, 343432101, 343234567, 343234565, 343234545, 343234543, 343234345, 343234343, 343234323, 343234321, 343232345, 343232343, 343232323, 343232321, 343232123, 343232121, 343232101, 343212345, 343212343, 343212323, 343212321, 343212123, 343212121, 343212101, 343210123, 343210121, 343210101, 323456789, 323456787, 323456767, 323456765, 323456567, 323456565, 323456545, 323456543, 323454567, 323454565, 323454545, 323454543, 323454345, 323454343, 323454323, 323454321, 323434567, 323434565, 323434545, 323434543, 323434345, 323434343, 323434323, 323434321, 323432345, 323432343, 323432323, 323432321, 323432123, 323432121, 323432101, 323234567, 323234565, 323234545, 323234543, 323234345, 323234343, 323234323, 323234321, 323232345, 323232343, 323232323, 323232321, 323232123, 323232121, 323232101, 323212345, 323212343, 323212323, 323212321, 323212123, 323212121, 323212101, 323210123, 323210121, 323210101, 321234567, 321234565, 321234545, 321234543, 321234345, 321234343, 321234323, 321234321, 321232345, 321232343, 321232323, 321232321, 321232123, 321232121, 321232101, 321212345, 321212343, 321212323, 321212321, 321212123, 321212121, 321212101, 321210123, 321210121, 321210101, 321012345, 321012343, 321012323, 321012321, 321012123, 321012121, 321012101, 321010123, 321010121, 321010101, 456789898, 456789878, 456789876, 456787898, 456787878, 456787876, 456787678, 456787676, 456787656, 456787654, 456767898, 456767878, 456767876, 456767678, 456767676, 456767656, 456767654, 456765678, 456765676, 456765656, 456765654, 456765456, 456765454, 456765434, 456765432, 456567898, 456567878, 456567876, 456567678, 456567676, 456567656, 456567654, 456565678, 456565676, 456565656, 456565654, 456565456, 456565454, 456565434, 456565432, 456545678, 456545676, 456545656, 456545654, 456545456, 456545454, 456545434, 456545432, 456543456, 456543454, 456543434, 456543432, 456543234, 456543232, 456543212, 456543210, 454567898, 454567878, 454567876, 454567678, 454567676, 454567656, 454567654, 454565678, 454565676, 454565656, 454565654, 454565456, 454565454, 454565434, 454565432, 454545678, 454545676, 454545656, 454545654, 454545456, 454545454, 454545434, 454545432, 454543456, 454543454, 454543434, 454543432, 454543234, 454543232, 454543212, 454543210, 454345678, 454345676, 454345656, 454345654, 454345456, 454345454, 454345434, 454345432, 454343456, 454343454, 454343434, 454343432, 454343234, 454343232, 454343212, 454343210, 454323456, 454323454, 454323434, 454323432, 454323234, 454323232, 454323212, 454323210, 454321234, 454321232, 454321212, 454321210, 454321012, 454321010, 434567898, 434567878, 434567876, 434567678, 434567676, 434567656, 434567654, 434565678, 434565676, 434565656, 434565654, 434565456, 434565454, 434565434, 434565432, 434545678, 434545676, 434545656, 434545654, 434545456, 434545454, 434545434, 434545432, 434543456, 434543454, 434543434, 434543432, 434543234, 434543232, 434543212, 434543210, 434345678, 434345676, 434345656, 434345654, 434345456, 434345454, 434345434, 434345432, 434343456, 434343454, 434343434, 434343432, 434343234, 434343232, 434343212, 434343210, 434323456, 434323454, 434323434, 434323432, 434323234, 434323232, 434323212, 434323210, 434321234, 434321232, 434321212, 434321210, 434321012, 434321010, 432345678, 432345676, 432345656, 432345654, 432345456, 432345454, 432345434, 432345432, 432343456, 432343454, 432343434, 432343432, 432343234, 432343232, 432343212, 432343210, 432323456, 432323454, 432323434, 432323432, 432323234, 432323232, 432323212, 432323210, 432321234, 432321232, 432321212, 432321210, 432321012, 432321010, 432123456, 432123454, 432123434, 432123432, 432123234, 432123232, 432123212, 432123210, 432121234, 432121232, 432121212, 432121210, 432121012, 432121010, 432101234, 432101232, 432101212, 432101210, 432101012, 432101010, 567898989, 567898987, 567898789, 567898787, 567898767, 567898765, 567878989, 567878987, 567878789, 567878787, 567878767, 567878765, 567876789, 567876787, 567876767, 567876765, 567876567, 567876565, 567876545, 567876543, 567678989, 567678987, 567678789, 567678787, 567678767, 567678765, 567676789, 567676787, 567676767, 567676765, 567676567, 567676565, 567676545, 567676543, 567656789, 567656787, 567656767, 567656765, 567656567, 567656565, 567656545, 567656543, 567654567, 567654565, 567654545, 567654543, 567654345, 567654343, 567654323, 567654321, 565678989, 565678987, 565678789, 565678787, 565678767, 565678765, 565676789, 565676787, 565676767, 565676765, 565676567, 565676565, 565676545, 565676543, 565656789, 565656787, 565656767, 565656765, 565656567, 565656565, 565656545, 565656543, 565654567, 565654565, 565654545, 565654543, 565654345, 565654343, 565654323, 565654321, 565456789, 565456787, 565456767, 565456765, 565456567, 565456565, 565456545, 565456543, 565454567, 565454565, 565454545, 565454543, 565454345, 565454343, 565454323, 565454321, 565434567, 565434565, 565434545, 565434543, 565434345, 565434343, 565434323, 565434321, 565432345, 565432343, 565432323, 565432321, 565432123, 565432121, 565432101, 545678989, 545678987, 545678789, 545678787, 545678767, 545678765, 545676789, 545676787, 545676767, 545676765, 545676567, 545676565, 545676545, 545676543, 545656789, 545656787, 545656767, 545656765, 545656567, 545656565, 545656545, 545656543, 545654567, 545654565, 545654545, 545654543, 545654345, 545654343, 545654323, 545654321, 545456789, 545456787, 545456767, 545456765, 545456567, 545456565, 545456545, 545456543, 545454567, 545454565, 545454545, 545454543, 545454345, 545454343, 545454323, 545454321, 545434567, 545434565, 545434545, 545434543, 545434345, 545434343, 545434323, 545434321, 545432345, 545432343, 545432323, 545432321, 545432123, 545432121, 545432101, 543456789, 543456787, 543456767, 543456765, 543456567, 543456565, 543456545, 543456543, 543454567, 543454565, 543454545, 543454543, 543454345, 543454343, 543454323, 543454321, 543434567, 543434565, 543434545, 543434543, 543434345, 543434343, 543434323, 543434321, 543432345, 543432343, 543432323, 543432321, 543432123, 543432121, 543432101, 543234567, 543234565, 543234545, 543234543, 543234345, 543234343, 543234323, 543234321, 543232345, 543232343, 543232323, 543232321, 543232123, 543232121, 543232101, 543212345, 543212343, 543212323, 543212321, 543212123, 543212121, 543212101, 543210123, 543210121, 543210101, 678989898, 678989878, 678989876, 678987898, 678987878, 678987876, 678987678, 678987676, 678987656, 678987654, 678789898, 678789878, 678789876, 678787898, 678787878, 678787876, 678787678, 678787676, 678787656, 678787654, 678767898, 678767878, 678767876, 678767678, 678767676, 678767656, 678767654, 678765678, 678765676, 678765656, 678765654, 678765456, 678765454, 678765434, 678765432, 676789898, 676789878, 676789876, 676787898, 676787878, 676787876, 676787678, 676787676, 676787656, 676787654, 676767898, 676767878, 676767876, 676767678, 676767676, 676767656, 676767654, 676765678, 676765676, 676765656, 676765654, 676765456, 676765454, 676765434, 676765432, 676567898, 676567878, 676567876, 676567678, 676567676, 676567656, 676567654, 676565678, 676565676, 676565656, 676565654, 676565456, 676565454, 676565434, 676565432, 676545678, 676545676, 676545656, 676545654, 676545456, 676545454, 676545434, 676545432, 676543456, 676543454, 676543434, 676543432, 676543234, 676543232, 676543212, 676543210, 656789898, 656789878, 656789876, 656787898, 656787878, 656787876, 656787678, 656787676, 656787656, 656787654, 656767898, 656767878, 656767876, 656767678, 656767676, 656767656, 656767654, 656765678, 656765676, 656765656, 656765654, 656765456, 656765454, 656765434, 656765432, 656567898, 656567878, 656567876, 656567678, 656567676, 656567656, 656567654, 656565678, 656565676, 656565656, 656565654, 656565456, 656565454, 656565434, 656565432, 656545678, 656545676, 656545656, 656545654, 656545456, 656545454, 656545434, 656545432, 656543456, 656543454, 656543434, 656543432, 656543234, 656543232, 656543212, 656543210, 654567898, 654567878, 654567876, 654567678, 654567676, 654567656, 654567654, 654565678, 654565676, 654565656, 654565654, 654565456, 654565454, 654565434, 654565432, 654545678, 654545676, 654545656, 654545654, 654545456, 654545454, 654545434, 654545432, 654543456, 654543454, 654543434, 654543432, 654543234, 654543232, 654543212, 654543210, 654345678, 654345676, 654345656, 654345654, 654345456, 654345454, 654345434, 654345432, 654343456, 654343454, 654343434, 654343432, 654343234, 654343232, 654343212, 654343210, 654323456, 654323454, 654323434, 654323432, 654323234, 654323232, 654323212, 654323210, 654321234, 654321232, 654321212, 654321210, 654321012, 654321010, 789898989, 789898987, 789898789, 789898787, 789898767, 789898765, 789878989, 789878987, 789878789, 789878787, 789878767, 789878765, 789876789, 789876787, 789876767, 789876765, 789876567, 789876565, 789876545, 789876543, 787898989, 787898987, 787898789, 787898787, 787898767, 787898765, 787878989, 787878987, 787878789, 787878787, 787878767, 787878765, 787876789, 787876787, 787876767, 787876765, 787876567, 787876565, 787876545, 787876543, 787678989, 787678987, 787678789, 787678787, 787678767, 787678765, 787676789, 787676787, 787676767, 787676765, 787676567, 787676565, 787676545, 787676543, 787656789, 787656787, 787656767, 787656765, 787656567, 787656565, 787656545, 787656543, 787654567, 787654565, 787654545, 787654543, 787654345, 787654343, 787654323, 787654321, 767898989, 767898987, 767898789, 767898787, 767898767, 767898765, 767878989, 767878987, 767878789, 767878787, 767878767, 767878765, 767876789, 767876787, 767876767, 767876765, 767876567, 767876565, 767876545, 767876543, 767678989, 767678987, 767678789, 767678787, 767678767, 767678765, 767676789, 767676787, 767676767, 767676765, 767676567, 767676565, 767676545, 767676543, 767656789, 767656787, 767656767, 767656765, 767656567, 767656565, 767656545, 767656543, 767654567, 767654565, 767654545, 767654543, 767654345, 767654343, 767654323, 767654321, 765678989, 765678987, 765678789, 765678787, 765678767, 765678765, 765676789, 765676787, 765676767, 765676765, 765676567, 765676565, 765676545, 765676543, 765656789, 765656787, 765656767, 765656765, 765656567, 765656565, 765656545, 765656543, 765654567, 765654565, 765654545, 765654543, 765654345, 765654343, 765654323, 765654321, 765456789, 765456787, 765456767, 765456765, 765456567, 765456565, 765456545, 765456543, 765454567, 765454565, 765454545, 765454543, 765454345, 765454343, 765454323, 765454321, 765434567, 765434565, 765434545, 765434543, 765434345, 765434343, 765434323, 765434321, 765432345, 765432343, 765432323, 765432321, 765432123, 765432121, 765432101, 898989898, 898989878, 898989876, 898987898, 898987878, 898987876, 898987678, 898987676, 898987656, 898987654, 898789898, 898789878, 898789876, 898787898, 898787878, 898787876, 898787678, 898787676, 898787656, 898787654, 898767898, 898767878, 898767876, 898767678, 898767676, 898767656, 898767654, 898765678, 898765676, 898765656, 898765654, 898765456, 898765454, 898765434, 898765432, 878989898, 878989878, 878989876, 878987898, 878987878, 878987876, 878987678, 878987676, 878987656, 878987654, 878789898, 878789878, 878789876, 878787898, 878787878, 878787876, 878787678, 878787676, 878787656, 878787654, 878767898, 878767878, 878767876, 878767678, 878767676, 878767656, 878767654, 878765678, 878765676, 878765656, 878765654, 878765456, 878765454, 878765434, 878765432, 876789898, 876789878, 876789876, 876787898, 876787878, 876787876, 876787678, 876787676, 876787656, 876787654, 876767898, 876767878, 876767876, 876767678, 876767676, 876767656, 876767654, 876765678, 876765676, 876765656, 876765654, 876765456, 876765454, 876765434, 876765432, 876567898, 876567878, 876567876, 876567678, 876567676, 876567656, 876567654, 876565678, 876565676, 876565656, 876565654, 876565456, 876565454, 876565434, 876565432, 876545678, 876545676, 876545656, 876545654, 876545456, 876545454, 876545434, 876545432, 876543456, 876543454, 876543434, 876543432, 876543234, 876543232, 876543212, 876543210, 989898989, 989898987, 989898789, 989898787, 989898767, 989898765, 989878989, 989878987, 989878789, 989878787, 989878767, 989878765, 989876789, 989876787, 989876767, 989876765, 989876567, 989876565, 989876545, 989876543, 987898989, 987898987, 987898789, 987898787, 987898767, 987898765, 987878989, 987878987, 987878789, 987878787, 987878767, 987878765, 987876789, 987876787, 987876767, 987876765, 987876567, 987876565, 987876545, 987876543, 987678989, 987678987, 987678789, 987678787, 987678767, 987678765, 987676789, 987676787, 987676767, 987676765, 987676567, 987676565, 987676545, 987676543, 987656789, 987656787, 987656767, 987656765, 987656567, 987656565, 987656545, 987656543, 987654567, 987654565, 987654545, 987654543, 987654345, 987654343, 987654323, 987654321]\n assert candidate(n = 5,k = 2) == [13579, 13575, 13535, 13531, 13135, 13131, 24686, 24646, 24642, 24246, 24242, 24202, 20246, 20242, 20202, 35797, 35757, 35753, 35357, 35353, 35313, 31357, 31353, 31313, 46868, 46864, 46468, 46464, 46424, 46420, 42468, 42464, 42424, 42420, 42024, 42020, 57979, 57975, 57579, 57575, 57535, 57531, 53579, 53575, 53535, 53531, 53135, 53131, 68686, 68646, 68642, 64686, 64646, 64642, 64246, 64242, 64202, 79797, 79757, 79753, 75797, 75757, 75753, 75357, 75353, 75313, 86868, 86864, 86468, 86464, 86424, 86420, 97979, 97975, 97579, 97575, 97535, 97531]\n assert candidate(n = 4,k = 5) == [1616, 2727, 3838, 4949, 5050, 6161, 7272, 8383, 9494]\n assert candidate(n = 4,k = 2) == [1357, 1353, 1313, 2468, 2464, 2424, 2420, 2024, 2020, 3579, 3575, 3535, 3531, 3135, 3131, 4686, 4646, 4642, 4246, 4242, 4202, 5797, 5757, 5753, 5357, 5353, 5313, 6868, 6864, 6468, 6464, 6424, 6420, 7979, 7975, 7579, 7575, 7535, 7531, 8686, 8646, 8642, 9797, 9757, 9753]\n assert candidate(n = 3,k = 7) == [181, 292, 707, 818, 929]\n assert candidate(n = 5,k = 0) == [11111, 22222, 33333, 44444, 55555, 66666, 77777, 88888, 99999]\n assert candidate(n = 4,k = 3) == [1474, 1414, 2585, 2525, 3696, 3636, 3630, 3036, 3030, 4747, 4741, 4147, 4141, 5858, 5852, 5258, 5252, 6969, 6963, 6369, 6363, 6303, 7474, 7414, 8585, 8525, 9696, 9636, 9630]\n assert candidate(n = 9,k = 4) == [159595959, 159595951, 159595159, 159595151, 159515959, 159515951, 159515159, 159515151, 151595959, 151595951, 151595159, 151595151, 151515959, 151515951, 151515159, 151515151, 262626262, 373737373, 484848484, 484848404, 484840484, 484840404, 484048484, 484048404, 484040484, 484040404, 404848484, 404848404, 404840484, 404840404, 404048484, 404048404, 404040484, 404040404, 595959595, 595959515, 595951595, 595951515, 595159595, 595159515, 595151595, 595151515, 515959595, 515959515, 515951595, 515951515, 515159595, 515159515, 515151595, 515151515, 626262626, 737373737, 848484848, 848484840, 848484048, 848484040, 848404848, 848404840, 848404048, 848404040, 840484848, 840484840, 840484048, 840484040, 840404848, 840404840, 840404048, 840404040, 959595959, 959595951, 959595159, 959595151, 959515959, 959515951, 959515159, 959515151, 951595959, 951595951, 951595159, 951595151, 951515959, 951515951, 951515159, 951515151]\n assert candidate(n = 4,k = 8) == [1919, 8080, 9191]\n assert candidate(n = 6,k = 8) == [191919, 808080, 919191]\n assert candidate(n = 2,k = 8) == [19, 80, 91]\n assert candidate(n = 6,k = 0) == [111111, 222222, 333333, 444444, 555555, 666666, 777777, 888888, 999999]\n assert candidate(n = 7,k = 3) == [1474747, 1474741, 1474147, 1474141, 1414747, 1414741, 1414147, 1414141, 2585858, 2585852, 2585258, 2585252, 2525858, 2525852, 2525258, 2525252, 3696969, 3696963, 3696369, 3696363, 3696303, 3636969, 3636963, 3636369, 3636363, 3636303, 3630369, 3630363, 3630303, 3036969, 3036963, 3036369, 3036363, 3036303, 3030369, 3030363, 3030303, 4747474, 4747414, 4741474, 4741414, 4147474, 4147414, 4141474, 4141414, 5858585, 5858525, 5852585, 5852525, 5258585, 5258525, 5252585, 5252525, 6969696, 6969636, 6969630, 6963696, 6963636, 6963630, 6963036, 6963030, 6369696, 6369636, 6369630, 6363696, 6363636, 6363630, 6363036, 6363030, 6303696, 6303636, 6303630, 6303036, 6303030, 7474747, 7474741, 7474147, 7474141, 7414747, 7414741, 7414147, 7414141, 8585858, 8585852, 8585258, 8585252, 8525858, 8525852, 8525258, 8525252, 9696969, 9696963, 9696369, 9696363, 9696303, 9636969, 9636963, 9636369, 9636363, 9636303, 9630369, 9630363, 9630303]\n assert candidate(n = 7,k = 1) == [1234567, 1234565, 1234545, 1234543, 1234345, 1234343, 1234323, 1234321, 1232345, 1232343, 1232323, 1232321, 1232123, 1232121, 1232101, 1212345, 1212343, 1212323, 1212321, 1212123, 1212121, 1212101, 1210123, 1210121, 1210101, 1012345, 1012343, 1012323, 1012321, 1012123, 1012121, 1012101, 1010123, 1010121, 1010101, 2345678, 2345676, 2345656, 2345654, 2345456, 2345454, 2345434, 2345432, 2343456, 2343454, 2343434, 2343432, 2343234, 2343232, 2343212, 2343210, 2323456, 2323454, 2323434, 2323432, 2323234, 2323232, 2323212, 2323210, 2321234, 2321232, 2321212, 2321210, 2321012, 2321010, 2123456, 2123454, 2123434, 2123432, 2123234, 2123232, 2123212, 2123210, 2121234, 2121232, 2121212, 2121210, 2121012, 2121010, 2101234, 2101232, 2101212, 2101210, 2101012, 2101010, 3456789, 3456787, 3456767, 3456765, 3456567, 3456565, 3456545, 3456543, 3454567, 3454565, 3454545, 3454543, 3454345, 3454343, 3454323, 3454321, 3434567, 3434565, 3434545, 3434543, 3434345, 3434343, 3434323, 3434321, 3432345, 3432343, 3432323, 3432321, 3432123, 3432121, 3432101, 3234567, 3234565, 3234545, 3234543, 3234345, 3234343, 3234323, 3234321, 3232345, 3232343, 3232323, 3232321, 3232123, 3232121, 3232101, 3212345, 3212343, 3212323, 3212321, 3212123, 3212121, 3212101, 3210123, 3210121, 3210101, 4567898, 4567878, 4567876, 4567678, 4567676, 4567656, 4567654, 4565678, 4565676, 4565656, 4565654, 4565456, 4565454, 4565434, 4565432, 4545678, 4545676, 4545656, 4545654, 4545456, 4545454, 4545434, 4545432, 4543456, 4543454, 4543434, 4543432, 4543234, 4543232, 4543212, 4543210, 4345678, 4345676, 4345656, 4345654, 4345456, 4345454, 4345434, 4345432, 4343456, 4343454, 4343434, 4343432, 4343234, 4343232, 4343212, 4343210, 4323456, 4323454, 4323434, 4323432, 4323234, 4323232, 4323212, 4323210, 4321234, 4321232, 4321212, 4321210, 4321012, 4321010, 5678989, 5678987, 5678789, 5678787, 5678767, 5678765, 5676789, 5676787, 5676767, 5676765, 5676567, 5676565, 5676545, 5676543, 5656789, 5656787, 5656767, 5656765, 5656567, 5656565, 5656545, 5656543, 5654567, 5654565, 5654545, 5654543, 5654345, 5654343, 5654323, 5654321, 5456789, 5456787, 5456767, 5456765, 5456567, 5456565, 5456545, 5456543, 5454567, 5454565, 5454545, 5454543, 5454345, 5454343, 5454323, 5454321, 5434567, 5434565, 5434545, 5434543, 5434345, 5434343, 5434323, 5434321, 5432345, 5432343, 5432323, 5432321, 5432123, 5432121, 5432101, 6789898, 6789878, 6789876, 6787898, 6787878, 6787876, 6787678, 6787676, 6787656, 6787654, 6767898, 6767878, 6767876, 6767678, 6767676, 6767656, 6767654, 6765678, 6765676, 6765656, 6765654, 6765456, 6765454, 6765434, 6765432, 6567898, 6567878, 6567876, 6567678, 6567676, 6567656, 6567654, 6565678, 6565676, 6565656, 6565654, 6565456, 6565454, 6565434, 6565432, 6545678, 6545676, 6545656, 6545654, 6545456, 6545454, 6545434, 6545432, 6543456, 6543454, 6543434, 6543432, 6543234, 6543232, 6543212, 6543210, 7898989, 7898987, 7898789, 7898787, 7898767, 7898765, 7878989, 7878987, 7878789, 7878787, 7878767, 7878765, 7876789, 7876787, 7876767, 7876765, 7876567, 7876565, 7876545, 7876543, 7678989, 7678987, 7678789, 7678787, 7678767, 7678765, 7676789, 7676787, 7676767, 7676765, 7676567, 7676565, 7676545, 7676543, 7656789, 7656787, 7656767, 7656765, 7656567, 7656565, 7656545, 7656543, 7654567, 7654565, 7654545, 7654543, 7654345, 7654343, 7654323, 7654321, 8989898, 8989878, 8989876, 8987898, 8987878, 8987876, 8987678, 8987676, 8987656, 8987654, 8789898, 8789878, 8789876, 8787898, 8787878, 8787876, 8787678, 8787676, 8787656, 8787654, 8767898, 8767878, 8767876, 8767678, 8767676, 8767656, 8767654, 8765678, 8765676, 8765656, 8765654, 8765456, 8765454, 8765434, 8765432, 9898989, 9898987, 9898789, 9898787, 9898767, 9898765, 9878989, 9878987, 9878789, 9878787, 9878767, 9878765, 9876789, 9876787, 9876767, 9876765, 9876567, 9876565, 9876545, 9876543]\n assert candidate(n = 9,k = 8) == [191919191, 808080808, 919191919]\n assert candidate(n = 5,k = 1) == [12345, 12343, 12323, 12321, 12123, 12121, 12101, 10123, 10121, 10101, 23456, 23454, 23434, 23432, 23234, 23232, 23212, 23210, 21234, 21232, 21212, 21210, 21012, 21010, 34567, 34565, 34545, 34543, 34345, 34343, 34323, 34321, 32345, 32343, 32323, 32321, 32123, 32121, 32101, 45678, 45676, 45656, 45654, 45456, 45454, 45434, 45432, 43456, 43454, 43434, 43432, 43234, 43232, 43212, 43210, 56789, 56787, 56767, 56765, 56567, 56565, 56545, 56543, 54567, 54565, 54545, 54543, 54345, 54343, 54323, 54321, 67898, 67878, 67876, 67678, 67676, 67656, 67654, 65678, 65676, 65656, 65654, 65456, 65454, 65434, 65432, 78989, 78987, 78789, 78787, 78767, 78765, 76789, 76787, 76767, 76765, 76567, 76565, 76545, 76543, 89898, 89878, 89876, 87898, 87878, 87876, 87678, 87676, 87656, 87654, 98989, 98987, 98789, 98787, 98767, 98765]\n assert candidate(n = 3,k = 6) == [171, 282, 393, 606, 717, 828, 939]\n assert candidate(n = 6,k = 9) == [909090]\n assert candidate(n = 4,k = 0) == [1111, 2222, 3333, 4444, 5555, 6666, 7777, 8888, 9999]\n assert candidate(n = 2,k = 5) == [16, 27, 38, 49, 50, 61, 72, 83, 94]\n assert candidate(n = 7,k = 2) == [1357979, 1357975, 1357579, 1357575, 1357535, 1357531, 1353579, 1353575, 1353535, 1353531, 1353135, 1353131, 1313579, 1313575, 1313535, 1313531, 1313135, 1313131, 2468686, 2468646, 2468642, 2464686, 2464646, 2464642, 2464246, 2464242, 2464202, 2424686, 2424646, 2424642, 2424246, 2424242, 2424202, 2420246, 2420242, 2420202, 2024686, 2024646, 2024642, 2024246, 2024242, 2024202, 2020246, 2020242, 2020202, 3579797, 3579757, 3579753, 3575797, 3575757, 3575753, 3575357, 3575353, 3575313, 3535797, 3535757, 3535753, 3535357, 3535353, 3535313, 3531357, 3531353, 3531313, 3135797, 3135757, 3135753, 3135357, 3135353, 3135313, 3131357, 3131353, 3131313, 4686868, 4686864, 4686468, 4686464, 4686424, 4686420, 4646868, 4646864, 4646468, 4646464, 4646424, 4646420, 4642468, 4642464, 4642424, 4642420, 4642024, 4642020, 4246868, 4246864, 4246468, 4246464, 4246424, 4246420, 4242468, 4242464, 4242424, 4242420, 4242024, 4242020, 4202468, 4202464, 4202424, 4202420, 4202024, 4202020, 5797979, 5797975, 5797579, 5797575, 5797535, 5797531, 5757979, 5757975, 5757579, 5757575, 5757535, 5757531, 5753579, 5753575, 5753535, 5753531, 5753135, 5753131, 5357979, 5357975, 5357579, 5357575, 5357535, 5357531, 5353579, 5353575, 5353535, 5353531, 5353135, 5353131, 5313579, 5313575, 5313535, 5313531, 5313135, 5313131, 6868686, 6868646, 6868642, 6864686, 6864646, 6864642, 6864246, 6864242, 6864202, 6468686, 6468646, 6468642, 6464686, 6464646, 6464642, 6464246, 6464242, 6464202, 6424686, 6424646, 6424642, 6424246, 6424242, 6424202, 6420246, 6420242, 6420202, 7979797, 7979757, 7979753, 7975797, 7975757, 7975753, 7975357, 7975353, 7975313, 7579797, 7579757, 7579753, 7575797, 7575757, 7575753, 7575357, 7575353, 7575313, 7535797, 7535757, 7535753, 7535357, 7535353, 7535313, 7531357, 7531353, 7531313, 8686868, 8686864, 8686468, 8686464, 8686424, 8686420, 8646868, 8646864, 8646468, 8646464, 8646424, 8646420, 8642468, 8642464, 8642424, 8642420, 8642024, 8642020, 9797979, 9797975, 9797579, 9797575, 9797535, 9797531, 9757979, 9757975, 9757579, 9757575, 9757535, 9757531, 9753579, 9753575, 9753535, 9753531, 9753135, 9753131]\n assert candidate(n = 4,k = 1) == [1234, 1232, 1212, 1210, 1012, 1010, 2345, 2343, 2323, 2321, 2123, 2121, 2101, 3456, 3454, 3434, 3432, 3234, 3232, 3212, 3210, 4567, 4565, 4545, 4543, 4345, 4343, 4323, 4321, 5678, 5676, 5656, 5654, 5456, 5454, 5434, 5432, 6789, 6787, 6767, 6765, 6567, 6565, 6545, 6543, 7898, 7878, 7876, 7678, 7676, 7656, 7654, 8989, 8987, 8789, 8787, 8767, 8765, 9898, 9878, 9876]\n assert candidate(n = 8,k = 1) == [12345678, 12345676, 12345656, 12345654, 12345456, 12345454, 12345434, 12345432, 12343456, 12343454, 12343434, 12343432, 12343234, 12343232, 12343212, 12343210, 12323456, 12323454, 12323434, 12323432, 12323234, 12323232, 12323212, 12323210, 12321234, 12321232, 12321212, 12321210, 12321012, 12321010, 12123456, 12123454, 12123434, 12123432, 12123234, 12123232, 12123212, 12123210, 12121234, 12121232, 12121212, 12121210, 12121012, 12121010, 12101234, 12101232, 12101212, 12101210, 12101012, 12101010, 10123456, 10123454, 10123434, 10123432, 10123234, 10123232, 10123212, 10123210, 10121234, 10121232, 10121212, 10121210, 10121012, 10121010, 10101234, 10101232, 10101212, 10101210, 10101012, 10101010, 23456789, 23456787, 23456767, 23456765, 23456567, 23456565, 23456545, 23456543, 23454567, 23454565, 23454545, 23454543, 23454345, 23454343, 23454323, 23454321, 23434567, 23434565, 23434545, 23434543, 23434345, 23434343, 23434323, 23434321, 23432345, 23432343, 23432323, 23432321, 23432123, 23432121, 23432101, 23234567, 23234565, 23234545, 23234543, 23234345, 23234343, 23234323, 23234321, 23232345, 23232343, 23232323, 23232321, 23232123, 23232121, 23232101, 23212345, 23212343, 23212323, 23212321, 23212123, 23212121, 23212101, 23210123, 23210121, 23210101, 21234567, 21234565, 21234545, 21234543, 21234345, 21234343, 21234323, 21234321, 21232345, 21232343, 21232323, 21232321, 21232123, 21232121, 21232101, 21212345, 21212343, 21212323, 21212321, 21212123, 21212121, 21212101, 21210123, 21210121, 21210101, 21012345, 21012343, 21012323, 21012321, 21012123, 21012121, 21012101, 21010123, 21010121, 21010101, 34567898, 34567878, 34567876, 34567678, 34567676, 34567656, 34567654, 34565678, 34565676, 34565656, 34565654, 34565456, 34565454, 34565434, 34565432, 34545678, 34545676, 34545656, 34545654, 34545456, 34545454, 34545434, 34545432, 34543456, 34543454, 34543434, 34543432, 34543234, 34543232, 34543212, 34543210, 34345678, 34345676, 34345656, 34345654, 34345456, 34345454, 34345434, 34345432, 34343456, 34343454, 34343434, 34343432, 34343234, 34343232, 34343212, 34343210, 34323456, 34323454, 34323434, 34323432, 34323234, 34323232, 34323212, 34323210, 34321234, 34321232, 34321212, 34321210, 34321012, 34321010, 32345678, 32345676, 32345656, 32345654, 32345456, 32345454, 32345434, 32345432, 32343456, 32343454, 32343434, 32343432, 32343234, 32343232, 32343212, 32343210, 32323456, 32323454, 32323434, 32323432, 32323234, 32323232, 32323212, 32323210, 32321234, 32321232, 32321212, 32321210, 32321012, 32321010, 32123456, 32123454, 32123434, 32123432, 32123234, 32123232, 32123212, 32123210, 32121234, 32121232, 32121212, 32121210, 32121012, 32121010, 32101234, 32101232, 32101212, 32101210, 32101012, 32101010, 45678989, 45678987, 45678789, 45678787, 45678767, 45678765, 45676789, 45676787, 45676767, 45676765, 45676567, 45676565, 45676545, 45676543, 45656789, 45656787, 45656767, 45656765, 45656567, 45656565, 45656545, 45656543, 45654567, 45654565, 45654545, 45654543, 45654345, 45654343, 45654323, 45654321, 45456789, 45456787, 45456767, 45456765, 45456567, 45456565, 45456545, 45456543, 45454567, 45454565, 45454545, 45454543, 45454345, 45454343, 45454323, 45454321, 45434567, 45434565, 45434545, 45434543, 45434345, 45434343, 45434323, 45434321, 45432345, 45432343, 45432323, 45432321, 45432123, 45432121, 45432101, 43456789, 43456787, 43456767, 43456765, 43456567, 43456565, 43456545, 43456543, 43454567, 43454565, 43454545, 43454543, 43454345, 43454343, 43454323, 43454321, 43434567, 43434565, 43434545, 43434543, 43434345, 43434343, 43434323, 43434321, 43432345, 43432343, 43432323, 43432321, 43432123, 43432121, 43432101, 43234567, 43234565, 43234545, 43234543, 43234345, 43234343, 43234323, 43234321, 43232345, 43232343, 43232323, 43232321, 43232123, 43232121, 43232101, 43212345, 43212343, 43212323, 43212321, 43212123, 43212121, 43212101, 43210123, 43210121, 43210101, 56789898, 56789878, 56789876, 56787898, 56787878, 56787876, 56787678, 56787676, 56787656, 56787654, 56767898, 56767878, 56767876, 56767678, 56767676, 56767656, 56767654, 56765678, 56765676, 56765656, 56765654, 56765456, 56765454, 56765434, 56765432, 56567898, 56567878, 56567876, 56567678, 56567676, 56567656, 56567654, 56565678, 56565676, 56565656, 56565654, 56565456, 56565454, 56565434, 56565432, 56545678, 56545676, 56545656, 56545654, 56545456, 56545454, 56545434, 56545432, 56543456, 56543454, 56543434, 56543432, 56543234, 56543232, 56543212, 56543210, 54567898, 54567878, 54567876, 54567678, 54567676, 54567656, 54567654, 54565678, 54565676, 54565656, 54565654, 54565456, 54565454, 54565434, 54565432, 54545678, 54545676, 54545656, 54545654, 54545456, 54545454, 54545434, 54545432, 54543456, 54543454, 54543434, 54543432, 54543234, 54543232, 54543212, 54543210, 54345678, 54345676, 54345656, 54345654, 54345456, 54345454, 54345434, 54345432, 54343456, 54343454, 54343434, 54343432, 54343234, 54343232, 54343212, 54343210, 54323456, 54323454, 54323434, 54323432, 54323234, 54323232, 54323212, 54323210, 54321234, 54321232, 54321212, 54321210, 54321012, 54321010, 67898989, 67898987, 67898789, 67898787, 67898767, 67898765, 67878989, 67878987, 67878789, 67878787, 67878767, 67878765, 67876789, 67876787, 67876767, 67876765, 67876567, 67876565, 67876545, 67876543, 67678989, 67678987, 67678789, 67678787, 67678767, 67678765, 67676789, 67676787, 67676767, 67676765, 67676567, 67676565, 67676545, 67676543, 67656789, 67656787, 67656767, 67656765, 67656567, 67656565, 67656545, 67656543, 67654567, 67654565, 67654545, 67654543, 67654345, 67654343, 67654323, 67654321, 65678989, 65678987, 65678789, 65678787, 65678767, 65678765, 65676789, 65676787, 65676767, 65676765, 65676567, 65676565, 65676545, 65676543, 65656789, 65656787, 65656767, 65656765, 65656567, 65656565, 65656545, 65656543, 65654567, 65654565, 65654545, 65654543, 65654345, 65654343, 65654323, 65654321, 65456789, 65456787, 65456767, 65456765, 65456567, 65456565, 65456545, 65456543, 65454567, 65454565, 65454545, 65454543, 65454345, 65454343, 65454323, 65454321, 65434567, 65434565, 65434545, 65434543, 65434345, 65434343, 65434323, 65434321, 65432345, 65432343, 65432323, 65432321, 65432123, 65432121, 65432101, 78989898, 78989878, 78989876, 78987898, 78987878, 78987876, 78987678, 78987676, 78987656, 78987654, 78789898, 78789878, 78789876, 78787898, 78787878, 78787876, 78787678, 78787676, 78787656, 78787654, 78767898, 78767878, 78767876, 78767678, 78767676, 78767656, 78767654, 78765678, 78765676, 78765656, 78765654, 78765456, 78765454, 78765434, 78765432, 76789898, 76789878, 76789876, 76787898, 76787878, 76787876, 76787678, 76787676, 76787656, 76787654, 76767898, 76767878, 76767876, 76767678, 76767676, 76767656, 76767654, 76765678, 76765676, 76765656, 76765654, 76765456, 76765454, 76765434, 76765432, 76567898, 76567878, 76567876, 76567678, 76567676, 76567656, 76567654, 76565678, 76565676, 76565656, 76565654, 76565456, 76565454, 76565434, 76565432, 76545678, 76545676, 76545656, 76545654, 76545456, 76545454, 76545434, 76545432, 76543456, 76543454, 76543434, 76543432, 76543234, 76543232, 76543212, 76543210, 89898989, 89898987, 89898789, 89898787, 89898767, 89898765, 89878989, 89878987, 89878789, 89878787, 89878767, 89878765, 89876789, 89876787, 89876767, 89876765, 89876567, 89876565, 89876545, 89876543, 87898989, 87898987, 87898789, 87898787, 87898767, 87898765, 87878989, 87878987, 87878789, 87878787, 87878767, 87878765, 87876789, 87876787, 87876767, 87876765, 87876567, 87876565, 87876545, 87876543, 87678989, 87678987, 87678789, 87678787, 87678767, 87678765, 87676789, 87676787, 87676767, 87676765, 87676567, 87676565, 87676545, 87676543, 87656789, 87656787, 87656767, 87656765, 87656567, 87656565, 87656545, 87656543, 87654567, 87654565, 87654545, 87654543, 87654345, 87654343, 87654323, 87654321, 98989898, 98989878, 98989876, 98987898, 98987878, 98987876, 98987678, 98987676, 98987656, 98987654, 98789898, 98789878, 98789876, 98787898, 98787878, 98787876, 98787678, 98787676, 98787656, 98787654, 98767898, 98767878, 98767876, 98767678, 98767676, 98767656, 98767654, 98765678, 98765676, 98765656, 98765654, 98765456, 98765454, 98765434, 98765432]\n assert candidate(n = 3,k = 9) == [909]\n assert candidate(n = 7,k = 4) == [1595959, 1595951, 1595159, 1595151, 1515959, 1515951, 1515159, 1515151, 2626262, 3737373, 4848484, 4848404, 4840484, 4840404, 4048484, 4048404, 4040484, 4040404, 5959595, 5959515, 5951595, 5951515, 5159595, 5159515, 5151595, 5151515, 6262626, 7373737, 8484848, 8484840, 8484048, 8484040, 8404848, 8404840, 8404048, 8404040, 9595959, 9595951, 9595159, 9595151, 9515959, 9515951, 9515159, 9515151]\n assert candidate(n = 8,k = 2) == [13579797, 13579757, 13579753, 13575797, 13575757, 13575753, 13575357, 13575353, 13575313, 13535797, 13535757, 13535753, 13535357, 13535353, 13535313, 13531357, 13531353, 13531313, 13135797, 13135757, 13135753, 13135357, 13135353, 13135313, 13131357, 13131353, 13131313, 24686868, 24686864, 24686468, 24686464, 24686424, 24686420, 24646868, 24646864, 24646468, 24646464, 24646424, 24646420, 24642468, 24642464, 24642424, 24642420, 24642024, 24642020, 24246868, 24246864, 24246468, 24246464, 24246424, 24246420, 24242468, 24242464, 24242424, 24242420, 24242024, 24242020, 24202468, 24202464, 24202424, 24202420, 24202024, 24202020, 20246868, 20246864, 20246468, 20246464, 20246424, 20246420, 20242468, 20242464, 20242424, 20242420, 20242024, 20242020, 20202468, 20202464, 20202424, 20202420, 20202024, 20202020, 35797979, 35797975, 35797579, 35797575, 35797535, 35797531, 35757979, 35757975, 35757579, 35757575, 35757535, 35757531, 35753579, 35753575, 35753535, 35753531, 35753135, 35753131, 35357979, 35357975, 35357579, 35357575, 35357535, 35357531, 35353579, 35353575, 35353535, 35353531, 35353135, 35353131, 35313579, 35313575, 35313535, 35313531, 35313135, 35313131, 31357979, 31357975, 31357579, 31357575, 31357535, 31357531, 31353579, 31353575, 31353535, 31353531, 31353135, 31353131, 31313579, 31313575, 31313535, 31313531, 31313135, 31313131, 46868686, 46868646, 46868642, 46864686, 46864646, 46864642, 46864246, 46864242, 46864202, 46468686, 46468646, 46468642, 46464686, 46464646, 46464642, 46464246, 46464242, 46464202, 46424686, 46424646, 46424642, 46424246, 46424242, 46424202, 46420246, 46420242, 46420202, 42468686, 42468646, 42468642, 42464686, 42464646, 42464642, 42464246, 42464242, 42464202, 42424686, 42424646, 42424642, 42424246, 42424242, 42424202, 42420246, 42420242, 42420202, 42024686, 42024646, 42024642, 42024246, 42024242, 42024202, 42020246, 42020242, 42020202, 57979797, 57979757, 57979753, 57975797, 57975757, 57975753, 57975357, 57975353, 57975313, 57579797, 57579757, 57579753, 57575797, 57575757, 57575753, 57575357, 57575353, 57575313, 57535797, 57535757, 57535753, 57535357, 57535353, 57535313, 57531357, 57531353, 57531313, 53579797, 53579757, 53579753, 53575797, 53575757, 53575753, 53575357, 53575353, 53575313, 53535797, 53535757, 53535753, 53535357, 53535353, 53535313, 53531357, 53531353, 53531313, 53135797, 53135757, 53135753, 53135357, 53135353, 53135313, 53131357, 53131353, 53131313, 68686868, 68686864, 68686468, 68686464, 68686424, 68686420, 68646868, 68646864, 68646468, 68646464, 68646424, 68646420, 68642468, 68642464, 68642424, 68642420, 68642024, 68642020, 64686868, 64686864, 64686468, 64686464, 64686424, 64686420, 64646868, 64646864, 64646468, 64646464, 64646424, 64646420, 64642468, 64642464, 64642424, 64642420, 64642024, 64642020, 64246868, 64246864, 64246468, 64246464, 64246424, 64246420, 64242468, 64242464, 64242424, 64242420, 64242024, 64242020, 64202468, 64202464, 64202424, 64202420, 64202024, 64202020, 79797979, 79797975, 79797579, 79797575, 79797535, 79797531, 79757979, 79757975, 79757579, 79757575, 79757535, 79757531, 79753579, 79753575, 79753535, 79753531, 79753135, 79753131, 75797979, 75797975, 75797579, 75797575, 75797535, 75797531, 75757979, 75757975, 75757579, 75757575, 75757535, 75757531, 75753579, 75753575, 75753535, 75753531, 75753135, 75753131, 75357979, 75357975, 75357579, 75357575, 75357535, 75357531, 75353579, 75353575, 75353535, 75353531, 75353135, 75353131, 75313579, 75313575, 75313535, 75313531, 75313135, 75313131, 86868686, 86868646, 86868642, 86864686, 86864646, 86864642, 86864246, 86864242, 86864202, 86468686, 86468646, 86468642, 86464686, 86464646, 86464642, 86464246, 86464242, 86464202, 86424686, 86424646, 86424642, 86424246, 86424242, 86424202, 86420246, 86420242, 86420202, 97979797, 97979757, 97979753, 97975797, 97975757, 97975753, 97975357, 97975353, 97975313, 97579797, 97579757, 97579753, 97575797, 97575757, 97575753, 97575357, 97575353, 97575313, 97535797, 97535757, 97535753, 97535357, 97535353, 97535313, 97531357, 97531353, 97531313]\n assert candidate(n = 5,k = 7) == [18181, 29292, 70707, 81818, 92929]\n assert candidate(n = 8,k = 3) == [14747474, 14747414, 14741474, 14741414, 14147474, 14147414, 14141474, 14141414, 25858585, 25858525, 25852585, 25852525, 25258585, 25258525, 25252585, 25252525, 36969696, 36969636, 36969630, 36963696, 36963636, 36963630, 36963036, 36963030, 36369696, 36369636, 36369630, 36363696, 36363636, 36363630, 36363036, 36363030, 36303696, 36303636, 36303630, 36303036, 36303030, 30369696, 30369636, 30369630, 30363696, 30363636, 30363630, 30363036, 30363030, 30303696, 30303636, 30303630, 30303036, 30303030, 47474747, 47474741, 47474147, 47474141, 47414747, 47414741, 47414147, 47414141, 41474747, 41474741, 41474147, 41474141, 41414747, 41414741, 41414147, 41414141, 58585858, 58585852, 58585258, 58585252, 58525858, 58525852, 58525258, 58525252, 52585858, 52585852, 52585258, 52585252, 52525858, 52525852, 52525258, 52525252, 69696969, 69696963, 69696369, 69696363, 69696303, 69636969, 69636963, 69636369, 69636363, 69636303, 69630369, 69630363, 69630303, 63696969, 63696963, 63696369, 63696363, 63696303, 63636969, 63636963, 63636369, 63636363, 63636303, 63630369, 63630363, 63630303, 63036969, 63036963, 63036369, 63036363, 63036303, 63030369, 63030363, 63030303, 74747474, 74747414, 74741474, 74741414, 74147474, 74147414, 74141474, 74141414, 85858585, 85858525, 85852585, 85852525, 85258585, 85258525, 85252585, 85252525, 96969696, 96969636, 96969630, 96963696, 96963636, 96963630, 96963036, 96963030, 96369696, 96369636, 96369630, 96363696, 96363636, 96363630, 96363036, 96363030, 96303696, 96303636, 96303630, 96303036, 96303030]\n assert candidate(n = 8,k = 4) == [15959595, 15959515, 15951595, 15951515, 15159595, 15159515, 15151595, 15151515, 26262626, 37373737, 48484848, 48484840, 48484048, 48484040, 48404848, 48404840, 48404048, 48404040, 40484848, 40484840, 40484048, 40484040, 40404848, 40404840, 40404048, 40404040, 59595959, 59595951, 59595159, 59595151, 59515959, 59515951, 59515159, 59515151, 51595959, 51595951, 51595159, 51595151, 51515959, 51515951, 51515159, 51515151, 62626262, 73737373, 84848484, 84848404, 84840484, 84840404, 84048484, 84048404, 84040484, 84040404, 95959595, 95959515, 95951595, 95951515, 95159595, 95159515, 95151595, 95151515]\n assert candidate(n = 6,k = 4) == [159595, 159515, 151595, 151515, 262626, 373737, 484848, 484840, 484048, 484040, 404848, 404840, 404048, 404040, 595959, 595951, 595159, 595151, 515959, 515951, 515159, 515151, 626262, 737373, 848484, 848404, 840484, 840404, 959595, 959515, 951595, 951515]\n assert candidate(n = 8,k = 9) == [90909090]\n assert candidate(n = 7,k = 7) == [1818181, 2929292, 7070707, 8181818, 9292929]\n assert candidate(n = 8,k = 0) == [11111111, 22222222, 33333333, 44444444, 55555555, 66666666, 77777777, 88888888, 99999999]\n assert candidate(n = 7,k = 0) == [1111111, 2222222, 3333333, 4444444, 5555555, 6666666, 7777777, 8888888, 9999999]\n assert candidate(n = 9,k = 3) == [147474747, 147474741, 147474147, 147474141, 147414747, 147414741, 147414147, 147414141, 141474747, 141474741, 141474147, 141474141, 141414747, 141414741, 141414147, 141414141, 258585858, 258585852, 258585258, 258585252, 258525858, 258525852, 258525258, 258525252, 252585858, 252585852, 252585258, 252585252, 252525858, 252525852, 252525258, 252525252, 369696969, 369696963, 369696369, 369696363, 369696303, 369636969, 369636963, 369636369, 369636363, 369636303, 369630369, 369630363, 369630303, 363696969, 363696963, 363696369, 363696363, 363696303, 363636969, 363636963, 363636369, 363636363, 363636303, 363630369, 363630363, 363630303, 363036969, 363036963, 363036369, 363036363, 363036303, 363030369, 363030363, 363030303, 303696969, 303696963, 303696369, 303696363, 303696303, 303636969, 303636963, 303636369, 303636363, 303636303, 303630369, 303630363, 303630303, 303036969, 303036963, 303036369, 303036363, 303036303, 303030369, 303030363, 303030303, 474747474, 474747414, 474741474, 474741414, 474147474, 474147414, 474141474, 474141414, 414747474, 414747414, 414741474, 414741414, 414147474, 414147414, 414141474, 414141414, 585858585, 585858525, 585852585, 585852525, 585258585, 585258525, 585252585, 585252525, 525858585, 525858525, 525852585, 525852525, 525258585, 525258525, 525252585, 525252525, 696969696, 696969636, 696969630, 696963696, 696963636, 696963630, 696963036, 696963030, 696369696, 696369636, 696369630, 696363696, 696363636, 696363630, 696363036, 696363030, 696303696, 696303636, 696303630, 696303036, 696303030, 636969696, 636969636, 636969630, 636963696, 636963636, 636963630, 636963036, 636963030, 636369696, 636369636, 636369630, 636363696, 636363636, 636363630, 636363036, 636363030, 636303696, 636303636, 636303630, 636303036, 636303030, 630369696, 630369636, 630369630, 630363696, 630363636, 630363630, 630363036, 630363030, 630303696, 630303636, 630303630, 630303036, 630303030, 747474747, 747474741, 747474147, 747474141, 747414747, 747414741, 747414147, 747414141, 741474747, 741474741, 741474147, 741474141, 741414747, 741414741, 741414147, 741414141, 858585858, 858585852, 858585258, 858585252, 858525858, 858525852, 858525258, 858525252, 852585858, 852585852, 852585258, 852585252, 852525858, 852525852, 852525258, 852525252, 969696969, 969696963, 969696369, 969696363, 969696303, 969636969, 969636963, 969636369, 969636363, 969636303, 969630369, 969630363, 969630303, 963696969, 963696963, 963696369, 963696363, 963696303, 963636969, 963636963, 963636369, 963636363, 963636303, 963630369, 963630363, 963630303, 963036969, 963036963, 963036369, 963036363, 963036303, 963030369, 963030363, 963030303]\n assert candidate(n = 8,k = 5) == [16161616, 27272727, 38383838, 49494949, 50505050, 61616161, 72727272, 83838383, 94949494]\n assert candidate(n = 9,k = 2) == [135797979, 135797975, 135797579, 135797575, 135797535, 135797531, 135757979, 135757975, 135757579, 135757575, 135757535, 135757531, 135753579, 135753575, 135753535, 135753531, 135753135, 135753131, 135357979, 135357975, 135357579, 135357575, 135357535, 135357531, 135353579, 135353575, 135353535, 135353531, 135353135, 135353131, 135313579, 135313575, 135313535, 135313531, 135313135, 135313131, 131357979, 131357975, 131357579, 131357575, 131357535, 131357531, 131353579, 131353575, 131353535, 131353531, 131353135, 131353131, 131313579, 131313575, 131313535, 131313531, 131313135, 131313131, 246868686, 246868646, 246868642, 246864686, 246864646, 246864642, 246864246, 246864242, 246864202, 246468686, 246468646, 246468642, 246464686, 246464646, 246464642, 246464246, 246464242, 246464202, 246424686, 246424646, 246424642, 246424246, 246424242, 246424202, 246420246, 246420242, 246420202, 242468686, 242468646, 242468642, 242464686, 242464646, 242464642, 242464246, 242464242, 242464202, 242424686, 242424646, 242424642, 242424246, 242424242, 242424202, 242420246, 242420242, 242420202, 242024686, 242024646, 242024642, 242024246, 242024242, 242024202, 242020246, 242020242, 242020202, 202468686, 202468646, 202468642, 202464686, 202464646, 202464642, 202464246, 202464242, 202464202, 202424686, 202424646, 202424642, 202424246, 202424242, 202424202, 202420246, 202420242, 202420202, 202024686, 202024646, 202024642, 202024246, 202024242, 202024202, 202020246, 202020242, 202020202, 357979797, 357979757, 357979753, 357975797, 357975757, 357975753, 357975357, 357975353, 357975313, 357579797, 357579757, 357579753, 357575797, 357575757, 357575753, 357575357, 357575353, 357575313, 357535797, 357535757, 357535753, 357535357, 357535353, 357535313, 357531357, 357531353, 357531313, 353579797, 353579757, 353579753, 353575797, 353575757, 353575753, 353575357, 353575353, 353575313, 353535797, 353535757, 353535753, 353535357, 353535353, 353535313, 353531357, 353531353, 353531313, 353135797, 353135757, 353135753, 353135357, 353135353, 353135313, 353131357, 353131353, 353131313, 313579797, 313579757, 313579753, 313575797, 313575757, 313575753, 313575357, 313575353, 313575313, 313535797, 313535757, 313535753, 313535357, 313535353, 313535313, 313531357, 313531353, 313531313, 313135797, 313135757, 313135753, 313135357, 313135353, 313135313, 313131357, 313131353, 313131313, 468686868, 468686864, 468686468, 468686464, 468686424, 468686420, 468646868, 468646864, 468646468, 468646464, 468646424, 468646420, 468642468, 468642464, 468642424, 468642420, 468642024, 468642020, 464686868, 464686864, 464686468, 464686464, 464686424, 464686420, 464646868, 464646864, 464646468, 464646464, 464646424, 464646420, 464642468, 464642464, 464642424, 464642420, 464642024, 464642020, 464246868, 464246864, 464246468, 464246464, 464246424, 464246420, 464242468, 464242464, 464242424, 464242420, 464242024, 464242020, 464202468, 464202464, 464202424, 464202420, 464202024, 464202020, 424686868, 424686864, 424686468, 424686464, 424686424, 424686420, 424646868, 424646864, 424646468, 424646464, 424646424, 424646420, 424642468, 424642464, 424642424, 424642420, 424642024, 424642020, 424246868, 424246864, 424246468, 424246464, 424246424, 424246420, 424242468, 424242464, 424242424, 424242420, 424242024, 424242020, 424202468, 424202464, 424202424, 424202420, 424202024, 424202020, 420246868, 420246864, 420246468, 420246464, 420246424, 420246420, 420242468, 420242464, 420242424, 420242420, 420242024, 420242020, 420202468, 420202464, 420202424, 420202420, 420202024, 420202020, 579797979, 579797975, 579797579, 579797575, 579797535, 579797531, 579757979, 579757975, 579757579, 579757575, 579757535, 579757531, 579753579, 579753575, 579753535, 579753531, 579753135, 579753131, 575797979, 575797975, 575797579, 575797575, 575797535, 575797531, 575757979, 575757975, 575757579, 575757575, 575757535, 575757531, 575753579, 575753575, 575753535, 575753531, 575753135, 575753131, 575357979, 575357975, 575357579, 575357575, 575357535, 575357531, 575353579, 575353575, 575353535, 575353531, 575353135, 575353131, 575313579, 575313575, 575313535, 575313531, 575313135, 575313131, 535797979, 535797975, 535797579, 535797575, 535797535, 535797531, 535757979, 535757975, 535757579, 535757575, 535757535, 535757531, 535753579, 535753575, 535753535, 535753531, 535753135, 535753131, 535357979, 535357975, 535357579, 535357575, 535357535, 535357531, 535353579, 535353575, 535353535, 535353531, 535353135, 535353131, 535313579, 535313575, 535313535, 535313531, 535313135, 535313131, 531357979, 531357975, 531357579, 531357575, 531357535, 531357531, 531353579, 531353575, 531353535, 531353531, 531353135, 531353131, 531313579, 531313575, 531313535, 531313531, 531313135, 531313131, 686868686, 686868646, 686868642, 686864686, 686864646, 686864642, 686864246, 686864242, 686864202, 686468686, 686468646, 686468642, 686464686, 686464646, 686464642, 686464246, 686464242, 686464202, 686424686, 686424646, 686424642, 686424246, 686424242, 686424202, 686420246, 686420242, 686420202, 646868686, 646868646, 646868642, 646864686, 646864646, 646864642, 646864246, 646864242, 646864202, 646468686, 646468646, 646468642, 646464686, 646464646, 646464642, 646464246, 646464242, 646464202, 646424686, 646424646, 646424642, 646424246, 646424242, 646424202, 646420246, 646420242, 646420202, 642468686, 642468646, 642468642, 642464686, 642464646, 642464642, 642464246, 642464242, 642464202, 642424686, 642424646, 642424642, 642424246, 642424242, 642424202, 642420246, 642420242, 642420202, 642024686, 642024646, 642024642, 642024246, 642024242, 642024202, 642020246, 642020242, 642020202, 797979797, 797979757, 797979753, 797975797, 797975757, 797975753, 797975357, 797975353, 797975313, 797579797, 797579757, 797579753, 797575797, 797575757, 797575753, 797575357, 797575353, 797575313, 797535797, 797535757, 797535753, 797535357, 797535353, 797535313, 797531357, 797531353, 797531313, 757979797, 757979757, 757979753, 757975797, 757975757, 757975753, 757975357, 757975353, 757975313, 757579797, 757579757, 757579753, 757575797, 757575757, 757575753, 757575357, 757575353, 757575313, 757535797, 757535757, 757535753, 757535357, 757535353, 757535313, 757531357, 757531353, 757531313, 753579797, 753579757, 753579753, 753575797, 753575757, 753575753, 753575357, 753575353, 753575313, 753535797, 753535757, 753535753, 753535357, 753535353, 753535313, 753531357, 753531353, 753531313, 753135797, 753135757, 753135753, 753135357, 753135353, 753135313, 753131357, 753131353, 753131313, 868686868, 868686864, 868686468, 868686464, 868686424, 868686420, 868646868, 868646864, 868646468, 868646464, 868646424, 868646420, 868642468, 868642464, 868642424, 868642420, 868642024, 868642020, 864686868, 864686864, 864686468, 864686464, 864686424, 864686420, 864646868, 864646864, 864646468, 864646464, 864646424, 864646420, 864642468, 864642464, 864642424, 864642420, 864642024, 864642020, 864246868, 864246864, 864246468, 864246464, 864246424, 864246420, 864242468, 864242464, 864242424, 864242420, 864242024, 864242020, 864202468, 864202464, 864202424, 864202420, 864202024, 864202020, 979797979, 979797975, 979797579, 979797575, 979797535, 979797531, 979757979, 979757975, 979757579, 979757575, 979757535, 979757531, 979753579, 979753575, 979753535, 979753531, 979753135, 979753131, 975797979, 975797975, 975797579, 975797575, 975797535, 975797531, 975757979, 975757975, 975757579, 975757575, 975757535, 975757531, 975753579, 975753575, 975753535, 975753531, 975753135, 975753131, 975357979, 975357975, 975357579, 975357575, 975357535, 975357531, 975353579, 975353575, 975353535, 975353531, 975353135, 975353131, 975313579, 975313575, 975313535, 975313531, 975313135, 975313131]\n assert candidate(n = 9,k = 6) == [171717171, 282828282, 393939393, 606060606, 717171717, 828282828, 939393939]\n assert candidate(n = 5,k = 3) == [14747, 14741, 14147, 14141, 25858, 25852, 25258, 25252, 36969, 36963, 36369, 36363, 36303, 30369, 30363, 30303, 47474, 47414, 41474, 41414, 58585, 58525, 52585, 52525, 69696, 69636, 69630, 63696, 63636, 63630, 63036, 63030, 74747, 74741, 74147, 74141, 85858, 85852, 85258, 85252, 96969, 96963, 96369, 96363, 96303]\n assert candidate(n = 7,k = 5) == [1616161, 2727272, 3838383, 4949494, 5050505, 6161616, 7272727, 8383838, 9494949]\n assert candidate(n = 3,k = 8) == [191, 808, 919]\n assert candidate(n = 9,k = 7) == [181818181, 292929292, 707070707, 818181818, 929292929]\n assert candidate(n = 6,k = 7) == [181818, 292929, 707070, 818181, 929292]\n assert candidate(n = 6,k = 3) == [147474, 147414, 141474, 141414, 258585, 258525, 252585, 252525, 369696, 369636, 369630, 363696, 363636, 363630, 363036, 363030, 303696, 303636, 303630, 303036, 303030, 474747, 474741, 474147, 474141, 414747, 414741, 414147, 414141, 585858, 585852, 585258, 585252, 525858, 525852, 525258, 525252, 696969, 696963, 696369, 696363, 696303, 636969, 636963, 636369, 636363, 636303, 630369, 630363, 630303, 747474, 747414, 741474, 741414, 858585, 858525, 852585, 852525, 969696, 969636, 969630, 963696, 963636, 963630, 963036, 963030]\n assert candidate(n = 9,k = 0) == [111111111, 222222222, 333333333, 444444444, 555555555, 666666666, 777777777, 888888888, 999999999]\n assert candidate(n = 5,k = 8) == [19191, 80808, 91919]\n assert candidate(n = 8,k = 8) == [19191919, 80808080, 91919191]\n assert candidate(n = 5,k = 6) == [17171, 28282, 39393, 60606, 71717, 82828, 93939]\n assert candidate(n = 4,k = 4) == [1595, 1515, 2626, 3737, 4848, 4840, 4048, 4040, 5959, 5951, 5159, 5151, 6262, 7373, 8484, 8404, 9595, 9515]\n assert candidate(n = 6,k = 5) == [161616, 272727, 383838, 494949, 505050, 616161, 727272, 838383, 949494]\n assert candidate(n = 6,k = 2) == [135797, 135757, 135753, 135357, 135353, 135313, 131357, 131353, 131313, 246868, 246864, 246468, 246464, 246424, 246420, 242468, 242464, 242424, 242420, 242024, 242020, 202468, 202464, 202424, 202420, 202024, 202020, 357979, 357975, 357579, 357575, 357535, 357531, 353579, 353575, 353535, 353531, 353135, 353131, 313579, 313575, 313535, 313531, 313135, 313131, 468686, 468646, 468642, 464686, 464646, 464642, 464246, 464242, 464202, 424686, 424646, 424642, 424246, 424242, 424202, 420246, 420242, 420202, 579797, 579757, 579753, 575797, 575757, 575753, 575357, 575353, 575313, 535797, 535757, 535753, 535357, 535353, 535313, 531357, 531353, 531313, 686868, 686864, 686468, 686464, 686424, 686420, 646868, 646864, 646468, 646464, 646424, 646420, 642468, 642464, 642424, 642420, 642024, 642020, 797979, 797975, 797579, 797575, 797535, 797531, 757979, 757975, 757579, 757575, 757535, 757531, 753579, 753575, 753535, 753531, 753135, 753131, 868686, 868646, 868642, 864686, 864646, 864642, 864246, 864242, 864202, 979797, 979757, 979753, 975797, 975757, 975753, 975357, 975353, 975313]\n assert candidate(n = 7,k = 8) == [1919191, 8080808, 9191919]\n assert candidate(n = 5,k = 4) == [15959, 15951, 15159, 15151, 26262, 37373, 48484, 48404, 40484, 40404, 59595, 59515, 51595, 51515, 62626, 73737, 84848, 84840, 84048, 84040, 95959, 95951, 95159, 95151]\n"}, "metadata": {"canonical_parameter_names": ["n", "k"], "leetcode_dataset_entry_point": "Solution().numsSameConsecDiff", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numsSameConsecDiff = function(n, k) {", "container": null, "callable": "numsSameConsecDiff", "parameters": [{"name": "n", "type": "number"}, {"name": "k", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 968, "task_id": "binary-tree-cameras", "difficulty": "Hard", "problem_description": "You are given the root of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, itself, and its immediate children.\nReturn the minimum number of cameras needed to monitor all nodes of the tree.\n \nExample 1:\n\n\nInput: root = [0,0,null,0,0]\nOutput: 1\nExplanation: One camera is enough to monitor all nodes if placed as shown.\n\nExample 2:\n\n\nInput: root = [0,0,null,0,null,0,null,null,0]\nOutput: 2\nExplanation: At least two cameras are needed to monitor all nodes of the tree. The above image shows one of the valid configurations of camera placement.\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 1000].\nNode.val == 0\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([0, None, 0, None, 0])) == 1\n assert candidate(root = tree_node([0, 0, 0, None, None, 0, 0])) == 2\n assert candidate(root = tree_node([0, 0, None, 0, 0])) == 1\n assert candidate(root = tree_node([0, 0, None, 0, None, 0, None, None, 0])) == 2\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, None, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0])) == 2\n assert candidate(root = tree_node([0])) == 1\n assert candidate(root = tree_node([0, None, 0, None, 0, None, 0])) == 2\n assert candidate(root = tree_node([0, 0, 0, 0, None, None, 0, None, 0, None, 0, 0, None, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, None, None, None, 0, 0])) == 2\n assert candidate(root = tree_node([0, 0, 0, 0, None, None, 0, None, None, None, None, 0])) == 2\n assert candidate(root = tree_node([0, None, 0, 0, 0, 0, 0, 0, 0])) == 3\n assert candidate(root = tree_node([0, 0, None, 0, 0, None, 0, 0, 0, None, None, 0, 0, None, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, None, None, 0, 0, None, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, None, 0, None, None, None, 0, 0])) == 2\n assert candidate(root = tree_node([0, 0, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, None, None, 0, 0, None, 0, None, None, 0, None, 0, None, 0, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, None, None, 0, 0, 0, 0, 0, 0, 0, 0, 0, None, None])) == 8\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, None, 0, 0, None, None, 0, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 9\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, None, 0, 0, 0, 0, 0, 0, 0, 0, None, None, 0, 0, 0, 0, 0, 0, 0])) == 7\n assert candidate(root = tree_node([0, None, 0, 0, 0, 0, 0, 0, 0, None, None, None, None, None, None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 7\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, None, None, 0, None, 0, None, 0, 0, 0, 0, 0, None, None, 0, None, 0, None, 0])) == 6\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, None, 0, 0, None, None, 0, 0, None, None, 0, 0])) == 5\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, None, None, None, None, None, 0, 0, 0, None, None, 0, 0, 0, None, None, None])) == 4\n assert candidate(root = tree_node([0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, None, None, 0, 0, None, 0])) == 4\n assert candidate(root = tree_node([0, None, 0, 0, 0, None, None, None, 0, 0, 0, None, None, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, None, 0, 0, 0, None, 0, 0, None, None, None, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, None, 0, 0, None, None, None, 0, 0, None])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, None, None, None, None, None, None, None, None, None])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, None, 0, 0, 0, 0, None, None, None, None])) == 3\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, 0, None, 0, 0, 0, None, 0, 0, 0, None, 0, 0, 0, None, 0, 0, 0])) == 6\n assert candidate(root = tree_node([0, 0, 0, None, None, 0, 0, 0, None, None, 0, 0, None, None, 0, 0, None, None, 0, 0, 0])) == 5\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, None, None, None, None, None, None, 0, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, None, 0, None, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, None, 0, 0, None, None, 0, 0, None, None, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, None, None, 0, 0, 0, None, None, 0, 0, 0, None, None])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, None, 0, 0, 0, 0, 0, 0, None, None, 0, 0, 0, 0, 0, 0, None, None, 0, 0, 0, None, None, 0])) == 8\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, None, None, 0, 0, None, None, 0, 0, None, None, 0, 0, None, None, 0, 0, None, None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 10\n assert candidate(root = tree_node([0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, None, None, None, 0, 0, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, None, 0, 0, 0])) == 5\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, 0])) == 2\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, None, 0, 0, None, 0, 0, None, 0, 0, None, 0, 0, None, 0, 0, None, 0, 0])) == 6\n assert candidate(root = tree_node([0, 0, None, 0, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 8\n assert candidate(root = tree_node([0, 0, 0, None, None, 0, 0, None, None, 0, 0, None, None, 0, 0, None, None, 0, 0, None, None])) == 5\n assert candidate(root = tree_node([0, 0, 0, 0, None, None, 0, None, None, 0, 0])) == 2\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, None, 0, 0, None, 0, None, 0, None, 0, 0, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, None, 0, 0, 0, None, 0, 0, 0, None, 0, None, 0, None, 0, None, 0, 0, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 8\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 10\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 15\n assert candidate(root = tree_node([0, 0, 0, 0, None, None, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, None, None, 0, 0, None, None, 0, 0, None, None, 0, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, None, 0, None, 0, None, None, 0, None, 0, None, None, 0, None])) == 3\n assert candidate(root = tree_node([0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 2\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, None, None, 0, None, None, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, None, None, 0, 0, None, None, None, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, None, None, 0, 0, 0, None, None, 0, 0, 0, 0, 0, 0])) == 5\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 7\n assert candidate(root = tree_node([0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 5\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, 0, None, None, 0, 0, 0, None, None, 0, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, None, None, None, 0])) == 2\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, 0, 0, 0, None, 0, 0, 0, 0, 0, 0, 0, None, None, 0, 0])) == 6\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, None, None, None, 0, 0, 0, 0, 0, 0, None, None, None, None, 0, 0, 0])) == 5\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, None, 0, None, 0, None, 0])) == 5\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 8\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, None, None, 0, 0, None, None, 0, 0, None, None])) == 5\n assert candidate(root = tree_node([0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, None, 0, 0, 0, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, None, 0, 0, 0, None, 0, 0, 0, 0, 0, 0, 0, None, 0, None, 0, 0, 0, None, 0, None, 0, None, 0, None, 0, 0, 0, None, 0])) == 10\n assert candidate(root = tree_node([0, None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, None, None, None, None, None, None, None, None])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, None, 0, None, 0, None, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0])) == 11\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0])) == 6\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, None, None, None, 0, 0, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, None, 0, 0, 0, 0, None, None, None, None, None, None, None, 0])) == 2\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, 0, 0])) == 7\n assert candidate(root = tree_node([0, 0, 0, 0, None, 0, None, None, 0, None, 0, 0, None, 0, None])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, None, None, None, None, 0])) == 5\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, None, None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, None, None, None, None])) == 5\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, None, None, None, None, None, None, None, None, None, 0, 0, 0, 0, 0, 0, 0])) == 2\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, None, 0, 0, 0, 0])) == 5\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, 0, 0, None, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, 0, None, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, None, 0, None, None, None, None, 0, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, None, 0, 0, None, None, 0, 0, 0, 0, None, None, 0, 0, None, None])) == 5\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, None, None, 0, None, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, None, 0, 0, None, None, 0, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, None, 0, 0, 0, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, None, 0, 0, None, 0, None, 0, None, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 6\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, None, 0, 0, 0, None, 0, 0, None, None, 0, 0, 0, None, 0, 0, 0, None, 0, 0, 0, None, None, 0, 0])) == 8\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, 0, 0, 0, None, None, 0, None, None, None])) == 3\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, 0, 0, 0, None, None, 0, 0, None, 0, None, 0, None, 0, None, 0, None, None, 0, None, 0])) == 6\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 10\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, None, 0, 0, 0, 0, 0, 0, None, None, 0, 0])) == 5\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, None, 0, None, None, None, 0, 0, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, None, 0, 0, 0, None, None, 0, 0, None, None, 0, 0])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, 0, None, 0, None, None, 0, 0, None, 0])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 5\n assert candidate(root = tree_node([0, 0, 0, 0, 0, None, 0, 0, 0, None, 0, None, None, 0, 0, 0, None])) == 4\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, None, 0, 0, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 7\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().minCameraCover", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minCameraCover = function(root) {", "container": null, "callable": "minCameraCover", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 969, "task_id": "pancake-sorting", "difficulty": "Medium", "problem_description": "Given an array of integers arr, sort the array by performing a series of pancake flips.\nIn one pancake flip we do the following steps:\n\nChoose an integer k where 1 <= k <= arr.length.\nReverse the sub-array arr[0...k-1] (0-indexed).\n\nFor example, if arr = [3,2,1,4] and we performed a pancake flip choosing k = 3, we reverse the sub-array [3,2,1], so arr = [1,2,3,4] after the pancake flip at k = 3.\nReturn an array of the k-values corresponding to a sequence of pancake flips that sort arr. Any valid answer that sorts the array within 10 * arr.length flips will be judged as correct.\n \nExample 1:\n\nInput: arr = [3,2,4,1]\nOutput: [4,2,4,3]\nExplanation: \nWe perform 4 pancake flips, with k values 4, 2, 4, and 3.\nStarting state: arr = [3, 2, 4, 1]\nAfter 1st flip (k = 4): arr = [1, 4, 2, 3]\nAfter 2nd flip (k = 2): arr = [4, 1, 2, 3]\nAfter 3rd flip (k = 4): arr = [3, 2, 1, 4]\nAfter 4th flip (k = 3): arr = [1, 2, 3, 4], which is sorted.\n\nExample 2:\n\nInput: arr = [1,2,3]\nOutput: []\nExplanation: The input is already sorted, so there is no need to flip anything.\nNote that other answers, such as [3, 3], would also be accepted.\n\n \nConstraints:\n\n1 <= arr.length <= 100\n1 <= arr[i] <= arr.length\nAll integers in arr are unique (i.e. arr is a permutation of the integers from 1 to arr.length).\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [2, 1, 3, 4, 5]) == [2]\n assert candidate(arr = [4, 3, 2, 1]) == [4]\n assert candidate(arr = [5, 4, 3, 2, 1]) == [5]\n assert candidate(arr = [3, 1, 2]) == [3, 2]\n assert candidate(arr = [1, 5, 3, 4, 2]) == [2, 5, 2, 4, 2, 3, 2]\n assert candidate(arr = [2, 3, 4, 1, 5]) == [3, 4]\n assert candidate(arr = [1, 2, 3]) == []\n assert candidate(arr = [1, 5, 4, 3, 2]) == [2, 5, 3, 4]\n assert candidate(arr = [1]) == []\n assert candidate(arr = [5, 4, 3, 2, 1, 6, 7, 8, 9, 10]) == [5]\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [10]\n assert candidate(arr = [2, 1]) == [2]\n assert candidate(arr = [3, 2, 4, 1]) == [3, 4, 2, 3, 2]\n assert candidate(arr = [1, 3, 2]) == [2, 3, 2]\n assert candidate(arr = [6, 3, 5, 1, 2, 4]) == [6, 4, 5, 2, 4]\n assert candidate(arr = [2, 5, 1, 3, 4]) == [2, 5, 4, 2]\n assert candidate(arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]) == [11, 10, 5, 9, 8, 7, 2, 6, 2, 4, 3, 2]\n assert candidate(arr = [3, 1, 4, 2, 6, 5]) == [5, 6, 5, 2, 4, 3, 2]\n assert candidate(arr = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [15]\n assert candidate(arr = [7, 1, 2, 6, 4, 5, 3]) == [7, 4, 6, 4, 5, 4, 3]\n assert candidate(arr = [1, 10, 3, 5, 7, 9, 2, 4, 8, 6]) == [2, 10, 5, 9, 6, 8, 6, 7, 6, 5, 2, 4, 3, 2]\n assert candidate(arr = [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [11]\n assert candidate(arr = [2, 4, 1, 3]) == [2, 4, 3, 2]\n assert candidate(arr = [6, 5, 4, 3, 2, 1, 7, 8, 9, 10]) == [6]\n assert candidate(arr = [7, 1, 8, 2, 9, 3, 10, 4, 5, 6]) == [7, 10, 8, 9, 7, 8, 6, 7, 4, 6, 2, 5, 3]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == [9]\n assert candidate(arr = [8, 5, 10, 9, 3, 7, 6, 4, 2, 1]) == [3, 10, 7, 9, 2, 8, 2, 7, 5, 6, 2, 5, 4, 3, 2]\n assert candidate(arr = [10, 1, 9, 2, 8, 3, 7, 4, 6, 5]) == [10, 8, 9, 7, 8, 6, 7, 5, 6, 4]\n assert candidate(arr = [9, 7, 5, 3, 1, 2, 4, 6, 8]) == [9, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(arr = [6, 5, 3, 1, 2, 4]) == [6, 4, 3, 2]\n assert candidate(arr = [2, 1, 4, 3, 6, 5]) == [5, 6, 5, 2, 4, 2]\n assert candidate(arr = [3, 1, 4, 2]) == [3, 4, 2, 3]\n assert candidate(arr = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [10, 9]\n assert candidate(arr = [8, 6, 4, 2, 1, 3, 5, 7]) == [8, 7, 6, 5, 4, 3, 2]\n assert candidate(arr = [7, 6, 5, 4, 3, 2, 1, 8]) == [7]\n assert candidate(arr = [8, 6, 7, 5, 3, 1, 4, 9, 2, 10]) == [8, 9, 2, 8, 5, 7, 2, 6, 5, 2, 4, 3, 2]\n assert candidate(arr = [1, 3, 5, 7, 9, 10, 8, 6, 4, 2]) == [6, 10, 4, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(arr = [7, 10, 4, 8, 5, 9, 1, 6, 2, 3]) == [2, 10, 5, 9, 3, 8, 6, 7, 3, 6, 5, 2, 4, 3]\n assert candidate(arr = [5, 1, 4, 2, 3]) == [5, 3, 4, 2, 3, 2]\n assert candidate(arr = [5, 3, 1, 4, 2]) == [5, 2, 4, 3, 2]\n assert candidate(arr = [10, 2, 1, 3, 5, 4, 7, 6, 9, 8]) == [10, 2, 9, 6, 7, 6, 2, 5, 2]\n assert candidate(arr = [8, 5, 9, 1, 7, 3, 4, 2, 6]) == [3, 9, 7, 8, 6, 7, 3, 6, 2, 4]\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [20]\n assert candidate(arr = [5, 4, 2, 3, 1]) == [5, 2, 3, 2]\n assert candidate(arr = [7, 1, 6, 2, 5, 3, 4]) == [7, 5, 6, 4, 5, 3, 4, 3]\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 10]) == [8, 9, 8, 2, 7, 4, 5, 4, 2, 3]\n assert candidate(arr = [4, 6, 3, 5, 2, 1]) == [2, 6, 3, 5, 4, 2]\n assert candidate(arr = [6, 4, 2, 1, 3, 5]) == [6, 5, 4, 3, 2]\n assert candidate(arr = [2, 7, 4, 1, 8, 3, 6, 5]) == [5, 8, 5, 7, 4, 6, 2, 3]\n assert candidate(arr = [3, 6, 1, 7, 5, 4, 2]) == [4, 7, 5, 6, 4, 5, 3, 2]\n assert candidate(arr = [6, 1, 5, 2, 4, 3]) == [6, 4, 5, 3, 4, 2]\n assert candidate(arr = [1, 4, 3, 2, 5, 6, 7, 8, 9, 10]) == [2, 4, 2, 3]\n assert candidate(arr = [5, 3, 8, 6, 2, 7, 4, 1]) == [3, 8, 3, 7, 3, 6, 4, 3]\n assert candidate(arr = [1, 3, 2, 5, 4]) == [4, 5, 4, 2, 3]\n assert candidate(arr = [6, 5, 4, 3, 2, 1, 7, 8, 9]) == [6]\n assert candidate(arr = [1, 3, 2, 4, 6, 5]) == [5, 6, 5, 4, 2, 3, 2]\n assert candidate(arr = [7, 1, 3, 5, 2, 6, 4]) == [7, 2, 6, 3, 5, 4, 3, 2]\n assert candidate(arr = [6, 3, 1, 5, 2, 4]) == [6, 3, 5, 3, 4, 2, 3]\n assert candidate(arr = [10, 2, 8, 6, 4, 12, 14, 16, 18, 20, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == [10, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 5, 10, 9, 2, 8, 7, 2, 6, 5, 2, 4, 3, 2]\n assert candidate(arr = [8, 1, 7, 3, 6, 2, 5, 4]) == [8, 6, 7, 5, 6, 4, 5, 2, 3]\n assert candidate(arr = [3, 1, 2, 4, 5]) == [3, 2]\n assert candidate(arr = [7, 4, 6, 2, 5, 1, 3]) == [7, 5, 6, 4, 5, 2, 4, 2, 3, 2]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10]) == [9]\n assert candidate(arr = [7, 1, 5, 3, 6, 4, 2]) == [7, 3, 6, 2, 5, 4, 2, 3, 2]\n assert candidate(arr = [6, 3, 2, 5, 4, 1]) == [6, 3, 5, 3]\n assert candidate(arr = [5, 2, 3, 1, 4]) == [5, 4, 2, 3]\n assert candidate(arr = [8, 6, 7, 5, 3, 0, 9, 1, 4, 2]) == [10, 4, 9, 8, 6, 5, 4, 3, 2]\n assert candidate(arr = [2, 6, 4, 3, 5, 1, 7]) == [2, 6, 2, 5, 2, 4, 2, 3, 2]\n assert candidate(arr = [2, 3, 1, 4, 6, 5]) == [5, 6, 5, 4, 2, 3]\n assert candidate(arr = [3, 5, 4, 1, 2]) == [2, 5, 3, 4, 3]\n assert candidate(arr = [8, 1, 2, 3, 4, 5, 6, 7]) == [8, 7]\n assert candidate(arr = [5, 2, 3, 1, 4, 6, 7, 8, 9, 10]) == [5, 4, 2, 3]\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 10]) == [8, 9, 8, 2, 7, 4, 5, 4, 2, 3]\n assert candidate(arr = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [15]\n assert candidate(arr = [2, 3, 1, 5, 4]) == [4, 5, 4, 2, 3, 2]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10]) == [9]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 11, 12]) == [9]\n assert candidate(arr = [3, 5, 4, 1, 2]) == [2, 5, 3, 4, 3]\n assert candidate(arr = [7, 5, 2, 4, 6, 1, 3]) == [7, 3, 6, 5, 3, 4, 2]\n assert candidate(arr = [2, 4, 1, 3, 5]) == [2, 4, 3, 2]\n assert candidate(arr = [7, 6, 5, 4, 3, 2, 1, 8]) == [7]\n assert candidate(arr = [5, 1, 3, 2, 4]) == [5, 4, 2, 3, 2]\n assert candidate(arr = [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [12]\n assert candidate(arr = [9, 1, 8, 2, 7, 3, 6, 4, 5]) == [9, 7, 8, 6, 7, 5, 6, 4, 5, 4]\n assert candidate(arr = [5, 3, 6, 1, 2, 4]) == [3, 6, 4, 5, 2, 4]\n assert candidate(arr = [4, 1, 5, 2, 3, 6]) == [3, 5, 3, 4, 2, 3, 2]\n assert candidate(arr = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [10, 9]\n assert candidate(arr = [3, 6, 1, 8, 5, 2, 7, 4]) == [4, 8, 2, 7, 2, 6, 3, 5, 3, 4, 2]\n assert candidate(arr = [1, 3, 5, 2, 4, 6]) == [3, 5, 4, 3, 2]\n assert candidate(arr = [2, 7, 4, 3, 5, 1, 6, 8, 9, 10]) == [2, 7, 6, 4, 5, 3, 4, 3, 2]\n assert candidate(arr = [8, 1, 3, 7, 5, 2, 6, 4]) == [8, 5, 7, 4, 6, 5, 4, 2]\n assert candidate(arr = [11, 2, 9, 3, 8, 4, 7, 5, 10, 6, 1]) == [11, 3, 10, 2, 9, 6, 8, 6, 7, 4, 6, 5, 3, 4, 2, 3, 2]\n assert candidate(arr = [6, 3, 5, 4, 2, 1]) == [6, 4, 5, 3, 2]\n assert candidate(arr = [10, 1, 3, 4, 5, 6, 7, 8, 9, 2]) == [10, 2, 9, 7, 8, 2]\n assert candidate(arr = [7, 6, 5, 4, 3, 2, 1]) == [7]\n assert candidate(arr = [9, 7, 5, 3, 1, 8, 6, 4, 2]) == [9, 4, 8, 7, 6, 5, 4, 3, 2]\n assert candidate(arr = [1, 3, 2, 4, 5]) == [2, 3, 2]\n assert candidate(arr = [2, 9, 5, 1, 8, 3, 7, 4, 6]) == [2, 9, 5, 8, 6, 7, 5, 6, 4, 5, 2, 4, 2, 3]\n assert candidate(arr = [5, 1, 9, 7, 3, 10, 2, 4, 8, 6]) == [6, 10, 7, 9, 4, 8, 6, 7, 6, 4, 5, 3, 4, 2]\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().pancakeSort", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var pancakeSort = function(arr) {", "container": null, "callable": "pancakeSort", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 970, "task_id": "powerful-integers", "difficulty": "Medium", "problem_description": "Given three integers x, y, and bound, return a list of all the powerful integers that have a value less than or equal to bound.\nAn integer is powerful if it can be represented as xi + yj for some integers i >= 0 and j >= 0.\nYou may return the answer in any order. In your answer, each value should occur at most once.\n \nExample 1:\n\nInput: x = 2, y = 3, bound = 10\nOutput: [2,3,4,5,7,9,10]\nExplanation:\n2 = 20 + 30\n3 = 21 + 30\n4 = 20 + 31\n5 = 21 + 31\n7 = 22 + 31\n9 = 23 + 30\n10 = 20 + 32\n\nExample 2:\n\nInput: x = 3, y = 5, bound = 15\nOutput: [2,4,6,8,10,14]\n\n \nConstraints:\n\n1 <= x, y <= 100\n0 <= bound <= 106\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(x = 3,y = 5,bound = 15) == [2, 4, 6, 8, 10, 14]\n assert candidate(x = 3,y = 1,bound = 20) == [2, 10, 4]\n assert candidate(x = 2,y = 2,bound = 100) == [2, 3, 4, 5, 6, 8, 9, 10, 12, 16, 17, 18, 20, 24, 32, 33, 34, 36, 40, 48, 64, 65, 66, 68, 72, 80, 96]\n assert candidate(x = 1,y = 2,bound = 10) == [9, 2, 3, 5]\n assert candidate(x = 2,y = 3,bound = 10) == [2, 3, 4, 5, 7, 9, 10]\n assert candidate(x = 1,y = 1,bound = 2) == [2]\n assert candidate(x = 1,y = 1,bound = 5) == [2]\n assert candidate(x = 100,y = 100,bound = 1000000) == [20000, 2, 101, 200, 10001, 10100]\n assert candidate(x = 1,y = 1,bound = 10) == [2]\n assert candidate(x = 5,y = 5,bound = 100) == [2, 6, 10, 50, 26, 30]\n assert candidate(x = 2,y = 2,bound = 10) == [2, 3, 4, 5, 6, 8, 9, 10]\n assert candidate(x = 2,y = 5,bound = 50) == [33, 2, 3, 5, 6, 7, 37, 9, 41, 13, 17, 21, 26, 27, 29]\n assert candidate(x = 99,y = 100,bound = 10000) == [2, 100, 101, 199, 9802, 9901]\n assert candidate(x = 7,y = 11,bound = 1000) == [128, 2, 354, 8, 170, 12, 464, 18, 50, 344, 122, 60]\n assert candidate(x = 2,y = 1,bound = 30) == [2, 3, 5, 9, 17]\n assert candidate(x = 3,y = 2,bound = 100) == [2, 3, 4, 5, 7, 9, 10, 11, 13, 17, 19, 25, 28, 29, 31, 33, 35, 41, 43, 59, 65, 67, 73, 82, 83, 85, 89, 91, 97]\n assert candidate(x = 3,y = 2,bound = 20) == [2, 3, 4, 5, 7, 9, 10, 11, 13, 17, 19]\n assert candidate(x = 2,y = 3,bound = 1000) == [129, 2, 3, 4, 5, 259, 7, 131, 9, 10, 11, 137, 13, 257, 265, 521, 17, 145, 19, 275, 513, 25, 793, 155, 28, 29, 283, 31, 515, 33, 539, 35, 41, 43, 307, 59, 65, 67, 73, 209, 82, 83, 337, 85, 593, 89, 730, 731, 91, 733, 857, 985, 737, 97, 745, 113, 371, 244, 245, 499, 247, 755, 761, 251]\n assert candidate(x = 2,y = 1,bound = 1000) == [33, 2, 3, 65, 5, 129, 257, 513, 9, 17]\n assert candidate(x = 2,y = 5,bound = 30) == [2, 3, 5, 6, 7, 9, 13, 17, 21, 26, 27, 29]\n assert candidate(x = 5,y = 5,bound = 125) == [2, 6, 10, 50, 26, 30]\n assert candidate(x = 3,y = 3,bound = 100) == [2, 4, 36, 6, 10, 12, 82, 18, 84, 54, 90, 28, 30]\n assert candidate(x = 2,y = 5,bound = 100) == [2, 3, 5, 6, 7, 9, 13, 17, 21, 26, 27, 29, 33, 37, 41, 57, 65, 69, 89]\n assert candidate(x = 1,y = 1,bound = 1) == []\n assert candidate(x = 3,y = 2,bound = 25) == [2, 3, 4, 5, 7, 9, 10, 11, 13, 17, 19, 25]\n assert candidate(x = 1,y = 2,bound = 100) == [33, 2, 3, 65, 5, 9, 17]\n assert candidate(x = 2,y = 5,bound = 1000) == [129, 2, 3, 641, 5, 6, 7, 133, 9, 257, 261, 517, 13, 141, 17, 657, 21, 513, 153, 26, 27, 281, 29, 157, 537, 637, 33, 37, 41, 689, 57, 189, 65, 69, 89, 753, 626, 627, 381, 629, 881, 633, 253, 126, 127]\n assert candidate(x = 5,y = 3,bound = 20) == [2, 4, 6, 8, 10, 14]\n assert candidate(x = 17,y = 29,bound = 1000) == [318, 2, 290, 842, 46, 18, 858, 30]\n assert candidate(x = 2,y = 3,bound = 50) == [2, 3, 4, 5, 7, 9, 10, 11, 13, 17, 19, 25, 28, 29, 31, 33, 35, 41, 43]\n assert candidate(x = 1,y = 2,bound = 1000) == [33, 2, 3, 65, 5, 129, 257, 513, 9, 17]\n assert candidate(x = 10,y = 5,bound = 500) == [225, 2, 35, 101, 6, 135, 105, 11, 15, 26, 125, 126]\n assert candidate(x = 99,y = 99,bound = 10000) == [2, 100, 198, 9802, 9900]\n assert candidate(x = 97,y = 97,bound = 10000) == [9410, 2, 9506, 98, 194]\n assert candidate(x = 2,y = 7,bound = 50) == [33, 2, 3, 5, 39, 8, 9, 11, 15, 17, 50, 23]\n assert candidate(x = 7,y = 11,bound = 200) == [128, 2, 8, 170, 12, 18, 50, 122, 60]\n assert candidate(x = 10,y = 10,bound = 1000) == [2, 101, 200, 11, 110, 20]\n assert candidate(x = 31,y = 37,bound = 2000) == [32, 2, 962, 68, 38, 998, 1400, 1370]\n assert candidate(x = 2,y = 5,bound = 256) == [129, 2, 3, 5, 6, 7, 133, 9, 13, 141, 17, 21, 153, 26, 27, 29, 157, 33, 37, 41, 57, 189, 65, 69, 89, 253, 126, 127]\n assert candidate(x = 3,y = 2,bound = 1000) == [129, 2, 515, 3, 5, 257, 513, 4, 9, 7, 11, 131, 10, 13, 137, 265, 17, 521, 19, 145, 275, 259, 25, 793, 155, 28, 29, 283, 31, 539, 33, 35, 41, 43, 307, 59, 65, 67, 73, 209, 82, 83, 337, 85, 593, 89, 730, 91, 731, 733, 857, 985, 97, 737, 745, 113, 371, 244, 245, 499, 247, 755, 761, 251]\n assert candidate(x = 5,y = 7,bound = 500) == [32, 2, 132, 6, 8, 74, 12, 174, 368, 50, 468, 54, 344, 26, 348, 126]\n assert candidate(x = 1,y = 100,bound = 500) == [2, 101]\n assert candidate(x = 97,y = 98,bound = 10000) == [2, 99, 98, 9605, 195, 9701, 9410, 9507]\n assert candidate(x = 5,y = 2,bound = 100) == [2, 3, 5, 6, 7, 9, 13, 17, 21, 26, 27, 29, 33, 37, 41, 57, 65, 69, 89]\n assert candidate(x = 3,y = 7,bound = 343) == [2, 34, 4, 130, 292, 8, 10, 250, 76, 16, 50, 82, 52, 244, 88, 58, 28]\n assert candidate(x = 50,y = 50,bound = 5000) == [2, 100, 2501, 5000, 51, 2550]\n assert candidate(x = 100,y = 100,bound = 100000) == [20000, 2, 101, 200, 10001, 10100]\n assert candidate(x = 100,y = 1,bound = 500) == [2, 101]\n assert candidate(x = 1,y = 1,bound = 1000) == [2]\n assert candidate(x = 2,y = 10,bound = 1024) == [129, 2, 3, 132, 5, 257, 513, 9, 138, 11, 12, 266, 14, 522, 17, 18, 26, 33, 164, 42, 65, 74, 228, 101, 102, 356, 104, 1001, 1002, 612, 1004, 108, 1008, 116, 1016]\n assert candidate(x = 2,y = 3,bound = 100000) == [513, 2, 3, 4, 5, 515, 7, 1025, 9, 10, 11, 521, 13, 1033, 2057, 4105, 17, 8201, 19, 16387, 32771, 65539, 25, 539, 28, 29, 1051, 31, 2075, 33, 6689, 35, 4123, 41, 43, 16393, 16385, 1027, 32777, 65545, 59, 32769, 65, 67, 2049, 73, 2051, 593, 82, 83, 1105, 85, 2129, 4177, 8273, 89, 16465, 91, 33497, 66265, 65537, 97, 113, 129, 131, 75433, 91817, 4097, 85219, 16411, 137, 32795, 2699, 2188, 2189, 3211, 2191, 4235, 145, 4099, 2195, 6283, 2203, 155, 6817, 59561, 59050, 59051, 2219, 59053, 60073, 61097, 63145, 59057, 67241, 59065, 16627, 33011, 59081, 65779, 2251, 209, 22945, 36067, 52451, 1241, 730, 731, 1753, 733, 2777, 4825, 8921, 737, 17113, 20195, 19684, 19685, 20707, 19687, 21731, 745, 59113, 19691, 23779, 39329, 65563, 19699, 244, 245, 755, 247, 1267, 761, 2291, 251, 4339, 18571, 34955, 67723, 257, 259, 19715, 8193, 72097, 265, 2315, 8195, 275, 793, 283, 19747, 59177, 307, 337, 857, 19811, 371, 8219, 2443, 32849, 65617, 7073, 6562, 6563, 7585, 6565, 8609, 10657, 14753, 6569, 59305, 6577, 6593, 8435, 27875, 985, 6625, 19939, 499, 10379]\n assert candidate(x = 3,y = 7,bound = 200) == [2, 34, 4, 130, 8, 10, 76, 16, 50, 82, 52, 88, 58, 28]\n assert candidate(x = 1,y = 2,bound = 1024) == [33, 2, 3, 65, 5, 129, 257, 513, 9, 17]\n assert candidate(x = 17,y = 19,bound = 300) == [2, 290, 36, 18, 20]\n assert candidate(x = 7,y = 4,bound = 200) == [65, 2, 5, 71, 8, 11, 17, 50, 113, 53, 23]\n assert candidate(x = 50,y = 50,bound = 10000) == [2, 100, 2501, 5000, 51, 2550]\n assert candidate(x = 2,y = 1,bound = 1024) == [33, 2, 3, 65, 5, 129, 257, 513, 9, 17]\n assert candidate(x = 97,y = 99,bound = 100000) == [2, 98, 196, 100, 9410, 9508, 9802, 9898, 19210]\n assert candidate(x = 5,y = 5,bound = 50) == [2, 6, 10, 50, 26, 30]\n assert candidate(x = 7,y = 5,bound = 200) == [32, 2, 132, 6, 8, 74, 12, 174, 50, 54, 26, 126]\n assert candidate(x = 2,y = 3,bound = 20) == [2, 3, 4, 5, 7, 9, 10, 11, 13, 17, 19]\n assert candidate(x = 3,y = 7,bound = 300) == [2, 34, 4, 130, 292, 8, 10, 250, 76, 16, 50, 82, 52, 244, 88, 58, 28]\n assert candidate(x = 3,y = 7,bound = 100) == [2, 34, 4, 8, 10, 76, 16, 50, 82, 52, 88, 58, 28]\n assert candidate(x = 2,y = 3,bound = 10000) == [513, 2, 3, 4, 5, 515, 7, 1025, 9, 10, 11, 521, 13, 1033, 2057, 4105, 17, 8201, 19, 25, 539, 28, 29, 1051, 31, 2075, 33, 6689, 35, 4123, 41, 43, 1027, 59, 65, 67, 2049, 73, 2051, 593, 82, 83, 1105, 85, 2129, 4177, 8273, 89, 91, 97, 113, 129, 131, 4097, 137, 2699, 2188, 2189, 3211, 2191, 4235, 145, 4099, 2195, 6283, 2203, 155, 6817, 2219, 2251, 209, 1241, 730, 731, 1753, 733, 2777, 4825, 8921, 737, 745, 755, 244, 245, 1267, 247, 2291, 761, 4339, 251, 8435, 257, 259, 8193, 265, 2315, 8195, 275, 793, 283, 307, 337, 857, 371, 8219, 2443, 7073, 6562, 6563, 7585, 6565, 8609, 6569, 6577, 6593, 985, 6625, 499]\n assert candidate(x = 9,y = 3,bound = 300) == [2, 162, 4, 36, 10, 12, 108, 82, 18, 244, 252, 84, 90, 28]\n assert candidate(x = 3,y = 7,bound = 50) == [2, 34, 4, 8, 10, 16, 50, 28]\n assert candidate(x = 7,y = 11,bound = 100) == [2, 8, 12, 18, 50, 60]\n assert candidate(x = 13,y = 17,bound = 5000) == [2, 290, 2214, 170, 458, 14, 302, 4926, 4914, 18, 2198, 2486, 186, 30]\n assert candidate(x = 5,y = 3,bound = 100) == [32, 2, 34, 4, 6, 8, 10, 14, 82, 52, 86, 26, 28]\n assert candidate(x = 2,y = 3,bound = 100) == [2, 3, 4, 5, 7, 9, 10, 11, 13, 17, 19, 25, 28, 29, 31, 33, 35, 41, 43, 59, 65, 67, 73, 82, 83, 85, 89, 91, 97]\n assert candidate(x = 3,y = 7,bound = 500) == [2, 130, 4, 8, 10, 16, 28, 34, 292, 424, 50, 52, 58, 76, 82, 344, 88, 346, 352, 370, 244, 250]\n assert candidate(x = 10,y = 10,bound = 10000) == [2, 101, 200, 1001, 11, 1100, 110, 2000, 1010, 20]\n assert candidate(x = 7,y = 3,bound = 100) == [2, 34, 4, 8, 10, 76, 16, 82, 50, 52, 88, 58, 28]\n assert candidate(x = 3,y = 2,bound = 50) == [2, 3, 4, 5, 7, 9, 10, 11, 13, 17, 19, 25, 28, 29, 31, 33, 35, 41, 43]\n assert candidate(x = 7,y = 2,bound = 100) == [33, 2, 3, 65, 5, 39, 8, 9, 71, 11, 15, 17, 50, 51, 81, 53, 23, 57]\n assert candidate(x = 3,y = 3,bound = 81) == [2, 4, 36, 6, 10, 12, 18, 54, 28, 30]\n assert candidate(x = 2,y = 1,bound = 100) == [33, 2, 3, 65, 5, 9, 17]\n assert candidate(x = 5,y = 5,bound = 200) == [2, 130, 6, 10, 50, 150, 30, 26, 126]\n assert candidate(x = 1,y = 2,bound = 15) == [9, 2, 3, 5]\n assert candidate(x = 2,y = 2,bound = 1024) == [128, 129, 2, 3, 257, 5, 513, 4, 6, 9, 10, 130, 8, 12, 136, 264, 16, 17, 18, 258, 20, 144, 272, 528, 24, 132, 640, 514, 768, 260, 32, 33, 34, 160, 36, 516, 288, 544, 40, 1024, 256, 48, 520, 64, 65, 66, 192, 68, 320, 576, 384, 72, 80, 512, 96]\n assert candidate(x = 5,y = 5,bound = 1000) == [2, 130, 6, 10, 650, 250, 750, 626, 50, 630, 30, 150, 26, 126]\n assert candidate(x = 2,y = 2,bound = 64) == [2, 3, 4, 5, 6, 8, 9, 10, 12, 16, 17, 18, 20, 24, 32, 33, 34, 36, 40, 48, 64]\n"}, "metadata": {"canonical_parameter_names": ["x", "y", "bound"], "leetcode_dataset_entry_point": "Solution().powerfulIntegers", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var powerfulIntegers = function(x, y, bound) {", "container": null, "callable": "powerfulIntegers", "parameters": [{"name": "x", "type": "number"}, {"name": "y", "type": "number"}, {"name": "bound", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 971, "task_id": "flip-binary-tree-to-match-preorder-traversal", "difficulty": "Medium", "problem_description": "You are given the root of a binary tree with n nodes, where each node is uniquely assigned a value from 1 to n. You are also given a sequence of n values voyage, which is the desired pre-order traversal of the binary tree.\nAny node in the binary tree can be flipped by swapping its left and right subtrees. For example, flipping node 1 will have the following effect:\n\nFlip the smallest number of nodes so that the pre-order traversal of the tree matches voyage.\nReturn a list of the values of all flipped nodes. You may return the answer in any order. If it is impossible to flip the nodes in the tree to make the pre-order traversal match voyage, return the list [-1].\n \nExample 1:\n\n\nInput: root = [1,2], voyage = [2,1]\nOutput: [-1]\nExplanation: It is impossible to flip the nodes such that the pre-order traversal matches voyage.\n\nExample 2:\n\n\nInput: root = [1,2,3], voyage = [1,3,2]\nOutput: [1]\nExplanation: Flipping node 1 swaps nodes 2 and 3, so the pre-order traversal matches voyage.\nExample 3:\n\n\nInput: root = [1,2,3], voyage = [1,2,3]\nOutput: []\nExplanation: The tree's pre-order traversal already matches voyage, so no nodes need to be flipped.\n\n \nConstraints:\n\nThe number of nodes in the tree is n.\nn == voyage.length\n1 <= n <= 100\n1 <= Node.val, voyage[i] <= n\nAll the values in the tree are unique.\nAll the values in voyage are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3]),voyage = [1, 3, 2]) == [1]\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5]),voyage = [1, 3, 5, 4, 2]) == [1, 3]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),voyage = [1, 2, 3, 4, 5, 6, 7]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),voyage = [1, 2, 4, 5, 3, 6, 7]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5]),voyage = [1, 3, 5, 4, 2]) == [-1]\n assert candidate(root = tree_node([1, 2, 3]),voyage = [1, 2, 3]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5]),voyage = [1, 2, 4, 5, 3]) == []\n assert candidate(root = tree_node([1, None, 2]),voyage = [1, 2]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5]),voyage = [1, 3, 2, 5, 4]) == [1, 2]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),voyage = [1, 3, 7, 6, 2, 5, 4]) == [1, 3, 2]\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5]),voyage = [1, 2, 3, 4, 5]) == []\n assert candidate(root = tree_node([1, 2]),voyage = [2, 1]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),voyage = [1, 3, 7, 6, 5, 2, 4]) == [-1]\n assert candidate(root = tree_node([1, 2, None, 3]),voyage = [1, 2, 3]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 7, 14, 15, 6, 12, 13, 2, 5, 10, 11, 4, 8, 9]) == [1, 3, 2]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, 8, 9, 10, 11, None, 13, 14, 15]),voyage = [1, 3, 7, 15, 14, 13, 6, 11, 10, 9, 2, 5, 4, 8]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 2, 4, 9, 8, 5, 11, 10, 3, 6, 13, 12, 7, 15, 14]) == [4, 5, 6, 7]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 6, 5, 4, 7, 2, 10, 9, 8, 13, 12, 11, 15, 14]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, 6, 7, 8]),voyage = [1, 3, 5, 8, 7, 6, 2, 4]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, None, 9, 10, 11, None, 12, None, 13, None, None, 14]),voyage = [1, 2, 4, 8, 3, 5, 10, 11, 6, 12, 13, 7, 9, 14]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 2]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, 6, 7, None, None, 8, 9, 10, 11]),voyage = [1, 3, 5, 11, 10, 9, 8, 7, 6, 2, 4]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, None, None, None, 4, None, None, 5, None, None, 6, None, None, 7, None, None, 8]),voyage = [1, 3, 4, 8, 7, 6, 5, 2]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 6, 12, 13, 7, 14, 15, 2, 4, 8, 9, 5, 10, 11]) == [1]\n assert candidate(root = tree_node([1, 2, None, 3, 4, 5, 6]),voyage = [1, 2, 3, 4, 5, 6]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 7, 15, 14, 13, 6, 12, 11, 10, 9, 8, 2, 5, 4]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, None, None, 8, 9]),voyage = [1, 3, 5, 7, 9, 8, 6, 2, 4]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11, None, None, 12, 13, None, None, 14, 15]),voyage = [1, 3, 7, 6, 5, 2, 4, 9, 8, 11, 10, 13, 12]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, 8, 9]),voyage = [1, 3, 7, 8, 9, 6, 2, 5, 4]) == [1, 3, 2]\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9]),voyage = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8, 9]),voyage = [1, 3, 6, 8, 9, 2, 4, 5]) == [-1]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6]),voyage = [1, 2, 3, 4, 5, 6]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 7, 15, 14, 13, 8, 12, 6, 11, 10, 9, 5, 4, 2]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, None, None, None, None, 7]),voyage = [1, 2, 4, 6, 7, 5, 3]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 2, 6, 5, 4, 7, 11, 10, 9, 13, 12, 8, 15, 14]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, 7, 8, 9, 10, None, None, 11, 12, None, None, 13, None, None, 14, 15]),voyage = [1, 3, 6, 10, 12, 14, 15, 13, 9, 11, 8, 5, 4, 2]) == [-1]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9]),voyage = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 8, None, 9, None, 10]),voyage = [1, 2, 4, 5, 6, 10, 7, 3, 8, 9]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, 6, None, 7, None, 8, None, 9]),voyage = [1, 3, 5, 9, 8, 7, 6, 2, 4]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 2, 3, 4, 6, 5, 7, 8, 9, 10, 11, 12, 13, 15, 14]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, 6]),voyage = [1, 3, 5, 6, 2, 4]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, None, 7, 8, 9, 10]),voyage = [1, 2, 4, 3, 6, 10, 9, 8, 5, 7]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, 7, None, None, None, None, 8]),voyage = [1, 3, 6, 8, 5, 4, 2]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, None, 7, 8, None, None, 9, 10]),voyage = [1, 3, 6, 10, 9, 2, 4, 5, 8, 7]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, None, None, 7, 8, None, None, 9, 10]),voyage = [1, 3, 6, 10, 9, 2, 5, 8, 7, 4]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 14, 15]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 2, 4, 8, 9, 10, 11, 5, 12, 13, 6, 14, 15, 3, 7]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 7, 15, 14, 13, 6, 12, 11, 5, 10, 9, 4, 2]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 8, None, 9, None, 10, None, None, 11, None, 12]),voyage = [1, 2, 4, 5, 6, 10, 11, 7, 3, 8, 12, 9]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11, None, None, 12, 13]),voyage = [1, 3, 7, 13, 12, 6, 11, 10, 9, 8, 2, 5, 4]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 7, 15, 14, 13, 12, 6, 11, 10, 9, 8, 2, 5, 4]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6]),voyage = [1, 2, 4, 3, 5, 6]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 7, 15, 14, 13, 12, 6, 11, 10, 9, 5, 4, 2]) == [-1]\n assert candidate(root = tree_node([1, 2, None, 4, 5, None, None, 8, 9]),voyage = [1, 2, 5, 4, 9, 8]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, None, None, 6, None, None, 7]),voyage = [1, 3, 5, 6, 7, 4, 2]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, 6, 7, None, 8, 9]),voyage = [1, 2, 4, 3, 5, 7, 8, 9, 6]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 7, 14, 15, 6, 13, 12, 2, 5, 11, 10, 4, 9, 8]) == [1, 3, 6, 2, 5, 4]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, 12, 13]),voyage = [1, 3, 7, 13, 12, 6, 11, 10, 9, 2, 5, 4, 8]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, 10, None, 11, 12, None, None, 13, 14, 15, None, None, None, None, None, None, None, None, None, 16]),voyage = [1, 2, 4, 8, 13, 14, 15, 9, 16, 5, 10, 6, 11, 12, 3, 7]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, None, None, 7, 8, None, None, 9, 10]),voyage = [1, 2, 4, 7, 8, 5, 3, 6, 9, 10]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7]),voyage = [1, 3, 5, 7, 2, 4, 6]) == [1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 2, 3, 4, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15]) == [-1]\n assert candidate(root = tree_node([1, 2, None, 3, 4, None, None, 5, 6]),voyage = [1, 2, 4, 3, 5, 6]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),voyage = [1, 3, 7, 8, 9, 6, 10, 5, 4, 2]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9, None, None, 10, 11]),voyage = [1, 2, 4, 6, 10, 7, 11, 5, 8, 9, 3]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, None, None, None, None, None, None, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 2, 4, 8, 9, 10, 11, 5, 3, 6, 7, 12, 13, 14, 15]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, 7, None, 8]),voyage = [1, 2, 4, 3, 6, 5, 8, 7]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9]),voyage = [1, 2, 4, 5, 6, 7, 8, 9, 3]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 2, 4, 5, 3, 6, 7, 12, 8, 9, 10, 11, 13, 14, 15]) == [-1]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10]),voyage = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 2, 7, 6, 5, 4, 15, 14, 13, 12, 11, 10, 9, 8]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, 8, 9, 10, None, None, 11, 12, None, None, None, None, 13, 14, 15]),voyage = [1, 3, 6, 13, 14, 15, 11, 12, 8, 9, 10, 7, 2, 4, 5]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, 8, 9, None, None, 10, 11]),voyage = [1, 3, 7, 11, 10, 9, 8, 6, 5, 4, 2]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, None, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 6, 15, 14, 13, 12, 11, 10, 9, 5, 4, 2]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 7, 15, 14, 13, 12, 6, 11, 10, 9, 5, 4, 2, 8]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11]),voyage = [1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 3]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9]),voyage = [1, 2, 4, 6, 7, 5, 8, 9, 3]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 7, 15, 14, 13, 12, 11, 6, 10, 9, 8, 2, 5, 4]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, 6]),voyage = [1, 2, 4, 3, 5, 6]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, None, 6, None, None, 7, 8, 9]),voyage = [1, 3, 5, 9, 8, 7, 2, 4, 6]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, 7, None, None, 8, 9]),voyage = [1, 3, 5, 9, 8, 7, 6, 2, 4]) == [-1]\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5]),voyage = [1, 2, 3, 4, 5]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 2, 4, 8, 9, 5, 10, 11, 3, 6, 12, 13, 7, 14, 15]) == []\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15]),voyage = [1, 3, 5, 7, 15, 14, 13, 12, 6, 11, 10, 9, 4, 2]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),voyage = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, 6, 7]),voyage = [1, 2, 4, 6, 7, 3, 5]) == []\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),voyage = [1, 3, 7, 6, 2, 5, 4, 10, 9, 8]) == [-1]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, None, None, 7, 8, None, None, 9, 10]),voyage = [1, 3, 6, 10, 5, 4, 2, 7, 8, 9]) == [-1]\n"}, "metadata": {"canonical_parameter_names": ["root", "voyage"], "leetcode_dataset_entry_point": "Solution().flipMatchVoyage", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var flipMatchVoyage = function(root, voyage) {", "container": null, "callable": "flipMatchVoyage", "parameters": [{"name": "root", "type": "TreeNode"}, {"name": "voyage", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 972, "task_id": "equal-rational-numbers", "difficulty": "Hard", "problem_description": "Given two strings s and t, each of which represents a non-negative rational number, return true if and only if they represent the same number. The strings may use parentheses to denote the repeating part of the rational number.\nA rational number can be represented using up to three parts: , , and a . The number will be represented in one of the following three ways:\n\n\n\nFor example, 12, 0, and 123.\n\n\n<.>\n\nFor example, 0.5, 1., 2.12, and 123.0001.\n\n\n<.><(><)>\n\nFor example, 0.1(6), 1.(9), 123.00(1212).\n\n\n\nThe repeating portion of a decimal expansion is conventionally denoted within a pair of round brackets. For example:\n\n1/6 = 0.16666666... = 0.1(6) = 0.1666(6) = 0.166(66).\n\n \nExample 1:\n\nInput: s = \"0.(52)\", t = \"0.5(25)\"\nOutput: true\nExplanation: Because \"0.(52)\" represents 0.52525252..., and \"0.5(25)\" represents 0.52525252525..... , the strings represent the same number.\n\nExample 2:\n\nInput: s = \"0.1666(6)\", t = \"0.166(66)\"\nOutput: true\n\nExample 3:\n\nInput: s = \"0.9(9)\", t = \"1.\"\nOutput: true\nExplanation: \"0.9(9)\" represents 0.999999999... repeated forever, which equals 1. [See this link for an explanation.]\n\"1.\" represents the number 1, which is formed correctly: (IntegerPart) = \"1\" and (NonRepeatingPart) = \"\".\n\n \nConstraints:\n\nEach part consists only of digits.\nThe does not have leading zeros (except for the zero itself).\n1 <= .length <= 4\n0 <= .length <= 4\n1 <= .length <= 4\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"0.123\",t = \"0.123\") == True\n assert candidate(s = \"0.(9)\",t = \"1\") == True\n assert candidate(s = \"0.0(0)\",t = \"0\") == True\n assert candidate(s = \"0.9(99)\",t = \"1.0\") == True\n assert candidate(s = \"0.00(1)\",t = \"0.01\") == False\n assert candidate(s = \"0.\",t = \"0.(0)\") == True\n assert candidate(s = \"0.(52)\",t = \"0.5(25)\") == True\n assert candidate(s = \"0.5\",t = \"0.5\") == True\n assert candidate(s = \"1.0(0)\",t = \"1.0\") == True\n assert candidate(s = \"0.1666(6)\",t = \"0.166(66)\") == True\n assert candidate(s = \"123.\",t = \"123\") == True\n assert candidate(s = \"0.(123)\",t = \"0.123123\") == False\n assert candidate(s = \"0.5\",t = \"0.50000\") == True\n assert candidate(s = \"123.456\",t = \"123.456(0)\") == True\n assert candidate(s = \"3.(14)\",t = \"3.141414\") == False\n assert candidate(s = \"0.\",t = \"0.0(0)\") == True\n assert candidate(s = \"0.1(1)\",t = \"0.1111\") == False\n assert candidate(s = \"3.14159\",t = \"3.14159\") == True\n assert candidate(s = \"0.0(1)\",t = \"0.0101\") == False\n assert candidate(s = \"0.9(9)\",t = \"1.\") == True\n assert candidate(s = \"2.5(0)\",t = \"2.5\") == True\n assert candidate(s = \"1.\",t = \"1.0\") == True\n assert candidate(s = \"0.(1)\",t = \"0.1111(1)\") == True\n assert candidate(s = \"123.0001\",t = \"123.0(001)\") == False\n assert candidate(s = \"0.1(9)\",t = \"0.2\") == True\n assert candidate(s = \"0.0(5)\",t = \"0.050505\") == False\n assert candidate(s = \"0.(123)\",t = \"0.123(123)\") == True\n assert candidate(s = \"1(0)\",t = \"1.0\") == True\n assert candidate(s = \"3.(3)\",t = \"3.333333(3)\") == True\n assert candidate(s = \"0.(999)\",t = \"1\") == True\n assert candidate(s = \"0.(0)\",t = \"0.000000000000000000000000000000000000000000000000000000000000000000000\") == True\n assert candidate(s = \"0.(111)\",t = \"0.111111111111111\") == True\n assert candidate(s = \"0.(111)\",t = \"0.111(111)\") == True\n assert candidate(s = \"5.0(00)\",t = \"5.0\") == True\n assert candidate(s = \"0.(12)\",t = \"0.121212121212\") == True\n assert candidate(s = \"0.(1)\",t = \"0.11111111111111111111\") == True\n assert candidate(s = \"999.(9)\",t = \"1000\") == True\n assert candidate(s = \"3.14159(26)\",t = \"3.1415926(26)\") == True\n assert candidate(s = \"0.00001(0)\",t = \"0.00001\") == True\n assert candidate(s = \"0.0(0001)\",t = \"0.0001(0001)\") == False\n assert candidate(s = \"0.0(0)\",t = \"0.0\") == True\n assert candidate(s = \"0.1(234)\",t = \"0.1234234\") == False\n assert candidate(s = \"999999.(9)\",t = \"1000000.\") == True\n assert candidate(s = \"0.(012)\",t = \"0.012012012\") == True\n assert candidate(s = \"0.0(9)\",t = \"0.1\") == True\n assert candidate(s = \"4.5(00)\",t = \"4.5\") == True\n assert candidate(s = \"999.999(9)\",t = \"1000.0\") == True\n assert candidate(s = \"123.123(123)\",t = \"123.123123123\") == True\n assert candidate(s = \"2.345(678)\",t = \"2.345678678\") == True\n assert candidate(s = \"2.5(9)\",t = \"2.6\") == True\n assert candidate(s = \"123456789.999(9)\",t = \"123456790.0\") == True\n assert candidate(s = \"0.(1)\",t = \"0.1111111111111111\") == True\n assert candidate(s = \"0.123456(789)\",t = \"0.123456789789\") == True\n assert candidate(s = \"0.000(999)\",t = \"0.001\") == True\n assert candidate(s = \"123.4567(8901)\",t = \"123.45678901(8901)\") == True\n assert candidate(s = \"0.(001)\",t = \"0.001001\") == False\n assert candidate(s = \"0.1(01)\",t = \"0.101(01)\") == True\n assert candidate(s = \"0.00001(0)\",t = \"0.00001(00)\") == True\n assert candidate(s = \"0.111(1)\",t = \"0.1111(1)\") == True\n assert candidate(s = \"0.0(123)\",t = \"0.0123123123\") == True\n assert candidate(s = \"0.1(2)\",t = \"0.121212\") == False\n assert candidate(s = \"0.123(456)\",t = \"0.123456456456\") == True\n assert candidate(s = \"0.(1234)\",t = \"0.123412341234\") == True\n assert candidate(s = \"0.(01)\",t = \"0.010101\") == False\n assert candidate(s = \"12.(34)\",t = \"12.3434(34)\") == True\n assert candidate(s = \"999.999(9)\",t = \"1000\") == True\n assert candidate(s = \"0.(111)\",t = \"0.1111(111)\") == True\n assert candidate(s = \"1.0(0)\",t = \"1\") == True\n assert candidate(s = \"100.(001)\",t = \"100.001001001\") == True\n assert candidate(s = \"0.(0)\",t = \"0\") == True\n assert candidate(s = \"0.123(456)\",t = \"0.123456456\") == True\n assert candidate(s = \"0.12(345)\",t = \"0.12345(345)\") == True\n assert candidate(s = \"100.(0)\",t = \"100\") == True\n assert candidate(s = \"1000.0001(0)\",t = \"1000.0001\") == True\n assert candidate(s = \"0.000(001)\",t = \"0.000001001001001001001001001001001001001001001001001001001001001\") == True\n assert candidate(s = \"0.1(2345)\",t = \"0.123452345\") == True\n assert candidate(s = \"1.23(456)\",t = \"1.23456456\") == False\n assert candidate(s = \"0.5555(5)\",t = \"0.5556(5)\") == False\n assert candidate(s = \"0.(999)\",t = \"1.0\") == True\n assert candidate(s = \"123456789.000(0001)\",t = \"123456789.0000001000100010001\") == True\n assert candidate(s = \"123.(456)\",t = \"123.456456\") == False\n assert candidate(s = \"0.9(99)\",t = \"1\") == True\n assert candidate(s = \"0.(999)\",t = \"1.000\") == True\n assert candidate(s = \"5.0(5)\",t = \"5.05(5)\") == True\n assert candidate(s = \"1.(0)\",t = \"1\") == True\n assert candidate(s = \"0.1(1)\",t = \"0.1111111111111111\") == True\n assert candidate(s = \"0.(12)\",t = \"0.1212121212121212\") == True\n assert candidate(s = \"0.1234(567)\",t = \"0.1234567567\") == True\n assert candidate(s = \"0.1(0)\",t = \"0.1\") == True\n assert candidate(s = \"0.000(0)\",t = \"0\") == True\n assert candidate(s = \"0.5(0)\",t = \"0.5\") == True\n assert candidate(s = \"0.000(009)\",t = \"0.000009009\") == True\n assert candidate(s = \"0.(5)\",t = \"0.5(5)\") == True\n assert candidate(s = \"0.(3)\",t = \"0.333(3)\") == True\n assert candidate(s = \"0.(1)\",t = \"0.111111111111111111111111111111111111111111111111111111111111111111111\") == True\n assert candidate(s = \"0.0000001(0)\",t = \"0.0000001\") == True\n assert candidate(s = \"0.00(123)\",t = \"0.00123123123\") == True\n assert candidate(s = \"0.0(999)\",t = \"0.1\") == True\n assert candidate(s = \"0.(01)\",t = \"0.01010101\") == True\n assert candidate(s = \"0.1(2345)\",t = \"0.12345(2345)\") == True\n assert candidate(s = \"0.1(3)\",t = \"0.133333333333333333333333333333333333333333333333333333333333333333333\") == True\n assert candidate(s = \"999.(9)\",t = \"1000.0\") == True\n assert candidate(s = \"0.12345678(9)\",t = \"0.12345678989\") == True\n assert candidate(s = \"10.0(000)\",t = \"10.0\") == True\n assert candidate(s = \"123.(0)\",t = \"123\") == True\n assert candidate(s = \"100.0001(0)\",t = \"100.0001\") == True\n assert candidate(s = \"0.9(9)\",t = \"1\") == True\n assert candidate(s = \"0.999(999)\",t = \"1.000\") == True\n assert candidate(s = \"0.0000(1)\",t = \"0.0001\") == False\n assert candidate(s = \"1.000(0)\",t = \"1\") == True\n assert candidate(s = \"0.0(000)\",t = \"0\") == True\n assert candidate(s = \"0.(111)\",t = \"0.11111111\") == False\n assert candidate(s = \"0.0(001)\",t = \"0.0001(001)\") == True\n assert candidate(s = \"0.00(1)\",t = \"0.001(0)\") == False\n assert candidate(s = \"42.(0)\",t = \"42.0\") == True\n assert candidate(s = \"0.000(9)\",t = \"0.001\") == True\n assert candidate(s = \"0.0000(0001)\",t = \"0.000000010001\") == True\n assert candidate(s = \"0.1(6)\",t = \"0.166666666666\") == True\n assert candidate(s = \"3.0000(0)\",t = \"3.0\") == True\n assert candidate(s = \"0.000(001)\",t = \"0.000001(001)\") == True\n assert candidate(s = \"1.9(9)\",t = \"2.0\") == True\n assert candidate(s = \"123.456(789)\",t = \"123.456789789789\") == True\n assert candidate(s = \"0.12(34)\",t = \"0.12343434\") == False\n assert candidate(s = \"0.5(00)\",t = \"0.5\") == True\n assert candidate(s = \"0.999(9)\",t = \"1.0\") == True\n assert candidate(s = \"0.999(9)\",t = \"0.999999(999)\") == True\n assert candidate(s = \"0.999(9)\",t = \"1\") == True\n assert candidate(s = \"1.0(0)\",t = \"1.00(0)\") == True\n assert candidate(s = \"123.456(789)\",t = \"123.456789789\") == True\n assert candidate(s = \"1.234(567)\",t = \"1.234567(567)\") == True\n assert candidate(s = \"0.(010)\",t = \"0.0101010\") == False\n assert candidate(s = \"0.1234(5678)\",t = \"0.12345678(5678)\") == True\n assert candidate(s = \"0.000(1)\",t = \"0.0001(0)\") == False\n assert candidate(s = \"0.0001(0001)\",t = \"0.000100010001\") == True\n assert candidate(s = \"123.456(7890)\",t = \"123.45678907890\") == True\n assert candidate(s = \"0.(01)\",t = \"0.0101010101\") == True\n assert candidate(s = \"0.999999(9)\",t = \"1.0\") == True\n assert candidate(s = \"0.(001)\",t = \"0.001(001)\") == True\n assert candidate(s = \"0.(12)\",t = \"0.121212\") == False\n assert candidate(s = \"0.0(99)\",t = \"0.1\") == True\n assert candidate(s = \"12.(34)\",t = \"12.34(34)\") == True\n assert candidate(s = \"0.00(9)\",t = \"0.01\") == True\n assert candidate(s = \"0.9(999)\",t = \"1\") == True\n assert candidate(s = \"0.1(234)\",t = \"0.1234(234)\") == True\n assert candidate(s = \"5.000(0)\",t = \"5.0\") == True\n assert candidate(s = \"100.0000(9)\",t = \"100.0001\") == True\n assert candidate(s = \"1234.5678(9)\",t = \"1234.5679(0)\") == True\n assert candidate(s = \"0.5(5)\",t = \"0.55(55)\") == True\n assert candidate(s = \"1.234(5678)\",t = \"1.23456785678\") == True\n assert candidate(s = \"123.456(789)\",t = \"123.456789(789)\") == True\n assert candidate(s = \"0.(0)\",t = \"0.0\") == True\n assert candidate(s = \"0.00(000)\",t = \"0.0\") == True\n assert candidate(s = \"0.123(456)\",t = \"0.123456(456)\") == True\n assert candidate(s = \"0.001(002)\",t = \"0.001002(002)\") == True\n assert candidate(s = \"2.4(9)\",t = \"2.5\") == True\n"}, "metadata": {"canonical_parameter_names": ["s", "t"], "leetcode_dataset_entry_point": "Solution().isRationalEqual", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isRationalEqual = function(s, t) {", "container": null, "callable": "isRationalEqual", "parameters": [{"name": "s", "type": "string"}, {"name": "t", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 973, "task_id": "k-closest-points-to-origin", "difficulty": "Medium", "problem_description": "Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k, return the k closest points to the origin (0, 0).\nThe distance between two points on the X-Y plane is the Euclidean distance (i.e., √(x1 - x2)2 + (y1 - y2)2).\nYou may return the answer in any order. The answer is guaranteed to be unique (except for the order that it is in).\n \nExample 1:\n\n\nInput: points = [[1,3],[-2,2]], k = 1\nOutput: [[-2,2]]\nExplanation:\nThe distance between (1, 3) and the origin is sqrt(10).\nThe distance between (-2, 2) and the origin is sqrt(8).\nSince sqrt(8) < sqrt(10), (-2, 2) is closer to the origin.\nWe only want the closest k = 1 points from the origin, so the answer is just [[-2,2]].\n\nExample 2:\n\nInput: points = [[3,3],[5,-1],[-2,4]], k = 2\nOutput: [[3,3],[-2,4]]\nExplanation: The answer [[-2,4],[3,3]] would also be accepted.\n\n \nConstraints:\n\n1 <= k <= points.length <= 104\n-104 <= xi, yi <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]],k = 3) == [[0, 0], [1, 1], [2, 2]]\n assert candidate(points = [[3, 3], [5, -1], [-2, 4]],k = 2) == [[3, 3], [-2, 4]]\n assert candidate(points = [[-3, -3], [-2, -2], [-1, -1], [0, 0], [1, 1], [2, 2], [3, 3]],k = 4) == [[0, 0], [-1, -1], [1, 1], [-2, -2]]\n assert candidate(points = [[10000, -10000], [-10000, 10000], [0, 0]],k = 2) == [[0, 0], [10000, -10000]]\n assert candidate(points = [[1, 3], [-2, 2]],k = 1) == [[-2, 2]]\n assert candidate(points = [[1, 3], [2, 4], [3, 1]],k = 2) == [[1, 3], [3, 1]]\n assert candidate(points = [[-1, 0], [2, 0], [-1, 0], [2, 0]],k = 3) == [[-1, 0], [-1, 0], [2, 0]]\n assert candidate(points = [[-10000, -10000], [10000, 10000]],k = 1) == [[-10000, -10000]]\n assert candidate(points = [[-1, 0], [2, 0], [-1, 0], [2, 0]],k = 2) == [[-1, 0], [-1, 0]]\n assert candidate(points = [[0, 1], [1, 0]],k = 2) == [[0, 1], [1, 0]]\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]],k = 5) == [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]\n assert candidate(points = [[6, 10], [-3, 3], [-2, 5], [0, 2]],k = 3) == [[0, 2], [-3, 3], [-2, 5]]\n assert candidate(points = [[-10000, 10000], [10000, -10000]],k = 1) == [[-10000, 10000]]\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]],k = 5) == [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3]],k = 3) == [[0, 0], [1, 1], [2, 2]]\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3]],k = 2) == [[0, 0], [1, 1]]\n assert candidate(points = [[-5, 4], [4, -5], [0, 0], [1, 1], [-1, -1], [5, -5], [-5, 5], [2, 2], [-2, -2]],k = 5) == [[0, 0], [1, 1], [-1, -1], [2, 2], [-2, -2]]\n assert candidate(points = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0]],k = 7) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0]]\n assert candidate(points = [[10000, 0], [0, 10000], [-10000, 0], [0, -10000], [2500, 2500], [2500, -2500], [-2500, 2500], [-2500, -2500], [0, 0]],k = 6) == [[0, 0], [2500, 2500], [2500, -2500], [-2500, 2500], [-2500, -2500], [10000, 0]]\n assert candidate(points = [[100, 100], [200, 200], [300, 300], [400, 400], [500, 500], [600, 600], [700, 700]],k = 5) == [[100, 100], [200, 200], [300, 300], [400, 400], [500, 500]]\n assert candidate(points = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0], [-1, 0], [-2, 0], [-3, 0], [-4, 0], [-5, 0], [-6, 0], [-7, 0], [-8, 0], [-9, 0], [-10, 0]],k = 10) == [[1, 0], [-1, 0], [2, 0], [-2, 0], [3, 0], [-3, 0], [4, 0], [-4, 0], [5, 0], [-5, 0]]\n assert candidate(points = [[-1, 0], [0, -1], [1, 0], [0, 1], [-2, 0], [0, -2], [2, 0], [0, 2], [-3, 0], [0, -3], [3, 0], [0, 3], [-4, 0], [0, -4], [4, 0], [0, 4]],k = 8) == [[-1, 0], [0, -1], [1, 0], [0, 1], [-2, 0], [0, -2], [2, 0], [0, 2]]\n assert candidate(points = [[100, 100], [-100, -100], [200, 200], [-200, -200], [300, 300], [-300, -300], [0, 0]],k = 4) == [[0, 0], [100, 100], [-100, -100], [200, 200]]\n assert candidate(points = [[-10, 10], [-20, 20], [-30, 30], [-40, 40], [-50, 50], [-60, 60], [-70, 70], [-80, 80], [-90, 90], [-100, 100]],k = 3) == [[-10, 10], [-20, 20], [-30, 30]]\n assert candidate(points = [[-1, 0], [0, -1], [1, 0], [0, 1], [0, 0]],k = 3) == [[0, 0], [-1, 0], [0, -1]]\n assert candidate(points = [[100, -100], [-100, 100], [200, 200], [-200, -200], [300, -300], [-300, 300], [400, 400], [-400, -400], [500, -500]],k = 3) == [[100, -100], [-100, 100], [200, 200]]\n assert candidate(points = [[100, 100], [200, 200], [300, 300], [400, 400], [500, 500], [600, 600], [700, 700], [800, 800], [900, 900], [1000, 1000]],k = 4) == [[100, 100], [200, 200], [300, 300], [400, 400]]\n assert candidate(points = [[0, 0], [1, 1], [1, -1], [-1, -1], [-1, 1], [2, 2], [-2, -2]],k = 5) == [[0, 0], [1, 1], [1, -1], [-1, -1], [-1, 1]]\n assert candidate(points = [[-5, -5], [5, 5], [-6, -6], [6, 6], [-7, -7], [7, 7], [-8, -8], [8, 8], [-9, -9], [9, 9], [-10, -10], [10, 10]],k = 6) == [[-5, -5], [5, 5], [-6, -6], [6, 6], [-7, -7], [7, 7]]\n assert candidate(points = [[10, 0], [20, 0], [30, 0], [40, 0], [50, 0], [60, 0], [70, 0], [80, 0], [90, 0], [100, 0]],k = 7) == [[10, 0], [20, 0], [30, 0], [40, 0], [50, 0], [60, 0], [70, 0]]\n assert candidate(points = [[-1, -1], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]],k = 5) == [[0, 0], [-1, -1], [1, 1], [2, 2], [3, 3]]\n assert candidate(points = [[-9999, -9999], [9999, 9999], [5000, 5000], [-5000, -5000], [1000, -1000], [-1000, 1000], [2000, -2000], [-2000, 2000]],k = 4) == [[1000, -1000], [-1000, 1000], [2000, -2000], [-2000, 2000]]\n assert candidate(points = [[1, -1], [2, -2], [3, -3], [4, -4], [5, -5], [6, -6], [7, -7], [8, -8], [9, -9], [10, -10]],k = 5) == [[1, -1], [2, -2], [3, -3], [4, -4], [5, -5]]\n assert candidate(points = [[-8000, 8000], [8000, -8000], [-7000, 7000], [7000, -7000], [-6000, 6000], [6000, -6000], [-5000, 5000], [5000, -5000], [-4000, 4000], [4000, -4000]],k = 3) == [[-4000, 4000], [4000, -4000], [-5000, 5000]]\n assert candidate(points = [[0, 0], [1, 0], [0, 1], [-1, 0], [0, -1], [1, 1], [-1, -1], [-1, 1], [1, -1]],k = 6) == [[0, 0], [1, 0], [0, 1], [-1, 0], [0, -1], [1, 1]]\n assert candidate(points = [[100, -100], [-100, 100], [200, -200], [-200, 200], [300, -300]],k = 3) == [[100, -100], [-100, 100], [200, -200]]\n assert candidate(points = [[-1000, 0], [0, -1000], [1000, 0], [0, 1000], [500, 500], [-500, -500]],k = 3) == [[500, 500], [-500, -500], [-1000, 0]]\n assert candidate(points = [[0, 0], [1, 0], [0, 1], [1, 1], [-1, -1], [-1, 0], [0, -1]],k = 5) == [[0, 0], [1, 0], [0, 1], [-1, 0], [0, -1]]\n assert candidate(points = [[1, 1], [1, -1], [-1, 1], [-1, -1], [2, 2], [2, -2], [-2, 2], [-2, -2], [3, 3], [3, -3], [-3, 3], [-3, -3]],k = 6) == [[1, 1], [1, -1], [-1, 1], [-1, -1], [2, 2], [2, -2]]\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11]],k = 5) == [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6]]\n assert candidate(points = [[-500, 500], [500, -500], [-100, 100], [100, -100], [0, 0], [200, -200]],k = 4) == [[0, 0], [-100, 100], [100, -100], [200, -200]]\n assert candidate(points = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0]],k = 8) == [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0]]\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]],k = 4) == [[1, 2], [3, 4], [5, 6], [7, 8]]\n assert candidate(points = [[100, 100], [200, 200], [300, 300], [400, 400], [500, 500]],k = 1) == [[100, 100]]\n assert candidate(points = [[-999, -999], [999, 999], [0, 0], [499, 499], [-499, -499], [500, 500], [-500, -500]],k = 5) == [[0, 0], [499, 499], [-499, -499], [500, 500], [-500, -500]]\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]],k = 5) == [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]\n assert candidate(points = [[-5000, 5000], [-4000, 4000], [-3000, 3000], [-2000, 2000], [-1000, 1000]],k = 3) == [[-1000, 1000], [-2000, 2000], [-3000, 3000]]\n assert candidate(points = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70], [80, 80], [90, 90], [100, 100]],k = 8) == [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70], [80, 80]]\n assert candidate(points = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70], [80, 80], [90, 90], [100, 100]],k = 3) == [[10, 10], [20, 20], [30, 30]]\n assert candidate(points = [[10, 10], [-10, -10], [5, 5], [-5, -5], [0, 0], [2, 2], [-2, -2], [3, 3], [-3, -3], [4, 4], [-4, -4]],k = 7) == [[0, 0], [2, 2], [-2, -2], [3, 3], [-3, -3], [4, 4], [-4, -4]]\n assert candidate(points = [[-100, -100], [100, 100], [-200, -200], [200, 200], [-300, -300], [300, 300], [-400, -400], [400, 400], [-500, -500], [500, 500]],k = 7) == [[-100, -100], [100, 100], [-200, -200], [200, 200], [-300, -300], [300, 300], [-400, -400]]\n assert candidate(points = [[10, 0], [-10, 0], [0, 10], [0, -10], [5, 5], [-5, -5]],k = 2) == [[5, 5], [-5, -5]]\n assert candidate(points = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5], [-6, -6], [-7, -7], [-8, -8], [-9, -9], [-10, -10]],k = 7) == [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5], [-6, -6], [-7, -7]]\n assert candidate(points = [[9999, 9999], [-9999, -9999], [0, 0], [5000, 5000], [-5000, -5000], [1, -1], [-1, 1]],k = 3) == [[0, 0], [1, -1], [-1, 1]]\n assert candidate(points = [[-5000, -5000], [-4000, -4000], [-3000, -3000], [-2000, -2000], [-1000, -1000], [0, 0], [1000, 1000], [2000, 2000], [3000, 3000], [4000, 4000], [5000, 5000], [10000, -10000], [-10000, 10000]],k = 6) == [[0, 0], [-1000, -1000], [1000, 1000], [-2000, -2000], [2000, 2000], [-3000, -3000]]\n assert candidate(points = [[-1, 1], [1, -1], [-2, 2], [2, -2], [-3, 3], [3, -3]],k = 3) == [[-1, 1], [1, -1], [-2, 2]]\n assert candidate(points = [[-5000, 5000], [5000, -5000], [0, 0], [-3000, -3000], [3000, 3000]],k = 3) == [[0, 0], [-3000, -3000], [3000, 3000]]\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]],k = 5) == [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]\n assert candidate(points = [[-1, -2], [-2, -3], [-3, -4], [-4, -5], [-5, -6], [-6, -7], [-7, -8], [-8, -9], [-9, -10], [-10, -11], [-11, -12], [-12, -13], [-13, -14]],k = 8) == [[-1, -2], [-2, -3], [-3, -4], [-4, -5], [-5, -6], [-6, -7], [-7, -8], [-8, -9]]\n assert candidate(points = [[1, 1], [-1, -1], [0, 0], [2, 2], [-2, -2], [3, 3], [-3, -3]],k = 4) == [[0, 0], [1, 1], [-1, -1], [2, 2]]\n assert candidate(points = [[100, 100], [200, 200], [300, 300], [400, 400], [500, 500], [-100, -100], [-200, -200], [-300, -300], [-400, -400], [-500, -500]],k = 6) == [[100, 100], [-100, -100], [200, 200], [-200, -200], [300, 300], [-300, -300]]\n assert candidate(points = [[-1000, 1000], [1000, -1000], [0, 0], [500, 500], [-500, -500], [250, 250], [-250, -250]],k = 4) == [[0, 0], [250, 250], [-250, -250], [500, 500]]\n assert candidate(points = [[-5000, 5000], [5000, -5000], [10000, 0], [0, 10000], [-10000, 0], [0, -10000]],k = 3) == [[-5000, 5000], [5000, -5000], [10000, 0]]\n assert candidate(points = [[-1000, 0], [1000, 0], [0, -1000], [0, 1000], [-500, -500], [500, 500], [-500, 500], [500, -500], [250, 250], [750, 750]],k = 6) == [[250, 250], [-500, -500], [500, 500], [-500, 500], [500, -500], [-1000, 0]]\n assert candidate(points = [[100, 100], [-100, -100], [0, 0], [200, 200], [-200, -200], [50, 50], [-50, -50], [75, 75], [-75, -75]],k = 6) == [[0, 0], [50, 50], [-50, -50], [75, 75], [-75, -75], [100, 100]]\n assert candidate(points = [[-9999, 10000], [10000, -9999], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]],k = 5) == [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]\n assert candidate(points = [[1, -1], [-1, 1], [1, 1], [-1, -1], [0, 0], [2, 2], [-2, -2], [2, -2], [-2, 2]],k = 4) == [[0, 0], [1, -1], [-1, 1], [1, 1]]\n assert candidate(points = [[-1, 1], [-2, 2], [-3, 3], [-4, 4], [-5, 5], [-6, 6], [-7, 7], [-8, 8], [-9, 9], [-10, 10]],k = 5) == [[-1, 1], [-2, 2], [-3, 3], [-4, 4], [-5, 5]]\n assert candidate(points = [[10000, 10000], [-10000, -10000], [5000, 5000], [-5000, -5000], [0, 0]],k = 3) == [[0, 0], [5000, 5000], [-5000, -5000]]\n assert candidate(points = [[0, 0], [0, 1], [1, 0], [1, 1], [-1, -1], [-1, 0], [0, -1], [1, -1], [-1, 1], [0, 2], [2, 0]],k = 5) == [[0, 0], [0, 1], [1, 0], [-1, 0], [0, -1]]\n assert candidate(points = [[-5000, -5000], [5000, 5000], [0, 0], [100, 100], [-100, -100]],k = 4) == [[0, 0], [100, 100], [-100, -100], [-5000, -5000]]\n assert candidate(points = [[-1, -1], [-1, 1], [1, -1], [1, 1], [0, 0], [0, 1], [1, 0], [0, -1], [-2, 2], [2, -2]],k = 5) == [[0, 0], [0, 1], [1, 0], [0, -1], [-1, -1]]\n assert candidate(points = [[-1, -1], [0, 0], [1, 1], [-2, -2], [0, 1], [1, 0], [-3, -3], [0, 2], [2, 0], [-4, -4]],k = 5) == [[0, 0], [0, 1], [1, 0], [-1, -1], [1, 1]]\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]],k = 5) == [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]\n assert candidate(points = [[500, 500], [-500, -500], [500, -500], [-500, 500], [0, 0], [1000, 0], [0, 1000], [-1000, 0], [0, -1000]],k = 5) == [[0, 0], [500, 500], [-500, -500], [500, -500], [-500, 500]]\n assert candidate(points = [[-5000, -5000], [-7000, 7000], [8000, -8000], [6000, 6000]],k = 2) == [[-5000, -5000], [6000, 6000]]\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]],k = 3) == [[1, 2], [3, 4], [5, 6]]\n assert candidate(points = [[100, 200], [200, 300], [300, 400], [400, 500], [500, 600], [600, 700], [700, 800], [800, 900]],k = 6) == [[100, 200], [200, 300], [300, 400], [400, 500], [500, 600], [600, 700]]\n assert candidate(points = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5], [-6, -6], [-7, -7], [-8, -8], [-9, -9], [-10, -10]],k = 4) == [[-1, -1], [-2, -2], [-3, -3], [-4, -4]]\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]],k = 5) == [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]\n assert candidate(points = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5], [-6, -6], [-7, -7], [-8, -8], [-9, -9], [-10, -10]],k = 7) == [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5], [-6, -6], [-7, -7]]\n assert candidate(points = [[-9000, 0], [0, -9000], [9000, 0], [0, 9000], [-4500, 4500], [4500, -4500], [-4500, -4500], [4500, 4500]],k = 4) == [[-4500, 4500], [4500, -4500], [-4500, -4500], [4500, 4500]]\n assert candidate(points = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70], [80, 80], [90, 90], [100, 100], [0, 0], [-10, -10], [-20, -20], [-30, -30], [-40, -40], [-50, -50]],k = 7) == [[0, 0], [10, 10], [-10, -10], [20, 20], [-20, -20], [30, 30], [-30, -30]]\n assert candidate(points = [[-9999, 9999], [9999, -9999], [1000, 1000], [-1000, -1000]],k = 2) == [[1000, 1000], [-1000, -1000]]\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14]],k = 7) == [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8]]\n assert candidate(points = [[0, 10000], [-10000, 0], [10000, 0], [0, -10000], [2500, 2500], [-2500, -2500], [5000, -5000], [-5000, 5000], [7500, 7500]],k = 5) == [[2500, 2500], [-2500, -2500], [5000, -5000], [-5000, 5000], [0, 10000]]\n assert candidate(points = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10]],k = 6) == [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6]]\n assert candidate(points = [[-10, -10], [-9, -9], [-8, -8], [-7, -7], [-6, -6], [-5, -5]],k = 3) == [[-5, -5], [-6, -6], [-7, -7]]\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5], [-6, -6], [-7, -7], [-8, -8], [-9, -9], [-10, -10]],k = 15) == [[1, 1], [-1, -1], [2, 2], [-2, -2], [3, 3], [-3, -3], [4, 4], [-4, -4], [5, 5], [-5, -5], [6, 6], [-6, -6], [7, 7], [-7, -7], [8, 8]]\n assert candidate(points = [[-1000, 1000], [1000, -1000], [500, 500], [-500, -500], [750, -750], [-750, 750]],k = 4) == [[500, 500], [-500, -500], [750, -750], [-750, 750]]\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],k = 4) == [[1, 2], [2, 3], [3, 4], [4, 5]]\n assert candidate(points = [[-8, 6], [5, 0], [3, 1], [-9, 4], [2, -8], [-5, -3], [7, -7], [1, 9], [-4, -10]],k = 4) == [[3, 1], [5, 0], [-5, -3], [2, -8]]\n assert candidate(points = [[0, 0], [1, 2], [2, 4], [3, 6], [4, 8], [5, 10], [6, 12], [7, 14], [8, 16], [9, 18], [10, 20]],k = 4) == [[0, 0], [1, 2], [2, 4], [3, 6]]\n assert candidate(points = [[1000, 1000], [2000, 2000], [3000, 3000], [4000, 4000], [5000, 5000], [6000, 6000], [7000, 7000], [8000, 8000], [9000, 9000], [10000, 10000]],k = 5) == [[1000, 1000], [2000, 2000], [3000, 3000], [4000, 4000], [5000, 5000]]\n assert candidate(points = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]],k = 6) == [[0, 0], [-1, -1], [1, 1], [-2, -2], [2, 2], [-3, -3]]\n assert candidate(points = [[-5, -12], [-10, -24], [-15, -36], [-20, -48], [-25, -60], [-30, -72], [-35, -84], [-40, -96], [-45, -108], [-50, -120]],k = 6) == [[-5, -12], [-10, -24], [-15, -36], [-20, -48], [-25, -60], [-30, -72]]\n assert candidate(points = [[-3, 0], [2, 6], [0, 5], [-4, -4], [8, 3]],k = 3) == [[-3, 0], [0, 5], [-4, -4]]\n assert candidate(points = [[-1, -1], [1, 1], [-2, -2], [2, 2], [-3, -3], [3, 3], [-4, -4], [4, 4], [-5, -5]],k = 4) == [[-1, -1], [1, 1], [-2, -2], [2, 2]]\n"}, "metadata": {"canonical_parameter_names": ["points", "k"], "leetcode_dataset_entry_point": "Solution().kClosest", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var kClosest = function(points, k) {", "container": null, "callable": "kClosest", "parameters": [{"name": "points", "type": "number[][]"}, {"name": "k", "type": "number"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 974, "task_id": "subarray-sums-divisible-by-k", "difficulty": "Medium", "problem_description": "Given an integer array nums and an integer k, return the number of non-empty subarrays that have a sum divisible by k.\nA subarray is a contiguous part of an array.\n \nExample 1:\n\nInput: nums = [4,5,0,-2,-3,1], k = 5\nOutput: 7\nExplanation: There are 7 subarrays with a sum divisible by k = 5:\n[4, 5, 0, -2, -3, 1], [5], [5, 0], [5, 0, -2, -3], [0], [0, -2, -3], [-2, -3]\n\nExample 2:\n\nInput: nums = [5], k = 9\nOutput: 0\n\n \nConstraints:\n\n1 <= nums.length <= 3 * 104\n-104 <= nums[i] <= 104\n2 <= k <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [2, 2, 2, 2, 2],k = 6) == 3\n assert candidate(nums = [0, 0, 0, 0],k = 2) == 10\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 25\n assert candidate(nums = [-1, 2, -3, 4, -5],k = 2) == 6\n assert candidate(nums = [4, 5, 0, -2, -3, 1],k = 5) == 7\n assert candidate(nums = [2, 2, 2, 2, 2],k = 2) == 15\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10],k = 3) == 27\n assert candidate(nums = [0, 0, 0, 0, 0],k = 1) == 15\n assert candidate(nums = [1, 2, 3, 4, 5],k = 3) == 7\n assert candidate(nums = [0, 0, 0, 0, 0],k = 2) == 15\n assert candidate(nums = [-1, -2, -3, 4, 5, 6],k = 2) == 9\n assert candidate(nums = [7, 7, 7, 7, 7, 7],k = 7) == 21\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 17\n assert candidate(nums = [-1, 2, -3, 4, -5, 6],k = 4) == 3\n assert candidate(nums = [-1, -2, -3, 3, 1, 2, 3, -4],k = 3) == 16\n assert candidate(nums = [1, -1, 2, -2, 3, -3],k = 2) == 11\n assert candidate(nums = [0, 0, 0, 0],k = 1) == 10\n assert candidate(nums = [1, 1, 1, 1, 1],k = 5) == 1\n assert candidate(nums = [5],k = 9) == 0\n assert candidate(nums = [10, 5, 0, 3, -2],k = 7) == 1\n assert candidate(nums = [10, 20, 30, 40, 50],k = 10) == 15\n assert candidate(nums = [-1, -2, -3, 4, 5, 6],k = 4) == 3\n assert candidate(nums = [-10, -5, 0, 5, 10],k = 5) == 15\n assert candidate(nums = [-1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1],k = 4) == 100\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 19) == 13\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3) == 27\n assert candidate(nums = [104, -104, 208, -208, 312, -312, 416, -416, 520, -520],k = 104) == 55\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5],k = 3) == 34\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5],k = 6) == 14\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 7) == 55\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 250) == 17\n assert candidate(nums = [-10, 10, -10, 10, -10, 10, -10, 10],k = 5) == 36\n assert candidate(nums = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14, -15],k = 11) == 5\n assert candidate(nums = [100, -100, 200, -200, 300, -300, 400, -400, 500, -500],k = 100) == 55\n assert candidate(nums = [7, 3, 5, 1, 2, 4, 6],k = 7) == 4\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 25\n assert candidate(nums = [9999, -9999, 9999, -9999, 9999, -9999],k = 10000) == 9\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 10) == 55\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 10) == 55\n assert candidate(nums = [10, 20, 30, 40, 50],k = 10) == 15\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 100) == 55\n assert candidate(nums = [1, 0, 2, 1, -1, -1, -1, 0, 1, 2],k = 4) == 11\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 3) == 64\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 3) == 35\n assert candidate(nums = [3, 1, 2, 5, 3, 2, 3, 1, 2, 3],k = 5) == 9\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21],k = 3) == 28\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7],k = 11) == 0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 34\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 5) == 210\n assert candidate(nums = [9, -1, -2, 3, 5, -7, 10, -12, 15, -18, 21, -24, 27, -30, 33, -36, 39, -42, 45, -48],k = 15) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 7) == 10\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5],k = 4) == 14\n assert candidate(nums = [-5, 0, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0, -5, 0],k = 10) == 225\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500],k = 100) == 120\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5],k = 5) == 21\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 2) == 120\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991],k = 1000) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 13) == 12\n assert candidate(nums = [10, 20, 30, 40, 50],k = 15) == 7\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],k = 1000) == 55\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 4) == 45\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 13) == 22\n assert candidate(nums = [-10, -20, -30, -40, -50],k = 15) == 7\n assert candidate(nums = [-10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000],k = 10000) == 55\n assert candidate(nums = [15, -15, 30, -30, 45, -45, 60, -60, 75, -75, 90, -90],k = 15) == 78\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 7) == 27\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 3) == 63\n assert candidate(nums = [9999, -9999, 9999, -9999, 9999, -9999, 9999, -9999],k = 9999) == 36\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],k = 2) == 106\n assert candidate(nums = [10, -10, 10, -10, 10, -10, 10, -10, 10],k = 5) == 45\n assert candidate(nums = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],k = 5000) == 7\n assert candidate(nums = [2, 3, -5, 6, 1, -7, 8, 9, 10, -11, 12],k = 7) == 12\n assert candidate(nums = [-3, -1, -2, 2, 1, 3],k = 5) == 3\n assert candidate(nums = [-1, 1, -2, 2, -3, 3, -4, 4],k = 4) == 15\n assert candidate(nums = [1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000],k = 2000) == 25\n assert candidate(nums = [10, -10, 20, -20, 30, -30, 40],k = 10) == 28\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000],k = 10000) == 55\n assert candidate(nums = [-1, 0, 1, -2, 2, -3, 3, -4, 4, -5, 5, -6, 6, -7, 7, -8, 8, -9, 9, -10, 10],k = 6) == 72\n assert candidate(nums = [-10, 10, -10, 10, -10, 10, -10, 10],k = 10) == 36\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 4) == 10\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0],k = 4) == 28\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],k = 5) == 120\n assert candidate(nums = [1000, 2000, 3000, -1000, -2000, -3000],k = 1000) == 21\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],k = 7) == 27\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 7) == 48\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 11) == 5\n assert candidate(nums = [1000, -1000, 2000, -2000, 3000, -3000, 4000, -4000],k = 1000) == 36\n assert candidate(nums = [104, -104, 104, -104, 104, -104, 104, -104, 104, -104],k = 104) == 55\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 7) == 10\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 3) == 55\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 2) == 25\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 225\n assert candidate(nums = [-10, -20, -30, 0, 5, 10, 15, 20],k = 5) == 36\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 7) == 210\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 5) == 55\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30],k = 3) == 55\n assert candidate(nums = [2, -2, 2, -2, 2, -2, 2, -2],k = 4) == 16\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 2) == 25\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 5) == 55\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3) == 27\n assert candidate(nums = [2, 3, 5, 8, 13, 21, 34, 55, 89, 144],k = 7) == 7\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],k = 11) == 28\n assert candidate(nums = [10000, -10000, 10000, -10000, 10000],k = 10000) == 15\n assert candidate(nums = [1, 2, 3, -6, 1, 2, 3, 4, 5],k = 7) == 8\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 15) == 27\n assert candidate(nums = [-5, 5, -5, 5, -5, 5, -5, 5, -5, 5],k = 5) == 55\n assert candidate(nums = [2, -2, 2, -4, 6, 5, -1, 3, -3, 4],k = 5) == 8\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().subarraysDivByK", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var subarraysDivByK = function(nums, k) {", "container": null, "callable": "subarraysDivByK", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 975, "task_id": "odd-even-jump", "difficulty": "Hard", "problem_description": "You are given an integer array arr. From some starting index, you can make a series of jumps. The (1st, 3rd, 5th, ...) jumps in the series are called odd-numbered jumps, and the (2nd, 4th, 6th, ...) jumps in the series are called even-numbered jumps. Note that the jumps are numbered, not the indices.\nYou may jump forward from index i to index j (with i < j) in the following way:\n\nDuring odd-numbered jumps (i.e., jumps 1, 3, 5, ...), you jump to the index j such that arr[i] <= arr[j] and arr[j] is the smallest possible value. If there are multiple such indices j, you can only jump to the smallest such index j.\nDuring even-numbered jumps (i.e., jumps 2, 4, 6, ...), you jump to the index j such that arr[i] >= arr[j] and arr[j] is the largest possible value. If there are multiple such indices j, you can only jump to the smallest such index j.\nIt may be the case that for some index i, there are no legal jumps.\n\nA starting index is good if, starting from that index, you can reach the end of the array (index arr.length - 1) by jumping some number of times (possibly 0 or more than once).\nReturn the number of good starting indices.\n \nExample 1:\n\nInput: arr = [10,13,12,14,15]\nOutput: 2\nExplanation: \nFrom starting index i = 0, we can make our 1st jump to i = 2 (since arr[2] is the smallest among arr[1], arr[2], arr[3], arr[4] that is greater or equal to arr[0]), then we cannot jump any more.\nFrom starting index i = 1 and i = 2, we can make our 1st jump to i = 3, then we cannot jump any more.\nFrom starting index i = 3, we can make our 1st jump to i = 4, so we have reached the end.\nFrom starting index i = 4, we have reached the end already.\nIn total, there are 2 different starting indices i = 3 and i = 4, where we can reach the end with some number of\njumps.\n\nExample 2:\n\nInput: arr = [2,3,1,1,4]\nOutput: 3\nExplanation: \nFrom starting index i = 0, we make jumps to i = 1, i = 2, i = 3:\nDuring our 1st jump (odd-numbered), we first jump to i = 1 because arr[1] is the smallest value in [arr[1], arr[2], arr[3], arr[4]] that is greater than or equal to arr[0].\nDuring our 2nd jump (even-numbered), we jump from i = 1 to i = 2 because arr[2] is the largest value in [arr[2], arr[3], arr[4]] that is less than or equal to arr[1]. arr[3] is also the largest value, but 2 is a smaller index, so we can only jump to i = 2 and not i = 3\nDuring our 3rd jump (odd-numbered), we jump from i = 2 to i = 3 because arr[3] is the smallest value in [arr[3], arr[4]] that is greater than or equal to arr[2].\nWe can't jump from i = 3 to i = 4, so the starting index i = 0 is not good.\nIn a similar manner, we can deduce that:\nFrom starting index i = 1, we jump to i = 4, so we reach the end.\nFrom starting index i = 2, we jump to i = 3, and then we can't jump anymore.\nFrom starting index i = 3, we jump to i = 4, so we reach the end.\nFrom starting index i = 4, we are already at the end.\nIn total, there are 3 different starting indices i = 1, i = 3, and i = 4, where we can reach the end with some\nnumber of jumps.\n\nExample 3:\n\nInput: arr = [5,1,3,4,2]\nOutput: 3\nExplanation: We can reach the end from starting indices 1, 2, and 4.\n\n \nConstraints:\n\n1 <= arr.length <= 2 * 104\n0 <= arr[i] < 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [11, 9, 7, 5, 3, 1]) == 1\n assert candidate(arr = [5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [7, 10, 5, 8, 4, 2, 6, 3, 9, 1]) == 8\n assert candidate(arr = [0, 10, 8, 9, 3, 5, 7, 6, 2, 4, 1, 11]) == 11\n assert candidate(arr = [1, 2]) == 2\n assert candidate(arr = [5, 1, 3, 4, 2]) == 3\n assert candidate(arr = [0]) == 1\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 4, 6]) == 3\n assert candidate(arr = [1, 3, 5, 7, 9, 11]) == 2\n assert candidate(arr = [8, 6, 5, 4, 10, 7, 9, 3, 2, 1]) == 1\n assert candidate(arr = [1]) == 1\n assert candidate(arr = [10, 13, 12, 14, 15]) == 2\n assert candidate(arr = [2, 1]) == 1\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [1, 1, 1, 1, 1]) == 5\n assert candidate(arr = [1, 2, 3, 4, 5]) == 2\n assert candidate(arr = [1, 2, 3, 2, 1]) == 3\n assert candidate(arr = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91]) == 1\n assert candidate(arr = [0, 10, 5, 3, 8, 0, 9, 0, 6, 3, 8, 0, 6, 6, 0, 8, 8, 8, 3, 3]) == 13\n assert candidate(arr = [0, 10, 8, 12, 4, 7, 9, 6, 1, 5, 11, 3]) == 9\n assert candidate(arr = [1, 3, 2, 4, 5]) == 2\n assert candidate(arr = [2, 3, 1, 1, 4]) == 3\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 20\n assert candidate(arr = [1, 2, 2, 1, 2, 1, 2, 1, 2, 1]) == 7\n assert candidate(arr = [50, 40, 30, 20, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50]) == 3\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 2\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == 5\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 4\n assert candidate(arr = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [1, 5, 3, 4, 2, 6, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19]) == 3\n assert candidate(arr = [15, 13, 14, 11, 10, 12, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18]) == 3\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 11\n assert candidate(arr = [1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2]) == 20\n assert candidate(arr = [1, 2, 3, 5, 4, 6, 7, 8, 10, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 2\n assert candidate(arr = [3, 2, 4, 1, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 30\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 5\n assert candidate(arr = [49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 1\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 7\n assert candidate(arr = [1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3]) == 8\n assert candidate(arr = [5, 2, 6, 3, 7, 4, 8, 1, 9]) == 9\n assert candidate(arr = [1, 3, 5, 2, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2]) == 3\n assert candidate(arr = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9]) == 3\n assert candidate(arr = [1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19]) == 3\n assert candidate(arr = [1, 3, 2, 4, 7, 6, 9, 11, 8, 10]) == 3\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4]) == 9\n assert candidate(arr = [4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]) == 2\n assert candidate(arr = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(arr = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [20, 18, 19, 16, 17, 14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 1]) == 2\n assert candidate(arr = [100, 200, 150, 300, 250, 350, 400, 375, 450, 425]) == 3\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 2\n assert candidate(arr = [1, 3, 2, 4, 3, 2, 1, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == 2\n assert candidate(arr = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5]) == 6\n assert candidate(arr = [150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 1\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21]) == 1\n assert candidate(arr = [5, 2, 6, 4, 1, 7, 8, 3, 9, 0]) == 9\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [5, 1, 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == 4\n assert candidate(arr = [5, 4, 3, 2, 1, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == 2\n assert candidate(arr = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 9, 19, 29, 39, 49, 59, 69, 79, 89]) == 4\n assert candidate(arr = [1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10]) == 15\n assert candidate(arr = [1, 5, 2, 4, 3, 6, 8, 7, 9, 10]) == 2\n assert candidate(arr = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 20\n assert candidate(arr = [3, 4, 2, 5, 1, 7, 6, 8, 0, 9]) == 10\n assert candidate(arr = [59, 57, 55, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 1\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 3\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 3\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0]) == 1\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 2\n assert candidate(arr = [10, 11, 10, 11, 10, 11, 10, 11]) == 6\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == 3\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 2\n assert candidate(arr = [20, 30, 40, 50, 60, 70, 80, 90, 100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5, 0]) == 1\n assert candidate(arr = [1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5]) == 6\n assert candidate(arr = [1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19, 22, 21, 24, 23, 26, 25, 28, 27, 30, 29]) == 3\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1]) == 20\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(arr = [5, 3, 9, 2, 8, 6, 7, 4, 10, 1]) == 9\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 38]) == 2\n assert candidate(arr = [2, 2, 2, 2, 1, 1, 1, 1, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5]) == 12\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 12\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 2\n assert candidate(arr = [5, 3, 6, 8, 1, 2, 9, 10, 4, 7]) == 6\n assert candidate(arr = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 20\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]) == 2\n assert candidate(arr = [8, 7, 10, 8, 11, 5, 13, 5, 6, 12]) == 7\n assert candidate(arr = [3, 2, 1, 6, 5, 4, 9, 8, 7, 10]) == 4\n assert candidate(arr = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 12\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 5\n assert candidate(arr = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [1, 3, 2, 6, 5, 4, 9, 8, 7, 10, 2, 1, 3, 4, 5, 6, 7, 8, 9, 0]) == 18\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 1, 2, 3, 4]) == 7\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 1\n assert candidate(arr = [1, 2, 3, 2, 1, 4, 5, 4, 3, 2, 1, 6, 7, 6, 5, 4, 3, 2, 1]) == 6\n assert candidate(arr = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4]) == 6\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, 10, 20, 30, 40, 50]) == 6\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 7\n assert candidate(arr = [10, 20, 10, 30, 20, 40, 30, 50, 40, 60]) == 3\n assert candidate(arr = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81]) == 1\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 10\n assert candidate(arr = [1, 5, 2, 3, 4, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [1, 5, 3, 7, 2, 6, 4, 8, 9, 10, 1, 5, 3, 7, 2, 6, 4, 8, 9, 10, 1, 5, 3, 7, 2, 6, 4, 8, 9, 10]) == 5\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 3\n assert candidate(arr = [1, 5, 3, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 2\n assert candidate(arr = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19]) == 3\n assert candidate(arr = [10, 20, 30, 20, 10, 40, 50, 60, 70, 80]) == 2\n assert candidate(arr = [7, 2, 5, 1, 6, 3, 4, 8, 9, 0]) == 9\n assert candidate(arr = [5, 3, 8, 6, 9, 1, 7, 4, 2, 10]) == 9\n assert candidate(arr = [5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 2\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 20]) == 3\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 8\n assert candidate(arr = [1, 5, 3, 7, 9, 2, 6, 8, 4, 10]) == 7\n assert candidate(arr = [5, 4, 3, 2, 1, 2, 3, 4, 5]) == 3\n assert candidate(arr = [5, 3, 1, 4, 2, 6]) == 5\n assert candidate(arr = [1, 5, 3, 7, 2, 6, 4, 8, 9, 10, 1, 5, 3, 7, 2, 6, 4, 8, 9, 10]) == 3\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 23\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 2\n assert candidate(arr = [1, 3, 2, 5, 4, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 3\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9]) == 5\n assert candidate(arr = [1, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 10, 7, 11, 8, 12, 9, 13, 10, 14, 11, 15, 12, 16, 13, 17, 14, 18, 15, 19, 16, 20]) == 5\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == 3\n assert candidate(arr = [29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 1\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 5, 1, 0, 5, 8, 2, 0, 9, 7, 4, 9, 4, 4, 5, 9, 2, 3, 0, 7, 8, 1, 6, 4, 0, 6, 2, 8, 2, 8, 0, 9, 7, 9, 9, 4, 9, 2, 3, 0, 9, 0]) == 54\n assert candidate(arr = [100000]) == 1\n assert candidate(arr = [0, 10, 1, 20, 2, 30, 3]) == 4\n assert candidate(arr = [2, 1, 2, 3, 1]) == 4\n assert candidate(arr = [1, 0, 2, 1, 0]) == 3\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12]) == 3\n assert candidate(arr = [1, 3, 5, 2, 4, 6]) == 3\n assert candidate(arr = [50, 40, 30, 20, 10]) == 1\n assert candidate(arr = [1, 2, 3, 2, 1, 4, 5, 4, 3, 2, 1, 6, 7, 8, 9]) == 2\n assert candidate(arr = [0, 1, 0, 1, 0, 1, 0]) == 5\n assert candidate(arr = [100000, 99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991, 99990, 99989, 99988, 99987, 99986, 99985, 99984, 99983, 99982, 99981, 99980, 99979, 99978, 99977, 99976, 99975, 99974, 99973, 99972, 99971, 99970, 99969, 99968, 99967, 99966, 99965, 99964, 99963, 99962, 99961, 99960, 99959, 99958, 99957, 99956, 99955, 99954, 99953, 99952, 99951, 99950, 99949, 99948, 99947, 99946, 99945, 99944, 99943, 99942, 99941, 99940, 99939, 99938, 99937, 99936, 99935, 99934, 99933, 99932, 99931, 99930, 99929, 99928, 99927, 99926, 99925, 99924, 99923, 99922, 99921, 99920]) == 1\n assert candidate(arr = [100, 200, 300, 400, 500]) == 2\n assert candidate(arr = [100, 99, 98, 97, 96, 95]) == 1\n assert candidate(arr = [4, 2, 3, 0, 3, 1, 2]) == 4\n assert candidate(arr = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 7\n assert candidate(arr = [20, 30, 25, 35, 40, 39, 38, 37, 36, 35]) == 4\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [1, 2, 3, 5, 4, 6, 7]) == 2\n assert candidate(arr = [0, 1, 0, 3, 0, 4, 0, 5, 0, 6]) == 7\n assert candidate(arr = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]) == 3\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 2, 1]) == 5\n assert candidate(arr = [100000, 99999, 99998, 99997, 99996]) == 1\n assert candidate(arr = [2, 2, 2, 2, 2]) == 5\n assert candidate(arr = [0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 2\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 10\n assert candidate(arr = [9, 11, 12]) == 2\n assert candidate(arr = [2, 1, 4, 3, 2, 1, 4, 3, 2, 1]) == 4\n assert candidate(arr = [1, 0, 3, 2, 5, 3, 1, 2, 4]) == 4\n assert candidate(arr = [19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [100000, 99999, 99998, 99997, 99996]) == 1\n assert candidate(arr = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20]) == 8\n assert candidate(arr = [1, 2, 1, 2, 1]) == 4\n assert candidate(arr = [100, 90, 80, 70, 60]) == 1\n assert candidate(arr = [11, 13, 15, 17, 19, 21]) == 2\n assert candidate(arr = [60, 70, 80, 90, 100]) == 2\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10]) == 3\n assert candidate(arr = [5, 1, 3, 4, 2, 6, 7, 8, 9, 0]) == 9\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 2\n assert candidate(arr = [10, 20, 30, 40, 50]) == 2\n assert candidate(arr = [1, 2, 3, 5, 4, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [3, 2, 1]) == 1\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8]) == 3\n assert candidate(arr = [8, 1, 5, 2, 10, 13, 17, 7, 4, 9, 12]) == 4\n assert candidate(arr = [20, 18, 16, 14, 12, 10, 8, 6, 4, 2]) == 1\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(arr = [100000, 0, 100000, 0, 100000]) == 4\n assert candidate(arr = [10, 90, 80, 70, 60, 50, 40, 30, 20, 100]) == 9\n assert candidate(arr = [0, 1, 2, 3, 4, 5]) == 2\n assert candidate(arr = [10, 10, 10, 10, 10]) == 5\n assert candidate(arr = [1, 2, 3]) == 2\n assert candidate(arr = [8, 9, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11]) == 1\n assert candidate(arr = [1, 2, 3, 2, 1, 4, 3, 2, 1, 5, 4, 3, 2, 1]) == 6\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2]) == 8\n assert candidate(arr = [1, 2, 3, 5, 4, 6, 7, 8, 9, 0]) == 9\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 2\n assert candidate(arr = [3, 3, 3, 2, 1]) == 1\n assert candidate(arr = [0, 2, 1, 4, 3]) == 3\n assert candidate(arr = [0, 2, 2, 2, 0]) == 3\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [0, 0, 0, 0, 0]) == 5\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().oddEvenJumps", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var oddEvenJumps = function(arr) {", "container": null, "callable": "oddEvenJumps", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 976, "task_id": "largest-perimeter-triangle", "difficulty": "Easy", "problem_description": "Given an integer array nums, return the largest perimeter of a triangle with a non-zero area, formed from three of these lengths. If it is impossible to form any triangle of a non-zero area, return 0.\n \nExample 1:\n\nInput: nums = [2,1,2]\nOutput: 5\nExplanation: You can form a triangle with three side lengths: 1, 2, and 2.\n\nExample 2:\n\nInput: nums = [1,2,1,10]\nOutput: 0\nExplanation: \nYou cannot use the side lengths 1, 1, and 2 to form a triangle.\nYou cannot use the side lengths 1, 1, and 10 to form a triangle.\nYou cannot use the side lengths 1, 2, and 10 to form a triangle.\nAs we cannot use any three side lengths to form a triangle of non-zero area, we return 0.\n\n \nConstraints:\n\n3 <= nums.length <= 104\n1 <= nums[i] <= 106\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 5, 7]) == 22\n assert candidate(nums = [10, 5, 1, 8, 12, 10, 5, 15]) == 37\n assert candidate(nums = [7, 10, 5, 2, 8, 7]) == 25\n assert candidate(nums = [1, 1, 1, 1]) == 3\n assert candidate(nums = [1, 1, 1]) == 3\n assert candidate(nums = [1, 1000000, 1000000]) == 2000001\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 27\n assert candidate(nums = [10, 5, 7, 8, 2, 12]) == 30\n assert candidate(nums = [3, 6, 2, 3]) == 8\n assert candidate(nums = [2, 1, 2]) == 5\n assert candidate(nums = [2, 3, 4, 5, 6]) == 15\n assert candidate(nums = [10, 20, 30, 40, 50]) == 120\n assert candidate(nums = [7, 10, 5, 2, 8, 4, 6]) == 25\n assert candidate(nums = [5, 5, 5, 5]) == 15\n assert candidate(nums = [1, 1, 1, 2, 2, 2]) == 6\n assert candidate(nums = [1, 3, 5, 7, 9, 11]) == 27\n assert candidate(nums = [2, 3, 3, 4, 5, 6, 7]) == 18\n assert candidate(nums = [1, 1, 1, 1, 1]) == 3\n assert candidate(nums = [7, 10, 5, 2]) == 22\n assert candidate(nums = [1, 2, 3, 4, 5, 6]) == 15\n assert candidate(nums = [6, 4, 10, 3]) == 13\n assert candidate(nums = [3, 6, 2, 3, 5, 4, 1]) == 15\n assert candidate(nums = [6, 4, 2, 8, 5, 7]) == 21\n assert candidate(nums = [1, 3, 2, 4, 6, 5, 7, 8]) == 21\n assert candidate(nums = [6, 6, 6, 10]) == 22\n assert candidate(nums = [1, 2, 1, 10]) == 0\n assert candidate(nums = [3, 3, 3, 3, 3]) == 9\n assert candidate(nums = [1, 1, 1, 1, 1, 1]) == 3\n assert candidate(nums = [3, 2, 3, 4]) == 10\n assert candidate(nums = [7, 10, 5, 2, 8, 7, 3, 5]) == 25\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == 4200\n assert candidate(nums = [100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000]) == 2700000\n assert candidate(nums = [3, 6, 2, 3, 5, 4, 8, 7]) == 21\n assert candidate(nums = [5, 5, 5, 1, 1, 1, 10, 10, 10, 20]) == 30\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 81\n assert candidate(nums = [1000000, 999999, 999998, 999997, 999996]) == 2999997\n assert candidate(nums = [1, 1000000, 2, 999999, 3, 999998, 4, 999997, 5, 999996, 6, 999995, 7, 999994, 8, 999993]) == 2999997\n assert candidate(nums = [1000000, 999999, 1000000, 1000000, 999998]) == 3000000\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 30\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000, 500000, 600000, 700000]) == 2300000\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1]) == 30\n assert candidate(nums = [999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991, 999990, 999989]) == 2999991\n assert candidate(nums = [1000000, 999999, 999998, 1, 2, 3]) == 2999997\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30]) == 81\n assert candidate(nums = [9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]) == 69\n assert candidate(nums = [1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009]) == 3024\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 9\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 29\n assert candidate(nums = [10, 20, 25, 30, 40, 50, 60, 70, 80, 90]) == 240\n assert candidate(nums = [1, 3, 2, 4, 6, 5, 7, 9, 8, 10, 12, 11, 13, 15, 14, 16, 18, 17, 19, 20, 22, 21, 23, 25, 24, 26, 28, 27, 29, 30]) == 87\n assert candidate(nums = [1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000]) == 3000000\n assert candidate(nums = [10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == 84\n assert candidate(nums = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]) == 81\n assert candidate(nums = [3, 6, 2, 3, 5, 40, 41]) == 87\n assert candidate(nums = [1000000, 999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991]) == 2999997\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 9\n assert candidate(nums = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]) == 36\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 57\n assert candidate(nums = [7, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105]) == 300\n assert candidate(nums = [1000000, 999999, 1000001, 1000002, 1000003]) == 3000006\n assert candidate(nums = [1000000, 2, 1000000, 3, 1000000, 4, 1000000, 5, 1000000]) == 3000000\n assert candidate(nums = [3, 3, 3, 2, 2, 2, 1, 1, 1, 1]) == 9\n assert candidate(nums = [1, 200000, 200000, 200000, 200000]) == 600000\n assert candidate(nums = [999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991, 999990, 999989, 999988, 999987, 999986, 999985, 999984, 999983, 999982, 999981, 999980]) == 2999994\n assert candidate(nums = [2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 57\n assert candidate(nums = [999999, 999999, 999999, 999999, 999999, 999999, 999999, 999999, 999999, 999999]) == 2999997\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 15\n assert candidate(nums = [5, 10, 25, 40, 50, 60, 70, 80, 90, 100]) == 270\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]) == 0\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 51\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21]) == 57\n assert candidate(nums = [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000]) == 300000\n assert candidate(nums = [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 26\n assert candidate(nums = [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 29\n assert candidate(nums = [1, 2, 3, 6, 7, 8, 12, 14, 15, 18, 20, 21, 24, 25, 28, 30, 32, 33, 36, 39]) == 108\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == 4200\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 42\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 27\n assert candidate(nums = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 27\n assert candidate(nums = [500000, 500000, 500000, 500000, 500000, 500000]) == 1500000\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 9\n assert candidate(nums = [10, 5, 7, 3, 9, 8]) == 27\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1000000]) == 9\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8]) == 23\n assert candidate(nums = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]) == 20\n assert candidate(nums = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509]) == 1524\n assert candidate(nums = [1000000, 999999, 999998, 999997, 999996, 999995]) == 2999997\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]) == 330\n assert candidate(nums = [1000, 2000, 1500, 2500, 1800, 3000, 2200, 3500]) == 9000\n assert candidate(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109]) == 324\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 57\n assert candidate(nums = [10, 5, 7, 2, 8, 4, 6]) == 25\n assert candidate(nums = [1, 1000000, 2, 999999, 3, 999998, 4, 999997, 5, 999996, 6, 999995, 7, 999994, 8, 999993, 9, 999992]) == 2999997\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300]) == 3600\n assert candidate(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == 357\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 6\n assert candidate(nums = [1, 2, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946]) == 0\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 9\n assert candidate(nums = [10, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 3\n assert candidate(nums = [100, 200, 150, 300, 250, 400, 350, 500]) == 1250\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 9\n assert candidate(nums = [12, 25, 10, 15, 30, 18, 20, 22, 28, 35, 40]) == 105\n assert candidate(nums = [7, 10, 5, 3, 8, 9, 2, 6, 4, 1]) == 27\n assert candidate(nums = [1000000, 999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991]) == 2999997\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 270\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 15\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 27\n assert candidate(nums = [10, 21, 32, 43, 54, 65, 76, 87, 98, 109]) == 294\n assert candidate(nums = [1, 1000000, 1000000, 1000000, 1000000]) == 3000000\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 420\n assert candidate(nums = [2, 2, 3, 3, 4, 4, 5, 5, 6, 6]) == 17\n assert candidate(nums = [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == 44\n assert candidate(nums = [1000000, 999999, 1000000, 999998, 999997]) == 2999999\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().largestPerimeter", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var largestPerimeter = function(nums) {", "container": null, "callable": "largestPerimeter", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 977, "task_id": "squares-of-a-sorted-array", "difficulty": "Easy", "problem_description": "Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.\n \nExample 1:\n\nInput: nums = [-4,-1,0,3,10]\nOutput: [0,1,9,16,100]\nExplanation: After squaring, the array becomes [16,1,0,9,100].\nAfter sorting, it becomes [0,1,9,16,100].\n\nExample 2:\n\nInput: nums = [-7,-3,2,3,11]\nOutput: [4,9,9,49,121]\n\n \nConstraints:\n\n1 <= nums.length <= 104\n-104 <= nums[i] <= 104\nnums is sorted in non-decreasing order.\n\n \nFollow up: Squaring each element and sorting the new array is very trivial, could you find an O(n) solution using a different approach?", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [-2, -1, 0, 1, 2]) == [0, 1, 1, 4, 4]\n assert candidate(nums = [0, 1, 2, 3, 4, 5]) == [0, 1, 4, 9, 16, 25]\n assert candidate(nums = [-1, -1, 0, 0, 1, 1]) == [0, 0, 1, 1, 1, 1]\n assert candidate(nums = [-1]) == [1]\n assert candidate(nums = [-4, -4, -3, -2, -1, 0, 1, 2, 3, 4]) == [0, 1, 1, 4, 4, 9, 9, 16, 16, 16]\n assert candidate(nums = [-3, 0, 3]) == [0, 9, 9]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]\n assert candidate(nums = [-7, -3, 2, 3, 11]) == [4, 9, 9, 49, 121]\n assert candidate(nums = [-5, -3, -1, 0, 1, 2, 3]) == [0, 1, 1, 4, 9, 9, 25]\n assert candidate(nums = [-10, -5, 0, 5, 10]) == [0, 25, 25, 100, 100]\n assert candidate(nums = [-5, -4, -3, -2, -1]) == [1, 4, 9, 16, 25]\n assert candidate(nums = [0, 0, 0, 0, 0]) == [0, 0, 0, 0, 0]\n assert candidate(nums = [1, 2, 3, 4, 5]) == [1, 4, 9, 16, 25]\n assert candidate(nums = [0, 1, 2, 3, 4]) == [0, 1, 4, 9, 16]\n assert candidate(nums = [-9, -7, -5, -3, -1, 2, 4, 6, 8]) == [1, 4, 9, 16, 25, 36, 49, 64, 81]\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1]) == [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]\n assert candidate(nums = [-8, -6, -4, -2, 0, 1, 3, 5, 7]) == [0, 1, 4, 9, 16, 25, 36, 49, 64]\n assert candidate(nums = [0]) == [0]\n assert candidate(nums = [0, 0, 0, 0]) == [0, 0, 0, 0]\n assert candidate(nums = [-10000, 10000]) == [100000000, 100000000]\n assert candidate(nums = [-5, -3, -1, 0, 2, 4]) == [0, 1, 4, 9, 16, 25]\n assert candidate(nums = [-5, -3, -2, -1]) == [1, 4, 9, 25]\n assert candidate(nums = [-2, -2, 2, 2]) == [4, 4, 4, 4]\n assert candidate(nums = [-10, -8, -6, -4, -2]) == [4, 16, 36, 64, 100]\n assert candidate(nums = [-10000, 0, 10000]) == [0, 100000000, 100000000]\n assert candidate(nums = [-4, -1, 0, 3, 10]) == [0, 1, 9, 16, 100]\n assert candidate(nums = [-3, -2, -1, 0, 1, 2, 3]) == [0, 1, 1, 4, 4, 9, 9]\n assert candidate(nums = [-5, -3, -1, 0, 1, 3, 5]) == [0, 1, 1, 9, 9, 25, 25]\n assert candidate(nums = [-1, 0, 1]) == [0, 1, 1]\n assert candidate(nums = [-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6]) == [0, 1, 1, 4, 4, 9, 9, 16, 16, 25, 25, 36, 36]\n assert candidate(nums = [-2, -2, -2, -1, 0, 0, 1, 2, 2, 2]) == [0, 0, 1, 1, 4, 4, 4, 4, 4, 4]\n assert candidate(nums = [-9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [0, 1, 1, 4, 4, 9, 9, 16, 16, 25, 25, 36, 36, 49, 49, 64, 64, 81, 81]\n assert candidate(nums = [-3, -2, -1, 0, 0, 0, 1, 2, 3]) == [0, 0, 0, 1, 1, 4, 4, 9, 9]\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, -9990, -9989, -9988, -9987, -9986, -9985, -9984, -9983, -9982, -9981, -9980, -9979, -9978, -9977, -9976, -9975, -9974, -9973, -9972, -9971, -9970, -9969, -9968, -9967, -9966, -9965, -9964, -9963, -9962, -9961, -9960, -9959, -9958, -9957, -9956, -9955, -9954, -9953, -9952, -9951, -9950, -9949, -9948, -9947, -9946, -9945, -9944, -9943, -9942, -9941, -9940, -9939, -9938, -9937, -9936, -9935, -9934, -9933, -9932, -9931, -9930, -9929, -9928, -9927, -9926, -9925, -9924, -9923, -9922, -9921, -9920, -9919, -9918, -9917, -9916, -9915, -9914, -9913, -9912, -9911, -9910, -9909, -9908, -9907, -9906, -9905, -9904, -9903, -9902, -9901, -9900, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1024, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 1936, 2025, 2116, 2209, 2304, 2401, 2500, 2601, 2704, 2809, 2916, 3025, 3136, 3249, 3364, 3481, 3600, 3721, 3844, 3969, 4096, 4225, 4356, 4489, 4624, 4761, 4900, 5041, 5184, 5329, 5476, 5625, 5776, 5929, 6084, 6241, 6400, 6561, 6724, 6889, 7056, 7225, 7396, 7569, 7744, 7921, 8100, 8281, 8464, 8649, 8836, 9025, 9216, 9409, 9604, 9801, 10000, 98010000, 98029801, 98049604, 98069409, 98089216, 98109025, 98128836, 98148649, 98168464, 98188281, 98208100, 98227921, 98247744, 98267569, 98287396, 98307225, 98327056, 98346889, 98366724, 98386561, 98406400, 98426241, 98446084, 98465929, 98485776, 98505625, 98525476, 98545329, 98565184, 98585041, 98604900, 98624761, 98644624, 98664489, 98684356, 98704225, 98724096, 98743969, 98763844, 98783721, 98803600, 98823481, 98843364, 98863249, 98883136, 98903025, 98922916, 98942809, 98962704, 98982601, 99002500, 99022401, 99042304, 99062209, 99082116, 99102025, 99121936, 99141849, 99161764, 99181681, 99201600, 99221521, 99241444, 99261369, 99281296, 99301225, 99321156, 99341089, 99361024, 99380961, 99400900, 99420841, 99440784, 99460729, 99480676, 99500625, 99520576, 99540529, 99560484, 99580441, 99600400, 99620361, 99640324, 99660289, 99680256, 99700225, 99720196, 99740169, 99760144, 99780121, 99800100, 99820081, 99840064, 99860049, 99880036, 99900025, 99920016, 99940009, 99960004, 99980001, 100000000]\n assert candidate(nums = [-100, -50, -25, -10, -5, 0, 5, 10, 25, 50, 100]) == [0, 25, 25, 100, 100, 625, 625, 2500, 2500, 10000, 10000]\n assert candidate(nums = [-10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == [0, 25, 25, 100, 100, 225, 400, 625, 900, 1225, 1600, 2025, 2500]\n assert candidate(nums = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums = [-100, -50, -20, -10, -5, -1, 0, 1, 5, 10, 20, 50, 100]) == [0, 1, 1, 25, 25, 100, 100, 400, 400, 2500, 2500, 10000, 10000]\n assert candidate(nums = [-10000, -9000, -8000, -7000, -6000, -5000, -4000, -3000, -2000, -1000, 0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]) == [0, 1000000, 1000000, 4000000, 4000000, 9000000, 9000000, 16000000, 16000000, 25000000, 25000000, 36000000, 36000000, 49000000, 49000000, 64000000, 64000000, 81000000, 81000000, 100000000, 100000000]\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 1, 4, 4, 9, 9, 16, 16, 25, 25, 36, 36, 49, 49, 64, 64, 81, 81, 100, 100]\n assert candidate(nums = [-9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, -9990, 9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999]) == [99800100, 99800100, 99820081, 99820081, 99840064, 99840064, 99860049, 99860049, 99880036, 99880036, 99900025, 99900025, 99920016, 99920016, 99940009, 99940009, 99960004, 99960004, 99980001, 99980001]\n assert candidate(nums = [-1, -1, -1, -1, -1, 0, 1, 1, 1, 1, 1]) == [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums = [-1, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]) == [0, 1, 1, 1, 1, 4, 4, 4, 9, 9, 9, 16, 16, 16, 25, 25, 25]\n assert candidate(nums = [-5, -3, -1, 2, 4, 6, 8]) == [1, 4, 9, 16, 25, 36, 64]\n assert candidate(nums = [-10, -5, -1, 0, 1, 5, 10]) == [0, 1, 1, 25, 25, 100, 100]\n assert candidate(nums = [-5000, -1000, -500, -100, -50, -10, -5, -1, 0, 1, 5, 10, 50, 100, 500, 1000, 5000]) == [0, 1, 1, 25, 25, 100, 100, 2500, 2500, 10000, 10000, 250000, 250000, 1000000, 1000000, 25000000, 25000000]\n assert candidate(nums = [-10000, -9000, -8000, -7000, -6000, -5000, 0, 5000, 6000, 7000, 8000, 9000, 10000]) == [0, 25000000, 25000000, 36000000, 36000000, 49000000, 49000000, 64000000, 64000000, 81000000, 81000000, 100000000, 100000000]\n assert candidate(nums = [-5000, -2500, -1250, -625, -312, -156, -78, -39, 0, 39, 78, 156, 312, 625, 1250, 2500, 5000]) == [0, 1521, 1521, 6084, 6084, 24336, 24336, 97344, 97344, 390625, 390625, 1562500, 1562500, 6250000, 6250000, 25000000, 25000000]\n assert candidate(nums = [-9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 81, 64, 49, 36, 25, 16, 9, 4, 1, 0, 1, 1, 4, 4, 9, 9, 16, 16, 25, 25, 36, 36, 49, 49, 64, 64, 81, 81, 100]\n assert candidate(nums = [-9, -8, -7, -6, -5, -4, -3, -2, -1]) == [1, 4, 9, 16, 25, 36, 49, 64, 81]\n assert candidate(nums = [-10, -5, -1, 0, 1, 2, 3, 4, 5, 10]) == [0, 1, 1, 4, 9, 16, 25, 25, 100, 100]\n assert candidate(nums = [-1, 0, 1]) == [0, 1, 1]\n assert candidate(nums = [-1, 0, 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000]) == [0, 1, 1, 100, 10000, 1000000, 100000000, 10000000000, 1000000000000, 100000000000000]\n assert candidate(nums = [-9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, -9990, 0, 1, 2, 3, 4, 5]) == [0, 1, 4, 9, 16, 25, 99800100, 99820081, 99840064, 99860049, 99880036, 99900025, 99920016, 99940009, 99960004, 99980001]\n assert candidate(nums = [-20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == [0, 25, 25, 100, 100, 225, 225, 400, 400, 625, 900, 1225, 1600, 2025, 2500]\n assert candidate(nums = [-9999, -5000, -1000, -500, -100, -50, -10, -5, -2, -1, 0, 1, 2, 5, 10, 50, 100, 500, 1000, 5000, 9999]) == [0, 1, 1, 4, 4, 25, 25, 100, 100, 2500, 2500, 10000, 10000, 250000, 250000, 1000000, 1000000, 25000000, 25000000, 99980001, 99980001]\n assert candidate(nums = [-2, -2, -2, -1, 0, 0, 0, 1, 2, 2, 2]) == [0, 0, 0, 1, 1, 4, 4, 4, 4, 4, 4]\n assert candidate(nums = [-100, -50, -25, -10, -5, -1, 0, 1, 5, 10, 25, 50, 100]) == [0, 1, 1, 25, 25, 100, 100, 625, 625, 2500, 2500, 10000, 10000]\n assert candidate(nums = [-10000, 0, 10000]) == [0, 100000000, 100000000]\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991]) == [99820081, 99840064, 99860049, 99880036, 99900025, 99920016, 99940009, 99960004, 99980001, 100000000]\n assert candidate(nums = [-9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, -9990, -9989, -9988, -9987, -9986, -9985, -9984, -9983, -9982, -9981, -9980, 0, 9980, 9981, 9982, 9983, 9984, 9985, 9986, 9987, 9988, 9989, 9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999]) == [0, 99600400, 99600400, 99620361, 99620361, 99640324, 99640324, 99660289, 99660289, 99680256, 99680256, 99700225, 99700225, 99720196, 99720196, 99740169, 99740169, 99760144, 99760144, 99780121, 99780121, 99800100, 99800100, 99820081, 99820081, 99840064, 99840064, 99860049, 99860049, 99880036, 99880036, 99900025, 99900025, 99920016, 99920016, 99940009, 99940009, 99960004, 99960004, 99980001, 99980001]\n assert candidate(nums = [-9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, -9990]) == [99800100, 99820081, 99840064, 99860049, 99880036, 99900025, 99920016, 99940009, 99960004, 99980001]\n assert candidate(nums = [-10000, -5000, -1000, -500, -100, -50, -10, -5, -1, 0, 1, 5, 10, 50, 100, 500, 1000, 5000, 10000]) == [0, 1, 1, 25, 25, 100, 100, 2500, 2500, 10000, 10000, 250000, 250000, 1000000, 1000000, 25000000, 25000000, 100000000, 100000000]\n assert candidate(nums = [-20, -15, -10, -5, 0, 5, 10, 15, 20]) == [0, 25, 25, 100, 100, 225, 225, 400, 400]\n assert candidate(nums = [-9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, 0, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999]) == [0, 99820081, 99820081, 99840064, 99840064, 99860049, 99860049, 99880036, 99880036, 99900025, 99900025, 99920016, 99920016, 99940009, 99940009, 99960004, 99960004, 99980001, 99980001]\n assert candidate(nums = [-9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, -9990, 0, 9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999]) == [0, 99800100, 99800100, 99820081, 99820081, 99840064, 99840064, 99860049, 99860049, 99880036, 99880036, 99900025, 99900025, 99920016, 99920016, 99940009, 99940009, 99960004, 99960004, 99980001, 99980001]\n assert candidate(nums = [-100, -99, -98, -97, -96, -95, -94, -93, -92, -91]) == [8281, 8464, 8649, 8836, 9025, 9216, 9409, 9604, 9801, 10000]\n assert candidate(nums = [-9999, 0, 9999]) == [0, 99980001, 99980001]\n assert candidate(nums = [-5000, -3000, -1000, 0, 1000, 3000, 5000]) == [0, 1000000, 1000000, 9000000, 9000000, 25000000, 25000000]\n assert candidate(nums = [-1, 0, 1, 0, -1, 0, 1, 0, -1, 0]) == [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]\n assert candidate(nums = [-3, -2, -1, 0, 1, 2, 3, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == [0, 1, 1, 4, 4, 9, 9, 100, 400, 900, 1600, 2500, 3600, 4900, 6400, 8100, 10000]\n assert candidate(nums = [-1000, -500, -100, -50, -10, -5, -1, 0, 1, 5, 10, 50, 100, 500, 1000]) == [0, 1, 1, 25, 25, 100, 100, 2500, 2500, 10000, 10000, 250000, 250000, 1000000, 1000000]\n assert candidate(nums = [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [0, 1, 1, 4, 4, 9, 9, 16, 25, 36, 49, 64, 81, 100]\n assert candidate(nums = [-1, -1, -1, 0, 0, 0, 1, 1, 1]) == [0, 0, 0, 1, 1, 1, 1, 1, 1]\n assert candidate(nums = [-4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == [0, 1, 1, 4, 4, 9, 9, 16, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225]\n assert candidate(nums = [-5, -4, -3, -2, -1, 1, 2, 3, 4, 5]) == [1, 1, 4, 4, 9, 9, 16, 16, 25, 25]\n assert candidate(nums = [-9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991, -9990, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 99800100, 99820081, 99840064, 99860049, 99880036, 99900025, 99920016, 99940009, 99960004, 99980001]\n assert candidate(nums = [-100, -50, -20, -10, -5, 0, 5, 10, 20, 50, 100]) == [0, 25, 25, 100, 100, 400, 400, 2500, 2500, 10000, 10000]\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [0, 1, 1, 4, 4, 9, 9, 16, 16, 25, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400]\n assert candidate(nums = [-100, -50, -25, -10, -5, -2, 0, 2, 5, 10, 25, 50, 100]) == [0, 4, 4, 25, 25, 100, 100, 625, 625, 2500, 2500, 10000, 10000]\n assert candidate(nums = [-10, -5, 0, 5, 10, -10, -5, 0, 5, 10]) == [0, 25, 100, 100, 25, 0, 25, 25, 100, 100]\n assert candidate(nums = [-1000, -500, -100, -50, -10, -5, -2, -1, 0, 1, 2, 5, 10, 50, 100, 500, 1000]) == [0, 1, 1, 4, 4, 25, 25, 100, 100, 2500, 2500, 10000, 10000, 250000, 250000, 1000000, 1000000]\n assert candidate(nums = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]) == [0, 1, 1, 4, 4, 9, 9, 16, 16, 25, 25]\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [0, 1, 1, 4, 4, 9, 9, 16, 16, 25, 25, 36, 36, 49, 49, 64, 64, 81, 81, 100, 100]\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(nums = [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [0, 1, 1, 4, 4, 9, 9, 16, 25, 36, 49, 64, 81]\n assert candidate(nums = [-1, -1, -1, -1, -1, 0, 1, 1, 1, 1, 1]) == [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums = [-50, -40, -30, -20, -10, -5, -1, 0, 1, 5, 10, 20, 30, 40, 50]) == [0, 1, 1, 25, 25, 100, 100, 400, 400, 900, 900, 1600, 1600, 2500, 2500]\n assert candidate(nums = [-10, -10, -10, -10, -10, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10]) == [0, 0, 0, 0, 0, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100]\n assert candidate(nums = [-25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == [0, 1, 1, 4, 4, 9, 9, 16, 16, 25, 25, 36, 36, 49, 49, 64, 64, 81, 81, 100, 100, 121, 121, 144, 144, 169, 169, 196, 196, 225, 225, 256, 256, 289, 289, 324, 324, 361, 361, 400, 400, 441, 441, 484, 484, 529, 529, 576, 576, 625, 625]\n assert candidate(nums = [-5000, -4000, -3000, -2000, -1000, 0, 1000, 2000, 3000, 4000, 5000]) == [0, 1000000, 1000000, 4000000, 4000000, 9000000, 9000000, 16000000, 16000000, 25000000, 25000000]\n assert candidate(nums = [-999, -998, -997, -996, -995, -994, -993, -992, -991, -990, 0, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999]) == [0, 980100, 980100, 982081, 982081, 984064, 984064, 986049, 986049, 988036, 988036, 990025, 990025, 992016, 992016, 994009, 994009, 996004, 996004, 998001, 998001]\n assert candidate(nums = [-100, -90, -80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == [0, 100, 100, 400, 400, 900, 900, 1600, 1600, 2500, 2500, 3600, 3600, 4900, 4900, 6400, 6400, 8100, 8100, 10000, 10000]\n assert candidate(nums = [-1000, -900, -800, -700, -600, -500, -400, -300, -200, -100, 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == [0, 10000, 10000, 40000, 40000, 90000, 90000, 160000, 160000, 250000, 250000, 360000, 360000, 490000, 490000, 640000, 640000, 810000, 810000, 1000000, 1000000]\n assert candidate(nums = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == [0, 1, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625]\n assert candidate(nums = [-10, -5, -1, 0, 2, 5, 8]) == [0, 1, 4, 25, 25, 64, 100]\n assert candidate(nums = [-1, -1, 0, 1, 1]) == [0, 1, 1, 1, 1]\n assert candidate(nums = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10]) == [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]\n assert candidate(nums = [-100, -50, -25, -10, -5, 0, 1, 2, 5, 10, 25, 50, 100]) == [0, 1, 4, 25, 25, 100, 100, 625, 625, 2500, 2500, 10000, 10000]\n assert candidate(nums = [-5000, -4000, -3000, -2000, -1000, -500, -100, -50, -10, -1, 0, 1, 10, 50, 100, 500, 1000, 2000, 3000, 4000, 5000]) == [0, 1, 1, 100, 100, 2500, 2500, 10000, 10000, 250000, 250000, 1000000, 1000000, 4000000, 4000000, 9000000, 9000000, 16000000, 16000000, 25000000, 25000000]\n assert candidate(nums = [-3000, -2500, -2000, -1500, -1000, -500, -250, -100, -50, -25, -10, -5, -1, 0, 1, 5, 10, 25, 50, 100, 250, 500, 1000, 1500, 2000, 2500, 3000]) == [0, 1, 1, 25, 25, 100, 100, 625, 625, 2500, 2500, 10000, 10000, 62500, 62500, 250000, 250000, 1000000, 1000000, 2250000, 2250000, 4000000, 4000000, 6250000, 6250000, 9000000, 9000000]\n assert candidate(nums = [-1, -1, -1, 0, 0, 0, 1, 1, 1]) == [0, 0, 0, 1, 1, 1, 1, 1, 1]\n assert candidate(nums = [-1000, -500, -250, -100, -50, -25, -10, -5, -2, -1, 0, 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000]) == [0, 1, 1, 4, 4, 25, 25, 100, 100, 625, 625, 2500, 2500, 10000, 10000, 62500, 62500, 250000, 250000, 1000000, 1000000]\n assert candidate(nums = [-50, -40, -30, -20, -10, 0, 10, 20, 30, 40, 50]) == [0, 100, 100, 400, 400, 900, 900, 1600, 1600, 2500, 2500]\n assert candidate(nums = [-100, -99, -98, -97, -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, -86, -85, -84, -83, -82, -81, -80, -79, -78, -77, -76, -75, -74, -73, -72, -71, -70, -69, -68, -67, -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53, -52, -51, -50, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1024, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 1936, 2025, 2116, 2209, 2304, 2401, 2500, 2500, 2601, 2601, 2704, 2704, 2809, 2809, 2916, 2916, 3025, 3025, 3136, 3136, 3249, 3249, 3364, 3364, 3481, 3481, 3600, 3600, 3721, 3721, 3844, 3844, 3969, 3969, 4096, 4096, 4225, 4225, 4356, 4356, 4489, 4489, 4624, 4624, 4761, 4761, 4900, 4900, 5041, 5041, 5184, 5184, 5329, 5329, 5476, 5476, 5625, 5625, 5776, 5776, 5929, 5929, 6084, 6084, 6241, 6241, 6400, 6400, 6561, 6561, 6724, 6724, 6889, 6889, 7056, 7056, 7225, 7225, 7396, 7396, 7569, 7569, 7744, 7744, 7921, 7921, 8100, 8100, 8281, 8281, 8464, 8464, 8649, 8649, 8836, 8836, 9025, 9025, 9216, 9216, 9409, 9409, 9604, 9604, 9801, 9801, 10000, 10000]\n assert candidate(nums = [-100, -99, -98, -97, -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, -86, -85, -84, -83, -82, -81, -80, -79, -78, -77, -76, -75, -74, -73, -72, -71, -70, -69, -68, -67, -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53, -52, -51, -50, -49, -48, -47, -46, -45, -44, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == [0, 1, 1, 4, 4, 9, 9, 16, 16, 25, 25, 36, 36, 49, 49, 64, 64, 81, 81, 100, 100, 121, 121, 144, 144, 169, 169, 196, 196, 225, 225, 256, 256, 289, 289, 324, 324, 361, 361, 400, 400, 441, 441, 484, 484, 529, 529, 576, 576, 625, 625, 676, 676, 729, 729, 784, 784, 841, 841, 900, 900, 961, 961, 1024, 1024, 1089, 1089, 1156, 1156, 1225, 1225, 1296, 1296, 1369, 1369, 1444, 1444, 1521, 1521, 1600, 1600, 1681, 1681, 1764, 1764, 1849, 1849, 1936, 1936, 2025, 2025, 2116, 2116, 2209, 2209, 2304, 2304, 2401, 2401, 2500, 2500, 2601, 2601, 2704, 2704, 2809, 2809, 2916, 2916, 3025, 3025, 3136, 3136, 3249, 3249, 3364, 3364, 3481, 3481, 3600, 3600, 3721, 3721, 3844, 3844, 3969, 3969, 4096, 4096, 4225, 4225, 4356, 4356, 4489, 4489, 4624, 4624, 4761, 4761, 4900, 4900, 5041, 5041, 5184, 5184, 5329, 5329, 5476, 5476, 5625, 5625, 5776, 5776, 5929, 5929, 6084, 6084, 6241, 6241, 6400, 6400, 6561, 6561, 6724, 6724, 6889, 6889, 7056, 7056, 7225, 7225, 7396, 7396, 7569, 7569, 7744, 7744, 7921, 7921, 8100, 8100, 8281, 8281, 8464, 8464, 8649, 8649, 8836, 8836, 9025, 9025, 9216, 9216, 9409, 9409, 9604, 9604, 9801, 9801, 10000, 10000]\n assert candidate(nums = [-9, -6, -3, 0, 3, 6, 9]) == [0, 9, 9, 36, 36, 81, 81]\n assert candidate(nums = [-1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1]) == [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]) == [1, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 10000]\n assert candidate(nums = [-10, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 10]) == [0, 1, 1, 4, 4, 9, 9, 16, 16, 25, 25, 36, 36, 100, 100]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(nums = [-2, -2, 0, 2, 2]) == [0, 4, 4, 4, 4]\n assert candidate(nums = [-100, -99, -98, -97, -96, -95, -94, -93, -92, -91, -90, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == [8100, 8100, 8281, 8281, 8464, 8464, 8649, 8649, 8836, 8836, 9025, 9025, 9216, 9216, 9409, 9409, 9604, 9604, 9801, 9801, 10000, 10000]\n assert candidate(nums = [-9, -6, -5, -3, -1, 0, 1, 3, 5, 6, 9, 12, 15, 18, 21]) == [0, 1, 1, 9, 9, 25, 25, 36, 36, 81, 81, 144, 225, 324, 441]\n assert candidate(nums = [-10, -5, -1, 0, 1, 5, 10]) == [0, 1, 1, 25, 25, 100, 100]\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, 0, 1, 2, 3, 4, 5]) == [0, 1, 4, 9, 16, 25, 99920016, 99940009, 99960004, 99980001, 100000000]\n assert candidate(nums = [-1000, -999, -998, -997, -996, -995, -994, -993, -992, -991, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000]) == [982081, 982081, 984064, 984064, 986049, 986049, 988036, 988036, 990025, 990025, 992016, 992016, 994009, 994009, 996004, 996004, 998001, 998001, 1000000, 1000000]\n assert candidate(nums = [-10, -5, -3, -2, -1, 0, 0, 0, 1, 2, 3, 5, 10]) == [0, 0, 0, 1, 1, 4, 4, 9, 9, 25, 25, 100, 100]\n assert candidate(nums = [-25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25]) == [0, 25, 25, 100, 100, 225, 225, 400, 400, 625, 625]\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().sortedSquares", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sortedSquares = function(nums) {", "container": null, "callable": "sortedSquares", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 978, "task_id": "longest-turbulent-subarray", "difficulty": "Medium", "problem_description": "Given an integer array arr, return the length of a maximum size turbulent subarray of arr.\nA subarray is turbulent if the comparison sign flips between each adjacent pair of elements in the subarray.\nMore formally, a subarray [arr[i], arr[i + 1], ..., arr[j]] of arr is said to be turbulent if and only if:\n\nFor i <= k < j:\n\n\t\narr[k] > arr[k + 1] when k is odd, and\narr[k] < arr[k + 1] when k is even.\n\n\nOr, for i <= k < j:\n\t\narr[k] > arr[k + 1] when k is even, and\narr[k] < arr[k + 1] when k is odd.\n\n\n\n \nExample 1:\n\nInput: arr = [9,4,2,10,7,8,8,1,9]\nOutput: 5\nExplanation: arr[1] > arr[2] < arr[3] > arr[4] < arr[5]\n\nExample 2:\n\nInput: arr = [4,8,12,16]\nOutput: 2\n\nExample 3:\n\nInput: arr = [100]\nOutput: 1\n\n \nConstraints:\n\n1 <= arr.length <= 4 * 104\n0 <= arr[i] <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [9, 9]) == 1\n assert candidate(arr = [9, 4, 2, 10, 7, 8, 8, 1, 9]) == 5\n assert candidate(arr = [9, 8, 7, 6, 7, 8, 9, 8, 7, 6]) == 3\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2, 3]) == 8\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2, 1]) == 9\n assert candidate(arr = [9, 4, 2, 10, 7, 8, 7, 1, 9, 4, 2, 10, 7, 8, 8, 1, 9]) == 6\n assert candidate(arr = [10, 9, 4, 5, 4, 8, 9, 3, 5]) == 5\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0]) == 1\n assert candidate(arr = [1, 2, 2, 1, 2, 2, 1, 2, 2]) == 3\n assert candidate(arr = [2, 1, 2, 1, 2, 1, 2, 1, 2]) == 9\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1]) == 3\n assert candidate(arr = [0, 8, 45, 88, 48, 68, 28, 55, 17, 24]) == 8\n assert candidate(arr = [100]) == 1\n assert candidate(arr = [8, 8, 8, 8, 8, 8]) == 1\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 2\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 2, 1]) == 3\n assert candidate(arr = [4, 8, 12, 16]) == 2\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 10]) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 2\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8]) == 9\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 4, 6, 5]) == 9\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 1, 2, 3, 4, 3, 2, 1, 2, 1]) == 5\n assert candidate(arr = [1, 4, 5, 6, 7, 8, 9, 10, 8, 6, 4, 2, 1]) == 3\n assert candidate(arr = [9, 9, 9, 9, 9, 9, 9, 10]) == 2\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2]) == 8\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1]) == 3\n assert candidate(arr = [5, 3, 8, 6, 7, 4, 9, 2, 10, 1, 11, 0, 12, -1, 13, -2, 14, -3]) == 18\n assert candidate(arr = [5, 3, 8, 6, 10, 7, 12, 9, 14, 11, 16, 13, 18, 15]) == 14\n assert candidate(arr = [5, 3, 8, 1, 4, 7, 2, 6, 9, 0, 11]) == 5\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 3\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(arr = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 2\n assert candidate(arr = [1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1]) == 3\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [1, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11, 13, 12, 14, 13]) == 27\n assert candidate(arr = [3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4]) == 14\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(arr = [3, 8, 5, 11, 6, 10, 7, 12, 8, 14, 9, 15]) == 12\n assert candidate(arr = [1, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9]) == 19\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3]) == 3\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4]) == 3\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11]) == 21\n assert candidate(arr = [1, 2, 1, 2, 3, 2, 3, 2, 1, 2, 1, 2, 1, 2, 3, 2, 3, 2, 1, 2]) == 7\n assert candidate(arr = [10, 9, 8, 9, 10, 9, 8, 9, 10, 9, 8, 9, 10, 9, 8, 9, 10, 9, 8, 9, 10, 9, 8, 9, 10, 9, 8, 9]) == 3\n assert candidate(arr = [21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 2\n assert candidate(arr = [9, 8, 7, 6, 7, 8, 9, 8, 7, 6, 7, 8, 9, 8, 7, 6, 7, 8, 9, 8, 7, 6, 7, 8, 9]) == 3\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 5, 4, 3, 4, 5, 6]) == 3\n assert candidate(arr = [1, 2, 2, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5]) == 3\n assert candidate(arr = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 3, 4, 5, 4, 3, 2, 3, 4, 5, 4, 3, 2, 3, 4, 5, 4, 3, 2, 3, 4]) == 3\n assert candidate(arr = [10, 5, 15, 10, 20, 15, 25, 20, 30, 25, 35]) == 11\n assert candidate(arr = [8, 9, 6, 7, 4, 5, 2, 3, 0, 1, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1]) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 3\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 10, 9, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18]) == 21\n assert candidate(arr = [10, 1, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9]) == 20\n assert candidate(arr = [5, 3, 8, 10, 6, 5, 7, 9, 3, 1, 2, 4, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 3\n assert candidate(arr = [2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11]) == 19\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 29\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10]) == 3\n assert candidate(arr = [5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1]) == 20\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 2\n assert candidate(arr = [10, 9, 10, 8, 9, 7, 8, 6, 7, 5, 6, 4, 5, 6, 4, 3, 4, 2, 1]) == 13\n assert candidate(arr = [1, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3]) == 13\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4]) == 3\n assert candidate(arr = [2, 3, 1, 4, 2, 5, 3, 6, 4, 7, 5, 8, 6, 9, 7, 10, 8, 11, 9, 12]) == 20\n assert candidate(arr = [1, 3, 5, 7, 9, 8, 6, 4, 2, 0, 2, 4, 6, 8, 10, 9, 7, 5, 3, 1]) == 3\n assert candidate(arr = [5, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4]) == 3\n assert candidate(arr = [10, 9, 10, 8, 9, 7, 8, 6, 7, 5, 6, 4, 5, 3, 4, 2, 3, 1, 2, 0, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1]) == 21\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4]) == 3\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 4\n assert candidate(arr = [3, 8, 1, 6, 4, 9, 2, 7, 3, 8, 1, 6, 4, 9, 2, 7, 3, 8]) == 18\n assert candidate(arr = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16]) == 2\n assert candidate(arr = [3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1]) == 16\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1]) == 3\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 2\n assert candidate(arr = [1, 2, 2, 1, 2, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11, 13, 12, 14, 13, 15]) == 26\n assert candidate(arr = [3, 8, 6, 5, 10, 7, 1, 9, 2, 8, 5, 7, 6, 1, 5, 1, 4, 3]) == 8\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == 2\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(arr = [2, 4, 2, 6, 4, 8, 6, 10, 8, 12, 10, 14, 12, 16, 14, 18, 16]) == 17\n assert candidate(arr = [10, 9, 10, 8, 10, 7, 10, 6, 10, 5, 10, 4, 10, 3, 10, 2, 10, 1]) == 18\n assert candidate(arr = [100, 90, 100, 90, 100, 90, 100, 90, 100, 90, 100, 90, 100, 90, 100, 90]) == 16\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2]) == 3\n assert candidate(arr = [5, 8, 6, 7, 3, 4, 2, 3, 1, 4, 3, 2, 1, 5, 4, 3, 2, 1, 6, 5, 4, 3]) == 11\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 28\n assert candidate(arr = [5, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -3, -2, -1, 0, 1, 2, 3, 4]) == 3\n assert candidate(arr = [200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 2\n assert candidate(arr = [10, 20, 30, 25, 20, 15, 10, 5, 10, 15, 20, 25, 30, 25, 20, 15, 10]) == 3\n assert candidate(arr = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3]) == 20\n assert candidate(arr = [3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3]) == 4\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 2\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 2\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [1, 2, 1, 3, 2, 1, 4, 3, 2, 1, 5, 4, 3, 2]) == 5\n assert candidate(arr = [1, 3, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4]) == 4\n assert candidate(arr = [1, 7, 4, 9, 2, 8, 3, 10, 5, 11, 6]) == 11\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6]) == 3\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4]) == 3\n assert candidate(arr = [10, 20, 10, 30, 20, 40, 30, 50, 40, 60, 50]) == 11\n assert candidate(arr = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 11\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6]) == 3\n assert candidate(arr = [9, 3, 8, 3, 8, 3, 9, 3, 9, 3, 8, 3, 8]) == 13\n assert candidate(arr = [5, 8, 5, 10, 7, 12, 9, 14, 11, 16, 13, 18]) == 12\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81]) == 2\n assert candidate(arr = [10, 9, 10, 8, 9, 10, 8, 9, 10, 8, 9, 10, 8, 9, 10, 8, 9, 10, 8, 9]) == 5\n assert candidate(arr = [5, 1, 4, 1, 4, 1, 5, 1, 5, 1, 4]) == 11\n assert candidate(arr = [5, 6, 5, 7, 6, 5, 7, 6, 5, 7, 6, 5, 7, 6, 5, 7, 6, 5, 7, 6]) == 5\n assert candidate(arr = [5, 3, 1, 2, 4, 6, 8, 7, 9, 11, 13, 15, 14, 16, 18, 17, 19, 21, 23, 22, 24, 26, 25, 27, 29, 28, 30]) == 4\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 3\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [4, 5, 6, 1, 2, 3, 7, 8, 9, 2, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7, 8, 9]) == 4\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 2\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2]) == 3\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2]) == 3\n assert candidate(arr = [8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 4\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(arr = [8, 6, 10, 5, 9, 4, 12, 3, 13, 2, 14, 1]) == 12\n assert candidate(arr = [1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7, 6, 7, 8, 7, 8, 9, 8, 9, 10, 9, 10, 11, 10, 11, 12]) == 4\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1]) == 3\n assert candidate(arr = [2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11]) == 16\n assert candidate(arr = [8, 10, 6, 5, 7, 9, 3, 1, 2, 4, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6]) == 3\n assert candidate(arr = [9, 10, 8, 11, 7, 12, 6, 13, 5, 14, 4, 15, 3, 16, 2, 17, 1]) == 17\n assert candidate(arr = [10, 20, 10, 30, 20, 40, 30, 50, 40, 60, 50, 70, 60, 80, 70]) == 15\n assert candidate(arr = [1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3]) == 32\n assert candidate(arr = [5, 8, 6, 7, 4, 5, 3, 4, 2, 1, 4, 3, 5, 6, 4, 7]) == 9\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 30\n assert candidate(arr = [1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1]) == 2\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12]) == 20\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4]) == 3\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(arr = [3, 1, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10]) == 17\n assert candidate(arr = [10, 5, 15, 0, 10, 5, 15, 0, 10, 5, 15, 0, 10, 5, 15]) == 15\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11, 13, 12, 14, 13]) == 25\n assert candidate(arr = [5, 3, 1, 4, 2, 6, 4, 8, 6, 10, 8, 12, 10, 14, 12, 16, 14, 18, 16, 20, 18]) == 20\n assert candidate(arr = [2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2]) == 3\n assert candidate(arr = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3]) == 3\n assert candidate(arr = [1, 2, 3, 2, 1, 3, 4, 3, 2, 1, 3, 4, 5, 4, 3, 2, 1, 3, 4, 5, 6, 5, 4, 3, 2, 1, 3, 4]) == 3\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().maxTurbulenceSize", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxTurbulenceSize = function(arr) {", "container": null, "callable": "maxTurbulenceSize", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 979, "task_id": "distribute-coins-in-binary-tree", "difficulty": "Medium", "problem_description": "You are given the root of a binary tree with n nodes where each node in the tree has node.val coins. There are n coins in total throughout the whole tree.\nIn one move, we may choose two adjacent nodes and move one coin from one node to another. A move may be from parent to child, or from child to parent.\nReturn the minimum number of moves required to make every node have exactly one coin.\n \nExample 1:\n\n\nInput: root = [3,0,0]\nOutput: 2\nExplanation: From the root of the tree, we move one coin to its left child, and one coin to its right child.\n\nExample 2:\n\n\nInput: root = [0,3,0]\nOutput: 3\nExplanation: From the left child of the root, we move two coins to the root [taking two moves]. Then, we move one coin from the root of the tree to the right child.\n\n \nConstraints:\n\nThe number of nodes in the tree is n.\n1 <= n <= 100\n0 <= Node.val <= n\nThe sum of all Node.val is n.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([3, 0, 0])) == 2\n assert candidate(root = tree_node([0, 0, 0, 3, 0, 0, 4])) == 8\n assert candidate(root = tree_node([1, 0, 0, None, 3, 0, 0])) == 8\n assert candidate(root = tree_node([1, 0, 0, None, 3, 0, 0, None, 4])) == 17\n assert candidate(root = tree_node([1, 0, 2])) == 2\n assert candidate(root = tree_node([1, 0, 0, None, 3])) == 4\n assert candidate(root = tree_node([0, 0, 0, 3, 3])) == 8\n assert candidate(root = tree_node([0, 3, 0])) == 3\n assert candidate(root = tree_node([1, 0, 0, None, 3, 0, 2])) == 6\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 9])) == 25\n assert candidate(root = tree_node([2, 0, 1, 3, 0, 0, 0, None, None, None, 1])) == 7\n assert candidate(root = tree_node([0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 29\n assert candidate(root = tree_node([0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0])) == 29\n assert candidate(root = tree_node([1, 0, 0, 2, 0, 0, 1, None, 2, 0, 0, 0, 0, 1, 0])) == 22\n assert candidate(root = tree_node([1, 2, 2, 3, 3, 3, 3])) == 18\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 7])) == 16\n assert candidate(root = tree_node([4, 1, 1, 1, 1, 1, 1])) == 0\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9])) == 39\n assert candidate(root = tree_node([3, 0, 0, 1, 0, 0, 0, None, None, 2, 0, 0, 0, 0, 0])) == 22\n assert candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])) == 31\n assert candidate(root = tree_node([0, 3, 0, 0, 0, 2, 0, None, None, 0, 0, 0, 1])) == 12\n assert candidate(root = tree_node([2, 3, 3, None, None, None, 4, 0, 0, None, None, 5, 0, 0, None])) == 17\n assert candidate(root = tree_node([0, 1, 1, 2, 0, 0, 0, None, None, 0, 0, 1, 0, 0, 0])) == 21\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, 8, 9])) == 84\n assert candidate(root = tree_node([1, 0, 0, 0, 0, 2, 2, None, None, 0, 0, 0, 0, 1, 0])) == 17\n assert candidate(root = tree_node([0, 1, 0, 0, 3, 0, 0, None, None, None, 0, 0, 0, 0, 5])) == 17\n assert candidate(root = tree_node([5, 3, None, 3, None, 2, 1])) == 9\n assert candidate(root = tree_node([5, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 28\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 4, 0, 0, 3, 0, 0, 0, 0, 0])) == 23\n assert candidate(root = tree_node([2, 3, 0, 3, 0, None, 2, None, 0])) == 6\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 17\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, None, 8])) == 23\n assert candidate(root = tree_node([0, 0, 0, 3, 0, 0, 2, None, 0, 0, 0, 1])) == 13\n assert candidate(root = tree_node([5, 0, 0, 0, 4, 0, 0, None, None, 3, 0, 0, 0, 2, 0])) == 23\n assert candidate(root = tree_node([5, 2, 2, 1, 0, 0, 3, None, None, 0, 0, 0, 0])) == 14\n assert candidate(root = tree_node([0, 0, 3, 0, 0, 0, 0, None, 4])) == 8\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10])) == 42\n assert candidate(root = tree_node([1, 2, 2, None, 4, 1, 2, None, None, None, 1, None, None, 1, 2])) == 14\n assert candidate(root = tree_node([3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 31\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 0\n assert candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1])) == 28\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 0])) == 27\n assert candidate(root = tree_node([1, 0, 0, 0, 1, 0, 0, None, 3, 0, 0, 0, 0, 0, 2])) == 22\n assert candidate(root = tree_node([0, 2, 0, 0, 0, 3, 0, None, None, 0, 0, 0, 0, 0, 1])) == 17\n assert candidate(root = tree_node([0, 2, 0, 0, 0, 0, 7])) == 14\n assert candidate(root = tree_node([0, 0, 0, 4, 0, 0, 0, None, 0, 2, 0, 0, 0, 0, 2])) == 19\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().distributeCoins", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var distributeCoins = function(root) {", "container": null, "callable": "distributeCoins", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 980, "task_id": "unique-paths-iii", "difficulty": "Hard", "problem_description": "You are given an m x n integer array grid where grid[i][j] could be:\n\n1 representing the starting square. There is exactly one starting square.\n2 representing the ending square. There is exactly one ending square.\n0 representing empty squares we can walk over.\n-1 representing obstacles that we cannot walk over.\n\nReturn the number of 4-directional walks from the starting square to the ending square, that walk over every non-obstacle square exactly once.\n \nExample 1:\n\n\nInput: grid = [[1,0,0,0],[0,0,0,0],[0,0,2,-1]]\nOutput: 2\nExplanation: We have the following two paths: \n1. (0,0),(0,1),(0,2),(0,3),(1,3),(1,2),(1,1),(1,0),(2,0),(2,1),(2,2)\n2. (0,0),(1,0),(2,0),(2,1),(1,1),(0,1),(0,2),(0,3),(1,3),(1,2),(2,2)\n\nExample 2:\n\n\nInput: grid = [[1,0,0,0],[0,0,0,0],[0,0,0,2]]\nOutput: 4\nExplanation: We have the following four paths: \n1. (0,0),(0,1),(0,2),(0,3),(1,3),(1,2),(1,1),(1,0),(2,0),(2,1),(2,2),(2,3)\n2. (0,0),(0,1),(1,1),(1,0),(2,0),(2,1),(2,2),(1,2),(0,2),(0,3),(1,3),(2,3)\n3. (0,0),(1,0),(2,0),(2,1),(2,2),(1,2),(1,1),(0,1),(0,2),(0,3),(1,3),(2,3)\n4. (0,0),(1,0),(2,0),(2,1),(1,1),(0,1),(0,2),(0,3),(1,3),(1,2),(2,2),(2,3)\n\nExample 3:\n\n\nInput: grid = [[0,1],[2,0]]\nOutput: 0\nExplanation: There is no path that walks over every empty square exactly once.\nNote that the starting and ending square can be anywhere in the grid.\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m, n <= 20\n1 <= m * n <= 20\n-1 <= grid[i][j] <= 2\nThere is exactly one starting cell and one ending cell.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[0, 1], [2, 0]]) == 0\n assert candidate(grid = [[0, 0, 0], [1, 0, 0], [0, 2, -1]]) == 0\n assert candidate(grid = [[1, 0, -1, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 2], [-1, 0, 0], [0, 0, 0]]) == 0\n assert candidate(grid = [[0, 0, 1], [0, 0, 0], [2, 0, 0]]) == 2\n assert candidate(grid = [[1, 0, 0, 2], [-1, 0, -1, -1], [0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0], [0, 0, 0], [0, 0, 2]]) == 2\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 2, -1]]) == 2\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 2]]) == 4\n assert candidate(grid = [[1, 0], [0, 2]]) == 0\n assert candidate(grid = [[1, 0, -1], [0, 0, 0], [0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, -1, 0], [0, 0, 0, 0], [0, 0, 2, 0]]) == 0\n assert candidate(grid = [[1, 0, 2]]) == 1\n assert candidate(grid = [[1, 0, 0, 2]]) == 1\n assert candidate(grid = [[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 2, 0]]) == 0\n assert candidate(grid = [[1], [0], [0], [2]]) == 1\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, -1, -1, 0], [0, -1, 0, 0, 2], [0, 0, 0, -1, 0], [0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, -1, 0, -1, 0, -1], [0, 0, 0, 0, 0, 0], [0, -1, 0, -1, 0, -1], [0, 0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0, 0, 0], [0, -1, -1, -1, -1, 0, 0, 0], [0, 0, 0, -1, 0, 0, 0, 0], [0, -1, 0, -1, 0, -1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, -1, 0, 0], [0, 0, 0, 0, 0], [0, -1, -1, 0, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0], [-1, 0, 0, -1, 0], [0, 0, 0, 0, 0], [0, -1, 0, -1, 2]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, -1, -1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0], [0, -1, -1, -1, -1, 0], [0, 0, 0, -1, 0, 0], [0, 0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) == 104\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, -1, 0, -1, 0], [0, 0, 0, 0, 0], [0, -1, 0, -1, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 1], [0, 0, 0, 0, 0], [0, -1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 972\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -1, 0, 0], [0, 0, 0, -1, 2, -1, 0], [0, 0, 0, 0, -1, 0, 0]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, -1, 2, 0], [0, 0, 0, 0, 0, 0]]) == 272\n assert candidate(grid = [[1, 0, 0, -1, 0], [0, 0, 0, 0, 0], [0, -1, 0, -1, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0], [0, -1, 0, -1, 0, 0], [0, 0, 0, 0, 0, 2], [0, 0, 0, -1, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, -1, 2]]) == 1\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 0], [0, 0, 0, 0, 0, 0]]) == 378\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0], [0, 0, 0, -1, 0, 0], [0, 0, 0, 0, 0, 2]]) == 46\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) == 378\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, -1, 0], [0, 0, 0, 0, 0], [0, -1, -1, 0, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, -1, 0, -1, 0], [0, 0, 0, 0, 0], [0, -1, 2, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 2, -1, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [2, -1, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, -1, 0], [0, 0, 0, 0, 0], [0, -1, 0, 0, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, -1], [0, 0, -1, 0], [0, 0, 0, 2]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, -1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, -1, 0, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 1], [0, -1, -1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 2, 0, 0]]) == 3\n assert candidate(grid = [[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, 0, -1], [0, 0, 2, 0]]) == 0\n assert candidate(grid = [[1, -1, -1, -1, -1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) == 20\n assert candidate(grid = [[1, 0, 0, -1], [0, 0, 2, 0], [0, 0, -1, 0], [0, 0, 0, 0]]) == 0\n assert candidate(grid = [[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 2]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 0], [0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, -1, 0], [0, 0, 0, -1, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, -1, 0, -1, 0], [0, 0, 0, 0, 0], [0, -1, 0, -1, 0], [0, 0, 0, 0, 0], [0, -1, 0, -1, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 2]]) == 378\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, -1, -1, -1, -1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 2]]) == 68\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, -1, -1, 0, 0], [0, 0, 0, 0, 2, 0], [0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 1], [0, -1, -1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 2, 0, 0]]) == 11\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 2, -1, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 42\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, 0, 0], [0, -1, 0, -1, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, -1, 0, 0], [0, 0, 0, 0, 0], [0, -1, 2, -1, 0], [0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, -1, 0, -1, 0], [0, 0, 2, 0, 0], [0, -1, 0, -1, 0], [0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 2, 0], [0, 0, 0, -1, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, -1, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 2, 0]]) == 4\n assert candidate(grid = [[1, 0, -1, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, -1, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 2, 0]]) == 1\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, -1, 0], [0, 0, 0, 0], [0, 0, 0, 2]]) == 4\n assert candidate(grid = [[0, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 2, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0], [0, -1, 2, -1, 0, 0], [0, 0, 0, -1, 0, 0], [0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, -1, -1, -1, -1, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, -1, 0, 0], [0, 0, 0, 0, 0], [0, -1, 0, -1, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, -1], [0, 0, 0, 2]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, -1, -1, 0, 0], [0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, -1, -1, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, -1, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, -1, -1, -1, -1, 0], [0, 0, 0, 0, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 2]]) == 1670\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) == 48\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 0], [0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 2], [-1, 0, -1, 0, -1], [0, 0, 0, 0, 0], [0, -1, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [0, -1, 2, -1], [0, -1, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 2], [0, 0, -1, -1, 0], [0, -1, 0, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, 0, 2]]) == 0\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().uniquePathsIII", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var uniquePathsIII = function(grid) {", "container": null, "callable": "uniquePathsIII", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 982, "task_id": "triples-with-bitwise-and-equal-to-zero", "difficulty": "Hard", "problem_description": "Given an integer array nums, return the number of AND triples.\nAn AND triple is a triple of indices (i, j, k) such that:\n\n0 <= i < nums.length\n0 <= j < nums.length\n0 <= k < nums.length\nnums[i] & nums[j] & nums[k] == 0, where & represents the bitwise-AND operator.\n\n \nExample 1:\n\nInput: nums = [2,1,3]\nOutput: 12\nExplanation: We could choose the following i, j, k triples:\n(i=0, j=0, k=1) : 2 & 2 & 1\n(i=0, j=1, k=0) : 2 & 1 & 2\n(i=0, j=1, k=1) : 2 & 1 & 1\n(i=0, j=1, k=2) : 2 & 1 & 3\n(i=0, j=2, k=1) : 2 & 3 & 1\n(i=1, j=0, k=0) : 1 & 2 & 2\n(i=1, j=0, k=1) : 1 & 2 & 1\n(i=1, j=0, k=2) : 1 & 2 & 3\n(i=1, j=1, k=0) : 1 & 1 & 2\n(i=1, j=2, k=0) : 1 & 3 & 2\n(i=2, j=0, k=1) : 3 & 2 & 1\n(i=2, j=1, k=0) : 3 & 1 & 2\n\nExample 2:\n\nInput: nums = [0,0,0]\nOutput: 27\n\n \nConstraints:\n\n1 <= nums.length <= 1000\n0 <= nums[i] < 216\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [0, 0, 0]) == 27\n assert candidate(nums = [5, 3, 7, 10]) == 18\n assert candidate(nums = [15, 15, 15, 15]) == 0\n assert candidate(nums = [5, 3, 0, 1, 4]) == 91\n assert candidate(nums = [1, 2, 3, 4]) == 48\n assert candidate(nums = [5, 10, 15, 20]) == 30\n assert candidate(nums = [1, 0, 1, 0, 1, 0]) == 189\n assert candidate(nums = [1, 2, 4, 8]) == 60\n assert candidate(nums = [2, 1, 3]) == 12\n assert candidate(nums = [16, 32, 48, 64]) == 48\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]) == 0\n assert candidate(nums = [0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383]) == 631\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [255, 127, 63, 31, 15, 7, 3, 1, 0, 1, 3, 7, 15, 31, 63, 127, 255]) == 817\n assert candidate(nums = [1, 2, 4, 8, 16, 32]) == 210\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 258\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) == 990\n assert candidate(nums = [1023, 511, 255, 127, 63, 31, 15, 7, 3, 1, 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023]) == 1261\n assert candidate(nums = [255, 254, 253, 252, 251, 250, 249, 248]) == 0\n assert candidate(nums = [7, 14, 28, 56, 112, 224]) == 132\n assert candidate(nums = [1, 3, 7, 15, 31, 63, 127, 255]) == 0\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 16231\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1680\n assert candidate(nums = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]) == 0\n assert candidate(nums = [255, 128, 64, 32, 16, 8, 4, 2, 1, 0]) == 943\n assert candidate(nums = [128, 64, 32, 16, 8, 4, 2, 1, 255, 127, 63, 31, 15, 7, 3, 1, 0, 0, 0, 0]) == 6760\n assert candidate(nums = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15]) == 0\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 432\n assert candidate(nums = [17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79]) == 0\n assert candidate(nums = [8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128]) == 2400\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 1680\n assert candidate(nums = [15, 30, 45, 60, 75, 90, 105, 120, 135, 150]) == 180\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49, 56]) == 216\n assert candidate(nums = [65535, 32767, 16383, 8191, 4095, 2047, 1023, 511, 255, 127, 63, 31, 15, 7, 3, 1]) == 0\n assert candidate(nums = [13, 29, 17, 5, 23, 31, 47, 19, 2, 7, 11, 13, 17, 19, 23, 29, 31]) == 546\n assert candidate(nums = [8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096]) == 990\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [7, 14, 21, 28, 35]) == 30\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 220]) == 3036\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]) == 13830\n assert candidate(nums = [65535, 32767, 16383, 8191, 4095, 2047, 1023, 511, 255, 127]) == 0\n assert candidate(nums = [255, 127, 63, 31, 15, 7, 3, 1, 0]) == 217\n assert candidate(nums = [15, 240, 240, 15, 240, 15, 240, 15, 240]) == 540\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]) == 744\n assert candidate(nums = [16383, 8191, 4095, 2047, 1023, 511, 255, 127, 63, 31, 15, 7, 3, 1, 0]) == 631\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128]) == 504\n assert candidate(nums = [15, 7, 3, 1, 0, 31, 14, 6, 2, 0, 255, 127]) == 872\n assert candidate(nums = [8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192]) == 1320\n assert candidate(nums = [15, 20, 25, 30, 35, 40]) == 84\n assert candidate(nums = [15, 30, 45, 60, 75, 90, 105]) == 0\n assert candidate(nums = [512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144]) == 990\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384]) == 3360\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256]) == 720\n assert candidate(nums = [255, 128, 64, 32, 16, 8, 4, 2, 1]) == 672\n assert candidate(nums = [17, 34, 51, 68, 85, 102, 119, 136, 153, 170]) == 684\n assert candidate(nums = [255, 128, 64, 32, 16, 8, 4, 2, 1, 0, 255, 128, 64, 32, 16, 8]) == 3751\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 2401\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]) == 180\n assert candidate(nums = [1023, 511, 255, 127, 63, 31, 15, 7, 3, 1]) == 0\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1015\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == 0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 1440\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536]) == 4896\n assert candidate(nums = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768]) == 3360\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 5064\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 2401\n assert candidate(nums = [1, 5, 17, 85, 257, 681, 2049, 5121, 13633, 34609, 88417]) == 0\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128]) == 504\n assert candidate(nums = [255, 255, 255, 255, 255, 255, 255, 255, 255, 255]) == 0\n assert candidate(nums = [8, 4, 2, 1, 14, 7, 3, 1, 12, 6, 3, 1, 10, 5, 2, 1]) == 2868\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 3420\n assert candidate(nums = [1023, 511, 255, 127, 63, 31, 15, 7, 3, 1, 0]) == 331\n assert candidate(nums = [255, 127, 63, 31, 15, 7, 3, 1]) == 0\n assert candidate(nums = [1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047]) == 0\n assert candidate(nums = [8191, 4095, 2047, 1023, 511, 255, 127, 63, 31, 15, 7, 3, 1, 0]) == 547\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49, 56, 63]) == 240\n assert candidate(nums = [15, 240, 10, 100, 5, 60]) == 114\n assert candidate(nums = [85, 170, 51, 204, 68, 136, 34, 0, 255, 128, 64, 32, 16, 8, 4, 2, 1]) == 4285\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 432\n assert candidate(nums = [255, 192, 128, 64, 32, 16, 8, 4, 2, 1, 0, 255, 192]) == 1897\n assert candidate(nums = [13, 26, 39, 52, 65, 78, 91, 104, 117, 130, 143, 156, 169, 182, 195, 208]) == 1638\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80]) == 1998\n assert candidate(nums = [1023, 511, 255, 127, 63, 31, 15, 7, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 28791\n assert candidate(nums = [8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38]) == 2352\n assert candidate(nums = [21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845]) == 0\n assert candidate(nums = [255, 127, 63, 31, 15, 7, 3, 1, 0]) == 217\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(nums = [4095, 2047, 1023, 511, 255, 127, 63, 31, 15, 7, 3, 1, 0]) == 469\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().countTriplets", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var countTriplets = function(nums) {", "container": null, "callable": "countTriplets", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 983, "task_id": "minimum-cost-for-tickets", "difficulty": "Medium", "problem_description": "You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array days. Each day is an integer from 1 to 365.\nTrain tickets are sold in three different ways:\n\na 1-day pass is sold for costs[0] dollars,\na 7-day pass is sold for costs[1] dollars, and\na 30-day pass is sold for costs[2] dollars.\n\nThe passes allow that many days of consecutive travel.\n\nFor example, if we get a 7-day pass on day 2, then we can travel for 7 days: 2, 3, 4, 5, 6, 7, and 8.\n\nReturn the minimum number of dollars you need to travel every day in the given list of days.\n \nExample 1:\n\nInput: days = [1,4,6,7,8,20], costs = [2,7,15]\nOutput: 11\nExplanation: For example, here is one way to buy passes that lets you travel your travel plan:\nOn day 1, you bought a 1-day pass for costs[0] = $2, which covered day 1.\nOn day 3, you bought a 7-day pass for costs[1] = $7, which covered days 3, 4, ..., 9.\nOn day 20, you bought a 1-day pass for costs[0] = $2, which covered day 20.\nIn total, you spent $11 and covered all the days of your travel.\n\nExample 2:\n\nInput: days = [1,2,3,4,5,6,7,8,9,10,30,31], costs = [2,7,15]\nOutput: 17\nExplanation: For example, here is one way to buy passes that lets you travel your travel plan:\nOn day 1, you bought a 30-day pass for costs[2] = $15 which covered days 1, 2, ..., 30.\nOn day 31, you bought a 1-day pass for costs[0] = $2 which covered day 31.\nIn total, you spent $17 and covered all the days of your travel.\n\n \nConstraints:\n\n1 <= days.length <= 365\n1 <= days[i] <= 365\ndays is in strictly increasing order.\ncosts.length == 3\n1 <= costs[i] <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(days = [1, 50, 100, 200, 300, 365],costs = [5, 10, 20]) == 30\n assert candidate(days = [1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31],costs = [4, 12, 30]) == 34\n assert candidate(days = [1, 100, 200, 300, 365],costs = [2, 7, 15]) == 10\n assert candidate(days = [1, 2, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25],costs = [3, 8, 25]) == 25\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7],costs = [2, 7, 15]) == 7\n assert candidate(days = [1, 6, 8, 16, 17, 20, 24, 26, 27, 29, 30, 32, 33],costs = [1, 4, 9]) == 10\n assert candidate(days = [365],costs = [2, 7, 15]) == 2\n assert candidate(days = [5, 6, 7, 8, 9, 10, 31, 32, 33, 34, 35, 36],costs = [5, 10, 50]) == 20\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],costs = [1, 4, 20]) == 19\n assert candidate(days = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205, 215, 225, 235, 245, 255, 265, 275, 285, 295, 305, 315, 325, 335, 345, 355, 365],costs = [10, 30, 50]) == 370\n assert candidate(days = [1, 5, 8, 9, 10, 12, 13, 17, 18, 19, 20, 23, 25, 27],costs = [3, 13, 45]) == 38\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],costs = [5, 10, 15]) == 20\n assert candidate(days = [1, 5, 8, 10, 12, 16, 18, 21, 23, 25, 27, 30],costs = [3, 8, 16]) == 16\n assert candidate(days = [1, 100, 200, 300, 365],costs = [5, 10, 15]) == 25\n assert candidate(days = [1, 5, 9, 13, 17, 21, 25, 29, 33, 35],costs = [3, 10, 25]) == 30\n assert candidate(days = [3, 8, 9, 20, 23, 30, 33, 36, 40, 43],costs = [1, 8, 30]) == 10\n assert candidate(days = [1, 5, 8, 10, 14, 18, 21, 23, 25, 26, 27, 28, 30],costs = [4, 10, 29]) == 29\n assert candidate(days = [1, 5, 9, 14, 20, 25],costs = [1, 6, 10]) == 6\n assert candidate(days = [1, 4, 6, 7, 8, 20],costs = [2, 7, 15]) == 11\n assert candidate(days = [1],costs = [2, 7, 15]) == 2\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 30, 31],costs = [2, 7, 15]) == 17\n assert candidate(days = [1, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36],costs = [3, 9, 20]) == 29\n assert candidate(days = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 63, 95, 127, 159, 191, 223, 255, 287, 319, 351, 365],costs = [3, 7, 20]) == 56\n assert candidate(days = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200],costs = [1, 5, 10]) == 40\n assert candidate(days = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70],costs = [5, 20, 50]) == 120\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],costs = [1, 5, 15]) == 30\n assert candidate(days = [1, 4, 6, 9, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70],costs = [5, 20, 75]) == 80\n assert candidate(days = [1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 33, 34, 35, 40, 41, 42, 43, 48, 49, 50, 51, 56, 57, 58, 59],costs = [3, 15, 60]) == 93\n assert candidate(days = [1, 14, 28, 42, 56, 70, 84, 98, 112, 126, 140, 154, 168, 182, 196, 210, 224, 238, 252, 266, 280, 294, 308, 322, 336, 350, 364],costs = [7, 15, 35]) == 189\n assert candidate(days = [1, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36],costs = [2, 15, 40]) == 48\n assert candidate(days = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, 267, 269, 271, 273, 275, 277, 279, 281, 283, 285, 287, 289, 291, 293, 295, 297, 299, 301, 303, 305, 307, 309, 311, 313, 315, 317, 319, 321, 323, 325, 327, 329, 331, 333, 335, 337, 339, 341, 343, 345, 347, 349, 351, 353, 355, 357, 359, 361, 363, 365],costs = [1, 5, 10]) == 123\n assert candidate(days = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360],costs = [10, 30, 80]) == 360\n assert candidate(days = [1, 4, 8, 15, 22, 29, 36, 43, 50, 57, 64, 71, 78, 85, 92, 99, 106, 113, 120, 127, 134, 141, 148, 155, 162, 169, 176, 183, 190, 197, 204, 211, 218, 225, 232, 239, 246, 253, 260, 267, 274, 281, 288, 295, 302, 309, 316, 323, 330, 337, 344, 351, 358, 365],costs = [7, 40, 120]) == 378\n assert candidate(days = [1, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200, 204, 208, 212, 216, 220, 224, 228, 232, 236, 240, 244, 248, 252, 256, 260, 264, 268, 272, 276, 280, 284, 288, 292, 296, 300, 304, 308, 312, 316, 320, 324, 328, 332, 336, 340, 344, 348, 352, 356, 360, 364],costs = [2, 10, 30]) == 184\n assert candidate(days = [2, 5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 107, 113, 119, 125, 131, 137, 143, 149, 155, 161, 167, 173, 179, 185, 191, 197, 203, 209, 215, 221, 227, 233, 239, 245, 251, 257, 263, 269, 275, 281, 287, 293, 299, 305, 311, 317, 323, 329, 335, 341, 347, 353, 359, 365],costs = [3, 15, 60]) == 186\n assert candidate(days = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, 267, 269, 271, 273, 275, 277, 279, 281, 283, 285, 287, 289, 291, 293, 295, 297, 299, 301, 303, 305, 307, 309, 311, 313, 315, 317, 319, 321, 323, 325, 327, 329, 331, 333, 335, 337, 339, 341, 343, 345, 347, 349, 351, 353, 355, 357, 359, 361, 363, 365],costs = [1, 4, 12]) == 147\n assert candidate(days = [1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32, 34, 35, 37, 38, 40, 41, 43, 44, 46, 47, 49, 50, 52, 53, 55, 56, 58, 59, 61, 62, 64, 65, 67, 68, 70, 71, 73, 74, 76, 77, 79, 80, 82, 83, 85, 86, 88, 89, 91, 92, 94, 95, 97, 98, 100, 101, 103, 104, 106, 107, 109, 110, 112, 113, 115, 116, 118, 119, 121, 122, 124, 125, 127, 128, 130, 131, 133, 134, 136, 137, 139, 140, 142, 143, 145, 146, 148, 149, 151, 152, 154, 155, 157, 158, 160, 161, 163, 164, 166, 167, 169, 170, 172, 173, 175, 176, 178, 179, 181, 182, 184, 185, 187, 188, 190, 191, 193, 194, 196, 197, 199, 200, 202, 203, 205, 206, 208, 209, 211, 212, 214, 215, 217, 218, 220, 221, 223, 224, 226, 227, 229, 230, 232, 233, 235, 236, 238, 239, 241, 242, 244, 245, 247, 248, 250, 251, 253, 254, 256, 257, 259, 260, 262, 263, 265, 266, 268, 269, 271, 272, 274, 275, 277, 278, 280, 281, 283, 284, 286, 287, 289, 290, 292, 293, 295, 296, 298, 299, 301, 302, 304, 305, 307, 308, 310, 311, 313, 314, 316, 317, 319, 320, 322, 323, 325, 326, 328, 329, 331, 332, 334, 335, 337, 338, 340, 341, 343, 344, 346, 347, 349, 350, 352, 353, 355, 356, 358, 359, 361, 362, 364, 365],costs = [3, 9, 25]) == 309\n assert candidate(days = [1, 14, 28, 42, 56, 70, 84, 98, 112, 126, 140, 154, 168, 182, 196, 210, 224, 238, 252, 266, 280, 294, 308, 322, 336, 350, 364],costs = [4, 15, 40]) == 108\n assert candidate(days = [1, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, 364, 365],costs = [1, 5, 20]) == 183\n assert candidate(days = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360],costs = [5, 20, 60]) == 185\n assert candidate(days = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31],costs = [2, 5, 15]) == 17\n assert candidate(days = [2, 3, 4, 5, 6, 7, 14, 15, 16, 17, 18, 19, 20, 21, 28, 29, 30, 31, 32, 33, 34, 35, 36],costs = [3, 11, 25]) == 36\n assert candidate(days = [3, 4, 7, 9, 14, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260, 265, 270, 275, 280, 285, 290, 295, 300, 305, 310, 315, 320, 325, 330, 335, 340, 345, 350, 355, 360, 365],costs = [5, 25, 100]) == 375\n assert candidate(days = [1, 3, 4, 5, 6, 7, 15, 16, 17, 18, 19, 20, 30, 31, 32, 33, 34, 35, 36, 37],costs = [3, 8, 20]) == 27\n assert candidate(days = [1, 10, 20, 21, 22, 30, 31, 40, 50, 60, 70, 80, 90, 100],costs = [5, 15, 50]) == 70\n assert candidate(days = [1, 3, 4, 10, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36],costs = [4, 10, 20]) == 30\n assert candidate(days = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 365],costs = [5, 10, 15]) == 90\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],costs = [2, 7, 15]) == 15\n assert candidate(days = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 365],costs = [2, 5, 20]) == 53\n assert candidate(days = [1, 2, 3, 10, 11, 12, 20, 21, 22, 30, 31, 32, 40, 41, 42, 50, 51, 52, 60, 61, 62, 70, 71, 72, 80, 81, 82, 90, 91, 92, 100, 101, 102, 110, 111, 112, 120, 121, 122, 130, 131, 132, 140, 141, 142, 150, 151, 152, 160, 161, 162, 170, 171, 172, 180, 181, 182, 190, 191, 192, 200, 201, 202, 210, 211, 212, 220, 221, 222, 230, 231, 232, 240, 241, 242, 250, 251, 252, 260, 261, 262, 270, 271, 272, 280, 281, 282, 290, 291, 292, 300, 301, 302, 310, 311, 312, 320, 321, 322, 330, 331, 332, 340, 341, 342, 350, 351, 352, 360, 361, 362],costs = [2, 8, 20]) == 222\n assert candidate(days = [1, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45],costs = [4, 15, 30]) == 60\n assert candidate(days = [1, 8, 15, 22, 29, 36, 43, 50, 57, 64, 71, 78, 85, 92, 99, 106, 113, 120, 127, 134, 141, 148, 155, 162],costs = [3, 15, 50]) == 72\n assert candidate(days = [1, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],costs = [3, 10, 20]) == 33\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 14, 15, 16, 17, 18, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 35, 36],costs = [2, 9, 30]) == 39\n assert candidate(days = [1, 2, 4, 5, 6, 8, 9, 10, 12, 13, 14, 16, 17, 18, 20, 21, 22, 24, 25, 26, 28, 29, 30, 32, 33, 34, 36, 37, 38, 40, 41, 42, 44, 45, 46, 48, 49, 50, 52, 53, 54, 56, 57, 58, 60, 61, 62, 64, 65, 66, 68, 69, 70, 72, 73, 74, 76, 77, 78, 80, 81, 82, 84, 85, 86, 88, 89, 90, 92, 93, 94, 96, 97, 98, 100, 101, 102, 104, 105, 106, 108, 109, 110, 112, 113, 114, 116, 117, 118, 120, 121, 122, 124, 125, 126, 128, 129, 130, 132, 133, 134, 136, 137, 138, 140, 141, 142, 144, 145, 146, 148, 149, 150, 152, 153, 154, 156, 157, 158, 160, 161, 162, 164, 165, 166, 168, 169, 170, 172, 173, 174, 176, 177, 178, 180, 181, 182, 184, 185, 186, 188, 189, 190, 192, 193, 194, 196, 197, 198, 200, 201, 202, 204, 205, 206, 208, 209, 210, 212, 213, 214, 216, 217, 218, 220, 221, 222, 224, 225, 226, 228, 229, 230, 232, 233, 234, 236, 237, 238, 240, 241, 242, 244, 245, 246, 248, 249, 250, 252, 253, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 268, 269, 270, 272, 273, 274, 276, 277, 278, 280, 281, 282, 284, 285, 286, 288, 289, 290, 292, 293, 294, 296, 297, 298, 300, 301, 302, 304, 305, 306, 308, 309, 310, 312, 313, 314, 316, 317, 318, 320, 321, 322, 324, 325, 326, 328, 329, 330, 332, 333, 334, 336, 337, 338, 340, 341, 342, 344, 345, 346, 348, 349, 350, 352, 353, 354, 356, 357, 358, 360, 361, 362, 364, 365],costs = [4, 12, 40]) == 488\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36],costs = [1, 6, 12]) == 18\n assert candidate(days = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 237, 241, 245, 249, 253, 257, 261, 265, 269, 273, 277, 281, 285, 289, 293, 297, 301, 305, 309, 313, 317, 321, 325, 329, 333, 337, 341, 345, 349, 353, 357, 361, 365],costs = [1, 4, 10]) == 92\n assert candidate(days = [10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 30, 31, 32, 33, 34, 40, 41, 42, 43, 44, 50, 51, 52, 53, 54, 60, 61, 62, 63, 64, 70, 71, 72, 73, 74, 80, 81, 82, 83, 84, 90, 91, 92, 93, 94],costs = [4, 25, 90]) == 180\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80],costs = [4, 15, 30]) == 90\n assert candidate(days = [2, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150],costs = [3, 12, 45]) == 93\n assert candidate(days = [1, 2, 8, 9, 10, 16, 17, 18, 24, 25, 26, 32, 33, 34, 40, 41, 42, 48, 49, 50, 56, 57, 58, 64, 65, 66, 72, 73, 74, 80, 81, 82, 88, 89, 90, 96, 97, 98, 104, 105, 106, 112, 113, 114, 120, 121, 122, 128, 129, 130, 136, 137, 138, 144, 145, 146, 152, 153, 154, 160, 161, 162, 168, 169, 170, 176, 177, 178, 184, 185, 186, 192, 193, 194, 200, 201, 202, 208, 209, 210],costs = [2, 7, 25]) == 160\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],costs = [2, 10, 25]) == 50\n assert candidate(days = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205, 215, 225, 235, 245, 255, 265, 275, 285, 295, 305, 315, 325, 335, 345, 355, 365],costs = [6, 18, 50]) == 222\n assert candidate(days = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 365],costs = [6, 15, 30]) == 228\n assert candidate(days = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, 267, 269, 271, 273, 275, 277, 279, 281, 283, 285, 287, 289, 291, 293, 295, 297, 299, 301, 303, 305, 307, 309, 311, 313, 315, 317, 319, 321, 323, 325, 327, 329, 331, 333, 335, 337, 339, 341, 343, 345, 347, 349, 351, 353, 355, 357, 359, 361, 363, 365],costs = [1, 5, 10]) == 123\n assert candidate(days = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360],costs = [5, 20, 50]) == 185\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 14, 15, 16, 17, 18, 19, 20, 21, 28, 29, 30, 31, 32, 33, 34, 35, 36],costs = [1, 10, 30]) == 24\n assert candidate(days = [1, 3, 4, 6, 7, 9, 10, 11, 14, 15, 16, 17, 20, 21, 22, 23, 24, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39],costs = [4, 10, 25]) == 39\n assert candidate(days = [1, 5, 8, 10, 12, 16, 18, 21, 23, 25, 27, 30, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60],costs = [3, 10, 20]) == 40\n assert candidate(days = [1, 2, 3, 10, 11, 12, 13, 20, 21, 22, 23, 30, 31, 32, 33, 40, 41, 42, 43, 50, 51, 52, 53, 60],costs = [5, 12, 30]) == 60\n assert candidate(days = [1, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36],costs = [3, 10, 25]) == 34\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],costs = [3, 12, 30]) == 60\n assert candidate(days = [1, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255, 270, 285, 300, 315, 330, 345, 360, 365],costs = [5, 12, 30]) == 130\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],costs = [2, 7, 15]) == 17\n assert candidate(days = [1, 7, 14, 15, 16, 17, 21, 28, 29, 30, 31, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105],costs = [4, 20, 50]) == 88\n assert candidate(days = [1, 2, 5, 6, 7, 8, 9, 10, 14, 15, 16, 17, 18, 19, 23, 24, 25, 26, 27, 28, 29, 30, 31, 35, 36, 37, 38, 39, 40],costs = [2, 12, 40]) == 54\n assert candidate(days = [1, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210, 217, 224, 231, 238, 245, 252, 259, 266, 273, 280, 287, 294, 301, 308, 315, 322, 329, 336, 343, 350, 357, 364],costs = [5, 20, 50]) == 265\n assert candidate(days = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31],costs = [2, 8, 20]) == 22\n assert candidate(days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360],costs = [4, 10, 20]) == 68\n"}, "metadata": {"canonical_parameter_names": ["days", "costs"], "leetcode_dataset_entry_point": "Solution().mincostTickets", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var mincostTickets = function(days, costs) {", "container": null, "callable": "mincostTickets", "parameters": [{"name": "days", "type": "number[]"}, {"name": "costs", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 984, "task_id": "string-without-aaa-or-bbb", "difficulty": "Medium", "problem_description": "Given two integers a and b, return any string s such that:\n\ns has length a + b and contains exactly a 'a' letters, and exactly b 'b' letters,\nThe substring 'aaa' does not occur in s, and\nThe substring 'bbb' does not occur in s.\n\n \nExample 1:\n\nInput: a = 1, b = 2\nOutput: \"abb\"\nExplanation: \"abb\", \"bab\" and \"bba\" are all correct answers.\n\nExample 2:\n\nInput: a = 4, b = 1\nOutput: \"aabaa\"\n\n \nConstraints:\n\n0 <= a, b <= 100\nIt is guaranteed such an s exists for the given a and b.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(a = 0,b = 5) == \"bbbbb\"\n assert candidate(a = 10,b = 10) == \"abababababababababab\"\n assert candidate(a = 6,b = 4) == \"aabaababab\"\n assert candidate(a = 7,b = 7) == \"ababababababab\"\n assert candidate(a = 4,b = 1) == \"aabaa\"\n assert candidate(a = 7,b = 2) == \"aabaabaaa\"\n assert candidate(a = 4,b = 6) == \"bbabbaabab\"\n assert candidate(a = 1,b = 2) == \"bba\"\n assert candidate(a = 5,b = 5) == \"ababababab\"\n assert candidate(a = 5,b = 0) == \"aaaaa\"\n assert candidate(a = 0,b = 0) == \"\"\n assert candidate(a = 5,b = 2) == \"aabaaba\"\n assert candidate(a = 2,b = 2) == \"abab\"\n assert candidate(a = 2,b = 7) == \"bbabbabbb\"\n assert candidate(a = 3,b = 3) == \"ababab\"\n assert candidate(a = 33,b = 67) == \"bbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbab\"\n assert candidate(a = 15,b = 5) == \"aabaabaabaabaabaaaaa\"\n assert candidate(a = 30,b = 70) == \"bbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbbbbbbbbb\"\n assert candidate(a = 33,b = 34) == \"bbaabababababababababababababababababababababababababababababababab\"\n assert candidate(a = 30,b = 25) == \"aabaabaabaabaababababababababababababababababababababab\"\n assert candidate(a = 100,b = 100) == \"abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab\"\n assert candidate(a = 0,b = 100) == \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"\n assert candidate(a = 27,b = 3) == \"aabaabaabaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(a = 100,b = 0) == \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(a = 8,b = 1) == \"aabaaaaaa\"\n assert candidate(a = 1,b = 100) == \"bbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"\n assert candidate(a = 100,b = 1) == \"aabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(a = 30,b = 30) == \"abababababababababababababababababababababababababababababab\"\n assert candidate(a = 30,b = 10) == \"aabaabaabaabaabaabaabaabaabaabaaaaaaaaaa\"\n assert candidate(a = 20,b = 30) == \"bbabbabbabbabbabbabbabbabbabbaabababababababababab\"\n assert candidate(a = 25,b = 25) == \"ababababababababababababababababababababababababab\"\n assert candidate(a = 20,b = 20) == \"abababababababababababababababababababab\"\n assert candidate(a = 50,b = 51) == \"bbaababababababababababababababababababababababababababababababababababababababababababababababababab\"\n assert candidate(a = 33,b = 33) == \"ababababababababababababababababababababababababababababababababab\"\n assert candidate(a = 10,b = 90) == \"bbabbabbabbabbabbabbabbabbabbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"\n assert candidate(a = 15,b = 15) == \"ababababababababababababababab\"\n assert candidate(a = 85,b = 15) == \"aabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(a = 99,b = 1) == \"aabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(a = 45,b = 55) == \"bbabbabbabbabbabbabbabbabbabbaababababababababababababababababababababababababababababababababababab\"\n assert candidate(a = 1,b = 99) == \"bbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"\n assert candidate(a = 49,b = 1) == \"aabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(a = 35,b = 40) == \"bbabbabbabbabbaabababababababababababababababababababababababababababababab\"\n assert candidate(a = 70,b = 30) == \"aabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaaaaaaaaaa\"\n assert candidate(a = 7,b = 3) == \"aabaabaaba\"\n assert candidate(a = 25,b = 30) == \"bbabbabbabbabbaabababababababababababababababababababab\"\n assert candidate(a = 75,b = 25) == \"aabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(a = 34,b = 33) == \"aababababababababababababababababababababababababababababababababab\"\n assert candidate(a = 51,b = 50) == \"aabababababababababababababababababababababababababababababababababababababababababababababababababab\"\n assert candidate(a = 1,b = 49) == \"bbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"\n assert candidate(a = 90,b = 10) == \"aabaabaabaabaabaabaabaabaabaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(a = 80,b = 20) == \"aabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(a = 30,b = 20) == \"aabaabaabaabaabaabaabaabaabaababababababababababab\"\n assert candidate(a = 40,b = 60) == \"bbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbaabababababababababababababababababababab\"\n assert candidate(a = 50,b = 50) == \"abababababababababababababababababababababababababababababababababababababababababababababababababab\"\n assert candidate(a = 3,b = 7) == \"bbabbabbab\"\n assert candidate(a = 60,b = 40) == \"aabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaababababababababababababababababababababab\"\n assert candidate(a = 8,b = 25) == \"bbabbabbabbabbabbabbabbabbbbbbbbb\"\n assert candidate(a = 1,b = 8) == \"bbabbbbbb\"\n assert candidate(a = 20,b = 15) == \"aabaabaabaabaababababababababababab\"\n assert candidate(a = 15,b = 35) == \"bbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbbbb\"\n assert candidate(a = 25,b = 75) == \"bbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbbbbbbbbbbbbbbbbbbbbbbbb\"\n assert candidate(a = 3,b = 10) == \"bbabbabbabbbb\"\n assert candidate(a = 20,b = 80) == \"bbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"\n assert candidate(a = 55,b = 45) == \"aabaabaabaabaabaabaabaabaabaabababababababababababababababababababababababababababababababababababab\"\n"}, "metadata": {"canonical_parameter_names": ["a", "b"], "leetcode_dataset_entry_point": "Solution().strWithout3a3b", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var strWithout3a3b = function(a, b) {", "container": null, "callable": "strWithout3a3b", "parameters": [{"name": "a", "type": "number"}, {"name": "b", "type": "number"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 985, "task_id": "sum-of-even-numbers-after-queries", "difficulty": "Medium", "problem_description": "You are given an integer array nums and an array queries where queries[i] = [vali, indexi].\nFor each query i, first, apply nums[indexi] = nums[indexi] + vali, then print the sum of the even values of nums.\nReturn an integer array answer where answer[i] is the answer to the ith query.\n \nExample 1:\n\nInput: nums = [1,2,3,4], queries = [[1,0],[-3,1],[-4,0],[2,3]]\nOutput: [8,6,2,4]\nExplanation: At the beginning, the array is [1,2,3,4].\nAfter adding 1 to nums[0], the array is [2,2,3,4], and the sum of even values is 2 + 2 + 4 = 8.\nAfter adding -3 to nums[1], the array is [2,-1,3,4], and the sum of even values is 2 + 4 = 6.\nAfter adding -4 to nums[0], the array is [-2,-1,3,4], and the sum of even values is -2 + 4 = 2.\nAfter adding 2 to nums[3], the array is [-2,-1,3,6], and the sum of even values is -2 + 6 = 4.\n\nExample 2:\n\nInput: nums = [1], queries = [[4,0]]\nOutput: [0]\n\n \nConstraints:\n\n1 <= nums.length <= 104\n-104 <= nums[i] <= 104\n1 <= queries.length <= 104\n-104 <= vali <= 104\n0 <= indexi < nums.length\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [2, 4, 6, 8],queries = [[1, 0], [2, 1], [3, 2], [4, 3]]) == [18, 20, 14, 18]\n assert candidate(nums = [2, 4, 6, 8],queries = [[-2, 0], [2, 1], [-4, 2], [4, 3]]) == [18, 20, 16, 20]\n assert candidate(nums = [0, 0, 0, 0],queries = [[1, 0], [1, 1], [1, 2], [1, 3]]) == [0, 0, 0, 0]\n assert candidate(nums = [10, 20, 30, 40],queries = [[-10, 0], [-20, 1], [-30, 2], [-40, 3]]) == [90, 70, 40, 0]\n assert candidate(nums = [1, 2, 3, 4],queries = [[1, 0], [-3, 1], [-4, 0], [2, 3]]) == [8, 6, 2, 4]\n assert candidate(nums = [1],queries = [[4, 0]]) == [0]\n assert candidate(nums = [1, 3, 5, 7],queries = [[2, 0], [4, 1], [6, 2], [8, 3]]) == [0, 0, 0, 0]\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],queries = [[-1, 0], [-3, 1], [-5, 2], [-7, 3], [-9, 4], [-11, 5], [-13, 6], [-15, 7], [-17, 8], [-19, 9]]) == [108, 104, 98, 90, 80, 68, 54, 38, 20, 0]\n assert candidate(nums = [-1, -2, -3, -4, -5],queries = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4]]) == [-6, -4, -4, 0, 0]\n assert candidate(nums = [1, 3, 5, 7, 9, 11],queries = [[2, 0], [4, 1], [6, 2], [8, 3], [10, 4], [12, 5]]) == [0, 0, 0, 0, 0, 0]\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],queries = [[10, 0], [20, 1], [30, 2], [40, 3], [50, 4], [60, 5], [70, 6], [80, 7], [90, 8], [100, 9]]) == [560, 580, 610, 650, 700, 760, 830, 910, 1000, 1100]\n assert candidate(nums = [1, 3, 5, 7, 9],queries = [[2, 0], [4, 1], [6, 2], [8, 3], [10, 4], [2, 0], [4, 1], [6, 2], [8, 3], [10, 4]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],queries = [[-2, 0], [-4, 1], [-6, 2], [-8, 3], [-10, 4], [-12, 5], [-14, 6], [-16, 7], [-18, 8], [-20, 9]]) == [108, 104, 98, 90, 80, 68, 54, 38, 20, 0]\n assert candidate(nums = [5, 10, 15, 20, 25, 30],queries = [[5, 0], [-10, 1], [15, 2], [-20, 3], [25, 4], [-30, 5]]) == [70, 60, 90, 70, 120, 90]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],queries = [[1, 0], [-2, 1], [3, 2], [-4, 3], [5, 4], [-6, 5], [7, 6], [-8, 7], [9, 8], [-10, 9], [11, 10], [-12, 11], [13, 12], [-14, 13], [15, 14], [-16, 15], [17, 16], [-18, 17], [19, 18], [-20, 19]]) == [112, 110, 116, 112, 122, 116, 130, 122, 140, 130, 152, 140, 166, 152, 182, 166, 200, 182, 220, 200]\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1],queries = [[1, 0], [-1, 1], [2, 2], [-2, 3], [3, 4], [-3, 5], [4, 6], [-4, 7], [5, 8]]) == [30, 22, 22, 20, 28, 24, 24, 20, 26]\n assert candidate(nums = [0, -2, 4, -6, 8],queries = [[2, 0], [-4, 1], [6, 2], [-8, 3], [10, 4]]) == [6, 2, 8, 0, 10]\n assert candidate(nums = [0, 0, 0, 0, 0],queries = [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4]]) == [0, 0, 0, 0, 0]\n assert candidate(nums = [1, -1, 1, -1, 1, -1, 1, -1],queries = [[1, 0], [-1, 1], [1, 2], [-1, 3], [1, 4], [-1, 5], [1, 6], [-1, 7]]) == [2, 0, 2, 0, 2, 0, 2, 0]\n assert candidate(nums = [-1, -3, -5, -7, -9],queries = [[1, 0], [3, 1], [5, 2], [7, 3], [9, 4]]) == [0, 0, 0, 0, 0]\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],queries = [[-1, 0], [-2, 1], [-3, 2], [-4, 3], [-5, 4], [-6, 5], [-7, 6], [-8, 7], [-9, 8], [-10, 9]]) == [540, 538, 508, 504, 454, 448, 378, 370, 280, 270]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],queries = [[-1, 0], [1, 1], [-1, 2], [1, 3], [-1, 4], [1, 5], [-1, 6], [1, 7], [-1, 8], [1, 9]]) == [0, 2, 2, 4, 4, 6, 6, 8, 8, 10]\n assert candidate(nums = [0, 0, 0, 0, 0],queries = [[2, 0], [-2, 1], [3, 2], [-3, 3], [4, 4]]) == [2, 0, 0, 0, 4]\n assert candidate(nums = [5, 10, 15, 20, 25, 30],queries = [[-5, 0], [5, 1], [10, 2], [-10, 3], [15, 4], [-15, 5]]) == [60, 50, 50, 40, 80, 50]\n assert candidate(nums = [1, 1, 1, 1, 1],queries = [[2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [-2, 0], [-2, 1], [-2, 2], [-2, 3], [-2, 4]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],queries = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 8], [10, 9]]) == [20, 20, 18, 18, 14, 14, 8, 8, 0, 0]\n assert candidate(nums = [1, 3, 5, 7, 9],queries = [[2, 0], [4, 1], [6, 2], [8, 3], [10, 4]]) == [0, 0, 0, 0, 0]\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000],queries = [[-500, 0], [-1500, 1], [-2500, 2], [-3500, 3], [-4500, 4], [500, 0], [1500, 1], [2500, 2], [3500, 3], [4500, 4]]) == [14500, 13000, 10500, 7000, 2500, 3000, 4500, 7000, 10500, 15000]\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],queries = [[-10, 0], [-20, 1], [-30, 2], [-40, 3], [-50, 4], [-60, 5], [-70, 6], [-80, 7], [-90, 8], [-100, 9], [10, 0], [20, 1], [30, 2], [40, 3], [50, 4], [60, 5], [70, 6], [80, 7], [90, 8], [100, 9]]) == [5490, 5470, 5440, 5400, 5350, 5290, 5220, 5140, 5050, 4950, 4960, 4980, 5010, 5050, 5100, 5160, 5230, 5310, 5400, 5500]\n assert candidate(nums = [0, 0, 0, 0],queries = [[1, 0], [1, 1], [1, 2], [1, 3], [1, 0], [1, 1], [1, 2], [1, 3]]) == [0, 0, 0, 0, 2, 4, 6, 8]\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],queries = [[2, 0], [4, 1], [6, 2], [8, 3], [10, 4], [12, 5], [14, 6], [16, 7], [18, 8], [20, 9]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(nums = [-1, -2, -3, -4, -5, -6],queries = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5]]) == [-12, -10, -10, -6, -6, 0]\n assert candidate(nums = [100, 200, 300, 400, 500],queries = [[-50, 0], [-100, 1], [-150, 2], [-200, 3], [-250, 4], [50, 0], [100, 1], [150, 2], [200, 3], [250, 4]]) == [1450, 1350, 1200, 1000, 750, 800, 900, 1050, 1250, 1500]\n assert candidate(nums = [100, 200, 300, 400, 500],queries = [[-100, 0], [100, 1], [-200, 2], [200, 3], [-300, 4], [300, 0], [-400, 1], [400, 2], [-500, 3], [500, 4]]) == [1400, 1500, 1300, 1500, 1200, 1500, 1100, 1500, 1000, 1500]\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],queries = [[-1, 0], [-1, 1], [-1, 2], [-1, 3], [-1, 4], [-1, 5], [-1, 6], [-1, 7], [-1, 8], [-1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19]]) == [60, 60, 58, 56, 58, 60, 56, 52, 56, 60, 54, 48, 56, 64, 56, 48, 58, 68, 58, 48]\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10],queries = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 8], [10, 9], [11, 0], [12, 1], [13, 2], [14, 3], [15, 4], [16, 5], [17, 6], [18, 7], [19, 8], [20, 9]]) == [-30, -28, -28, -24, -24, -18, -18, -10, -10, 0, 0, 12, 12, 26, 26, 42, 42, 60, 60, 80]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],queries = [[-1, 0], [-2, 1], [-3, 2], [-4, 3], [-5, 4], [-6, 5], [-7, 6], [-8, 7], [-9, 8], [-10, 9]]) == [30, 28, 28, 24, 24, 18, 18, 10, 10, 0]\n assert candidate(nums = [1000, -1000, 2000, -2000],queries = [[500, 0], [-500, 1], [1000, 2], [-1000, 3]]) == [500, 0, 1000, 0]\n assert candidate(nums = [10000, -10000, 5000, -5000, 2500],queries = [[-10000, 0], [10000, 1], [-5000, 2], [5000, 3], [-2500, 4]]) == [-7500, 2500, -2500, 2500, 0]\n assert candidate(nums = [0, -1, -2, 3, 5, 7, 9, 11],queries = [[2, 0], [5, 1], [-3, 2], [4, 3], [-1, 4], [10, 5], [15, 6], [20, 7]]) == [0, 4, 6, 6, 10, 10, 34, 34]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],queries = [[-1, 0], [-2, 1], [-3, 2], [-4, 3], [-5, 4], [-6, 5], [-7, 6], [-8, 7], [-9, 8], [-10, 9], [1, 10], [2, 11], [3, 12], [4, 13], [5, 14], [6, 15], [7, 16], [8, 17], [9, 18], [10, 19]]) == [110, 108, 108, 104, 104, 98, 98, 90, 90, 80, 92, 94, 110, 114, 134, 140, 164, 172, 200, 210]\n assert candidate(nums = [0, 0, 0, 0],queries = [[1, 0], [2, 1], [3, 2], [4, 3]]) == [0, 2, 2, 6]\n assert candidate(nums = [1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009],queries = [[-1, 0], [-2, 1], [-3, 2], [-4, 3], [-5, 4], [-6, 5], [-7, 6], [-8, 7], [-9, 8], [-10, 9]]) == [4020, 4020, 3018, 3018, 2014, 2014, 1008, 1008, 0, 0]\n assert candidate(nums = [100, 200, 300, 400, 500],queries = [[-50, 0], [50, 1], [-100, 2], [100, 3], [-150, 4]]) == [1450, 1500, 1400, 1500, 1350]\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],queries = [[-1, 0], [-2, 1], [-3, 2], [-4, 3], [-5, 4], [-6, 5], [-7, 6], [-8, 7], [-9, 8], [-10, 9]]) == [108, 106, 100, 96, 86, 80, 66, 58, 40, 30]\n assert candidate(nums = [1000, -1000, 2000, -2000, 3000, -3000],queries = [[-500, 0], [500, 1], [-1000, 2], [1000, 3], [-1500, 4], [1500, 5]]) == [-500, 0, -1000, 0, -1500, 0]\n assert candidate(nums = [1000, 2000, 3000, 4000],queries = [[-500, 0], [-1500, 1], [2000, 2], [3500, 3]]) == [9500, 8000, 10000, 13500]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],queries = [[2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],queries = [[1, 0], [-1, 1], [2, 2], [-2, 3], [3, 4], [-3, 5], [4, 6], [-4, 7], [5, 8], [-5, 9]]) == [90, 80, 82, 80, 70, 60, 64, 60, 50, 40]\n assert candidate(nums = [5000, -5000, 5000, -5000],queries = [[10000, 0], [10000, 1], [10000, 2], [10000, 3]]) == [10000, 20000, 30000, 40000]\n assert candidate(nums = [10000, -10000, 10000, -10000],queries = [[10000, 0], [-10000, 1], [20000, 2], [-20000, 3], [5000, 0], [-5000, 1], [15000, 2], [-15000, 3]]) == [10000, 0, 20000, 0, 5000, 0, 15000, 0]\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000],queries = [[-2000, 0], [-3000, 1], [-4000, 2], [-5000, 3], [-6000, 4]]) == [13000, 10000, 6000, 1000, -5000]\n assert candidate(nums = [-1, -2, -3, -4, -5],queries = [[1, 0], [-1, 1], [2, 2], [-2, 3], [3, 4]]) == [-6, -4, -4, -6, -8]\n assert candidate(nums = [-9999, -9998, -9997, -9996, -9995],queries = [[-1, 0], [-2, 1], [-3, 2], [-4, 3], [-5, 4]]) == [-29994, -29996, -39996, -40000, -50000]\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],queries = [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9]]) == [6, 12, 18, 24, 30, 36, 42, 48, 54, 60]\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000],queries = [[-1000, 0], [-2000, 1], [-3000, 2], [-4000, 3], [-5000, 4]]) == [14000, 12000, 9000, 5000, 0]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],queries = [[-1, 0], [-2, 1], [-3, 2], [-4, 3], [-5, 4], [-6, 5], [-7, 6], [-8, 7], [-9, 8], [-10, 9], [1, 10], [2, 11], [3, 12], [4, 13], [5, 14], [6, 15], [7, 16], [8, 17], [9, 18], [10, 19]]) == [110, 108, 108, 104, 104, 98, 98, 90, 90, 80, 92, 94, 110, 114, 134, 140, 164, 172, 200, 210]\n assert candidate(nums = [100, -100, 200, -200, 300],queries = [[-50, 0], [50, 1], [-100, 2], [100, 3], [-150, 4]]) == [250, 300, 200, 300, 150]\n assert candidate(nums = [100, 200, 300, 400, 500, 600],queries = [[-100, 0], [-200, 1], [-300, 2], [-400, 3], [-500, 4], [-600, 5]]) == [2000, 1800, 1500, 1100, 600, 0]\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],queries = [[-1, 0], [1, 1], [-2, 2], [2, 3], [-3, 4], [3, 5], [-4, 6], [4, 7], [-5, 8], [5, 9]]) == [20, 22, 20, 20, 16, 24, 20, 20, 12, 26]\n assert candidate(nums = [9999, -9999, 9999, -9999, 9999],queries = [[10000, 0], [-10000, 1], [10000, 2], [-10000, 3], [10000, 4]]) == [0, 0, 0, 0, 0]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],queries = [[2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(nums = [9999, -9999, 9999, -9999, 9999],queries = [[10000, 0], [-10000, 1], [10000, 2], [-10000, 3], [10000, 4]]) == [0, 0, 0, 0, 0]\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15],queries = [[2, 0], [4, 1], [6, 2], [8, 3], [10, 4], [12, 5], [14, 6], [16, 7]]) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(nums = [5, 15, 25, 35, 45],queries = [[-5, 0], [10, 1], [-15, 2], [20, 3], [25, 4]]) == [0, 0, 10, 10, 80]\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],queries = [[-100, 0], [-200, 1], [-300, 2], [-400, 3], [-500, 4], [-600, 5], [-700, 6], [-800, 7], [-900, 8], [-1000, 9]]) == [5400, 5200, 4900, 4500, 4000, 3400, 2700, 1900, 1000, 0]\n assert candidate(nums = [5, 8, 12, 15, 20],queries = [[3, 1], [-5, 0], [10, 4], [7, 3]]) == [32, 32, 42, 64]\n assert candidate(nums = [1, 3, 5, 7, 9],queries = [[2, 0], [4, 1], [6, 2], [8, 3], [10, 4]]) == [0, 0, 0, 0, 0]\n assert candidate(nums = [9999, -9999, 9998, -9998],queries = [[1, 0], [-1, 1], [2, 2], [-2, 3]]) == [10000, 0, 2, 0]\n assert candidate(nums = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],queries = [[-100, 0], [-200, 1], [-300, 2], [-400, 3], [-500, 4], [-600, 5], [-700, 6], [-800, 7], [-900, 8], [-1000, 9]]) == [9900, 9700, 9400, 9000, 8500, 7900, 7200, 6400, 5500, 4500]\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0],queries = [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7]]) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(nums = [5, 15, 25, 35, 45],queries = [[2, 0], [4, 1], [6, 2], [8, 3], [10, 4]]) == [0, 0, 0, 0, 0]\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],queries = [[-1, 0], [-2, 1], [-3, 2], [-4, 3], [-5, 4], [-6, 5], [-7, 6], [-8, 7], [-9, 8], [-10, 9]]) == [108, 106, 100, 96, 86, 80, 66, 58, 40, 30]\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995],queries = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4]]) == [29994, 29996, 39996, 40000, 50000]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],queries = [[2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2, 15], [2, 16], [2, 17], [2, 18], [2, 19]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(nums = [1, 3, 5, 7, 9, 11],queries = [[2, 0], [4, 1], [6, 2], [8, 3], [10, 4], [12, 5]]) == [0, 0, 0, 0, 0, 0]\n assert candidate(nums = [0, -2, 4, -6, 8, -10],queries = [[1, 0], [-1, 1], [2, 2], [-2, 3], [3, 4], [-3, 5]]) == [-6, -4, -2, -4, -12, -2]\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],queries = [[-1, 0], [-2, 1], [-3, 2], [-4, 3], [-5, 4], [-6, 5], [-7, 6], [-8, 7], [-9, 8], [-10, 9]]) == [30, 28, 28, 24, 24, 18, 18, 10, 10, 0]\n assert candidate(nums = [100, 200, 300, 400, 500],queries = [[-100, 0], [-200, 1], [-300, 2], [-400, 3], [-500, 4]]) == [1400, 1200, 900, 500, 0]\n assert candidate(nums = [-10, 15, -20, 25, -30],queries = [[10, 0], [-15, 1], [20, 2], [-25, 3], [30, 4]]) == [-50, -50, -30, -30, 0]\n assert candidate(nums = [-2, -4, -6, -8, -10],queries = [[3, 0], [-5, 1], [7, 2], [-9, 3], [11, 4]]) == [-28, -24, -18, -10, 0]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1],queries = [[2, 0], [4, 1], [8, 2], [16, 3], [32, 4], [64, 5], [128, 6], [256, 7]]) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],queries = [[-5, 0], [-10, 1], [-15, 2], [-20, 3], [-25, 4], [-30, 5], [-35, 6], [-40, 7], [-45, 8], [-50, 9]]) == [150, 140, 140, 120, 120, 90, 90, 50, 50, 0]\n assert candidate(nums = [-1, -2, -3, -4],queries = [[1, 0], [-2, 1], [3, 2], [-4, 3]]) == [-6, -8, -8, -12]\n assert candidate(nums = [2, 3, 5, 7, 11],queries = [[4, 0], [6, 1], [8, 2], [10, 3], [12, 4], [14, 0], [-14, 1]]) == [6, 6, 6, 6, 6, 20, 20]\n assert candidate(nums = [100, 200, 300, 400, 500],queries = [[-50, 0], [100, 1], [-150, 2], [200, 3], [-250, 4]]) == [1450, 1550, 1400, 1600, 1350]\n assert candidate(nums = [5, 15, 25, 35, 45],queries = [[-5, 0], [10, 1], [15, 2], [20, 3], [25, 4]]) == [0, 0, 40, 40, 110]\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],queries = [[-2, 0], [-4, 1], [-6, 2], [-8, 3], [-10, 4], [-12, 5], [-14, 6], [-16, 7], [-18, 8], [-20, 9]]) == [108, 104, 98, 90, 80, 68, 54, 38, 20, 0]\n"}, "metadata": {"canonical_parameter_names": ["nums", "queries"], "leetcode_dataset_entry_point": "Solution().sumEvenAfterQueries", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sumEvenAfterQueries = function(nums, queries) {", "container": null, "callable": "sumEvenAfterQueries", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "queries", "type": "number[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 986, "task_id": "interval-list-intersections", "difficulty": "Medium", "problem_description": "You are given two lists of closed intervals, firstList and secondList, where firstList[i] = [starti, endi] and secondList[j] = [startj, endj]. Each list of intervals is pairwise disjoint and in sorted order.\nReturn the intersection of these two interval lists.\nA closed interval [a, b] (with a <= b) denotes the set of real numbers x with a <= x <= b.\nThe intersection of two closed intervals is a set of real numbers that are either empty or represented as a closed interval. For example, the intersection of [1, 3] and [2, 4] is [2, 3].\n \nExample 1:\n\n\nInput: firstList = [[0,2],[5,10],[13,23],[24,25]], secondList = [[1,5],[8,12],[15,24],[25,26]]\nOutput: [[1,2],[5,5],[8,10],[15,23],[24,24],[25,25]]\n\nExample 2:\n\nInput: firstList = [[1,3],[5,9]], secondList = []\nOutput: []\n\n \nConstraints:\n\n0 <= firstList.length, secondList.length <= 1000\nfirstList.length + secondList.length >= 1\n0 <= starti < endi <= 109\nendi < starti+1\n0 <= startj < endj <= 109 \nendj < startj+1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(firstList = [[1, 2], [3, 5], [6, 7]],secondList = [[2, 3], [5, 6]]) == [[2, 2], [3, 3], [5, 5], [6, 6]]\n assert candidate(firstList = [[1, 5]],secondList = [[2, 3]]) == [[2, 3]]\n assert candidate(firstList = [],secondList = [[1, 5], [8, 12]]) == []\n assert candidate(firstList = [[1, 5]],secondList = [[2, 3], [6, 7]]) == [[2, 3]]\n assert candidate(firstList = [[5, 10]],secondList = [[1, 5], [5, 10]]) == [[5, 5], [5, 10]]\n assert candidate(firstList = [[1, 3], [4, 5], [6, 7]],secondList = [[2, 3], [5, 6], [8, 9]]) == [[2, 3], [5, 5], [6, 6]]\n assert candidate(firstList = [[1, 2], [3, 4], [5, 6]],secondList = [[2, 3], [5, 7]]) == [[2, 2], [3, 3], [5, 6]]\n assert candidate(firstList = [[1, 10]],secondList = [[5, 5]]) == [[5, 5]]\n assert candidate(firstList = [[1, 3], [5, 9]],secondList = []) == []\n assert candidate(firstList = [[0, 2], [5, 10], [13, 23], [24, 25]],secondList = [[1, 5], [8, 12], [15, 24], [25, 26]]) == [[1, 2], [5, 5], [8, 10], [15, 23], [24, 24], [25, 25]]\n assert candidate(firstList = [],secondList = [[1, 5], [8, 12], [15, 24], [25, 26]]) == []\n assert candidate(firstList = [[0, 2]],secondList = [[1, 2]]) == [[1, 2]]\n assert candidate(firstList = [[1, 5], [10, 14]],secondList = [[3, 6], [7, 9]]) == [[3, 5]]\n assert candidate(firstList = [[1, 3], [3, 7], [8, 10]],secondList = [[2, 4], [6, 8], [10, 12]]) == [[2, 3], [3, 4], [6, 7], [8, 8], [10, 10]]\n assert candidate(firstList = [[5, 10], [15, 20], [25, 30]],secondList = [[3, 7], [12, 18], [23, 28]]) == [[5, 7], [15, 18], [25, 28]]\n assert candidate(firstList = [[1, 500000000], [500000001, 1000000000]],secondList = [[250000000, 750000000], [750000001, 1250000000]]) == [[250000000, 500000000], [500000001, 750000000], [750000001, 1000000000]]\n assert candidate(firstList = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],secondList = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6]]) == [[1, 2], [2, 2], [2, 3], [3, 3], [3, 4], [4, 4], [4, 5], [5, 5], [5, 6]]\n assert candidate(firstList = [[0, 5], [10, 15], [20, 25], [30, 35]],secondList = [[2, 7], [12, 17], [22, 27], [29, 34]]) == [[2, 5], [12, 15], [22, 25], [30, 34]]\n assert candidate(firstList = [[1, 3], [6, 9]],secondList = [[2, 5], [7, 10], [11, 15]]) == [[2, 3], [7, 9]]\n assert candidate(firstList = [[0, 5], [10, 15], [20, 25], [30, 35]],secondList = [[5, 10], [15, 20], [25, 30]]) == [[5, 5], [10, 10], [15, 15], [20, 20], [25, 25], [30, 30]]\n assert candidate(firstList = [[1, 2], [4, 8], [10, 15], [17, 22]],secondList = [[3, 5], [6, 10], [12, 18], [20, 25]]) == [[4, 5], [6, 8], [10, 10], [12, 15], [17, 18], [20, 22]]\n assert candidate(firstList = [[1, 2], [4, 5], [7, 8], [10, 11]],secondList = [[1, 2], [3, 4], [5, 6], [7, 8]]) == [[1, 2], [4, 4], [5, 5], [7, 8]]\n assert candidate(firstList = [[1, 5], [10, 15], [20, 25], [30, 35]],secondList = [[6, 10], [11, 20], [21, 30], [31, 35]]) == [[10, 10], [11, 15], [20, 20], [21, 25], [30, 30], [31, 35]]\n assert candidate(firstList = [[1, 3], [5, 7], [9, 11]],secondList = [[2, 4], [6, 8], [10, 12]]) == [[2, 3], [6, 7], [10, 11]]\n assert candidate(firstList = [[1, 2], [3, 4], [5, 6], [7, 8]],secondList = [[2, 3], [4, 5], [6, 7], [8, 9]]) == [[2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]\n assert candidate(firstList = [[1, 10], [20, 30], [40, 50], [60, 70]],secondList = [[15, 25], [35, 45], [55, 65], [65, 75]]) == [[20, 25], [40, 45], [60, 65], [65, 70]]\n assert candidate(firstList = [[1, 2], [3, 4], [5, 6]],secondList = [[1, 6], [3, 5], [5, 7]]) == [[1, 2], [3, 4], [5, 6], [5, 5], [5, 6]]\n assert candidate(firstList = [[0, 10], [20, 30], [40, 50], [60, 70]],secondList = [[10, 20], [30, 40], [50, 60], [70, 80]]) == [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70]]\n assert candidate(firstList = [[1, 10], [15, 20], [25, 30]],secondList = [[5, 12], [17, 22], [27, 32]]) == [[5, 10], [17, 20], [27, 30]]\n assert candidate(firstList = [[5, 10], [15, 20], [25, 30]],secondList = [[5, 10], [15, 20], [25, 30]]) == [[5, 10], [15, 20], [25, 30]]\n assert candidate(firstList = [[1, 3], [4, 7], [8, 10], [11, 13]],secondList = [[2, 4], [5, 6], [9, 12]]) == [[2, 3], [4, 4], [5, 6], [9, 10], [11, 12]]\n assert candidate(firstList = [[1, 2]],secondList = [[1, 2], [2, 3], [3, 4], [4, 5]]) == [[1, 2], [2, 2]]\n assert candidate(firstList = [[1, 1000000000]],secondList = [[500000000, 1000000000]]) == [[500000000, 1000000000]]\n assert candidate(firstList = [[0, 10], [20, 30], [40, 50]],secondList = [[15, 25], [35, 45], [55, 65]]) == [[20, 25], [40, 45]]\n assert candidate(firstList = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],secondList = [[1, 3], [3, 5], [5, 7]]) == [[1, 2], [2, 3], [3, 3], [3, 4], [4, 5], [5, 5], [5, 6]]\n assert candidate(firstList = [[1, 10]],secondList = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]\n assert candidate(firstList = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]],secondList = [[1, 5], [2, 4], [3, 3], [4, 4], [5, 5]]) == [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [5, 5]]\n assert candidate(firstList = [[1, 2], [4, 5], [7, 8], [10, 11]],secondList = [[2, 3], [5, 6], [8, 9], [11, 12]]) == [[2, 2], [5, 5], [8, 8], [11, 11]]\n assert candidate(firstList = [[1, 100], [200, 300], [400, 500]],secondList = [[50, 150], [250, 350], [450, 550]]) == [[50, 100], [250, 300], [450, 500]]\n assert candidate(firstList = [[1, 20], [25, 30], [35, 40]],secondList = [[5, 15], [20, 25], [30, 35]]) == [[5, 15], [20, 20], [25, 25], [30, 30], [35, 35]]\n assert candidate(firstList = [[1, 5], [10, 15], [20, 25], [30, 35]],secondList = [[5, 10], [15, 20], [25, 30], [35, 40]]) == [[5, 5], [10, 10], [15, 15], [20, 20], [25, 25], [30, 30], [35, 35]]\n assert candidate(firstList = [[1, 2]],secondList = [[1, 2], [2, 3], [3, 4]]) == [[1, 2], [2, 2]]\n assert candidate(firstList = [[1, 5], [10, 15], [20, 25], [30, 35]],secondList = [[0, 5], [10, 20], [25, 35]]) == [[1, 5], [10, 15], [20, 20], [25, 25], [30, 35]]\n assert candidate(firstList = [[1, 2], [2, 3], [3, 4]],secondList = [[1, 2], [2, 3], [3, 4]]) == [[1, 2], [2, 2], [2, 3], [3, 3], [3, 4]]\n assert candidate(firstList = [[1, 3], [3, 5], [5, 7], [7, 9]],secondList = [[2, 4], [4, 6], [6, 8], [8, 10]]) == [[2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]\n assert candidate(firstList = [[1, 10], [11, 20], [21, 30]],secondList = [[5, 15], [25, 35], [35, 45]]) == [[5, 10], [11, 15], [25, 30]]\n assert candidate(firstList = [[1, 3], [6, 9]],secondList = [[2, 5], [7, 10]]) == [[2, 3], [7, 9]]\n assert candidate(firstList = [[1, 2], [4, 5], [7, 8], [10, 11]],secondList = [[0, 1], [3, 4], [6, 7], [9, 10]]) == [[1, 1], [4, 4], [7, 7], [10, 10]]\n assert candidate(firstList = [[5, 10], [15, 20], [25, 30]],secondList = [[10, 15], [20, 25], [30, 35]]) == [[10, 10], [15, 15], [20, 20], [25, 25], [30, 30]]\n assert candidate(firstList = [[1, 15], [20, 25], [30, 35]],secondList = [[10, 18], [22, 27], [33, 38]]) == [[10, 15], [22, 25], [33, 35]]\n assert candidate(firstList = [[1, 50], [100, 150], [200, 250], [300, 350]],secondList = [[25, 75], [125, 175], [225, 275], [325, 375]]) == [[25, 50], [125, 150], [225, 250], [325, 350]]\n assert candidate(firstList = [[1, 2], [4, 6], [8, 10]],secondList = [[3, 5], [7, 9], [11, 13]]) == [[4, 5], [8, 9]]\n assert candidate(firstList = [[1, 3], [6, 9], [12, 15], [18, 21], [24, 27]],secondList = [[2, 4], [7, 10], [13, 16], [19, 22], [25, 28]]) == [[2, 3], [7, 9], [13, 15], [19, 21], [25, 27]]\n assert candidate(firstList = [[1, 5], [10, 15], [20, 25]],secondList = [[2, 6], [12, 18], [22, 27]]) == [[2, 5], [12, 15], [22, 25]]\n assert candidate(firstList = [[1, 3], [6, 9], [12, 15], [18, 21]],secondList = [[2, 4], [7, 10], [13, 17], [20, 23]]) == [[2, 3], [7, 9], [13, 15], [20, 21]]\n assert candidate(firstList = [[1, 2], [3, 4], [5, 6], [7, 8]],secondList = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8]]) == [[1, 1], [1, 2], [2, 2], [3, 3], [3, 4], [4, 4], [5, 5], [5, 6], [6, 6], [7, 7], [7, 8]]\n assert candidate(firstList = [[1, 1000000000]],secondList = [[500000000, 500000001]]) == [[500000000, 500000001]]\n assert candidate(firstList = [[1, 1], [2, 2], [3, 3]],secondList = [[1, 1], [2, 2], [3, 3]]) == [[1, 1], [2, 2], [3, 3]]\n assert candidate(firstList = [[1, 5], [6, 10], [11, 15], [16, 20]],secondList = [[2, 4], [7, 9], [12, 14], [17, 19]]) == [[2, 4], [7, 9], [12, 14], [17, 19]]\n assert candidate(firstList = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]],secondList = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]\n assert candidate(firstList = [[1, 3], [5, 7], [9, 11], [13, 15], [17, 19]],secondList = [[2, 4], [6, 8], [10, 12], [14, 16], [18, 20]]) == [[2, 3], [6, 7], [10, 11], [14, 15], [18, 19]]\n assert candidate(firstList = [[1, 5], [10, 15], [20, 25]],secondList = [[1, 5], [10, 15], [20, 25]]) == [[1, 5], [10, 15], [20, 25]]\n assert candidate(firstList = [[10, 15], [20, 25], [30, 35], [40, 45]],secondList = [[5, 10], [15, 20], [25, 30], [35, 40]]) == [[10, 10], [15, 15], [20, 20], [25, 25], [30, 30], [35, 35], [40, 40]]\n assert candidate(firstList = [[1, 5], [6, 10], [11, 15], [16, 20]],secondList = [[0, 2], [4, 6], [8, 12], [14, 18]]) == [[1, 2], [4, 5], [6, 6], [8, 10], [11, 12], [14, 15], [16, 18]]\n assert candidate(firstList = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],secondList = [[2, 3], [4, 5], [6, 7], [8, 9]]) == [[2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]\n assert candidate(firstList = [[1, 2], [4, 5], [7, 8], [10, 11]],secondList = [[2, 4], [5, 7], [8, 10], [11, 13]]) == [[2, 2], [4, 4], [5, 5], [7, 7], [8, 8], [10, 10], [11, 11]]\n assert candidate(firstList = [[1, 500], [600, 800], [900, 1000]],secondList = [[100, 300], [400, 650], [750, 950]]) == [[100, 300], [400, 500], [600, 650], [750, 800], [900, 950]]\n assert candidate(firstList = [[1, 2], [4, 5], [7, 8], [10, 11], [13, 14]],secondList = [[2, 3], [5, 6], [8, 9], [11, 12], [14, 15]]) == [[2, 2], [5, 5], [8, 8], [11, 11], [14, 14]]\n assert candidate(firstList = [[0, 100], [150, 200], [300, 350]],secondList = [[50, 120], [160, 180], [280, 330]]) == [[50, 100], [160, 180], [300, 330]]\n assert candidate(firstList = [[1, 3], [6, 9]],secondList = [[2, 5], [7, 10], [11, 13]]) == [[2, 3], [7, 9]]\n assert candidate(firstList = [[1, 3], [6, 9], [12, 15], [18, 21]],secondList = [[2, 4], [8, 10], [14, 17], [20, 22]]) == [[2, 3], [8, 9], [14, 15], [20, 21]]\n assert candidate(firstList = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],secondList = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]\n assert candidate(firstList = [[1, 1], [2, 2], [3, 3], [4, 4]],secondList = [[1, 1], [2, 2], [3, 3], [4, 4]]) == [[1, 1], [2, 2], [3, 3], [4, 4]]\n assert candidate(firstList = [[1, 2], [4, 6], [8, 10], [12, 14]],secondList = [[1, 1], [3, 5], [7, 9], [11, 13], [15, 16]]) == [[1, 1], [4, 5], [8, 9], [12, 13]]\n assert candidate(firstList = [[1, 20], [30, 40], [50, 60]],secondList = [[5, 15], [25, 35], [45, 55]]) == [[5, 15], [30, 35], [50, 55]]\n assert candidate(firstList = [[1, 3], [3, 5], [5, 7], [7, 9]],secondList = [[0, 2], [2, 4], [4, 6], [6, 8], [8, 10]]) == [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]\n assert candidate(firstList = [[1, 5], [10, 15], [20, 25]],secondList = [[2, 3], [8, 12], [18, 22]]) == [[2, 3], [10, 12], [20, 22]]\n assert candidate(firstList = [[5, 10], [15, 20], [25, 30]],secondList = [[3, 7], [12, 17], [22, 27]]) == [[5, 7], [15, 17], [25, 27]]\n assert candidate(firstList = [[1, 2], [2, 3], [3, 4], [4, 5]],secondList = [[1, 2]]) == [[1, 2]]\n assert candidate(firstList = [[1, 5], [5, 10]],secondList = [[3, 7], [8, 12]]) == [[3, 5], [5, 7], [8, 10]]\n assert candidate(firstList = [[10, 20], [30, 40], [50, 60]],secondList = [[5, 25], [35, 45], [55, 65]]) == [[10, 20], [35, 40], [55, 60]]\n assert candidate(firstList = [[1, 3], [6, 9], [11, 15], [20, 25]],secondList = [[2, 4], [8, 10], [16, 22], [23, 30]]) == [[2, 3], [8, 9], [20, 22], [23, 25]]\n assert candidate(firstList = [[0, 100], [200, 300], [400, 500]],secondList = [[50, 150], [250, 350], [450, 550]]) == [[50, 100], [250, 300], [450, 500]]\n assert candidate(firstList = [[1, 2], [3, 4], [5, 6], [7, 8]],secondList = [[1, 8]]) == [[1, 2], [3, 4], [5, 6], [7, 8]]\n assert candidate(firstList = [[2, 5], [11, 16], [21, 26], [31, 36]],secondList = [[3, 7], [13, 18], [23, 28], [33, 38]]) == [[3, 5], [13, 16], [23, 26], [33, 36]]\n assert candidate(firstList = [[1, 1000000000]],secondList = [[500000000, 600000000], [800000000, 900000000]]) == [[500000000, 600000000], [800000000, 900000000]]\n assert candidate(firstList = [[1, 5], [10, 15], [20, 25]],secondList = [[3, 7], [12, 18], [23, 29]]) == [[3, 5], [12, 15], [23, 25]]\n assert candidate(firstList = [[1, 10], [12, 20], [22, 30]],secondList = [[5, 15], [18, 25], [28, 35]]) == [[5, 10], [12, 15], [18, 20], [22, 25], [28, 30]]\n assert candidate(firstList = [[1, 1000000000]],secondList = [[500000000, 600000000]]) == [[500000000, 600000000]]\n assert candidate(firstList = [[1, 2], [2, 3], [3, 4]],secondList = [[1, 2]]) == [[1, 2]]\n assert candidate(firstList = [[1, 2], [4, 5], [7, 8]],secondList = [[3, 4], [5, 6], [7, 8], [9, 10]]) == [[4, 4], [5, 5], [7, 8]]\n assert candidate(firstList = [[1, 3], [4, 7], [8, 11], [14, 17]],secondList = [[2, 5], [6, 9], [10, 13], [15, 18]]) == [[2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [15, 17]]\n assert candidate(firstList = [[1, 50], [60, 110], [120, 170], [180, 230]],secondList = [[25, 75], [85, 135], [145, 195], [205, 255]]) == [[25, 50], [60, 75], [85, 110], [120, 135], [145, 170], [180, 195], [205, 230]]\n assert candidate(firstList = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],secondList = [[2, 3], [4, 5], [6, 7], [8, 9], [10, 11]]) == [[2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]\n assert candidate(firstList = [[5, 10], [15, 20], [25, 30], [35, 40]],secondList = [[1, 100], [50, 55], [60, 65], [70, 75]]) == [[5, 10], [15, 20], [25, 30], [35, 40]]\n assert candidate(firstList = [[1, 3], [6, 9], [12, 15]],secondList = [[2, 5], [7, 10], [13, 18]]) == [[2, 3], [7, 9], [13, 15]]\n assert candidate(firstList = [[0, 10], [20, 30], [40, 50]],secondList = [[5, 15], [25, 35], [45, 55]]) == [[5, 10], [25, 30], [45, 50]]\n assert candidate(firstList = [[1, 5], [10, 15], [20, 25]],secondList = [[5, 10], [15, 20], [25, 30]]) == [[5, 5], [10, 10], [15, 15], [20, 20], [25, 25]]\n assert candidate(firstList = [[1, 3], [4, 7], [8, 10], [11, 14]],secondList = [[2, 4], [6, 8], [10, 12], [13, 15]]) == [[2, 3], [4, 4], [6, 7], [8, 8], [10, 10], [11, 12], [13, 14]]\n assert candidate(firstList = [[1, 100]],secondList = [[50, 150], [200, 300]]) == [[50, 100]]\n assert candidate(firstList = [[100, 200], [300, 400], [500, 600]],secondList = [[150, 250], [350, 450], [550, 650]]) == [[150, 200], [350, 400], [550, 600]]\n assert candidate(firstList = [[1, 1000000000]],secondList = [[500000000, 1500000000]]) == [[500000000, 1000000000]]\n assert candidate(firstList = [[1, 10], [20, 30], [40, 50]],secondList = [[5, 15], [25, 35], [45, 55]]) == [[5, 10], [25, 30], [45, 50]]\n assert candidate(firstList = [[1, 10], [15, 20], [25, 30]],secondList = [[5, 15], [20, 25], [30, 35]]) == [[5, 10], [15, 15], [20, 20], [25, 25], [30, 30]]\n assert candidate(firstList = [[1, 2], [4, 6], [8, 10], [12, 14]],secondList = [[3, 5], [7, 9], [11, 13]]) == [[4, 5], [8, 9], [12, 13]]\n assert candidate(firstList = [[1, 2], [3, 4], [5, 6], [7, 8]],secondList = [[2, 3], [6, 7]]) == [[2, 2], [3, 3], [6, 6], [7, 7]]\n assert candidate(firstList = [[1, 10], [20, 30], [40, 50], [60, 70], [80, 90]],secondList = [[5, 15], [25, 35], [45, 55], [65, 75], [85, 95]]) == [[5, 10], [25, 30], [45, 50], [65, 70], [85, 90]]\n"}, "metadata": {"canonical_parameter_names": ["firstList", "secondList"], "leetcode_dataset_entry_point": "Solution().intervalIntersection", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var intervalIntersection = function(firstList, secondList) {", "container": null, "callable": "intervalIntersection", "parameters": [{"name": "firstList", "type": "number[][]"}, {"name": "secondList", "type": "number[][]"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 987, "task_id": "vertical-order-traversal-of-a-binary-tree", "difficulty": "Hard", "problem_description": "Given the root of a binary tree, calculate the vertical order traversal of the binary tree.\nFor each node at position (row, col), its left and right children will be at positions (row + 1, col - 1) and (row + 1, col + 1) respectively. The root of the tree is at (0, 0).\nThe vertical order traversal of a binary tree is a list of top-to-bottom orderings for each column index starting from the leftmost column and ending on the rightmost column. There may be multiple nodes in the same row and same column. In such a case, sort these nodes by their values.\nReturn the vertical order traversal of the binary tree.\n \nExample 1:\n\n\nInput: root = [3,9,20,null,null,15,7]\nOutput: [[9],[3,15],[20],[7]]\nExplanation:\nColumn -1: Only node 9 is in this column.\nColumn 0: Nodes 3 and 15 are in this column in that order from top to bottom.\nColumn 1: Only node 20 is in this column.\nColumn 2: Only node 7 is in this column.\nExample 2:\n\n\nInput: root = [1,2,3,4,5,6,7]\nOutput: [[4],[2],[1,5,6],[3],[7]]\nExplanation:\nColumn -2: Only node 4 is in this column.\nColumn -1: Only node 2 is in this column.\nColumn 0: Nodes 1, 5, and 6 are in this column.\n 1 is at the top, so it comes first.\n 5 and 6 are at the same position (2, 0), so we order them by their value, 5 before 6.\nColumn 1: Only node 3 is in this column.\nColumn 2: Only node 7 is in this column.\n\nExample 3:\n\n\nInput: root = [1,2,3,4,6,5,7]\nOutput: [[4],[2],[1,5,6],[3],[7]]\nExplanation:\nThis case is the exact same as example 2, but with nodes 5 and 6 swapped.\nNote that the solution remains the same since 5 and 6 are in the same location and should be ordered by their values.\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 1000].\n0 <= Node.val <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7])) == [[4], [2], [1, 5, 6], [3], [7]]\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, 6, 7])) == [[6], [5], [3, 7], [1, 3], [2], [9]]\n assert candidate(root = tree_node([0, 2, 1, 3, None, None, None, 4, 5, None, 7, 6, None, 10, 8, 11, 9])) == [[4, 10, 11], [3, 6, 7], [2, 5, 8, 9], [0], [1]]\n assert candidate(root = tree_node([1, 2, 3, 4, 6, 5, 7])) == [[4], [2], [1, 5, 6], [3], [7]]\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7])) == [[9], [3, 15], [20], [7]]\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, 2, None, 4, 8, 6, None, 10, 7])) == [[10], [2], [5, 7], [3, 4], [1, 3], [2, 6, 8], [9]]\n assert candidate(root = tree_node([0, 2, 1, 3, None, None, None, 4, 5])) == [[4], [3], [2, 5], [0], [1]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, 8, 9, 10, 11, 12, 13, 14, 15])) == [[4], [2, 14], [1, 5, 6, 10], [3, 8, 15], [7, 11, 12], [9], [13]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 8, None, None, 9, None, None, 10, None, None, 11, None, None, 12, None, None, 13, None, None, 14, None, None, 15])) == [[4, 11], [2, 8, 9], [1, 5, 6], [3], [7], [10, 13], [12, 14]]\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 13, 17, 23, 27, 33, 37, 2, 4, 6, 8, 12, 14, 16, 18, 22, 24, 26, 28, 32, 34, 36, 38])) == [[2], [3], [5, 4, 6, 12, 22], [10, 7, 13, 23], [20, 15, 25, 8, 14, 16, 24, 26, 32], [30, 17, 27, 33], [35, 18, 28, 34, 36], [37], [38]]\n assert candidate(root = tree_node([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5, None, None, None, None, 10])) == [[0, 10], [2, 3], [6, 4, 7], [8, 5], [9]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, 10, None, None, None, 11, None, None, None, None, 12, None, None, 13, None, None, 14, None, None, 15])) == [[11], [8], [4], [2, 9, 10, 13], [1, 5, 6, 12, 14], [3], [7]]\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, 1, None, None, 8])) == [[1], [2], [3], [5, 4], [6, 8], [7]]\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])) == [[7], [3], [1, 8, 9, 11], [0, 4, 5], [2, 10, 12, 13], [6], [14]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])) == [[32], [16], [8, 33, 34, 36, 40], [4, 17, 18, 20, 24], [2, 9, 10, 12, 35, 37, 38], [1, 5, 6, 19, 21, 22, 25, 26, 28], [3, 11, 13, 14, 39], [7, 23, 27, 29, 30], [15], [31]]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, 6, 4, 8, 11, 17])) == [[1], [3], [5, 4, 6], [10, 7], [15, 8, 11], [18], [17]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, 10, 11, 12, 13, None, None, 14, 15, None, 16, 17])) == [[17], [12], [8], [4, 13], [2, 9], [1, 5, 6, 14], [3, 10], [7, 15], [11], [16]]\n assert candidate(root = tree_node([0, None, 1, None, 2, None, 3, None, 4, None, 5, None, 6])) == [[0], [1], [2], [3], [4], [5], [6]]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20, None, None, None, None, None, None, None, None, 21])) == [[2], [1, 4], [3, 6], [5, 8], [7, 10], [9, 12], [11, 14], [13, 16], [15, 18], [17, 20], [19]]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 9])) == [[1], [3], [5, 6], [10, 7], [15, 9], [18]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, None, None, None, None, None, None, None, None, None, 21])) == [[16], [8], [4, 17, 18, 20], [2, 9, 10, 12], [1, 5, 6, 19], [3, 11, 13, 14], [7, 21], [15]]\n assert candidate(root = tree_node([3, 1, 4, 2, None, None, None, None, 5])) == [[2], [1, 5], [3], [4]]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 8, 16, 20, 14, 19])) == [[14], [1], [3, 19], [5, 6], [10, 7], [15, 8, 16], [18], [20]]\n assert candidate(root = tree_node([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5])) == [[0], [2, 3], [6, 4, 7], [8, 5], [9]]\n assert candidate(root = tree_node([5, 2, 7, 1, 4, 6, 9, 0, 3, 8, None, None, None, None, None, 10, 11])) == [[10], [0], [1, 11], [2, 3, 8], [5, 4, 6], [7], [9]]\n assert candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15])) == [[1], [2], [4, 3, 5, 9], [8, 6, 10], [12, 7, 11, 13], [14], [15]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, None, None, None, 14, None, 15, 16])) == [[8], [4], [2, 9, 10, 12], [1, 5, 6, 14, 15, 16], [3, 11, 13], [7]]\n assert candidate(root = tree_node([3, 1, 4, 0, 2, 2, None, -1])) == [[-1], [0], [1], [3, 2, 2], [4]]\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 13, 17, 23, 27, 32, 37, 2, 4, 6, 8, 12, 14, 16, 18, 22, 24, 26, 28, 31, 33, 36, 38])) == [[2], [3], [5, 4, 6, 12, 22], [10, 7, 13, 23], [20, 15, 25, 8, 14, 16, 24, 26, 31], [30, 17, 27, 32], [35, 18, 28, 33, 36], [37], [38]]\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, 12, None, 13, None, None, 16])) == [[9, 12], [3, 15, 16], [20, 13], [7]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, 12, 13, None, None, None, None, 14, 15, None, None, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == [[18], [4, 14], [2, 8, 10, 19, 20], [1, 5, 6, 15], [3, 9, 11, 12, 21, 22], [7, 16], [13, 23, 24], [17], [25]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 8, 9, 10, 11, None, None, None, 12, None, None, None, None, None, 13, 14, 15])) == [[15], [4, 12, 13], [2, 8, 9, 11], [1, 5, 6, 14], [3, 10], [7]]\n assert candidate(root = tree_node([0, 2, 1, 3, None, None, None, 4, 5, None, 7, 6, None, 10, 8, None, 11, 9])) == [[9], [4, 10], [3, 6, 7], [2, 5, 8, 11], [0], [1]]\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 7, 8, 9, None, 11, None, None, 14, 15])) == [[8], [4, 14], [2, 9], [1, 15], [3], [7], [11]]\n assert candidate(root = tree_node([3, 1, 4, 0, 2, 2, None])) == [[0], [1], [3, 2, 2], [4]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])) == [[16], [8], [4, 17, 18, 20, 24], [2, 9, 10, 12], [1, 5, 6, 19, 21, 22, 25, 26, 28], [3, 11, 13, 14], [7, 23, 27, 29, 30], [15], [31]]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18, 1, 4, 6, 8, 11, 13, 17, 19])) == [[1], [3], [5, 4, 6, 11], [10, 7, 12], [15, 8, 13, 17], [18], [19]]\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11])) == [[11], [10], [9], [8], [7], [6], [5], [4], [3], [2], [1]]\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, 6, 7, None, None, 8, 9, 10, 11, 12, 13, None, None, 14, 15, None, None, 16, 17])) == [[16], [12], [8, 17], [2, 6, 13, 14], [1, 4, 9, 10], [3, 7, 15], [5, 11]]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, None, 6, None, 7])) == [[2], [1, 4, 7], [3, 6], [5]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 8, None, None, 9, 10, 11, 12, None, None, None, None, 13, 14, 15, None, None, None, None, 16, 17])) == [[4], [2, 8, 9], [1, 5, 6, 13, 15], [3, 10, 11, 16, 17], [7, 14], [12]]\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, 1, None, None, 8, 9, 10])) == [[1], [2], [3], [5, 4], [6, 8, 9], [7], [10]]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6, 8, 11, 14, None, 12, 17, 19])) == [[17], [1], [3, 19], [5, 6, 11], [10, 7, 13], [15, 8, 14], [18], [12]]\n assert candidate(root = tree_node([2, 1, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == [[1], [2, 4], [3, 6], [5, 8], [7], [9]]\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, 6, None, 7, None, None, 8, 9, None, None, 10, 11])) == [[2], [1, 4, 5, 10], [3, 7, 8], [6, 11], [9]]\n assert candidate(root = tree_node([1, None, 3, 2, 4, None, None, 5, 6])) == [[1, 2], [3, 5], [4], [6]]\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, 6, 7, 8, 9, None, None, 10, 11, None, None, 12, 13, None, None, None, None, 14, 15])) == [[2, 6], [1, 4, 10], [3, 7, 8, 14], [5, 11, 12], [9, 15], [13]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == [[16], [8], [4, 17, 18, 20, 24], [2, 9, 10, 12], [1, 5, 6, 19, 21, 22, 25, 26, 28], [3, 11, 13, 14], [7, 23, 27, 29, 30], [15]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == [[16], [8], [4, 17, 18, 20], [2, 9, 10, 12], [1, 5, 6, 19], [3, 11, 13, 14], [7], [15]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, None, None, None, None, 8, 9])) == [[6], [4], [2, 7], [1, 5], [3]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == [[8], [4], [2, 9, 10, 12], [1, 5, 6], [3, 11, 13, 14], [7], [15]]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6])) == [[1], [3], [5, 6], [10, 7], [15], [18]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, 12, 13, None, None, 14, 15, 16, 17, 18, 19, 20])) == [[4, 16], [2, 8, 10], [1, 5, 6, 14, 17, 18, 20], [3, 9, 11, 12], [7, 15, 19], [13]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == [[16], [8], [4, 17, 18, 20, 24], [2, 9, 10, 12], [1, 5, 6, 19, 21, 22, 25], [3, 11, 13, 14], [7, 23], [15]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50])) == [[32], [16], [8, 33, 34, 36, 40, 48], [4, 17, 18, 20, 24], [2, 9, 10, 12, 35, 37, 38, 41, 42, 44, 49, 50], [1, 5, 6, 19, 21, 22, 25, 26, 28], [3, 11, 13, 14, 39, 43, 45, 46], [7, 23, 27, 29, 30], [15, 47], [31]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, 16, 17, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == [[8], [4, 16], [2, 9, 10, 12], [1, 5, 6, 17], [3, 11, 13, 14], [7], [15]]\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, 6, None, None, 7, None, None, 8, None, None, 9, None, None, 10, None, None, 11, None, None, 12, None, None, 13, None, None, 14, None, None, 15])) == [[4, 7], [2, 6, 8], [1], [3], [5]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, 16, 17, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])) == [[8], [4, 16], [2, 9, 10, 12], [1, 5, 6, 17], [3, 11, 13, 14], [7], [15]]\n assert candidate(root = tree_node([5, 2, 6, 1, 3, None, None, None, 4, 8, 7, None, None, None, None, None, None, None, 9])) == [[1], [2, 4, 8], [5, 3], [6, 7]]\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 8, 1, None, None, None, None, 9, 7, 10])) == [[7], [1], [2, 10], [3], [5, 4], [6], [8], [9]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, 8, 9, 10, 11])) == [[4], [2, 8], [1, 5, 6], [3, 9, 10], [7], [11]]\n assert candidate(root = tree_node([3, 1, 4, 0, 2, 2, None, None, None, None, None, 5])) == [[0], [1, 5], [3, 2, 2], [4]]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7])) == [[1], [2], [3], [4], [5], [6], [7]]\n assert candidate(root = tree_node([3, 1, 4, 0, 2, 2, None, 5, None, None, 3, None, None, None, 6])) == [[5], [0, 6], [1], [3, 2, 2], [4, 3]]\n assert candidate(root = tree_node([5, 1, 4, None, None, 3, 6])) == [[1], [5, 3], [4], [6]]\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, 7, None, None, 8, 9, None, 10, 11, None, None, 12, None, None, 13])) == [[10], [7, 13], [4, 11], [2], [1, 5, 12], [3, 8, 9], [6]]\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == [[15], [7], [3, 16, 17, 19], [1, 8, 9, 11], [0, 4, 5, 18, 20], [2, 10, 12, 13], [6], [14]]\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, 1, None, None, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17])) == [[11], [1], [2, 12], [3], [5, 4, 13, 15], [6, 8, 9], [7, 14, 16, 17], [10]]\n assert candidate(root = tree_node([1, 2, None, 4, 5, 6, 7, None, 8, None, 9, 10, 11, None, None, None, None, None, 12, 13, None, None, None, None, 14, 15])) == [[6], [4, 9, 10], [2, 7, 12, 13, 15], [1, 5, 11, 14], [8]]\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, None, 1, None, None, None, 7, 8])) == [[7], [1], [2, 8], [3], [5, 4], [6]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, 10, None, None, 11, None, 12, None, 13])) == [[12], [8], [4, 13], [2, 9], [1, 5, 6], [3, 10, 11], [7]]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6])) == [[1], [3], [5, 6], [10, 7, 13], [15], [18]]\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == [[2], [1, 4], [3, 6], [5, 8], [7], [9]]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 9, 14])) == [[1], [3], [5, 6], [10, 7], [15, 9, 14], [18]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32])) == [[32], [16], [8], [4, 17, 18, 20, 24], [2, 9, 10, 12], [1, 5, 6, 19, 21, 22, 25, 26, 28], [3, 11, 13, 14], [7, 23, 27, 29, 30], [15], [31]]\n assert candidate(root = tree_node([3, 1, 4, None, 2, None, 5, None, None, 6, 7, 8, 9])) == [[1], [3, 2, 8], [4, 6], [5, 9], [7]]\n assert candidate(root = tree_node([314, 6, 8, 3, 5, 7, 9, 2, 4, None, None, 6, 8, 10, 12, None, None, None, None, None, 7])) == [[2], [3], [6, 4, 6], [314, 5, 7, 7], [8, 8, 10], [9], [12]]\n assert candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13, None])) == [[1], [3, 4], [8, 6], [10, 7, 13], [14]]\n assert candidate(root = tree_node([1, 2, 3, None, None, None, 4, None, 5, None, None, None, None, None, 6, None, None, None, None, None, 7])) == [[2], [1], [3], [4], [5]]\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12])) == [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14])) == [[14], [4, 11, 12], [2, 8, 9], [1, 5, 6, 13], [3, 10], [7]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 8, None, None, 9, None, None, 10, None, None, 11, None, None, 12, None, None, 13])) == [[4, 11], [2, 8, 9], [1, 5, 6], [3], [7], [10, 13], [12]]\n assert candidate(root = tree_node([5, 2, 6, 1, 3, None, None, 0, None, None, None, None, 7, 8, 9])) == [[0, 8], [1, 7], [2, 9], [5, 3], [6]]\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, 1, None, None, 8, 9, None, None, 10, None, None, 11])) == [[1], [2, 10], [3], [5, 4, 11], [6, 8, 9], [7]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, 16, 17, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 18])) == [[8], [4, 16], [2, 9, 10, 12], [1, 5, 6, 17], [3, 11, 13, 14], [7], [15]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, None, None, None, 14])) == [[8], [4], [2, 9, 10, 12], [1, 5, 6, 14], [3, 11, 13], [7]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, None, None, None, 14, 15])) == [[8], [4, 15], [2, 9, 10, 12], [1, 5, 6, 14], [3, 11, 13], [7]]\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 12, 20, 1, 4, 6, 8, 11, 13, 18, 25])) == [[1], [3], [5, 4, 6, 11], [10, 7, 12], [15, 8, 13, 18], [20], [25]]\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, 10, None, None, 11, None, None, 12, None, None, 13, None, None, 14, None, None, 15])) == [[8], [4, 12], [2, 9, 15], [1, 5, 6, 13], [3, 10, 11], [7, 14]]\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().verticalTraversal", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var verticalTraversal = function(root) {", "container": null, "callable": "verticalTraversal", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 988, "task_id": "smallest-string-starting-from-leaf", "difficulty": "Medium", "problem_description": "You are given the root of a binary tree where each node has a value in the range [0, 25] representing the letters 'a' to 'z'.\nReturn the lexicographically smallest string that starts at a leaf of this tree and ends at the root.\nAs a reminder, any shorter prefix of a string is lexicographically smaller.\n\nFor example, \"ab\" is lexicographically smaller than \"aba\".\n\nA leaf of a node is a node that has no children.\n \nExample 1:\n\n\nInput: root = [0,1,2,3,4,3,4]\nOutput: \"dba\"\n\nExample 2:\n\n\nInput: root = [25,1,3,1,3,0,2]\nOutput: \"adz\"\n\nExample 3:\n\n\nInput: root = [2,2,1,null,1,0,null,0]\nOutput: \"abc\"\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 8500].\n0 <= Node.val <= 25\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 3, 4])) == \"dba\"\n assert candidate(root = tree_node([2, 2, 1, None, 1, 0, None, 0])) == \"abc\"\n assert candidate(root = tree_node([25, 1, 3, 1, 3, 0, 2])) == \"adz\"\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14])) == \"onmlkjihgfedcb\"\n assert candidate(root = tree_node([25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0])) == \"anuxz\"\n assert candidate(root = tree_node([1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2])) == \"aaaaab\"\n assert candidate(root = tree_node([0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2])) == \"abaca\"\n assert candidate(root = tree_node([12, 11, 14, 10, 13, 13, 15, 9, 12, 12, 14, 14, 16, 8, 11, 11, 13, 13, 15, 15, 17, 7, 10, 10, 12, 12, 14, 14, 16, 16, 18])) == \"honlm\"\n assert candidate(root = tree_node([4, 2, 5, 1, 3, None, 6, 0, None, None, 7, None, None, 8, None, None, 9])) == \"gfe\"\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])) == \"fdba\"\n assert candidate(root = tree_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])) == \"fffff\"\n assert candidate(root = tree_node([4, 2, 6, 1, 3, 5, 7, None, None, None, None, None, None, None, None])) == \"bce\"\n assert candidate(root = tree_node([12, 11, 13, 10, None, 14, None, 9, None, 15, None, 8, None, 16, None, 7, None, 17, None, 6, None, 18, None, 5, None, 19, None, 4, None, 20, None, 3, None, 21, None, 2, None, 22, None, 1, None, 23, None, 0, None, 24, None, 25])) == \"yxwvutsrqponm\"\n assert candidate(root = tree_node([12, 11, 13, 10, 14, 9, 15, 8, 16, 7, 17, 6, 18, 5, 19, 4, 20, 3, 21, 2, 22, 1, 23, 0, 24, 25])) == \"agjnm\"\n assert candidate(root = tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1, None, None, None, 9])) == \"beif\"\n assert candidate(root = tree_node([25, 1, 3, 1, 3, 0, 2, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24])) == \"ahbbz\"\n assert candidate(root = tree_node([1, 0, 2, 0, 0, 0, 3, 0, 0, None, 0, 0, 0, 0, None, 0, 0, 0, 0, None, 0, 0, 0, 0, None, 0, 0, 0, 0, None, 0, 0, 0, 0, None])) == \"aaaaab\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])) == \"ngdb\"\n assert candidate(root = tree_node([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == \"aaaba\"\n assert candidate(root = tree_node([0, 1, 2, None, 3, None, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20, None, 21, None, 22, None, 23, None, 24, None, 25])) == \"ca\"\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, None, None, None, None, None, None, None, None, None, None, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0])) == \"awsheba\"\n assert candidate(root = tree_node([25, 1, 3, 1, 3, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == \"lcdz\"\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, None, 0, None, 1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20, None, 21, None, 22, None, 23, None, 24, None, 25])) == \"mykdca\"\n assert candidate(root = tree_node([0, 25, 1, 24, 2, 23, 3, 22, 4, 21, 5, 20, 6, 19, 7, 18, 8, 17, 9, 16, 10, 15, 11, 14, 12, 13, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])) == \"hdba\"\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, None, None, 5, 6, None, None, 8, 9, None, None, 10, 11, None, None, None, None, None, None, 12, 13, None, None, None, None, None, 14, 15])) == \"fhud\"\n assert candidate(root = tree_node([25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11])) == \"ltxz\"\n assert candidate(root = tree_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, None, None, None, None, None, None, None, None, None, None, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == \"ftbgjk\"\n assert candidate(root = tree_node([1, 0, 2, 0, 0, 0, 3, 0, 0, None, 0, 0, 0, 0, None])) == \"aaab\"\n assert candidate(root = tree_node([7, 3, 15, 2, 5, 12, 18, None, 4, 6, None, 10, 14, 16, 19, None, None, None, None, None, 8, None, None, None, None, None, 9, 11, 13, None, None, 17])) == \"ecdh\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, None, None, None])) == \"iecb\"\n assert candidate(root = tree_node([13, 7, 18, 3, 9, None, 20, 1, None, 5, 10, None, None, None, None, 2, 6, 8, 11, None, None, 12, None, 14, None, 15])) == \"bdhn\"\n assert candidate(root = tree_node([13, 12, 14, 11, 15, 10, 16, 9, 17, 8, 18, 7, 19, 6, 20, 5, 21, 4, 22, 3, 23, 2, 24, 1, 25, 0])) == \"atkon\"\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, None, None, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9])) == \"angca\"\n assert candidate(root = tree_node([7, 15, 10, 2, 20, 7, 13, None, 8, None, None, 2, 12, None, None, None, None, 4, 6, 5, 11, None, None, None, None, None, None, None, None, 3, None, None, None, None, None])) == \"echkh\"\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, None, None, 6, 9])) == \"dfk\"\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0])) == \"azmfca\"\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == \"alrhcpud\"\n assert candidate(root = tree_node([10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, 25, 21, 24, 22, 23])) == \"afmjk\"\n assert candidate(root = tree_node([12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12])) == \"mmmm\"\n assert candidate(root = tree_node([0, 1, 2, None, None, None, None, None, None, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == \"ba\"\n assert candidate(root = tree_node([0, 2, 1, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == \"igeba\"\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4])) == \"dddba\"\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == \"meca\"\n assert candidate(root = tree_node([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])) == \"aaaaa\"\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == \"aangdb\"\n assert candidate(root = tree_node([25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24])) == \"anuxz\"\n assert candidate(root = tree_node([3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == \"aaacd\"\n assert candidate(root = tree_node([0, 1, 2, None, None, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])) == \"ba\"\n assert candidate(root = tree_node([25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])) == \"anuxz\"\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == \"aaaaaa\"\n assert candidate(root = tree_node([25, 1, 3, 1, 3, 0, 2, 25, 1, 3, 0, 2, 25, 1, 3, 0, 2, 25, 1, 3, 0, 2, 25, 1, 3, 0, 2, 25, 1, 3, 0, 2])) == \"adcdz\"\n assert candidate(root = tree_node([10, 9, 10, 8, 9, 9, 10, 7, 8, 8, 9, 9, 10, 6, 7, 7, 8, 8, 9, 9, 10, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10])) == \"aegjjjk\"\n assert candidate(root = tree_node([10, 9, 11, 8, 10, 10, 12, 7, 9, 9, 11, 11, 13, 6, 8, 8, 10, 10, 12, 12, 14, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18])) == \"cngmlk\"\n assert candidate(root = tree_node([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3])) == \"dddddd\"\n assert candidate(root = tree_node([15, 14, 16, 13, 15, 15, 17, 12, 14, 14, 16, 16, 18, 11, 13, 13, 15, 15, 17, 17, 19, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 21, 23])) == \"hslrqp\"\n assert candidate(root = tree_node([7, 6, 8, 5, 7, 7, 9, 4, 6, 6, 8, 8, 10, 3, 5, 5, 7, 7, 9, 9, 11, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14])) == \"acihgh\"\n assert candidate(root = tree_node([25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, None, None, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0])) == \"azmtxz\"\n assert candidate(root = tree_node([13, 12, 14, 11, 13, 13, 15, 10, 12, 12, 14, 14, 16, 9, 11, 11, 13, 13, 15, 15, 17, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 21, 23, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 21, 23, 23, 25, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26])) == \"akppmlmn\"\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == \"ngca\"\n assert candidate(root = tree_node([25, 1, 3, 1, 3, 0, 2, 25, 1, 3, 0, 2, 25, 1, 3, 0, 2, 25, 1, 3, 0, 2, 25, 1, 3, 0, 2])) == \"addbz\"\n assert candidate(root = tree_node([0, 1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20, None, 21, None, 22, None, 23, None, 24, None, 25])) == \"zyxwvutsrqponmlkjihgfedcba\"\n assert candidate(root = tree_node([1, 0, 2, 2, 1, 1, 2, 0, 0, 2, 0, 1, 2, 1, 2, 0, 0, 1, 2, 0, 1, 2, 1, 0, 2, 1, 0, 1, 0, 2, 1])) == \"aacab\"\n assert candidate(root = tree_node([1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2])) == \"aaaab\"\n assert candidate(root = tree_node([20, 19, 21, 18, 22, 17, 23, 16, 24, 15, 25, 14, 26, 13, 27, 12, 28, 11, 29, 10, 30, 9, 31, 8, 32, 7, 33, 6, 34, 5, 35, 4, 36, 3, 37, 2, 38, 1, 39, 0])) == \"akpwtu\"\n assert candidate(root = tree_node([0, 25, 1, 24, 2, 23, 3, 22, 4, 21, 5, 20, 6, 19, 7, 18, 8, 17, 9, 16, 10, 15, 11, 14, 12, 13])) == \"hdba\"\n assert candidate(root = tree_node([3, 2, 4, 1, 5, 3, 6, 0, None, None, None, None, None, None, 7])) == \"abcd\"\n assert candidate(root = tree_node([5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, 24, 11, 23, 12, 22, 13, 21, 14, 20, 15, 19, 16, 18, 17])) == \"lcgf\"\n assert candidate(root = tree_node([2, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == \"aaabc\"\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, 1, 2, None, None, 4, 8, None, None, None, None, 5, 6])) == \"cpud\"\n assert candidate(root = tree_node([5, 4, 8, 3, 6, 7, 9, None, None, 2, None, None, None, None, None, None, None, 0])) == \"cgef\"\n assert candidate(root = tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1])) == \"beif\"\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().smallestFromLeaf", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var smallestFromLeaf = function(root) {", "container": null, "callable": "smallestFromLeaf", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 989, "task_id": "add-to-array-form-of-integer", "difficulty": "Easy", "problem_description": "The array-form of an integer num is an array representing its digits in left to right order.\n\nFor example, for num = 1321, the array form is [1,3,2,1].\n\nGiven num, the array-form of an integer, and an integer k, return the array-form of the integer num + k.\n \nExample 1:\n\nInput: num = [1,2,0,0], k = 34\nOutput: [1,2,3,4]\nExplanation: 1200 + 34 = 1234\n\nExample 2:\n\nInput: num = [2,7,4], k = 181\nOutput: [4,5,5]\nExplanation: 274 + 181 = 455\n\nExample 3:\n\nInput: num = [2,1,5], k = 806\nOutput: [1,0,2,1]\nExplanation: 215 + 806 = 1021\n\n \nConstraints:\n\n1 <= num.length <= 104\n0 <= num[i] <= 9\nnum does not contain any leading zeros except for the zero itself.\n1 <= k <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(num = [1],k = 9) == [1, 0]\n assert candidate(num = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 1) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\n assert candidate(num = [0],k = 10000) == [1, 0, 0, 0, 0]\n assert candidate(num = [2, 1, 5],k = 806) == [1, 0, 2, 1]\n assert candidate(num = [1, 2, 3, 4],k = 6789) == [8, 0, 2, 3]\n assert candidate(num = [9, 9, 9, 9],k = 1) == [1, 0, 0, 0, 0]\n assert candidate(num = [0],k = 23) == [2, 3]\n assert candidate(num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0],k = 987654321) == [2, 2, 2, 2, 2, 2, 2, 2, 1, 1]\n assert candidate(num = [5, 6, 7],k = 456) == [1, 0, 2, 3]\n assert candidate(num = [0],k = 256) == [2, 5, 6]\n assert candidate(num = [2, 7, 4],k = 181) == [4, 5, 5]\n assert candidate(num = [1, 2, 0, 0],k = 34) == [1, 2, 3, 4]\n assert candidate(num = [9, 9, 9],k = 1000) == [1, 9, 9, 9]\n assert candidate(num = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 55555555555555555555555555555555555555555555555) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(num = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],k = 123456789) == [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]\n assert candidate(num = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 1) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\n assert candidate(num = [2, 4, 6, 8, 0, 2, 4, 6, 8, 0],k = 1357913579) == [3, 8, 2, 5, 9, 3, 8, 2, 5, 9]\n assert candidate(num = [1, 0, 0, 0, 0],k = 99999) == [1, 0, 9, 9, 9, 9]\n assert candidate(num = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10000000000000000000) == [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(num = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 1) == [9, 8, 7, 6, 5, 4, 3, 2, 2]\n assert candidate(num = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 1) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\n assert candidate(num = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 909090909) == [1, 9, 1, 9, 1, 9, 1, 9, 1, 9]\n assert candidate(num = [1, 2, 3, 4, 5, 6, 7, 8, 9],k = 987654321) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(num = [5, 6, 7, 8, 9],k = 98765) == [1, 5, 5, 5, 5, 4]\n assert candidate(num = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 1) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(num = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 1) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(num = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 88888888888888888889) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(num = [9, 0, 0, 0, 0, 0, 0, 0, 0, 9],k = 9999999999) == [1, 9, 0, 0, 0, 0, 0, 0, 0, 0, 8]\n assert candidate(num = [5, 0, 0, 5],k = 5005) == [1, 0, 0, 1, 0]\n assert candidate(num = [2, 4, 6, 8, 0, 2, 4, 6, 8, 0],k = 987654321) == [3, 4, 5, 5, 6, 7, 9, 0, 0, 1]\n assert candidate(num = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 10000000000) == [1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]\n assert candidate(num = [0, 0, 0, 1],k = 9999) == [1, 0, 0, 0, 0]\n assert candidate(num = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 9999999999) == [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]\n assert candidate(num = [5, 4, 3, 2, 1],k = 123456789) == [1, 2, 3, 5, 1, 1, 1, 1, 0]\n assert candidate(num = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 555555555) == [6, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(num = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1111111111) == [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]\n assert candidate(num = [1, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 1) == [2, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(num = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],k = 1234567890123456789) == [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]\n assert candidate(num = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 1) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(num = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 9090909090) == [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]\n assert candidate(num = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 50000000000000000000) == [1, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]\n assert candidate(num = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 5) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 5]\n assert candidate(num = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1],k = 999999999) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(num = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 0]\n assert candidate(num = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 9999999999) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(num = [1, 3, 5, 7, 9, 1, 3, 5, 7, 9],k = 9753197531) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(num = [9, 9, 9, 9, 9],k = 9999) == [1, 0, 9, 9, 9, 8]\n assert candidate(num = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4],k = 5432109876) == [1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0]\n assert candidate(num = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 987654321) == [1, 9, 7, 5, 3, 0, 8, 6, 4, 2]\n assert candidate(num = [5, 0, 5, 0, 5, 0, 5],k = 5050505) == [1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(num = [5],k = 5) == [1, 0]\n assert candidate(num = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 4444444444) == [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]\n assert candidate(num = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 1) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\n assert candidate(num = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 10000000000) == [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(num = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 9999999999) == [1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8]\n assert candidate(num = [5, 6, 7, 8, 9],k = 43210) == [9, 9, 9, 9, 9]\n assert candidate(num = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 99999999999999999999999999999999999999999999999) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]\n assert candidate(num = [8, 6, 4, 2, 0, 8, 6, 4, 2, 0],k = 123456789) == [8, 7, 6, 5, 5, 4, 3, 2, 0, 9]\n assert candidate(num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0],k = 9876543210) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]\n assert candidate(num = [9, 9, 9, 9, 9, 9, 9, 9],k = 1) == [1, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(num = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 1) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 1]\n assert candidate(num = [0],k = 1000000000) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(num = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 8888888888) == [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]\n assert candidate(num = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 2) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\n assert candidate(num = [9, 9, 9, 9, 9],k = 99999) == [1, 9, 9, 9, 9, 8]\n assert candidate(num = [9],k = 9999) == [1, 0, 0, 0, 8]\n assert candidate(num = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 999999999) == [1, 9, 9, 9, 9, 9, 9, 9, 9, 9]\n assert candidate(num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0],k = 123456789) == [1, 3, 5, 8, 0, 2, 4, 6, 7, 9]\n assert candidate(num = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 99999999999999999999) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(num = [9, 0, 9, 0, 9, 0, 9, 0, 9, 0],k = 123456789) == [9, 2, 1, 4, 3, 6, 5, 8, 7, 9]\n assert candidate(num = [0, 0, 0, 0],k = 123456789) == [1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(num = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],k = 10987654321) == [2, 0, 8, 6, 4, 1, 9, 7, 5, 3, 1]\n assert candidate(num = [9, 0, 9, 0, 9, 0, 9],k = 99999999) == [1, 0, 9, 0, 9, 0, 9, 0, 8]\n assert candidate(num = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 123456789) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(num = [0, 0, 0, 0],k = 9999) == [9, 9, 9, 9]\n"}, "metadata": {"canonical_parameter_names": ["num", "k"], "leetcode_dataset_entry_point": "Solution().addToArrayForm", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var addToArrayForm = function(num, k) {", "container": null, "callable": "addToArrayForm", "parameters": [{"name": "num", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 990, "task_id": "satisfiability-of-equality-equations", "difficulty": "Medium", "problem_description": "You are given an array of strings equations that represent relationships between variables where each string equations[i] is of length 4 and takes one of two different forms: \"xi==yi\" or \"xi!=yi\".Here, xi and yi are lowercase letters (not necessarily different) that represent one-letter variable names.\nReturn true if it is possible to assign integers to variable names so as to satisfy all the given equations, or false otherwise.\n \nExample 1:\n\nInput: equations = [\"a==b\",\"b!=a\"]\nOutput: false\nExplanation: If we assign say, a = 1 and b = 1, then the first equation is satisfied, but not the second.\nThere is no way to assign the variables to satisfy both equations.\n\nExample 2:\n\nInput: equations = [\"b==a\",\"a==b\"]\nOutput: true\nExplanation: We could assign a = 1 and b = 1 to satisfy both equations.\n\n \nConstraints:\n\n1 <= equations.length <= 500\nequations[i].length == 4\nequations[i][0] is a lowercase letter.\nequations[i][1] is either '=' or '!'.\nequations[i][2] is '='.\nequations[i][3] is a lowercase letter.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(equations = ['a!=a']) == False\n assert candidate(equations = ['a==b', 'c==d', 'e==f', 'g==h']) == True\n assert candidate(equations = ['c==c', 'b==d', 'x!=z']) == True\n assert candidate(equations = ['a==b', 'b==c', 'a!=c']) == False\n assert candidate(equations = ['a==a', 'b==b', 'c==c']) == True\n assert candidate(equations = ['a==b', 'b!=a', 'a==c', 'c==b']) == False\n assert candidate(equations = ['a!=b', 'b!=c', 'c!=a']) == True\n assert candidate(equations = ['a!=b', 'b!=c', 'a!=c']) == True\n assert candidate(equations = ['a==b', 'b!=c', 'c==a']) == False\n assert candidate(equations = ['b==a', 'a==b']) == True\n assert candidate(equations = ['f==g', 'g==f', 'f!=g']) == False\n assert candidate(equations = ['a==b', 'b!=a']) == False\n assert candidate(equations = ['a==b', 'b==c', 'a==c']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c==a', 'a!=b', 'b!=c', 'c!=a']) == False\n assert candidate(equations = ['a==b', 'b!=c', 'c!=d', 'd!=e', 'e!=f', 'f!=g', 'g!=h', 'h!=i', 'i!=j', 'j!=k', 'k!=l', 'l!=m', 'm!=n', 'n!=o', 'o!=p', 'p!=q', 'q!=r', 'r!=s', 's!=t', 't!=u', 'u!=v', 'v!=w', 'w!=x', 'x!=y', 'y!=z', 'z==a']) == True\n assert candidate(equations = ['p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'p!=q', 'q!=r', 'r!=s', 's!=t', 't!=u', 'u!=v', 'v!=w', 'w!=x', 'x!=y', 'y!=z', 'z!=a', 'a!=b', 'b!=c', 'c!=d', 'd!=e', 'e!=f', 'f!=g', 'g!=h', 'h!=i', 'i!=j', 'j!=k', 'k!=l', 'l!=m', 'm!=n', 'n!=o', 'o!=p', 'p!=q', 'q!=r', 'r!=s', 's!=t', 't!=u', 'u!=v', 'v!=w', 'w!=x', 'x!=y', 'y!=z', 'z!=a', 'a!=b', 'b!=c', 'c!=d', 'd!=e', 'e!=f', 'f!=g', 'g!=h', 'h!=i', 'i!=j', 'j!=k', 'k!=l', 'l!=m', 'm!=n', 'n!=o', 'o!=p', 'p!=q', 'q!=r', 'r!=s', 's!=t', 't!=u', 'u!=v', 'v!=w', 'w!=x', 'x!=y', 'y!=z', 'z!=a']) == False\n assert candidate(equations = ['x==y', 'y==z', 'z==w', 'w==x']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c!=a', 'a==d', 'd!=b', 'b!=c']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==a', 'e==f', 'f!=g', 'g==h', 'h==i', 'i!=j', 'j==k', 'k==l', 'l==m', 'm==n', 'n!=o', 'o==p', 'p==q', 'q==r', 'r==s', 's!=t', 't==u', 'u==v', 'v==w', 'w==x', 'x!=y', 'y!=z']) == True\n assert candidate(equations = ['x==y', 'y==z', 'z==w', 'w==x', 'x!=y']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c!=d', 'd==e', 'e==f', 'f!=g', 'g==h', 'h==i', 'i==j', 'j!=k', 'k==l', 'l==m', 'm==n', 'n!=o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z!=a']) == True\n assert candidate(equations = ['x==y', 'y==z', 'z==w', 'w!=x', 'p==q', 'q==r', 'r!=s', 's==t', 't!=u', 'u==v', 'v!=w', 'w==x', 'x==y', 'y!=z', 'z==a', 'a==b', 'b!=c', 'c==d', 'd!=e', 'e==f', 'f!=g', 'g==h']) == False\n assert candidate(equations = ['x==y', 'y==z', 'z==x', 'x!=y', 'y!=z', 'z!=x']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==a', 'a!=g']) == False\n assert candidate(equations = ['m==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==m', 'm!=n']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c!=d', 'd!=e', 'e==f', 'f==g', 'g!=h', 'h!=i', 'i==j', 'j==k', 'k!=l', 'l!=m', 'm==n', 'n==o', 'o!=p', 'p!=q', 'q==r', 'r==s', 's!=t', 't!=u', 'u==v', 'v==w', 'w!=x', 'x!=y', 'y==z', 'z!=a']) == True\n assert candidate(equations = ['x==y', 'y==z', 'x!=z', 'w==x', 'w==y', 'w!=z']) == False\n assert candidate(equations = ['a==b', 'b==a', 'c!=d', 'd!=c', 'e==f', 'f!=e']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z!=a']) == False\n assert candidate(equations = ['p==q', 'q==r', 'r==s', 's==t', 't==p', 'p!=r']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c!=d', 'd==e', 'e==f', 'f!=g', 'g==h', 'h!=i', 'i==j', 'j!=k', 'k==l', 'l!=m', 'm==n', 'n!=o']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a!=b', 'b!=c', 'c!=d', 'd!=e', 'e!=f', 'f!=g', 'g!=h', 'h!=i', 'i!=j', 'j!=k', 'k!=l', 'l!=m', 'm!=n', 'n!=o', 'o!=p', 'p!=q', 'q!=r', 'r!=s', 's!=t', 't!=u', 'u!=v', 'v!=w', 'w!=x', 'x!=y', 'y!=z', 'z!=a']) == False\n assert candidate(equations = ['a==b', 'b==c', 'a==c', 'a!=b', 'b!=c', 'a!=c']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'a!=d']) == False\n assert candidate(equations = ['x==y', 'y==z', 'z==x', 'u==v', 'v==w', 'w==u', 'x!=u']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a']) == True\n assert candidate(equations = ['p==q', 'q!=r', 'r==s', 's!=t', 't==u', 'u==p']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a==b', 'b==a', 'c==d', 'd==c', 'e==f', 'f==e', 'g==h', 'h==g', 'i==j', 'j==i', 'k==l', 'l==k', 'm==n', 'n==m', 'o==p', 'p==o', 'q==r', 'r==q', 's==t', 't==s', 'u==v', 'v==u', 'w==x', 'x==w', 'y==z', 'z==y', 'a!=a']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a!=b']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c!=d', 'd==e', 'e==f', 'f!=g', 'g==h', 'h==i', 'i!=j', 'j==k', 'k==l', 'l!=m', 'm==n', 'n==o', 'o!=p', 'p==q', 'q==r', 'r!=s', 's==t', 't==u', 'u!=v', 'v==w', 'w==x', 'x!=y', 'y==z', 'z!=a', 'a==b']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a!=b']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c!=d', 'd==e', 'e==f', 'f!=a']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'a!=d', 'b!=c', 'd!=a']) == False\n assert candidate(equations = ['x==y', 'y==z', 'z==w', 'w!=x']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==a', 'a==d', 'd==e', 'e==f', 'f==a', 'a!=b']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a!=c']) == False\n assert candidate(equations = ['p==q', 'q==r', 'r==s', 's==p', 'p!=q']) == False\n assert candidate(equations = ['p==q', 'q==r', 'r==s', 's==p', 'p!=q']) == False\n assert candidate(equations = ['a==b', 'b==c', 'a!=c', 'd==e', 'e==f', 'd!=f']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==a', 'a==d', 'b==e', 'c==f', 'd==e', 'e==f', 'f==d', 'a!=d', 'b!=e', 'c!=f']) == False\n assert candidate(equations = ['p==q', 'q==r', 'r==s', 's==t', 't==p', 'p!=q']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'a!=d']) == False\n assert candidate(equations = ['x1==y1', 'y1==z1', 'z1==w1', 'w1!=x1', 'a2==b2', 'b2==c2', 'c2==d2', 'd2==e2', 'e2!=f2', 'g3==h3', 'h3==i3', 'i3==j3', 'j3!=k3']) == True\n assert candidate(equations = ['m==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a==b', 'b==m', 'm!=n', 'n!=o', 'o!=p', 'p!=q', 'q!=r', 'r!=s', 's!=t', 't!=u', 'u!=v', 'v!=w', 'w!=x', 'x!=y', 'y!=z', 'z!=a', 'a!=b', 'b!=m']) == False\n assert candidate(equations = ['a==b', 'b!=c', 'c==d', 'd!=e', 'e==f', 'f==g', 'g!=h', 'h==i', 'i!=j', 'j==k', 'k!=l', 'l==m', 'm==n', 'n!=o', 'o==p', 'p!=q', 'q==r', 'r==s', 's!=t', 't==u', 'u!=v', 'v==w', 'w==x', 'x!=y', 'y==z']) == True\n assert candidate(equations = ['x==y', 'y==z', 'z==w', 'w==x', 'x!=y', 'y!=z', 'z!=w', 'w!=x']) == False\n assert candidate(equations = ['x==y', 'y==z', 'z==x', 'x!=y']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c!=a', 'd==e', 'e==f', 'f!=d', 'g==h', 'h==i', 'i!=g', 'j==k', 'k==l', 'l!=j', 'm==n', 'n==o', 'o!=m']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c!=d', 'd==e', 'e==f', 'f!=g', 'g==h', 'h!=i', 'i==j', 'j!=k', 'k==l', 'l!=m', 'm==n', 'n==o', 'o!=p']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==a']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c==a', 'a!=d', 'd!=e', 'e!=f', 'f!=a', 'a==b']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'a!=d', 'b==e', 'e!=f', 'f==g', 'g!=h', 'h==i', 'i!=j', 'j==k', 'k!=l', 'l!=m', 'm!=n', 'n!=o', 'o!=p', 'p!=a']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==a', 'a!=b']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a']) == True\n assert candidate(equations = ['a==b', 'b==a', 'c==d', 'd==c', 'e==f', 'f==e', 'g==h', 'h==g', 'i==j', 'j==i', 'k==l', 'l==k', 'm==n', 'n==m', 'o==p', 'p==o', 'q==r', 'r==q', 's==t', 't==s', 'u==v', 'v==u', 'w==x', 'x==w', 'y==z', 'z==y']) == True\n assert candidate(equations = ['m==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==m', 'm!=n']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'a==d', 'a!=d']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==a', 'a!=b']) == False\n assert candidate(equations = ['x==y', 'y==z', 'z!=x']) == False\n assert candidate(equations = ['x==y', 'y==z', 'z==w', 'w==v', 'v==u', 'u==x', 'x!=y']) == False\n assert candidate(equations = ['m==n', 'n==o', 'o!=p', 'p==q', 'q==r', 'r!=s', 's==t', 't==u', 'u==v', 'v!=w', 'w==x', 'x==y', 'y==z', 'z==a', 'a==b', 'b!=c']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c!=a', 'd==e', 'e==f', 'f!=d', 'g==h', 'h==i', 'i!=g', 'j==k', 'k==l', 'l!=j', 'm==n', 'n==o', 'o!=m', 'p==q', 'q==r', 'r!=p', 's==t', 't==u', 'u!=s', 'v==w', 'w==x', 'x!=v', 'y==z', 'z==a', 'a!=y']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a!=b', 'b!=c', 'c!=d', 'd!=e', 'e!=f', 'f!=g', 'g!=h', 'h!=i', 'i!=j', 'j!=k', 'k!=l', 'l!=m', 'm!=n', 'n!=o', 'o!=p', 'p!=q', 'q!=r', 'r!=s', 's!=t', 't!=u', 'u!=v', 'v!=w', 'w!=x', 'x!=y', 'y!=z', 'z!=a', 'a!=b', 'b!=c', 'c!=d', 'd!=e', 'e!=f', 'f!=g', 'g!=h', 'h!=i', 'i!=j', 'j!=k', 'k!=l', 'l!=m', 'm!=n', 'n!=o', 'o!=p', 'p!=q', 'q!=r', 'r!=s', 's!=t', 't!=u', 'u!=v', 'v!=w', 'w!=x', 'x!=y', 'y!=z', 'z!=a']) == False\n assert candidate(equations = ['m==n', 'n==o', 'o!=p', 'p!=q', 'q==r', 'r==s', 's!=t', 't!=u', 'u==v', 'v==w', 'w!=x', 'x!=y', 'y==z', 'z==a', 'a!=b', 'b!=c', 'c!=d', 'd!=e', 'e!=f', 'f!=g', 'g!=h']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e!=f', 'f!=g', 'g!=h', 'h!=i', 'i!=j', 'j!=k', 'k!=l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a']) == True\n assert candidate(equations = ['p==q', 'q==r', 'r==s', 's==t', 't==p', 'p!=t']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==d', 'd==e', 'e==f', 'f==g', 'g==h', 'h==i', 'i==j', 'j==k', 'k==l', 'l==m', 'm==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==a', 'a!=b']) == False\n assert candidate(equations = ['a==b', 'b==c', 'c==a', 'a!=d', 'd!=e', 'e!=a']) == True\n assert candidate(equations = ['a==b', 'b==c', 'c==a', 'a!=b']) == False\n assert candidate(equations = ['p==q', 'q==r', 'r==s', 's==t', 't==p', 'p!=q']) == False\n assert candidate(equations = ['m==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==m', 'm!=n']) == False\n assert candidate(equations = ['m==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==m', 'm!=n']) == False\n assert candidate(equations = ['m==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==m', 'm!=o']) == False\n"}, "metadata": {"canonical_parameter_names": ["equations"], "leetcode_dataset_entry_point": "Solution().equationsPossible", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var equationsPossible = function(equations) {", "container": null, "callable": "equationsPossible", "parameters": [{"name": "equations", "type": "string[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 991, "task_id": "broken-calculator", "difficulty": "Medium", "problem_description": "There is a broken calculator that has the integer startValue on its display initially. In one operation, you can:\n\nmultiply the number on display by 2, or\nsubtract 1 from the number on display.\n\nGiven two integers startValue and target, return the minimum number of operations needed to display target on the calculator.\n \nExample 1:\n\nInput: startValue = 2, target = 3\nOutput: 2\nExplanation: Use double operation and then decrement operation {2 -> 4 -> 3}.\n\nExample 2:\n\nInput: startValue = 5, target = 8\nOutput: 2\nExplanation: Use decrement and then double {5 -> 4 -> 8}.\n\nExample 3:\n\nInput: startValue = 3, target = 10\nOutput: 3\nExplanation: Use double, decrement and double {3 -> 6 -> 5 -> 10}.\n\n \nConstraints:\n\n1 <= startValue, target <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(startValue = 2,target = 3) == 2\n assert candidate(startValue = 1000000000,target = 1) == 999999999\n assert candidate(startValue = 7,target = 15) == 6\n assert candidate(startValue = 2,target = 1) == 1\n assert candidate(startValue = 3,target = 10) == 3\n assert candidate(startValue = 100,target = 99) == 1\n assert candidate(startValue = 10,target = 1) == 9\n assert candidate(startValue = 1,target = 2) == 1\n assert candidate(startValue = 1,target = 1000000000) == 39\n assert candidate(startValue = 5,target = 8) == 2\n assert candidate(startValue = 1,target = 1) == 0\n assert candidate(startValue = 4,target = 7) == 2\n assert candidate(startValue = 100,target = 100) == 0\n assert candidate(startValue = 7,target = 19) == 5\n assert candidate(startValue = 8,target = 16) == 1\n assert candidate(startValue = 9,target = 28) == 4\n assert candidate(startValue = 1000000,target = 1000000) == 0\n assert candidate(startValue = 123456,target = 654321) == 41671\n assert candidate(startValue = 2,target = 3000000000) == 43\n assert candidate(startValue = 1000,target = 1001) == 501\n assert candidate(startValue = 15,target = 1) == 14\n assert candidate(startValue = 1000000,target = 999999) == 1\n assert candidate(startValue = 2,target = 1024) == 9\n assert candidate(startValue = 1024,target = 1) == 1023\n assert candidate(startValue = 2,target = 1023) == 10\n assert candidate(startValue = 10,target = 11) == 6\n assert candidate(startValue = 50,target = 1000) == 25\n assert candidate(startValue = 7,target = 128) == 8\n assert candidate(startValue = 3,target = 1023) == 11\n assert candidate(startValue = 23,target = 17) == 6\n assert candidate(startValue = 500,target = 1000000) == 26\n assert candidate(startValue = 2,target = 100) == 9\n assert candidate(startValue = 50,target = 101) == 28\n assert candidate(startValue = 15,target = 20) == 6\n assert candidate(startValue = 12,target = 32) == 6\n assert candidate(startValue = 3,target = 33) == 8\n assert candidate(startValue = 1000000,target = 1000001) == 500001\n assert candidate(startValue = 500,target = 1023) == 247\n assert candidate(startValue = 7,target = 47) == 5\n assert candidate(startValue = 13,target = 1) == 12\n assert candidate(startValue = 15,target = 97) == 8\n assert candidate(startValue = 123456789,target = 987654321) == 61728401\n assert candidate(startValue = 25,target = 24) == 1\n assert candidate(startValue = 2345678,target = 8765432) == 154322\n assert candidate(startValue = 256,target = 2048) == 3\n assert candidate(startValue = 12345,target = 54321) == 5560\n assert candidate(startValue = 20,target = 25) == 9\n assert candidate(startValue = 6,target = 9) == 3\n assert candidate(startValue = 500000000,target = 750000000) == 125000001\n assert candidate(startValue = 15,target = 10) == 5\n assert candidate(startValue = 1000,target = 500) == 500\n assert candidate(startValue = 9,target = 18) == 1\n assert candidate(startValue = 7,target = 1000) == 13\n assert candidate(startValue = 31,target = 15) == 16\n assert candidate(startValue = 15,target = 300) == 12\n assert candidate(startValue = 2,target = 2048) == 10\n assert candidate(startValue = 10,target = 15) == 4\n assert candidate(startValue = 5,target = 1023) == 10\n assert candidate(startValue = 25,target = 100) == 2\n assert candidate(startValue = 20,target = 5) == 15\n assert candidate(startValue = 15,target = 31) == 10\n assert candidate(startValue = 7,target = 1) == 6\n assert candidate(startValue = 8,target = 20) == 5\n assert candidate(startValue = 7,target = 100) == 6\n assert candidate(startValue = 999999999,target = 1000000000) == 500000000\n assert candidate(startValue = 64,target = 32) == 32\n assert candidate(startValue = 8,target = 1000) == 9\n assert candidate(startValue = 15,target = 7) == 8\n assert candidate(startValue = 12345,target = 67890) == 3863\n assert candidate(startValue = 3,target = 123456789) == 39\n assert candidate(startValue = 5,target = 123) == 8\n assert candidate(startValue = 1024,target = 512) == 512\n assert candidate(startValue = 1000000,target = 10000000) == 375004\n assert candidate(startValue = 12345,target = 98765) == 6178\n assert candidate(startValue = 10,target = 31) == 5\n assert candidate(startValue = 1,target = 1000000) == 28\n assert candidate(startValue = 8,target = 1) == 7\n assert candidate(startValue = 123,target = 456) == 11\n assert candidate(startValue = 100,target = 1) == 99\n assert candidate(startValue = 2,target = 1025) == 20\n assert candidate(startValue = 3456,target = 6789) == 63\n assert candidate(startValue = 500000000,target = 1000000000) == 1\n assert candidate(startValue = 1023,target = 1024) == 512\n assert candidate(startValue = 8,target = 15) == 2\n assert candidate(startValue = 7,target = 101) == 7\n assert candidate(startValue = 31,target = 8) == 23\n assert candidate(startValue = 3,target = 9) == 4\n assert candidate(startValue = 500,target = 250) == 250\n assert candidate(startValue = 987654321,target = 123456789) == 864197532\n assert candidate(startValue = 500,target = 1024) == 246\n assert candidate(startValue = 7,target = 150) == 9\n assert candidate(startValue = 8,target = 64) == 3\n assert candidate(startValue = 6,target = 32) == 5\n assert candidate(startValue = 10,target = 1023) == 10\n assert candidate(startValue = 13,target = 169) == 9\n assert candidate(startValue = 8,target = 1024) == 7\n"}, "metadata": {"canonical_parameter_names": ["startValue", "target"], "leetcode_dataset_entry_point": "Solution().brokenCalc", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var brokenCalc = function(startValue, target) {", "container": null, "callable": "brokenCalc", "parameters": [{"name": "startValue", "type": "number"}, {"name": "target", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 992, "task_id": "subarrays-with-k-different-integers", "difficulty": "Hard", "problem_description": "Given an integer array nums and an integer k, return the number of good subarrays of nums.\nA good array is an array where the number of different integers in that array is exactly k.\n\nFor example, [1,2,3,1,2] has 3 different integers: 1, 2, and 3.\n\nA subarray is a contiguous part of an array.\n \nExample 1:\n\nInput: nums = [1,2,1,2,3], k = 2\nOutput: 7\nExplanation: Subarrays formed with exactly 2 different integers: [1,2], [2,1], [1,2], [2,3], [1,2,1], [2,1,2], [1,2,1,2]\n\nExample 2:\n\nInput: nums = [1,2,1,3,4], k = 3\nOutput: 3\nExplanation: Subarrays formed with exactly 3 different integers: [1,2,1,3], [2,1,3], [1,3,4].\n\n \nConstraints:\n\n1 <= nums.length <= 2 * 104\n1 <= nums[i], k <= nums.length\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [4, 2, 4, 5, 6],k = 2) == 5\n assert candidate(nums = [1, 2, 1, 3, 4],k = 3) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 1\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 1) == 55\n assert candidate(nums = [1, 2, 2, 1, 1, 3],k = 2) == 10\n assert candidate(nums = [1, 2, 3],k = 2) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6],k = 3) == 4\n assert candidate(nums = [1, 2],k = 1) == 2\n assert candidate(nums = [1, 2, 2, 1, 2, 3, 3, 4],k = 3) == 9\n assert candidate(nums = [1, 2, 3, 4, 5],k = 5) == 1\n assert candidate(nums = [1, 2, 3, 4, 5],k = 3) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 6\n assert candidate(nums = [1],k = 1) == 1\n assert candidate(nums = [1, 2, 1, 2, 3],k = 2) == 7\n assert candidate(nums = [5, 5, 5, 5, 5],k = 1) == 15\n assert candidate(nums = [1, 2, 2, 1, 1],k = 2) == 8\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == 6\n assert candidate(nums = [1, 2, 2, 1, 3],k = 2) == 6\n assert candidate(nums = [1, 1, 1, 1, 1],k = 1) == 15\n assert candidate(nums = [1, 2, 2, 1, 2],k = 2) == 9\n assert candidate(nums = [1, 2, 3, 2, 1, 2, 3, 2, 1],k = 2) == 11\n assert candidate(nums = [1, 1, 2, 2, 3, 3],k = 2) == 8\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == 7\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1) == 55\n assert candidate(nums = [1, 2, 3, 2, 2, 3, 1, 2, 3],k = 3) == 22\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3],k = 2) == 18\n assert candidate(nums = [1, 2, 3, 4, 5],k = 1) == 5\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],k = 3) == 253\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == 21\n assert candidate(nums = [1, 2, 2, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 6, 7, 8, 9],k = 5) == 143\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == 11\n assert candidate(nums = [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4],k = 4) == 91\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1) == 210\n assert candidate(nums = [1, 2, 2, 1, 3, 1, 4, 2],k = 3) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 26\n assert candidate(nums = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2],k = 2) == 13\n assert candidate(nums = [1, 2, 1, 3, 2, 1, 4, 3, 2, 1, 5, 4, 3, 2, 1],k = 3) == 18\n assert candidate(nums = [5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1],k = 3) == 19\n assert candidate(nums = [5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1],k = 3) == 35\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5],k = 2) == 36\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 66\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 10) == 237\n assert candidate(nums = [1, 2, 2, 1, 2, 2, 1, 2, 2, 1],k = 2) == 42\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20],k = 10) == 44\n assert candidate(nums = [1, 2, 2, 1, 3, 3, 4],k = 2) == 9\n assert candidate(nums = [1, 2, 1, 3, 2, 4, 3, 5, 2, 3, 1, 4],k = 3) == 14\n assert candidate(nums = [1, 2, 1, 3, 2, 4, 2, 1, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == 29\n assert candidate(nums = [10, 20, 30, 40, 50, 10, 20, 30, 40, 50],k = 4) == 7\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 5) == 6\n assert candidate(nums = [1, 1, 2, 3, 2, 3, 3, 4, 4, 4, 4, 4],k = 3) == 23\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3],k = 4) == 18\n assert candidate(nums = [1, 2, 2, 1, 3, 4, 3, 2, 1],k = 2) == 11\n assert candidate(nums = [1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2],k = 2) == 100\n assert candidate(nums = [1, 2, 3, 2, 1, 2, 3, 1, 2, 3, 1, 2, 3],k = 2) == 14\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],k = 5) == 0\n assert candidate(nums = [1, 1, 2, 3, 2, 1, 2, 3, 1, 2, 3, 1, 2, 3],k = 3) == 75\n assert candidate(nums = [10, 20, 10, 30, 20, 40, 30, 50, 20, 30, 10, 40],k = 3) == 14\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 3) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],k = 7) == 24\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 3) == 100\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 16\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7],k = 4) == 36\n assert candidate(nums = [10, 20, 30, 10, 20, 30, 10, 20, 30],k = 2) == 8\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],k = 3) == 136\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5],k = 4) == 7\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9],k = 3) == 63\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 4) == 28\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 20) == 1\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],k = 2) == 378\n assert candidate(nums = [1, 2, 3, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 2, 1],k = 2) == 21\n assert candidate(nums = [1, 2, 1, 2, 3, 3, 4, 4, 5, 5],k = 3) == 12\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],k = 2) == 120\n assert candidate(nums = [5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],k = 5) == 253\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],k = 5) == 136\n assert candidate(nums = [1, 2, 2, 1, 1, 3, 4, 3, 2, 1],k = 2) == 15\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],k = 2) == 190\n assert candidate(nums = [5, 4, 3, 2, 1, 1, 2, 3, 4, 5],k = 3) == 11\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8],k = 4) == 20\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],k = 2) == 16\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],k = 3) == 190\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1, 2, 2],k = 2) == 28\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9],k = 3) == 28\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 20) == 0\n assert candidate(nums = [1, 2, 2, 1, 3, 2, 4, 5, 3],k = 3) == 10\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8],k = 3) == 48\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5],k = 2) == 36\n assert candidate(nums = [1, 2, 3, 2, 2, 3, 1, 1, 2, 3, 3, 3, 2, 1],k = 2) == 22\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],k = 3) == 13\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 5) == 24\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == 17\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],k = 5) == 66\n assert candidate(nums = [4, 2, 4, 4, 2, 2, 3, 1, 1, 4],k = 2) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5],k = 4) == 20\n assert candidate(nums = [1, 2, 3, 2, 1, 4, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == 93\n assert candidate(nums = [1, 2, 2, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1],k = 4) == 30\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 5) == 16\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],k = 2) == 29\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12],k = 5) == 32\n assert candidate(nums = [1, 2, 2, 1, 2, 3, 3, 2, 1],k = 2) == 15\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],k = 4) == 22\n assert candidate(nums = [1, 2, 2, 1, 3, 3, 3, 2, 1, 4, 4, 5, 5, 5, 5, 5],k = 3) == 27\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],k = 3) == 55\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],k = 3) == 12\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10) == 11\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 1, 1, 2, 2, 3, 3],k = 4) == 72\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10],k = 3) == 72\n assert candidate(nums = [5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5],k = 5) == 106\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 2, 1, 1, 1],k = 3) == 162\n assert candidate(nums = [1, 2, 2, 1, 3, 3, 2, 1, 4, 4, 3, 2, 1],k = 2) == 16\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1],k = 5) == 80\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9],k = 4) == 24\n assert candidate(nums = [10, 10, 20, 30, 40, 50, 60, 70, 80, 90],k = 5) == 6\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6],k = 3) == 36\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2],k = 2) == 45\n assert candidate(nums = [1, 2, 2, 1, 3, 3, 2, 1, 4, 4, 3, 2, 1, 5, 5, 4, 3, 2, 1, 6, 6, 5, 4, 3, 2, 1, 7, 7, 6, 5, 4, 3, 2, 1, 8, 8, 7, 6, 5, 4, 3, 2, 1, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 10) == 541\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 10) == 21\n assert candidate(nums = [1, 2, 3, 2, 1, 4, 5, 4, 3, 2, 1, 2],k = 3) == 13\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5],k = 5) == 21\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().subarraysWithKDistinct", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var subarraysWithKDistinct = function(nums, k) {", "container": null, "callable": "subarraysWithKDistinct", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 993, "task_id": "cousins-in-binary-tree", "difficulty": "Easy", "problem_description": "Given the root of a binary tree with unique values and the values of two different nodes of the tree x and y, return true if the nodes corresponding to the values x and y in the tree are cousins, or false otherwise.\nTwo nodes of a binary tree are cousins if they have the same depth with different parents.\nNote that in a binary tree, the root node is at the depth 0, and children of each depth k node are at the depth k + 1.\n \nExample 1:\n\n\nInput: root = [1,2,3,4], x = 4, y = 3\nOutput: false\n\nExample 2:\n\n\nInput: root = [1,2,3,null,4,null,5], x = 5, y = 4\nOutput: true\n\nExample 3:\n\n\nInput: root = [1,2,3,null,4], x = 2, y = 3\nOutput: false\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [2, 100].\n1 <= Node.val <= 100\nEach node has a unique value.\nx != y\nx and y are exist in the tree.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, None, 5, None, 6]),x = 5,y = 6) == False\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5]),x = 5,y = 4) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11]),x = 9,y = 11) == True\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5, None, 6]),x = 5,y = 6) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),x = 2,y = 3) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, 8, None, None, 9]),x = 6,y = 8) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, None, None, None, None, 12, 13]),x = 10,y = 11) == False\n assert candidate(root = tree_node([1, 2, 3, 4]),x = 4,y = 3) == False\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, None, 6, 7]),x = 6,y = 7) == False\n assert candidate(root = tree_node([1, 2, 3, None, 4]),x = 2,y = 3) == False\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5]),x = 4,y = 5) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11]),x = 3,y = 7) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),x = 4,y = 7) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11]),x = 2,y = 3) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, None, None, 6, 7]),x = 6,y = 7) == False\n assert candidate(root = tree_node([1, 2, 3, None, None, 6, 7, 8, 9]),x = 8,y = 9) == False\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5, 6, None, None, None, None, 7, 8]),x = 7,y = 8) == False\n assert candidate(root = tree_node([1, 2, 3, None, None, 6, 7]),x = 6,y = 7) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11]),x = 4,y = 9) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9]),x = 4,y = 9) == False\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5]),x = 5,y = 4) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11]),x = 4,y = 6) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, None, None, 6, None, None, 7]),x = 6,y = 7) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9]),x = 8,y = 5) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),x = 4,y = 6) == True\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, None, None, 5]),x = 4,y = 5) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),x = 5,y = 7) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, None, None, 7, 8]),x = 7,y = 8) == False\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, 7]),x = 6,y = 7) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),x = 6,y = 5) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),x = 8,y = 11) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11, None, None, 12]),x = 12,y = 11) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, None, None, 5]),x = 2,y = 3) == False\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, 6, None, None, 7]),x = 6,y = 7) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, None, None, 9, None, None, 10]),x = 8,y = 10) == False\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5]),x = 4,y = 5) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7]),x = 6,y = 7) == False\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5, 6]),x = 5,y = 6) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11]),x = 10,y = 11) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),x = 4,y = 5) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9]),x = 8,y = 9) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, None]),x = 4,y = 3) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7]),x = 4,y = 7) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11]),x = 8,y = 9) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, 8, 9]),x = 8,y = 9) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),x = 10,y = 14) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, 8, 9, 10, 11]),x = 10,y = 11) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, None, None, 6, 7]),x = 6,y = 5) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, 8, 9]),x = 8,y = 9) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, 8, 9]),x = 8,y = 9) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),x = 3,y = 15) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, None, 5, 6]),x = 5,y = 6) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, None, None, 10, 11, None, None, 12, 13]),x = 12,y = 13) == False\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, 6]),x = 6,y = 5) == False\n"}, "metadata": {"canonical_parameter_names": ["root", "x", "y"], "leetcode_dataset_entry_point": "Solution().isCousins", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isCousins = function(root, x, y) {", "container": null, "callable": "isCousins", "parameters": [{"name": "root", "type": "TreeNode"}, {"name": "x", "type": "number"}, {"name": "y", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 994, "task_id": "rotting-oranges", "difficulty": "Medium", "problem_description": "You are given an m x n grid where each cell can have one of three values:\n\n0 representing an empty cell,\n1 representing a fresh orange, or\n2 representing a rotten orange.\n\nEvery minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten.\nReturn the minimum number of minutes that must elapse until no cell has a fresh orange. If this is impossible, return -1.\n \nExample 1:\n\n\nInput: grid = [[2,1,1],[1,1,0],[0,1,1]]\nOutput: 4\n\nExample 2:\n\nInput: grid = [[2,1,1],[0,1,1],[1,0,1]]\nOutput: -1\nExplanation: The orange in the bottom left corner (row 2, column 0) is never rotten, because rotting only happens 4-directionally.\n\nExample 3:\n\nInput: grid = [[0,2]]\nOutput: 0\nExplanation: Since there are already no fresh oranges at minute 0, the answer is just 0.\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m, n <= 10\ngrid[i][j] is 0, 1, or 2.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == -1\n assert candidate(grid = [[1, 2, 1, 1, 2, 1, 1]]) == 2\n assert candidate(grid = [[2, 2, 2], [2, 1, 2], [2, 2, 2]]) == 1\n assert candidate(grid = [[2, 1, 1], [0, 1, 1], [1, 0, 1]]) == -1\n assert candidate(grid = [[2, 1, 1], [1, 1, 0], [0, 1, 1]]) == 4\n assert candidate(grid = [[1], [2]]) == 1\n assert candidate(grid = [[0, 2]]) == 0\n assert candidate(grid = [[2, 1, 0, 1], [1, 0, 1, 2], [0, 1, 2, 0]]) == 1\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [0, 1, 2]]) == 4\n assert candidate(grid = [[2, 1, 0], [0, 1, 1], [1, 0, 2]]) == -1\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(grid = [[2, 1, 1, 1], [1, 1, 1, 1], [1, 1, 2, 1], [1, 1, 1, 1]]) == 3\n assert candidate(grid = [[1, 0, 2, 0, 1], [1, 0, 1, 2, 1], [0, 2, 1, 1, 0], [1, 0, 0, 0, 1]]) == -1\n assert candidate(grid = [[2, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 2]]) == 4\n assert candidate(grid = [[1, 1, 0, 1, 0], [1, 1, 0, 1, 1], [0, 1, 2, 0, 1], [1, 0, 1, 1, 2], [1, 1, 2, 1, 1]]) == 4\n assert candidate(grid = [[2, 1, 0, 1, 1, 0], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [1, 1, 0, 1, 1, 2]]) == -1\n assert candidate(grid = [[1, 2, 1, 1, 1], [1, 1, 0, 1, 1], [0, 0, 0, 0, 0], [1, 1, 0, 1, 1], [1, 2, 1, 1, 1]]) == 4\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 2, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]]) == 6\n assert candidate(grid = [[2, 1, 1, 0, 1], [1, 0, 1, 1, 1], [0, 1, 2, 1, 1], [1, 1, 1, 1, 0], [1, 0, 1, 1, 2]]) == 4\n assert candidate(grid = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == -1\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) == -1\n assert candidate(grid = [[1, 1, 1, 1], [2, 1, 0, 2], [1, 0, 1, 1], [0, 2, 1, 1]]) == 2\n assert candidate(grid = [[2, 0, 1, 1, 1], [1, 0, 1, 0, 1], [1, 0, 1, 0, 1], [1, 1, 1, 0, 1]]) == 13\n assert candidate(grid = [[2, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 2, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == 11\n assert candidate(grid = [[2, 1, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 2]]) == -1\n assert candidate(grid = [[2, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 2]]) == 5\n assert candidate(grid = [[1, 2, 1, 1, 2, 1, 1], [1, 1, 0, 0, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 2, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1]]) == 9\n assert candidate(grid = [[2, 1, 1, 2, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 2], [1, 0, 1, 0, 1], [2, 1, 2, 1, 1]]) == 3\n assert candidate(grid = [[2, 1, 1, 0, 1, 0], [1, 0, 1, 1, 1, 1], [0, 1, 1, 0, 1, 0], [1, 0, 1, 1, 1, 1], [0, 1, 0, 1, 1, 0]]) == -1\n assert candidate(grid = [[2, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [1, 1, 0, 1, 1], [2, 1, 1, 1, 2]]) == 4\n assert candidate(grid = [[1, 1, 0, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1], [1, 1, 0, 0, 1, 1]]) == -1\n assert candidate(grid = [[2, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1], [0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 2]]) == -1\n assert candidate(grid = [[2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 0, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 2, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 5\n assert candidate(grid = [[2, 1, 1, 1, 1], [1, 1, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 2]]) == 4\n assert candidate(grid = [[2, 2, 1, 1, 2], [1, 2, 0, 1, 2], [2, 1, 2, 0, 2], [1, 2, 2, 2, 1], [2, 1, 1, 1, 2]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[1, 1, 2, 1, 1, 1, 1], [1, 1, 1, 1, 2, 1, 1], [1, 2, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 2, 1], [1, 1, 1, 2, 1, 1, 1]]) == 3\n assert candidate(grid = [[2, 1, 1, 0, 1], [1, 1, 0, 1, 1], [0, 1, 2, 0, 1], [1, 0, 1, 1, 2], [1, 1, 2, 1, 1]]) == 3\n assert candidate(grid = [[2, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 2]]) == 1\n assert candidate(grid = [[2, 1, 1, 1, 2], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [2, 1, 1, 1, 2]]) == 4\n assert candidate(grid = [[2, 1, 1, 1, 1, 2], [1, 1, 0, 0, 1, 1], [1, 0, 0, 0, 1, 1], [1, 0, 0, 0, 1, 1], [1, 1, 1, 1, 1, 2]]) == 4\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 2]]) == 10\n assert candidate(grid = [[2, 1, 1, 0], [1, 1, 0, 0], [0, 0, 1, 1], [1, 2, 1, 0]]) == 3\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 2, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[2, 1, 0, 0, 1, 1], [1, 0, 1, 0, 1, 2], [1, 0, 1, 1, 0, 1], [2, 1, 1, 0, 1, 1], [1, 0, 1, 1, 0, 1]]) == 4\n assert candidate(grid = [[2, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == 9\n assert candidate(grid = [[2, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 8\n assert candidate(grid = [[1, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 0, 1]]) == -1\n assert candidate(grid = [[2, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 1], [0, 0, 0, 2, 0, 0], [1, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 2]]) == -1\n assert candidate(grid = [[2, 0, 1, 0, 2], [0, 1, 1, 1, 0], [1, 1, 2, 1, 1], [0, 1, 1, 1, 0], [2, 0, 1, 0, 2]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 2]]) == 12\n assert candidate(grid = [[2, 1, 0, 1, 2], [1, 0, 1, 0, 2], [2, 1, 2, 0, 2], [1, 2, 2, 2, 1], [2, 1, 1, 1, 2]]) == 1\n assert candidate(grid = [[2, 1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 2]]) == -1\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 2, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[1, 2, 1, 1, 2], [1, 1, 1, 2, 1], [2, 1, 1, 1, 1], [1, 2, 2, 1, 1], [1, 1, 1, 2, 1]]) == 2\n assert candidate(grid = [[2, 1, 1], [1, 1, 1], [1, 2, 1], [2, 1, 1], [1, 1, 2]]) == 2\n assert candidate(grid = [[1, 2, 1, 2, 1], [2, 1, 0, 1, 2], [1, 0, 0, 0, 1], [2, 1, 2, 1, 2]]) == 1\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 0, 1], [1, 0, 1, 1], [1, 1, 1, 1]]) == -1\n assert candidate(grid = [[2, 1, 1, 0, 0, 1], [1, 0, 0, 0, 1, 1], [0, 1, 0, 1, 0, 0], [1, 0, 1, 0, 1, 2], [1, 1, 0, 1, 0, 1]]) == -1\n assert candidate(grid = [[0, 1, 1, 1, 0], [1, 1, 1, 1, 1], [1, 1, 2, 1, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0]]) == 3\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 1, 1], [0, 0, 0, 2, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 2, 2]]) == -1\n assert candidate(grid = [[2, 1, 1, 0, 1], [1, 0, 1, 1, 2], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [2, 1, 1, 1, 2]]) == 3\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 2, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) == -1\n assert candidate(grid = [[2, 1, 1, 1, 2], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [2, 1, 1, 1, 2]]) == -1\n assert candidate(grid = [[2, 1, 0, 0, 1, 1], [1, 0, 0, 1, 1, 2], [0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 1, 1]]) == -1\n assert candidate(grid = [[2, 1, 1, 1, 1, 1], [1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 2]]) == 4\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 2, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 2\n assert candidate(grid = [[0, 2, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 1, 0, 1, 1], [1, 2, 1, 1, 2], [1, 1, 0, 1, 1], [0, 1, 1, 1, 1], [2, 1, 1, 1, 0]]) == 3\n assert candidate(grid = [[2, 1, 1, 1, 1, 1, 2], [1, 1, 0, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 2]]) == 6\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 0, 1, 0, 0], [0, 1, 2, 1, 0], [0, 0, 1, 0, 0], [1, 0, 0, 0, 1]]) == -1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 2, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[2, 1, 1, 2, 1], [1, 0, 0, 1, 1], [1, 1, 0, 1, 2], [0, 1, 1, 1, 0], [1, 2, 0, 2, 1]]) == 2\n assert candidate(grid = [[2, 1, 1, 0, 1], [1, 1, 0, 1, 1], [0, 1, 1, 0, 1], [1, 0, 1, 1, 2]]) == -1\n assert candidate(grid = [[2, 2, 2, 2, 2], [2, 1, 1, 1, 2], [2, 1, 0, 1, 2], [2, 1, 1, 1, 2], [2, 2, 2, 2, 2]]) == 1\n assert candidate(grid = [[2, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 8\n assert candidate(grid = [[1, 1, 1, 1, 2], [1, 1, 0, 1, 1], [1, 1, 1, 1, 1], [1, 0, 1, 1, 1], [2, 1, 1, 1, 1]]) == 4\n assert candidate(grid = [[2, 1, 0, 1], [0, 0, 0, 0], [1, 0, 1, 2], [0, 1, 2, 0], [1, 2, 0, 1]]) == -1\n assert candidate(grid = [[2, 1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) == -1\n assert candidate(grid = [[2, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == 8\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 2, 0, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]) == 6\n assert candidate(grid = [[2, 1, 1, 0, 0], [1, 0, 1, 1, 1], [0, 1, 1, 1, 2], [0, 0, 0, 1, 1], [0, 1, 2, 1, 2]]) == 3\n assert candidate(grid = [[1, 2, 0, 2, 1], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [1, 1, 0, 1, 1]]) == -1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 2, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[2, 1, 0, 1, 2, 1, 1], [1, 1, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1, 1], [1, 0, 1, 1, 0, 1, 0], [1, 1, 0, 1, 1, 0, 1], [1, 1, 1, 0, 1, 1, 2]]) == -1\n assert candidate(grid = [[1, 0, 2, 0, 1], [0, 1, 0, 1, 0], [2, 0, 1, 0, 2], [0, 1, 0, 1, 0], [1, 0, 2, 0, 1]]) == -1\n assert candidate(grid = [[1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 2, 1, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1]]) == -1\n assert candidate(grid = [[1, 0, 0, 0, 0, 1], [0, 1, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1]]) == -1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 2, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]]) == 6\n assert candidate(grid = [[2, 1, 1, 2, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 2]]) == 4\n assert candidate(grid = [[1, 2, 1, 0, 1, 2], [1, 0, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 1], [2, 1, 1, 1, 1, 0]]) == 4\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 1, 0, 1, 1], [1, 1, 0, 1, 1], [1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[2, 1, 1, 0, 1], [1, 0, 1, 1, 1], [1, 1, 0, 1, 1], [0, 1, 1, 1, 2]]) == 3\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().orangesRotting", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var orangesRotting = function(grid) {", "container": null, "callable": "orangesRotting", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 995, "task_id": "minimum-number-of-k-consecutive-bit-flips", "difficulty": "Hard", "problem_description": "You are given a binary array nums and an integer k.\nA k-bit flip is choosing a subarray of length k from nums and simultaneously changing every 0 in the subarray to 1, and every 1 in the subarray to 0.\nReturn the minimum number of k-bit flips required so that there is no 0 in the array. If it is not possible, return -1.\nA subarray is a contiguous part of an array.\n \nExample 1:\n\nInput: nums = [0,1,0], k = 1\nOutput: 2\nExplanation: Flip nums[0], then flip nums[2].\n\nExample 2:\n\nInput: nums = [1,1,0], k = 2\nOutput: -1\nExplanation: No matter how we flip subarrays of size 2, we cannot make the array become [1,1,1].\n\nExample 3:\n\nInput: nums = [0,0,0,1,0,1,1,0], k = 3\nOutput: 3\nExplanation: \nFlip nums[0],nums[1],nums[2]: nums becomes [1,1,1,1,0,1,1,0]\nFlip nums[4],nums[5],nums[6]: nums becomes [1,1,1,1,1,0,0,0]\nFlip nums[5],nums[6],nums[7]: nums becomes [1,1,1,1,1,1,1,1]\n\n \nConstraints:\n\n1 <= nums.length <= 105\n1 <= k <= nums.length\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [0, 0, 1, 1, 0, 1, 1, 0, 1, 0],k = 2) == -1\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0],k = 3) == 3\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0],k = 4) == 4\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1],k = 4) == -1\n assert candidate(nums = [1, 0, 0, 1, 0, 1],k = 2) == -1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 0\n assert candidate(nums = [1, 1, 0],k = 2) == -1\n assert candidate(nums = [1, 0, 0, 1, 1, 0, 1],k = 2) == -1\n assert candidate(nums = [0, 0, 0, 0, 0],k = 2) == -1\n assert candidate(nums = [0, 0, 0, 1, 0, 1, 1, 0],k = 3) == 3\n assert candidate(nums = [1, 1, 1, 1, 1],k = 2) == 0\n assert candidate(nums = [1, 0, 1, 1, 0, 0, 1, 1, 1, 0],k = 4) == -1\n assert candidate(nums = [0, 0, 0, 0, 0],k = 5) == 1\n assert candidate(nums = [1, 0, 1, 0, 1, 0],k = 2) == -1\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0],k = 2) == 4\n assert candidate(nums = [1, 1, 1, 1, 1],k = 1) == 0\n assert candidate(nums = [0, 0, 1, 1, 0, 0, 1, 1, 0],k = 4) == -1\n assert candidate(nums = [0, 1, 1, 1, 0, 1, 0, 0, 1, 1],k = 3) == 4\n assert candidate(nums = [0, 1, 0],k = 1) == 2\n assert candidate(nums = [1, 0, 0, 1, 0, 1, 0, 1],k = 2) == 3\n assert candidate(nums = [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],k = 8) == 4\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 20) == 0\n assert candidate(nums = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],k = 3) == 4\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 3) == 15\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],k = 6) == 1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 9) == 0\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 5) == -1\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 7) == 0\n assert candidate(nums = [0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0],k = 4) == 8\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 5) == 6\n assert candidate(nums = [1, 1, 0, 0, 1, 0, 1, 0, 0, 1],k = 4) == -1\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 5) == 10\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 15) == -1\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 5) == -1\n assert candidate(nums = [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1],k = 5) == -1\n assert candidate(nums = [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1],k = 4) == -1\n assert candidate(nums = [1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0],k = 5) == 6\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 5) == -1\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 5) == -1\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],k = 8) == -1\n assert candidate(nums = [0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1],k = 5) == -1\n assert candidate(nums = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0],k = 3) == -1\n assert candidate(nums = [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],k = 5) == -1\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 5) == 10\n assert candidate(nums = [0, 1, 1, 0, 0, 1, 1, 0, 0, 1],k = 4) == -1\n assert candidate(nums = [0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0],k = 5) == 9\n assert candidate(nums = [0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0],k = 5) == -1\n assert candidate(nums = [0, 0, 1, 0, 0, 1, 0, 1, 0, 0],k = 3) == -1\n assert candidate(nums = [0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],k = 4) == -1\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 3) == 6\n assert candidate(nums = [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],k = 4) == 2\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 6) == -1\n assert candidate(nums = [1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],k = 4) == -1\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 2) == 10\n assert candidate(nums = [0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0],k = 3) == 8\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],k = 4) == -1\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 2) == 8\n assert candidate(nums = [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],k = 6) == -1\n assert candidate(nums = [1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],k = 7) == -1\n assert candidate(nums = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],k = 6) == -1\n assert candidate(nums = [0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0],k = 7) == -1\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 15) == -1\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],k = 4) == -1\n assert candidate(nums = [0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1],k = 10) == -1\n assert candidate(nums = [1, 1, 1, 0, 0, 1, 0, 1, 0, 0],k = 3) == 3\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 20) == 0\n assert candidate(nums = [1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1],k = 4) == 3\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0],k = 5) == -1\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0],k = 3) == -1\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 10) == -1\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 7) == -1\n assert candidate(nums = [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1],k = 4) == 2\n assert candidate(nums = [0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0],k = 5) == -1\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 7) == 21\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0],k = 5) == -1\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 10) == -1\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 7) == -1\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 2) == -1\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 10) == 2\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 5) == -1\n assert candidate(nums = [1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],k = 3) == -1\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1],k = 8) == -1\n assert candidate(nums = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],k = 6) == -1\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 9) == -1\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 5) == 4\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 10) == 3\n assert candidate(nums = [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1],k = 4) == -1\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 3) == -1\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1],k = 3) == -1\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 7) == 3\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 7) == 0\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],k = 4) == -1\n assert candidate(nums = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],k = 6) == -1\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 8) == -1\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],k = 2) == 4\n assert candidate(nums = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],k = 4) == -1\n assert candidate(nums = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0],k = 3) == 6\n assert candidate(nums = [0, 0, 1, 1, 0, 0, 1, 0, 0, 1],k = 3) == -1\n assert candidate(nums = [0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0],k = 7) == -1\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().minKBitFlips", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minKBitFlips = function(nums, k) {", "container": null, "callable": "minKBitFlips", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 996, "task_id": "number-of-squareful-arrays", "difficulty": "Hard", "problem_description": "An array is squareful if the sum of every pair of adjacent elements is a perfect square.\nGiven an integer array nums, return the number of permutations of nums that are squareful.\nTwo permutations perm1 and perm2 are different if there is some index i such that perm1[i] != perm2[i].\n \nExample 1:\n\nInput: nums = [1,17,8]\nOutput: 2\nExplanation: [1,8,17] and [17,8,1] are the valid permutations.\n\nExample 2:\n\nInput: nums = [2,2,2]\nOutput: 1\n\n \nConstraints:\n\n1 <= nums.length <= 12\n0 <= nums[i] <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [9, 0, 16, 25, 36]) == 0\n assert candidate(nums = [2, 2, 2]) == 1\n assert candidate(nums = [1, 17, 8]) == 2\n assert candidate(nums = [9, 0, 9]) == 1\n assert candidate(nums = [0, 0, 0]) == 1\n assert candidate(nums = [4, 6, 15, 33, 50]) == 0\n assert candidate(nums = [0, 1, 1, 0]) == 3\n assert candidate(nums = [16, 9, 4, 0, 25]) == 0\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23]) == 0\n assert candidate(nums = [1, 1, 1, 1]) == 0\n assert candidate(nums = [4, 6, 15, 33]) == 0\n assert candidate(nums = [9, 0, 4, 10, 9]) == 0\n assert candidate(nums = [0, 0, 0, 0]) == 1\n assert candidate(nums = [1, 2, 3, 6, 10]) == 0\n assert candidate(nums = [25, 10, 5, 15, 20]) == 0\n assert candidate(nums = [9, 4, 1, 4, 9]) == 0\n assert candidate(nums = [1, 3, 5, 7, 9]) == 0\n assert candidate(nums = [2, 8, 10, 18, 26]) == 0\n assert candidate(nums = [1, 2, 5, 10, 17, 26, 37, 50, 65, 82]) == 0\n assert candidate(nums = [0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66]) == 12\n assert candidate(nums = [0, 4, 9, 16, 25, 36, 49]) == 0\n assert candidate(nums = [2, 7, 8, 18, 20, 25]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 0\n assert candidate(nums = [1, 3, 6, 10, 15, 21, 28, 36, 45]) == 4\n assert candidate(nums = [4, 6, 9, 11, 14, 16, 19, 21, 25, 27, 30, 32]) == 0\n assert candidate(nums = [100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441]) == 0\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 0\n assert candidate(nums = [2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156]) == 0\n assert candidate(nums = [10, 15, 21, 26, 30, 35, 40]) == 0\n assert candidate(nums = [16, 9, 0, 4, 25, 1]) == 0\n assert candidate(nums = [25, 36, 49, 64, 81, 100, 121]) == 0\n assert candidate(nums = [4, 6, 9, 10, 15, 21, 30, 36, 45, 55]) == 0\n assert candidate(nums = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144]) == 0\n assert candidate(nums = [0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 0\n assert candidate(nums = [4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169]) == 0\n assert candidate(nums = [18, 20, 22, 24, 26, 28, 30, 32, 34, 36]) == 0\n assert candidate(nums = [4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169]) == 0\n assert candidate(nums = [1, 2, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66]) == 0\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21]) == 0\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100]) == 0\n assert candidate(nums = [8, 18, 28, 38, 48, 58, 68, 78, 88, 98]) == 0\n assert candidate(nums = [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13]) == 0\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 0\n assert candidate(nums = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60]) == 0\n assert candidate(nums = [5, 13, 29, 34, 37, 41, 50, 53, 61, 65, 72, 74]) == 0\n assert candidate(nums = [2, 3, 6, 11, 15, 20]) == 0\n assert candidate(nums = [0, 2, 8, 18, 32, 50, 72, 98, 128, 162, 200, 242]) == 0\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]) == 0\n assert candidate(nums = [4, 1, 3, 0, 9, 16, 25, 36, 49]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 0\n assert candidate(nums = [25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256]) == 0\n assert candidate(nums = [2, 7, 11, 15, 20, 25]) == 0\n assert candidate(nums = [81, 180, 144, 121, 100, 25, 0]) == 0\n assert candidate(nums = [0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66]) == 12\n assert candidate(nums = [1, 2, 3, 6, 10, 15, 21]) == 0\n assert candidate(nums = [81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 121]) == 0\n assert candidate(nums = [2, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68]) == 0\n assert candidate(nums = [8, 17, 28, 39, 50, 61, 72, 83]) == 0\n assert candidate(nums = [2, 3, 6, 7, 8, 15, 21, 30, 35, 42, 48, 55]) == 0\n assert candidate(nums = [5, 7, 8, 12, 13, 16, 17, 24, 25, 28, 32, 33]) == 0\n assert candidate(nums = [1, 16, 81, 144, 121, 100, 25]) == 0\n assert candidate(nums = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600]) == 0\n assert candidate(nums = [1, 16, 9, 4, 0, 36, 25, 10]) == 0\n assert candidate(nums = [49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82]) == 0\n assert candidate(nums = [4, 6, 9, 10, 15, 21, 25]) == 0\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256]) == 0\n assert candidate(nums = [0, 0, 1, 1, 4, 4, 9, 9, 16, 16, 25, 25]) == 0\n assert candidate(nums = [4, 6, 9, 13, 15, 17, 21, 25, 27, 31]) == 0\n assert candidate(nums = [5, 13, 25, 41, 61, 85, 113, 145, 181, 221, 265]) == 0\n assert candidate(nums = [8, 15, 18, 23, 26, 32, 35, 38, 41]) == 0\n assert candidate(nums = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121]) == 0\n assert candidate(nums = [2, 3, 6, 5, 9, 10]) == 0\n assert candidate(nums = [8, 7, 15, 1, 28, 25, 24]) == 0\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21]) == 0\n assert candidate(nums = [1, 2, 2, 3, 6, 10]) == 0\n assert candidate(nums = [144, 169, 196, 225, 256, 289, 324, 361]) == 0\n assert candidate(nums = [3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]) == 0\n assert candidate(nums = [8, 18, 28, 38, 48, 58, 68, 78, 88, 98, 108, 118]) == 0\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]) == 0\n assert candidate(nums = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78]) == 12\n assert candidate(nums = [1, 4, 9, 16, 25, 36, 49]) == 0\n assert candidate(nums = [8, 7, 3, 12, 5, 13, 25, 16, 9]) == 0\n assert candidate(nums = [16, 9, 4, 1, 0, 25, 36, 49, 64, 81]) == 0\n assert candidate(nums = [0, 1, 4, 9, 16, 25, 36, 49]) == 0\n assert candidate(nums = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]) == 0\n assert candidate(nums = [36, 100, 144, 196, 256, 324, 400, 484, 576, 676, 784, 900]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 120]) == 0\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]) == 0\n assert candidate(nums = [4, 6, 9, 10, 13, 15, 16, 18, 19, 20, 25, 28]) == 0\n assert candidate(nums = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144]) == 0\n assert candidate(nums = [3, 12, 27, 48, 75, 108, 147, 192, 243, 300, 363, 432]) == 0\n assert candidate(nums = [49, 36, 25, 16, 9, 4, 1, 0, 81, 64, 49, 36]) == 0\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24]) == 0\n assert candidate(nums = [10, 21, 35, 51, 70, 92, 117, 144, 173, 204, 237]) == 0\n assert candidate(nums = [2, 3, 6, 11, 19, 20]) == 0\n assert candidate(nums = [8, 15, 24, 35, 46, 57, 68, 79, 90, 101, 112, 123]) == 0\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45]) == 0\n assert candidate(nums = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]) == 0\n assert candidate(nums = [1, 4, 9, 16, 25, 36, 49, 64, 81]) == 0\n assert candidate(nums = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]) == 0\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 1\n assert candidate(nums = [1, 17, 8, 2, 18, 20, 32, 50, 33, 6]) == 0\n assert candidate(nums = [1, 10, 19, 28, 37, 46, 55, 64, 73, 82, 91, 100]) == 0\n assert candidate(nums = [50, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324]) == 0\n assert candidate(nums = [10, 15, 21, 26, 35, 40, 51, 56, 65, 70, 85, 90]) == 0\n assert candidate(nums = [0, 1, 4, 9, 16, 25, 36, 49]) == 0\n assert candidate(nums = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78]) == 12\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().numSquarefulPerms", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numSquarefulPerms = function(nums) {", "container": null, "callable": "numSquarefulPerms", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 997, "task_id": "find-the-town-judge", "difficulty": "Easy", "problem_description": "In a town, there are n people labeled from 1 to n. There is a rumor that one of these people is secretly the town judge.\nIf the town judge exists, then:\n\nThe town judge trusts nobody.\nEverybody (except for the town judge) trusts the town judge.\nThere is exactly one person that satisfies properties 1 and 2.\n\nYou are given an array trust where trust[i] = [ai, bi] representing that the person labeled ai trusts the person labeled bi. If a trust relationship does not exist in trust array, then such a trust relationship does not exist.\nReturn the label of the town judge if the town judge exists and can be identified, or return -1 otherwise.\n \nExample 1:\n\nInput: n = 2, trust = [[1,2]]\nOutput: 2\n\nExample 2:\n\nInput: n = 3, trust = [[1,3],[2,3]]\nOutput: 3\n\nExample 3:\n\nInput: n = 3, trust = [[1,3],[2,3],[3,1]]\nOutput: -1\n\n \nConstraints:\n\n1 <= n <= 1000\n0 <= trust.length <= 104\ntrust[i].length == 2\nAll the pairs of trust are unique.\nai != bi\n1 <= ai, bi <= n\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 4,trust = [[1, 3], [1, 4], [2, 3], [2, 4], [4, 3]]) == 3\n assert candidate(n = 1,trust = []) == 1\n assert candidate(n = 5,trust = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1]]) == -1\n assert candidate(n = 3,trust = [[1, 3], [2, 3], [3, 1]]) == -1\n assert candidate(n = 4,trust = [[1, 2], [1, 3], [1, 4]]) == -1\n assert candidate(n = 3,trust = [[1, 3], [2, 3]]) == 3\n assert candidate(n = 2,trust = [[1, 2]]) == 2\n assert candidate(n = 3,trust = [[1, 2], [2, 1], [1, 3], [3, 1]]) == -1\n assert candidate(n = 8,trust = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 1]]) == -1\n assert candidate(n = 5,trust = [[1, 4], [2, 4], [3, 4], [4, 5], [5, 1]]) == -1\n assert candidate(n = 8,trust = [[1, 3], [2, 3], [4, 3], [5, 3], [6, 3], [7, 3], [8, 3]]) == 3\n assert candidate(n = 15,trust = [[1, 15], [2, 15], [3, 15], [4, 15], [5, 15], [6, 15], [7, 15], [8, 15], [9, 15], [10, 15], [11, 15], [12, 15], [13, 15], [14, 15]]) == 15\n assert candidate(n = 6,trust = [[1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [6, 5]]) == -1\n assert candidate(n = 10,trust = [[1, 3], [2, 3], [3, 5], [4, 5], [5, 7], [6, 7], [7, 9], [8, 9], [9, 10], [10, 1]]) == -1\n assert candidate(n = 5,trust = [[1, 4], [2, 4], [3, 4], [5, 4]]) == 4\n assert candidate(n = 8,trust = [[1, 8], [2, 8], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8]]) == 8\n assert candidate(n = 10,trust = [[1, 5], [2, 5], [3, 5], [4, 5], [6, 5], [7, 5], [8, 5], [9, 5], [10, 5]]) == 5\n assert candidate(n = 7,trust = [[1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7]]) == 7\n assert candidate(n = 5,trust = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 4], [3, 5], [4, 1], [4, 2], [5, 1], [5, 3]]) == -1\n assert candidate(n = 11,trust = [[1, 11], [2, 11], [3, 11], [4, 11], [5, 11], [6, 11], [7, 11], [8, 11], [9, 11], [10, 11]]) == 11\n assert candidate(n = 5,trust = [[1, 5], [2, 5], [3, 5], [4, 5]]) == 5\n assert candidate(n = 6,trust = [[1, 4], [2, 4], [3, 4], [5, 4], [6, 4], [4, 6]]) == -1\n assert candidate(n = 9,trust = [[1, 3], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 1]]) == -1\n assert candidate(n = 13,trust = [[1, 13], [2, 13], [3, 13], [4, 13], [5, 13], [6, 13], [7, 13], [8, 13], [9, 13], [10, 13], [11, 13], [12, 13]]) == 13\n assert candidate(n = 9,trust = [[1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [8, 7], [9, 7]]) == 7\n assert candidate(n = 6,trust = [[1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [6, 1]]) == -1\n assert candidate(n = 9,trust = [[1, 9], [2, 9], [3, 9], [4, 9], [5, 9], [6, 9], [7, 9], [8, 9], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 1]]) == 9\n assert candidate(n = 6,trust = [[1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [1, 2], [2, 3], [3, 4], [4, 5], [5, 1]]) == 6\n assert candidate(n = 10,trust = [[1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == 10\n assert candidate(n = 5,trust = [[1, 2], [2, 3], [3, 4], [4, 5]]) == -1\n assert candidate(n = 6,trust = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 2]]) == -1\n assert candidate(n = 7,trust = [[1, 4], [2, 4], [3, 4], [4, 5], [5, 6], [6, 7], [7, 1]]) == -1\n assert candidate(n = 10,trust = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1]]) == -1\n assert candidate(n = 5,trust = [[1, 3], [2, 3], [4, 5], [5, 4]]) == -1\n assert candidate(n = 7,trust = [[1, 5], [2, 5], [3, 5], [4, 5], [6, 5], [7, 5], [5, 1]]) == -1\n assert candidate(n = 5,trust = [[1, 3], [2, 3], [4, 3], [5, 3], [1, 5], [2, 5], [4, 5]]) == 3\n assert candidate(n = 9,trust = [[1, 9], [2, 9], [3, 9], [4, 9], [5, 9], [6, 9], [7, 9], [8, 9], [9, 1]]) == -1\n assert candidate(n = 10,trust = [[1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10], [10, 1]]) == -1\n assert candidate(n = 5,trust = [[1, 4], [2, 4], [3, 4], [4, 5], [5, 4]]) == -1\n assert candidate(n = 10,trust = [[1, 8], [2, 8], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8], [9, 8], [10, 8]]) == 8\n assert candidate(n = 12,trust = [[1, 12], [2, 12], [3, 12], [4, 12], [5, 12], [6, 12], [7, 12], [8, 12], [9, 12], [10, 12], [11, 12], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 1]]) == 12\n assert candidate(n = 12,trust = [[1, 12], [2, 12], [3, 12], [4, 12], [5, 12], [6, 12], [7, 12], [8, 12], [9, 12], [10, 12], [11, 12]]) == 12\n assert candidate(n = 6,trust = [[1, 3], [2, 3], [3, 1], [4, 5], [5, 4], [1, 5], [2, 6], [6, 2], [3, 4]]) == -1\n assert candidate(n = 8,trust = [[1, 5], [2, 5], [3, 5], [4, 5], [6, 5], [7, 5], [8, 5], [5, 8]]) == -1\n assert candidate(n = 10,trust = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == -1\n assert candidate(n = 10,trust = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10]]) == -1\n assert candidate(n = 10,trust = [[1, 9], [2, 9], [3, 9], [4, 9], [5, 9], [6, 9], [7, 9], [8, 9], [10, 1]]) == -1\n assert candidate(n = 8,trust = [[1, 5], [2, 5], [3, 5], [4, 5], [6, 5], [7, 5], [8, 5]]) == 5\n assert candidate(n = 9,trust = [[1, 2], [1, 3], [2, 3], [3, 1], [4, 5], [4, 6], [5, 6], [6, 4], [7, 8], [7, 9], [8, 9], [9, 7]]) == -1\n assert candidate(n = 7,trust = [[1, 4], [2, 4], [3, 4], [5, 4], [6, 4], [7, 4]]) == 4\n assert candidate(n = 8,trust = [[1, 8], [2, 8], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8], [8, 7]]) == -1\n assert candidate(n = 11,trust = [[1, 11], [2, 11], [3, 11], [4, 11], [5, 11], [6, 11], [7, 11], [8, 11], [9, 11], [10, 11], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1]]) == 11\n assert candidate(n = 12,trust = [[1, 12], [2, 12], [3, 12], [4, 12], [5, 12], [6, 12], [7, 12], [8, 12], [9, 12], [10, 12], [11, 12], [12, 10]]) == -1\n assert candidate(n = 10,trust = [[1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 6], [10, 7], [10, 8], [10, 9]]) == -1\n assert candidate(n = 5,trust = [[1, 2], [2, 1], [3, 4], [4, 3]]) == -1\n assert candidate(n = 10,trust = [[2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1]]) == 1\n assert candidate(n = 8,trust = [[1, 8], [2, 8], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8], [8, 7], [8, 1]]) == -1\n assert candidate(n = 8,trust = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 1], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 2], [8, 3]]) == -1\n assert candidate(n = 5,trust = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1], [1, 3], [2, 4], [3, 5], [4, 1], [5, 2]]) == -1\n assert candidate(n = 6,trust = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6]]) == -1\n assert candidate(n = 9,trust = [[1, 9], [2, 9], [3, 9], [4, 9], [5, 9], [6, 9], [7, 9], [8, 9], [1, 2], [2, 1], [1, 3], [3, 1], [1, 4], [4, 1], [1, 5], [5, 1], [1, 6], [6, 1], [1, 7], [7, 1], [1, 8], [8, 1]]) == 9\n assert candidate(n = 5,trust = [[1, 3], [2, 3], [4, 3], [5, 3]]) == 3\n assert candidate(n = 20,trust = [[1, 20], [2, 20], [3, 20], [4, 20], [5, 20], [6, 20], [7, 20], [8, 20], [9, 20], [10, 20], [11, 20], [12, 20], [13, 20], [14, 20], [15, 20], [16, 20], [17, 20], [18, 20], [19, 20], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 1]]) == 20\n assert candidate(n = 10,trust = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [2, 3], [4, 5], [6, 7], [8, 9], [1, 10]]) == -1\n assert candidate(n = 5,trust = [[1, 2], [1, 3], [1, 4], [1, 5], [2, 3], [2, 4], [2, 5], [3, 4], [3, 5], [4, 5]]) == 5\n assert candidate(n = 6,trust = [[1, 6], [2, 6], [3, 6], [4, 6], [5, 6]]) == 6\n assert candidate(n = 8,trust = [[1, 8], [2, 8], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 1]]) == 8\n assert candidate(n = 7,trust = [[1, 4], [2, 4], [3, 4], [5, 4], [6, 4], [1, 5], [2, 5], [3, 5], [5, 6], [6, 7]]) == -1\n assert candidate(n = 6,trust = [[1, 3], [2, 3], [3, 1], [3, 4], [4, 5], [5, 6], [6, 4]]) == -1\n assert candidate(n = 9,trust = [[1, 9], [2, 9], [3, 9], [4, 9], [5, 9], [6, 9], [7, 9], [8, 9]]) == 9\n assert candidate(n = 5,trust = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 4]]) == -1\n assert candidate(n = 7,trust = [[1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 1]]) == 7\n assert candidate(n = 7,trust = [[1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 1]]) == -1\n assert candidate(n = 6,trust = [[1, 2], [2, 3], [3, 1], [4, 5], [5, 6]]) == -1\n assert candidate(n = 5,trust = [[1, 3], [2, 3], [3, 1], [4, 5], [5, 4]]) == -1\n assert candidate(n = 8,trust = [[1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [7, 6], [8, 6]]) == 6\n assert candidate(n = 12,trust = [[1, 12], [2, 12], [3, 12], [4, 12], [5, 12], [6, 12], [7, 12], [8, 12], [9, 12], [10, 12], [11, 12], [12, 1]]) == -1\n assert candidate(n = 6,trust = [[1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [1, 2], [2, 1], [3, 4], [4, 3]]) == 6\n assert candidate(n = 10,trust = [[1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10]]) == 10\n assert candidate(n = 10,trust = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == -1\n assert candidate(n = 5,trust = [[1, 5], [2, 5], [3, 5], [4, 5], [5, 1]]) == -1\n assert candidate(n = 100,trust = [[1, 100], [2, 100], [3, 100], [4, 100], [5, 100], [6, 100], [7, 100], [8, 100], [9, 100], [10, 100], [11, 100], [12, 100], [13, 100], [14, 100], [15, 100], [16, 100], [17, 100], [18, 100], [19, 100], [20, 100], [21, 100], [22, 100], [23, 100], [24, 100], [25, 100], [26, 100], [27, 100], [28, 100], [29, 100], [30, 100], [31, 100], [32, 100], [33, 100], [34, 100], [35, 100], [36, 100], [37, 100], [38, 100], [39, 100], [40, 100], [41, 100], [42, 100], [43, 100], [44, 100], [45, 100], [46, 100], [47, 100], [48, 100], [49, 100], [50, 100], [51, 100], [52, 100], [53, 100], [54, 100], [55, 100], [56, 100], [57, 100], [58, 100], [59, 100], [60, 100], [61, 100], [62, 100], [63, 100], [64, 100], [65, 100], [66, 100], [67, 100], [68, 100], [69, 100], [70, 100], [71, 100], [72, 100], [73, 100], [74, 100], [75, 100], [76, 100], [77, 100], [78, 100], [79, 100], [80, 100], [81, 100], [82, 100], [83, 100], [84, 100], [85, 100], [86, 100], [87, 100], [88, 100], [89, 100], [90, 100], [91, 100], [92, 100], [93, 100], [94, 100], [95, 100], [96, 100], [97, 100], [98, 100], [99, 100]]) == 100\n assert candidate(n = 6,trust = [[1, 4], [2, 4], [3, 4], [5, 4], [6, 4]]) == 4\n assert candidate(n = 7,trust = [[1, 5], [2, 5], [3, 5], [4, 5], [6, 5], [7, 5]]) == 5\n assert candidate(n = 10,trust = [[1, 5], [2, 5], [3, 5], [4, 5], [6, 5], [7, 5], [8, 5], [9, 5], [1, 10], [2, 10], [3, 10], [4, 10]]) == -1\n assert candidate(n = 10,trust = [[1, 3], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == -1\n"}, "metadata": {"canonical_parameter_names": ["n", "trust"], "leetcode_dataset_entry_point": "Solution().findJudge", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findJudge = function(n, trust) {", "container": null, "callable": "findJudge", "parameters": [{"name": "n", "type": "number"}, {"name": "trust", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 998, "task_id": "maximum-binary-tree-ii", "difficulty": "Medium", "problem_description": "A maximum tree is a tree where every node has a value greater than any other value in its subtree.\nYou are given the root of a maximum binary tree and an integer val.\nJust as in the previous problem, the given tree was constructed from a list a (root = Construct(a)) recursively with the following Construct(a) routine:\n\nIf a is empty, return null.\nOtherwise, let a[i] be the largest element of a. Create a root node with the value a[i].\nThe left child of root will be Construct([a[0], a[1], ..., a[i - 1]]).\nThe right child of root will be Construct([a[i + 1], a[i + 2], ..., a[a.length - 1]]).\nReturn root.\n\nNote that we were not given a directly, only a root node root = Construct(a).\nSuppose b is a copy of a with the value val appended to it. It is guaranteed that b has unique values.\nReturn Construct(b).\n \nExample 1:\n\n\nInput: root = [4,1,3,null,null,2], val = 5\nOutput: [5,4,null,1,3,null,null,2]\nExplanation: a = [1,4,2,3], b = [1,4,2,3,5]\n\nExample 2:\n\n\nInput: root = [5,2,4,null,1], val = 3\nOutput: [5,2,4,null,1,null,3]\nExplanation: a = [2,1,5,4], b = [2,1,5,4,3]\n\nExample 3:\n\n\nInput: root = [5,2,3,null,1], val = 4\nOutput: [5,2,4,null,1,3]\nExplanation: a = [2,1,5,3], b = [2,1,5,3,4]\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 100].\n1 <= Node.val <= 100\nAll the values of the tree are unique.\n1 <= val <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(root = tree_node([4, 1, 3, None, None, 2]),val = 5), tree_node([5, 4, None, 1, 3, None, None, 2]))\n assert is_same_tree(candidate(root = tree_node([5, 2, 4, None, 1]),val = 3), tree_node([5, 2, 4, None, 1, None, 3]))\n assert is_same_tree(candidate(root = tree_node([5, 2, 3, None, 1]),val = 4), tree_node([5, 2, 4, None, 1, 3]))\n assert is_same_tree(candidate(root = tree_node([50, 20, 40, None, 10, 30, None, None, None, 5, 15, 25, 35]),val = 28), tree_node([50, 20, 40, None, 10, 30, 28, None, None, 5, 15, None, None, 25, 35]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 11, 1, 6, None, 12, 0, 5, None, 9, None, 13]),val = 15), tree_node([15, 8, None, 3, 11, 1, 6, None, 12, 0, 5, None, 9, None, 13]))\n assert is_same_tree(candidate(root = tree_node([30, 20, 40, 10, None, None, 50, 5, None, None, None, 45]),val = 35), tree_node([35, 30, None, 20, 40, 10, None, None, 50, 5, None, None, None, 45]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),val = 6), tree_node([10, 5, 15, 3, 7, None, 18, None, None, None, None, None, 6]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 15, 5, None, None, None, 3, 7]),val = 25), tree_node([25, 20, None, 10, 15, 5, None, None, None, 3, 7]))\n assert is_same_tree(candidate(root = tree_node([2, 1]),val = 3), tree_node([3, 2, None, 1]))\n assert is_same_tree(candidate(root = tree_node([3, 2, 4, None, None, None, 5]),val = 1), tree_node([3, 2, 4, None, None, None, 5, None, 1]))\n assert is_same_tree(candidate(root = tree_node([30, 10, 20, None, None, 15, 25]),val = 22), tree_node([30, 10, 22, None, None, 20, None, 15, 25]))\n assert is_same_tree(candidate(root = tree_node([50, 20, 40, None, 10, 30, None, None, None, 5, 15, 25, 35]),val = 22), tree_node([50, 20, 40, None, 10, 30, 22, None, None, 5, 15, None, None, 25, 35]))\n assert is_same_tree(candidate(root = tree_node([9, 7, 10, 5, 8, None, None, 3, 6]),val = 11), tree_node([11, 9, None, 7, 10, 5, 8, None, None, 3, 6]))\n assert is_same_tree(candidate(root = tree_node([2, 1, None, 4, 3]),val = 5), tree_node([5, 2, None, 1, None, 4, 3]))\n assert is_same_tree(candidate(root = tree_node([75, 50, 80, 30, 60, 78, 90, 10, None, 55, None, None, 77, None, None, None, 95]),val = 65), tree_node([75, 50, 80, 30, 60, 78, 90, 10, None, 55, None, None, 77, None, 65, None, 95]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 25, 5, 15, 22, 30, 2, 7, 13, 17, 18, 27, 29, 31, 1, 3, 6, 8, 12, 14, 16, 19, 21, 23, 26, 24, 28, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]),val = 32), tree_node([32, 20, None, 10, 25, 5, 15, 22, 30, 2, 7, 13, 17, 18, 27, 29, 31, 1, 3, 6, 8, 12, 14, 16, 19, 21, 23, 26, 24, 28]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),val = 20), tree_node([20, 1, None, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, None, 6, 12, 20, None, None, None, 7, 13, 17, None, None, None, None, None, 25]),val = 14), tree_node([14, 10, None, 5, 15, None, 6, 12, 20, None, None, None, 7, 13, 17, None, None, None, None, None, 25]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 8, 1, 4, 6, 9, None, None, None, 5]),val = 12), tree_node([12, 7, None, 3, 8, 1, 4, 6, 9, None, None, None, 5]))\n assert is_same_tree(candidate(root = tree_node([3, 2, 1]),val = 4), tree_node([4, 3, None, 2, 1]))\n assert is_same_tree(candidate(root = tree_node([60, 30, 80, 20, 40, 70, 90, 10, 25, 35, 45, 65, 75, 85, 95]),val = 88), tree_node([88, 60, None, 30, 80, 20, 40, 70, 90, 10, 25, 35, 45, 65, 75, 85, 95]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 8, 1, 4, 6, 9, None, 2, None, 5]),val = 1), tree_node([7, 3, 8, 1, 4, 6, 9, None, 2, None, 5, None, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([60, 30, 80, 10, 50, 70, 90, None, None, 20, 40, None, None, 75, None]),val = 100), tree_node([100, 60, None, 30, 80, 10, 50, 70, 90, None, None, 20, 40, None, None, 75]))\n assert is_same_tree(candidate(root = tree_node([6, 3, 8, 1, 5, 7, 9, 0, 2, 4, 6, 8, 10]),val = 7), tree_node([7, 6, None, 3, 8, 1, 5, 7, 9, 0, 2, 4, 6, 8, 10]))\n assert is_same_tree(candidate(root = tree_node([1, 2, None, None, 3, None, None, 4, None, None, 5, None, None, 6, None, None, 7]),val = 8), tree_node([8, 1, None, 2, None, None, 3]))\n assert is_same_tree(candidate(root = tree_node([50, 25, 75, 10, 40, 60, 80, 5, 15, 30, 45, 55, 65, 75, 85]),val = 90), tree_node([90, 50, None, 25, 75, 10, 40, 60, 80, 5, 15, 30, 45, 55, 65, 75, 85]))\n assert is_same_tree(candidate(root = tree_node([9, 3, 10, 1, 5, None, None, 0, 4, None, 6]),val = 11), tree_node([11, 9, None, 3, 10, 1, 5, None, None, 0, 4, None, 6]))\n assert is_same_tree(candidate(root = tree_node([5, 2, 4, None, 1, None, 3, None, None, None, None]),val = 35), tree_node([35, 5, None, 2, 4, None, 1, None, 3]))\n assert is_same_tree(candidate(root = tree_node([6, 3, 9, 2, 5, 8, 10, None, None, 1, 4, 7, None, None, None, None, None, None, None]),val = 11), tree_node([11, 6, None, 3, 9, 2, 5, 8, 10, None, None, 1, 4, 7]))\n assert is_same_tree(candidate(root = tree_node([3, 1, 4, None, 2, None, 6, 5, None, None, 7]),val = 8), tree_node([8, 3, None, 1, 4, None, 2, None, 6, 5, None, None, 7]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 20, None, None, 15, 30, 12, None, None, 25, 28, None, None, 35]),val = 33), tree_node([33, 10, None, 5, 20, None, None, 15, 30, 12, None, None, 25, 28, None, None, 35]))\n assert is_same_tree(candidate(root = tree_node([15, 10, 20, 5, 12, 18, 25, 1, 6, None, 14, 16, None, 19, 23, None, None, None, 3, None, None, None, 11, None, None, None, None, None, None, 2, None, None, None, None]),val = 17), tree_node([17, 15, None, 10, 20, 5, 12, 18, 25, 1, 6, None, 14, 16, None, 19, 23, None, None, None, 3, None, None, None, 11, None, None, None, None, None, None, 2]))\n assert is_same_tree(candidate(root = tree_node([15, 5, 16, 2, 7, None, None, 1, 3, None, 6, 4, None, None, None, None, None]),val = 10), tree_node([15, 5, 16, 2, 7, None, 10, 1, 3, None, 6, None, None, 4]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 5, 9, 11, None, 2, 4, 7, None, None, 6, None, None, None, None, None]),val = 12), tree_node([12, 8, None, 3, 10, 1, 5, 9, 11, None, 2, 4, 7, None, None, 6]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 7, 2, 4, 6, 8]),val = 1), tree_node([5, 3, 7, 2, 4, 6, 8, None, None, None, None, None, None, None, 1]))\n assert is_same_tree(candidate(root = tree_node([9, 5, 11, 3, 7, 10, 13, 1, 4, 6, 8, 9, 12, 14, 15]),val = 16), tree_node([16, 9, None, 5, 11, 3, 7, 10, 13, 1, 4, 6, 8, 9, 12, 14, 15]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, None, None, None, None, None, None, 37]),val = 22), tree_node([25, 15, 35, 10, 20, 30, 40, None, None, None, None, None, None, 37, 22]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 8, None, 4, 9, None, None, 5, None, 10, 6, None, None, 11]),val = 12), tree_node([12, 7, None, 3, 8, None, 4, 9, None, None, 5, None, 10, 6, None, None, 11]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 25, None, 15, 22, 30, None, None, 13, None, None, 28]),val = 18), tree_node([20, 10, 25, None, 15, 22, 30, None, None, 13, None, None, 28, None, None, None, 18]))\n assert is_same_tree(candidate(root = tree_node([7, 5, 10, 4, 6, 9, 12, None, None, 2, None, 8, None, 11, None, None, None, 13]),val = 14), tree_node([14, 7, None, 5, 10, 4, 6, 9, 12, None, None, 2, None, 8, None, 11, None, None, None, 13]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 8, 1, 4, 6, 9, None, 2, None, 5]),val = 11), tree_node([11, 7, None, 3, 8, 1, 4, 6, 9, None, 2, None, 5]))\n assert is_same_tree(candidate(root = tree_node([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5]),val = 10), tree_node([10, 6, None, 2, 8, 0, 4, 7, 9, None, None, 3, 5]))\n assert is_same_tree(candidate(root = tree_node([3, 1, 4, None, 2]),val = 0), tree_node([3, 1, 4, None, 2, None, 0]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, 7, None, 13, 22, 28, None, None, None, None, None, 6, None, None, None, None, None, 27, None, None]),val = 18), tree_node([20, 10, 30, 5, 15, 25, 35, 1, 7, None, 13, 22, 28, None, 18, None, None, None, 6, None, None, None, None, None, 27]))\n assert is_same_tree(candidate(root = tree_node([8, 5, 9, 3, 7, 6, 10, 1, 4, None, None, None, None, None, 11]),val = 12), tree_node([12, 8, None, 5, 9, 3, 7, 6, 10, 1, 4, None, None, None, None, None, 11]))\n assert is_same_tree(candidate(root = tree_node([15, 10, 20, 5, 12, 18, 25, 3, 7, 11, 14, 16, 19, 23, 27, 1, 4, 6, 8, 9, 13, 15, 17, 21, 22, 24, 26, 28]),val = 29), tree_node([29, 15, None, 10, 20, 5, 12, 18, 25, 3, 7, 11, 14, 16, 19, 23, 27, 1, 4, 6, 8, 9, 13, 15, 17, 21, 22, 24, 26, 28]))\n assert is_same_tree(candidate(root = tree_node([50, 20, 30, 10, 25, 28, 35, None, 15, None, None, None, None, None, 40]),val = 45), tree_node([50, 20, 45, 10, 25, 30, None, None, 15, None, None, 28, 35, None, None, None, None, None, 40]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 12, 2, 7, None, 13, 1, None, 6, 8]),val = 14), tree_node([14, 10, None, 5, 12, 2, 7, None, 13, 1, None, 6, 8]))\n assert is_same_tree(candidate(root = tree_node([9, 6, 12, 3, 8, 11, 15, None, 5, 7, None, None, 13, None, None, 16, 17]),val = 14), tree_node([14, 9, None, 6, 12, 3, 8, 11, 15, None, 5, 7, None, None, 13, None, None, 16, 17]))\n assert is_same_tree(candidate(root = tree_node([50, 20, 40, None, 10, 30, None, None, None, 5, 15, 25, 35]),val = 45), tree_node([50, 20, 45, None, 10, 40, None, None, None, 30, None, 5, 15, 25, 35]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 8, 1, 4, 6, 9, None, 2, None, 5]),val = 10), tree_node([10, 7, None, 3, 8, 1, 4, 6, 9, None, 2, None, 5]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, None, 200, 10, 30, 60, 90, 180, 220]),val = 120), tree_node([120, 100, None, 50, 150, 25, 75, None, 200, 10, 30, 60, 90, 180, 220]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 4, None, 12, None, 2, 5, 7, None, None, 6, 9, 11]),val = 1), tree_node([8, 3, 10, 1, 4, None, 12, None, 2, 5, 7, None, 1, 6, 9, 11]))\n assert is_same_tree(candidate(root = tree_node([50, 20, 40, None, 10, 30, None, None, None, 5, 15, 25, 35]),val = 9), tree_node([50, 20, 40, None, 10, 30, 9, None, None, 5, 15, None, None, 25, 35]))\n assert is_same_tree(candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 10, 25, 35, 45, 55, 65, 75, 85]),val = 42), tree_node([50, 30, 70, 20, 40, 60, 80, 10, 25, 35, 45, 55, 65, 75, 85, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 42]))\n assert is_same_tree(candidate(root = tree_node([9, 3, 12, 1, 6, 11, 13, None, 2, 5, 7, None, None, 10, None, None, None, None, None]),val = 8), tree_node([9, 3, 12, 1, 6, 11, 13, None, 2, 5, 7, None, None, 10, 8]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 8, 1, 4, 6, 9, None, 2, None, 5]),val = 6), tree_node([7, 3, 8, 1, 4, 6, 9, None, 2, None, 5, None, None, None, 6]))\n assert is_same_tree(candidate(root = tree_node([6, 2, 8, 1, 4, 7, 9, None, None, 3, 5]),val = 10), tree_node([10, 6, None, 2, 8, 1, 4, 7, 9, None, None, 3, 5]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, None, None, 12, 20, None, None, 11, 13]),val = 8), tree_node([10, 5, 15, None, None, 12, 20, None, None, 11, 13, None, None, None, 8]))\n assert is_same_tree(candidate(root = tree_node([1]),val = 2), tree_node([2, 1]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 8, 2, 4, None, 9, 1, None, 7, None, 6]),val = 13), tree_node([13, 5, None, 3, 8, 2, 4, None, 9, 1, None, 7, None, 6]))\n assert is_same_tree(candidate(root = tree_node([7, 2, 11, 1, 6, 10, 13, 0, 5, None, 9, 8, 12, None, 14]),val = 16), tree_node([16, 7, None, 2, 11, 1, 6, 10, 13, 0, 5, None, 9, 8, 12, None, 14]))\n assert is_same_tree(candidate(root = tree_node([1, 3, None, 2]),val = 4), tree_node([4, 1, None, 3, None, 2]))\n assert is_same_tree(candidate(root = tree_node([15, 5, 25, 3, 10, None, 30, 2, 4, 7, 13, 27, 35, 26, None, None, None, None, None, 36, 37]),val = 38), tree_node([38, 15, None, 5, 25, 3, 10, None, 30, 2, 4, 7, 13, 27, 35, 26, None, None, None, None, None, 36, 37]))\n assert is_same_tree(candidate(root = tree_node([90, 60, 100, 40, 70, 95, 110, 20, 50, 65, 75, 92, 98, None, None, 10, 30, 45, 55, None, 62, 68, 73, 85, 91, 96, 105, None, None, None, None, None, None, None, None, None, None, None, None, 35]),val = 88), tree_node([90, 60, 100, 40, 70, 95, 110, 20, 50, 65, 75, 92, 98, None, 88, 10, 30, 45, 55, None, 62, 68, 73, 85, 91, 96, 105, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 35]))\n assert is_same_tree(candidate(root = tree_node([10, 4, 12, 2, 7, 11, 14, 1, 3, 5, 8, 9, 13, 15]),val = 16), tree_node([16, 10, None, 4, 12, 2, 7, 11, 14, 1, 3, 5, 8, 9, 13, 15]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 2, 6, 12, 18, None, None, None, None, 11, 13, None, None, None, None, 16, 20]),val = 9), tree_node([10, 5, 15, 2, 6, 12, 18, None, None, None, None, 11, 13, None, 9, None, None, 16, 20]))\n assert is_same_tree(candidate(root = tree_node([15, 10, 20, 5, 12, 17, 25, 3, 7, 11, 13, None, 18, None, 2, 6, 8, 9, 14, 16, 19, 21, 23, None, None, None, None, None, None, None, None, 22, 24, 26]),val = 27), tree_node([27, 15, None, 10, 20, 5, 12, 17, 25, 3, 7, 11, 13, None, 18, None, 2, 6, 8, 9, 14, 16, 19, 21, 23, None, None, None, None, None, None, None, None, 22, 24, 26]))\n assert is_same_tree(candidate(root = tree_node([8, 5, 10, 2, 6, None, 15, None, None, None, None, 12]),val = 7), tree_node([8, 5, 10, 2, 6, None, 15, None, None, None, None, 12, 7]))\n assert is_same_tree(candidate(root = tree_node([75, 50, 80, 25, 60, 78, 85, 10, 30, 55, 65, None, 79, None, 20, 40, 53, None, None, 58]),val = 100), tree_node([100, 75, None, 50, 80, 25, 60, 78, 85, 10, 30, 55, 65, None, 79, None, 20, 40, 53, None, None, 58]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),val = 16), tree_node([16, 1, None, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]))\n assert is_same_tree(candidate(root = tree_node([3, 2, 4, None, None, None, 5]),val = 6), tree_node([6, 3, None, 2, 4, None, None, None, 5]))\n assert is_same_tree(candidate(root = tree_node([50, 20, 40, None, 10, 30, None, None, None, 5, 15, 25, 35]),val = 60), tree_node([60, 50, None, 20, 40, None, 10, 30, None, None, None, 5, 15, 25, 35]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 8, None, None, 5, 9, None, 4]),val = 6), tree_node([7, 3, 8, None, None, 5, 9, None, 4, None, 6]))\n assert is_same_tree(candidate(root = tree_node([15, 7, 16, 3, 9, 11, 17, 1, 5, 8, 10, 12, 13, None, 4, 6, None, 2, 14]),val = 18), tree_node([18, 15, None, 7, 16, 3, 9, 11, 17, 1, 5, 8, 10, 12, 13, None, 4, 6, None, 2, 14]))\n assert is_same_tree(candidate(root = tree_node([7, 4, 9, 2, 5, None, 10, 1, 3, 6, 8, None, None, None, None, None, 11]),val = 7), tree_node([7, 4, 9, 2, 5, None, 10, 1, 3, 6, 8, None, 7, None, None, None, 11]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 180]),val = 130), tree_node([130, 100, None, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 180]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 2, 7, None, 18, 1, 3, 6, 9, None, None, None, None, None, 16, 17]),val = 20), tree_node([20, 10, None, 5, 15, 2, 7, None, 18, 1, 3, 6, 9, None, None, None, None, None, 16, 17]))\n assert is_same_tree(candidate(root = tree_node([9, 3, 7, None, 6, 4, 8]),val = 10), tree_node([10, 9, None, 3, 7, None, 6, 4, 8]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180]),val = 90), tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 90]))\n assert is_same_tree(candidate(root = tree_node([75, 50, 80, 25, 60, 78, 85, 10, 30, 55, 65, None, 79, None, 20, 40, 53, None, None, 58]),val = 27), tree_node([75, 50, 80, 25, 60, 78, 85, 10, 30, 55, 65, None, 79, None, 27, 40, 53, None, None, 58, None, None, None, None, None, 20]))\n assert is_same_tree(candidate(root = tree_node([75, 50, 80, 25, 60, 78, 85, 10, 30, 55, 65, None, 79, None, 20, 40, 53, None, None, 58]),val = 10), tree_node([75, 50, 80, 25, 60, 78, 85, 10, 30, 55, 65, None, 79, None, 20, 40, 53, None, None, 58, None, None, None, None, None, None, 10]))\n assert is_same_tree(candidate(root = tree_node([75, 50, 80, 25, 60, 78, 85, 10, 30, 55, 65, None, 79, None, 20, 40, 53, None, None, 58]),val = 62), tree_node([75, 50, 80, 25, 60, 78, 85, 10, 30, 55, 65, None, 79, None, 62, 40, 53, None, None, 58, None, None, None, None, None, 20]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 18, 23, 28, 33, 38, 1, 4, 6, 8, 9, 11, 13, 14, 16, 17, 19, 21, 22, 24, 26, 27, 29, 31, 32, 34, 36, 37, 39, 40]),val = 41), tree_node([41, 20, None, 10, 30, 5, 15, 25, 35, 2, 7, 12, 18, 23, 28, 33, 38, 1, 4, 6, 8, 9, 11, 13, 14, 16, 17, 19, 21, 22, 24, 26, 27, 29, 31, 32, 34, 36, 37, 39, 40]))\n"}, "metadata": {"canonical_parameter_names": ["root", "val"], "leetcode_dataset_entry_point": "Solution().insertIntoMaxTree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var insertIntoMaxTree = function(root, val) {", "container": null, "callable": "insertIntoMaxTree", "parameters": [{"name": "root", "type": "TreeNode"}, {"name": "val", "type": "number"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 999, "task_id": "available-captures-for-rook", "difficulty": "Easy", "problem_description": "You are given an 8 x 8 matrix representing a chessboard. There is exactly one white rook represented by 'R', some number of white bishops 'B', and some number of black pawns 'p'. Empty squares are represented by '.'.\nA rook can move any number of squares horizontally or vertically (up, down, left, right) until it reaches another piece or the edge of the board. A rook is attacking a pawn if it can move to the pawn's square in one move.\nNote: A rook cannot move through other pieces, such as bishops or pawns. This means a rook cannot attack a pawn if there is another piece blocking the path.\nReturn the number of pawns the white rook is attacking.\n \nExample 1:\n\n\nInput: board = [[\".\",\".\",\".\",\".\",\".\",\".\",\".\",\".\"],[\".\",\".\",\".\",\"p\",\".\",\".\",\".\",\".\"],[\".\",\".\",\".\",\"R\",\".\",\".\",\".\",\"p\"],[\".\",\".\",\".\",\".\",\".\",\".\",\".\",\".\"],[\".\",\".\",\".\",\".\",\".\",\".\",\".\",\".\"],[\".\",\".\",\".\",\"p\",\".\",\".\",\".\",\".\"],[\".\",\".\",\".\",\".\",\".\",\".\",\".\",\".\"],[\".\",\".\",\".\",\".\",\".\",\".\",\".\",\".\"]]\nOutput: 3\nExplanation:\nIn this example, the rook is attacking all the pawns.\n\nExample 2:\n\n\nInput: board = [[\".\",\".\",\".\",\".\",\".\",\".\",\".\"],[\".\",\"p\",\"p\",\"p\",\"p\",\"p\",\".\",\".\"],[\".\",\"p\",\"p\",\"B\",\"p\",\"p\",\".\",\".\"],[\".\",\"p\",\"B\",\"R\",\"B\",\"p\",\".\",\".\"],[\".\",\"p\",\"p\",\"B\",\"p\",\"p\",\".\",\".\"],[\".\",\"p\",\"p\",\"p\",\"p\",\"p\",\".\",\".\"],[\".\",\".\",\".\",\".\",\".\",\".\",\".\",\".\"],[\".\",\".\",\".\",\".\",\".\",\".\",\".\",\".\"]]\nOutput: 0\nExplanation:\nThe bishops are blocking the rook from attacking any of the pawns.\n\nExample 3:\n\n\nInput: board = [[\".\",\".\",\".\",\".\",\".\",\".\",\".\",\".\"],[\".\",\".\",\".\",\"p\",\".\",\".\",\".\",\".\"],[\".\",\".\",\".\",\"p\",\".\",\".\",\".\",\".\"],[\"p\",\"p\",\".\",\"R\",\".\",\"p\",\"B\",\".\"],[\".\",\".\",\".\",\".\",\".\",\".\",\".\",\".\"],[\".\",\".\",\".\",\"B\",\".\",\".\",\".\",\".\"],[\".\",\".\",\".\",\"p\",\".\",\".\",\".\",\".\"],[\".\",\".\",\".\",\".\",\".\",\".\",\".\",\".\"]]\nOutput: 3\nExplanation:\nThe rook is attacking the pawns at positions b5, d6, and f5.\n\n \nConstraints:\n\nboard.length == 8\nboard[i].length == 8\nboard[i][j] is either 'R', '.', 'B', or 'p'\nThere is exactly one cell with board[i][j] == 'R'\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', '.'], ['p', 'p', '.', 'R', '.', 'p', 'B', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'B', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 3\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', 'p', 'p', 'p', 'p', '.', '.'], ['.', 'p', 'p', 'B', 'p', 'p', '.', '.'], ['.', 'p', 'B', 'R', 'B', 'p', '.', '.'], ['.', 'p', 'p', 'B', 'p', 'p', '.', '.'], ['.', 'p', 'p', 'p', 'p', 'p', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', 'p'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 3\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'p', 'p', 'p', '.', '.', '.'], ['p', '.', 'B', 'R', '.', 'B', 'p', '.'], ['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', 'p', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 1\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', 'R', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', 'p'], ['.', '.', '.', '.', '.', '.', '.', 'p']]) == 0\n assert candidate(board = [['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', 'p', '.', '.', '.'], ['p', '.', '.', '.', '.', '.', 'p', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', 'p', '.', '.', 'p', '.', '.'], ['.', 'B', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'R', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'p', 'p', 'p', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', '.', '.', '.', '.', 'p', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'p', 'R', 'p', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 2\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'B', '.', '.', '.', '.'], ['.', '.', '.', '.', 'R', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', 'p', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', '.', '.', 'p', '.', 'p', '.'], ['.', '.', 'B', '.', '.', '.', '.', '.'], ['.', 'p', '.', 'R', '.', 'p', '.', '.'], ['.', '.', '.', '.', 'B', '.', '.', '.'], ['.', 'p', '.', '.', 'p', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 2\n assert candidate(board = [['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'B', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', 'R', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', 'p', 'p']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['p', '.', '.', 'p', '.', '.', '.', '.'], ['.', '.', 'B', '.', '.', 'B', '.', '.'], ['.', '.', '.', 'p', '.', 'p', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 1\n assert candidate(board = [['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['p', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', 'p', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', 'p'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', '.'], ['.', '.', 'p', '.', 'B', '.', 'p', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', 'p', '.', 'B', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 1\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', 'p', '.', '.', 'p', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', 'p', '.', '.', '.'], ['.', '.', 'p', '.', '.', '.', 'p', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', 'p', '.', '.', 'p', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'B', '.', '.', '.', 'B', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'B', 'p', 'R', 'p', 'B', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 2\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', '.', 'R', 'p', '.', '.', '.'], ['.', '.', 'B', '.', '.', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 3\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['p', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', 'B', 'p', '.'], ['.', '.', 'p', '.', 'p', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', 'B', '.', '.'], ['.', '.', '.', '.', '.', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', 'p', 'R', 'p', 'p', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 2\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', 'B', '.', '.', 'p', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['p', '.', '.', 'p', '.', '.', '.', 'p']]) == 1\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', 'R', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', 'p', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', 'p']]) == 1\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'p', '.', 'p', '.', '.', '.'], ['.', '.', '.', 'B', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', 'p', 'p', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['p', '.', '.', '.', '.', 'p', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', 'p']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', 'p', 'p', 'p', 'p', 'p', 'p']]) == 1\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', '.', 'R', '.', 'B', '.', '.'], ['.', '.', '.', '.', 'p', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 1\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', 'p', '.', 'B', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', '.', '.', '.', '.', 'p', '.'], ['p', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 1\n assert candidate(board = [['.', '.', 'p', '.', 'B', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', '.', 'R', '.', '.', 'p', '.'], ['.', '.', 'B', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', 'p', '.', '.', '.'], ['.', '.', '.', '.', '.', 'B', '.', '.'], ['.', '.', '.', '.', '.', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 2\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', 'p', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 1\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', '.'], ['p', '.', '.', 'R', '.', '.', 'p', '.'], ['.', 'p', '.', '.', 'p', '.', '.', '.'], ['.', '.', 'B', '.', '.', 'B', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', '.', '.', '.', '.', '.', '.']]) == 3\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'p', 'R', '.', 'p', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 2\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['p', 'p', 'p', 'p', 'p', 'p', 'p', 'p']]) == 1\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', '.', 'p', '.', 'p', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', 'R', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['p', '.', 'p', '.', '.', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['p', '.', '.', '.', 'p', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', 'p', '.', 'p']]) == 1\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['p', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'p', 'p', 'p', 'p', 'p', 'p']]) == 1\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', 'p', '.', '.', '.', '.', 'p', '.'], ['B', '.', '.', '.', '.', '.', '.', 'B'], ['.', 'p', '.', '.', '.', '.', 'p', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'p', 'B', '.', '.', '.', '.'], ['.', '.', '.', 'R', 'p', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 1\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'p', 'B', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', 'p', 'p', 'p', 'p']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'B', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', 'p', '.', '.', '.'], ['.', 'p', '.', '.', '.', 'B', '.', '.'], ['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['p', '.', 'p', '.', 'p', '.', 'p', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', '.'], ['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', 'p', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', '.']]) == 3\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'p', '.', '.', '.', 'p'], ['.', 'p', '.', 'R', '.', 'p', '.', '.'], ['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', 'B', '.', '.', 'B', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 3\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', 'B', 'p', 'p', 'B', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 1\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', 'R', '.', '.', '.'], ['.', 'p', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', 'p', '.']]) == 0\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', '.', '.', '.', '.', '.', '.'], ['p', '.', '.', 'R', '.', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', 'B', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', 'p', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 2\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', 'p', 'B', 'p', 'R', 'p', 'B', 'p'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 2\n assert candidate(board = [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', 'p', '.', 'p', '.', 'p', '.', 'p']]) == 1\n assert candidate(board = [['.', '.', 'p', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['p', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', 'R', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', 'p', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.']]) == 0\n"}, "metadata": {"canonical_parameter_names": ["board"], "leetcode_dataset_entry_point": "Solution().numRookCaptures", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numRookCaptures = function(board) {", "container": null, "callable": "numRookCaptures", "parameters": [{"name": "board", "type": "character[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1000, "task_id": "minimum-cost-to-merge-stones", "difficulty": "Hard", "problem_description": "There are n piles of stones arranged in a row. The ith pile has stones[i] stones.\nA move consists of merging exactly k consecutive piles into one pile, and the cost of this move is equal to the total number of stones in these k piles.\nReturn the minimum cost to merge all piles of stones into one pile. If it is impossible, return -1.\n \nExample 1:\n\nInput: stones = [3,2,4,1], k = 2\nOutput: 20\nExplanation: We start with [3, 2, 4, 1].\nWe merge [3, 2] for a cost of 5, and we are left with [5, 4, 1].\nWe merge [4, 1] for a cost of 5, and we are left with [5, 5].\nWe merge [5, 5] for a cost of 10, and we are left with [10].\nThe total cost was 20, and this is the minimum possible.\n\nExample 2:\n\nInput: stones = [3,2,4,1], k = 3\nOutput: -1\nExplanation: After any merge operation, there are 2 piles left, and we can't merge anymore. So the task is impossible.\n\nExample 3:\n\nInput: stones = [3,5,1,2,6], k = 3\nOutput: 25\nExplanation: We start with [3, 5, 1, 2, 6].\nWe merge [5, 1, 2] for a cost of 8, and we are left with [3, 8, 6].\nWe merge [3, 8, 6] for a cost of 17, and we are left with [17].\nThe total cost was 25, and this is the minimum possible.\n\n \nConstraints:\n\nn == stones.length\n1 <= n <= 30\n1 <= stones[i] <= 100\n2 <= k <= 30\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == -1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9],k = 2) == 135\n assert candidate(stones = [3, 2, 4, 1],k = 3) == -1\n assert candidate(stones = [1, 2, 3, 4, 5],k = 3) == 21\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 3) == -1\n assert candidate(stones = [4, 3, 2],k = 2) == 14\n assert candidate(stones = [10, 20, 30, 40, 50],k = 2) == 330\n assert candidate(stones = [4, 4, 4, 4, 4],k = 2) == 48\n assert candidate(stones = [15, 10, 5, 10, 15],k = 2) == 125\n assert candidate(stones = [3, 2, 1],k = 3) == 6\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3) == -1\n assert candidate(stones = [1, 3, 5, 7, 9, 11],k = 2) == 85\n assert candidate(stones = [7, 3, 8, 1, 12, 10, 6],k = 3) == 87\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 88\n assert candidate(stones = [4, 4, 4, 4],k = 2) == 32\n assert candidate(stones = [3, 2, 4, 1],k = 2) == 20\n assert candidate(stones = [5, 1, 2, 4, 3],k = 2) == 33\n assert candidate(stones = [1, 2, 3, 4, 5, 6],k = 3) == -1\n assert candidate(stones = [3, 5, 1, 2, 6],k = 3) == 25\n assert candidate(stones = [10, 20, 30, 40, 50],k = 5) == 150\n assert candidate(stones = [5, 17, 19, 8, 45, 30],k = 3) == -1\n assert candidate(stones = [7, 7, 7, 7, 7, 7],k = 3) == -1\n assert candidate(stones = [10, 15, 20, 25],k = 2) == 140\n assert candidate(stones = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 5) == -1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 5) == -1\n assert candidate(stones = [5, 17, 9, 4, 13, 8, 11],k = 3) == 123\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],k = 4) == -1\n assert candidate(stones = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],k = 4) == 910\n assert candidate(stones = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60],k = 6) == -1\n assert candidate(stones = [22, 15, 33, 11, 7, 19, 25, 28],k = 4) == -1\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25],k = 5) == 269\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 15) == -1\n assert candidate(stones = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 6) == -1\n assert candidate(stones = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 3) == 450\n assert candidate(stones = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60],k = 10) == -1\n assert candidate(stones = [1, 3, 2, 5, 4, 6, 9, 8, 7, 10, 13, 12, 11, 14, 17, 16, 15, 18, 21, 20, 19, 22, 25, 24, 23, 26, 29, 28, 27, 30],k = 3) == -1\n assert candidate(stones = [10, 15, 20, 25, 30, 35, 40, 45, 50],k = 3) == 535\n assert candidate(stones = [100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28],k = 4) == -1\n assert candidate(stones = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == -1\n assert candidate(stones = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 2) == 2175\n assert candidate(stones = [5, 3, 8, 6, 2, 7, 4, 9, 1, 12, 11, 10, 15, 13, 14, 19, 17, 18, 23, 21, 22, 27, 25, 26, 31, 29, 30, 35, 33, 34],k = 7) == -1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 5) == -1\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 3) == -1\n assert candidate(stones = [1, 10, 100, 1000, 10000, 100000, 1000000],k = 2) == 1234566\n assert candidate(stones = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 6) == -1\n assert candidate(stones = [15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205, 215, 225, 235, 245, 255, 265, 275, 285, 295, 300],k = 5) == -1\n assert candidate(stones = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],k = 4) == -1\n assert candidate(stones = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70],k = 5) == -1\n assert candidate(stones = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],k = 4) == -1\n assert candidate(stones = [5, 3, 8, 1, 9, 2, 6, 4, 7, 10],k = 4) == 91\n assert candidate(stones = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == -1\n assert candidate(stones = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 6) == -1\n assert candidate(stones = [7, 13, 8, 9, 12, 5, 6, 3, 1, 4],k = 3) == -1\n assert candidate(stones = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 4) == 1092\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == -1\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300],k = 8) == -1\n assert candidate(stones = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109],k = 7) == -1\n assert candidate(stones = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8],k = 3) == -1\n assert candidate(stones = [14, 29, 10, 21, 3, 16, 24, 20, 30],k = 3) == 334\n assert candidate(stones = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 5) == -1\n assert candidate(stones = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 3) == 198\n assert candidate(stones = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80],k = 7) == -1\n assert candidate(stones = [3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2],k = 3) == -1\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],k = 4) == 164\n assert candidate(stones = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 2) == 17300\n assert candidate(stones = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == -1\n assert candidate(stones = [3, 8, 3, 9, 3, 8, 3, 9, 3, 8, 3, 9, 3, 8, 3, 9, 3, 8, 3, 9],k = 3) == -1\n assert candidate(stones = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29],k = 3) == -1\n assert candidate(stones = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200],k = 4) == -1\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59],k = 3) == -1\n assert candidate(stones = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 2) == 135\n assert candidate(stones = [1, 100, 2, 99, 3, 98, 4, 97, 5, 96, 6, 95, 7, 94, 8, 93, 9, 92, 10, 91, 11, 90, 12, 89, 13, 88, 14, 87],k = 3) == -1\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90],k = 5) == 600\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],k = 5) == -1\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70],k = 3) == 490\n assert candidate(stones = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 2) == 296\n assert candidate(stones = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == 60\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 2) == 2175\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 10) == -1\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],k = 4) == 455\n assert candidate(stones = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101],k = 6) == 2076\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],k = 7) == -1\n assert candidate(stones = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],k = 3) == -1\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59],k = 6) == -1\n assert candidate(stones = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3],k = 2) == 296\n assert candidate(stones = [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 9) == -1\n assert candidate(stones = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105],k = 5) == -1\n assert candidate(stones = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 5) == -1\n assert candidate(stones = [9, 5, 7, 3, 8, 6, 2, 4, 1, 10],k = 2) == 177\n assert candidate(stones = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 4) == -1\n assert candidate(stones = [9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99, 108, 117, 126, 135, 144, 153, 162, 171, 180, 189, 198, 207, 216, 225, 234, 243, 252, 261, 270],k = 3) == -1\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 34\n assert candidate(stones = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 29, 28, 27],k = 5) == -1\n assert candidate(stones = [9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9],k = 2) == 193\n assert candidate(stones = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49],k = 5) == 515\n assert candidate(stones = [4, 8, 15, 16, 23, 42, 7, 11, 18, 29, 37, 45, 1, 3, 6, 10, 14, 19],k = 4) == -1\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 148\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60],k = 4) == -1\n assert candidate(stones = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 3) == 87\n assert candidate(stones = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140, 147, 154, 161, 168, 175],k = 5) == 4480\n assert candidate(stones = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],k = 7) == -1\n assert candidate(stones = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210],k = 7) == -1\n assert candidate(stones = [15, 10, 5, 1, 20, 30, 25, 35, 40, 45, 50, 55],k = 5) == -1\n assert candidate(stones = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 5) == -1\n assert candidate(stones = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 3) == -1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],k = 3) == -1\n assert candidate(stones = [5, 15, 10, 25, 30, 20, 5, 10, 40],k = 3) == 310\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40],k = 4) == -1\n assert candidate(stones = [31, 41, 59, 26, 53, 58, 97, 93, 23, 84, 62, 64, 33, 83, 27, 95],k = 3) == -1\n assert candidate(stones = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60],k = 6) == -1\n assert candidate(stones = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == 91\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 5) == -1\n assert candidate(stones = [5, 3, 8, 9, 1, 2, 4, 7, 6, 0],k = 3) == -1\n assert candidate(stones = [7, 1, 4, 5, 6],k = 2) == 51\n assert candidate(stones = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 5) == -1\n assert candidate(stones = [7, 7, 7, 7, 7, 7, 7],k = 2) == 140\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],k = 4) == -1\n assert candidate(stones = [7, 7, 7, 7, 7, 7, 7, 7],k = 2) == 168\n assert candidate(stones = [7, 7, 7, 7, 7, 7],k = 3) == -1\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 2) == 1730\n assert candidate(stones = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],k = 3) == -1\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15],k = 4) == -1\n assert candidate(stones = [1, 2, 3, 4, 5, 6],k = 2) == 51\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15],k = 3) == -1\n assert candidate(stones = [3, 2, 4, 1],k = 3) == -1\n assert candidate(stones = [5, 3, 8, 12, 6],k = 3) == 50\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 148\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 30) == 465\n assert candidate(stones = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7],k = 5) == -1\n assert candidate(stones = [1, 3, 2, 1, 2, 3, 1],k = 3) == 25\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 5) == -1\n assert candidate(stones = [10, 4, 3, 5, 1],k = 2) == 49\n assert candidate(stones = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == -1\n assert candidate(stones = [10, 20, 30, 40, 50, 60],k = 3) == -1\n assert candidate(stones = [10, 10, 10, 10],k = 2) == 80\n assert candidate(stones = [10, 22, 9, 33, 21, 50, 41, 60, 80],k = 3) == 613\n assert candidate(stones = [1, 3, 3, 3, 2, 4, 1],k = 3) == 31\n assert candidate(stones = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4],k = 2) == 136\n assert candidate(stones = [8, 32, 25, 35, 25, 32, 25, 32, 31, 21, 34, 35, 31, 30, 29, 35, 32, 29, 29, 26, 30, 24, 26, 33, 38, 29, 21, 20, 34, 31],k = 3) == -1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 2) == 173\n assert candidate(stones = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3],k = 2) == 68\n assert candidate(stones = [7, 4, 5, 9, 2],k = 2) == 63\n assert candidate(stones = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3],k = 4) == -1\n assert candidate(stones = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4],k = 2) == 136\n assert candidate(stones = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == -1\n assert candidate(stones = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 3) == -1\n assert candidate(stones = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == -1\n assert candidate(stones = [5, 3, 8, 3, 5, 3, 8, 5],k = 3) == -1\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],k = 2) == 310\n assert candidate(stones = [5, 3, 8, 3, 8, 3, 8, 3, 8, 3],k = 4) == 93\n assert candidate(stones = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 3) == -1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9],k = 3) == 87\n assert candidate(stones = [10, 20, 30, 40, 50],k = 5) == 150\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90],k = 3) == 870\n assert candidate(stones = [2, 2, 2, 2, 2, 2, 2],k = 3) == 26\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 2) == 173\n assert candidate(stones = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],k = 4) == -1\n assert candidate(stones = [7, 8, 9, 10, 11, 12],k = 3) == -1\n assert candidate(stones = [5, 5, 5, 5, 5, 5],k = 3) == -1\n assert candidate(stones = [10, 12, 3, 4, 5, 6, 7, 8, 9, 10],k = 4) == 126\n assert candidate(stones = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2],k = 2) == 51\n assert candidate(stones = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 2) == 740\n assert candidate(stones = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == 315\n assert candidate(stones = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],k = 2) == 1730\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1],k = 2) == 20\n assert candidate(stones = [5, 3, 3, 3, 5],k = 2) == 44\n assert candidate(stones = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],k = 5) == -1\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 3) == -1\n assert candidate(stones = [7, 8, 9, 10, 11, 12, 13],k = 3) == 127\n assert candidate(stones = [4, 4, 4, 4, 4, 4, 4],k = 2) == 80\n assert candidate(stones = [5, 3, 8, 1, 9, 2, 7, 4, 6],k = 3) == 90\n assert candidate(stones = [7, 3, 2, 1, 8],k = 3) == 27\n assert candidate(stones = [10, 4, 3, 5, 10, 7, 9, 6],k = 3) == -1\n assert candidate(stones = [1, 3, 5, 7, 9],k = 4) == -1\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45],k = 5) == -1\n assert candidate(stones = [15, 10, 20, 5, 25],k = 3) == 110\n assert candidate(stones = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3],k = 3) == -1\n assert candidate(stones = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3],k = 4) == -1\n assert candidate(stones = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 2) == 135\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300],k = 10) == -1\n assert candidate(stones = [8, 8, 8, 8, 8, 8, 8, 8],k = 4) == -1\n assert candidate(stones = [100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100],k = 3) == 4644\n assert candidate(stones = [5, 17, 100, 11],k = 2) == 266\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 29\n assert candidate(stones = [1, 3, 2, 4, 5],k = 2) == 34\n assert candidate(stones = [2, 4, 6, 8, 10, 12, 14, 16, 18],k = 5) == 120\n assert candidate(stones = [4, 4, 4, 4, 4, 4],k = 3) == -1\n assert candidate(stones = [10, 4, 3, 5, 1],k = 2) == 49\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 34\n assert candidate(stones = [5, 17, 23, 26, 32, 48],k = 2) == 369\n assert candidate(stones = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 3) == -1\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],k = 5) == -1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9],k = 2) == 135\n assert candidate(stones = [2, 3, 5, 7, 11, 13, 17],k = 3) == 96\n assert candidate(stones = [1, 2, 3, 4, 5, 6],k = 2) == 51\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 154\n assert candidate(stones = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 2) == 1480\n assert candidate(stones = [1, 2, 3],k = 4) == -1\n assert candidate(stones = [4, 3, 6, 7, 8, 2, 4, 1, 2, 3],k = 3) == -1\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 30],k = 5) == -1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 29) == -1\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 3) == -1\n assert candidate(stones = [8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],k = 4) == -1\n assert candidate(stones = [1, 3, 1, 3, 1, 3],k = 3) == -1\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 30],k = 2) == 958\n assert candidate(stones = [3, 2, 4, 1],k = 2) == 20\n assert candidate(stones = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],k = 4) == 182\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 30, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1],k = 3) == 1452\n assert candidate(stones = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 2) == 444\n assert candidate(stones = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],k = 5) == -1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 3) == -1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 4) == 91\n assert candidate(stones = [7, 8, 9, 10, 11, 12],k = 4) == -1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 2) == 2175\n assert candidate(stones = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],k = 2) == 346\n assert candidate(stones = [10, 4, 3, 5, 3, 3, 9, 4, 8, 7, 7, 2, 2, 4, 1, 6, 5],k = 3) == 213\n assert candidate(stones = [3, 5, 1, 2, 6],k = 3) == 25\n assert candidate(stones = [4, 4, 4, 4, 4, 4],k = 2) == 64\n assert candidate(stones = [10, 5, 10, 15, 20],k = 2) == 135\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 5) == -1\n assert candidate(stones = [10, 4, 3, 5, 9],k = 2) == 69\n assert candidate(stones = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1],k = 3) == 176\n assert candidate(stones = [9, 9, 9, 9, 9, 9, 9, 9, 9],k = 3) == 162\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],k = 3) == 523\n assert candidate(stones = [5, 17, 100, 11],k = 3) == -1\n assert candidate(stones = [1, 3, 5, 7, 9],k = 2) == 54\n assert candidate(stones = [5, 17, 19, 19, 5, 19, 8, 13, 18, 3, 18, 1, 17, 1, 11, 17, 1, 20, 18, 3, 18, 17, 1, 20, 20, 9, 2, 11, 17, 2],k = 3) == -1\n assert candidate(stones = [5, 17, 12, 2, 9, 13, 11, 16, 1, 12, 18, 10, 20, 8],k = 2) == 583\n assert candidate(stones = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],k = 2) == 592\n assert candidate(stones = [7, 1, 5, 9, 3, 2, 4, 6],k = 3) == -1\n assert candidate(stones = [5, 5, 5, 5, 5, 5, 5],k = 5) == -1\n assert candidate(stones = [15, 18, 6, 11, 13, 18, 5, 12, 8],k = 3) == 212\n assert candidate(stones = [10, 5, 9, 1],k = 2) == 50\n assert candidate(stones = [4, 10, 3, 5],k = 2) == 44\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 30) == 465\n"}, "metadata": {"canonical_parameter_names": ["stones", "k"], "leetcode_dataset_entry_point": "Solution().mergeStones", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var mergeStones = function(stones, k) {", "container": null, "callable": "mergeStones", "parameters": [{"name": "stones", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1001, "task_id": "grid-illumination", "difficulty": "Hard", "problem_description": "There is a 2D grid of size n x n where each cell of this grid has a lamp that is initially turned off.\nYou are given a 2D array of lamp positions lamps, where lamps[i] = [rowi, coli] indicates that the lamp at grid[rowi][coli] is turned on. Even if the same lamp is listed more than once, it is turned on.\nWhen a lamp is turned on, it illuminates its cell and all other cells in the same row, column, or diagonal.\nYou are also given another 2D array queries, where queries[j] = [rowj, colj]. For the jth query, determine whether grid[rowj][colj] is illuminated or not. After answering the jth query, turn off the lamp at grid[rowj][colj] and its 8 adjacent lamps if they exist. A lamp is adjacent if its cell shares either a side or corner with grid[rowj][colj].\nReturn an array of integers ans, where ans[j] should be 1 if the cell in the jth query was illuminated, or 0 if the lamp was not.\n \nExample 1:\n\n\nInput: n = 5, lamps = [[0,0],[4,4]], queries = [[1,1],[1,0]]\nOutput: [1,0]\nExplanation: We have the initial grid with all lamps turned off. In the above picture we see the grid after turning on the lamp at grid[0][0] then turning on the lamp at grid[4][4].\nThe 0th query asks if the lamp at grid[1][1] is illuminated or not (the blue square). It is illuminated, so set ans[0] = 1. Then, we turn off all lamps in the red square.\n\nThe 1st query asks if the lamp at grid[1][0] is illuminated or not (the blue square). It is not illuminated, so set ans[1] = 0. Then, we turn off all lamps in the red rectangle.\n\n\nExample 2:\n\nInput: n = 5, lamps = [[0,0],[4,4]], queries = [[1,1],[1,1]]\nOutput: [1,1]\n\nExample 3:\n\nInput: n = 5, lamps = [[0,0],[0,4]], queries = [[0,4],[0,1],[1,4]]\nOutput: [1,1,0]\n\n \nConstraints:\n\n1 <= n <= 109\n0 <= lamps.length <= 20000\n0 <= queries.length <= 20000\nlamps[i].length == 2\n0 <= rowi, coli < n\nqueries[j].length == 2\n0 <= rowj, colj < n\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 5,lamps = [[0, 0], [4, 4]],queries = [[1, 1], [1, 1]]) == [1, 1]\n assert candidate(n = 5,lamps = [[0, 0], [0, 4]],queries = [[0, 4], [0, 1], [1, 4]]) == [1, 1, 0]\n assert candidate(n = 5,lamps = [[0, 0], [4, 4]],queries = [[1, 1], [1, 0]]) == [1, 0]\n assert candidate(n = 10,lamps = [[0, 0], [9, 9], [5, 5], [2, 7], [7, 2]],queries = [[1, 1], [8, 8], [4, 4], [3, 6], [6, 3]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[5, 5]],queries = [[4, 4], [4, 5], [4, 6], [5, 4], [5, 5], [5, 6], [6, 4], [6, 5], [6, 6]]) == [1, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(n = 500,lamps = [[100, 100], [200, 200], [300, 300], [400, 400], [499, 499]],queries = [[100, 100], [200, 200], [400, 400]]) == [1, 1, 1]\n assert candidate(n = 15,lamps = [[3, 3], [6, 6], [9, 9], [12, 12]],queries = [[3, 3], [6, 6], [9, 9], [12, 12], [7, 7], [8, 8], [10, 10], [11, 11]]) == [1, 1, 1, 1, 0, 0, 0, 0]\n assert candidate(n = 2000,lamps = [[1000, 1000], [500, 500], [1500, 1500], [200, 200], [1800, 1800]],queries = [[1000, 1000], [500, 500], [1500, 1500], [200, 200], [1800, 1800]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[0, 9], [9, 0], [5, 5]],queries = [[0, 9], [9, 0], [5, 5], [4, 4], [6, 6], [3, 3], [7, 7]]) == [1, 1, 1, 0, 0, 0, 0]\n assert candidate(n = 10,lamps = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]],queries = [[1, 1], [3, 3], [5, 5], [7, 7]]) == [1, 1, 1, 1]\n assert candidate(n = 1000,lamps = [[500, 500], [501, 501], [499, 499], [502, 502], [498, 498]],queries = [[500, 500], [501, 501], [499, 499]]) == [1, 1, 1]\n assert candidate(n = 6,lamps = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2], [3, 3]],queries = [[2, 2], [1, 1], [1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2], [3, 3]]) == [1, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(n = 20,lamps = [[5, 5], [5, 6], [6, 5], [6, 6], [10, 10], [11, 11], [12, 12], [13, 13]],queries = [[5, 5], [10, 10], [15, 15]]) == [1, 1, 1]\n assert candidate(n = 15,lamps = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]],queries = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(n = 20,lamps = [[0, 0], [19, 19], [0, 19], [19, 0], [10, 10], [9, 9], [11, 11]],queries = [[10, 10], [10, 10], [9, 9], [11, 11], [5, 5], [10, 0]]) == [1, 1, 1, 1, 1, 1]\n assert candidate(n = 1000,lamps = [[500, 500], [250, 250], [750, 750], [100, 100], [900, 900]],queries = [[500, 500], [250, 250], [750, 750], [100, 100], [900, 900]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 20,lamps = [[10, 10], [10, 11], [10, 12], [11, 10], [11, 11], [11, 12], [12, 10], [12, 11], [12, 12]],queries = [[9, 9], [9, 10], [9, 11], [10, 9], [10, 10], [10, 11], [11, 9], [11, 10], [11, 11]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[0, 9], [1, 8], [2, 7], [3, 6], [4, 5], [5, 4], [6, 3], [7, 2], [8, 1], [9, 0]],queries = [[5, 5], [4, 6], [3, 7], [2, 8], [1, 9], [0, 8], [1, 7], [2, 6], [3, 5], [4, 4]]) == [1, 1, 1, 1, 1, 0, 0, 0, 0, 0]\n assert candidate(n = 12,lamps = [[0, 0], [0, 11], [11, 0], [11, 11], [5, 5], [6, 6], [7, 7]],queries = [[5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11]]) == [1, 1, 1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 2], [2, 0], [2, 1], [2, 2], [4, 4], [4, 5], [4, 6], [5, 4], [5, 6], [6, 4], [6, 5], [6, 6]],queries = [[1, 1], [1, 2], [2, 1], [3, 3], [4, 4], [6, 6]]) == [1, 1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0]],queries = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(n = 5,lamps = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 0], [1, 4], [2, 0], [2, 4], [3, 0], [3, 4], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4]],queries = [[2, 2], [2, 1], [2, 3], [1, 2], [3, 2]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[2, 2], [3, 3], [5, 5], [7, 7]],queries = [[2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]) == [1, 1, 1, 1, 1, 0, 0]\n assert candidate(n = 10,lamps = [[0, 9], [1, 8], [2, 7], [3, 6], [4, 5], [5, 4], [6, 3], [7, 2], [8, 1], [9, 0]],queries = [[0, 0], [9, 9], [4, 4], [3, 3], [5, 5], [1, 1], [8, 8], [2, 2], [7, 7], [6, 6]]) == [1, 1, 1, 1, 0, 1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]],queries = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == [1, 1, 1, 1, 0]\n assert candidate(n = 100,lamps = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70], [80, 80], [90, 90]],queries = [[50, 50], [45, 45], [55, 55]]) == [1, 1, 1]\n assert candidate(n = 4,lamps = [[0, 0], [0, 3], [3, 0], [3, 3]],queries = [[1, 1], [1, 2], [2, 1], [2, 2]]) == [1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[0, 0], [9, 9], [0, 9], [9, 0], [5, 5], [5, 4], [4, 5]],queries = [[5, 5], [5, 4], [4, 5], [5, 0], [9, 9]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 20,lamps = [[5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14]],queries = [[10, 10], [9, 9], [11, 11], [8, 8], [12, 12], [7, 7], [13, 13], [6, 6], [14, 14], [5, 5]]) == [1, 1, 1, 1, 1, 1, 1, 1, 0, 0]\n assert candidate(n = 50,lamps = [[0, 0], [25, 25], [49, 49], [24, 24], [26, 26]],queries = [[25, 25], [24, 24], [26, 26], [0, 0], [49, 49], [1, 1], [48, 48], [23, 23], [27, 27], [25, 24]]) == [1, 1, 1, 1, 1, 0, 0, 0, 0, 0]\n assert candidate(n = 10,lamps = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]],queries = [[0, 0], [1, 2], [3, 3], [5, 5], [9, 9]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]],queries = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]) == [1, 1, 1, 1, 1, 1, 0, 0]\n assert candidate(n = 10,lamps = [[1, 1], [2, 2], [3, 3], [4, 4]],queries = [[1, 1], [2, 2], [3, 3], [4, 4]]) == [1, 1, 1, 0]\n assert candidate(n = 7,lamps = [[1, 1], [1, 5], [5, 1], [5, 5]],queries = [[3, 3], [3, 2], [2, 3], [3, 4], [4, 3]]) == [1, 0, 0, 0, 0]\n assert candidate(n = 7,lamps = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]],queries = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]]) == [1, 1, 1, 1, 1, 0, 0]\n assert candidate(n = 9,lamps = [[0, 0], [0, 8], [8, 0], [8, 8], [4, 4]],queries = [[4, 4], [4, 5], [4, 3], [5, 4], [3, 4]]) == [1, 0, 0, 0, 0]\n assert candidate(n = 10,lamps = [[0, 0], [0, 9], [9, 0], [9, 9]],queries = [[4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 20,lamps = [[0, 0], [0, 19], [19, 0], [19, 19], [10, 10]],queries = [[10, 10], [5, 5], [15, 15], [0, 0], [19, 19]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]],queries = [[0, 1], [1, 0], [2, 1], [3, 0], [4, 1], [5, 0], [6, 1], [7, 0], [8, 1], [9, 0]]) == [1, 0, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(n = 20,lamps = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]],queries = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) == [1, 1, 1, 1, 1, 0, 0, 0, 0]\n assert candidate(n = 10,lamps = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]],queries = [[1, 1], [0, 0], [1, 0], [0, 1], [1, 2], [2, 1], [2, 2], [2, 0], [0, 2]]) == [1, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(n = 100,lamps = [[50, 50], [50, 51], [50, 52], [51, 50], [51, 51], [51, 52], [52, 50], [52, 51], [52, 52]],queries = [[49, 49], [49, 50], [49, 51], [50, 49], [50, 50], [50, 51], [51, 49], [51, 50], [51, 51]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]],queries = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(n = 10,lamps = [[0, 0], [2, 2], [5, 5], [7, 7], [9, 9]],queries = [[1, 1], [3, 3], [4, 4], [6, 6], [8, 8]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 100,lamps = [[0, 0], [0, 99], [99, 0], [99, 99], [50, 50]],queries = [[25, 25], [50, 50], [75, 75], [0, 0], [99, 99]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 100,lamps = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70], [80, 80], [90, 90]],queries = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70], [80, 80], [90, 90]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(n = 15,lamps = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14]],queries = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(n = 12,lamps = [[2, 2], [5, 5], [8, 8], [11, 11]],queries = [[2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(n = 50,lamps = [[25, 25], [25, 26], [25, 27], [26, 25], [26, 26], [26, 27], [27, 25], [27, 26], [27, 27]],queries = [[24, 24], [24, 25], [24, 26], [25, 24], [25, 25], [25, 26], [26, 24], [26, 25], [26, 26]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[0, 0], [2, 2], [3, 3], [5, 5], [8, 8]],queries = [[1, 1], [2, 2], [5, 5], [9, 9]]) == [1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[0, 0], [2, 2], [4, 4], [6, 6], [8, 8]],queries = [[1, 1], [3, 3], [5, 5], [7, 7], [9, 9]]) == [1, 1, 1, 1, 0]\n assert candidate(n = 20,lamps = [[5, 5], [10, 10], [15, 15], [5, 15], [15, 5]],queries = [[5, 5], [10, 10], [15, 15], [5, 15], [15, 5], [0, 0], [19, 19], [2, 2], [18, 18], [9, 9], [11, 11]]) == [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0]\n assert candidate(n = 100,lamps = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50]],queries = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [51, 51], [49, 49]]) == [1, 1, 1, 1, 1, 0, 0]\n assert candidate(n = 50,lamps = [[10, 10], [10, 20], [10, 30], [20, 10], [20, 20], [20, 30], [30, 10], [30, 20], [30, 30]],queries = [[10, 10], [20, 20], [30, 30]]) == [1, 1, 1]\n assert candidate(n = 50,lamps = [[0, 0], [49, 49], [25, 25], [10, 10], [35, 35]],queries = [[0, 0], [49, 49], [25, 25], [10, 10], [35, 35], [26, 26], [24, 24]]) == [1, 1, 1, 1, 1, 0, 0]\n assert candidate(n = 8,lamps = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]],queries = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]]) == [1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(n = 9,lamps = [[1, 1], [1, 7], [7, 1], [7, 7], [4, 4], [5, 5]],queries = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7]]) == [1, 1, 1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]],queries = [[1, 1], [2, 3], [5, 5], [8, 8], [9, 9]]) == [1, 1, 1, 1, 0]\n assert candidate(n = 6,lamps = [[0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0]],queries = [[0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0]]) == [1, 1, 1, 1, 1, 0]\n assert candidate(n = 10,lamps = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],queries = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == [1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(n = 25,lamps = [[5, 5], [10, 10], [15, 15], [20, 20], [24, 24], [20, 5], [5, 20], [15, 10], [10, 15]],queries = [[5, 5], [10, 10], [15, 15], [20, 20], [24, 24], [20, 5], [5, 20], [15, 10], [10, 15]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(n = 20,lamps = [[10, 10], [10, 11], [10, 12], [11, 10], [11, 11], [11, 12], [12, 10], [12, 11], [12, 12]],queries = [[11, 11], [10, 10], [10, 11], [10, 12], [11, 10], [11, 11], [11, 12], [12, 10], [12, 11], [12, 12]]) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(n = 1000,lamps = [[500, 500], [501, 501], [499, 499], [502, 502], [498, 498]],queries = [[500, 500], [501, 501], [499, 499], [502, 502], [498, 498], [500, 498], [498, 500]]) == [1, 1, 1, 0, 0, 0, 0]\n assert candidate(n = 15,lamps = [[3, 3], [3, 12], [12, 3], [12, 12], [7, 7], [4, 8], [8, 4], [4, 4], [8, 8]],queries = [[7, 7], [3, 3], [12, 12], [4, 4], [8, 8]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 20,lamps = [[5, 5], [5, 15], [15, 5], [15, 15], [10, 10]],queries = [[5, 5], [15, 15], [10, 10], [15, 5], [5, 15]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 20,lamps = [[5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14]],queries = [[5, 5], [10, 10], [15, 15], [2, 2], [18, 18]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 250,lamps = [[125, 125], [126, 126], [124, 124], [127, 127], [123, 123]],queries = [[125, 125], [126, 126], [124, 124]]) == [1, 1, 1]\n assert candidate(n = 10,lamps = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]],queries = [[2, 2], [1, 1], [3, 3], [1, 3], [2, 3]]) == [1, 0, 0, 0, 0]\n assert candidate(n = 10,lamps = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]],queries = [[4, 4], [3, 3], [2, 2], [1, 1], [0, 0], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(n = 6,lamps = [[0, 0], [0, 5], [5, 0], [5, 5], [2, 2], [3, 3]],queries = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]) == [1, 1, 1, 1, 1, 1]\n assert candidate(n = 8,lamps = [[0, 0], [0, 7], [7, 0], [7, 7], [3, 3], [4, 4]],queries = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == [1, 1, 1, 1, 1, 1]\n assert candidate(n = 50,lamps = [[5, 5], [10, 10], [15, 15], [20, 20], [25, 25], [30, 30], [35, 35], [40, 40], [45, 45]],queries = [[0, 0], [5, 5], [10, 10], [15, 15], [20, 20], [25, 25], [30, 30], [35, 35], [40, 40], [45, 45], [50, 50]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(n = 100,lamps = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]],queries = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) == [1, 1, 1, 1, 1, 0, 0, 0, 0]\n assert candidate(n = 30,lamps = [[10, 10], [20, 20], [5, 5], [25, 25], [15, 15]],queries = [[10, 10], [20, 20], [5, 5], [25, 25], [15, 15]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[0, 9], [1, 8], [2, 7], [3, 6], [4, 5], [5, 4], [6, 3], [7, 2], [8, 1], [9, 0]],queries = [[0, 0], [9, 9], [4, 4], [3, 3], [5, 5]]) == [1, 1, 1, 1, 0]\n assert candidate(n = 10,lamps = [[0, 0], [0, 9], [9, 0], [9, 9], [4, 4], [5, 5]],queries = [[4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == [1, 1, 1, 1, 1, 1]\n assert candidate(n = 15,lamps = [[0, 14], [1, 13], [2, 12], [3, 11], [4, 10], [5, 9], [6, 8], [7, 7], [8, 6], [9, 5], [10, 4], [11, 3], [12, 2], [13, 1], [14, 0]],queries = [[7, 7], [8, 6], [9, 5]]) == [1, 1, 1]\n assert candidate(n = 100,lamps = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70], [80, 80], [90, 90]],queries = [[5, 5], [15, 15], [25, 25], [35, 35], [45, 45], [55, 55], [65, 65], [75, 75], [85, 85], [95, 95]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(n = 15,lamps = [[3, 3], [3, 4], [3, 5], [4, 3], [4, 4], [4, 5], [5, 3], [5, 4], [5, 5]],queries = [[2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(n = 1000,lamps = [[0, 0], [100, 100], [200, 200], [300, 300], [400, 400], [500, 500], [600, 600], [700, 700], [800, 800], [900, 900]],queries = [[0, 0], [100, 100], [500, 500], [900, 900], [450, 450]]) == [1, 1, 1, 1, 1]\n assert candidate(n = 10,lamps = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]],queries = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) == [1, 1, 1, 1, 1, 0, 0, 0, 0]\n assert candidate(n = 100,lamps = [[0, 0], [99, 99], [49, 49], [25, 25], [75, 75]],queries = [[50, 50], [25, 25], [49, 49], [75, 75], [99, 99], [0, 0]]) == [1, 1, 1, 1, 1, 1]\n assert candidate(n = 1000,lamps = [[500, 500], [501, 501], [499, 499], [500, 501], [501, 500], [499, 500], [500, 499], [501, 499], [499, 501]],queries = [[499, 499], [500, 500], [501, 501], [499, 501], [501, 499], [499, 500], [500, 499], [501, 500], [500, 501]]) == [1, 1, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(n = 10,lamps = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]],queries = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]) == [1, 1, 1, 1, 1, 0, 0]\n assert candidate(n = 15,lamps = [[0, 0], [0, 14], [14, 0], [14, 14], [7, 7]],queries = [[7, 7], [0, 0], [14, 14], [0, 14], [14, 0]]) == [1, 1, 1, 1, 1]\n"}, "metadata": {"canonical_parameter_names": ["n", "lamps", "queries"], "leetcode_dataset_entry_point": "Solution().gridIllumination", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var gridIllumination = function(n, lamps, queries) {", "container": null, "callable": "gridIllumination", "parameters": [{"name": "n", "type": "number"}, {"name": "lamps", "type": "number[][]"}, {"name": "queries", "type": "number[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1002, "task_id": "find-common-characters", "difficulty": "Easy", "problem_description": "Given a string array words, return an array of all characters that show up in all strings within the words (including duplicates). You may return the answer in any order.\n \nExample 1:\nInput: words = [\"bella\",\"label\",\"roller\"]\nOutput: [\"e\",\"l\",\"l\"]\nExample 2:\nInput: words = [\"cool\",\"lock\",\"cook\"]\nOutput: [\"c\",\"o\"]\n\n \nConstraints:\n\n1 <= words.length <= 100\n1 <= words[i].length <= 100\nwords[i] consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['abc', 'abc', 'abc']) == ['a', 'b', 'c']\n assert candidate(words = ['bella', 'label', 'roller']) == ['e', 'l', 'l']\n assert candidate(words = ['python', 'java', 'javascript']) == []\n assert candidate(words = ['hello', 'world', 'hold']) == ['l', 'o']\n assert candidate(words = ['aabbcc', 'aabbc', 'abc']) == ['a', 'b', 'c']\n assert candidate(words = ['cool', 'lock', 'cook']) == ['c', 'o']\n assert candidate(words = ['a', 'a', 'a', 'a']) == ['a']\n assert candidate(words = ['apple', 'apricot', 'peach']) == ['a', 'p']\n assert candidate(words = ['happy', 'happy', 'happy']) == ['h', 'a', 'p', 'p', 'y']\n assert candidate(words = ['a', 'a', 'a']) == ['a']\n assert candidate(words = ['flower', 'flow', 'flight']) == ['f', 'l']\n assert candidate(words = ['a', 'b', 'c']) == []\n assert candidate(words = ['common', 'commons', 'commonground']) == ['c', 'o', 'o', 'm', 'm', 'n']\n assert candidate(words = ['sophistication', 'sophisticated', 'sophisticating']) == ['s', 's', 'o', 'p', 'h', 'i', 'i', 't', 't', 'c', 'a']\n assert candidate(words = ['encyclopedia', 'encyclopedia', 'encyclopedic']) == ['e', 'e', 'n', 'c', 'c', 'y', 'l', 'o', 'p', 'd', 'i']\n assert candidate(words = ['abracadabra', 'abrakadabrac', 'abrakadabracd']) == ['a', 'a', 'a', 'a', 'a', 'b', 'b', 'r', 'r', 'c', 'd']\n assert candidate(words = ['multifaceted', 'multimodal', 'multiplicity']) == ['m', 'u', 'l', 't', 'i']\n assert candidate(words = ['encyclopedia', 'encyclopedic', 'encyclopediae']) == ['e', 'e', 'n', 'c', 'c', 'y', 'l', 'o', 'p', 'd', 'i']\n assert candidate(words = ['repetition', 'perception', 'competition']) == ['e', 'p', 't', 'i', 'o', 'n']\n assert candidate(words = ['algorithm', 'logarithm', 'rhythm', 'harmony']) == ['r', 'h', 'm']\n assert candidate(words = ['xylophone', 'zoo', 'ozone']) == ['o', 'o']\n assert candidate(words = ['banana', 'bandana', 'panama']) == ['a', 'a', 'a', 'n']\n assert candidate(words = ['algorithm', 'logarithm', 'altruism']) == ['a', 'l', 'r', 'i', 't', 'm']\n assert candidate(words = ['floccinaucinihilipilification', 'pneumonoultramicroscopicsilicovolcanoconiosis', 'supercalifragilisticexpialidocious']) == ['l', 'l', 'l', 'o', 'o', 'c', 'c', 'c', 'i', 'i', 'i', 'i', 'i', 'i', 'a', 'a', 'u', 'p', 't']\n assert candidate(words = ['environment', 'venture', 'ambient']) == ['e', 'n', 't']\n assert candidate(words = ['algorithm', 'algorithms', 'algebra']) == ['a', 'l', 'g', 'r']\n assert candidate(words = ['repetition', 'replication', 'repetitive']) == ['r', 'e', 'p', 't', 'i', 'i']\n assert candidate(words = ['characterization', 'character', 'charisma']) == ['c', 'h', 'a', 'a', 'r']\n assert candidate(words = ['repetition', 'petition', 'portion']) == ['p', 't', 'i', 'o', 'n']\n assert candidate(words = ['unbelievable', 'believable', 'believability']) == ['b', 'b', 'e', 'e', 'l', 'l', 'i', 'v', 'a']\n assert candidate(words = ['xylophone', 'xylophones', 'xylophonist']) == ['x', 'y', 'l', 'o', 'o', 'p', 'h', 'n']\n assert candidate(words = ['environment', 'ambient', 'administrate']) == ['e', 'n', 'i', 'm', 't']\n assert candidate(words = ['environment', 'environments', 'environmental']) == ['e', 'e', 'n', 'n', 'n', 'v', 'i', 'r', 'o', 'm', 't']\n assert candidate(words = ['intersection', 'intersects', 'intercept']) == ['i', 'n', 't', 't', 'e', 'e', 'r', 'c']\n assert candidate(words = ['abracadabra', 'abrakadabras', 'abrakadabratic']) == ['a', 'a', 'a', 'a', 'a', 'b', 'b', 'r', 'r', 'd']\n assert candidate(words = ['intersection', 'interact', 'interstellar']) == ['i', 'n', 't', 't', 'e', 'r']\n assert candidate(words = ['fantastic', 'fantasy', 'fantasia']) == ['f', 'a', 'a', 'n', 't', 's']\n assert candidate(words = ['mississippi', 'missouri', 'missile']) == ['m', 'i', 'i', 's', 's']\n assert candidate(words = ['reducibility', 'reductiveness', 'reductive']) == ['r', 'e', 'd', 'u', 'c', 'i', 't']\n assert candidate(words = ['alphabet', 'alphabetic', 'alphanumeric']) == ['a', 'a', 'l', 'p', 'h', 'e']\n assert candidate(words = ['repetition', 'petition', 'representation']) == ['e', 'p', 't', 't', 'i', 'o', 'n']\n assert candidate(words = ['congratulations', 'congratulate', 'congratulatory']) == ['c', 'o', 'n', 'g', 'r', 'a', 'a', 't', 't', 'u', 'l']\n assert candidate(words = ['zzzzzz', 'zzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzz']) == ['z', 'z', 'z', 'z', 'z', 'z']\n assert candidate(words = ['programming', 'program', 'pro']) == ['p', 'r', 'o']\n assert candidate(words = ['environment', 'environmental', 'environments']) == ['e', 'e', 'n', 'n', 'n', 'v', 'i', 'r', 'o', 'm', 't']\n assert candidate(words = ['abbreviation', 'abbreviate', 'abbreviations']) == ['a', 'a', 'b', 'b', 'r', 'e', 'v', 'i', 't']\n assert candidate(words = ['intersection', 'interior', 'interesting']) == ['i', 'i', 'n', 't', 'e', 'r']\n assert candidate(words = ['abcdefghij', 'jihgfedcba', 'fedcba', 'abcdefghij']) == ['a', 'b', 'c', 'd', 'e', 'f']\n assert candidate(words = ['supercalifragilisticexpialidocious', 'supercalifragilistic', 'supercalifragilisticexpialidos']) == ['s', 's', 'u', 'p', 'e', 'r', 'r', 'c', 'c', 'a', 'a', 'l', 'l', 'i', 'i', 'i', 'i', 'f', 'g', 't']\n assert candidate(words = ['development', 'delivery', 'department']) == ['d', 'e', 'e']\n assert candidate(words = ['mississippi', 'missionary', 'pessimism']) == ['m', 'i', 'i', 's', 's']\n assert candidate(words = ['programming', 'gramming', 'paring']) == ['r', 'g', 'a', 'i', 'n']\n assert candidate(words = ['zzzzzzzzzz', 'zzzzzzzzz', 'zzzzzzzz', 'zzzzzzz', 'zzzzzz', 'zzzzz', 'zzzz', 'zzz', 'zz', 'z']) == ['z']\n assert candidate(words = ['programming', 'programmer', 'program']) == ['p', 'r', 'r', 'o', 'g', 'a', 'm']\n assert candidate(words = ['xylophone', 'xylography', 'xylophonist']) == ['x', 'y', 'l', 'o', 'p', 'h']\n assert candidate(words = ['characterization', 'characterization', 'characterize']) == ['c', 'c', 'h', 'a', 'a', 'r', 'r', 't', 'e', 'i', 'z']\n assert candidate(words = ['orchestration', 'orchestrated', 'orchestrator']) == ['o', 'r', 'r', 'c', 'h', 'e', 's', 't', 't', 'a']\n assert candidate(words = ['characterization', 'character', 'characterization']) == ['c', 'c', 'h', 'a', 'a', 'r', 'r', 't', 'e']\n assert candidate(words = ['intersectionality', 'interact', 'interstellar']) == ['i', 'n', 't', 't', 'e', 'r', 'a']\n assert candidate(words = ['abracadabra', 'academia', 'barbara']) == ['a', 'a', 'a']\n assert candidate(words = ['aabbcc', 'bbaacc', 'ccaabb', 'aabbc', 'abbcc', 'aaccb', 'abcabc']) == ['a', 'b', 'c']\n assert candidate(words = ['abacaxi', 'bacana', 'cabana']) == ['a', 'a', 'a', 'b', 'c']\n assert candidate(words = ['intersection', 'interact', 'interactive']) == ['i', 'n', 't', 't', 'e', 'r', 'c']\n assert candidate(words = ['programming', 'programmer', 'programmatic']) == ['p', 'r', 'r', 'o', 'g', 'a', 'm', 'm']\n assert candidate(words = ['exemplification', 'exemplary', 'exemplify']) == ['e', 'e', 'x', 'm', 'p', 'l']\n assert candidate(words = ['congratulations', 'congratulate', 'congratulations']) == ['c', 'o', 'n', 'g', 'r', 'a', 'a', 't', 't', 'u', 'l']\n assert candidate(words = ['abracadabra', 'alakazam', 'alchemy']) == ['a']\n assert candidate(words = ['mississippi', 'missouri', 'missed']) == ['m', 'i', 's', 's']\n assert candidate(words = ['aaa', 'aa', 'a']) == ['a']\n assert candidate(words = ['xylophone', 'xylophones', 'xylophonist', 'xylophonists']) == ['x', 'y', 'l', 'o', 'o', 'p', 'h', 'n']\n assert candidate(words = ['mississippi', 'misstep', 'misspell']) == ['m', 'i', 's', 's', 'p']\n assert candidate(words = ['bookkeeper', 'bookstore', 'keeper']) == ['k', 'e', 'r']\n assert candidate(words = ['multifaceted', 'multifarious', 'multitude']) == ['m', 'u', 'l', 't', 'i']\n assert candidate(words = ['multiple', 'multiplication', 'multiplicity']) == ['m', 'u', 'l', 'l', 't', 'i', 'p']\n assert candidate(words = ['aabbccddeeff', 'bbaacceeddff', 'ccaabbeeffdd', 'aabbeeffccdd', 'aabbccdde', 'bbccddeeff', 'aaccbbeeff']) == ['b', 'b', 'c', 'c', 'e']\n assert candidate(words = ['xylophone', 'xenon', 'xerox', 'xylography']) == ['x', 'o']\n assert candidate(words = ['repetition', 'repetitions', 'repetitive']) == ['r', 'e', 'e', 'p', 't', 't', 'i', 'i']\n assert candidate(words = ['mississippi', 'missouri', 'missisipi']) == ['m', 'i', 'i', 's', 's']\n assert candidate(words = ['beautiful', 'beautify', 'beautification']) == ['b', 'e', 'a', 'u', 't', 'i', 'f']\n assert candidate(words = ['algorithm', 'algebra', 'alignment']) == ['a', 'l', 'g']\n assert candidate(words = ['intersection', 'interact', 'interaction']) == ['i', 'n', 't', 't', 'e', 'r', 'c']\n assert candidate(words = ['exceedingly', 'excellent', 'exceptional']) == ['e', 'e', 'x', 'c', 'n', 'l']\n assert candidate(words = ['abracadabra', 'cadabra', 'abraca']) == ['a', 'a', 'a', 'b', 'r', 'c']\n assert candidate(words = ['algorithm', 'logarithm', 'rhythm']) == ['r', 't', 'h', 'm']\n assert candidate(words = ['quizzing', 'quizzes', 'quizzed']) == ['q', 'u', 'i', 'z', 'z']\n assert candidate(words = ['sophisticated', 'sophistication', 'sophistry']) == ['s', 's', 'o', 'p', 'h', 'i', 't']\n assert candidate(words = ['strength', 'strengths', 'stressed']) == ['s', 't', 'r', 'e']\n assert candidate(words = ['encyclopedia', 'encyclopediae', 'encyclopedias']) == ['e', 'e', 'n', 'c', 'c', 'y', 'l', 'o', 'p', 'd', 'i', 'a']\n assert candidate(words = ['repetition', 'petition', 'competition']) == ['e', 'p', 't', 't', 'i', 'i', 'o', 'n']\n assert candidate(words = ['unbelievable', 'unbeliever', 'unbelievably']) == ['u', 'n', 'b', 'e', 'e', 'l', 'i', 'v']\n assert candidate(words = ['interpolation', 'interpretation', 'internationalization']) == ['i', 'i', 'n', 'n', 't', 't', 'e', 'r', 'o', 'a']\n assert candidate(words = ['intersection', 'intercept', 'interstellar']) == ['i', 'n', 't', 't', 'e', 'e', 'r']\n assert candidate(words = ['abcd', 'bcde', 'cdef', 'defg']) == ['d']\n assert candidate(words = ['pterodactyl', 'pterodactyl', 'pterodactyls']) == ['p', 't', 't', 'e', 'r', 'o', 'd', 'a', 'c', 'y', 'l']\n assert candidate(words = ['mississippi', 'missouri', 'missed', 'missives']) == ['m', 'i', 's', 's']\n assert candidate(words = ['repetition', 'replicate', 'repetitive']) == ['r', 'e', 'e', 'p', 't', 'i']\n assert candidate(words = ['algorithm', 'algorithmic', 'algorithms']) == ['a', 'l', 'g', 'o', 'r', 'i', 't', 'h', 'm']\n assert candidate(words = ['encyclopedia', 'encyclopedia', 'encyclopedia']) == ['e', 'e', 'n', 'c', 'c', 'y', 'l', 'o', 'p', 'd', 'i', 'a']\n assert candidate(words = ['banana', 'bandana', 'bananas']) == ['b', 'a', 'a', 'a', 'n', 'n']\n assert candidate(words = ['repetition', 'perpetuation', 'petition']) == ['e', 'p', 't', 't', 'i', 'o', 'n']\n assert candidate(words = ['algorithm', 'logarithm', 'anthology']) == ['a', 'l', 'g', 'o', 't', 'h']\n assert candidate(words = ['intersection', 'interview', 'interstellar']) == ['i', 'n', 't', 'e', 'e', 'r']\n assert candidate(words = ['mississippi', 'missouri', 'dismiss']) == ['m', 'i', 'i', 's', 's']\n"}, "metadata": {"canonical_parameter_names": ["words"], "leetcode_dataset_entry_point": "Solution().commonChars", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var commonChars = function(words) {", "container": null, "callable": "commonChars", "parameters": [{"name": "words", "type": "string[]"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1003, "task_id": "check-if-word-is-valid-after-substitutions", "difficulty": "Medium", "problem_description": "Given a string s, determine if it is valid.\nA string s is valid if, starting with an empty string t = \"\", you can transform t into s after performing the following operation any number of times:\n\nInsert string \"abc\" into any position in t. More formally, t becomes tleft + \"abc\" + tright, where t == tleft + tright. Note that tleft and tright may be empty.\n\nReturn true if s is a valid string, otherwise, return false.\n \nExample 1:\n\nInput: s = \"aabcbc\"\nOutput: true\nExplanation:\n\"\" -> \"abc\" -> \"aabcbc\"\nThus, \"aabcbc\" is valid.\nExample 2:\n\nInput: s = \"abcabcababcc\"\nOutput: true\nExplanation:\n\"\" -> \"abc\" -> \"abcabc\" -> \"abcabcabc\" -> \"abcabcababcc\"\nThus, \"abcabcababcc\" is valid.\n\nExample 3:\n\nInput: s = \"abccba\"\nOutput: false\nExplanation: It is impossible to get \"abccba\" using the operation.\n\n \nConstraints:\n\n1 <= s.length <= 2 * 104\ns consists of letters 'a', 'b', and 'c'\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"aaabbbccc\") == False\n assert candidate(s = \"aababcbccabc\") == False\n assert candidate(s = \"cababc\") == False\n assert candidate(s = \"abcabcabc\") == True\n assert candidate(s = \"aababcbabc\") == False\n assert candidate(s = \"abcabcabcabc\") == True\n assert candidate(s = \"aabcbc\") == True\n assert candidate(s = \"\") == True\n assert candidate(s = \"abcabc\") == True\n assert candidate(s = \"abcabcababcc\") == True\n assert candidate(s = \"bcaabc\") == False\n assert candidate(s = \"aabcabcabc\") == False\n assert candidate(s = \"bca\") == False\n assert candidate(s = \"abc\") == True\n assert candidate(s = \"aabababc\") == False\n assert candidate(s = \"abcabcabcabcabcabc\") == True\n assert candidate(s = \"abcabcabacbc\") == False\n assert candidate(s = \"ababcabcababcc\") == False\n assert candidate(s = \"abccba\") == False\n assert candidate(s = \"cab\") == False\n assert candidate(s = \"aabbcc\") == False\n assert candidate(s = \"aabcbcababc\") == False\n assert candidate(s = \"aabcbabcbabc\") == False\n assert candidate(s = \"aabcbabcbabccba\") == False\n assert candidate(s = \"aababababababcabcabcabcabcabc\") == False\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"aababababababcabcababc\") == False\n assert candidate(s = \"aabcbcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"ababcabcabcababcabcababcabc\") == False\n assert candidate(s = \"abcabcabababcabc\") == False\n assert candidate(s = \"ababcabcabcabcababc\") == False\n assert candidate(s = \"ababcababcababcababcababcc\") == False\n assert candidate(s = \"abcabababcababcabc\") == False\n assert candidate(s = \"aababababcbcbcbc\") == False\n assert candidate(s = \"aabbbccabcabcabcabcabcabcab\") == False\n assert candidate(s = \"aabbabccbababc\") == False\n assert candidate(s = \"aaaabbbbcccc\") == False\n assert candidate(s = \"abcabababababababc\") == False\n assert candidate(s = \"aababcabcbaabc\") == False\n assert candidate(s = \"aabcbabcbabcbabcbabcbabc\") == False\n assert candidate(s = \"abcabababababababcababababababc\") == False\n assert candidate(s = \"abcabccbaabc\") == False\n assert candidate(s = \"abcabcababababcabc\") == False\n assert candidate(s = \"aabcbcaabcab\") == False\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"aabcbabcababcabcba\") == False\n assert candidate(s = \"aabcbcababcbcababc\") == False\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"aabcbabcabcbabcabcbabcabcbabcabcbabcabc\") == False\n assert candidate(s = \"abccabccabccabccabccabccabccabccabcc\") == False\n assert candidate(s = \"aababcababcabcabcabcabcababcc\") == False\n assert candidate(s = \"aabcbcaabcbcaabcbcaabcbcaabc\") == False\n assert candidate(s = \"abcabcabcabcabcabcabc\") == True\n assert candidate(s = \"abcabcabcabcabcabcab\") == False\n assert candidate(s = \"abababcabcabcabc\") == False\n assert candidate(s = \"abababcabcabcabcabc\") == False\n assert candidate(s = \"abccababccababcc\") == False\n assert candidate(s = \"ababcabcababcabcabcabcabc\") == False\n assert candidate(s = \"abccbaabccbaabccba\") == False\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"aabcbcabcabcabcabcbcaabbcc\") == False\n assert candidate(s = \"aabababababababcabcabc\") == False\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"aabcbcababcbcababccba\") == False\n assert candidate(s = \"ababababcabcabc\") == False\n assert candidate(s = \"ababababababcabcabcababc\") == False\n assert candidate(s = \"abccabccabccabccabccabcc\") == False\n assert candidate(s = \"aabcbabcbababc\") == False\n assert candidate(s = \"abcabcababccabcabcab\") == False\n assert candidate(s = \"aabcbcabcabababcabcabcabababcabcab\") == False\n assert candidate(s = \"aabcbcaabcbcaabcbcaabc\") == False\n assert candidate(s = \"aabcbabcabcbabcabcbabcabc\") == False\n assert candidate(s = \"abcabababcabababc\") == False\n assert candidate(s = \"ababababababcabcabcabcabcabc\") == False\n assert candidate(s = \"aaabbbcccaabbbcccaabbbcccabcabcabc\") == False\n assert candidate(s = \"abcababccbaabc\") == False\n assert candidate(s = \"abcabcabcabcabcabcabccbaabccba\") == False\n assert candidate(s = \"aabcbabababcabcabc\") == False\n assert candidate(s = \"aabcbcababccbaabcbcbcabcababcababcbc\") == False\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabccba\") == False\n assert candidate(s = \"abcababababcabab\") == False\n assert candidate(s = \"abcababcababcababc\") == False\n assert candidate(s = \"aabcbcababccbaabccba\") == False\n assert candidate(s = \"abababababcabababcabc\") == False\n assert candidate(s = \"aabcbcababcbcababcbcabababcabcabccba\") == False\n assert candidate(s = \"aabcbabcbabcbabcbabcbabcbabcbabc\") == False\n assert candidate(s = \"aababababababababcabcababcababcc\") == False\n assert candidate(s = \"aabbccabcabcabcabcabcabcabc\") == False\n assert candidate(s = \"abababababababababababcabcabcabcabcabcabc\") == False\n assert candidate(s = \"aabcbcabcabcabcabcabccbaabc\") == False\n assert candidate(s = \"aaaaaaaaaabbbbbbbbbbcccccccccc\") == False\n assert candidate(s = \"abababababababababababc\") == False\n assert candidate(s = \"abababababababababababcabcabc\") == False\n assert candidate(s = \"aabcaabbccabcabcabc\") == False\n assert candidate(s = \"ababcababcababcababcababcababcababcabcabcc\") == False\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"abcabababababababababababababcabcabcababcabc\") == False\n assert candidate(s = \"abcabcabcabcabccba\") == False\n assert candidate(s = \"aabcbcababccbaabcbcbcabcababcababcbcababccba\") == False\n assert candidate(s = \"abcabcababcabcabcabababc\") == False\n assert candidate(s = \"aaabbbbcccc\") == False\n assert candidate(s = \"abcabababcababababc\") == False\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"ababababcabcabcababc\") == False\n assert candidate(s = \"abccabccabccabccabccabccabccabccabccabccabcc\") == False\n assert candidate(s = \"ababcababcababcababcababcababcababcababc\") == False\n assert candidate(s = \"abcababababababababababababcabcabcab\") == False\n assert candidate(s = \"abababababababababababababcabcabcabcabcabcabcabc\") == False\n assert candidate(s = \"abccabccabccabcabcabc\") == False\n assert candidate(s = \"aababcababcababcababcab\") == False\n assert candidate(s = \"abcabcabcabccbaabc\") == False\n assert candidate(s = \"aababcabcabcababcc\") == False\n assert candidate(s = \"aabcbcaabcbcaabc\") == False\n assert candidate(s = \"abcabcabcabababcababc\") == False\n assert candidate(s = \"abcababcababcababcababcab\") == False\n assert candidate(s = \"abcabcabcabcababcabc\") == False\n assert candidate(s = \"abacbabcbacbabcbabc\") == False\n assert candidate(s = \"aabccbaabcabcabc\") == False\n assert candidate(s = \"abccbaabcabcabcabcabc\") == False\n assert candidate(s = \"abababababcabcabcabc\") == False\n assert candidate(s = \"aabbabccbababcabcabc\") == False\n assert candidate(s = \"abcabcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"abcabcabcabcabcabccba\") == False\n assert candidate(s = \"abcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"abcabcababcababc\") == False\n assert candidate(s = \"aabcbcababcbcababcbcababcabc\") == False\n assert candidate(s = \"ababababababababc\") == False\n assert candidate(s = \"aabcbabcbabcbabc\") == False\n assert candidate(s = \"ababcababcababcababcababcababcabcabc\") == False\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"aabcbcabcabcabcabcabcabcabcabcabcabcabc\") == True\n assert candidate(s = \"abcabcabcababccbaabc\") == False\n assert candidate(s = \"abcababababcabcabcab\") == False\n assert candidate(s = \"aabcbcabcabcabcabcabcabcabcbc\") == False\n assert candidate(s = \"aabababababababababababababababcabcabc\") == False\n assert candidate(s = \"aabcbcbcbcabcabcabc\") == False\n assert candidate(s = \"abccabcabcabcabcab\") == False\n assert candidate(s = \"abababababababababababababababababababcabcabc\") == False\n assert candidate(s = \"aabcbcababccbaabcbcbc\") == False\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().isValid", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isValid = function(s) {", "container": null, "callable": "isValid", "parameters": [{"name": "s", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1004, "task_id": "max-consecutive-ones-iii", "difficulty": "Medium", "problem_description": "Given a binary array nums and an integer k, return the maximum number of consecutive 1's in the array if you can flip at most k 0's.\n \nExample 1:\n\nInput: nums = [1,1,1,0,0,0,1,1,1,1,0], k = 2\nOutput: 6\nExplanation: [1,1,1,0,0,1,1,1,1,1,1]\nBolded numbers were flipped from 0 to 1. The longest subarray is underlined.\nExample 2:\n\nInput: nums = [0,0,1,1,0,0,1,1,1,0,1,1,0,0,0,1,1,1,1], k = 3\nOutput: 10\nExplanation: [0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1]\nBolded numbers were flipped from 0 to 1. The longest subarray is underlined.\n\n \nConstraints:\n\n1 <= nums.length <= 105\nnums[i] is either 0 or 1.\n0 <= k <= nums.length\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],k = 2) == 4\n assert candidate(nums = [0, 0, 0, 0],k = 2) == 2\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0],k = 2) == 5\n assert candidate(nums = [0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1],k = 3) == 10\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 4) == 9\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 3) == 7\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1) == 10\n assert candidate(nums = [1, 1, 1, 1, 1],k = 1) == 5\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 5) == 5\n assert candidate(nums = [0, 0, 0, 0, 0],k = 3) == 3\n assert candidate(nums = [1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0],k = 2) == 6\n assert candidate(nums = [1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1],k = 4) == 14\n assert candidate(nums = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 8) == 37\n assert candidate(nums = [1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0],k = 5) == 16\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 20) == 41\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 20) == 32\n assert candidate(nums = [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 7) == 20\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 3) == 15\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],k = 10) == 22\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],k = 7) == 15\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 10) == 21\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 15) == 31\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],k = 8) == 13\n assert candidate(nums = [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],k = 5) == 15\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 10) == 10\n assert candidate(nums = [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],k = 3) == 8\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 15) == 31\n assert candidate(nums = [1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],k = 6) == 14\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 20\n assert candidate(nums = [0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1],k = 6) == 14\n assert candidate(nums = [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 14\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0],k = 10) == 16\n assert candidate(nums = [1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 5) == 13\n assert candidate(nums = [0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],k = 15) == 51\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],k = 2) == 3\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 0) == 20\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 8) == 17\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 10) == 21\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],k = 4) == 10\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0],k = 12) == 19\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 25\n assert candidate(nums = [1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1],k = 7) == 17\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 15) == 30\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 0) == 32\n assert candidate(nums = [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1],k = 6) == 15\n assert candidate(nums = [1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0],k = 7) == 19\n assert candidate(nums = [1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1],k = 4) == 16\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 0) == 30\n assert candidate(nums = [1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 42\n assert candidate(nums = [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],k = 0) == 5\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 12) == 45\n assert candidate(nums = [1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1],k = 3) == 11\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 15) == 15\n assert candidate(nums = [1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0],k = 5) == 18\n assert candidate(nums = [0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 5) == 9\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 32\n assert candidate(nums = [0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0],k = 3) == 9\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 10) == 10\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],k = 2) == 3\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1],k = 4) == 11\n assert candidate(nums = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 7) == 46\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 0) == 48\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 31\n assert candidate(nums = [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],k = 3) == 8\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0],k = 5) == 18\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 3) == 12\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],k = 1) == 3\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 10) == 20\n assert candidate(nums = [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],k = 10) == 35\n assert candidate(nums = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0],k = 4) == 7\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 30) == 61\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],k = 15) == 31\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 0) == 0\n assert candidate(nums = [1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0],k = 5) == 15\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 15) == 15\n assert candidate(nums = [0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1],k = 4) == 14\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 15) == 15\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().longestOnes", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var longestOnes = function(nums, k) {", "container": null, "callable": "longestOnes", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1005, "task_id": "maximize-sum-of-array-after-k-negations", "difficulty": "Easy", "problem_description": "Given an integer array nums and an integer k, modify the array in the following way:\n\nchoose an index i and replace nums[i] with -nums[i].\n\nYou should apply this process exactly k times. You may choose the same index i multiple times.\nReturn the largest possible sum of the array after modifying it in this way.\n \nExample 1:\n\nInput: nums = [4,2,3], k = 1\nOutput: 5\nExplanation: Choose index 1 and nums becomes [4,-2,3].\n\nExample 2:\n\nInput: nums = [3,-1,0,2], k = 3\nOutput: 6\nExplanation: Choose indices (1, 2, 2) and nums becomes [3,1,0,2].\n\nExample 3:\n\nInput: nums = [2,-3,-1,5,-4], k = 2\nOutput: 13\nExplanation: Choose indices (1, 4) and nums becomes [2,3,-1,5,4].\n\n \nConstraints:\n\n1 <= nums.length <= 104\n-100 <= nums[i] <= 100\n1 <= k <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [-5, -4, -3, -2, -1],k = 5) == 15\n assert candidate(nums = [0, 0, 0, 0],k = 3) == 0\n assert candidate(nums = [4, 2, 3],k = 1) == 5\n assert candidate(nums = [100, -100, 50, -50],k = 3) == 200\n assert candidate(nums = [1, 2, 3, 4],k = 2) == 10\n assert candidate(nums = [100, -100, 50, -50],k = 5) == 200\n assert candidate(nums = [2, -3, -1, 5, -4],k = 2) == 13\n assert candidate(nums = [3, -1, 0, 2],k = 3) == 6\n assert candidate(nums = [-1, -2, -3, -4],k = 2) == 4\n assert candidate(nums = [0, 0, 0, 0],k = 4) == 0\n assert candidate(nums = [1, 2, 3],k = 6) == 6\n assert candidate(nums = [-1, 0, 1],k = 1) == 2\n assert candidate(nums = [-1, -2, -3, -4],k = 4) == 10\n assert candidate(nums = [0, 0, 0, 0],k = 10) == 0\n assert candidate(nums = [1, 2, 3, 4, 5],k = 1) == 13\n assert candidate(nums = [1, -1, 2, -2],k = 4) == 6\n assert candidate(nums = [1, 2, 3, 4],k = 4) == 10\n assert candidate(nums = [0, 1, -1, 2, -2, 3, -3, 4, -4],k = 10) == 20\n assert candidate(nums = [1, -1, 2, -2, 3, -3],k = 9) == 12\n assert candidate(nums = [-100, -99, -98, -97, -96, -95, -94, -93, -92, -91],k = 10) == 955\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == 53\n assert candidate(nums = [-3, -2, -1, 0, 1, 2, 3],k = 5) == 12\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3) == 53\n assert candidate(nums = [-7, 3, -5, 2, -1],k = 6) == 16\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 53\n assert candidate(nums = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1],k = 15) == 8\n assert candidate(nums = [-1, 1, -1, 1, -1],k = 8) == 3\n assert candidate(nums = [-10, 20, -30, 40, -50],k = 5) == 150\n assert candidate(nums = [1, 2, 3, 4, 5],k = 5) == 13\n assert candidate(nums = [99, -99, 50, -50, 25, -25],k = 10) == 298\n assert candidate(nums = [1, 2, 3, 4, 5],k = 20) == 15\n assert candidate(nums = [100, -100, 100, -100, 100],k = 100) == 500\n assert candidate(nums = [100, 200, 300, 400, 500],k = 1) == 1300\n assert candidate(nums = [-1, -2, -3, -4],k = 10) == 10\n assert candidate(nums = [-10, -9, -8, -7, -6],k = 10) == 28\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 10) == 0\n assert candidate(nums = [-10, -20, -30, -40, -50],k = 15) == 150\n assert candidate(nums = [-10, 20, -30, 40, -50],k = 15) == 150\n assert candidate(nums = [50, 40, 30, 20, 10, 0, -10, -20, -30, -40],k = 6) == 250\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 55\n assert candidate(nums = [10, -20, 30, -40, 50, -60, 70, -80, 90, -100],k = 15) == 550\n assert candidate(nums = [1, -1, 1, -1],k = 7) == 2\n assert candidate(nums = [5, -3, 8, -2, 9, -4],k = 3) == 31\n assert candidate(nums = [-1, -2, -3, -4, -5],k = 10) == 13\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 9) == 8\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 9999) == 8\n assert candidate(nums = [0, 1, -1, 2, -2, 3, -3, 4, -4],k = 15) == 20\n assert candidate(nums = [99, -99, 50, -50, 1],k = 10000) == 299\n assert candidate(nums = [1, -2, 3, -4, 5, -6],k = 5) == 21\n assert candidate(nums = [-1, -2, -3, -4],k = 3) == 8\n assert candidate(nums = [-1, 0, 1],k = 2) == 2\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 8\n assert candidate(nums = [0, 1, -2, 3, -4, 5, -6],k = 7) == 21\n assert candidate(nums = [1, -1, 1, -1, 1, -1],k = 100) == 4\n assert candidate(nums = [99, -99, 98, -98, 97, -97, 96, -96, 95, -95],k = 15) == 970\n assert candidate(nums = [-10, -20, -30, -40],k = 6) == 100\n assert candidate(nums = [-1, 0, 1],k = 3) == 2\n assert candidate(nums = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10],k = 11) == 55\n assert candidate(nums = [-9, -8, -7, -6, -5, -4, -3, -2, -1, 0],k = 9) == 45\n assert candidate(nums = [-50, 50, 25, -25, 12, -12, 6, -6, 3, -3],k = 12) == 186\n assert candidate(nums = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10],k = 7) == 55\n assert candidate(nums = [10, 20, 30, 40, 50],k = 3) == 130\n assert candidate(nums = [0, 0, 0, 0],k = 7) == 0\n assert candidate(nums = [-1, 1, -2, 2, -3, 3],k = 5) == 12\n assert candidate(nums = [2, 4, 6, 8, 10],k = 1) == 26\n assert candidate(nums = [-10, 10, -20, 20, -30, 30],k = 6) == 100\n assert candidate(nums = [5, -3, 7, -2, 1],k = 3) == 16\n assert candidate(nums = [0, 0, 0, 0, 0],k = 1000) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 15) == 53\n assert candidate(nums = [-1, -2, -3, -4],k = 10) == 10\n assert candidate(nums = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10],k = 15) == 55\n assert candidate(nums = [0, 0, 0, 0],k = 100) == 0\n assert candidate(nums = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10],k = 5) == 25\n assert candidate(nums = [100, 50, 25, 12, 6, 3],k = 7) == 190\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],k = 1) == 45\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9, 10, -10],k = 20) == 110\n assert candidate(nums = [5, -5, 15, -15, 25, -25],k = 11) == 90\n assert candidate(nums = [100, 100, 100, 100, 100],k = 10000) == 500\n assert candidate(nums = [0, -1, 1, -2, 2, -3, 3],k = 7) == 12\n assert candidate(nums = [10, -10, 20, -20, 30, -30],k = 6) == 100\n assert candidate(nums = [100, -50, 25, -10, 5],k = 3) == 180\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 53\n assert candidate(nums = [99, -99, 50, -50, 25, -25],k = 7) == 348\n assert candidate(nums = [-1, -2, -3, 4, 5, 6],k = 4) == 19\n assert candidate(nums = [1, -1, 1, -1, 1, -1],k = 10) == 4\n assert candidate(nums = [1, 2, 3, -4, -5, -6],k = 3) == 21\n assert candidate(nums = [10, -10, 20, -20, 30, -30],k = 9) == 120\n assert candidate(nums = [10, -10, 20, -20, 30, -30, 40, -40],k = 20) == 200\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4],k = 8) == 20\n assert candidate(nums = [0, 0, 0, 0, 0],k = 100) == 0\n assert candidate(nums = [-50, -40, -30, -20, -10, 0, 10, 20, 30, 40],k = 14) == 250\n assert candidate(nums = [-1, 0, 1],k = 5) == 2\n assert candidate(nums = [-99, -98, -97, -96, -95],k = 10) == 295\n assert candidate(nums = [10, -10, 20, -20, 30, -30],k = 7) == 120\n assert candidate(nums = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],k = 10) == 46\n assert candidate(nums = [100, 100, 100, 100, 100],k = 3) == 300\n assert candidate(nums = [5, 5, 5, 5, 5],k = 1000) == 25\n assert candidate(nums = [1, 1, 1, 1, 1, -1, -1, -1, -1, -1],k = 15) == 10\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 20) == 100\n assert candidate(nums = [10, -10, 20, -20, 30, -30, 40, -40, 50, -50],k = 20) == 280\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1],k = 10) == 55\n assert candidate(nums = [5, -5, 5, -5, 5, -5],k = 6) == 20\n assert candidate(nums = [-1, 0, 1, 0, -1, 0, 1, 0],k = 8) == 4\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == 53\n assert candidate(nums = [5, -1, -2, -3, -4],k = 6) == 15\n assert candidate(nums = [1, -1, 2, -2, 3, -3, 4, -4],k = 8) == 20\n assert candidate(nums = [-100, -200, -300, -400, -500],k = 2) == -1500\n assert candidate(nums = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10],k = 8) == 53\n assert candidate(nums = [-100, -50, 0, 50, 100],k = 3) == 300\n assert candidate(nums = [10, -20, 30, -40, 50, -60],k = 5) == 210\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 9) == 53\n assert candidate(nums = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1],k = 10) == 10\n assert candidate(nums = [-10, -20, -30, -40, -50],k = 3) == 90\n assert candidate(nums = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10],k = 8) == 53\n assert candidate(nums = [-100, -50, -25, -12, -6, -3],k = 8) == 196\n assert candidate(nums = [-10, -20, 0, 20, 10],k = 5) == 60\n assert candidate(nums = [-10, -20, -30, -40, -50],k = 20) == 130\n assert candidate(nums = [-1, 0, 1],k = 1) == 2\n assert candidate(nums = [-100, -100, -100, -100, -100],k = 10001) == 500\n assert candidate(nums = [-10, -20, -30, -40, -50],k = 6) == 130\n assert candidate(nums = [100, -100, 50, -50, 25, -25, 12, -12, 6, -6],k = 20) == 374\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().largestSumAfterKNegations", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var largestSumAfterKNegations = function(nums, k) {", "container": null, "callable": "largestSumAfterKNegations", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1006, "task_id": "clumsy-factorial", "difficulty": "Medium", "problem_description": "The factorial of a positive integer n is the product of all positive integers less than or equal to n.\n\nFor example, factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1.\n\nWe make a clumsy factorial using the integers in decreasing order by swapping out the multiply operations for a fixed rotation of operations with multiply '*', divide '/', add '+', and subtract '-' in this order.\n\nFor example, clumsy(10) = 10 * 9 / 8 + 7 - 6 * 5 / 4 + 3 - 2 * 1.\n\nHowever, these operations are still applied using the usual order of operations of arithmetic. We do all multiplication and division steps before any addition or subtraction steps, and multiplication and division steps are processed left to right.\nAdditionally, the division that we use is floor division such that 10 * 9 / 8 = 90 / 8 = 11.\nGiven an integer n, return the clumsy factorial of n.\n \nExample 1:\n\nInput: n = 4\nOutput: 7\nExplanation: 7 = 4 * 3 / 2 + 1\n\nExample 2:\n\nInput: n = 10\nOutput: 12\nExplanation: 12 = 10 * 9 / 8 + 7 - 6 * 5 / 4 + 3 - 2 * 1\n\n \nConstraints:\n\n1 <= n <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 8) == 9\n assert candidate(n = 3) == 6\n assert candidate(n = 100) == 101\n assert candidate(n = 4) == 7\n assert candidate(n = 10000) == 10001\n assert candidate(n = 9) == 11\n assert candidate(n = 5000) == 5001\n assert candidate(n = 6) == 8\n assert candidate(n = 2) == 2\n assert candidate(n = 9999) == 9998\n assert candidate(n = 1) == 1\n assert candidate(n = 1000) == 1001\n assert candidate(n = 7) == 6\n assert candidate(n = 10) == 12\n assert candidate(n = 5) == 7\n assert candidate(n = 12) == 13\n assert candidate(n = 21) == 23\n assert candidate(n = 2000) == 2001\n assert candidate(n = 7500) == 7501\n assert candidate(n = 104) == 105\n assert candidate(n = 50) == 52\n assert candidate(n = 300) == 301\n assert candidate(n = 28) == 29\n assert candidate(n = 30) == 32\n assert candidate(n = 99) == 98\n assert candidate(n = 6666) == 6668\n assert candidate(n = 17) == 19\n assert candidate(n = 999) == 998\n assert candidate(n = 18) == 20\n assert candidate(n = 20) == 21\n assert candidate(n = 24) == 25\n assert candidate(n = 7777) == 7779\n assert candidate(n = 11) == 10\n assert candidate(n = 15) == 14\n assert candidate(n = 14) == 16\n assert candidate(n = 31) == 30\n assert candidate(n = 500) == 501\n assert candidate(n = 25) == 27\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().clumsy", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var clumsy = function(n) {", "container": null, "callable": "clumsy", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1007, "task_id": "minimum-domino-rotations-for-equal-row", "difficulty": "Medium", "problem_description": "In a row of dominoes, tops[i] and bottoms[i] represent the top and bottom halves of the ith domino. (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.)\nWe may rotate the ith domino, so that tops[i] and bottoms[i] swap values.\nReturn the minimum number of rotations so that all the values in tops are the same, or all the values in bottoms are the same.\nIf it cannot be done, return -1.\n \nExample 1:\n\n\nInput: tops = [2,1,2,4,2,2], bottoms = [5,2,6,2,3,2]\nOutput: 2\nExplanation: \nThe first figure represents the dominoes as given by tops and bottoms: before we do any rotations.\nIf we rotate the second and fourth dominoes, we can make every value in the top row equal to 2, as indicated by the second figure.\n\nExample 2:\n\nInput: tops = [3,5,1,2,3], bottoms = [3,6,3,3,4]\nOutput: -1\nExplanation: \nIn this case, it is not possible to rotate the dominoes to make one row of values equal.\n\n \nConstraints:\n\n2 <= tops.length <= 2 * 104\nbottoms.length == tops.length\n1 <= tops[i], bottoms[i] <= 6\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(tops = [2, 3, 2, 2],bottoms = [1, 2, 2, 2]) == 1\n assert candidate(tops = [2, 3, 2, 1, 2],bottoms = [1, 2, 3, 2, 2]) == 2\n assert candidate(tops = [6, 6, 6, 6, 6, 6],bottoms = [6, 6, 6, 6, 6, 6]) == 0\n assert candidate(tops = [3, 5, 1, 2, 3],bottoms = [3, 6, 3, 3, 4]) == -1\n assert candidate(tops = [1, 1, 1, 1],bottoms = [1, 1, 1, 1]) == 0\n assert candidate(tops = [1, 2, 3, 4, 5, 6],bottoms = [6, 5, 4, 3, 2, 1]) == -1\n assert candidate(tops = [5, 5, 5, 5, 5],bottoms = [5, 5, 5, 5, 5]) == 0\n assert candidate(tops = [2, 1, 2, 4, 2, 2],bottoms = [5, 2, 6, 2, 3, 2]) == 2\n assert candidate(tops = [1, 2, 1, 1],bottoms = [2, 1, 2, 2]) == 1\n assert candidate(tops = [3, 3, 3, 3, 3, 3],bottoms = [3, 3, 3, 3, 3, 2]) == 0\n assert candidate(tops = [3, 3, 3, 3, 3],bottoms = [3, 3, 3, 3, 3]) == 0\n assert candidate(tops = [1, 2, 1, 2],bottoms = [2, 1, 2, 1]) == 2\n assert candidate(tops = [1, 1, 2, 2],bottoms = [2, 2, 1, 1]) == 2\n assert candidate(tops = [2, 3, 2, 4, 2],bottoms = [3, 2, 2, 2, 2]) == 1\n assert candidate(tops = [1, 2, 1, 1, 1, 2, 2, 2],bottoms = [2, 1, 2, 2, 2, 2, 2, 2]) == 1\n assert candidate(tops = [1, 3, 4, 1, 4, 3, 4, 1, 4, 3],bottoms = [3, 1, 1, 3, 1, 4, 1, 3, 1, 4]) == -1\n assert candidate(tops = [1, 5, 5, 5, 5, 5],bottoms = [5, 5, 1, 5, 5, 5]) == 1\n assert candidate(tops = [1, 1, 2, 2, 1, 1],bottoms = [2, 2, 1, 1, 2, 2]) == 2\n assert candidate(tops = [2, 2, 3, 3, 4, 4, 5, 5],bottoms = [5, 5, 4, 4, 3, 3, 2, 2]) == -1\n assert candidate(tops = [6, 1, 6, 6, 6, 6, 6, 6, 6, 6],bottoms = [1, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 1\n assert candidate(tops = [1, 6, 1, 6, 1, 6],bottoms = [6, 1, 6, 1, 6, 1]) == 3\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],bottoms = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6],bottoms = [6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6],bottoms = [6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(tops = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],bottoms = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(tops = [1, 1, 2, 2, 3, 3, 4, 4],bottoms = [4, 4, 3, 3, 2, 2, 1, 1]) == -1\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 7, 8, 9],bottoms = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(tops = [1, 2, 1, 3, 1, 4, 1, 5, 1, 6],bottoms = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(tops = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],bottoms = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 44\n assert candidate(tops = [3, 3, 3, 4, 3, 3, 3],bottoms = [3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(tops = [5, 5, 6, 5, 5, 5, 5, 5, 5, 5],bottoms = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(tops = [1, 2, 2, 1, 1, 2, 1, 2],bottoms = [2, 1, 1, 2, 2, 1, 2, 1]) == 4\n assert candidate(tops = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],bottoms = [10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == -1\n assert candidate(tops = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],bottoms = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(tops = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6],bottoms = [6, 6, 6, 6, 6, 6, 6, 6, 6, 5]) == 0\n assert candidate(tops = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],bottoms = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 0\n assert candidate(tops = [4, 5, 6, 6, 5, 4],bottoms = [4, 5, 6, 6, 5, 4]) == -1\n assert candidate(tops = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],bottoms = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 0\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],bottoms = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(tops = [5, 5, 5, 5, 5, 1],bottoms = [1, 5, 5, 5, 5, 5]) == 1\n assert candidate(tops = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],bottoms = [6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5]) == 0\n assert candidate(tops = [3, 3, 3, 3, 5, 5, 5, 5],bottoms = [5, 5, 5, 5, 3, 3, 3, 3]) == 4\n assert candidate(tops = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],bottoms = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 0\n assert candidate(tops = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],bottoms = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 0\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 1, 2, 3, 4],bottoms = [6, 5, 4, 3, 2, 1, 6, 5, 4, 3]) == -1\n assert candidate(tops = [1, 2, 3, 4, 1, 2],bottoms = [2, 3, 4, 1, 2, 3]) == -1\n assert candidate(tops = [1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2],bottoms = [2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1]) == 7\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],bottoms = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(tops = [3, 1, 3, 3, 3, 3, 3, 3, 3, 3],bottoms = [3, 3, 1, 3, 3, 3, 3, 3, 3, 3]) == 1\n assert candidate(tops = [1, 1, 1, 2, 2, 2, 2, 2],bottoms = [2, 2, 2, 1, 1, 1, 1, 1]) == 3\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1],bottoms = [1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(tops = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6],bottoms = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(tops = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3],bottoms = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(tops = [1, 1, 1, 1, 2, 2, 2, 2, 2, 2],bottoms = [2, 2, 2, 2, 1, 1, 1, 1, 1, 1]) == 4\n assert candidate(tops = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],bottoms = [3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1]) == -1\n assert candidate(tops = [3, 6, 3, 3, 3, 3, 3, 3, 3, 3],bottoms = [3, 3, 3, 3, 3, 3, 3, 3, 3, 6]) == 1\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],bottoms = [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(tops = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],bottoms = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1]) == 0\n assert candidate(tops = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],bottoms = [5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == -1\n assert candidate(tops = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],bottoms = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1]) == 0\n assert candidate(tops = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2],bottoms = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1]) == 1\n assert candidate(tops = [5, 5, 2, 5, 5, 5],bottoms = [5, 5, 5, 5, 5, 2]) == 1\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 7, 8],bottoms = [8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(tops = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6],bottoms = [6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == -1\n assert candidate(tops = [2, 2, 2, 2, 2, 2, 2, 2, 2, 1],bottoms = [1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 1\n assert candidate(tops = [1, 2, 2, 3, 3, 3],bottoms = [3, 3, 3, 2, 2, 1]) == 3\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 1, 2, 3, 4],bottoms = [4, 3, 2, 1, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(tops = [2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3],bottoms = [3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2]) == 10\n assert candidate(tops = [5, 6, 5, 5, 6, 5, 6, 5, 6, 5, 5, 6, 5, 5, 5, 5, 5, 6, 5, 5],bottoms = [5, 5, 6, 5, 5, 6, 5, 6, 5, 5, 6, 5, 5, 6, 5, 5, 5, 5, 5, 6]) == 6\n assert candidate(tops = [4, 1, 4, 1, 4, 1, 4, 1, 4, 1],bottoms = [1, 4, 1, 4, 1, 4, 1, 4, 1, 4]) == 5\n assert candidate(tops = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],bottoms = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(tops = [1, 3, 1, 2, 1, 1],bottoms = [2, 1, 2, 1, 2, 2]) == 2\n assert candidate(tops = [5, 5, 5, 5, 5, 5, 5],bottoms = [5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(tops = [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4],bottoms = [4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1]) == -1\n assert candidate(tops = [1, 1, 1, 2, 2, 2, 1, 1, 1],bottoms = [1, 2, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(tops = [1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],bottoms = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(tops = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2],bottoms = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(tops = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6],bottoms = [1, 2, 3, 4, 5, 6, 1, 2, 3, 4]) == 0\n assert candidate(tops = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2],bottoms = [2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1]) == 6\n assert candidate(tops = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],bottoms = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(tops = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],bottoms = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == -1\n assert candidate(tops = [2, 3, 4, 5, 6, 1, 2, 3, 4, 5],bottoms = [5, 4, 3, 2, 1, 6, 5, 4, 3, 2]) == -1\n assert candidate(tops = [6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5],bottoms = [5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6]) == 10\n assert candidate(tops = [1, 6, 1, 6, 1, 6, 1, 6, 1, 6],bottoms = [6, 1, 6, 1, 6, 1, 6, 1, 6, 1]) == 5\n assert candidate(tops = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],bottoms = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(tops = [3, 3, 2, 5, 3, 3, 3, 3, 3, 3],bottoms = [5, 3, 3, 5, 3, 3, 3, 3, 3, 3]) == -1\n assert candidate(tops = [2, 2, 2, 2, 2, 2, 2, 2],bottoms = [1, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(tops = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],bottoms = [1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1]) == 1\n assert candidate(tops = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3],bottoms = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 0\n assert candidate(tops = [5, 5, 5, 5, 5, 1],bottoms = [1, 1, 1, 1, 1, 5]) == 1\n assert candidate(tops = [1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],bottoms = [1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == -1\n assert candidate(tops = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],bottoms = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 0\n assert candidate(tops = [1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5],bottoms = [5, 5, 5, 5, 4, 4, 4, 3, 3, 2, 2, 1]) == -1\n assert candidate(tops = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4],bottoms = [1, 1, 2, 2, 3, 3, 4, 4, 4, 4]) == -1\n assert candidate(tops = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],bottoms = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(tops = [1, 3, 5, 3, 5, 3, 5, 3, 5, 3],bottoms = [3, 1, 3, 5, 3, 5, 3, 5, 3, 5]) == 5\n assert candidate(tops = [2, 3, 2, 3, 2, 3],bottoms = [3, 2, 3, 2, 3, 2]) == 3\n assert candidate(tops = [1, 2, 3, 1, 2, 3],bottoms = [3, 2, 1, 3, 2, 1]) == -1\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6],bottoms = [6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(tops = [1, 1, 1, 1, 1, 1, 1, 1],bottoms = [1, 1, 1, 1, 1, 1, 1, 2]) == 0\n assert candidate(tops = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2],bottoms = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 5\n assert candidate(tops = [1, 1, 1, 2, 2, 2],bottoms = [2, 2, 2, 1, 1, 1]) == 3\n assert candidate(tops = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6],bottoms = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 0\n assert candidate(tops = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],bottoms = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 6\n assert candidate(tops = [1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4],bottoms = [1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == -1\n assert candidate(tops = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4],bottoms = [4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1]) == -1\n assert candidate(tops = [1, 2, 2, 3, 4, 5, 6],bottoms = [6, 5, 4, 3, 2, 1, 2]) == -1\n assert candidate(tops = [3, 3, 3, 3, 3, 3],bottoms = [3, 3, 3, 3, 3, 3]) == 0\n assert candidate(tops = [2, 3, 4, 2, 3, 4],bottoms = [4, 3, 2, 4, 3, 2]) == -1\n assert candidate(tops = [1, 6, 1, 6, 1, 6, 1, 6],bottoms = [6, 1, 6, 1, 6, 1, 6, 1]) == 4\n assert candidate(tops = [1, 2, 2, 3, 3, 4, 4, 5, 5],bottoms = [5, 5, 4, 4, 3, 3, 2, 2, 1]) == -1\n assert candidate(tops = [1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1],bottoms = [6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6]) == -1\n"}, "metadata": {"canonical_parameter_names": ["tops", "bottoms"], "leetcode_dataset_entry_point": "Solution().minDominoRotations", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minDominoRotations = function(tops, bottoms) {", "container": null, "callable": "minDominoRotations", "parameters": [{"name": "tops", "type": "number[]"}, {"name": "bottoms", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1008, "task_id": "construct-binary-search-tree-from-preorder-traversal", "difficulty": "Medium", "problem_description": "Given an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary search tree), construct the tree and return its root.\nIt is guaranteed that there is always possible to find a binary search tree with the given requirements for the given test cases.\nA binary search tree is a binary tree where for every node, any descendant of Node.left has a value strictly less than Node.val, and any descendant of Node.right has a value strictly greater than Node.val.\nA preorder traversal of a binary tree displays the value of the node first, then traverses Node.left, then traverses Node.right.\n \nExample 1:\n\n\nInput: preorder = [8,5,1,7,10,12]\nOutput: [8,5,10,1,7,null,12]\n\nExample 2:\n\nInput: preorder = [1,3]\nOutput: [1,null,3]\n\n \nConstraints:\n\n1 <= preorder.length <= 100\n1 <= preorder[i] <= 1000\nAll the values of preorder are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(preorder = [1, 3]), tree_node([1, None, 3]))\n assert is_same_tree(candidate(preorder = [5, 2, 1, 3, 8, 7, 9]), tree_node([5, 2, 8, 1, 3, 7, 9]))\n assert is_same_tree(candidate(preorder = [100, 50, 25, 75, 200, 125, 150, 250]), tree_node([100, 50, 200, 25, 75, 125, 250, None, None, None, None, None, 150]))\n assert is_same_tree(candidate(preorder = [8, 5, 1, 7, 10, 12]), tree_node([8, 5, 10, 1, 7, None, 12]))\n assert is_same_tree(candidate(preorder = [2]), tree_node([2]))\n assert is_same_tree(candidate(preorder = [5, 2, 1, 3, 7, 6, 8]), tree_node([5, 2, 7, 1, 3, 6, 8]))\n assert is_same_tree(candidate(preorder = [10, 5, 15, 3, 7, 12, 20]), tree_node([10, 5, 12, 15, 7, None, 20, 3]))\n assert is_same_tree(candidate(preorder = [4, 2, 1, 3, 7, 5, 6, 8]), tree_node([4, 2, 7, 1, 3, 5, 8, None, None, None, None, None, 6]))\n assert is_same_tree(candidate(preorder = [2, 3]), tree_node([2, None, 3]))\n assert is_same_tree(candidate(preorder = [10, 5, 1, 7, 40, 50]), tree_node([10, 5, 40, 1, 7, None, 50]))\n assert is_same_tree(candidate(preorder = [3, 1, 2, 5, 4, 6]), tree_node([3, 1, 5, None, 2, 4, 6]))\n assert is_same_tree(candidate(preorder = [2, 1]), tree_node([2, 1]))\n assert is_same_tree(candidate(preorder = [25, 15, 10, 5, 3, 1, 7, 12, 20, 17, 16, 18, 35, 30, 28, 27, 29, 40, 37, 36, 38, 45, 42, 41, 43, 50, 48, 47, 49, 55, 52, 51, 53, 57, 56, 58, 60]), tree_node([25, 15, 35, 10, 20, 30, 40, 5, 12, 17, None, 28, None, 37, 45, 3, 7, None, None, 16, 18, 27, 29, 36, 38, 42, 50, 1, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 41, 43, 48, 55, None, None, None, None, None, None, 47, 49, 52, 57, None, None, None, None, 51, 53, 56, 58, None, None, None, None, None, None, None, 60]))\n assert is_same_tree(candidate(preorder = [15, 10, 5, 3, 1, 7, 12, 6, 8, 20, 17, 16, 18, 25, 23, 24, 27]), tree_node([15, 10, 20, 5, None, 17, 25, 3, 7, 16, 18, 23, 27, 1, None, 12, 8, None, None, None, None, None, 24, None, None, None, None, 6]))\n assert is_same_tree(candidate(preorder = [20, 10, 5, 3, 1, 4, 7, 6, 8, 15, 12, 11, 13, 18, 17, 19, 25, 22, 21, 23, 30, 28, 27, 29, 35, 32, 31, 33, 37, 36, 38]), tree_node([20, 10, 25, 5, 15, 22, 30, 3, 7, 12, 18, 21, 23, 28, 35, 1, 4, 6, 8, 11, 13, 17, 19, None, None, None, None, 27, 29, 32, 37, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 31, 33, 36, 38]))\n assert is_same_tree(candidate(preorder = [20, 15, 10, 5, 12, 18, 16, 17, 25, 22, 21, 24, 30, 28, 29, 32, 31]), tree_node([20, 15, 25, 10, 18, 22, 30, 5, 12, 16, None, 21, 24, 28, 32, None, None, None, None, None, 17, None, None, None, None, None, 29, 31]))\n assert is_same_tree(candidate(preorder = [50, 30, 20, 10, 5, 3, 1, 4, 7, 6, 8, 15, 12, 11, 13, 18, 17, 19, 70, 60, 55, 53, 52, 54, 57, 56, 58, 65, 62, 61, 63, 68, 67, 69, 80, 75, 72, 71, 73, 78, 77, 79, 85, 82, 81, 83, 88, 87, 89, 90]), tree_node([50, 30, 70, 20, None, 60, 80, 10, None, 55, 65, 75, 85, 5, 15, 53, 57, 62, 68, 72, 78, 82, 88, 3, 7, 12, 18, 52, 54, 56, 58, 61, 63, 67, 69, 71, 73, 77, 79, 81, 83, 87, 89, 1, 4, 6, 8, 11, 13, 17, 19, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 90]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 3, 5, 6, 8, 7, 9, 10, 12, 11, 13, 14, 15]), tree_node([1, None, 2, None, 4, 3, 5, None, None, None, 6, None, 8, 7, 9, None, None, None, 10, None, 12, 11, 13, None, None, None, 14, None, 15]))\n assert is_same_tree(candidate(preorder = [10, 5, 2, 1, 3, 7, 6, 8, 15, 12, 11, 13, 18, 17, 20]), tree_node([10, 5, 15, 2, 7, 12, 18, 1, 3, 6, 8, 11, 13, 17, 20]))\n assert is_same_tree(candidate(preorder = [100, 50, 25, 10, 5, 15, 40, 35, 30, 45, 75, 60, 55, 57, 65, 85, 80, 77, 78, 87, 90, 95, 100]), tree_node([100, 50, None, 25, 75, 10, 40, 60, 85, 5, 15, 35, 45, 55, 65, 80, 87, None, None, None, None, 30, None, None, None, None, 57, None, None, 77, None, None, 90, None, None, None, None, None, 78, None, 95, None, None, None, 100]))\n assert is_same_tree(candidate(preorder = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]), tree_node([20, 19, None, 18, None, 17, None, 16, None, 15, None, 14, None, 13, None, 12, None, 11, None, 10, None, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(preorder = [25, 15, 10, 8, 6, 7, 12, 11, 20, 18, 17, 19, 30, 28, 27, 29, 35, 33, 32, 34, 37, 36, 38]), tree_node([25, 15, 30, 10, 20, 28, 35, 8, 12, 18, None, 27, 29, 33, 37, 6, None, 11, None, 17, 19, None, None, None, None, 32, 34, 36, 38, None, 7]))\n assert is_same_tree(candidate(preorder = [100, 50, 25, 10, 5, 15, 30, 28, 32, 75, 65, 60, 63, 70, 80, 90, 85, 95]), tree_node([100, 50, None, 25, 75, 10, 30, 65, 80, 5, 15, 28, 32, 60, 70, None, 90, None, None, None, None, None, None, None, None, None, 63, None, None, 85, 95]))\n assert is_same_tree(candidate(preorder = [20, 10, 5, 3, 1, 4, 7, 6, 8, 15, 12, 11, 13, 18, 17, 19, 25, 22, 21, 23, 27, 26, 28, 30]), tree_node([20, 10, 25, 5, 15, 22, 27, 3, 7, 12, 18, 21, 23, 26, 28, 1, 4, 6, 8, 11, 13, 17, 19, None, None, None, None, None, None, None, 30]))\n assert is_same_tree(candidate(preorder = [8, 10, 12, 14, 16, 18, 20, 7, 6, 5, 4, 3, 2, 1, 11, 9, 13, 15, 17, 19]), tree_node([8, 10, 11, 12, None, 9, 13, 14, None, None, None, None, 15, 16, None, None, 17, 18, None, None, 19, 20, None, None, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(preorder = [50, 40, 35, 30, 25, 45, 42, 47, 60, 55, 57, 65, 70, 67, 75, 80]), tree_node([50, 40, 60, 35, 45, 55, 65, 30, None, 42, 47, None, 57, None, 70, 25, None, None, None, None, None, None, None, 67, 75, None, None, None, None, None, 80]))\n assert is_same_tree(candidate(preorder = [50, 30, 20, 10, 5, 3, 1, 4, 7, 6, 8, 15, 12, 11, 13, 18, 17, 19, 70, 60, 55, 53, 52, 54, 57, 56, 58, 65, 62, 61, 63, 68, 67, 69, 80, 75, 72, 71, 73, 78, 77, 79, 85, 82, 81, 83, 88, 87, 89, 95, 92, 91, 93, 98, 97, 99]), tree_node([50, 30, 70, 20, None, 60, 80, 10, None, 55, 65, 75, 85, 5, 15, 53, 57, 62, 68, 72, 78, 82, 88, 3, 7, 12, 18, 52, 54, 56, 58, 61, 63, 67, 69, 71, 73, 77, 79, 81, 83, 87, 89, 1, 4, 6, 8, 11, 13, 17, 19, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 95, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 92, 98, 91, 93, 97, 99]))\n assert is_same_tree(candidate(preorder = [10, 5, 3, 2, 1, 4, 7, 6, 8, 15, 13, 12, 14, 18, 17, 16, 19, 20]), tree_node([10, 5, 15, 3, 7, 13, 18, 2, 4, 6, 8, 12, 14, 17, 19, 1, None, None, None, None, None, None, None, None, None, None, None, 16, None, None, 20]))\n assert is_same_tree(candidate(preorder = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]), tree_node([10, 9, None, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))\n assert is_same_tree(candidate(preorder = [30, 15, 10, 5, 1, 3, 7, 6, 8, 20, 17, 16, 18, 25, 22, 23, 27, 30]), tree_node([30, 15, None, 10, 20, 5, None, 17, 25, 1, 7, 16, 18, 22, 27, None, 3, 6, 8, None, None, None, None, None, 23, None, 30]))\n assert is_same_tree(candidate(preorder = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10]))\n assert is_same_tree(candidate(preorder = [20, 10, 5, 3, 7, 15, 12, 17, 25, 22, 27, 30]), tree_node([20, 10, 25, 5, 15, 22, 27, 3, 7, 12, 17, None, None, None, 30]))\n assert is_same_tree(candidate(preorder = [30, 20, 10, 5, 15, 25, 18, 22, 40, 35, 32, 33, 38, 37, 36, 39, 50, 45, 43, 44, 48, 47, 46, 49, 55, 52, 51, 53, 54, 58, 56, 57, 59, 60]), tree_node([30, 20, 40, 10, 25, 35, 50, 5, 15, 18, None, 32, 38, 45, 55, None, None, None, None, None, 22, None, 33, 37, 39, 43, 48, 52, 58, None, None, None, None, 36, None, None, None, None, 44, 47, 49, 51, 53, 56, 59, None, None, None, None, 46, None, None, None, None, None, None, 54, None, 57, None, 60]))\n assert is_same_tree(candidate(preorder = [15, 10, 5, 3, 7, 12, 9, 14, 20, 18, 17, 19, 25, 23, 24, 28, 27, 29, 30]), tree_node([15, 10, 20, 5, 12, 18, 25, 3, 7, 9, 14, 17, 19, 23, 28, None, None, None, None, None, None, None, None, None, None, None, None, None, 24, 27, 29, None, None, None, None, None, 30]))\n assert is_same_tree(candidate(preorder = [10, 5, 1, 3, 7, 6, 8, 15, 12, 14, 17, 20]), tree_node([10, 5, 15, 1, 7, 12, 17, None, 3, 6, 8, None, 14, None, 20]))\n assert is_same_tree(candidate(preorder = [1, 2, 4, 3, 5, 6, 8, 7, 10, 9, 11]), tree_node([1, None, 2, None, 4, 3, 5, None, None, None, 6, None, 8, 7, 10, None, None, 9, 11]))\n assert is_same_tree(candidate(preorder = [25, 20, 15, 10, 5, 18, 22, 17, 19, 30, 27, 26, 28, 35, 32, 31, 33, 40, 37, 39, 45, 42, 43, 47, 50]), tree_node([25, 20, 30, 15, None, 27, 35, 10, 18, 26, 28, 32, 40, 5, None, 22, 19, None, None, None, None, 31, 33, 37, 45, None, None, 17, None, None, None, None, None, None, None, None, 39, 42, 47, None, None, None, None, None, 43, None, 50]))\n assert is_same_tree(candidate(preorder = [30, 10, 5, 3, 1, 4, 7, 6, 8, 20, 15, 12, 11, 13, 18, 17, 19, 25, 22, 21, 23, 27, 26, 28]), tree_node([30, 10, None, 5, 20, 3, 7, 15, 25, 1, 4, 6, 8, 12, 18, 22, 27, None, None, None, None, None, None, None, None, 11, 13, 17, 19, 21, 23, 26, 28]))\n assert is_same_tree(candidate(preorder = [20, 10, 5, 1, 3, 7, 6, 8, 15, 12, 14, 17, 25, 22, 27, 30]), tree_node([20, 10, 25, 5, 15, 22, 27, 1, 7, 12, 17, None, None, None, 30, None, 3, 6, 8, None, 14]))\n assert is_same_tree(candidate(preorder = [40, 30, 20, 10, 5, 3, 7, 25, 22, 27, 35, 32, 38, 50, 45, 42, 47, 55, 52, 58, 60]), tree_node([40, 30, 50, 20, 35, 45, 55, 10, 25, 32, 38, 42, 47, 52, 58, 5, None, 22, 27, None, None, None, None, None, None, None, None, None, None, None, 60, 3, 7]))\n assert is_same_tree(candidate(preorder = [25, 15, 10, 5, 3, 1, 4, 12, 8, 7, 6, 11, 20, 18, 17, 16, 19, 35, 30, 28, 27, 29, 26, 32, 31, 33, 31, 34, 45, 40, 38, 37, 39, 42, 41, 43, 48, 46, 45, 47, 49, 55, 50, 49, 51, 52, 58, 56, 57, 59, 60]), tree_node([25, 15, 35, 10, 20, 30, 45, 5, 12, 18, None, 28, 32, 40, 48, 3, None, 8, None, 17, 19, 27, 29, 31, 34, 38, 42, 46, 49, 1, 4, 7, 11, 16, None, None, None, None, None, 26, None, 33, None, None, None, 37, 39, 41, 43, 45, 47, 55, 51, None, None, None, None, 6, None, None, None, None, None, None, None, 31, None, None, None, None, None, None, None, None, None, None, None, None, None, 50, None, None, 52, None, None, None, None, 49, None, None, 58, None, None, 56, 59, None, 57, None, 60]))\n assert is_same_tree(candidate(preorder = [100, 50, 25, 10, 5, 3, 1, 4, 7, 6, 8, 15, 12, 11, 13, 18, 17, 19, 75, 60, 55, 53, 52, 54, 57, 56, 58, 65, 62, 61, 63, 68, 67, 69, 80, 75, 72, 71, 73, 78, 77, 79, 85, 82, 81, 83, 88, 87, 89, 95, 92, 91, 93, 98, 97, 99, 150, 125, 110, 105, 103, 102, 104, 107, 106, 108, 115, 112, 111, 113, 118, 117, 119, 130, 122, 121, 123, 128, 127, 129, 140, 135, 132, 131, 133, 138, 137, 139, 155, 152, 151, 153, 158, 157, 159]), tree_node([100, 50, 150, 25, 75, 125, 155, 10, None, 60, 78, 110, 130, 152, 158, 5, 15, 55, 65, 77, 79, 105, 115, 122, 140, 151, 153, 157, 159, 3, 7, 12, 18, 53, 57, 62, 68, None, None, None, 85, 103, 107, 112, 118, 121, 123, 135, None, None, None, None, None, None, None, None, None, 1, 4, 6, 8, 11, 13, 17, 19, 52, 54, 56, 58, 61, 63, 67, 69, 82, 88, 102, 104, 106, 108, 111, 113, 117, 119, None, None, None, 128, 132, 138, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 80, 81, 83, 87, 89, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 127, 129, 131, 133, 137, 139, 75, None, None, None, None, None, None, None, None, 95, None, None, None, None, None, None, None, None, None, None, None, None, 72, None, 92, 98, 71, 73, 91, 93, 97, 99]))\n assert is_same_tree(candidate(preorder = [50, 30, 20, 10, 15, 25, 35, 40, 45, 70, 60, 55, 58, 65, 80, 75, 72, 73, 78, 85, 82, 83, 87, 90, 95, 92, 93, 98, 97, 99]), tree_node([50, 30, 70, 20, 35, 60, 80, 10, 25, None, 40, 55, 65, 75, 85, None, 15, None, None, None, 45, None, 58, None, None, 72, 78, 82, 87, None, None, None, None, None, None, None, 73, None, None, None, 83, None, 90, None, None, None, None, None, 95, 92, 98, None, 93, 97, 99]))\n assert is_same_tree(candidate(preorder = [100, 50, 25, 10, 5, 15, 40, 30, 75, 60, 55, 57, 65, 80, 70, 72, 90, 85, 95]), tree_node([100, 50, None, 25, 75, 10, 40, 60, 90, 5, 15, 30, None, 55, 65, 85, 95, None, None, None, None, None, None, None, 57, None, 80, None, None, None, None, None, None, 70, None, None, 72]))\n assert is_same_tree(candidate(preorder = [10, 5, 1, 3, 7, 6, 8, 9, 12, 11, 13]), tree_node([10, 5, 12, 1, 7, 11, 13, None, 3, 6, 8, None, None, None, None, None, None, None, None, None, 9]))\n assert is_same_tree(candidate(preorder = [50, 25, 10, 5, 3, 7, 15, 12, 18, 40, 30, 28, 32, 35, 38, 75, 60, 55, 58, 65, 80, 72, 70, 73, 78, 85, 82, 83, 87, 90, 95, 92, 93, 98, 97, 99]), tree_node([50, 25, 75, 10, 40, 60, 78, 5, 15, 30, None, 55, 65, None, 85, 3, 7, 12, 18, 28, 32, None, 58, None, 80, 82, 87, None, None, None, None, None, None, None, None, None, None, None, 35, None, None, 72, None, None, 83, None, 90, None, 38, 70, 73, None, None, None, 95, None, None, None, None, None, None, 92, 98, None, 93, 97, 99]))\n assert is_same_tree(candidate(preorder = [100, 50, 25, 12, 6, 37, 43, 75, 62, 60, 61, 70, 80, 150, 125, 110, 115, 113, 114, 130, 140, 135, 137, 155, 160, 158, 159]), tree_node([100, 50, 150, 25, 75, 125, 155, 12, 37, 62, 80, 110, 130, None, 160, 6, None, None, 43, 60, 70, None, None, None, 115, None, 140, 158, None, None, None, None, None, None, 61, None, None, 113, None, 135, None, None, 159, None, None, None, 114, None, 137]))\n assert is_same_tree(candidate(preorder = [100, 50, 25, 20, 15, 30, 40, 35, 37, 75, 60, 55, 58, 65, 80, 70, 72, 78, 90, 85, 88, 95, 92, 94, 98, 97, 99, 100]), tree_node([100, 50, None, 25, 75, 20, 30, 60, 80, 15, None, None, 40, 55, 65, 70, 90, None, None, 35, None, None, 58, None, None, None, 72, 85, 95, None, 37, None, None, None, 78, None, 88, 92, 98, None, None, None, None, None, None, None, 94, 97, 99, None, None, None, None, None, 100]))\n assert is_same_tree(candidate(preorder = [20, 10, 5, 3, 1, 7, 15, 6, 8, 30, 25, 22, 27, 35, 32, 37, 40]), tree_node([20, 10, 30, 5, None, 25, 35, 3, 7, 22, 27, 32, 37, 1, None, 15, 8, None, None, None, None, None, None, None, 40, None, None, 6]))\n assert is_same_tree(candidate(preorder = [25, 15, 10, 5, 8, 20, 17, 16, 18, 35, 30, 27, 28, 32, 33, 40, 37, 38, 42, 41, 43]), tree_node([25, 15, 35, 10, 20, 30, 40, 5, None, 17, None, 27, 32, 37, 42, None, 8, 16, 18, None, 28, None, 33, None, 38, 41, 43]))\n assert is_same_tree(candidate(preorder = [15, 10, 5, 3, 2, 7, 13, 12, 11, 14, 20, 18, 17, 16, 19, 25, 23, 22, 21, 24, 27, 26, 28, 30, 29, 31]), tree_node([15, 10, 20, 5, 13, 18, 25, 3, 7, 12, 14, 17, 19, 23, 27, 2, None, None, None, 11, None, None, None, 16, None, None, None, 22, 24, 26, 28, None, None, None, None, None, None, 21, None, None, None, None, None, None, 30, None, None, 29, 31]))\n assert is_same_tree(candidate(preorder = [10, 5, 3, 1, 4, 7, 6, 9, 15, 12, 11, 13, 18, 17, 19]), tree_node([10, 5, 15, 3, 7, 12, 18, 1, 4, 6, 9, 11, 13, 17, 19]))\n assert is_same_tree(candidate(preorder = [7, 3, 1, 0, -1, 2, 5, 4, 6, 9, 8, 10, 12, 11, 13]), tree_node([7, 3, 9, 1, 5, 8, 10, 0, 2, 4, 6, None, None, None, 12, -1, None, None, None, None, None, None, None, 11, 13]))\n assert is_same_tree(candidate(preorder = [10, 5, 1, 3, 7, 6, 8, 9, 12, 11, 13, 14]), tree_node([10, 5, 12, 1, 7, 11, 13, None, 3, 6, 8, None, None, None, 14, None, None, None, None, None, 9]))\n assert is_same_tree(candidate(preorder = [100, 50, 25, 10, 5, 1, 4, 12, 8, 7, 6, 11, 40, 35, 32, 31, 33, 38, 36, 37, 39, 150, 125, 100, 75, 50, 25, 10, 5, 1, 4, 12, 8, 7, 6, 11, 40, 35, 32, 31, 33, 38, 36, 37, 39, 175, 150, 125, 100, 75, 50, 25, 10, 5, 1, 4, 12, 8, 7, 6, 11, 40, 35, 32, 31, 33, 38, 36, 37, 39]), tree_node([100, 50, None, 25, None, 10, 40, 5, 11, 35, None, 1, 12, None, None, 32, 38, None, 4, 8, None, 31, 33, 36, 39, None, None, 7, None, 33, 40, None, None, 37, 38, None, None, 6, None, 38, None, 35, None, 39, 40, 36, None, None, None, 36, None, 32, None, 175, None, 35, None, None, 37, 37, None, 31, None, 150, None, 32, None, None, None, 39, None, None, None, 125, None, 31, 33, 150, None, 100, None, None, None, None, None, 125, None, 75, None, 100, None, 50, None, 75, None, 25, None, 50, None, 10, None, 25, None, 5, 11, 10, None, 1, 12, None, None, 5, 11, None, 4, 8, None, 1, 12, None, None, None, None, 7, None, None, 4, 8, None, 6, None, None, None, 7, None, None, None, 6]))\n assert is_same_tree(candidate(preorder = [50, 40, 30, 20, 10, 60, 55, 58, 57, 59, 65, 63, 62, 64, 67, 66, 68, 70, 69, 71]), tree_node([50, 40, 60, 30, None, 55, 65, 20, None, None, 58, 63, 67, 10, None, 57, 59, 62, 64, 66, 68, None, None, None, None, None, None, None, None, None, None, None, None, None, 70, 69, 71]))\n assert is_same_tree(candidate(preorder = [50, 25, 20, 10, 5, 3, 1, 4, 7, 6, 8, 22, 21, 23, 30, 28, 27, 29, 40, 35, 32, 31, 33, 38, 36, 37, 55, 52, 51, 53, 58, 57, 59, 60, 56, 54, 65, 62, 61, 63, 68, 67, 69, 70, 66, 64, 75, 72, 71, 73, 78, 77, 79, 80, 76]), tree_node([50, 25, 55, 20, 30, 52, 58, 10, 22, 28, 40, 51, 53, 57, 65, 5, None, 21, 23, 27, 29, 35, None, None, None, None, None, 59, None, 62, 68, 3, 7, None, None, None, None, None, None, None, None, 32, 38, 60, None, 61, 63, 67, 75, 1, 4, 6, 8, 31, 33, 36, None, 56, None, None, None, None, None, 69, None, 72, 78, None, None, None, None, None, None, None, None, None, None, None, None, None, 37, 54, None, 70, None, 71, 73, 77, 79, None, None, None, None, 66, None, None, None, None, None, None, None, 80, None, 64, None, 76]))\n assert is_same_tree(candidate(preorder = [50, 30, 15, 10, 5, 3, 1, 4, 7, 6, 8, 25, 22, 21, 23, 40, 35, 32, 31, 33, 37, 36, 38, 60, 55, 52, 51, 53, 58, 57, 59, 65, 62, 61, 63, 68, 67, 69]), tree_node([50, 30, 60, 15, 40, 55, 65, 10, 25, 35, None, 52, 58, 62, 68, 5, None, 22, None, 32, 37, 51, 53, 57, 59, 61, 63, 67, 69, 3, 7, 21, 23, 31, 33, 36, 38, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 1, 4, 6, 8]))\n assert is_same_tree(candidate(preorder = [50, 30, 20, 10, 5, 15, 25, 22, 27, 40, 35, 32, 37, 45, 42, 47, 60, 55, 52, 57, 65, 62, 67]), tree_node([50, 30, 60, 20, 40, 55, 65, 10, 25, 35, 45, 52, 57, 62, 67, 5, 15, 22, 27, 32, 37, 42, 47]))\n assert is_same_tree(candidate(preorder = [8, 3, 1, 0, 2, 5, 4, 6, 10, 9, 11, 14, 13, 12, 15, 18, 17, 16, 19]), tree_node([8, 3, 10, 1, 5, 9, 11, 0, 2, 4, 6, None, None, None, 14, None, None, None, None, None, None, None, None, 13, 15, 12, None, None, 18, None, None, 17, 19, 16]))\n assert is_same_tree(candidate(preorder = [30, 20, 15, 10, 12, 25, 22, 21, 24, 35, 32, 31, 33, 40, 38, 37, 39, 45, 42, 41, 43, 48, 47, 46, 49]), tree_node([30, 20, 35, 15, 25, 32, 40, 10, None, 22, None, 31, 33, 38, 45, None, 12, 21, 24, None, None, None, None, 37, 39, 42, 48, None, None, None, None, None, None, None, None, None, None, 41, 43, 47, 49, None, None, None, None, 46]))\n assert is_same_tree(candidate(preorder = [8, 5, 3, 2, 1, 4, 7, 6, 8, 10, 9, 12, 11, 13, 15, 14, 16, 18, 17, 19, 20]), tree_node([8, 5, 10, 3, 7, 9, 12, 2, 4, 6, 8, None, None, 11, 13, 1, None, None, None, None, None, None, None, None, None, None, 15, None, None, 14, 16, None, None, None, 18, 17, 19, None, None, None, 20]))\n assert is_same_tree(candidate(preorder = [30, 20, 10, 5, 15, 25, 18, 22, 40, 35, 32, 37, 45, 42, 43, 47, 50]), tree_node([30, 20, 40, 10, 25, 35, 45, 5, 15, 18, None, 32, 37, 42, 47, None, None, None, None, None, 22, None, None, None, None, None, 43, None, 50]))\n assert is_same_tree(candidate(preorder = [5, 3, 2, 1, 4, 7, 6, 8, 9, 10]), tree_node([5, 3, 7, 2, 4, 6, 8, 1, None, None, None, None, None, None, 9, None, None, None, 10]))\n assert is_same_tree(candidate(preorder = [7, 3, 1, 0, 2, 5, 4, 6, 10, 9, 11, 15, 13, 12, 14, 18, 16, 17, 19]), tree_node([7, 3, 10, 1, 5, 9, 11, 0, 2, 4, 6, None, None, None, 15, None, None, None, None, None, None, None, None, 13, 18, 12, 14, 16, 19, None, None, None, None, None, 17]))\n assert is_same_tree(candidate(preorder = [25, 15, 10, 5, 3, 7, 20, 18, 22, 35, 30, 28, 32, 40, 45]), tree_node([25, 15, 35, 10, 20, 30, 40, 5, None, 18, 22, 28, 32, None, 45, 3, 7]))\n assert is_same_tree(candidate(preorder = [30, 20, 10, 5, 7, 15, 25, 22, 27, 40, 35, 32, 38, 45, 42, 47, 50, 48, 49, 55, 52, 58, 60]), tree_node([30, 20, 40, 10, 25, 35, 45, 5, 15, 22, 27, 32, 38, 42, 47, None, 7, None, None, None, None, None, None, None, None, None, None, None, None, None, 50, None, None, 48, 55, None, 49, 52, 58, None, None, None, None, None, 60]))\n assert is_same_tree(candidate(preorder = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]), tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20]))\n assert is_same_tree(candidate(preorder = [50, 30, 25, 20, 15, 10, 5, 3, 1, 4, 7, 6, 8, 27, 26, 28, 40, 35, 32, 31, 33, 37, 36, 38, 45, 42, 41, 43, 47, 46, 48, 60, 55, 52, 51, 53, 58, 57, 59, 65, 62, 61, 63, 68, 67, 69]), tree_node([50, 30, 60, 25, 40, 55, 65, 20, 27, 35, 45, 52, 58, 62, 68, 15, None, 26, 28, 32, 37, 42, 47, 51, 53, 57, 59, 61, 63, 67, 69, 10, None, None, None, None, None, 31, 33, 36, 38, 41, 43, 46, 48, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 5, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 3, 7, 1, 4, 6, 8]))\n assert is_same_tree(candidate(preorder = [10, 5, 3, 1, 4, 7, 6, 8, 15, 12, 11, 13, 18, 17, 19]), tree_node([10, 5, 15, 3, 7, 12, 18, 1, 4, 6, 8, 11, 13, 17, 19]))\n assert is_same_tree(candidate(preorder = [50, 30, 20, 10, 5, 15, 40, 25, 35, 70, 60, 55, 65, 80, 75, 85]), tree_node([50, 30, 70, 20, 35, 60, 80, 10, 40, None, None, 55, 65, 75, 85, 5, 15, 25]))\n assert is_same_tree(candidate(preorder = [20, 15, 10, 5, 3, 2, 1, 4, 7, 6, 8, 12, 11, 13, 18, 17, 19, 25, 22, 21, 23, 27, 26, 28, 30]), tree_node([20, 15, 25, 10, 18, 22, 27, 5, 12, 17, 19, 21, 23, 26, 28, 3, 7, 11, 13, None, None, None, None, None, None, None, None, None, None, None, 30, 2, 4, 6, 8, None, None, None, None, None, None, 1]))\n assert is_same_tree(candidate(preorder = [25, 20, 15, 10, 5, 3, 1, 4, 7, 6, 8, 22, 21, 23, 30, 28, 27, 29, 35, 33, 32, 34, 38, 36, 37, 40, 39, 41]), tree_node([25, 20, 30, 15, 22, 28, 35, 10, None, 21, 23, 27, 29, 33, 38, 5, None, None, None, None, None, None, None, None, None, 32, 34, 36, 40, 3, 7, None, None, None, None, None, 37, 39, 41, 1, 4, 6, 8]))\n assert is_same_tree(candidate(preorder = [5, 15, 3, 7, 12, 18, 2, 1, 4, 6, 8, 11, 13, 17, 19]), tree_node([5, 15, 6, 3, 18, None, 8, None, 7, 2, None, None, 11, None, 12, 1, 4, None, 13, None, None, None, None, None, None, None, 17, None, 19]))\n assert is_same_tree(candidate(preorder = [50, 30, 20, 10, 5, 3, 1, 8, 7, 6, 15, 12, 11, 13, 40, 35, 32, 31, 33, 38, 36, 37, 39, 70, 60, 55, 50, 45, 40, 42, 43, 57, 53, 52, 51, 54, 58, 59, 65, 62, 61, 63, 68, 67, 69, 75, 72, 71, 73, 78, 76, 77, 79]), tree_node([50, 30, 57, 20, 40, 53, 58, 10, None, 35, 70, 52, 54, None, 59, 5, 15, 32, 38, 60, None, 51, None, None, None, None, 65, 3, 8, 12, None, 31, 33, 36, 39, 55, None, None, None, 62, 68, 1, None, 7, None, 11, 13, None, None, None, None, None, 37, None, None, 50, None, 61, 63, 67, 69, None, None, 6, None, None, None, None, None, None, None, 45, None, None, None, None, None, None, None, None, 75, None, None, 40, None, 72, 78, None, 42, 71, 73, 76, 79, None, 43, None, None, None, None, None, 77]))\n assert is_same_tree(candidate(preorder = [75, 50, 25, 10, 5, 15, 30, 20, 28, 40, 35, 45, 60, 55, 57, 65, 100, 80, 77, 78, 85, 87, 90, 95, 110, 105, 115]), tree_node([75, 50, 100, 25, 60, 80, 110, 10, 28, 55, 65, 77, 85, 105, 115, 5, 15, None, 40, None, 57, None, None, None, 78, None, 87, None, None, None, None, None, None, None, 30, 35, 45, None, None, None, None, None, 90, 20, None, None, None, None, None, None, 95]))\n assert is_same_tree(candidate(preorder = [50, 30, 20, 10, 25, 40, 35, 38, 70, 60, 55, 65, 80, 75, 85]), tree_node([50, 30, 70, 20, 40, 60, 80, 10, 25, 35, None, 55, 65, 75, 85, None, None, None, None, None, 38]))\n assert is_same_tree(candidate(preorder = [30, 20, 10, 5, 3, 7, 15, 12, 17, 25, 22, 27, 35, 32, 33, 37]), tree_node([30, 20, 35, 10, 25, 32, 37, 5, 15, 22, 27, None, 33, None, None, 3, 7, 12, 17]))\n assert is_same_tree(candidate(preorder = [20, 15, 10, 5, 12, 17, 16, 18, 25, 22, 24, 28, 27, 29]), tree_node([20, 15, 25, 10, 17, 22, 28, 5, 12, 16, 18, None, 24, 27, 29]))\n assert is_same_tree(candidate(preorder = [200, 100, 50, 25, 10, 5, 15, 75, 60, 55, 63, 70, 150, 125, 120, 110, 115, 130, 135, 250, 225, 220, 210, 215, 230, 235, 275, 255, 245, 260, 265, 285, 280, 290, 295]), tree_node([200, 100, 250, 50, 150, 225, 275, 25, 75, 125, None, 220, 230, 255, 285, 10, None, 60, None, 120, 130, 210, None, None, 235, 245, 260, 280, 290, 5, 15, 55, 63, 110, None, None, 135, None, 215, None, None, None, None, None, 265, None, None, None, 295, None, None, None, None, None, None, None, 70, None, 115]))\n assert is_same_tree(candidate(preorder = [50, 40, 30, 20, 10, 35, 45, 33, 36, 42, 48, 60, 55, 52, 53, 58, 56, 57, 65, 62, 61, 63, 68, 66, 67, 69, 70]), tree_node([50, 40, 60, 30, 45, 55, 65, 20, 35, 33, 48, 52, 58, 62, 68, 10, None, None, None, None, 36, None, None, None, 53, 56, None, 61, 63, 66, 69, None, None, None, 42, None, None, None, 57, None, None, None, None, None, 67, None, 70]))\n assert is_same_tree(candidate(preorder = [2, 1, 4, 3, 5, 7, 6, 8, 9, 10]), tree_node([2, 1, 4, None, None, 3, 5, None, None, None, 7, 6, 8, None, None, None, 9, None, 10]))\n assert is_same_tree(candidate(preorder = [30, 20, 10, 5, 3, 1, 4, 7, 6, 8, 15, 12, 11, 13, 25, 22, 21, 23, 27, 26, 28]), tree_node([30, 20, None, 10, 25, 5, 15, 22, 27, 3, 7, 12, None, 21, 23, 26, 28, 1, 4, 6, 8, 11, 13]))\n assert is_same_tree(candidate(preorder = [30, 20, 10, 5, 15, 25, 18, 28, 40, 35, 32, 38, 50, 45, 55]), tree_node([30, 20, 40, 10, 25, 35, 50, 5, 15, 18, 28, 32, 38, 45, 55]))\n assert is_same_tree(candidate(preorder = [45, 25, 10, 5, 15, 20, 30, 35, 40, 65, 55, 50, 58, 60, 67, 70, 80, 75, 77, 85, 90, 88, 89, 95, 92, 93, 98, 97, 99]), tree_node([45, 25, 65, 10, 30, 55, 67, 5, 15, None, 35, 50, 58, None, 70, None, None, None, 20, None, 40, None, None, None, 60, None, 80, None, None, None, None, None, None, 75, 85, None, 77, None, 90, None, None, 88, 95, None, 89, 92, 98, None, None, None, 93, 97, 99]))\n assert is_same_tree(candidate(preorder = [7, 3, 1, 2, 5, 4, 6, 10, 9, 12, 11, 13]), tree_node([7, 3, 10, 1, 5, 9, 12, None, 2, 4, 6, None, None, 11, 13]))\n assert is_same_tree(candidate(preorder = [10, 5, 3, 2, 1, 4, 7, 6, 8, 15, 12, 11, 13, 20, 18, 17, 19, 25, 22, 21, 23, 27, 26, 28]), tree_node([10, 5, 15, 3, 7, 12, 20, 2, 4, 6, 8, 11, 13, 18, 25, 1, None, None, None, None, None, None, None, None, None, None, None, 17, 19, 22, 27, None, None, None, None, None, None, 21, 23, 26, 28]))\n assert is_same_tree(candidate(preorder = [80, 70, 60, 50, 40, 45, 55, 65, 75, 90, 85, 88, 95, 100, 98, 99, 105, 102, 103, 110, 108, 109, 115, 112, 113, 118, 117, 119, 120]), tree_node([80, 70, 90, 60, 75, 85, 95, 50, 65, None, None, None, 88, None, 100, 40, 55, None, None, None, None, 98, 105, None, 45, None, None, None, 99, 102, 110, None, None, None, None, None, 103, 108, 115, None, None, None, 109, 112, 118, None, None, None, 113, 117, 119, None, None, None, None, None, 120]))\n assert is_same_tree(candidate(preorder = [100, 50, 25, 10, 5, 15, 7, 12, 30, 20, 27, 18, 22, 75, 60, 55, 58, 65, 70, 80, 90, 120, 110, 115, 130, 140]), tree_node([100, 50, 120, 25, 75, 110, 130, 10, 30, 60, 80, None, 115, None, 140, 5, 12, 20, None, 55, 65, None, 90, None, None, None, None, None, 15, None, None, 27, 22, None, 58, None, 70, None, None, 7, None, 18]))\n assert is_same_tree(candidate(preorder = [9, 6, 3, 2, 1, 4, 8, 7, 10, 12, 11, 13]), tree_node([9, 6, 10, 3, 8, None, 12, 2, 4, 7, None, 11, 13, 1]))\n assert is_same_tree(candidate(preorder = [60, 30, 20, 10, 5, 15, 25, 22, 27, 40, 35, 32, 38, 50, 45, 42, 47, 55, 52, 58, 65, 62, 63, 64, 67, 68, 70]), tree_node([60, 30, 65, 20, 40, 62, 67, 10, 25, 35, 50, None, 63, None, 68, 5, 15, 22, 27, 32, 38, 45, 55, None, 64, None, 70, None, None, None, None, None, None, None, None, None, None, None, None, 42, 47, 52, 58]))\n assert is_same_tree(candidate(preorder = [20, 10, 5, 1, 3, 7, 15, 12, 17, 30, 25, 22, 27, 40, 35, 32, 37, 45]), tree_node([20, 10, 30, 5, 15, 25, 40, 1, 7, 12, 17, 22, 27, 35, 45, None, 3, None, None, None, None, None, None, None, None, None, None, 32, 37]))\n assert is_same_tree(candidate(preorder = [25, 20, 15, 10, 5, 7, 12, 18, 23, 30, 27, 29, 35, 32, 38, 40, 37, 39, 45, 42, 44, 48, 50]), tree_node([25, 20, 30, 15, 23, 27, 35, 10, 18, None, None, None, 29, 32, 38, 5, 12, None, None, None, None, None, None, 40, 39, None, 7, None, None, 37, None, None, 45, None, None, None, None, 42, 48, None, 44, None, 50]))\n assert is_same_tree(candidate(preorder = [100, 50, 25, 10, 15, 75, 60, 55, 65, 70, 80, 90, 110, 105, 108, 109, 115, 112, 113, 118, 117, 119, 120]), tree_node([100, 50, 110, 25, 75, 105, 115, 10, None, 60, 80, None, 108, 112, 118, None, 15, 55, 65, None, 90, None, 109, None, 113, 117, 119, None, None, None, None, None, 70, None, None, None, None, None, None, None, None, None, 120]))\n"}, "metadata": {"canonical_parameter_names": ["preorder"], "leetcode_dataset_entry_point": "Solution().bstFromPreorder", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var bstFromPreorder = function(preorder) {", "container": null, "callable": "bstFromPreorder", "parameters": [{"name": "preorder", "type": "number[]"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1009, "task_id": "complement-of-base-10-integer", "difficulty": "Easy", "problem_description": "The complement of an integer is the integer you get when you flip all the 0's to 1's and all the 1's to 0's in its binary representation.\n\nFor example, The integer 5 is \"101\" in binary and its complement is \"010\" which is the integer 2.\n\nGiven an integer n, return its complement.\n \nExample 1:\n\nInput: n = 5\nOutput: 2\nExplanation: 5 is \"101\" in binary, with complement \"010\" in binary, which is 2 in base-10.\n\nExample 2:\n\nInput: n = 7\nOutput: 0\nExplanation: 7 is \"111\" in binary, with complement \"000\" in binary, which is 0 in base-10.\n\nExample 3:\n\nInput: n = 10\nOutput: 5\nExplanation: 10 is \"1010\" in binary, with complement \"0101\" in binary, which is 5 in base-10.\n\n \nConstraints:\n\n0 <= n < 109\n\n \nNote: This question is the same as 476: https://leetcode.com/problems/number-complement/\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 0) == 1\n assert candidate(n = 8) == 7\n assert candidate(n = 100) == 27\n assert candidate(n = 15) == 0\n assert candidate(n = 31) == 0\n assert candidate(n = 123456789) == 10760938\n assert candidate(n = 1) == 0\n assert candidate(n = 7) == 0\n assert candidate(n = 10) == 5\n assert candidate(n = 5) == 2\n assert candidate(n = 123) == 4\n assert candidate(n = 894567890) == 179173933\n assert candidate(n = 890123456) == 183618367\n assert candidate(n = 131071) == 0\n assert candidate(n = 897543210) == 176198613\n assert candidate(n = 67108863) == 0\n assert candidate(n = 2147483647) == 0\n assert candidate(n = 67890) == 63181\n assert candidate(n = 32767) == 0\n assert candidate(n = 4294967295) == 0\n assert candidate(n = 134217727) == 0\n assert candidate(n = 891011121) == 182730702\n assert candidate(n = 1073741823) == 0\n assert candidate(n = 1024) == 1023\n assert candidate(n = 16777215) == 0\n assert candidate(n = 2048) == 2047\n assert candidate(n = 255) == 0\n assert candidate(n = 1023) == 0\n assert candidate(n = 65535) == 0\n assert candidate(n = 1000000000) == 73741823\n assert candidate(n = 987654321) == 86087502\n assert candidate(n = 1048575) == 0\n assert candidate(n = 500000000) == 36870911\n assert candidate(n = 536870911) == 0\n assert candidate(n = 543210987) == 530530836\n assert candidate(n = 33554431) == 0\n assert candidate(n = 54321) == 11214\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().bitwiseComplement", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var bitwiseComplement = function(n) {", "container": null, "callable": "bitwiseComplement", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1010, "task_id": "pairs-of-songs-with-total-durations-divisible-by-60", "difficulty": "Medium", "problem_description": "You are given a list of songs where the ith song has a duration of time[i] seconds.\nReturn the number of pairs of songs for which their total duration in seconds is divisible by 60. Formally, we want the number of indices i, j such that i < j with (time[i] + time[j]) % 60 == 0.\n \nExample 1:\n\nInput: time = [30,20,150,100,40]\nOutput: 3\nExplanation: Three pairs have a total duration divisible by 60:\n(time[0] = 30, time[2] = 150): total duration 180\n(time[1] = 20, time[3] = 100): total duration 120\n(time[1] = 20, time[4] = 40): total duration 60\n\nExample 2:\n\nInput: time = [60,60,60]\nOutput: 3\nExplanation: All three pairs have a total duration of 120, which is divisible by 60.\n\n \nConstraints:\n\n1 <= time.length <= 6 * 104\n1 <= time[i] <= 500\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(time = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(time = [1, 3, 5, 7, 9, 11]) == 0\n assert candidate(time = [40, 20, 50, 30, 10]) == 2\n assert candidate(time = [60, 120, 180, 240, 300]) == 10\n assert candidate(time = [37, 123, 45, 20, 7, 30]) == 0\n assert candidate(time = [30, 60, 90, 120, 150]) == 4\n assert candidate(time = [10, 20, 30, 40, 50]) == 2\n assert candidate(time = [37, 49, 58, 37, 17]) == 0\n assert candidate(time = [60, 60, 60]) == 3\n assert candidate(time = [30, 20, 150, 100, 40]) == 3\n assert candidate(time = [15, 60, 75, 90, 105]) == 2\n assert candidate(time = [5, 10, 15, 20, 25, 30]) == 0\n assert candidate(time = [59, 61, 59, 61, 59, 61]) == 9\n assert candidate(time = [10, 50, 90, 150, 210]) == 4\n assert candidate(time = [120, 240, 360, 480, 600]) == 10\n assert candidate(time = [59, 1, 59, 2, 59, 3, 59, 4, 59, 5]) == 5\n assert candidate(time = [30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480, 510, 540, 570]) == 81\n assert candidate(time = [59, 1, 59, 2, 58, 3, 57, 4, 56, 5, 55, 6, 54, 7, 53, 8, 52, 9, 51, 10, 50]) == 11\n assert candidate(time = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 30\n assert candidate(time = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]) == 29\n assert candidate(time = [15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240]) == 28\n assert candidate(time = [1, 119, 2, 118, 3, 117, 4, 116, 5, 115]) == 5\n assert candidate(time = [59, 61, 119, 121, 179, 181, 239, 241, 299, 301]) == 25\n assert candidate(time = [29, 31, 17, 43, 13, 47, 7, 53, 19, 41]) == 5\n assert candidate(time = [40, 80, 120, 160, 200, 240, 280, 320, 360, 400, 440, 480]) == 22\n assert candidate(time = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 0\n assert candidate(time = [5, 15, 25, 35, 45, 55, 105, 115, 125, 135, 145, 155]) == 12\n assert candidate(time = [14, 26, 38, 50, 2, 18, 30, 42, 54, 6]) == 2\n assert candidate(time = [59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59]) == 0\n assert candidate(time = [35, 25, 55, 35, 25, 55, 35, 25, 55, 35, 25, 55, 35, 25, 55, 35, 25, 55, 35, 25, 55, 35, 25, 55, 35, 25, 55]) == 81\n assert candidate(time = [59, 119, 179, 239, 299, 359, 419, 479, 539, 599, 659, 719, 779, 839, 899]) == 0\n assert candidate(time = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300]) == 70\n assert candidate(time = [35, 25, 55, 15, 45, 5, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205, 215, 225, 235, 245, 255, 265, 275, 285, 295]) == 75\n assert candidate(time = [30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480, 510, 540, 570, 600, 630, 660, 690, 720, 750, 780, 810, 840, 870, 900]) == 210\n assert candidate(time = [40, 20, 50, 10, 80, 30, 70, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480, 510, 540, 570, 600, 630, 660, 690, 720, 750, 780, 810, 840, 870, 900, 930, 960, 990, 1020, 1050, 1080, 1110, 1140, 1170, 1200, 1230, 1260, 1290, 1320, 1350, 1380, 1410, 1440, 1470, 1500, 1530, 1560, 1590, 1620, 1650, 1680]) == 760\n assert candidate(time = [53, 5, 3, 17, 57, 23, 59, 41, 37, 19, 49, 11]) == 4\n assert candidate(time = [1, 61, 121, 181, 241, 301, 361, 421, 481, 541, 601, 661, 721, 781, 841, 901, 961, 1021, 1081, 1141, 1201, 1261, 1321, 1381, 1441, 1501, 1561, 1621, 1681, 1741, 1801, 1861, 1921, 1981, 2041, 2101, 2161, 2221, 2281, 2341, 2401, 2461, 2521, 2581, 2641, 2701, 2761, 2821, 2881, 2941, 3001, 3061, 3121, 3181, 3241, 3301, 3361, 3421, 3481, 3541, 3601]) == 0\n assert candidate(time = [30, 45, 60, 75, 90, 105, 120, 135, 150, 165]) == 10\n assert candidate(time = [37, 123, 45, 20, 7, 30, 23, 37, 123, 45, 20, 7, 30, 23, 37, 123, 45, 20, 7, 30]) == 9\n assert candidate(time = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 16\n assert candidate(time = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]) == 29\n assert candidate(time = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260, 265, 270, 275, 280, 285, 290, 295, 300]) == 145\n assert candidate(time = [59, 59, 59, 59, 59, 1, 1, 1, 1, 1]) == 25\n assert candidate(time = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 16\n assert candidate(time = [33, 27, 42, 18, 24, 36, 6, 54, 12, 48]) == 5\n assert candidate(time = [30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300]) == 60\n assert candidate(time = [59, 61, 119, 121, 179, 181, 239, 241, 299, 301, 359, 361, 419, 421, 479, 481, 539, 541, 599, 601, 659, 661, 719, 721, 779, 781, 839, 841, 899, 901, 959, 961, 1019, 1021, 1079, 1081, 1139, 1141, 1199, 1201, 1259, 1261, 1319, 1321, 1379, 1381, 1439, 1441, 1499, 1501, 1559, 1561, 1619, 1621, 1679, 1681]) == 784\n assert candidate(time = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60]) == 9\n assert candidate(time = [1, 59, 2, 58, 3, 57, 4, 56, 5, 55, 6, 54, 7, 53, 8, 52, 9, 51, 10, 50]) == 10\n assert candidate(time = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420, 430, 440, 450, 460, 470, 480, 490, 500]) == 200\n assert candidate(time = [1, 2, 3, 4, 5, 55, 56, 57, 58, 59]) == 5\n assert candidate(time = [1, 61, 2, 62, 3, 63, 4, 64, 5, 65, 6, 66, 7, 67, 8, 68, 9, 69, 10, 70]) == 0\n assert candidate(time = [1, 2, 3, 4, 5, 58, 59, 60, 61, 62, 63, 118, 119, 120, 121, 122, 178, 179, 180, 181, 182]) == 27\n assert candidate(time = [60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900, 960, 1020, 1080, 1140, 1200, 1260, 1320, 1380, 1440, 1500, 1560, 1620, 1680, 1740, 1800, 1860, 1920, 1980, 2040, 2100, 2160, 2220, 2280, 2340, 2400, 2460, 2520, 2580, 2640, 2700, 2760, 2820, 2880, 2940, 3000]) == 1225\n assert candidate(time = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]) == 10\n assert candidate(time = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205]) == 36\n assert candidate(time = [58, 59, 1, 2, 57, 56, 3, 4, 55, 54, 5, 6, 53, 52, 7, 8, 51, 50, 9, 10, 49, 48, 11, 12, 47, 46, 13, 14, 45, 44, 15, 16, 43, 42, 17, 18, 41, 40, 19, 20, 39, 38, 21, 22, 37, 36, 23, 24, 35, 34, 25, 26, 33, 32, 27, 28, 31, 30, 29]) == 29\n assert candidate(time = [29, 31, 59, 1, 58, 2, 57, 3, 56, 4, 55, 5, 54, 6, 53, 7, 52, 8, 51, 9, 50, 10, 49, 11, 48, 12, 47, 13, 46, 14, 45, 15, 44, 16, 43, 17, 42, 18, 41, 19, 40, 20, 39, 21, 38, 22, 37, 23, 36, 24, 35, 25, 34, 26, 33, 27, 32, 28]) == 29\n assert candidate(time = [45, 105, 165, 225, 285, 345, 405, 465, 525, 585]) == 0\n assert candidate(time = [40, 20, 60, 80, 100, 120, 140, 160, 180, 200]) == 15\n assert candidate(time = [30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480, 510, 540, 570, 600]) == 90\n assert candidate(time = [1, 2, 3, 4, 5, 58, 59, 60, 61, 62, 118, 119, 120, 121, 122]) == 13\n assert candidate(time = [30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480, 510, 540, 570, 600, 630, 660, 690, 720, 750, 780, 810, 840, 870, 900, 930, 960, 990, 1020, 1050, 1080, 1110, 1140, 1170, 1200, 1230, 1260, 1290, 1320, 1350, 1380, 1410, 1440, 1470, 1500]) == 600\n assert candidate(time = [31, 29, 1, 59, 2, 58, 3, 57, 4, 56, 5, 55, 6, 54, 7, 53, 8, 52, 9, 51]) == 10\n assert candidate(time = [40, 40, 40, 40, 40, 40, 20, 20, 20, 20, 20, 20]) == 36\n assert candidate(time = [60, 120, 180, 240, 300, 360, 420, 480, 540]) == 36\n assert candidate(time = [59, 1, 59, 1, 59, 1, 59, 1]) == 16\n assert candidate(time = [1, 59, 2, 58, 3, 57, 4, 56, 5, 55, 6, 54, 7, 53]) == 7\n assert candidate(time = [3, 12, 21, 30, 39, 48, 57, 66, 75, 84, 93, 102, 111, 120, 129, 138, 147, 156, 165, 174]) == 9\n assert candidate(time = [54, 42, 18, 24, 30, 60, 120, 180, 240, 300, 360, 420, 480, 540, 600]) == 46\n assert candidate(time = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30]) == 45\n assert candidate(time = [11, 22, 33, 44, 55, 11, 22, 33, 44, 55, 11, 22, 33, 44, 55, 11, 22, 33, 44, 55]) == 0\n assert candidate(time = [42, 18, 78, 36, 12, 24, 30, 60, 120, 180]) == 6\n assert candidate(time = [40, 20, 50, 30, 10, 70, 110, 90]) == 6\n assert candidate(time = [51, 9, 42, 18, 27, 33, 6, 54, 12, 48]) == 5\n assert candidate(time = [11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165]) == 0\n assert candidate(time = [61, 62, 63, 64, 65, 66, 67, 68, 69, 70]) == 0\n assert candidate(time = [1, 2, 3, 4, 5, 58, 59, 118, 119, 178, 179, 238, 239, 298, 299]) == 10\n assert candidate(time = [45, 90, 135, 180, 225, 270, 315, 360, 405, 450]) == 10\n assert candidate(time = [15, 25, 35, 45, 55, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195]) == 19\n assert candidate(time = [30, 60, 90, 120, 150, 180, 210, 240, 270, 300]) == 20\n assert candidate(time = [12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144]) == 13\n assert candidate(time = [14, 44, 23, 32, 56, 33, 92, 88, 31, 29]) == 3\n assert candidate(time = [30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360]) == 30\n assert candidate(time = [47, 47, 47, 47, 47, 13, 13, 13, 13, 13]) == 25\n assert candidate(time = [37, 37, 37, 37, 37, 23, 23, 23, 23, 23, 13, 13, 13, 13, 13]) == 25\n assert candidate(time = [60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900]) == 105\n assert candidate(time = [60, 120, 180, 240, 300, 360, 420, 480, 540, 600]) == 45\n assert candidate(time = [37, 123, 45, 20, 7, 30, 60, 120, 180, 240]) == 6\n"}, "metadata": {"canonical_parameter_names": ["time"], "leetcode_dataset_entry_point": "Solution().numPairsDivisibleBy60", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numPairsDivisibleBy60 = function(time) {", "container": null, "callable": "numPairsDivisibleBy60", "parameters": [{"name": "time", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1011, "task_id": "capacity-to-ship-packages-within-d-days", "difficulty": "Medium", "problem_description": "A conveyor belt has packages that must be shipped from one port to another within days days.\nThe ith package on the conveyor belt has a weight of weights[i]. Each day, we load the ship with packages on the conveyor belt (in the order given by weights). We may not load more weight than the maximum weight capacity of the ship.\nReturn the least weight capacity of the ship that will result in all the packages on the conveyor belt being shipped within days days.\n \nExample 1:\n\nInput: weights = [1,2,3,4,5,6,7,8,9,10], days = 5\nOutput: 15\nExplanation: A ship capacity of 15 is the minimum to ship all the packages in 5 days like this:\n1st day: 1, 2, 3, 4, 5\n2nd day: 6, 7\n3rd day: 8\n4th day: 9\n5th day: 10\n\nNote that the cargo must be shipped in the order given, so using a ship of capacity 14 and splitting the packages into parts like (2, 3, 4, 5), (1, 6, 7), (8), (9), (10) is not allowed.\n\nExample 2:\n\nInput: weights = [3,2,2,4,1,4], days = 3\nOutput: 6\nExplanation: A ship capacity of 6 is the minimum to ship all the packages in 3 days like this:\n1st day: 3, 2\n2nd day: 2, 4\n3rd day: 1, 4\n\nExample 3:\n\nInput: weights = [1,2,3,1,1], days = 4\nOutput: 3\nExplanation:\n1st day: 1\n2nd day: 2\n3rd day: 3\n4th day: 1, 1\n\n \nConstraints:\n\n1 <= days <= weights.length <= 5 * 104\n1 <= weights[i] <= 500\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(weights = [10, 50, 100, 100, 50, 10],days = 2) == 160\n assert candidate(weights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],days = 5) == 15\n assert candidate(weights = [10, 50, 100, 100, 50, 10],days = 3) == 160\n assert candidate(weights = [3, 2, 2, 4, 1, 4],days = 3) == 6\n assert candidate(weights = [1, 2, 3, 1, 1],days = 4) == 3\n assert candidate(weights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],days = 5) == 2\n assert candidate(weights = [5, 5, 5, 5, 5],days = 2) == 15\n assert candidate(weights = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47],days = 5) == 83\n assert candidate(weights = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],days = 4) == 170\n assert candidate(weights = [4, 3, 2, 5, 8, 2, 3, 5, 6, 1, 2, 4, 3, 7, 5],days = 8) == 10\n assert candidate(weights = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],days = 5) == 52\n assert candidate(weights = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],days = 6) == 48\n assert candidate(weights = [9, 10, 10, 10, 10, 10, 10, 10, 10, 10],days = 3) == 39\n assert candidate(weights = [450, 450, 450, 450, 450, 450, 450, 450, 450, 450],days = 2) == 2250\n assert candidate(weights = [30, 40, 20, 5, 10, 80, 25, 45, 60, 35, 50, 20, 40, 30, 50, 15],days = 8) == 90\n assert candidate(weights = [300, 300, 300, 300, 300, 300, 300, 300, 300, 300],days = 3) == 1200\n assert candidate(weights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],days = 7) == 23\n assert candidate(weights = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500],days = 4) == 850\n assert candidate(weights = [500, 500, 500, 500, 500, 500, 500, 500, 500, 500],days = 5) == 1000\n assert candidate(weights = [150, 300, 450, 600, 750, 900, 1050],days = 3) == 1650\n assert candidate(weights = [250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250],days = 5) == 750\n assert candidate(weights = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],days = 3) == 210\n assert candidate(weights = [3, 5, 8, 4, 2, 10, 1, 7, 6, 9, 11, 13, 15, 12, 14],days = 6) == 26\n assert candidate(weights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],days = 15) == 7\n assert candidate(weights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],days = 3) == 42\n assert candidate(weights = [1, 5, 9, 14, 20, 25, 30, 35, 40, 45, 50],days = 10) == 50\n assert candidate(weights = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],days = 15) == 20\n assert candidate(weights = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],days = 2) == 28000\n assert candidate(weights = [30, 50, 20, 40, 60, 10, 90, 80, 70, 100, 120, 130, 110, 140],days = 6) == 240\n assert candidate(weights = [50, 40, 30, 20, 10, 10, 20, 30, 40, 50],days = 4) == 90\n assert candidate(weights = [100, 200, 300, 400, 500, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],days = 6) == 500\n assert candidate(weights = [5, 10, 20, 30, 25, 40, 15, 10, 5, 30],days = 3) == 65\n assert candidate(weights = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],days = 10) == 20\n assert candidate(weights = [100, 200, 300, 100, 200, 300, 100, 200, 300, 100],days = 5) == 500\n assert candidate(weights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],days = 5) == 28\n assert candidate(weights = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50],days = 30) == 100\n assert candidate(weights = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],days = 5) == 1500\n assert candidate(weights = [47, 2, 20, 7, 2, 19, 23, 30, 6, 12, 9, 4, 30, 26, 8, 7],days = 10) == 47\n assert candidate(weights = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],days = 5) == 30\n assert candidate(weights = [10, 15, 10, 15, 10, 15, 10, 15],days = 6) == 25\n assert candidate(weights = [31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31],days = 5) == 155\n assert candidate(weights = [1, 2, 3, 100, 200, 300, 100, 200, 300, 1, 2, 3, 100, 200, 300, 100, 200, 300, 1, 2, 3],days = 7) == 500\n assert candidate(weights = [30, 50, 20, 100, 5, 75, 30, 25, 10, 60, 40, 80, 90, 10, 20],days = 7) == 120\n assert candidate(weights = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],days = 2) == 28\n assert candidate(weights = [500, 400, 300, 200, 100, 50, 40, 30, 20, 10, 5, 4, 3, 2, 1],days = 5) == 500\n assert candidate(weights = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],days = 5) == 1500\n assert candidate(weights = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],days = 2) == 500\n assert candidate(weights = [300, 200, 100, 50, 40, 30, 20, 10, 5, 4, 3, 2, 1, 1, 1],days = 7) == 300\n assert candidate(weights = [250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250],days = 10) == 500\n assert candidate(weights = [10, 5, 1, 7, 8, 12, 4, 7],days = 6) == 12\n assert candidate(weights = [300, 200, 100, 200, 300, 100, 200, 300, 100, 200],days = 4) == 600\n assert candidate(weights = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],days = 3) == 420\n assert candidate(weights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],days = 4) == 57\n assert candidate(weights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],days = 7) == 23\n assert candidate(weights = [4, 3, 5, 6, 8, 10, 3, 1, 5, 6],days = 5) == 13\n assert candidate(weights = [48, 99, 37, 11, 37, 42, 46, 20, 7, 13, 11, 50, 88, 33, 60, 10],days = 7) == 103\n assert candidate(weights = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],days = 3) == 70\n assert candidate(weights = [9, 8, 7, 6, 5, 4, 3, 2, 1],days = 5) == 11\n assert candidate(weights = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],days = 5) == 40\n assert candidate(weights = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],days = 15) == 10\n assert candidate(weights = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],days = 10) == 3\n assert candidate(weights = [10, 5, 2, 7, 3, 4, 11, 6, 9],days = 4) == 15\n assert candidate(weights = [300, 200, 100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300],days = 15) == 470\n assert candidate(weights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],days = 20) == 1\n assert candidate(weights = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],days = 10) == 6\n assert candidate(weights = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],days = 10) == 15\n assert candidate(weights = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50],days = 15) == 100\n assert candidate(weights = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],days = 7) == 100\n assert candidate(weights = [25, 47, 42, 77, 72, 46, 42, 44, 63, 59, 51, 55, 53, 91, 93, 95, 97, 99],days = 10) == 149\n assert candidate(weights = [91, 41, 54, 63, 17, 5, 58, 57, 98, 46],days = 10) == 98\n assert candidate(weights = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8],days = 5) == 32\n assert candidate(weights = [450, 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, 450],days = 15) == 900\n assert candidate(weights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],days = 10) == 28\n assert candidate(weights = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],days = 2) == 2800\n assert candidate(weights = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],days = 3) == 2100\n assert candidate(weights = [450, 450, 450, 450, 450, 450, 450, 450, 450, 450],days = 5) == 900\n assert candidate(weights = [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500],days = 10) == 1000\n assert candidate(weights = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],days = 10) == 27\n assert candidate(weights = [150, 100, 50, 200, 250, 300, 100, 50, 200, 150],days = 3) == 550\n assert candidate(weights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],days = 9) == 31\n"}, "metadata": {"canonical_parameter_names": ["weights", "days"], "leetcode_dataset_entry_point": "Solution().shipWithinDays", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shipWithinDays = function(weights, days) {", "container": null, "callable": "shipWithinDays", "parameters": [{"name": "weights", "type": "number[]"}, {"name": "days", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1012, "task_id": "numbers-with-repeated-digits", "difficulty": "Hard", "problem_description": "Given an integer n, return the number of positive integers in the range [1, n] that have at least one repeated digit.\n \nExample 1:\n\nInput: n = 20\nOutput: 1\nExplanation: The only positive number (<= 20) with at least 1 repeated digit is 11.\n\nExample 2:\n\nInput: n = 100\nOutput: 10\nExplanation: The positive numbers (<= 100) with atleast 1 repeated digit are 11, 22, 33, 44, 55, 66, 77, 88, 99, and 100.\n\nExample 3:\n\nInput: n = 1000\nOutput: 262\n\n \nConstraints:\n\n1 <= n <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 99999) == 67509\n assert candidate(n = 999999999) == 994388229\n assert candidate(n = 9999999) == 9287109\n assert candidate(n = 100) == 10\n assert candidate(n = 56789) == 37493\n assert candidate(n = 1000) == 262\n assert candidate(n = 50) == 4\n assert candidate(n = 300) == 66\n assert candidate(n = 10000) == 4726\n assert candidate(n = 101) == 11\n assert candidate(n = 100000) == 67510\n assert candidate(n = 999) == 261\n assert candidate(n = 9999) == 4725\n assert candidate(n = 20) == 1\n assert candidate(n = 1000000000) == 994388230\n assert candidate(n = 987654321) == 982042551\n assert candidate(n = 1234) == 431\n assert candidate(n = 1000000) == 831430\n assert candidate(n = 123456789) == 121064705\n assert candidate(n = 1) == 0\n assert candidate(n = 10) == 0\n assert candidate(n = 222222222) == 219432852\n assert candidate(n = 567890) == 465294\n assert candidate(n = 1234567890123456789) == 1234567890114579099\n assert candidate(n = 111111) == 76941\n assert candidate(n = 746384741) == 741672419\n assert candidate(n = 23456) == 14387\n assert candidate(n = 100100100) == 97754250\n assert candidate(n = 234567890) == 231766695\n assert candidate(n = 23456789) == 22516226\n assert candidate(n = 876543210) == 871340553\n assert candidate(n = 101010101) == 98664251\n assert candidate(n = 200000000) == 197291270\n assert candidate(n = 900000000) == 894751110\n assert candidate(n = 10000000) == 9287110\n assert candidate(n = 987654319) == 982042551\n assert candidate(n = 99999999) == 97654149\n assert candidate(n = 314159265) == 311036535\n assert candidate(n = 543210987) == 539235633\n assert candidate(n = 1000000010) == 994388240\n assert candidate(n = 899899) == 746449\n assert candidate(n = 1122334455) == 1116682365\n assert candidate(n = 555555555) == 551556585\n assert candidate(n = 271828182) == 268868772\n assert candidate(n = 111111111) == 108724941\n assert candidate(n = 1234567890) == 1228909886\n assert candidate(n = 888888888) == 883680318\n assert candidate(n = 11111) == 5501\n assert candidate(n = 987654320) == 982042551\n assert candidate(n = 500000) == 407030\n assert candidate(n = 98765) == 66275\n assert candidate(n = 500000000) == 496202630\n assert candidate(n = 88888888) == 86744638\n assert candidate(n = 1234567) == 1058291\n assert candidate(n = 999999) == 831429\n assert candidate(n = 123456) == 89039\n assert candidate(n = 87654321) == 85513027\n assert candidate(n = 54321) == 35467\n assert candidate(n = 100000000) == 97654150\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().numDupDigitsAtMostN", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numDupDigitsAtMostN = function(n) {", "container": null, "callable": "numDupDigitsAtMostN", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1013, "task_id": "partition-array-into-three-parts-with-equal-sum", "difficulty": "Easy", "problem_description": "Given an array of integers arr, return true if we can partition the array into three non-empty parts with equal sums.\nFormally, we can partition the array if we can find indexes i + 1 < j with (arr[0] + arr[1] + ... + arr[i] == arr[i + 1] + arr[i + 2] + ... + arr[j - 1] == arr[j] + arr[j + 1] + ... + arr[arr.length - 1])\n \nExample 1:\n\nInput: arr = [0,2,1,-6,6,-7,9,1,2,0,1]\nOutput: true\nExplanation: 0 + 2 + 1 = -6 + 6 - 7 + 9 + 1 = 2 + 0 + 1\n\nExample 2:\n\nInput: arr = [0,2,1,-6,6,7,9,-1,2,0,1]\nOutput: false\n\nExample 3:\n\nInput: arr = [3,3,6,5,-2,2,5,1,-9,4]\nOutput: true\nExplanation: 3 + 3 = 6 = 5 - 2 + 2 + 5 + 1 - 9 + 4\n\n \nConstraints:\n\n3 <= arr.length <= 5 * 104\n-104 <= arr[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000]) == True\n assert candidate(arr = [-10, -20, -30, -40, -50, -60, -70, -80, -90, -100]) == False\n assert candidate(arr = [10, -10, 10, -10, 10, -10, 10, -10]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == False\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(arr = [10, -10, 10, -10, 10, -10, 10, -10, 10, -10]) == True\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [-10000, 10000, -10000, 10000, -10000, 10000]) == True\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == False\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 3]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(arr = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1]) == True\n assert candidate(arr = [1, 2, 3, 0, 0, 0, 1, 2, 3]) == False\n assert candidate(arr = [3, 3, 6, 5, -2, 2, 5, 1, -9, 4]) == True\n assert candidate(arr = [0, 2, 1, -6, 6, 7, 9, -1, 2, 0, 1]) == False\n assert candidate(arr = [-10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000]) == True\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(arr = [0, 2, 1, -6, 6, -7, 9, 1, 2, 0, 1]) == True\n assert candidate(arr = [1, 2, 3, 6, 2, 3, 6, 2, 3, 6]) == False\n assert candidate(arr = [5, -5, 5, -5, 5, -5, 5, -5, 5, -5]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 15]) == False\n assert candidate(arr = [1, -1, 1, -1, 1, -1, 1, -1]) == True\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == False\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False\n assert candidate(arr = [1, 2, 3, 0, 0, 0, 6, 0, 0, 0, 6, 0, 0, 0, 6, 0, 0, 0]) == False\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == False\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == False\n assert candidate(arr = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, -30, -31, -32, -33, -34, -35, -36, -37, -38, -39, -40, -41, -42, -43, -44, -45, -46, -47, -48, -49, -50]) == False\n assert candidate(arr = [3, 6, -3, 6, -6, 3, 6, -3, 6, -6, 3, 6, -3, 6, -6]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -66, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == False\n assert candidate(arr = [-1, -1, -1, 3, 2, 0, 1, 1, -2, -1, 1, 1, 1, 1]) == False\n assert candidate(arr = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -15, 5, 10, 15, -30]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, -15, 1, 2, 3, 4, 5, -15, 1, 2, 3, 4, 5]) == False\n assert candidate(arr = [-5, 10, -15, 20, -25, 30, -35, 40, -45, 50, -55, 60, -65, 70, -75]) == False\n assert candidate(arr = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == False\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(arr = [1, 2, 3, 6, 0, 0, 6, 3, 2, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -210, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == False\n assert candidate(arr = [3, 6, 5, 2, 2, 5, 1, 2, 2, 3]) == False\n assert candidate(arr = [3, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == False\n assert candidate(arr = [10, 20, 30, 40, 50, -150, 60, 70, 80, 90, 100]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, -5, -10, -15, 30]) == False\n assert candidate(arr = [100, -50, 50, -50, 50, -50, 50, -50, 50, -50, 50, -50, 50, -50, 50, -50, 50, -50, 50, -50]) == False\n assert candidate(arr = [3, 1, -2, 1, 5, -4, 2, -1, 2, 1, 3, -1, -2, 1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -55, 11, 12, 13, 14]) == False\n assert candidate(arr = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14, -15, 16, -17, 18, -19, 20]) == False\n assert candidate(arr = [10, -10, 20, -20, 30, -30, 40, -40, 50, -50, 60, -60, 70, -70, 80, -80, 90, -90, 100, -100]) == True\n assert candidate(arr = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]) == False\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5]) == True\n assert candidate(arr = [7, 2, 19, 5, 1, 13, 1, 5, 3, 100, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -120, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -210, 21]) == False\n assert candidate(arr = [10, 10, -10, 10, 10, -20, 10, 10, 10, -30, 10, 10, 10, 10, 10]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -55, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == False\n assert candidate(arr = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9, 10, -10]) == True\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10]) == False\n assert candidate(arr = [3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1]) == False\n assert candidate(arr = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1]) == True\n assert candidate(arr = [100, 200, 300, 100, 200, 300, 100, 200, 300, 100, 200, 300, 100, 200, 300]) == False\n assert candidate(arr = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, 55, -11, -12, -13, -14, -15, -16, -17, -18, -19]) == False\n assert candidate(arr = [5, 5, 5, 5, -15, 5, 5, 5, 5, 5, 5, 5, -15, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [100, -50, 50, -25, 25, -12, 12, -6, 6, -3, 3, -1, 1, 0, 0, 0, 0, 0, 0, 0]) == False\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, -10, -20, -30, -40, -50, -60, -70, -80, -90, -100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == False\n assert candidate(arr = [-1, 2, -2, 3, -3, 4, -4, 5, -5, 1, -1, 2, -2, 3, -3, 4, -4, 5, -5]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -55, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == False\n assert candidate(arr = [1000, 2000, 3000, -1000, -2000, -3000, 1000, 2000, 3000, -1000, -2000, -3000, 1000, 2000, 3000]) == False\n assert candidate(arr = [2, 4, 6, 8, 10, 2, 4, 6, 8, 10, 2, 4, 6, 8, 10, 2, 4, 6, 8, 10]) == False\n assert candidate(arr = [7, -5, 3, 2, -4, 4, -1, 0, 1, -2, 1, 2, -3, 3]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -210]) == False\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().canThreePartsEqualSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var canThreePartsEqualSum = function(arr) {", "container": null, "callable": "canThreePartsEqualSum", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1014, "task_id": "best-sightseeing-pair", "difficulty": "Medium", "problem_description": "You are given an integer array values where values[i] represents the value of the ith sightseeing spot. Two sightseeing spots i and j have a distance j - i between them.\nThe score of a pair (i < j) of sightseeing spots is values[i] + values[j] + i - j: the sum of the values of the sightseeing spots, minus the distance between them.\nReturn the maximum score of a pair of sightseeing spots.\n \nExample 1:\n\nInput: values = [8,1,5,2,6]\nOutput: 11\nExplanation: i = 0, j = 2, values[i] + values[j] + i - j = 8 + 5 + 0 - 2 = 11\n\nExample 2:\n\nInput: values = [1,2]\nOutput: 2\n\n \nConstraints:\n\n2 <= values.length <= 5 * 104\n1 <= values[i] <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(values = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991]) == 1998\n assert candidate(values = [1, 3, 5, 7, 9, 11]) == 19\n assert candidate(values = [10, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 10\n assert candidate(values = [1, 100, 1, 100, 1, 100, 1, 100, 1, 100]) == 198\n assert candidate(values = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 18\n assert candidate(values = [8, 1, 5, 2, 6]) == 11\n assert candidate(values = [1000, 1, 1000, 1, 1000]) == 1998\n assert candidate(values = [10, 5, 1, 7, 2]) == 14\n assert candidate(values = [50, 40, 30, 20, 10]) == 89\n assert candidate(values = [3, 7, 2, 5]) == 10\n assert candidate(values = [10, 20, 30, 40, 50]) == 89\n assert candidate(values = [10, 5, 1, 2, 6, 3, 8, 1, 9, 4]) == 15\n assert candidate(values = [5, 5, 5, 5, 5]) == 9\n assert candidate(values = [1, 999, 999, 1, 999, 999, 1, 999, 999, 1]) == 1997\n assert candidate(values = [3, 7, 2, 5, 10]) == 14\n assert candidate(values = [1, 2]) == 2\n assert candidate(values = [1, 1000, 2, 999, 3, 998, 4, 997]) == 1997\n assert candidate(values = [9, 7, 5, 3, 1]) == 15\n assert candidate(values = [9, 4, 3, 2]) == 12\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 18\n assert candidate(values = [5, 3, 5, 7, 1, 9, 2, 6]) == 14\n assert candidate(values = [100, 1, 99, 2, 98, 3, 97, 4, 96, 5]) == 197\n assert candidate(values = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81]) == 198\n assert candidate(values = [1000, 1, 1000, 1, 1000, 1, 1000, 1]) == 1998\n assert candidate(values = [1, 999, 2, 998, 3, 997, 4, 996, 5, 995]) == 1995\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 38\n assert candidate(values = [1, 5, 3, 7, 9, 2, 6, 8, 4, 10]) == 16\n assert candidate(values = [500, 400, 300, 200, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 899\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == 189\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 18\n assert candidate(values = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 100, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 100\n assert candidate(values = [1, 2, 3, 4, 5, 1000, 6, 7, 8, 9]) == 1005\n assert candidate(values = [10, 1, 20, 2, 30, 3, 40, 4, 50, 5, 60, 6, 70, 7, 80, 8, 90, 9, 100, 10]) == 188\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 98\n assert candidate(values = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]) == 199\n assert candidate(values = [100, 200, 100, 200, 100, 200, 100, 200, 100, 200, 100, 200, 100, 200, 100, 200, 100, 200, 100, 200]) == 398\n assert candidate(values = [50, 20, 30, 10, 40, 60, 70, 80, 90, 100, 110, 120]) == 229\n assert candidate(values = [5, 4, 3, 2, 1, 1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980]) == 1998\n assert candidate(values = [1000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1000\n assert candidate(values = [5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 15, 14, 13, 12, 11]) == 28\n assert candidate(values = [1, 100, 2, 99, 3, 98, 4, 97, 5, 96, 6, 95, 7, 94, 8, 93]) == 197\n assert candidate(values = [10, 1, 20, 3, 30, 5, 40, 7, 50, 9, 60, 11, 70, 13, 80]) == 148\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10, -20, -30, -40, -50]) == 189\n assert candidate(values = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990]) == 1998\n assert candidate(values = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985]) == 1996\n assert candidate(values = [500, 500, 500, 500, 500, 500, 500, 500, 500, 500]) == 999\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1000]) == 1008\n assert candidate(values = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5]) == 8\n assert candidate(values = [1, 5, 2, 9, 3, 8, 4, 7, 5, 6, 2, 8, 4, 6, 1, 3, 5, 2, 8, 7, 4, 6, 1, 3, 5, 2, 8, 7, 4, 6]) == 15\n assert candidate(values = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970, 969, 968, 967, 966, 965, 964, 963, 962, 961, 960, 959, 958, 957, 956, 955, 954, 953, 952, 951, 950]) == 1996\n assert candidate(values = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 28\n assert candidate(values = [500, 100, 150, 200, 250, 300, 350, 400, 450, 500]) == 991\n assert candidate(values = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970]) == 1996\n assert candidate(values = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 19\n assert candidate(values = [100, 1, 200, 3, 400, 5, 600, 7, 800, 9]) == 1398\n assert candidate(values = [1, 1000, 2, 999, 3, 998, 4, 997, 5, 996, 6]) == 1997\n assert candidate(values = [1000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 1000\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 389\n assert candidate(values = [500, 10, 300, 20, 500, 10, 300, 20]) == 996\n assert candidate(values = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 98\n assert candidate(values = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 2\n assert candidate(values = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 18\n assert candidate(values = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 100]) == 100\n assert candidate(values = [500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000, 6500, 7000, 7500, 8000, 8500, 9000, 9500, 10000]) == 19499\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 9\n assert candidate(values = [1, 2, 3, 100, 2, 3, 100, 2, 3, 100, 2, 3, 100, 2, 3]) == 197\n assert candidate(values = [100, 1, 200, 2, 300, 3, 400, 4, 500, 5]) == 898\n assert candidate(values = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000]) == 1999\n assert candidate(values = [999, 1, 998, 2, 997, 3, 996, 4, 995, 5]) == 1995\n assert candidate(values = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991]) == 1998\n assert candidate(values = [800, 100, 900, 50, 10, 200, 300, 400, 500, 600]) == 1698\n assert candidate(values = [2, 3, 5, 5, 6, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 30\n assert candidate(values = [1, 1000, 1, 999, 1, 998, 1, 997, 1, 996]) == 1997\n assert candidate(values = [10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1]) == 18\n assert candidate(values = [10, 1, 10, 1, 10, 1, 10, 1, 10]) == 18\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 9\n assert candidate(values = [1, 1000, 2, 999, 3, 998, 4, 997, 5, 996, 6, 995, 7, 994, 8, 993, 9, 992, 10, 991]) == 1997\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 18\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1000]) == 1004\n assert candidate(values = [1, 5, 3, 7, 9, 2, 8, 6, 4, 10]) == 15\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 28\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 48\n assert candidate(values = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520]) == 1038\n assert candidate(values = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50]) == 1899\n assert candidate(values = [1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1]) == 1998\n assert candidate(values = [500, 400, 300, 200, 100, 50, 25, 10, 5, 1]) == 899\n assert candidate(values = [1, 1000, 2, 999, 3, 998, 4, 997, 5, 996, 6, 995, 7, 994, 8]) == 1997\n assert candidate(values = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 1990\n assert candidate(values = [1, 1000, 2, 999, 3, 998, 4, 997, 5, 996]) == 1997\n assert candidate(values = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1000]) == 1000\n assert candidate(values = [10, 50, 15, 20, 80, 30, 40, 60, 25, 70]) == 145\n assert candidate(values = [800, 900, 100, 200, 300, 400, 500, 600, 700, 800, 900]) == 1791\n assert candidate(values = [500, 499, 498, 497, 496, 495, 494, 493, 492, 491]) == 998\n assert candidate(values = [999, 1, 998, 2, 997, 3, 996, 4, 995, 5, 994, 6, 993, 7, 992, 8, 991, 9, 990, 10, 989, 11, 988, 12, 987, 13, 986, 14, 985, 15, 984, 16, 983]) == 1995\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1000, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 1008\n assert candidate(values = [1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1]) == 1998\n assert candidate(values = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 1980\n assert candidate(values = [1, 2, 3, 4, 5, 100, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 105\n assert candidate(values = [1, 999, 2, 998, 3, 997, 4, 996, 5, 995, 6, 994, 7, 993, 8, 992, 9, 991, 10, 990, 11, 989, 12, 988, 13, 987, 14, 986, 15, 985, 16, 984]) == 1995\n assert candidate(values = [1, 1000, 2, 1000, 3, 1000, 4, 1000, 5, 1000, 6, 1000, 7, 1000, 8, 1000, 9, 1000, 10, 1000]) == 1998\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 189\n assert candidate(values = [500, 400, 300, 200, 100, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 899\n assert candidate(values = [500, 1, 500, 1, 500, 1, 500, 1, 500, 1]) == 998\n assert candidate(values = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 99\n assert candidate(values = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 38\n assert candidate(values = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981]) == 1998\n"}, "metadata": {"canonical_parameter_names": ["values"], "leetcode_dataset_entry_point": "Solution().maxScoreSightseeingPair", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxScoreSightseeingPair = function(values) {", "container": null, "callable": "maxScoreSightseeingPair", "parameters": [{"name": "values", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1015, "task_id": "smallest-integer-divisible-by-k", "difficulty": "Medium", "problem_description": "Given a positive integer k, you need to find the length of the smallest positive integer n such that n is divisible by k, and n only contains the digit 1.\nReturn the length of n. If there is no such n, return -1.\nNote: n may not fit in a 64-bit signed integer.\n \nExample 1:\n\nInput: k = 1\nOutput: 1\nExplanation: The smallest answer is n = 1, which has length 1.\n\nExample 2:\n\nInput: k = 2\nOutput: -1\nExplanation: There is no such positive integer n divisible by 2.\n\nExample 3:\n\nInput: k = 3\nOutput: 3\nExplanation: The smallest answer is n = 111, which has length 3.\n\n \nConstraints:\n\n1 <= k <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(k = 29) == 28\n assert candidate(k = 101) == 4\n assert candidate(k = 83) == 41\n assert candidate(k = 43) == 21\n assert candidate(k = 89) == 44\n assert candidate(k = 17) == 16\n assert candidate(k = 73) == 8\n assert candidate(k = 67) == 33\n assert candidate(k = 53) == 13\n assert candidate(k = 7) == 6\n assert candidate(k = 99) == 18\n assert candidate(k = 31) == 15\n assert candidate(k = 13) == 6\n assert candidate(k = 71) == 35\n assert candidate(k = 2) == -1\n assert candidate(k = 59) == 58\n assert candidate(k = 99999) == 45\n assert candidate(k = 97) == 96\n assert candidate(k = 37) == 3\n assert candidate(k = 61) == 60\n assert candidate(k = 1) == 1\n assert candidate(k = 79) == 13\n assert candidate(k = 103) == 34\n assert candidate(k = 107) == 53\n assert candidate(k = 3) == 3\n assert candidate(k = 9) == 9\n assert candidate(k = 109) == 108\n assert candidate(k = 113) == 112\n assert candidate(k = 23) == 22\n assert candidate(k = 11) == 2\n assert candidate(k = 41) == 5\n assert candidate(k = 100000) == -1\n assert candidate(k = 19) == 18\n assert candidate(k = 47) == 46\n assert candidate(k = 5) == -1\n assert candidate(k = 77777) == 30\n assert candidate(k = 234567) == 38412\n assert candidate(k = 4567) == 4566\n assert candidate(k = 24680) == -1\n assert candidate(k = 1234567) == 34020\n assert candidate(k = 1000001) == 12\n assert candidate(k = 999) == 27\n assert candidate(k = 99991) == 49995\n assert candidate(k = 199) == 99\n assert candidate(k = 100003) == 50001\n assert candidate(k = 789012) == -1\n assert candidate(k = 111111111) == 9\n assert candidate(k = 777777) == 42\n assert candidate(k = 827) == 413\n assert candidate(k = 81) == 81\n assert candidate(k = 131071) == 3855\n assert candidate(k = 7919) == 3959\n assert candidate(k = 34567) == 2658\n assert candidate(k = 99997) == 7866\n assert candidate(k = 54321) == 8568\n assert candidate(k = 12345) == -1\n assert candidate(k = 57) == 18\n assert candidate(k = 59999) == 29999\n assert candidate(k = 500001) == 249999\n assert candidate(k = 76543) == 25514\n assert candidate(k = 100001) == 10\n assert candidate(k = 700003) == 9459\n assert candidate(k = 13579) == 366\n assert candidate(k = 89753) == 89752\n assert candidate(k = 990001) == 495000\n assert candidate(k = 123) == 15\n assert candidate(k = 500003) == 214284\n assert candidate(k = 65537) == 65536\n assert candidate(k = 999999999) == 81\n assert candidate(k = 99998) == -1\n assert candidate(k = 89999) == 462\n assert candidate(k = 50003) == 6045\n assert candidate(k = 333) == 9\n assert candidate(k = 999983) == 999982\n assert candidate(k = 899999) == 10197\n assert candidate(k = 88889) == 14654\n assert candidate(k = 1001) == 6\n assert candidate(k = 89765) == -1\n assert candidate(k = 98765) == -1\n assert candidate(k = 313) == 312\n assert candidate(k = 987654) == -1\n assert candidate(k = 104729) == 52364\n assert candidate(k = 75321) == 37656\n assert candidate(k = 137) == 8\n assert candidate(k = 79999) == 13333\n assert candidate(k = 23456) == -1\n assert candidate(k = 987654321) == 116194320\n assert candidate(k = 11111) == 5\n assert candidate(k = 997) == 166\n assert candidate(k = 300007) == 100002\n"}, "metadata": {"canonical_parameter_names": ["k"], "leetcode_dataset_entry_point": "Solution().smallestRepunitDivByK", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var smallestRepunitDivByK = function(k) {", "container": null, "callable": "smallestRepunitDivByK", "parameters": [{"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1016, "task_id": "binary-string-with-substrings-representing-1-to-n", "difficulty": "Medium", "problem_description": "Given a binary string s and a positive integer n, return true if the binary representation of all the integers in the range [1, n] are substrings of s, or false otherwise.\nA substring is a contiguous sequence of characters within a string.\n \nExample 1:\nInput: s = \"0110\", n = 3\nOutput: true\nExample 2:\nInput: s = \"0110\", n = 4\nOutput: false\n\n \nConstraints:\n\n1 <= s.length <= 1000\ns[i] is either '0' or '1'.\n1 <= n <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"0110\",n = 3) == True\n assert candidate(s = \"1111111111\",n = 10) == False\n assert candidate(s = \"0000000000\",n = 1) == False\n assert candidate(s = \"0110\",n = 4) == False\n assert candidate(s = \"000000\",n = 1) == False\n assert candidate(s = \"101010\",n = 5) == False\n assert candidate(s = \"0000000000\",n = 2) == False\n assert candidate(s = \"110100101101001011010010110100101101001011010010110100101101001011010010110100101101001011010010110100101101001\",n = 200) == False\n assert candidate(s = \"1010101010101010101010101010101010101010101010101010\",n = 20) == False\n assert candidate(s = \"10010010010010010010\",n = 25) == False\n assert candidate(s = \"1111111111111111111111111111111111111111111111111111\",n = 1000) == False\n assert candidate(s = \"0101010101010101010101010101010101010101010101010101\",n = 64) == False\n assert candidate(s = \"111000111000111000111000\",n = 8) == False\n assert candidate(s = \"10100101001010010100101001\",n = 10) == False\n assert candidate(s = \"10110100101100101101\",n = 25) == False\n assert candidate(s = \"001001001001001001001001\",n = 9) == False\n assert candidate(s = \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",n = 20) == False\n assert candidate(s = \"101010101010101010101010101010101010101010101010101010101010\",n = 256) == False\n assert candidate(s = \"01010101010101010101\",n = 22) == False\n assert candidate(s = \"0101010101010101010101010101010101010101010101010101\",n = 50) == False\n assert candidate(s = \"1100101001110110100010101100101001110110100010101100\",n = 30) == False\n assert candidate(s = \"111000111000111000\",n = 12) == False\n assert candidate(s = \"01010101010101010101\",n = 15) == False\n assert candidate(s = \"10101010101010101010\",n = 64) == False\n assert candidate(s = \"111100001111000011110000\",n = 50) == False\n assert candidate(s = \"10100101001010010100101001010010100101001\",n = 40) == False\n assert candidate(s = \"11011011011011011011\",n = 25) == False\n assert candidate(s = \"01010101010101010101\",n = 31) == False\n assert candidate(s = \"1001001001001001001001001001001001001001001001001001\",n = 25) == False\n assert candidate(s = \"10101010101010101010101010101010\",n = 20) == False\n assert candidate(s = \"00000000000000000000\",n = 1) == False\n assert candidate(s = \"111000111000111000\",n = 15) == False\n assert candidate(s = \"1111000011110000111100001111000011110000111100001111\",n = 15) == False\n assert candidate(s = \"0101010101010101010101\",n = 7) == False\n assert candidate(s = \"1100111100001111111100000000111111111111000000000000\",n = 127) == False\n assert candidate(s = \"10101010101010101010\",n = 15) == False\n assert candidate(s = \"11001100110011001100\",n = 20) == False\n assert candidate(s = \"11001100110011001100110011001100\",n = 9) == False\n assert candidate(s = \"0000111100001111000011110000111100001111000011110000\",n = 15) == False\n assert candidate(s = \"111000011100001110000111000011100001110000111000011100001110000\",n = 150) == False\n assert candidate(s = \"1100110011001100110011001100110011001100110011001100110011001100\",n = 60) == False\n assert candidate(s = \"10010010010010010010\",n = 16) == False\n assert candidate(s = \"010101010101010101010101010101010101\",n = 30) == False\n assert candidate(s = \"10101010101010101010\",n = 5) == False\n assert candidate(s = \"10010010010010010010\",n = 8) == False\n assert candidate(s = \"01010101010101010101\",n = 5) == False\n assert candidate(s = \"11001100110011001100110011001100\",n = 25) == False\n assert candidate(s = \"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\",n = 30) == False\n assert candidate(s = \"1100110011001100110011001100110011001100110011001100\",n = 30) == False\n assert candidate(s = \"111000111000111000111000111000111000\",n = 32) == False\n assert candidate(s = \"00000000000000000000000000000000\",n = 8) == False\n assert candidate(s = \"1010101010101010101010101010101010101010101010101010101010101010101010101010\",n = 100) == False\n assert candidate(s = \"10101010101010101010101010101010101010101010101010\",n = 20) == False\n assert candidate(s = \"00000000000000000000\",n = 5) == False\n assert candidate(s = \"11111111111111111111\",n = 1000) == False\n assert candidate(s = \"00011111110000001110\",n = 100) == False\n assert candidate(s = \"11111111111111111111111111111111\",n = 255) == False\n assert candidate(s = \"00001111000011110000\",n = 25) == False\n assert candidate(s = \"101001010010100101001010010100101001010010100101001010010100101001010010100101001010010100101001010010100101001010010100101001010010100101001\",n = 175) == False\n assert candidate(s = \"1111000011110000111100001111000011110000\",n = 50) == False\n assert candidate(s = \"01101101101101101101101101101101\",n = 12) == False\n assert candidate(s = \"1000100010001000100010001000\",n = 35) == False\n assert candidate(s = \"00110011001100110011001100110011\",n = 100) == False\n assert candidate(s = \"11111111111111111111111111111111\",n = 100) == False\n assert candidate(s = \"11011011011011011011\",n = 150) == False\n assert candidate(s = \"0000000000000000000000000000000000000000000000000000\",n = 1) == False\n assert candidate(s = \"11011011011011011011\",n = 30) == False\n assert candidate(s = \"00110011001100110011\",n = 16) == False\n assert candidate(s = \"10000000000000000000\",n = 5) == False\n assert candidate(s = \"0001111000111100011110001111\",n = 16) == False\n assert candidate(s = \"11100011100011100011\",n = 7) == False\n assert candidate(s = \"10101010101010101010101010101010\",n = 50) == False\n assert candidate(s = \"10011001100110011001100110011001\",n = 18) == False\n assert candidate(s = \"10101010101010101010101010101010\",n = 100) == False\n assert candidate(s = \"111100001111000011110000\",n = 15) == False\n assert candidate(s = \"0100100100100100100100100100100100100100100100100100\",n = 200) == False\n assert candidate(s = \"1101110101001101010011010100110101001101010011010100\",n = 50) == False\n assert candidate(s = \"001001001001001001001001001001001001001\",n = 35) == False\n assert candidate(s = \"11001100110011001100\",n = 6) == False\n assert candidate(s = \"11110000111100001111\",n = 20) == False\n assert candidate(s = \"00101010100101010100101010100101010100101010100101010100101010100101010100101010100101010100101010100101010100101010100101010\",n = 125) == False\n assert candidate(s = \"00001111000011110000\",n = 50) == False\n assert candidate(s = \"11011011011011011011\",n = 10) == False\n assert candidate(s = \"00000000000000000000000000000000000000000000000000\",n = 5) == False\n assert candidate(s = \"01001001001001001001001001\",n = 20) == False\n assert candidate(s = \"11100001110000111000011100001110000111000011100001110000\",n = 100) == False\n assert candidate(s = \"00000000000000000000000000000000\",n = 1) == False\n assert candidate(s = \"01010101010101010101\",n = 30) == False\n assert candidate(s = \"1010101010101010101010101010101010101010101010101010\",n = 25) == False\n assert candidate(s = \"10101010101010101010\",n = 20) == False\n assert candidate(s = \"11110000111100001111\",n = 30) == False\n assert candidate(s = \"01010101010101010101010101010101010101010101010101010101010101010101010101010\",n = 75) == False\n assert candidate(s = \"0110011001100110011001100110011001100110011001100110\",n = 63) == False\n assert candidate(s = \"0011001100110011001100110011001100110011001100110011\",n = 128) == False\n assert candidate(s = \"11110000111100001111\",n = 125) == False\n assert candidate(s = \"1010101010101010101010101010101010101010101010101010101010101010\",n = 50) == False\n"}, "metadata": {"canonical_parameter_names": ["s", "n"], "leetcode_dataset_entry_point": "Solution().queryString", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var queryString = function(s, n) {", "container": null, "callable": "queryString", "parameters": [{"name": "s", "type": "string"}, {"name": "n", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1017, "task_id": "convert-to-base-2", "difficulty": "Medium", "problem_description": "Given an integer n, return a binary string representing its representation in base -2.\nNote that the returned string should not have leading zeros unless the string is \"0\".\n \nExample 1:\n\nInput: n = 2\nOutput: \"110\"\nExplantion: (-2)2 + (-2)1 = 2\n\nExample 2:\n\nInput: n = 3\nOutput: \"111\"\nExplantion: (-2)2 + (-2)1 + (-2)0 = 3\n\nExample 3:\n\nInput: n = 4\nOutput: \"100\"\nExplantion: (-2)2 = 4\n\n \nConstraints:\n\n0 <= n <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 3) == \"111\"\n assert candidate(n = 104730) == \"1101110100101101110\"\n assert candidate(n = 100) == \"110100100\"\n assert candidate(n = 1000) == \"10000111000\"\n assert candidate(n = 5) == \"101\"\n assert candidate(n = 4) == \"100\"\n assert candidate(n = 16) == \"10000\"\n assert candidate(n = 10000) == \"111101100010000\"\n assert candidate(n = 2) == \"110\"\n assert candidate(n = 1024) == \"10000000000\"\n assert candidate(n = 0) == \"0\"\n assert candidate(n = 8) == \"11000\"\n assert candidate(n = 1023) == \"10000000011\"\n assert candidate(n = 1000000000) == \"1001100111011111101111000000000\"\n assert candidate(n = 104729) == \"1101110100101101001\"\n assert candidate(n = 15) == \"10011\"\n assert candidate(n = 9) == \"11001\"\n assert candidate(n = 6) == \"11010\"\n assert candidate(n = 1) == \"1\"\n assert candidate(n = 7) == \"11011\"\n assert candidate(n = 10) == \"11110\"\n assert candidate(n = 999999992) == \"1001100111011111101111000001000\"\n assert candidate(n = 1099511627776) == \"10000000000000000000000000000000000000000\"\n assert candidate(n = 999999999) == \"1001100111011111101111000000011\"\n assert candidate(n = 999999996) == \"1001100111011111101111000001100\"\n assert candidate(n = 2147483647) == \"110000000000000000000000000000011\"\n assert candidate(n = 32767) == \"11000000000000011\"\n assert candidate(n = 511) == \"11000000011\"\n assert candidate(n = 536870912) == \"1100000000000000000000000000000\"\n assert candidate(n = 4294967295) == \"100000000000000000000000000000011\"\n assert candidate(n = 524288) == \"110000000000000000000\"\n assert candidate(n = 2047) == \"1100000000011\"\n assert candidate(n = 16383) == \"100000000000011\"\n assert candidate(n = 999999998) == \"1001100111011111101111000000010\"\n assert candidate(n = 134217728) == \"11000000000000000000000000000\"\n assert candidate(n = 1073741823) == \"1000000000000000000000000000011\"\n assert candidate(n = 800000000) == \"1110000111100110001100000000000\"\n assert candidate(n = 1073741824) == \"1000000000000000000000000000000\"\n assert candidate(n = 333333333) == \"10100001000100100011101010101\"\n assert candidate(n = 4095) == \"1000000000011\"\n assert candidate(n = 999999995) == \"1001100111011111101111000001111\"\n assert candidate(n = 999999994) == \"1001100111011111101111000001110\"\n assert candidate(n = 999999991) == \"1001100111011111101111000001011\"\n assert candidate(n = 1048576) == \"100000000000000000000\"\n assert candidate(n = 8192) == \"110000000000000\"\n assert candidate(n = 255) == \"100000011\"\n assert candidate(n = 8191) == \"110000000000011\"\n assert candidate(n = 65536) == \"10000000000000000\"\n assert candidate(n = 68719476736) == \"1000000000000000000000000000000000000\"\n assert candidate(n = 1099511627775) == \"10000000000000000000000000000000000000011\"\n assert candidate(n = 262144) == \"1000000000000000000\"\n assert candidate(n = 65535) == \"10000000000000011\"\n assert candidate(n = 131072) == \"1100000000000000000\"\n assert candidate(n = 127) == \"110000011\"\n assert candidate(n = 999999993) == \"1001100111011111101111000001001\"\n assert candidate(n = 987654321) == \"1001111001000111011100111110001\"\n assert candidate(n = 894752631) == \"1110101010101010010100010001011\"\n assert candidate(n = 897410135) == \"1001010100000101010010110101011\"\n assert candidate(n = 500000) == \"110001110000101100000\"\n assert candidate(n = 32768) == \"11000000000000000\"\n assert candidate(n = 999999997) == \"1001100111011111101111000001101\"\n assert candidate(n = 1048575) == \"100000000000000000011\"\n assert candidate(n = 500000000) == \"1100010110100101010010100000000\"\n assert candidate(n = 31) == \"1100011\"\n assert candidate(n = 1000000) == \"100110100011001000000\"\n assert candidate(n = 123456789) == \"11000101011001101110100010101\"\n assert candidate(n = 999999) == \"100110100011001000011\"\n assert candidate(n = 1099511627777) == \"10000000000000000000000000000000000000001\"\n assert candidate(n = 531441) == \"110000110110000110001\"\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().baseNeg2", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var baseNeg2 = function(n) {", "container": null, "callable": "baseNeg2", "parameters": [{"name": "n", "type": "number"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1018, "task_id": "binary-prefix-divisible-by-5", "difficulty": "Easy", "problem_description": "You are given a binary array nums (0-indexed).\nWe define xi as the number whose binary representation is the subarray nums[0..i] (from most-significant-bit to least-significant-bit).\n\nFor example, if nums = [1,0,1], then x0 = 1, x1 = 2, and x2 = 5.\n\nReturn an array of booleans answer where answer[i] is true if xi is divisible by 5.\n \nExample 1:\n\nInput: nums = [0,1,1]\nOutput: [true,false,false]\nExplanation: The input numbers in binary are 0, 01, 011; which are 0, 1, and 3 in base-10.\nOnly the first number is divisible by 5, so answer[0] is true.\n\nExample 2:\n\nInput: nums = [1,1,1]\nOutput: [false,false,false]\n\n \nConstraints:\n\n1 <= nums.length <= 105\nnums[i] is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1]) == [False]\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [True, False, False, True, True, False, False, True, True, False]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [False, False, False, True, False, False, False, True, False, False]\n assert candidate(nums = [1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0]) == [False, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False]\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [True, True, True, True, True, True, True, True, True, True]\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1]) == [False, False, False, False, True, False, False, False, False, False]\n assert candidate(nums = [1, 0, 1, 0, 1, 0]) == [False, False, True, True, False, False]\n assert candidate(nums = [1, 1, 1]) == [False, False, False]\n assert candidate(nums = [1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1]) == [False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False]\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [False, False, True, True, False, False, True, True, False, False]\n assert candidate(nums = [1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0]) == [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False]\n assert candidate(nums = [0, 0, 0, 0, 0]) == [True, True, True, True, True]\n assert candidate(nums = [0, 1, 1]) == [True, False, False]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False]\n assert candidate(nums = [1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1]) == [False, False, False, False, False, False, False, False, False, True, False, False, True, False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, True, False]\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False]\n assert candidate(nums = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1]) == [True, True, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, True, False, False, False, False]\n assert candidate(nums = [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0]) == [False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False]\n assert candidate(nums = [1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1]) == [False, False, True, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, True, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, True, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, True, False, False]\n assert candidate(nums = [0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1]) == [True, False, False, False, False, False, False, False, False, False, True, False, False, True, False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False]\n assert candidate(nums = [1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1]) == [False, False, False, False, False, False, False, False, False, False, False, True, True, False, False, True, False, False, True, True, False, False, False, False, False, False, False, False, False, False, False]\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]\n assert candidate(nums = [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0]) == [False, False, False, True, True, True, True, True, False, False, False, True, True, True, True, True, False, False, False, True, True, True, True, True, False, False, False, True, True, True]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False]\n assert candidate(nums = [1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1]) == [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]\n assert candidate(nums = [0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1]) == [True, True, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, True, True, True, True, False, False, False, False, False, False]\n assert candidate(nums = [1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1]) == [False, False, True, False, False, True, False, False, True, False, False, True, False, False, True, False, False, True, False, False, True, False, False, True, False, False, True, False, False, True]\n assert candidate(nums = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]) == [True, True, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, False]\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True]\n assert candidate(nums = [1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1]) == [False, False, False, False, False, False, False, False, False, True, True, False, False, True, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False]\n assert candidate(nums = [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0]) == [False, False, False, True, True, True, True, True, False, False, False, True, True, True, True, True, False, False, False, True, True, True, True, True, False, False, False, True, True, True, True]\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True]\n assert candidate(nums = [1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1]) == [False, False, False, False, False, False, True, True, True, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False]\n assert candidate(nums = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0]) == [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, True, False, False, False, False, False, False, False, False, False, False]\n assert candidate(nums = [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0]) == [False, False, False, False, False, False, False, False, True, True, True, True, False, False, False, False, False, False, False, False, True, True, True, True, False, False, False, False, False, False]\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]) == [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, True, False, False, False, False, False, False]\n assert candidate(nums = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]) == [True, True, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, True, False, False, False, False, False, False, False, False]\n assert candidate(nums = [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0]) == [False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False]\n assert candidate(nums = [0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0]) == [True, False, False, False, True, True, True, True, True, False, False, False, True, True, True, True, True, False, False, False, True, True, True, True, True, False, False, False, True, True, True]\n assert candidate(nums = [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False]\n assert candidate(nums = [1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1]) == [False, False, False, False, False, False, True, True, False, False, False, False, False, False, True, True, True, False, False, False, False, True, True, False, False, False, False, False, False, False]\n assert candidate(nums = [0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1]) == [True, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False]\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0]) == [False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, False, False]\n assert candidate(nums = [1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]) == [False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False]\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]) == [False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False]\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True]\n assert candidate(nums = [1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]) == [False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False]\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False]\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1]) == [False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False]\n assert candidate(nums = [1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1]) == [False, False, True, False, False, True, True, False, False, False, False, False, False, False, False, False, False, False, True, True, False, False, True, False, False, True, True, False, False, False, False]\n assert candidate(nums = [0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1]) == [True, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, True, False, False, False, False]\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True]\n assert candidate(nums = [1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1]) == [False, False, False, False, False, False, True, True, True, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False]\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0]) == [False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, False, False]\n assert candidate(nums = [0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0]) == [True, True, False, False, False, False, False, False, False, False, False, False, False, True, True, False, False, True, False, False, True, True, False, False, False, False, False, False, False, False, False, False, False, True, True, False, False, True, False, False, True, True, False, False, False, False, False, False, False, False, False, False, False, True, True, False, False, True, False, False, True, True, False, False, False, False, False, False, False, False, False, False, False, True, True, False, False, True, False, False, True, True, False, False, False, False, False]\n assert candidate(nums = [1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1]) == [False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False]\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True]\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False]\n assert candidate(nums = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1]) == [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, True, False, False, False, False, False]\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True]\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]\n assert candidate(nums = [0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0]) == [True, True, False, False, False, False, False, False, False, False, True, True, True, True, False, False, False, False, False, False, False, False, True, True, True, True, False, False, False, False]\n assert candidate(nums = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False, True, True, False, False]\n assert candidate(nums = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]) == [True, True, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, True, False, False, False]\n assert candidate(nums = [1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1]) == [False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, False, False, True, False, False, False, False]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False, False, True, False, False]\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().prefixesDivBy5", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var prefixesDivBy5 = function(nums) {", "container": null, "callable": "prefixesDivBy5", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "boolean[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1019, "task_id": "next-greater-node-in-linked-list", "difficulty": "Medium", "problem_description": "You are given the head of a linked list with n nodes.\nFor each node in the list, find the value of the next greater node. That is, for each node, find the value of the first node that is next to it and has a strictly larger value than it.\nReturn an integer array answer where answer[i] is the value of the next greater node of the ith node (1-indexed). If the ith node does not have a next greater node, set answer[i] = 0.\n \nExample 1:\n\n\nInput: head = [2,1,5]\nOutput: [5,5,0]\n\nExample 2:\n\n\nInput: head = [2,7,4,3,5]\nOutput: [7,0,5,5,0]\n\n \nConstraints:\n\nThe number of nodes in the list is n.\n1 <= n <= 104\n1 <= Node.val <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(head = list_node([5, 4, 3, 2, 1])) == [0, 0, 0, 0, 0]\n assert candidate(head = list_node([9, 7, 5, 3, 1])) == [0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5])) == [2, 3, 4, 5, 0]\n assert candidate(head = list_node([2, 7, 4, 3, 5])) == [7, 0, 5, 5, 0]\n assert candidate(head = list_node([1])) == [0]\n assert candidate(head = list_node([1, 7, 5, 1, 9, 2, 5, 1])) == [7, 9, 9, 9, 0, 5, 0, 0]\n assert candidate(head = list_node([1, 1, 1, 1, 1])) == [0, 0, 0, 0, 0]\n assert candidate(head = list_node([2, 1, 5])) == [5, 5, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 3, 2, 1, 2, 3, 4])) == [2, 3, 4, 0, 4, 3, 2, 3, 4, 0]\n assert candidate(head = list_node([1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10])) == [2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 0, 0, 0]\n assert candidate(head = list_node([1, 5, 2, 4, 3, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5])) == [5, 6, 4, 6, 6, 7, 8, 9, 10, 0, 2, 3, 4, 5, 0]\n assert candidate(head = list_node([9, 7, 5, 3, 1, 2, 4, 6, 8, 10])) == [10, 8, 6, 4, 2, 4, 6, 8, 10, 0]\n assert candidate(head = list_node([1000000000, 999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992, 999999991])) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([10, 1, 2, 5, 3, 9, 4, 6, 8, 7])) == [0, 2, 5, 9, 9, 0, 6, 8, 0, 0]\n assert candidate(head = list_node([2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1])) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2])) == [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([5, 1, 5, 1, 5, 1, 5, 1, 5, 1])) == [0, 5, 0, 5, 0, 5, 0, 5, 0, 0]\n assert candidate(head = list_node([1, 5, 4, 6, 2, 8, 7, 3, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) == [5, 6, 6, 8, 8, 9, 9, 9, 10, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0]\n assert candidate(head = list_node([20, 1, 19, 2, 18, 3, 17, 4, 16, 5, 15, 6, 14, 7, 13, 8, 12, 9, 11, 10])) == [0, 19, 0, 18, 0, 17, 0, 16, 0, 15, 0, 14, 0, 13, 0, 12, 0, 11, 0, 0]\n assert candidate(head = list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11])) == [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 0]\n assert candidate(head = list_node([100, 90, 80, 70, 60, 50, 40, 30, 20, 10])) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1])) == [3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 0, 0]\n assert candidate(head = list_node([1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 11, 12, 13, 14, 15])) == [10, 11, 9, 11, 8, 11, 7, 11, 6, 11, 12, 13, 14, 15, 0]\n assert candidate(head = list_node([1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21])) == [10, 11, 9, 11, 8, 11, 7, 11, 6, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0]\n assert candidate(head = list_node([1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8])) == [3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 2, 1, 4, 3, 2, 1, 5, 4, 3, 2, 1])) == [2, 3, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([5, 1, 4, 2, 6, 3, 8, 7, 9, 10, 1, 2, 3, 4])) == [6, 4, 6, 6, 8, 8, 9, 9, 10, 0, 2, 3, 4, 0]\n assert candidate(head = list_node([3, 2, 1, 5, 4, 6, 7, 8, 9, 1])) == [5, 5, 5, 6, 6, 7, 8, 9, 0, 0]\n assert candidate(head = list_node([10, 20, 30, 40, 50, 60, 70, 80, 90])) == [20, 30, 40, 50, 60, 70, 80, 90, 0]\n assert candidate(head = list_node([9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10])) == [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0]\n assert candidate(head = list_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 6, 6])) == [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([2, 3, 4, 5, 6, 7, 8, 9, 10])) == [3, 4, 5, 6, 7, 8, 9, 10, 0]\n assert candidate(head = list_node([20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 21])) == [21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 0]\n assert candidate(head = list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10])) == [0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0]\n assert candidate(head = list_node([1, 10, 2, 9, 3, 8, 4, 7, 5, 6])) == [10, 0, 9, 0, 8, 0, 7, 0, 6, 0]\n assert candidate(head = list_node([1, 1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10])) == [2, 2, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1])) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0]\n assert candidate(head = list_node([3, 7, 8, 4, 2, 10, 5, 9, 1])) == [7, 8, 10, 10, 10, 0, 9, 0, 0]\n assert candidate(head = list_node([15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1])) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3])) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1])) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) == [2, 3, 4, 5, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0]\n assert candidate(head = list_node([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4])) == [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0]\n assert candidate(head = list_node([1, 10, 1, 10, 1, 10, 1, 10])) == [10, 0, 10, 0, 10, 0, 10, 0]\n assert candidate(head = list_node([5, 6, 2, 5, 3, 4, 5, 1, 2, 3, 4, 5, 6, 1, 2, 3])) == [6, 0, 5, 6, 4, 5, 6, 2, 3, 4, 5, 6, 0, 2, 3, 0]\n assert candidate(head = list_node([1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11])) == [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 0]\n assert candidate(head = list_node([9, 8, 7, 6, 10, 5, 4, 3, 2, 1, 11, 12, 13, 14, 15])) == [10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 13, 14, 15, 0]\n assert candidate(head = list_node([5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2])) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6])) == [2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2])) == [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([5, 1, 4, 3, 2, 6, 1, 2, 4, 3, 5, 1, 2, 4, 3, 6, 1, 2, 4, 3])) == [6, 4, 6, 6, 6, 0, 2, 4, 5, 5, 6, 2, 4, 6, 6, 0, 2, 4, 0, 0]\n assert candidate(head = list_node([1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 11])) == [10, 11, 9, 11, 8, 11, 7, 11, 6, 11, 0]\n assert candidate(head = list_node([10, 1, 2, 3, 4, 5, 6, 7, 8, 9])) == [0, 2, 3, 4, 5, 6, 7, 8, 9, 0]\n assert candidate(head = list_node([5, 1, 4, 2, 3, 6, 8, 7, 10, 9, 12])) == [6, 4, 6, 3, 6, 8, 10, 10, 12, 12, 0]\n assert candidate(head = list_node([9, 7, 5, 3, 1, 0, 12, 8, 10])) == [12, 12, 12, 12, 12, 12, 0, 10, 0]\n assert candidate(head = list_node([1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4])) == [2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 5, 3, 4, 2, 6, 7, 8, 10, 9, 11])) == [5, 6, 4, 6, 6, 7, 8, 10, 11, 11, 0]\n assert candidate(head = list_node([3, 8, 6, 5, 9, 1, 2, 4])) == [8, 9, 9, 9, 0, 2, 4, 0]\n assert candidate(head = list_node([100, 50, 25, 10, 5, 1, 99, 49, 24, 9, 4, 2, 0])) == [0, 99, 99, 99, 99, 99, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([5, 8, 4, 7, 10, 3, 6, 2, 9, 1])) == [8, 10, 7, 10, 0, 6, 9, 9, 0, 0]\n assert candidate(head = list_node([2, 1, 5, 6, 2, 3, 1, 9, 8])) == [5, 5, 6, 9, 3, 9, 9, 0, 0]\n assert candidate(head = list_node([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 10])) == [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0]\n assert candidate(head = list_node([109, 108, 107, 106, 105, 104, 103, 102, 101, 100])) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 3, 4, 3, 4, 5, 6, 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10])) == [2, 3, 4, 5, 6, 4, 5, 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10, 8, 9, 10, 0]\n assert candidate(head = list_node([1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9])) == [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 0, 0]\n assert candidate(head = list_node([1, 3, 2, 4, 6, 5, 7, 9, 8, 10])) == [3, 4, 4, 6, 7, 7, 9, 10, 10, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1])) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5])) == [2, 3, 4, 5, 0, 2, 3, 4, 5, 0, 2, 3, 4, 5, 0, 2, 3, 4, 5, 0]\n assert candidate(head = list_node([1000000000, 999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992, 999999991])) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 3, 5, 7, 9, 8, 6, 4, 2, 1, 3, 5, 7, 9, 11, 13, 15, 17])) == [3, 5, 7, 9, 11, 9, 7, 5, 3, 3, 5, 7, 9, 11, 13, 15, 17, 0]\n assert candidate(head = list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 12])) == [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 0]\n assert candidate(head = list_node([1, 2, 1, 3, 2, 4, 3, 5, 4])) == [2, 3, 3, 4, 4, 5, 5, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 4, 3, 2, 1])) == [2, 3, 4, 5, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([5, 3, 1, 4, 2, 6, 7, 8, 10, 9, 11])) == [6, 4, 4, 6, 6, 7, 8, 10, 11, 11, 0]\n assert candidate(head = list_node([3, 2, 1, 5, 4, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5])) == [5, 5, 5, 6, 6, 7, 8, 9, 10, 0, 2, 3, 4, 5, 0]\n assert candidate(head = list_node([100, 101, 102, 103, 104, 105, 106, 107, 108, 109])) == [101, 102, 103, 104, 105, 106, 107, 108, 109, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 20, 19, 18, 17, 16])) == [2, 3, 4, 5, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([5, 8, 3, 7, 9, 1, 2, 4, 6])) == [8, 9, 7, 9, 0, 2, 4, 6, 0]\n assert candidate(head = list_node([9, 8, 7, 6, 5, 4, 3, 2, 1, 10])) == [10, 10, 10, 10, 10, 10, 10, 10, 10, 0]\n assert candidate(head = list_node([1, 3, 2, 4, 5, 3, 2, 1, 6, 7, 8, 9, 10])) == [3, 4, 4, 5, 6, 6, 6, 6, 7, 8, 9, 10, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0]\n assert candidate(head = list_node([5, 1, 4, 2, 8, 7, 6, 9, 10])) == [8, 4, 8, 8, 9, 9, 9, 10, 0]\n assert candidate(head = list_node([1, 2, 3, 2, 1, 2, 3, 2, 1])) == [2, 3, 0, 3, 2, 3, 0, 0, 0]\n assert candidate(head = list_node([1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10])) == [3, 5, 5, 7, 7, 9, 9, 11, 11, 0, 0]\n assert candidate(head = list_node([1, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 10, 7, 11, 8])) == [5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 0, 0]\n assert candidate(head = list_node([2, 1, 5, 4, 3, 6, 7, 8, 9, 10])) == [5, 5, 6, 6, 6, 7, 8, 9, 10, 0]\n assert candidate(head = list_node([6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 2, 2, 1])) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1])) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1])) == [0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([10, 22, 9, 33, 21, 50, 41, 60, 80])) == [22, 33, 33, 50, 50, 60, 60, 80, 0]\n assert candidate(head = list_node([1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 11, 20, 12, 19, 13, 18, 14, 17, 15, 16])) == [10, 11, 9, 11, 8, 11, 7, 11, 6, 11, 20, 0, 19, 0, 18, 0, 17, 0, 16, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 0]\n assert candidate(head = list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) == [0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0]\n assert candidate(head = list_node([1, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1])) == [2, 3, 0, 3, 3, 0, 3, 3, 0, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11])) == [2, 3, 4, 5, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([9, 7, 8, 5, 6, 4, 3, 2, 1])) == [0, 8, 0, 6, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1])) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 0, 0]\n assert candidate(head = list_node([5, 3, 2, 7, 6, 4, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) == [7, 7, 7, 8, 8, 8, 9, 10, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0]\n assert candidate(head = list_node([2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1])) == [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 0]\n assert candidate(head = list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9])) == [0, 0, 9, 8, 7, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7, 8, 9, 0]\n assert candidate(head = list_node([1, 3, 2, 5, 4, 6, 7, 8, 9, 10, 2])) == [3, 5, 5, 6, 6, 7, 8, 9, 10, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1])) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1])) == [2, 3, 4, 5, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1])) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11])) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([10, 5, 12, 9, 15, 3, 7, 11, 8])) == [12, 12, 15, 15, 0, 7, 11, 0, 0]\n assert candidate(head = list_node([1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9])) == [2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 0, 0]\n assert candidate(head = list_node([5, 1, 4, 2, 8, 7, 3, 6, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) == [8, 4, 8, 8, 9, 9, 6, 9, 10, 0, 3, 4, 5, 6, 7, 8, 9, 10, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0]\n assert candidate(head = list_node([20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1])) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(head = list_node([17, 15, 13, 11, 9, 7, 5, 3, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18])) == [18, 16, 14, 12, 10, 8, 6, 4, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0]\n assert candidate(head = list_node([1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2])) == [2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0]\n assert candidate(head = list_node([1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14])) == [3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 0, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5])) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 0, 2, 3, 4, 5, 0]\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0]\n"}, "metadata": {"canonical_parameter_names": ["head"], "leetcode_dataset_entry_point": "Solution().nextLargerNodes", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var nextLargerNodes = function(head) {", "container": null, "callable": "nextLargerNodes", "parameters": [{"name": "head", "type": "ListNode"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1020, "task_id": "number-of-enclaves", "difficulty": "Medium", "problem_description": "You are given an m x n binary matrix grid, where 0 represents a sea cell and 1 represents a land cell.\nA move consists of walking from one land cell to another adjacent (4-directionally) land cell or walking off the boundary of the grid.\nReturn the number of land cells in grid for which we cannot walk off the boundary of the grid in any number of moves.\n \nExample 1:\n\n\nInput: grid = [[0,0,0,0],[1,0,1,0],[0,1,1,0],[0,0,0,0]]\nOutput: 3\nExplanation: There are three 1s that are enclosed by 0s, and one 1 that is not enclosed because its on the boundary.\n\nExample 2:\n\n\nInput: grid = [[0,1,1,0],[0,0,1,0],[0,0,1,0],[0,0,0,0]]\nOutput: 0\nExplanation: All 1s are either on the boundary or can reach the boundary.\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m, n <= 500\ngrid[i][j] is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[0, 0, 0, 0], [1, 0, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]]) == 3\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]]) == 0\n assert candidate(grid = [[0, 1, 1, 0], [0, 0, 1, 0], [0, 0, 1, 0], [0, 0, 0, 0]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 8\n assert candidate(grid = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1], [0, 0, 0, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 0], [0, 0, 1, 0], [0, 1, 1, 0], [0, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[0, 1, 1, 1, 1, 1], [1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 1], [1, 1, 0, 0, 0, 1], [0, 1, 1, 1, 1, 0]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 20\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == 8\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 1, 1, 1, 0, 0, 1], [0, 1, 0, 1, 0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0]]) == 17\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 10\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0]]) == 10\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0], [1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0], [1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0]]) == 0\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0]]) == 7\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 32\n assert candidate(grid = [[1, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1]]) == 14\n assert candidate(grid = [[1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 1]]) == 9\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 36\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 17\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 17\n assert candidate(grid = [[1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 1, 1, 0, 0, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 0, 0, 1, 1, 0], [1, 0, 0, 0, 1, 0, 0, 0, 1]]) == 20\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 18\n assert candidate(grid = [[0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == 6\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]]) == 4\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1]]) == 4\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 55\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[1, 1, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 36\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 12\n assert candidate(grid = [[1, 1, 1, 0, 1, 0], [0, 0, 1, 1, 0, 0], [0, 1, 0, 1, 1, 0], [0, 1, 1, 1, 0, 0], [1, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 30\n assert candidate(grid = [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0]]) == 10\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 33\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 32\n assert candidate(grid = [[1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [0, 0, 0, 0, 0], [1, 0, 0, 0, 1], [1, 1, 0, 1, 1]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 1, 1, 1, 0], [0, 1, 0, 1, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 26\n assert candidate(grid = [[0, 1, 0, 1, 0, 1], [1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 0, 0], [1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1]]) == 5\n assert candidate(grid = [[0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 3\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 17\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 1, 1, 1, 1, 1, 1, 1, 0], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 1, 0, 1, 0]]) == 0\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 0, 0], [1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 0, 1, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1], [1, 0, 0, 1, 0, 0, 0, 1], [1, 1, 0, 0, 0, 1, 1, 1], [0, 1, 1, 1, 1, 1, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 0, 0, 1], [1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [0, 0, 1, 1, 0], [1, 1, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 4\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 24\n assert candidate(grid = [[1, 1, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 1], [0, 0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0], [1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 1, 1, 1]]) == 14\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 6\n assert candidate(grid = [[0, 1, 1, 1, 0, 0, 1, 1, 0], [1, 1, 0, 0, 1, 0, 0, 1, 1], [1, 1, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 9\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 10\n assert candidate(grid = [[0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0]]) == 11\n assert candidate(grid = [[0, 0, 0, 1, 1, 0, 0], [0, 1, 1, 1, 0, 1, 0], [1, 1, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 0, 0], [0, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 0, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 0, 1]]) == 8\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 25\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 1, 1, 1, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 36\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 0, 0, 1, 1], [0, 1, 0, 0, 1, 0, 0, 1], [0, 0, 0, 1, 1, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0, 1]]) == 9\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 21\n assert candidate(grid = [[1, 0, 1, 1, 1, 0, 1, 0, 1, 1], [0, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 7\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 32\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().numEnclaves", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numEnclaves = function(grid) {", "container": null, "callable": "numEnclaves", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1021, "task_id": "remove-outermost-parentheses", "difficulty": "Easy", "problem_description": "A valid parentheses string is either empty \"\", \"(\" + A + \")\", or A + B, where A and B are valid parentheses strings, and + represents string concatenation.\n\nFor example, \"\", \"()\", \"(())()\", and \"(()(()))\" are all valid parentheses strings.\n\nA valid parentheses string s is primitive if it is nonempty, and there does not exist a way to split it into s = A + B, with A and B nonempty valid parentheses strings.\nGiven a valid parentheses string s, consider its primitive decomposition: s = P1 + P2 + ... + Pk, where Pi are primitive valid parentheses strings.\nReturn s after removing the outermost parentheses of every primitive string in the primitive decomposition of s.\n \nExample 1:\n\nInput: s = \"(()())(())\"\nOutput: \"()()()\"\nExplanation: \nThe input string is \"(()())(())\", with primitive decomposition \"(()())\" + \"(())\".\nAfter removing outer parentheses of each part, this is \"()()\" + \"()\" = \"()()()\".\n\nExample 2:\n\nInput: s = \"(()())(())(()(()))\"\nOutput: \"()()()()(())\"\nExplanation: \nThe input string is \"(()())(())(()(()))\", with primitive decomposition \"(()())\" + \"(())\" + \"(()(()))\".\nAfter removing outer parentheses of each part, this is \"()()\" + \"()\" + \"()(())\" = \"()()()()(())\".\n\nExample 3:\n\nInput: s = \"()()\"\nOutput: \"\"\nExplanation: \nThe input string is \"()()\", with primitive decomposition \"()\" + \"()\".\nAfter removing outer parentheses of each part, this is \"\" + \"\" = \"\".\n\n \nConstraints:\n\n1 <= s.length <= 105\ns[i] is either '(' or ')'.\ns is a valid parentheses string.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"(()(()))()\") == \"()(())\"\n assert candidate(s = \"()\") == \"\"\n assert candidate(s = \"()(()())\") == \"()()\"\n assert candidate(s = \"(()())(())\") == \"()()()\"\n assert candidate(s = \"((()))\") == \"(())\"\n assert candidate(s = \"()()\") == \"\"\n assert candidate(s = \"\") == \"\"\n assert candidate(s = \"(())(())\") == \"()()\"\n assert candidate(s = \"(())\") == \"()\"\n assert candidate(s = \"((())())\") == \"(())()\"\n assert candidate(s = \"(()(()))(()(()))\") == \"()(())()(())\"\n assert candidate(s = \"(()())(())(()(()))\") == \"()()()()(())\"\n assert candidate(s = \"((()))()(())((()))\") == \"(())()(())\"\n assert candidate(s = \"((()))()(())\") == \"(())()\"\n assert candidate(s = \"()(())((()))()(())\") == \"()(())()\"\n assert candidate(s = \"(())(())(())(())\") == \"()()()()\"\n assert candidate(s = \"(()(()(()(()(())))))\") == \"()(()(()(()(()))))\"\n assert candidate(s = \"()(()())(())()()\") == \"()()()\"\n assert candidate(s = \"(())()((()))(())\") == \"()(())()\"\n assert candidate(s = \"(()())(()(()))(()(()))\") == \"()()()(())()(())\"\n assert candidate(s = \"(()())()(()())\") == \"()()()()\"\n assert candidate(s = \"()(()(()))\") == \"()(())\"\n assert candidate(s = \"(((()())))\") == \"((()()))\"\n assert candidate(s = \"((())()(()))\") == \"(())()(())\"\n assert candidate(s = \"(((((())))))\") == \"((((()))))\"\n assert candidate(s = \"((())((())))\") == \"(())((()))\"\n assert candidate(s = \"(()()())\") == \"()()()\"\n assert candidate(s = \"((((())())()))\") == \"(((())())())\"\n assert candidate(s = \"((())(()))((()))\") == \"(())(())(())\"\n assert candidate(s = \"((()()(())))\") == \"(()()(()))\"\n assert candidate(s = \"(()())(()())(()())\") == \"()()()()()()\"\n assert candidate(s = \"((()))(())((()))\") == \"(())()(())\"\n assert candidate(s = \"()(())((()()))\") == \"()(()())\"\n assert candidate(s = \"()(())(())(())\") == \"()()()\"\n assert candidate(s = \"()()()()()\") == \"\"\n assert candidate(s = \"()(()(()))()((()))\") == \"()(())(())\"\n assert candidate(s = \"((())())(()(()(())))\") == \"(())()()(()(()))\"\n assert candidate(s = \"(()(()(()(()))))\") == \"()(()(()(())))\"\n assert candidate(s = \"((()))(())(()())\") == \"(())()()()\"\n assert candidate(s = \"((()()()()))\") == \"(()()()())\"\n assert candidate(s = \"((()()))(()(()))\") == \"(()())()(())\"\n assert candidate(s = \"()(()(()))((()))\") == \"()(())(())\"\n assert candidate(s = \"(()(()))(()(()))()()\") == \"()(())()(())\"\n assert candidate(s = \"(((()))(()(()(()))))\") == \"((()))(()(()(())))\"\n assert candidate(s = \"((()))((())())(()())\") == \"(())(())()()()\"\n assert candidate(s = \"(((()))(()(())))\") == \"((()))(()(()))\"\n assert candidate(s = \"((()))((()))((()))\") == \"(())(())(())\"\n assert candidate(s = \"(())()((()))\") == \"()(())\"\n assert candidate(s = \"((()))(())()(()())\") == \"(())()()()\"\n assert candidate(s = \"(()(()(()(()(()())))))\") == \"()(()(()(()(()()))))\"\n assert candidate(s = \"((()))((()))\") == \"(())(())\"\n assert candidate(s = \"(()(()))()((())())\") == \"()(())(())()\"\n assert candidate(s = \"(()(()(()(()))))(()(()(())))\") == \"()(()(()(())))()(()(()))\"\n assert candidate(s = \"((()))(())(())\") == \"(())()()\"\n assert candidate(s = \"(((())()))((()))\") == \"((())())(())\"\n assert candidate(s = \"(((()))())((()))\") == \"((()))()(())\"\n assert candidate(s = \"()()()()\") == \"\"\n assert candidate(s = \"(()(()(()())))\") == \"()(()(()()))\"\n assert candidate(s = \"(()(()(())))\") == \"()(()(()))\"\n assert candidate(s = \"((())(()))(()(()))\") == \"(())(())()(())\"\n assert candidate(s = \"((())()())((()()))\") == \"(())()()(()())\"\n assert candidate(s = \"(())()(())(())()\") == \"()()()\"\n assert candidate(s = \"((()()))(()(()(()())))\") == \"(()())()(()(()()))\"\n assert candidate(s = \"((((()())))((())))\") == \"(((()())))((()))\"\n assert candidate(s = \"((()())(()))\") == \"(()())(())\"\n assert candidate(s = \"(()())(()(()))(()(()(())))\") == \"()()()(())()(()(()))\"\n assert candidate(s = \"((()))(()(()))((()))\") == \"(())()(())(())\"\n assert candidate(s = \"((()()))(())(()(()))\") == \"(()())()()(())\"\n assert candidate(s = \"()(()(()(()())))\") == \"()(()(()()))\"\n assert candidate(s = \"()()(((())))()\") == \"((()))\"\n assert candidate(s = \"(((())))\") == \"((()))\"\n assert candidate(s = \"(()((()))(())())\") == \"()((()))(())()\"\n assert candidate(s = \"(())(())(())\") == \"()()()\"\n assert candidate(s = \"(()((())))\") == \"()((()))\"\n assert candidate(s = \"((())(()(()())))((()))\") == \"(())(()(()()))(())\"\n assert candidate(s = \"((())())(())\") == \"(())()()\"\n assert candidate(s = \"()((()))()(())\") == \"(())()\"\n assert candidate(s = \"(()(()(()(()))))(()(()(()(()(()))))(()(()(()(()))))\") == \"()(()(()(())))()(()(()(()(()))))(()(()(()(()))))\"\n assert candidate(s = \"()(()(()(())))()\") == \"()(()(()))\"\n assert candidate(s = \"()((())(()))()()\") == \"(())(())\"\n assert candidate(s = \"((()()())())\") == \"(()()())()\"\n assert candidate(s = \"()(()(()))()(()())\") == \"()(())()()\"\n assert candidate(s = \"((()))(((()())))\") == \"(())((()()))\"\n assert candidate(s = \"((()))(()(()))\") == \"(())()(())\"\n assert candidate(s = \"()()()()()()()()\") == \"\"\n assert candidate(s = \"((())(()))\") == \"(())(())\"\n assert candidate(s = \"(()())((()))()\") == \"()()(())\"\n assert candidate(s = \"(())(()(()))()\") == \"()()(())\"\n assert candidate(s = \"((())())(()(()))\") == \"(())()()(())\"\n assert candidate(s = \"(()(()))(()(()))(()(()))\") == \"()(())()(())()(())\"\n assert candidate(s = \"(((()))(()))\") == \"((()))(())\"\n assert candidate(s = \"()()()()()()\") == \"\"\n assert candidate(s = \"(()(()())(()))\") == \"()(()())(())\"\n assert candidate(s = \"((()())(()()))\") == \"(()())(()())\"\n assert candidate(s = \"((()))(()(()))(()(()))\") == \"(())()(())()(())\"\n assert candidate(s = \"((()((()))))\") == \"(()((())))\"\n assert candidate(s = \"(((())))(((())))\") == \"((()))((()))\"\n assert candidate(s = \"((((()))))\") == \"(((())))\"\n assert candidate(s = \"(()(()))((())(()(()())))\") == \"()(())(())(()(()()))\"\n assert candidate(s = \"(()())(())(()(()))(()(()))\") == \"()()()()(())()(())\"\n assert candidate(s = \"((())())((()))\") == \"(())()(())\"\n assert candidate(s = \"()(()())(()(()))(()(()))\") == \"()()()(())()(())\"\n assert candidate(s = \"((()(()))(()))\") == \"(()(()))(())\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().removeOuterParentheses", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var removeOuterParentheses = function(s) {", "container": null, "callable": "removeOuterParentheses", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1022, "task_id": "sum-of-root-to-leaf-binary-numbers", "difficulty": "Easy", "problem_description": "You are given the root of a binary tree where each node has a value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant bit.\n\nFor example, if the path is 0 -> 1 -> 1 -> 0 -> 1, then this could represent 01101 in binary, which is 13.\n\nFor all leaves in the tree, consider the numbers represented by the path from the root to that leaf. Return the sum of these numbers.\nThe test cases are generated so that the answer fits in a 32-bits integer.\n \nExample 1:\n\n\nInput: root = [1,0,1,0,1,0,1]\nOutput: 22\nExplanation: (100) + (101) + (110) + (111) = 4 + 5 + 6 + 7 = 22\n\nExample 2:\n\nInput: root = [0]\nOutput: 0\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 1000].\nNode.val is 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 1, 0, 1, 0, 0, 1])) == 22\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0])) == 0\n assert candidate(root = tree_node([1, 1, 1])) == 6\n assert candidate(root = tree_node([0])) == 0\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1])) == 22\n assert candidate(root = tree_node([1, 1, 0, 0, 1, 0, 1])) == 22\n assert candidate(root = tree_node([1, 0, 0, 1, 0, 0, 1])) == 18\n assert candidate(root = tree_node([0, 0, 0])) == 0\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1])) == 28\n assert candidate(root = tree_node([1, 0, 1, 0, 0, 1, 0])) == 21\n assert candidate(root = tree_node([1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1])) == 73\n assert candidate(root = tree_node([1, 0, 0, 1, 0, 0, 1, 0, 1])) == 34\n assert candidate(root = tree_node([0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 28\n assert candidate(root = tree_node([1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1])) == 92\n assert candidate(root = tree_node([1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1])) == 1592\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 0\n assert candidate(root = tree_node([0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1])) == 44\n assert candidate(root = tree_node([1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0])) == 260\n assert candidate(root = tree_node([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])) == 28\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 1520\n assert candidate(root = tree_node([0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0])) == 41\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 247\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])) == 392\n assert candidate(root = tree_node([1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])) == 551\n assert candidate(root = tree_node([1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 312\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 1826\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 376\n assert candidate(root = tree_node([1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1])) == 2978\n assert candidate(root = tree_node([1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0])) == 440\n assert candidate(root = tree_node([1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1])) == 2102\n assert candidate(root = tree_node([1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1])) == 1488\n assert candidate(root = tree_node([1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1])) == 390\n assert candidate(root = tree_node([1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1])) == 108\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 496\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 590\n assert candidate(root = tree_node([1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])) == 108\n assert candidate(root = tree_node([1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0])) == 104\n assert candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 512\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 1161\n assert candidate(root = tree_node([1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0])) == 310\n assert candidate(root = tree_node([0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1])) == 102\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 92\n assert candidate(root = tree_node([1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])) == 876\n assert candidate(root = tree_node([1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1])) == 92\n assert candidate(root = tree_node([1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0])) == 169\n assert candidate(root = tree_node([1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1])) == 109\n assert candidate(root = tree_node([1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1])) == 313\n assert candidate(root = tree_node([0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1])) == 29\n assert candidate(root = tree_node([1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1])) == 301\n assert candidate(root = tree_node([1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1])) == 477\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 176\n assert candidate(root = tree_node([1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])) == 372\n assert candidate(root = tree_node([0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1])) == 181\n assert candidate(root = tree_node([1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0])) == 376\n assert candidate(root = tree_node([1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0])) == 304\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 1003\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 782\n assert candidate(root = tree_node([0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1])) == 32\n assert candidate(root = tree_node([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 136\n assert candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 272\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 355\n assert candidate(root = tree_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 256\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 120\n assert candidate(root = tree_node([1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 715\n assert candidate(root = tree_node([1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1])) == 299\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 1098\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 715\n assert candidate(root = tree_node([1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1])) == 1786\n assert candidate(root = tree_node([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 117\n assert candidate(root = tree_node([0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1])) == 128\n assert candidate(root = tree_node([1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 535\n assert candidate(root = tree_node([1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1])) == 400\n assert candidate(root = tree_node([0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0])) == 194\n assert candidate(root = tree_node([1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0])) == 104\n assert candidate(root = tree_node([1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0])) == 249\n assert candidate(root = tree_node([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])) == 120\n assert candidate(root = tree_node([1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1])) == 594\n assert candidate(root = tree_node([1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 336\n assert candidate(root = tree_node([1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 1383\n assert candidate(root = tree_node([1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1])) == 656\n assert candidate(root = tree_node([1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])) == 88\n assert candidate(root = tree_node([1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1])) == 108\n assert candidate(root = tree_node([1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1])) == 2214\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 1162\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 528\n assert candidate(root = tree_node([1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0])) == 92\n assert candidate(root = tree_node([1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1])) == 1378\n assert candidate(root = tree_node([1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 108\n assert candidate(root = tree_node([1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0])) == 430\n assert candidate(root = tree_node([1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1])) == 809\n assert candidate(root = tree_node([1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 307\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 0\n assert candidate(root = tree_node([1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1])) == 399\n assert candidate(root = tree_node([1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1])) == 1375\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 0\n assert candidate(root = tree_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 1426\n assert candidate(root = tree_node([1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0])) == 400\n assert candidate(root = tree_node([1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0])) == 80\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().sumRootToLeaf", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sumRootToLeaf = function(root) {", "container": null, "callable": "sumRootToLeaf", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1023, "task_id": "camelcase-matching", "difficulty": "Medium", "problem_description": "Given an array of strings queries and a string pattern, return a boolean array answer where answer[i] is true if queries[i] matches pattern, and false otherwise.\nA query word queries[i] matches pattern if you can insert lowercase English letters into the pattern so that it equals the query. You may insert a character at any position in pattern or you may choose not to insert any characters at all.\n \nExample 1:\n\nInput: queries = [\"FooBar\",\"FooBarTest\",\"FootBall\",\"FrameBuffer\",\"ForceFeedBack\"], pattern = \"FB\"\nOutput: [true,false,true,true,false]\nExplanation: \"FooBar\" can be generated like this \"F\" + \"oo\" + \"B\" + \"ar\".\n\"FootBall\" can be generated like this \"F\" + \"oot\" + \"B\" + \"all\".\n\"FrameBuffer\" can be generated like this \"F\" + \"rame\" + \"B\" + \"uffer\".\n\nExample 2:\n\nInput: queries = [\"FooBar\",\"FooBarTest\",\"FootBall\",\"FrameBuffer\",\"ForceFeedBack\"], pattern = \"FoBa\"\nOutput: [true,false,true,false,false]\nExplanation: \"FooBar\" can be generated like this \"Fo\" + \"o\" + \"Ba\" + \"r\".\n\"FootBall\" can be generated like this \"Fo\" + \"ot\" + \"Ba\" + \"ll\".\n\nExample 3:\n\nInput: queries = [\"FooBar\",\"FooBarTest\",\"FootBall\",\"FrameBuffer\",\"ForceFeedBack\"], pattern = \"FoBaT\"\nOutput: [false,true,false,false,false]\nExplanation: \"FooBarTest\" can be generated like this \"Fo\" + \"o\" + \"Ba\" + \"r\" + \"T\" + \"est\".\n\n \nConstraints:\n\n1 <= pattern.length, queries.length <= 100\n1 <= queries[i].length <= 100\nqueries[i] and pattern consist of English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(queries = ['FooBar', 'FooBarTest', 'FootBall', 'FrameBuffer', 'ForceFeedBack'],pattern = \"FB\") == [True, False, True, True, False]\n assert candidate(queries = ['FooBar', 'FooBarTest', 'FootBall', 'FrameBuffer', 'ForceFeedBack'],pattern = \"FoBa\") == [True, False, True, False, False]\n assert candidate(queries = ['FooBar', 'FooBarTest', 'FootBall', 'FrameBuffer', 'ForceFeedBack'],pattern = \"FoBaT\") == [False, True, False, False, False]\n assert candidate(queries = ['Interleaving', 'InTerLeaVing', 'InterLeaving', 'InterLEAVING'],pattern = \"InLeV\") == [False, False, False, False]\n assert candidate(queries = ['MixedCASE', 'MxCs', 'MxCASE', 'MixCsE', 'MxCsECASE'],pattern = \"MxCsE\") == [False, False, False, True, False]\n assert candidate(queries = ['AaAaAaAaAa', 'aAaAaAaAa', 'AaAaAaA', 'AaAa', 'Aa'],pattern = \"Aa\") == [False, False, False, False, True]\n assert candidate(queries = ['samePattern', 'samePatternEverywhere', 'same', 'pattern'],pattern = \"sP\") == [True, False, False, False]\n assert candidate(queries = ['ComplexPattern', 'CompPat', 'ComplexPatt', 'ComplPtn', 'CompPattn'],pattern = \"CompPtn\") == [True, False, False, True, True]\n assert candidate(queries = ['SoftwareEngineering', 'softwareENGINEERING', 'SoftWaReEnGiNeErInG', 'SOFTWAREENGINEERING'],pattern = \"SWE\") == [False, False, False, False]\n assert candidate(queries = ['PatternMatching', 'Pattern', 'Pat', 'PatMatch', 'PatternMatchInString'],pattern = \"Pat\") == [False, True, True, False, False]\n assert candidate(queries = ['testCase', 'testCase1', 'testCase2', 'testCase3', 'testCase4'],pattern = \"testCase\") == [True, False, False, False, False]\n assert candidate(queries = ['xYzAbCdEfG', 'xYzAbCdEfGhI', 'xYzAbCd', 'xYzAbCdEfGhIjK', 'xYzAbCdEfGhIjKlM'],pattern = \"xYzAbCd\") == [False, False, True, False, False]\n assert candidate(queries = ['ComplexPattern', 'ComplexPatternQuery', 'ComplexPatternMatch', 'ComplexPatternMismatch', 'ComplexPatternCase'],pattern = \"CPM\") == [False, False, True, True, False]\n assert candidate(queries = ['ComplexPatternMatching', 'ComplexPattern', 'ComplexMatch', 'PatternMatching', 'PatternMatch'],pattern = \"CPM\") == [True, False, False, False, False]\n assert candidate(queries = ['Java', 'JavaScript', 'JavaS', 'JavaScr', 'JavaScriptAndMore'],pattern = \"JS\") == [False, True, True, True, False]\n assert candidate(queries = ['TestCase1', 'TestCase2', 'TestCase3', 'testCase4', 'testCase5', 'testCase6'],pattern = \"TestCase\") == [False, False, False, False, False, False]\n assert candidate(queries = ['CamelCase', 'CamelCasePattern', 'Camel', 'Case'],pattern = \"CCP\") == [False, True, False, False]\n assert candidate(queries = ['MultipleUpperCaseLetters', 'MultipleLowerCaseLetters', 'MixOfUpperAndLowerCase', 'OnlyUpperCase', 'OnlyLowerCase'],pattern = \"MUCL\") == [True, False, False, False, False]\n assert candidate(queries = ['LongPatternMatchingExample', 'LongPattern', 'Long', 'LongPatternExample', 'LongPatternMatchingExampleInPython'],pattern = \"Long\") == [False, False, True, False, False]\n assert candidate(queries = ['CamelHump', 'CamelHumpQuery', 'CamelHouse', 'CamelHousekeeping', 'CamelHorseRace'],pattern = \"CH\") == [True, False, True, True, False]\n assert candidate(queries = ['EdgeCase', 'EdgeCaseQuery', 'EdgeCaseMatch', 'EdgeCaseMismatch', 'EdgeCaseCase'],pattern = \"ECMc\") == [False, False, True, True, False]\n assert candidate(queries = ['ABcDeFgHiJkLmNoPqRsTuVwXyZ', 'abcdefgHIJKLmnopQRstUVwxYZ', 'AbCdEfGhIjKlMnOpQrStUvWxYz'],pattern = \"AbCdEfG\") == [False, False, False]\n assert candidate(queries = ['MixedCasePattern', 'Mixed', 'Case', 'Pattern', 'MixedPatternCase'],pattern = \"Mix\") == [False, True, False, False, False]\n assert candidate(queries = ['ExamplePattern', 'Ex', 'ExPat', 'Example', 'PatternExample'],pattern = \"Ex\") == [False, True, False, True, False]\n assert candidate(queries = ['DeepLearning', 'deepLEARNING', 'DeEpLeArNiNg', 'DEEPLEARNING'],pattern = \"DL\") == [True, False, False, False]\n assert candidate(queries = ['veryComplexPattern', 'veryComplexPat', 'veryComp', 'very'],pattern = \"vCP\") == [True, True, False, False]\n assert candidate(queries = ['LeetCode', 'Leet_Code', 'Leet_Co_Dee', 'L_C_D', 'L_C_D_E_T'],pattern = \"LCDE\") == [False, False, False, False, False]\n assert candidate(queries = ['ComplexPatternMatching', 'Complex', 'Pat', 'ComplexPat', 'PatternComplex'],pattern = \"Com\") == [False, True, False, False, False]\n assert candidate(queries = ['aAaAaAaA', 'AAAAAAAA', 'aAaAaAa', 'AaAaAaAaAaAaAaAa', 'aAaAaAaAaAaAaAaAa', 'AaAaAaAaAaAaAaAaAaAa', 'AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa'],pattern = \"aAaAaAaA\") == [True, False, False, False, False, False, False]\n assert candidate(queries = ['CamelCase', 'camelCase', 'Camelcase', 'camelCASE'],pattern = \"Camel\") == [False, False, True, False]\n assert candidate(queries = ['CamelCaseExample', 'CamelCase', 'CamelExample', 'ExampleCamel', 'Camel'],pattern = \"CamEx\") == [False, False, True, False, False]\n assert candidate(queries = ['CamelCase', 'Camel', 'CamelCasePattern', 'CamelPattern', 'PatternCamel'],pattern = \"Cam\") == [False, True, False, False, False]\n assert candidate(queries = ['Match', 'MaTch', 'MatCh', 'MatcH', 'MatchiNg'],pattern = \"Match\") == [True, False, False, False, False]\n assert candidate(queries = ['aAbBcC', 'aabbcc', 'aaBbCc', 'aAaBbCc', 'aAbbcC'],pattern = \"abc\") == [False, True, False, False, False]\n assert candidate(queries = ['testCase', 'TestCase', 'testCase1', 'testCase2', 'testCase3'],pattern = \"tc\") == [False, False, False, False, False]\n assert candidate(queries = ['VariableLength', 'VarLen', 'VarLenPattern', 'VL', 'VariablePatLen'],pattern = \"VarPatLen\") == [False, False, False, False, True]\n assert candidate(queries = ['lowerCasePattern', 'lowercasepattern', 'LOWERCASEPATTERN', 'lowerCASE'],pattern = \"lCP\") == [True, False, False, False]\n assert candidate(queries = ['Python', 'PythoN', 'PythOn', 'PyThOn', 'PYTHOn', 'PYTHOnS'],pattern = \"PyTh\") == [False, False, False, False, False, False]\n assert candidate(queries = ['aAbBcCdDeEfF', 'aabbccddeeff', 'Aabbccddeeff', 'aAbbccddeeff'],pattern = \"aBcDeF\") == [False, False, False, False]\n assert candidate(queries = ['Programming', 'PrograMMing', 'PROGRAMMING', 'programming'],pattern = \"PrM\") == [False, False, False, False]\n assert candidate(queries = ['helloWorld', 'HELLOworld', 'hElLoWoRlD', 'HeLLoWoRLd', 'HELLOWORLD'],pattern = \"hELo\") == [False, False, False, False, False]\n assert candidate(queries = ['aAbB', 'aabb', 'AABB', 'aAaA'],pattern = \"aAbB\") == [True, False, False, False]\n assert candidate(queries = ['aAbBcCdDeE', 'aabbccddeeff', 'AaBbCcDdEeFf', 'AABBCCDDEEFF'],pattern = \"aBcDeF\") == [False, False, False, False]\n assert candidate(queries = ['DataScience', 'Data_Science', 'DaSc', 'DaTaSci', 'DaTaSceNiCe'],pattern = \"DaS\") == [True, False, True, False, False]\n assert candidate(queries = ['AlGoRiThM', 'algoRiThm', 'AlgorIthM', 'Algorithm'],pattern = \"AlGoRiThM\") == [True, False, False, False]\n assert candidate(queries = ['ThisIsJustARandomQuery', 'ThisIsJustAQuery', 'ThisIsARandomQuery', 'ThisJustARandomQuery', 'ThisIsJustARandomQ'],pattern = \"TIJARQ\") == [True, False, False, False, True]\n assert candidate(queries = ['ComplexPattern', 'ComplexPAttern', 'ComplexPattern1', 'ComplexPattern2', 'ComplexPattern3'],pattern = \"ComplexPat\") == [True, False, False, False, False]\n assert candidate(queries = ['QuantumComputing', 'quantumCOMPUTING', 'QuAnTuMCoMpUtInG', 'QUANTUMCOMPUTING'],pattern = \"QC\") == [True, False, False, False]\n assert candidate(queries = ['ComplexPattern', 'complexPattern', 'ComplexPATTERN', 'complexpATTERN', 'ComplexpAtTeRn'],pattern = \"CP\") == [True, False, False, False, False]\n assert candidate(queries = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],pattern = \"a\") == [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]\n assert candidate(queries = ['aBcDeFgHiJ', 'aBcDeFgHiJkLmNoPqR', 'aBcDeFgHiJkL', 'aBcDeFgHiJkLmNoP', 'aBcDeFgHiJkLmNoPqRsTuVwXyZ'],pattern = \"aBcDeFgHiJ\") == [True, False, False, False, False]\n assert candidate(queries = ['EdgeCase', 'EdgeCaseQuery', 'EdgeCaseMatch', 'EdgeCaseMismatch', 'EdgeCaseCase'],pattern = \"ECq\") == [False, False, False, False, False]\n assert candidate(queries = ['EdgeCase', 'EdgeCaseQuery', 'EdgeCaseMatch', 'EdgeCaseMismatch', 'EdgeCaseCase'],pattern = \"ECM\") == [False, False, True, True, False]\n assert candidate(queries = ['Pattern', 'Pattern1', 'Pattern2', 'Pattern3', 'Pattern4'],pattern = \"Pattern\") == [True, False, False, False, False]\n assert candidate(queries = ['ArtificialIntelligence', 'artificialINTELLIGENCE', 'ArTiFiCiAlInTeLlIgEnCe', 'ARTIFICIALINTELLIGENCE'],pattern = \"AI\") == [True, False, False, False]\n assert candidate(queries = ['ComplexPattern', 'ComplexPatternQuery', 'ComplexPatternMatch', 'ComplexPatternMismatch', 'ComplexPatternCase'],pattern = \"CPMc\") == [False, False, True, True, False]\n assert candidate(queries = ['camelMatch', 'CamelMatch', 'camelMATCH', 'CamelMATCH', 'camelMatchTEST'],pattern = \"CMt\") == [False, True, False, False, False]\n assert candidate(queries = ['MiXeDcAsE', 'MiXeDcAsEc', 'MiXeDcAsEcc', 'MiXeDcAsEcce', 'MiXeDcAsEcces', 'MiXeDcAsEccese'],pattern = \"MiXeDcAsEcces\") == [False, False, False, False, True, True]\n assert candidate(queries = ['upperCASE', 'UpperCASE', 'upperCase', 'UPPERcase', 'uPPERCase'],pattern = \"uPR\") == [False, False, False, False, False]\n assert candidate(queries = ['AbCdEfGh', 'AbCdEfGhIj', 'AbCdEfGhIjKl', 'AbCdEfGhIjKlMn'],pattern = \"ACEGIK\") == [False, False, True, False]\n assert candidate(queries = ['SubsequenceMatching', 'SubseqMatch', 'SubSeqMatch', 'SbqMtch', 'SubsqMtch'],pattern = \"SbqMtch\") == [True, True, False, True, True]\n assert candidate(queries = ['TestPattern', 'TestPatternQuery', 'TestPatternMatch', 'TestPatternMismatch', 'TestPatternCase'],pattern = \"TPq\") == [False, False, False, False, False]\n assert candidate(queries = ['xYzXyZ', 'xyzyxzyx', 'XYXYXY', 'xyXyXy'],pattern = \"XyZ\") == [False, False, False, False]\n assert candidate(queries = ['multipleUpperCases', 'multipleUPPERCASES', 'MULTIPLEUPPERCASES', 'multipleUPPER'],pattern = \"mUC\") == [True, False, False, False]\n assert candidate(queries = ['CamelMatch', 'camelMatch', 'CaMeLmAtCh', 'CAMELMATCH', 'camelMATCH'],pattern = \"CaM\") == [True, False, False, False, False]\n assert candidate(queries = ['PatternMatching', 'PatternMATching', 'PatternMATCHing', 'PatternMATCHINg'],pattern = \"PatternMATCHINg\") == [False, False, False, True]\n assert candidate(queries = ['ComplexPattern', 'ComplexPatternQuery', 'ComplexPatternMatch', 'ComplexPatternMismatch', 'ComplexPatternCase'],pattern = \"CPq\") == [False, False, False, False, False]\n assert candidate(queries = ['XyZ', 'XYZabc', 'xYzAbC', 'xyZabc', 'XyZABC'],pattern = \"XyZ\") == [True, False, False, False, False]\n assert candidate(queries = ['MachineLearning', 'machineLEARNING', 'MaChInELeArNiNg', 'MACHINELEARNING'],pattern = \"ML\") == [True, False, False, False]\n assert candidate(queries = ['aBcDeFgHiJ', 'aBcDeFgHiJkL', 'aBcDeFgHiJkLmN', 'aBcDeFgHiJkLmNoP', 'aBcDeFgHiJkLmNoPqR'],pattern = \"aBcFj\") == [False, False, False, False, False]\n assert candidate(queries = ['SamePatternSamePattern', 'SamePattern', 'Pattern', 'Same', ''],pattern = \"SPSP\") == [True, False, False, False, False]\n assert candidate(queries = ['CamelCasePatternMatching', 'camelCasePatternMatching', 'CamelCasePattern', 'CamelCasePatternMatch', 'CamelCasePatt'],pattern = \"CCPM\") == [True, False, False, True, False]\n assert candidate(queries = ['AbCdEfG', 'AbcDeFG', 'AbCDefg', 'AbcDefgHiJk', 'AbCdEfGhIjk'],pattern = \"ACEG\") == [True, False, False, False, False]\n assert candidate(queries = ['TestPattern', 'TestPatternQuery', 'TestPatternMatch', 'TestPatternMismatch', 'TestPatternCase'],pattern = \"TPM\") == [False, False, True, True, False]\n assert candidate(queries = ['CamelCase', 'camelCase', 'CamelCASE', 'CAMELcase'],pattern = \"CaC\") == [True, False, False, False]\n assert candidate(queries = ['aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ', 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'aBcDeFgHiJkLmNoPqRsTuVwXyZ', 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'],pattern = \"aBcEfHjLpTz\") == [False, False, False, False, False]\n assert candidate(queries = ['OneTwoThreeFourFiveSixSevenEightNineTen', 'OneTwoThreeFourFiveSixSevenEightNine', 'OneTwoThreeFourFiveSixSevenEight', 'OneTwoThreeFourFiveSixSeven', 'OneTwoThreeFourFiveSix'],pattern = \"OTFSF\") == [False, False, False, False, False]\n assert candidate(queries = ['CamelCasePatternMatching', 'camelCasePatternMatching', 'CAMELCASEPATTERNMATCHING', 'camelcasepatternmatching'],pattern = \"CamElCaSePaTtErNmAtChInG\") == [False, False, False, False]\n assert candidate(queries = ['aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ', 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyY'],pattern = \"aBcDeFgHiJkLmNoPqRsTuVwXyZ\") == [False, False]\n assert candidate(queries = ['AnotherExample', 'Another', 'An', 'AnotherExampleString', 'ExampleAnotherString'],pattern = \"An\") == [False, True, True, False, False]\n assert candidate(queries = ['TestCase', 'Test', 'TestCasePattern', 'TestPattern', 'PatternTest'],pattern = \"Tes\") == [False, True, False, False, False]\n assert candidate(queries = ['MachineLearning', 'ML', 'MaChine_Learning', 'MachLeaRning', 'MachineLearNiNg'],pattern = \"MLe\") == [True, False, False, False, False]\n assert candidate(queries = ['PatternMatching', 'PatternMatchingExample', 'PatMatch', 'PatMatchEx'],pattern = \"PM\") == [True, False, True, False]\n assert candidate(queries = ['abAB', 'abab', 'ABab', 'abABab', 'abABAB'],pattern = \"abAB\") == [True, False, False, True, False]\n assert candidate(queries = ['PatternMatchingIsFun', 'PatternMatching', 'PatternMatchingIs', 'PatternIsFun', 'PatternMatchingFun'],pattern = \"PMIF\") == [True, False, False, False, False]\n assert candidate(queries = ['AlGoRiThM', 'algoR', 'alGOrIthM', 'aLGOrIth', 'AlgOrIthM'],pattern = \"aGI\") == [False, False, False, False, False]\n assert candidate(queries = ['aBcDeFgHiJ', 'aBcDeFgHiJkL', 'aBcDeFgHiJkLmN', 'aBcDeFgHiJkLmNoP', 'aBcDeFgHiJkLmNoPqR'],pattern = \"aBcDFgHj\") == [False, False, False, False, False]\n assert candidate(queries = ['PaTtErN123', 'Pattern123', 'pAtTeRn123', 'PaTtErN', 'Pattern', 'pAtTeRn'],pattern = \"PaTtErN\") == [False, False, False, True, False, False]\n assert candidate(queries = ['aBCdEf', 'abcdef', 'abDef', 'aBcDE', 'aBcDeF', 'aBcDEf'],pattern = \"aBcEf\") == [False, False, False, False, False, False]\n assert candidate(queries = ['TestCasesWithDifferentLengths', 'TestCasesWithDifferentLength', 'TestCasesWithDifferent', 'TestCasesWith', 'TestCases'],pattern = \"TCWDL\") == [True, True, False, False, False]\n assert candidate(queries = ['Pattern', 'pattern', 'PatternMatch', 'PAtTERNmAtCH', 'PaTtErNmAtCh'],pattern = \"PaT\") == [False, False, False, False, False]\n assert candidate(queries = ['ComputerVision', 'computerVISION', 'CoMpUtErViSiOn', 'COMPUTERVISION'],pattern = \"CV\") == [True, False, False, False]\n assert candidate(queries = ['Xylophone', 'xylophone', 'XyLopHone', 'XyLoPhone', 'xyLoPhOnE'],pattern = \"XyLoPhOnE\") == [False, False, False, False, False]\n assert candidate(queries = ['CoMpLeXqUeRiEs', 'complexqueries', 'CoMpLeXqUeRiE', 'CoMpLeXqUeRiEz', 'CoMpLeXqUeRiEsZ', 'CoMpLeXqUeRiEsZz'],pattern = \"CoMpLeXqUeRiEs\") == [True, False, False, False, False, False]\n assert candidate(queries = ['CamelHump', 'CamelHumpQuery', 'CamelHouse', 'CamelHousekeeping', 'CamelHorseRace'],pattern = \"CHq\") == [False, False, False, False, False]\n assert candidate(queries = ['OpenAI', 'Open_Artificial_Intelligence', 'O_A_I', 'OpenA', 'OpenAIAI'],pattern = \"OAI\") == [True, False, False, False, False]\n assert candidate(queries = ['looongPattern', 'looongPattern', 'longPattern', 'lOnGPattern', 'LoNgPatTerN'],pattern = \"LoNgPat\") == [False, False, False, False, False]\n assert candidate(queries = ['Algorithm', 'AlgoRhythm', 'AlGoRiThM', 'ALGORITHM'],pattern = \"AlGM\") == [False, False, False, False]\n assert candidate(queries = ['TestString', 'TestingString', 'TeststrIng', 'TstStr', 'TestStrng'],pattern = \"TstStr\") == [True, True, False, True, True]\n assert candidate(queries = ['OneTwoThreeFour', 'OTFT', 'OneTwoF', 'OneTwoThrFor', 'OTFTF'],pattern = \"OTFT\") == [False, True, False, False, False]\n assert candidate(queries = ['qWeRtY', 'qwerty', 'QwErTy', 'QwErTyUiOp'],pattern = \"qWeRtY\") == [True, False, False, False]\n assert candidate(queries = ['TestPattern', 'TestPatternQuery', 'TestPatternMatch', 'TestPatternMismatch', 'TestPatternCase'],pattern = \"TPMc\") == [False, False, True, True, False]\n assert candidate(queries = ['NaturalLanguageProcessing', 'naturalLANGUAGEPROCESSING', 'NaTuRaLlAnGuAgEPrOcEsSiNg', 'NATURALLANGUAGEPROCESSING'],pattern = \"NLP\") == [True, False, False, False]\n assert candidate(queries = ['MIXEDcase', 'MiXEDcase', 'MiXeDCase', 'MIXeDCase', 'MiXEdCASE'],pattern = \"MXc\") == [False, False, False, False, False]\n assert candidate(queries = ['MiXeDcASe', 'MiXeDCase', 'MiXeD', 'MiX', 'MixeDCase'],pattern = \"MiX\") == [False, False, False, True, False]\n assert candidate(queries = ['aAaAaA', 'aaaaaa', 'Aaaaaa', 'aAaaaa', 'aaaaAa'],pattern = \"aAa\") == [False, False, False, True, True]\n assert candidate(queries = ['CamelHump', 'CamelHumpQuery', 'CamelHouse', 'CamelHousekeeping', 'CamelHorseRace'],pattern = \"CHH\") == [False, False, False, False, False]\n assert candidate(queries = ['PatternMatching', 'PatMat', 'PatrnMtch', 'PatternMtching', 'PatMatch'],pattern = \"PtnMtch\") == [True, False, True, True, False]\n assert candidate(queries = ['AlphabetPattern', 'Al', 'Alpha', 'Pattern', 'AlphabetPatternInString'],pattern = \"Al\") == [False, True, True, False, False]\n assert candidate(queries = ['lowercase', 'Lowercase', 'LOWERCASE', 'lowerCASE', 'lowERCASE'],pattern = \"lwr\") == [True, False, False, False, False]\n assert candidate(queries = ['aAbBcCdDeEfFgG', 'aBcDeFg', 'aBcD', 'aB', 'a'],pattern = \"aBcD\") == [False, False, True, False, False]\n assert candidate(queries = ['AlGoRiThM', 'algorithm', 'AlGoRiThMs', 'AlGoRiThMuS', 'algorithms', 'AlGoRiThmSUs', 'AlGoRiThMuSiC'],pattern = \"AlGoRiThMuS\") == [False, False, False, True, False, False, False]\n assert candidate(queries = ['exampleQuery', 'ExampleQUERY', 'exampleQUERY', 'exampleQueryTest', 'exampleQueryTestTest'],pattern = \"eQ\") == [True, False, False, False, False]\n assert candidate(queries = ['DataStructure', 'dataStructure', 'DataSTRUCTURE', 'DATAstructure'],pattern = \"DtS\") == [True, False, False, False]\n"}, "metadata": {"canonical_parameter_names": ["queries", "pattern"], "leetcode_dataset_entry_point": "Solution().camelMatch", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var camelMatch = function(queries, pattern) {", "container": null, "callable": "camelMatch", "parameters": [{"name": "queries", "type": "string[]"}, {"name": "pattern", "type": "string"}], "return_type": "boolean[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1024, "task_id": "video-stitching", "difficulty": "Medium", "problem_description": "You are given a series of video clips from a sporting event that lasted time seconds. These video clips can be overlapping with each other and have varying lengths.\nEach video clip is described by an array clips where clips[i] = [starti, endi] indicates that the ith clip started at starti and ended at endi.\nWe can cut these clips into segments freely.\n\nFor example, a clip [0, 7] can be cut into segments [0, 1] + [1, 3] + [3, 7].\n\nReturn the minimum number of clips needed so that we can cut the clips into segments that cover the entire sporting event [0, time]. If the task is impossible, return -1.\n \nExample 1:\n\nInput: clips = [[0,2],[4,6],[8,10],[1,9],[1,5],[5,9]], time = 10\nOutput: 3\nExplanation: We take the clips [0,2], [8,10], [1,9]; a total of 3 clips.\nThen, we can reconstruct the sporting event as follows:\nWe cut [1,9] into segments [1,2] + [2,8] + [8,9].\nNow we have segments [0,2] + [2,8] + [8,10] which cover the sporting event [0, 10].\n\nExample 2:\n\nInput: clips = [[0,1],[1,2]], time = 5\nOutput: -1\nExplanation: We cannot cover [0,5] with only [0,1] and [1,2].\n\nExample 3:\n\nInput: clips = [[0,1],[6,8],[0,2],[5,6],[0,4],[0,3],[6,7],[1,3],[4,7],[1,4],[2,5],[2,6],[3,4],[4,5],[5,7],[6,9]], time = 9\nOutput: 3\nExplanation: We can take clips [0,4], [4,7], and [6,9].\n\n \nConstraints:\n\n1 <= clips.length <= 100\n0 <= starti <= endi <= 100\n1 <= time <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(clips = [[0, 5], [0, 7], [1, 3], [1, 4], [2, 5], [2, 6], [3, 4], [3, 5], [4, 5], [4, 6], [5, 6], [5, 7], [6, 7], [6, 8], [7, 8], [7, 10], [7, 9], [8, 10], [9, 10]],time = 10) == 2\n assert candidate(clips = [[0, 2], [4, 6], [8, 10], [1, 9], [1, 5], [5, 9]],time = 10) == 3\n assert candidate(clips = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]],time = 10) == 10\n assert candidate(clips = [[0, 10]],time = 10) == 1\n assert candidate(clips = [[0, 5], [0, 7], [0, 8], [1, 5], [2, 4], [4, 5], [5, 8], [5, 10], [6, 8], [7, 10], [8, 10], [9, 10]],time = 10) == 2\n assert candidate(clips = [[0, 1], [1, 3], [3, 4], [4, 6], [6, 7], [7, 9], [9, 10]],time = 10) == 7\n assert candidate(clips = [[0, 1], [1, 2]],time = 5) == -1\n assert candidate(clips = [[0, 0], [6, 8], [0, 4], [0, 7], [7, 9], [8, 10], [9, 10], [9, 12], [4, 5], [4, 4], [0, 3], [6, 7], [0, 6], [0, 6], [0, 2], [7, 10], [7, 9], [9, 10]],time = 9) == 2\n assert candidate(clips = [[0, 1], [6, 8], [0, 2], [5, 6], [0, 4], [0, 3], [6, 7], [1, 3], [4, 7], [1, 4], [2, 5], [2, 6], [3, 4], [4, 5], [5, 7], [6, 9]],time = 9) == 3\n assert candidate(clips = [[0, 5], [1, 5], [1, 6], [3, 4], [3, 5]],time = 5) == 1\n assert candidate(clips = [[0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 16], [15, 17], [16, 18], [17, 19], [18, 20], [19, 21], [20, 22], [21, 23], [22, 24], [23, 25], [24, 26], [25, 27], [26, 28], [27, 29], [28, 30]],time = 30) == 15\n assert candidate(clips = [[0, 20], [1, 19], [2, 18], [3, 17], [4, 16], [5, 15], [6, 14], [7, 13], [8, 12], [9, 11]],time = 20) == 1\n assert candidate(clips = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15]],time = 15) == 15\n assert candidate(clips = [[0, 50], [25, 75], [50, 100], [0, 25], [25, 50], [50, 75], [75, 100], [0, 100]],time = 100) == 1\n assert candidate(clips = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10]],time = 10) == 1\n assert candidate(clips = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19], [20, 21], [22, 23], [24, 25], [26, 27], [28, 29], [30, 31], [32, 33], [34, 35], [36, 37], [38, 39]],time = 39) == -1\n assert candidate(clips = [[0, 50], [50, 100], [100, 150], [150, 200], [200, 250], [250, 300], [300, 350], [350, 400], [400, 450], [450, 500]],time = 500) == 10\n assert candidate(clips = [[0, 5], [5, 10], [10, 15], [15, 20], [20, 25], [25, 30], [30, 35], [35, 40], [40, 45], [45, 50], [50, 55]],time = 55) == 11\n assert candidate(clips = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]],time = 10) == -1\n assert candidate(clips = [[0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 16], [15, 17], [16, 18], [17, 19], [18, 20], [19, 21], [20, 22]],time = 22) == 11\n assert candidate(clips = [[0, 2], [1, 5], [3, 7], [4, 9], [6, 11], [8, 13], [10, 15], [12, 17], [14, 19], [16, 21], [18, 23], [20, 25]],time = 25) == 7\n assert candidate(clips = [[0, 10], [2, 8], [3, 5], [4, 6], [6, 9], [8, 10], [1, 4], [5, 7]],time = 10) == 1\n assert candidate(clips = [[0, 10], [5, 20], [15, 30], [10, 25], [20, 35], [25, 40], [0, 5], [5, 15], [15, 25], [25, 35], [30, 40], [5, 10], [10, 15], [15, 20], [20, 25], [25, 30]],time = 40) == 3\n assert candidate(clips = [[0, 4], [4, 8], [8, 12], [12, 16], [16, 20], [20, 24], [24, 28], [28, 32], [0, 2], [2, 4], [4, 6], [6, 8], [8, 10], [10, 12], [12, 14], [14, 16], [16, 18], [18, 20], [20, 22], [22, 24], [24, 26], [26, 28], [28, 30]],time = 32) == 8\n assert candidate(clips = [[0, 50], [10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100]],time = 100) == 6\n assert candidate(clips = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19], [20, 21], [22, 23], [24, 25]],time = 25) == -1\n assert candidate(clips = [[0, 10], [10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100]],time = 50) == 5\n assert candidate(clips = [[0, 10], [1, 11], [2, 12], [3, 13], [4, 14], [5, 15], [6, 16], [7, 17], [8, 18], [9, 19]],time = 19) == 2\n assert candidate(clips = [[0, 10], [2, 20], [5, 30], [7, 25], [10, 40], [12, 50], [15, 35], [20, 60], [25, 45], [30, 70]],time = 60) == 3\n assert candidate(clips = [[0, 2], [2, 4], [4, 6], [6, 8], [8, 10], [10, 12], [12, 14], [14, 16], [16, 18], [18, 20]],time = 20) == 10\n assert candidate(clips = [[0, 100], [0, 50], [50, 75], [75, 100], [0, 25], [25, 50], [50, 75], [75, 100]],time = 100) == 1\n assert candidate(clips = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 6], [2, 7], [3, 8], [4, 9], [5, 10], [6, 11], [7, 12], [8, 13], [9, 14], [10, 15]],time = 15) == 3\n assert candidate(clips = [[0, 10], [5, 15], [10, 20], [15, 25], [20, 30], [25, 35], [30, 40], [35, 45], [40, 50], [45, 55]],time = 55) == 6\n assert candidate(clips = [[0, 15], [5, 20], [10, 25], [15, 30], [20, 35], [25, 40], [30, 45], [35, 50], [40, 55], [45, 60], [50, 65], [55, 70], [60, 75], [65, 80], [70, 85], [75, 90], [80, 95], [85, 100]],time = 100) == 7\n assert candidate(clips = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13]],time = 13) == 13\n assert candidate(clips = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]],time = 11) == -1\n assert candidate(clips = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [0, 10], [10, 20], [20, 30]],time = 30) == 3\n assert candidate(clips = [[0, 20], [5, 10], [10, 15], [15, 20], [2, 4], [4, 6], [6, 8], [8, 10], [12, 14], [14, 16], [16, 18], [18, 20]],time = 20) == 1\n assert candidate(clips = [[0, 5], [5, 10], [10, 15], [15, 20], [20, 25], [25, 30], [30, 35], [35, 40], [40, 45], [45, 50]],time = 49) == 10\n assert candidate(clips = [[0, 100], [0, 50], [50, 100], [25, 75], [75, 100], [50, 75], [25, 50]],time = 100) == 1\n assert candidate(clips = [[0, 50], [5, 15], [10, 20], [15, 25], [20, 30], [25, 35], [30, 35], [35, 40], [40, 45], [45, 50], [0, 10], [10, 20], [20, 30], [30, 40], [40, 50]],time = 50) == 1\n assert candidate(clips = [[5, 10], [10, 15], [0, 5], [15, 20], [20, 25], [0, 25], [25, 30], [0, 15], [15, 25], [0, 30]],time = 30) == 1\n assert candidate(clips = [[0, 50], [25, 75], [50, 100], [75, 125], [100, 150], [125, 175], [150, 200]],time = 200) == 4\n assert candidate(clips = [[0, 10], [5, 15], [10, 20], [15, 25], [20, 30], [25, 35], [30, 40], [35, 45], [40, 50]],time = 45) == 5\n assert candidate(clips = [[0, 10], [1, 11], [2, 12], [3, 13], [4, 14], [5, 15], [6, 16], [7, 17], [8, 18], [9, 19]],time = 20) == -1\n assert candidate(clips = [[0, 50], [10, 60], [20, 70], [30, 80], [40, 90], [50, 100], [60, 110], [70, 120], [80, 130], [90, 140]],time = 140) == 3\n assert candidate(clips = [[0, 1], [1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]],time = 20) == -1\n assert candidate(clips = [[0, 20], [5, 15], [10, 25], [0, 10], [15, 20], [20, 30]],time = 25) == 2\n assert candidate(clips = [[0, 5], [5, 10], [10, 15], [15, 20], [20, 25], [25, 30], [30, 35], [35, 40], [40, 45], [45, 50]],time = 50) == 10\n assert candidate(clips = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [0, 5], [5, 10], [10, 15], [15, 20]],time = 20) == 4\n assert candidate(clips = [[0, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11]],time = 11) == 10\n assert candidate(clips = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15]],time = 15) == 1\n assert candidate(clips = [[0, 10], [1, 9], [2, 8], [3, 7], [4, 6], [5, 5], [6, 4], [7, 3], [8, 2], [9, 1], [10, 0]],time = 10) == 1\n assert candidate(clips = [[0, 2], [1, 4], [2, 6], [3, 5], [4, 7], [5, 8], [6, 9], [7, 10], [8, 11], [9, 12], [10, 13], [11, 14], [12, 15], [13, 16], [14, 17], [15, 18], [16, 19], [17, 20], [18, 21], [19, 22], [20, 23], [21, 24], [22, 25], [23, 26], [24, 27], [25, 28], [26, 29], [27, 30]],time = 30) == 10\n assert candidate(clips = [[0, 10], [1, 20], [2, 30], [3, 40], [4, 50], [5, 60], [6, 70], [7, 80], [8, 90], [9, 100]],time = 100) == 2\n assert candidate(clips = [[0, 30], [3, 20], [5, 25], [7, 15], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [21, 22], [23, 24], [25, 26], [27, 28], [29, 30]],time = 30) == 1\n assert candidate(clips = [[0, 3], [1, 4], [2, 5], [3, 6], [4, 7], [5, 8], [6, 9], [7, 10], [8, 11], [9, 12]],time = 12) == 4\n assert candidate(clips = [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1]],time = 1) == 1\n assert candidate(clips = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19]],time = 20) == -1\n assert candidate(clips = [[0, 1], [1, 100]],time = 100) == 2\n assert candidate(clips = [[0, 100], [1, 99], [2, 98], [3, 97], [4, 96], [5, 95], [6, 94], [7, 93], [8, 92], [9, 91]],time = 100) == 1\n assert candidate(clips = [[0, 20], [15, 30], [25, 40], [10, 25], [30, 45], [5, 15], [0, 10], [20, 30], [10, 20], [40, 50]],time = 50) == 4\n assert candidate(clips = [[0, 1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 16], [15, 17], [16, 18], [17, 19], [18, 20], [0, 5], [5, 10], [10, 15], [15, 20]],time = 20) == 4\n assert candidate(clips = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19], [20, 21]],time = 21) == -1\n assert candidate(clips = [[0, 2], [2, 4], [4, 6], [6, 8], [8, 10], [10, 12], [12, 14], [14, 16], [16, 18], [18, 20], [20, 22], [22, 24], [24, 26], [26, 28], [28, 30]],time = 30) == 15\n assert candidate(clips = [[0, 25], [5, 50], [10, 75], [15, 100], [20, 125], [25, 150], [30, 175], [35, 200], [40, 225], [45, 250], [50, 275], [55, 300], [60, 325], [65, 350], [70, 375], [75, 400]],time = 400) == 3\n assert candidate(clips = [[0, 30], [1, 29], [2, 28], [3, 27], [4, 26], [5, 25], [6, 24], [7, 23], [8, 22], [9, 21], [10, 20], [11, 19], [12, 18], [13, 17], [14, 16]],time = 30) == 1\n assert candidate(clips = [[0, 5], [0, 10], [0, 15], [0, 20], [0, 25], [0, 30], [0, 35], [0, 40], [0, 45], [0, 50]],time = 50) == 1\n assert candidate(clips = [[0, 1], [2, 4], [4, 6], [6, 8], [8, 10], [10, 12], [12, 14], [14, 16], [16, 18], [18, 20], [20, 22], [22, 24], [24, 26], [26, 28], [28, 30], [30, 32], [32, 34], [34, 36], [36, 38], [38, 40]],time = 40) == -1\n assert candidate(clips = [[0, 50], [10, 60], [20, 70], [30, 80], [40, 90], [50, 100], [60, 110], [70, 120], [80, 130], [90, 140], [100, 150]],time = 150) == 3\n assert candidate(clips = [[0, 3], [4, 9], [5, 11], [13, 14], [10, 14], [11, 14], [12, 15], [15, 16], [6, 13], [1, 6], [3, 8], [7, 8], [9, 10], [10, 12], [8, 9], [14, 15], [1, 2], [0, 1]],time = 16) == 5\n assert candidate(clips = [[0, 10], [2, 5], [5, 15], [10, 20], [15, 25], [20, 30], [0, 5], [5, 10], [10, 15], [15, 20], [20, 25], [25, 30], [1, 4], [4, 7], [7, 10], [10, 13], [13, 16], [16, 19], [19, 22], [22, 25], [25, 28], [28, 30]],time = 30) == 3\n assert candidate(clips = [[0, 1], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 16], [15, 17], [16, 18], [17, 19], [18, 20]],time = 20) == 11\n assert candidate(clips = [[0, 20], [1, 19], [2, 18], [3, 17], [4, 16], [5, 15], [6, 14], [7, 13], [8, 12], [9, 11], [10, 10], [11, 9], [12, 8], [13, 7], [14, 6], [15, 5], [16, 4], [17, 3], [18, 2], [19, 1], [20, 0]],time = 20) == 1\n assert candidate(clips = [[0, 100], [1, 99], [2, 98], [3, 97], [4, 96], [5, 95], [6, 94], [7, 93], [8, 92], [9, 91], [10, 90], [11, 89], [12, 88], [13, 87], [14, 86], [15, 85]],time = 95) == 1\n assert candidate(clips = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19], [20, 21], [22, 23], [24, 25], [26, 27], [28, 29], [30, 31], [32, 33], [34, 35], [36, 37], [38, 39], [40, 41], [42, 43], [44, 45], [46, 47], [48, 49], [50, 51], [52, 53], [54, 55]],time = 55) == -1\n assert candidate(clips = [[0, 10], [2, 20], [4, 30], [6, 40], [8, 50], [10, 60], [12, 70], [14, 80], [16, 90], [18, 100]],time = 100) == 3\n assert candidate(clips = [[0, 5], [1, 9], [2, 11], [3, 13], [4, 15], [5, 17], [6, 19], [7, 21], [8, 23], [9, 25]],time = 25) == 3\n assert candidate(clips = [[0, 1], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11]],time = 11) == 6\n assert candidate(clips = [[0, 50], [1, 49], [2, 48], [3, 47], [4, 46], [5, 45], [6, 44], [7, 43], [8, 42], [9, 41]],time = 50) == 1\n assert candidate(clips = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20]],time = 20) == 20\n assert candidate(clips = [[0, 3], [1, 7], [2, 8], [3, 11], [5, 10], [7, 15], [8, 16], [12, 18], [14, 20], [16, 22], [18, 25]],time = 25) == 5\n assert candidate(clips = [[0, 2], [2, 4], [4, 6], [6, 8], [8, 10], [10, 12], [12, 14], [14, 16], [16, 18], [18, 20], [20, 22], [22, 24], [24, 26], [26, 28], [28, 30], [30, 32], [32, 34], [34, 36], [36, 38], [38, 40]],time = 40) == 20\n assert candidate(clips = [[0, 10], [5, 20], [15, 25], [20, 30], [25, 35], [30, 40], [35, 45], [40, 50], [45, 55], [50, 60]],time = 60) == 6\n assert candidate(clips = [[0, 5], [2, 8], [4, 10], [6, 12], [8, 14], [10, 16], [12, 18], [14, 20], [16, 22], [18, 24], [20, 25]],time = 25) == 5\n assert candidate(clips = [[0, 3], [1, 6], [2, 7], [3, 10], [4, 8], [5, 9], [6, 11], [7, 12], [8, 13], [9, 14]],time = 14) == 3\n assert candidate(clips = [[0, 10], [1, 5], [5, 10], [10, 15], [15, 20], [20, 25], [25, 30], [0, 30], [15, 30], [30, 40], [35, 45], [40, 50], [35, 50], [0, 25], [25, 45]],time = 50) == 3\n assert candidate(clips = [[0, 1], [1, 3], [2, 5], [4, 6], [6, 8], [8, 10], [10, 12], [12, 14], [14, 16], [16, 18], [18, 20], [20, 22]],time = 22) == 12\n assert candidate(clips = [[0, 25], [5, 50], [10, 75], [15, 100], [20, 125], [25, 150], [30, 175], [35, 200], [40, 225], [45, 250]],time = 250) == 3\n assert candidate(clips = [[0, 30], [10, 20], [20, 30], [5, 15], [15, 25], [25, 35], [0, 10], [10, 20], [20, 30], [30, 40], [40, 50]],time = 45) == 3\n assert candidate(clips = [[0, 3], [4, 7], [8, 12], [5, 9], [1, 4], [2, 6], [3, 5], [6, 10], [7, 11], [0, 1], [9, 13]],time = 13) == 4\n assert candidate(clips = [[0, 1], [0, 3], [0, 5], [0, 7], [0, 9], [1, 2], [1, 4], [1, 6], [1, 8], [1, 10], [2, 3], [2, 5], [2, 7], [2, 9], [3, 4], [3, 6], [3, 8], [3, 10], [4, 5], [4, 7], [4, 9], [5, 6], [5, 8], [5, 10], [6, 7], [6, 9], [7, 8], [7, 10], [8, 9]],time = 10) == 2\n assert candidate(clips = [[0, 10], [2, 20], [4, 30], [6, 40], [8, 50], [10, 60], [12, 70], [14, 80], [16, 90], [18, 100], [20, 110], [22, 120]],time = 120) == 3\n assert candidate(clips = [[0, 100], [1, 99], [2, 98], [3, 97], [4, 96], [5, 95], [6, 94], [7, 93], [8, 92], [9, 91], [10, 90], [11, 89], [12, 88], [13, 87], [14, 86], [15, 85], [16, 84], [17, 83], [18, 82], [19, 81], [20, 80], [21, 79], [22, 78], [23, 77], [24, 76], [25, 75], [26, 74], [27, 73], [28, 72], [29, 71], [30, 70], [31, 69], [32, 68], [33, 67], [34, 66], [35, 65], [36, 64], [37, 63], [38, 62], [39, 61], [40, 60], [41, 59], [42, 58], [43, 57], [44, 56], [45, 55], [46, 54], [47, 53], [48, 52], [49, 51]],time = 100) == 1\n assert candidate(clips = [[0, 10], [10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100]],time = 100) == 10\n"}, "metadata": {"canonical_parameter_names": ["clips", "time"], "leetcode_dataset_entry_point": "Solution().videoStitching", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var videoStitching = function(clips, time) {", "container": null, "callable": "videoStitching", "parameters": [{"name": "clips", "type": "number[][]"}, {"name": "time", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1025, "task_id": "divisor-game", "difficulty": "Easy", "problem_description": "Alice and Bob take turns playing a game, with Alice starting first.\nInitially, there is a number n on the chalkboard. On each player's turn, that player makes a move consisting of:\n\nChoosing any x with 0 < x < n and n % x == 0.\nReplacing the number n on the chalkboard with n - x.\n\nAlso, if a player cannot make a move, they lose the game.\nReturn true if and only if Alice wins the game, assuming both players play optimally.\n \nExample 1:\n\nInput: n = 2\nOutput: true\nExplanation: Alice chooses 1, and Bob has no more moves.\n\nExample 2:\n\nInput: n = 3\nOutput: false\nExplanation: Alice chooses 1, Bob chooses 1, and Alice has no more moves.\n\n \nConstraints:\n\n1 <= n <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 8) == True\n assert candidate(n = 3) == False\n assert candidate(n = 4) == True\n assert candidate(n = 9) == False\n assert candidate(n = 6) == True\n assert candidate(n = 2) == True\n assert candidate(n = 1000) == True\n assert candidate(n = 7) == False\n assert candidate(n = 10) == True\n assert candidate(n = 5) == False\n assert candidate(n = 625) == False\n assert candidate(n = 576) == True\n assert candidate(n = 729) == False\n assert candidate(n = 49) == False\n assert candidate(n = 50) == True\n assert candidate(n = 300) == True\n assert candidate(n = 99) == False\n assert candidate(n = 64) == True\n assert candidate(n = 17) == False\n assert candidate(n = 649) == False\n assert candidate(n = 23) == False\n assert candidate(n = 343) == False\n assert candidate(n = 640) == True\n assert candidate(n = 819) == False\n assert candidate(n = 128) == True\n assert candidate(n = 1024) == True\n assert candidate(n = 299) == False\n assert candidate(n = 777) == False\n assert candidate(n = 701) == False\n assert candidate(n = 999) == False\n assert candidate(n = 129) == False\n assert candidate(n = 18) == True\n assert candidate(n = 32) == True\n assert candidate(n = 256) == True\n assert candidate(n = 997) == False\n assert candidate(n = 768) == True\n assert candidate(n = 127) == False\n assert candidate(n = 81) == False\n assert candidate(n = 150) == True\n assert candidate(n = 503) == False\n assert candidate(n = 24) == True\n assert candidate(n = 15) == False\n assert candidate(n = 400) == True\n assert candidate(n = 512) == True\n assert candidate(n = 31) == False\n assert candidate(n = 377) == False\n assert candidate(n = 499) == False\n assert candidate(n = 1) == False\n assert candidate(n = 500) == True\n assert candidate(n = 420) == True\n assert candidate(n = 13) == False\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().divisorGame", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var divisorGame = function(n) {", "container": null, "callable": "divisorGame", "parameters": [{"name": "n", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1026, "task_id": "maximum-difference-between-node-and-ancestor", "difficulty": "Medium", "problem_description": "Given the root of a binary tree, find the maximum value v for which there exist different nodes a and b where v = |a.val - b.val| and a is an ancestor of b.\nA node a is an ancestor of b if either: any child of a is equal to b or any child of a is an ancestor of b.\n \nExample 1:\n\n\nInput: root = [8,3,10,1,6,null,14,null,null,4,7,13]\nOutput: 7\nExplanation: We have various ancestor-node differences, some of which are given below :\n|8 - 3| = 5\n|3 - 7| = 4\n|8 - 1| = 7\n|10 - 13| = 3\nAmong all possible differences, the maximum value of 7 is obtained by |8 - 1| = 7.\nExample 2:\n\n\nInput: root = [1,null,2,null,0,3]\nOutput: 3\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [2, 5000].\n0 <= Node.val <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, None, 2, None, 0, 3])) == 3\n assert candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13])) == 7\n assert candidate(root = tree_node([10, 5, 15, 2, 7, None, 18, None, None, 6, 8, 13, 19])) == 9\n assert candidate(root = tree_node([4, 2, 6, 1, 3, 5, 7, None, None, None, None, None, None, None, None])) == 3\n assert candidate(root = tree_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1])) == 9\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, None, 12, None, 22, 28, None, 33])) == 17\n assert candidate(root = tree_node([5, 4, 7, 3, 8, 6, 9, 2, 9, 10, None, None, None, 11, None, 12, None, 13])) == 10\n assert candidate(root = tree_node([10, 8, 15, 7, 9, 12, 20, 6, None, 10, 11, 14, 18, None, None, None, None, 13, 17, 19, 25])) == 17\n assert candidate(root = tree_node([10, 9, 20, None, None, 15, 7, 6, 11, 14, None, 13, None, None, None, None, None, None, 12, None, None, None, None, 16, None, None, None, None, None, None, None, None, 18, None, None, None, None, 19, None, None, None, None, None, 20, None, None, None, None, None, None, None, None])) == 14\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 190])) == 90\n assert candidate(root = tree_node([10, 4, 17, 3, 9, 15, 8, None, None, 7, None, None, None, None, None])) == 9\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, 7, None, 18, None, 28, 32, 40, None, None, None, None, None, None, None, None, 27])) == 20\n assert candidate(root = tree_node([50, 25, 75, 10, 30, 60, 90, 5, None, 28, 40, 55, 70, 80, 95])) == 45\n assert candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15])) == 7\n assert candidate(root = tree_node([50, 20, 60, 10, 30, 55, 70, 5, 15, 25, 35, 52, 58, 65, 75, 1, None, None, None, None, None, None, None, 12, None, 28, None, None, 50, 56, 62, 68, 72, 78, 80])) == 71\n assert candidate(root = tree_node([9, 4, 17, 3, 6, 10, 22, None, None, 5, 7, None, 20, None, 24])) == 15\n assert candidate(root = tree_node([10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])) == 19\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8])) == 7\n assert candidate(root = tree_node([20, 10, 30, 5, 15, None, 35, None, 7, None, 17, None, None, None, 25, 40])) == 30\n assert candidate(root = tree_node([25, 10, 35, 5, 15, 30, 40, 2, 7, 12, 18, 27, 32, 38, 45])) == 23\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 180])) == 90\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6, None, 11, 14, None, None, 17, 20])) == 19\n assert candidate(root = tree_node([15, 10, 20, 8, 12, 18, 25, 5, 9, 11, 14, 16, 19, 24, 30])) == 15\n assert candidate(root = tree_node([7, 3, 15, 1, 5, 10, 20, None, 2, None, None, 6, 12, 18, 25])) == 18\n assert candidate(root = tree_node([9, 4, 17, 3, 6, 15, 22, 2, 5, 12, 18, None, None, None, None, 16, 20, None, None, None, None, None, 24, 27])) == 25\n assert candidate(root = tree_node([4, 2, 7, 1, 3, 6, 9, None, None, None, None, None, 12, 11, 14])) == 10\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, 16])) == 15\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 12, 18, 23, 27, 32, 37])) == 17\n assert candidate(root = tree_node([100, 90, 110, 80, 95, 105, 120, 70, 85, 92, 98, 102, 115, 118, 125])) == 30\n assert candidate(root = tree_node([9, 4, 17, 3, 6, 12, 22, 2, 5, 8, 11, 15, 20, 24, 25])) == 16\n assert candidate(root = tree_node([3, 1, 4, None, 2, None, None, None, None, None, None])) == 2\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7])) == 17\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 13, 17, 23, 27, 33, 37])) == 18\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, None, 18, None, 37, 47, None, None, None, None, None])) == 25\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 13, 18, 23, 27, 33, 37])) == 17\n assert candidate(root = tree_node([30, 20, 40, 10, 25, 35, 50, 5, 15, None, None, 32, 37, 45, 60])) == 30\n assert candidate(root = tree_node([5, 3, 10, 1, 6, 9, 15, None, None, 4, 7, 8, 12, None, None, None, None, None, None, None, 14])) == 10\n assert candidate(root = tree_node([10, 5, 15, None, 7, None, 20, None, None, 18, 25])) == 15\n assert candidate(root = tree_node([100, 90, 110, 80, 95, 105, 120, 70, 85, 92, 97, 102, 115, 125, 130])) == 30\n assert candidate(root = tree_node([3, 1, 4, None, 2, None, None, None, None, None, 5, None, 6, None, 7, None, 8, None, 9])) == 2\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, None, 13, None, 22, 28, 40])) == 20\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == 14\n assert candidate(root = tree_node([50, 20, 80, 10, 30, 70, 90, None, None, 25, 35, None, 75, 85, None])) == 40\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6])) == 9\n assert candidate(root = tree_node([50, 25, 75, 10, 35, 60, 90, 5, 20, 30, 40, 55, 65, 85, 95])) == 45\n assert candidate(root = tree_node([50, 25, 75, 12, 37, 63, 87, 6, 18, 31, 44, 58, 69, 83, 90])) == 44\n assert candidate(root = tree_node([2, 1, 3, None, 4, None, None, None, 5])) == 4\n assert candidate(root = tree_node([5, 1, 9, None, None, 7, 10, None, 6, None, 11])) == 6\n assert candidate(root = tree_node([5, 2, 10, 1, 3, 9, 12, None, None, 4, 6, 8, 11, 13])) == 8\n assert candidate(root = tree_node([50, 25, 75, 10, 30, 60, 90, 5, 15, 20, 35, 55, 65, 85, 100])) == 50\n assert candidate(root = tree_node([2, 1, 3, None, None, 4, None, None, 5, None, None, None, None, None, 6])) == 3\n assert candidate(root = tree_node([40, 20, 60, 10, 30, 50, 70, 5, 15, 25, 35, 45, 55, 65, 75])) == 35\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 17, 25, 35, 47, 49])) == 25\n assert candidate(root = tree_node([50, 20, 60, 10, 30, 55, 70, 5, 15, 25, 35, 52, 65, 68, 75])) == 45\n assert candidate(root = tree_node([2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == 13\n assert candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, None, None, None, None, None, None, None])) == 20\n assert candidate(root = tree_node([1, None, 3, None, None, 2, 4, None, None, None, 5])) == 2\n assert candidate(root = tree_node([30, 25, 40, 20, 28, 35, 45, 15, 22, None, 27, 32, 38, 43, 47])) == 17\n assert candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, None, 25, 35, 45, 48, 55])) == 25\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6])) == 9\n assert candidate(root = tree_node([5, 3, 8, 1, 4, 7, 9, 0, 2, 6, 10])) == 7\n assert candidate(root = tree_node([3, 1, 4, None, 2])) == 2\n assert candidate(root = tree_node([4, 2, 6, 1, 3, 5, 7, 0, None, None, None, None, None, None, 8])) == 4\n assert candidate(root = tree_node([5, 1, 9, 0, 2, None, None, None, 4, 3])) == 5\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, 7, 12, 18, 23, 28, 33, 37])) == 19\n assert candidate(root = tree_node([1, 0, 2, None, None, 3, None, None, None, 4, None, None, None, 5])) == 2\n assert candidate(root = tree_node([7, 3, 15, 1, 5, 10, 20, None, None, 4, 6, 8, 12, 17, 23])) == 16\n assert candidate(root = tree_node([20, 10, 30, 5, 15, None, None, 3, 7, 13, 18])) == 17\n assert candidate(root = tree_node([2, 1, 3, None, 4, None, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20, None, 21, None, 22, None, 23, None, 24, None, 25, None, 26, None, 27, None, 28, None, 29, None, 30])) == 29\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180, None, None, None, None, 20, None, 40, None, 90, None, None, 130, None, None, None, None, 150, None, None, 190, None, None])) == 150\n assert candidate(root = tree_node([4, 2, 6, 1, 3, 5, 7, 0, 8, None, None, None, None, None, None])) == 7\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == 8\n assert candidate(root = tree_node([4, 2, 6, 1, 3, 5, 7])) == 3\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, None, None, None, None, 16, 20])) == 10\n assert candidate(root = tree_node([2, 1, 3, None, None, 4])) == 2\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 12, 37, 62, 87, 112, 137, 162, 187, 6, 18, 31, 44, 58, 69, 83, 90, 108, 118, 128, 138, 158, 168, 178, 188])) == 94\n assert candidate(root = tree_node([9, 6, 12, 4, 7, 10, 14, 3, 5, 8, 11, 13, 15])) == 6\n assert candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 12, 18, 22, 27, 32, 37])) == 17\n assert candidate(root = tree_node([5, 3, 9, 1, 4, None, 11, None, None, 2, 6, 10, 12])) == 7\n assert candidate(root = tree_node([100, 50, 200, 25, 75, 150, 250, 12, None, 65, 85, 125, 175, 225, 275])) == 175\n assert candidate(root = tree_node([10, 5, 15, 1, 8, None, 7])) == 9\n assert candidate(root = tree_node([5, 2, 6, 1, None, None, 8, None, 4, None, None, None, 7, 9])) == 8\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6, None, 10, 14, None, None, 17, None, None, None, None, None, None, None, None])) == 16\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 180])) == 90\n assert candidate(root = tree_node([10, 9, 20, None, None, 15, 7, 13, 18, 25, 8, 17, 19, 21, 30])) == 20\n assert candidate(root = tree_node([15, 10, 20, 8, 12, None, 25, None, None, None, None, 22, 28])) == 13\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().maxAncestorDiff", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxAncestorDiff = function(root) {", "container": null, "callable": "maxAncestorDiff", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1027, "task_id": "longest-arithmetic-subsequence", "difficulty": "Medium", "problem_description": "Given an array nums of integers, return the length of the longest arithmetic subsequence in nums.\nNote that:\n\nA subsequence is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.\nA sequence seq is arithmetic if seq[i + 1] - seq[i] are all the same value (for 0 <= i < seq.length - 1).\n\n \nExample 1:\n\nInput: nums = [3,6,9,12]\nOutput: 4\nExplanation: The whole array is an arithmetic sequence with steps of length = 3.\n\nExample 2:\n\nInput: nums = [9,4,7,2,10]\nOutput: 3\nExplanation: The longest arithmetic subsequence is [4,7,10].\n\nExample 3:\n\nInput: nums = [20,1,15,3,10,5,8]\nOutput: 4\nExplanation: The longest arithmetic subsequence is [20,15,10,5].\n\n \nConstraints:\n\n2 <= nums.length <= 1000\n0 <= nums[i] <= 500\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [7, 7, 7, 11, 11, 11, 15]) == 3\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15]) == 8\n assert candidate(nums = [83, 20, 17, 43, 52, 78, 68, 45]) == 2\n assert candidate(nums = [8, 12, 16, 20, 24, 28]) == 6\n assert candidate(nums = [2, 4, 6, 8, 10, 14, 18]) == 5\n assert candidate(nums = [8, 12, 16, 4, 0, 20]) == 4\n assert candidate(nums = [2, 4, 6, 8, 10]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums = [3, 6, 9, 12]) == 4\n assert candidate(nums = [20, 1, 15, 3, 10, 5, 8]) == 4\n assert candidate(nums = [500, 0, 500, 0, 500, 0]) == 3\n assert candidate(nums = [10, 20, 30, 40, 50]) == 5\n assert candidate(nums = [9, 4, 7, 2, 10]) == 3\n assert candidate(nums = [5, 5, 5, 5, 5]) == 5\n assert candidate(nums = [3, 5, 7, 9, 11, 13, 15]) == 7\n assert candidate(nums = [1, 2, 3, 4, 5]) == 5\n assert candidate(nums = [1, 3, 5, 7, 9, 11]) == 6\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13]) == 7\n assert candidate(nums = [7, 7, 7, 7, 10, 10, 10, 10]) == 4\n assert candidate(nums = [500, 500, 500, 500, 500]) == 5\n assert candidate(nums = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]) == 5\n assert candidate(nums = [0, 2, 2, 2, 4, 6, 8, 10]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 9\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 10\n assert candidate(nums = [44, 46, 22, 68, 45, 66, 43, 96, 29, 37]) == 2\n assert candidate(nums = [10, 9, 4, 5, 4, 8, 6]) == 3\n assert candidate(nums = [1, 2, 3, 8, 9, 10]) == 3\n assert candidate(nums = [1, 7, 10, 15, 27, 29]) == 3\n assert candidate(nums = [100, 100, 100, 100, 101]) == 4\n assert candidate(nums = [5, 14, 13, 8, 12]) == 3\n assert candidate(nums = [500, 250, 0, -250, -500, -750, -1000]) == 7\n assert candidate(nums = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49]) == 17\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 20\n assert candidate(nums = [4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61]) == 20\n assert candidate(nums = [4, 1, 3, 2, 5, 10, 8, 14, 18, 22, 26, 30]) == 6\n assert candidate(nums = [8, 11, 13, 16, 18, 21, 23, 26, 28, 31, 33, 36, 38]) == 7\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70]) == 14\n assert candidate(nums = [500, 250, 125, 62, 31, 15, 7, 3, 1, 0, 1, 3, 7, 15, 31, 62, 125, 250, 500]) == 3\n assert candidate(nums = [1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29]) == 10\n assert candidate(nums = [50, 40, 30, 20, 10, 0, -10, -20, -30, -40]) == 10\n assert candidate(nums = [100, 101, 104, 109, 115, 122, 130, 139, 149, 160, 172, 185, 199]) == 3\n assert candidate(nums = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101]) == 26\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 10\n assert candidate(nums = [10, 5, 0, -5, -10, -15, -20, -25, -30, -35, -40, -45, -50]) == 13\n assert candidate(nums = [1, 3, 5, 7, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39]) == 11\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33]) == 11\n assert candidate(nums = [1, 7, 10, 15, 27, 29, 33, 18]) == 3\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 15\n assert candidate(nums = [10, 20, 15, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80]) == 13\n assert candidate(nums = [7, 9, 11, 7, 9, 11, 7, 9, 11, 7, 9, 11, 7, 9, 11, 7, 9, 11]) == 6\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60]) == 30\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 30\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == 30\n assert candidate(nums = [10, 20, 30, 15, 25, 35, 20, 30, 40, 25, 35, 45, 30, 40, 50, 35, 45, 55, 40, 50, 60, 45, 55, 65]) == 8\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]) == 11\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 10\n assert candidate(nums = [5, 3, 8, 6, 11, 9, 14, 12, 17, 15, 20, 18]) == 6\n assert candidate(nums = [5, 10, 15, 25, 35, 40, 45, 50]) == 5\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(nums = [1, 2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41]) == 14\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]) == 25\n assert candidate(nums = [10, 5, 0, -5, -10, -15, -20, -25, -30]) == 9\n assert candidate(nums = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45]) == 12\n assert candidate(nums = [15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155]) == 15\n assert candidate(nums = [1, 5, 7, 11, 13, 17, 19, 23, 29, 31, 35, 37, 41]) == 7\n assert candidate(nums = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == 10\n assert candidate(nums = [100, 200, 150, 250, 300, 350, 400, 450]) == 6\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130]) == 13\n assert candidate(nums = [1, 100, 50, 25, 12, 6, 3, 1, 0, -1, -2, -3, -4, -5]) == 7\n assert candidate(nums = [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]) == 24\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == 10\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0]) == 11\n assert candidate(nums = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20]) == 10\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 15\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210]) == 21\n assert candidate(nums = [10, 20, 30, 25, 40, 50, 45, 60, 70, 65, 80, 90, 85, 100]) == 10\n assert candidate(nums = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130]) == 25\n assert candidate(nums = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97]) == 25\n assert candidate(nums = [5, 8, 11, 14, 17, 20, 23, 26, 29, 32]) == 10\n assert candidate(nums = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57]) == 15\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150]) == 30\n assert candidate(nums = [30, 20, 10, 0, -10, -20, -30, -40, -50, -60]) == 10\n assert candidate(nums = [2, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 9\n assert candidate(nums = [4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100]) == 25\n assert candidate(nums = [10, 20, 15, 25, 35, 40, 45, 55, 65, 75, 85, 95]) == 9\n assert candidate(nums = [4, 8, 12, 16, 20, 24, 28, 32, 36, 40]) == 10\n assert candidate(nums = [10, 5, 0, -5, -10, -15, -20, -25, -30, -35, -40, -45, -50, -55, -60]) == 15\n assert candidate(nums = [4, 12, 16, 20, 28, 32, 36, 40, 44]) == 6\n assert candidate(nums = [1, 7, 10, 15, 27, 29, 33]) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 10\n assert candidate(nums = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89]) == 3\n assert candidate(nums = [500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486]) == 15\n assert candidate(nums = [100, 50, 0, -50, -100, -150, -200]) == 7\n assert candidate(nums = [100, 50, 75, 100, 125, 150, 175, 200, 225, 250]) == 9\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24]) == 12\n assert candidate(nums = [10, 20, 20, 30, 30, 40, 40, 50, 50, 60, 60, 70, 70]) == 7\n assert candidate(nums = [4, 1, 3, 2, 5, 7, 6, 9, 8, 10]) == 5\n assert candidate(nums = [3, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51]) == 15\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 40\n assert candidate(nums = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50, 53, 56, 59, 62, 65, 68, 71, 74, 77, 80, 83, 86, 89, 92, 95, 98]) == 33\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200]) == 40\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == 15\n assert candidate(nums = [10, 5, 0, -5, -10, -15, -20, -25, -30, -35]) == 10\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21]) == 11\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 25\n assert candidate(nums = [45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99]) == 28\n assert candidate(nums = [2, 4, 6, 8, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50]) == 13\n assert candidate(nums = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190]) == 3\n assert candidate(nums = [5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]) == 11\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45]) == 15\n assert candidate(nums = [3, 5, 6, 7, 8, 10, 12, 14, 15, 18, 20, 22, 24, 25, 27, 29, 30]) == 6\n assert candidate(nums = [5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89]) == 15\n assert candidate(nums = [4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46]) == 15\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120]) == 24\n assert candidate(nums = [1, 5, 7, 10, 15, 16, 21, 26, 31, 36, 41]) == 6\n assert candidate(nums = [5, 8, 11, 14, 13, 12, 15, 18, 21, 24, 27]) == 6\n assert candidate(nums = [1, 7, 10, 13, 14, 18, 21, 22, 25, 28]) == 4\n assert candidate(nums = [25, 29, 33, 37, 41, 45, 49, 53, 57, 61]) == 10\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 20\n assert candidate(nums = [7, 11, 5, 13, 17, 3, 19, 23, 29, 37, 43, 47, 53, 59, 67, 71, 79, 83, 89]) == 4\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75]) == 15\n assert candidate(nums = [5, 3, 1, 4, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 13\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]) == 12\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]) == 13\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 20, 30, 40]) == 10\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3]) == 8\n assert candidate(nums = [1, 7, 10, 15, 27, 29, 33, 37, 41, 54, 69]) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(nums = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57]) == 15\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10, -20, -30]) == 14\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 15\n assert candidate(nums = [5, 10, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155]) == 16\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 10\n assert candidate(nums = [10, 9, 4, 5, 4, 8, 6]) == 3\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 20\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250]) == 25\n assert candidate(nums = [2, 4, 6, 8, 10, 14, 18, 22, 26, 30, 34, 38, 42]) == 11\n assert candidate(nums = [500, 250, 125, 62, 31, 15, 7, 3, 1]) == 2\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 20\n assert candidate(nums = [4, 12, 10, 9, 8, 6, 5, 3, 1]) == 4\n assert candidate(nums = [10, 5, 10, 15, 20, 25, 30, 35, 40, 45]) == 9\n assert candidate(nums = [100, 200, 50, 150, 250, 300, 350, 400, 450, 500]) == 7\n assert candidate(nums = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 19\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 10\n assert candidate(nums = [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27]) == 13\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300]) == 30\n assert candidate(nums = [2, 6, 8, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70, 74]) == 19\n assert candidate(nums = [3, 1, 2, 4, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27]) == 13\n assert candidate(nums = [8, 12, 16, 4, 0, 20, 24, 28]) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5]) == 10\n assert candidate(nums = [1, 10, 19, 28, 37, 46, 55, 64, 73, 82, 91, 100]) == 12\n assert candidate(nums = [4, 14, 24, 34, 44, 54, 49, 64, 59, 74, 69, 84, 79, 94, 89, 104]) == 11\n assert candidate(nums = [1, 2, 3, 5, 8, 13, 21, 34, 55]) == 3\n assert candidate(nums = [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41]) == 20\n assert candidate(nums = [1, 5, 3, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 18\n assert candidate(nums = [5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35]) == 11\n assert candidate(nums = [20, 30, 25, 35, 40, 50, 45, 55, 60]) == 5\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().longestArithSeqLength", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var longestArithSeqLength = function(nums) {", "container": null, "callable": "longestArithSeqLength", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1028, "task_id": "recover-a-tree-from-preorder-traversal", "difficulty": "Hard", "problem_description": "We run a preorder depth-first search (DFS) on the root of a binary tree.\nAt each node in this traversal, we output D dashes (where D is the depth of this node), then we output the value of this node.  If the depth of a node is D, the depth of its immediate child is D + 1.  The depth of the root node is 0.\nIf a node has only one child, that child is guaranteed to be the left child.\nGiven the output traversal of this traversal, recover the tree and return its root.\n \nExample 1:\n\n\nInput: traversal = \"1-2--3--4-5--6--7\"\nOutput: [1,2,5,3,4,6,7]\n\nExample 2:\n\n\nInput: traversal = \"1-2--3---4-5--6---7\"\nOutput: [1,2,5,3,null,6,null,4,null,7]\n\nExample 3:\n\n\nInput: traversal = \"1-401--349---90--88\"\nOutput: [1,401,null,349,88,90]\n\n \nConstraints:\n\nThe number of nodes in the original tree is in the range [1, 1000].\n1 <= Node.val <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(traversal = \"1\"), tree_node([1]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4---5\"), tree_node([1, 2, None, 3, 4, None, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3---5----6\"), tree_node([1, 2, None, 3, None, 5, None, 6]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7-8-9-10\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5-6--7-8--9\"), tree_node([1, 2, 4, 3, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2-3----4-----5\"), tree_node([1, 2, 3]))\n assert is_same_tree(candidate(traversal = \"1-2-3--4--5\"), tree_node([1, 2, 3, None, None, 4, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2---3----4-----5\"), tree_node([1, 2]))\n assert is_same_tree(candidate(traversal = \"1-2-3-4-5\"), tree_node([1, 2, 3]))\n assert is_same_tree(candidate(traversal = \"1-2-3\"), tree_node([1, 2, 3]))\n assert is_same_tree(candidate(traversal = \"1-2\"), tree_node([1, 2]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4-5--6---7\"), tree_node([1, 2, 5, 3, None, 6, None, 4, None, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5-6--7-8-9\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4-5\"), tree_node([1, 2, 4, 3]))\n assert is_same_tree(candidate(traversal = \"1-2-3--4-5--6-7\"), tree_node([1, 2, 3, None, None, 4]))\n assert is_same_tree(candidate(traversal = \"1-401--349---90--88\"), tree_node([1, 401, None, 349, 88, 90]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5\"), tree_node([1, 2, 4, 3, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5-6--7-8--9-10--11\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-----6------7-------8\"), tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7--8--9--10\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8-9-10-11-12-13-14-15-16-17-18-19\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4-----5------6-------7--------8---------9----------10-----------11------------12-------------13\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5------6---------7----------8-9-10-11-12-13\"), tree_node([1, 2, None, 3, None, 4, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5-6--7--8--9--10--11--12-13\"), tree_node([1, 2, 5, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4----5-6------7--8---9\"), tree_node([1, 2, 4, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7-8--9--10--11--12--13--14\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5--6--7---8----9-10--11--12-13\"), tree_node([1, 2, None, 3, 6, 4, None, None, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4----5--6--7-8-9-10-11-12-13--14----15\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4------5--------6\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-----6------7-------8--------9---------10----------11-----------12------------13-------------14\"), tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5---6------7\"), tree_node([1, 2, 4, 3, None, 5, None, None, None, 6]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4-----5------6-------7--------8---------9----------10-----------11------------12\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7-8--9--10--11--12--13--14--15--16--17--18--19--20--21--22--23--24--25--26--27--28--29--30--31--32--33--34--35--36--37--38--39--40--41--42--43--44--45--46--47--48--49--50\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5-----6----7---8-9\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4---5----6-----7\"), tree_node([1, 2, None, 3, 4, None, None, 5, None, 6, None, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12--13--14--15\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2-3-4-5-6-7-8-9\"), tree_node([1, 2, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4-5--6--7---8-9-10-11-12\"), tree_node([1, 2, 5, 3, None, 6, 7, 4, None, None, None, 8]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-6--7---8----9-10--11--12-13-14\"), tree_node([1, 2, 6, 3, None, 7, None, 4, None, 8, None, 5, None, 9]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5------6--------7\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4-----5------6-------7--------8---------9----------10-----------11\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5-6--7--8--9--10--11--12--13--14--15--16\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4----5--6--7-8-9-10-11-12-13--14----15--16-17\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12--13--14--15--16--17--18--19--20--21\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9-10-11-12-13-14\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5-6------7---8-9--10----11\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5-6--7--8--9--10--11-12--13--14--15--16--17--18--19--20\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7--8-9\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-6--7---8----9-10--11--12\"), tree_node([1, 2, 6, 3, None, 7, None, 4, None, 8, None, 5, None, 9]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5-6--7---8--9-10----11--12\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-6--7---8-9\"), tree_node([1, 2, 6, 3, None, 7, None, 4, None, 8, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7-8--9--10-11-12--13--14-15-16--17-18--19-20-21-22-23-24\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5--6-7---8-9--10-11--12-13--14\"), tree_node([1, 2, 7, 3, 6, None, None, 4, None, None, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5------6---------7----------8-9\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7-8--9--10-11-12--13--14-15-16--17-18--19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4----5---6--7\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7-8--9--10--11--12--13--14--15--16\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5----6-----7------8-------9\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5--6-7-8-9-10-11-12-13-14-15-16-17-18\"), tree_node([1, 2, 4, 3, None, 5, 6]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5---6---7---8---9\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5------6--------7-8--9---10----11\"), tree_node([1, 2, None, 3, None, 4, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7-8--9--10-11--12--13--14--15\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7--8-9-10--11--12-13--14--15--16--17--18--19\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5-6--7-8--9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"10-20--30---40----50-60--70---80----90\"), tree_node([10, 20, 60, 30, None, 70, None, 40, None, 80, None, 50, None, 90]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4----5------6--------7--------8------9----10--11-12--13\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5--6-7-8--9-10-11-12-13-14-15\"), tree_node([1, 2, 4, 3, None, 5, 6]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5-6--7-8\"), tree_node([1, 2, 5, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5-6--7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5------6---------7----------8-9-10-11-12-13-14-15-16-17-18-19-20\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5--6-7---8----9\"), tree_node([1, 2, 4, 3, None, 5, 6]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5------6---------7----------8-9-10-11-12\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5-6----7-8--9\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-6--7---8----9-10--11\"), tree_node([1, 2, 6, 3, None, 7, None, 4, None, 8, None, 5, None, 9]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7-8--9-10--11--12\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5-6--7-8--9--10-11-12--13--14-15-16--17-18--19-20\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12--13--14--15--16--17--18--19--20\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6-7-8--9-10--11--12-13--14\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7-8--9--10\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4-5-6--7----8-9----10--11----12\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8-9--10--11--12\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5------6---------7\"), tree_node([1, 2, None, 3, None, 4, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5-6----7------8\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"10-20--30---40----50-60--70-80\"), tree_node([10, 20, 60, 30, None, 70, None, 40, None, None, None, 50]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5--6-7---8-9--10-11--12-13--14-15--16-17--18--19--20--21--22\"), tree_node([1, 2, 7, 3, 6, None, None, 4, None, None, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5-6--7--8-9--10-11--12-13\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7-8--9-10--11--12-13--14-15--16-17--18\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5-6--7--8--9\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5------6-7--8---9\"), tree_node([1, 2, None, 3, None, 4, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5-6-7-8-9-10-11-12\"), tree_node([1, 2, 5, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-----6------7-------8--------9---------10----------11-----------12------------13\"), tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4-----5------6-------7--------8\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12--13\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7--8--9--10--11--12\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7--8--9--10--11--12--13--14--15--16--17--18--19--20--21--22--23\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7-8--9--10-11-12--13--14-15-16--17-18--19-20-21-22-23-24-25-26-27-28-29-30\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5---6----7--8--9--10--11--12\"), tree_node([1, 2, 4, 3, None, 5, 8, None, None, 6, None, None, None, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5---6----7\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4-----5------6-------7--------8---------9\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4----5--6--7-8-9-10-11-12-13--14----15--16-17--18----19--20-21\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7-8-9-10-11-12\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4---5----6-----7------8\"), tree_node([1, 2, None, 3, 4, None, None, 5, None, 6, None, 7, None, 8]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4-5--6----7-8\"), tree_node([1, 2, 5, 3, None, 6, None, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5-6--7-8--9-10\"), tree_node([1, 2, 5, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-----6--7---8----9-10--11--12--13\"), tree_node([1, 2, 10, 3, 7, 11, 12, 4, None, 8, None, None, None, None, None, 5, None, 9, None, 6]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4---5-6--7---8----9-10--11\"), tree_node([1, 2, 6, 3, 4, 7, None, None, None, 5, None, 8, None, None, None, 9]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7-8--9-10--11--12--13--14\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4-----5------6-------7--------8---------9----------10\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-----6------7-------8--------9---------10\"), tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-6--7---8-9--10-11--12-13--14-15--16-17--18--19--20\"), tree_node([1, 2, 6, 3, None, 7, None, 4, None, 8, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6-7--8-9--10\"), tree_node([1, 2, 5, 3, 4, 6]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4----5--6--7-8-9-10-11-12-13--14----15--16-17--18----19--20-21--22----23\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5--6-7-8--9---10\"), tree_node([1, 2, 4, 3, None, 5, 6]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4----5--6--7-8-9-10-11-12-13--14----15--16-17--18----19\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-6--7---8----9-10\"), tree_node([1, 2, 6, 3, None, 7, None, 4, None, 8, None, 5, None, 9]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7-8--9-10--11--12-13--14-15--16-17--18--19--20--21\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-----6------7-------8--------9\"), tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12--13--14--15--16--17--18--19--20--21--22\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7--8-9-10-11-12-13-14\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5---6----7-8--9----10-11\"), tree_node([1, 2, 4, 3, None, 5, None, None, None, 6, None, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5-----6------7-------8\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6-7--8--9-10-11--12--13\"), tree_node([1, 2, 5, 3, 4, 6]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5------6---------7----------8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5------6-------7\"), tree_node([1, 2, None, 3, None, 4, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5\"), tree_node([1, 2, None, 3, None, 4, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5-6--7-8-9-10-11\"), tree_node([1, 2, 4, 3, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12--13-14--15\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-----6------7-------8--------9---------10----------11\"), tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4----5--6--7-8-9-10-11-12-13--14----15--16-17--18----19--20\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-----6------7-------8--------9---------10----------11-----------12------------13-------------14--------------15\"), tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5-6--7-8--9--10-11\"), tree_node([1, 2, 5, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5--6--7----8-9----10\"), tree_node([1, 2, None, 3, 6, 4, None, None, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5-6--7--8-9--10--11\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-6--7---8-9--10\"), tree_node([1, 2, 6, 3, None, 7, None, 4, None, 8, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4----5--6--7-8-9-10-11-12-13\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5-6--7-8-9-10--11\"), tree_node([1, 2, 5, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4----5------6--------7--------8------9----10--11\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6---7----8-9-10-11-12-13\"), tree_node([1, 2, 5, 3, 4, 6, None, None, None, None, None, 7, None, 8]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12-13--14--15\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-6--7---8-9--10-11--12-13--14\"), tree_node([1, 2, 6, 3, None, 7, None, 4, None, 8, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5--6--7---8----9\"), tree_node([1, 2, None, 3, 6, 4, None, None, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7-8--9-10--11--12--13--14--15--16\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-6--7---8----9-10--11--12-13-14-15\"), tree_node([1, 2, 6, 3, None, 7, None, 4, None, 8, None, 5, None, 9]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5------6-7--8----9\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5------6-7\"), tree_node([1, 2, None, 3, None, 4, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-----6------7-------8--------9---------10----------11-----------12\"), tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7-8--9-10--11--12-13--14-15--16-17--18--19--20--21--22--23\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5-6--7----8----9\"), tree_node([1, 2, 5, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7--8--9--10--11--12--13--14--15--16--17--18--19\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12--13--14--15--16--17--18--19--20--21--22--23\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5----6--7\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7-8--9-10\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4----5----6----7----8----9\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7-8----9----10\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5-6--7-8--9-10-11-12-13-14-15-16\"), tree_node([1, 2, 4, 3, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-----6------7\"), tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5----6--7----8\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12--13--14--15--16--17\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5--6--7--8-9--10--11--12--13--14--15--16--17--18--19--20--21\"), tree_node([1, 2, 4, 3, None, 5, 6]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5------6----7---8-9----10--11\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5-6--7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5----6------7------8----9\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7--8-9--10-11-12-13-14\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12--13--14-15\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12--13--14--15--16--17--18--19--20--21--22--23--24--25\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9-10-11-12-13-14-15-16\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5------6---------7----------8\"), tree_node([1, 2, None, 3, None, 4, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5--6---7----8\"), tree_node([1, 2, None, 3, 6, 4, None, 7, None, 5, None, 8]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4---5----6-7--8-9-10-11-12\"), tree_node([1, 2, 7, 3, 4, 8, None, None, None, 5, None, None, None, 6]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5------6---------7----------8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5-6--7---8----9\"), tree_node([1, 2, 5, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4-----5------6\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7--8-9--10-11-12-13-14-15-16-17\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3----4------5--------6----------7\"), tree_node([1, 2, None, 3]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7-8-9-10-11\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4----5------6---------7----------8-9-10-11-12-13-14\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3---4----5-6--7---8\"), tree_node([1, 2, 6, 3, None, 7, None, 4, None, 8, None, 5]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12--13--14--15--16--17--18\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3-4--5--6--7--8-9--10-11-12-13-14-15-16-17-18-19-20\"), tree_node([1, 2, 4, 3, None, 5, 6]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7-8--9--10--11--12--13--14--15--16--17--18--19\"), tree_node([1, 2, None, 3, 4]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4-5--6--7-8--9-10--11--12-13--14-15--16-17--18--19\"), tree_node([1, 2, 5, 3, 4, 6, 7]))\n assert is_same_tree(candidate(traversal = \"1-2--3--4--5--6--7--8--9--10--11--12--13--14--15--16--17--18--19--20--21--22--23--24\"), tree_node([1, 2, None, 3, 4]))\n"}, "metadata": {"canonical_parameter_names": ["traversal"], "leetcode_dataset_entry_point": "Solution().recoverFromPreorder", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var recoverFromPreorder = function(traversal) {", "container": null, "callable": "recoverFromPreorder", "parameters": [{"name": "traversal", "type": "string"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1029, "task_id": "two-city-scheduling", "difficulty": "Medium", "problem_description": "A company is planning to interview 2n people. Given the array costs where costs[i] = [aCosti, bCosti], the cost of flying the ith person to city a is aCosti, and the cost of flying the ith person to city b is bCosti.\nReturn the minimum cost to fly every person to a city such that exactly n people arrive in each city.\n \nExample 1:\n\nInput: costs = [[10,20],[30,200],[400,50],[30,20]]\nOutput: 110\nExplanation: \nThe first person goes to city A for a cost of 10.\nThe second person goes to city A for a cost of 30.\nThe third person goes to city B for a cost of 50.\nThe fourth person goes to city B for a cost of 20.\n\nThe total minimum cost is 10 + 30 + 50 + 20 = 110 to have half the people interviewing in each city.\n\nExample 2:\n\nInput: costs = [[259,770],[448,54],[926,667],[184,139],[840,118],[577,469]]\nOutput: 1859\n\nExample 3:\n\nInput: costs = [[515,563],[451,713],[537,709],[343,819],[855,779],[457,60],[650,359],[631,42]]\nOutput: 3086\n\n \nConstraints:\n\n2 * n == costs.length\n2 <= costs.length <= 100\ncosts.length is even.\n1 <= aCosti, bCosti <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(costs = [[30, 20], [200, 300], [50, 400], [20, 30]]) == 300\n assert candidate(costs = [[10, 20], [30, 200], [400, 50], [30, 20]]) == 110\n assert candidate(costs = [[515, 563], [451, 713], [537, 709], [343, 819], [855, 779], [457, 60], [650, 359], [631, 42]]) == 3086\n assert candidate(costs = [[1, 2], [3, 4], [5, 6], [7, 8]]) == 18\n assert candidate(costs = [[259, 770], [448, 54], [926, 667], [184, 139], [840, 118], [577, 469]]) == 1859\n assert candidate(costs = [[100, 200], [200, 100], [300, 400], [400, 300], [500, 600], [600, 500], [700, 800], [800, 700]]) == 3200\n assert candidate(costs = [[450, 440], [300, 400], [350, 420], [400, 380], [250, 410], [410, 420], [270, 300], [430, 450]]) == 2860\n assert candidate(costs = [[100, 200], [250, 150], [300, 400], [50, 500], [450, 350], [200, 300], [150, 450], [350, 250], [500, 600], [650, 550]]) == 2700\n assert candidate(costs = [[100, 200], [150, 250], [300, 100], [400, 150], [500, 500], [250, 350], [100, 400], [200, 500], [350, 250], [500, 450]]) == 2250\n assert candidate(costs = [[888, 111], [777, 222], [666, 333], [555, 444], [444, 555], [333, 666], [222, 777], [111, 888]]) == 2220\n assert candidate(costs = [[100, 101], [102, 103], [104, 105], [106, 107], [108, 109], [110, 111], [112, 113], [114, 115], [116, 117], [118, 119], [120, 121], [122, 123], [124, 125], [126, 127], [128, 129], [130, 131], [132, 133], [134, 135], [136, 137], [138, 139], [140, 141], [142, 143], [144, 145], [146, 147], [148, 149], [150, 151]]) == 3263\n assert candidate(costs = [[800, 700], [700, 800], [600, 900], [900, 600], [500, 1000], [1000, 500], [400, 1100], [1100, 400]]) == 4400\n assert candidate(costs = [[123, 456], [789, 101], [112, 223], [334, 445], [556, 667], [778, 889], [990, 1001], [102, 203]]) == 3319\n assert candidate(costs = [[10, 20], [30, 200], [400, 50], [30, 20], [10, 20], [30, 200], [400, 50], [30, 20]]) == 220\n assert candidate(costs = [[50, 1000], [200, 300], [400, 600], [300, 800], [700, 100], [100, 750], [600, 550], [800, 400]]) == 2200\n assert candidate(costs = [[101, 99], [99, 101], [102, 98], [98, 102], [103, 97], [97, 103], [104, 96], [96, 104], [105, 95], [95, 105], [106, 94], [94, 106], [107, 93], [93, 107], [108, 92], [92, 108], [109, 91], [91, 109]]) == 1710\n assert candidate(costs = [[100, 200], [200, 300], [300, 100], [400, 500], [500, 400], [600, 300], [700, 600], [800, 700], [900, 800], [1000, 900], [1100, 1000], [1200, 1100]]) == 6900\n assert candidate(costs = [[999, 1], [1, 999], [998, 2], [2, 998], [997, 3], [3, 997], [996, 4], [4, 996], [995, 5], [5, 995], [994, 6], [6, 994], [993, 7], [7, 993], [992, 8], [8, 992]]) == 72\n assert candidate(costs = [[1, 1000], [2, 999], [3, 998], [4, 997], [5, 996], [6, 995], [7, 994], [8, 993]]) == 3988\n assert candidate(costs = [[500, 600], [600, 500], [700, 800], [800, 700], [900, 1000], [1000, 900], [1100, 1200], [1200, 1100], [1300, 1400], [1400, 1300], [1500, 1600], [1600, 1500], [1700, 1800], [1800, 1700], [1900, 2000], [2000, 1900]]) == 19200\n assert candidate(costs = [[500, 400], [250, 600], [1000, 500], [300, 200], [600, 700], [100, 100], [400, 300], [350, 450], [700, 600], [800, 200]]) == 3600\n assert candidate(costs = [[1, 1000], [1000, 1], [2, 999], [999, 2], [3, 998], [998, 3], [4, 997], [997, 4], [5, 996], [996, 5], [6, 995], [995, 6]]) == 42\n assert candidate(costs = [[100, 900], [200, 800], [300, 700], [400, 600], [500, 500], [600, 400], [700, 300], [800, 200], [900, 100], [1000, 0]]) == 2500\n assert candidate(costs = [[100, 200], [150, 250], [200, 300], [250, 350], [300, 400], [350, 450], [400, 500], [450, 550]]) == 2600\n assert candidate(costs = [[100, 900], [900, 100], [200, 800], [800, 200], [300, 700], [700, 300], [400, 600], [600, 400]]) == 2000\n assert candidate(costs = [[100, 900], [900, 100], [150, 650], [700, 300], [200, 800], [800, 200], [400, 500], [600, 400]]) == 1850\n assert candidate(costs = [[100, 500], [200, 400], [300, 300], [400, 200], [500, 100], [600, 600], [700, 700], [800, 800], [900, 900], [1000, 1000], [1100, 1100], [1200, 1200]]) == 7200\n assert candidate(costs = [[10, 100], [20, 90], [30, 80], [40, 70], [50, 60], [60, 50], [70, 40], [80, 30], [90, 20], [100, 10]]) == 300\n assert candidate(costs = [[500, 100], [200, 400], [600, 300], [700, 200], [100, 500], [400, 600], [300, 700], [200, 100]]) == 1700\n assert candidate(costs = [[300, 100], [100, 300], [500, 200], [200, 500], [700, 400], [400, 700], [900, 600], [600, 900], [1100, 800], [800, 1100]]) == 4200\n assert candidate(costs = [[100, 900], [900, 100], [200, 800], [800, 200], [300, 700], [700, 300], [400, 600], [600, 400], [500, 500], [500, 500], [400, 600], [600, 400], [300, 700], [700, 300], [200, 800], [800, 200], [100, 900], [900, 100]]) == 5000\n assert candidate(costs = [[1, 999], [1, 998], [1, 997], [1, 996], [1, 995], [1, 994], [1, 993], [1, 992]]) == 3978\n assert candidate(costs = [[50, 50], [60, 60], [70, 70], [80, 80], [90, 90], [100, 100], [110, 110], [120, 120], [130, 130], [140, 140], [150, 150], [160, 160], [170, 170], [180, 180]]) == 1610\n assert candidate(costs = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]) == 36\n assert candidate(costs = [[500, 600], [400, 500], [300, 400], [200, 300], [100, 200], [50, 100], [600, 500], [700, 600], [800, 700], [900, 800], [1000, 900], [1100, 1000]]) == 6050\n assert candidate(costs = [[1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7], [9, 10], [10, 9], [11, 12], [12, 11], [13, 14], [14, 13], [15, 16], [16, 15]]) == 128\n assert candidate(costs = [[10, 100], [20, 200], [30, 300], [40, 400], [50, 500], [60, 600], [70, 700], [80, 800], [90, 900], [100, 1000], [110, 1100], [120, 1200], [130, 1300], [140, 1400]]) == 3570\n assert candidate(costs = [[10, 1000], [15, 995], [20, 990], [25, 985], [30, 980], [35, 975], [40, 970], [45, 965], [50, 960], [55, 955], [60, 950], [65, 945], [70, 940], [75, 935], [80, 930], [85, 925], [90, 920], [95, 915], [100, 910], [105, 905]]) == 9600\n assert candidate(costs = [[900, 1000], [800, 800], [700, 900], [600, 700], [500, 600], [400, 500], [300, 400], [200, 300], [100, 200], [50, 100]]) == 4900\n assert candidate(costs = [[150, 300], [250, 200], [350, 250], [100, 200], [200, 150], [150, 250], [300, 100], [200, 350]]) == 1300\n assert candidate(costs = [[120, 600], [300, 1000], [400, 800], [500, 900], [1000, 200], [700, 750], [600, 600], [800, 500]]) == 3370\n assert candidate(costs = [[1, 999], [999, 1], [2, 998], [998, 2], [3, 997], [997, 3], [4, 996], [996, 4], [5, 995], [995, 5]]) == 30\n assert candidate(costs = [[200, 500], [300, 400], [100, 600], [250, 350], [150, 450], [50, 550], [350, 250], [600, 100]]) == 1600\n assert candidate(costs = [[123, 456], [456, 123], [789, 321], [321, 789], [234, 567], [567, 234], [890, 123], [123, 890]]) == 1602\n assert candidate(costs = [[100, 1000], [200, 900], [300, 800], [400, 700], [500, 600], [600, 500], [700, 400], [800, 300]]) == 2800\n assert candidate(costs = [[343, 819], [855, 779], [457, 60], [650, 359], [631, 42], [515, 563], [451, 713], [537, 709]]) == 3086\n assert candidate(costs = [[50, 200], [150, 100], [200, 50], [100, 150], [250, 200], [200, 250], [300, 350], [350, 300], [400, 450], [450, 400], [500, 550], [550, 500], [600, 650], [650, 600], [700, 750], [750, 700]]) == 5700\n assert candidate(costs = [[150, 200], [100, 150], [120, 170], [110, 160], [130, 180], [140, 190], [160, 210], [170, 220], [180, 230], [190, 240], [200, 250], [210, 260], [220, 270], [230, 280]]) == 2660\n assert candidate(costs = [[550, 500], [500, 550], [450, 520], [520, 450], [600, 470], [470, 600], [650, 480], [480, 650]]) == 3800\n assert candidate(costs = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50], [60, 60], [70, 70], [80, 80]]) == 360\n assert candidate(costs = [[500, 600], [400, 300], [200, 100], [800, 700], [600, 500], [900, 1000], [300, 400], [700, 800]]) == 4000\n assert candidate(costs = [[200, 100], [100, 200], [300, 200], [200, 300], [400, 300], [300, 400], [500, 400], [400, 500]]) == 2000\n assert candidate(costs = [[1, 999], [999, 1], [100, 900], [900, 100], [50, 950], [950, 50], [150, 850], [850, 150]]) == 602\n assert candidate(costs = [[100, 200], [200, 300], [300, 100], [400, 200], [500, 400], [600, 300], [700, 500], [800, 600], [900, 700], [1000, 800]]) == 4400\n assert candidate(costs = [[999, 1], [1, 999], [998, 2], [2, 998], [997, 3], [3, 997], [996, 4], [4, 996]]) == 20\n assert candidate(costs = [[10, 20], [30, 200], [400, 50], [30, 20], [5, 25], [35, 15], [25, 5], [15, 30], [100, 200], [300, 400], [40, 500], [50, 40]]) == 640\n assert candidate(costs = [[100, 200], [150, 250], [200, 300], [250, 350], [300, 400], [350, 450], [400, 500], [450, 550], [500, 600], [550, 650], [600, 700], [650, 750]]) == 5100\n assert candidate(costs = [[1, 1000], [1000, 1], [2, 999], [999, 2], [3, 998], [998, 3], [4, 997], [997, 4], [5, 996], [996, 5], [6, 995], [995, 6], [7, 994], [994, 7], [8, 993], [993, 8]]) == 72\n assert candidate(costs = [[800, 8], [700, 7], [600, 6], [500, 5], [400, 4], [300, 3], [200, 2], [100, 1]]) == 1026\n assert candidate(costs = [[100, 300], [200, 100], [400, 600], [500, 200], [700, 500], [800, 400], [1000, 700], [1200, 600], [1400, 900], [1500, 800]]) == 5300\n assert candidate(costs = [[500, 1], [1, 500], [250, 2], [2, 250], [125, 3], [3, 125], [625, 4], [4, 625]]) == 20\n assert candidate(costs = [[100, 150], [200, 250], [300, 350], [400, 450], [500, 550], [600, 650], [700, 750], [800, 850]]) == 3800\n assert candidate(costs = [[200, 300], [100, 400], [300, 200], [500, 400], [100, 500], [200, 600], [300, 300], [400, 100], [500, 200], [600, 300], [700, 400], [800, 500]]) == 3100\n assert candidate(costs = [[1, 1000], [10, 990], [100, 900], [1000, 100], [900, 200], [800, 300], [700, 400], [600, 500], [500, 600], [400, 700], [300, 800], [200, 900], [100, 1000], [10, 990], [1, 1000], [0, 1001], [1001, 0], [999, 2], [3, 997], [50, 950], [950, 50]]) == 4127\n assert candidate(costs = [[100, 1], [200, 2], [300, 3], [400, 4], [500, 5], [600, 6], [700, 7], [800, 8]]) == 1026\n assert candidate(costs = [[100, 100], [101, 99], [99, 101], [98, 102], [102, 98], [103, 97], [97, 103], [96, 104]]) == 784\n assert candidate(costs = [[50, 100], [75, 125], [25, 50], [100, 200], [150, 175], [200, 300], [350, 450], [400, 500], [450, 600], [550, 700]]) == 2600\n assert candidate(costs = [[200, 300], [300, 400], [500, 600], [600, 700], [800, 900], [900, 1000], [1100, 1200], [1200, 1300], [1300, 1400], [1400, 1500]]) == 8800\n"}, "metadata": {"canonical_parameter_names": ["costs"], "leetcode_dataset_entry_point": "Solution().twoCitySchedCost", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var twoCitySchedCost = function(costs) {", "container": null, "callable": "twoCitySchedCost", "parameters": [{"name": "costs", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1030, "task_id": "matrix-cells-in-distance-order", "difficulty": "Easy", "problem_description": "You are given four integers row, cols, rCenter, and cCenter. There is a rows x cols matrix and you are on the cell with the coordinates (rCenter, cCenter).\nReturn the coordinates of all cells in the matrix, sorted by their distance from (rCenter, cCenter) from the smallest distance to the largest distance. You may return the answer in any order that satisfies this condition.\nThe distance between two cells (r1, c1) and (r2, c2) is |r1 - r2| + |c1 - c2|.\n \nExample 1:\n\nInput: rows = 1, cols = 2, rCenter = 0, cCenter = 0\nOutput: [[0,0],[0,1]]\nExplanation: The distances from (0, 0) to other cells are: [0,1]\n\nExample 2:\n\nInput: rows = 2, cols = 2, rCenter = 0, cCenter = 1\nOutput: [[0,1],[0,0],[1,1],[1,0]]\nExplanation: The distances from (0, 1) to other cells are: [0,1,1,2]\nThe answer [[0,1],[1,1],[0,0],[1,0]] would also be accepted as correct.\n\nExample 3:\n\nInput: rows = 2, cols = 3, rCenter = 1, cCenter = 2\nOutput: [[1,2],[0,2],[1,1],[0,1],[1,0],[0,0]]\nExplanation: The distances from (1, 2) to other cells are: [0,1,1,2,2,3]\nThere are other answers that would also be accepted as correct, such as [[1,2],[1,1],[0,2],[1,0],[0,1],[0,0]].\n\n \nConstraints:\n\n1 <= rows, cols <= 100\n0 <= rCenter < rows\n0 <= cCenter < cols\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(rows = 5,cols = 7,rCenter = 3,cCenter = 4) == [[3, 4], [2, 4], [3, 5], [4, 4], [3, 3], [1, 4], [2, 5], [2, 3], [3, 6], [4, 5], [4, 3], [3, 2], [0, 4], [1, 5], [1, 3], [2, 6], [2, 2], [4, 6], [4, 2], [3, 1], [0, 5], [0, 3], [1, 6], [1, 2], [2, 1], [4, 1], [3, 0], [0, 6], [0, 2], [1, 1], [2, 0], [4, 0], [0, 1], [1, 0], [0, 0]]\n assert candidate(rows = 2,cols = 3,rCenter = 1,cCenter = 2) == [[1, 2], [0, 2], [1, 1], [0, 1], [1, 0], [0, 0]]\n assert candidate(rows = 3,cols = 4,rCenter = 1,cCenter = 1) == [[1, 1], [0, 1], [1, 2], [2, 1], [1, 0], [0, 2], [0, 0], [1, 3], [2, 2], [2, 0], [0, 3], [2, 3]]\n assert candidate(rows = 4,cols = 4,rCenter = 2,cCenter = 2) == [[2, 2], [1, 2], [2, 3], [3, 2], [2, 1], [0, 2], [1, 3], [1, 1], [3, 3], [3, 1], [2, 0], [0, 3], [0, 1], [1, 0], [3, 0], [0, 0]]\n assert candidate(rows = 5,cols = 5,rCenter = 2,cCenter = 2) == [[2, 2], [1, 2], [2, 3], [3, 2], [2, 1], [0, 2], [1, 3], [1, 1], [2, 4], [3, 3], [4, 2], [3, 1], [2, 0], [0, 3], [0, 1], [1, 4], [1, 0], [3, 4], [4, 3], [4, 1], [3, 0], [0, 4], [0, 0], [4, 4], [4, 0]]\n assert candidate(rows = 1,cols = 2,rCenter = 0,cCenter = 0) == [[0, 0], [0, 1]]\n assert candidate(rows = 4,cols = 4,rCenter = 0,cCenter = 0) == [[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, 0], [0, 3], [1, 2], [2, 1], [3, 0], [1, 3], [2, 2], [3, 1], [2, 3], [3, 2], [3, 3]]\n assert candidate(rows = 3,cols = 3,rCenter = 2,cCenter = 2) == [[2, 2], [1, 2], [2, 1], [0, 2], [1, 1], [2, 0], [0, 1], [1, 0], [0, 0]]\n assert candidate(rows = 10,cols = 10,rCenter = 5,cCenter = 5) == [[5, 5], [4, 5], [5, 6], [6, 5], [5, 4], [3, 5], [4, 6], [4, 4], [5, 7], [6, 6], [7, 5], [6, 4], [5, 3], [2, 5], [3, 6], [3, 4], [4, 7], [4, 3], [5, 8], [6, 7], [7, 6], [8, 5], [7, 4], [6, 3], [5, 2], [1, 5], [2, 6], [2, 4], [3, 7], [3, 3], [4, 8], [4, 2], [5, 9], [6, 8], [7, 7], [8, 6], [9, 5], [8, 4], [7, 3], [6, 2], [5, 1], [0, 5], [1, 6], [1, 4], [2, 7], [2, 3], [3, 8], [3, 2], [4, 9], [4, 1], [6, 9], [7, 8], [8, 7], [9, 6], [9, 4], [8, 3], [7, 2], [6, 1], [5, 0], [0, 6], [0, 4], [1, 7], [1, 3], [2, 8], [2, 2], [3, 9], [3, 1], [4, 0], [7, 9], [8, 8], [9, 7], [9, 3], [8, 2], [7, 1], [6, 0], [0, 7], [0, 3], [1, 8], [1, 2], [2, 9], [2, 1], [3, 0], [8, 9], [9, 8], [9, 2], [8, 1], [7, 0], [0, 8], [0, 2], [1, 9], [1, 1], [2, 0], [9, 9], [9, 1], [8, 0], [0, 9], [0, 1], [1, 0], [9, 0], [0, 0]]\n assert candidate(rows = 2,cols = 2,rCenter = 0,cCenter = 1) == [[0, 1], [1, 1], [0, 0], [1, 0]]\n assert candidate(rows = 3,cols = 3,rCenter = 1,cCenter = 1) == [[1, 1], [0, 1], [1, 2], [2, 1], [1, 0], [0, 2], [0, 0], [2, 2], [2, 0]]\n assert candidate(rows = 3,cols = 3,rCenter = 0,cCenter = 0) == [[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, 0], [1, 2], [2, 1], [2, 2]]\n assert candidate(rows = 4,cols = 7,rCenter = 3,cCenter = 0) == [[3, 0], [2, 0], [3, 1], [1, 0], [2, 1], [3, 2], [0, 0], [1, 1], [2, 2], [3, 3], [0, 1], [1, 2], [2, 3], [3, 4], [0, 2], [1, 3], [2, 4], [3, 5], [0, 3], [1, 4], [2, 5], [3, 6], [0, 4], [1, 5], [2, 6], [0, 5], [1, 6], [0, 6]]\n assert candidate(rows = 50,cols = 30,rCenter = 25,cCenter = 15) == [[25, 15], [24, 15], [25, 16], [26, 15], [25, 14], [23, 15], [24, 16], [24, 14], [25, 17], [26, 16], [27, 15], [26, 14], [25, 13], [22, 15], [23, 16], [23, 14], [24, 17], [24, 13], [25, 18], [26, 17], [27, 16], [28, 15], [27, 14], [26, 13], [25, 12], [21, 15], [22, 16], [22, 14], [23, 17], [23, 13], [24, 18], [24, 12], [25, 19], [26, 18], [27, 17], [28, 16], [29, 15], [28, 14], [27, 13], [26, 12], [25, 11], [20, 15], [21, 16], [21, 14], [22, 17], [22, 13], [23, 18], [23, 12], [24, 19], [24, 11], [25, 20], [26, 19], [27, 18], [28, 17], [29, 16], [30, 15], [29, 14], [28, 13], [27, 12], [26, 11], [25, 10], [19, 15], [20, 16], [20, 14], [21, 17], [21, 13], [22, 18], [22, 12], [23, 19], [23, 11], [24, 20], [24, 10], [25, 21], [26, 20], [27, 19], [28, 18], [29, 17], [30, 16], [31, 15], [30, 14], [29, 13], [28, 12], [27, 11], [26, 10], [25, 9], [18, 15], [19, 16], [19, 14], [20, 17], [20, 13], [21, 18], [21, 12], [22, 19], [22, 11], [23, 20], [23, 10], [24, 21], [24, 9], [25, 22], [26, 21], [27, 20], [28, 19], [29, 18], [30, 17], [31, 16], [32, 15], [31, 14], [30, 13], [29, 12], [28, 11], [27, 10], [26, 9], [25, 8], [17, 15], [18, 16], [18, 14], [19, 17], [19, 13], [20, 18], [20, 12], [21, 19], [21, 11], [22, 20], [22, 10], [23, 21], [23, 9], [24, 22], [24, 8], [25, 23], [26, 22], [27, 21], [28, 20], [29, 19], [30, 18], [31, 17], [32, 16], [33, 15], [32, 14], [31, 13], [30, 12], [29, 11], [28, 10], [27, 9], [26, 8], [25, 7], [16, 15], [17, 16], [17, 14], [18, 17], [18, 13], [19, 18], [19, 12], [20, 19], [20, 11], [21, 20], [21, 10], [22, 21], [22, 9], [23, 22], [23, 8], [24, 23], [24, 7], [25, 24], [26, 23], [27, 22], [28, 21], [29, 20], [30, 19], [31, 18], [32, 17], [33, 16], [34, 15], [33, 14], [32, 13], [31, 12], [30, 11], [29, 10], [28, 9], [27, 8], [26, 7], [25, 6], [15, 15], [16, 16], [16, 14], [17, 17], [17, 13], [18, 18], [18, 12], [19, 19], [19, 11], [20, 20], [20, 10], [21, 21], [21, 9], [22, 22], [22, 8], [23, 23], [23, 7], [24, 24], [24, 6], [25, 25], [26, 24], [27, 23], [28, 22], [29, 21], [30, 20], [31, 19], [32, 18], [33, 17], [34, 16], [35, 15], [34, 14], [33, 13], [32, 12], [31, 11], [30, 10], [29, 9], [28, 8], [27, 7], [26, 6], [25, 5], [14, 15], [15, 16], [15, 14], [16, 17], [16, 13], [17, 18], [17, 12], [18, 19], [18, 11], [19, 20], [19, 10], [20, 21], [20, 9], [21, 22], [21, 8], [22, 23], [22, 7], [23, 24], [23, 6], [24, 25], [24, 5], [25, 26], [26, 25], [27, 24], [28, 23], [29, 22], [30, 21], [31, 20], [32, 19], [33, 18], [34, 17], [35, 16], [36, 15], [35, 14], [34, 13], [33, 12], [32, 11], [31, 10], [30, 9], [29, 8], [28, 7], [27, 6], [26, 5], [25, 4], [13, 15], [14, 16], [14, 14], [15, 17], [15, 13], [16, 18], [16, 12], [17, 19], [17, 11], [18, 20], [18, 10], [19, 21], [19, 9], [20, 22], [20, 8], [21, 23], [21, 7], [22, 24], [22, 6], [23, 25], [23, 5], [24, 26], [24, 4], [25, 27], [26, 26], [27, 25], [28, 24], [29, 23], [30, 22], [31, 21], [32, 20], [33, 19], [34, 18], [35, 17], [36, 16], [37, 15], [36, 14], [35, 13], [34, 12], [33, 11], [32, 10], [31, 9], [30, 8], [29, 7], [28, 6], [27, 5], [26, 4], [25, 3], [12, 15], [13, 16], [13, 14], [14, 17], [14, 13], [15, 18], [15, 12], [16, 19], [16, 11], [17, 20], [17, 10], [18, 21], [18, 9], [19, 22], [19, 8], [20, 23], [20, 7], [21, 24], [21, 6], [22, 25], [22, 5], [23, 26], [23, 4], [24, 27], [24, 3], [25, 28], [26, 27], [27, 26], [28, 25], [29, 24], [30, 23], [31, 22], [32, 21], [33, 20], [34, 19], [35, 18], [36, 17], [37, 16], [38, 15], [37, 14], [36, 13], [35, 12], [34, 11], [33, 10], [32, 9], [31, 8], [30, 7], [29, 6], [28, 5], [27, 4], [26, 3], [25, 2], [11, 15], [12, 16], [12, 14], [13, 17], [13, 13], [14, 18], [14, 12], [15, 19], [15, 11], [16, 20], [16, 10], [17, 21], [17, 9], [18, 22], [18, 8], [19, 23], [19, 7], [20, 24], [20, 6], [21, 25], [21, 5], [22, 26], [22, 4], [23, 27], [23, 3], [24, 28], [24, 2], [25, 29], [26, 28], [27, 27], [28, 26], [29, 25], [30, 24], [31, 23], [32, 22], [33, 21], [34, 20], [35, 19], [36, 18], [37, 17], [38, 16], [39, 15], [38, 14], [37, 13], [36, 12], [35, 11], [34, 10], [33, 9], [32, 8], [31, 7], [30, 6], [29, 5], [28, 4], [27, 3], [26, 2], [25, 1], [10, 15], [11, 16], [11, 14], [12, 17], [12, 13], [13, 18], [13, 12], [14, 19], [14, 11], [15, 20], [15, 10], [16, 21], [16, 9], [17, 22], [17, 8], [18, 23], [18, 7], [19, 24], [19, 6], [20, 25], [20, 5], [21, 26], [21, 4], [22, 27], [22, 3], [23, 28], [23, 2], [24, 29], [24, 1], [26, 29], [27, 28], [28, 27], [29, 26], [30, 25], [31, 24], [32, 23], [33, 22], [34, 21], [35, 20], [36, 19], [37, 18], [38, 17], [39, 16], [40, 15], [39, 14], [38, 13], [37, 12], [36, 11], [35, 10], [34, 9], [33, 8], [32, 7], [31, 6], [30, 5], [29, 4], [28, 3], [27, 2], [26, 1], [25, 0], [9, 15], [10, 16], [10, 14], [11, 17], [11, 13], [12, 18], [12, 12], [13, 19], [13, 11], [14, 20], [14, 10], [15, 21], [15, 9], [16, 22], [16, 8], [17, 23], [17, 7], [18, 24], [18, 6], [19, 25], [19, 5], [20, 26], [20, 4], [21, 27], [21, 3], [22, 28], [22, 2], [23, 29], [23, 1], [24, 0], [27, 29], [28, 28], [29, 27], [30, 26], [31, 25], [32, 24], [33, 23], [34, 22], [35, 21], [36, 20], [37, 19], [38, 18], [39, 17], [40, 16], [41, 15], [40, 14], [39, 13], [38, 12], [37, 11], [36, 10], [35, 9], [34, 8], [33, 7], [32, 6], [31, 5], [30, 4], [29, 3], [28, 2], [27, 1], [26, 0], [8, 15], [9, 16], [9, 14], [10, 17], [10, 13], [11, 18], [11, 12], [12, 19], [12, 11], [13, 20], [13, 10], [14, 21], [14, 9], [15, 22], [15, 8], [16, 23], [16, 7], [17, 24], [17, 6], [18, 25], [18, 5], [19, 26], [19, 4], [20, 27], [20, 3], [21, 28], [21, 2], [22, 29], [22, 1], [23, 0], [28, 29], [29, 28], [30, 27], [31, 26], [32, 25], [33, 24], [34, 23], [35, 22], [36, 21], [37, 20], [38, 19], [39, 18], [40, 17], [41, 16], [42, 15], [41, 14], [40, 13], [39, 12], [38, 11], [37, 10], [36, 9], [35, 8], [34, 7], [33, 6], [32, 5], [31, 4], [30, 3], [29, 2], [28, 1], [27, 0], [7, 15], [8, 16], [8, 14], [9, 17], [9, 13], [10, 18], [10, 12], [11, 19], [11, 11], [12, 20], [12, 10], [13, 21], [13, 9], [14, 22], [14, 8], [15, 23], [15, 7], [16, 24], [16, 6], [17, 25], [17, 5], [18, 26], [18, 4], [19, 27], [19, 3], [20, 28], [20, 2], [21, 29], [21, 1], [22, 0], [29, 29], [30, 28], [31, 27], [32, 26], [33, 25], [34, 24], [35, 23], [36, 22], [37, 21], [38, 20], [39, 19], [40, 18], [41, 17], [42, 16], [43, 15], [42, 14], [41, 13], [40, 12], [39, 11], [38, 10], [37, 9], [36, 8], [35, 7], [34, 6], [33, 5], [32, 4], [31, 3], [30, 2], [29, 1], [28, 0], [6, 15], [7, 16], [7, 14], [8, 17], [8, 13], [9, 18], [9, 12], [10, 19], [10, 11], [11, 20], [11, 10], [12, 21], [12, 9], [13, 22], [13, 8], [14, 23], [14, 7], [15, 24], [15, 6], [16, 25], [16, 5], [17, 26], [17, 4], [18, 27], [18, 3], [19, 28], [19, 2], [20, 29], [20, 1], [21, 0], [30, 29], [31, 28], [32, 27], [33, 26], [34, 25], [35, 24], [36, 23], [37, 22], [38, 21], [39, 20], [40, 19], [41, 18], [42, 17], [43, 16], [44, 15], [43, 14], [42, 13], [41, 12], [40, 11], [39, 10], [38, 9], [37, 8], [36, 7], [35, 6], [34, 5], [33, 4], [32, 3], [31, 2], [30, 1], [29, 0], [5, 15], [6, 16], [6, 14], [7, 17], [7, 13], [8, 18], [8, 12], [9, 19], [9, 11], [10, 20], [10, 10], [11, 21], [11, 9], [12, 22], [12, 8], [13, 23], [13, 7], [14, 24], [14, 6], [15, 25], [15, 5], [16, 26], [16, 4], [17, 27], [17, 3], [18, 28], [18, 2], [19, 29], [19, 1], [20, 0], [31, 29], [32, 28], [33, 27], [34, 26], [35, 25], [36, 24], [37, 23], [38, 22], [39, 21], [40, 20], [41, 19], [42, 18], [43, 17], [44, 16], [45, 15], [44, 14], [43, 13], [42, 12], [41, 11], [40, 10], [39, 9], [38, 8], [37, 7], [36, 6], [35, 5], [34, 4], [33, 3], [32, 2], [31, 1], [30, 0], [4, 15], [5, 16], [5, 14], [6, 17], [6, 13], [7, 18], [7, 12], [8, 19], [8, 11], [9, 20], [9, 10], [10, 21], [10, 9], [11, 22], [11, 8], [12, 23], [12, 7], [13, 24], [13, 6], [14, 25], [14, 5], [15, 26], [15, 4], [16, 27], [16, 3], [17, 28], [17, 2], [18, 29], [18, 1], [19, 0], [32, 29], [33, 28], [34, 27], [35, 26], [36, 25], [37, 24], [38, 23], [39, 22], [40, 21], [41, 20], [42, 19], [43, 18], [44, 17], [45, 16], [46, 15], [45, 14], [44, 13], [43, 12], [42, 11], [41, 10], [40, 9], [39, 8], [38, 7], [37, 6], [36, 5], [35, 4], [34, 3], [33, 2], [32, 1], [31, 0], [3, 15], [4, 16], [4, 14], [5, 17], [5, 13], [6, 18], [6, 12], [7, 19], [7, 11], [8, 20], [8, 10], [9, 21], [9, 9], [10, 22], [10, 8], [11, 23], [11, 7], [12, 24], [12, 6], [13, 25], [13, 5], [14, 26], [14, 4], [15, 27], [15, 3], [16, 28], [16, 2], [17, 29], [17, 1], [18, 0], [33, 29], [34, 28], [35, 27], [36, 26], [37, 25], [38, 24], [39, 23], [40, 22], [41, 21], [42, 20], [43, 19], [44, 18], [45, 17], [46, 16], [47, 15], [46, 14], [45, 13], [44, 12], [43, 11], [42, 10], [41, 9], [40, 8], [39, 7], [38, 6], [37, 5], [36, 4], [35, 3], [34, 2], [33, 1], [32, 0], [2, 15], [3, 16], [3, 14], [4, 17], [4, 13], [5, 18], [5, 12], [6, 19], [6, 11], [7, 20], [7, 10], [8, 21], [8, 9], [9, 22], [9, 8], [10, 23], [10, 7], [11, 24], [11, 6], [12, 25], [12, 5], [13, 26], [13, 4], [14, 27], [14, 3], [15, 28], [15, 2], [16, 29], [16, 1], [17, 0], [34, 29], [35, 28], [36, 27], [37, 26], [38, 25], [39, 24], [40, 23], [41, 22], [42, 21], [43, 20], [44, 19], [45, 18], [46, 17], [47, 16], [48, 15], [47, 14], [46, 13], [45, 12], [44, 11], [43, 10], [42, 9], [41, 8], [40, 7], [39, 6], [38, 5], [37, 4], [36, 3], [35, 2], [34, 1], [33, 0], [1, 15], [2, 16], [2, 14], [3, 17], [3, 13], [4, 18], [4, 12], [5, 19], [5, 11], [6, 20], [6, 10], [7, 21], [7, 9], [8, 22], [8, 8], [9, 23], [9, 7], [10, 24], [10, 6], [11, 25], [11, 5], [12, 26], [12, 4], [13, 27], [13, 3], [14, 28], [14, 2], [15, 29], [15, 1], [16, 0], [35, 29], [36, 28], [37, 27], [38, 26], [39, 25], [40, 24], [41, 23], [42, 22], [43, 21], [44, 20], [45, 19], [46, 18], [47, 17], [48, 16], [49, 15], [48, 14], [47, 13], [46, 12], [45, 11], [44, 10], [43, 9], [42, 8], [41, 7], [40, 6], [39, 5], [38, 4], [37, 3], [36, 2], [35, 1], [34, 0], [0, 15], [1, 16], [1, 14], [2, 17], [2, 13], [3, 18], [3, 12], [4, 19], [4, 11], [5, 20], [5, 10], [6, 21], [6, 9], [7, 22], [7, 8], [8, 23], [8, 7], [9, 24], [9, 6], [10, 25], [10, 5], [11, 26], [11, 4], [12, 27], [12, 3], [13, 28], [13, 2], [14, 29], [14, 1], [15, 0], [36, 29], [37, 28], [38, 27], [39, 26], [40, 25], [41, 24], [42, 23], [43, 22], [44, 21], [45, 20], [46, 19], [47, 18], [48, 17], [49, 16], [49, 14], [48, 13], [47, 12], [46, 11], [45, 10], [44, 9], [43, 8], [42, 7], [41, 6], [40, 5], [39, 4], [38, 3], [37, 2], [36, 1], [35, 0], [0, 16], [0, 14], [1, 17], [1, 13], [2, 18], [2, 12], [3, 19], [3, 11], [4, 20], [4, 10], [5, 21], [5, 9], [6, 22], [6, 8], [7, 23], [7, 7], [8, 24], [8, 6], [9, 25], [9, 5], [10, 26], [10, 4], [11, 27], [11, 3], [12, 28], [12, 2], [13, 29], [13, 1], [14, 0], [37, 29], [38, 28], [39, 27], [40, 26], [41, 25], [42, 24], [43, 23], [44, 22], [45, 21], [46, 20], [47, 19], [48, 18], [49, 17], [49, 13], [48, 12], [47, 11], [46, 10], [45, 9], [44, 8], [43, 7], [42, 6], [41, 5], [40, 4], [39, 3], [38, 2], [37, 1], [36, 0], [0, 17], [0, 13], [1, 18], [1, 12], [2, 19], [2, 11], [3, 20], [3, 10], [4, 21], [4, 9], [5, 22], [5, 8], [6, 23], [6, 7], [7, 24], [7, 6], [8, 25], [8, 5], [9, 26], [9, 4], [10, 27], [10, 3], [11, 28], [11, 2], [12, 29], [12, 1], [13, 0], [38, 29], [39, 28], [40, 27], [41, 26], [42, 25], [43, 24], [44, 23], [45, 22], [46, 21], [47, 20], [48, 19], [49, 18], [49, 12], [48, 11], [47, 10], [46, 9], [45, 8], [44, 7], [43, 6], [42, 5], [41, 4], [40, 3], [39, 2], [38, 1], [37, 0], [0, 18], [0, 12], [1, 19], [1, 11], [2, 20], [2, 10], [3, 21], [3, 9], [4, 22], [4, 8], [5, 23], [5, 7], [6, 24], [6, 6], [7, 25], [7, 5], [8, 26], [8, 4], [9, 27], [9, 3], [10, 28], [10, 2], [11, 29], [11, 1], [12, 0], [39, 29], [40, 28], [41, 27], [42, 26], [43, 25], [44, 24], [45, 23], [46, 22], [47, 21], [48, 20], [49, 19], [49, 11], [48, 10], [47, 9], [46, 8], [45, 7], [44, 6], [43, 5], [42, 4], [41, 3], [40, 2], [39, 1], [38, 0], [0, 19], [0, 11], [1, 20], [1, 10], [2, 21], [2, 9], [3, 22], [3, 8], [4, 23], [4, 7], [5, 24], [5, 6], [6, 25], [6, 5], [7, 26], [7, 4], [8, 27], [8, 3], [9, 28], [9, 2], [10, 29], [10, 1], [11, 0], [40, 29], [41, 28], [42, 27], [43, 26], [44, 25], [45, 24], [46, 23], [47, 22], [48, 21], [49, 20], [49, 10], [48, 9], [47, 8], [46, 7], [45, 6], [44, 5], [43, 4], [42, 3], [41, 2], [40, 1], [39, 0], [0, 20], [0, 10], [1, 21], [1, 9], [2, 22], [2, 8], [3, 23], [3, 7], [4, 24], [4, 6], [5, 25], [5, 5], [6, 26], [6, 4], [7, 27], [7, 3], [8, 28], [8, 2], [9, 29], [9, 1], [10, 0], [41, 29], [42, 28], [43, 27], [44, 26], [45, 25], [46, 24], [47, 23], [48, 22], [49, 21], [49, 9], [48, 8], [47, 7], [46, 6], [45, 5], [44, 4], [43, 3], [42, 2], [41, 1], [40, 0], [0, 21], [0, 9], [1, 22], [1, 8], [2, 23], [2, 7], [3, 24], [3, 6], [4, 25], [4, 5], [5, 26], [5, 4], [6, 27], [6, 3], [7, 28], [7, 2], [8, 29], [8, 1], [9, 0], [42, 29], [43, 28], [44, 27], [45, 26], [46, 25], [47, 24], [48, 23], [49, 22], [49, 8], [48, 7], [47, 6], [46, 5], [45, 4], [44, 3], [43, 2], [42, 1], [41, 0], [0, 22], [0, 8], [1, 23], [1, 7], [2, 24], [2, 6], [3, 25], [3, 5], [4, 26], [4, 4], [5, 27], [5, 3], [6, 28], [6, 2], [7, 29], [7, 1], [8, 0], [43, 29], [44, 28], [45, 27], [46, 26], [47, 25], [48, 24], [49, 23], [49, 7], [48, 6], [47, 5], [46, 4], [45, 3], [44, 2], [43, 1], [42, 0], [0, 23], [0, 7], [1, 24], [1, 6], [2, 25], [2, 5], [3, 26], [3, 4], [4, 27], [4, 3], [5, 28], [5, 2], [6, 29], [6, 1], [7, 0], [44, 29], [45, 28], [46, 27], [47, 26], [48, 25], [49, 24], [49, 6], [48, 5], [47, 4], [46, 3], [45, 2], [44, 1], [43, 0], [0, 24], [0, 6], [1, 25], [1, 5], [2, 26], [2, 4], [3, 27], [3, 3], [4, 28], [4, 2], [5, 29], [5, 1], [6, 0], [45, 29], [46, 28], [47, 27], [48, 26], [49, 25], [49, 5], [48, 4], [47, 3], [46, 2], [45, 1], [44, 0], [0, 25], [0, 5], [1, 26], [1, 4], [2, 27], [2, 3], [3, 28], [3, 2], [4, 29], [4, 1], [5, 0], [46, 29], [47, 28], [48, 27], [49, 26], [49, 4], [48, 3], [47, 2], [46, 1], [45, 0], [0, 26], [0, 4], [1, 27], [1, 3], [2, 28], [2, 2], [3, 29], [3, 1], [4, 0], [47, 29], [48, 28], [49, 27], [49, 3], [48, 2], [47, 1], [46, 0], [0, 27], [0, 3], [1, 28], [1, 2], [2, 29], [2, 1], [3, 0], [48, 29], [49, 28], [49, 2], [48, 1], [47, 0], [0, 28], [0, 2], [1, 29], [1, 1], [2, 0], [49, 29], [49, 1], [48, 0], [0, 29], [0, 1], [1, 0], [49, 0], [0, 0]]\n assert candidate(rows = 6,cols = 6,rCenter = 3,cCenter = 0) == [[3, 0], [2, 0], [3, 1], [4, 0], [1, 0], [2, 1], [3, 2], [4, 1], [5, 0], [0, 0], [1, 1], [2, 2], [3, 3], [4, 2], [5, 1], [0, 1], [1, 2], [2, 3], [3, 4], [4, 3], [5, 2], [0, 2], [1, 3], [2, 4], [3, 5], [4, 4], [5, 3], [0, 3], [1, 4], [2, 5], [4, 5], [5, 4], [0, 4], [1, 5], [5, 5], [0, 5]]\n assert candidate(rows = 40,cols = 40,rCenter = 0,cCenter = 0) == [[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, 0], [0, 3], [1, 2], [2, 1], [3, 0], [0, 4], [1, 3], [2, 2], [3, 1], [4, 0], [0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0], [0, 8], [1, 7], [2, 6], [3, 5], [4, 4], [5, 3], [6, 2], [7, 1], [8, 0], [0, 9], [1, 8], [2, 7], [3, 6], [4, 5], [5, 4], [6, 3], [7, 2], [8, 1], [9, 0], [0, 10], [1, 9], [2, 8], [3, 7], [4, 6], [5, 5], [6, 4], [7, 3], [8, 2], [9, 1], [10, 0], [0, 11], [1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1], [11, 0], [0, 12], [1, 11], [2, 10], [3, 9], [4, 8], [5, 7], [6, 6], [7, 5], [8, 4], [9, 3], [10, 2], [11, 1], [12, 0], [0, 13], [1, 12], [2, 11], [3, 10], [4, 9], [5, 8], [6, 7], [7, 6], [8, 5], [9, 4], [10, 3], [11, 2], [12, 1], [13, 0], [0, 14], [1, 13], [2, 12], [3, 11], [4, 10], [5, 9], [6, 8], [7, 7], [8, 6], [9, 5], [10, 4], [11, 3], [12, 2], [13, 1], [14, 0], [0, 15], [1, 14], [2, 13], [3, 12], [4, 11], [5, 10], [6, 9], [7, 8], [8, 7], [9, 6], [10, 5], [11, 4], [12, 3], [13, 2], [14, 1], [15, 0], [0, 16], [1, 15], [2, 14], [3, 13], [4, 12], [5, 11], [6, 10], [7, 9], [8, 8], [9, 7], [10, 6], [11, 5], [12, 4], [13, 3], [14, 2], [15, 1], [16, 0], [0, 17], [1, 16], [2, 15], [3, 14], [4, 13], [5, 12], [6, 11], [7, 10], [8, 9], [9, 8], [10, 7], [11, 6], [12, 5], [13, 4], [14, 3], [15, 2], [16, 1], [17, 0], [0, 18], [1, 17], [2, 16], [3, 15], [4, 14], [5, 13], [6, 12], [7, 11], [8, 10], [9, 9], [10, 8], [11, 7], [12, 6], [13, 5], [14, 4], [15, 3], [16, 2], [17, 1], [18, 0], [0, 19], [1, 18], [2, 17], [3, 16], [4, 15], [5, 14], [6, 13], [7, 12], [8, 11], [9, 10], [10, 9], [11, 8], [12, 7], [13, 6], [14, 5], [15, 4], [16, 3], [17, 2], [18, 1], [19, 0], [0, 20], [1, 19], [2, 18], [3, 17], [4, 16], [5, 15], [6, 14], [7, 13], [8, 12], [9, 11], [10, 10], [11, 9], [12, 8], [13, 7], [14, 6], [15, 5], [16, 4], [17, 3], [18, 2], [19, 1], [20, 0], [0, 21], [1, 20], [2, 19], [3, 18], [4, 17], [5, 16], [6, 15], [7, 14], [8, 13], [9, 12], [10, 11], [11, 10], [12, 9], [13, 8], [14, 7], [15, 6], [16, 5], [17, 4], [18, 3], [19, 2], [20, 1], [21, 0], [0, 22], [1, 21], [2, 20], [3, 19], [4, 18], [5, 17], [6, 16], [7, 15], [8, 14], [9, 13], [10, 12], [11, 11], [12, 10], [13, 9], [14, 8], [15, 7], [16, 6], [17, 5], [18, 4], [19, 3], [20, 2], [21, 1], [22, 0], [0, 23], [1, 22], [2, 21], [3, 20], [4, 19], [5, 18], [6, 17], [7, 16], [8, 15], [9, 14], [10, 13], [11, 12], [12, 11], [13, 10], [14, 9], [15, 8], [16, 7], [17, 6], [18, 5], [19, 4], [20, 3], [21, 2], [22, 1], [23, 0], [0, 24], [1, 23], [2, 22], [3, 21], [4, 20], [5, 19], [6, 18], [7, 17], [8, 16], [9, 15], [10, 14], [11, 13], [12, 12], [13, 11], [14, 10], [15, 9], [16, 8], [17, 7], [18, 6], [19, 5], [20, 4], [21, 3], [22, 2], [23, 1], [24, 0], [0, 25], [1, 24], [2, 23], [3, 22], [4, 21], [5, 20], [6, 19], [7, 18], [8, 17], [9, 16], [10, 15], [11, 14], [12, 13], [13, 12], [14, 11], [15, 10], [16, 9], [17, 8], [18, 7], [19, 6], [20, 5], [21, 4], [22, 3], [23, 2], [24, 1], [25, 0], [0, 26], [1, 25], [2, 24], [3, 23], [4, 22], [5, 21], [6, 20], [7, 19], [8, 18], [9, 17], [10, 16], [11, 15], [12, 14], [13, 13], [14, 12], [15, 11], [16, 10], [17, 9], [18, 8], [19, 7], [20, 6], [21, 5], [22, 4], [23, 3], [24, 2], [25, 1], [26, 0], [0, 27], [1, 26], [2, 25], [3, 24], [4, 23], [5, 22], [6, 21], [7, 20], [8, 19], [9, 18], [10, 17], [11, 16], [12, 15], [13, 14], [14, 13], [15, 12], [16, 11], [17, 10], [18, 9], [19, 8], [20, 7], [21, 6], [22, 5], [23, 4], [24, 3], [25, 2], [26, 1], [27, 0], [0, 28], [1, 27], [2, 26], [3, 25], [4, 24], [5, 23], [6, 22], [7, 21], [8, 20], [9, 19], [10, 18], [11, 17], [12, 16], [13, 15], [14, 14], [15, 13], [16, 12], [17, 11], [18, 10], [19, 9], [20, 8], [21, 7], [22, 6], [23, 5], [24, 4], [25, 3], [26, 2], [27, 1], [28, 0], [0, 29], [1, 28], [2, 27], [3, 26], [4, 25], [5, 24], [6, 23], [7, 22], [8, 21], [9, 20], [10, 19], [11, 18], [12, 17], [13, 16], [14, 15], [15, 14], [16, 13], [17, 12], [18, 11], [19, 10], [20, 9], [21, 8], [22, 7], [23, 6], [24, 5], [25, 4], [26, 3], [27, 2], [28, 1], [29, 0], [0, 30], [1, 29], [2, 28], [3, 27], [4, 26], [5, 25], [6, 24], [7, 23], [8, 22], [9, 21], [10, 20], [11, 19], [12, 18], [13, 17], [14, 16], [15, 15], [16, 14], [17, 13], [18, 12], [19, 11], [20, 10], [21, 9], [22, 8], [23, 7], [24, 6], [25, 5], [26, 4], [27, 3], [28, 2], [29, 1], [30, 0], [0, 31], [1, 30], [2, 29], [3, 28], [4, 27], [5, 26], [6, 25], [7, 24], [8, 23], [9, 22], [10, 21], [11, 20], [12, 19], [13, 18], [14, 17], [15, 16], [16, 15], [17, 14], [18, 13], [19, 12], [20, 11], [21, 10], [22, 9], [23, 8], [24, 7], [25, 6], [26, 5], [27, 4], [28, 3], [29, 2], [30, 1], [31, 0], [0, 32], [1, 31], [2, 30], [3, 29], [4, 28], [5, 27], [6, 26], [7, 25], [8, 24], [9, 23], [10, 22], [11, 21], [12, 20], [13, 19], [14, 18], [15, 17], [16, 16], [17, 15], [18, 14], [19, 13], [20, 12], [21, 11], [22, 10], [23, 9], [24, 8], [25, 7], [26, 6], [27, 5], [28, 4], [29, 3], [30, 2], [31, 1], [32, 0], [0, 33], [1, 32], [2, 31], [3, 30], [4, 29], [5, 28], [6, 27], [7, 26], [8, 25], [9, 24], [10, 23], [11, 22], [12, 21], [13, 20], [14, 19], [15, 18], [16, 17], [17, 16], [18, 15], [19, 14], [20, 13], [21, 12], [22, 11], [23, 10], [24, 9], [25, 8], [26, 7], [27, 6], [28, 5], [29, 4], [30, 3], [31, 2], [32, 1], [33, 0], [0, 34], [1, 33], [2, 32], [3, 31], [4, 30], [5, 29], [6, 28], [7, 27], [8, 26], [9, 25], [10, 24], [11, 23], [12, 22], [13, 21], [14, 20], [15, 19], [16, 18], [17, 17], [18, 16], [19, 15], [20, 14], [21, 13], [22, 12], [23, 11], [24, 10], [25, 9], [26, 8], [27, 7], [28, 6], [29, 5], [30, 4], [31, 3], [32, 2], [33, 1], [34, 0], [0, 35], [1, 34], [2, 33], [3, 32], [4, 31], [5, 30], [6, 29], [7, 28], [8, 27], [9, 26], [10, 25], [11, 24], [12, 23], [13, 22], [14, 21], [15, 20], [16, 19], [17, 18], [18, 17], [19, 16], [20, 15], [21, 14], [22, 13], [23, 12], [24, 11], [25, 10], [26, 9], [27, 8], [28, 7], [29, 6], [30, 5], [31, 4], [32, 3], [33, 2], [34, 1], [35, 0], [0, 36], [1, 35], [2, 34], [3, 33], [4, 32], [5, 31], [6, 30], [7, 29], [8, 28], [9, 27], [10, 26], [11, 25], [12, 24], [13, 23], [14, 22], [15, 21], [16, 20], [17, 19], [18, 18], [19, 17], [20, 16], [21, 15], [22, 14], [23, 13], [24, 12], [25, 11], [26, 10], [27, 9], [28, 8], [29, 7], [30, 6], [31, 5], [32, 4], [33, 3], [34, 2], [35, 1], [36, 0], [0, 37], [1, 36], [2, 35], [3, 34], [4, 33], [5, 32], [6, 31], [7, 30], [8, 29], [9, 28], [10, 27], [11, 26], [12, 25], [13, 24], [14, 23], [15, 22], [16, 21], [17, 20], [18, 19], [19, 18], [20, 17], [21, 16], [22, 15], [23, 14], [24, 13], [25, 12], [26, 11], [27, 10], [28, 9], [29, 8], [30, 7], [31, 6], [32, 5], [33, 4], [34, 3], [35, 2], [36, 1], [37, 0], [0, 38], [1, 37], [2, 36], [3, 35], [4, 34], [5, 33], [6, 32], [7, 31], [8, 30], [9, 29], [10, 28], [11, 27], [12, 26], [13, 25], [14, 24], [15, 23], [16, 22], [17, 21], [18, 20], [19, 19], [20, 18], [21, 17], [22, 16], [23, 15], [24, 14], [25, 13], [26, 12], [27, 11], [28, 10], [29, 9], [30, 8], [31, 7], [32, 6], [33, 5], [34, 4], [35, 3], [36, 2], [37, 1], [38, 0], [0, 39], [1, 38], [2, 37], [3, 36], [4, 35], [5, 34], [6, 33], [7, 32], [8, 31], [9, 30], [10, 29], [11, 28], [12, 27], [13, 26], [14, 25], [15, 24], [16, 23], [17, 22], [18, 21], [19, 20], [20, 19], [21, 18], [22, 17], [23, 16], [24, 15], [25, 14], [26, 13], [27, 12], [28, 11], [29, 10], [30, 9], [31, 8], [32, 7], [33, 6], [34, 5], [35, 4], [36, 3], [37, 2], [38, 1], [39, 0], [1, 39], [2, 38], [3, 37], [4, 36], [5, 35], [6, 34], [7, 33], [8, 32], [9, 31], [10, 30], [11, 29], [12, 28], [13, 27], [14, 26], [15, 25], [16, 24], [17, 23], [18, 22], [19, 21], [20, 20], [21, 19], [22, 18], [23, 17], [24, 16], [25, 15], [26, 14], [27, 13], [28, 12], [29, 11], [30, 10], [31, 9], [32, 8], [33, 7], [34, 6], [35, 5], [36, 4], [37, 3], [38, 2], [39, 1], [2, 39], [3, 38], [4, 37], [5, 36], [6, 35], [7, 34], [8, 33], [9, 32], [10, 31], [11, 30], [12, 29], [13, 28], [14, 27], [15, 26], [16, 25], [17, 24], [18, 23], [19, 22], [20, 21], [21, 20], [22, 19], [23, 18], [24, 17], [25, 16], [26, 15], [27, 14], [28, 13], [29, 12], [30, 11], [31, 10], [32, 9], [33, 8], [34, 7], [35, 6], [36, 5], [37, 4], [38, 3], [39, 2], [3, 39], [4, 38], [5, 37], [6, 36], [7, 35], [8, 34], [9, 33], [10, 32], [11, 31], [12, 30], [13, 29], [14, 28], [15, 27], [16, 26], [17, 25], [18, 24], [19, 23], [20, 22], [21, 21], [22, 20], [23, 19], [24, 18], [25, 17], [26, 16], [27, 15], [28, 14], [29, 13], [30, 12], [31, 11], [32, 10], [33, 9], [34, 8], [35, 7], [36, 6], [37, 5], [38, 4], [39, 3], [4, 39], [5, 38], [6, 37], [7, 36], [8, 35], [9, 34], [10, 33], [11, 32], [12, 31], [13, 30], [14, 29], [15, 28], [16, 27], [17, 26], [18, 25], [19, 24], [20, 23], [21, 22], [22, 21], [23, 20], [24, 19], [25, 18], [26, 17], [27, 16], [28, 15], [29, 14], [30, 13], [31, 12], [32, 11], [33, 10], [34, 9], [35, 8], [36, 7], [37, 6], [38, 5], [39, 4], [5, 39], [6, 38], [7, 37], [8, 36], [9, 35], [10, 34], [11, 33], [12, 32], [13, 31], [14, 30], [15, 29], [16, 28], [17, 27], [18, 26], [19, 25], [20, 24], [21, 23], [22, 22], [23, 21], [24, 20], [25, 19], [26, 18], [27, 17], [28, 16], [29, 15], [30, 14], [31, 13], [32, 12], [33, 11], [34, 10], [35, 9], [36, 8], [37, 7], [38, 6], [39, 5], [6, 39], [7, 38], [8, 37], [9, 36], [10, 35], [11, 34], [12, 33], [13, 32], [14, 31], [15, 30], [16, 29], [17, 28], [18, 27], [19, 26], [20, 25], [21, 24], [22, 23], [23, 22], [24, 21], [25, 20], [26, 19], [27, 18], [28, 17], [29, 16], [30, 15], [31, 14], [32, 13], [33, 12], [34, 11], [35, 10], [36, 9], [37, 8], [38, 7], [39, 6], [7, 39], [8, 38], [9, 37], [10, 36], [11, 35], [12, 34], [13, 33], [14, 32], [15, 31], [16, 30], [17, 29], [18, 28], [19, 27], [20, 26], [21, 25], [22, 24], [23, 23], [24, 22], [25, 21], [26, 20], [27, 19], [28, 18], [29, 17], [30, 16], [31, 15], [32, 14], [33, 13], [34, 12], [35, 11], [36, 10], [37, 9], [38, 8], [39, 7], [8, 39], [9, 38], [10, 37], [11, 36], [12, 35], [13, 34], [14, 33], [15, 32], [16, 31], [17, 30], [18, 29], [19, 28], [20, 27], [21, 26], [22, 25], [23, 24], [24, 23], [25, 22], [26, 21], [27, 20], [28, 19], [29, 18], [30, 17], [31, 16], [32, 15], [33, 14], [34, 13], [35, 12], [36, 11], [37, 10], [38, 9], [39, 8], [9, 39], [10, 38], [11, 37], [12, 36], [13, 35], [14, 34], [15, 33], [16, 32], [17, 31], [18, 30], [19, 29], [20, 28], [21, 27], [22, 26], [23, 25], [24, 24], [25, 23], [26, 22], [27, 21], [28, 20], [29, 19], [30, 18], [31, 17], [32, 16], [33, 15], [34, 14], [35, 13], [36, 12], [37, 11], [38, 10], [39, 9], [10, 39], [11, 38], [12, 37], [13, 36], [14, 35], [15, 34], [16, 33], [17, 32], [18, 31], [19, 30], [20, 29], [21, 28], [22, 27], [23, 26], [24, 25], [25, 24], [26, 23], [27, 22], [28, 21], [29, 20], [30, 19], [31, 18], [32, 17], [33, 16], [34, 15], [35, 14], [36, 13], [37, 12], [38, 11], [39, 10], [11, 39], [12, 38], [13, 37], [14, 36], [15, 35], [16, 34], [17, 33], [18, 32], [19, 31], [20, 30], [21, 29], [22, 28], [23, 27], [24, 26], [25, 25], [26, 24], [27, 23], [28, 22], [29, 21], [30, 20], [31, 19], [32, 18], [33, 17], [34, 16], [35, 15], [36, 14], [37, 13], [38, 12], [39, 11], [12, 39], [13, 38], [14, 37], [15, 36], [16, 35], [17, 34], [18, 33], [19, 32], [20, 31], [21, 30], [22, 29], [23, 28], [24, 27], [25, 26], [26, 25], [27, 24], [28, 23], [29, 22], [30, 21], [31, 20], [32, 19], [33, 18], [34, 17], [35, 16], [36, 15], [37, 14], [38, 13], [39, 12], [13, 39], [14, 38], [15, 37], [16, 36], [17, 35], [18, 34], [19, 33], [20, 32], [21, 31], [22, 30], [23, 29], [24, 28], [25, 27], [26, 26], [27, 25], [28, 24], [29, 23], [30, 22], [31, 21], [32, 20], [33, 19], [34, 18], [35, 17], [36, 16], [37, 15], [38, 14], [39, 13], [14, 39], [15, 38], [16, 37], [17, 36], [18, 35], [19, 34], [20, 33], [21, 32], [22, 31], [23, 30], [24, 29], [25, 28], [26, 27], [27, 26], [28, 25], [29, 24], [30, 23], [31, 22], [32, 21], [33, 20], [34, 19], [35, 18], [36, 17], [37, 16], [38, 15], [39, 14], [15, 39], [16, 38], [17, 37], [18, 36], [19, 35], [20, 34], [21, 33], [22, 32], [23, 31], [24, 30], [25, 29], [26, 28], [27, 27], [28, 26], [29, 25], [30, 24], [31, 23], [32, 22], [33, 21], [34, 20], [35, 19], [36, 18], [37, 17], [38, 16], [39, 15], [16, 39], [17, 38], [18, 37], [19, 36], [20, 35], [21, 34], [22, 33], [23, 32], [24, 31], [25, 30], [26, 29], [27, 28], [28, 27], [29, 26], [30, 25], [31, 24], [32, 23], [33, 22], [34, 21], [35, 20], [36, 19], [37, 18], [38, 17], [39, 16], [17, 39], [18, 38], [19, 37], [20, 36], [21, 35], [22, 34], [23, 33], [24, 32], [25, 31], [26, 30], [27, 29], [28, 28], [29, 27], [30, 26], [31, 25], [32, 24], [33, 23], [34, 22], [35, 21], [36, 20], [37, 19], [38, 18], [39, 17], [18, 39], [19, 38], [20, 37], [21, 36], [22, 35], [23, 34], [24, 33], [25, 32], [26, 31], [27, 30], [28, 29], [29, 28], [30, 27], [31, 26], [32, 25], [33, 24], [34, 23], [35, 22], [36, 21], [37, 20], [38, 19], [39, 18], [19, 39], [20, 38], [21, 37], [22, 36], [23, 35], [24, 34], [25, 33], [26, 32], [27, 31], [28, 30], [29, 29], [30, 28], [31, 27], [32, 26], [33, 25], [34, 24], [35, 23], [36, 22], [37, 21], [38, 20], [39, 19], [20, 39], [21, 38], [22, 37], [23, 36], [24, 35], [25, 34], [26, 33], [27, 32], [28, 31], [29, 30], [30, 29], [31, 28], [32, 27], [33, 26], [34, 25], [35, 24], [36, 23], [37, 22], [38, 21], [39, 20], [21, 39], [22, 38], [23, 37], [24, 36], [25, 35], [26, 34], [27, 33], [28, 32], [29, 31], [30, 30], [31, 29], [32, 28], [33, 27], [34, 26], [35, 25], [36, 24], [37, 23], [38, 22], [39, 21], [22, 39], [23, 38], [24, 37], [25, 36], [26, 35], [27, 34], [28, 33], [29, 32], [30, 31], [31, 30], [32, 29], [33, 28], [34, 27], [35, 26], [36, 25], [37, 24], [38, 23], [39, 22], [23, 39], [24, 38], [25, 37], [26, 36], [27, 35], [28, 34], [29, 33], [30, 32], [31, 31], [32, 30], [33, 29], [34, 28], [35, 27], [36, 26], [37, 25], [38, 24], [39, 23], [24, 39], [25, 38], [26, 37], [27, 36], [28, 35], [29, 34], [30, 33], [31, 32], [32, 31], [33, 30], [34, 29], [35, 28], [36, 27], [37, 26], [38, 25], [39, 24], [25, 39], [26, 38], [27, 37], [28, 36], [29, 35], [30, 34], [31, 33], [32, 32], [33, 31], [34, 30], [35, 29], [36, 28], [37, 27], [38, 26], [39, 25], [26, 39], [27, 38], [28, 37], [29, 36], [30, 35], [31, 34], [32, 33], [33, 32], [34, 31], [35, 30], [36, 29], [37, 28], [38, 27], [39, 26], [27, 39], [28, 38], [29, 37], [30, 36], [31, 35], [32, 34], [33, 33], [34, 32], [35, 31], [36, 30], [37, 29], [38, 28], [39, 27], [28, 39], [29, 38], [30, 37], [31, 36], [32, 35], [33, 34], [34, 33], [35, 32], [36, 31], [37, 30], [38, 29], [39, 28], [29, 39], [30, 38], [31, 37], [32, 36], [33, 35], [34, 34], [35, 33], [36, 32], [37, 31], [38, 30], [39, 29], [30, 39], [31, 38], [32, 37], [33, 36], [34, 35], [35, 34], [36, 33], [37, 32], [38, 31], [39, 30], [31, 39], [32, 38], [33, 37], [34, 36], [35, 35], [36, 34], [37, 33], [38, 32], [39, 31], [32, 39], [33, 38], [34, 37], [35, 36], [36, 35], [37, 34], [38, 33], [39, 32], [33, 39], [34, 38], [35, 37], [36, 36], [37, 35], [38, 34], [39, 33], [34, 39], [35, 38], [36, 37], [37, 36], [38, 35], [39, 34], [35, 39], [36, 38], [37, 37], [38, 36], [39, 35], [36, 39], [37, 38], [38, 37], [39, 36], [37, 39], [38, 38], [39, 37], [38, 39], [39, 38], [39, 39]]\n assert candidate(rows = 8,cols = 3,rCenter = 0,cCenter = 0) == [[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, 0], [1, 2], [2, 1], [3, 0], [2, 2], [3, 1], [4, 0], [3, 2], [4, 1], [5, 0], [4, 2], [5, 1], [6, 0], [5, 2], [6, 1], [7, 0], [6, 2], [7, 1], [7, 2]]\n assert candidate(rows = 7,cols = 7,rCenter = 0,cCenter = 6) == [[0, 6], [1, 6], [0, 5], [2, 6], [1, 5], [0, 4], [3, 6], [2, 5], [1, 4], [0, 3], [4, 6], [3, 5], [2, 4], [1, 3], [0, 2], [5, 6], [4, 5], [3, 4], [2, 3], [1, 2], [0, 1], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1], [0, 0], [6, 5], [5, 4], [4, 3], [3, 2], [2, 1], [1, 0], [6, 4], [5, 3], [4, 2], [3, 1], [2, 0], [6, 3], [5, 2], [4, 1], [3, 0], [6, 2], [5, 1], [4, 0], [6, 1], [5, 0], [6, 0]]\n assert candidate(rows = 1,cols = 100,rCenter = 0,cCenter = 50) == [[0, 50], [0, 51], [0, 49], [0, 52], [0, 48], [0, 53], [0, 47], [0, 54], [0, 46], [0, 55], [0, 45], [0, 56], [0, 44], [0, 57], [0, 43], [0, 58], [0, 42], [0, 59], [0, 41], [0, 60], [0, 40], [0, 61], [0, 39], [0, 62], [0, 38], [0, 63], [0, 37], [0, 64], [0, 36], [0, 65], [0, 35], [0, 66], [0, 34], [0, 67], [0, 33], [0, 68], [0, 32], [0, 69], [0, 31], [0, 70], [0, 30], [0, 71], [0, 29], [0, 72], [0, 28], [0, 73], [0, 27], [0, 74], [0, 26], [0, 75], [0, 25], [0, 76], [0, 24], [0, 77], [0, 23], [0, 78], [0, 22], [0, 79], [0, 21], [0, 80], [0, 20], [0, 81], [0, 19], [0, 82], [0, 18], [0, 83], [0, 17], [0, 84], [0, 16], [0, 85], [0, 15], [0, 86], [0, 14], [0, 87], [0, 13], [0, 88], [0, 12], [0, 89], [0, 11], [0, 90], [0, 10], [0, 91], [0, 9], [0, 92], [0, 8], [0, 93], [0, 7], [0, 94], [0, 6], [0, 95], [0, 5], [0, 96], [0, 4], [0, 97], [0, 3], [0, 98], [0, 2], [0, 99], [0, 1], [0, 0]]\n assert candidate(rows = 5,cols = 5,rCenter = 4,cCenter = 4) == [[4, 4], [3, 4], [4, 3], [2, 4], [3, 3], [4, 2], [1, 4], [2, 3], [3, 2], [4, 1], [0, 4], [1, 3], [2, 2], [3, 1], [4, 0], [0, 3], [1, 2], [2, 1], [3, 0], [0, 2], [1, 1], [2, 0], [0, 1], [1, 0], [0, 0]]\n assert candidate(rows = 9,cols = 4,rCenter = 4,cCenter = 3) == [[4, 3], [3, 3], [5, 3], [4, 2], [2, 3], [3, 2], [6, 3], [5, 2], [4, 1], [1, 3], [2, 2], [3, 1], [7, 3], [6, 2], [5, 1], [4, 0], [0, 3], [1, 2], [2, 1], [3, 0], [8, 3], [7, 2], [6, 1], [5, 0], [0, 2], [1, 1], [2, 0], [8, 2], [7, 1], [6, 0], [0, 1], [1, 0], [8, 1], [7, 0], [0, 0], [8, 0]]\n assert candidate(rows = 50,cols = 50,rCenter = 25,cCenter = 25) == [[25, 25], [24, 25], [25, 26], [26, 25], [25, 24], [23, 25], [24, 26], [24, 24], [25, 27], [26, 26], [27, 25], [26, 24], [25, 23], [22, 25], [23, 26], [23, 24], [24, 27], [24, 23], [25, 28], [26, 27], [27, 26], [28, 25], [27, 24], [26, 23], [25, 22], [21, 25], [22, 26], [22, 24], [23, 27], [23, 23], [24, 28], [24, 22], [25, 29], [26, 28], [27, 27], [28, 26], [29, 25], [28, 24], [27, 23], [26, 22], [25, 21], [20, 25], [21, 26], [21, 24], [22, 27], [22, 23], [23, 28], [23, 22], [24, 29], [24, 21], [25, 30], [26, 29], [27, 28], [28, 27], [29, 26], [30, 25], [29, 24], [28, 23], [27, 22], [26, 21], [25, 20], [19, 25], [20, 26], [20, 24], [21, 27], [21, 23], [22, 28], [22, 22], [23, 29], [23, 21], [24, 30], [24, 20], [25, 31], [26, 30], [27, 29], [28, 28], [29, 27], [30, 26], [31, 25], [30, 24], [29, 23], [28, 22], [27, 21], [26, 20], [25, 19], [18, 25], [19, 26], [19, 24], [20, 27], [20, 23], [21, 28], [21, 22], [22, 29], [22, 21], [23, 30], [23, 20], [24, 31], [24, 19], [25, 32], [26, 31], [27, 30], [28, 29], [29, 28], [30, 27], [31, 26], [32, 25], [31, 24], [30, 23], [29, 22], [28, 21], [27, 20], [26, 19], [25, 18], [17, 25], [18, 26], [18, 24], [19, 27], [19, 23], [20, 28], [20, 22], [21, 29], [21, 21], [22, 30], [22, 20], [23, 31], [23, 19], [24, 32], [24, 18], [25, 33], [26, 32], [27, 31], [28, 30], [29, 29], [30, 28], [31, 27], [32, 26], [33, 25], [32, 24], [31, 23], [30, 22], [29, 21], [28, 20], [27, 19], [26, 18], [25, 17], [16, 25], [17, 26], [17, 24], [18, 27], [18, 23], [19, 28], [19, 22], [20, 29], [20, 21], [21, 30], [21, 20], [22, 31], [22, 19], [23, 32], [23, 18], [24, 33], [24, 17], [25, 34], [26, 33], [27, 32], [28, 31], [29, 30], [30, 29], [31, 28], [32, 27], [33, 26], [34, 25], [33, 24], [32, 23], [31, 22], [30, 21], [29, 20], [28, 19], [27, 18], [26, 17], [25, 16], [15, 25], [16, 26], [16, 24], [17, 27], [17, 23], [18, 28], [18, 22], [19, 29], [19, 21], [20, 30], [20, 20], [21, 31], [21, 19], [22, 32], [22, 18], [23, 33], [23, 17], [24, 34], [24, 16], [25, 35], [26, 34], [27, 33], [28, 32], [29, 31], [30, 30], [31, 29], [32, 28], [33, 27], [34, 26], [35, 25], [34, 24], [33, 23], [32, 22], [31, 21], [30, 20], [29, 19], [28, 18], [27, 17], [26, 16], [25, 15], [14, 25], [15, 26], [15, 24], [16, 27], [16, 23], [17, 28], [17, 22], [18, 29], [18, 21], [19, 30], [19, 20], [20, 31], [20, 19], [21, 32], [21, 18], [22, 33], [22, 17], [23, 34], [23, 16], [24, 35], [24, 15], [25, 36], [26, 35], [27, 34], [28, 33], [29, 32], [30, 31], [31, 30], [32, 29], [33, 28], [34, 27], [35, 26], [36, 25], [35, 24], [34, 23], [33, 22], [32, 21], [31, 20], [30, 19], [29, 18], [28, 17], [27, 16], [26, 15], [25, 14], [13, 25], [14, 26], [14, 24], [15, 27], [15, 23], [16, 28], [16, 22], [17, 29], [17, 21], [18, 30], [18, 20], [19, 31], [19, 19], [20, 32], [20, 18], [21, 33], [21, 17], [22, 34], [22, 16], [23, 35], [23, 15], [24, 36], [24, 14], [25, 37], [26, 36], [27, 35], [28, 34], [29, 33], [30, 32], [31, 31], [32, 30], [33, 29], [34, 28], [35, 27], [36, 26], [37, 25], [36, 24], [35, 23], [34, 22], [33, 21], [32, 20], [31, 19], [30, 18], [29, 17], [28, 16], [27, 15], [26, 14], [25, 13], [12, 25], [13, 26], [13, 24], [14, 27], [14, 23], [15, 28], [15, 22], [16, 29], [16, 21], [17, 30], [17, 20], [18, 31], [18, 19], [19, 32], [19, 18], [20, 33], [20, 17], [21, 34], [21, 16], [22, 35], [22, 15], [23, 36], [23, 14], [24, 37], [24, 13], [25, 38], [26, 37], [27, 36], [28, 35], [29, 34], [30, 33], [31, 32], [32, 31], [33, 30], [34, 29], [35, 28], [36, 27], [37, 26], [38, 25], [37, 24], [36, 23], [35, 22], [34, 21], [33, 20], [32, 19], [31, 18], [30, 17], [29, 16], [28, 15], [27, 14], [26, 13], [25, 12], [11, 25], [12, 26], [12, 24], [13, 27], [13, 23], [14, 28], [14, 22], [15, 29], [15, 21], [16, 30], [16, 20], [17, 31], [17, 19], [18, 32], [18, 18], [19, 33], [19, 17], [20, 34], [20, 16], [21, 35], [21, 15], [22, 36], [22, 14], [23, 37], [23, 13], [24, 38], [24, 12], [25, 39], [26, 38], [27, 37], [28, 36], [29, 35], [30, 34], [31, 33], [32, 32], [33, 31], [34, 30], [35, 29], [36, 28], [37, 27], [38, 26], [39, 25], [38, 24], [37, 23], [36, 22], [35, 21], [34, 20], [33, 19], [32, 18], [31, 17], [30, 16], [29, 15], [28, 14], [27, 13], [26, 12], [25, 11], [10, 25], [11, 26], [11, 24], [12, 27], [12, 23], [13, 28], [13, 22], [14, 29], [14, 21], [15, 30], [15, 20], [16, 31], [16, 19], [17, 32], [17, 18], [18, 33], [18, 17], [19, 34], [19, 16], [20, 35], [20, 15], [21, 36], [21, 14], [22, 37], [22, 13], [23, 38], [23, 12], [24, 39], [24, 11], [25, 40], [26, 39], [27, 38], [28, 37], [29, 36], [30, 35], [31, 34], [32, 33], [33, 32], [34, 31], [35, 30], [36, 29], [37, 28], [38, 27], [39, 26], [40, 25], [39, 24], [38, 23], [37, 22], [36, 21], [35, 20], [34, 19], [33, 18], [32, 17], [31, 16], [30, 15], [29, 14], [28, 13], [27, 12], [26, 11], [25, 10], [9, 25], [10, 26], [10, 24], [11, 27], [11, 23], [12, 28], [12, 22], [13, 29], [13, 21], [14, 30], [14, 20], [15, 31], [15, 19], [16, 32], [16, 18], [17, 33], [17, 17], [18, 34], [18, 16], [19, 35], [19, 15], [20, 36], [20, 14], [21, 37], [21, 13], [22, 38], [22, 12], [23, 39], [23, 11], [24, 40], [24, 10], [25, 41], [26, 40], [27, 39], [28, 38], [29, 37], [30, 36], [31, 35], [32, 34], [33, 33], [34, 32], [35, 31], [36, 30], [37, 29], [38, 28], [39, 27], [40, 26], [41, 25], [40, 24], [39, 23], [38, 22], [37, 21], [36, 20], [35, 19], [34, 18], [33, 17], [32, 16], [31, 15], [30, 14], [29, 13], [28, 12], [27, 11], [26, 10], [25, 9], [8, 25], [9, 26], [9, 24], [10, 27], [10, 23], [11, 28], [11, 22], [12, 29], [12, 21], [13, 30], [13, 20], [14, 31], [14, 19], [15, 32], [15, 18], [16, 33], [16, 17], [17, 34], [17, 16], [18, 35], [18, 15], [19, 36], [19, 14], [20, 37], [20, 13], [21, 38], [21, 12], [22, 39], [22, 11], [23, 40], [23, 10], [24, 41], [24, 9], [25, 42], [26, 41], [27, 40], [28, 39], [29, 38], [30, 37], [31, 36], [32, 35], [33, 34], [34, 33], [35, 32], [36, 31], [37, 30], [38, 29], [39, 28], [40, 27], [41, 26], [42, 25], [41, 24], [40, 23], [39, 22], [38, 21], [37, 20], [36, 19], [35, 18], [34, 17], [33, 16], [32, 15], [31, 14], [30, 13], [29, 12], [28, 11], [27, 10], [26, 9], [25, 8], [7, 25], [8, 26], [8, 24], [9, 27], [9, 23], [10, 28], [10, 22], [11, 29], [11, 21], [12, 30], [12, 20], [13, 31], [13, 19], [14, 32], [14, 18], [15, 33], [15, 17], [16, 34], [16, 16], [17, 35], [17, 15], [18, 36], [18, 14], [19, 37], [19, 13], [20, 38], [20, 12], [21, 39], [21, 11], [22, 40], [22, 10], [23, 41], [23, 9], [24, 42], [24, 8], [25, 43], [26, 42], [27, 41], [28, 40], [29, 39], [30, 38], [31, 37], [32, 36], [33, 35], [34, 34], [35, 33], [36, 32], [37, 31], [38, 30], [39, 29], [40, 28], [41, 27], [42, 26], [43, 25], [42, 24], [41, 23], [40, 22], [39, 21], [38, 20], [37, 19], [36, 18], [35, 17], [34, 16], [33, 15], [32, 14], [31, 13], [30, 12], [29, 11], [28, 10], [27, 9], [26, 8], [25, 7], [6, 25], [7, 26], [7, 24], [8, 27], [8, 23], [9, 28], [9, 22], [10, 29], [10, 21], [11, 30], [11, 20], [12, 31], [12, 19], [13, 32], [13, 18], [14, 33], [14, 17], [15, 34], [15, 16], [16, 35], [16, 15], [17, 36], [17, 14], [18, 37], [18, 13], [19, 38], [19, 12], [20, 39], [20, 11], [21, 40], [21, 10], [22, 41], [22, 9], [23, 42], [23, 8], [24, 43], [24, 7], [25, 44], [26, 43], [27, 42], [28, 41], [29, 40], [30, 39], [31, 38], [32, 37], [33, 36], [34, 35], [35, 34], [36, 33], [37, 32], [38, 31], [39, 30], [40, 29], [41, 28], [42, 27], [43, 26], [44, 25], [43, 24], [42, 23], [41, 22], [40, 21], [39, 20], [38, 19], [37, 18], [36, 17], [35, 16], [34, 15], [33, 14], [32, 13], [31, 12], [30, 11], [29, 10], [28, 9], [27, 8], [26, 7], [25, 6], [5, 25], [6, 26], [6, 24], [7, 27], [7, 23], [8, 28], [8, 22], [9, 29], [9, 21], [10, 30], [10, 20], [11, 31], [11, 19], [12, 32], [12, 18], [13, 33], [13, 17], [14, 34], [14, 16], [15, 35], [15, 15], [16, 36], [16, 14], [17, 37], [17, 13], [18, 38], [18, 12], [19, 39], [19, 11], [20, 40], [20, 10], [21, 41], [21, 9], [22, 42], [22, 8], [23, 43], [23, 7], [24, 44], [24, 6], [25, 45], [26, 44], [27, 43], [28, 42], [29, 41], [30, 40], [31, 39], [32, 38], [33, 37], [34, 36], [35, 35], [36, 34], [37, 33], [38, 32], [39, 31], [40, 30], [41, 29], [42, 28], [43, 27], [44, 26], [45, 25], [44, 24], [43, 23], [42, 22], [41, 21], [40, 20], [39, 19], [38, 18], [37, 17], [36, 16], [35, 15], [34, 14], [33, 13], [32, 12], [31, 11], [30, 10], [29, 9], [28, 8], [27, 7], [26, 6], [25, 5], [4, 25], [5, 26], [5, 24], [6, 27], [6, 23], [7, 28], [7, 22], [8, 29], [8, 21], [9, 30], [9, 20], [10, 31], [10, 19], [11, 32], [11, 18], [12, 33], [12, 17], [13, 34], [13, 16], [14, 35], [14, 15], [15, 36], [15, 14], [16, 37], [16, 13], [17, 38], [17, 12], [18, 39], [18, 11], [19, 40], [19, 10], [20, 41], [20, 9], [21, 42], [21, 8], [22, 43], [22, 7], [23, 44], [23, 6], [24, 45], [24, 5], [25, 46], [26, 45], [27, 44], [28, 43], [29, 42], [30, 41], [31, 40], [32, 39], [33, 38], [34, 37], [35, 36], [36, 35], [37, 34], [38, 33], [39, 32], [40, 31], [41, 30], [42, 29], [43, 28], [44, 27], [45, 26], [46, 25], [45, 24], [44, 23], [43, 22], [42, 21], [41, 20], [40, 19], [39, 18], [38, 17], [37, 16], [36, 15], [35, 14], [34, 13], [33, 12], [32, 11], [31, 10], [30, 9], [29, 8], [28, 7], [27, 6], [26, 5], [25, 4], [3, 25], [4, 26], [4, 24], [5, 27], [5, 23], [6, 28], [6, 22], [7, 29], [7, 21], [8, 30], [8, 20], [9, 31], [9, 19], [10, 32], [10, 18], [11, 33], [11, 17], [12, 34], [12, 16], [13, 35], [13, 15], [14, 36], [14, 14], [15, 37], [15, 13], [16, 38], [16, 12], [17, 39], [17, 11], [18, 40], [18, 10], [19, 41], [19, 9], [20, 42], [20, 8], [21, 43], [21, 7], [22, 44], [22, 6], [23, 45], [23, 5], [24, 46], [24, 4], [25, 47], [26, 46], [27, 45], [28, 44], [29, 43], [30, 42], [31, 41], [32, 40], [33, 39], [34, 38], [35, 37], [36, 36], [37, 35], [38, 34], [39, 33], [40, 32], [41, 31], [42, 30], [43, 29], [44, 28], [45, 27], [46, 26], [47, 25], [46, 24], [45, 23], [44, 22], [43, 21], [42, 20], [41, 19], [40, 18], [39, 17], [38, 16], [37, 15], [36, 14], [35, 13], [34, 12], [33, 11], [32, 10], [31, 9], [30, 8], [29, 7], [28, 6], [27, 5], [26, 4], [25, 3], [2, 25], [3, 26], [3, 24], [4, 27], [4, 23], [5, 28], [5, 22], [6, 29], [6, 21], [7, 30], [7, 20], [8, 31], [8, 19], [9, 32], [9, 18], [10, 33], [10, 17], [11, 34], [11, 16], [12, 35], [12, 15], [13, 36], [13, 14], [14, 37], [14, 13], [15, 38], [15, 12], [16, 39], [16, 11], [17, 40], [17, 10], [18, 41], [18, 9], [19, 42], [19, 8], [20, 43], [20, 7], [21, 44], [21, 6], [22, 45], [22, 5], [23, 46], [23, 4], [24, 47], [24, 3], [25, 48], [26, 47], [27, 46], [28, 45], [29, 44], [30, 43], [31, 42], [32, 41], [33, 40], [34, 39], [35, 38], [36, 37], [37, 36], [38, 35], [39, 34], [40, 33], [41, 32], [42, 31], [43, 30], [44, 29], [45, 28], [46, 27], [47, 26], [48, 25], [47, 24], [46, 23], [45, 22], [44, 21], [43, 20], [42, 19], [41, 18], [40, 17], [39, 16], [38, 15], [37, 14], [36, 13], [35, 12], [34, 11], [33, 10], [32, 9], [31, 8], [30, 7], [29, 6], [28, 5], [27, 4], [26, 3], [25, 2], [1, 25], [2, 26], [2, 24], [3, 27], [3, 23], [4, 28], [4, 22], [5, 29], [5, 21], [6, 30], [6, 20], [7, 31], [7, 19], [8, 32], [8, 18], [9, 33], [9, 17], [10, 34], [10, 16], [11, 35], [11, 15], [12, 36], [12, 14], [13, 37], [13, 13], [14, 38], [14, 12], [15, 39], [15, 11], [16, 40], [16, 10], [17, 41], [17, 9], [18, 42], [18, 8], [19, 43], [19, 7], [20, 44], [20, 6], [21, 45], [21, 5], [22, 46], [22, 4], [23, 47], [23, 3], [24, 48], [24, 2], [25, 49], [26, 48], [27, 47], [28, 46], [29, 45], [30, 44], [31, 43], [32, 42], [33, 41], [34, 40], [35, 39], [36, 38], [37, 37], [38, 36], [39, 35], [40, 34], [41, 33], [42, 32], [43, 31], [44, 30], [45, 29], [46, 28], [47, 27], [48, 26], [49, 25], [48, 24], [47, 23], [46, 22], [45, 21], [44, 20], [43, 19], [42, 18], [41, 17], [40, 16], [39, 15], [38, 14], [37, 13], [36, 12], [35, 11], [34, 10], [33, 9], [32, 8], [31, 7], [30, 6], [29, 5], [28, 4], [27, 3], [26, 2], [25, 1], [0, 25], [1, 26], [1, 24], [2, 27], [2, 23], [3, 28], [3, 22], [4, 29], [4, 21], [5, 30], [5, 20], [6, 31], [6, 19], [7, 32], [7, 18], [8, 33], [8, 17], [9, 34], [9, 16], [10, 35], [10, 15], [11, 36], [11, 14], [12, 37], [12, 13], [13, 38], [13, 12], [14, 39], [14, 11], [15, 40], [15, 10], [16, 41], [16, 9], [17, 42], [17, 8], [18, 43], [18, 7], [19, 44], [19, 6], [20, 45], [20, 5], [21, 46], [21, 4], [22, 47], [22, 3], [23, 48], [23, 2], [24, 49], [24, 1], [26, 49], [27, 48], [28, 47], [29, 46], [30, 45], [31, 44], [32, 43], [33, 42], [34, 41], [35, 40], [36, 39], [37, 38], [38, 37], [39, 36], [40, 35], [41, 34], [42, 33], [43, 32], [44, 31], [45, 30], [46, 29], [47, 28], [48, 27], [49, 26], [49, 24], [48, 23], [47, 22], [46, 21], [45, 20], [44, 19], [43, 18], [42, 17], [41, 16], [40, 15], [39, 14], [38, 13], [37, 12], [36, 11], [35, 10], [34, 9], [33, 8], [32, 7], [31, 6], [30, 5], [29, 4], [28, 3], [27, 2], [26, 1], [25, 0], [0, 26], [0, 24], [1, 27], [1, 23], [2, 28], [2, 22], [3, 29], [3, 21], [4, 30], [4, 20], [5, 31], [5, 19], [6, 32], [6, 18], [7, 33], [7, 17], [8, 34], [8, 16], [9, 35], [9, 15], [10, 36], [10, 14], [11, 37], [11, 13], [12, 38], [12, 12], [13, 39], [13, 11], [14, 40], [14, 10], [15, 41], [15, 9], [16, 42], [16, 8], [17, 43], [17, 7], [18, 44], [18, 6], [19, 45], [19, 5], [20, 46], [20, 4], [21, 47], [21, 3], [22, 48], [22, 2], [23, 49], [23, 1], [24, 0], [27, 49], [28, 48], [29, 47], [30, 46], [31, 45], [32, 44], [33, 43], [34, 42], [35, 41], [36, 40], [37, 39], [38, 38], [39, 37], [40, 36], [41, 35], [42, 34], [43, 33], [44, 32], [45, 31], [46, 30], [47, 29], [48, 28], [49, 27], [49, 23], [48, 22], [47, 21], [46, 20], [45, 19], [44, 18], [43, 17], [42, 16], [41, 15], [40, 14], [39, 13], [38, 12], [37, 11], [36, 10], [35, 9], [34, 8], [33, 7], [32, 6], [31, 5], [30, 4], [29, 3], [28, 2], [27, 1], [26, 0], [0, 27], [0, 23], [1, 28], [1, 22], [2, 29], [2, 21], [3, 30], [3, 20], [4, 31], [4, 19], [5, 32], [5, 18], [6, 33], [6, 17], [7, 34], [7, 16], [8, 35], [8, 15], [9, 36], [9, 14], [10, 37], [10, 13], [11, 38], [11, 12], [12, 39], [12, 11], [13, 40], [13, 10], [14, 41], [14, 9], [15, 42], [15, 8], [16, 43], [16, 7], [17, 44], [17, 6], [18, 45], [18, 5], [19, 46], [19, 4], [20, 47], [20, 3], [21, 48], [21, 2], [22, 49], [22, 1], [23, 0], [28, 49], [29, 48], [30, 47], [31, 46], [32, 45], [33, 44], [34, 43], [35, 42], [36, 41], [37, 40], [38, 39], [39, 38], [40, 37], [41, 36], [42, 35], [43, 34], [44, 33], [45, 32], [46, 31], [47, 30], [48, 29], [49, 28], [49, 22], [48, 21], [47, 20], [46, 19], [45, 18], [44, 17], [43, 16], [42, 15], [41, 14], [40, 13], [39, 12], [38, 11], [37, 10], [36, 9], [35, 8], [34, 7], [33, 6], [32, 5], [31, 4], [30, 3], [29, 2], [28, 1], [27, 0], [0, 28], [0, 22], [1, 29], [1, 21], [2, 30], [2, 20], [3, 31], [3, 19], [4, 32], [4, 18], [5, 33], [5, 17], [6, 34], [6, 16], [7, 35], [7, 15], [8, 36], [8, 14], [9, 37], [9, 13], [10, 38], [10, 12], [11, 39], [11, 11], [12, 40], [12, 10], [13, 41], [13, 9], [14, 42], [14, 8], [15, 43], [15, 7], [16, 44], [16, 6], [17, 45], [17, 5], [18, 46], [18, 4], [19, 47], [19, 3], [20, 48], [20, 2], [21, 49], [21, 1], [22, 0], [29, 49], [30, 48], [31, 47], [32, 46], [33, 45], [34, 44], [35, 43], [36, 42], [37, 41], [38, 40], [39, 39], [40, 38], [41, 37], [42, 36], [43, 35], [44, 34], [45, 33], [46, 32], [47, 31], [48, 30], [49, 29], [49, 21], [48, 20], [47, 19], [46, 18], [45, 17], [44, 16], [43, 15], [42, 14], [41, 13], [40, 12], [39, 11], [38, 10], [37, 9], [36, 8], [35, 7], [34, 6], [33, 5], [32, 4], [31, 3], [30, 2], [29, 1], [28, 0], [0, 29], [0, 21], [1, 30], [1, 20], [2, 31], [2, 19], [3, 32], [3, 18], [4, 33], [4, 17], [5, 34], [5, 16], [6, 35], [6, 15], [7, 36], [7, 14], [8, 37], [8, 13], [9, 38], [9, 12], [10, 39], [10, 11], [11, 40], [11, 10], [12, 41], [12, 9], [13, 42], [13, 8], [14, 43], [14, 7], [15, 44], [15, 6], [16, 45], [16, 5], [17, 46], [17, 4], [18, 47], [18, 3], [19, 48], [19, 2], [20, 49], [20, 1], [21, 0], [30, 49], [31, 48], [32, 47], [33, 46], [34, 45], [35, 44], [36, 43], [37, 42], [38, 41], [39, 40], [40, 39], [41, 38], [42, 37], [43, 36], [44, 35], [45, 34], [46, 33], [47, 32], [48, 31], [49, 30], [49, 20], [48, 19], [47, 18], [46, 17], [45, 16], [44, 15], [43, 14], [42, 13], [41, 12], [40, 11], [39, 10], [38, 9], [37, 8], [36, 7], [35, 6], [34, 5], [33, 4], [32, 3], [31, 2], [30, 1], [29, 0], [0, 30], [0, 20], [1, 31], [1, 19], [2, 32], [2, 18], [3, 33], [3, 17], [4, 34], [4, 16], [5, 35], [5, 15], [6, 36], [6, 14], [7, 37], [7, 13], [8, 38], [8, 12], [9, 39], [9, 11], [10, 40], [10, 10], [11, 41], [11, 9], [12, 42], [12, 8], [13, 43], [13, 7], [14, 44], [14, 6], [15, 45], [15, 5], [16, 46], [16, 4], [17, 47], [17, 3], [18, 48], [18, 2], [19, 49], [19, 1], [20, 0], [31, 49], [32, 48], [33, 47], [34, 46], [35, 45], [36, 44], [37, 43], [38, 42], [39, 41], [40, 40], [41, 39], [42, 38], [43, 37], [44, 36], [45, 35], [46, 34], [47, 33], [48, 32], [49, 31], [49, 19], [48, 18], [47, 17], [46, 16], [45, 15], [44, 14], [43, 13], [42, 12], [41, 11], [40, 10], [39, 9], [38, 8], [37, 7], [36, 6], [35, 5], [34, 4], [33, 3], [32, 2], [31, 1], [30, 0], [0, 31], [0, 19], [1, 32], [1, 18], [2, 33], [2, 17], [3, 34], [3, 16], [4, 35], [4, 15], [5, 36], [5, 14], [6, 37], [6, 13], [7, 38], [7, 12], [8, 39], [8, 11], [9, 40], [9, 10], [10, 41], [10, 9], [11, 42], [11, 8], [12, 43], [12, 7], [13, 44], [13, 6], [14, 45], [14, 5], [15, 46], [15, 4], [16, 47], [16, 3], [17, 48], [17, 2], [18, 49], [18, 1], [19, 0], [32, 49], [33, 48], [34, 47], [35, 46], [36, 45], [37, 44], [38, 43], [39, 42], [40, 41], [41, 40], [42, 39], [43, 38], [44, 37], [45, 36], [46, 35], [47, 34], [48, 33], [49, 32], [49, 18], [48, 17], [47, 16], [46, 15], [45, 14], [44, 13], [43, 12], [42, 11], [41, 10], [40, 9], [39, 8], [38, 7], [37, 6], [36, 5], [35, 4], [34, 3], [33, 2], [32, 1], [31, 0], [0, 32], [0, 18], [1, 33], [1, 17], [2, 34], [2, 16], [3, 35], [3, 15], [4, 36], [4, 14], [5, 37], [5, 13], [6, 38], [6, 12], [7, 39], [7, 11], [8, 40], [8, 10], [9, 41], [9, 9], [10, 42], [10, 8], [11, 43], [11, 7], [12, 44], [12, 6], [13, 45], [13, 5], [14, 46], [14, 4], [15, 47], [15, 3], [16, 48], [16, 2], [17, 49], [17, 1], [18, 0], [33, 49], [34, 48], [35, 47], [36, 46], [37, 45], [38, 44], [39, 43], [40, 42], [41, 41], [42, 40], [43, 39], [44, 38], [45, 37], [46, 36], [47, 35], [48, 34], [49, 33], [49, 17], [48, 16], [47, 15], [46, 14], [45, 13], [44, 12], [43, 11], [42, 10], [41, 9], [40, 8], [39, 7], [38, 6], [37, 5], [36, 4], [35, 3], [34, 2], [33, 1], [32, 0], [0, 33], [0, 17], [1, 34], [1, 16], [2, 35], [2, 15], [3, 36], [3, 14], [4, 37], [4, 13], [5, 38], [5, 12], [6, 39], [6, 11], [7, 40], [7, 10], [8, 41], [8, 9], [9, 42], [9, 8], [10, 43], [10, 7], [11, 44], [11, 6], [12, 45], [12, 5], [13, 46], [13, 4], [14, 47], [14, 3], [15, 48], [15, 2], [16, 49], [16, 1], [17, 0], [34, 49], [35, 48], [36, 47], [37, 46], [38, 45], [39, 44], [40, 43], [41, 42], [42, 41], [43, 40], [44, 39], [45, 38], [46, 37], [47, 36], [48, 35], [49, 34], [49, 16], [48, 15], [47, 14], [46, 13], [45, 12], [44, 11], [43, 10], [42, 9], [41, 8], [40, 7], [39, 6], [38, 5], [37, 4], [36, 3], [35, 2], [34, 1], [33, 0], [0, 34], [0, 16], [1, 35], [1, 15], [2, 36], [2, 14], [3, 37], [3, 13], [4, 38], [4, 12], [5, 39], [5, 11], [6, 40], [6, 10], [7, 41], [7, 9], [8, 42], [8, 8], [9, 43], [9, 7], [10, 44], [10, 6], [11, 45], [11, 5], [12, 46], [12, 4], [13, 47], [13, 3], [14, 48], [14, 2], [15, 49], [15, 1], [16, 0], [35, 49], [36, 48], [37, 47], [38, 46], [39, 45], [40, 44], [41, 43], [42, 42], [43, 41], [44, 40], [45, 39], [46, 38], [47, 37], [48, 36], [49, 35], [49, 15], [48, 14], [47, 13], [46, 12], [45, 11], [44, 10], [43, 9], [42, 8], [41, 7], [40, 6], [39, 5], [38, 4], [37, 3], [36, 2], [35, 1], [34, 0], [0, 35], [0, 15], [1, 36], [1, 14], [2, 37], [2, 13], [3, 38], [3, 12], [4, 39], [4, 11], [5, 40], [5, 10], [6, 41], [6, 9], [7, 42], [7, 8], [8, 43], [8, 7], [9, 44], [9, 6], [10, 45], [10, 5], [11, 46], [11, 4], [12, 47], [12, 3], [13, 48], [13, 2], [14, 49], [14, 1], [15, 0], [36, 49], [37, 48], [38, 47], [39, 46], [40, 45], [41, 44], [42, 43], [43, 42], [44, 41], [45, 40], [46, 39], [47, 38], [48, 37], [49, 36], [49, 14], [48, 13], [47, 12], [46, 11], [45, 10], [44, 9], [43, 8], [42, 7], [41, 6], [40, 5], [39, 4], [38, 3], [37, 2], [36, 1], [35, 0], [0, 36], [0, 14], [1, 37], [1, 13], [2, 38], [2, 12], [3, 39], [3, 11], [4, 40], [4, 10], [5, 41], [5, 9], [6, 42], [6, 8], [7, 43], [7, 7], [8, 44], [8, 6], [9, 45], [9, 5], [10, 46], [10, 4], [11, 47], [11, 3], [12, 48], [12, 2], [13, 49], [13, 1], [14, 0], [37, 49], [38, 48], [39, 47], [40, 46], [41, 45], [42, 44], [43, 43], [44, 42], [45, 41], [46, 40], [47, 39], [48, 38], [49, 37], [49, 13], [48, 12], [47, 11], [46, 10], [45, 9], [44, 8], [43, 7], [42, 6], [41, 5], [40, 4], [39, 3], [38, 2], [37, 1], [36, 0], [0, 37], [0, 13], [1, 38], [1, 12], [2, 39], [2, 11], [3, 40], [3, 10], [4, 41], [4, 9], [5, 42], [5, 8], [6, 43], [6, 7], [7, 44], [7, 6], [8, 45], [8, 5], [9, 46], [9, 4], [10, 47], [10, 3], [11, 48], [11, 2], [12, 49], [12, 1], [13, 0], [38, 49], [39, 48], [40, 47], [41, 46], [42, 45], [43, 44], [44, 43], [45, 42], [46, 41], [47, 40], [48, 39], [49, 38], [49, 12], [48, 11], [47, 10], [46, 9], [45, 8], [44, 7], [43, 6], [42, 5], [41, 4], [40, 3], [39, 2], [38, 1], [37, 0], [0, 38], [0, 12], [1, 39], [1, 11], [2, 40], [2, 10], [3, 41], [3, 9], [4, 42], [4, 8], [5, 43], [5, 7], [6, 44], [6, 6], [7, 45], [7, 5], [8, 46], [8, 4], [9, 47], [9, 3], [10, 48], [10, 2], [11, 49], [11, 1], [12, 0], [39, 49], [40, 48], [41, 47], [42, 46], [43, 45], [44, 44], [45, 43], [46, 42], [47, 41], [48, 40], [49, 39], [49, 11], [48, 10], [47, 9], [46, 8], [45, 7], [44, 6], [43, 5], [42, 4], [41, 3], [40, 2], [39, 1], [38, 0], [0, 39], [0, 11], [1, 40], [1, 10], [2, 41], [2, 9], [3, 42], [3, 8], [4, 43], [4, 7], [5, 44], [5, 6], [6, 45], [6, 5], [7, 46], [7, 4], [8, 47], [8, 3], [9, 48], [9, 2], [10, 49], [10, 1], [11, 0], [40, 49], [41, 48], [42, 47], [43, 46], [44, 45], [45, 44], [46, 43], [47, 42], [48, 41], [49, 40], [49, 10], [48, 9], [47, 8], [46, 7], [45, 6], [44, 5], [43, 4], [42, 3], [41, 2], [40, 1], [39, 0], [0, 40], [0, 10], [1, 41], [1, 9], [2, 42], [2, 8], [3, 43], [3, 7], [4, 44], [4, 6], [5, 45], [5, 5], [6, 46], [6, 4], [7, 47], [7, 3], [8, 48], [8, 2], [9, 49], [9, 1], [10, 0], [41, 49], [42, 48], [43, 47], [44, 46], [45, 45], [46, 44], [47, 43], [48, 42], [49, 41], [49, 9], [48, 8], [47, 7], [46, 6], [45, 5], [44, 4], [43, 3], [42, 2], [41, 1], [40, 0], [0, 41], [0, 9], [1, 42], [1, 8], [2, 43], [2, 7], [3, 44], [3, 6], [4, 45], [4, 5], [5, 46], [5, 4], [6, 47], [6, 3], [7, 48], [7, 2], [8, 49], [8, 1], [9, 0], [42, 49], [43, 48], [44, 47], [45, 46], [46, 45], [47, 44], [48, 43], [49, 42], [49, 8], [48, 7], [47, 6], [46, 5], [45, 4], [44, 3], [43, 2], [42, 1], [41, 0], [0, 42], [0, 8], [1, 43], [1, 7], [2, 44], [2, 6], [3, 45], [3, 5], [4, 46], [4, 4], [5, 47], [5, 3], [6, 48], [6, 2], [7, 49], [7, 1], [8, 0], [43, 49], [44, 48], [45, 47], [46, 46], [47, 45], [48, 44], [49, 43], [49, 7], [48, 6], [47, 5], [46, 4], [45, 3], [44, 2], [43, 1], [42, 0], [0, 43], [0, 7], [1, 44], [1, 6], [2, 45], [2, 5], [3, 46], [3, 4], [4, 47], [4, 3], [5, 48], [5, 2], [6, 49], [6, 1], [7, 0], [44, 49], [45, 48], [46, 47], [47, 46], [48, 45], [49, 44], [49, 6], [48, 5], [47, 4], [46, 3], [45, 2], [44, 1], [43, 0], [0, 44], [0, 6], [1, 45], [1, 5], [2, 46], [2, 4], [3, 47], [3, 3], [4, 48], [4, 2], [5, 49], [5, 1], [6, 0], [45, 49], [46, 48], [47, 47], [48, 46], [49, 45], [49, 5], [48, 4], [47, 3], [46, 2], [45, 1], [44, 0], [0, 45], [0, 5], [1, 46], [1, 4], [2, 47], [2, 3], [3, 48], [3, 2], [4, 49], [4, 1], [5, 0], [46, 49], [47, 48], [48, 47], [49, 46], [49, 4], [48, 3], [47, 2], [46, 1], [45, 0], [0, 46], [0, 4], [1, 47], [1, 3], [2, 48], [2, 2], [3, 49], [3, 1], [4, 0], [47, 49], [48, 48], [49, 47], [49, 3], [48, 2], [47, 1], [46, 0], [0, 47], [0, 3], [1, 48], [1, 2], [2, 49], [2, 1], [3, 0], [48, 49], [49, 48], [49, 2], [48, 1], [47, 0], [0, 48], [0, 2], [1, 49], [1, 1], [2, 0], [49, 49], [49, 1], [48, 0], [0, 49], [0, 1], [1, 0], [49, 0], [0, 0]]\n assert candidate(rows = 4,cols = 6,rCenter = 3,cCenter = 0) == [[3, 0], [2, 0], [3, 1], [1, 0], [2, 1], [3, 2], [0, 0], [1, 1], [2, 2], [3, 3], [0, 1], [1, 2], [2, 3], [3, 4], [0, 2], [1, 3], [2, 4], [3, 5], [0, 3], [1, 4], [2, 5], [0, 4], [1, 5], [0, 5]]\n assert candidate(rows = 10,cols = 10,rCenter = 0,cCenter = 9) == [[0, 9], [1, 9], [0, 8], [2, 9], [1, 8], [0, 7], [3, 9], [2, 8], [1, 7], [0, 6], [4, 9], [3, 8], [2, 7], [1, 6], [0, 5], [5, 9], [4, 8], [3, 7], [2, 6], [1, 5], [0, 4], [6, 9], [5, 8], [4, 7], [3, 6], [2, 5], [1, 4], [0, 3], [7, 9], [6, 8], [5, 7], [4, 6], [3, 5], [2, 4], [1, 3], [0, 2], [8, 9], [7, 8], [6, 7], [5, 6], [4, 5], [3, 4], [2, 3], [1, 2], [0, 1], [9, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1], [0, 0], [9, 8], [8, 7], [7, 6], [6, 5], [5, 4], [4, 3], [3, 2], [2, 1], [1, 0], [9, 7], [8, 6], [7, 5], [6, 4], [5, 3], [4, 2], [3, 1], [2, 0], [9, 6], [8, 5], [7, 4], [6, 3], [5, 2], [4, 1], [3, 0], [9, 5], [8, 4], [7, 3], [6, 2], [5, 1], [4, 0], [9, 4], [8, 3], [7, 2], [6, 1], [5, 0], [9, 3], [8, 2], [7, 1], [6, 0], [9, 2], [8, 1], [7, 0], [9, 1], [8, 0], [9, 0]]\n assert candidate(rows = 7,cols = 12,rCenter = 6,cCenter = 11) == [[6, 11], [5, 11], [6, 10], [4, 11], [5, 10], [6, 9], [3, 11], [4, 10], [5, 9], [6, 8], [2, 11], [3, 10], [4, 9], [5, 8], [6, 7], [1, 11], [2, 10], [3, 9], [4, 8], [5, 7], [6, 6], [0, 11], [1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [0, 10], [1, 9], [2, 8], [3, 7], [4, 6], [5, 5], [6, 4], [0, 9], [1, 8], [2, 7], [3, 6], [4, 5], [5, 4], [6, 3], [0, 8], [1, 7], [2, 6], [3, 5], [4, 4], [5, 3], [6, 2], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0], [0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0], [0, 4], [1, 3], [2, 2], [3, 1], [4, 0], [0, 3], [1, 2], [2, 1], [3, 0], [0, 2], [1, 1], [2, 0], [0, 1], [1, 0], [0, 0]]\n assert candidate(rows = 7,cols = 2,rCenter = 3,cCenter = 1) == [[3, 1], [2, 1], [4, 1], [3, 0], [1, 1], [2, 0], [5, 1], [4, 0], [0, 1], [1, 0], [6, 1], [5, 0], [0, 0], [6, 0]]\n assert candidate(rows = 5,cols = 5,rCenter = 3,cCenter = 3) == [[3, 3], [2, 3], [3, 4], [4, 3], [3, 2], [1, 3], [2, 4], [2, 2], [4, 4], [4, 2], [3, 1], [0, 3], [1, 4], [1, 2], [2, 1], [4, 1], [3, 0], [0, 4], [0, 2], [1, 1], [2, 0], [4, 0], [0, 1], [1, 0], [0, 0]]\n assert candidate(rows = 5,cols = 10,rCenter = 3,cCenter = 0) == [[3, 0], [2, 0], [3, 1], [4, 0], [1, 0], [2, 1], [3, 2], [4, 1], [0, 0], [1, 1], [2, 2], [3, 3], [4, 2], [0, 1], [1, 2], [2, 3], [3, 4], [4, 3], [0, 2], [1, 3], [2, 4], [3, 5], [4, 4], [0, 3], [1, 4], [2, 5], [3, 6], [4, 5], [0, 4], [1, 5], [2, 6], [3, 7], [4, 6], [0, 5], [1, 6], [2, 7], [3, 8], [4, 7], [0, 6], [1, 7], [2, 8], [3, 9], [4, 8], [0, 7], [1, 8], [2, 9], [4, 9], [0, 8], [1, 9], [0, 9]]\n assert candidate(rows = 100,cols = 1,rCenter = 50,cCenter = 0) == [[50, 0], [49, 0], [51, 0], [48, 0], [52, 0], [47, 0], [53, 0], [46, 0], [54, 0], [45, 0], [55, 0], [44, 0], [56, 0], [43, 0], [57, 0], [42, 0], [58, 0], [41, 0], [59, 0], [40, 0], [60, 0], [39, 0], [61, 0], [38, 0], [62, 0], [37, 0], [63, 0], [36, 0], [64, 0], [35, 0], [65, 0], [34, 0], [66, 0], [33, 0], [67, 0], [32, 0], [68, 0], [31, 0], [69, 0], [30, 0], [70, 0], [29, 0], [71, 0], [28, 0], [72, 0], [27, 0], [73, 0], [26, 0], [74, 0], [25, 0], [75, 0], [24, 0], [76, 0], [23, 0], [77, 0], [22, 0], [78, 0], [21, 0], [79, 0], [20, 0], [80, 0], [19, 0], [81, 0], [18, 0], [82, 0], [17, 0], [83, 0], [16, 0], [84, 0], [15, 0], [85, 0], [14, 0], [86, 0], [13, 0], [87, 0], [12, 0], [88, 0], [11, 0], [89, 0], [10, 0], [90, 0], [9, 0], [91, 0], [8, 0], [92, 0], [7, 0], [93, 0], [6, 0], [94, 0], [5, 0], [95, 0], [4, 0], [96, 0], [3, 0], [97, 0], [2, 0], [98, 0], [1, 0], [99, 0], [0, 0]]\n assert candidate(rows = 12,cols = 12,rCenter = 3,cCenter = 3) == [[3, 3], [2, 3], [3, 4], [4, 3], [3, 2], [1, 3], [2, 4], [2, 2], [3, 5], [4, 4], [5, 3], [4, 2], [3, 1], [0, 3], [1, 4], [1, 2], [2, 5], [2, 1], [3, 6], [4, 5], [5, 4], [6, 3], [5, 2], [4, 1], [3, 0], [0, 4], [0, 2], [1, 5], [1, 1], [2, 6], [2, 0], [3, 7], [4, 6], [5, 5], [6, 4], [7, 3], [6, 2], [5, 1], [4, 0], [0, 5], [0, 1], [1, 6], [1, 0], [2, 7], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [7, 2], [6, 1], [5, 0], [0, 6], [0, 0], [1, 7], [2, 8], [3, 9], [4, 8], [5, 7], [6, 6], [7, 5], [8, 4], [9, 3], [8, 2], [7, 1], [6, 0], [0, 7], [1, 8], [2, 9], [3, 10], [4, 9], [5, 8], [6, 7], [7, 6], [8, 5], [9, 4], [10, 3], [9, 2], [8, 1], [7, 0], [0, 8], [1, 9], [2, 10], [3, 11], [4, 10], [5, 9], [6, 8], [7, 7], [8, 6], [9, 5], [10, 4], [11, 3], [10, 2], [9, 1], [8, 0], [0, 9], [1, 10], [2, 11], [4, 11], [5, 10], [6, 9], [7, 8], [8, 7], [9, 6], [10, 5], [11, 4], [11, 2], [10, 1], [9, 0], [0, 10], [1, 11], [5, 11], [6, 10], [7, 9], [8, 8], [9, 7], [10, 6], [11, 5], [11, 1], [10, 0], [0, 11], [6, 11], [7, 10], [8, 9], [9, 8], [10, 7], [11, 6], [11, 0], [7, 11], [8, 10], [9, 9], [10, 8], [11, 7], [8, 11], [9, 10], [10, 9], [11, 8], [9, 11], [10, 10], [11, 9], [10, 11], [11, 10], [11, 11]]\n assert candidate(rows = 20,cols = 5,rCenter = 19,cCenter = 0) == [[19, 0], [18, 0], [19, 1], [17, 0], [18, 1], [19, 2], [16, 0], [17, 1], [18, 2], [19, 3], [15, 0], [16, 1], [17, 2], [18, 3], [19, 4], [14, 0], [15, 1], [16, 2], [17, 3], [18, 4], [13, 0], [14, 1], [15, 2], [16, 3], [17, 4], [12, 0], [13, 1], [14, 2], [15, 3], [16, 4], [11, 0], [12, 1], [13, 2], [14, 3], [15, 4], [10, 0], [11, 1], [12, 2], [13, 3], [14, 4], [9, 0], [10, 1], [11, 2], [12, 3], [13, 4], [8, 0], [9, 1], [10, 2], [11, 3], [12, 4], [7, 0], [8, 1], [9, 2], [10, 3], [11, 4], [6, 0], [7, 1], [8, 2], [9, 3], [10, 4], [5, 0], [6, 1], [7, 2], [8, 3], [9, 4], [4, 0], [5, 1], [6, 2], [7, 3], [8, 4], [3, 0], [4, 1], [5, 2], [6, 3], [7, 4], [2, 0], [3, 1], [4, 2], [5, 3], [6, 4], [1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 1], [1, 2], [2, 3], [3, 4], [0, 2], [1, 3], [2, 4], [0, 3], [1, 4], [0, 4]]\n assert candidate(rows = 6,cols = 8,rCenter = 4,cCenter = 7) == [[4, 7], [3, 7], [5, 7], [4, 6], [2, 7], [3, 6], [5, 6], [4, 5], [1, 7], [2, 6], [3, 5], [5, 5], [4, 4], [0, 7], [1, 6], [2, 5], [3, 4], [5, 4], [4, 3], [0, 6], [1, 5], [2, 4], [3, 3], [5, 3], [4, 2], [0, 5], [1, 4], [2, 3], [3, 2], [5, 2], [4, 1], [0, 4], [1, 3], [2, 2], [3, 1], [5, 1], [4, 0], [0, 3], [1, 2], [2, 1], [3, 0], [5, 0], [0, 2], [1, 1], [2, 0], [0, 1], [1, 0], [0, 0]]\n assert candidate(rows = 4,cols = 5,rCenter = 2,cCenter = 3) == [[2, 3], [1, 3], [2, 4], [3, 3], [2, 2], [0, 3], [1, 4], [1, 2], [3, 4], [3, 2], [2, 1], [0, 4], [0, 2], [1, 1], [3, 1], [2, 0], [0, 1], [1, 0], [3, 0], [0, 0]]\n assert candidate(rows = 8,cols = 8,rCenter = 1,cCenter = 1) == [[1, 1], [0, 1], [1, 2], [2, 1], [1, 0], [0, 2], [0, 0], [1, 3], [2, 2], [3, 1], [2, 0], [0, 3], [1, 4], [2, 3], [3, 2], [4, 1], [3, 0], [0, 4], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [4, 0], [0, 5], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [5, 0], [0, 6], [1, 7], [2, 6], [3, 5], [4, 4], [5, 3], [6, 2], [7, 1], [6, 0], [0, 7], [2, 7], [3, 6], [4, 5], [5, 4], [6, 3], [7, 2], [7, 0], [3, 7], [4, 6], [5, 5], [6, 4], [7, 3], [4, 7], [5, 6], [6, 5], [7, 4], [5, 7], [6, 6], [7, 5], [6, 7], [7, 6], [7, 7]]\n assert candidate(rows = 6,cols = 4,rCenter = 0,cCenter = 0) == [[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, 0], [0, 3], [1, 2], [2, 1], [3, 0], [1, 3], [2, 2], [3, 1], [4, 0], [2, 3], [3, 2], [4, 1], [5, 0], [3, 3], [4, 2], [5, 1], [4, 3], [5, 2], [5, 3]]\n assert candidate(rows = 8,cols = 4,rCenter = 0,cCenter = 3) == [[0, 3], [1, 3], [0, 2], [2, 3], [1, 2], [0, 1], [3, 3], [2, 2], [1, 1], [0, 0], [4, 3], [3, 2], [2, 1], [1, 0], [5, 3], [4, 2], [3, 1], [2, 0], [6, 3], [5, 2], [4, 1], [3, 0], [7, 3], [6, 2], [5, 1], [4, 0], [7, 2], [6, 1], [5, 0], [7, 1], [6, 0], [7, 0]]\n assert candidate(rows = 7,cols = 7,rCenter = 3,cCenter = 3) == [[3, 3], [2, 3], [3, 4], [4, 3], [3, 2], [1, 3], [2, 4], [2, 2], [3, 5], [4, 4], [5, 3], [4, 2], [3, 1], [0, 3], [1, 4], [1, 2], [2, 5], [2, 1], [3, 6], [4, 5], [5, 4], [6, 3], [5, 2], [4, 1], [3, 0], [0, 4], [0, 2], [1, 5], [1, 1], [2, 6], [2, 0], [4, 6], [5, 5], [6, 4], [6, 2], [5, 1], [4, 0], [0, 5], [0, 1], [1, 6], [1, 0], [5, 6], [6, 5], [6, 1], [5, 0], [0, 6], [0, 0], [6, 6], [6, 0]]\n assert candidate(rows = 10,cols = 10,rCenter = 9,cCenter = 0) == [[9, 0], [8, 0], [9, 1], [7, 0], [8, 1], [9, 2], [6, 0], [7, 1], [8, 2], [9, 3], [5, 0], [6, 1], [7, 2], [8, 3], [9, 4], [4, 0], [5, 1], [6, 2], [7, 3], [8, 4], [9, 5], [3, 0], [4, 1], [5, 2], [6, 3], [7, 4], [8, 5], [9, 6], [2, 0], [3, 1], [4, 2], [5, 3], [6, 4], [7, 5], [8, 6], [9, 7], [1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 8], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [0, 3], [1, 4], [2, 5], [3, 6], [4, 7], [5, 8], [6, 9], [0, 4], [1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [0, 5], [1, 6], [2, 7], [3, 8], [4, 9], [0, 6], [1, 7], [2, 8], [3, 9], [0, 7], [1, 8], [2, 9], [0, 8], [1, 9], [0, 9]]\n assert candidate(rows = 15,cols = 5,rCenter = 14,cCenter = 2) == [[14, 2], [13, 2], [14, 3], [14, 1], [12, 2], [13, 3], [13, 1], [14, 4], [14, 0], [11, 2], [12, 3], [12, 1], [13, 4], [13, 0], [10, 2], [11, 3], [11, 1], [12, 4], [12, 0], [9, 2], [10, 3], [10, 1], [11, 4], [11, 0], [8, 2], [9, 3], [9, 1], [10, 4], [10, 0], [7, 2], [8, 3], [8, 1], [9, 4], [9, 0], [6, 2], [7, 3], [7, 1], [8, 4], [8, 0], [5, 2], [6, 3], [6, 1], [7, 4], [7, 0], [4, 2], [5, 3], [5, 1], [6, 4], [6, 0], [3, 2], [4, 3], [4, 1], [5, 4], [5, 0], [2, 2], [3, 3], [3, 1], [4, 4], [4, 0], [1, 2], [2, 3], [2, 1], [3, 4], [3, 0], [0, 2], [1, 3], [1, 1], [2, 4], [2, 0], [0, 3], [0, 1], [1, 4], [1, 0], [0, 4], [0, 0]]\n assert candidate(rows = 7,cols = 7,rCenter = 3,cCenter = 4) == [[3, 4], [2, 4], [3, 5], [4, 4], [3, 3], [1, 4], [2, 5], [2, 3], [3, 6], [4, 5], [5, 4], [4, 3], [3, 2], [0, 4], [1, 5], [1, 3], [2, 6], [2, 2], [4, 6], [5, 5], [6, 4], [5, 3], [4, 2], [3, 1], [0, 5], [0, 3], [1, 6], [1, 2], [2, 1], [5, 6], [6, 5], [6, 3], [5, 2], [4, 1], [3, 0], [0, 6], [0, 2], [1, 1], [2, 0], [6, 6], [6, 2], [5, 1], [4, 0], [0, 1], [1, 0], [6, 1], [5, 0], [0, 0], [6, 0]]\n assert candidate(rows = 10,cols = 1,rCenter = 5,cCenter = 0) == [[5, 0], [4, 0], [6, 0], [3, 0], [7, 0], [2, 0], [8, 0], [1, 0], [9, 0], [0, 0]]\n assert candidate(rows = 6,cols = 6,rCenter = 3,cCenter = 3) == [[3, 3], [2, 3], [3, 4], [4, 3], [3, 2], [1, 3], [2, 4], [2, 2], [3, 5], [4, 4], [5, 3], [4, 2], [3, 1], [0, 3], [1, 4], [1, 2], [2, 5], [2, 1], [4, 5], [5, 4], [5, 2], [4, 1], [3, 0], [0, 4], [0, 2], [1, 5], [1, 1], [2, 0], [5, 5], [5, 1], [4, 0], [0, 5], [0, 1], [1, 0], [5, 0], [0, 0]]\n assert candidate(rows = 6,cols = 4,rCenter = 3,cCenter = 0) == [[3, 0], [2, 0], [3, 1], [4, 0], [1, 0], [2, 1], [3, 2], [4, 1], [5, 0], [0, 0], [1, 1], [2, 2], [3, 3], [4, 2], [5, 1], [0, 1], [1, 2], [2, 3], [4, 3], [5, 2], [0, 2], [1, 3], [5, 3], [0, 3]]\n assert candidate(rows = 7,cols = 7,rCenter = 0,cCenter = 0) == [[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, 0], [0, 3], [1, 2], [2, 1], [3, 0], [0, 4], [1, 3], [2, 2], [3, 1], [4, 0], [0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [2, 6], [3, 5], [4, 4], [5, 3], [6, 2], [3, 6], [4, 5], [5, 4], [6, 3], [4, 6], [5, 5], [6, 4], [5, 6], [6, 5], [6, 6]]\n assert candidate(rows = 4,cols = 5,rCenter = 0,cCenter = 0) == [[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, 0], [0, 3], [1, 2], [2, 1], [3, 0], [0, 4], [1, 3], [2, 2], [3, 1], [1, 4], [2, 3], [3, 2], [2, 4], [3, 3], [3, 4]]\n assert candidate(rows = 6,cols = 3,rCenter = 3,cCenter = 1) == [[3, 1], [2, 1], [3, 2], [4, 1], [3, 0], [1, 1], [2, 2], [2, 0], [4, 2], [5, 1], [4, 0], [0, 1], [1, 2], [1, 0], [5, 2], [5, 0], [0, 2], [0, 0]]\n assert candidate(rows = 15,cols = 5,rCenter = 0,cCenter = 0) == [[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, 0], [0, 3], [1, 2], [2, 1], [3, 0], [0, 4], [1, 3], [2, 2], [3, 1], [4, 0], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0], [4, 4], [5, 3], [6, 2], [7, 1], [8, 0], [5, 4], [6, 3], [7, 2], [8, 1], [9, 0], [6, 4], [7, 3], [8, 2], [9, 1], [10, 0], [7, 4], [8, 3], [9, 2], [10, 1], [11, 0], [8, 4], [9, 3], [10, 2], [11, 1], [12, 0], [9, 4], [10, 3], [11, 2], [12, 1], [13, 0], [10, 4], [11, 3], [12, 2], [13, 1], [14, 0], [11, 4], [12, 3], [13, 2], [14, 1], [12, 4], [13, 3], [14, 2], [13, 4], [14, 3], [14, 4]]\n assert candidate(rows = 12,cols = 12,rCenter = 6,cCenter = 6) == [[6, 6], [5, 6], [6, 7], [7, 6], [6, 5], [4, 6], [5, 7], [5, 5], [6, 8], [7, 7], [8, 6], [7, 5], [6, 4], [3, 6], [4, 7], [4, 5], [5, 8], [5, 4], [6, 9], [7, 8], [8, 7], [9, 6], [8, 5], [7, 4], [6, 3], [2, 6], [3, 7], [3, 5], [4, 8], [4, 4], [5, 9], [5, 3], [6, 10], [7, 9], [8, 8], [9, 7], [10, 6], [9, 5], [8, 4], [7, 3], [6, 2], [1, 6], [2, 7], [2, 5], [3, 8], [3, 4], [4, 9], [4, 3], [5, 10], [5, 2], [6, 11], [7, 10], [8, 9], [9, 8], [10, 7], [11, 6], [10, 5], [9, 4], [8, 3], [7, 2], [6, 1], [0, 6], [1, 7], [1, 5], [2, 8], [2, 4], [3, 9], [3, 3], [4, 10], [4, 2], [5, 11], [5, 1], [7, 11], [8, 10], [9, 9], [10, 8], [11, 7], [11, 5], [10, 4], [9, 3], [8, 2], [7, 1], [6, 0], [0, 7], [0, 5], [1, 8], [1, 4], [2, 9], [2, 3], [3, 10], [3, 2], [4, 11], [4, 1], [5, 0], [8, 11], [9, 10], [10, 9], [11, 8], [11, 4], [10, 3], [9, 2], [8, 1], [7, 0], [0, 8], [0, 4], [1, 9], [1, 3], [2, 10], [2, 2], [3, 11], [3, 1], [4, 0], [9, 11], [10, 10], [11, 9], [11, 3], [10, 2], [9, 1], [8, 0], [0, 9], [0, 3], [1, 10], [1, 2], [2, 11], [2, 1], [3, 0], [10, 11], [11, 10], [11, 2], [10, 1], [9, 0], [0, 10], [0, 2], [1, 11], [1, 1], [2, 0], [11, 11], [11, 1], [10, 0], [0, 11], [0, 1], [1, 0], [11, 0], [0, 0]]\n assert candidate(rows = 20,cols = 20,rCenter = 19,cCenter = 19) == [[19, 19], [18, 19], [19, 18], [17, 19], [18, 18], [19, 17], [16, 19], [17, 18], [18, 17], [19, 16], [15, 19], [16, 18], [17, 17], [18, 16], [19, 15], [14, 19], [15, 18], [16, 17], [17, 16], [18, 15], [19, 14], [13, 19], [14, 18], [15, 17], [16, 16], [17, 15], [18, 14], [19, 13], [12, 19], [13, 18], [14, 17], [15, 16], [16, 15], [17, 14], [18, 13], [19, 12], [11, 19], [12, 18], [13, 17], [14, 16], [15, 15], [16, 14], [17, 13], [18, 12], [19, 11], [10, 19], [11, 18], [12, 17], [13, 16], [14, 15], [15, 14], [16, 13], [17, 12], [18, 11], [19, 10], [9, 19], [10, 18], [11, 17], [12, 16], [13, 15], [14, 14], [15, 13], [16, 12], [17, 11], [18, 10], [19, 9], [8, 19], [9, 18], [10, 17], [11, 16], [12, 15], [13, 14], [14, 13], [15, 12], [16, 11], [17, 10], [18, 9], [19, 8], [7, 19], [8, 18], [9, 17], [10, 16], [11, 15], [12, 14], [13, 13], [14, 12], [15, 11], [16, 10], [17, 9], [18, 8], [19, 7], [6, 19], [7, 18], [8, 17], [9, 16], [10, 15], [11, 14], [12, 13], [13, 12], [14, 11], [15, 10], [16, 9], [17, 8], [18, 7], [19, 6], [5, 19], [6, 18], [7, 17], [8, 16], [9, 15], [10, 14], [11, 13], [12, 12], [13, 11], [14, 10], [15, 9], [16, 8], [17, 7], [18, 6], [19, 5], [4, 19], [5, 18], [6, 17], [7, 16], [8, 15], [9, 14], [10, 13], [11, 12], [12, 11], [13, 10], [14, 9], [15, 8], [16, 7], [17, 6], [18, 5], [19, 4], [3, 19], [4, 18], [5, 17], [6, 16], [7, 15], [8, 14], [9, 13], [10, 12], [11, 11], [12, 10], [13, 9], [14, 8], [15, 7], [16, 6], [17, 5], [18, 4], [19, 3], [2, 19], [3, 18], [4, 17], [5, 16], [6, 15], [7, 14], [8, 13], [9, 12], [10, 11], [11, 10], [12, 9], [13, 8], [14, 7], [15, 6], [16, 5], [17, 4], [18, 3], [19, 2], [1, 19], [2, 18], [3, 17], [4, 16], [5, 15], [6, 14], [7, 13], [8, 12], [9, 11], [10, 10], [11, 9], [12, 8], [13, 7], [14, 6], [15, 5], [16, 4], [17, 3], [18, 2], [19, 1], [0, 19], [1, 18], [2, 17], [3, 16], [4, 15], [5, 14], [6, 13], [7, 12], [8, 11], [9, 10], [10, 9], [11, 8], [12, 7], [13, 6], [14, 5], [15, 4], [16, 3], [17, 2], [18, 1], [19, 0], [0, 18], [1, 17], [2, 16], [3, 15], [4, 14], [5, 13], [6, 12], [7, 11], [8, 10], [9, 9], [10, 8], [11, 7], [12, 6], [13, 5], [14, 4], [15, 3], [16, 2], [17, 1], [18, 0], [0, 17], [1, 16], [2, 15], [3, 14], [4, 13], [5, 12], [6, 11], [7, 10], [8, 9], [9, 8], [10, 7], [11, 6], [12, 5], [13, 4], [14, 3], [15, 2], [16, 1], [17, 0], [0, 16], [1, 15], [2, 14], [3, 13], [4, 12], [5, 11], [6, 10], [7, 9], [8, 8], [9, 7], [10, 6], [11, 5], [12, 4], [13, 3], [14, 2], [15, 1], [16, 0], [0, 15], [1, 14], [2, 13], [3, 12], [4, 11], [5, 10], [6, 9], [7, 8], [8, 7], [9, 6], [10, 5], [11, 4], [12, 3], [13, 2], [14, 1], [15, 0], [0, 14], [1, 13], [2, 12], [3, 11], [4, 10], [5, 9], [6, 8], [7, 7], [8, 6], [9, 5], [10, 4], [11, 3], [12, 2], [13, 1], [14, 0], [0, 13], [1, 12], [2, 11], [3, 10], [4, 9], [5, 8], [6, 7], [7, 6], [8, 5], [9, 4], [10, 3], [11, 2], [12, 1], [13, 0], [0, 12], [1, 11], [2, 10], [3, 9], [4, 8], [5, 7], [6, 6], [7, 5], [8, 4], [9, 3], [10, 2], [11, 1], [12, 0], [0, 11], [1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1], [11, 0], [0, 10], [1, 9], [2, 8], [3, 7], [4, 6], [5, 5], [6, 4], [7, 3], [8, 2], [9, 1], [10, 0], [0, 9], [1, 8], [2, 7], [3, 6], [4, 5], [5, 4], [6, 3], [7, 2], [8, 1], [9, 0], [0, 8], [1, 7], [2, 6], [3, 5], [4, 4], [5, 3], [6, 2], [7, 1], [8, 0], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0], [0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0], [0, 4], [1, 3], [2, 2], [3, 1], [4, 0], [0, 3], [1, 2], [2, 1], [3, 0], [0, 2], [1, 1], [2, 0], [0, 1], [1, 0], [0, 0]]\n assert candidate(rows = 8,cols = 8,rCenter = 7,cCenter = 7) == [[7, 7], [6, 7], [7, 6], [5, 7], [6, 6], [7, 5], [4, 7], [5, 6], [6, 5], [7, 4], [3, 7], [4, 6], [5, 5], [6, 4], [7, 3], [2, 7], [3, 6], [4, 5], [5, 4], [6, 3], [7, 2], [1, 7], [2, 6], [3, 5], [4, 4], [5, 3], [6, 2], [7, 1], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0], [0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0], [0, 4], [1, 3], [2, 2], [3, 1], [4, 0], [0, 3], [1, 2], [2, 1], [3, 0], [0, 2], [1, 1], [2, 0], [0, 1], [1, 0], [0, 0]]\n assert candidate(rows = 8,cols = 8,rCenter = 4,cCenter = 4) == [[4, 4], [3, 4], [4, 5], [5, 4], [4, 3], [2, 4], [3, 5], [3, 3], [4, 6], [5, 5], [6, 4], [5, 3], [4, 2], [1, 4], [2, 5], [2, 3], [3, 6], [3, 2], [4, 7], [5, 6], [6, 5], [7, 4], [6, 3], [5, 2], [4, 1], [0, 4], [1, 5], [1, 3], [2, 6], [2, 2], [3, 7], [3, 1], [5, 7], [6, 6], [7, 5], [7, 3], [6, 2], [5, 1], [4, 0], [0, 5], [0, 3], [1, 6], [1, 2], [2, 7], [2, 1], [3, 0], [6, 7], [7, 6], [7, 2], [6, 1], [5, 0], [0, 6], [0, 2], [1, 7], [1, 1], [2, 0], [7, 7], [7, 1], [6, 0], [0, 7], [0, 1], [1, 0], [7, 0], [0, 0]]\n assert candidate(rows = 15,cols = 5,rCenter = 7,cCenter = 2) == [[7, 2], [6, 2], [7, 3], [8, 2], [7, 1], [5, 2], [6, 3], [6, 1], [7, 4], [8, 3], [9, 2], [8, 1], [7, 0], [4, 2], [5, 3], [5, 1], [6, 4], [6, 0], [8, 4], [9, 3], [10, 2], [9, 1], [8, 0], [3, 2], [4, 3], [4, 1], [5, 4], [5, 0], [9, 4], [10, 3], [11, 2], [10, 1], [9, 0], [2, 2], [3, 3], [3, 1], [4, 4], [4, 0], [10, 4], [11, 3], [12, 2], [11, 1], [10, 0], [1, 2], [2, 3], [2, 1], [3, 4], [3, 0], [11, 4], [12, 3], [13, 2], [12, 1], [11, 0], [0, 2], [1, 3], [1, 1], [2, 4], [2, 0], [12, 4], [13, 3], [14, 2], [13, 1], [12, 0], [0, 3], [0, 1], [1, 4], [1, 0], [13, 4], [14, 3], [14, 1], [13, 0], [0, 4], [0, 0], [14, 4], [14, 0]]\n assert candidate(rows = 6,cols = 4,rCenter = 0,cCenter = 3) == [[0, 3], [1, 3], [0, 2], [2, 3], [1, 2], [0, 1], [3, 3], [2, 2], [1, 1], [0, 0], [4, 3], [3, 2], [2, 1], [1, 0], [5, 3], [4, 2], [3, 1], [2, 0], [5, 2], [4, 1], [3, 0], [5, 1], [4, 0], [5, 0]]\n assert candidate(rows = 9,cols = 9,rCenter = 4,cCenter = 8) == [[4, 8], [3, 8], [5, 8], [4, 7], [2, 8], [3, 7], [6, 8], [5, 7], [4, 6], [1, 8], [2, 7], [3, 6], [7, 8], [6, 7], [5, 6], [4, 5], [0, 8], [1, 7], [2, 6], [3, 5], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [0, 7], [1, 6], [2, 5], [3, 4], [8, 7], [7, 6], [6, 5], [5, 4], [4, 3], [0, 6], [1, 5], [2, 4], [3, 3], [8, 6], [7, 5], [6, 4], [5, 3], [4, 2], [0, 5], [1, 4], [2, 3], [3, 2], [8, 5], [7, 4], [6, 3], [5, 2], [4, 1], [0, 4], [1, 3], [2, 2], [3, 1], [8, 4], [7, 3], [6, 2], [5, 1], [4, 0], [0, 3], [1, 2], [2, 1], [3, 0], [8, 3], [7, 2], [6, 1], [5, 0], [0, 2], [1, 1], [2, 0], [8, 2], [7, 1], [6, 0], [0, 1], [1, 0], [8, 1], [7, 0], [0, 0], [8, 0]]\n assert candidate(rows = 5,cols = 5,rCenter = 0,cCenter = 0) == [[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, 0], [0, 3], [1, 2], [2, 1], [3, 0], [0, 4], [1, 3], [2, 2], [3, 1], [4, 0], [1, 4], [2, 3], [3, 2], [4, 1], [2, 4], [3, 3], [4, 2], [3, 4], [4, 3], [4, 4]]\n assert candidate(rows = 7,cols = 5,rCenter = 3,cCenter = 2) == [[3, 2], [2, 2], [3, 3], [4, 2], [3, 1], [1, 2], [2, 3], [2, 1], [3, 4], [4, 3], [5, 2], [4, 1], [3, 0], [0, 2], [1, 3], [1, 1], [2, 4], [2, 0], [4, 4], [5, 3], [6, 2], [5, 1], [4, 0], [0, 3], [0, 1], [1, 4], [1, 0], [5, 4], [6, 3], [6, 1], [5, 0], [0, 4], [0, 0], [6, 4], [6, 0]]\n assert candidate(rows = 8,cols = 3,rCenter = 1,cCenter = 2) == [[1, 2], [0, 2], [2, 2], [1, 1], [0, 1], [3, 2], [2, 1], [1, 0], [0, 0], [4, 2], [3, 1], [2, 0], [5, 2], [4, 1], [3, 0], [6, 2], [5, 1], [4, 0], [7, 2], [6, 1], [5, 0], [7, 1], [6, 0], [7, 0]]\n assert candidate(rows = 7,cols = 2,rCenter = 6,cCenter = 0) == [[6, 0], [5, 0], [6, 1], [4, 0], [5, 1], [3, 0], [4, 1], [2, 0], [3, 1], [1, 0], [2, 1], [0, 0], [1, 1], [0, 1]]\n assert candidate(rows = 8,cols = 8,rCenter = 7,cCenter = 0) == [[7, 0], [6, 0], [7, 1], [5, 0], [6, 1], [7, 2], [4, 0], [5, 1], [6, 2], [7, 3], [3, 0], [4, 1], [5, 2], [6, 3], [7, 4], [2, 0], [3, 1], [4, 2], [5, 3], [6, 4], [7, 5], [1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [0, 3], [1, 4], [2, 5], [3, 6], [4, 7], [0, 4], [1, 5], [2, 6], [3, 7], [0, 5], [1, 6], [2, 7], [0, 6], [1, 7], [0, 7]]\n assert candidate(rows = 5,cols = 9,rCenter = 2,cCenter = 8) == [[2, 8], [1, 8], [3, 8], [2, 7], [0, 8], [1, 7], [4, 8], [3, 7], [2, 6], [0, 7], [1, 6], [4, 7], [3, 6], [2, 5], [0, 6], [1, 5], [4, 6], [3, 5], [2, 4], [0, 5], [1, 4], [4, 5], [3, 4], [2, 3], [0, 4], [1, 3], [4, 4], [3, 3], [2, 2], [0, 3], [1, 2], [4, 3], [3, 2], [2, 1], [0, 2], [1, 1], [4, 2], [3, 1], [2, 0], [0, 1], [1, 0], [4, 1], [3, 0], [0, 0], [4, 0]]\n assert candidate(rows = 60,cols = 25,rCenter = 30,cCenter = 10) == [[30, 10], [29, 10], [30, 11], [31, 10], [30, 9], [28, 10], [29, 11], [29, 9], [30, 12], [31, 11], [32, 10], [31, 9], [30, 8], [27, 10], [28, 11], [28, 9], [29, 12], [29, 8], [30, 13], [31, 12], [32, 11], [33, 10], [32, 9], [31, 8], [30, 7], [26, 10], [27, 11], [27, 9], [28, 12], [28, 8], [29, 13], [29, 7], [30, 14], [31, 13], [32, 12], [33, 11], [34, 10], [33, 9], [32, 8], [31, 7], [30, 6], [25, 10], [26, 11], [26, 9], [27, 12], [27, 8], [28, 13], [28, 7], [29, 14], [29, 6], [30, 15], [31, 14], [32, 13], [33, 12], [34, 11], [35, 10], [34, 9], [33, 8], [32, 7], [31, 6], [30, 5], [24, 10], [25, 11], [25, 9], [26, 12], [26, 8], [27, 13], [27, 7], [28, 14], [28, 6], [29, 15], [29, 5], [30, 16], [31, 15], [32, 14], [33, 13], [34, 12], [35, 11], [36, 10], [35, 9], [34, 8], [33, 7], [32, 6], [31, 5], [30, 4], [23, 10], [24, 11], [24, 9], [25, 12], [25, 8], [26, 13], [26, 7], [27, 14], [27, 6], [28, 15], [28, 5], [29, 16], [29, 4], [30, 17], [31, 16], [32, 15], [33, 14], [34, 13], [35, 12], [36, 11], [37, 10], [36, 9], [35, 8], [34, 7], [33, 6], [32, 5], [31, 4], [30, 3], [22, 10], [23, 11], [23, 9], [24, 12], [24, 8], [25, 13], [25, 7], [26, 14], [26, 6], [27, 15], [27, 5], [28, 16], [28, 4], [29, 17], [29, 3], [30, 18], [31, 17], [32, 16], [33, 15], [34, 14], [35, 13], [36, 12], [37, 11], [38, 10], [37, 9], [36, 8], [35, 7], [34, 6], [33, 5], [32, 4], [31, 3], [30, 2], [21, 10], [22, 11], [22, 9], [23, 12], [23, 8], [24, 13], [24, 7], [25, 14], [25, 6], [26, 15], [26, 5], [27, 16], [27, 4], [28, 17], [28, 3], [29, 18], [29, 2], [30, 19], [31, 18], [32, 17], [33, 16], [34, 15], [35, 14], [36, 13], [37, 12], [38, 11], [39, 10], [38, 9], [37, 8], [36, 7], [35, 6], [34, 5], [33, 4], [32, 3], [31, 2], [30, 1], [20, 10], [21, 11], [21, 9], [22, 12], [22, 8], [23, 13], [23, 7], [24, 14], [24, 6], [25, 15], [25, 5], [26, 16], [26, 4], [27, 17], [27, 3], [28, 18], [28, 2], [29, 19], [29, 1], [30, 20], [31, 19], [32, 18], [33, 17], [34, 16], [35, 15], [36, 14], [37, 13], [38, 12], [39, 11], [40, 10], [39, 9], [38, 8], [37, 7], [36, 6], [35, 5], [34, 4], [33, 3], [32, 2], [31, 1], [30, 0], [19, 10], [20, 11], [20, 9], [21, 12], [21, 8], [22, 13], [22, 7], [23, 14], [23, 6], [24, 15], [24, 5], [25, 16], [25, 4], [26, 17], [26, 3], [27, 18], [27, 2], [28, 19], [28, 1], [29, 20], [29, 0], [30, 21], [31, 20], [32, 19], [33, 18], [34, 17], [35, 16], [36, 15], [37, 14], [38, 13], [39, 12], [40, 11], [41, 10], [40, 9], [39, 8], [38, 7], [37, 6], [36, 5], [35, 4], [34, 3], [33, 2], [32, 1], [31, 0], [18, 10], [19, 11], [19, 9], [20, 12], [20, 8], [21, 13], [21, 7], [22, 14], [22, 6], [23, 15], [23, 5], [24, 16], [24, 4], [25, 17], [25, 3], [26, 18], [26, 2], [27, 19], [27, 1], [28, 20], [28, 0], [29, 21], [30, 22], [31, 21], [32, 20], [33, 19], [34, 18], [35, 17], [36, 16], [37, 15], [38, 14], [39, 13], [40, 12], [41, 11], [42, 10], [41, 9], [40, 8], [39, 7], [38, 6], [37, 5], [36, 4], [35, 3], [34, 2], [33, 1], [32, 0], [17, 10], [18, 11], [18, 9], [19, 12], [19, 8], [20, 13], [20, 7], [21, 14], [21, 6], [22, 15], [22, 5], [23, 16], [23, 4], [24, 17], [24, 3], [25, 18], [25, 2], [26, 19], [26, 1], [27, 20], [27, 0], [28, 21], [29, 22], [30, 23], [31, 22], [32, 21], [33, 20], [34, 19], [35, 18], [36, 17], [37, 16], [38, 15], [39, 14], [40, 13], [41, 12], [42, 11], [43, 10], [42, 9], [41, 8], [40, 7], [39, 6], [38, 5], [37, 4], [36, 3], [35, 2], [34, 1], [33, 0], [16, 10], [17, 11], [17, 9], [18, 12], [18, 8], [19, 13], [19, 7], [20, 14], [20, 6], [21, 15], [21, 5], [22, 16], [22, 4], [23, 17], [23, 3], [24, 18], [24, 2], [25, 19], [25, 1], [26, 20], [26, 0], [27, 21], [28, 22], [29, 23], [30, 24], [31, 23], [32, 22], [33, 21], [34, 20], [35, 19], [36, 18], [37, 17], [38, 16], [39, 15], [40, 14], [41, 13], [42, 12], [43, 11], [44, 10], [43, 9], [42, 8], [41, 7], [40, 6], [39, 5], [38, 4], [37, 3], [36, 2], [35, 1], [34, 0], [15, 10], [16, 11], [16, 9], [17, 12], [17, 8], [18, 13], [18, 7], [19, 14], [19, 6], [20, 15], [20, 5], [21, 16], [21, 4], [22, 17], [22, 3], [23, 18], [23, 2], [24, 19], [24, 1], [25, 20], [25, 0], [26, 21], [27, 22], [28, 23], [29, 24], [31, 24], [32, 23], [33, 22], [34, 21], [35, 20], [36, 19], [37, 18], [38, 17], [39, 16], [40, 15], [41, 14], [42, 13], [43, 12], [44, 11], [45, 10], [44, 9], [43, 8], [42, 7], [41, 6], [40, 5], [39, 4], [38, 3], [37, 2], [36, 1], [35, 0], [14, 10], [15, 11], [15, 9], [16, 12], [16, 8], [17, 13], [17, 7], [18, 14], [18, 6], [19, 15], [19, 5], [20, 16], [20, 4], [21, 17], [21, 3], [22, 18], [22, 2], [23, 19], [23, 1], [24, 20], [24, 0], [25, 21], [26, 22], [27, 23], [28, 24], [32, 24], [33, 23], [34, 22], [35, 21], [36, 20], [37, 19], [38, 18], [39, 17], [40, 16], [41, 15], [42, 14], [43, 13], [44, 12], [45, 11], [46, 10], [45, 9], [44, 8], [43, 7], [42, 6], [41, 5], [40, 4], [39, 3], [38, 2], [37, 1], [36, 0], [13, 10], [14, 11], [14, 9], [15, 12], [15, 8], [16, 13], [16, 7], [17, 14], [17, 6], [18, 15], [18, 5], [19, 16], [19, 4], [20, 17], [20, 3], [21, 18], [21, 2], [22, 19], [22, 1], [23, 20], [23, 0], [24, 21], [25, 22], [26, 23], [27, 24], [33, 24], [34, 23], [35, 22], [36, 21], [37, 20], [38, 19], [39, 18], [40, 17], [41, 16], [42, 15], [43, 14], [44, 13], [45, 12], [46, 11], [47, 10], [46, 9], [45, 8], [44, 7], [43, 6], [42, 5], [41, 4], [40, 3], [39, 2], [38, 1], [37, 0], [12, 10], [13, 11], [13, 9], [14, 12], [14, 8], [15, 13], [15, 7], [16, 14], [16, 6], [17, 15], [17, 5], [18, 16], [18, 4], [19, 17], [19, 3], [20, 18], [20, 2], [21, 19], [21, 1], [22, 20], [22, 0], [23, 21], [24, 22], [25, 23], [26, 24], [34, 24], [35, 23], [36, 22], [37, 21], [38, 20], [39, 19], [40, 18], [41, 17], [42, 16], [43, 15], [44, 14], [45, 13], [46, 12], [47, 11], [48, 10], [47, 9], [46, 8], [45, 7], [44, 6], [43, 5], [42, 4], [41, 3], [40, 2], [39, 1], [38, 0], [11, 10], [12, 11], [12, 9], [13, 12], [13, 8], [14, 13], [14, 7], [15, 14], [15, 6], [16, 15], [16, 5], [17, 16], [17, 4], [18, 17], [18, 3], [19, 18], [19, 2], [20, 19], [20, 1], [21, 20], [21, 0], [22, 21], [23, 22], [24, 23], [25, 24], [35, 24], [36, 23], [37, 22], [38, 21], [39, 20], [40, 19], [41, 18], [42, 17], [43, 16], [44, 15], [45, 14], [46, 13], [47, 12], [48, 11], [49, 10], [48, 9], [47, 8], [46, 7], [45, 6], [44, 5], [43, 4], [42, 3], [41, 2], [40, 1], [39, 0], [10, 10], [11, 11], [11, 9], [12, 12], [12, 8], [13, 13], [13, 7], [14, 14], [14, 6], [15, 15], [15, 5], [16, 16], [16, 4], [17, 17], [17, 3], [18, 18], [18, 2], [19, 19], [19, 1], [20, 20], [20, 0], [21, 21], [22, 22], [23, 23], [24, 24], [36, 24], [37, 23], [38, 22], [39, 21], [40, 20], [41, 19], [42, 18], [43, 17], [44, 16], [45, 15], [46, 14], [47, 13], [48, 12], [49, 11], [50, 10], [49, 9], [48, 8], [47, 7], [46, 6], [45, 5], [44, 4], [43, 3], [42, 2], [41, 1], [40, 0], [9, 10], [10, 11], [10, 9], [11, 12], [11, 8], [12, 13], [12, 7], [13, 14], [13, 6], [14, 15], [14, 5], [15, 16], [15, 4], [16, 17], [16, 3], [17, 18], [17, 2], [18, 19], [18, 1], [19, 20], [19, 0], [20, 21], [21, 22], [22, 23], [23, 24], [37, 24], [38, 23], [39, 22], [40, 21], [41, 20], [42, 19], [43, 18], [44, 17], [45, 16], [46, 15], [47, 14], [48, 13], [49, 12], [50, 11], [51, 10], [50, 9], [49, 8], [48, 7], [47, 6], [46, 5], [45, 4], [44, 3], [43, 2], [42, 1], [41, 0], [8, 10], [9, 11], [9, 9], [10, 12], [10, 8], [11, 13], [11, 7], [12, 14], [12, 6], [13, 15], [13, 5], [14, 16], [14, 4], [15, 17], [15, 3], [16, 18], [16, 2], [17, 19], [17, 1], [18, 20], [18, 0], [19, 21], [20, 22], [21, 23], [22, 24], [38, 24], [39, 23], [40, 22], [41, 21], [42, 20], [43, 19], [44, 18], [45, 17], [46, 16], [47, 15], [48, 14], [49, 13], [50, 12], [51, 11], [52, 10], [51, 9], [50, 8], [49, 7], [48, 6], [47, 5], [46, 4], [45, 3], [44, 2], [43, 1], [42, 0], [7, 10], [8, 11], [8, 9], [9, 12], [9, 8], [10, 13], [10, 7], [11, 14], [11, 6], [12, 15], [12, 5], [13, 16], [13, 4], [14, 17], [14, 3], [15, 18], [15, 2], [16, 19], [16, 1], [17, 20], [17, 0], [18, 21], [19, 22], [20, 23], [21, 24], [39, 24], [40, 23], [41, 22], [42, 21], [43, 20], [44, 19], [45, 18], [46, 17], [47, 16], [48, 15], [49, 14], [50, 13], [51, 12], [52, 11], [53, 10], [52, 9], [51, 8], [50, 7], [49, 6], [48, 5], [47, 4], [46, 3], [45, 2], [44, 1], [43, 0], [6, 10], [7, 11], [7, 9], [8, 12], [8, 8], [9, 13], [9, 7], [10, 14], [10, 6], [11, 15], [11, 5], [12, 16], [12, 4], [13, 17], [13, 3], [14, 18], [14, 2], [15, 19], [15, 1], [16, 20], [16, 0], [17, 21], [18, 22], [19, 23], [20, 24], [40, 24], [41, 23], [42, 22], [43, 21], [44, 20], [45, 19], [46, 18], [47, 17], [48, 16], [49, 15], [50, 14], [51, 13], [52, 12], [53, 11], [54, 10], [53, 9], [52, 8], [51, 7], [50, 6], [49, 5], [48, 4], [47, 3], [46, 2], [45, 1], [44, 0], [5, 10], [6, 11], [6, 9], [7, 12], [7, 8], [8, 13], [8, 7], [9, 14], [9, 6], [10, 15], [10, 5], [11, 16], [11, 4], [12, 17], [12, 3], [13, 18], [13, 2], [14, 19], [14, 1], [15, 20], [15, 0], [16, 21], [17, 22], [18, 23], [19, 24], [41, 24], [42, 23], [43, 22], [44, 21], [45, 20], [46, 19], [47, 18], [48, 17], [49, 16], [50, 15], [51, 14], [52, 13], [53, 12], [54, 11], [55, 10], [54, 9], [53, 8], [52, 7], [51, 6], [50, 5], [49, 4], [48, 3], [47, 2], [46, 1], [45, 0], [4, 10], [5, 11], [5, 9], [6, 12], [6, 8], [7, 13], [7, 7], [8, 14], [8, 6], [9, 15], [9, 5], [10, 16], [10, 4], [11, 17], [11, 3], [12, 18], [12, 2], [13, 19], [13, 1], [14, 20], [14, 0], [15, 21], [16, 22], [17, 23], [18, 24], [42, 24], [43, 23], [44, 22], [45, 21], [46, 20], [47, 19], [48, 18], [49, 17], [50, 16], [51, 15], [52, 14], [53, 13], [54, 12], [55, 11], [56, 10], [55, 9], [54, 8], [53, 7], [52, 6], [51, 5], [50, 4], [49, 3], [48, 2], [47, 1], [46, 0], [3, 10], [4, 11], [4, 9], [5, 12], [5, 8], [6, 13], [6, 7], [7, 14], [7, 6], [8, 15], [8, 5], [9, 16], [9, 4], [10, 17], [10, 3], [11, 18], [11, 2], [12, 19], [12, 1], [13, 20], [13, 0], [14, 21], [15, 22], [16, 23], [17, 24], [43, 24], [44, 23], [45, 22], [46, 21], [47, 20], [48, 19], [49, 18], [50, 17], [51, 16], [52, 15], [53, 14], [54, 13], [55, 12], [56, 11], [57, 10], [56, 9], [55, 8], [54, 7], [53, 6], [52, 5], [51, 4], [50, 3], [49, 2], [48, 1], [47, 0], [2, 10], [3, 11], [3, 9], [4, 12], [4, 8], [5, 13], [5, 7], [6, 14], [6, 6], [7, 15], [7, 5], [8, 16], [8, 4], [9, 17], [9, 3], [10, 18], [10, 2], [11, 19], [11, 1], [12, 20], [12, 0], [13, 21], [14, 22], [15, 23], [16, 24], [44, 24], [45, 23], [46, 22], [47, 21], [48, 20], [49, 19], [50, 18], [51, 17], [52, 16], [53, 15], [54, 14], [55, 13], [56, 12], [57, 11], [58, 10], [57, 9], [56, 8], [55, 7], [54, 6], [53, 5], [52, 4], [51, 3], [50, 2], [49, 1], [48, 0], [1, 10], [2, 11], [2, 9], [3, 12], [3, 8], [4, 13], [4, 7], [5, 14], [5, 6], [6, 15], [6, 5], [7, 16], [7, 4], [8, 17], [8, 3], [9, 18], [9, 2], [10, 19], [10, 1], [11, 20], [11, 0], [12, 21], [13, 22], [14, 23], [15, 24], [45, 24], [46, 23], [47, 22], [48, 21], [49, 20], [50, 19], [51, 18], [52, 17], [53, 16], [54, 15], [55, 14], [56, 13], [57, 12], [58, 11], [59, 10], [58, 9], [57, 8], [56, 7], [55, 6], [54, 5], [53, 4], [52, 3], [51, 2], [50, 1], [49, 0], [0, 10], [1, 11], [1, 9], [2, 12], [2, 8], [3, 13], [3, 7], [4, 14], [4, 6], [5, 15], [5, 5], [6, 16], [6, 4], [7, 17], [7, 3], [8, 18], [8, 2], [9, 19], [9, 1], [10, 20], [10, 0], [11, 21], [12, 22], [13, 23], [14, 24], [46, 24], [47, 23], [48, 22], [49, 21], [50, 20], [51, 19], [52, 18], [53, 17], [54, 16], [55, 15], [56, 14], [57, 13], [58, 12], [59, 11], [59, 9], [58, 8], [57, 7], [56, 6], [55, 5], [54, 4], [53, 3], [52, 2], [51, 1], [50, 0], [0, 11], [0, 9], [1, 12], [1, 8], [2, 13], [2, 7], [3, 14], [3, 6], [4, 15], [4, 5], [5, 16], [5, 4], [6, 17], [6, 3], [7, 18], [7, 2], [8, 19], [8, 1], [9, 20], [9, 0], [10, 21], [11, 22], [12, 23], [13, 24], [47, 24], [48, 23], [49, 22], [50, 21], [51, 20], [52, 19], [53, 18], [54, 17], [55, 16], [56, 15], [57, 14], [58, 13], [59, 12], [59, 8], [58, 7], [57, 6], [56, 5], [55, 4], [54, 3], [53, 2], [52, 1], [51, 0], [0, 12], [0, 8], [1, 13], [1, 7], [2, 14], [2, 6], [3, 15], [3, 5], [4, 16], [4, 4], [5, 17], [5, 3], [6, 18], [6, 2], [7, 19], [7, 1], [8, 20], [8, 0], [9, 21], [10, 22], [11, 23], [12, 24], [48, 24], [49, 23], [50, 22], [51, 21], [52, 20], [53, 19], [54, 18], [55, 17], [56, 16], [57, 15], [58, 14], [59, 13], [59, 7], [58, 6], [57, 5], [56, 4], [55, 3], [54, 2], [53, 1], [52, 0], [0, 13], [0, 7], [1, 14], [1, 6], [2, 15], [2, 5], [3, 16], [3, 4], [4, 17], [4, 3], [5, 18], [5, 2], [6, 19], [6, 1], [7, 20], [7, 0], [8, 21], [9, 22], [10, 23], [11, 24], [49, 24], [50, 23], [51, 22], [52, 21], [53, 20], [54, 19], [55, 18], [56, 17], [57, 16], [58, 15], [59, 14], [59, 6], [58, 5], [57, 4], [56, 3], [55, 2], [54, 1], [53, 0], [0, 14], [0, 6], [1, 15], [1, 5], [2, 16], [2, 4], [3, 17], [3, 3], [4, 18], [4, 2], [5, 19], [5, 1], [6, 20], [6, 0], [7, 21], [8, 22], [9, 23], [10, 24], [50, 24], [51, 23], [52, 22], [53, 21], [54, 20], [55, 19], [56, 18], [57, 17], [58, 16], [59, 15], [59, 5], [58, 4], [57, 3], [56, 2], [55, 1], [54, 0], [0, 15], [0, 5], [1, 16], [1, 4], [2, 17], [2, 3], [3, 18], [3, 2], [4, 19], [4, 1], [5, 20], [5, 0], [6, 21], [7, 22], [8, 23], [9, 24], [51, 24], [52, 23], [53, 22], [54, 21], [55, 20], [56, 19], [57, 18], [58, 17], [59, 16], [59, 4], [58, 3], [57, 2], [56, 1], [55, 0], [0, 16], [0, 4], [1, 17], [1, 3], [2, 18], [2, 2], [3, 19], [3, 1], [4, 20], [4, 0], [5, 21], [6, 22], [7, 23], [8, 24], [52, 24], [53, 23], [54, 22], [55, 21], [56, 20], [57, 19], [58, 18], [59, 17], [59, 3], [58, 2], [57, 1], [56, 0], [0, 17], [0, 3], [1, 18], [1, 2], [2, 19], [2, 1], [3, 20], [3, 0], [4, 21], [5, 22], [6, 23], [7, 24], [53, 24], [54, 23], [55, 22], [56, 21], [57, 20], [58, 19], [59, 18], [59, 2], [58, 1], [57, 0], [0, 18], [0, 2], [1, 19], [1, 1], [2, 20], [2, 0], [3, 21], [4, 22], [5, 23], [6, 24], [54, 24], [55, 23], [56, 22], [57, 21], [58, 20], [59, 19], [59, 1], [58, 0], [0, 19], [0, 1], [1, 20], [1, 0], [2, 21], [3, 22], [4, 23], [5, 24], [55, 24], [56, 23], [57, 22], [58, 21], [59, 20], [59, 0], [0, 20], [0, 0], [1, 21], [2, 22], [3, 23], [4, 24], [56, 24], [57, 23], [58, 22], [59, 21], [0, 21], [1, 22], [2, 23], [3, 24], [57, 24], [58, 23], [59, 22], [0, 22], [1, 23], [2, 24], [58, 24], [59, 23], [0, 23], [1, 24], [59, 24], [0, 24]]\n assert candidate(rows = 15,cols = 10,rCenter = 2,cCenter = 8) == [[2, 8], [1, 8], [2, 9], [3, 8], [2, 7], [0, 8], [1, 9], [1, 7], [3, 9], [4, 8], [3, 7], [2, 6], [0, 9], [0, 7], [1, 6], [4, 9], [5, 8], [4, 7], [3, 6], [2, 5], [0, 6], [1, 5], [5, 9], [6, 8], [5, 7], [4, 6], [3, 5], [2, 4], [0, 5], [1, 4], [6, 9], [7, 8], [6, 7], [5, 6], [4, 5], [3, 4], [2, 3], [0, 4], [1, 3], [7, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [0, 3], [1, 2], [8, 9], [9, 8], [8, 7], [7, 6], [6, 5], [5, 4], [4, 3], [3, 2], [2, 1], [0, 2], [1, 1], [9, 9], [10, 8], [9, 7], [8, 6], [7, 5], [6, 4], [5, 3], [4, 2], [3, 1], [2, 0], [0, 1], [1, 0], [10, 9], [11, 8], [10, 7], [9, 6], [8, 5], [7, 4], [6, 3], [5, 2], [4, 1], [3, 0], [0, 0], [11, 9], [12, 8], [11, 7], [10, 6], [9, 5], [8, 4], [7, 3], [6, 2], [5, 1], [4, 0], [12, 9], [13, 8], [12, 7], [11, 6], [10, 5], [9, 4], [8, 3], [7, 2], [6, 1], [5, 0], [13, 9], [14, 8], [13, 7], [12, 6], [11, 5], [10, 4], [9, 3], [8, 2], [7, 1], [6, 0], [14, 9], [14, 7], [13, 6], [12, 5], [11, 4], [10, 3], [9, 2], [8, 1], [7, 0], [14, 6], [13, 5], [12, 4], [11, 3], [10, 2], [9, 1], [8, 0], [14, 5], [13, 4], [12, 3], [11, 2], [10, 1], [9, 0], [14, 4], [13, 3], [12, 2], [11, 1], [10, 0], [14, 3], [13, 2], [12, 1], [11, 0], [14, 2], [13, 1], [12, 0], [14, 1], [13, 0], [14, 0]]\n assert candidate(rows = 5,cols = 8,rCenter = 0,cCenter = 7) == [[0, 7], [1, 7], [0, 6], [2, 7], [1, 6], [0, 5], [3, 7], [2, 6], [1, 5], [0, 4], [4, 7], [3, 6], [2, 5], [1, 4], [0, 3], [4, 6], [3, 5], [2, 4], [1, 3], [0, 2], [4, 5], [3, 4], [2, 3], [1, 2], [0, 1], [4, 4], [3, 3], [2, 2], [1, 1], [0, 0], [4, 3], [3, 2], [2, 1], [1, 0], [4, 2], [3, 1], [2, 0], [4, 1], [3, 0], [4, 0]]\n assert candidate(rows = 1,cols = 10,rCenter = 0,cCenter = 5) == [[0, 5], [0, 6], [0, 4], [0, 7], [0, 3], [0, 8], [0, 2], [0, 9], [0, 1], [0, 0]]\n assert candidate(rows = 9,cols = 9,rCenter = 8,cCenter = 8) == [[8, 8], [7, 8], [8, 7], [6, 8], [7, 7], [8, 6], [5, 8], [6, 7], [7, 6], [8, 5], [4, 8], [5, 7], [6, 6], [7, 5], [8, 4], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [2, 8], [3, 7], [4, 6], [5, 5], [6, 4], [7, 3], [8, 2], [1, 8], [2, 7], [3, 6], [4, 5], [5, 4], [6, 3], [7, 2], [8, 1], [0, 8], [1, 7], [2, 6], [3, 5], [4, 4], [5, 3], [6, 2], [7, 1], [8, 0], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0], [0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0], [0, 4], [1, 3], [2, 2], [3, 1], [4, 0], [0, 3], [1, 2], [2, 1], [3, 0], [0, 2], [1, 1], [2, 0], [0, 1], [1, 0], [0, 0]]\n assert candidate(rows = 6,cols = 4,rCenter = 3,cCenter = 3) == [[3, 3], [2, 3], [4, 3], [3, 2], [1, 3], [2, 2], [5, 3], [4, 2], [3, 1], [0, 3], [1, 2], [2, 1], [5, 2], [4, 1], [3, 0], [0, 2], [1, 1], [2, 0], [5, 1], [4, 0], [0, 1], [1, 0], [5, 0], [0, 0]]\n assert candidate(rows = 50,cols = 50,rCenter = 0,cCenter = 0) == [[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, 0], [0, 3], [1, 2], [2, 1], [3, 0], [0, 4], [1, 3], [2, 2], [3, 1], [4, 0], [0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0], [0, 8], [1, 7], [2, 6], [3, 5], [4, 4], [5, 3], [6, 2], [7, 1], [8, 0], [0, 9], [1, 8], [2, 7], [3, 6], [4, 5], [5, 4], [6, 3], [7, 2], [8, 1], [9, 0], [0, 10], [1, 9], [2, 8], [3, 7], [4, 6], [5, 5], [6, 4], [7, 3], [8, 2], [9, 1], [10, 0], [0, 11], [1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1], [11, 0], [0, 12], [1, 11], [2, 10], [3, 9], [4, 8], [5, 7], [6, 6], [7, 5], [8, 4], [9, 3], [10, 2], [11, 1], [12, 0], [0, 13], [1, 12], [2, 11], [3, 10], [4, 9], [5, 8], [6, 7], [7, 6], [8, 5], [9, 4], [10, 3], [11, 2], [12, 1], [13, 0], [0, 14], [1, 13], [2, 12], [3, 11], [4, 10], [5, 9], [6, 8], [7, 7], [8, 6], [9, 5], [10, 4], [11, 3], [12, 2], [13, 1], [14, 0], [0, 15], [1, 14], [2, 13], [3, 12], [4, 11], [5, 10], [6, 9], [7, 8], [8, 7], [9, 6], [10, 5], [11, 4], [12, 3], [13, 2], [14, 1], [15, 0], [0, 16], [1, 15], [2, 14], [3, 13], [4, 12], [5, 11], [6, 10], [7, 9], [8, 8], [9, 7], [10, 6], [11, 5], [12, 4], [13, 3], [14, 2], [15, 1], [16, 0], [0, 17], [1, 16], [2, 15], [3, 14], [4, 13], [5, 12], [6, 11], [7, 10], [8, 9], [9, 8], [10, 7], [11, 6], [12, 5], [13, 4], [14, 3], [15, 2], [16, 1], [17, 0], [0, 18], [1, 17], [2, 16], [3, 15], [4, 14], [5, 13], [6, 12], [7, 11], [8, 10], [9, 9], [10, 8], [11, 7], [12, 6], [13, 5], [14, 4], [15, 3], [16, 2], [17, 1], [18, 0], [0, 19], [1, 18], [2, 17], [3, 16], [4, 15], [5, 14], [6, 13], [7, 12], [8, 11], [9, 10], [10, 9], [11, 8], [12, 7], [13, 6], [14, 5], [15, 4], [16, 3], [17, 2], [18, 1], [19, 0], [0, 20], [1, 19], [2, 18], [3, 17], [4, 16], [5, 15], [6, 14], [7, 13], [8, 12], [9, 11], [10, 10], [11, 9], [12, 8], [13, 7], [14, 6], [15, 5], [16, 4], [17, 3], [18, 2], [19, 1], [20, 0], [0, 21], [1, 20], [2, 19], [3, 18], [4, 17], [5, 16], [6, 15], [7, 14], [8, 13], [9, 12], [10, 11], [11, 10], [12, 9], [13, 8], [14, 7], [15, 6], [16, 5], [17, 4], [18, 3], [19, 2], [20, 1], [21, 0], [0, 22], [1, 21], [2, 20], [3, 19], [4, 18], [5, 17], [6, 16], [7, 15], [8, 14], [9, 13], [10, 12], [11, 11], [12, 10], [13, 9], [14, 8], [15, 7], [16, 6], [17, 5], [18, 4], [19, 3], [20, 2], [21, 1], [22, 0], [0, 23], [1, 22], [2, 21], [3, 20], [4, 19], [5, 18], [6, 17], [7, 16], [8, 15], [9, 14], [10, 13], [11, 12], [12, 11], [13, 10], [14, 9], [15, 8], [16, 7], [17, 6], [18, 5], [19, 4], [20, 3], [21, 2], [22, 1], [23, 0], [0, 24], [1, 23], [2, 22], [3, 21], [4, 20], [5, 19], [6, 18], [7, 17], [8, 16], [9, 15], [10, 14], [11, 13], [12, 12], [13, 11], [14, 10], [15, 9], [16, 8], [17, 7], [18, 6], [19, 5], [20, 4], [21, 3], [22, 2], [23, 1], [24, 0], [0, 25], [1, 24], [2, 23], [3, 22], [4, 21], [5, 20], [6, 19], [7, 18], [8, 17], [9, 16], [10, 15], [11, 14], [12, 13], [13, 12], [14, 11], [15, 10], [16, 9], [17, 8], [18, 7], [19, 6], [20, 5], [21, 4], [22, 3], [23, 2], [24, 1], [25, 0], [0, 26], [1, 25], [2, 24], [3, 23], [4, 22], [5, 21], [6, 20], [7, 19], [8, 18], [9, 17], [10, 16], [11, 15], [12, 14], [13, 13], [14, 12], [15, 11], [16, 10], [17, 9], [18, 8], [19, 7], [20, 6], [21, 5], [22, 4], [23, 3], [24, 2], [25, 1], [26, 0], [0, 27], [1, 26], [2, 25], [3, 24], [4, 23], [5, 22], [6, 21], [7, 20], [8, 19], [9, 18], [10, 17], [11, 16], [12, 15], [13, 14], [14, 13], [15, 12], [16, 11], [17, 10], [18, 9], [19, 8], [20, 7], [21, 6], [22, 5], [23, 4], [24, 3], [25, 2], [26, 1], [27, 0], [0, 28], [1, 27], [2, 26], [3, 25], [4, 24], [5, 23], [6, 22], [7, 21], [8, 20], [9, 19], [10, 18], [11, 17], [12, 16], [13, 15], [14, 14], [15, 13], [16, 12], [17, 11], [18, 10], [19, 9], [20, 8], [21, 7], [22, 6], [23, 5], [24, 4], [25, 3], [26, 2], [27, 1], [28, 0], [0, 29], [1, 28], [2, 27], [3, 26], [4, 25], [5, 24], [6, 23], [7, 22], [8, 21], [9, 20], [10, 19], [11, 18], [12, 17], [13, 16], [14, 15], [15, 14], [16, 13], [17, 12], [18, 11], [19, 10], [20, 9], [21, 8], [22, 7], [23, 6], [24, 5], [25, 4], [26, 3], [27, 2], [28, 1], [29, 0], [0, 30], [1, 29], [2, 28], [3, 27], [4, 26], [5, 25], [6, 24], [7, 23], [8, 22], [9, 21], [10, 20], [11, 19], [12, 18], [13, 17], [14, 16], [15, 15], [16, 14], [17, 13], [18, 12], [19, 11], [20, 10], [21, 9], [22, 8], [23, 7], [24, 6], [25, 5], [26, 4], [27, 3], [28, 2], [29, 1], [30, 0], [0, 31], [1, 30], [2, 29], [3, 28], [4, 27], [5, 26], [6, 25], [7, 24], [8, 23], [9, 22], [10, 21], [11, 20], [12, 19], [13, 18], [14, 17], [15, 16], [16, 15], [17, 14], [18, 13], [19, 12], [20, 11], [21, 10], [22, 9], [23, 8], [24, 7], [25, 6], [26, 5], [27, 4], [28, 3], [29, 2], [30, 1], [31, 0], [0, 32], [1, 31], [2, 30], [3, 29], [4, 28], [5, 27], [6, 26], [7, 25], [8, 24], [9, 23], [10, 22], [11, 21], [12, 20], [13, 19], [14, 18], [15, 17], [16, 16], [17, 15], [18, 14], [19, 13], [20, 12], [21, 11], [22, 10], [23, 9], [24, 8], [25, 7], [26, 6], [27, 5], [28, 4], [29, 3], [30, 2], [31, 1], [32, 0], [0, 33], [1, 32], [2, 31], [3, 30], [4, 29], [5, 28], [6, 27], [7, 26], [8, 25], [9, 24], [10, 23], [11, 22], [12, 21], [13, 20], [14, 19], [15, 18], [16, 17], [17, 16], [18, 15], [19, 14], [20, 13], [21, 12], [22, 11], [23, 10], [24, 9], [25, 8], [26, 7], [27, 6], [28, 5], [29, 4], [30, 3], [31, 2], [32, 1], [33, 0], [0, 34], [1, 33], [2, 32], [3, 31], [4, 30], [5, 29], [6, 28], [7, 27], [8, 26], [9, 25], [10, 24], [11, 23], [12, 22], [13, 21], [14, 20], [15, 19], [16, 18], [17, 17], [18, 16], [19, 15], [20, 14], [21, 13], [22, 12], [23, 11], [24, 10], [25, 9], [26, 8], [27, 7], [28, 6], [29, 5], [30, 4], [31, 3], [32, 2], [33, 1], [34, 0], [0, 35], [1, 34], [2, 33], [3, 32], [4, 31], [5, 30], [6, 29], [7, 28], [8, 27], [9, 26], [10, 25], [11, 24], [12, 23], [13, 22], [14, 21], [15, 20], [16, 19], [17, 18], [18, 17], [19, 16], [20, 15], [21, 14], [22, 13], [23, 12], [24, 11], [25, 10], [26, 9], [27, 8], [28, 7], [29, 6], [30, 5], [31, 4], [32, 3], [33, 2], [34, 1], [35, 0], [0, 36], [1, 35], [2, 34], [3, 33], [4, 32], [5, 31], [6, 30], [7, 29], [8, 28], [9, 27], [10, 26], [11, 25], [12, 24], [13, 23], [14, 22], [15, 21], [16, 20], [17, 19], [18, 18], [19, 17], [20, 16], [21, 15], [22, 14], [23, 13], [24, 12], [25, 11], [26, 10], [27, 9], [28, 8], [29, 7], [30, 6], [31, 5], [32, 4], [33, 3], [34, 2], [35, 1], [36, 0], [0, 37], [1, 36], [2, 35], [3, 34], [4, 33], [5, 32], [6, 31], [7, 30], [8, 29], [9, 28], [10, 27], [11, 26], [12, 25], [13, 24], [14, 23], [15, 22], [16, 21], [17, 20], [18, 19], [19, 18], [20, 17], [21, 16], [22, 15], [23, 14], [24, 13], [25, 12], [26, 11], [27, 10], [28, 9], [29, 8], [30, 7], [31, 6], [32, 5], [33, 4], [34, 3], [35, 2], [36, 1], [37, 0], [0, 38], [1, 37], [2, 36], [3, 35], [4, 34], [5, 33], [6, 32], [7, 31], [8, 30], [9, 29], [10, 28], [11, 27], [12, 26], [13, 25], [14, 24], [15, 23], [16, 22], [17, 21], [18, 20], [19, 19], [20, 18], [21, 17], [22, 16], [23, 15], [24, 14], [25, 13], [26, 12], [27, 11], [28, 10], [29, 9], [30, 8], [31, 7], [32, 6], [33, 5], [34, 4], [35, 3], [36, 2], [37, 1], [38, 0], [0, 39], [1, 38], [2, 37], [3, 36], [4, 35], [5, 34], [6, 33], [7, 32], [8, 31], [9, 30], [10, 29], [11, 28], [12, 27], [13, 26], [14, 25], [15, 24], [16, 23], [17, 22], [18, 21], [19, 20], [20, 19], [21, 18], [22, 17], [23, 16], [24, 15], [25, 14], [26, 13], [27, 12], [28, 11], [29, 10], [30, 9], [31, 8], [32, 7], [33, 6], [34, 5], [35, 4], [36, 3], [37, 2], [38, 1], [39, 0], [0, 40], [1, 39], [2, 38], [3, 37], [4, 36], [5, 35], [6, 34], [7, 33], [8, 32], [9, 31], [10, 30], [11, 29], [12, 28], [13, 27], [14, 26], [15, 25], [16, 24], [17, 23], [18, 22], [19, 21], [20, 20], [21, 19], [22, 18], [23, 17], [24, 16], [25, 15], [26, 14], [27, 13], [28, 12], [29, 11], [30, 10], [31, 9], [32, 8], [33, 7], [34, 6], [35, 5], [36, 4], [37, 3], [38, 2], [39, 1], [40, 0], [0, 41], [1, 40], [2, 39], [3, 38], [4, 37], [5, 36], [6, 35], [7, 34], [8, 33], [9, 32], [10, 31], [11, 30], [12, 29], [13, 28], [14, 27], [15, 26], [16, 25], [17, 24], [18, 23], [19, 22], [20, 21], [21, 20], [22, 19], [23, 18], [24, 17], [25, 16], [26, 15], [27, 14], [28, 13], [29, 12], [30, 11], [31, 10], [32, 9], [33, 8], [34, 7], [35, 6], [36, 5], [37, 4], [38, 3], [39, 2], [40, 1], [41, 0], [0, 42], [1, 41], [2, 40], [3, 39], [4, 38], [5, 37], [6, 36], [7, 35], [8, 34], [9, 33], [10, 32], [11, 31], [12, 30], [13, 29], [14, 28], [15, 27], [16, 26], [17, 25], [18, 24], [19, 23], [20, 22], [21, 21], [22, 20], [23, 19], [24, 18], [25, 17], [26, 16], [27, 15], [28, 14], [29, 13], [30, 12], [31, 11], [32, 10], [33, 9], [34, 8], [35, 7], [36, 6], [37, 5], [38, 4], [39, 3], [40, 2], [41, 1], [42, 0], [0, 43], [1, 42], [2, 41], [3, 40], [4, 39], [5, 38], [6, 37], [7, 36], [8, 35], [9, 34], [10, 33], [11, 32], [12, 31], [13, 30], [14, 29], [15, 28], [16, 27], [17, 26], [18, 25], [19, 24], [20, 23], [21, 22], [22, 21], [23, 20], [24, 19], [25, 18], [26, 17], [27, 16], [28, 15], [29, 14], [30, 13], [31, 12], [32, 11], [33, 10], [34, 9], [35, 8], [36, 7], [37, 6], [38, 5], [39, 4], [40, 3], [41, 2], [42, 1], [43, 0], [0, 44], [1, 43], [2, 42], [3, 41], [4, 40], [5, 39], [6, 38], [7, 37], [8, 36], [9, 35], [10, 34], [11, 33], [12, 32], [13, 31], [14, 30], [15, 29], [16, 28], [17, 27], [18, 26], [19, 25], [20, 24], [21, 23], [22, 22], [23, 21], [24, 20], [25, 19], [26, 18], [27, 17], [28, 16], [29, 15], [30, 14], [31, 13], [32, 12], [33, 11], [34, 10], [35, 9], [36, 8], [37, 7], [38, 6], [39, 5], [40, 4], [41, 3], [42, 2], [43, 1], [44, 0], [0, 45], [1, 44], [2, 43], [3, 42], [4, 41], [5, 40], [6, 39], [7, 38], [8, 37], [9, 36], [10, 35], [11, 34], [12, 33], [13, 32], [14, 31], [15, 30], [16, 29], [17, 28], [18, 27], [19, 26], [20, 25], [21, 24], [22, 23], [23, 22], [24, 21], [25, 20], [26, 19], [27, 18], [28, 17], [29, 16], [30, 15], [31, 14], [32, 13], [33, 12], [34, 11], [35, 10], [36, 9], [37, 8], [38, 7], [39, 6], [40, 5], [41, 4], [42, 3], [43, 2], [44, 1], [45, 0], [0, 46], [1, 45], [2, 44], [3, 43], [4, 42], [5, 41], [6, 40], [7, 39], [8, 38], [9, 37], [10, 36], [11, 35], [12, 34], [13, 33], [14, 32], [15, 31], [16, 30], [17, 29], [18, 28], [19, 27], [20, 26], [21, 25], [22, 24], [23, 23], [24, 22], [25, 21], [26, 20], [27, 19], [28, 18], [29, 17], [30, 16], [31, 15], [32, 14], [33, 13], [34, 12], [35, 11], [36, 10], [37, 9], [38, 8], [39, 7], [40, 6], [41, 5], [42, 4], [43, 3], [44, 2], [45, 1], [46, 0], [0, 47], [1, 46], [2, 45], [3, 44], [4, 43], [5, 42], [6, 41], [7, 40], [8, 39], [9, 38], [10, 37], [11, 36], [12, 35], [13, 34], [14, 33], [15, 32], [16, 31], [17, 30], [18, 29], [19, 28], [20, 27], [21, 26], [22, 25], [23, 24], [24, 23], [25, 22], [26, 21], [27, 20], [28, 19], [29, 18], [30, 17], [31, 16], [32, 15], [33, 14], [34, 13], [35, 12], [36, 11], [37, 10], [38, 9], [39, 8], [40, 7], [41, 6], [42, 5], [43, 4], [44, 3], [45, 2], [46, 1], [47, 0], [0, 48], [1, 47], [2, 46], [3, 45], [4, 44], [5, 43], [6, 42], [7, 41], [8, 40], [9, 39], [10, 38], [11, 37], [12, 36], [13, 35], [14, 34], [15, 33], [16, 32], [17, 31], [18, 30], [19, 29], [20, 28], [21, 27], [22, 26], [23, 25], [24, 24], [25, 23], [26, 22], [27, 21], [28, 20], [29, 19], [30, 18], [31, 17], [32, 16], [33, 15], [34, 14], [35, 13], [36, 12], [37, 11], [38, 10], [39, 9], [40, 8], [41, 7], [42, 6], [43, 5], [44, 4], [45, 3], [46, 2], [47, 1], [48, 0], [0, 49], [1, 48], [2, 47], [3, 46], [4, 45], [5, 44], [6, 43], [7, 42], [8, 41], [9, 40], [10, 39], [11, 38], [12, 37], [13, 36], [14, 35], [15, 34], [16, 33], [17, 32], [18, 31], [19, 30], [20, 29], [21, 28], [22, 27], [23, 26], [24, 25], [25, 24], [26, 23], [27, 22], [28, 21], [29, 20], [30, 19], [31, 18], [32, 17], [33, 16], [34, 15], [35, 14], [36, 13], [37, 12], [38, 11], [39, 10], [40, 9], [41, 8], [42, 7], [43, 6], [44, 5], [45, 4], [46, 3], [47, 2], [48, 1], [49, 0], [1, 49], [2, 48], [3, 47], [4, 46], [5, 45], [6, 44], [7, 43], [8, 42], [9, 41], [10, 40], [11, 39], [12, 38], [13, 37], [14, 36], [15, 35], [16, 34], [17, 33], [18, 32], [19, 31], [20, 30], [21, 29], [22, 28], [23, 27], [24, 26], [25, 25], [26, 24], [27, 23], [28, 22], [29, 21], [30, 20], [31, 19], [32, 18], [33, 17], [34, 16], [35, 15], [36, 14], [37, 13], [38, 12], [39, 11], [40, 10], [41, 9], [42, 8], [43, 7], [44, 6], [45, 5], [46, 4], [47, 3], [48, 2], [49, 1], [2, 49], [3, 48], [4, 47], [5, 46], [6, 45], [7, 44], [8, 43], [9, 42], [10, 41], [11, 40], [12, 39], [13, 38], [14, 37], [15, 36], [16, 35], [17, 34], [18, 33], [19, 32], [20, 31], [21, 30], [22, 29], [23, 28], [24, 27], [25, 26], [26, 25], [27, 24], [28, 23], [29, 22], [30, 21], [31, 20], [32, 19], [33, 18], [34, 17], [35, 16], [36, 15], [37, 14], [38, 13], [39, 12], [40, 11], [41, 10], [42, 9], [43, 8], [44, 7], [45, 6], [46, 5], [47, 4], [48, 3], [49, 2], [3, 49], [4, 48], [5, 47], [6, 46], [7, 45], [8, 44], [9, 43], [10, 42], [11, 41], [12, 40], [13, 39], [14, 38], [15, 37], [16, 36], [17, 35], [18, 34], [19, 33], [20, 32], [21, 31], [22, 30], [23, 29], [24, 28], [25, 27], [26, 26], [27, 25], [28, 24], [29, 23], [30, 22], [31, 21], [32, 20], [33, 19], [34, 18], [35, 17], [36, 16], [37, 15], [38, 14], [39, 13], [40, 12], [41, 11], [42, 10], [43, 9], [44, 8], [45, 7], [46, 6], [47, 5], [48, 4], [49, 3], [4, 49], [5, 48], [6, 47], [7, 46], [8, 45], [9, 44], [10, 43], [11, 42], [12, 41], [13, 40], [14, 39], [15, 38], [16, 37], [17, 36], [18, 35], [19, 34], [20, 33], [21, 32], [22, 31], [23, 30], [24, 29], [25, 28], [26, 27], [27, 26], [28, 25], [29, 24], [30, 23], [31, 22], [32, 21], [33, 20], [34, 19], [35, 18], [36, 17], [37, 16], [38, 15], [39, 14], [40, 13], [41, 12], [42, 11], [43, 10], [44, 9], [45, 8], [46, 7], [47, 6], [48, 5], [49, 4], [5, 49], [6, 48], [7, 47], [8, 46], [9, 45], [10, 44], [11, 43], [12, 42], [13, 41], [14, 40], [15, 39], [16, 38], [17, 37], [18, 36], [19, 35], [20, 34], [21, 33], [22, 32], [23, 31], [24, 30], [25, 29], [26, 28], [27, 27], [28, 26], [29, 25], [30, 24], [31, 23], [32, 22], [33, 21], [34, 20], [35, 19], [36, 18], [37, 17], [38, 16], [39, 15], [40, 14], [41, 13], [42, 12], [43, 11], [44, 10], [45, 9], [46, 8], [47, 7], [48, 6], [49, 5], [6, 49], [7, 48], [8, 47], [9, 46], [10, 45], [11, 44], [12, 43], [13, 42], [14, 41], [15, 40], [16, 39], [17, 38], [18, 37], [19, 36], [20, 35], [21, 34], [22, 33], [23, 32], [24, 31], [25, 30], [26, 29], [27, 28], [28, 27], [29, 26], [30, 25], [31, 24], [32, 23], [33, 22], [34, 21], [35, 20], [36, 19], [37, 18], [38, 17], [39, 16], [40, 15], [41, 14], [42, 13], [43, 12], [44, 11], [45, 10], [46, 9], [47, 8], [48, 7], [49, 6], [7, 49], [8, 48], [9, 47], [10, 46], [11, 45], [12, 44], [13, 43], [14, 42], [15, 41], [16, 40], [17, 39], [18, 38], [19, 37], [20, 36], [21, 35], [22, 34], [23, 33], [24, 32], [25, 31], [26, 30], [27, 29], [28, 28], [29, 27], [30, 26], [31, 25], [32, 24], [33, 23], [34, 22], [35, 21], [36, 20], [37, 19], [38, 18], [39, 17], [40, 16], [41, 15], [42, 14], [43, 13], [44, 12], [45, 11], [46, 10], [47, 9], [48, 8], [49, 7], [8, 49], [9, 48], [10, 47], [11, 46], [12, 45], [13, 44], [14, 43], [15, 42], [16, 41], [17, 40], [18, 39], [19, 38], [20, 37], [21, 36], [22, 35], [23, 34], [24, 33], [25, 32], [26, 31], [27, 30], [28, 29], [29, 28], [30, 27], [31, 26], [32, 25], [33, 24], [34, 23], [35, 22], [36, 21], [37, 20], [38, 19], [39, 18], [40, 17], [41, 16], [42, 15], [43, 14], [44, 13], [45, 12], [46, 11], [47, 10], [48, 9], [49, 8], [9, 49], [10, 48], [11, 47], [12, 46], [13, 45], [14, 44], [15, 43], [16, 42], [17, 41], [18, 40], [19, 39], [20, 38], [21, 37], [22, 36], [23, 35], [24, 34], [25, 33], [26, 32], [27, 31], [28, 30], [29, 29], [30, 28], [31, 27], [32, 26], [33, 25], [34, 24], [35, 23], [36, 22], [37, 21], [38, 20], [39, 19], [40, 18], [41, 17], [42, 16], [43, 15], [44, 14], [45, 13], [46, 12], [47, 11], [48, 10], [49, 9], [10, 49], [11, 48], [12, 47], [13, 46], [14, 45], [15, 44], [16, 43], [17, 42], [18, 41], [19, 40], [20, 39], [21, 38], [22, 37], [23, 36], [24, 35], [25, 34], [26, 33], [27, 32], [28, 31], [29, 30], [30, 29], [31, 28], [32, 27], [33, 26], [34, 25], [35, 24], [36, 23], [37, 22], [38, 21], [39, 20], [40, 19], [41, 18], [42, 17], [43, 16], [44, 15], [45, 14], [46, 13], [47, 12], [48, 11], [49, 10], [11, 49], [12, 48], [13, 47], [14, 46], [15, 45], [16, 44], [17, 43], [18, 42], [19, 41], [20, 40], [21, 39], [22, 38], [23, 37], [24, 36], [25, 35], [26, 34], [27, 33], [28, 32], [29, 31], [30, 30], [31, 29], [32, 28], [33, 27], [34, 26], [35, 25], [36, 24], [37, 23], [38, 22], [39, 21], [40, 20], [41, 19], [42, 18], [43, 17], [44, 16], [45, 15], [46, 14], [47, 13], [48, 12], [49, 11], [12, 49], [13, 48], [14, 47], [15, 46], [16, 45], [17, 44], [18, 43], [19, 42], [20, 41], [21, 40], [22, 39], [23, 38], [24, 37], [25, 36], [26, 35], [27, 34], [28, 33], [29, 32], [30, 31], [31, 30], [32, 29], [33, 28], [34, 27], [35, 26], [36, 25], [37, 24], [38, 23], [39, 22], [40, 21], [41, 20], [42, 19], [43, 18], [44, 17], [45, 16], [46, 15], [47, 14], [48, 13], [49, 12], [13, 49], [14, 48], [15, 47], [16, 46], [17, 45], [18, 44], [19, 43], [20, 42], [21, 41], [22, 40], [23, 39], [24, 38], [25, 37], [26, 36], [27, 35], [28, 34], [29, 33], [30, 32], [31, 31], [32, 30], [33, 29], [34, 28], [35, 27], [36, 26], [37, 25], [38, 24], [39, 23], [40, 22], [41, 21], [42, 20], [43, 19], [44, 18], [45, 17], [46, 16], [47, 15], [48, 14], [49, 13], [14, 49], [15, 48], [16, 47], [17, 46], [18, 45], [19, 44], [20, 43], [21, 42], [22, 41], [23, 40], [24, 39], [25, 38], [26, 37], [27, 36], [28, 35], [29, 34], [30, 33], [31, 32], [32, 31], [33, 30], [34, 29], [35, 28], [36, 27], [37, 26], [38, 25], [39, 24], [40, 23], [41, 22], [42, 21], [43, 20], [44, 19], [45, 18], [46, 17], [47, 16], [48, 15], [49, 14], [15, 49], [16, 48], [17, 47], [18, 46], [19, 45], [20, 44], [21, 43], [22, 42], [23, 41], [24, 40], [25, 39], [26, 38], [27, 37], [28, 36], [29, 35], [30, 34], [31, 33], [32, 32], [33, 31], [34, 30], [35, 29], [36, 28], [37, 27], [38, 26], [39, 25], [40, 24], [41, 23], [42, 22], [43, 21], [44, 20], [45, 19], [46, 18], [47, 17], [48, 16], [49, 15], [16, 49], [17, 48], [18, 47], [19, 46], [20, 45], [21, 44], [22, 43], [23, 42], [24, 41], [25, 40], [26, 39], [27, 38], [28, 37], [29, 36], [30, 35], [31, 34], [32, 33], [33, 32], [34, 31], [35, 30], [36, 29], [37, 28], [38, 27], [39, 26], [40, 25], [41, 24], [42, 23], [43, 22], [44, 21], [45, 20], [46, 19], [47, 18], [48, 17], [49, 16], [17, 49], [18, 48], [19, 47], [20, 46], [21, 45], [22, 44], [23, 43], [24, 42], [25, 41], [26, 40], [27, 39], [28, 38], [29, 37], [30, 36], [31, 35], [32, 34], [33, 33], [34, 32], [35, 31], [36, 30], [37, 29], [38, 28], [39, 27], [40, 26], [41, 25], [42, 24], [43, 23], [44, 22], [45, 21], [46, 20], [47, 19], [48, 18], [49, 17], [18, 49], [19, 48], [20, 47], [21, 46], [22, 45], [23, 44], [24, 43], [25, 42], [26, 41], [27, 40], [28, 39], [29, 38], [30, 37], [31, 36], [32, 35], [33, 34], [34, 33], [35, 32], [36, 31], [37, 30], [38, 29], [39, 28], [40, 27], [41, 26], [42, 25], [43, 24], [44, 23], [45, 22], [46, 21], [47, 20], [48, 19], [49, 18], [19, 49], [20, 48], [21, 47], [22, 46], [23, 45], [24, 44], [25, 43], [26, 42], [27, 41], [28, 40], [29, 39], [30, 38], [31, 37], [32, 36], [33, 35], [34, 34], [35, 33], [36, 32], [37, 31], [38, 30], [39, 29], [40, 28], [41, 27], [42, 26], [43, 25], [44, 24], [45, 23], [46, 22], [47, 21], [48, 20], [49, 19], [20, 49], [21, 48], [22, 47], [23, 46], [24, 45], [25, 44], [26, 43], [27, 42], [28, 41], [29, 40], [30, 39], [31, 38], [32, 37], [33, 36], [34, 35], [35, 34], [36, 33], [37, 32], [38, 31], [39, 30], [40, 29], [41, 28], [42, 27], [43, 26], [44, 25], [45, 24], [46, 23], [47, 22], [48, 21], [49, 20], [21, 49], [22, 48], [23, 47], [24, 46], [25, 45], [26, 44], [27, 43], [28, 42], [29, 41], [30, 40], [31, 39], [32, 38], [33, 37], [34, 36], [35, 35], [36, 34], [37, 33], [38, 32], [39, 31], [40, 30], [41, 29], [42, 28], [43, 27], [44, 26], [45, 25], [46, 24], [47, 23], [48, 22], [49, 21], [22, 49], [23, 48], [24, 47], [25, 46], [26, 45], [27, 44], [28, 43], [29, 42], [30, 41], [31, 40], [32, 39], [33, 38], [34, 37], [35, 36], [36, 35], [37, 34], [38, 33], [39, 32], [40, 31], [41, 30], [42, 29], [43, 28], [44, 27], [45, 26], [46, 25], [47, 24], [48, 23], [49, 22], [23, 49], [24, 48], [25, 47], [26, 46], [27, 45], [28, 44], [29, 43], [30, 42], [31, 41], [32, 40], [33, 39], [34, 38], [35, 37], [36, 36], [37, 35], [38, 34], [39, 33], [40, 32], [41, 31], [42, 30], [43, 29], [44, 28], [45, 27], [46, 26], [47, 25], [48, 24], [49, 23], [24, 49], [25, 48], [26, 47], [27, 46], [28, 45], [29, 44], [30, 43], [31, 42], [32, 41], [33, 40], [34, 39], [35, 38], [36, 37], [37, 36], [38, 35], [39, 34], [40, 33], [41, 32], [42, 31], [43, 30], [44, 29], [45, 28], [46, 27], [47, 26], [48, 25], [49, 24], [25, 49], [26, 48], [27, 47], [28, 46], [29, 45], [30, 44], [31, 43], [32, 42], [33, 41], [34, 40], [35, 39], [36, 38], [37, 37], [38, 36], [39, 35], [40, 34], [41, 33], [42, 32], [43, 31], [44, 30], [45, 29], [46, 28], [47, 27], [48, 26], [49, 25], [26, 49], [27, 48], [28, 47], [29, 46], [30, 45], [31, 44], [32, 43], [33, 42], [34, 41], [35, 40], [36, 39], [37, 38], [38, 37], [39, 36], [40, 35], [41, 34], [42, 33], [43, 32], [44, 31], [45, 30], [46, 29], [47, 28], [48, 27], [49, 26], [27, 49], [28, 48], [29, 47], [30, 46], [31, 45], [32, 44], [33, 43], [34, 42], [35, 41], [36, 40], [37, 39], [38, 38], [39, 37], [40, 36], [41, 35], [42, 34], [43, 33], [44, 32], [45, 31], [46, 30], [47, 29], [48, 28], [49, 27], [28, 49], [29, 48], [30, 47], [31, 46], [32, 45], [33, 44], [34, 43], [35, 42], [36, 41], [37, 40], [38, 39], [39, 38], [40, 37], [41, 36], [42, 35], [43, 34], [44, 33], [45, 32], [46, 31], [47, 30], [48, 29], [49, 28], [29, 49], [30, 48], [31, 47], [32, 46], [33, 45], [34, 44], [35, 43], [36, 42], [37, 41], [38, 40], [39, 39], [40, 38], [41, 37], [42, 36], [43, 35], [44, 34], [45, 33], [46, 32], [47, 31], [48, 30], [49, 29], [30, 49], [31, 48], [32, 47], [33, 46], [34, 45], [35, 44], [36, 43], [37, 42], [38, 41], [39, 40], [40, 39], [41, 38], [42, 37], [43, 36], [44, 35], [45, 34], [46, 33], [47, 32], [48, 31], [49, 30], [31, 49], [32, 48], [33, 47], [34, 46], [35, 45], [36, 44], [37, 43], [38, 42], [39, 41], [40, 40], [41, 39], [42, 38], [43, 37], [44, 36], [45, 35], [46, 34], [47, 33], [48, 32], [49, 31], [32, 49], [33, 48], [34, 47], [35, 46], [36, 45], [37, 44], [38, 43], [39, 42], [40, 41], [41, 40], [42, 39], [43, 38], [44, 37], [45, 36], [46, 35], [47, 34], [48, 33], [49, 32], [33, 49], [34, 48], [35, 47], [36, 46], [37, 45], [38, 44], [39, 43], [40, 42], [41, 41], [42, 40], [43, 39], [44, 38], [45, 37], [46, 36], [47, 35], [48, 34], [49, 33], [34, 49], [35, 48], [36, 47], [37, 46], [38, 45], [39, 44], [40, 43], [41, 42], [42, 41], [43, 40], [44, 39], [45, 38], [46, 37], [47, 36], [48, 35], [49, 34], [35, 49], [36, 48], [37, 47], [38, 46], [39, 45], [40, 44], [41, 43], [42, 42], [43, 41], [44, 40], [45, 39], [46, 38], [47, 37], [48, 36], [49, 35], [36, 49], [37, 48], [38, 47], [39, 46], [40, 45], [41, 44], [42, 43], [43, 42], [44, 41], [45, 40], [46, 39], [47, 38], [48, 37], [49, 36], [37, 49], [38, 48], [39, 47], [40, 46], [41, 45], [42, 44], [43, 43], [44, 42], [45, 41], [46, 40], [47, 39], [48, 38], [49, 37], [38, 49], [39, 48], [40, 47], [41, 46], [42, 45], [43, 44], [44, 43], [45, 42], [46, 41], [47, 40], [48, 39], [49, 38], [39, 49], [40, 48], [41, 47], [42, 46], [43, 45], [44, 44], [45, 43], [46, 42], [47, 41], [48, 40], [49, 39], [40, 49], [41, 48], [42, 47], [43, 46], [44, 45], [45, 44], [46, 43], [47, 42], [48, 41], [49, 40], [41, 49], [42, 48], [43, 47], [44, 46], [45, 45], [46, 44], [47, 43], [48, 42], [49, 41], [42, 49], [43, 48], [44, 47], [45, 46], [46, 45], [47, 44], [48, 43], [49, 42], [43, 49], [44, 48], [45, 47], [46, 46], [47, 45], [48, 44], [49, 43], [44, 49], [45, 48], [46, 47], [47, 46], [48, 45], [49, 44], [45, 49], [46, 48], [47, 47], [48, 46], [49, 45], [46, 49], [47, 48], [48, 47], [49, 46], [47, 49], [48, 48], [49, 47], [48, 49], [49, 48], [49, 49]]\n assert candidate(rows = 4,cols = 6,rCenter = 0,cCenter = 5) == [[0, 5], [1, 5], [0, 4], [2, 5], [1, 4], [0, 3], [3, 5], [2, 4], [1, 3], [0, 2], [3, 4], [2, 3], [1, 2], [0, 1], [3, 3], [2, 2], [1, 1], [0, 0], [3, 2], [2, 1], [1, 0], [3, 1], [2, 0], [3, 0]]\n assert candidate(rows = 8,cols = 5,rCenter = 5,cCenter = 0) == [[5, 0], [4, 0], [5, 1], [6, 0], [3, 0], [4, 1], [5, 2], [6, 1], [7, 0], [2, 0], [3, 1], [4, 2], [5, 3], [6, 2], [7, 1], [1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 3], [7, 2], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [6, 4], [7, 3], [0, 1], [1, 2], [2, 3], [3, 4], [7, 4], [0, 2], [1, 3], [2, 4], [0, 3], [1, 4], [0, 4]]\n assert candidate(rows = 4,cols = 6,rCenter = 3,cCenter = 5) == [[3, 5], [2, 5], [3, 4], [1, 5], [2, 4], [3, 3], [0, 5], [1, 4], [2, 3], [3, 2], [0, 4], [1, 3], [2, 2], [3, 1], [0, 3], [1, 2], [2, 1], [3, 0], [0, 2], [1, 1], [2, 0], [0, 1], [1, 0], [0, 0]]\n assert candidate(rows = 7,cols = 3,rCenter = 3,cCenter = 1) == [[3, 1], [2, 1], [3, 2], [4, 1], [3, 0], [1, 1], [2, 2], [2, 0], [4, 2], [5, 1], [4, 0], [0, 1], [1, 2], [1, 0], [5, 2], [6, 1], [5, 0], [0, 2], [0, 0], [6, 2], [6, 0]]\n assert candidate(rows = 10,cols = 5,rCenter = 2,cCenter = 4) == [[2, 4], [1, 4], [3, 4], [2, 3], [0, 4], [1, 3], [4, 4], [3, 3], [2, 2], [0, 3], [1, 2], [5, 4], [4, 3], [3, 2], [2, 1], [0, 2], [1, 1], [6, 4], [5, 3], [4, 2], [3, 1], [2, 0], [0, 1], [1, 0], [7, 4], [6, 3], [5, 2], [4, 1], [3, 0], [0, 0], [8, 4], [7, 3], [6, 2], [5, 1], [4, 0], [9, 4], [8, 3], [7, 2], [6, 1], [5, 0], [9, 3], [8, 2], [7, 1], [6, 0], [9, 2], [8, 1], [7, 0], [9, 1], [8, 0], [9, 0]]\n assert candidate(rows = 9,cols = 6,rCenter = 3,cCenter = 2) == [[3, 2], [2, 2], [3, 3], [4, 2], [3, 1], [1, 2], [2, 3], [2, 1], [3, 4], [4, 3], [5, 2], [4, 1], [3, 0], [0, 2], [1, 3], [1, 1], [2, 4], [2, 0], [3, 5], [4, 4], [5, 3], [6, 2], [5, 1], [4, 0], [0, 3], [0, 1], [1, 4], [1, 0], [2, 5], [4, 5], [5, 4], [6, 3], [7, 2], [6, 1], [5, 0], [0, 4], [0, 0], [1, 5], [5, 5], [6, 4], [7, 3], [8, 2], [7, 1], [6, 0], [0, 5], [6, 5], [7, 4], [8, 3], [8, 1], [7, 0], [7, 5], [8, 4], [8, 0], [8, 5]]\n"}, "metadata": {"canonical_parameter_names": ["rows", "cols", "rCenter", "cCenter"], "leetcode_dataset_entry_point": "Solution().allCellsDistOrder", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var allCellsDistOrder = function(rows, cols, rCenter, cCenter) {", "container": null, "callable": "allCellsDistOrder", "parameters": [{"name": "rows", "type": "number"}, {"name": "cols", "type": "number"}, {"name": "rCenter", "type": "number"}, {"name": "cCenter", "type": "number"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1031, "task_id": "maximum-sum-of-two-non-overlapping-subarrays", "difficulty": "Medium", "problem_description": "Given an integer array nums and two integers firstLen and secondLen, return the maximum sum of elements in two non-overlapping subarrays with lengths firstLen and secondLen.\nThe array with length firstLen could occur before or after the array with length secondLen, but they have to be non-overlapping.\nA subarray is a contiguous part of an array.\n \nExample 1:\n\nInput: nums = [0,6,5,2,2,5,1,9,4], firstLen = 1, secondLen = 2\nOutput: 20\nExplanation: One choice of subarrays is [9] with length 1, and [6,5] with length 2.\n\nExample 2:\n\nInput: nums = [3,8,1,3,2,1,8,9,0], firstLen = 3, secondLen = 2\nOutput: 29\nExplanation: One choice of subarrays is [3,8,1] with length 3, and [8,9] with length 2.\n\nExample 3:\n\nInput: nums = [2,1,5,6,0,9,5,0,3,8], firstLen = 4, secondLen = 3\nOutput: 31\nExplanation: One choice of subarrays is [5,6,0,9] with length 4, and [0,3,8] with length 3.\n\n \nConstraints:\n\n1 <= firstLen, secondLen <= 1000\n2 <= firstLen + secondLen <= 1000\nfirstLen + secondLen <= nums.length <= 1000\n0 <= nums[i] <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 3,secondLen = 3) == 6\n assert candidate(nums = [0, 6, 5, 2, 2, 5, 1, 9, 4],firstLen = 1,secondLen = 2) == 20\n assert candidate(nums = [2, 1, 5, 6, 0, 9, 5, 0, 3, 8],firstLen = 4,secondLen = 3) == 31\n assert candidate(nums = [4, 5, 14, 16, 16, 20, 7, 13, 8, 15],firstLen = 3,secondLen = 5) == 109\n assert candidate(nums = [1, 4, 1, 1, 3, 3, 1, 2, 2, 2],firstLen = 3,secondLen = 5) == 18\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1],firstLen = 3,secondLen = 2) == 35\n assert candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1, 0],firstLen = 4,secondLen = 2) == 33\n assert candidate(nums = [1, 4, 1, 4, 1, 4, 1, 4, 1],firstLen = 1,secondLen = 1) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9],firstLen = 2,secondLen = 3) == 35\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5],firstLen = 2,secondLen = 2) == 20\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90],firstLen = 2,secondLen = 4) == 390\n assert candidate(nums = [3, 8, 1, 3, 2, 1, 8, 9, 0],firstLen = 3,secondLen = 2) == 29\n assert candidate(nums = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991],firstLen = 2,secondLen = 3) == 4990\n assert candidate(nums = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6],firstLen = 4,secondLen = 5) == 57\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],firstLen = 5,secondLen = 7) == 234\n assert candidate(nums = [5, 8, 6, 7, 2, 0, 9, 4, 5, 1, 6, 8, 3, 4, 5, 2],firstLen = 4,secondLen = 5) == 52\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],firstLen = 5,secondLen = 5) == 105\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],firstLen = 3,secondLen = 4) == 840\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],firstLen = 3,secondLen = 5) == 80\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200],firstLen = 15,secondLen = 10) == 3500\n assert candidate(nums = [40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],firstLen = 7,secondLen = 6) == 442\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],firstLen = 5,secondLen = 6) == 110\n assert candidate(nums = [1, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 10,secondLen = 15) == 28\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 10,secondLen = 15) == 25\n assert candidate(nums = [100, 0, 100, 0, 100, 0, 100, 0, 100, 0, 100, 0, 100, 0, 100, 0, 100, 0, 100, 0],firstLen = 2,secondLen = 3) == 300\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],firstLen = 2,secondLen = 5) == 11\n assert candidate(nums = [5, 3, 2, 5, 1, 6, 4, 9, 3, 2, 8, 7, 4, 5, 6, 1, 3, 4, 5, 6],firstLen = 5,secondLen = 5) == 55\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 5,secondLen = 10) == 15\n assert candidate(nums = [5, 1, 4, 7, 3, 1, 9, 8, 2, 0, 6],firstLen = 4,secondLen = 3) == 36\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],firstLen = 5,secondLen = 10) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],firstLen = 3,secondLen = 4) == 119\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100],firstLen = 20,secondLen = 30) == 3775\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],firstLen = 4,secondLen = 6) == 155\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],firstLen = 2,secondLen = 8) == 5500\n assert candidate(nums = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970, 969, 968, 967, 966, 965, 964, 963, 962, 961, 960, 959, 958, 957, 956, 955, 954, 953, 952, 951, 950, 949, 948, 947, 946, 945, 944, 943, 942, 941, 940, 939, 938, 937, 936, 935, 934, 933, 932, 931, 930],firstLen = 25,secondLen = 25) == 48775\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],firstLen = 8,secondLen = 9) == 374\n assert candidate(nums = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],firstLen = 1,secondLen = 1) == 2\n assert candidate(nums = [5, 1, 2, 10, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],firstLen = 10,secondLen = 8) == 567\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],firstLen = 7,secondLen = 6) == 1820\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 25,secondLen = 15) == 40\n assert candidate(nums = [5, 1, 3, 2, 4, 1, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7],firstLen = 5,secondLen = 4) == 62\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],firstLen = 7,secondLen = 6) == 182\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],firstLen = 6,secondLen = 7) == 351\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],firstLen = 1,secondLen = 1) == 0\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],firstLen = 7,secondLen = 8) == 75\n assert candidate(nums = [1000, 0, 1000, 0, 1000, 0, 1000, 0, 1000, 0, 1000, 0, 1000, 0, 1000, 0, 1000, 0, 1000, 0],firstLen = 5,secondLen = 6) == 6000\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 10,secondLen = 10) == 20\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],firstLen = 4,secondLen = 7) == 1650\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],firstLen = 10,secondLen = 10) == 210\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],firstLen = 4,secondLen = 3) == 4900\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],firstLen = 5,secondLen = 5) == 75\n assert candidate(nums = [9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9],firstLen = 1,secondLen = 19) == 36\n assert candidate(nums = [2, 3, 5, 1, 4, 7, 3, 1, 9, 8, 2, 0, 6],firstLen = 5,secondLen = 4) == 42\n assert candidate(nums = [5, 1, 6, 3, 7, 4, 8, 2, 9, 10],firstLen = 4,secondLen = 4) == 49\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],firstLen = 5,secondLen = 6) == 275\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 10,secondLen = 10) == 20\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],firstLen = 8,secondLen = 4) == 228\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 10,secondLen = 15) == 25\n assert candidate(nums = [5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],firstLen = 2,secondLen = 7) == 51\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],firstLen = 5,secondLen = 7) == 17400\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],firstLen = 4,secondLen = 3) == 490\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],firstLen = 5,secondLen = 10) == 195\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11],firstLen = 6,secondLen = 8) == 177\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],firstLen = 6,secondLen = 4) == 155\n assert candidate(nums = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],firstLen = 5,secondLen = 4) == 900\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],firstLen = 4,secondLen = 4) == 520\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],firstLen = 2,secondLen = 3) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 1000],firstLen = 30,secondLen = 25) == 4915\n assert candidate(nums = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],firstLen = 5,secondLen = 5) == 1000\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9],firstLen = 5,secondLen = 5) == 70\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],firstLen = 8,secondLen = 9) == 153\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 5,secondLen = 10) == 15\n assert candidate(nums = [30, 25, 20, 15, 10, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100],firstLen = 40,secondLen = 35) == 4725\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 15,secondLen = 15) == 30\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],firstLen = 10,secondLen = 5) == 195\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],firstLen = 10,secondLen = 10) == 55\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],firstLen = 5,secondLen = 3) == 920\n assert candidate(nums = [200, 100, 50, 25, 12, 6, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],firstLen = 3,secondLen = 4) == 396\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],firstLen = 4,secondLen = 4) == 40\n assert candidate(nums = [3, 5, 2, 1, 7, 9, 3, 5, 1, 9, 2, 6, 5, 8, 7, 4, 1, 5, 3, 2, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9],firstLen = 4,secondLen = 5) == 61\n assert candidate(nums = [2, 1, 3, 4, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 15,secondLen = 20) == 45\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 9,secondLen = 10) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],firstLen = 5,secondLen = 5) == 155\n assert candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],firstLen = 7,secondLen = 4) == 68\n assert candidate(nums = [8, 3, 5, 4, 7, 9, 2, 3, 5, 6, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7],firstLen = 9,secondLen = 5) == 78\n assert candidate(nums = [8, 3, 9, 1, 8, 7, 1, 9, 5, 1, 8],firstLen = 4,secondLen = 3) == 45\n assert candidate(nums = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 5, 1, 0, 5, 8, 2, 0, 9, 7, 4, 9, 4, 4, 5, 9, 2, 3, 0, 7, 8, 1, 6, 4, 0, 6, 2, 8, 6, 2, 0, 8, 9, 9, 8, 6, 2, 8, 0, 3, 4, 8, 2, 5, 3, 4, 2, 1],firstLen = 15,secondLen = 10) == 149\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 2,secondLen = 2) == 4\n assert candidate(nums = [9, 3, 8, 5, 6, 1, 2, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],firstLen = 7,secondLen = 8) == 88\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],firstLen = 5,secondLen = 2) == 490\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],firstLen = 4,secondLen = 5) == 144\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],firstLen = 5,secondLen = 4) == 144\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],firstLen = 5,secondLen = 5) == 30\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],firstLen = 5,secondLen = 4) == 0\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 5,secondLen = 5) == 10\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],firstLen = 5,secondLen = 5) == 70\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],firstLen = 7,secondLen = 8) == 75\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],firstLen = 5,secondLen = 6) == 55\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],firstLen = 6,secondLen = 4) == 79\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],firstLen = 6,secondLen = 10) == 2000\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],firstLen = 5,secondLen = 6) == 110\n assert candidate(nums = [5, 3, 1, 5, 2, 1, 3, 2, 1, 2, 5, 2, 5, 1, 3, 2, 5, 1, 3, 2, 5],firstLen = 5,secondLen = 7) == 39\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],firstLen = 3,secondLen = 3) == 45\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],firstLen = 5,secondLen = 10) == 195\n assert candidate(nums = [200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10],firstLen = 6,secondLen = 5) == 1650\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],firstLen = 9,secondLen = 10) == 20900\n assert candidate(nums = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28],firstLen = 8,secondLen = 6) == 301\n assert candidate(nums = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],firstLen = 6,secondLen = 5) == 275\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],firstLen = 2,secondLen = 3) == 400\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],firstLen = 15,secondLen = 10) == 25\n"}, "metadata": {"canonical_parameter_names": ["nums", "firstLen", "secondLen"], "leetcode_dataset_entry_point": "Solution().maxSumTwoNoOverlap", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxSumTwoNoOverlap = function(nums, firstLen, secondLen) {", "container": null, "callable": "maxSumTwoNoOverlap", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "firstLen", "type": "number"}, {"name": "secondLen", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1033, "task_id": "moving-stones-until-consecutive", "difficulty": "Medium", "problem_description": "There are three stones in different positions on the X-axis. You are given three integers a, b, and c, the positions of the stones.\nIn one move, you pick up a stone at an endpoint (i.e., either the lowest or highest position stone), and move it to an unoccupied position between those endpoints. Formally, let's say the stones are currently at positions x, y, and z with x < y < z. You pick up the stone at either position x or position z, and move that stone to an integer position k, with x < k < z and k != y.\nThe game ends when you cannot make any more moves (i.e., the stones are in three consecutive positions).\nReturn an integer array answer of length 2 where:\n\nanswer[0] is the minimum number of moves you can play, and\nanswer[1] is the maximum number of moves you can play.\n\n \nExample 1:\n\nInput: a = 1, b = 2, c = 5\nOutput: [1,2]\nExplanation: Move the stone from 5 to 3, or move the stone from 5 to 4 to 3.\n\nExample 2:\n\nInput: a = 4, b = 3, c = 2\nOutput: [0,0]\nExplanation: We cannot make any moves.\n\nExample 3:\n\nInput: a = 3, b = 5, c = 1\nOutput: [1,2]\nExplanation: Move the stone from 1 to 4; or move the stone from 1 to 2 to 4.\n\n \nConstraints:\n\n1 <= a, b, c <= 100\na, b, and c have different values.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(a = 7,b = 8,c = 10) == [1, 1]\n assert candidate(a = 1,b = 100,c = 50) == [2, 97]\n assert candidate(a = 1,b = 3,c = 100) == [1, 97]\n assert candidate(a = 10,b = 12,c = 14) == [1, 2]\n assert candidate(a = 50,b = 51,c = 53) == [1, 1]\n assert candidate(a = 25,b = 27,c = 30) == [1, 3]\n assert candidate(a = 5,b = 6,c = 8) == [1, 1]\n assert candidate(a = 10,b = 9,c = 8) == [0, 0]\n assert candidate(a = 2,b = 5,c = 7) == [1, 3]\n assert candidate(a = 7,b = 1,c = 3) == [1, 4]\n assert candidate(a = 2,b = 8,c = 15) == [2, 11]\n assert candidate(a = 1,b = 2,c = 5) == [1, 2]\n assert candidate(a = 20,b = 25,c = 30) == [2, 8]\n assert candidate(a = 15,b = 17,c = 20) == [1, 3]\n assert candidate(a = 3,b = 5,c = 1) == [1, 2]\n assert candidate(a = 2,b = 7,c = 10) == [2, 6]\n assert candidate(a = 2,b = 6,c = 5) == [1, 2]\n assert candidate(a = 15,b = 13,c = 11) == [1, 2]\n assert candidate(a = 5,b = 10,c = 15) == [2, 8]\n assert candidate(a = 10,b = 20,c = 30) == [2, 18]\n assert candidate(a = 100,b = 1,c = 50) == [2, 97]\n assert candidate(a = 3,b = 6,c = 9) == [2, 4]\n assert candidate(a = 25,b = 28,c = 30) == [1, 3]\n assert candidate(a = 2,b = 3,c = 4) == [0, 0]\n assert candidate(a = 1,b = 3,c = 6) == [1, 3]\n assert candidate(a = 3,b = 4,c = 5) == [0, 0]\n assert candidate(a = 8,b = 13,c = 17) == [2, 7]\n assert candidate(a = 4,b = 3,c = 2) == [0, 0]\n assert candidate(a = 2,b = 18,c = 20) == [1, 16]\n assert candidate(a = 1,b = 10,c = 20) == [2, 17]\n assert candidate(a = 30,b = 35,c = 40) == [2, 8]\n assert candidate(a = 1,b = 5,c = 9) == [2, 6]\n assert candidate(a = 1,b = 50,c = 100) == [2, 97]\n assert candidate(a = 10,b = 12,c = 25) == [1, 13]\n assert candidate(a = 5,b = 8,c = 12) == [2, 5]\n assert candidate(a = 8,b = 11,c = 20) == [2, 10]\n assert candidate(a = 23,b = 24,c = 26) == [1, 1]\n assert candidate(a = 1,b = 3,c = 7) == [1, 4]\n assert candidate(a = 7,b = 10,c = 13) == [2, 4]\n assert candidate(a = 3,b = 11,c = 20) == [2, 15]\n assert candidate(a = 8,b = 12,c = 17) == [2, 7]\n assert candidate(a = 13,b = 16,c = 20) == [2, 5]\n assert candidate(a = 20,b = 22,c = 26) == [1, 4]\n assert candidate(a = 1,b = 3,c = 8) == [1, 5]\n assert candidate(a = 7,b = 10,c = 14) == [2, 5]\n assert candidate(a = 98,b = 99,c = 100) == [0, 0]\n assert candidate(a = 5,b = 15,c = 25) == [2, 18]\n assert candidate(a = 35,b = 40,c = 45) == [2, 8]\n assert candidate(a = 2,b = 5,c = 8) == [2, 4]\n assert candidate(a = 2,b = 6,c = 9) == [2, 5]\n assert candidate(a = 5,b = 9,c = 14) == [2, 7]\n assert candidate(a = 6,b = 10,c = 12) == [1, 4]\n assert candidate(a = 8,b = 10,c = 15) == [1, 5]\n assert candidate(a = 6,b = 10,c = 15) == [2, 7]\n assert candidate(a = 30,b = 32,c = 34) == [1, 2]\n assert candidate(a = 3,b = 6,c = 10) == [2, 5]\n assert candidate(a = 1,b = 4,c = 7) == [2, 4]\n assert candidate(a = 2,b = 9,c = 12) == [2, 8]\n assert candidate(a = 15,b = 20,c = 25) == [2, 8]\n assert candidate(a = 8,b = 13,c = 18) == [2, 8]\n assert candidate(a = 23,b = 26,c = 29) == [2, 4]\n assert candidate(a = 40,b = 41,c = 43) == [1, 1]\n assert candidate(a = 6,b = 9,c = 12) == [2, 4]\n assert candidate(a = 2,b = 3,c = 6) == [1, 2]\n assert candidate(a = 1,b = 4,c = 100) == [2, 97]\n assert candidate(a = 6,b = 7,c = 12) == [1, 4]\n assert candidate(a = 5,b = 10,c = 14) == [2, 7]\n assert candidate(a = 5,b = 11,c = 14) == [2, 7]\n assert candidate(a = 2,b = 5,c = 10) == [2, 6]\n assert candidate(a = 15,b = 25,c = 35) == [2, 18]\n assert candidate(a = 10,b = 15,c = 25) == [2, 13]\n assert candidate(a = 20,b = 21,c = 26) == [1, 4]\n assert candidate(a = 5,b = 8,c = 11) == [2, 4]\n assert candidate(a = 2,b = 8,c = 14) == [2, 10]\n assert candidate(a = 5,b = 7,c = 14) == [1, 7]\n assert candidate(a = 25,b = 30,c = 40) == [2, 13]\n assert candidate(a = 1,b = 6,c = 11) == [2, 8]\n assert candidate(a = 33,b = 35,c = 40) == [1, 5]\n assert candidate(a = 1,b = 3,c = 10) == [1, 7]\n assert candidate(a = 2,b = 4,c = 8) == [1, 4]\n assert candidate(a = 2,b = 7,c = 11) == [2, 7]\n assert candidate(a = 10,b = 13,c = 16) == [2, 4]\n assert candidate(a = 15,b = 20,c = 40) == [2, 23]\n assert candidate(a = 5,b = 6,c = 9) == [1, 2]\n assert candidate(a = 21,b = 24,c = 28) == [2, 5]\n assert candidate(a = 90,b = 95,c = 100) == [2, 8]\n assert candidate(a = 10,b = 20,c = 25) == [2, 13]\n assert candidate(a = 3,b = 7,c = 11) == [2, 6]\n assert candidate(a = 3,b = 8,c = 10) == [1, 5]\n assert candidate(a = 10,b = 11,c = 14) == [1, 2]\n assert candidate(a = 12,b = 14,c = 20) == [1, 6]\n assert candidate(a = 30,b = 31,c = 34) == [1, 2]\n assert candidate(a = 5,b = 11,c = 17) == [2, 10]\n assert candidate(a = 100,b = 99,c = 97) == [1, 1]\n assert candidate(a = 3,b = 5,c = 10) == [1, 5]\n assert candidate(a = 4,b = 7,c = 11) == [2, 5]\n assert candidate(a = 1,b = 2,c = 4) == [1, 1]\n assert candidate(a = 2,b = 5,c = 9) == [2, 5]\n assert candidate(a = 5,b = 7,c = 10) == [1, 3]\n assert candidate(a = 3,b = 8,c = 13) == [2, 8]\n assert candidate(a = 15,b = 17,c = 25) == [1, 8]\n assert candidate(a = 6,b = 9,c = 18) == [2, 10]\n assert candidate(a = 7,b = 8,c = 14) == [1, 5]\n assert candidate(a = 2,b = 6,c = 8) == [1, 4]\n assert candidate(a = 17,b = 20,c = 23) == [2, 4]\n assert candidate(a = 30,b = 32,c = 40) == [1, 8]\n assert candidate(a = 8,b = 10,c = 13) == [1, 3]\n assert candidate(a = 1,b = 4,c = 10) == [2, 7]\n assert candidate(a = 7,b = 8,c = 15) == [1, 6]\n assert candidate(a = 7,b = 14,c = 21) == [2, 12]\n assert candidate(a = 10,b = 15,c = 20) == [2, 8]\n assert candidate(a = 4,b = 6,c = 9) == [1, 3]\n assert candidate(a = 20,b = 22,c = 30) == [1, 8]\n assert candidate(a = 10,b = 14,c = 17) == [2, 5]\n assert candidate(a = 8,b = 12,c = 22) == [2, 12]\n assert candidate(a = 7,b = 11,c = 15) == [2, 6]\n assert candidate(a = 8,b = 15,c = 3) == [2, 10]\n assert candidate(a = 2,b = 8,c = 9) == [1, 5]\n assert candidate(a = 45,b = 50,c = 55) == [2, 8]\n assert candidate(a = 3,b = 6,c = 8) == [1, 3]\n assert candidate(a = 6,b = 9,c = 15) == [2, 7]\n assert candidate(a = 1,b = 5,c = 7) == [1, 4]\n assert candidate(a = 1,b = 2,c = 3) == [0, 0]\n assert candidate(a = 50,b = 52,c = 55) == [1, 3]\n assert candidate(a = 7,b = 11,c = 25) == [2, 16]\n assert candidate(a = 9,b = 11,c = 13) == [1, 2]\n assert candidate(a = 25,b = 30,c = 50) == [2, 23]\n assert candidate(a = 10,b = 14,c = 18) == [2, 6]\n assert candidate(a = 2,b = 99,c = 100) == [1, 96]\n assert candidate(a = 23,b = 27,c = 31) == [2, 6]\n"}, "metadata": {"canonical_parameter_names": ["a", "b", "c"], "leetcode_dataset_entry_point": "Solution().numMovesStones", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numMovesStones = function(a, b, c) {", "container": null, "callable": "numMovesStones", "parameters": [{"name": "a", "type": "number"}, {"name": "b", "type": "number"}, {"name": "c", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1034, "task_id": "coloring-a-border", "difficulty": "Medium", "problem_description": "You are given an m x n integer matrix grid, and three integers row, col, and color. Each value in the grid represents the color of the grid square at that location.\nTwo squares are called adjacent if they are next to each other in any of the 4 directions.\nTwo squares belong to the same connected component if they have the same color and they are adjacent.\nThe border of a connected component is all the squares in the connected component that are either adjacent to (at least) a square not in the component, or on the boundary of the grid (the first or last row or column).\nYou should color the border of the connected component that contains the square grid[row][col] with color.\nReturn the final grid.\n \nExample 1:\nInput: grid = [[1,1],[1,2]], row = 0, col = 0, color = 3\nOutput: [[3,3],[3,2]]\nExample 2:\nInput: grid = [[1,2,2],[2,3,2]], row = 0, col = 1, color = 3\nOutput: [[1,3,3],[2,3,3]]\nExample 3:\nInput: grid = [[1,1,1],[1,1,1],[1,1,1]], row = 1, col = 1, color = 2\nOutput: [[2,2,2],[2,1,2],[2,2,2]]\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m, n <= 50\n1 <= grid[i][j], color <= 1000\n0 <= row < m\n0 <= col < n\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1000, 1000, 1000], [1000, 1, 1000], [1000, 1000, 1000]],row = 1,col = 1,color = 2) == [[1000, 1000, 1000], [1000, 2, 1000], [1000, 1000, 1000]]\n assert candidate(grid = [[1, 1], [1, 2]],row = 0,col = 0,color = 3) == [[3, 3], [3, 2]]\n assert candidate(grid = [[1000, 1000], [1000, 1000]],row = 1,col = 1,color = 999) == [[999, 999], [999, 999]]\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],row = 1,col = 1,color = 2) == [[2, 2, 2], [2, 1, 2], [2, 2, 2]]\n assert candidate(grid = [[1, 1, 1, 1], [1, 2, 2, 1], [1, 2, 2, 1], [1, 1, 1, 1]],row = 1,col = 1,color = 3) == [[1, 1, 1, 1], [1, 3, 3, 1], [1, 3, 3, 1], [1, 1, 1, 1]]\n assert candidate(grid = [[2, 3, 4], [3, 1, 3], [4, 3, 2]],row = 1,col = 1,color = 5) == [[2, 3, 4], [3, 5, 3], [4, 3, 2]]\n assert candidate(grid = [[10, 10, 10], [10, 10, 10], [10, 10, 10]],row = 1,col = 1,color = 10) == [[10, 10, 10], [10, 10, 10], [10, 10, 10]]\n assert candidate(grid = [[1, 2, 2], [2, 3, 2]],row = 0,col = 1,color = 3) == [[1, 3, 3], [2, 3, 3]]\n assert candidate(grid = [[1, 1, 1, 1], [1, 2, 2, 1], [1, 2, 2, 1], [1, 1, 1, 1]],row = 1,col = 1,color = 4) == [[1, 1, 1, 1], [1, 4, 4, 1], [1, 4, 4, 1], [1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 1], [2, 1, 2], [1, 2, 1]],row = 1,col = 1,color = 3) == [[1, 2, 1], [2, 3, 2], [1, 2, 1]]\n assert candidate(grid = [[2, 2, 2, 2], [2, 1, 1, 2], [2, 1, 1, 2], [2, 2, 2, 2]],row = 1,col = 1,color = 3) == [[2, 2, 2, 2], [2, 3, 3, 2], [2, 3, 3, 2], [2, 2, 2, 2]]\n assert candidate(grid = [[1, 2, 1], [2, 1, 2], [1, 2, 1]],row = 1,col = 1,color = 4) == [[1, 2, 1], [2, 4, 2], [1, 2, 1]]\n assert candidate(grid = [[1, 2, 3, 4], [2, 1, 2, 3], [3, 2, 3, 2], [4, 3, 2, 1]],row = 0,col = 0,color = 5) == [[5, 2, 3, 4], [2, 1, 2, 3], [3, 2, 3, 2], [4, 3, 2, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 3, 4, 4, 3, 2, 1], [1, 2, 3, 4, 4, 3, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1]],row = 4,col = 4,color = 12) == [[1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 3, 12, 12, 3, 2, 1], [1, 2, 3, 12, 12, 3, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 7, 5, 3, 1], [2, 4, 6, 8, 10, 8, 6, 4, 2], [1, 3, 5, 7, 9, 7, 5, 3, 1]],row = 2,col = 4,color = 10) == [[1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 10, 7, 5, 3, 1], [2, 4, 6, 8, 10, 8, 6, 4, 2], [1, 3, 5, 7, 9, 7, 5, 3, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 4, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]],row = 3,col = 3,color = 8) == [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 8, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]],row = 2,col = 2,color = 26) == [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 26, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]\n assert candidate(grid = [[1, 2, 3, 4], [2, 3, 4, 1], [3, 4, 1, 2], [4, 1, 2, 3], [1, 2, 3, 4]],row = 0,col = 0,color = 8) == [[8, 2, 3, 4], [2, 3, 4, 1], [3, 4, 1, 2], [4, 1, 2, 3], [1, 2, 3, 4]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 4, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]],row = 3,col = 3,color = 5) == [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 5, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 1], [3, 4, 5, 1, 2], [4, 5, 1, 2, 3], [5, 1, 2, 3, 4]],row = 1,col = 1,color = 6) == [[1, 2, 3, 4, 5], [2, 6, 4, 5, 1], [3, 4, 5, 1, 2], [4, 5, 1, 2, 3], [5, 1, 2, 3, 4]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]],row = 2,col = 2,color = 7) == [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 7, 7, 2, 1], [1, 2, 7, 7, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[3, 3, 3, 3, 3, 3], [3, 1, 1, 1, 1, 3], [3, 1, 2, 2, 1, 3], [3, 1, 2, 2, 1, 3], [3, 1, 1, 1, 1, 3], [3, 3, 3, 3, 3, 3]],row = 1,col = 1,color = 6) == [[3, 3, 3, 3, 3, 3], [3, 6, 6, 6, 6, 3], [3, 6, 2, 2, 6, 3], [3, 6, 2, 2, 6, 3], [3, 6, 6, 6, 6, 3], [3, 3, 3, 3, 3, 3]]\n assert candidate(grid = [[1, 1, 2, 2, 3, 3], [1, 1, 2, 2, 3, 3], [4, 4, 5, 5, 6, 6], [4, 4, 5, 5, 6, 6]],row = 1,col = 2,color = 7) == [[1, 1, 7, 7, 3, 3], [1, 1, 7, 7, 3, 3], [4, 4, 5, 5, 6, 6], [4, 4, 5, 5, 6, 6]]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]],row = 2,col = 2,color = 4) == [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 4, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]],row = 2,col = 2,color = 10) == [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 10, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 1, 2, 2, 1], [1, 2, 2, 2, 2, 1], [1, 2, 1, 2, 2, 1], [1, 1, 1, 1, 1, 1]],row = 1,col = 1,color = 3) == [[1, 1, 1, 1, 1, 1], [1, 3, 3, 3, 3, 1], [1, 3, 1, 3, 3, 1], [1, 3, 3, 2, 3, 1], [1, 3, 1, 3, 3, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]],row = 2,col = 2,color = 2) == [[2, 2, 2, 2, 2], [2, 1, 1, 1, 2], [2, 1, 1, 1, 2], [2, 1, 1, 1, 2], [2, 2, 2, 2, 2]]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 2, 3, 4, 1], [1, 3, 1, 3, 1], [1, 4, 3, 4, 1], [1, 1, 1, 1, 1]],row = 1,col = 2,color = 5) == [[1, 1, 1, 1, 1], [1, 2, 5, 4, 1], [1, 3, 1, 3, 1], [1, 4, 3, 4, 1], [1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 1, 2, 1, 2], [2, 1, 2, 1, 2, 1], [1, 2, 1, 2, 1, 2], [2, 1, 2, 1, 2, 1], [1, 2, 1, 2, 1, 2]],row = 2,col = 2,color = 3) == [[1, 2, 1, 2, 1, 2], [2, 1, 2, 1, 2, 1], [1, 2, 3, 2, 1, 2], [2, 1, 2, 1, 2, 1], [1, 2, 1, 2, 1, 2]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 1, 2, 2, 2, 2, 2, 1], [1, 2, 2, 3, 3, 3, 2, 2, 1], [1, 2, 1, 3, 1, 3, 2, 2, 1], [1, 2, 2, 3, 3, 3, 2, 2, 1], [1, 2, 1, 2, 2, 2, 2, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]],row = 4,col = 4,color = 4) == [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 1, 2, 2, 2, 2, 2, 1], [1, 2, 2, 3, 3, 3, 2, 2, 1], [1, 2, 1, 3, 4, 3, 2, 2, 1], [1, 2, 2, 3, 3, 3, 2, 2, 1], [1, 2, 1, 2, 2, 2, 2, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 4, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]],row = 3,col = 3,color = 10) == [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 10, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[5, 5, 5], [5, 1, 5], [5, 5, 5], [1, 1, 1], [5, 5, 5]],row = 1,col = 1,color = 7) == [[5, 5, 5], [5, 7, 5], [5, 5, 5], [1, 1, 1], [5, 5, 5]]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 2, 3, 2, 1], [1, 3, 1, 3, 1], [1, 2, 3, 2, 1], [1, 1, 1, 1, 1]],row = 2,col = 2,color = 9) == [[1, 1, 1, 1, 1], [1, 2, 3, 2, 1], [1, 3, 9, 3, 1], [1, 2, 3, 2, 1], [1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 3, 1, 1, 1, 3, 2, 1], [1, 2, 3, 1, 0, 1, 3, 2, 1], [1, 2, 3, 1, 1, 1, 3, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]],row = 4,col = 4,color = 5) == [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 3, 1, 1, 1, 3, 2, 1], [1, 2, 3, 1, 5, 1, 3, 2, 1], [1, 2, 3, 1, 1, 1, 3, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[5, 3, 3, 3, 3, 5], [3, 1, 1, 1, 1, 3], [3, 1, 2, 2, 1, 3], [3, 1, 2, 2, 1, 3], [3, 1, 1, 1, 1, 3], [5, 3, 3, 3, 3, 5]],row = 2,col = 2,color = 4) == [[5, 3, 3, 3, 3, 5], [3, 1, 1, 1, 1, 3], [3, 1, 4, 4, 1, 3], [3, 1, 4, 4, 1, 3], [3, 1, 1, 1, 1, 3], [5, 3, 3, 3, 3, 5]]\n assert candidate(grid = [[1, 1, 1, 2, 1], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 2, 1]],row = 2,col = 2,color = 4) == [[1, 1, 1, 2, 1], [1, 2, 2, 2, 1], [1, 2, 4, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 2, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 1, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]],row = 2,col = 2,color = 3) == [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [1, 2, 3], [4, 5, 6]],row = 2,col = 1,color = 10) == [[1, 2, 3], [4, 5, 6], [7, 10, 9], [1, 2, 3], [4, 5, 6]]\n assert candidate(grid = [[1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6, 1], [3, 4, 5, 6, 1, 2], [4, 5, 6, 1, 2, 3], [5, 6, 1, 2, 3, 4], [6, 1, 2, 3, 4, 5]],row = 2,col = 2,color = 7) == [[1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6, 1], [3, 4, 7, 6, 1, 2], [4, 5, 6, 1, 2, 3], [5, 6, 1, 2, 3, 4], [6, 1, 2, 3, 4, 5]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]],row = 4,col = 4,color = 2) == [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 2, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 2, 3, 4, 2, 1], [1, 3, 4, 5, 3, 1], [1, 4, 5, 6, 4, 1], [1, 5, 6, 7, 5, 1], [1, 1, 1, 1, 1, 1]],row = 2,col = 2,color = 8) == [[1, 1, 1, 1, 1, 1], [1, 2, 3, 4, 2, 1], [1, 3, 8, 5, 3, 1], [1, 4, 5, 6, 4, 1], [1, 5, 6, 7, 5, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]],row = 2,col = 2,color = 4) == [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 4, 4, 2, 1], [1, 2, 4, 4, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[5, 5, 5, 5, 5, 5], [5, 4, 4, 4, 4, 5], [5, 4, 3, 3, 4, 5], [5, 4, 3, 3, 4, 5], [5, 4, 4, 4, 4, 5], [5, 5, 5, 5, 5, 5]],row = 2,col = 2,color = 1) == [[5, 5, 5, 5, 5, 5], [5, 4, 4, 4, 4, 5], [5, 4, 1, 1, 4, 5], [5, 4, 1, 1, 4, 5], [5, 4, 4, 4, 4, 5], [5, 5, 5, 5, 5, 5]]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],row = 0,col = 0,color = 2) == [[2, 2, 2, 2], [2, 1, 1, 2], [2, 1, 1, 2], [2, 1, 1, 2], [2, 2, 2, 2]]\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]],row = 1,col = 1,color = 13) == [[1, 2, 3], [4, 13, 6], [7, 8, 9], [10, 11, 12]]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]],row = 2,col = 2,color = 6) == [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 6, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],row = 2,col = 2,color = 2) == [[2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [2, 1, 1, 1, 1, 1, 1, 1, 1, 2], [2, 1, 1, 1, 1, 1, 1, 1, 1, 2], [2, 1, 1, 1, 1, 1, 1, 1, 1, 2], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 0, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]],row = 3,col = 3,color = 4) == [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 4, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 1, 2, 1, 2, 1], [2, 1, 2, 1, 2, 1, 2], [1, 2, 1, 2, 1, 2, 1], [2, 1, 2, 1, 2, 1, 2], [1, 2, 1, 2, 1, 2, 1]],row = 2,col = 2,color = 3) == [[1, 2, 1, 2, 1, 2, 1], [2, 1, 2, 1, 2, 1, 2], [1, 2, 3, 2, 1, 2, 1], [2, 1, 2, 1, 2, 1, 2], [1, 2, 1, 2, 1, 2, 1]]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],row = 0,col = 0,color = 5) == [[5, 5, 5, 5], [5, 1, 1, 5], [5, 1, 1, 5], [5, 5, 5, 5]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]],row = 2,col = 2,color = 9) == [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 9, 9, 2, 1], [1, 2, 9, 9, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 3, 4, 4, 4, 3, 2, 1], [1, 2, 3, 4, 5, 4, 3, 2, 1], [1, 2, 3, 4, 4, 4, 3, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]],row = 4,col = 4,color = 15) == [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 3, 4, 4, 4, 3, 2, 1], [1, 2, 3, 4, 15, 4, 3, 2, 1], [1, 2, 3, 4, 4, 4, 3, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1]],row = 2,col = 2,color = 3) == [[1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 3, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 3, 1, 1, 3, 2, 1], [1, 2, 3, 1, 1, 3, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1]],row = 3,col = 3,color = 4) == [[1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 3, 4, 4, 3, 2, 1], [1, 2, 3, 4, 4, 3, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 1, 1, 2, 2], [1, 2, 2, 2, 1], [1, 2, 1, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 2, 2]],row = 2,col = 2,color = 3) == [[1, 1, 1, 2, 2], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 2, 2]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 4, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]],row = 3,col = 3,color = 11) == [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 11, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]],row = 2,col = 2,color = 5) == [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 5, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 2, 3, 4, 5]],row = 2,col = 2,color = 6) == [[1, 2, 6, 4, 5], [5, 4, 6, 2, 1], [1, 2, 6, 4, 5], [5, 4, 6, 2, 1], [1, 2, 6, 4, 5]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 1, 2, 2, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 2, 2, 1, 1], [1, 1, 1, 1, 1, 1]],row = 2,col = 2,color = 8) == [[1, 1, 1, 1, 1, 1], [1, 1, 8, 8, 1, 1], [1, 8, 2, 2, 8, 1], [1, 8, 2, 2, 8, 1], [1, 1, 8, 8, 1, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[5, 5, 5, 5, 5], [5, 6, 7, 6, 5], [5, 7, 5, 7, 5], [5, 6, 7, 6, 5], [5, 5, 5, 5, 5]],row = 1,col = 2,color = 8) == [[5, 5, 5, 5, 5], [5, 6, 8, 6, 5], [5, 7, 5, 7, 5], [5, 6, 7, 6, 5], [5, 5, 5, 5, 5]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 2, 2, 2, 1, 1], [1, 1, 1, 2, 1, 2, 1, 1], [1, 1, 1, 2, 2, 2, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]],row = 3,col = 3,color = 3) == [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 3, 3, 3, 1, 1], [1, 1, 1, 3, 1, 3, 1, 1], [1, 1, 1, 3, 3, 3, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1]],row = 3,col = 3,color = 9) == [[1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6], [6, 5, 4, 9, 2, 1], [1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1]]\n assert candidate(grid = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]],row = 3,col = 3,color = 10) == [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 10, 8], [5, 6, 7, 8, 9]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 1, 2, 1, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 1, 2, 1, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]],row = 3,col = 3,color = 3) == [[1, 1, 1, 1, 1, 1, 1], [1, 3, 3, 3, 3, 3, 1], [1, 3, 1, 3, 1, 3, 1], [1, 3, 3, 2, 3, 3, 1], [1, 3, 1, 3, 1, 3, 1], [1, 3, 3, 3, 3, 3, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]],row = 0,col = 0,color = 6) == [[6, 6, 6, 6, 6], [6, 2, 2, 2, 6], [6, 2, 3, 2, 6], [6, 2, 2, 2, 6], [6, 6, 6, 6, 6]]\n assert candidate(grid = [[1, 1, 2, 2, 3], [1, 1, 2, 3, 3], [2, 2, 3, 3, 3], [2, 3, 3, 3, 3], [3, 3, 3, 3, 3]],row = 0,col = 0,color = 5) == [[5, 5, 2, 2, 3], [5, 5, 2, 3, 3], [2, 2, 3, 3, 3], [2, 3, 3, 3, 3], [3, 3, 3, 3, 3]]\n assert candidate(grid = [[1, 2, 3, 4, 5], [2, 1, 2, 3, 4], [3, 2, 3, 2, 3], [4, 3, 2, 3, 2], [5, 4, 3, 2, 1]],row = 2,col = 2,color = 14) == [[1, 2, 3, 4, 5], [2, 1, 2, 3, 4], [3, 2, 14, 2, 3], [4, 3, 2, 3, 2], [5, 4, 3, 2, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 4, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]],row = 3,col = 3,color = 13) == [[1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 3, 13, 3, 2, 1], [1, 2, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [2, 3, 4, 5, 6, 7, 8, 9, 1], [3, 4, 5, 6, 7, 8, 9, 1, 2], [4, 5, 6, 7, 8, 9, 1, 2, 3], [5, 6, 7, 8, 9, 1, 2, 3, 4], [6, 7, 8, 9, 1, 2, 3, 4, 5], [7, 8, 9, 1, 2, 3, 4, 5, 6], [8, 9, 1, 2, 3, 4, 5, 6, 7], [9, 1, 2, 3, 4, 5, 6, 7, 8]],row = 4,col = 4,color = 10) == [[1, 2, 3, 4, 5, 6, 7, 8, 9], [2, 3, 4, 5, 6, 7, 8, 9, 1], [3, 4, 5, 6, 7, 8, 9, 1, 2], [4, 5, 6, 7, 8, 9, 1, 2, 3], [5, 6, 7, 8, 10, 1, 2, 3, 4], [6, 7, 8, 9, 1, 2, 3, 4, 5], [7, 8, 9, 1, 2, 3, 4, 5, 6], [8, 9, 1, 2, 3, 4, 5, 6, 7], [9, 1, 2, 3, 4, 5, 6, 7, 8]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 3, 4, 4, 3, 2, 1], [1, 2, 3, 4, 4, 3, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1]],row = 4,col = 4,color = 11) == [[1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 3, 11, 11, 3, 2, 1], [1, 2, 3, 11, 11, 3, 2, 1], [1, 2, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 1, 2, 2, 3], [1, 2, 2, 3, 3], [2, 2, 3, 3, 4], [2, 3, 3, 4, 4], [3, 3, 4, 4, 5]],row = 2,col = 2,color = 6) == [[1, 1, 2, 2, 6], [1, 2, 2, 6, 6], [2, 2, 6, 6, 4], [2, 6, 6, 4, 4], [6, 6, 4, 4, 5]]\n assert candidate(grid = [[10, 10, 10], [10, 20, 10], [10, 10, 10], [10, 10, 10]],row = 1,col = 1,color = 15) == [[10, 10, 10], [10, 15, 10], [10, 10, 10], [10, 10, 10]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]],row = 3,col = 3,color = 7) == [[1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 1], [1, 2, 7, 7, 2, 1], [1, 2, 7, 7, 2, 1], [1, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[1, 2, 3, 4, 5], [2, 1, 4, 5, 1], [3, 4, 1, 2, 3], [4, 5, 2, 3, 4], [5, 1, 3, 4, 1]],row = 2,col = 2,color = 10) == [[1, 2, 3, 4, 5], [2, 1, 4, 5, 1], [3, 4, 10, 2, 3], [4, 5, 2, 3, 4], [5, 1, 3, 4, 1]]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],row = 1,col = 1,color = 5) == [[5, 5, 5, 5], [5, 1, 1, 5], [5, 1, 1, 5], [5, 5, 5, 5]]\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 3, 4, 4, 4, 3, 2, 1], [1, 2, 3, 4, 5, 4, 3, 2, 1], [1, 2, 3, 4, 4, 4, 3, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]],row = 4,col = 4,color = 13) == [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 3, 4, 4, 4, 3, 2, 1], [1, 2, 3, 4, 13, 4, 3, 2, 1], [1, 2, 3, 4, 4, 4, 3, 2, 1], [1, 2, 3, 3, 3, 3, 3, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]\n assert candidate(grid = [[10, 11, 10, 11], [11, 10, 11, 10], [10, 11, 10, 11], [11, 10, 11, 10]],row = 1,col = 1,color = 12) == [[10, 11, 10, 11], [11, 12, 11, 10], [10, 11, 10, 11], [11, 10, 11, 10]]\n assert candidate(grid = [[1, 2, 1, 2, 1, 2], [2, 1, 2, 1, 2, 1], [1, 2, 1, 2, 1, 2], [2, 1, 2, 1, 2, 1], [1, 2, 1, 2, 1, 2], [2, 1, 2, 1, 2, 1]],row = 3,col = 3,color = 3) == [[1, 2, 1, 2, 1, 2], [2, 1, 2, 1, 2, 1], [1, 2, 1, 2, 1, 2], [2, 1, 2, 3, 2, 1], [1, 2, 1, 2, 1, 2], [2, 1, 2, 1, 2, 1]]\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 2, 3, 2, 1], [1, 3, 5, 3, 1], [1, 2, 3, 2, 1], [1, 1, 1, 1, 1]],row = 1,col = 2,color = 6) == [[1, 1, 1, 1, 1], [1, 2, 6, 2, 1], [1, 3, 5, 3, 1], [1, 2, 3, 2, 1], [1, 1, 1, 1, 1]]\n"}, "metadata": {"canonical_parameter_names": ["grid", "row", "col", "color"], "leetcode_dataset_entry_point": "Solution().colorBorder", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var colorBorder = function(grid, row, col, color) {", "container": null, "callable": "colorBorder", "parameters": [{"name": "grid", "type": "number[][]"}, {"name": "row", "type": "number"}, {"name": "col", "type": "number"}, {"name": "color", "type": "number"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1035, "task_id": "uncrossed-lines", "difficulty": "Medium", "problem_description": "You are given two integer arrays nums1 and nums2. We write the integers of nums1 and nums2 (in the order they are given) on two separate horizontal lines.\nWe may draw connecting lines: a straight line connecting two numbers nums1[i] and nums2[j] such that:\n\nnums1[i] == nums2[j], and\nthe line we draw does not intersect any other connecting (non-horizontal) line.\n\nNote that a connecting line cannot intersect even at the endpoints (i.e., each number can only belong to one connecting line).\nReturn the maximum number of connecting lines we can draw in this way.\n \nExample 1:\n\n\nInput: nums1 = [1,4,2], nums2 = [1,2,4]\nOutput: 2\nExplanation: We can draw 2 uncrossed lines as in the diagram.\nWe cannot draw 3 uncrossed lines, because the line from nums1[1] = 4 to nums2[2] = 4 will intersect the line from nums1[2]=2 to nums2[1]=2.\n\nExample 2:\n\nInput: nums1 = [2,5,1,2,5], nums2 = [10,5,2,1,5,2]\nOutput: 3\n\nExample 3:\n\nInput: nums1 = [1,3,7,1,7,5], nums2 = [1,9,2,5,1]\nOutput: 2\n\n \nConstraints:\n\n1 <= nums1.length, nums2.length <= 500\n1 <= nums1[i], nums2[j] <= 2000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums1 = [2, 5, 1, 2, 5],nums2 = [10, 5, 2, 1, 5, 2]) == 3\n assert candidate(nums1 = [1, 4, 2],nums2 = [1, 2, 4]) == 2\n assert candidate(nums1 = [3, 3, 3, 3, 3, 3, 3],nums2 = [3, 3, 3, 3, 3, 3, 3]) == 7\n assert candidate(nums1 = [1, 2, 2, 1],nums2 = [2, 1, 1, 2]) == 2\n assert candidate(nums1 = [5],nums2 = [5]) == 1\n assert candidate(nums1 = [1, 1, 1, 1],nums2 = [1, 1, 1, 1]) == 4\n assert candidate(nums1 = [1, 2, 3],nums2 = [3, 2, 1]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5],nums2 = [5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [1, 2, 3, 3, 4, 5],nums2 = [3, 3, 3]) == 2\n assert candidate(nums1 = [1, 2, 3, 3, 2, 1],nums2 = [1, 2, 3, 4, 3, 2, 1]) == 6\n assert candidate(nums1 = [5, 1, 4, 2],nums2 = [5, 2, 1, 4]) == 3\n assert candidate(nums1 = [1, 3, 7, 1, 7, 5],nums2 = [1, 9, 2, 5, 1]) == 2\n assert candidate(nums1 = [3],nums2 = [3]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5],nums2 = [1, 2, 3, 4, 5]) == 5\n assert candidate(nums1 = [1000, 2000],nums2 = [2000, 1000]) == 1\n assert candidate(nums1 = [5, 1, 4, 2],nums2 = [5, 1, 2]) == 3\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [1, 2, 3],nums2 = [4, 5, 6]) == 0\n assert candidate(nums1 = [1],nums2 = [1]) == 1\n assert candidate(nums1 = [5, 1, 4, 5, 1, 3],nums2 = [5, 2, 1, 4, 1, 3]) == 5\n assert candidate(nums1 = [3],nums2 = [3, 3, 3]) == 1\n assert candidate(nums1 = [1, 1, 1, 1, 1],nums2 = [1, 1, 1, 1, 1]) == 5\n assert candidate(nums1 = [1, 4, 2, 6, 7, 8, 9],nums2 = [2, 3, 6, 7, 8, 9, 10]) == 5\n assert candidate(nums1 = [1, 1, 2, 3, 4, 5, 1, 1, 1, 1, 1, 1],nums2 = [1, 2, 3, 4, 5, 1, 1, 1, 1, 1, 1, 1]) == 11\n assert candidate(nums1 = [1, 2, 2, 3, 3, 4, 4, 5, 5],nums2 = [5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == 2\n assert candidate(nums1 = [1000, 2000, 1000, 2000],nums2 = [2000, 1000, 2000, 1000]) == 3\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],nums2 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 11\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9],nums2 = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [1, 3, 7, 1, 7, 5, 9, 2, 4, 8],nums2 = [1, 9, 2, 5, 1, 3, 4, 8, 7]) == 5\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],nums2 = [29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [5, 1, 4, 9, 3, 7, 2, 8, 10, 6]) == 5\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90],nums2 = [90, 80, 70, 60, 50, 40, 30, 20, 10]) == 1\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 11\n assert candidate(nums1 = [10, 5, 2, 1, 5, 2, 3, 4, 5, 6, 7, 8, 9],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 5, 2, 1]) == 9\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 10\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 15\n assert candidate(nums1 = [3, 1, 2, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 2\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]) == 15\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],nums2 = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20\n assert candidate(nums1 = [1, 3, 7, 1, 7, 5, 9, 1, 3, 7, 1, 7, 5],nums2 = [1, 9, 2, 5, 1, 3, 7, 1, 7, 5, 9, 1, 3]) == 9\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [1, 2, 3, 3, 4, 5, 5, 5, 6, 7, 8, 9, 10, 10],nums2 = [3, 3, 3, 5, 5, 5, 7, 7, 7]) == 6\n assert candidate(nums1 = [8, 5, 1, 2, 6, 8, 3, 6],nums2 = [8, 3, 2, 1, 6, 8, 8, 5]) == 4\n assert candidate(nums1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],nums2 = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 60\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],nums2 = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],nums2 = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 29\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(nums1 = [1, 3, 7, 1, 7, 5, 9, 2, 5],nums2 = [1, 9, 2, 5, 1, 5, 9, 7, 3]) == 4\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [3, 3, 3, 3, 3, 3],nums2 = [3, 3, 3, 3, 3, 3]) == 6\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],nums2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 0\n assert candidate(nums1 = [5, 10, 15, 20, 25, 30],nums2 = [5, 10, 15, 20, 25, 30, 5, 10, 15, 20, 25, 30]) == 6\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(nums1 = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],nums2 = [5, 4, 3, 2, 1, 5, 4, 3, 2, 1]) == 2\n assert candidate(nums1 = [1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 2, 1],nums2 = [1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 2, 1]) == 22\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 5\n assert candidate(nums1 = [5, 4, 3, 2, 1],nums2 = [1, 2, 3, 4, 5, 6, 7, 8]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5],nums2 = [5, 4, 3, 2, 1]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6]) == 2\n assert candidate(nums1 = [10, 20, 30, 40, 50],nums2 = [20, 10, 40, 30, 50]) == 3\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],nums2 = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums1 = [1, 2, 2, 1, 3, 3, 1, 2],nums2 = [2, 1, 3, 3, 1, 2, 2, 1]) == 6\n assert candidate(nums1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],nums2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]) == 0\n assert candidate(nums1 = [1, 1, 1, 1, 1],nums2 = [1, 1, 1, 1, 1]) == 5\n assert candidate(nums1 = [2, 3, 1, 3, 4, 5, 6],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 5\n assert candidate(nums1 = [1, 3, 7, 1, 7, 5],nums2 = [1, 9, 2, 5, 1, 7, 5]) == 4\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [1, 5, 10, 15, 20, 25, 30, 35, 40, 45]) == 3\n assert candidate(nums1 = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],nums2 = [5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == 2\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(nums1 = [5, 1, 4, 3, 6, 2, 7, 8, 9],nums2 = [10, 5, 2, 3, 8, 1, 6, 4, 7]) == 4\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 5\n assert candidate(nums1 = [5, 3, 8, 7, 9, 2, 4, 1],nums2 = [7, 2, 3, 8, 9, 4, 5, 1]) == 5\n assert candidate(nums1 = [1, 3, 7, 1, 7, 5],nums2 = [1, 9, 2, 5, 1, 7, 5, 1, 9, 2, 5, 1, 7, 5]) == 5\n assert candidate(nums1 = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4],nums2 = [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]) == 6\n assert candidate(nums1 = [1, 3, 5, 7, 9],nums2 = [2, 4, 6, 8, 10]) == 0\n assert candidate(nums1 = [2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2],nums2 = [1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1]) == 28\n assert candidate(nums1 = [1, 2, 1, 4, 1, 5, 1],nums2 = [1, 5, 1, 4, 1, 2, 1]) == 5\n assert candidate(nums1 = [5, 4, 3, 2, 1, 1, 2, 3, 4, 5],nums2 = [1, 2, 3, 4, 5, 5, 4, 3, 2, 1]) == 5\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5]) == 10\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],nums2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 50\n assert candidate(nums1 = [1, 2, 1, 3, 1, 4, 1, 5],nums2 = [5, 1, 4, 1, 3, 1, 2, 1]) == 5\n assert candidate(nums1 = [1, 4, 2, 3, 5, 7],nums2 = [1, 3, 5, 4, 2, 7]) == 4\n assert candidate(nums1 = [2, 1, 3, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 8\n assert candidate(nums1 = [5, 14, 23, 42, 55, 67, 78],nums2 = [5, 14, 23, 42, 55, 67, 78]) == 7\n assert candidate(nums1 = [4, 1, 3, 3, 5, 2, 1, 4, 3, 3],nums2 = [3, 5, 1, 3, 2, 1, 4, 3, 4]) == 6\n assert candidate(nums1 = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110],nums2 = [110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100]) == 1\n assert candidate(nums1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],nums2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 16\n assert candidate(nums1 = [1, 2, 1, 3, 1, 4, 1, 5, 1],nums2 = [1, 5, 1, 4, 1, 3, 1, 2, 1]) == 5\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],nums2 = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 1\n assert candidate(nums1 = [10, 5, 2, 1, 5, 2, 8, 7, 10, 9],nums2 = [10, 2, 5, 1, 5, 2, 9, 10, 7, 8]) == 6\n assert candidate(nums1 = [5, 1, 4, 5, 5, 3],nums2 = [5, 5, 3, 1, 4, 5]) == 4\n assert candidate(nums1 = [100, 200, 300, 400, 500],nums2 = [500, 400, 300, 200, 100]) == 1\n assert candidate(nums1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],nums2 = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 13, 14, 15]) == 13\n assert candidate(nums1 = [1, 2, 2, 1, 5],nums2 = [3, 2, 2, 1, 5, 3, 2, 2, 1]) == 4\n assert candidate(nums1 = [1, 4, 2, 3, 5, 6],nums2 = [6, 2, 4, 5, 1]) == 2\n assert candidate(nums1 = [5, 14, 10, 3, 2, 1, 5, 18, 9, 10, 13, 11, 10, 13, 13, 20, 7, 7, 13, 4, 12, 18, 10, 3, 1, 10, 19, 14, 18, 2, 17, 20, 2, 19, 2, 11, 2, 13, 12, 20, 1, 10, 19, 14, 18, 2, 17, 20],nums2 = [5, 5, 5, 14, 10, 3, 2, 1, 5, 18, 9, 10, 13, 11, 10, 13, 13, 20, 7, 7, 13, 4, 12, 18, 10, 3, 1, 10, 19, 14, 18, 2, 17, 20, 2, 19, 2, 11, 2, 13, 12, 20, 1, 10, 19, 14, 18, 2, 17, 20]) == 48\n"}, "metadata": {"canonical_parameter_names": ["nums1", "nums2"], "leetcode_dataset_entry_point": "Solution().maxUncrossedLines", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxUncrossedLines = function(nums1, nums2) {", "container": null, "callable": "maxUncrossedLines", "parameters": [{"name": "nums1", "type": "number[]"}, {"name": "nums2", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1036, "task_id": "escape-a-large-maze", "difficulty": "Hard", "problem_description": "There is a 1 million by 1 million grid on an XY-plane, and the coordinates of each grid square are (x, y).\nWe start at the source = [sx, sy] square and want to reach the target = [tx, ty] square. There is also an array of blocked squares, where each blocked[i] = [xi, yi] represents a blocked square with coordinates (xi, yi).\nEach move, we can walk one square north, east, south, or west if the square is not in the array of blocked squares. We are also not allowed to walk outside of the grid.\nReturn true if and only if it is possible to reach the target square from the source square through a sequence of valid moves.\n \nExample 1:\n\nInput: blocked = [[0,1],[1,0]], source = [0,0], target = [0,2]\nOutput: false\nExplanation: The target square is inaccessible starting from the source square because we cannot move.\nWe cannot move north or east because those squares are blocked.\nWe cannot move south or west because we cannot go outside of the grid.\n\nExample 2:\n\nInput: blocked = [], source = [0,0], target = [999999,999999]\nOutput: true\nExplanation: Because there are no blocked cells, it is possible to reach the target square.\n\n \nConstraints:\n\n0 <= blocked.length <= 200\nblocked[i].length == 2\n0 <= xi, yi < 106\nsource.length == target.length == 2\n0 <= sx, sy, tx, ty < 106\nsource != target\nIt is guaranteed that source and target are not blocked.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(blocked = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]],source = [0, 0],target = [6, 6]) == True\n assert candidate(blocked = [[5, 5]],source = [4, 4],target = [6, 6]) == True\n assert candidate(blocked = [],source = [0, 0],target = [999999, 999999]) == True\n assert candidate(blocked = [[1, 2], [2, 1], [2, 3], [3, 2]],source = [0, 0],target = [4, 4]) == True\n assert candidate(blocked = [[10, 10], [11, 10], [12, 10], [13, 10]],source = [9, 9],target = [14, 14]) == True\n assert candidate(blocked = [[500000, 500000]],source = [499999, 499999],target = [500001, 500001]) == True\n assert candidate(blocked = [[10, 10], [10, 11], [10, 12], [11, 10], [11, 11], [11, 12], [12, 10], [12, 11], [12, 12]],source = [9, 9],target = [13, 13]) == True\n assert candidate(blocked = [[0, 1], [1, 0], [2, 0], [0, 2]],source = [0, 0],target = [3, 3]) == False\n assert candidate(blocked = [[5, 5], [5, 6], [5, 7], [6, 5], [6, 7], [7, 5], [7, 6], [7, 7]],source = [4, 4],target = [8, 8]) == True\n assert candidate(blocked = [[1, 1], [2, 2], [3, 3]],source = [0, 0],target = [3, 4]) == True\n assert candidate(blocked = [[10, 10], [11, 10], [10, 11], [11, 11]],source = [0, 0],target = [20, 20]) == True\n assert candidate(blocked = [[0, 3], [1, 3], [2, 3], [3, 3]],source = [0, 0],target = [0, 4]) == True\n assert candidate(blocked = [[0, 1], [1, 0]],source = [0, 0],target = [0, 2]) == False\n assert candidate(blocked = [[0, 1], [1, 1], [2, 1], [3, 1]],source = [0, 0],target = [0, 4]) == True\n assert candidate(blocked = [[1, 1], [1, 2], [2, 1]],source = [0, 0],target = [3, 3]) == True\n assert candidate(blocked = [[100, 100], [100, 101], [101, 100], [101, 101], [200, 200], [200, 201], [201, 200], [201, 201]],source = [0, 0],target = [300, 300]) == True\n assert candidate(blocked = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]],source = [0, 0],target = [11, 11]) == True\n assert candidate(blocked = [[999997, 999998], [999998, 999998], [999999, 999998], [999997, 999999], [999998, 999999], [999999, 999999]],source = [999995, 999995],target = [999999, 999999]) == False\n assert candidate(blocked = [[50, 50], [50, 51], [50, 52], [50, 53], [51, 50], [51, 51], [51, 52], [51, 53], [52, 50], [52, 51], [52, 52], [52, 53], [53, 50], [53, 51], [53, 52], [53, 53]],source = [0, 0],target = [100, 100]) == True\n assert candidate(blocked = [[500, 500], [501, 500], [502, 500], [500, 501], [501, 501], [502, 501], [500, 502], [501, 502], [502, 502]],source = [500, 499],target = [502, 503]) == True\n assert candidate(blocked = [[1000, 1000], [1001, 1000], [1000, 1001], [1001, 1001], [1002, 1000], [1000, 1002], [1002, 1002], [1001, 1002], [1003, 1001], [1001, 1003]],source = [500, 500],target = [1500, 1500]) == True\n assert candidate(blocked = [[999998, 999998], [999998, 999999], [999999, 999998], [999999, 999999]],source = [999997, 999997],target = [999998, 999997]) == True\n assert candidate(blocked = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]],source = [0, 0],target = [9, 9]) == True\n assert candidate(blocked = [[5, 4], [4, 5], [6, 5], [5, 6]],source = [5, 5],target = [6, 6]) == False\n assert candidate(blocked = [[500000, 500000], [500001, 500001], [500002, 500002], [500003, 500003]],source = [499999, 499999],target = [500004, 500004]) == True\n assert candidate(blocked = [[1, 2], [2, 1], [2, 3], [3, 2], [4, 3], [5, 4]],source = [0, 0],target = [6, 6]) == True\n assert candidate(blocked = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [3, 3]],source = [10, 10],target = [0, 2]) == True\n assert candidate(blocked = [[999998, 999998], [999997, 999998], [999996, 999998], [999998, 999997], [999997, 999997], [999996, 999997], [999998, 999996], [999997, 999996], [999996, 999996]],source = [999995, 999995],target = [999999, 999999]) == True\n assert candidate(blocked = [[500000, 500000], [500001, 500000], [500002, 500000], [500000, 500001], [500001, 500001], [500002, 500001]],source = [499999, 499999],target = [500001, 500001]) == True\n assert candidate(blocked = [[10, 10], [11, 10], [12, 10], [10, 11], [10, 12], [11, 11], [11, 12], [12, 11], [12, 12], [13, 13], [14, 14], [13, 14], [14, 13]],source = [0, 0],target = [20, 20]) == True\n assert candidate(blocked = [[999999, 999998], [999998, 999999]],source = [0, 0],target = [999998, 999997]) == True\n assert candidate(blocked = [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4]],source = [0, 0],target = [0, 5]) == True\n assert candidate(blocked = [[1, 1], [2, 1], [3, 1], [1, 2], [2, 2], [3, 2], [1, 3], [2, 3], [3, 3], [1, 4], [2, 4], [3, 4], [1, 5], [2, 5], [3, 5]],source = [0, 0],target = [3, 5]) == True\n assert candidate(blocked = [[999999, 999999]],source = [0, 0],target = [999998, 999998]) == True\n assert candidate(blocked = [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 2], [2, 3], [2, 4], [2, 5]],source = [0, 0],target = [6, 0]) == True\n assert candidate(blocked = [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1]],source = [0, 0],target = [10, 1]) == True\n assert candidate(blocked = [[100000, 100000], [100001, 100000], [100002, 100000], [100003, 100000], [100004, 100000], [100005, 100000], [100006, 100000], [100007, 100000]],source = [99999, 99999],target = [100008, 100008]) == True\n assert candidate(blocked = [[1, 1], [1, 2], [2, 1], [2, 2]],source = [0, 0],target = [3, 3]) == True\n assert candidate(blocked = [[0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3]],source = [0, 0],target = [5, 5]) == False\n assert candidate(blocked = [[500000, 0], [500001, 0], [500002, 0], [500003, 0], [500004, 0], [500005, 0], [500006, 0], [500007, 0], [500008, 0], [500009, 0]],source = [499990, 0],target = [500010, 0]) == True\n assert candidate(blocked = [[0, 0], [1, 0], [2, 0], [0, 1], [0, 2], [1, 1], [1, 2], [2, 1], [2, 2], [1, 3], [2, 3]],source = [0, 3],target = [3, 0]) == True\n assert candidate(blocked = [[0, 1], [1, 0], [1, 1]],source = [2, 2],target = [3, 3]) == True\n assert candidate(blocked = [[10, 10], [11, 10], [12, 10], [10, 11], [11, 11], [10, 12]],source = [9, 9],target = [13, 13]) == True\n assert candidate(blocked = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3], [4, 1], [4, 2], [4, 3]],source = [0, 0],target = [5, 5]) == True\n assert candidate(blocked = [[500000, 500000], [500001, 500001], [500002, 500002]],source = [500000, 500001],target = [500002, 500000]) == True\n assert candidate(blocked = [[500000, 500000], [500001, 500000], [500002, 500000], [500003, 500000], [500004, 500000], [500005, 500000], [500000, 500001], [500000, 500002], [500000, 500003], [500000, 500004], [500000, 500005]],source = [499999, 500000],target = [500006, 500006]) == True\n assert candidate(blocked = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [1, 4], [2, 5], [3, 6], [4, 7], [5, 8]],source = [0, 0],target = [5, 9]) == True\n assert candidate(blocked = [[100, 100], [101, 100], [102, 100], [100, 101], [101, 101], [102, 101], [100, 102], [101, 102], [102, 102]],source = [99, 99],target = [103, 103]) == True\n assert candidate(blocked = [[0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]],source = [0, 0],target = [3, 3]) == False\n assert candidate(blocked = [[0, 1], [1, 0], [1, 1], [2, 1], [1, 2], [2, 2], [3, 2], [2, 3], [3, 3], [4, 3], [3, 4], [4, 4], [5, 4], [4, 5], [5, 5], [6, 5], [5, 6], [6, 6], [7, 6], [6, 7], [7, 7]],source = [0, 0],target = [10, 10]) == False\n assert candidate(blocked = [[1, 1], [2, 1], [1, 2], [2, 2]],source = [0, 0],target = [3, 3]) == True\n assert candidate(blocked = [[100, 100], [101, 100], [102, 100], [100, 101], [101, 101], [102, 101], [100, 102], [101, 102], [102, 102]],source = [50, 50],target = [150, 150]) == True\n assert candidate(blocked = [[100, 100], [101, 100], [102, 100], [103, 100], [104, 100], [100, 101], [100, 102], [100, 103], [100, 104], [101, 101], [101, 102], [101, 103], [102, 101], [102, 102], [103, 101]],source = [100, 100],target = [104, 104]) == True\n assert candidate(blocked = [[999999, 999998], [999998, 999999], [999998, 999998]],source = [999997, 999997],target = [999999, 999999]) == False\n assert candidate(blocked = [[999999, 999999], [999998, 999998], [999997, 999997]],source = [999996, 999996],target = [0, 0]) == True\n assert candidate(blocked = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4]],source = [0, 5],target = [5, 0]) == True\n assert candidate(blocked = [[500000, 500000], [500001, 500000], [500000, 500001], [500001, 500001]],source = [499999, 499999],target = [500002, 500002]) == True\n assert candidate(blocked = [[10, 10], [11, 10], [10, 11], [11, 11], [12, 10], [10, 12], [12, 12], [11, 12], [13, 11], [11, 13]],source = [0, 0],target = [14, 14]) == True\n assert candidate(blocked = [[999999, 999999], [999998, 999998], [999997, 999997], [999996, 999996], [999995, 999995]],source = [0, 0],target = [999999, 999999]) == True\n assert candidate(blocked = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10]],source = [0, 0],target = [0, 11]) == True\n assert candidate(blocked = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9]],source = [0, 0],target = [999999, 999999]) == True\n assert candidate(blocked = [[0, 500000], [0, 500001], [0, 500002], [0, 500003], [0, 500004], [0, 500005], [0, 500006], [0, 500007], [0, 500008], [0, 500009]],source = [0, 499990],target = [0, 500010]) == True\n assert candidate(blocked = [[1, 1], [2, 1], [3, 1], [1, 2], [2, 2], [3, 2], [1, 3], [2, 3], [3, 3]],source = [0, 0],target = [3, 0]) == True\n assert candidate(blocked = [[100, 100], [101, 100], [100, 101], [101, 101], [102, 100], [100, 102], [102, 102], [101, 102], [103, 101], [101, 103], [104, 101], [101, 104], [105, 101], [101, 105]],source = [50, 50],target = [150, 150]) == True\n assert candidate(blocked = [[50, 50], [51, 51], [52, 52], [53, 53], [54, 54], [55, 55], [56, 56], [57, 57], [58, 58]],source = [49, 49],target = [59, 59]) == True\n assert candidate(blocked = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],source = [0, 0],target = [9, 10]) == True\n assert candidate(blocked = [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9]],source = [0, 0],target = [2, 0]) == True\n assert candidate(blocked = [[200, 200], [201, 200], [202, 200], [203, 200], [204, 200], [205, 200], [206, 200], [207, 200], [208, 200], [209, 200]],source = [100, 100],target = [300, 300]) == True\n assert candidate(blocked = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0]],source = [0, 0],target = [0, 10]) == True\n assert candidate(blocked = [[500, 500], [501, 500], [502, 500], [503, 500], [504, 500], [500, 501], [501, 501], [502, 501], [503, 501], [504, 501]],source = [499, 499],target = [505, 505]) == True\n assert candidate(blocked = [[999998, 999999], [999999, 999998]],source = [0, 0],target = [999997, 999998]) == True\n assert candidate(blocked = [[500000, 500000], [500001, 500001], [500002, 500002], [500003, 500003], [500004, 500004]],source = [499999, 499999],target = [500005, 500005]) == True\n assert candidate(blocked = [[500000, 500000], [500001, 500000], [500000, 500001], [500001, 500001], [500002, 500000], [500000, 500002], [500002, 500002]],source = [500000, 499999],target = [500002, 500003]) == True\n assert candidate(blocked = [[1, 1], [1, 2], [1, 3], [1, 4], [2, 1], [2, 2], [2, 3], [2, 4], [3, 1], [3, 2], [3, 3], [3, 4]],source = [0, 0],target = [5, 5]) == True\n assert candidate(blocked = [[500, 500], [501, 500], [500, 501], [501, 501]],source = [400, 400],target = [600, 600]) == True\n assert candidate(blocked = [[100000, 100000], [100001, 100000], [100002, 100000], [100000, 100001], [100000, 100002]],source = [99999, 99999],target = [100003, 100003]) == True\n assert candidate(blocked = [[500, 500], [500, 501], [500, 502], [500, 503], [500, 504], [501, 500], [501, 501], [501, 502], [501, 503], [501, 504], [502, 500], [502, 501], [502, 502], [502, 503], [502, 504], [503, 500], [503, 501], [503, 502], [503, 503], [503, 504]],source = [500, 499],target = [504, 504]) == True\n assert candidate(blocked = [[1, 1], [1, 2], [2, 1], [2, 2], [2, 3], [3, 2], [3, 3], [3, 4], [4, 3], [4, 4]],source = [0, 0],target = [5, 5]) == True\n assert candidate(blocked = [[500000, 500000], [500001, 500000], [500002, 500000], [500000, 500001], [500000, 500002]],source = [499999, 499999],target = [500003, 500003]) == True\n assert candidate(blocked = [[100, 100], [101, 100], [102, 100], [103, 100], [104, 100], [100, 101], [100, 102], [100, 103], [100, 104]],source = [99, 99],target = [105, 105]) == True\n assert candidate(blocked = [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9]],source = [0, 0],target = [3, 0]) == True\n assert candidate(blocked = [[999998, 999998], [999998, 999999], [999999, 999998], [999997, 999999], [999999, 999997]],source = [999997, 999997],target = [999998, 999999]) == False\n assert candidate(blocked = [[0, 1], [1, 0], [2, 0], [3, 0], [0, 2], [1, 2], [2, 2], [3, 2]],source = [0, 0],target = [3, 3]) == False\n assert candidate(blocked = [[1, 0], [0, 1], [2, 0], [0, 2], [3, 0], [0, 3], [4, 0], [0, 4]],source = [0, 0],target = [4, 4]) == False\n assert candidate(blocked = [[50000, 50000], [50000, 50001], [50000, 50002], [50001, 50000], [50001, 50001], [50001, 50002], [50002, 50000], [50002, 50001], [50002, 50002]],source = [0, 0],target = [99999, 99999]) == True\n assert candidate(blocked = [[1, 1], [2, 1], [3, 1], [4, 1], [1, 2], [2, 2], [3, 2], [4, 2], [1, 3], [2, 3], [3, 3], [4, 3]],source = [0, 0],target = [5, 5]) == True\n assert candidate(blocked = [[2, 1], [2, 2], [3, 2], [4, 2], [5, 2]],source = [1, 1],target = [6, 1]) == True\n assert candidate(blocked = [[100000, 100000], [100001, 100000], [100002, 100000], [100000, 100001], [100001, 100001], [100002, 100001], [100000, 100002], [100001, 100002], [100002, 100002]],source = [99999, 99999],target = [100003, 100003]) == True\n assert candidate(blocked = [[50, 50], [50, 51], [50, 52], [51, 50], [52, 50], [51, 52], [52, 51]],source = [49, 49],target = [53, 53]) == True\n assert candidate(blocked = [[200, 200], [201, 200], [202, 200], [200, 201], [200, 202], [201, 202], [202, 202]],source = [100, 100],target = [250, 250]) == True\n assert candidate(blocked = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1]],source = [0, 0],target = [11, 11]) == True\n assert candidate(blocked = [[500, 500], [501, 500], [502, 500], [503, 500], [504, 500], [505, 500], [506, 500], [500, 501], [500, 502], [500, 503], [500, 504], [500, 505], [500, 506]],source = [500, 499],target = [506, 506]) == True\n assert candidate(blocked = [[1, 0], [0, 1], [2, 0], [0, 2], [3, 0], [0, 3]],source = [0, 0],target = [3, 3]) == False\n assert candidate(blocked = [[500000, 500000], [500001, 500000], [500002, 500000], [500000, 500001], [500001, 500001], [500002, 500001]],source = [499999, 499999],target = [500003, 500003]) == True\n assert candidate(blocked = [[999999, 0], [999998, 0], [999997, 0], [999998, 1], [999999, 1]],source = [999995, 0],target = [999999, 999999]) == True\n assert candidate(blocked = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0]],source = [0, 1],target = [11, 1]) == True\n assert candidate(blocked = [[1, 1], [2, 1], [3, 1], [1, 2], [2, 2], [3, 2], [1, 3], [2, 3], [3, 3]],source = [0, 0],target = [6, 6]) == True\n assert candidate(blocked = [[1, 0], [1, 1], [2, 0], [2, 1]],source = [0, 0],target = [2, 2]) == True\n assert candidate(blocked = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2]],source = [0, 3],target = [3, 3]) == True\n assert candidate(blocked = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10]],source = [0, 0],target = [3, 3]) == True\n assert candidate(blocked = [[1000, 1000], [1001, 1001], [1002, 1002], [1000, 1001], [1001, 1000], [1002, 1001], [1001, 1002], [1000, 1002], [1002, 1000]],source = [999, 999],target = [1003, 1003]) == True\n assert candidate(blocked = [[5, 5], [5, 6], [5, 7], [6, 5], [6, 6], [6, 7], [7, 5], [7, 6], [7, 7], [8, 8], [8, 9], [8, 10], [9, 8], [9, 9], [9, 10], [10, 8], [10, 9], [10, 10]],source = [4, 4],target = [11, 11]) == True\n assert candidate(blocked = [[100, 100], [101, 100], [102, 100], [103, 100], [104, 100], [105, 100], [106, 100], [107, 100], [108, 100], [109, 100], [100, 101], [100, 102], [100, 103], [100, 104], [100, 105], [100, 106], [100, 107], [100, 108], [100, 109]],source = [99, 99],target = [109, 109]) == True\n assert candidate(blocked = [[100000, 100000], [100001, 100001], [100002, 100002], [100003, 100003], [100004, 100004]],source = [0, 0],target = [200000, 200000]) == True\n assert candidate(blocked = [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]],source = [0, 0],target = [4, 4]) == True\n assert candidate(blocked = [[100000, 100000], [100000, 100001], [100000, 100002], [100000, 100003], [100000, 100004], [100001, 100000], [100001, 100001], [100001, 100002], [100001, 100003], [100001, 100004]],source = [0, 0],target = [200000, 200000]) == True\n assert candidate(blocked = [[500000, 500000], [500001, 500000], [500002, 500000], [500000, 500001], [500001, 500001], [500002, 500001], [500000, 500002], [500001, 500002], [500002, 500002]],source = [499990, 499990],target = [500010, 500010]) == True\n assert candidate(blocked = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]],source = [0, 0],target = [5, 5]) == False\n assert candidate(blocked = [[1, 1], [2, 1], [3, 1], [1, 2], [2, 2], [1, 3]],source = [0, 0],target = [5, 5]) == True\n"}, "metadata": {"canonical_parameter_names": ["blocked", "source", "target"], "leetcode_dataset_entry_point": "Solution().isEscapePossible", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isEscapePossible = function(blocked, source, target) {", "container": null, "callable": "isEscapePossible", "parameters": [{"name": "blocked", "type": "number[][]"}, {"name": "source", "type": "number[]"}, {"name": "target", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1037, "task_id": "valid-boomerang", "difficulty": "Easy", "problem_description": "Given an array points where points[i] = [xi, yi] represents a point on the X-Y plane, return true if these points are a boomerang.\nA boomerang is a set of three points that are all distinct and not in a straight line.\n \nExample 1:\nInput: points = [[1,1],[2,3],[3,2]]\nOutput: true\nExample 2:\nInput: points = [[1,1],[2,2],[3,3]]\nOutput: false\n\n \nConstraints:\n\npoints.length == 3\npoints[i].length == 2\n0 <= xi, yi <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(points = [[1, 1], [2, 2], [1, 3]]) == True\n assert candidate(points = [[1, 1], [2, 5], [3, 9]]) == False\n assert candidate(points = [[1, 1], [2, 3], [3, 2]]) == True\n assert candidate(points = [[5, 5], [6, 6], [7, 7]]) == False\n assert candidate(points = [[1, 1], [2, 1], [3, 1]]) == False\n assert candidate(points = [[0, 0], [1, 1], [2, 2]]) == False\n assert candidate(points = [[0, 1], [1, 1], [2, 1]]) == False\n assert candidate(points = [[0, 0], [1, 1], [1, 0]]) == True\n assert candidate(points = [[0, 0], [1, 1], [1, 2]]) == True\n assert candidate(points = [[1, 1], [2, 2], [3, 3]]) == False\n assert candidate(points = [[0, 0], [0, 1], [0, 2]]) == False\n assert candidate(points = [[5, 0], [0, 0], [0, 5]]) == True\n assert candidate(points = [[0, 0], [1, 2], [2, 1]]) == True\n assert candidate(points = [[1, 1], [2, 2], [2, 1]]) == True\n assert candidate(points = [[10, 10], [20, 20], [30, 30]]) == False\n assert candidate(points = [[1, 0], [0, 0], [0, 1]]) == True\n assert candidate(points = [[1, 1], [1, 2], [1, 3]]) == False\n assert candidate(points = [[1, 0], [2, 1], [1, 2]]) == True\n assert candidate(points = [[1, 2], [2, 3], [3, 4]]) == False\n assert candidate(points = [[0, 0], [0, 1], [1, 1]]) == True\n assert candidate(points = [[1, 0], [2, 0], [3, 0]]) == False\n assert candidate(points = [[1, 1], [2, 1], [2, 2]]) == True\n assert candidate(points = [[2, 1], [1, 2], [3, 4]]) == True\n assert candidate(points = [[100, 100], [50, 50], [0, 0]]) == False\n assert candidate(points = [[1, 1], [2, 2], [3, 4]]) == True\n assert candidate(points = [[-1, -1], [0, 0], [1, 1]]) == False\n assert candidate(points = [[1, 1], [3, 3], [2, 2]]) == False\n assert candidate(points = [[1, 1], [1, 2], [1, 3]]) == False\n assert candidate(points = [[-10, 10], [0, 0], [10, -10]]) == False\n assert candidate(points = [[1, 2], [2, 4], [3, 6]]) == False\n assert candidate(points = [[1, 2], [3, 4], [5, 6]]) == False\n assert candidate(points = [[1, 1], [2, 2], [2, 3]]) == True\n assert candidate(points = [[0, 1], [1, 0], [0, 0]]) == True\n assert candidate(points = [[100, 100], [99, 99], [98, 98]]) == False\n assert candidate(points = [[100, 0], [50, 50], [0, 100]]) == False\n assert candidate(points = [[50, 50], [50, 60], [60, 50]]) == True\n assert candidate(points = [[33, 33], [66, 66], [99, 99]]) == False\n assert candidate(points = [[10, 10], [15, 10], [10, 15]]) == True\n assert candidate(points = [[1, 2], [2, 1], [3, 4]]) == True\n assert candidate(points = [[1, 1], [2, 2], [4, 4]]) == False\n assert candidate(points = [[1, 1], [2, 3], [1, 5]]) == True\n assert candidate(points = [[50, 0], [0, 50], [25, 25]]) == False\n assert candidate(points = [[0, 0], [1, 2], [3, 6]]) == False\n assert candidate(points = [[1, 1], [1, 2], [2, 2]]) == True\n assert candidate(points = [[0, 100], [100, 0], [50, 50]]) == False\n assert candidate(points = [[1, 2], [4, 6], [5, 3]]) == True\n assert candidate(points = [[1, 1], [1, 2], [2, 1]]) == True\n assert candidate(points = [[1, 1], [2, 2], [1, 2]]) == True\n assert candidate(points = [[0, 0], [1, 0], [2, 1]]) == True\n assert candidate(points = [[-1, 0], [0, 1], [1, 0]]) == True\n assert candidate(points = [[0, 0], [100, 100], [50, 50]]) == False\n assert candidate(points = [[50, 50], [60, 60], [70, 70]]) == False\n assert candidate(points = [[10, 20], [20, 30], [30, 40]]) == False\n assert candidate(points = [[100, 100], [99, 98], [98, 97]]) == True\n assert candidate(points = [[50, 50], [50, 60], [50, 70]]) == False\n assert candidate(points = [[0, 100], [50, 50], [100, 0]]) == False\n assert candidate(points = [[2, 3], [5, 6], [8, 9]]) == False\n assert candidate(points = [[0, 0], [0, 1], [1, 0]]) == True\n assert candidate(points = [[10, 0], [20, 0], [30, 0]]) == False\n assert candidate(points = [[0, 1], [1, 2], [2, 3]]) == False\n assert candidate(points = [[1, 1], [2, 2], [0, 0]]) == False\n assert candidate(points = [[5, 5], [10, 5], [15, 5]]) == False\n assert candidate(points = [[1, 100], [100, 1], [50, 50]]) == True\n assert candidate(points = [[99, 99], [98, 98], [97, 97]]) == False\n assert candidate(points = [[1, 1], [3, 1], [2, 2]]) == True\n assert candidate(points = [[2, 4], [4, 6], [6, 8]]) == False\n assert candidate(points = [[99, 98], [98, 97], [97, 96]]) == False\n assert candidate(points = [[0, 100], [50, 50], [100, 0]]) == False\n assert candidate(points = [[10, 20], [20, 30], [30, 30]]) == True\n assert candidate(points = [[1, 2], [2, 3], [4, 5]]) == False\n assert candidate(points = [[0, 1], [1, 0], [2, 1]]) == True\n assert candidate(points = [[5, 0], [0, 5], [5, 5]]) == True\n assert candidate(points = [[10, 20], [30, 40], [50, 60]]) == False\n assert candidate(points = [[1, 1], [2, 3], [3, 1]]) == True\n assert candidate(points = [[0, 0], [1, 0], [2, 0]]) == False\n assert candidate(points = [[5, 5], [10, 10], [15, 15]]) == False\n assert candidate(points = [[5, 5], [10, 15], [20, 25]]) == True\n assert candidate(points = [[2, 3], [3, 6], [5, 10]]) == True\n assert candidate(points = [[3, 6], [6, 12], [9, 18]]) == False\n assert candidate(points = [[10, 20], [20, 10], [30, 0]]) == False\n assert candidate(points = [[1, 1], [2, 3], [3, 6]]) == True\n assert candidate(points = [[1, 1], [2, 2], [3, 5]]) == True\n assert candidate(points = [[33, 55], [66, 77], [99, 88]]) == True\n assert candidate(points = [[1, 0], [0, 1], [0, 2]]) == True\n assert candidate(points = [[50, 50], [51, 51], [52, 52]]) == False\n assert candidate(points = [[2, 2], [1, 1], [3, 3]]) == False\n assert candidate(points = [[5, 5], [5, 6], [6, 5]]) == True\n assert candidate(points = [[5, 5], [15, 10], [25, 15]]) == False\n assert candidate(points = [[1, 1], [2, 3], [4, 6]]) == True\n assert candidate(points = [[0, 50], [50, 0], [25, 25]]) == False\n assert candidate(points = [[0, 0], [1, 2], [2, 4]]) == False\n assert candidate(points = [[0, 0], [1, 2], [3, 4]]) == True\n assert candidate(points = [[1, 2], [4, 5], [7, 8]]) == False\n assert candidate(points = [[10, 20], [30, 40], [50, 60]]) == False\n assert candidate(points = [[10, 10], [20, 30], [30, 50]]) == False\n assert candidate(points = [[1, 5], [3, 4], [4, 5]]) == True\n assert candidate(points = [[50, 50], [50, 51], [51, 50]]) == True\n assert candidate(points = [[1, 100], [100, 1], [50, 50]]) == True\n assert candidate(points = [[10, 20], [20, 10], [30, 20]]) == True\n assert candidate(points = [[1, 5], [2, 3], [3, 1]]) == False\n assert candidate(points = [[-5, -5], [-4, -4], [-3, -3]]) == False\n assert candidate(points = [[99, 99], [50, 50], [1, 1]]) == False\n assert candidate(points = [[5, 3], [6, 4], [7, 5]]) == False\n assert candidate(points = [[5, 5], [5, 6], [6, 6]]) == True\n assert candidate(points = [[1, 1], [2, 3], [4, 5]]) == True\n assert candidate(points = [[2, 4], [4, 2], [0, 0]]) == True\n assert candidate(points = [[1, 2], [2, 3], [3, 5]]) == True\n assert candidate(points = [[1, 1], [1, 100], [100, 1]]) == True\n assert candidate(points = [[1, 0], [0, 1], [-1, 0]]) == True\n assert candidate(points = [[0, 1], [1, 0], [1, 1]]) == True\n assert candidate(points = [[99, 1], [100, 1], [99, 2]]) == True\n assert candidate(points = [[3, 6], [6, 12], [9, 17]]) == True\n assert candidate(points = [[100, 100], [0, 0], [50, 50]]) == False\n assert candidate(points = [[0, 0], [50, 50], [100, 100]]) == False\n assert candidate(points = [[0, 0], [2, 0], [1, 1]]) == True\n assert candidate(points = [[7, 7], [8, 9], [9, 7]]) == True\n"}, "metadata": {"canonical_parameter_names": ["points"], "leetcode_dataset_entry_point": "Solution().isBoomerang", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isBoomerang = function(points) {", "container": null, "callable": "isBoomerang", "parameters": [{"name": "points", "type": "number[][]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1038, "task_id": "binary-search-tree-to-greater-sum-tree", "difficulty": "Medium", "problem_description": "Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum of all keys greater than the original key in BST.\nAs a reminder, a binary search tree is a tree that satisfies these constraints:\n\nThe left subtree of a node contains only nodes with keys less than the node's key.\nThe right subtree of a node contains only nodes with keys greater than the node's key.\nBoth the left and right subtrees must also be binary search trees.\n\n \nExample 1:\n\n\nInput: root = [4,1,6,0,2,5,7,null,null,null,3,null,null,null,8]\nOutput: [30,36,21,36,35,26,15,null,null,null,33,null,null,null,8]\n\nExample 2:\n\nInput: root = [0,null,1]\nOutput: [1,null,1]\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 100].\n0 <= Node.val <= 100\nAll the values in the tree are unique.\n\n \nNote: This question is the same as 538: https://leetcode.com/problems/convert-bst-to-greater-tree/\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5])), tree_node([15, None, 14, None, 12, None, 9, None, 5]))\n assert is_same_tree(candidate(root = tree_node([5, 2, 13])), tree_node([18, 20, 13]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18])), tree_node([43, 55, 33, 58, 50, None, 18]))\n assert is_same_tree(candidate(root = tree_node([3, 2, 4, 1])), tree_node([7, 9, 4, 10]))\n assert is_same_tree(candidate(root = tree_node([4, 1, 6, 0, 2, 5, 7, None, None, None, 3, None, None, None, 8])), tree_node([30, 36, 21, 36, 35, 26, 15, None, None, None, 33, None, None, None, 8]))\n assert is_same_tree(candidate(root = tree_node([1, 0, 2])), tree_node([3, 3, 2]))\n assert is_same_tree(candidate(root = tree_node([0, None, 1])), tree_node([1, None, 1]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3])), tree_node([6, None, 5, None, 3]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 7, 2, 4, 6, 8, 1, None, None, None, None, None, None, 9])), tree_node([35, 42, 24, 44, 39, 30, 17, 45, None, None, None, None, None, None, 9]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, None, None, None, None, None, None, 50])), tree_node([180, 215, 125, 225, 200, 155, 90, 230, None, None, None, None, None, None, 50]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13, None, None, None, None, None])), tree_node([45, 65, 37, 66, 58, None, 14, None, None, 62, 52, 27]))\n assert is_same_tree(candidate(root = tree_node([9, 4, 20, 2, 6, 15, 25, 1, 3, 5, 7, 13, 18, 23, 28])), tree_node([151, 173, 96, 178, 164, 129, 53, 179, 176, 169, 158, 142, 114, 76, 28]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, 1, 5, 9, 20, None, None, 2, 6, None, None, 11, 17, None, None, None, None, None, 18])), tree_node([97, 113, 81, 114, 108, 90, 37, None, None, 110, 103, None, None, 66, 17, None, None, None, None, None, 55]))\n assert is_same_tree(candidate(root = tree_node([30, 15, 60, 10, 20, 45, 75, 5, 12, 17, 25, 35, 55, 70, 85])), tree_node([455, 532, 290, 554, 500, 390, 160, 559, 544, 517, 480, 425, 345, 230, 85]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, 12, 18, 23, 28, 33, 38, 45])), tree_node([274, 350, 158, 372, 317, 221, 85, 377, 362, 335, 297, 249, 191, 123, 45]))\n assert is_same_tree(candidate(root = tree_node([5, 2, 13, None, 4, 9, 21])), tree_node([48, 54, 34, None, 52, 43, 21]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, None, None, 9, 20, 8, None, None, 18])), tree_node([77, 80, 53, None, None, 62, 38, 70, None, None, 18]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, None, 4, 7, 13])), tree_node([45, 65, 37, 66, 58, None, 14, None, None, 62, 52, 27]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, 1, 5, 9, 20, 0, 2, None, 6, None, None, None, None, None, None, 8, 10, None, 11, None, 12, 13, 14, 16, None, 18, None, 19, 21])), tree_node([51, 92, 35, 210, 89, 44, 20, 210, 171, None, 84, None, None, None, None, None, None, 209, 116, None, 62, None, 183, 150, 106, 78, None, 201, None, 169, 137]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 12, 18, 22, 28, 32, 38])), tree_node([230, 285, 135, 297, 263, 188, 73, 300, 292, 275, 248, 210, 163, 105, 38]))\n assert is_same_tree(candidate(root = tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15])), tree_node([92, 114, 54, 119, 105, 75, 29, 120, 117, 110, 99, 84, 65, 42, 15]))\n assert is_same_tree(candidate(root = tree_node([14, 7, 22, 4, 9, 16, 25, 3, 6, 8, 11, 15, 18, 21, 26])), tree_node([157, 192, 94, 202, 177, 128, 51, 205, 198, 185, 168, 143, 112, 72, 26]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, 12, 18, 22, 28, 32, 38, 45])), tree_node([273, 348, 158, 370, 315, 220, 85, 375, 360, 333, 295, 248, 190, 123, 45]))\n assert is_same_tree(candidate(root = tree_node([50, 25, 75, 15, 35, 60, 85, 10, 20, 30, 40, 55, 65, 70, 90])), tree_node([550, 680, 320, 715, 625, 445, 175, 725, 700, 655, 590, 500, 385, 245, 90]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, 1, 5, 9, 20, 0, 2, None, None, 6, 8, 12, 25, None, None, None, None, 10, 11, 13, 14, 16, 19, 21, 22, 24, 23, 26, None, None, None, None, None, None, None, None, None, 18, None])), tree_node([319, 327, 168, 330, 324, 212, 106, 330, 329, None, None, 255, 190, 137, 47, None, None, None, None, 288, 223, 203, 182, 153, 125, 68, 22, 312, 278, 249, None, None, None, None, None, None, None, None, None, 86]))\n assert is_same_tree(candidate(root = tree_node([15, 10, 20, 8, 12, 18, 25, 7, 9, 11, 13, 16, 19, 22, 27])), tree_node([162, 208, 94, 225, 187, 131, 52, 232, 217, 198, 175, 147, 113, 74, 27]))\n assert is_same_tree(candidate(root = tree_node([30, 10, 50, 5, 15, 40, 60, 1, 7, 12, 18, 35, 45, 55, 65, 0, None, 3, None, 8, 9, 11, 13, 14, 16, 17, 19, 21, 23, 25, 27, 28, 29, 31, 32, 33, 34, 36, 37, 38, 39, 41, 42, 43, 44, 46, 47, 48, 49, 51, 52, 53, 54, 56, 57, 58, 59, None, None, None, None, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, None, 72])), tree_node([1259, 2005, 663, 2343, 1476, 984, 294, 2344, 2012, 1642, 1373, 1128, 830, 485, 92, 2496, None, 2180, None, 1825, 1522, 1423, 1314, 1186, 1047, 896, 734, 560, 374, 176, 27, 2524, 2435, 2275, 2111, 1927, 1747, 1630, 1513, 1461, 1412, 1355, 1301, 1229, 1172, 1093, 1031, 944, 879, 785, 715, 613, 539, 430, 351, 234, 151, None, None, None, None, 2496, 2406, 2338, 2244, 2177, 2079, 1995, 1894, 1817, 1713, None, 1594]))\n assert is_same_tree(candidate(root = tree_node([55, 35, 75, 20, 45, 60, 85, 10, 25, 30, 40, 52, 65, 80, 90])), tree_node([562, 712, 330, 757, 647, 455, 175, 767, 737, 677, 602, 507, 395, 255, 90]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18, 1, 4, 6, 8, 11, 13, 17, 19])), tree_node([115, 141, 69, 148, 130, 94, 37, 149, 145, 136, 123, 105, 82, 54, 19]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, 1, 5, 9, 20, None, None, 2, 6, 8, 18, None, None, 16])), tree_node([77, 109, 35, 110, 88, 62, 20, None, None, 90, 83, 70, 53, None, None, 106]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6, None, None, None, None, None, 14, None, 17, None, None, 19, 20])), tree_node([56, 111, 33, 114, 63, 46, 18, 115, None, 69, None, None, None, None, None, 148, None, 86, None, None, 134, 106]))\n assert is_same_tree(candidate(root = tree_node([6, 3, 12, 1, 4, 9, 15, None, None, 2, 5, 8, 11, 13, 16])), tree_node([90, 104, 56, 105, 99, 76, 31, None, None, 101, 95, 84, 67, 44, 16]))\n assert is_same_tree(candidate(root = tree_node([30, 15, 45, 10, 20, 40, 50, 5, 12, 17, 22, 35, 47, 42, 55])), tree_node([344, 418, 192, 440, 386, 279, 105, 445, 430, 403, 366, 314, 239, 147, 55]))\n assert is_same_tree(candidate(root = tree_node([15, 9, 20, 7, 12, 17, 25, 5, 8, 11, 13, 16, 19, 22, 27])), tree_node([161, 206, 94, 221, 186, 130, 52, 226, 214, 197, 174, 146, 113, 74, 27]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, 12, 17, 22, 28, 33, 37, 45])), tree_node([273, 347, 157, 369, 315, 220, 85, 374, 359, 332, 295, 248, 190, 122, 45]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 8, 2, 4, 6, 10, 1, 7, 9, 11])), tree_node([29, 56, 18, 65, 44, 24, 10, 66, 63, 53, 40]))\n assert is_same_tree(candidate(root = tree_node([6, 3, 9, 1, 5, 7, 10, 0, 2, 4, 6, 8, 11])), tree_node([51, 69, 19, 72, 62, 37, 10, 72, 71, 66, 57, 45, 30]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 12, 18, 23, 28, 33, 38])), tree_node([232, 287, 136, 299, 265, 189, 73, 302, 294, 277, 250, 212, 164, 106, 38]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, None, None, None, 20])), tree_node([42, 45, 35, None, None, None, 20]))\n assert is_same_tree(candidate(root = tree_node([5, 2, 13, None, 3, 10, 18, None, None, 6, 12, 15, 19])), tree_node([98, 103, 65, None, 101, 87, 37, None, None, 93, 77, 52, 19]))\n assert is_same_tree(candidate(root = tree_node([60, 30, 90, 20, 40, 70, 100, 10, 25, 35, 45, 65, 75, 85, 105])), tree_node([650, 800, 380, 845, 735, 525, 205, 855, 825, 770, 695, 590, 455, 290, 105]))\n assert is_same_tree(candidate(root = tree_node([5, 2, 13, 1, 4, 9, 21, None, None, None, None, None, 19])), tree_node([67, 73, 34, 74, 71, 62, 21, None, None, None, None, None, 53]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])), tree_node([71, 119, 39, 169, 87, 58, 22, 194, 147, 97, 82, 70, 52, 36, 15, 210, 186, 165, 138, 117]))\n assert is_same_tree(candidate(root = tree_node([15, 10, 20, 8, 12, 17, 25, 7, 9, 11, 13, 16, 18, 22, 27])), tree_node([160, 206, 94, 223, 185, 129, 52, 230, 215, 196, 173, 145, 112, 74, 27]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 7, 1, 4, 6, 8, None, None, None, None, None, None, 0, 9])), tree_node([35, 42, 24, 43, 39, 30, 17, None, None, None, None, None, None, 17, 9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])), tree_node([71, 99, 39, 112, 87, 58, 22, 120, 108, 97, 82, 70, 52, 36, 15]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, None, 12, 18, 22, 27, 32, 40])), tree_node([231, 286, 137, 291, 264, 189, 75, 292, None, 276, 249, 211, 164, 107, 40]))\n assert is_same_tree(candidate(root = tree_node([25, 15, 35, 10, 20, 30, 40, 5, 12, None, 17, 22, 28, 32, 45, None, None, None, 8, None, None, None, None, None, None, None, 13, None, None, None, None, None, None, 19, 21, 23, 26, 29, 31, 33, 34, 36, 37, 38, 39, 41, 42, 43, 44, None, None, None, 46, None, None, None, None, None, None, None, None, None, None, 47])), tree_node([270, 322, 165, 352, 307, 223, 85, 357, 342, None, 287, 245, 193, 130, 45, None, None, None, 330, None, None, None, None, None, None, None, 98]))\n assert is_same_tree(candidate(root = tree_node([18, 9, 27, 6, 12, 24, 30, 3, 8, 11, 15, 21, 26, 29, 33])), tree_node([208, 255, 119, 269, 235, 169, 63, 272, 263, 246, 223, 190, 145, 92, 33]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6])), tree_node([43, 61, 33, 64, 50, None, 18, 65, None, 56]))\n assert is_same_tree(candidate(root = tree_node([50, 20, 70, 10, 30, 60, 80, 5, 15, 25, 35, 55, 65, 75, 85])), tree_node([540, 650, 310, 675, 605, 435, 165, 680, 665, 630, 575, 490, 375, 240, 85]))\n assert is_same_tree(candidate(root = tree_node([40, 20, 60, 10, 30, 50, 70, 5, 15, 25, 35, 45, 55, 65, 75, 2, 7, None, 8, None, 12, None, 22, None, 27, None, 32, None, 37, None, 42, None, 47, None, 52, None, 57, None, 62, None, 67, None, 72, None, 77, None, 78, None, 79, None, 80, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])), tree_node([904, 1177, 506, 1267, 1058, 720, 266, 1331, 1257, 1157, 1028, 864, 670, 446, 196, 1460, 1326, None, 1242, None, 1132, None, 993, None, 819, None, 615, None, 381, None, 121, None, 1458, None, 1319, None, 1234, None, 1120, None, 971, None, 792, None, 583, None, 344, None, 79, None, 1411]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 9, None, None, None, None, 17, 20])), tree_node([43, 107, 33, 110, 59, None, 18, 111, None, 85, 52, None, None, None, None, 102, 79]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 8, 2, 4, 6, 10, 1, None, None, None, None, 9, 11])), tree_node([49, 56, 29, 58, 53, 44, 10, 59, None, None, None, None, 38, 21]))\n assert is_same_tree(candidate(root = tree_node([15, 9, 20, 7, 10, 16, 22, None, 8, None, 12, 18, 25, None, None, None, None, None, None])), tree_node([116, 147, 42, 162, 138, 83, 22, None, 155, None, 128, 101, 67]))\n assert is_same_tree(candidate(root = tree_node([22, 12, 30, 7, 15, 25, 35, 3, 10, 13, 17, 23, 28, 32, 38])), tree_node([233, 290, 135, 307, 265, 188, 73, 310, 300, 278, 250, 211, 163, 105, 38]))\n assert is_same_tree(candidate(root = tree_node([5, 2, 13, 1, 4, 9, 21, 0, None, 3, None, None, None, 7, 15, 19, None, None, 6, 8, 12, 14, 16, 17, 18, None, None, 10, None, None, None, None, None, None, 20, None, None, None, None, 22])), tree_node([172, 187, 158, 188, 176, 167, 86, 188, None, 185, None, None, None, 105, 51, 225, None, None, 182, 113, 98, 65, 36, 242, 206, None, None, 123, None, None, None, None, None, None, 20, None, None, None, None, 145]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 10, 1, 6, None, 14, None, 4, 7, 13, None, None, None, None, None, 11, 12, 15, 16, 18])), tree_node([32, 133, 24, 138, 78, None, 14, None, 137, 130, 60, None, None, None, None, None, 107, 72, 47, 123, 96]))\n assert is_same_tree(candidate(root = tree_node([40, 20, 60, 10, 30, 50, 70, 5, 15, 25, 35, 45, 55, 65, 75])), tree_node([460, 570, 270, 595, 525, 375, 145, 600, 585, 550, 495, 420, 325, 210, 75]))\n assert is_same_tree(candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 10, 25, 35, 45, 55, 65, 75, 90, 5, 15, None, None, 28, 33, None, 42, 47, None, None, 53, 58, 63, 68, None, 73, 78, None, None, 85, 95])), tree_node([834, 1267, 504, 1312, 961, 682, 238, 1337, 1292, 1029, 921, 737, 622, 376, 90, 1420, 1327, None, None, 1152, 994, None, 876, 784, None, None, 557, 434, 301, 158, None, 1493, 1415, None, None, 1237, 1124]))\n assert is_same_tree(candidate(root = tree_node([12, 5, 18, 3, 7, 15, 20, 1, 4, 6, 8, 13, 17, 19, 22])), tree_node([136, 162, 79, 169, 151, 111, 42, 170, 166, 157, 144, 124, 96, 61, 22]))\n assert is_same_tree(candidate(root = tree_node([45, 25, 65, 15, 35, 55, 75, 10, 20, 30, 40, 50, 60, 70, 80])), tree_node([500, 630, 290, 665, 575, 405, 155, 675, 650, 605, 540, 455, 350, 225, 80]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, 1, 5, 9, 20, None, None, 2, 6, 8, 12, None, 18])), tree_node([89, 105, 53, 106, 100, 74, 38, None, None, 102, 95, 82, 65, None, 18]))\n assert is_same_tree(candidate(root = tree_node([30, 10, 50, 5, 15, 40, 60, 1, 7, 12, 18, 35, 45, 55, 65])), tree_node([380, 435, 230, 447, 413, 315, 125, 448, 442, 425, 398, 350, 275, 180, 65]))\n assert is_same_tree(candidate(root = tree_node([20, 15, 25, 10, 17, 22, 30, 5, 12, None, 18, None, 27, None, None, None, None, None, None, 13, 14, None, 21, 23, None, 28])), tree_node([145, 273, 55, 295, 258, 125, 30, 300, 285, None, 205, None, 103, None, None, None, None, None, None, 218, 159, None, 76, 241, None, 187]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 3, 7, 13, 17, 23, 27, 33, 37])), tree_node([230, 285, 135, 297, 262, 187, 72, 300, 292, 275, 247, 210, 162, 105, 37]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6])), tree_node([56, 74, 33, 77, 63, 46, 18, 78, None, 69]))\n assert is_same_tree(candidate(root = tree_node([3, 1, 4, None, 2])), tree_node([7, 10, 4, None, 9]))\n assert is_same_tree(candidate(root = tree_node([25, 10, 30, 5, 15, 27, 35, 3, 7, 12, 18, 26, 32, 34, 36])), tree_node([245, 300, 135, 312, 278, 194, 71, 315, 307, 290, 263, 220, 167, 105, 36]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 1, 7, 13, 17, 23, 27, 33, 37])), tree_node([230, 285, 135, 297, 262, 187, 72, 298, 292, 275, 247, 210, 162, 105, 37]))\n assert is_same_tree(candidate(root = tree_node([8, 5, 12, 3, 7, 10, 15, 2, 4, 6, None, 9, 11, 13, 17, 1, None, None, None, None, None, None, None, None, None, None, None, 14, 16, None, 18])), tree_node([125, 143, 87, 150, 132, 108, 62, 152, 147, 138, None, 117, 98, 75, 33, 171, None, None, None, None, None, None, None, None, None, None, None, 47, 16, None, 170]))\n assert is_same_tree(candidate(root = tree_node([33, 17, 50, 9, 25, 40, 60, 5, 12, 20, 28, 38, 53, 58, 63])), tree_node([395, 485, 231, 506, 448, 324, 123, 511, 497, 468, 423, 362, 284, 181, 63]))\n assert is_same_tree(candidate(root = tree_node([15, 8, 25, 4, 10, 20, 30, 2, 6, 12, 14, 18, 22, 28, 32])), tree_node([190, 234, 115, 244, 214, 157, 62, 246, 240, 226, 204, 175, 137, 90, 32]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, 1, 5, 9, 20, None, 2, None, 4, None, None, 8, 11, 17, 25])), tree_node([70, 82, 54, 127, 79, 63, 31, None, 109, None, 74, None, None, 39, 11, 126, 107]))\n assert is_same_tree(candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 10, 25, 35, 45, 55, 65, 75, 85])), tree_node([540, 690, 310, 735, 625, 435, 165, 745, 715, 660, 585, 490, 375, 240, 85]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 13, None, 6, 9, 17, None, None, None, None, None, 15, None, 18])), tree_node([80, 89, 63, None, 86, 72, 50, None, None, None, None, None, 33, None, 18]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, None, None, 12, 20])), tree_node([57, 62, 35, None, None, 47, 20]))\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 80, 110, 140, 160, 190, 5, 15, 28, 38, 55, 70, 85, 105, 120, 135, 145, 155, 170, 185, None, 95, 100, None, None, None, None, None, 115, None, 125, None, 130, 138, None, 148, None, None, 165, None, 175, None, 180, 188, None, 195])), tree_node([3058, 4179, 1125, 4415, 3551, 2253, 460, 4440, 4362, 3949, 3243, 2673, 1615, 805, 285, 4445, 4430, 4390, 4217, 4004, 3759, 3476, 3163, 2793, 2388, 1948, 1475, 975, 645, None, 95, 4545, None, None, None, None, None, 4332, None, 4129, None, 3889, 3689, None, 3391, None, None, 2958, None, 2563, None, 2128, 1803, None, 1320]))\n assert is_same_tree(candidate(root = tree_node([8, 5, 13, 3, 6, 10, 16, 1, 4, 7, 9, 12, 15, 17, 18])), tree_node([109, 136, 64, 143, 124, 89, 34, 144, 140, 131, 118, 101, 79, 51, 18]))\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 18, 22, 28, 33, 37])), tree_node([230, 285, 135, 297, 263, 188, 72, 299, 292, 275, 248, 210, 163, 105, 37]))\n assert is_same_tree(candidate(root = tree_node([8, 3, 13, None, 6, 10, 17, 5, 7, 9, 11, 15, 18])), tree_node([101, 122, 63, None, 114, 84, 35, 119, 108, 93, 74, 50, 18]))\n assert is_same_tree(candidate(root = tree_node([50, 30, 70, 20, 40, 60, 80, 10, None, None, None, None, None, None, 90])), tree_node([350, 420, 240, 440, 390, 300, 170, 450, None, None, None, None, None, None, 90]))\n assert is_same_tree(candidate(root = tree_node([6, 4, 8, 3, 5, 7, 9, 2, 1, None, None, None, None, None, None, 0])), tree_node([30, 39, 17, 43, 35, 24, 9, 45, 40, None, None, None, None, None, None, 45]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 15, None, 5, 9, 20, 2, 4, 8, 12, 17, 21, 11, 13, 16, 19, 14, 18])), tree_node([141, 214, 73, None, 185, 94, 41, 200, 164, 120, 85, 58, 21, 211, 198, 180, 160, 134, 112]))\n assert is_same_tree(candidate(root = tree_node([20, 15, 30, 10, 18, 25, 40, 5, None, None, 16, 22, None, 35, 45, 3, None, None, None, None, None, None, None, None, 19])), tree_node([236, 285, 169, 295, 270, 194, 104, 300, None, None, 252, 216, None, 139, 64, 303, None, None, None, None, None, None, None, None, 19]))\n assert is_same_tree(candidate(root = tree_node([15, 10, 20, 8, 12, 17, 25, 6, 9, 11, 13, 16, 18, 22, 27, 4, 7, None, None, None, None, None, None, 14, None, None, None, None, 19, None, 21, 23, None, 24, 26, 28, 29])), tree_node([271, 317, 134, 334, 296, 169, 73, 397, 326, 307, 284, 185, 152, 114, 48, 401, 367, None, None, None, None, None, None, 228, None, None, None, None, 92, None, 21, 424, None, 391, 360, 256, 214]))\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().bstToGst", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var bstToGst = function(root) {", "container": null, "callable": "bstToGst", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1039, "task_id": "minimum-score-triangulation-of-polygon", "difficulty": "Medium", "problem_description": "You have a convex n-sided polygon where each vertex has an integer value. You are given an integer array values where values[i] is the value of the ith vertex in clockwise order.\nPolygon triangulation is a process where you divide a polygon into a set of triangles and the vertices of each triangle must also be vertices of the original polygon. Note that no other shapes other than triangles are allowed in the division. This process will result in n - 2 triangles.\nYou will triangulate the polygon. For each triangle, the weight of that triangle is the product of the values at its vertices. The total score of the triangulation is the sum of these weights over all n - 2 triangles.\nReturn the minimum possible score that you can achieve with some triangulation of the polygon.\n \nExample 1:\n\n\nInput: values = [1,2,3]\nOutput: 6\nExplanation: The polygon is already triangulated, and the score of the only triangle is 6.\n\nExample 2:\n\n\nInput: values = [3,7,4,5]\nOutput: 144\nExplanation: There are two triangulations, with possible scores: 3*7*5 + 4*5*7 = 245, or 3*4*5 + 3*4*7 = 144.\nThe minimum score is 144.\n\nExample 3:\n\n\nInput: values = [1,3,1,4,1,5]\nOutput: 13\nExplanation: The minimum score triangulation is 1*1*3 + 1*1*4 + 1*1*5 + 1*1*1 = 13.\n\n \nConstraints:\n\nn == values.length\n3 <= n <= 50\n1 <= values[i] <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(values = [10, 1, 1, 10]) == 110\n assert candidate(values = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 328\n assert candidate(values = [3, 1, 2, 4, 5, 6]) == 76\n assert candidate(values = [10, 1, 20, 2, 30, 3, 40, 4]) == 510\n assert candidate(values = [1, 5, 11, 7, 10, 2, 12, 8]) == 342\n assert candidate(values = [1, 3, 1, 4, 1, 5]) == 13\n assert candidate(values = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 328000\n assert candidate(values = [3, 5, 10, 7, 2]) == 270\n assert candidate(values = [6, 6, 6, 6, 6, 6]) == 864\n assert candidate(values = [5, 2, 1, 4, 3]) == 37\n assert candidate(values = [10, 20, 30, 40, 50]) == 38000\n assert candidate(values = [1, 1, 1, 1, 1, 1]) == 4\n assert candidate(values = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 8\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5, 5, 5]) == 875\n assert candidate(values = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 44\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5]) == 625\n assert candidate(values = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 864\n assert candidate(values = [5, 5, 5, 5]) == 250\n assert candidate(values = [3, 3, 3, 3, 3, 3]) == 108\n assert candidate(values = [8, 3, 5, 1]) == 39\n assert candidate(values = [3, 7, 4, 5]) == 144\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 328\n assert candidate(values = [1, 1, 1, 1, 1, 1, 1]) == 5\n assert candidate(values = [1, 2, 3]) == 6\n assert candidate(values = [10, 5, 2, 1, 4, 3]) == 102\n assert candidate(values = [5, 50, 24, 30]) == 9600\n assert candidate(values = [6, 10, 5, 2, 1, 4, 3]) == 150\n assert candidate(values = [1, 2, 3, 4, 5]) == 38\n assert candidate(values = [5, 8, 7, 3, 2, 9, 4]) == 346\n assert candidate(values = [5, 3, 2, 6, 1, 4, 7]) == 96\n assert candidate(values = [2, 1, 3, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10]) == 77\n assert candidate(values = [8, 6, 7, 5, 3, 0, 9, 2, 4, 1]) == 0\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2658\n assert candidate(values = [2, 3, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 41736\n assert candidate(values = [10, 5, 1, 9, 3, 7, 2, 6]) == 184\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 328000\n assert candidate(values = [5, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 5, 1, 0, 5, 8, 2, 0, 9, 7, 4, 9, 4, 4, 5, 9, 2, 3, 0, 7, 8, 1, 6, 4, 0, 6, 2, 8, 6, 2, 0, 8, 9, 9, 8, 6]) == 0\n assert candidate(values = [15, 25, 35, 45, 55, 65, 75]) == 200625\n assert candidate(values = [2, 10, 3, 8, 4, 1, 9, 7]) == 183\n assert candidate(values = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 323398\n assert candidate(values = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20]) == 70000\n assert candidate(values = [2, 3, 4, 5, 6, 7, 8, 9]) == 464\n assert candidate(values = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 328000000\n assert candidate(values = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 486\n assert candidate(values = [30, 20, 10, 5, 15, 25, 40, 35]) == 23125\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 328\n assert candidate(values = [30, 20, 10, 40, 50, 60, 70]) == 119000\n assert candidate(values = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 48\n assert candidate(values = [50, 40, 30, 20, 10, 90, 80, 70, 60, 50, 40, 30, 20, 10, 90, 80, 70, 60, 50, 40, 30]) == 527000\n assert candidate(values = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139]) == 368064\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 1000\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70]) == 110000\n assert candidate(values = [15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125]) == 963750\n assert candidate(values = [8, 3, 7, 1, 2, 9, 4]) == 131\n assert candidate(values = [100, 1, 100, 1, 100, 1, 100]) == 10301\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 2658000\n assert candidate(values = [30, 20, 10, 40, 50, 60, 70, 80, 90, 100, 110]) == 459000\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 570\n assert candidate(values = [5, 10, 15, 20, 25, 30, 35, 40, 45]) == 29750\n assert candidate(values = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54]) == 14469840\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 238\n assert candidate(values = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 328000\n assert candidate(values = [12, 21, 34, 43, 55, 67, 78, 89, 90, 101, 112, 123, 134, 145, 156]) == 1453368\n assert candidate(values = [5, 6, 7, 8, 9, 10, 11]) == 1850\n assert candidate(values = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80]) == 11702400\n assert candidate(values = [8, 2, 3, 4, 1, 5, 7]) == 125\n assert candidate(values = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 328\n assert candidate(values = [1, 100, 2, 99, 3, 98, 4, 97, 5]) == 2254\n assert candidate(values = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89]) == 7158270\n assert candidate(values = [3, 2, 1, 4, 6, 5, 9, 7, 8]) == 248\n assert candidate(values = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]) == 5634\n assert candidate(values = [7, 6, 8, 5, 3, 4, 9, 2]) == 386\n assert candidate(values = [7, 3, 8, 6, 2, 9, 1, 4, 10, 5]) == 248\n assert candidate(values = [150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 1118000\n assert candidate(values = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 54\n assert candidate(values = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300]) == 726000000\n assert candidate(values = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 51\n assert candidate(values = [9, 1, 8, 2, 7, 3, 6, 4, 5, 10, 11, 12, 13, 14, 15]) == 1088\n assert candidate(values = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 1128\n assert candidate(values = [40, 10, 30, 20, 50, 60, 70, 80, 90]) == 252000\n assert candidate(values = [25, 15, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135]) == 1254375\n assert candidate(values = [31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2, 1, 1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]) == 66691\n assert candidate(values = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 47\n assert candidate(values = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 238\n assert candidate(values = [1, 10, 100, 1000, 10000, 100000, 1000000]) == 101010101000\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]) == 71978\n assert candidate(values = [30, 20, 10, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 1151000\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 1118\n assert candidate(values = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 864\n assert candidate(values = [8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96]) == 291840\n assert candidate(values = [7, 8, 9, 10, 11, 12, 13, 14]) == 5194\n assert candidate(values = [12, 8, 6, 3, 7, 11, 9, 5, 4]) == 1299\n assert candidate(values = [10, 1, 100, 10, 1, 100, 10, 1, 100]) == 3031\n assert candidate(values = [9, 1, 8, 1, 7, 2, 6, 3, 5, 4]) == 125\n assert candidate(values = [99, 1, 98, 2, 97, 3, 96, 4, 95, 5, 94, 6]) == 3836\n assert candidate(values = [5, 6, 3, 2, 7, 8, 4, 1, 9]) == 201\n assert candidate(values = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100]) == 32000000\n assert candidate(values = [3, 7, 4, 5, 6, 8, 2, 9, 1]) == 181\n assert candidate(values = [10, 5, 1, 100, 10, 5, 1]) == 1110\n assert candidate(values = [3, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 41788\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80]) == 166000\n assert candidate(values = [99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 56498\n assert candidate(values = [5, 25, 15, 10, 40, 50]) == 14625\n assert candidate(values = [10, 20, 30, 40, 50]) == 38000\n assert candidate(values = [3, 5, 100, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 568\n assert candidate(values = [2, 5, 8, 13, 21, 34, 55, 89]) == 15792\n assert candidate(values = [100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100]) == 10503\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 1625\n assert candidate(values = [12, 34, 56, 78, 90, 11, 22, 33, 44, 55]) == 208538\n assert candidate(values = [50, 20, 10, 30, 40, 60, 80, 70, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 2733000\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90]) == 238000\n"}, "metadata": {"canonical_parameter_names": ["values"], "leetcode_dataset_entry_point": "Solution().minScoreTriangulation", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minScoreTriangulation = function(values) {", "container": null, "callable": "minScoreTriangulation", "parameters": [{"name": "values", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1040, "task_id": "moving-stones-until-consecutive-ii", "difficulty": "Medium", "problem_description": "There are some stones in different positions on the X-axis. You are given an integer array stones, the positions of the stones.\nCall a stone an endpoint stone if it has the smallest or largest position. In one move, you pick up an endpoint stone and move it to an unoccupied position so that it is no longer an endpoint stone.\n\nIn particular, if the stones are at say, stones = [1,2,5], you cannot move the endpoint stone at position 5, since moving it to any position (such as 0, or 3) will still keep that stone as an endpoint stone.\n\nThe game ends when you cannot make any more moves (i.e., the stones are in three consecutive positions).\nReturn an integer array answer of length 2 where:\n\nanswer[0] is the minimum number of moves you can play, and\nanswer[1] is the maximum number of moves you can play.\n\n \nExample 1:\n\nInput: stones = [7,4,9]\nOutput: [1,2]\nExplanation: We can move 4 -> 8 for one move to finish the game.\nOr, we can move 9 -> 5, 4 -> 6 for two moves to finish the game.\n\nExample 2:\n\nInput: stones = [6,5,4,3,10]\nOutput: [2,3]\nExplanation: We can move 3 -> 8 then 10 -> 7 to finish the game.\nOr, we can move 3 -> 7, 4 -> 8, 5 -> 9 to finish the game.\nNotice we cannot move 10 -> 2 to finish the game, because that would be an illegal move.\n\n \nConstraints:\n\n3 <= stones.length <= 104\n1 <= stones[i] <= 109\nAll the values of stones are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(stones = [4, 5, 6, 7, 100]) == [2, 92]\n assert candidate(stones = [10, 11, 12, 14, 15, 16]) == [1, 1]\n assert candidate(stones = [3, 6, 9, 12, 15]) == [3, 6]\n assert candidate(stones = [6, 5, 4, 3, 10]) == [2, 3]\n assert candidate(stones = [1, 3, 5, 7, 9]) == [2, 3]\n assert candidate(stones = [1, 1000000000, 2000000000]) == [2, 999999999]\n assert candidate(stones = [7, 4, 9]) == [1, 2]\n assert candidate(stones = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [0, 0]\n assert candidate(stones = [100, 101, 102, 103]) == [0, 0]\n assert candidate(stones = [1, 2, 100, 101, 102]) == [2, 97]\n assert candidate(stones = [1, 5, 9, 14, 15]) == [3, 10]\n assert candidate(stones = [1, 5, 100]) == [2, 94]\n assert candidate(stones = [1, 2, 5, 7, 9]) == [2, 4]\n assert candidate(stones = [10, 11, 12, 13, 14, 15]) == [0, 0]\n assert candidate(stones = [2, 3, 6, 8, 9]) == [2, 3]\n assert candidate(stones = [1, 2, 5]) == [2, 2]\n assert candidate(stones = [1, 2, 3, 4, 5]) == [0, 0]\n assert candidate(stones = [1, 2, 3, 4, 10, 11, 12, 13]) == [4, 5]\n assert candidate(stones = [1, 100, 101, 102]) == [2, 98]\n assert candidate(stones = [1, 2, 3, 8, 10]) == [2, 5]\n assert candidate(stones = [1, 2, 1000, 1001, 1002, 1003]) == [2, 997]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == [0, 0]\n assert candidate(stones = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45]) == [10, 26]\n assert candidate(stones = [1, 10, 11, 12, 13, 14, 15, 20]) == [2, 8]\n assert candidate(stones = [1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101]) == [9, 81]\n assert candidate(stones = [5, 6, 10, 11, 15, 16, 20, 21, 25, 26, 30, 31, 35, 36, 40]) == [9, 21]\n assert candidate(stones = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 100, 101]) == [2, 79]\n assert candidate(stones = [1, 2, 10, 20, 30, 40, 50, 60, 70, 80]) == [7, 70]\n assert candidate(stones = [1, 2, 1000, 2000, 3000, 4000, 5000]) == [5, 4993]\n assert candidate(stones = [1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [2, 8]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == [0, 0]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 100]) == [2, 79]\n assert candidate(stones = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]) == [7, 88]\n assert candidate(stones = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35]) == [8, 20]\n assert candidate(stones = [1, 3, 10, 15, 18, 25]) == [4, 18]\n assert candidate(stones = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == [14, 126]\n assert candidate(stones = [1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22, 25, 26, 29, 30]) == [8, 14]\n assert candidate(stones = [10, 11, 12, 20, 21, 22, 23, 24]) == [3, 7]\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 15]) == [3, 7]\n assert candidate(stones = [1, 3, 6, 8, 12, 15, 18, 22, 25]) == [5, 15]\n assert candidate(stones = [2, 5, 7, 12, 15, 18, 22, 25, 28, 32, 35, 38]) == [8, 23]\n assert candidate(stones = [100, 101, 102, 200, 201, 202, 300, 301, 302]) == [6, 194]\n assert candidate(stones = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 100]) == [19, 72]\n assert candidate(stones = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666, 703, 741, 780, 820, 861, 903, 946, 990, 1035, 1081, 1128, 1176, 1225, 1275, 1326, 1378, 1431, 1485, 1540, 1596, 1653, 1711, 1770, 1830, 1891, 1953, 2016, 2080, 2145, 2211, 2278, 2346, 2415, 2485, 2556, 2628, 2701, 2775, 2850, 2926, 3003, 3081, 3160, 3240, 3321, 3403, 3486, 3570, 3655, 3741, 3828, 3916, 4005, 4095, 4186, 4278, 4371, 4465, 4560, 4656, 4753, 4851, 4950]) == [86, 4850]\n assert candidate(stones = [1, 3, 6, 8, 10, 13, 16, 18, 21]) == [5, 11]\n assert candidate(stones = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666, 703, 741, 780, 820, 861, 903, 946, 990, 1035, 1081]) == [37, 1034]\n assert candidate(stones = [1, 2, 3, 6, 10]) == [2, 5]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == [0, 0]\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35]) == [5, 20]\n assert candidate(stones = [1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 30, 31, 32, 33, 34, 40, 41, 42, 43, 44, 50, 51, 52, 53, 54]) == [14, 24]\n assert candidate(stones = [1, 2, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == [2, 97]\n assert candidate(stones = [1, 2, 3, 10, 11, 12, 20, 21, 22, 30]) == [6, 20]\n assert candidate(stones = [1, 2, 3, 4, 100, 101, 102]) == [3, 95]\n assert candidate(stones = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == [18, 171]\n assert candidate(stones = [1, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == [10, 891]\n assert candidate(stones = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190]) == [17, 162]\n assert candidate(stones = [1, 2, 3, 4, 100, 101, 102, 103]) == [4, 95]\n assert candidate(stones = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113]) == [21, 81]\n assert candidate(stones = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105]) == [9, 81]\n assert candidate(stones = [1, 2, 1000000000]) == [2, 999999997]\n assert candidate(stones = [1, 2, 3, 100, 101, 102, 200, 201, 202, 300]) == [7, 290]\n assert candidate(stones = [1, 2, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [2, 7]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 100]) == [2, 90]\n assert candidate(stones = [2, 5, 7, 10, 15, 20, 30]) == [4, 20]\n assert candidate(stones = [1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95]) == [15, 72]\n assert candidate(stones = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300]) == [27, 261]\n assert candidate(stones = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26]) == [6, 11]\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130]) == [11, 99]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40]) == [3, 27]\n assert candidate(stones = [1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28]) == [7, 13]\n assert candidate(stones = [1, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == [8, 36]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == [0, 0]\n assert candidate(stones = [1, 2, 3, 7, 8, 9, 13, 14, 15, 19, 20, 21]) == [6, 9]\n assert candidate(stones = [2, 5, 7, 8, 11, 13, 15, 17, 19, 22, 25, 27, 29]) == [6, 14]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1000]) == [2, 980]\n assert candidate(stones = [1, 2, 3, 6, 7, 8, 10, 11, 12, 15, 16, 17]) == [3, 5]\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]) == [6, 11]\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == [9, 72]\n assert candidate(stones = [1, 2, 3, 8, 9, 10, 11]) == [3, 4]\n assert candidate(stones = [1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == [8, 36]\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 30]) == [7, 14]\n assert candidate(stones = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) == [6, 502]\n assert candidate(stones = [1, 2, 3, 5, 6, 7, 10, 11, 12, 15, 16, 17, 20, 21, 22, 25, 26, 27]) == [6, 9]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 100, 101, 102, 103, 104, 105, 106]) == [7, 92]\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35]) == [9, 16]\n assert candidate(stones = [1, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000]) == [20, 18981]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 21, 22, 23, 24, 25]) == [6, 9]\n assert candidate(stones = [2, 4, 5, 6, 8, 10, 11, 13, 15, 16]) == [3, 5]\n assert candidate(stones = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190]) == [17, 162]\n assert candidate(stones = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500]) == [13, 477]\n assert candidate(stones = [1, 2, 3, 4, 9, 10, 11, 12, 17, 18, 19, 20]) == [4, 8]\n assert candidate(stones = [1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250]) == [40, 196]\n assert candidate(stones = [1, 2, 3, 5, 6, 8, 10, 11]) == [2, 3]\n assert candidate(stones = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == [9, 81]\n assert candidate(stones = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57]) == [11, 39]\n assert candidate(stones = [1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27]) == [7, 12]\n assert candidate(stones = [2, 5, 7, 11, 14, 17, 20]) == [4, 10]\n assert candidate(stones = [1, 4, 8, 10, 13, 17, 20]) == [4, 11]\n assert candidate(stones = [1, 2, 3, 4, 5, 100, 101, 102, 103, 104]) == [5, 94]\n assert candidate(stones = [1, 2, 5, 7, 11, 13, 17, 19]) == [4, 11]\n assert candidate(stones = [3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105]) == [9, 88]\n assert candidate(stones = [1, 2, 3, 8, 9, 10]) == [3, 4]\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40]) == [6, 24]\n assert candidate(stones = [1, 3, 6, 10, 14, 15]) == [3, 9]\n assert candidate(stones = [1, 3, 5, 7, 9, 100]) == [3, 93]\n assert candidate(stones = [1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130]) == [21, 100]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150]) == [0, 0]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26, 27, 28, 29, 30]) == [4, 4]\n assert candidate(stones = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420, 430, 440, 450, 460, 470, 480, 490, 500]) == [45, 441]\n assert candidate(stones = [1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 40]) == [2, 9]\n assert candidate(stones = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == [7, 13]\n assert candidate(stones = [1, 2, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == [16, 78]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [0, 0]\n assert candidate(stones = [2, 5, 7, 8, 11, 13, 16, 20]) == [4, 9]\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == [8, 32]\n assert candidate(stones = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55]) == [6, 44]\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75]) == [12, 52]\n assert candidate(stones = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90]) == [8, 72]\n assert candidate(stones = [1, 2, 3, 1000000000, 2000000000]) == [2, 1999999995]\n assert candidate(stones = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]) == [8, 999999982]\n assert candidate(stones = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == [9, 792]\n assert candidate(stones = [1, 2, 3, 4, 100, 101, 102, 150]) == [4, 142]\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == [8, 32]\n assert candidate(stones = [1, 2, 3, 4, 5, 100, 101, 102, 103, 104]) == [5, 94]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 100, 101, 102, 103, 104, 105]) == [6, 84]\n assert candidate(stones = [100, 101, 102, 103, 104, 200, 201, 202, 203, 204]) == [5, 95]\n assert candidate(stones = [1, 3, 10, 20, 30, 40, 50]) == [5, 42]\n assert candidate(stones = [1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == [16, 76]\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == [13, 117]\n assert candidate(stones = [2, 5, 10, 15, 20, 25, 30, 35, 40]) == [6, 28]\n assert candidate(stones = [1, 3, 5, 10, 20, 30]) == [3, 23]\n assert candidate(stones = [1, 2, 5, 6, 10, 11, 13, 14, 17, 18]) == [4, 8]\n assert candidate(stones = [1, 2, 3, 4, 5, 10, 11, 12, 13, 14]) == [4, 4]\n assert candidate(stones = [1, 2, 3, 10, 11, 12]) == [3, 6]\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100]) == [2, 89]\n assert candidate(stones = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == [0, 0]\n assert candidate(stones = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105]) == [10, 90]\n assert candidate(stones = [5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27]) == [6, 10]\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == [16, 72]\n assert candidate(stones = [1, 1000000000]) == [2, 0]\n"}, "metadata": {"canonical_parameter_names": ["stones"], "leetcode_dataset_entry_point": "Solution().numMovesStonesII", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numMovesStonesII = function(stones) {", "container": null, "callable": "numMovesStonesII", "parameters": [{"name": "stones", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1041, "task_id": "robot-bounded-in-circle", "difficulty": "Medium", "problem_description": "On an infinite plane, a robot initially stands at (0, 0) and faces north. Note that:\n\nThe north direction is the positive direction of the y-axis.\nThe south direction is the negative direction of the y-axis.\nThe east direction is the positive direction of the x-axis.\nThe west direction is the negative direction of the x-axis.\n\nThe robot can receive one of three instructions:\n\n\"G\": go straight 1 unit.\n\"L\": turn 90 degrees to the left (i.e., anti-clockwise direction).\n\"R\": turn 90 degrees to the right (i.e., clockwise direction).\n\nThe robot performs the instructions given in order, and repeats them forever.\nReturn true if and only if there exists a circle in the plane such that the robot never leaves the circle.\n \nExample 1:\n\nInput: instructions = \"GGLLGG\"\nOutput: true\nExplanation: The robot is initially at (0, 0) facing the north direction.\n\"G\": move one step. Position: (0, 1). Direction: North.\n\"G\": move one step. Position: (0, 2). Direction: North.\n\"L\": turn 90 degrees anti-clockwise. Position: (0, 2). Direction: West.\n\"L\": turn 90 degrees anti-clockwise. Position: (0, 2). Direction: South.\n\"G\": move one step. Position: (0, 1). Direction: South.\n\"G\": move one step. Position: (0, 0). Direction: South.\nRepeating the instructions, the robot goes into the cycle: (0, 0) --> (0, 1) --> (0, 2) --> (0, 1) --> (0, 0).\nBased on that, we return true.\n\nExample 2:\n\nInput: instructions = \"GG\"\nOutput: false\nExplanation: The robot is initially at (0, 0) facing the north direction.\n\"G\": move one step. Position: (0, 1). Direction: North.\n\"G\": move one step. Position: (0, 2). Direction: North.\nRepeating the instructions, keeps advancing in the north direction and does not go into cycles.\nBased on that, we return false.\n\nExample 3:\n\nInput: instructions = \"GL\"\nOutput: true\nExplanation: The robot is initially at (0, 0) facing the north direction.\n\"G\": move one step. Position: (0, 1). Direction: North.\n\"L\": turn 90 degrees anti-clockwise. Position: (0, 1). Direction: West.\n\"G\": move one step. Position: (-1, 1). Direction: West.\n\"L\": turn 90 degrees anti-clockwise. Position: (-1, 1). Direction: South.\n\"G\": move one step. Position: (-1, 0). Direction: South.\n\"L\": turn 90 degrees anti-clockwise. Position: (-1, 0). Direction: East.\n\"G\": move one step. Position: (0, 0). Direction: East.\n\"L\": turn 90 degrees anti-clockwise. Position: (0, 0). Direction: North.\nRepeating the instructions, the robot goes into the cycle: (0, 0) --> (0, 1) --> (-1, 1) --> (-1, 0) --> (0, 0).\nBased on that, we return true.\n\n \nConstraints:\n\n1 <= instructions.length <= 100\ninstructions[i] is 'G', 'L' or, 'R'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(instructions = \"GGLGRGLL\") == True\n assert candidate(instructions = \"LLLL\") == True\n assert candidate(instructions = \"GLLRLLRL\") == True\n assert candidate(instructions = \"GRGL\") == False\n assert candidate(instructions = \"LLGRL\") == True\n assert candidate(instructions = \"LRRL\") == True\n assert candidate(instructions = \"LLGRR\") == False\n assert candidate(instructions = \"LRRRRLL\") == True\n assert candidate(instructions = \"LL\") == True\n assert candidate(instructions = \"RRGRRG\") == True\n assert candidate(instructions = \"GGGG\") == False\n assert candidate(instructions = \"GGRRGG\") == True\n assert candidate(instructions = \"GLGLG\") == True\n assert candidate(instructions = \"GGLLGG\") == True\n assert candidate(instructions = \"L\") == True\n assert candidate(instructions = \"GL\") == True\n assert candidate(instructions = \"R\") == True\n assert candidate(instructions = \"GG\") == False\n assert candidate(instructions = \"GLGLGLGL\") == True\n assert candidate(instructions = \"RRRR\") == True\n assert candidate(instructions = \"G\") == False\n assert candidate(instructions = \"GLGLGRRG\") == False\n assert candidate(instructions = \"GLLRLLRR\") == True\n assert candidate(instructions = \"RR\") == True\n assert candidate(instructions = \"LGLLGLLGRRRRGG\") == True\n assert candidate(instructions = \"LGR\") == False\n assert candidate(instructions = \"GLGLGRRR\") == True\n assert candidate(instructions = \"GRRG\") == True\n assert candidate(instructions = \"GRRGRRGRRGRRGRRGLG\") == True\n assert candidate(instructions = \"GLRGLRGLRGLRGLRGLR\") == False\n assert candidate(instructions = \"GGGGGRRRRRLLLLL\") == False\n assert candidate(instructions = \"GGRRLLGGRRLLGGRRLL\") == False\n assert candidate(instructions = \"LGGRRGGRRGGRRG\") == True\n assert candidate(instructions = \"RRRLLLLGGGGRRRLLL\") == True\n assert candidate(instructions = \"RRLLRRLLRRLLRR\") == True\n assert candidate(instructions = \"GLRGLRGLRGLRGLR\") == False\n assert candidate(instructions = \"RRRRGGGGLLGGGG\") == True\n assert candidate(instructions = \"GLGLGLGLGLGLGLGLGL\") == True\n assert candidate(instructions = \"RRRRRRRRRRRRRR\") == True\n assert candidate(instructions = \"RRLLGGGLLLRRRR\") == True\n assert candidate(instructions = \"LGLLGLGLLGLGRR\") == True\n assert candidate(instructions = \"GGRRLLGGLLRR\") == False\n assert candidate(instructions = \"GGGGGLLLRRRGGGGGLLLRRR\") == False\n assert candidate(instructions = \"LRRLRLRLRLRLRLRL\") == True\n assert candidate(instructions = \"LLLLRRRRLLLLRRRR\") == True\n assert candidate(instructions = \"GLGRGLGRGLGRGL\") == True\n assert candidate(instructions = \"GLRRLGLRRL\") == False\n assert candidate(instructions = \"GRRGRRGRRGRRGRRGRR\") == True\n assert candidate(instructions = \"LLLLRRRRLLLLRRRRGG\") == False\n assert candidate(instructions = \"GGGGRRRLLLLGGGRR\") == True\n assert candidate(instructions = \"GRRGRLGLGG\") == True\n assert candidate(instructions = \"RRLLGGGGLLRRLG\") == True\n assert candidate(instructions = \"GGLLGGRRLLRRGG\") == False\n assert candidate(instructions = \"GLGRRGLLGLLRRGGG\") == True\n assert candidate(instructions = \"LRRLGRLGRLGRLRLR\") == True\n assert candidate(instructions = \"GLLRRGGLLRRGGLLRR\") == False\n assert candidate(instructions = \"GGGRRRGRRRRGGGRRR\") == True\n assert candidate(instructions = \"RRLLGGGGLLRRG\") == False\n assert candidate(instructions = \"LRRRRLLRRRRLLRRR\") == True\n assert candidate(instructions = \"GRRGRRGRRGRRGG\") == False\n assert candidate(instructions = \"GGGLGGGLGGGLGGGL\") == True\n assert candidate(instructions = \"GGRRGGRRGGRRGGRR\") == True\n assert candidate(instructions = \"LLRRGGGGLLRRGG\") == False\n assert candidate(instructions = \"GGLRLRGGRRLL\") == False\n assert candidate(instructions = \"LRRGGLLLGGRRGG\") == False\n assert candidate(instructions = \"GLRRGLRRGLRR\") == True\n assert candidate(instructions = \"LLLLGRRGGGLLRLLRRR\") == True\n assert candidate(instructions = \"GLRLRLRLRLRRGGGG\") == True\n assert candidate(instructions = \"RRGLLRRGLLRRGLLRRG\") == True\n assert candidate(instructions = \"GLLGRRGRRGLLGRR\") == True\n assert candidate(instructions = \"LGGGGRLRRRRGLLGG\") == True\n assert candidate(instructions = \"GRRGGLLLGGRRGG\") == True\n assert candidate(instructions = \"LLLLRRRLLLLRRR\") == True\n assert candidate(instructions = \"LRLLRRLLRRLLRRLL\") == True\n assert candidate(instructions = \"RRLLGGGLLLRRGG\") == True\n assert candidate(instructions = \"RRGRLGGRLGRLG\") == True\n assert candidate(instructions = \"GGGLLLGGRRRRGGGL\") == False\n assert candidate(instructions = \"GLGGRLGRLGLGRLGLGG\") == True\n assert candidate(instructions = \"GGLGGLGGRRRR\") == True\n assert candidate(instructions = \"LGLRLGLRLGLRLGLRL\") == True\n assert candidate(instructions = \"GLGLGLGLGRRGRRGL\") == True\n assert candidate(instructions = \"LGGRLGRRGLLGRRGLGRR\") == True\n assert candidate(instructions = \"RRRLLLLRRRLLLL\") == True\n assert candidate(instructions = \"GLRGLRLRLGRRGGGG\") == True\n assert candidate(instructions = \"LGGRRGLGGLLRRGL\") == True\n assert candidate(instructions = \"GGGGLLLRRRGGRRRL\") == True\n assert candidate(instructions = \"GLRLRLRLRLRLRLRL\") == True\n assert candidate(instructions = \"GLGRRGGLLRRGGLLRR\") == True\n assert candidate(instructions = \"GGGGRRRLLLLLGGGG\") == True\n assert candidate(instructions = \"RRRGLLGGLLLGGG\") == True\n assert candidate(instructions = \"GGRRLLGGRRLL\") == False\n assert candidate(instructions = \"LGRGLRLRLGRR\") == True\n assert candidate(instructions = \"LGGRRGRRLLGGRL\") == True\n assert candidate(instructions = \"GLLLRRRRGLLLRRRR\") == True\n assert candidate(instructions = \"GGGLLLGGGLLLGGGL\") == True\n assert candidate(instructions = \"GLRLGLRLGLRLGLRL\") == True\n assert candidate(instructions = \"LGLLGLGLLGLGRRGLGRR\") == False\n assert candidate(instructions = \"GLGRLLRLRRRL\") == False\n assert candidate(instructions = \"LGLGLLRLRLRLRL\") == False\n assert candidate(instructions = \"GLGLGLGLGLGL\") == True\n assert candidate(instructions = \"LLGGRRLLGGRRLLGG\") == True\n assert candidate(instructions = \"GLGGRLGRLGLGRL\") == True\n assert candidate(instructions = \"LGLLGLGLGLGLLGLL\") == True\n assert candidate(instructions = \"LRLRLRLRLRLRLRLRLR\") == True\n assert candidate(instructions = \"GGLRLRRLLGLGGGG\") == True\n assert candidate(instructions = \"GGGGGGGGGGGGGG\") == False\n assert candidate(instructions = \"GRRRLRLLGLGLGRLR\") == False\n assert candidate(instructions = \"GGGLGGGLGGGLGGGLGG\") == False\n assert candidate(instructions = \"LGLRLGLRLGLRLGLRLR\") == True\n assert candidate(instructions = \"GLGLGLGLGLGLGLGL\") == True\n assert candidate(instructions = \"LGLGLGLGLGLGLGLG\") == True\n assert candidate(instructions = \"LLLLLLLLLLLLLL\") == True\n assert candidate(instructions = \"LGLGLGLGLGLGLG\") == True\n assert candidate(instructions = \"GGRRGLGRRGRRGRR\") == True\n assert candidate(instructions = \"LRLRLRLRLRLRLRLR\") == True\n assert candidate(instructions = \"GLGLGLGLGL\") == True\n assert candidate(instructions = \"GRRGRRGRRGRRGRRG\") == True\n assert candidate(instructions = \"GRRGLLRLLGRGLL\") == True\n assert candidate(instructions = \"LGLRLGLRLG\") == True\n assert candidate(instructions = \"GGLRLGLLGGRR\") == True\n assert candidate(instructions = \"GLRRLLRRLLRRLLRR\") == True\n assert candidate(instructions = \"RRLLRRLLRRLLRRLLRR\") == True\n assert candidate(instructions = \"GLRLRLRLRLRLRLRLGG\") == True\n assert candidate(instructions = \"RRGGLLRGGLLRRGLL\") == True\n assert candidate(instructions = \"GGGGGGGGGGGGGGGG\") == False\n assert candidate(instructions = \"GRRGLRGGGLLRLLGRR\") == True\n assert candidate(instructions = \"GLRRGLLLGGGGRRRR\") == True\n assert candidate(instructions = \"RRRRLLLLGGGG\") == False\n assert candidate(instructions = \"GLRRGLGLRLRR\") == True\n assert candidate(instructions = \"LGGRLGRRGLG\") == False\n assert candidate(instructions = \"GGGGRRRRLLLL\") == False\n assert candidate(instructions = \"RGLLRLGLGRRG\") == True\n assert candidate(instructions = \"RRLLRRLLRRLLRRLL\") == True\n assert candidate(instructions = \"GLRLGLRLGLRL\") == True\n assert candidate(instructions = \"GLGRRRRRGGGLLGLGRR\") == True\n assert candidate(instructions = \"GGGLRRLLGLRRLL\") == True\n assert candidate(instructions = \"GGLLGGGGLLGGGG\") == False\n assert candidate(instructions = \"LRRLRLRLRL\") == True\n assert candidate(instructions = \"GRRGGGGLLLRRGGLG\") == False\n assert candidate(instructions = \"LRRGLLRRGLLRRGLLRR\") == True\n"}, "metadata": {"canonical_parameter_names": ["instructions"], "leetcode_dataset_entry_point": "Solution().isRobotBounded", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isRobotBounded = function(instructions) {", "container": null, "callable": "isRobotBounded", "parameters": [{"name": "instructions", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1042, "task_id": "flower-planting-with-no-adjacent", "difficulty": "Medium", "problem_description": "You have n gardens, labeled from 1 to n, and an array paths where paths[i] = [xi, yi] describes a bidirectional path between garden xi to garden yi. In each garden, you want to plant one of 4 types of flowers.\nAll gardens have at most 3 paths coming into or leaving it.\nYour task is to choose a flower type for each garden such that, for any two gardens connected by a path, they have different types of flowers.\nReturn any such a choice as an array answer, where answer[i] is the type of flower planted in the (i+1)th garden. The flower types are denoted 1, 2, 3, or 4. It is guaranteed an answer exists.\n \nExample 1:\n\nInput: n = 3, paths = [[1,2],[2,3],[3,1]]\nOutput: [1,2,3]\nExplanation:\nGardens 1 and 2 have different types.\nGardens 2 and 3 have different types.\nGardens 3 and 1 have different types.\nHence, [1,2,3] is a valid answer. Other valid answers include [1,2,4], [1,4,2], and [3,2,1].\n\nExample 2:\n\nInput: n = 4, paths = [[1,2],[3,4]]\nOutput: [1,2,1,2]\n\nExample 3:\n\nInput: n = 4, paths = [[1,2],[2,3],[3,4],[4,1],[1,3],[2,4]]\nOutput: [1,2,3,4]\n\n \nConstraints:\n\n1 <= n <= 104\n0 <= paths.length <= 2 * 104\npaths[i].length == 2\n1 <= xi, yi <= n\nxi != yi\nEvery garden has at most 3 paths coming into or leaving it.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 3,paths = [[1, 2], [2, 3], [3, 1]]) == [1, 2, 3]\n assert candidate(n = 6,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 5], [3, 6], [4, 5], [4, 6]]) == [1, 2, 2, 2, 1, 1]\n assert candidate(n = 6,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 1]]) == [1, 2, 1, 2, 1, 2]\n assert candidate(n = 5,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1]]) == [1, 2, 1, 2, 3]\n assert candidate(n = 7,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 1]]) == [1, 2, 1, 2, 1, 2, 3]\n assert candidate(n = 4,paths = [[1, 2], [3, 4]]) == [1, 2, 1, 2]\n assert candidate(n = 8,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 7], [4, 8]]) == [1, 2, 2, 2, 1, 1, 1, 1]\n assert candidate(n = 7,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [1, 7], [1, 3], [4, 6]]) == [1, 2, 3, 1, 2, 3, 2]\n assert candidate(n = 5,paths = [[1, 2], [2, 3], [3, 4], [4, 5]]) == [1, 2, 1, 2, 1]\n assert candidate(n = 7,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 1], [1, 3], [2, 4], [5, 7]]) == [1, 2, 3, 1, 2, 1, 3]\n assert candidate(n = 4,paths = [[1, 2], [2, 3], [3, 4], [4, 1], [1, 3], [2, 4]]) == [1, 2, 3, 4]\n assert candidate(n = 6,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [1, 3], [4, 6]]) == [1, 2, 3, 1, 2, 3]\n assert candidate(n = 6,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 1], [1, 3], [4, 6]]) == [1, 2, 3, 1, 2, 3]\n assert candidate(n = 5,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [1, 5]]) == [1, 2, 1, 2, 3]\n assert candidate(n = 10,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [1, 3], [4, 6], [7, 9]]) == [1, 2, 3, 1, 2, 3, 1, 2, 3, 2]\n assert candidate(n = 12,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 1], [1, 3], [4, 6], [7, 9], [2, 4], [5, 7], [8, 10], [11, 12]]) == [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]\n assert candidate(n = 10,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [2, 4], [3, 5], [6, 8], [7, 9]]) == [1, 2, 1, 3, 2, 1, 2, 3, 1, 2]\n assert candidate(n = 12,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [2, 7], [3, 8], [3, 9], [3, 10], [4, 11], [4, 12], [5, 11], [6, 12]]) == [1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 3, 3]\n assert candidate(n = 12,paths = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [7, 12], [8, 10], [9, 11]]) == [1, 2, 2, 1, 1, 1, 1, 2, 2, 3, 3, 2]\n assert candidate(n = 18,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [1, 3], [4, 6], [7, 9], [10, 12], [13, 15], [16, 18], [1, 17], [2, 16], [3, 15], [4, 14], [5, 13], [6, 12], [7, 11], [8, 10], [1, 18], [2, 17], [3, 16], [4, 15], [5, 14], [6, 13], [7, 12], [8, 11], [9, 10]]) == [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 3, 2, 1, 3, 2, 1, 3, 2]\n assert candidate(n = 20,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [1, 20], [2, 19], [3, 18], [4, 17], [5, 16], [6, 15], [7, 14], [8, 13], [9, 12], [10, 11]]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]\n assert candidate(n = 9,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 5], [3, 7], [4, 6], [4, 8], [5, 9], [6, 9], [7, 8], [8, 9]]) == [1, 2, 2, 2, 1, 1, 1, 3, 2]\n assert candidate(n = 15,paths = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 5], [3, 6], [4, 7], [4, 8], [5, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 13], [10, 14], [11, 15], [12, 15]]) == [1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2]\n assert candidate(n = 15,paths = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 9], [10, 11], [12, 13], [14, 15]]) == [1, 2, 2, 1, 1, 1, 1, 2, 3, 2, 3, 2, 3, 2, 3]\n assert candidate(n = 25,paths = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 16], [8, 17], [9, 18], [9, 19], [10, 20], [10, 21], [11, 22], [11, 23], [12, 24], [12, 25], [13, 14], [15, 16], [17, 18], [19, 20], [21, 22], [23, 24], [25, 13]]) == [1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 2, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1]\n assert candidate(n = 15,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [2, 7], [3, 8], [3, 9], [3, 10], [4, 11], [4, 12], [4, 13], [5, 14], [6, 14], [7, 14], [8, 15], [9, 15], [10, 15], [11, 15], [12, 15], [13, 15]]) == [1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2]\n assert candidate(n = 25,paths = [[1, 2], [1, 3], [1, 4], [1, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [3, 11], [3, 12], [3, 13], [3, 14], [3, 15], [4, 16], [4, 17], [4, 18], [4, 19], [4, 20], [5, 21], [5, 22], [5, 23], [5, 24], [5, 25], [6, 21], [7, 22], [8, 23], [9, 24], [10, 25], [11, 16], [12, 17], [13, 18], [14, 19], [15, 20], [16, 21], [17, 22], [18, 23], [19, 24], [20, 25], [21, 22], [22, 23], [23, 24], [24, 25]]) == [1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 4, 0, 4, 0, 4]\n assert candidate(n = 20,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [2, 7], [3, 8], [3, 9], [3, 10], [4, 11], [4, 12], [4, 13], [5, 14], [5, 15], [6, 16], [6, 17], [7, 18], [7, 19], [8, 20], [9, 20], [10, 20], [11, 20], [12, 20], [13, 20], [14, 20], [15, 20], [16, 20], [17, 20], [18, 20], [19, 20]]) == [1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3]\n assert candidate(n = 15,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [2, 7], [3, 8], [3, 9], [3, 10], [4, 11], [4, 12], [4, 13], [5, 14], [5, 15], [6, 14], [7, 15], [8, 11], [9, 12], [10, 13], [11, 14], [12, 15], [13, 14], [1, 5], [2, 6], [3, 7], [4, 8]]) == [1, 2, 2, 2, 3, 1, 1, 1, 1, 1, 3, 3, 3, 2, 2]\n assert candidate(n = 25,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], [25, 1], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 16], [15, 17], [16, 18], [17, 19], [18, 20], [19, 21], [20, 22], [21, 23], [22, 24], [23, 25], [24, 1], [25, 2], [1, 4], [2, 5], [3, 6], [4, 7], [5, 8], [6, 9], [7, 10], [8, 11], [9, 12], [10, 13], [11, 14], [12, 15], [13, 16], [14, 17], [15, 18], [16, 19], [17, 20], [18, 21], [19, 22], [20, 23], [21, 24], [22, 25], [23, 1], [24, 2], [25, 3]]) == [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 0]\n assert candidate(n = 20,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 1], [1, 3], [4, 6], [7, 9], [10, 12], [13, 15], [16, 18], [2, 4], [5, 7], [8, 10], [11, 13], [14, 16], [17, 19]]) == [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2]\n assert candidate(n = 15,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 6], [7, 8], [9, 10], [5, 7], [6, 9], [11, 12], [11, 13], [11, 14], [12, 15], [13, 14]]) == [1, 2, 2, 2, 1, 3, 3, 1, 1, 3, 1, 2, 2, 3, 1]\n assert candidate(n = 12,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 1], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12]]) == [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]\n assert candidate(n = 10,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 6], [7, 8], [9, 10], [5, 7], [6, 9]]) == [1, 2, 2, 2, 1, 3, 3, 1, 1, 3]\n assert candidate(n = 20,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [2, 7], [2, 8], [3, 9], [3, 10], [3, 11], [4, 12], [4, 13], [4, 14], [5, 15], [6, 15], [7, 15], [8, 15], [9, 16], [10, 16], [11, 16], [12, 17], [13, 17], [14, 17], [15, 18], [16, 18], [17, 19], [18, 20], [19, 20]]) == [1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 2]\n assert candidate(n = 10,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 10], [2, 8], [3, 9], [4, 6], [5, 7]]) == [1, 2, 1, 2, 1, 3, 2, 1, 2, 3]\n assert candidate(n = 12,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 1], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 1], [12, 2]]) == [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]\n assert candidate(n = 20,paths = [[1, 2], [1, 10], [2, 3], [2, 9], [3, 4], [3, 8], [4, 5], [4, 7], [5, 6], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [11, 12], [11, 20], [12, 13], [12, 19], [13, 14], [13, 18], [14, 15], [14, 17], [15, 16], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 11]]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]\n assert candidate(n = 12,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [5, 12], [6, 11], [6, 12], [7, 11], [7, 12], [8, 11], [8, 12], [9, 11], [9, 12]]) == [1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2]\n assert candidate(n = 10,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 1], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 1], [10, 2]]) == [1, 2, 3, 1, 2, 3, 1, 2, 3, 4]\n assert candidate(n = 20,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 1], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 16], [15, 17], [16, 18], [17, 19], [18, 20], [19, 1], [20, 2]]) == [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 0]\n assert candidate(n = 10,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [2, 7], [3, 8], [3, 9], [4, 10], [5, 6], [5, 7], [5, 8], [6, 9], [7, 10], [8, 9], [9, 10]]) == [1, 2, 2, 2, 1, 3, 3, 3, 1, 4]\n assert candidate(n = 9,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [5, 6], [5, 7], [6, 8], [7, 9], [8, 9]]) == [1, 2, 2, 2, 1, 3, 3, 1, 4]\n assert candidate(n = 12,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [6, 11], [7, 12], [8, 12], [9, 11], [10, 12]]) == [1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2]\n assert candidate(n = 15,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 1], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13, 15], [14, 1], [15, 2]]) == [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]\n assert candidate(n = 10,paths = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 9], [5, 10], [6, 10]]) == [1, 2, 2, 1, 1, 1, 1, 2, 2, 2]\n assert candidate(n = 20,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 1], [1, 3], [4, 6], [7, 9], [10, 12], [13, 15], [16, 18], [1, 19], [2, 18], [3, 17], [4, 16], [5, 15], [6, 14], [7, 13], [8, 12], [9, 11]]) == [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 1, 3, 2, 1, 3, 2, 3]\n assert candidate(n = 15,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [2, 7], [3, 8], [3, 9], [3, 10], [4, 11], [4, 12], [4, 13], [5, 14], [5, 15], [6, 14], [7, 15], [8, 14], [9, 15], [10, 14], [11, 15], [12, 15], [13, 15]]) == [1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2]\n assert candidate(n = 20,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [2, 7], [3, 8], [3, 9], [3, 10], [4, 11], [4, 12], [4, 13], [5, 14], [5, 15], [5, 16], [6, 17], [6, 18], [6, 19], [7, 20], [8, 14], [8, 15], [8, 16], [9, 17], [9, 18], [9, 19], [10, 20], [11, 14], [11, 15], [11, 16], [12, 17], [12, 18], [12, 19], [13, 20]]) == [1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2]\n assert candidate(n = 10,paths = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 10], [1, 5], [3, 8]]) == [1, 2, 1, 2, 3, 1, 2, 3, 1, 2]\n assert candidate(n = 15,paths = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 9], [10, 11], [12, 13], [14, 15], [1, 15], [3, 5], [8, 12]]) == [1, 2, 2, 1, 1, 1, 1, 2, 3, 2, 3, 3, 2, 2, 3]\n assert candidate(n = 10,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [2, 7], [3, 8], [3, 9], [4, 10], [5, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 10]]) == [1, 2, 2, 2, 1, 3, 3, 1, 1, 3]\n assert candidate(n = 12,paths = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [7, 12], [8, 12], [9, 12], [10, 11], [10, 12], [11, 12]]) == [1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 3, 4]\n assert candidate(n = 18,paths = [[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 16], [8, 17], [9, 18], [10, 18], [11, 18], [12, 18], [13, 18], [14, 18], [15, 18], [16, 18], [17, 18]]) == [1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 3]\n assert candidate(n = 25,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [2, 7], [3, 8], [3, 9], [3, 10], [4, 11], [4, 12], [4, 13], [5, 14], [5, 15], [5, 16], [6, 17], [6, 18], [6, 19], [7, 20], [7, 21], [7, 22], [8, 23], [8, 24], [8, 25], [9, 23], [9, 24], [9, 25], [10, 23], [10, 24], [10, 25], [11, 20], [11, 21], [11, 22], [12, 20], [12, 21], [12, 22], [13, 20], [13, 21], [13, 22], [14, 23], [14, 24], [14, 25], [15, 23], [15, 24], [15, 25], [16, 23], [16, 24], [16, 25], [17, 23], [17, 24], [17, 25], [18, 23], [18, 24], [18, 25], [19, 23], [19, 24], [19, 25]]) == [1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3]\n assert candidate(n = 12,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [5, 12], [6, 7], [6, 8], [7, 9], [7, 10], [8, 11], [8, 12], [9, 10], [11, 12]]) == [1, 2, 2, 2, 1, 1, 3, 3, 1, 4, 2, 4]\n assert candidate(n = 10,paths = [[1, 2], [1, 3], [1, 4], [1, 5], [2, 6], [2, 7], [3, 8], [3, 9], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10]]) == [1, 2, 2, 2, 2, 1, 1, 1, 1, 3]\n assert candidate(n = 15,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [2, 7], [3, 8], [3, 9], [3, 10], [4, 11], [4, 12], [4, 13], [5, 14], [5, 15], [6, 14], [6, 15], [7, 14], [7, 15], [8, 14], [8, 15], [9, 14], [9, 15], [10, 14], [10, 15]]) == [1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2]\n assert candidate(n = 12,paths = [[1, 2], [1, 3], [1, 4], [2, 5], [2, 6], [2, 7], [3, 8], [3, 9], [3, 10], [4, 11], [4, 12], [5, 6], [5, 7], [6, 7], [8, 9], [8, 10], [9, 10], [11, 12]]) == [1, 2, 2, 2, 1, 3, 4, 1, 3, 4, 1, 3]\n"}, "metadata": {"canonical_parameter_names": ["n", "paths"], "leetcode_dataset_entry_point": "Solution().gardenNoAdj", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var gardenNoAdj = function(n, paths) {", "container": null, "callable": "gardenNoAdj", "parameters": [{"name": "n", "type": "number"}, {"name": "paths", "type": "number[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1043, "task_id": "partition-array-for-maximum-sum", "difficulty": "Medium", "problem_description": "Given an integer array arr, partition the array into (contiguous) subarrays of length at most k. After partitioning, each subarray has their values changed to become the maximum value of that subarray.\nReturn the largest sum of the given array after partitioning. Test cases are generated so that the answer fits in a 32-bit integer.\n \nExample 1:\n\nInput: arr = [1,15,7,9,2,5,10], k = 3\nOutput: 84\nExplanation: arr becomes [15,15,15,9,10,10,10]\n\nExample 2:\n\nInput: arr = [1,4,1,5,7,3,6,1,9,9,3], k = 4\nOutput: 83\n\nExample 3:\n\nInput: arr = [1], k = 1\nOutput: 1\n\n \nConstraints:\n\n1 <= arr.length <= 500\n0 <= arr[i] <= 109\n1 <= k <= arr.length\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [1],k = 1) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9],k = 1) == 45\n assert candidate(arr = [1, 15, 7, 9, 2, 5, 10],k = 3) == 84\n assert candidate(arr = [10, 20, 30, 40, 50],k = 3) == 190\n assert candidate(arr = [9, 1, 2, 3, 9],k = 3) == 45\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 1) == 55\n assert candidate(arr = [2, 3, 5, 10, 15, 20],k = 2) == 66\n assert candidate(arr = [3, 2, 1, 4, 7, 8, 5, 6, 9],k = 3) == 62\n assert candidate(arr = [5, 4, 3, 2, 1],k = 1) == 15\n assert candidate(arr = [2, 3, 4, 5, 6, 7, 8, 9, 10],k = 2) == 58\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == 50\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 3) == 54\n assert candidate(arr = [5, 5, 5, 5, 5],k = 5) == 25\n assert candidate(arr = [5, 4, 3, 2, 1],k = 5) == 25\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 2) == 60\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 10\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == 75\n assert candidate(arr = [1, 2, 3, 4, 5],k = 3) == 19\n assert candidate(arr = [1, 4, 1, 5, 7, 3, 6, 1, 9, 9, 3],k = 4) == 83\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 100\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10],k = 9) == 90\n assert candidate(arr = [2, 3, 1, 2, 4, 3],k = 2) == 19\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 75\n assert candidate(arr = [4, 3, 2, 5, 6],k = 2) == 24\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],k = 6) == 143\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == 75\n assert candidate(arr = [1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9],k = 8) == 180\n assert candidate(arr = [8, 5, 4, 2, 1, 9, 3, 7, 6, 10, 11, 13, 12, 14, 15, 17, 16, 18, 19, 20, 22, 21, 23, 24, 26, 25, 27, 28, 30, 29, 31, 32, 33, 35, 34, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60],k = 6) == 2007\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],k = 7) == 1422\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 3) == 229\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 5) == 7500\n assert candidate(arr = [9, 1, 5, 7, 3, 6, 4, 8, 2, 10],k = 2) == 80\n assert candidate(arr = [7, 1, 5, 3, 6, 4, 2, 9, 8, 11, 10, 12],k = 6) == 118\n assert candidate(arr = [8, 7, 6, 5, 4, 3, 2, 1],k = 5) == 49\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 1) == 20\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 1) == 55\n assert candidate(arr = [9, 1, 2, 3, 9, 1, 2, 3, 9, 1, 2, 3, 9],k = 4) == 117\n assert candidate(arr = [5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1],k = 2) == 58\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 20) == 20\n assert candidate(arr = [7, 3, 6, 1, 4, 9, 2, 8, 5, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50],k = 7) == 835\n assert candidate(arr = [5, 1, 1, 5, 2, 2, 2, 2, 2, 5],k = 4) == 50\n assert candidate(arr = [9, 1, 2, 3, 9, 3, 2, 4, 5, 6],k = 3) == 75\n assert candidate(arr = [5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1, 4, 1, 5, 1],k = 3) == 334\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900],k = 7) == 6700\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9],k = 5) == 139\n assert candidate(arr = [40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2],k = 3) == 458\n assert candidate(arr = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100],k = 1) == 2000\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 4) == 240\n assert candidate(arr = [50, 40, 30, 20, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 7) == 423\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 25) == 300\n assert candidate(arr = [1000000000, 999999999, 888888888, 777777777, 666666666],k = 2) == 4555555552\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == 150\n assert candidate(arr = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109],k = 2) == 1050\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 10) == 160\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],k = 5) == 1375\n assert candidate(arr = [100, 1, 200, 2, 300, 3, 400, 4, 500, 5, 600, 6],k = 3) == 4800\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],k = 2) == 1270\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 15\n assert candidate(arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 5, 1, 0, 5, 8, 2, 0, 9, 7, 4, 9, 4, 4, 5, 9, 2, 3, 0, 7, 8, 1, 6, 4, 0, 6, 2, 8, 6, 2, 0, 8, 9, 9, 8, 6, 2, 8, 0, 3, 4, 8, 2, 5, 3, 4, 2, 1, 1, 7, 0, 6, 7, 9],k = 15) == 900\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 4) == 20\n assert candidate(arr = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == 150\n assert candidate(arr = [5, 3, 7, 9, 2, 6, 1, 8, 4, 10, 11, 12, 13, 14, 15],k = 5) == 170\n assert candidate(arr = [1000000000, 999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992, 999999991],k = 10) == 10000000000\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 2) == 480\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 1) == 120\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10) == 300\n assert candidate(arr = [9, 1, 2, 3, 9, 1, 4, 5, 1, 6, 7, 8, 1, 9],k = 4) == 122\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 5) == 130\n assert candidate(arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 5, 1, 0, 5, 8, 2, 0, 9, 7, 4, 9, 4, 4, 5, 9, 2, 3, 0, 7, 8, 1, 6, 4, 0, 6, 2, 8, 6, 2, 0, 8, 9, 9, 8, 6, 2, 8, 0, 3, 4, 8, 2, 5, 3, 4, 2, 1, 1, 7, 0, 6, 7, 9],k = 7) == 881\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 2) == 50\n assert candidate(arr = [8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == 192\n assert candidate(arr = [5, 1, 100, 1, 1, 100, 1, 1, 100, 1, 1],k = 3) == 910\n assert candidate(arr = [5, 4, 3, 2, 1],k = 4) == 21\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == 68\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],k = 3) == 54\n assert candidate(arr = [5, 2, 7, 1, 8, 3, 6, 4, 9, 10, 11, 12, 13, 14, 15],k = 8) == 176\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 20\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1],k = 2) == 49\n assert candidate(arr = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20],k = 2) == 200\n assert candidate(arr = [1, 3, 2, 5, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10) == 300\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 15) == 675\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 4) == 502\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 7) == 162\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],k = 10) == 10000\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59],k = 15) == 1320\n assert candidate(arr = [10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10],k = 10) == 150\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],k = 5) == 750\n assert candidate(arr = [15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 150],k = 6) == 1590\n assert candidate(arr = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],k = 4) == 480\n assert candidate(arr = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],k = 2) == 90\n assert candidate(arr = [5, 1, 3, 4, 6, 2, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19, 22, 21, 24, 23, 26, 25, 28, 27, 30, 29],k = 6) == 563\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],k = 5) == 250\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 25) == 300\n assert candidate(arr = [5, 6, 1, 2, 8, 7, 3, 4, 5, 6, 7, 8, 9],k = 5) == 106\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],k = 5) == 200\n assert candidate(arr = [1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9],k = 2) == 180\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],k = 2) == 420\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 10) == 175\n assert candidate(arr = [5, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 4) == 147\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 5) == 250\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 50) == 111\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],k = 4) == 135\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 3) == 229\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5],k = 3) == 89\n"}, "metadata": {"canonical_parameter_names": ["arr", "k"], "leetcode_dataset_entry_point": "Solution().maxSumAfterPartitioning", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxSumAfterPartitioning = function(arr, k) {", "container": null, "callable": "maxSumAfterPartitioning", "parameters": [{"name": "arr", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1044, "task_id": "longest-duplicate-substring", "difficulty": "Hard", "problem_description": "Given a string s, consider all duplicated substrings: (contiguous) substrings of s that occur 2 or more times. The occurrences may overlap.\nReturn any duplicated substring that has the longest possible length. If s does not have a duplicated substring, the answer is \"\".\n \nExample 1:\nInput: s = \"banana\"\nOutput: \"ana\"\nExample 2:\nInput: s = \"abcd\"\nOutput: \"\"\n\n \nConstraints:\n\n2 <= s.length <= 3 * 104\ns consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"abcabcabc\") == \"abcabc\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(s = \"mississippi\") == \"issi\"\n assert candidate(s = \"banana\") == \"ana\"\n assert candidate(s = \"bananaaa\") == \"ana\"\n assert candidate(s = \"abcdefgh\") == \"\"\n assert candidate(s = \"abcd\") == \"\"\n assert candidate(s = \"aaaaa\") == \"aaaa\"\n assert candidate(s = \"aabb\") == \"a\"\n assert candidate(s = \"aaaa\") == \"aaa\"\n assert candidate(s = \"abab\") == \"ab\"\n assert candidate(s = \"longestrepeatingsubstringlongestrepeatingsubstring\") == \"longestrepeatingsubstring\"\n assert candidate(s = \"abcdefghijkabcdefgh\") == \"abcdefgh\"\n assert candidate(s = \"abcdefghijkabcdefghijkabcdefghijkabcdefghijk\") == \"abcdefghijkabcdefghijkabcdefghijk\"\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(s = \"norepeats\") == \"e\"\n assert candidate(s = \"abcdeabcdeabcdeabcdeabcde\") == \"abcdeabcdeabcdeabcde\"\n assert candidate(s = \"abcabcabcabcabcabcabcd\") == \"abcabcabcabcabcabc\"\n assert candidate(s = \"abracadabra\") == \"abra\"\n assert candidate(s = \"abcdefabcdefabcdef\") == \"abcdefabcdef\"\n assert candidate(s = \"abcabcabcabc\") == \"abcabcabc\"\n assert candidate(s = \"aaaaaaaaaabbbbbbbbbccccc\") == \"aaaaaaaaa\"\n assert candidate(s = \"abcdefghabcdefghabcdefghabcdefgh\") == \"abcdefghabcdefghabcdefgh\"\n assert candidate(s = \"aaaaaabbccccaaa\") == \"aaaaa\"\n assert candidate(s = \"abcdefghigklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == \"klmnopqrstuvwxyz\"\n assert candidate(s = \"thisisaverylongstringwithrepeatedsubstringsubstring\") == \"substring\"\n assert candidate(s = \"abcdefghijabcdefghijabcdefghij\") == \"abcdefghijabcdefghij\"\n assert candidate(s = \"hellohellohello\") == \"hellohello\"\n assert candidate(s = \"abababababababababababababababab\") == \"ababababababababababababababab\"\n assert candidate(s = \"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef\") == \"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef\"\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\"\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabc\") == \"abcabcabcabcabcabcabcabcabcabcabcabc\"\n assert candidate(s = \"anvnvnvnvnvnvnvnvvnvnvnvnvnvnvnvnvnvn\") == \"vnvnvnvnvnvnvnvnvn\"\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\"\n assert candidate(s = \"bananaananabanana\") == \"banana\"\n assert candidate(s = \"abcabcabcabcabcabcabc\") == \"abcabcabcabcabcabc\"\n assert candidate(s = \"bananaapplebananabananaapplebananabananaapple\") == \"bananaapplebananabananaapple\"\n assert candidate(s = \"abcabcabcabcd\") == \"abcabcabc\"\n assert candidate(s = \"mississippimississippimississippi\") == \"mississippimississippi\"\n assert candidate(s = \"abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde\") == \"abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde\"\n assert candidate(s = \"qwertyuiopqwertyuiop\") == \"qwertyuiop\"\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabc\") == \"abcabcabcabcabcabcabcabcabc\"\n assert candidate(s = \"abcdeabcdfabcde\") == \"abcde\"\n assert candidate(s = \"abracadabraabracadabraabracadabraabracadabraabracadabra\") == \"abracadabraabracadabraabracadabraabracadabra\"\n assert candidate(s = \"abracadabraabracadabraabracadabra\") == \"abracadabraabracadabra\"\n assert candidate(s = \"zabacabadabacaba\") == \"abacaba\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\") == \"z\"\n assert candidate(s = \"aaaaaa\") == \"aaaaa\"\n assert candidate(s = \"xyzxyzxyzxyzxyzxyzxyzxyzxyzxyz\") == \"xyzxyzxyzxyzxyzxyzxyzxyzxyz\"\n assert candidate(s = \"abcabcabcabcabcabc\") == \"abcabcabcabcabc\"\n assert candidate(s = \"abcdefghijkabcdefghijk\") == \"abcdefghijk\"\n assert candidate(s = \"12345678901234567890\") == \"1234567890\"\n assert candidate(s = \"aaaaaaaaaaaaaaaaaa\") == \"aaaaaaaaaaaaaaaaa\"\n assert candidate(s = \"bananaananabananana\") == \"banana\"\n assert candidate(s = \"pneumonoultramicroscopicsilicovolcanoconiosispneumonoultramicroscopicsilicovolcanoconiosispneumonoultramicroscopicsilicovolcanoconiosispneumonoultramicroscopicsilicovolcanoconiosis\") == \"pneumonoultramicroscopicsilicovolcanoconiosispneumonoultramicroscopicsilicovolcanoconiosispneumonoultramicroscopicsilicovolcanoconiosis\"\n assert candidate(s = \"thisisaverylongstringwithsomerepeatedsubstringsubstring\") == \"substring\"\n assert candidate(s = \"abcdefghijkabcdefghijkabcdefghijk\") == \"abcdefghijkabcdefghijk\"\n assert candidate(s = \"pneumonoultramicroscopicsilicovolcanoconiosispneumonoultramicroscopicsilicovolcanoconiosis\") == \"pneumonoultramicroscopicsilicovolcanoconiosis\"\n assert candidate(s = \"abcdabcdabcdabcd\") == \"abcdabcdabcd\"\n assert candidate(s = \"bananaaaanaaanana\") == \"anaaa\"\n assert candidate(s = \"aaaaaaa\") == \"aaaaaa\"\n assert candidate(s = \"abababababababababababababab\") == \"ababababababababababababab\"\n assert candidate(s = \"asdfghjklasdfghjklasdfghjkl\") == \"asdfghjklasdfghjkl\"\n assert candidate(s = \"racecaracecaracecar\") == \"racecaracecar\"\n assert candidate(s = \"abcdefghijk\") == \"\"\n assert candidate(s = \"ababababababababababab\") == \"abababababababababab\"\n assert candidate(s = \"xyzxyzxyzxyzxyzxyzxyzxyzxyz\") == \"xyzxyzxyzxyzxyzxyzxyzxyz\"\n assert candidate(s = \"abababababababababab\") == \"ababababababababab\"\n assert candidate(s = \"qwertyuiopqwertyuiopqwertyuiopqwertyuiop\") == \"qwertyuiopqwertyuiopqwertyuiop\"\n assert candidate(s = \"bananaananabanananabanana\") == \"ananabanana\"\n assert candidate(s = \"abacabadabacaba\") == \"abacaba\"\n assert candidate(s = \"zxyzyxyzxyzyxyzxyzyxzyzy\") == \"zxyzyxyzxyzyx\"\n assert candidate(s = \"bananaananab\") == \"anana\"\n assert candidate(s = \"ananananananananan\") == \"anananananananan\"\n assert candidate(s = \"xyzxyzxyzxyzxyzxyz\") == \"xyzxyzxyzxyzxyz\"\n assert candidate(s = \"abcdefghijkabcdefghijabcdefghij\") == \"abcdefghij\"\n assert candidate(s = \"zzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzz\"\n assert candidate(s = \"thisisaverylongstringwithsomerepeatingpatterns\") == \"ing\"\n assert candidate(s = \"xyxyxyxyxyxyxyxyxyxyxyxy\") == \"xyxyxyxyxyxyxyxyxyxyxy\"\n assert candidate(s = \"xyzabcxyzabcxyzabcxyzabcxyz\") == \"xyzabcxyzabcxyzabcxyz\"\n assert candidate(s = \"supercalifragilisticexpialidocioussupercalifragilisticexpialidocious\") == \"supercalifragilisticexpialidocious\"\n assert candidate(s = \"aaaaabbbbbaaaaabbbb\") == \"aaaaabbbb\"\n assert candidate(s = \"bananaapplebananabananaapple\") == \"bananaapple\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(s = \"longestsubstringissubstring\") == \"substring\"\n assert candidate(s = \"abcdefgabcdefg\") == \"abcdefg\"\n assert candidate(s = \"abcdeabcdeabcdeabcde\") == \"abcdeabcdeabcde\"\n assert candidate(s = \"thisisaverylongstringwitharepeatedsubstringthisisaverylongstringwitharepeatedsubstring\") == \"thisisaverylongstringwitharepeatedsubstring\"\n assert candidate(s = \"abracadabraabracadabra\") == \"abracadabra\"\n assert candidate(s = \"abcdabcdabcdabcdabcdabcd\") == \"abcdabcdabcdabcdabcd\"\n assert candidate(s = \"xyzxyzxyzxyzxyz\") == \"xyzxyzxyzxyz\"\n assert candidate(s = \"bananaanananab\") == \"anana\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == \"a\"\n assert candidate(s = \"longestsubstrlongestsubstrlongestsubstr\") == \"longestsubstrlongestsubstr\"\n assert candidate(s = \"anananananananananananananananananan\") == \"ananananananananananananananananan\"\n assert candidate(s = \"aabbccddeeffaabbccddeeff\") == \"aabbccddeeff\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(s = \"noonnoonnoon\") == \"noonnoon\"\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcd\") == \"abcdabcdabcdabcdabcdabcdabcdabcd\"\n assert candidate(s = \"abcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh\") == \"abcdefghabcdefghabcdefghabcdefghabcdefgh\"\n assert candidate(s = \"anananananananananananananananananananananananananananananananananananananananananananan\") == \"ananananananananananananananananananananananananananananananananananananananananananan\"\n assert candidate(s = \"abcdeabcdeabcde\") == \"abcdeabcde\"\n assert candidate(s = \"mnopqrsmnopqrsmnopqrsmnopqrs\") == \"mnopqrsmnopqrsmnopqrs\"\n assert candidate(s = \"abcdefgabcdefgabcdefg\") == \"abcdefgabcdefg\"\n assert candidate(s = \"racecar\") == \"c\"\n assert candidate(s = \"abcdefghijabcdefghij\") == \"abcdefghij\"\n assert candidate(s = \"ababababababababababababababababababababababab\") == \"abababababababababababababababababababababab\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"abcdefghabcdefgh\") == \"abcdefgh\"\n assert candidate(s = \"pneumonoultramicroscopicsilicovolcanoconiosis\") == \"ic\"\n assert candidate(s = \"xylophonepianoguitarxylophonepianoguitarxylophonepianoguitar\") == \"xylophonepianoguitarxylophonepianoguitar\"\n assert candidate(s = \"aaaaabaaaaabaaaaab\") == \"aaaaabaaaaab\"\n assert candidate(s = \"mississippimississippimississippimississippimississippimississippi\") == \"mississippimississippimississippimississippimississippi\"\n assert candidate(s = \"hellohellohellohello\") == \"hellohellohello\"\n assert candidate(s = \"zxcvbnmzxcvbnmzxcvbnm\") == \"zxcvbnmzxcvbnm\"\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaa\") == \"aaaaaaaaaaaaaaaaaaa\"\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaa\") == \"aaaaaaaaaaaaaaaaaaaaaaa\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().longestDupSubstring", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var longestDupSubstring = function(s) {", "container": null, "callable": "longestDupSubstring", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1046, "task_id": "last-stone-weight", "difficulty": "Easy", "problem_description": "You are given an array of integers stones where stones[i] is the weight of the ith stone.\nWe are playing a game with the stones. On each turn, we choose the heaviest two stones and smash them together. Suppose the heaviest two stones have weights x and y with x <= y. The result of this smash is:\n\nIf x == y, both stones are destroyed, and\nIf x != y, the stone of weight x is destroyed, and the stone of weight y has new weight y - x.\n\nAt the end of the game, there is at most one stone left.\nReturn the weight of the last remaining stone. If there are no stones left, return 0.\n \nExample 1:\n\nInput: stones = [2,7,4,1,8,1]\nOutput: 1\nExplanation: \nWe combine 7 and 8 to get 1 so the array converts to [2,4,1,1,1] then,\nwe combine 2 and 4 to get 2 so the array converts to [2,1,1,1] then,\nwe combine 2 and 1 to get 1 so the array converts to [1,1,1] then,\nwe combine 1 and 1 to get 0 so the array converts to [1] then that's the value of the last stone.\n\nExample 2:\n\nInput: stones = [1]\nOutput: 1\n\n \nConstraints:\n\n1 <= stones.length <= 30\n1 <= stones[i] <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(stones = [9, 3, 2, 10, 8]) == 2\n assert candidate(stones = [5, 5, 5, 5, 5]) == 5\n assert candidate(stones = [5, 5, 5, 5, 5]) == 5\n assert candidate(stones = [3, 3, 3, 3, 3]) == 3\n assert candidate(stones = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(stones = [10, 4, 2, 10]) == 2\n assert candidate(stones = [1000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 535\n assert candidate(stones = [3, 7, 8, 9]) == 3\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(stones = [30, 1, 29, 2, 28, 3, 27, 4, 26, 5, 25, 6, 24, 7, 23, 8, 22, 9, 21, 10, 20, 11, 19, 12, 18, 13, 17, 14, 16, 15]) == 1\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(stones = [3, 3, 3, 3]) == 0\n assert candidate(stones = [10, 4, 3, 100]) == 83\n assert candidate(stones = [5, 8, 1, 2, 7]) == 1\n assert candidate(stones = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(stones = [1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 971\n assert candidate(stones = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(stones = [10, 4, 3, 100, 56, 89]) == 28\n assert candidate(stones = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000]) == 0\n assert candidate(stones = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1]) == 1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(stones = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(stones = [10, 4, 3, 100, 5]) == 78\n assert candidate(stones = [1]) == 1\n assert candidate(stones = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1]) == 1\n assert candidate(stones = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971]) == 1\n assert candidate(stones = [10, 4, 3, 100, 2]) == 81\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 1\n assert candidate(stones = [6, 6, 6, 6, 6]) == 6\n assert candidate(stones = [5, 8, 12, 9, 11, 10]) == 1\n assert candidate(stones = [1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1]) == 995\n assert candidate(stones = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(stones = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 0\n assert candidate(stones = [2, 7, 4, 1, 8, 1]) == 1\n assert candidate(stones = [299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240]) == 0\n assert candidate(stones = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 5, 3, 1]) == 1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 1\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1000]) == 971\n assert candidate(stones = [299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270]) == 1\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == 0\n assert candidate(stones = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970]) == 1\n assert candidate(stones = [5, 8, 12, 19, 22, 33, 44, 55, 66, 77, 88, 99, 100]) == 0\n assert candidate(stones = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 999, 899, 799, 699, 599, 499, 399, 299, 199, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == 76\n assert candidate(stones = [999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(stones = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(stones = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(stones = [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1]) == 499\n assert candidate(stones = [500, 400, 300, 200, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]) == 0\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 1\n assert candidate(stones = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1, 1, 1, 1, 1]) == 1\n assert candidate(stones = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60]) == 2\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300]) == 10\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 1\n assert candidate(stones = [500, 400, 300, 200, 100, 50, 25, 10, 5, 1]) == 9\n assert candidate(stones = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 2\n assert candidate(stones = [800, 700, 600, 500, 400, 300, 200, 100, 900, 850, 800, 750, 700, 650, 600, 550, 500, 450, 400, 350, 300, 250, 200, 150, 100, 50, 49, 48, 47, 46]) == 44\n assert candidate(stones = [5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 15, 14, 13, 12, 11, 20, 19, 18, 17, 16]) == 0\n assert candidate(stones = [250, 500, 750, 1000, 250, 500, 750, 1000, 250, 500, 750, 1000, 250, 500, 750, 1000, 250, 500, 750, 1000, 250, 500, 750, 1000, 250, 500, 750, 1000, 250, 500]) == 250\n assert candidate(stones = [300, 200, 100, 50, 25, 12, 6, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(stones = [800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(stones = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 45\n assert candidate(stones = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912]) == 1\n assert candidate(stones = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113]) == 1\n assert candidate(stones = [500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510]) == 1\n assert candidate(stones = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 1]) == 7\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300]) == 10\n assert candidate(stones = [800, 100, 200, 300, 400, 500, 600, 700, 900, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000]) == 100\n assert candidate(stones = [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 501]) == 499\n assert candidate(stones = [333, 666, 999, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]) == 0\n assert candidate(stones = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1]) == 0\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == 1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(stones = [500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471]) == 1\n assert candidate(stones = [999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1]) == 1\n assert candidate(stones = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 0\n assert candidate(stones = [20, 10, 5, 25, 15, 30, 35, 50, 40, 60]) == 0\n assert candidate(stones = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129]) == 1\n assert candidate(stones = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970]) == 1\n assert candidate(stones = [500, 300, 200, 400, 100, 150, 250, 600, 700, 800, 900]) == 0\n assert candidate(stones = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90]) == 3\n assert candidate(stones = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529]) == 1\n assert candidate(stones = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900]) == 100\n assert candidate(stones = [5, 8, 2, 9, 7, 3, 6, 10, 1, 4]) == 1\n assert candidate(stones = [1, 10, 100, 1000, 10, 100, 1000, 1, 10, 100, 1000, 1, 10, 100, 1000, 1, 10, 100, 1000, 1, 10, 100, 1000, 1, 10, 100, 1000, 1, 10]) == 213\n assert candidate(stones = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(stones = [1000, 500, 250, 125, 62, 31, 15, 7, 3, 1]) == 6\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 5, 10, 15, 20, 25]) == 5\n assert candidate(stones = [500, 500, 500, 500, 499, 499, 499, 499, 498, 498, 498, 498, 497, 497, 497, 497, 496, 496, 496, 496, 495, 495, 495, 495, 494, 494, 494, 494, 493, 493]) == 0\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000]) == 0\n assert candidate(stones = [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 499]) == 1\n assert candidate(stones = [2, 2, 3, 3, 5, 5, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 26, 28, 28]) == 0\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(stones = [100, 100, 100, 100, 99, 99, 99, 99, 98, 98, 98, 98]) == 0\n assert candidate(stones = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 100\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == 0\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 10\n assert candidate(stones = [300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270]) == 255\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(stones = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970]) == 955\n assert candidate(stones = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(stones = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1]) == 1\n assert candidate(stones = [1000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]) == 565\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1000, 999, 998, 997, 996, 995, 994, 993, 992, 991]) == 0\n assert candidate(stones = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1]) == 9\n assert candidate(stones = [50, 45, 40, 35, 30, 25, 20, 15, 10, 5]) == 5\n assert candidate(stones = [1000, 500, 250, 125, 62, 31, 15, 7, 3, 1]) == 6\n assert candidate(stones = [1, 1000, 2, 999, 3, 998, 4, 997, 5, 996, 6, 995, 7, 994, 8, 993, 9, 992, 10, 991, 11, 990, 12, 989, 13, 988, 14, 987]) == 0\n assert candidate(stones = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229]) == 0\n assert candidate(stones = [300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271]) == 1\n assert candidate(stones = [29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1000]) == 565\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 1\n assert candidate(stones = [300, 100, 200, 300, 100, 200, 300, 100, 200, 300, 100, 200, 300, 100, 200, 300, 100, 200, 300, 100, 200, 300, 100, 200, 300, 100, 200, 300, 100, 200]) == 0\n assert candidate(stones = [317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903, 2971215073, 4807526976, 7778742049, 12586269025, 20365011074, 32951280099, 53316291173, 86267571272, 139583862445, 225851433717, 365435296162]) == 0\n assert candidate(stones = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60]) == 2\n assert candidate(stones = [300, 200, 100, 50, 25, 12, 6, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]) == 0\n assert candidate(stones = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 0\n assert candidate(stones = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(stones = [10, 4, 6, 9, 2, 11, 3, 7, 5, 8]) == 1\n assert candidate(stones = [999, 1, 998, 2, 997, 3, 996, 4, 995, 5, 994, 6, 993, 7, 992, 8, 991, 9, 990, 10, 989, 11, 988, 12, 987, 13, 986, 14, 985, 15]) == 858\n assert candidate(stones = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971]) == 1\n assert candidate(stones = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100]) == 0\n assert candidate(stones = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) == 1\n"}, "metadata": {"canonical_parameter_names": ["stones"], "leetcode_dataset_entry_point": "Solution().lastStoneWeight", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var lastStoneWeight = function(stones) {", "container": null, "callable": "lastStoneWeight", "parameters": [{"name": "stones", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1047, "task_id": "remove-all-adjacent-duplicates-in-string", "difficulty": "Easy", "problem_description": "You are given a string s consisting of lowercase English letters. A duplicate removal consists of choosing two adjacent and equal letters and removing them.\nWe repeatedly make duplicate removals on s until we no longer can.\nReturn the final string after all such duplicate removals have been made. It can be proven that the answer is unique.\n \nExample 1:\n\nInput: s = \"abbaca\"\nOutput: \"ca\"\nExplanation: \nFor example, in \"abbaca\" we could remove \"bb\" since the letters are adjacent and equal, and this is the only possible move. The result of this move is that the string is \"aaca\", of which only \"aa\" is possible, so the final string is \"ca\".\n\nExample 2:\n\nInput: s = \"azxxzy\"\nOutput: \"ay\"\n\n \nConstraints:\n\n1 <= s.length <= 105\ns consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"acbbcaa\") == \"a\"\n assert candidate(s = \"aabbaa\") == \"\"\n assert candidate(s = \"abcdef\") == \"abcdef\"\n assert candidate(s = \"abbacdcd\") == \"cdcd\"\n assert candidate(s = \"aaaaa\") == \"a\"\n assert candidate(s = \"abbaca\") == \"ca\"\n assert candidate(s = \"a\") == \"a\"\n assert candidate(s = \"aabbccddccbaaabbccdd\") == \"ba\"\n assert candidate(s = \"\") == \"\"\n assert candidate(s = \"abcddcba\") == \"\"\n assert candidate(s = \"abba\") == \"\"\n assert candidate(s = \"zyz\") == \"zyz\"\n assert candidate(s = \"abc\") == \"abc\"\n assert candidate(s = \"abbacca\") == \"a\"\n assert candidate(s = \"abcd\") == \"abcd\"\n assert candidate(s = \"abbazzyy\") == \"\"\n assert candidate(s = \"aabbccddeeff\") == \"\"\n assert candidate(s = \"aabbcc\") == \"\"\n assert candidate(s = \"mississippi\") == \"m\"\n assert candidate(s = \"aaaaaaaaa\") == \"a\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == \"\"\n assert candidate(s = \"aaaaaaaa\") == \"\"\n assert candidate(s = \"zzzyyxxwwvvuuttrrqqqllopssmmnnllkkjjiihhggffeeddccbbaa\") == \"zqop\"\n assert candidate(s = \"aabbccdd\") == \"\"\n assert candidate(s = \"azxxzy\") == \"ay\"\n assert candidate(s = \"aabbbccddeeeffggghhhiiiijjjjkkkkllllmmmmnnnnooopppqqqqrrrrssssttttuuuuvvvvwwwwwxxxxxyyyyyzzzzz\") == \"beghopwxyz\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\") == \"\"\n assert candidate(s = \"abcdeedcba\") == \"\"\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabc\") == \"abcabcabcabcabcabcabcabcabcabc\"\n assert candidate(s = \"abcdabcdbcaabbccdd\") == \"abcdabcdbc\"\n assert candidate(s = \"xyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyx\") == \"xyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyx\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"aabbaaabbbaaaabbbaaaaabbbbbbaaaaaaaaa\") == \"a\"\n assert candidate(s = \"mississiissippi\") == \"m\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzyxwvutsrqponmlkjihgfedcba\") == \"zyxwvutsrqponmlkjihgfedcba\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba\") == \"abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba\"\n assert candidate(s = \"aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnooooppppqqqqrrrrssssttttuuuuvvvvwwwwxxxxyyyyzzzz\") == \"\"\n assert candidate(s = \"aaabbbcccdddcccbbbaaa\") == \"abcdcba\"\n assert candidate(s = \"abccbaabccbaabccbaabccbaabccbaabccbaabccbaabccba\") == \"\"\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == \"\"\n assert candidate(s = \"abacadaeafagahaiajakalamananapapaqara saratasaunaavawaxayaz\") == \"abacadaeafagahaiajakalamananapapaqara saratasaunvawaxayaz\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().removeDuplicates", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var removeDuplicates = function(s) {", "container": null, "callable": "removeDuplicates", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1048, "task_id": "longest-string-chain", "difficulty": "Medium", "problem_description": "You are given an array of words where each word consists of lowercase English letters.\nwordA is a predecessor of wordB if and only if we can insert exactly one letter anywhere in wordA without changing the order of the other characters to make it equal to wordB.\n\nFor example, \"abc\" is a predecessor of \"abac\", while \"cba\" is not a predecessor of \"bcad\".\n\nA word chain is a sequence of words [word1, word2, ..., wordk] with k >= 1, where word1 is a predecessor of word2, word2 is a predecessor of word3, and so on. A single word is trivially a word chain with k == 1.\nReturn the length of the longest possible word chain with words chosen from the given list of words.\n \nExample 1:\n\nInput: words = [\"a\",\"b\",\"ba\",\"bca\",\"bda\",\"bdca\"]\nOutput: 4\nExplanation: One of the longest word chains is [\"a\",\"ba\",\"bda\",\"bdca\"].\n\nExample 2:\n\nInput: words = [\"xbc\",\"pcxbcf\",\"xb\",\"cxbc\",\"pcxbc\"]\nOutput: 5\nExplanation: All the words can be put in a word chain [\"xb\", \"xbc\", \"cxbc\", \"pcxbc\", \"pcxbcf\"].\n\nExample 3:\n\nInput: words = [\"abcd\",\"dbqca\"]\nOutput: 1\nExplanation: The trivial word chain [\"abcd\"] is one of the longest word chains.\n[\"abcd\",\"dbqca\"] is not a valid word chain because the ordering of the letters is changed.\n\n \nConstraints:\n\n1 <= words.length <= 1000\n1 <= words[i].length <= 16\nwords[i] only consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['xbc', 'pcxbcf', 'xb', 'cxbc', 'pcxbc']) == 5\n assert candidate(words = ['a', 'b', 'ba', 'bca', 'bda', 'bdca']) == 4\n assert candidate(words = ['abcd', 'abde', 'acde', 'bcde', 'abcde']) == 2\n assert candidate(words = ['a', 'abc', 'bde', 'abdce']) == 1\n assert candidate(words = ['m', 'mo', 'moc', 'moch', 'mocha', 'lca', 'lcoa', 'lcoc', 'lococ', 'loccoc']) == 5\n assert candidate(words = ['ksqvsyqpcq', 'ksqvsyqcpcq', 'vqsqpcq', 'ksqvsyqckpcq', 'kpcq', 'cqcq', 'qpcq', 'pcqcq']) == 3\n assert candidate(words = ['ksq', 'ksqa', 'k', 'q', 'kq', 'pql', 'kqs', 'ks', 'ar', 'n', 'qn', 'kaq', 'pxq']) == 4\n assert candidate(words = ['a', 'abc', 'bcd', 'abcd', 'abcde']) == 3\n assert candidate(words = ['a', 'abc', 'bdc', 'bcd', 'abcd', 'bdca', 'edcba']) == 2\n assert candidate(words = ['abcd', 'dbqca']) == 1\n assert candidate(words = ['a', 'abc', 'bdc', 'abcde']) == 1\n assert candidate(words = ['xyz', 'xyaz', 'xyazt', 'xyaztr', 'xyaztrd', 'xyaztrdf', 'xyaztrdfg', 'xyaztrdfgh', 'xyaztrdfghj', 'xyaztrdfghjk', 'xyaztrdfghjkl', 'xyaztrdfghjklm']) == 12\n assert candidate(words = ['abcdef', 'abcde', 'abce', 'abceg', 'abeg', 'ae', 'ag', 'aeg', 'abc', 'ab', 'a', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn', 'abcdefghijklmnop']) == 14\n assert candidate(words = ['abcdef', 'abdef', 'abcdf', 'abcef', 'abcd', 'abde', 'abcdx', 'abcdey', 'abcdez', 'abcde', 'abcdfg', 'abcdegh', 'abcdeghi', 'abcdeghij', 'abcdeghijk', 'abcdeghijkl', 'abcdeghijklm', 'abcdeghijklmn', 'abcdeghijklmno', 'abcdeghijklmnop', 'abcdeghijklmnopq', 'abcdeghijklmnopqr', 'abcdeghijklmnopqrs', 'abcdeghijklmnopqrst', 'abcdeghijklmnopqrstu', 'abcdeghijklmnopqrstuv', 'abcdeghijklmnopqrstuvw', 'abcdeghijklmnopqrstuvwx', 'abcdeghijklmnopqrstuvwxy', 'abcdeghijklmnopqrstuvwxyz']) == 19\n assert candidate(words = ['z', 'az', 'azm', 'azmn', 'azmno', 'azmnop', 'azmnopq', 'azmnopqr', 'azmnopqrs', 'azmnopqrst', 'azmnopqrstu', 'azmnopqrstuv', 'azmnopqrstuvw', 'azmnopqrstuvwx', 'azmnopqrstuvwxy', 'azmnopqrstuvwxyz', 'azmnopqrstuvwxyza', 'azmnopqrstuvwxyzab', 'azmnopqrstuvwxyzabc', 'azmnopqrstuvwxyzabcd', 'azmnopqrstuvwxyzabcde', 'azmnopqrstuvwxyzabcdef', 'azmnopqrstuvwxyzabcdefg', 'azmnopqrstuvwxyzabcdefgh', 'azmnopqrstuvwxyzabcdefghi']) == 25\n assert candidate(words = ['xyz', 'xy', 'xz', 'yz', 'x', 'y', 'z', 'xyza', 'xyzab', 'xyzabc', 'xyzabcd', 'xyzabcde']) == 8\n assert candidate(words = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij']) == 10\n assert candidate(words = ['abcd', 'abdc', 'acbd', 'bacd', 'cabd', 'dabc', 'abcdx', 'abcdxy', 'abcdxyz', 'abcdxyza']) == 5\n assert candidate(words = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn', 'abcdefghijklmno', 'abcdefghijklmnop']) == 16\n assert candidate(words = ['abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn', 'abcdefghijklmno', 'abcdefghijklmnop']) == 14\n assert candidate(words = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn', 'abcdefghijklmnop', 'abcdefghijklmnopq', 'abcdefghijklmnopqr', 'abcdefghijklmnopqrs', 'abcdefghijklmnopqrst', 'abcdefghijklmnopqrstu', 'abcdefghijklmnopqrstuv', 'abcdefghijklmnopqrstuvw', 'abcdefghijklmnopqrstuvwx', 'abcdefghijklmnopqrstuvwxy', 'abcdefghijklmnopqrstuvwxyz']) == 14\n assert candidate(words = ['abc', 'def', 'ab', 'bc', 'de', 'ef', 'abcd', 'defg', 'abef', 'abcd', 'bcde', 'cdef', 'abcd', 'bcde', 'cdefg', 'defgh', 'efghi', 'fghij', 'ghijk', 'hijkl', 'ijklm', 'jklmn', 'klmno', 'lmnop', 'mnopq', 'nopqr', 'opqrs', 'pqrs', 'qrstu', 'rstuv', 'stuvw', 'tuvwx', 'uvwxy', 'vwxyz']) == 4\n assert candidate(words = ['abcd', 'abcde', 'abfde', 'abfce', 'abcfg', 'abcgd', 'abcdefgh', 'abcdfeh', 'abcdfehi', 'abcdfehij']) == 3\n assert candidate(words = ['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a']) == 1\n assert candidate(words = ['ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn', 'abcdefghijklmno', 'abcdefghijklmnop']) == 15\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwx', 'abcdefghijklmnopqrstuvw', 'abcdefghijklmnopqrstu', 'abcdefghijklmnopqrstuv', 'abcdefghijklmnopqrst', 'abcdefghijklmnopqr', 'abcdefghijklmnopq', 'abcdefghijklmnop', 'abcdefghijklmnopq', 'abcdefghijklmnopqr', 'abcdefghijklmnopqrs', 'abcdefghijklmnopqrstuv', 'abcdefghijklmnopqrstuvw', 'abcdefghijklmnopqrstuvwx', 'abcdefghijklmnopqrstuvwxy']) == 11\n assert candidate(words = ['xyz', 'xzy', 'zyx', 'yxz', 'yzx', 'zxy', 'yza', 'yab', 'yac', 'yad', 'ybc', 'ybd', 'ycd', 'yabc', 'yabd', 'yacd', 'ybcd', 'yabcd', 'yabdc', 'yacdb', 'ybcda', 'yzcdb', 'yzdcb', 'zydcb', 'zydcba', 'zydcbaq', 'zydcbaqp', 'zydcbaqpo', 'zydcbaqpon', 'zydcbaqponm', 'zydcbaqponml', 'zydcbaqponmlk', 'zydcbaqponmlkj', 'zydcbaqponmlkji', 'zydcbaqponmlkjih', 'zydcbaqponmlkjihg', 'zydcbaqponmlkjihgf']) == 14\n assert candidate(words = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh']) == 8\n assert candidate(words = ['k', 'ko', 'kom', 'komo', 'komol', 'komole', 'komolen', 'komolex', 'komolexy', 'komolexyu', 'komolexyuc', 'komolexyucn', 'komolexyucne', 'komolexyucnew', 'komolexyucnewd', 'komolexyucnewdy', 'komolexyucnewdyt']) == 16\n assert candidate(words = ['xyz', 'xyzu', 'xyzuv', 'xyzuvw', 'xyzuvwx', 'xyzuvwxy', 'xyzuvwxz', 'xyzuvwxyz', 'xyzuvwxyza', 'xyzuvwxyzab', 'xyzuvwxyzabc', 'xyzuvwxyzabcd', 'xyzuvwxyzabce', 'xyzuvwxyzabcde', 'xyzuvwxyzabcdef', 'xyzuvwxyzabcdefg']) == 14\n assert candidate(words = ['abcd', 'abdc', 'acbd', 'bacd', 'bcad', 'cabd', 'cbad', 'dabc', 'dbac', 'dcab', 'dcba', 'bdac', 'bcad', 'acdb', 'cdba', 'adbc', 'bdca', 'cadb', 'cdab', 'cbda', 'abcd', 'abdc', 'acbd', 'bacd', 'bcad', 'cabd', 'cbad', 'dabc', 'dbac', 'dcab', 'dcba', 'bdac', 'bcad', 'acdb', 'cdba', 'adbc', 'bdca', 'cadb', 'cdab', 'cbda']) == 1\n assert candidate(words = ['one', 'two', 'three', 'thre', 'threfo', 'threef', 'threefo', 'threefon', 'threefont', 'threefonto', 'threefonton', 'threefontona', 'threefontonat', 'threefontonatu', 'threefontonatup', 'threefontonatupl', 'threefontonatuplo', 'threefontonatuploe', 'threefontonatuploei', 'threefontonatuploein', 'threefontonatuploeink', 'threefontonatuploeinkf', 'threefontonatuploeinkfg', 'threefontonatuploeinkfgj', 'threefontonatuploeinkfgjo', 'threefontonatuploeinkfgjob', 'threefontonatuploeinkfgjobk']) == 24\n assert candidate(words = ['mnop', 'mno', 'mn', 'm', 'ml', 'mlp', 'mlpq', 'mlpqr', 'mlpqrs', 'mlpqrst', 'mlpqrstu', 'mlpqrstuv', 'mlpqrstuvw', 'mlpqrstuvwx', 'mlpqrstuvwxy', 'mlpqrstuvwxyza', 'mlpqrstuvwxyzaq', 'mlpqrstuvwxyzaqp', 'mlpqrstuvwxyzaqpo', 'mlpqrstuvwxyzaqpom', 'mlpqrstuvwxyzaqpomn']) == 12\n assert candidate(words = ['xyz', 'xz', 'xy', 'yz', 'x', 'y', 'z', 'xyza', 'xyzab', 'xyzabc', 'xyzabcd', 'xyzabcde']) == 8\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa', 'aaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaaa', 'aaaaaaaaaaa', 'aaaaaaaaaaaa']) == 12\n assert candidate(words = ['mn', 'mno', 'mnoa', 'mnob', 'mnoab', 'mnop', 'mnopq', 'mnopqr', 'mnopqrs', 'mnopqrst']) == 7\n assert candidate(words = ['x', 'xy', 'xyz', 'xyza', 'xyzab', 'xyzabc', 'xyzabcd', 'xyzabcde', 'xyzabcdef', 'xyzabcdefg', 'xyzabcdefgh', 'xyzabcdefghi', 'xyzabcdefghij', 'xyzabcdefghijk', 'xyzabcdefghijklm', 'xyzabcdefghijklmn', 'xyzabcdefghijklmno', 'xyzabcdefghijklmnop']) == 14\n assert candidate(words = ['z', 'zy', 'zyx', 'zyxz', 'zyxza', 'zyxzag', 'zyxzagh', 'zyxzaghd', 'zyxzaghde', 'zyxzaghdef', 'zyxzaghdefg', 'zyxzaghdefgh', 'zyxzaghdefghi', 'zyxzaghdefghj', 'zyxzaghdefghjk', 'zyxzaghdefghjkl', 'zyxzaghdefghjklm', 'zyxzaghdefghjklmn', 'zyxzaghdefghjklmno', 'zyxzaghdefghjklmnop']) == 19\n assert candidate(words = ['abcd', 'acbd', 'adcb', 'bacd', 'bcad', 'bdac', 'cabd', 'cbad', 'cdab', 'dabc', 'dbac', 'dcab']) == 1\n assert candidate(words = ['xyz', 'xyaz', 'xyazb', 'xyazbc', 'xyazbcd', 'xyazbcde', 'xyazbcdef', 'xyazbcdefg', 'xyazbcdefgh', 'xyazbcdefghi', 'xyazbcdefghij', 'xyazbcdefghijk', 'xyazbcdefghijkl', 'xyazbcdefghijklm', 'xyazbcdefghijklmn', 'xyazbcdefghijklmno']) == 16\n assert candidate(words = ['abcd', 'abdc', 'acbd', 'adbc', 'bacd', 'badc', 'bcad', 'bcda', 'bdac', 'bdca', 'cabd', 'cadb', 'cbad', 'cbda', 'cdab', 'cdba', 'dcab', 'dcba', 'abcdex', 'abdcex', 'acbdex', 'adbcex', 'bacdex', 'badcex', 'bcadex', 'bcdaex', 'bdacex', 'bdcaex', 'cabdex', 'cadbex', 'cbadex', 'cbdaex', 'cdabex', 'cdbaex', 'dcabex', 'dcbaex', 'abcdexy', 'abdcexy', 'acbdexy', 'adbcexy', 'bacdexy', 'badcexy', 'bcadexy', 'bcdaexy', 'bdacexy', 'bdcaexy', 'cabdexy', 'cadbexy', 'cbadexy', 'cbdaexy', 'cdabexy', 'cdbaexy', 'dcabexy', 'dcbaexy', 'abcdexyz', 'abdcexyz', 'acbdexyz', 'adbcexyz', 'bacdexyz', 'badcexyz', 'bcadexyz', 'bcdaexyz', 'bdacexyz', 'bdcaexyz', 'cabdexyz', 'cadbexyz', 'cbadexyz', 'cbdaexyz', 'cdabexyz', 'cdbaexyz', 'dcabexyz', 'dcbaexyz', 'abcdefghij', 'abcdefghijk', 'abcdefghijl', 'abcdefghijm', 'abcdefghijn', 'abcdefghijo', 'abcdefghijp', 'abcdefghijq', 'abcdefghijr', 'abcdefghijs', 'abcdefghijt', 'abcdefghiju', 'abcdefghijv', 'abcdefghijw', 'abcdefghijx', 'abcdefghijy', 'abcdefghijz', 'abcdefghijkq', 'abcdefghijkqr', 'abcdefghijkqrs', 'abcdefghijkqrst', 'abcdefghijkqrstu', 'abcdefghijkqrstuv', 'abcdefghijkqrstuvw', 'abcdefghijkqrstuvwx', 'abcdefghijkqrstuvwxy', 'abcdefghijkqrstuvwxyz', 'abcdefghijkqrstuvwxys', 'abcdefghijkqrstuvwxyt', 'abcdefghijkqrstuvwxysu', 'abcdefghijkqrstuvwxyts', 'abcdefghijkqrstuvwxysut', 'abcdefghijkqrstuvwxytus', 'abcdefghijkqrstuvwxysutz', 'abcdefghijkqrstuvwxytzs', 'abcdefghijkqrstuvwxytzsu', 'abcdefghijkqrstuvwxytzst', 'abcdefghijkqrstuvwxytzstu', 'abcdefghijkqrstuvwxytzstuv', 'abcdefghijkqrstuvwxytzstuvw', 'abcdefghijkqrstuvwxytzstuvwx', 'abcdefghijkqrstuvwxytzstuvwxy', 'abcdefghijkqrstuvwxytzstuvwxyz', 'abcdefghijkqrstuvwxytzstuvwxyzs', 'abcdefghijkqrstuvwxytzstuvwxyzst', 'abcdefghijkqrstuvwxytzstuvwxyzstu', 'abcdefghijkqrstuvwxytzstuvwxyzstuv', 'abcdefghijkqrstuvwxytzstuvwxyzstuvw', 'abcdefghijkqrstuvwxytzstuvwxyzstuvwx', 'abcdefghijkqrstuvwxytzstuvwxyzstuvwxy', 'abcdefghijkqrstuvwxytzstuvwxyzstuvwxyz']) == 29\n assert candidate(words = ['a', 'b', 'c', 'ab', 'bc', 'abc', 'abcd', 'abdc', 'acbd', 'bacd', 'bdac', 'cabd', 'cbad', 'dabc', 'dbac']) == 4\n assert candidate(words = ['apple', 'ape', 'aple', 'appel', 'apples', 'appl', 'applle', 'appllees']) == 4\n assert candidate(words = ['x', 'xa', 'xaz', 'xazl', 'xazld', 'xazldq', 'xazldqw', 'xazldqwj', 'xazldqwji', 'xazldqwjit', 'xazldqwjitp', 'xazldqwjitpe', 'xazldqwjitpek', 'xazldqwjitpekf', 'xazldqwjitpekfg', 'xazldqwjitpekfgh', 'xazldqwjitpekfghi', 'xazldqwjitpekfghij', 'xazldqwjitpekfghijk', 'xazldqwjitpekfghijkl', 'xazldqwjitpekfghijklm', 'xazldqwjitpekfghijklmn', 'xazldqwjitpekfghijklmno', 'xazldqwjitpekfghijklmnop', 'xazldqwjitpekfghijklmnopq', 'xazldqwjitpekfghijklmnopqr', 'xazldqwjitpekfghijklmnopqrs', 'xazldqwjitpekfghijklmnopqrst', 'xazldqwjitpekfghijklmnopqrstu', 'xazldqwjitpekfghijklmnopqrstuv', 'xazldqwjitpekfghijklmnopqrstuvw', 'xazldqwjitpekfghijklmnopqrstuvwx', 'xazldqwjitpekfghijklmnopqrstuvwxy', 'xazldqwjitpekfghijklmnopqrstuvwxyz']) == 34\n assert candidate(words = ['xyz', 'xyzz', 'xyyzz', 'xyyyzz', 'xyyyyzz', 'xyyyyyzz', 'xyyyyyyzz', 'xyyyyyzzz', 'xyyyyyyzzzz']) == 7\n assert candidate(words = ['abcd', 'abdc', 'acbd', 'bacd', 'badc', 'cabd', 'cbad', 'cdab', 'cdba', 'dcba', 'dcab', 'dbac', 'dbca']) == 1\n assert candidate(words = ['apple', 'app', 'aple', 'appl', 'applu', 'apples', 'applks', 'applksa', 'applksag', 'applksage', 'applksager', 'applksagerm']) == 6\n assert candidate(words = ['m', 'mo', 'moc', 'moch', 'mocha', 'mochas', 'mochaste', 'mochaster', 'mochastera', 'mochasteras']) == 6\n assert candidate(words = ['p', 'pq', 'pqr', 'pqrs', 'pqrst', 'pqrstu', 'pqrstuv', 'pqrstuvw', 'pqrstuvwx', 'pqrstuvwxy', 'pqrstuvwxyz', 'pqrstuvwxyza', 'pqrstuvwxyzab', 'pqrstuvwxyzabc', 'pqrstuvwxyzabcd', 'pqrstuvwxyzabcde']) == 16\n assert candidate(words = ['aa', 'aaa', 'aaaa', 'abc', 'abcd', 'abce', 'abcef', 'abcdeg', 'abcdegh', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn', 'abcdefghijklmnop', 'abcdefghijklmnopq', 'abcdefghijklmnopqr', 'abcdefghijklmnopqrs', 'abcdefghijklmnopqrst', 'abcdefghijklmnopqrstu', 'abcdefghijklmnopqrstuv', 'abcdefghijklmnopqrstuvw', 'abcdefghijklmnopqrstuvwx', 'abcdefghijklmnopqrstuvwxy', 'abcdefghijklmnopqrstuvwxyz']) == 11\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa', 'aaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaaa']) == 10\n assert candidate(words = ['aaa', 'aaab', 'aaabc', 'aab', 'aabcc', 'aabc', 'aabcd', 'aabccd', 'abc', 'abccd', 'abcd', 'abccd', 'abcde', 'abcdde', 'abcdee', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn', 'abcdefghijklmno', 'abcdefghijklmnop', 'abcdefghijklmnopq', 'abcdefghijklmnopqr', 'abcdefghijklmnopqrs', 'abcdefghijklmnopqrst', 'abcdefghijklmnopqrstu', 'abcdefghijklmnopqrstuv', 'abcdefghijklmnopqrstuvw', 'abcdefghijklmnopqrstuvwx', 'abcdefghijklmnopqrstuvwxy', 'abcdefghijklmnopqrstuvxyz']) == 23\n assert candidate(words = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn', 'abcdefghijklmno', 'abcdefghijklmnp', 'abcdefghijklmnpo', 'abcdefghijklmnpqr', 'abcdefghijklmnpqrs', 'abcdefghijklmnpqrst', 'abcdefghijklmnpqrstu', 'abcdefghijklmnpqrstuv', 'abcdefghijklmnpqrstuvw', 'abcdefghijklmnpqrstuvwx', 'abcdefghijklmnpqrstuvwxy', 'abcdefghijklmnpqrstuvwxyz']) == 16\n assert candidate(words = ['m', 'mo', 'mop', 'mopt', 'mopti', 'moptio', 'moptiop', 'moptiopi', 'moptiopim', 'moptiopimu', 'moptiopimuv', 'moptiopimuvi', 'moptiopimuvis', 'moptiopimuvisd']) == 14\n assert candidate(words = ['abcdefgh', 'abcdefg', 'abcdef', 'abcde', 'abcd', 'abc', 'ab', 'a', 'abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn', 'abcdefghijklmnop']) == 8\n assert candidate(words = ['xyz', 'xy', 'x', 'xyzpq', 'yzpq', 'ypq', 'pq', 'zpq', 'p', 'q', 'qp']) == 5\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'az', 'bz', 'cz', 'dz', 'ez', 'fz', 'gz', 'hz', 'iz', 'jz', 'kz', 'lz', 'mz', 'nz', 'oz', 'pz', 'qz', 'rz', 'sz', 'tz', 'uz', 'vz', 'wz', 'xz', 'yz', 'abc', 'bcd', 'cde', 'def', 'efg', 'fgh', 'ghi', 'hij', 'ijk', 'jkl', 'klm', 'lmn', 'mno', 'nop', 'opq', 'pqr', 'qrs', 'rst', 'stu', 'tuv', 'uvw', 'vwx', 'wxy', 'xyz']) == 3\n assert candidate(words = ['m', 'mo', 'mop', 'mops', 'mopsi', 'mopsin', 'mopsing', 'mopsing', 'mopsingh', 'mopsingha', 'mopsinghar', 'mopsinghark', 'mopsingharky', 'mopsingharkyz', 'mopsingharkyzr', 'mopsingharkyzrf', 'mopsingharkyzrfc', 'mopsingharkyzrfca', 'mopsingharkyzrfcal', 'mopsingharkyzrfcala', 'mopsingharkyzrfcalab', 'mopsingharkyzrfcalabs', 'mopsingharkyzrfcalabss', 'mopsingharkyzrfcalabsss', 'mopsingharkyzrfcalabssss', 'mopsingharkyzrfcalabsssss', 'mopsingharkyzrfcalabssssss', 'mopsingharkyzrfcalabsssssss', 'mopsingharkyzrfcalabssssssss', 'mopsingharkyzrfcalabsssssssss', 'mopsingharkyzrfcalabssssssssss', 'mopsingharkyzrfcalabsssssssssss', 'mopsingharkyzrfcalabssssssssssss', 'mopsingharkyzrfcalabsssssssssssss', 'mopsingharkyzrfcalabssssssssssssss', 'mopsingharkyzrfcalabsssssssssssssss']) == 35\n assert candidate(words = ['p', 'pa', 'pau', 'paws', 'pawst', 'pawstd', 'pawstde', 'pawstdef', 'pawstdefp', 'pawstdefpg', 'pawstdefpgm', 'pawstdefpgmn', 'pawstdefpgmno', 'pawstdefpgmnop', 'pawstdefpgmnopq', 'pawstdefpgmnopqr', 'pawstdefpgmnopqrs', 'pawstdefpgmnopqrst', 'pawstdefpgmnopqrstu', 'pawstdefpgmnopqrstuv', 'pawstdefpgmnopqrstuvw', 'pawstdefpgmnopqrstuvwx', 'pawstdefpgmnopqrstuvwxy', 'pawstdefpgmnopqrstuvwxyz']) == 21\n assert candidate(words = ['xyz', 'xz', 'xy', 'x', 'yz', 'y', 'xzpq', 'zpq', 'zq', 'pq', 'q']) == 4\n assert candidate(words = ['abcdef', 'abcde', 'abcd', 'abc', 'ab', 'a', 'aghij', 'aghi', 'agh', 'ag', 'a', 'agghij', 'agghijr', 'agghijrk', 'agghijrkm', 'agghijrkmp', 'agghijrkmpa', 'agghijrkmpab', 'agghijrkmpabc', 'agghijrkmpabcd']) == 14\n assert candidate(words = ['aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa', 'aaaaaaaa', 'aaaaaaaaa', 'aaaaaaaaaa', 'aaaaaaaaaaa', 'aaaaaaaaaaaa', 'aaaaaaaaaaaaa', 'aaaaaaaaaaaaaa', 'aaaaaaaaaaaaaaa', 'aaaaaaaaaaaaaaaa', 'aaaaaaaaaaaaaaaaa', 'aaaaaaaaaaaaaaaaaa']) == 17\n assert candidate(words = ['q', 'qz', 'qzh', 'qzhd', 'qzhdr', 'qzhdre', 'qzhdrec', 'qzhdrecu', 'qzhdrecuj', 'qzhdrecuju', 'qzhdrecujuu', 'qzhdrecujuus']) == 12\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh', 'ii', 'jj', 'kk', 'll', 'mm', 'nn', 'oo', 'pp', 'qq', 'rr', 'ss', 'tt', 'uu', 'vv', 'ww', 'xx', 'yy', 'zz']) == 2\n assert candidate(words = ['abc', 'bca', 'cab', 'abcd', 'bcad', 'cabd', 'acbd', 'bacd', 'badc', 'bcda', 'acdb', 'cadb', 'cbad', 'cbda', 'cdab', 'cdba', 'dcab', 'dcba', 'dabc', 'dacb', 'dbac', 'dbca', 'dcab', 'dcba', 'abcdx', 'bcadx', 'cabdx', 'abcxd', 'bcadcx', 'cabdcx', 'acbdcx', 'bacdcx', 'bacdx', 'bcadcx', 'bcadxc', 'cabdxc', 'acbdcx', 'bacdxc', 'bacdx', 'bcadxc', 'bcadcx', 'bcadxc', 'abcde', 'bcade', 'cabde', 'acbed', 'bacde', 'baced', 'bcade', 'bcdea', 'cabde', 'cabed', 'cbade', 'cbdea', 'cdabe', 'cdbe', 'cdba', 'dcab', 'dcba', 'abcd', 'bcad', 'cabd', 'acbd', 'bacd', 'badc', 'bcda', 'acdb', 'cadb', 'cbad', 'cbda', 'cdab', 'cdba', 'dcab', 'dcba', 'dabc', 'dacb', 'dbac', 'dbca', 'dcab', 'dcba', 'xyz', 'xyaz', 'xyazb', 'xyazbc', 'xyazbcd', 'xyazbcde', 'xyazbcdef', 'xyazbcdefg', 'xyazbcdefgh', 'xyazbcdefghi', 'xyazbcdefghij', 'xyazbcdefghijk', 'xyazbcdefghijkl', 'xyazbcdefghijklm', 'xyazbcdefghijklmn', 'xyazbcdefghijklmno']) == 16\n assert candidate(words = ['a', 'b', 'ab', 'bc', 'abc', 'abcd', 'bcde', 'cde', 'efg', 'fgh', 'efgh', 'efghi', 'efghij']) == 4\n assert candidate(words = ['mnop', 'mno', 'mo', 'mn', 'm', 'on', 'om', 'op', 'pn', 'po', 'np', 'no', 'p', 'o', 'n']) == 4\n assert candidate(words = ['jkl', 'jkla', 'jklo', 'jkloi', 'jkloip', 'jkloipq', 'jkloipqr', 'jkloipqrs', 'jkloipqrst', 'jkloipqrstu', 'jkloipqrstuv', 'jkloipqrstuvw', 'jkloipqrstuvwx', 'jkloipqrstuvwxy', 'jkloipqrstuvwxyz', 'jkloipqrstuvwxyzv', 'jkloipqrstuvwxyza', 'jkloipqrstuvwxyzab', 'jkloipqrstuvwxyzabc', 'jkloipqrstuvwxyzabcd', 'jkloipqrstuvwxyzabcde', 'jkloipqrstuvwxyzabcdef', 'jkloipqrstuvwxyzabcdefg', 'jkloipqrstuvwxyzabcdefgh', 'jkloipqrstuvwxyzabcdefghi', 'jkloipqrstuvwxyzabcdefghij']) == 24\n assert candidate(words = ['abcd', 'abcde', 'abcdef', 'abcdf', 'abcdg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk']) == 4\n assert candidate(words = ['abcd', 'abdc', 'abacd', 'abcd', 'abac', 'abcde', 'abcfde', 'abcdefg', 'abcdegh']) == 3\n assert candidate(words = ['abc', 'ab', 'bc', 'abcde', 'abde', 'acde', 'cde', 'a', 'b', 'c', 'd', 'e']) == 3\n assert candidate(words = ['z', 'yz', 'xyz', 'wxyz', 'vwxyz', 'uvwxy', 'uvwx', 'uvx', 'ux', 'x', 'pq', 'pqr', 'pqrs', 'pqrsu', 'pqrstuv', 'pqrstuvw', 'pqrstuvwx', 'pqrstuvwxy', 'pqrstuvwxyz', 'abcdefghijkl', 'abcdefghij', 'abcdefghijk', 'abcdefghijklm', 'abcdefghijklmn', 'abcdefghijklmnop']) == 5\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == 1\n assert candidate(words = ['qwe', 'qwerty', 'qwertyu', 'qwertyui', 'qwertyuio', 'qwertyuiop', 'qwertyuiopl', 'qwertyuioplk', 'qwertyuioplkj', 'qwertyuioplkjh', 'qwertyuioplkjhg', 'qwertyuioplkjhgfd', 'qwertyuioplkjhgfdc', 'qwertyuioplkjhgfdcv', 'qwertyuioplkjhgfdcvb', 'qwertyuioplkjhgfdcvbn', 'qwertyuioplkjhgfdcvbnn', 'qwertyuioplkjhgfdcvbnm']) == 10\n assert candidate(words = ['k', 'a', 'b', 'ka', 'kb', 'abc', 'bcd', 'abcd', 'bcde', 'abcde', 'fgh', 'ghij', 'hijk', 'ijkl', 'jklm', 'klmn', 'lmno', 'mnop', 'nopq', 'opqr', 'pqr', 'pqrs', 'qrst', 'rstu', 'stuv', 'tuvw', 'uvwx', 'vwxy', 'wxyz']) == 3\n assert candidate(words = ['abcd', 'abce', 'abcf', 'abcg', 'abch', 'abci', 'abcfi', 'abcei', 'abceg', 'abcef', 'abcefj', 'abcefg', 'abcefgk', 'abcefgkl', 'abcefgklm', 'abcefgklmn', 'abcefgklmno', 'abcefgklmnop', 'abcefgklmnopq', 'abcefgklmnopqr', 'abcefgklmnopqrs', 'abcefgklmnopqrst', 'abcefgklmnopqrstu', 'abcefgklmnopqrstuv', 'abcefgklmnopqrstuvw', 'abcefgklmnopqrstuvwx', 'abcefgklmnopqrstuvwxy', 'abcefgklmnopqrstuvwxyz']) == 19\n assert candidate(words = ['aaaaab', 'aaab', 'aab', 'ab', 'b', 'ba', 'aba', 'abab', 'ababa', 'ababab', 'abababa', 'abababab', 'ababababa', 'ababababab']) == 10\n assert candidate(words = ['mnop', 'mno', 'mn', 'mnoq', 'mnopqr', 'mnopqrs', 'mnopqrst', 'mnopqrstu', 'mnopqrstuv', 'mnopqrstuvw', 'mnopqrstuvwx', 'mnopqrstuvwxz']) == 8\n assert candidate(words = ['xy', 'xyc', 'xyz', 'xyzq', 'xyzqr', 'xyzqrs', 'xyzqrst', 'xyzqrstuv', 'xyzqrstuvw', 'xyzqrstuvwx', 'xyzqrstuvwxy', 'xyzqrstuvwxyz', 'xyzqrstuvwxys', 'xyzqrstuvwxyt', 'xyzqrstuvwxysu', 'xyzqrstuvwxyts', 'xyzqrstuvwxysut', 'xyzqrstuvwxytus', 'xyzqrstuvwxysutz', 'xyzqrstuvwxytzs', 'xyzqrstuvwxytzsu', 'xyzqrstuvwxytzst', 'xyzqrstuvwxytzstu', 'xyzqrstuvwxytzstuv', 'xyzqrstuvwxytzstuvw', 'xyzqrstuvwxytzstuvwx', 'xyzqrstuvwxytzstuvwxy', 'xyzqrstuvwxytzstuvwxyz', 'xyzqrstuvwxytzstuvwxyzs', 'xyzqrstuvwxytzstuvwxyzst', 'xyzqrstuvwxytzstuvwxyzstu', 'xyzqrstuvwxytzstuvwxyzstuv', 'xyzqrstuvwxytzstuvwxyzstuvw', 'xyzqrstuvwxytzstuvwxyzstuvwx', 'xyzqrstuvwxytzstuvwxyzstuvwxy', 'xyzqrstuvwxytzstuvwxyzstuvwxyz']) == 22\n assert candidate(words = ['mno', 'mnop', 'mnop', 'mnopq', 'mnopqr', 'mnopqrs', 'mnopqrst', 'mnopqrstu', 'mnopqrstuv', 'mnopqrstuvw', 'mnopqrstuvwx', 'mnopqrstuvwxy', 'mnopqrstuvwxyz', 'mnopqrstuvwxyza', 'mnopqrstuvwxyzab', 'mnopqrstuvwxyzabc', 'mnopqrstuvwxyzabcd', 'mnopqrstuvwxyzabcde', 'mnopqrstuvwxyzabcdef', 'mnopqrstuvwxyzabcdefg', 'mnopqrstuvwxyzabcdefgh', 'mnopqrstuvwxyzabcdefghi', 'mnopqrstuvwxyzabcdefghij', 'mnopqrstuvwxyzabcdefghijk', 'mnopqrstuvwxyzabcdefghijkl', 'mnopqrstuvwxyzabcdefghijklm', 'mnopqrstuvwxyzabcdefghijklmn', 'mnopqrstuvwxyzabcdefghijklmno', 'mnopqrstuvwxyzabcdefghijklmnop', 'mnopqrstuvwxyzabcdefghijklmnopq', 'mnopqrstuvwxyzabcdefghijklmnopqr', 'mnopqrstuvwxyzabcdefghijklmnopqrs', 'mnopqrstuvwxyzabcdefghijklmnopqrst', 'mnopqrstuvwxyzabcdefghijklmnopqrstu', 'mnopqrstuvwxyzabcdefghijklmnopqrstuv', 'mnopqrstuvwxyzabcdefghijklmnopqrstuvw', 'mnopqrstuvwxyzabcdefghijklmnopqrstuvwx', 'mnopqrstuvwxyzabcdefghijklmnopqrstuvwxy', 'mnopqrstuvwxyzabcdefghijklmnopqrstuvwxyza']) == 37\n assert candidate(words = ['abcdef', 'abef', 'abcf', 'acdf', 'adef', 'abdf', 'abefg', 'abecf', 'abedf', 'abcef', 'abcdf', 'abdef', 'abcdefg']) == 4\n assert candidate(words = ['zyx', 'zyxa', 'zyxb', 'zyxc', 'zyxd', 'zyxe', 'zyxf', 'zyxg', 'zyxh', 'zyxi', 'zyxj', 'zyxk', 'zyxl', 'zyxm', 'zyxn', 'zyxo', 'zyxp', 'zyxq', 'zyxr', 'zyxs', 'zyxt', 'zyxu', 'zyxv', 'zyxw', 'zyxx', 'zyxy', 'zyxz']) == 2\n assert candidate(words = ['xyz', 'xz', 'xy', 'x', 'wxyz', 'wxz', 'wxy', 'wx', 'w', 'vxyz', 'vxz', 'vxy', 'vx', 'v', 'uvxyz', 'uvxz', 'uvxy', 'uvx', 'uv', 'tuvsxyz', 'tuvsxz', 'tuvsxy', 'tuvsx', 'tuvs', 'tuvxyz', 'tuvxz', 'tuvxy', 'tuvx', 'tuv', 'stuvxyz', 'stuvxz', 'stuvxy', 'stuvx', 'stuv', 'stuvxyz', 'stuvxz', 'stuvxy', 'stuvx', 'stuv']) == 7\n assert candidate(words = ['abcd', 'acbd', 'adcb', 'bacd', 'bcad', 'cabd', 'cbad', 'cdab', 'cdba', 'dcba', 'dcab', 'dbac', 'dbca', 'abcdxyz', 'abcdeyz', 'abcdefz', 'abcdefw']) == 1\n"}, "metadata": {"canonical_parameter_names": ["words"], "leetcode_dataset_entry_point": "Solution().longestStrChain", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var longestStrChain = function(words) {", "container": null, "callable": "longestStrChain", "parameters": [{"name": "words", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1049, "task_id": "last-stone-weight-ii", "difficulty": "Medium", "problem_description": "You are given an array of integers stones where stones[i] is the weight of the ith stone.\nWe are playing a game with the stones. On each turn, we choose any two stones and smash them together. Suppose the stones have weights x and y with x <= y. The result of this smash is:\n\nIf x == y, both stones are destroyed, and\nIf x != y, the stone of weight x is destroyed, and the stone of weight y has new weight y - x.\n\nAt the end of the game, there is at most one stone left.\nReturn the smallest possible weight of the left stone. If there are no stones left, return 0.\n \nExample 1:\n\nInput: stones = [2,7,4,1,8,1]\nOutput: 1\nExplanation:\nWe can combine 2 and 4 to get 2, so the array converts to [2,7,1,8,1] then,\nwe can combine 7 and 8 to get 1, so the array converts to [2,1,1,1] then,\nwe can combine 2 and 1 to get 1, so the array converts to [1,1,1] then,\nwe can combine 1 and 1 to get 0, so the array converts to [1], then that's the optimal value.\n\nExample 2:\n\nInput: stones = [31,26,33,21,40]\nOutput: 5\n\n \nConstraints:\n\n1 <= stones.length <= 30\n1 <= stones[i] <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(stones = [10, 10, 10, 10, 10]) == 10\n assert candidate(stones = [3, 9, 7, 3]) == 2\n assert candidate(stones = [1, 2, 3, 4, 5]) == 1\n assert candidate(stones = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 0\n assert candidate(stones = [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(stones = [100, 1]) == 99\n assert candidate(stones = [31, 26, 33, 21, 40]) == 5\n assert candidate(stones = [15, 10, 5, 10, 10]) == 0\n assert candidate(stones = [1, 100, 100, 1]) == 0\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(stones = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(stones = [10, 10, 10, 10]) == 0\n assert candidate(stones = [1]) == 1\n assert candidate(stones = [2, 7, 4, 1, 8, 1]) == 1\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 0\n assert candidate(stones = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == 65\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 0\n assert candidate(stones = [9, 3, 9, 8, 7, 8, 5, 4]) == 1\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145]) == 5\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 1\n assert candidate(stones = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 9\n assert candidate(stones = [50, 25, 25, 75, 100, 50]) == 25\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == 0\n assert candidate(stones = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]) == 1\n assert candidate(stones = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70]) == 1\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]) == 0\n assert candidate(stones = [49, 98, 147, 196, 245, 294, 343, 392, 441, 490]) == 49\n assert candidate(stones = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40]) == 15\n assert candidate(stones = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]) == 0\n assert candidate(stones = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == 1\n assert candidate(stones = [29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10]) == 0\n assert candidate(stones = [100, 1, 200, 2, 300, 3, 400, 4, 500, 5, 600, 6, 700, 7, 800, 8, 900, 9, 1000, 10, 1100, 11, 1200, 12, 1300, 13, 1400, 14]) == 1\n assert candidate(stones = [8, 14, 22, 26, 28, 30, 35, 40, 43, 45, 47, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 1\n assert candidate(stones = [45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(stones = [50, 45, 40, 35, 30, 25, 20, 15, 10, 5]) == 5\n assert candidate(stones = [1, 100, 2, 99, 3, 98, 4, 97, 5, 96, 6, 95, 7, 94, 8, 93, 9, 92, 10, 91, 11, 90, 12, 89, 13, 88]) == 1\n assert candidate(stones = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113]) == 1\n assert candidate(stones = [10, 22, 33, 44, 55, 66, 77, 88, 99, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300]) == 0\n assert candidate(stones = [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 0\n assert candidate(stones = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80]) == 0\n assert candidate(stones = [80, 20, 60, 40, 30, 70, 50, 10, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290]) == 10\n assert candidate(stones = [88, 77, 66, 55, 44, 33, 22, 11, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300]) == 0\n assert candidate(stones = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 1\n assert candidate(stones = [91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(stones = [8, 3, 5, 7, 11, 9, 14, 16, 2, 6]) == 1\n assert candidate(stones = [1, 100, 1, 100, 1, 100, 1, 100, 1, 100]) == 95\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 10\n assert candidate(stones = [29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(stones = [8, 8, 8, 8, 8, 8, 8, 8]) == 0\n assert candidate(stones = [50, 50, 50, 50, 50, 50, 50]) == 50\n assert candidate(stones = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) == 1\n assert candidate(stones = [8, 6, 7, 5, 3, 0, 9]) == 0\n assert candidate(stones = [12, 13, 14, 15, 16, 17, 18, 19, 20]) == 0\n assert candidate(stones = [99, 1, 100, 1, 100, 1, 100, 1, 100]) == 95\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(stones = [100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 45\n assert candidate(stones = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == 1\n assert candidate(stones = [2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6]) == 0\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 10\n assert candidate(stones = [29, 10, 15, 30, 25, 5]) == 4\n assert candidate(stones = [10, 14, 10, 4, 7, 12]) == 1\n assert candidate(stones = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91]) == 1\n assert candidate(stones = [5, 8, 12, 9, 15, 20, 18]) == 1\n assert candidate(stones = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71]) == 1\n assert candidate(stones = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30]) == 0\n assert candidate(stones = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30]) == 0\n assert candidate(stones = [100, 1, 2, 3, 99]) == 1\n assert candidate(stones = [20, 30, 40, 50, 60, 70]) == 10\n assert candidate(stones = [100, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 72\n assert candidate(stones = [30, 20, 10, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(stones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(stones = [100, 1, 99, 2, 98, 3, 97, 4]) == 0\n assert candidate(stones = [29, 22, 24, 27, 30, 31, 28, 25, 21, 20]) == 1\n assert candidate(stones = [12, 13, 14, 15, 16, 17, 18, 19, 20, 21]) == 1\n assert candidate(stones = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 0\n assert candidate(stones = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(stones = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6]) == 0\n assert candidate(stones = [20, 15, 10, 5, 30, 25, 40, 50]) == 5\n assert candidate(stones = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000]) == 8888889\n assert candidate(stones = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 5\n assert candidate(stones = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]) == 0\n assert candidate(stones = [100, 50, 25, 12, 6, 3, 1]) == 3\n assert candidate(stones = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 0\n assert candidate(stones = [25, 25, 25, 25, 25, 25, 25, 25]) == 0\n assert candidate(stones = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10]) == 0\n assert candidate(stones = [100, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 55\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10]) == 0\n assert candidate(stones = [50, 49, 51, 48, 52]) == 44\n assert candidate(stones = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 0\n assert candidate(stones = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 100]) == 13\n assert candidate(stones = [8, 14, 17, 31, 56, 13, 29]) == 2\n assert candidate(stones = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 50\n assert candidate(stones = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]) == 1\n assert candidate(stones = [9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 1\n assert candidate(stones = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113]) == 1\n assert candidate(stones = [2, 3, 7, 8, 10, 12, 15, 18, 20, 25]) == 0\n assert candidate(stones = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 50\n assert candidate(stones = [100, 99, 98, 97, 96, 95]) == 1\n"}, "metadata": {"canonical_parameter_names": ["stones"], "leetcode_dataset_entry_point": "Solution().lastStoneWeightII", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var lastStoneWeightII = function(stones) {", "container": null, "callable": "lastStoneWeightII", "parameters": [{"name": "stones", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1051, "task_id": "height-checker", "difficulty": "Easy", "problem_description": "A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreasing order by height. Let this ordering be represented by the integer array expected where expected[i] is the expected height of the ith student in line.\nYou are given an integer array heights representing the current order that the students are standing in. Each heights[i] is the height of the ith student in line (0-indexed).\nReturn the number of indices where heights[i] != expected[i].\n \nExample 1:\n\nInput: heights = [1,1,4,2,1,3]\nOutput: 3\nExplanation: \nheights: [1,1,4,2,1,3]\nexpected: [1,1,1,2,3,4]\nIndices 2, 4, and 5 do not match.\n\nExample 2:\n\nInput: heights = [5,1,2,3,4]\nOutput: 5\nExplanation:\nheights: [5,1,2,3,4]\nexpected: [1,2,3,4,5]\nAll indices do not match.\n\nExample 3:\n\nInput: heights = [1,2,3,4,5]\nOutput: 0\nExplanation:\nheights: [1,2,3,4,5]\nexpected: [1,2,3,4,5]\nAll indices match.\n\n \nConstraints:\n\n1 <= heights.length <= 100\n1 <= heights[i] <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(heights = [1]) == 0\n assert candidate(heights = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(heights = [1, 2, 1, 2]) == 2\n assert candidate(heights = [3, 3, 3, 3, 3]) == 0\n assert candidate(heights = [1, 2, 3, 4, 5]) == 0\n assert candidate(heights = [1, 100, 1, 100, 1]) == 2\n assert candidate(heights = [3, 2, 1]) == 2\n assert candidate(heights = [1, 2, 3, 5, 4]) == 2\n assert candidate(heights = [5, 1, 2, 3, 4]) == 5\n assert candidate(heights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(heights = [1, 1, 2, 2, 3, 3, 4, 4]) == 0\n assert candidate(heights = [1, 1, 4, 2, 1, 3]) == 3\n assert candidate(heights = [1, 2, 2, 3, 3, 4]) == 0\n assert candidate(heights = [100, 99, 98, 97, 96]) == 4\n assert candidate(heights = [3, 1, 2]) == 3\n assert candidate(heights = [1, 1, 1, 1, 1]) == 0\n assert candidate(heights = [1, 3, 2]) == 2\n assert candidate(heights = [3, 3, 3, 3, 3, 3]) == 0\n assert candidate(heights = [10, 20, 30, 40, 50]) == 0\n assert candidate(heights = [1, 2, 2, 3, 3, 4, 4]) == 0\n assert candidate(heights = [10, 1, 20, 2, 30, 3]) == 6\n assert candidate(heights = [5, 2, 3, 1, 4]) == 3\n assert candidate(heights = [1, 3, 2, 4, 5]) == 2\n assert candidate(heights = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 1, 2, 2, 3, 3]) == 24\n assert candidate(heights = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 1]) == 20\n assert candidate(heights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 35\n assert candidate(heights = [1, 3, 2, 2, 5, 3, 4]) == 5\n assert candidate(heights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 0\n assert candidate(heights = [30, 20, 10, 50, 40, 15, 5, 25, 35, 45]) == 10\n assert candidate(heights = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11]) == 0\n assert candidate(heights = [1, 3, 2, 4, 5, 3, 2, 1, 5, 4, 3, 2, 1, 4, 3, 2, 1, 3, 2, 1]) == 16\n assert candidate(heights = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10]) == 0\n assert candidate(heights = [1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5]) == 0\n assert candidate(heights = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == 0\n assert candidate(heights = [5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4]) == 49\n assert candidate(heights = [2, 2, 2, 1, 1, 1, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == 6\n assert candidate(heights = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 0\n assert candidate(heights = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 0\n assert candidate(heights = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91]) == 10\n assert candidate(heights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 18\n assert candidate(heights = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(heights = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 20\n assert candidate(heights = [100, 1, 99, 2, 98, 3, 97, 4, 96, 5, 95, 6, 94, 7, 93, 8, 92, 9, 91, 10]) == 20\n assert candidate(heights = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2\n assert candidate(heights = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81]) == 20\n assert candidate(heights = [34, 23, 12, 45, 67, 89, 12, 34, 56, 78, 90, 12, 34, 56, 78, 90]) == 13\n assert candidate(heights = [3, 1, 2, 4, 6, 5, 8, 7, 10, 9]) == 9\n assert candidate(heights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == 0\n assert candidate(heights = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 6\n assert candidate(heights = [3, 2, 1, 4, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19]) == 18\n assert candidate(heights = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 2, 2]) == 16\n assert candidate(heights = [99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100]) == 56\n assert candidate(heights = [1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1]) == 108\n assert candidate(heights = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 20]) == 18\n assert candidate(heights = [10, 10, 10, 10, 10, 10, 10]) == 0\n assert candidate(heights = [100, 1, 100, 2, 100, 3, 100, 4, 100, 5, 100, 6, 100, 7, 100, 8, 100, 9, 100, 10]) == 15\n assert candidate(heights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 0\n assert candidate(heights = [50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53]) == 0\n assert candidate(heights = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50]) == 50\n assert candidate(heights = [5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5]) == 18\n assert candidate(heights = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 24\n assert candidate(heights = [3, 3, 2, 1, 3, 2, 3, 1, 3]) == 5\n assert candidate(heights = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 62\n assert candidate(heights = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(heights = [5, 3, 8, 6, 7, 2, 4, 1, 9, 10]) == 8\n assert candidate(heights = [2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(heights = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70]) == 30\n assert candidate(heights = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10]) == 10\n assert candidate(heights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(heights = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 0\n assert candidate(heights = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1]) == 16\n assert candidate(heights = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 19\n assert candidate(heights = [1, 100, 2, 99, 3, 98, 4, 97, 5, 96, 6, 95, 7, 94, 8, 93, 9, 92, 10, 91]) == 18\n assert candidate(heights = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(heights = [10, 20, 30, 40, 50, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 20\n assert candidate(heights = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 0\n assert candidate(heights = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5]) == 0\n assert candidate(heights = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 18\n assert candidate(heights = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(heights = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4]) == 0\n assert candidate(heights = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]) == 0\n assert candidate(heights = [10, 20, 10, 30, 20, 40, 30, 50, 40, 60, 50, 70, 60, 80, 70, 90, 80, 100, 90, 110]) == 18\n assert candidate(heights = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 18\n assert candidate(heights = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80]) == 20\n assert candidate(heights = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(heights = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10]) == 17\n assert candidate(heights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 0\n assert candidate(heights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(heights = [30, 10, 20, 40, 60, 50, 70, 80, 90, 100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 17\n assert candidate(heights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 18\n assert candidate(heights = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 18\n assert candidate(heights = [34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34]) == 0\n assert candidate(heights = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 40\n assert candidate(heights = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(heights = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 16\n assert candidate(heights = [5, 3, 4, 1, 2, 3, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 17\n assert candidate(heights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 0\n assert candidate(heights = [34, 56, 23, 89, 12, 33, 21, 67, 45, 90]) == 7\n assert candidate(heights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5]) == 24\n assert candidate(heights = [1, 3, 2, 2, 5, 4, 7, 6, 8, 9]) == 6\n assert candidate(heights = [3, 3, 2, 1, 1, 1, 2, 3, 4, 5, 5, 5, 4, 3, 2, 1, 1, 2, 3, 4]) == 16\n assert candidate(heights = [5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1]) == 12\n assert candidate(heights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(heights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(heights = [7, 8, 9, 10, 11, 5, 6, 4, 3, 2, 1]) == 11\n assert candidate(heights = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80]) == 20\n assert candidate(heights = [2, 1, 2, 1, 1, 2, 2, 1]) == 4\n assert candidate(heights = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 0\n assert candidate(heights = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0\n assert candidate(heights = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2]) == 15\n assert candidate(heights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 26\n assert candidate(heights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 18\n assert candidate(heights = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1]) == 38\n assert candidate(heights = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 100\n assert candidate(heights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n"}, "metadata": {"canonical_parameter_names": ["heights"], "leetcode_dataset_entry_point": "Solution().heightChecker", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var heightChecker = function(heights) {", "container": null, "callable": "heightChecker", "parameters": [{"name": "heights", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1052, "task_id": "grumpy-bookstore-owner", "difficulty": "Medium", "problem_description": "There is a bookstore owner that has a store open for n minutes. You are given an integer array customers of length n where customers[i] is the number of the customers that enter the store at the start of the ith minute and all those customers leave after the end of that minute.\nDuring certain minutes, the bookstore owner is grumpy. You are given a binary array grumpy where grumpy[i] is 1 if the bookstore owner is grumpy during the ith minute, and is 0 otherwise.\nWhen the bookstore owner is grumpy, the customers entering during that minute are not satisfied. Otherwise, they are satisfied.\nThe bookstore owner knows a secret technique to remain not grumpy for minutes consecutive minutes, but this technique can only be used once.\nReturn the maximum number of customers that can be satisfied throughout the day.\n \nExample 1:\n\nInput: customers = [1,0,1,2,1,1,7,5], grumpy = [0,1,0,1,0,1,0,1], minutes = 3\nOutput: 16\nExplanation:\nThe bookstore owner keeps themselves not grumpy for the last 3 minutes.\nThe maximum number of customers that can be satisfied = 1 + 1 + 1 + 1 + 7 + 5 = 16.\n\nExample 2:\n\nInput: customers = [1], grumpy = [0], minutes = 1\nOutput: 1\n\n \nConstraints:\n\nn == customers.length == grumpy.length\n1 <= minutes <= n <= 2 * 104\n0 <= customers[i] <= 1000\ngrumpy[i] is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(customers = [3, 1, 4, 2, 2],grumpy = [0, 0, 1, 1, 1],minutes = 1) == 8\n assert candidate(customers = [5, 5, 5, 5, 5],grumpy = [0, 0, 0, 0, 0],minutes = 1) == 25\n assert candidate(customers = [2, 3, 4, 5],grumpy = [1, 0, 1, 1],minutes = 2) == 12\n assert candidate(customers = [2, 3, 4, 5, 6],grumpy = [1, 0, 1, 0, 1],minutes = 2) == 14\n assert candidate(customers = [2, 3, 4, 5],grumpy = [1, 0, 1, 0],minutes = 2) == 12\n assert candidate(customers = [10, 20, 30, 40, 50],grumpy = [0, 1, 0, 1, 0],minutes = 1) == 130\n assert candidate(customers = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 5) == 25\n assert candidate(customers = [2, 4, 2, 5, 0],grumpy = [0, 1, 0, 1, 1],minutes = 2) == 9\n assert candidate(customers = [1, 2, 3, 4, 5],grumpy = [1, 0, 1, 0, 1],minutes = 4) == 14\n assert candidate(customers = [5, 5, 5, 5, 5, 5],grumpy = [1, 1, 1, 1, 1, 1],minutes = 2) == 10\n assert candidate(customers = [10, 1, 2, 3, 4, 5],grumpy = [1, 0, 1, 0, 1, 0],minutes = 2) == 19\n assert candidate(customers = [1, 0, 1, 2, 1, 1, 7, 5],grumpy = [0, 1, 0, 1, 0, 1, 0, 1],minutes = 3) == 16\n assert candidate(customers = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 5) == 50\n assert candidate(customers = [1],grumpy = [0],minutes = 1) == 1\n assert candidate(customers = [2, 3, 4, 5],grumpy = [1, 1, 1, 1],minutes = 2) == 9\n assert candidate(customers = [10, 20, 30, 40, 50],grumpy = [0, 1, 0, 1, 0],minutes = 4) == 150\n assert candidate(customers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],grumpy = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],minutes = 5) == 55\n assert candidate(customers = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 1) == 10\n assert candidate(customers = [1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1],grumpy = [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],minutes = 4) == 8\n assert candidate(customers = [15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 7) == 1140\n assert candidate(customers = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],grumpy = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1],minutes = 3) == 60\n assert candidate(customers = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 5) == 35\n assert candidate(customers = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 10) == 550\n assert candidate(customers = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],grumpy = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1],minutes = 5) == 45\n assert candidate(customers = [90, 0, 40, 0, 20, 0, 70, 0, 50, 0, 10, 0, 30, 0, 60, 0, 80, 0, 100, 0],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 5) == 240\n assert candidate(customers = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],grumpy = [1, 1, 1, 1, 0, 0, 0, 0, 1, 1],minutes = 5) == 4500\n assert candidate(customers = [999, 888, 777, 666, 555, 444, 333, 222, 111, 0, 111, 222, 333, 444, 555],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],minutes = 7) == 6438\n assert candidate(customers = [100, 0, 100, 0, 100, 0, 100, 0, 100, 0],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 4) == 500\n assert candidate(customers = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 10) == 100\n assert candidate(customers = [9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99, 108, 117, 126, 135],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],minutes = 7) == 828\n assert candidate(customers = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130],grumpy = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1],minutes = 6) == 770\n assert candidate(customers = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],grumpy = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],minutes = 10) == 20\n assert candidate(customers = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 7) == 110\n assert candidate(customers = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 3) == 4300\n assert candidate(customers = [5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1],grumpy = [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],minutes = 5) == 25\n assert candidate(customers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 7) == 108\n assert candidate(customers = [30, 20, 10, 0, 5, 15, 25, 35, 45, 55],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 5) == 200\n assert candidate(customers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],grumpy = [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],minutes = 5) == 105\n assert candidate(customers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],grumpy = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],minutes = 10) == 45\n assert candidate(customers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 2) == 19\n assert candidate(customers = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 5) == 490\n assert candidate(customers = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 9) == 1850\n assert candidate(customers = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],grumpy = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],minutes = 8) == 354\n assert candidate(customers = [50, 25, 75, 100, 50, 25, 75, 100, 50, 25, 75, 100],grumpy = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],minutes = 4) == 600\n assert candidate(customers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],grumpy = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 7) == 174\n assert candidate(customers = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 6) == 189\n assert candidate(customers = [5, 3, 8, 2, 10, 15, 7, 1, 4, 6],grumpy = [0, 1, 1, 0, 1, 0, 1, 1, 0, 1],minutes = 4) == 47\n assert candidate(customers = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],grumpy = [0, 0, 0, 1, 1, 1, 1, 1, 1, 0],minutes = 3) == 4000\n assert candidate(customers = [3, 5, 0, 4, 7, 9, 6, 2, 5, 8],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 4) == 34\n assert candidate(customers = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],grumpy = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],minutes = 3) == 45\n assert candidate(customers = [200, 150, 100, 50, 0, 50, 100, 150, 200],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 3) == 700\n assert candidate(customers = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 5) == 10\n assert candidate(customers = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 3) == 79\n assert candidate(customers = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 3) == 60\n assert candidate(customers = [5, 1, 3, 4, 6, 2, 7, 8, 9, 10, 11, 12, 13, 14, 15],grumpy = [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1],minutes = 6) == 99\n assert candidate(customers = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],grumpy = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],minutes = 5) == 20\n assert candidate(customers = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 5) == 5100\n assert candidate(customers = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 8) == 16800\n assert candidate(customers = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 10) == 75\n assert candidate(customers = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 2) == 390\n assert candidate(customers = [50, 20, 30, 10, 40, 60, 70, 80, 90, 100, 110, 120],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 4) == 610\n assert candidate(customers = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 10) == 75\n assert candidate(customers = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 5) == 130\n assert candidate(customers = [500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000],grumpy = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],minutes = 2) == 27500\n assert candidate(customers = [10, 0, 5, 2, 3, 8, 6, 4, 7, 9],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 5) == 52\n assert candidate(customers = [100, 50, 25, 12, 6, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 6) == 197\n assert candidate(customers = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 6) == 90\n assert candidate(customers = [100, 200, 0, 300, 400, 0, 500, 0, 600, 700],grumpy = [1, 0, 1, 1, 0, 1, 1, 0, 1, 0],minutes = 5) == 2400\n assert candidate(customers = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 3) == 15\n assert candidate(customers = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 9) == 925\n assert candidate(customers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 2) == 0\n assert candidate(customers = [5, 1, 5, 1, 5, 1, 5, 1, 5, 1],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 3) == 11\n assert candidate(customers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 3) == 90\n assert candidate(customers = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 10) == 1\n assert candidate(customers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 2) == 19\n assert candidate(customers = [200, 300, 400, 500, 600, 700, 800, 900, 1000],grumpy = [1, 1, 0, 0, 1, 1, 0, 0, 1],minutes = 4) == 4300\n assert candidate(customers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 4) == 90\n assert candidate(customers = [9, 8, 7, 6, 5, 4, 3, 2, 1],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 3) == 36\n assert candidate(customers = [50, 40, 30, 20, 10, 0, 10, 20, 30, 40, 50],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 4) == 140\n assert candidate(customers = [23, 15, 6, 8, 9, 10, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 7) == 264\n assert candidate(customers = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 5) == 5100\n assert candidate(customers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],grumpy = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],minutes = 6) == 154\n assert candidate(customers = [100, 50, 25, 12, 6, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 10) == 197\n assert candidate(customers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000],grumpy = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],minutes = 10) == 1000\n assert candidate(customers = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 5) == 5100\n assert candidate(customers = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 5) == 255\n assert candidate(customers = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500],grumpy = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],minutes = 5) == 8000\n assert candidate(customers = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],grumpy = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],minutes = 5) == 510\n assert candidate(customers = [5, 1, 3, 0, 2, 7, 8, 9, 10, 1],grumpy = [1, 1, 0, 0, 1, 1, 1, 0, 1, 0],minutes = 4) == 38\n"}, "metadata": {"canonical_parameter_names": ["customers", "grumpy", "minutes"], "leetcode_dataset_entry_point": "Solution().maxSatisfied", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxSatisfied = function(customers, grumpy, minutes) {", "container": null, "callable": "maxSatisfied", "parameters": [{"name": "customers", "type": "number[]"}, {"name": "grumpy", "type": "number[]"}, {"name": "minutes", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1053, "task_id": "previous-permutation-with-one-swap", "difficulty": "Medium", "problem_description": "Given an array of positive integers arr (not necessarily distinct), return the lexicographically largest permutation that is smaller than arr, that can be made with exactly one swap. If it cannot be done, then return the same array.\nNote that a swap exchanges the positions of two numbers arr[i] and arr[j]\n \nExample 1:\n\nInput: arr = [3,2,1]\nOutput: [3,1,2]\nExplanation: Swapping 2 and 1.\n\nExample 2:\n\nInput: arr = [1,1,5]\nOutput: [1,1,5]\nExplanation: This is already the smallest permutation.\n\nExample 3:\n\nInput: arr = [1,9,4,6,7]\nOutput: [1,7,4,6,9]\nExplanation: Swapping 9 and 7.\n\n \nConstraints:\n\n1 <= arr.length <= 104\n1 <= arr[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [10, 9, 8, 7, 6, 5]) == [10, 9, 8, 7, 5, 6]\n assert candidate(arr = [3, 2, 1]) == [3, 1, 2]\n assert candidate(arr = [5, 1, 1, 2, 3]) == [3, 1, 1, 2, 5]\n assert candidate(arr = [5, 4, 3, 2, 1]) == [5, 4, 3, 1, 2]\n assert candidate(arr = [4, 5, 1, 2, 3]) == [4, 3, 1, 2, 5]\n assert candidate(arr = [10, 20, 30, 40, 50]) == [10, 20, 30, 40, 50]\n assert candidate(arr = [10, 9, 8, 7, 6]) == [10, 9, 8, 6, 7]\n assert candidate(arr = [4, 3, 2, 1, 0]) == [4, 3, 2, 0, 1]\n assert candidate(arr = [5, 1, 1]) == [1, 5, 1]\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [10, 9, 8, 7, 6, 5, 4, 3, 1, 2]\n assert candidate(arr = [1, 9, 4, 6, 7]) == [1, 7, 4, 6, 9]\n assert candidate(arr = [2, 1, 3, 1, 3]) == [2, 1, 1, 3, 3]\n assert candidate(arr = [1, 1, 5]) == [1, 1, 5]\n assert candidate(arr = [1, 10, 9, 8, 7, 6, 5, 4, 3, 2]) == [1, 10, 9, 8, 7, 6, 5, 4, 2, 3]\n assert candidate(arr = [1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]\n assert candidate(arr = [1, 2, 1]) == [1, 1, 2]\n assert candidate(arr = [1, 3, 2]) == [1, 2, 3]\n assert candidate(arr = [3, 1, 1, 3]) == [1, 3, 1, 3]\n assert candidate(arr = [5, 3, 4, 2, 1]) == [5, 3, 4, 1, 2]\n assert candidate(arr = [10, 5, 9, 2, 6]) == [10, 5, 6, 2, 9]\n assert candidate(arr = [2, 3, 1]) == [2, 1, 3]\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 12]) == [10, 9, 8, 7, 6, 5, 4, 3, 2, 0, 1, 11, 12]\n assert candidate(arr = [5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 2, 2, 1]) == [5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 2, 1, 2]\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 4, 4, 3, 3, 2, 1, 2, 1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2]\n assert candidate(arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]) == [3, 1, 4, 1, 5, 9, 2, 6, 3, 5, 5]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 1]) == [9, 8, 7, 6, 5, 4, 3, 1, 2, 1, 1]\n assert candidate(arr = [1, 2, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 2, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2]\n assert candidate(arr = [1, 9, 9, 9, 9, 9, 9, 8, 7, 6, 5]) == [1, 9, 9, 9, 9, 9, 9, 8, 7, 5, 6]\n assert candidate(arr = [1, 3, 2, 4, 3, 5, 6, 4, 2]) == [1, 3, 2, 4, 3, 5, 6, 2, 4]\n assert candidate(arr = [5, 3, 4, 4, 5, 4, 3]) == [5, 3, 4, 4, 5, 3, 4]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == [9, 8, 7, 6, 5, 4, 3, 1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1]) == [9, 8, 7, 6, 5, 4, 3, 2, 0, 1, 1]\n assert candidate(arr = [5, 4, 4, 3, 2, 1, 1, 1, 1]) == [5, 4, 4, 3, 1, 2, 1, 1, 1]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 2]) == [1, 1, 1, 1, 1, 1, 1, 1, 2]\n assert candidate(arr = [1, 3, 2, 4, 5, 6, 7]) == [1, 2, 3, 4, 5, 6, 7]\n assert candidate(arr = [10000, 1, 10000, 1, 10000, 1, 10000, 1, 10000, 1]) == [10000, 1, 10000, 1, 10000, 1, 10000, 1, 1, 10000]\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5, 4, 3, 1, 2]\n assert candidate(arr = [1, 2, 3, 3, 2, 1]) == [1, 2, 3, 3, 1, 2]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr = [1, 2, 3, 5, 4]) == [1, 2, 3, 4, 5]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == [9, 8, 7, 6, 5, 4, 3, 1, 2]\n assert candidate(arr = [1, 3, 5, 7, 9, 8, 6, 4, 2]) == [1, 3, 5, 7, 9, 8, 6, 2, 4]\n assert candidate(arr = [2, 3, 5, 4, 6, 1, 8, 7, 9]) == [2, 3, 5, 4, 6, 1, 7, 8, 9]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1]) == [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2, 1]\n assert candidate(arr = [9, 9, 8, 8, 7, 7, 6, 6]) == [9, 9, 8, 8, 7, 6, 7, 6]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2]\n assert candidate(arr = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == [100, 99, 98, 97, 96, 95, 94, 93, 92, 90, 91]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]\n assert candidate(arr = [1, 2, 3, 4, 5, 10, 9, 8, 7, 6]) == [1, 2, 3, 4, 5, 10, 9, 8, 6, 7]\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2]\n assert candidate(arr = [5, 6, 7, 8, 9, 1, 2, 3, 4]) == [5, 6, 7, 8, 4, 1, 2, 3, 9]\n assert candidate(arr = [1, 3, 2, 4, 5, 3, 2, 1, 4, 5, 6, 7]) == [1, 3, 2, 4, 5, 3, 1, 2, 4, 5, 6, 7]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 10]\n assert candidate(arr = [9, 7, 7, 7, 8, 7, 7, 7, 9]) == [9, 7, 7, 7, 7, 8, 7, 7, 9]\n assert candidate(arr = [3, 5, 4, 5, 3, 2, 4, 3, 2, 1]) == [3, 5, 4, 5, 3, 2, 4, 3, 1, 2]\n assert candidate(arr = [8, 9, 7, 9, 7, 8, 9, 7, 9, 7]) == [8, 9, 7, 9, 7, 8, 9, 7, 7, 9]\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]\n assert candidate(arr = [100, 200, 300, 400, 500, 450]) == [100, 200, 300, 400, 450, 500]\n assert candidate(arr = [1, 10000, 2, 9999, 3, 9998, 4, 9997, 5, 9996]) == [1, 10000, 2, 9999, 3, 9998, 4, 9996, 5, 9997]\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5]\n assert candidate(arr = [5, 3, 6, 7, 4, 8, 9, 1, 2]) == [5, 3, 6, 7, 4, 8, 2, 1, 9]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [9, 8, 7, 6, 5, 4, 3, 2, 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(arr = [1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2]) == [1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3]\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1]) == [1, 2, 3, 4, 3, 1, 2]\n assert candidate(arr = [1, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 9, 8, 7, 6, 5, 4, 3, 1, 2]\n assert candidate(arr = [3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1]) == [3, 3, 3, 3, 2, 2, 2, 1, 2, 1, 1, 1]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9]\n assert candidate(arr = [3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3]) == [3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3]\n assert candidate(arr = [5, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1]) == [5, 4, 3, 1, 2, 1, 1, 1, 1, 1, 1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2]\n assert candidate(arr = [5, 4, 3, 2, 1, 0, 9, 8, 7, 6]) == [5, 4, 3, 2, 1, 0, 9, 8, 6, 7]\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 0, 1]\n assert candidate(arr = [9, 8, 7, 6, 7, 8, 9, 8, 7, 6, 7, 8, 9]) == [9, 8, 7, 6, 7, 8, 9, 8, 6, 7, 7, 8, 9]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1, 20]\n assert candidate(arr = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991]) == [1000, 999, 998, 997, 996, 995, 994, 993, 991, 992]\n assert candidate(arr = [5, 4, 3, 2, 1, 1]) == [5, 4, 3, 1, 2, 1]\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 1]) == [5, 6, 7, 8, 9, 1, 10]\n assert candidate(arr = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1]) == [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 1, 10]\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [5, 6, 7, 8, 9, 9, 1, 2, 3, 4, 5, 6, 7, 8, 10]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 0, 1]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 11, 12]) == [2, 3, 4, 5, 6, 7, 8, 9, 1, 10, 11, 12]\n assert candidate(arr = [1, 2, 2, 3, 3, 2, 2, 1]) == [1, 2, 2, 3, 3, 2, 1, 2]\n assert candidate(arr = [3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1]) == [3, 3, 3, 3, 3, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1]\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == [100, 90, 80, 70, 60, 50, 40, 30, 10, 20]\n assert candidate(arr = [1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6]) == [1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6]\n assert candidate(arr = [1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3]) == [1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 1, 2, 3, 4, 10]\n assert candidate(arr = [1, 9, 4, 6, 7, 8, 5, 4, 3, 2, 1]) == [1, 9, 4, 6, 7, 8, 5, 4, 3, 1, 2]\n assert candidate(arr = [1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]) == [1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]\n assert candidate(arr = [8, 8, 8, 8, 7, 8, 8, 8, 8]) == [8, 8, 8, 7, 8, 8, 8, 8, 8]\n assert candidate(arr = [10, 9, 10, 9, 10, 9, 10, 9, 10, 9]) == [10, 9, 10, 9, 10, 9, 10, 9, 9, 10]\n assert candidate(arr = [1, 3, 3, 3, 3, 3, 3, 3, 3, 2]) == [1, 3, 3, 3, 3, 3, 3, 3, 2, 3]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10]) == [9, 8, 7, 6, 5, 4, 3, 1, 2, 10]\n assert candidate(arr = [10, 20, 30, 25, 15, 5]) == [10, 20, 30, 25, 5, 15]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 11, 12]) == [9, 8, 7, 6, 5, 4, 3, 1, 2, 10, 11, 12]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [9, 8, 7, 6, 5, 4, 3, 2, 0, 1]\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1]) == [10, 9, 8, 7, 6, 5, 4, 3, 1, 2, 1]\n assert candidate(arr = [1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr = [5, 4, 3, 2, 1, 0]) == [5, 4, 3, 2, 0, 1]\n assert candidate(arr = [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2]\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 5]\n assert candidate(arr = [2, 1, 3, 4, 3, 2, 1]) == [2, 1, 3, 4, 3, 1, 2]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 1, 2, 3, 4, 5, 6, 7, 8, 10, 10]\n assert candidate(arr = [3, 3, 3, 3, 2, 2, 2, 1, 1]) == [3, 3, 3, 3, 2, 2, 1, 2, 1]\n assert candidate(arr = [1, 3, 5, 4, 3, 2, 1]) == [1, 3, 5, 4, 3, 1, 2]\n assert candidate(arr = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8]) == [9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9]\n assert candidate(arr = [1000, 999, 998, 997, 996, 995]) == [1000, 999, 998, 997, 995, 996]\n assert candidate(arr = [1, 2, 2, 3, 4, 5, 5, 4, 3, 2, 1]) == [1, 2, 2, 3, 4, 5, 5, 4, 3, 1, 2]\n assert candidate(arr = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [9, 1, 2, 3, 4, 5, 6, 7, 8, 10]\n assert candidate(arr = [5, 4, 3, 2, 1, 1, 1, 1]) == [5, 4, 3, 1, 2, 1, 1, 1]\n assert candidate(arr = [10, 9, 8, 7, 6, 7, 8, 9, 10]) == [10, 9, 8, 6, 7, 7, 8, 9, 10]\n assert candidate(arr = [1, 3, 2, 4, 3, 2, 1]) == [1, 3, 2, 4, 3, 1, 2]\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2]\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]\n assert candidate(arr = [10, 9, 8, 7, 8, 9, 10]) == [10, 9, 7, 8, 8, 9, 10]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n assert candidate(arr = [1, 3, 5, 4, 2]) == [1, 3, 5, 2, 4]\n assert candidate(arr = [10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, 5, 5]) == [10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 5, 6, 5, 5]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n assert candidate(arr = [3, 3, 3, 3, 3, 3, 2]) == [3, 3, 3, 3, 3, 2, 3]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 0, 1]\n assert candidate(arr = [1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr = [10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [10, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2]\n assert candidate(arr = [3, 3, 2, 1, 3, 3]) == [3, 3, 1, 2, 3, 3]\n assert candidate(arr = [5, 1, 1, 1, 1, 1]) == [1, 5, 1, 1, 1, 1]\n assert candidate(arr = [5, 4, 5, 4, 5, 4, 5, 4]) == [5, 4, 5, 4, 5, 4, 4, 5]\n assert candidate(arr = [5, 6, 8, 9, 7, 3, 2, 4, 1, 0]) == [5, 6, 8, 9, 7, 3, 2, 4, 0, 1]\n assert candidate(arr = [4, 5, 3, 4, 5, 6, 7]) == [4, 4, 3, 5, 5, 6, 7]\n assert candidate(arr = [1, 3, 2, 4, 5]) == [1, 2, 3, 4, 5]\n assert candidate(arr = [3, 3, 2, 1, 4, 4, 5]) == [3, 3, 1, 2, 4, 4, 5]\n assert candidate(arr = [1, 2, 3, 3, 3, 2, 1, 1, 1]) == [1, 2, 3, 3, 3, 1, 2, 1, 1]\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().prevPermOpt1", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var prevPermOpt1 = function(arr) {", "container": null, "callable": "prevPermOpt1", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1054, "task_id": "distant-barcodes", "difficulty": "Medium", "problem_description": "In a warehouse, there is a row of barcodes, where the ith barcode is barcodes[i].\nRearrange the barcodes so that no two adjacent barcodes are equal. You may return any answer, and it is guaranteed an answer exists.\n \nExample 1:\nInput: barcodes = [1,1,1,2,2,2]\nOutput: [2,1,2,1,2,1]\nExample 2:\nInput: barcodes = [1,1,1,1,2,2,3,3]\nOutput: [1,3,1,3,1,2,1,2]\n\n \nConstraints:\n\n1 <= barcodes.length <= 10000\n1 <= barcodes[i] <= 10000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(barcodes = [1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5]) == [1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 2, 5, 2]\n assert candidate(barcodes = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == [1, 3, 1, 4, 2, 4, 2, 5, 3, 5]\n assert candidate(barcodes = [2, 2, 1, 1, 3, 3, 4, 4]) == [1, 3, 1, 3, 2, 4, 2, 4]\n assert candidate(barcodes = [1, 2, 2, 1, 2, 1]) == [1, 2, 1, 2, 1, 2]\n assert candidate(barcodes = [4, 1, 2, 2, 2, 3, 3, 3, 3]) == [3, 2, 3, 2, 3, 1, 3, 4, 2]\n assert candidate(barcodes = [5, 6, 7, 8, 8, 8, 8]) == [8, 5, 8, 6, 8, 7, 8]\n assert candidate(barcodes = [5, 5, 5, 6, 6, 7, 7, 7, 7]) == [7, 5, 7, 5, 7, 6, 7, 6, 5]\n assert candidate(barcodes = [5, 5, 5, 5, 5, 1, 1, 1, 1, 1]) == [1, 5, 1, 5, 1, 5, 1, 5, 1, 5]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 2, 2, 2, 3, 3]) == [1, 2, 1, 2, 1, 2, 1, 3, 1, 3]\n assert candidate(barcodes = [1, 1, 1, 1, 2, 2, 3, 3]) == [1, 2, 1, 2, 1, 3, 1, 3]\n assert candidate(barcodes = [2, 2, 3, 3, 3, 3, 4, 4, 4]) == [3, 4, 3, 4, 3, 2, 3, 2, 4]\n assert candidate(barcodes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 6, 2, 7, 3, 8, 4, 9, 5, 10]\n assert candidate(barcodes = [1, 2, 3, 4]) == [1, 3, 2, 4]\n assert candidate(barcodes = [1, 1, 1, 2, 2, 2]) == [1, 2, 1, 2, 1, 2]\n assert candidate(barcodes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 2, 7, 2, 7, 2, 7, 2, 7, 2, 7, 2, 7, 2, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10]\n assert candidate(barcodes = [32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50]) == [32, 37, 32, 37, 32, 37, 32, 38, 32, 38, 32, 38, 32, 39, 33, 39, 33, 39, 33, 40, 33, 40, 33, 40, 33, 42, 34, 42, 34, 42, 34, 44, 34, 44, 41, 44, 41, 46, 41, 46, 41, 46, 45, 43, 45, 43, 45, 47, 45, 47, 35, 48, 35, 48, 35, 49, 36, 49, 36, 50, 36, 50]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == [1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 7, 2, 7, 2, 7, 2, 7, 2, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 5, 9, 5, 9, 5, 9, 5, 9, 5, 9]\n assert candidate(barcodes = [5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8]) == [5, 7, 5, 8, 5, 8, 5, 8, 5, 8, 5, 8, 7, 6, 7, 6, 7, 6, 7, 6]\n assert candidate(barcodes = [9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 8888, 8888, 8888, 8888, 8888, 8888, 8888, 8888, 8888, 8888, 7777, 7777, 7777, 7777, 7777, 7777, 7777, 7777, 7777, 7777]) == [7777, 8888, 7777, 8888, 7777, 8888, 7777, 8888, 7777, 8888, 7777, 9999, 7777, 9999, 7777, 9999, 7777, 9999, 7777, 9999, 8888, 9999, 8888, 9999, 8888, 9999, 8888, 9999, 8888, 9999]\n assert candidate(barcodes = [100, 100, 100, 200, 200, 200, 300, 300, 300, 400, 400, 400, 500, 500, 500, 600, 600, 600, 700, 700, 700, 800, 800, 800, 900, 900, 900, 1000, 1000, 1000]) == [100, 600, 100, 600, 100, 600, 200, 700, 200, 700, 200, 700, 300, 800, 300, 800, 300, 800, 400, 900, 400, 900, 400, 900, 500, 1000, 500, 1000, 500, 1000]\n assert candidate(barcodes = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == [3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 2, 3, 2, 3, 2, 3, 2, 4, 1, 4, 1, 4, 1, 4]\n assert candidate(barcodes = [5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7]) == [5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 6, 7, 6, 7, 6]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5]) == [4, 3, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 5, 3, 5, 3, 5]\n assert candidate(barcodes = [5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8]) == [5, 8, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8]\n assert candidate(barcodes = [5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9]) == [5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 5, 8, 6, 8, 6, 9]\n assert candidate(barcodes = [10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 40, 40, 40, 50, 50]) == [10, 20, 10, 20, 10, 30, 10, 30, 10, 30, 10, 30, 10, 40, 20, 40, 20, 40, 20, 50, 20, 50]\n assert candidate(barcodes = [10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 13, 13]) == [10, 11, 10, 11, 10, 11, 10, 11, 10, 12, 10, 12, 10, 12, 11, 13, 11, 13]\n assert candidate(barcodes = [5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8]) == [5, 6, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 6, 8, 6, 8]\n assert candidate(barcodes = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25]) == [1, 13, 1, 14, 2, 14, 2, 15, 3, 15, 3, 16, 4, 16, 4, 17, 5, 17, 5, 18, 6, 18, 6, 19, 7, 19, 7, 20, 8, 20, 8, 21, 9, 21, 9, 22, 10, 22, 10, 23, 11, 23, 11, 24, 12, 24, 12, 25, 13, 25]\n assert candidate(barcodes = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == [7, 6, 7, 6, 7, 6, 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 4, 7, 4, 7, 4, 7, 4, 7, 3, 6, 3, 6, 3, 6, 2, 6, 2, 6, 1, 6]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4]\n assert candidate(barcodes = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 9980]) == [9980, 9990, 9981, 9991, 9982, 9992, 9983, 9993, 9984, 9994, 9985, 9995, 9986, 9996, 9987, 9997, 9988, 9998, 9989, 9999]\n assert candidate(barcodes = [9999, 9999, 9999, 9999, 9999, 9998, 9998, 9998, 9998, 9998, 9997, 9997, 9997, 9997, 9997, 9996, 9996, 9996, 9996, 9996]) == [9996, 9998, 9996, 9998, 9996, 9998, 9996, 9998, 9996, 9998, 9997, 9999, 9997, 9999, 9997, 9999, 9997, 9999, 9997, 9999]\n assert candidate(barcodes = [71, 71, 71, 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 80, 80, 80, 80, 81, 81, 81, 82, 82, 82, 82, 83, 83, 83, 83, 84, 84, 85, 85, 86, 86, 86, 87, 87, 87, 87, 88, 88, 89, 89, 90, 90, 90, 91, 91, 91, 91, 92, 92, 92, 93, 93, 93, 94, 94, 94, 94, 95, 95, 95, 96, 96, 96, 96, 96, 97, 97, 97, 97, 98, 98, 98, 98, 99, 99, 99, 99, 100, 100, 100, 100]) == [71, 80, 71, 80, 71, 82, 71, 82, 71, 82, 71, 82, 71, 83, 71, 83, 71, 83, 72, 83, 72, 87, 72, 87, 72, 87, 72, 87, 72, 91, 72, 91, 72, 91, 72, 91, 73, 94, 73, 94, 73, 94, 73, 94, 73, 97, 73, 97, 73, 97, 74, 97, 74, 98, 74, 98, 74, 98, 74, 98, 74, 99, 75, 99, 75, 99, 75, 99, 75, 100, 75, 100, 75, 100, 78, 100, 78, 81, 78, 81, 78, 81, 78, 86, 78, 86, 76, 86, 76, 90, 76, 90, 76, 90, 76, 92, 77, 92, 77, 92, 77, 93, 77, 93, 77, 93, 96, 95, 96, 95, 96, 95, 96, 84, 96, 84, 79, 85, 79, 85, 79, 88, 79, 88, 80, 89, 80, 89]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7]) == [1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 2, 5, 2, 5, 2, 6, 2, 6, 2, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 4, 7, 4, 7, 4]\n assert candidate(barcodes = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == [1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 2, 4, 2, 4, 2, 4, 2, 5, 2, 5, 2, 5, 2, 5, 3, 5, 3, 5, 3, 5, 3]\n assert candidate(barcodes = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10]) == [1, 6, 1, 6, 1, 6, 1, 6, 2, 7, 2, 7, 2, 7, 2, 7, 3, 8, 3, 8, 3, 8, 3, 8, 4, 9, 4, 9, 4, 9, 4, 9, 5, 10, 5, 10, 5, 10, 5, 10]\n assert candidate(barcodes = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == [1, 6, 1, 6, 1, 6, 2, 7, 2, 7, 2, 7, 3, 8, 3, 8, 3, 8, 4, 9, 4, 9, 4, 9, 5, 10, 5, 10, 5, 10]\n assert candidate(barcodes = [10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13]) == [10, 11, 10, 12, 10, 12, 10, 12, 10, 12, 10, 12, 10, 12, 11, 12, 11, 13, 11, 13, 11, 13, 11, 13, 11, 13]\n assert candidate(barcodes = [11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13]) == [12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 13, 12, 13, 12, 13, 12, 13, 12]\n assert candidate(barcodes = [10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == [30, 50, 30, 50, 30, 50, 30, 50, 30, 50, 30, 50, 30, 50, 30, 50, 30, 50, 30, 50, 40, 20, 40, 20, 40, 20, 40, 20, 40, 20, 40, 20, 40, 20, 40, 20, 40, 20, 40, 10]\n assert candidate(barcodes = [5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8]) == [5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 8, 6, 8, 6, 8, 6, 8, 6, 8, 6]\n assert candidate(barcodes = [1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5]) == [5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 4, 5, 4, 2, 4, 2, 4, 2, 1, 2, 1, 2, 1, 2]\n assert candidate(barcodes = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9]) == [1, 5, 1, 5, 1, 6, 1, 6, 2, 6, 2, 6, 2, 7, 2, 7, 3, 7, 3, 7, 3, 8, 3, 8, 4, 8, 4, 8, 4, 9, 4, 9, 5, 9, 5, 9]\n assert candidate(barcodes = [9999, 9999, 9999, 9999, 9999, 9998, 9998, 9998, 9998, 9998, 9997, 9997, 9997, 9997, 9997]) == [9997, 9998, 9997, 9998, 9997, 9999, 9997, 9999, 9997, 9999, 9998, 9999, 9998, 9999, 9998]\n assert candidate(barcodes = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7]) == [7, 5, 7, 5, 7, 5, 7, 5, 7, 4, 7, 4, 7, 4, 6, 4, 6, 3, 6, 3, 6, 3, 6, 2, 6, 2, 5, 1]\n assert candidate(barcodes = [21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24]) == [23, 22, 23, 22, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21]\n assert candidate(barcodes = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 1]\n assert candidate(barcodes = [1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6]) == [4, 6, 4, 6, 4, 6, 4, 6, 4, 6, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 2, 5, 2, 5, 2, 5, 2, 6, 1, 6, 1, 6]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10]) == [1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 2, 7, 2, 7, 2, 7, 2, 7, 2, 7, 2, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10]\n assert candidate(barcodes = [1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == [6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 1, 6, 1, 6, 1, 7, 3, 7, 3, 7, 3, 7, 4, 7, 4, 7, 4, 7, 5, 7, 5, 7, 5]\n assert candidate(barcodes = [17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19]) == [18, 17, 18, 17, 18, 17, 18, 17, 18, 17, 18, 17, 18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 17, 19, 17, 19, 17, 19]\n assert candidate(barcodes = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7]) == [7, 6, 7, 6, 7, 4, 7, 4, 7, 4, 7, 4, 7, 4, 7, 4, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 2, 5, 2, 6, 2, 6, 2, 6, 1, 6, 1, 6, 1]\n assert candidate(barcodes = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40]) == [10, 30, 10, 30, 10, 30, 10, 30, 10, 30, 10, 30, 10, 30, 10, 30, 10, 30, 10, 30, 20, 40, 20, 40, 20, 40, 20, 40, 20, 40, 20, 40, 20, 40, 20, 40, 20, 40, 20, 40]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == [1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4]) == [1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 2, 4, 2, 4, 2, 4]\n assert candidate(barcodes = [8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == [10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 9, 8, 9, 8, 9, 8]\n assert candidate(barcodes = [100, 200, 100, 300, 100, 400, 100, 500, 100, 200, 300, 400, 500, 100, 200, 300, 400, 500, 100, 200, 300, 400, 500]) == [100, 300, 100, 300, 100, 300, 100, 400, 100, 400, 100, 400, 100, 400, 200, 500, 200, 500, 200, 500, 200, 500, 300]\n assert candidate(barcodes = [9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14]) == [9, 10, 9, 11, 9, 11, 9, 11, 9, 11, 9, 12, 9, 12, 10, 12, 10, 13, 10, 13, 10, 14, 10, 14]\n assert candidate(barcodes = [9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6]) == [7, 8, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 8, 9, 8, 6, 8, 6, 8, 6, 8, 6, 8, 6, 8, 6, 8]\n assert candidate(barcodes = [13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16]) == [16, 14, 16, 14, 16, 13, 16, 13, 16, 13, 16, 13, 16, 13, 16, 13, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15]\n assert candidate(barcodes = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8]) == [7, 6, 7, 6, 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 8, 4, 8, 4, 8, 4, 8, 4, 8, 3, 8, 3, 8, 3, 6, 2, 6, 2, 6, 1, 6]\n assert candidate(barcodes = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12]) == [9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 11, 9, 11, 9, 11, 9, 11, 10, 12, 10, 12, 10, 12, 10]\n assert candidate(barcodes = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11]) == [10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11]\n assert candidate(barcodes = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == [1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4]\n assert candidate(barcodes = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000]) == [2000, 2000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000]\n assert candidate(barcodes = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3]\n assert candidate(barcodes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 6, 1, 6, 1, 6, 2, 7, 2, 7, 2, 7, 3, 8, 3, 8, 3, 8, 4, 9, 4, 9, 4, 9, 5, 10, 5, 10, 5, 10]\n assert candidate(barcodes = [15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 19, 19, 20, 20, 20]) == [16, 15, 16, 15, 16, 15, 16, 15, 16, 17, 16, 17, 16, 17, 16, 17, 16, 20, 16, 20, 15, 20, 15, 18, 15, 18, 15, 19, 15, 19]\n assert candidate(barcodes = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == [7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10]) == [1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 2, 7, 2, 7, 2, 7, 2, 7, 2, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5]) == [1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 2, 4, 2, 4, 2, 4, 2, 5, 2, 5, 2, 5, 2, 5, 3, 5, 3, 5, 3, 5, 3]\n assert candidate(barcodes = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == [2, 6, 2, 7, 2, 7, 2, 7, 3, 7, 3, 8, 3, 8, 3, 8, 4, 8, 4, 9, 4, 9, 4, 9, 5, 9, 5, 10, 5, 10, 5, 10, 6, 10, 6, 1, 6, 1]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]\n assert candidate(barcodes = [9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12]) == [10, 12, 10, 12, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11]\n assert candidate(barcodes = [10000, 10000, 9999, 9999, 9998, 9998, 9997, 9997, 9996, 9996, 9995, 9995, 9994, 9994, 9993, 9993, 9992, 9992, 9991, 9991, 9990, 9990, 9989, 9989, 9988, 9988, 9987, 9987, 9986, 9986]) == [9986, 9993, 9986, 9994, 9987, 9994, 9987, 9995, 9988, 9995, 9988, 9996, 9989, 9996, 9989, 9997, 9990, 9997, 9990, 9998, 9991, 9998, 9991, 9999, 9992, 9999, 9992, 10000, 9993, 10000]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == [5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 1, 5, 1, 3, 1, 3, 1, 3, 1, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 4]\n assert candidate(barcodes = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5]\n assert candidate(barcodes = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102]) == [100, 101, 100, 101, 100, 101, 100, 101, 100, 101, 100, 101, 100, 102, 100, 102, 100, 102, 100, 102, 101, 102, 101, 102, 101, 102]\n assert candidate(barcodes = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000]) == [3000, 1000, 3000, 1000, 3000, 1000, 3000, 1000, 3000, 1000, 3000, 1000, 3000, 1000, 3000, 1000, 3000, 2000, 3000, 2000, 3000, 2000, 3000, 2000, 3000, 2000, 3000, 2000, 3000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000]\n assert candidate(barcodes = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == [5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7]\n assert candidate(barcodes = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 200, 200, 200, 200, 200, 200, 200, 200, 200, 300, 300, 300, 300, 300, 300, 300, 300]) == [100, 200, 100, 200, 100, 200, 100, 200, 100, 200, 100, 300, 100, 300, 100, 300, 100, 300, 100, 300, 200, 300, 200, 300, 200, 300, 200]\n assert candidate(barcodes = [21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30, 30, 31, 31]) == [21, 30, 21, 30, 21, 30, 21, 30, 21, 24, 21, 24, 22, 24, 22, 25, 22, 25, 22, 25, 22, 29, 22, 29, 23, 29, 23, 27, 23, 27, 23, 28, 26, 28, 26, 31, 26, 31, 26]\n assert candidate(barcodes = [20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22]) == [20, 21, 20, 21, 20, 21, 20, 21, 20, 21, 20, 21, 20, 22, 20, 22, 20, 22, 21, 22, 21, 22]\n assert candidate(barcodes = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == [3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 1, 2]\n assert candidate(barcodes = [51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 70, 70]) == [51, 56, 51, 56, 51, 56, 51, 56, 51, 58, 51, 58, 51, 58, 51, 58, 52, 66, 52, 66, 52, 66, 52, 66, 52, 59, 52, 59, 52, 59, 52, 60, 54, 60, 54, 60, 54, 65, 54, 65, 54, 65, 54, 67, 55, 67, 55, 67, 55, 68, 55, 68, 55, 68, 55, 61, 57, 61, 57, 62, 57, 62, 57, 63, 57, 63, 57, 64, 53, 64, 53, 69, 53, 69, 53, 70, 53, 70, 56]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5]\n assert candidate(barcodes = [5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == [5, 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6]\n assert candidate(barcodes = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == [1, 6, 1, 6, 1, 6, 1, 6, 2, 7, 2, 7, 2, 7, 2, 7, 3, 8, 3, 8, 3, 8, 3, 8, 4, 9, 4, 9, 4, 9, 4, 9, 5, 10, 5, 10, 5, 10, 5, 10]\n assert candidate(barcodes = [14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16]) == [14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 15, 14, 16, 14, 16, 15, 16, 15]\n assert candidate(barcodes = [10, 10, 10, 20, 20, 20, 30, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 50, 50, 50, 50, 50, 50, 50]) == [50, 40, 50, 30, 50, 30, 50, 30, 50, 30, 50, 30, 50, 10, 40, 10, 40, 10, 40, 20, 40, 20, 40, 20]\n assert candidate(barcodes = [17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20]) == [17, 18, 17, 18, 17, 18, 17, 19, 17, 19, 17, 19, 17, 19, 17, 19, 17, 19, 18, 20, 18, 20, 18, 20, 18, 20]\n assert candidate(barcodes = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == [1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3]\n assert candidate(barcodes = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == [1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6]\n"}, "metadata": {"canonical_parameter_names": ["barcodes"], "leetcode_dataset_entry_point": "Solution().rearrangeBarcodes", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var rearrangeBarcodes = function(barcodes) {", "container": null, "callable": "rearrangeBarcodes", "parameters": [{"name": "barcodes", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1061, "task_id": "lexicographically-smallest-equivalent-string", "difficulty": "Medium", "problem_description": "You are given two strings of the same length s1 and s2 and a string baseStr.\nWe say s1[i] and s2[i] are equivalent characters.\n\nFor example, if s1 = \"abc\" and s2 = \"cde\", then we have 'a' == 'c', 'b' == 'd', and 'c' == 'e'.\n\nEquivalent characters follow the usual rules of any equivalence relation:\n\nReflexivity: 'a' == 'a'.\nSymmetry: 'a' == 'b' implies 'b' == 'a'.\nTransitivity: 'a' == 'b' and 'b' == 'c' implies 'a' == 'c'.\n\nFor example, given the equivalency information from s1 = \"abc\" and s2 = \"cde\", \"acd\" and \"aab\" are equivalent strings of baseStr = \"eed\", and \"aab\" is the lexicographically smallest equivalent string of baseStr.\nReturn the lexicographically smallest equivalent string of baseStr by using the equivalency information from s1 and s2.\n \nExample 1:\n\nInput: s1 = \"parker\", s2 = \"morris\", baseStr = \"parser\"\nOutput: \"makkek\"\nExplanation: Based on the equivalency information in s1 and s2, we can group their characters as [m,p], [a,o], [k,r,s], [e,i].\nThe characters in each group are equivalent and sorted in lexicographical order.\nSo the answer is \"makkek\".\n\nExample 2:\n\nInput: s1 = \"hello\", s2 = \"world\", baseStr = \"hold\"\nOutput: \"hdld\"\nExplanation: Based on the equivalency information in s1 and s2, we can group their characters as [h,w], [d,e,o], [l,r].\nSo only the second letter 'o' in baseStr is changed to 'd', the answer is \"hdld\".\n\nExample 3:\n\nInput: s1 = \"leetcode\", s2 = \"programs\", baseStr = \"sourcecode\"\nOutput: \"aauaaaaada\"\nExplanation: We group the equivalent characters in s1 and s2 as [a,o,e,r,s,c], [l,p], [g,t] and [d,m], thus all letters in baseStr except 'u' and 'd' are transformed to 'a', the answer is \"aauaaaaada\".\n\n \nConstraints:\n\n1 <= s1.length, s2.length, baseStr <= 1000\ns1.length == s2.length\ns1, s2, and baseStr consist of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s1 = \"abc\",s2 = \"bcd\",baseStr = \"xyz\") == \"xyz\"\n assert candidate(s1 = \"leetcode\",s2 = \"programs\",baseStr = \"sourcecode\") == \"aauaaaaada\"\n assert candidate(s1 = \"parker\",s2 = \"morris\",baseStr = \"parser\") == \"makkek\"\n assert candidate(s1 = \"abc\",s2 = \"bcd\",baseStr = \"zab\") == \"zaa\"\n assert candidate(s1 = \"abc\",s2 = \"bcd\",baseStr = \"ace\") == \"aae\"\n assert candidate(s1 = \"a\",s2 = \"b\",baseStr = \"z\") == \"z\"\n assert candidate(s1 = \"aaa\",s2 = \"bbb\",baseStr = \"ccc\") == \"ccc\"\n assert candidate(s1 = \"a\",s2 = \"z\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwxya\"\n assert candidate(s1 = \"hello\",s2 = \"world\",baseStr = \"hold\") == \"hdld\"\n assert candidate(s1 = \"abc\",s2 = \"cde\",baseStr = \"eed\") == \"aab\"\n assert candidate(s1 = \"abcdefghij\",s2 = \"abcdefghij\",baseStr = \"abcdefghij\") == \"abcdefghij\"\n assert candidate(s1 = \"aabbaabbccdd\",s2 = \"bbaaddeeccff\",baseStr = \"aabbaabbccdd\") == \"aaaaaaaaccaa\"\n assert candidate(s1 = \"mnopqrstuvwxyzabcdefghijkl\",s2 = \"pqrstuvwxyzabcdefghijklmno\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"aaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(s1 = \"abacaba\",s2 = \"zbzbzbz\",baseStr = \"zzzabzz\") == \"aaaabaa\"\n assert candidate(s1 = \"abcdef\",s2 = \"fedcba\",baseStr = \"abcdef\") == \"abccba\"\n assert candidate(s1 = \"abacabadabacaba\",s2 = \"zzzzzzzzzzzzzzz\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"aaaaefghijklmnopqrstuvwxya\"\n assert candidate(s1 = \"qqqqqqqqqq\",s2 = \"wwwwwwwwww\",baseStr = \"quicksort\") == \"quicksort\"\n assert candidate(s1 = \"qwertyuiop\",s2 = \"asdfghjklz\",baseStr = \"qwertyuiopasdfghjklz\") == \"asdfghjilpasdfghjilp\"\n assert candidate(s1 = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",s2 = \"zzzaaayyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbbaa\",baseStr = \"thequickbrownfoxjumpsoverthelazydog\") == \"ihelhiakaknfnfnejhmmjngekihelaaddng\"\n assert candidate(s1 = \"mnopqr\",s2 = \"nopqrs\",baseStr = \"mnopqrstuvwxyz\") == \"mmmmmmmtuvwxyz\"\n assert candidate(s1 = \"zzzzzz\",s2 = \"zzzzzz\",baseStr = \"zzzzzz\") == \"zzzzzz\"\n assert candidate(s1 = \"abcdefgh\",s2 = \"hgfedcba\",baseStr = \"abcdefgh\") == \"abcddcba\"\n assert candidate(s1 = \"abacabadaba\",s2 = \"xyzxyzxyzxy\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"aaaaefghijklmnopqrstuvwaaa\"\n assert candidate(s1 = \"zyxwvutsrqponmlkjihgfedcba\",s2 = \"abcdefghijklmnopqrstuvwxyz\",baseStr = \"basestring\") == \"bahehgiimg\"\n assert candidate(s1 = \"ab\",s2 = \"ba\",baseStr = \"abcd\") == \"aacd\"\n assert candidate(s1 = \"abacabad\",s2 = \"pqprpqps\",baseStr = \"zabcde\") == \"zabcde\"\n assert candidate(s1 = \"abcdefg\",s2 = \"gfedcba\",baseStr = \"zyxwvutsrqponmlkjihgfedcba\") == \"zyxwvutsrqponmlkjihabcdcba\"\n assert candidate(s1 = \"abcabcabc\",s2 = \"defdefdef\",baseStr = \"abcdefg\") == \"abcabcg\"\n assert candidate(s1 = \"abcdefabcdefabcdef\",s2 = \"fedcbafedcbafedcbafedcbafedcba\",baseStr = \"thisisaverycomplexexample\") == \"thisisavbrycomplbxbxamplb\"\n assert candidate(s1 = \"mnopqr\",s2 = \"nopqrm\",baseStr = \"mnopqrstuvwxyz\") == \"mmmmmmstuvwxyz\"\n assert candidate(s1 = \"xyzzxyzz\",s2 = \"zzxxyyzz\",baseStr = \"zzzzyyyyxxxxyyyy\") == \"xxxxxxxxxxxxxxxx\"\n assert candidate(s1 = \"aaaaabbbbbccccc\",s2 = \"bbbbbcccccddddd\",baseStr = \"fedcba\") == \"feaaaa\"\n assert candidate(s1 = \"abcabcabc\",s2 = \"cbacbacba\",baseStr = \"abcdefghi\") == \"abadefghi\"\n assert candidate(s1 = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",s2 = \"zzzaaayyxxwwvvuuttsrrqqppoonnmlkkjjiihhggffeeddccbbaa\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"aaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(s1 = \"zzzzzzzzzz\",s2 = \"aaaaaaaaaa\",baseStr = \"zzzzzzzzzz\") == \"aaaaaaaaaa\"\n assert candidate(s1 = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\",s2 = \"cbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacb\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"abadefghijklmnopqrstuvwxyz\"\n assert candidate(s1 = \"aabbcc\",s2 = \"bbccdd\",baseStr = \"abcabc\") == \"aaaaaa\"\n assert candidate(s1 = \"abacabad\",s2 = \"bcbcbcbc\",baseStr = \"zzzzzzzz\") == \"zzzzzzzz\"\n assert candidate(s1 = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",s2 = \"bbaaccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyza\",baseStr = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == \"aacdefghijklmnopqrstuvwxyaaacdefghijklmnopqrstuvwxya\"\n assert candidate(s1 = \"aaaaabbbbbccccc\",s2 = \"zzzzzyyyyyxxxxx\",baseStr = \"azbycxdwevfugthsiqjronmpkl\") == \"aabbccdwevfugthsiqjronmpkl\"\n assert candidate(s1 = \"aaabbbcccddd\",s2 = \"bbbaaaccdddbbb\",baseStr = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == \"aaaaaaaaeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\"\n assert candidate(s1 = \"abababababababab\",s2 = \"babababababababa\",baseStr = \"abababababababab\") == \"aaaaaaaaaaaaaaaa\"\n assert candidate(s1 = \"abcde\",s2 = \"vwxyz\",baseStr = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\"\n assert candidate(s1 = \"acaeac\",s2 = \"cdcdcd\",baseStr = \"acaeacdcd\") == \"aaaaaaaaa\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"zyxwvutsrqponmlkjihgfedcba\",baseStr = \"qponmlkjihgfedcba\") == \"jklmmlkjihgfedcba\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"zyxwvutsrqponmlkjihgfedcba\",baseStr = \"zyxwvutsrqponmlkjihgfedcba\") == \"abcdefghijklmmlkjihgfedcba\"\n assert candidate(s1 = \"mnopqr\",s2 = \"qrstuv\",baseStr = \"mnopqrqqqqqq\") == \"mnopmnmmmmmm\"\n assert candidate(s1 = \"abcdeabcde\",s2 = \"fghijfghij\",baseStr = \"abcdefghij\") == \"abcdeabcde\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"abcdefghijklmnopqrstuvwxyz\",baseStr = \"thequickbrownfoxjumpsoverthelazydog\") == \"thequickbrownfoxjumpsoverthelazydog\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"zyxwvutsrqponmlkjihgfedcba\",baseStr = \"smallestequivalentstring\") == \"hmallehgejfiealemghgiimg\"\n assert candidate(s1 = \"abcdef\",s2 = \"ghijkl\",baseStr = \"fedcba\") == \"fedcba\"\n assert candidate(s1 = \"abacabadabacaba\",s2 = \"zyczyxczyxzyxczyx\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"aaaaefghijklmnopqrstuvwaaa\"\n assert candidate(s1 = \"zzzyyxxwwvv\",s2 = \"xxwwvvuuttss\",baseStr = \"zyxwvutsrqponmlkjihgfedcba\") == \"ssssssssrqponmlkjihgfedcba\"\n assert candidate(s1 = \"qwertyuiop\",s2 = \"asdfghjklz\",baseStr = \"qazwsxedcrfvtgbyhnumpoi\") == \"aapssxddcffvggbhhnjmpli\"\n assert candidate(s1 = \"aaaabbbbccccddddeeeeffffgggghhhhiiii\",s2 = \"ddddccccbbbbaaaahhhhggggffffeeeeiiii\",baseStr = \"abcdefghi\") == \"abbaeffei\"\n assert candidate(s1 = \"abacabadabacaba\",s2 = \"xyzxyzxyzxyzxyz\",baseStr = \"zzzzzzzzzzzzzzz\") == \"aaaaaaaaaaaaaaa\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"zyxwvutsrqponmlkjihgfedcba\",baseStr = \"hello\") == \"helll\"\n assert candidate(s1 = \"abcdabcdabcd\",s2 = \"dcbaabdcbaab\",baseStr = \"abcdefg\") == \"aaaaefg\"\n assert candidate(s1 = \"abcdef\",s2 = \"fedcba\",baseStr = \"transform\") == \"transaorm\"\n assert candidate(s1 = \"abcabcabcabc\",s2 = \"defdefdefdef\",baseStr = \"abcdefabcdef\") == \"abcabcabcabc\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"bcdefghijklmnopqrstuvwxyza\",baseStr = \"zyxwvutsrqponmlkjihgfedcba\") == \"aaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(s1 = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",s2 = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\",baseStr = \"zzzyyxxwwvvuuttoossrrqqppoonnmmllkkjjiihhggffeeddccbaa\") == \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(s1 = \"abcabcabc\",s2 = \"bcdcbdbcd\",baseStr = \"abcbcadcb\") == \"aaaaaaaaa\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"zyxwvutsrqponmlkjihgfedcba\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmmlkjihgfedcba\"\n assert candidate(s1 = \"aaaaaaabbbbbbb\",s2 = \"bbbbbbbaaaaaaa\",baseStr = \"algorithm\") == \"algorithm\"\n assert candidate(s1 = \"aabbcc\",s2 = \"bbccdd\",baseStr = \"abcd\") == \"aaaa\"\n assert candidate(s1 = \"mammal\",s2 = \"walrus\",baseStr = \"evolve\") == \"evolve\"\n assert candidate(s1 = \"aaaaa\",s2 = \"bbbbb\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"aacdefghijklmnopqrstuvwxyz\"\n assert candidate(s1 = \"pqrstu\",s2 = \"vwxyzq\",baseStr = \"python\") == \"psthon\"\n assert candidate(s1 = \"pqrs\",s2 = \"qrst\",baseStr = \"pqrstuvxyzpqrs\") == \"pppppuvxyzpppp\"\n assert candidate(s1 = \"abcdefgh\",s2 = \"hgfedcba\",baseStr = \"abcdefghihgfedcba\") == \"abcddcbaiabcddcba\"\n assert candidate(s1 = \"pqrstu\",s2 = \"stuvwp\",baseStr = \"ppqrstuvwp\") == \"ppqppqppqp\"\n assert candidate(s1 = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",s2 = \"bbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzaa\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"aaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(s1 = \"abcdef\",s2 = \"fghijk\",baseStr = \"jklmnopqrstuvwxzyz\") == \"ealmnopqrstuvwxzyz\"\n assert candidate(s1 = \"abcdef\",s2 = \"fedcba\",baseStr = \"zyxwvutsrqponmlkjihgfedcba\") == \"zyxwvutsrqponmlkjihgabccba\"\n assert candidate(s1 = \"aaaaaaa\",s2 = \"bbbbbbb\",baseStr = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == \"aaaaccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"zyxwvutsrqponmlkjihgfedcba\",baseStr = \"language\") == \"lamgfage\"\n assert candidate(s1 = \"eqdf\",s2 = \"wtqu\",baseStr = \"eqdf\") == \"eddf\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"bcdefghijklmnopqrstuvwxyza\",baseStr = \"thequickbrownfoxjumpsoverthelazydog\") == \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(s1 = \"xyxzyz\",s2 = \"zyzxzy\",baseStr = \"xyzzyx\") == \"xxxxxx\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"zyxwvutsrqponmlkjihgfedcba\",baseStr = \"thequickbrownfoxjumpsoverthelazydog\") == \"ghejfickbildmflcjfmkhleeighelaabdlg\"\n assert candidate(s1 = \"ababababab\",s2 = \"bababababa\",baseStr = \"ababababab\") == \"aaaaaaaaaa\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"bcadefghijklmnopqrstuvwxzy\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"aaadefghijklmnopqrstuvwxyy\"\n assert candidate(s1 = \"equivalent\",s2 = \"characters\",baseStr = \"example\") == \"axampla\"\n assert candidate(s1 = \"ababababab\",s2 = \"bcbcbcbcbc\",baseStr = \"abacabadab\") == \"aaaaaaadaa\"\n assert candidate(s1 = \"aaabbbcccdddeeefffggghhhiiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxxyyyyzzzz\",s2 = \"zzzzyyyyxxxxyyyyvvvvwwwxxxxyyyyuuuvvvwwxxyyyytttsssrqqqpppoonnmmlkkkjjjiiiigggfffeeedddcccbbbaaa\",baseStr = \"thequickbrownfoxjumpsoverthelazydog\") == \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(s1 = \"abacabadabacaba\",s2 = \"zxyzxyzxyzxyzxy\",baseStr = \"abacabadabacaba\") == \"aaaaaaaaaaaaaaa\"\n assert candidate(s1 = \"abcdabcdabcdabcd\",s2 = \"dcbaecbaecbaecba\",baseStr = \"abcdefghijk\") == \"abbaafghijk\"\n assert candidate(s1 = \"leet\",s2 = \"code\",baseStr = \"leetcode\") == \"cdddcddd\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"bcdefghijklmnopqrstuvwxyza\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"aaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(s1 = \"abcdefgabcdefgabcdefg\",s2 = \"hijklmnopqrstuahijklmnopqrstuahijklmnopqrstuahijklmnopqrstuahijklmnopqrstu\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"aaaaaaaaaaaaaaaaaaaaavwxyz\"\n assert candidate(s1 = \"abcdefg\",s2 = \"ghijklm\",baseStr = \"abcdefg\") == \"abcdefa\"\n assert candidate(s1 = \"qwertyuiopasdfghjklzxcvbnm\",s2 = \"mlkjihgfedcbazyxwvutsrqpon\",baseStr = \"zyxwvutsrqponmlkjihgfedcba\") == \"faaaeafaaeaeeeaeafaafeaaaa\"\n assert candidate(s1 = \"abcabcabcabc\",s2 = \"defdefdefdef\",baseStr = \"complexity\") == \"complbxity\"\n assert candidate(s1 = \"abcdefghijklmnopqrstuvwxyz\",s2 = \"bcdefghijklmnopqrstuvwxyza\",baseStr = \"thequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydog\") == \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n assert candidate(s1 = \"acbacbacbacb\",s2 = \"zyxzyxzyxzyx\",baseStr = \"abcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwbca\"\n assert candidate(s1 = \"aaaaaa\",s2 = \"bbbbbb\",baseStr = \"ababab\") == \"aaaaaa\"\n assert candidate(s1 = \"xyzzzz\",s2 = \"zzzzzz\",baseStr = \"xyzzyx\") == \"xxxxxx\"\n"}, "metadata": {"canonical_parameter_names": ["s1", "s2", "baseStr"], "leetcode_dataset_entry_point": "Solution().smallestEquivalentString", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var smallestEquivalentString = function(s1, s2, baseStr) {", "container": null, "callable": "smallestEquivalentString", "parameters": [{"name": "s1", "type": "string"}, {"name": "s2", "type": "string"}, {"name": "baseStr", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1071, "task_id": "greatest-common-divisor-of-strings", "difficulty": "Easy", "problem_description": "For two strings s and t, we say \"t divides s\" if and only if s = t + t + t + ... + t + t (i.e., t is concatenated with itself one or more times).\nGiven two strings str1 and str2, return the largest string x such that x divides both str1 and str2.\n \nExample 1:\n\nInput: str1 = \"ABCABC\", str2 = \"ABC\"\nOutput: \"ABC\"\n\nExample 2:\n\nInput: str1 = \"ABABAB\", str2 = \"ABAB\"\nOutput: \"AB\"\n\nExample 3:\n\nInput: str1 = \"LEET\", str2 = \"CODE\"\nOutput: \"\"\n\n \nConstraints:\n\n1 <= str1.length, str2.length <= 1000\nstr1 and str2 consist of English uppercase letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(str1 = \"ABAB\",str2 = \"ABA\") == \"\"\n assert candidate(str1 = \"ABCDEFGH\",str2 = \"XYZ\") == \"\"\n assert candidate(str1 = \"ABCABC\",str2 = \"ABC\") == \"ABC\"\n assert candidate(str1 = \"ABABAB\",str2 = \"ABA\") == \"\"\n assert candidate(str1 = \"ABABAB\",str2 = \"ABAB\") == \"AB\"\n assert candidate(str1 = \"ABCABCABC\",str2 = \"ABCABC\") == \"ABC\"\n assert candidate(str1 = \"ABCD\",str2 = \"EFGH\") == \"\"\n assert candidate(str1 = \"XYZXYZXYZ\",str2 = \"XYZXYZ\") == \"XYZ\"\n assert candidate(str1 = \"AAAAAAAAAA\",str2 = \"AAAAAAAAAA\") == \"AAAAAAAAAA\"\n assert candidate(str1 = \"GCDGCDGCD\",str2 = \"GCD\") == \"GCD\"\n assert candidate(str1 = \"ABCD\",str2 = \"ABCD\") == \"ABCD\"\n assert candidate(str1 = \"HELLOHELLO\",str2 = \"HELLO\") == \"HELLO\"\n assert candidate(str1 = \"A\",str2 = \"A\") == \"A\"\n assert candidate(str1 = \"PQRS\",str2 = \"PQRS\") == \"PQRS\"\n assert candidate(str1 = \"AAAA\",str2 = \"AA\") == \"AA\"\n assert candidate(str1 = \"ABCDEFG\",str2 = \"BCD\") == \"\"\n assert candidate(str1 = \"LEET\",str2 = \"CODE\") == \"\"\n assert candidate(str1 = \"HELLOHELLOHELLO\",str2 = \"HELLO\") == \"HELLO\"\n assert candidate(str1 = \"ABCDEF\",str2 = \"ABC\") == \"\"\n assert candidate(str1 = \"ABABABAB\",str2 = \"BABA\") == \"\"\n assert candidate(str1 = \"AAAAAAAAA\",str2 = \"AAAAA\") == \"A\"\n assert candidate(str1 = \"TATATATA\",str2 = \"TAT\") == \"\"\n assert candidate(str1 = \"ABCABCABC\",str2 = \"ABC\") == \"ABC\"\n assert candidate(str1 = \"ABABABAB\",str2 = \"ABAB\") == \"ABAB\"\n assert candidate(str1 = \"BANANABANANABANANABANANA\",str2 = \"BANANABANANA\") == \"BANANABANANA\"\n assert candidate(str1 = \"XYXYXYXY\",str2 = \"XYXY\") == \"XYXY\"\n assert candidate(str1 = \"DOUBLEDOUBLEDOUBLE\",str2 = \"DOUBLEDOUBLE\") == \"DOUBLE\"\n assert candidate(str1 = \"SIMILARITYSIMILARITY\",str2 = \"SIMILARITY\") == \"SIMILARITY\"\n assert candidate(str1 = \"REPREPREP\",str2 = \"REPRE\") == \"\"\n assert candidate(str1 = \"ABACABACABAC\",str2 = \"ABAC\") == \"ABAC\"\n assert candidate(str1 = \"DOGDOGDOGDOGDOGDOG\",str2 = \"DOGDOGDOG\") == \"DOGDOGDOG\"\n assert candidate(str1 = \"XYZXYZXYZXYZXYZXYZ\",str2 = \"XYZXYZXYZXYZ\") == \"XYZXYZ\"\n assert candidate(str1 = \"PPPPPPPPPPPPPPPP\",str2 = \"PPPPPP\") == \"PP\"\n assert candidate(str1 = \"MULTIPLEMULTIPLEMULTIPLE\",str2 = \"MULTIPLEMULTIPLE\") == \"MULTIPLE\"\n assert candidate(str1 = \"MIXEDCASEMIXEDCASE\",str2 = \"MIXEDCASE\") == \"MIXEDCASE\"\n assert candidate(str1 = \"XYXYXYXYXYXYXYXY\",str2 = \"XYXYXY\") == \"XY\"\n assert candidate(str1 = \"ANTEANTEANTEANTEANTEANTEANTEANTEANTE\",str2 = \"ANTEANTEANTEANTE\") == \"ANTE\"\n assert candidate(str1 = \"QWQWQWQWQWQW\",str2 = \"QWQW\") == \"QWQW\"\n assert candidate(str1 = \"PINEAPPLEPINEAPPLEPINEAPPLEPINEAPPLE\",str2 = \"PINEAPPLEPINEAPPLE\") == \"PINEAPPLEPINEAPPLE\"\n assert candidate(str1 = \"MNMNMNMN\",str2 = \"MNMN\") == \"MNMN\"\n assert candidate(str1 = \"XYZXYZXYZXYZXYZ\",str2 = \"XYZXYZXYZ\") == \"XYZ\"\n assert candidate(str1 = \"REPORTEPORTEPORTE\",str2 = \"REPORTEPORTE\") == \"\"\n assert candidate(str1 = \"RRRRRRRRRRRR\",str2 = \"RRRRRR\") == \"RRRRRR\"\n assert candidate(str1 = \"DIFFERENTLENGTHDIFFERENTLENGTH\",str2 = \"DIFFERENTLENGTH\") == \"DIFFERENTLENGTH\"\n assert candidate(str1 = \"SMALLSAME\",str2 = \"SAME\") == \"\"\n assert candidate(str1 = \"MIXEDUPMIXEDUP\",str2 = \"MIXEDUP\") == \"MIXEDUP\"\n assert candidate(str1 = \"UPPERCASEUPPERCASEUPPERCASE\",str2 = \"UPPERCASEUPPERCASE\") == \"UPPERCASE\"\n assert candidate(str1 = \"LONGSTRINGLONGSTRINGLONGSTRINGLONGSTRING\",str2 = \"LONGSTRINGLONGSTRING\") == \"LONGSTRINGLONGSTRING\"\n assert candidate(str1 = \"LONGSTRINGLONGSTRINGLONGSTRING\",str2 = \"LONGSTRINGLONG\") == \"\"\n assert candidate(str1 = \"SIMPLESIMPLESIMPLE\",str2 = \"SIMPLESIMPLE\") == \"SIMPLE\"\n assert candidate(str1 = \"AAAAABBBB\",str2 = \"AAAAA\") == \"\"\n assert candidate(str1 = \"SHORT\",str2 = \"VERYLONGSTRINGTHATISNOTAREPEAT\") == \"\"\n assert candidate(str1 = \"AB\",str2 = \"BA\") == \"\"\n assert candidate(str1 = \"PRIMEPRIMEPRIME\",str2 = \"PRIMEPRIME\") == \"PRIME\"\n assert candidate(str1 = \"MNMNMNMNMNMN\",str2 = \"MNMN\") == \"MNMN\"\n assert candidate(str1 = \"BEEBEEBEEBEEBEEBEEBEEBEE\",str2 = \"BEEBEEBEEBEE\") == \"BEEBEEBEEBEE\"\n assert candidate(str1 = \"GRAPEGRAPEGRAPEGRAPEGRAPEGRAPE\",str2 = \"GRAPEGRAPEGRAPE\") == \"GRAPEGRAPEGRAPE\"\n assert candidate(str1 = \"TIGERTIGERTIGERTIGERTIGERTIGER\",str2 = \"TIGERTIGERTIGER\") == \"TIGERTIGERTIGER\"\n assert candidate(str1 = \"SCIENCE\",str2 = \"SCIENCE\") == \"SCIENCE\"\n assert candidate(str1 = \"ABCDEFGABCDEFG\",str2 = \"ABCDEFG\") == \"ABCDEFG\"\n assert candidate(str1 = \"XYZXYZXYZXYZXYZXYZXYZXYZ\",str2 = \"XYZXYZXYZ\") == \"XYZ\"\n assert candidate(str1 = \"MIXEDMIXEDMIXEDMIXED\",str2 = \"MIXEDMIXED\") == \"MIXEDMIXED\"\n assert candidate(str1 = \"ALMOSTSAMEALMOSTSAME\",str2 = \"ALMOSTSAME\") == \"ALMOSTSAME\"\n assert candidate(str1 = \"APPLEAPPLEAPPLEAPPLEAPPLE\",str2 = \"APPLEAPPLEAPPLE\") == \"APPLE\"\n assert candidate(str1 = \"MIXMIXMIXMIX\",str2 = \"MIXMIX\") == \"MIXMIX\"\n assert candidate(str1 = \"MATHMATHMATHMATH\",str2 = \"MATH\") == \"MATH\"\n assert candidate(str1 = \"SIMPLESIMPLESIMPLESIMPLE\",str2 = \"SIMPLE\") == \"SIMPLE\"\n assert candidate(str1 = \"DUCKDUCKDUCKDUCKDUCKDUCKDUCKDUCK\",str2 = \"DUCKDUCKDUCKDUCK\") == \"DUCKDUCKDUCKDUCK\"\n assert candidate(str1 = \"LONGLONGLONGLONGLONGLONG\",str2 = \"LONGLONGLONG\") == \"LONGLONGLONG\"\n assert candidate(str1 = \"ZAZAZAZAZA\",str2 = \"ZAZA\") == \"ZA\"\n assert candidate(str1 = \"AABAAABAAB\",str2 = \"AAB\") == \"\"\n assert candidate(str1 = \"ABCDEFABCDEF\",str2 = \"ABCDEF\") == \"ABCDEF\"\n assert candidate(str1 = \"PATTERNPATTERNPATTERN\",str2 = \"PATTERNPATTERN\") == \"PATTERN\"\n assert candidate(str1 = \"UNIQUEUNIQUEUNIQUEUNIQUEUNIQUE\",str2 = \"UNIQUEUNIQUE\") == \"UNIQUE\"\n assert candidate(str1 = \"A\",str2 = \"\") == \"\"\n assert candidate(str1 = \"WOWOWOWOWOWO\",str2 = \"WOWOWO\") == \"WOWOWO\"\n assert candidate(str1 = \"HELLOHELLOHELLOHELLO\",str2 = \"HELLOHELLOHELLO\") == \"HELLO\"\n assert candidate(str1 = \"REPEATREPEATREPEATREPEATREPEAT\",str2 = \"REPEATREPEAT\") == \"REPEAT\"\n assert candidate(str1 = \"IDENTICALIDENTICALIDENTICAL\",str2 = \"IDENTICALIDENTICAL\") == \"IDENTICAL\"\n assert candidate(str1 = \"ABCDEFGABCDEFG\",str2 = \"DEFGABCD\") == \"\"\n assert candidate(str1 = \"SAMESTRINGSAME\",str2 = \"SAME\") == \"\"\n assert candidate(str1 = \"REPEATREPEATREPEAT\",str2 = \"REPEATREPEAT\") == \"REPEAT\"\n assert candidate(str1 = \"QQQQQQQQQQ\",str2 = \"QQQQ\") == \"QQ\"\n assert candidate(str1 = \"FAMILYFAMILYFAMILY\",str2 = \"FAMILYFAMILY\") == \"FAMILY\"\n assert candidate(str1 = \"ABCABCABCABCABCABC\",str2 = \"ABCABCABC\") == \"ABCABCABC\"\n assert candidate(str1 = \"\",str2 = \"A\") == \"\"\n assert candidate(str1 = \"UNIQUEUNIQUEUNIQUEUNIQUE\",str2 = \"UNIQUEUNIQUE\") == \"UNIQUEUNIQUE\"\n assert candidate(str1 = \"LONGSTRINGLONGSTRING\",str2 = \"LONGSTRING\") == \"LONGSTRING\"\n assert candidate(str1 = \"UNIQUEUNIQUE\",str2 = \"UNIQUEUNIQUEUNIQUE\") == \"UNIQUE\"\n assert candidate(str1 = \"MOUSEMOUSEMOUSEMOUSEMOUSEMOUSE\",str2 = \"MOUSEMOUSE\") == \"MOUSEMOUSE\"\n assert candidate(str1 = \"ABABABABABAB\",str2 = \"ABAB\") == \"ABAB\"\n assert candidate(str1 = \"HELLOWORLDHELLOWORLD\",str2 = \"HELLOWORLD\") == \"HELLOWORLD\"\n assert candidate(str1 = \"ABCDABCD\",str2 = \"ABCDABCDABCD\") == \"ABCD\"\n assert candidate(str1 = \"SAMESAMESAME\",str2 = \"SAME\") == \"SAME\"\n assert candidate(str1 = \"QRSTQRSTQRST\",str2 = \"QRSTQRST\") == \"QRST\"\n assert candidate(str1 = \"KARMAKARMAKARMAKARMA\",str2 = \"KARMAKARMA\") == \"KARMAKARMA\"\n assert candidate(str1 = \"AAAAABAAAAAB\",str2 = \"AAAAAB\") == \"AAAAAB\"\n assert candidate(str1 = \"TTT\",str2 = \"TTTTTTT\") == \"T\"\n assert candidate(str1 = \"QQQQQQQQQQQQQQQQ\",str2 = \"QQQQ\") == \"QQQQ\"\n assert candidate(str1 = \"AAAABBBBAAAABBBB\",str2 = \"AAAABBBB\") == \"AAAABBBB\"\n assert candidate(str1 = \"QWQWQWQWQWQW\",str2 = \"QWQWQW\") == \"QWQWQW\"\n assert candidate(str1 = \"PPPPPPPP\",str2 = \"PPPP\") == \"PPPP\"\n assert candidate(str1 = \"SPAMSPAMSPAMSPAM\",str2 = \"SPAMSPAM\") == \"SPAMSPAM\"\n assert candidate(str1 = \"PATTERNPATTERN\",str2 = \"PATTERN\") == \"PATTERN\"\n assert candidate(str1 = \"XYZXYZXYZXYZXYZXYZ\",str2 = \"XYZXYZ\") == \"XYZXYZ\"\n assert candidate(str1 = \"SCREENSCREENSCREENSCREEN\",str2 = \"SCREEN\") == \"SCREEN\"\n assert candidate(str1 = \"PIZZAPIZZAPIZZAPIZZA\",str2 = \"PIZZAPIZZA\") == \"PIZZAPIZZA\"\n assert candidate(str1 = \"ORANGEORANGEORANGEORANGEORANGEORANGEORANGEORANGE\",str2 = \"ORANGEORANGEORANGE\") == \"ORANGE\"\n assert candidate(str1 = \"PRIMEPRIMEPRIMEPRIME\",str2 = \"PRIMEPRIME\") == \"PRIMEPRIME\"\n assert candidate(str1 = \"REPEATREPEATREPEAT\",str2 = \"REPEAT\") == \"REPEAT\"\n assert candidate(str1 = \"CODECODECODECODECODECODE\",str2 = \"CODECODECODE\") == \"CODECODECODE\"\n assert candidate(str1 = \"PROJECTORPROJECTORPROJECTORPROJECTOR\",str2 = \"PROJECTORPROJECTOR\") == \"PROJECTORPROJECTOR\"\n assert candidate(str1 = \"PYTHONPYTHONPYTHON\",str2 = \"PYTHONPYTHON\") == \"PYTHON\"\n assert candidate(str1 = \"CCCCCCCCCCCCCC\",str2 = \"CCCCCCCCC\") == \"C\"\n assert candidate(str1 = \"PQPQPQ\",str2 = \"PQPQPQPQPQ\") == \"PQ\"\n assert candidate(str1 = \"DESKDESKDESKDESK\",str2 = \"DESK\") == \"DESK\"\n assert candidate(str1 = \"GUITARGUITARGUITAR\",str2 = \"GUITAR\") == \"GUITAR\"\n assert candidate(str1 = \"QWQWQWQWQW\",str2 = \"QWQWQW\") == \"QW\"\n assert candidate(str1 = \"LONGLONGLONGLONGLONG\",str2 = \"LONGLONGLONG\") == \"LONG\"\n assert candidate(str1 = \"DEVDEVDEVDEVDEV\",str2 = \"DEVDEV\") == \"DEV\"\n assert candidate(str1 = \"UNIQUEUNIQUEUNIQUEUNIQUEUNIQUE\",str2 = \"UNIQUEUNIQUEUNIQUE\") == \"UNIQUE\"\n assert candidate(str1 = \"TREETREETREETREE\",str2 = \"TREETREE\") == \"TREETREE\"\n assert candidate(str1 = \"XYZXYZXYZXYZXYZXYZ\",str2 = \"XYZXYZXYZ\") == \"XYZXYZXYZ\"\n assert candidate(str1 = \"HELLOHELLOHELLOHELLOHELLO\",str2 = \"HELLOHELLOHELLO\") == \"HELLO\"\n assert candidate(str1 = \"SMALL\",str2 = \"SMALLSMALLSMALL\") == \"SMALL\"\n assert candidate(str1 = \"MNMNMNMNMN\",str2 = \"MNMN\") == \"MN\"\n assert candidate(str1 = \"ABCABCABCABC\",str2 = \"ABCABC\") == \"ABCABC\"\n assert candidate(str1 = \"LONGERSTRINGLONGERSTRINGLONGERSTRING\",str2 = \"LONGERSTRINGLONGERSTRING\") == \"LONGERSTRING\"\n assert candidate(str1 = \"PATTERNPATTERNPATTERNPATTERN\",str2 = \"PATTERNPATTERN\") == \"PATTERNPATTERN\"\n assert candidate(str1 = \"HELLOHELLOHELLOHELLOHELLOHELLO\",str2 = \"HELLOHELLOHELLOHELLOHELLO\") == \"HELLO\"\n assert candidate(str1 = \"DIFFERENTLENGTHS\",str2 = \"SOMEOTHERSTRING\") == \"\"\n assert candidate(str1 = \"MIXEDUP\",str2 = \"MIXEDUPMIXEDUP\") == \"MIXEDUP\"\n assert candidate(str1 = \"KEYBOARDKEYBOARDKEYBOARDKEYBOARD\",str2 = \"KEYBOARDKEYBOARD\") == \"KEYBOARDKEYBOARD\"\n assert candidate(str1 = \"FLOWERFLOWERFLOWERFLOWER\",str2 = \"FLOWERFLOWER\") == \"FLOWERFLOWER\"\n assert candidate(str1 = \"LONGSTRING\",str2 = \"LONGSTRINGLONGSTRING\") == \"LONGSTRING\"\n assert candidate(str1 = \"SAMESTRINGSAMESTRINGSAMESTRING\",str2 = \"SAMESTRINGSAMESTRING\") == \"SAMESTRING\"\n assert candidate(str1 = \"NONONONONONO\",str2 = \"NONO\") == \"NONO\"\n assert candidate(str1 = \"ABCDABCDABCDABCD\",str2 = \"ABCDABCD\") == \"ABCDABCD\"\n assert candidate(str1 = \"TESTTESTTESTTEST\",str2 = \"TESTTEST\") == \"TESTTEST\"\n assert candidate(str1 = \"SAMELENGTH\",str2 = \"DIFFERENT\") == \"\"\n assert candidate(str1 = \"HELLOHELLOHELLO\",str2 = \"HELLOHELLO\") == \"HELLO\"\n assert candidate(str1 = \"DOGDOGDOGDOGDOG\",str2 = \"DOGDOG\") == \"DOG\"\n assert candidate(str1 = \"CATCATCATCATCAT\",str2 = \"CATCAT\") == \"CAT\"\n assert candidate(str1 = \"ABABABABAB\",str2 = \"ABAB\") == \"AB\"\n assert candidate(str1 = \"LONGLONGLONGLONG\",str2 = \"LONG\") == \"LONG\"\n assert candidate(str1 = \"COMPUTERCOMPUTERCOMPUTER\",str2 = \"COMPUTER\") == \"COMPUTER\"\n assert candidate(str1 = \"RUBYRUBYRUBYRUBY\",str2 = \"RUBYRUBY\") == \"RUBYRUBY\"\n assert candidate(str1 = \"BEEBEEBEEBEEBEE\",str2 = \"BEEBEE\") == \"BEE\"\n assert candidate(str1 = \"ABABABABABAB\",str2 = \"ABABAB\") == \"ABABAB\"\n assert candidate(str1 = \"BIGBIGBIGBIG\",str2 = \"BIG\") == \"BIG\"\n assert candidate(str1 = \"APPLEAPPLEAPPLEAPPLEAPPLEAPPLE\",str2 = \"APPLEAPPLEAPPLE\") == \"APPLEAPPLEAPPLE\"\n assert candidate(str1 = \"AABBCCDDEEFF\",str2 = \"AABBCCDD\") == \"\"\n assert candidate(str1 = \"UVUVUVUVUVUV\",str2 = \"UVUVUV\") == \"UVUVUV\"\n assert candidate(str1 = \"PPPPPPPPPP\",str2 = \"PPPP\") == \"PP\"\n assert candidate(str1 = \"TESTTESTTESTTEST\",str2 = \"TESTTESTTEST\") == \"TEST\"\n assert candidate(str1 = \"AABBCCDDEE\",str2 = \"AABBCC\") == \"\"\n assert candidate(str1 = \"MIXMIXMIXMIXMIX\",str2 = \"MIXMIX\") == \"MIX\"\n assert candidate(str1 = \"PYTHONPYTHONPYTHONPYTHON\",str2 = \"PYTHONPYTHON\") == \"PYTHONPYTHON\"\n assert candidate(str1 = \"\",str2 = \"\") == \"\"\n assert candidate(str1 = \"PYTHONPYTHONPYTHONPYTHONPYTHON\",str2 = \"PYTHONPYTHON\") == \"PYTHON\"\n assert candidate(str1 = \"AABBCCAABBCC\",str2 = \"AABBCC\") == \"AABBCC\"\n assert candidate(str1 = \"LIONLIONLIONLIONLIONLION\",str2 = \"LIONLIONLION\") == \"LIONLIONLION\"\n assert candidate(str1 = \"ABCDEFGABCDEFGABCDEFG\",str2 = \"ABCDEFGABCDEFG\") == \"ABCDEFG\"\n assert candidate(str1 = \"MICROPHONEMICROPHONEMICROPHONE\",str2 = \"MICROPHONE\") == \"MICROPHONE\"\n assert candidate(str1 = \"ABABABABABABABAB\",str2 = \"ABABAB\") == \"AB\"\n assert candidate(str1 = \"XYZXYZXYZXYZ\",str2 = \"XYZXYZ\") == \"XYZXYZ\"\n assert candidate(str1 = \"HEADPHONESHEADPHONES\",str2 = \"HEADPHONESHEADPHONES\") == \"HEADPHONESHEADPHONES\"\n assert candidate(str1 = \"ABCDEFGHABCDEFGHABCDEFGH\",str2 = \"ABCDEFGHABCDEFGH\") == \"ABCDEFGH\"\n assert candidate(str1 = \"SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER\",str2 = \"SPEAKERSPEAKER\") == \"SPEAKER\"\n assert candidate(str1 = \"DIVIDEDIVIDE\",str2 = \"DIVIDE\") == \"DIVIDE\"\n assert candidate(str1 = \"JSJSJSJSJSJSJS\",str2 = \"JSJSJSJS\") == \"JS\"\n assert candidate(str1 = \"CATCATCATCATCATCAT\",str2 = \"CATCATCAT\") == \"CATCATCAT\"\n assert candidate(str1 = \"NOTCOMMONNOTCOMMONNOTCOMMON\",str2 = \"NOTCOMMONNOT\") == \"\"\n assert candidate(str1 = \"XZXZXZXZXZ\",str2 = \"XZXZ\") == \"XZ\"\n assert candidate(str1 = \"DOGDOGDOGDOGDOGDOGDOGDOGDOGDOG\",str2 = \"DOGDOGDOGDOG\") == \"DOGDOG\"\n"}, "metadata": {"canonical_parameter_names": ["str1", "str2"], "leetcode_dataset_entry_point": "Solution().gcdOfStrings", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var gcdOfStrings = function(str1, str2) {", "container": null, "callable": "gcdOfStrings", "parameters": [{"name": "str1", "type": "string"}, {"name": "str2", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1072, "task_id": "flip-columns-for-maximum-number-of-equal-rows", "difficulty": "Medium", "problem_description": "You are given an m x n binary matrix matrix.\nYou can choose any number of columns in the matrix and flip every cell in that column (i.e., Change the value of the cell from 0 to 1 or vice versa).\nReturn the maximum number of rows that have all values equal after some number of flips.\n \nExample 1:\n\nInput: matrix = [[0,1],[1,1]]\nOutput: 1\nExplanation: After flipping no values, 1 row has all values equal.\n\nExample 2:\n\nInput: matrix = [[0,1],[1,0]]\nOutput: 2\nExplanation: After flipping values in the first column, both rows have equal values.\n\nExample 3:\n\nInput: matrix = [[0,0,0],[0,0,1],[1,1,0]]\nOutput: 2\nExplanation: After flipping values in the first two columns, the last two rows have equal values.\n\n \nConstraints:\n\nm == matrix.length\nn == matrix[i].length\n1 <= m, n <= 300\nmatrix[i][j] is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(matrix = [[0, 1], [1, 0]]) == 2\n assert candidate(matrix = [[1, 0, 0, 1], [1, 0, 0, 1], [0, 1, 1, 0]]) == 3\n assert candidate(matrix = [[1, 1, 1, 1], [0, 0, 0, 0], [1, 0, 1, 0]]) == 2\n assert candidate(matrix = [[1, 0, 0, 1], [1, 1, 1, 1], [0, 1, 0, 0]]) == 1\n assert candidate(matrix = [[1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1]]) == 3\n assert candidate(matrix = [[0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 1]]) == 2\n assert candidate(matrix = [[1, 1, 1], [0, 0, 0], [1, 0, 1]]) == 2\n assert candidate(matrix = [[0, 1], [1, 1]]) == 1\n assert candidate(matrix = [[0, 0, 0], [0, 0, 1], [1, 1, 0]]) == 2\n assert candidate(matrix = [[0, 0, 0, 0], [0, 0, 0, 0], [1, 1, 1, 1]]) == 3\n assert candidate(matrix = [[1, 0, 0, 1], [1, 0, 1, 0], [0, 1, 0, 0]]) == 1\n assert candidate(matrix = [[0, 0], [0, 0], [1, 1], [1, 1]]) == 4\n assert candidate(matrix = [[0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 1, 0]]) == 4\n assert candidate(matrix = [[1, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0], [1, 1, 0, 1, 0, 1], [1, 1, 0, 1, 0, 1]]) == 4\n assert candidate(matrix = [[1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 0], [1, 1, 0, 0, 1, 1, 1]]) == 2\n assert candidate(matrix = [[1, 1, 1, 0, 1], [1, 1, 0, 1, 1], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [1, 1, 0, 0, 1]]) == 2\n assert candidate(matrix = [[1, 1, 1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0]]) == 4\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 2\n assert candidate(matrix = [[0, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0]]) == 2\n assert candidate(matrix = [[1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 2\n assert candidate(matrix = [[1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]]) == 2\n assert candidate(matrix = [[1, 0, 0, 1, 1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1, 1, 1], [0, 1, 1, 0, 0, 1, 1, 0, 0, 0]]) == 2\n assert candidate(matrix = [[1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 4\n assert candidate(matrix = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 0]]) == 2\n assert candidate(matrix = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(matrix = [[1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 2\n assert candidate(matrix = [[0, 1, 1, 0, 1], [1, 0, 0, 1, 0], [0, 1, 1, 0, 1], [1, 0, 0, 1, 0]]) == 4\n assert candidate(matrix = [[0, 0, 1, 0, 1], [1, 1, 0, 1, 0], [1, 1, 0, 1, 1], [0, 0, 1, 0, 0]]) == 2\n assert candidate(matrix = [[1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1]]) == 2\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 4\n assert candidate(matrix = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 2\n assert candidate(matrix = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 2\n assert candidate(matrix = [[1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(matrix = [[1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 2\n assert candidate(matrix = [[1, 0, 0, 0, 0, 1, 1, 0], [1, 1, 1, 0, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0]]) == 1\n assert candidate(matrix = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(matrix = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 1], [1, 0, 1, 0, 0]]) == 2\n assert candidate(matrix = [[1, 1, 1, 0, 0, 0, 1], [0, 0, 0, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0]]) == 2\n assert candidate(matrix = [[1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0]]) == 2\n assert candidate(matrix = [[0, 0, 1, 1, 0], [1, 1, 0, 0, 1], [0, 0, 1, 1, 1], [1, 1, 0, 0, 0]]) == 2\n assert candidate(matrix = [[1, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1]]) == 2\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 4\n assert candidate(matrix = [[0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 0], [1, 0, 1, 0, 1, 0, 0, 1]]) == 2\n assert candidate(matrix = [[1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 2\n assert candidate(matrix = [[0, 1, 1, 0, 1, 0, 0], [1, 0, 0, 1, 0, 1, 1], [0, 1, 1, 0, 1, 0, 0], [1, 0, 0, 1, 0, 1, 1]]) == 4\n assert candidate(matrix = [[1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 0, 1]]) == 4\n assert candidate(matrix = [[1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 2\n assert candidate(matrix = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 4\n assert candidate(matrix = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 1\n assert candidate(matrix = [[0, 1, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 0, 1, 0, 0, 1, 0, 1, 0], [1, 1, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 1, 0, 1, 0, 1]]) == 2\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 1]]) == 2\n assert candidate(matrix = [[1, 1, 0, 0, 1, 1], [1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1]]) == 2\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == 3\n assert candidate(matrix = [[1, 1, 1, 0, 0, 1], [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 1], [1, 1, 1, 0, 0, 0]]) == 2\n assert candidate(matrix = [[0, 0, 1, 1, 0], [0, 0, 1, 1, 1], [1, 1, 0, 0, 1], [1, 1, 0, 0, 0]]) == 2\n assert candidate(matrix = [[1, 0, 0, 1, 0, 1, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 3\n assert candidate(matrix = [[1, 1, 0, 0, 1, 0], [0, 0, 1, 1, 0, 1], [1, 1, 0, 0, 1, 0], [0, 0, 1, 1, 0, 1]]) == 4\n assert candidate(matrix = [[0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 0, 1, 1, 0]]) == 2\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0]]) == 2\n assert candidate(matrix = [[1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0, 1, 1, 0]]) == 4\n assert candidate(matrix = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 2\n assert candidate(matrix = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 0]]) == 2\n assert candidate(matrix = [[1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1]]) == 4\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1]]) == 4\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0]]) == 3\n assert candidate(matrix = [[1, 0, 0, 0, 0, 1, 1], [0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1, 0]]) == 2\n assert candidate(matrix = [[1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 2\n assert candidate(matrix = [[1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 2\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]]) == 2\n assert candidate(matrix = [[0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0]]) == 4\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 2\n assert candidate(matrix = [[0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0]]) == 2\n assert candidate(matrix = [[1, 1, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1, 1, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 2\n assert candidate(matrix = [[0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]]) == 4\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 2\n assert candidate(matrix = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 1], [0, 0, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0], [1, 0, 0, 0, 0]]) == 1\n assert candidate(matrix = [[0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1, 0, 1], [0, 0, 1, 1, 0, 0, 1, 0]]) == 2\n assert candidate(matrix = [[1, 1, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1]]) == 2\n assert candidate(matrix = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 2\n assert candidate(matrix = [[1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 2\n assert candidate(matrix = [[0, 1, 1, 1, 0], [0, 1, 1, 0, 1], [1, 0, 0, 1, 0], [1, 0, 0, 0, 1]]) == 2\n assert candidate(matrix = [[1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 1], [0, 0, 1, 1, 1]]) == 3\n assert candidate(matrix = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 2\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 1\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1]]) == 2\n assert candidate(matrix = [[0, 1, 1, 1, 0, 0, 1, 1, 1, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 1], [0, 1, 1, 1, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1]]) == 3\n"}, "metadata": {"canonical_parameter_names": ["matrix"], "leetcode_dataset_entry_point": "Solution().maxEqualRowsAfterFlips", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxEqualRowsAfterFlips = function(matrix) {", "container": null, "callable": "maxEqualRowsAfterFlips", "parameters": [{"name": "matrix", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1073, "task_id": "adding-two-negabinary-numbers", "difficulty": "Medium", "problem_description": "Given two numbers arr1 and arr2 in base -2, return the result of adding them together.\nEach number is given in array format:  as an array of 0s and 1s, from most significant bit to least significant bit.  For example, arr = [1,1,0,1] represents the number (-2)^3 + (-2)^2 + (-2)^0 = -3.  A number arr in array, format is also guaranteed to have no leading zeros: either arr == [0] or arr[0] == 1.\nReturn the result of adding arr1 and arr2 in the same format: as an array of 0s and 1s with no leading zeros.\n \nExample 1:\n\nInput: arr1 = [1,1,1,1,1], arr2 = [1,0,1]\nOutput: [1,0,0,0,0]\nExplanation: arr1 represents 11, arr2 represents 5, the output represents 16.\n\nExample 2:\n\nInput: arr1 = [0], arr2 = [0]\nOutput: [0]\n\nExample 3:\n\nInput: arr1 = [0], arr2 = [1]\nOutput: [1]\n\n \nConstraints:\n\n1 <= arr1.length, arr2.length <= 1000\narr1[i] and arr2[i] are 0 or 1\narr1 and arr2 have no leading zeros\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr1 = [0],arr2 = [0]) == [0]\n assert candidate(arr1 = [1, 0, 1, 0, 1],arr2 = [1, 0, 1, 0, 1]) == [1, 1, 1, 1, 1, 1, 0]\n assert candidate(arr1 = [1, 1, 0],arr2 = [1, 1, 0]) == [1, 0, 0]\n assert candidate(arr1 = [1, 0, 1],arr2 = [1, 1, 1, 1, 1]) == [1, 0, 0, 0, 0]\n assert candidate(arr1 = [1, 1, 0, 1],arr2 = [1, 0, 1, 0]) == [1, 1, 0, 1, 1, 1]\n assert candidate(arr1 = [1, 0, 0, 1],arr2 = [1, 1, 0, 1]) == [1, 0, 1, 0]\n assert candidate(arr1 = [1, 0, 0, 1],arr2 = [1, 1, 0]) == [1, 1, 1, 1]\n assert candidate(arr1 = [1, 0, 0, 0, 0],arr2 = [1, 0, 0, 0, 0]) == [1, 1, 0, 0, 0, 0, 0]\n assert candidate(arr1 = [1, 0, 1, 1],arr2 = [1, 1, 0, 0]) == [1, 1, 0, 1, 1, 1]\n assert candidate(arr1 = [1, 1, 0, 1],arr2 = [1, 0, 1, 1]) == [1, 1, 0, 1, 0, 0]\n assert candidate(arr1 = [1, 1, 1],arr2 = [1, 1, 1]) == [1, 1, 0, 1, 0]\n assert candidate(arr1 = [1, 1, 0, 0],arr2 = [1, 1, 1, 1]) == [1, 0, 1, 1]\n assert candidate(arr1 = [1, 1, 1, 1, 1],arr2 = [1, 0, 1]) == [1, 0, 0, 0, 0]\n assert candidate(arr1 = [1, 1, 1, 0, 1],arr2 = [1, 1, 0, 0, 0]) == [1, 0, 1, 0, 1]\n assert candidate(arr1 = [0],arr2 = [1]) == [1]\n assert candidate(arr1 = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1],arr2 = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]) == [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0]\n assert candidate(arr1 = [1, 1, 0, 0, 0, 1, 0],arr2 = [0, 1, 1, 0, 1, 1, 0]) == [1, 0, 0, 0, 0]\n assert candidate(arr1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],arr2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [0]\n assert candidate(arr1 = [1, 1, 1, 1, 1],arr2 = [1, 1, 1, 1, 1]) == [1, 1, 0, 1, 0, 1, 0]\n assert candidate(arr1 = [1, 1, 0, 0, 1, 1, 1, 1],arr2 = [1, 0, 1, 0, 1, 0, 1, 0]) == [1, 1, 0, 0, 0, 1, 0, 0, 0, 1]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 0, 1],arr2 = [1, 0, 1, 1, 1]) == [1, 0, 0, 0, 0, 0, 0]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(arr1 = [1, 0, 1, 1, 0, 1],arr2 = [1, 1, 0, 0, 1, 1]) == [1, 1, 0, 1, 1, 1, 0, 0]\n assert candidate(arr1 = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1],arr2 = [1, 1, 0, 0, 0, 0, 0, 0, 0, 1]) == [1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0]\n assert candidate(arr1 = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],arr2 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(arr1 = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]\n assert candidate(arr1 = [0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0],arr2 = [1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1]) == [1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1]\n assert candidate(arr1 = [1, 1, 0, 1, 1, 0, 1, 1, 0],arr2 = [0, 1, 1, 0, 0, 1, 0, 1, 1]) == [1, 1, 1, 1, 0, 0, 1]\n assert candidate(arr1 = [1, 1, 0, 1, 1, 1, 0, 1],arr2 = [1, 1, 1, 0, 1, 0, 1, 1]) == [1, 0, 1, 0, 0, 1, 0, 0]\n assert candidate(arr1 = [1, 1, 0, 1, 0],arr2 = [1, 0, 1, 1, 1]) == [1, 1, 0, 1, 0, 0, 1]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],arr2 = [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1]) == [1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],arr2 = [1, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0],arr2 = [1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]) == [1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1]) == [1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(arr1 = [1, 0, 0, 1, 1, 1, 0, 1, 0],arr2 = [1, 1, 1, 1, 0, 1, 0, 1]) == [1, 1, 1, 1, 0, 1, 1, 1, 1]\n assert candidate(arr1 = [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],arr2 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(arr1 = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],arr2 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(arr1 = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0],arr2 = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1],arr2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 0, 0]\n assert candidate(arr1 = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1],arr2 = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == [1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0]\n assert candidate(arr1 = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1],arr2 = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1]) == [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(arr1 = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],arr2 = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(arr1 = [1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0],arr2 = [1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1]) == [1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1]\n assert candidate(arr1 = [0, 1, 0, 1, 0, 1, 0, 1],arr2 = [1, 0, 1, 0, 1, 0, 1, 0]) == [1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],arr2 = [1, 1, 0, 1, 1, 0, 1, 1, 0, 1]) == [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 0, 1],arr2 = [1, 0, 1, 0, 1, 1]) == [1, 0, 0]\n assert candidate(arr1 = [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1],arr2 = [1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1]) == [1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0]\n assert candidate(arr1 = [0, 1, 1, 1, 0, 1, 1, 0],arr2 = [1, 0, 1, 0, 1, 0, 1, 0]) == [1, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(arr1 = [1, 0, 0, 0, 0, 0, 0, 0, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0]\n assert candidate(arr1 = [1, 0, 0, 1, 0, 0, 1],arr2 = [0, 1, 1, 1, 0, 0, 1]) == [1, 1, 0, 0, 1, 1, 0]\n assert candidate(arr1 = [1, 1, 1, 0, 1],arr2 = [1, 0, 1, 1, 1]) == [1, 1, 0, 0, 0, 0, 0]\n assert candidate(arr1 = [1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0],arr2 = [1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1]) == [1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1],arr2 = [1, 1, 0, 1, 1, 0, 1]) == [1, 1, 0, 1, 1, 0, 1, 1, 0]\n assert candidate(arr1 = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],arr2 = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0]\n assert candidate(arr1 = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0],arr2 = [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0]) == [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],arr2 = [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1]) == [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1],arr2 = [1, 1, 1, 1, 1, 1, 1]) == [1, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(arr1 = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1],arr2 = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1]) == [1, 0, 0, 0, 1, 0, 0, 0, 1, 0]\n assert candidate(arr1 = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]\n assert candidate(arr1 = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1],arr2 = [1, 1, 1, 0, 1, 1, 0, 1, 1, 0]) == [1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(arr1 = [1, 1, 1, 0, 1, 1],arr2 = [1, 0, 0, 1, 0, 1]) == [1, 1, 0, 1, 1, 1, 0, 0]\n assert candidate(arr1 = [1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1],arr2 = [1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1]) == [1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],arr2 = [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1]) == [1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]\n assert candidate(arr1 = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],arr2 = [1]) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\n assert candidate(arr1 = [1, 1, 0, 0, 1, 1, 0, 1],arr2 = [1, 1, 1, 1, 0, 0, 1, 1]) == [1, 0, 1, 1, 1, 1, 0, 0]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],arr2 = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [1, 1, 1, 0, 1, 1, 0, 1, 1, 0],arr2 = [1, 1, 0, 0, 0, 1, 0, 1, 0, 1]) == [1, 0, 1, 0, 0, 1, 1, 0, 1, 1]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1],arr2 = [1, 0, 0, 1, 1, 0, 0, 1, 1]) == [1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1],arr2 = [1, 1, 0, 1, 0, 1, 0]) == [1, 1, 0, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0],arr2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == [1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1],arr2 = [1, 0, 1, 0, 1, 0, 1]) == [1, 1, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],arr2 = [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [0, 0, 1, 1, 1, 0, 1, 1, 0],arr2 = [0, 1, 0, 0, 1, 1, 1, 0, 1]) == [1, 1, 0, 0, 0, 0, 1, 1]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],arr2 = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [1, 1, 0, 0, 0, 1, 1],arr2 = [1, 1, 1, 1, 0, 0, 1]) == [1, 0, 1, 1, 0, 0, 0]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1],arr2 = [1, 1, 1, 0, 0, 1, 1]) == [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0]\n assert candidate(arr1 = [1, 1, 1, 0, 0, 1, 1, 0, 1, 1],arr2 = [1, 0, 1, 1, 1, 0, 0, 1, 1, 1]) == [1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(arr1 = [1, 1, 0, 1, 0, 1, 1, 1, 0, 1],arr2 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 1]) == [1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0]\n assert candidate(arr1 = [1, 1, 1, 0, 1, 0],arr2 = [1, 0, 1, 1, 0]) == [1, 0, 0, 0]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1],arr2 = [1, 1, 1, 1, 1, 1]) == [1, 0, 1, 0, 1, 0]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(arr1 = [1, 0, 0, 0, 1, 0, 0, 0, 1],arr2 = [1, 0, 0, 0, 1, 0, 0, 0, 1]) == [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(arr1 = [1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1],arr2 = [1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1]) == [1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0],arr2 = [0, 1, 0, 1, 0, 1]) == [1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [1, 1, 1, 0, 0, 0, 1, 1],arr2 = [1, 0, 1, 1, 1, 0, 0, 0]) == [1, 1, 0, 0, 0, 1, 1, 0, 1, 1]\n assert candidate(arr1 = [1, 1, 0, 1, 0, 1],arr2 = [1, 0, 0, 0, 1, 0]) == [1, 1, 0, 1, 0, 1, 1, 1]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1],arr2 = [1, 1, 0, 1, 0, 1]) == [1, 0, 1, 1, 1, 1, 0]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],arr2 = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [1, 0, 1, 0, 1, 0, 1, 0],arr2 = [0, 1, 0, 1, 0, 1, 0, 1]) == [1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [1, 1, 1, 1, 1],arr2 = [1, 0, 1, 0, 1]) == [1, 1, 0, 0, 0, 0, 0]\n assert candidate(arr1 = [1, 1, 0, 1, 1],arr2 = [1, 1, 1, 0, 0]) == [1, 0, 1, 1, 1]\n assert candidate(arr1 = [1, 1, 0, 0, 0, 1, 1, 0, 0, 0],arr2 = [1, 0, 0, 1, 1, 0, 0, 1, 1, 0]) == [1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0]\n assert candidate(arr1 = [1, 0, 0, 0, 0, 0, 0, 0, 0],arr2 = [1, 0, 0, 0, 0, 0, 0, 0, 0]) == [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(arr1 = [1, 1, 1, 0, 0, 1],arr2 = [1, 0, 1, 0, 1]) == [1, 0]\n assert candidate(arr1 = [1, 1, 1, 0, 0, 1, 1, 0, 1],arr2 = [1, 0, 1, 1, 1, 0, 0, 0, 0]) == [1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1]\n assert candidate(arr1 = [1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1],arr2 = [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]) == [1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1]\n"}, "metadata": {"canonical_parameter_names": ["arr1", "arr2"], "leetcode_dataset_entry_point": "Solution().addNegabinary", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var addNegabinary = function(arr1, arr2) {", "container": null, "callable": "addNegabinary", "parameters": [{"name": "arr1", "type": "number[]"}, {"name": "arr2", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1074, "task_id": "number-of-submatrices-that-sum-to-target", "difficulty": "Hard", "problem_description": "Given a matrix and a target, return the number of non-empty submatrices that sum to target.\nA submatrix x1, y1, x2, y2 is the set of all cells matrix[x][y] with x1 <= x <= x2 and y1 <= y <= y2.\nTwo submatrices (x1, y1, x2, y2) and (x1', y1', x2', y2') are different if they have some coordinate that is different: for example, if x1 != x1'.\n \nExample 1:\n\n\nInput: matrix = [[0,1,0],[1,1,1],[0,1,0]], target = 0\nOutput: 4\nExplanation: The four 1x1 submatrices that only contain 0.\n\nExample 2:\n\nInput: matrix = [[1,-1],[-1,1]], target = 0\nOutput: 5\nExplanation: The two 1x2 submatrices, plus the two 2x1 submatrices, plus the 2x2 submatrix.\n\nExample 3:\n\nInput: matrix = [[904]], target = 0\nOutput: 0\n\n \nConstraints:\n\n1 <= matrix.length <= 100\n1 <= matrix[0].length <= 100\n-1000 <= matrix[i][j] <= 1000\n-10^8 <= target <= 10^8\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(matrix = [[1]],target = 1) == 1\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6]],target = 12) == 1\n assert candidate(matrix = [[-1, -1, -1], [-1, -1, -1], [-1, -1, -1]],target = -9) == 1\n assert candidate(matrix = [[0, 0, 0], [0, 0, 0], [0, 0, 0]],target = 0) == 36\n assert candidate(matrix = [[1, 2], [3, 4]],target = 3) == 2\n assert candidate(matrix = [[904]],target = 0) == 0\n assert candidate(matrix = [[1, -1, 0], [0, 0, 0], [0, 0, 0]],target = -1) == 6\n assert candidate(matrix = [[0, 1, 0], [1, 1, 1], [0, 1, 0]],target = 0) == 4\n assert candidate(matrix = [[1, -1], [-1, 1]],target = 0) == 5\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],target = 15) == 4\n assert candidate(matrix = [[1, -1, 1, -1], [-1, 1, -1, 1], [1, -1, 1, -1], [-1, 1, -1, 1]],target = 0) == 64\n assert candidate(matrix = [[-1, 0, 1, -1, 1], [0, 1, -1, 1, -1], [1, -1, 1, -1, 1], [-1, 1, -1, 1, -1], [1, -1, 1, -1, 1]],target = 0) == 128\n assert candidate(matrix = [[5, 1, 2, 3], [1, 6, 4, 5], [2, 4, 7, 8], [3, 5, 8, 9]],target = 18) == 0\n assert candidate(matrix = [[1, -1, 1, -1], [1, -1, 1, -1], [-1, 1, -1, 1], [-1, 1, -1, 1]],target = 0) == 52\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6], [7, 8]],target = 10) == 2\n assert candidate(matrix = [[-1, 2, -3, 4], [-2, 3, -4, 5], [-3, 4, -5, 6], [-4, 5, -6, 7]],target = 10) == 0\n assert candidate(matrix = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]],target = 45) == 2\n assert candidate(matrix = [[-1, -1, -1], [-1, -1, -1], [-1, -1, -1]],target = -3) == 6\n assert candidate(matrix = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],target = 0) == 100\n assert candidate(matrix = [[-1, 1, -1], [1, -1, 1], [-1, 1, -1]],target = 0) == 20\n assert candidate(matrix = [[10, 20, 10], [20, 30, 20], [10, 20, 10]],target = 60) == 0\n assert candidate(matrix = [[1, 2], [2, 1], [1, 2], [2, 1]],target = 3) == 10\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6], [7, 8]],target = 10) == 2\n assert candidate(matrix = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7]],target = 10) == 2\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],target = 15) == 4\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]],target = 21) == 4\n assert candidate(matrix = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7]],target = 15) == 6\n assert candidate(matrix = [[5, 1, -2, 4], [2, 1, 0, 3], [-1, 3, -1, 2], [0, 2, 1, -1]],target = 3) == 10\n assert candidate(matrix = [[-1, 1, 2, -1], [1, 1, -1, 1], [-2, -2, 1, 2]],target = 0) == 8\n assert candidate(matrix = [[1000, -1000, 1000], [-1000, 1000, -1000], [1000, -1000, 1000]],target = 0) == 20\n assert candidate(matrix = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],target = 4) == 17\n assert candidate(matrix = [[1, -2, 3], [-4, 5, -6], [7, -8, 9]],target = -5) == 2\n assert candidate(matrix = [[1, -1, 0], [0, 1, -1], [-1, 0, 1]],target = 0) == 19\n assert candidate(matrix = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],target = 0) == 60\n assert candidate(matrix = [[-1, 2, -3, 4, 5], [2, -1, 3, -4, 6], [-3, 2, -1, 4, -5], [4, -3, 2, -1, 5]],target = 3) == 19\n assert candidate(matrix = [[1, 0, 1], [0, -1, 0], [1, 0, 1]],target = 2) == 4\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]],target = 20) == 1\n assert candidate(matrix = [[1, 2, 3], [1, 2, 3], [1, 2, 3]],target = 6) == 8\n assert candidate(matrix = [[5, -1, 3], [-3, 0, 5], [3, -2, -1]],target = 4) == 3\n assert candidate(matrix = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],target = 0) == 100\n assert candidate(matrix = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]],target = -15) == 4\n assert candidate(matrix = [[5, -4, -3, 4], [-3, -4, 4, 5], [5, 1, 5, -4]],target = 5) == 6\n assert candidate(matrix = [[-10, 20, -30], [40, -50, 60], [-70, 80, -90]],target = -50) == 2\n assert candidate(matrix = [[-1, 0, 1], [2, 3, 4], [5, 6, 7]],target = 10) == 0\n assert candidate(matrix = [[1, -2, 3, -4], [-4, 3, -2, 1], [2, -3, 4, -5], [-5, 4, -3, 2]],target = -6) == 4\n assert candidate(matrix = [[0, 1, 2], [3, 4, 5], [6, 7, 8]],target = 12) == 3\n assert candidate(matrix = [[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]],target = 1) == 40\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]],target = 25) == 0\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],target = 30) == 0\n assert candidate(matrix = [[10, -10, 20, -20], [-10, 10, -20, 20], [20, -20, 30, -30], [-20, 20, -30, 30]],target = 0) == 52\n assert candidate(matrix = [[10, 20, 30], [40, 50, 60], [70, 80, 90]],target = 150) == 4\n assert candidate(matrix = [[1, -2, 3, -4, 5], [6, -7, 8, -9, 10], [-11, 12, -13, 14, -15], [16, -17, 18, -19, 20]],target = 5) == 10\n assert candidate(matrix = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]],target = 60) == 3\n assert candidate(matrix = [[5, 5, 5], [5, 5, 5], [5, 5, 5]],target = 15) == 6\n assert candidate(matrix = [[0, 1, 0], [1, 1, 1], [0, 1, 0], [1, 0, 1], [0, 1, 0]],target = 1) == 33\n assert candidate(matrix = [[1, 0, -1, 1], [2, 3, 2, -1], [-1, -1, -1, -1], [1, 1, 1, 1]],target = 1) == 18\n assert candidate(matrix = [[-10, -20, -30], [-20, -30, -40], [-30, -40, -50]],target = -70) == 4\n assert candidate(matrix = [[1, 0, 1], [0, 1, 0], [1, 0, 1]],target = 2) == 8\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]],target = 30) == 4\n assert candidate(matrix = [[100, 200, 300], [400, 500, 600], [700, 800, 900]],target = 1500) == 4\n assert candidate(matrix = [[-1, 2, -3, 4], [-5, 6, -7, 8], [9, -10, 11, -12], [-13, 14, -15, 16]],target = 0) == 9\n assert candidate(matrix = [[1, 0, 1], [0, -2, 3]],target = 2) == 2\n assert candidate(matrix = [[10, 20, 30], [40, 50, 60], [70, 80, 90]],target = 150) == 4\n assert candidate(matrix = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],target = 3) == 6\n assert candidate(matrix = [[1, 2, -3, 4], [-1, 0, 2, 1], [3, -2, 1, 4], [0, 1, -1, 2]],target = 5) == 4\n assert candidate(matrix = [[1, 2, 3], [3, 2, 1], [4, 5, 6], [6, 5, 4]],target = 9) == 3\n assert candidate(matrix = [[-1, 2, 3], [-4, 5, -6], [7, -8, 9]],target = 5) == 3\n assert candidate(matrix = [[-1, 2, -3, 4, -5], [5, -6, 7, -8, 9], [-9, 10, -11, 12, -13], [14, -15, 16, -17, 18], [-19, 20, -21, 22, -23]],target = 0) == 36\n assert candidate(matrix = [[1, 2, 3], [2, 3, 4], [3, 4, 5]],target = 9) == 4\n assert candidate(matrix = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]],target = -15) == 4\n assert candidate(matrix = [[0, 1, 0], [1, 1, 1], [0, 1, 0], [1, 1, 1], [0, 1, 0]],target = 1) == 30\n assert candidate(matrix = [[1, 2, -1, -4, -20], [2, 3, -2, -3, -15], [3, 4, -3, -2, -10], [4, 5, -4, -1, -5]],target = -5) == 9\n assert candidate(matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]],target = 30) == 2\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]],target = 24) == 3\n assert candidate(matrix = [[10, 20, 30], [20, 30, 40], [30, 40, 50]],target = 70) == 4\n assert candidate(matrix = [[0, 0, 0], [0, 0, 0], [0, 0, 0]],target = 0) == 36\n assert candidate(matrix = [[1, 2], [3, 4], [5, 6]],target = 10) == 2\n assert candidate(matrix = [[-1, 2, -3, 4], [2, -2, 1, 1], [-1, 3, -2, 2], [1, -1, 2, -2]],target = 0) == 16\n assert candidate(matrix = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]],target = 2) == 56\n assert candidate(matrix = [[0, 0, 0], [0, 1, 0], [0, 0, 0]],target = 1) == 16\n assert candidate(matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]],target = 10) == 3\n assert candidate(matrix = [[1, -1, 1], [-1, 1, -1], [1, -1, 1]],target = 0) == 20\n"}, "metadata": {"canonical_parameter_names": ["matrix", "target"], "leetcode_dataset_entry_point": "Solution().numSubmatrixSumTarget", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numSubmatrixSumTarget = function(matrix, target) {", "container": null, "callable": "numSubmatrixSumTarget", "parameters": [{"name": "matrix", "type": "number[][]"}, {"name": "target", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1078, "task_id": "occurrences-after-bigram", "difficulty": "Easy", "problem_description": "Given two strings first and second, consider occurrences in some text of the form \"first second third\", where second comes immediately after first, and third comes immediately after second.\nReturn an array of all the words third for each occurrence of \"first second third\".\n \nExample 1:\nInput: text = \"alice is a good girl she is a good student\", first = \"a\", second = \"good\"\nOutput: [\"girl\",\"student\"]\nExample 2:\nInput: text = \"we will we will rock you\", first = \"we\", second = \"will\"\nOutput: [\"we\",\"rock\"]\n\n \nConstraints:\n\n1 <= text.length <= 1000\ntext consists of lowercase English letters and spaces.\nAll the words in text are separated by a single space.\n1 <= first.length, second.length <= 10\nfirst and second consist of lowercase English letters.\ntext will not have any leading or trailing spaces.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(text = \"hello world hello hello world\",first = \"hello\",second = \"world\") == ['hello']\n assert candidate(text = \"repeat repeat repeat repeat\",first = \"repeat\",second = \"repeat\") == ['repeat', 'repeat']\n assert candidate(text = \"look at the stars look at the moon\",first = \"look\",second = \"at\") == ['the', 'the']\n assert candidate(text = \"in the beginning there was the word\",first = \"the\",second = \"beginning\") == ['there']\n assert candidate(text = \"this is a test this is only a test\",first = \"this\",second = \"is\") == ['a', 'only']\n assert candidate(text = \"one two three two three four three five\",first = \"two\",second = \"three\") == ['two', 'four']\n assert candidate(text = \"every good boy does fine every good boy does fine\",first = \"good\",second = \"boy\") == ['does', 'does']\n assert candidate(text = \"alice is a good girl she is a good student\",first = \"a\",second = \"good\") == ['girl', 'student']\n assert candidate(text = \"we will we will rock you\",first = \"we\",second = \"will\") == ['we', 'rock']\n assert candidate(text = \"foo bar foo bar foo\",first = \"foo\",second = \"bar\") == ['foo', 'foo']\n assert candidate(text = \"in a village of la mancha the name of which i have no desire to call to mind\",first = \"village\",second = \"of\") == ['la']\n assert candidate(text = \"this is a test this is only a test\",first = \"is\",second = \"a\") == ['test']\n assert candidate(text = \"foo bar foo foo bar bar foo\",first = \"foo\",second = \"bar\") == ['foo', 'bar']\n assert candidate(text = \"the quick brown fox jumps over the lazy dog\",first = \"the\",second = \"lazy\") == ['dog']\n assert candidate(text = \"the quick brown fox jumps over the lazy dog the quick brown fox jumps over the lazy dog\",first = \"quick\",second = \"brown\") == ['fox', 'fox']\n assert candidate(text = \"a b c a b c a b c a b c a b c a b c\",first = \"a\",second = \"b\") == ['c', 'c', 'c', 'c', 'c', 'c']\n assert candidate(text = \"repeat repeat repeat repeat repeat repeat repeat repeat repeat\",first = \"repeat\",second = \"repeat\") == ['repeat', 'repeat', 'repeat', 'repeat', 'repeat', 'repeat', 'repeat']\n assert candidate(text = \"one two three four five six seven eight nine ten eleven twelve\",first = \"five\",second = \"six\") == ['seven']\n assert candidate(text = \"the quick brown fox jumps over the lazy dog the quick brown fox\",first = \"quick\",second = \"brown\") == ['fox', 'fox']\n assert candidate(text = \"a tale of two cities a tale of two brothers a tale of two sisters\",first = \"tale\",second = \"of\") == ['two', 'two', 'two']\n assert candidate(text = \"once upon a time in a land far far away once upon a time in a magical land\",first = \"once\",second = \"upon\") == ['a', 'a']\n assert candidate(text = \"this is a simple test this is a more complex test this is a simple test\",first = \"is\",second = \"a\") == ['simple', 'more', 'simple']\n assert candidate(text = \"the rain in spain stays mainly in the plain the rain in spain\",first = \"rain\",second = \"in\") == ['spain', 'spain']\n assert candidate(text = \"one fish two fish red fish blue fish one fish two fish red fish blue fish\",first = \"fish\",second = \"red\") == ['fish', 'fish']\n assert candidate(text = \"one two three four five six seven eight nine ten one two three four five six\",first = \"three\",second = \"four\") == ['five', 'five']\n assert candidate(text = \"x y z x y z x y z x y z x y z x y z x y z x y z\",first = \"x\",second = \"y\") == ['z', 'z', 'z', 'z', 'z', 'z', 'z', 'z']\n assert candidate(text = \"this is a simple sentence to test the function this is a simple test\",first = \"simple\",second = \"sentence\") == ['to']\n assert candidate(text = \"a a a a a a a a a a a a a a a a a a a a a\",first = \"a\",second = \"a\") == ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a']\n assert candidate(text = \"once upon a time in a land far far away once upon a time\",first = \"once\",second = \"upon\") == ['a', 'a']\n assert candidate(text = \"repeated repeated repeated repeated repeated repeated\",first = \"repeated\",second = \"repeated\") == ['repeated', 'repeated', 'repeated', 'repeated']\n assert candidate(text = \"abc def ghi jkl mno pqr stu vwx yz abc def ghi jkl mno\",first = \"def\",second = \"ghi\") == ['jkl', 'jkl']\n assert candidate(text = \"a b c a b c a b c a b c a b c a b c a b c a b c a b c a b c\",first = \"a\",second = \"b\") == ['c', 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c']\n assert candidate(text = \"a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d\",first = \"a\",second = \"b\") == ['c', 'c']\n assert candidate(text = \"this is a simple test case this is a very simple test case\",first = \"is\",second = \"a\") == ['simple', 'very']\n assert candidate(text = \"the quick brown fox jumps over the lazy dog the quick brown fox jumps\",first = \"quick\",second = \"brown\") == ['fox', 'fox']\n assert candidate(text = \"once upon a time in a land far far away once upon a time in a land\",first = \"once\",second = \"upon\") == ['a', 'a']\n assert candidate(text = \"find these occurrences carefully find these occurrences again find these occurrences one more time\",first = \"find\",second = \"these\") == ['occurrences', 'occurrences', 'occurrences']\n assert candidate(text = \"a quick movement of the enemy will jeopardize six gunboats a quick and silent movement of the enemy will jeopardize five gunboats\",first = \"quick\",second = \"and\") == ['silent']\n assert candidate(text = \"complex example with multiple matches and no matches complex example with multiple matches and no matches\",first = \"with\",second = \"multiple\") == ['matches', 'matches']\n assert candidate(text = \"she sells sea shells by the sea shore she sells sea shells by the sea shore\",first = \"sea\",second = \"shells\") == ['by', 'by']\n assert candidate(text = \"complex scenario with different words complex scenario with different words complex\",first = \"with\",second = \"different\") == ['words', 'words']\n assert candidate(text = \"repeated repeated repeated words words words in a sentence\",first = \"words\",second = \"in\") == ['a']\n assert candidate(text = \"unique words with no repetitions should return empty list\",first = \"no\",second = \"repetitions\") == ['should']\n assert candidate(text = \"the quick brown fox jumps over the lazy dog the quick brown fox jumps over the quick brown fox\",first = \"quick\",second = \"brown\") == ['fox', 'fox', 'fox']\n assert candidate(text = \"x y z a b c x y z a b c x y z a b c x y z a b c\",first = \"x\",second = \"y\") == ['z', 'z', 'z', 'z']\n assert candidate(text = \"word word word word word word word word word word word word word word word word word word word word\",first = \"word\",second = \"word\") == ['word', 'word', 'word', 'word', 'word', 'word', 'word', 'word', 'word', 'word', 'word', 'word', 'word', 'word', 'word', 'word', 'word', 'word']\n assert candidate(text = \"edge case where the last word is the second\",first = \"second\",second = \"word\") == []\n assert candidate(text = \"a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z\",first = \"f\",second = \"g\") == ['h', 'h']\n assert candidate(text = \"the cat sat on the mat the dog sat on the log the cat sat on the mat the dog sat on the log\",first = \"sat\",second = \"on\") == ['the', 'the', 'the', 'the']\n assert candidate(text = \"hello there hello there hello there hello there hello there\",first = \"hello\",second = \"there\") == ['hello', 'hello', 'hello', 'hello']\n assert candidate(text = \"one fish two fish red fish blue fish one fish two fish red fish blue fish\",first = \"two\",second = \"fish\") == ['red', 'red']\n assert candidate(text = \"repeat after me repeat after me repeat after me repeat after me\",first = \"repeat\",second = \"after\") == ['me', 'me', 'me', 'me']\n assert candidate(text = \"one two three four five six seven eight nine ten eleven twelve\",first = \"three\",second = \"four\") == ['five']\n assert candidate(text = \"in the heart of the night the old owl hooted and the stars twinkled in the dark\",first = \"the\",second = \"old\") == ['owl']\n assert candidate(text = \"finding the third word after first second finding the third word after first\",first = \"finding\",second = \"the\") == ['third', 'third']\n assert candidate(text = \"abracadabra abracadabra abracadabra abracadabra abracadabra\",first = \"abracadabra\",second = \"abracadabra\") == ['abracadabra', 'abracadabra', 'abracadabra']\n assert candidate(text = \"find the pattern in this text pattern in this text pattern in this text pattern\",first = \"pattern\",second = \"in\") == ['this', 'this', 'this']\n assert candidate(text = \"a longer sentence with a variety of words and phrases to test the function properly\",first = \"variety\",second = \"of\") == ['words']\n assert candidate(text = \"she sells sea shells by the sea shore and the shells she sells are sea shells\",first = \"sea\",second = \"shells\") == ['by']\n assert candidate(text = \"example of a longer sentence where the pattern can be found multiple times example of a longer\",first = \"example\",second = \"of\") == ['a', 'a']\n assert candidate(text = \"multiple words in sequence are repeated multiple times multiple words in sequence\",first = \"multiple\",second = \"words\") == ['in', 'in']\n assert candidate(text = \"abc def ghi jkl mno pqr stu vwx yza abc def ghi jkl mno pqr stu vwx yza\",first = \"ghi\",second = \"jkl\") == ['mno', 'mno']\n assert candidate(text = \"abc abc abc abc abc abc abc abc abc abc\",first = \"abc\",second = \"abc\") == ['abc', 'abc', 'abc', 'abc', 'abc', 'abc', 'abc', 'abc']\n assert candidate(text = \"a quick movement of the enemy will jeopardize five gunboats a quick movement of the army will jeopardize five gunboats\",first = \"quick\",second = \"movement\") == ['of', 'of']\n assert candidate(text = \"a quick movement of the enemy will jeopardize six gunboats a quick movement of the enemy will jeopardize five gunboats\",first = \"quick\",second = \"movement\") == ['of', 'of']\n assert candidate(text = \"complex pattern with complex pattern and another complex pattern\",first = \"complex\",second = \"pattern\") == ['with', 'and']\n assert candidate(text = \"a b c a b c a b c a b c a b c\",first = \"a\",second = \"b\") == ['c', 'c', 'c', 'c', 'c']\n assert candidate(text = \"this is a simple test to see if the function works correctly with multiple occurrences of first second third\",first = \"first\",second = \"second\") == ['third']\n assert candidate(text = \"once upon a time in a galaxy far far away once upon a time in a galaxy\",first = \"once\",second = \"upon\") == ['a', 'a']\n assert candidate(text = \"cycling in the mountains mountains are beautiful cycling in the mountains\",first = \"cycling\",second = \"in\") == ['the', 'the']\n assert candidate(text = \"one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty\",first = \"one\",second = \"two\") == ['three']\n assert candidate(text = \"this is a simple sentence with multiple occurrences of the same word word\",first = \"the\",second = \"same\") == ['word']\n assert candidate(text = \"if you are reading this text then you are doing a great job reading\",first = \"reading\",second = \"this\") == ['text']\n assert candidate(text = \"this is a simple test case with multiple matches this is a simple test\",first = \"this\",second = \"is\") == ['a', 'a']\n assert candidate(text = \"to be or not to be that is the question to be or not to be that is the question\",first = \"be\",second = \"or\") == ['not', 'not']\n assert candidate(text = \"in the heart of the city in the heart of the heart in the heart of the city\",first = \"heart\",second = \"of\") == ['the', 'the', 'the']\n assert candidate(text = \"the quick brown fox jumps over the lazy dog the lazy dog jumps over the quick brown fox\",first = \"the\",second = \"lazy\") == ['dog', 'dog']\n assert candidate(text = \"this is a simple test this is a simple test this is a simple test\",first = \"is\",second = \"a\") == ['simple', 'simple', 'simple']\n assert candidate(text = \"a b c d e f g h i j k l m n o p q r s t u v w x y z a b c\",first = \"a\",second = \"b\") == ['c', 'c']\n assert candidate(text = \"last two words do not match first second\",first = \"first\",second = \"second\") == []\n assert candidate(text = \"every good boy does fine every good boy does fine every good boy does fine\",first = \"good\",second = \"boy\") == ['does', 'does', 'does']\n assert candidate(text = \"the quick brown fox jumps over the lazy dog the quick brown fox jumps over the lazy dog again\",first = \"quick\",second = \"brown\") == ['fox', 'fox']\n assert candidate(text = \"repeat repeat repeat repeat repeat repeat repeat\",first = \"repeat\",second = \"repeat\") == ['repeat', 'repeat', 'repeat', 'repeat', 'repeat']\n assert candidate(text = \"a b c d e f g h i j k l m n o p q r s t u v w x y z\",first = \"x\",second = \"y\") == ['z']\n assert candidate(text = \"the quick brown fox jumps over the lazy dog the quick brown fox is quick\",first = \"quick\",second = \"brown\") == ['fox', 'fox']\n assert candidate(text = \"cycling through the words cycling through the words cycling\",first = \"through\",second = \"the\") == ['words', 'words']\n assert candidate(text = \"a b c a b c a b c d e f g h i j k l m n o p q r s t u v w x y z\",first = \"b\",second = \"c\") == ['a', 'a', 'd']\n assert candidate(text = \"she sells sea shells by the sea shore she sells sea shells\",first = \"sea\",second = \"shells\") == ['by']\n assert candidate(text = \"hello world hello world hello world hello world hello world hello world\",first = \"hello\",second = \"world\") == ['hello', 'hello', 'hello', 'hello', 'hello']\n assert candidate(text = \"consecutive consecutive words words words words in this sequence sequence\",first = \"words\",second = \"words\") == ['words', 'words', 'in']\n assert candidate(text = \"complex sentence with multiple occurrences of first second third first second third\",first = \"first\",second = \"second\") == ['third', 'third']\n assert candidate(text = \"every good boy does fine every good boy does fine every good boy does fine\",first = \"every\",second = \"good\") == ['boy', 'boy', 'boy']\n assert candidate(text = \"this is a test this is only a test this is a test this is a test\",first = \"this\",second = \"is\") == ['a', 'only', 'a', 'a']\n assert candidate(text = \"repeat repeat repeat repeat repeat repeat\",first = \"repeat\",second = \"repeat\") == ['repeat', 'repeat', 'repeat', 'repeat']\n assert candidate(text = \"repeated repeated repeated repeated repeated repeated repeated repeated\",first = \"repeated\",second = \"repeated\") == ['repeated', 'repeated', 'repeated', 'repeated', 'repeated', 'repeated']\n assert candidate(text = \"aa bb aa bb aa bb aa bb aa bb aa bb\",first = \"aa\",second = \"bb\") == ['aa', 'aa', 'aa', 'aa', 'aa']\n assert candidate(text = \"a quick movement of the enemy will jeopardize six gunboats a quick movement of the enemy will jeopardize six gunboats\",first = \"movement\",second = \"of\") == ['the', 'the']\n assert candidate(text = \"x y z x y z x y z x y z x y z x y z x y z x y z x y z x y z x y z\",first = \"y\",second = \"z\") == ['x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x']\n assert candidate(text = \"consecutive consecutive consecutive words words words in in in the the the sentence sentence sentence\",first = \"consecutive\",second = \"consecutive\") == ['consecutive', 'words']\n assert candidate(text = \"this is a test this is only a test in case of an actual emergency this is a test\",first = \"this\",second = \"is\") == ['a', 'only', 'a']\n assert candidate(text = \"to be or not to be that is the question to be or not to be\",first = \"to\",second = \"be\") == ['or', 'that', 'or']\n"}, "metadata": {"canonical_parameter_names": ["text", "first", "second"], "leetcode_dataset_entry_point": "Solution().findOcurrences", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findOcurrences = function(text, first, second) {", "container": null, "callable": "findOcurrences", "parameters": [{"name": "text", "type": "string"}, {"name": "first", "type": "string"}, {"name": "second", "type": "string"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1079, "task_id": "letter-tile-possibilities", "difficulty": "Medium", "problem_description": "You have n  tiles, where each tile has one letter tiles[i] printed on it.\nReturn the number of possible non-empty sequences of letters you can make using the letters printed on those tiles.\n \nExample 1:\n\nInput: tiles = \"AAB\"\nOutput: 8\nExplanation: The possible sequences are \"A\", \"B\", \"AA\", \"AB\", \"BA\", \"AAB\", \"ABA\", \"BAA\".\n\nExample 2:\n\nInput: tiles = \"AAABBC\"\nOutput: 188\n\nExample 3:\n\nInput: tiles = \"V\"\nOutput: 1\n\n \nConstraints:\n\n1 <= tiles.length <= 7\ntiles consists of uppercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(tiles = \"AAAAAAA\") == 7\n assert candidate(tiles = \"QQQ\") == 3\n assert candidate(tiles = \"ABCDEFG\") == 13699\n assert candidate(tiles = \"ABC\") == 15\n assert candidate(tiles = \"AAB\") == 8\n assert candidate(tiles = \"AABBCC\") == 270\n assert candidate(tiles = \"XYZ\") == 15\n assert candidate(tiles = \"AAABBC\") == 188\n assert candidate(tiles = \"AB\") == 4\n assert candidate(tiles = \"AAAAAA\") == 6\n assert candidate(tiles = \"ABCD\") == 64\n assert candidate(tiles = \"V\") == 1\n assert candidate(tiles = \"ABBB\") == 13\n assert candidate(tiles = \"AAA\") == 3\n assert candidate(tiles = \"AABC\") == 34\n assert candidate(tiles = \"HHHHHHHH\") == 8\n assert candidate(tiles = \"UVWXYZ\") == 1956\n assert candidate(tiles = \"ABCDABCD\") == 7364\n assert candidate(tiles = \"ZZZZZZZ\") == 7\n assert candidate(tiles = \"JKJKJKJKJK\") == 922\n assert candidate(tiles = \"ZWZWZWZW\") == 250\n assert candidate(tiles = \"AAAABBBB\") == 250\n assert candidate(tiles = \"AAABBBCCC\") == 5247\n assert candidate(tiles = \"AABBCCDDEEFF\") == 21295782\n assert candidate(tiles = \"AAABBBCCCDDD\") == 1107696\n assert candidate(tiles = \"XYZXYZ\") == 270\n assert candidate(tiles = \"ABCDEFGH\") == 109600\n assert candidate(tiles = \"ABACADAE\") == 5188\n assert candidate(tiles = \"AABBCD\") == 522\n assert candidate(tiles = \"HELLO\") == 170\n assert candidate(tiles = \"AAAAAAAA\") == 8\n assert candidate(tiles = \"ABCDEABCDE\") == 326010\n assert candidate(tiles = \"QQQQRRRSSSTTTT\") == 12743958\n assert candidate(tiles = \"AABCCDDEE\") == 65201\n assert candidate(tiles = \"PPPPQQRR\") == 1350\n assert candidate(tiles = \"AAAAABBCCC\") == 8293\n assert candidate(tiles = \"ABCDABC\") == 1840\n assert candidate(tiles = \"MISSISSIPPI\") == 107898\n assert candidate(tiles = \"AABBCCD\") == 1840\n assert candidate(tiles = \"ABCDEFF\") == 7012\n assert candidate(tiles = \"REPEAT\") == 1010\n assert candidate(tiles = \"WWWWW\") == 5\n assert candidate(tiles = \"ZZZZAAAA\") == 250\n assert candidate(tiles = \"AABBBCC\") == 649\n assert candidate(tiles = \"QQQQQQQ\") == 7\n assert candidate(tiles = \"AABBCCDD\") == 7364\n assert candidate(tiles = \"AAABBCCCC\") == 4024\n assert candidate(tiles = \"ABCDEFGHII\") == 4986850\n assert candidate(tiles = \"ABCXYZ\") == 1956\n assert candidate(tiles = \"AAAAABBBCCC\") == 29887\n assert candidate(tiles = \"PYTHON\") == 1956\n assert candidate(tiles = \"AABCCD\") == 522\n assert candidate(tiles = \"ABABABABAB\") == 922\n assert candidate(tiles = \"AABBCCDDEE\") == 326010\n assert candidate(tiles = \"AAAABBBCCCDDD\") == 3627112\n assert candidate(tiles = \"AABBCCDE\") == 14458\n assert candidate(tiles = \"ABCDEF\") == 1956\n assert candidate(tiles = \"XYZABC\") == 1956\n assert candidate(tiles = \"SEQUENCES\") == 87185\n assert candidate(tiles = \"ABCDE\") == 325\n assert candidate(tiles = \"AABCDD\") == 522\n assert candidate(tiles = \"ABCABCABC\") == 5247\n assert candidate(tiles = \"AAAAABBBB\") == 460\n assert candidate(tiles = \"ABCDEFGABC\") == 1274854\n assert candidate(tiles = \"QWRTYUIOP\") == 986409\n assert candidate(tiles = \"AAAAABBBBBCCCCC\") == 2435199\n assert candidate(tiles = \"UNIQUE\") == 1010\n assert candidate(tiles = \"TILES\") == 325\n assert candidate(tiles = \"ABACADAEA\") == 9833\n assert candidate(tiles = \"MNOPQRST\") == 109600\n assert candidate(tiles = \"AAAABBBCCC\") == 13298\n assert candidate(tiles = \"FFFFFFFFF\") == 9\n assert candidate(tiles = \"ABCDEFGHI\") == 986409\n assert candidate(tiles = \"AAAAAABBBB\") == 790\n"}, "metadata": {"canonical_parameter_names": ["tiles"], "leetcode_dataset_entry_point": "Solution().numTilePossibilities", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numTilePossibilities = function(tiles) {", "container": null, "callable": "numTilePossibilities", "parameters": [{"name": "tiles", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1080, "task_id": "insufficient-nodes-in-root-to-leaf-paths", "difficulty": "Medium", "problem_description": "Given the root of a binary tree and an integer limit, delete all insufficient nodes in the tree simultaneously, and return the root of the resulting binary tree.\nA node is insufficient if every root to leaf path intersecting this node has a sum strictly less than limit.\nA leaf is a node with no children.\n \nExample 1:\n\n\nInput: root = [1,2,3,4,-99,-99,7,8,9,-99,-99,12,13,-99,14], limit = 1\nOutput: [1,2,3,4,null,null,7,8,9,null,14]\n\nExample 2:\n\n\nInput: root = [5,4,8,11,null,17,4,7,1,null,null,5,3], limit = 22\nOutput: [5,4,8,11,null,17,4,7,null,null,null,5]\n\nExample 3:\n\n\nInput: root = [1,2,-3,-5,null,4,null], limit = -1\nOutput: [1,null,-3,4]\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 5000].\n-105 <= Node.val <= 105\n-109 <= limit <= 109\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, -2, -3, -4, None, None, -5]),limit = -2) == None\n assert is_same_tree(candidate(root = tree_node([1, -10, 20, 100, -100, 30, -30]),limit = 50), tree_node([1, -10, 20, 100, None, 30]))\n assert is_same_tree(candidate(root = tree_node([1, 2]),limit = 3), tree_node([1, 2]))\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),limit = 30) == None\n assert candidate(root = tree_node([10, -10, 10, None, -10, None, -10, None, -10, None, -10]),limit = 8) == None\n assert is_same_tree(candidate(root = tree_node([2, -2, -3]),limit = -2), tree_node([2, -2, -3]))\n assert is_same_tree(candidate(root = tree_node([10, -10, 5, None, -2, None, 6]),limit = 8), tree_node([10, None, 5, None, 6]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3]),limit = 6), tree_node([1, None, 2, None, 3]))\n assert is_same_tree(candidate(root = tree_node([-10, -5, -3, -6, -20]),limit = -15), tree_node([-10, None, -3]))\n assert is_same_tree(candidate(root = tree_node([1, 2, -3, -5, None, 4, None]),limit = -1), tree_node([1, None, -3, 4]))\n assert is_same_tree(candidate(root = tree_node([-5, -10, -3, -1, -4, -2]),limit = -13), tree_node([-5, None, -3, -2]))\n assert is_same_tree(candidate(root = tree_node([5, 4, 8, 11, None, 17, 4, 7, 1, None, None, 5, 3]),limit = 28), tree_node([5, None, 8, 17]))\n assert candidate(root = tree_node([1, None, -2, -3, -4, -5, -6]),limit = -1) == None\n assert is_same_tree(candidate(root = tree_node([1, None, -2, None, -3]),limit = -5), tree_node([1, None, -2, None, -3]))\n assert candidate(root = tree_node([1, None, -2, -3, -4]),limit = -1) == None\n assert is_same_tree(candidate(root = tree_node([2, -5, -2]),limit = -4), tree_node([2, -5, -2]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 8, 16, 20, None, None, None, None, None, 19]),limit = 30), tree_node([10, 5, 15, None, 7, None, 18, None, 8, 16, 20, None, 19]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),limit = 5), tree_node([1, 2, 3, 4, 5, 6, 7]))\n assert is_same_tree(candidate(root = tree_node([1, -10, 10, -100, 100, -1000, 1000]),limit = 0), tree_node([1, -10, 10, None, 100, None, 1000]))\n assert is_same_tree(candidate(root = tree_node([1]),limit = 1), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([1, -1, -2, -3, -4, None, None, None, None, None]),limit = -6), tree_node([1, -1, -2, -3, -4]))\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),limit = 15) == None\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),limit = 15), tree_node([10, 5, 15, 3, 7, None, 18]))\n assert candidate(root = tree_node([1, 2, 3]),limit = 7) == None\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, -99, -99, 7, 8, 9, -99, -99, 12, 13, -99, 14]),limit = 1), tree_node([1, 2, 3, 4, None, None, 7, 8, 9, None, 14]))\n assert candidate(root = tree_node([1, None, -2, -3, None, -4, -5, None, -6, None, -7, None, -8, None, -9]),limit = 0) == None\n assert is_same_tree(candidate(root = tree_node([100, 50, 150, 25, 75, None, 200]),limit = 150), tree_node([100, 50, 150, 25, 75, None, 200]))\n assert is_same_tree(candidate(root = tree_node([5, 4, 8, 11, None, 17, 4, 7, 1, None, None, 5, 3]),limit = 22), tree_node([5, 4, 8, 11, None, 17, 4, 7, None, None, None, 5]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),limit = 10), tree_node([1, None, 3, 6, 7]))\n assert candidate(root = tree_node([5, -6, -6]),limit = 0) == None\n assert is_same_tree(candidate(root = tree_node([20, 10, 30, 5, 15, 25, 35, 2, 7, 12, 18, 23, 27, 32, 38, 1, 3, 6, 8, 11, 13, 17, 19, 22, 26, 28, 31, 33, 37, 39, 40]),limit = 50), tree_node([20, 10, 30, 5, 15, 25, 35, None, 7, 12, 18, 23, 27, 32, 38, None, 8, 11, 13, 17, 19, 22, 26, 28, 31, 33, 37, 39, 40]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5]),limit = 14), tree_node([1, None, 2, None, 3, None, 4, None, 5]))\n assert candidate(root = tree_node([1, None, -2, None, -3, None, -4, -5, None]),limit = -1) == None\n assert is_same_tree(candidate(root = tree_node([5, -6, 6, 5, 9, -6, -3, 2, -5, 2, 2, -1, -6, -6, -6]),limit = 2), tree_node([5, -6, 6, 5, 9, -6, -3, 2, None, 2, 2, -1, None, -6, -6]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),limit = 3), tree_node([1, 2, 3, 4, 5, 6, 7]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5]),limit = 8), tree_node([1, 2, None, None, 5]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5]),limit = 6), tree_node([1, None, 2, None, 3, None, 4, None, 5]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9]),limit = 15), tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 8, 2, 4, 7, 9, 1, 6, None, None, None, None, None, None, None, 10]),limit = 20), tree_node([5, 3, 8, 2, None, 7, 9, 1, None, None, None, None, None, None, 10]))\n assert candidate(root = tree_node([1]),limit = 2) == None\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),limit = 22), tree_node([10, 5, 15, None, 7, None, 18]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18]),limit = 25), tree_node([10, None, 15, None, 18]))\n assert candidate(root = tree_node([1, 2, 3, 4, 5]),limit = 9) == None\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5]),limit = 15), tree_node([1, None, 2, None, 3, None, 4, None, 5]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),limit = 10), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4]),limit = 6), tree_node([1, None, 2, None, 3, None, 4]))\n assert candidate(root = tree_node([1, None, -2, -3, -4, None, -5, -6, None, -7, None, -8, None, -9, None, -10, None, -11, None, -12, -13, None, -14]),limit = -3) == None\n assert candidate(root = tree_node([1, 2, 3]),limit = 6) == None\n assert is_same_tree(candidate(root = tree_node([10, -10, 10, None, None, None, -10, None, -10]),limit = 0), tree_node([10, -10, 10, None, None, None, -10, None, -10]))\n assert is_same_tree(candidate(root = tree_node([1, -2, -3, 4, 5, None, -6, -7, None, -8, None, 9, None, -10, None]),limit = -1), tree_node([1, None, -3, None, -6, 9]))\n assert is_same_tree(candidate(root = tree_node([-5, -6, -7]),limit = -15), tree_node([-5, -6, -7]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, None, None, 6, 9]),limit = 25), tree_node([10, 5, 15, None, 7, None, 18, 6, 9]))\n assert candidate(root = tree_node([10, -10, 10, None, None, -10, None, -10, None]),limit = 8) == None\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),limit = 20) == None\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, -5, None, 4]),limit = 0), tree_node([1, None, 3, None, 4]))\n assert candidate(root = tree_node([1, 2, 3]),limit = 5) == None\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3]),limit = 4), tree_node([1, None, 2, None, 3]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3]),limit = 5), tree_node([1, None, 2, None, 3]))\n assert candidate(root = tree_node([10, 5, 10]),limit = 21) == None\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 12, 18, 1, 2, 6, 8, 11, 13, 17, 19]),limit = 25), tree_node([10, 5, 15, None, 7, 12, 18, 6, 8, 11, 13, 17, 19]))\n"}, "metadata": {"canonical_parameter_names": ["root", "limit"], "leetcode_dataset_entry_point": "Solution().sufficientSubset", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sufficientSubset = function(root, limit) {", "container": null, "callable": "sufficientSubset", "parameters": [{"name": "root", "type": "TreeNode"}, {"name": "limit", "type": "number"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1081, "task_id": "smallest-subsequence-of-distinct-characters", "difficulty": "Medium", "problem_description": "Given a string s, return the lexicographically smallest subsequence of s that contains all the distinct characters of s exactly once.\n \nExample 1:\n\nInput: s = \"bcabc\"\nOutput: \"abc\"\n\nExample 2:\n\nInput: s = \"cbacdcbc\"\nOutput: \"acdb\"\n\n \nConstraints:\n\n1 <= s.length <= 1000\ns consists of lowercase English letters.\n\n \nNote: This question is the same as 316: https://leetcode.com/problems/remove-duplicate-letters/", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"rakuqjeiaxeidqqeaeiaxqeaeiaxjeidqq\") == \"rakudeiqxj\"\n assert candidate(s = \"a\") == \"a\"\n assert candidate(s = \"cccaae\") == \"cae\"\n assert candidate(s = \"cbacdcbc\") == \"acdb\"\n assert candidate(s = \"abacabadabc\") == \"abcd\"\n assert candidate(s = \"thesqskillqy\") == \"theqskily\"\n assert candidate(s = \"leetcode\") == \"letcod\"\n assert candidate(s = \"thesqpie\") == \"thesqpi\"\n assert candidate(s = \"example\") == \"exampl\"\n assert candidate(s = \"sequence\") == \"sequnc\"\n assert candidate(s = \"npxldumzcd\") == \"npxldumzc\"\n assert candidate(s = \"rakwsmggxvbrmgypwk\") == \"aksgxvbrmypw\"\n assert candidate(s = \"zyxzyxzyx\") == \"xyz\"\n assert candidate(s = \"distinct\") == \"disnct\"\n assert candidate(s = \"abcd\") == \"abcd\"\n assert candidate(s = \"bcabc\") == \"abc\"\n assert candidate(s = \"ecbacba\") == \"eacb\"\n assert candidate(s = \"aabbcc\") == \"abc\"\n assert candidate(s = \"abcdefghij\") == \"abcdefghij\"\n assert candidate(s = \"thesqtkwzyetipaswz\") == \"heqkwytipasz\"\n assert candidate(s = \"thesqtax\") == \"hesqtax\"\n assert candidate(s = \"crad\") == \"crad\"\n assert candidate(s = \"character\") == \"charte\"\n assert candidate(s = \"srzgp\") == \"srzgp\"\n assert candidate(s = \"nnnn\") == \"n\"\n assert candidate(s = \"subsequence\") == \"bsequnc\"\n assert candidate(s = \"indegree\") == \"indegr\"\n assert candidate(s = \"theskyisblue\") == \"thekyisblu\"\n assert candidate(s = \"thisisaverylongstringwithmanycharactersrepeatedmultipletimes\") == \"aveloginwhmycrdupts\"\n assert candidate(s = \"abracadabra\") == \"abcdr\"\n assert candidate(s = \"uniquecharacters\") == \"niquchartes\"\n assert candidate(s = \"swiss\") == \"swi\"\n assert candidate(s = \"iwanttofly\") == \"iwantofly\"\n assert candidate(s = \"repetition\") == \"repiton\"\n assert candidate(s = \"cbacdcbcacdcbcacdcbc\") == \"abcd\"\n assert candidate(s = \"abcdabcdabcd\") == \"abcd\"\n assert candidate(s = \"elephantzoo\") == \"elphantzo\"\n assert candidate(s = \"algorithm\") == \"algorithm\"\n assert candidate(s = \"hello\") == \"helo\"\n assert candidate(s = \"aaaaabbbbbccccdddd\") == \"abcd\"\n assert candidate(s = \"substring\") == \"subtring\"\n assert candidate(s = \"sphinxofblackquartzjumpsverilyzippyfidgetsbymywyrm\") == \"hinxoackqjumpsvelyzfdgtbwr\"\n assert candidate(s = \"thequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydog\") == \"adeqickbownfxjumpsvrthlzyg\"\n assert candidate(s = \"alphabet\") == \"alphbet\"\n assert candidate(s = \"abcdabcdeabcde\") == \"abcde\"\n assert candidate(s = \"zxyxzyzyxyzzyxzy\") == \"xyz\"\n assert candidate(s = \"abcdcba\") == \"abcd\"\n assert candidate(s = \"abcdeedcbaedcba\") == \"abcde\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"z\"\n assert candidate(s = \"abcdabcde\") == \"abcde\"\n assert candidate(s = \"allcharactersareunique\") == \"alchrtesniqu\"\n assert candidate(s = \"aebabdce\") == \"abdce\"\n assert candidate(s = \"abcdabcdbdabcdabcd\") == \"abcd\"\n assert candidate(s = \"nmlkjihgfedcba\") == \"nmlkjihgfedcba\"\n assert candidate(s = \"abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij\") == \"abcdefghij\"\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnm\") == \"qwertyuiopasdfghjklzxcvbnm\"\n assert candidate(s = \"xyzxyzxyz\") == \"xyz\"\n assert candidate(s = \"leetcodeleet\") == \"codelt\"\n assert candidate(s = \"theswiftbrownfoxjumpsoverthelazydog\") == \"eibownfxjumpsvrthlazydg\"\n assert candidate(s = \"ababababababababab\") == \"ab\"\n assert candidate(s = \"nctzggabcddcba\") == \"nctzgabd\"\n assert candidate(s = \"ananananananananananananananananananananananananananan\") == \"an\"\n assert candidate(s = \"programmingisfun\") == \"pograminsfu\"\n assert candidate(s = \"sivisoitnsidvsnoovsinovsdinovnsidvsindvsiodinvsiodinvson\") == \"iotdnsv\"\n assert candidate(s = \"paper\") == \"aper\"\n assert candidate(s = \"characters\") == \"chartes\"\n assert candidate(s = \"ecbacbacba\") == \"eabc\"\n assert candidate(s = \"abcdabcdabcdabcd\") == \"abcd\"\n assert candidate(s = \"programming\") == \"pogramin\"\n assert candidate(s = \"repeatedcharactersaaaabbccddeeff\") == \"epachrtsbdf\"\n assert candidate(s = \"abababababababababab\") == \"ab\"\n assert candidate(s = \"cbacdcbcde\") == \"abcde\"\n assert candidate(s = \"leetcodelite\") == \"codelit\"\n assert candidate(s = \"rwrwrwxyz\") == \"rwxyz\"\n assert candidate(s = \"abacabadabcabcabcabcdabcdabcde\") == \"abcde\"\n assert candidate(s = \"backtracking\") == \"backtring\"\n assert candidate(s = \"evolving\") == \"eolving\"\n assert candidate(s = \"thesamecharacterrepeats\") == \"amcherpts\"\n assert candidate(s = \"abcdabdcab\") == \"abcd\"\n assert candidate(s = \"abacabadabcdeabcdeabacabad\") == \"abcde\"\n assert candidate(s = \"abcdabcdeabcd\") == \"abcde\"\n assert candidate(s = \"xxyyzzxxzzyyxzyxzyzzyyzzyzyz\") == \"xyz\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzzzyyxxwwvvuuttssrrqqppoоннммллккjjiihhhggffeeddccbbaa\") == \"abcdefghijklmnopqrstuvwxyzонмлк\"\n assert candidate(s = \"banana\") == \"ban\"\n assert candidate(s = \"combinatorial\") == \"cmbinatorl\"\n assert candidate(s = \"zzzzyyyyxxxwvvvutttssrrqqppoonnmmllkkjjiihhhggffeeddccbbaa\") == \"zyxwvutsrqponmlkjihgfedcba\"\n assert candidate(s = \"eleetcode\") == \"eltcod\"\n assert candidate(s = \"elephanttree\") == \"elphantr\"\n assert candidate(s = \"elephant\") == \"elphant\"\n assert candidate(s = \"aabbccddeeffgg\") == \"abcdefg\"\n assert candidate(s = \"abcdabcdeabcdefabcdefgabcdefghabcdefghijkabcdefghijk\") == \"abcdefghijk\"\n assert candidate(s = \"aabbcceedd\") == \"abced\"\n assert candidate(s = \"rhythm\") == \"rhytm\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzabcd\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"bcbcbcbcbc\") == \"bc\"\n assert candidate(s = \"characterswithunequalfrequency\") == \"acerswithlfquny\"\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\") == \"zyxwvutsrqponmlkjihgfedcba\"\n assert candidate(s = \"thequickbrownfoxjumpsoverthelazydog\") == \"eqickbownfxjumpsvrthlazydg\"\n assert candidate(s = \"aaaabbbbccccdddd\") == \"abcd\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzzzzzzzzzz\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"aabbbcccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnooooppppqqqqrrrrssssttttuuuuvvvvwwwwxxxxyyyyzzzz\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"abcdedcba\") == \"abcde\"\n assert candidate(s = \"complexproblem\") == \"cexproblm\"\n assert candidate(s = \"zyxzyzyxzyx\") == \"xyz\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzyxwvutsrqponmlkjihgfedcba\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"lexicographical\") == \"excographil\"\n assert candidate(s = \"abcdefghihgfedcba\") == \"abcdefghi\"\n assert candidate(s = \"racecar\") == \"acer\"\n assert candidate(s = \"qpwoeirutyalskdfjhgfcxzvbnm\") == \"qpwoeirutyalskdfjhgcxzvbnm\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"rithmschool\") == \"rithmscol\"\n assert candidate(s = \"dynamicprogramming\") == \"dyacpogrmin\"\n assert candidate(s = \"interviewquestion\") == \"erviwquston\"\n assert candidate(s = \"abcdabcdeabcdeabcde\") == \"abcde\"\n assert candidate(s = \"thisisaverylongstringwithmanycharactersandmanyrepeatedcharacters\") == \"aveloginwcdmyphrts\"\n assert candidate(s = \"thisisatest\") == \"hiaest\"\n assert candidate(s = \"mississippi\") == \"misp\"\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba\") == \"azyxwvutsrqponmlkjihgfedcb\"\n assert candidate(s = \"permutation\") == \"permuation\"\n assert candidate(s = \"xyzzzyxyzzzyxyzzzyxyzzzy\") == \"xyz\"\n assert candidate(s = \"aabbbcccddd\") == \"abcd\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"z\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().smallestSubsequence", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var smallestSubsequence = function(s) {", "container": null, "callable": "smallestSubsequence", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1090, "task_id": "largest-values-from-labels", "difficulty": "Medium", "problem_description": "You are given n item's value and label as two integer arrays values and labels. You are also given two integers numWanted and useLimit.\nYour task is to find a subset of items with the maximum sum of their values such that:\n\nThe number of items is at most numWanted.\nThe number of items with the same label is at most useLimit.\n\nReturn the maximum sum.\n \nExample 1:\n\nInput: values = [5,4,3,2,1], labels = [1,1,2,2,3], numWanted = 3, useLimit = 1\nOutput: 9\nExplanation:\nThe subset chosen is the first, third, and fifth items with the sum of values 5 + 3 + 1.\n\nExample 2:\n\nInput: values = [5,4,3,2,1], labels = [1,3,3,3,2], numWanted = 3, useLimit = 2\nOutput: 12\nExplanation:\nThe subset chosen is the first, second, and third items with the sum of values 5 + 4 + 3.\n\nExample 3:\n\nInput: values = [9,8,8,7,6], labels = [0,0,0,1,1], numWanted = 3, useLimit = 1\nOutput: 16\nExplanation:\nThe subset chosen is the first and fourth items with the sum of values 9 + 7.\n\n \nConstraints:\n\nn == values.length == labels.length\n1 <= n <= 2 * 104\n0 <= values[i], labels[i] <= 2 * 104\n1 <= numWanted, useLimit <= n\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(values = [10, 10, 10, 10],labels = [1, 1, 1, 1],numWanted = 3,useLimit = 2) == 20\n assert candidate(values = [10, 10, 10, 10],labels = [1, 2, 3, 4],numWanted = 4,useLimit = 1) == 40\n assert candidate(values = [9, 8, 8, 7, 6],labels = [0, 0, 0, 1, 1],numWanted = 3,useLimit = 1) == 16\n assert candidate(values = [10, 20, 30, 40, 50],labels = [1, 2, 3, 4, 5],numWanted = 5,useLimit = 1) == 150\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 5,useLimit = 1) == 40\n assert candidate(values = [10, 20, 30, 40, 50],labels = [1, 1, 1, 1, 1],numWanted = 3,useLimit = 2) == 90\n assert candidate(values = [1, 2, 3, 4, 5],labels = [1, 1, 1, 1, 1],numWanted = 3,useLimit = 1) == 5\n assert candidate(values = [1, 2, 3, 4, 5],labels = [1, 2, 3, 4, 5],numWanted = 5,useLimit = 1) == 15\n assert candidate(values = [5, 4, 3, 2, 1],labels = [1, 3, 3, 3, 2],numWanted = 3,useLimit = 2) == 12\n assert candidate(values = [5, 4, 3, 2, 1],labels = [1, 1, 2, 2, 3],numWanted = 3,useLimit = 1) == 9\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],labels = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],numWanted = 5,useLimit = 2) == 19\n assert candidate(values = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 5,useLimit = 1) == 400\n assert candidate(values = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],labels = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2],numWanted = 5,useLimit = 2) == 2800\n assert candidate(values = [20, 18, 16, 14, 12, 10, 8, 6, 4, 2],labels = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5],numWanted = 5,useLimit = 2) == 80\n assert candidate(values = [5, 10, 15, 20, 25, 30],labels = [1, 2, 1, 3, 2, 3],numWanted = 4,useLimit = 2) == 90\n assert candidate(values = [1000, 500, 250, 125, 62, 31, 15, 7, 3, 1],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 5,useLimit = 1) == 1937\n assert candidate(values = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],labels = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3],numWanted = 6,useLimit = 3) == 220\n assert candidate(values = [25, 25, 25, 25, 25, 25],labels = [1, 1, 1, 1, 1, 1],numWanted = 4,useLimit = 1) == 25\n assert candidate(values = [15, 15, 15, 15, 15, 15, 15, 15, 15, 15],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 8,useLimit = 2) == 120\n assert candidate(values = [30, 20, 10, 30, 20, 10, 30, 20, 10],labels = [1, 2, 3, 1, 2, 3, 1, 2, 3],numWanted = 5,useLimit = 2) == 110\n assert candidate(values = [3, 5, 1, 3, 5, 3, 5, 3, 5, 3],labels = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2],numWanted = 6,useLimit = 2) == 18\n assert candidate(values = [10, 20, 30, 40, 50],labels = [1, 1, 1, 1, 2],numWanted = 3,useLimit = 2) == 120\n assert candidate(values = [50, 40, 30, 20, 10],labels = [1, 2, 2, 3, 3],numWanted = 4,useLimit = 1) == 110\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],labels = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],numWanted = 10,useLimit = 2) == 39\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],labels = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5],numWanted = 5,useLimit = 2) == 40\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],labels = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3],numWanted = 8,useLimit = 2) == 57\n assert candidate(values = [20, 18, 17, 16, 15, 14, 13, 12, 11, 10],labels = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5],numWanted = 4,useLimit = 1) == 71\n assert candidate(values = [20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19],labels = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],numWanted = 10,useLimit = 3) == 105\n assert candidate(values = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],labels = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],numWanted = 5,useLimit = 1) == 100\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],labels = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2],numWanted = 5,useLimit = 1) == 19\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2],numWanted = 8,useLimit = 2) == 680\n assert candidate(values = [10000, 10000, 9999, 9999, 9998, 9998, 9997, 9997, 9996, 9996],labels = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],numWanted = 8,useLimit = 2) == 79988\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 15,useLimit = 3) == 195\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9],labels = [1, 2, 1, 2, 1, 2, 1, 2, 1],numWanted = 3,useLimit = 1) == 17\n assert candidate(values = [9, 8, 7, 6, 5, 4, 3, 2, 1],labels = [1, 1, 2, 2, 3, 3, 4, 4, 5],numWanted = 5,useLimit = 2) == 35\n assert candidate(values = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 15,useLimit = 2) == 270\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 10,useLimit = 1) == 55\n assert candidate(values = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],labels = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],numWanted = 3,useLimit = 1) == 100\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],labels = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2],numWanted = 6,useLimit = 3) == 390\n assert candidate(values = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 15,useLimit = 2) == 195\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 7,useLimit = 1) == 49\n assert candidate(values = [20, 18, 16, 14, 12, 10, 8, 6, 4, 2],labels = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],numWanted = 5,useLimit = 2) == 38\n assert candidate(values = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],labels = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4],numWanted = 15,useLimit = 3) == 138\n assert candidate(values = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],labels = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],numWanted = 5,useLimit = 1) == 1\n assert candidate(values = [20, 18, 16, 14, 12, 10, 8, 6, 4, 2],labels = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2],numWanted = 6,useLimit = 3) == 90\n assert candidate(values = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 8,useLimit = 1) == 80\n assert candidate(values = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],labels = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2],numWanted = 8,useLimit = 3) == 60\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 5,useLimit = 10) == 400\n assert candidate(values = [100, 50, 200, 150, 100],labels = [1, 2, 1, 2, 1],numWanted = 2,useLimit = 1) == 350\n assert candidate(values = [10, 20, 30, 40, 50],labels = [1, 1, 2, 2, 3],numWanted = 2,useLimit = 1) == 90\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],labels = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3],numWanted = 6,useLimit = 2) == 30\n assert candidate(values = [25, 20, 15, 10, 5],labels = [1, 2, 3, 4, 5],numWanted = 3,useLimit = 1) == 60\n assert candidate(values = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 5,useLimit = 1) == 75\n assert candidate(values = [20, 15, 10, 5, 1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19],labels = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5],numWanted = 10,useLimit = 3) == 147\n assert candidate(values = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14],labels = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],numWanted = 8,useLimit = 3) == 84\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],labels = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2],numWanted = 5,useLimit = 2) == 34\n assert candidate(values = [9, 8, 7, 6, 5, 4, 3, 2, 1],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9],numWanted = 3,useLimit = 1) == 24\n assert candidate(values = [50, 40, 30, 20, 10, 50, 40, 30, 20, 10],labels = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5],numWanted = 5,useLimit = 2) == 210\n assert candidate(values = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],labels = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],numWanted = 10,useLimit = 2) == 105\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 5,useLimit = 1) == 25\n assert candidate(values = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 5,useLimit = 3) == 35\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],labels = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],numWanted = 5,useLimit = 1) == 100\n assert candidate(values = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 8,useLimit = 1) == 16\n assert candidate(values = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],labels = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4],numWanted = 7,useLimit = 2) == 40\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5, 5],labels = [1, 2, 3, 4, 5, 6, 7, 8],numWanted = 6,useLimit = 1) == 30\n assert candidate(values = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],labels = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],numWanted = 5,useLimit = 2) == 38\n assert candidate(values = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],labels = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2],numWanted = 5,useLimit = 3) == 360\n assert candidate(values = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 10,useLimit = 1) == 550\n assert candidate(values = [9, 8, 7, 6, 5, 4, 3, 2, 1],labels = [0, 1, 0, 1, 0, 1, 0, 1, 0],numWanted = 4,useLimit = 1) == 17\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],labels = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1],numWanted = 8,useLimit = 3) == 75\n assert candidate(values = [15, 10, 10, 5, 5, 5, 5],labels = [1, 1, 2, 2, 2, 3, 3],numWanted = 5,useLimit = 2) == 45\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 7,useLimit = 1) == 35\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],labels = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4],numWanted = 10,useLimit = 3) == 131\n assert candidate(values = [9, 8, 7, 6, 5, 4, 3, 2, 1],labels = [0, 1, 0, 1, 0, 1, 0, 1, 0],numWanted = 5,useLimit = 2) == 30\n assert candidate(values = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 5,useLimit = 1) == 50\n assert candidate(values = [15, 12, 11, 10, 9, 8],labels = [1, 1, 2, 2, 3, 3],numWanted = 4,useLimit = 2) == 48\n assert candidate(values = [500, 400, 300, 200, 100],labels = [1, 2, 3, 4, 5],numWanted = 3,useLimit = 1) == 1200\n assert candidate(values = [100, 80, 60, 40, 20],labels = [1, 1, 1, 1, 1],numWanted = 5,useLimit = 3) == 240\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],labels = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],numWanted = 6,useLimit = 2) == 450\n assert candidate(values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 7,useLimit = 3) == 490\n assert candidate(values = [5, 9, 1, 9, 8, 5, 7, 8, 2, 1],labels = [1, 1, 2, 2, 2, 3, 3, 3, 3, 3],numWanted = 6,useLimit = 2) == 46\n assert candidate(values = [20, 18, 16, 14, 12, 10, 8, 6, 4, 2],labels = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],numWanted = 5,useLimit = 1) == 60\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],labels = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2],numWanted = 4,useLimit = 3) == 20\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],labels = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],numWanted = 5,useLimit = 2) == 40\n assert candidate(values = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],labels = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2],numWanted = 5,useLimit = 3) == 5\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],labels = [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2],numWanted = 10,useLimit = 2) == 46\n assert candidate(values = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],labels = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],numWanted = 5,useLimit = 2) == 1900\n assert candidate(values = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5],numWanted = 10,useLimit = 1) == 50\n assert candidate(values = [5, 10, 15, 20, 25, 30, 35, 40],labels = [1, 1, 2, 2, 3, 3, 4, 4],numWanted = 4,useLimit = 2) == 130\n assert candidate(values = [20, 20, 20, 20, 20, 20, 20, 20, 20, 20],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],numWanted = 5,useLimit = 1) == 100\n assert candidate(values = [9, 8, 7, 6, 5, 4, 3, 2, 1],labels = [0, 0, 0, 1, 1, 1, 2, 2, 2],numWanted = 5,useLimit = 2) == 31\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],labels = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],numWanted = 5,useLimit = 1) == 10\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],numWanted = 10,useLimit = 2) == 155\n assert candidate(values = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],labels = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2],numWanted = 5,useLimit = 2) == 340\n assert candidate(values = [30, 25, 20, 15, 10, 5],labels = [1, 2, 3, 4, 5, 6],numWanted = 4,useLimit = 1) == 90\n assert candidate(values = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],labels = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2],numWanted = 5,useLimit = 3) == 360\n assert candidate(values = [20, 18, 15, 12, 10, 8, 6, 4, 2],labels = [1, 1, 2, 2, 3, 3, 4, 4, 5],numWanted = 5,useLimit = 2) == 75\n assert candidate(values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],labels = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],numWanted = 5,useLimit = 1) == 40\n assert candidate(values = [30, 20, 10, 10, 20, 30],labels = [1, 1, 2, 2, 3, 3],numWanted = 5,useLimit = 1) == 70\n"}, "metadata": {"canonical_parameter_names": ["values", "labels", "numWanted", "useLimit"], "leetcode_dataset_entry_point": "Solution().largestValsFromLabels", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var largestValsFromLabels = function(values, labels, numWanted, useLimit) {", "container": null, "callable": "largestValsFromLabels", "parameters": [{"name": "values", "type": "number[]"}, {"name": "labels", "type": "number[]"}, {"name": "numWanted", "type": "number"}, {"name": "useLimit", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1091, "task_id": "shortest-path-in-binary-matrix", "difficulty": "Medium", "problem_description": "Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1.\nA clear path in a binary matrix is a path from the top-left cell (i.e., (0, 0)) to the bottom-right cell (i.e., (n - 1, n - 1)) such that:\n\nAll the visited cells of the path are 0.\nAll the adjacent cells of the path are 8-directionally connected (i.e., they are different and they share an edge or a corner).\n\nThe length of a clear path is the number of visited cells of this path.\n \nExample 1:\n\n\nInput: grid = [[0,1],[1,0]]\nOutput: 2\n\nExample 2:\n\n\nInput: grid = [[0,0,0],[1,1,0],[1,1,0]]\nOutput: 4\n\nExample 3:\n\nInput: grid = [[1,0,0],[1,1,0],[1,1,0]]\nOutput: -1\n\n \nConstraints:\n\nn == grid.length\nn == grid[i].length\n1 <= n <= 100\ngrid[i][j] is 0 or 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[0, 1], [1, 0]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 0, 1, 0, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[1]]) == -1\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[0, 0, 0], [1, 1, 0], [1, 1, 0]]) == 4\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]]) == 6\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == -1\n assert candidate(grid = [[0]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[1, 0, 0], [1, 1, 0], [1, 1, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 8\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == -1\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 1, 0, 0], [1, 1, 1, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 7\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0]]) == 8\n assert candidate(grid = [[0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0]]) == 7\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 0], [1, 1, 0, 0, 0, 1, 1], [1, 0, 0, 1, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 10\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 14\n assert candidate(grid = [[0, 1, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 0, 1, 0], [1, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 5\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 9\n assert candidate(grid = [[0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 12\n assert candidate(grid = [[0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 9\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 17\n assert candidate(grid = [[0, 0, 0, 0, 0, 1, 1], [0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0]]) == 11\n assert candidate(grid = [[0, 1, 1, 1, 0], [0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0], [0, 1, 1, 1, 0]]) == 7\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 20\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 10\n assert candidate(grid = [[0, 1, 1, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 1, 0, 1, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 1, 0, 1, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0]]) == 10\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 17\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0]]) == 17\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 10\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 20\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 1, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0]]) == 13\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 0], [1, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 9\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 16\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 11\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 9\n assert candidate(grid = [[0, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 1], [0, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0]]) == 7\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 18\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 15\n assert candidate(grid = [[0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 1, 1, 1, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 12\n assert candidate(grid = [[0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 1, 0], [0, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 0, 1, 1, 0, 0, 0]]) == 12\n assert candidate(grid = [[0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 1, 0, 0, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0]]) == 9\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 1, 1, 0, 1], [0, 0, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0]]) == 11\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 16\n assert candidate(grid = [[0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 1, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 0, 0, 0]]) == 11\n assert candidate(grid = [[0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 1, 1, 1, 0], [0, 1, 1, 0, 0, 1, 1, 0], [0, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 1, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0]]) == 13\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0], [0, 1, 1, 1, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 12\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 17\n assert candidate(grid = [[0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 0]]) == -1\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 9\n assert candidate(grid = [[0, 0, 0, 0, 1, 1, 1, 1, 0], [0, 1, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 12\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 16\n assert candidate(grid = [[0, 1, 0, 0, 0], [0, 1, 0, 1, 0], [0, 0, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 8\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 12\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 0, 0]]) == 13\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().shortestPathBinaryMatrix", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shortestPathBinaryMatrix = function(grid) {", "container": null, "callable": "shortestPathBinaryMatrix", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1092, "task_id": "shortest-common-supersequence", "difficulty": "Hard", "problem_description": "Given two strings str1 and str2, return the shortest string that has both str1 and str2 as subsequences. If there are multiple valid strings, return any of them.\nA string s is a subsequence of string t if deleting some number of characters from t (possibly 0) results in the string s.\n \nExample 1:\n\nInput: str1 = \"abac\", str2 = \"cab\"\nOutput: \"cabac\"\nExplanation: \nstr1 = \"abac\" is a subsequence of \"cabac\" because we can delete the first \"c\".\nstr2 = \"cab\" is a subsequence of \"cabac\" because we can delete the last \"ac\".\nThe answer provided is the shortest such string that satisfies these properties.\n\nExample 2:\n\nInput: str1 = \"aaaaaaaa\", str2 = \"aaaaaaaa\"\nOutput: \"aaaaaaaa\"\n\n \nConstraints:\n\n1 <= str1.length, str2.length <= 1000\nstr1 and str2 consist of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(str1 = \"xyz\",str2 = \"xyx\") == \"xyxz\"\n assert candidate(str1 = \"short\",str2 = \"sorts\") == \"shorts\"\n assert candidate(str1 = \"algorithm\",str2 = \"altruistic\") == \"altgoruistichm\"\n assert candidate(str1 = \"ab\",str2 = \"ba\") == \"bab\"\n assert candidate(str1 = \"abc\",str2 = \"def\") == \"defabc\"\n assert candidate(str1 = \"aaaaaaaa\",str2 = \"aaaaaaaa\") == \"aaaaaaaa\"\n assert candidate(str1 = \"abc\",str2 = \"cba\") == \"cbabc\"\n assert candidate(str1 = \"abc\",str2 = \"abc\") == \"abc\"\n assert candidate(str1 = \"sequence\",str2 = \"subsequence\") == \"subsequence\"\n assert candidate(str1 = \"dynamic\",str2 = \"programming\") == \"progrdynammingc\"\n assert candidate(str1 = \"abac\",str2 = \"cab\") == \"cabac\"\n assert candidate(str1 = \"xyz\",str2 = \"zyx\") == \"zyxyz\"\n assert candidate(str1 = \"abcde\",str2 = \"ace\") == \"abcde\"\n assert candidate(str1 = \"a\",str2 = \"b\") == \"ba\"\n assert candidate(str1 = \"abcd\",str2 = \"aebd\") == \"aebcd\"\n assert candidate(str1 = \"datastructure\",str2 = \"algorithm\") == \"dalgotastriucthmure\"\n assert candidate(str1 = \"xyzuvw\",str2 = \"uvwzyx\") == \"xyzuvwzyx\"\n assert candidate(str1 = \"kitten\",str2 = \"sitting\") == \"skittieng\"\n assert candidate(str1 = \"intersection\",str2 = \"introduction\") == \"interodusection\"\n assert candidate(str1 = \"sequences\",str2 = \"supersequence\") == \"supersequences\"\n assert candidate(str1 = \"abracadabra\",str2 = \"cadabraabra\") == \"cadabracadabra\"\n assert candidate(str1 = \"mississippi\",str2 = \"missouri\") == \"missourissippi\"\n assert candidate(str1 = \"interview\",str2 = \"environment\") == \"eintervironmentw\"\n assert candidate(str1 = \"abcdabcdabcd\",str2 = \"cdabcdabcdab\") == \"cdabcdabcdabcd\"\n assert candidate(str1 = \"abcdefghij\",str2 = \"jihgfedcba\") == \"jihgfedcbabcdefghij\"\n assert candidate(str1 = \"ababab\",str2 = \"bababa\") == \"bababab\"\n assert candidate(str1 = \"abcdabcdabcd\",str2 = \"bcdabcda\") == \"abcdabcdabcd\"\n assert candidate(str1 = \"optimization\",str2 = \"generalization\") == \"generaloptimization\"\n assert candidate(str1 = \"interview\",str2 = \"intermission\") == \"intermvissionew\"\n assert candidate(str1 = \"partiallyoverlapping\",str2 = \"overlapping\") == \"partiallyoverlapping\"\n assert candidate(str1 = \"abcdabcd\",str2 = \"dcbaabcd\") == \"dcabcdaabcd\"\n assert candidate(str1 = \"uniquecharacters\",str2 = \"charactersunique\") == \"uniquecharactersunique\"\n assert candidate(str1 = \"abcxyz\",str2 = \"xyzabc\") == \"xyzabcxyz\"\n assert candidate(str1 = \"longest\",str2 = \"longestcommonsubsequence\") == \"longestcommonsubsequence\"\n assert candidate(str1 = \"abcdefgxyz\",str2 = \"zyxabcdefg\") == \"zyxabcdefgxyz\"\n assert candidate(str1 = \"longestcommonsubsequence\",str2 = \"shortestuncommonsupersequence\") == \"shlortngestuncommonsuperbsequence\"\n assert candidate(str1 = \"abracadabra\",str2 = \"bracadabrac\") == \"abracadabrac\"\n assert candidate(str1 = \"abcde\",str2 = \"fghij\") == \"fghijabcde\"\n assert candidate(str1 = \"mississippi\",str2 = \"pississippi\") == \"pmississippi\"\n assert candidate(str1 = \"abcdabcdabcd\",str2 = \"dcba\") == \"dabcdabcdabcd\"\n assert candidate(str1 = \"abcdefghiklmnopqrstuvwxyz\",str2 = \"zyxwvutsrqponmlkjihgfedcba\") == \"zyxwvutsrqponmlkjihgfedcbabcdefghiklmnopqrstuvwxyz\"\n assert candidate(str1 = \"complexity\",str2 = \"simplicity\") == \"sicomplexicity\"\n assert candidate(str1 = \"longest\",str2 = \"shortest\") == \"shlortngest\"\n assert candidate(str1 = \"programming\",str2 = \"grammingpro\") == \"programmingpro\"\n assert candidate(str1 = \"abcdefghijk\",str2 = \"mnopqrstuvwxyz\") == \"mnopqrstuvwxyzabcdefghijk\"\n assert candidate(str1 = \"supercalifragilisticexpialidocious\",str2 = \"california\") == \"supercalifornagilisticexpialidocious\"\n assert candidate(str1 = \"aabbccddeeff\",str2 = \"ffeeddccbbaa\") == \"ffeeddccbbaabbccddeeff\"\n assert candidate(str1 = \"abcdefg\",str2 = \"xyzabc\") == \"xyzabcdefg\"\n assert candidate(str1 = \"pneumonoultramicroscopicsilicovolcanoconiosis\",str2 = \"congratulations\") == \"cpneumongratoulatramicroscopicsilicovolcanoconiosis\"\n assert candidate(str1 = \"supersequence\",str2 = \"subsequence\") == \"subpersequence\"\n assert candidate(str1 = \"abababab\",str2 = \"babababa\") == \"babababab\"\n assert candidate(str1 = \"abracadabra\",str2 = \"bracadabra\") == \"abracadabra\"\n assert candidate(str1 = \"abcdexyz\",str2 = \"xyzab\") == \"abcdexyzab\"\n assert candidate(str1 = \"abcdefgh\",str2 = \"efghijkl\") == \"abcdefghijkl\"\n assert candidate(str1 = \"shortest\",str2 = \"common\") == \"cshommonrtest\"\n assert candidate(str1 = \"abcdxyz\",str2 = \"xyzabcd\") == \"xyzabcdxyz\"\n assert candidate(str1 = \"abracadabra\",str2 = \"avadakedavra\") == \"avbradcakedavbra\"\n assert candidate(str1 = \"abcdefgh\",str2 = \"efghabcd\") == \"efghabcdefgh\"\n assert candidate(str1 = \"super\",str2 = \"supercalifragilisticexpialidocious\") == \"supercalifragilisticexpialidocious\"\n assert candidate(str1 = \"overlapping\",str2 = \"lappingover\") == \"overlappingover\"\n assert candidate(str1 = \"abracadabra\",str2 = \"cabracadabrac\") == \"cabracadabrac\"\n assert candidate(str1 = \"programming\",str2 = \"development\") == \"developrogramemintg\"\n assert candidate(str1 = \"abcd\",str2 = \"abcdeabcde\") == \"abcdeabcde\"\n assert candidate(str1 = \"abcdexyz\",str2 = \"yzabcdex\") == \"yzabcdexyz\"\n assert candidate(str1 = \"programming\",str2 = \"gramming\") == \"programming\"\n assert candidate(str1 = \"aabbccdd\",str2 = \"dddccccbbbaa\") == \"dddccccbbbaabbccdd\"\n assert candidate(str1 = \"longestcommonsubsequence\",str2 = \"shortestcommonsupersequence\") == \"shlortngestcommonsuperbsequence\"\n assert candidate(str1 = \"abcdefghijklmnopqrstuvwxyz\",str2 = \"zyxwvutsrqponmlkjihgfedcba\") == \"zyxwvutsrqponmlkjihgfedcbabcdefghijklmnopqrstuvwxyz\"\n assert candidate(str1 = \"longest\",str2 = \"longer\") == \"longerst\"\n assert candidate(str1 = \"abcdefghijk\",str2 = \"abcdefghij\") == \"abcdefghijk\"\n assert candidate(str1 = \"abcd\",str2 = \"efgh\") == \"efghabcd\"\n assert candidate(str1 = \"abcdabcdabcd\",str2 = \"abcd\") == \"abcdabcdabcd\"\n assert candidate(str1 = \"abcdabcdabcd\",str2 = \"dcbaabcdabcd\") == \"dcabcdaabcdabcd\"\n assert candidate(str1 = \"abcdexyz\",str2 = \"yzabcd\") == \"yzabcdexyz\"\n assert candidate(str1 = \"repeatedcharactersin\",str2 = \"charactersinrepeated\") == \"repeatedcharactersinrepeated\"\n assert candidate(str1 = \"abcdefgh\",str2 = \"hgfedcba\") == \"hgfedcbabcdefgh\"\n assert candidate(str1 = \"repeatedcharacters\",str2 = \"charactersrepeated\") == \"repeatedcharactersrepeated\"\n assert candidate(str1 = \"thisisatest\",str2 = \"atestisthis\") == \"atehistisathiest\"\n assert candidate(str1 = \"shortest\",str2 = \"subsequence\") == \"subshortequencest\"\n assert candidate(str1 = \"aaaaabbbbb\",str2 = \"bbbbbbaaaa\") == \"aaaaabbbbbbaaaa\"\n assert candidate(str1 = \"abcabcabc\",str2 = \"cbacbacba\") == \"cbacbacabcabc\"\n assert candidate(str1 = \"interview\",str2 = \"interstellar\") == \"interstviellarw\"\n assert candidate(str1 = \"abcdexyz\",str2 = \"xyzabcd\") == \"xyzabcdexyz\"\n assert candidate(str1 = \"longest\",str2 = \"longshort\") == \"longeshort\"\n assert candidate(str1 = \"aaaaabbbb\",str2 = \"bbbaaaaa\") == \"bbbaaaaabbbb\"\n assert candidate(str1 = \"abcd\",str2 = \"dcba\") == \"dcbabcd\"\n assert candidate(str1 = \"abcdexyz\",str2 = \"xyzabcdexyz\") == \"xyzabcdexyz\"\n assert candidate(str1 = \"aaaaaaaaaa\",str2 = \"bbbbbbbbbb\") == \"bbbbbbbbbbaaaaaaaaaa\"\n assert candidate(str1 = \"abcd\",str2 = \"efghijklmnopqrstuvwxyz\") == \"efghijklmnopqrstuvwxyzabcd\"\n assert candidate(str1 = \"abcdefghijk\",str2 = \"jihgfedcba\") == \"jihgfedcbabcdefghijk\"\n assert candidate(str1 = \"aabbcc\",str2 = \"abcabc\") == \"abcabbcc\"\n assert candidate(str1 = \"abcabcabc\",str2 = \"bcabcabc\") == \"abcabcabc\"\n assert candidate(str1 = \"intersection\",str2 = \"interstellar\") == \"interstellarction\"\n assert candidate(str1 = \"abcdabcdabcd\",str2 = \"abcdabcdabcdabcd\") == \"abcdabcdabcdabcd\"\n assert candidate(str1 = \"abcdeffedcba\",str2 = \"defgfedcba\") == \"abcdefgfedcba\"\n assert candidate(str1 = \"supercalifragilisticexpialidocious\",str2 = \"supercalifragilisticexpialidocious\") == \"supercalifragilisticexpialidocious\"\n assert candidate(str1 = \"dynamic\",str2 = \"program\") == \"progrdynamic\"\n assert candidate(str1 = \"interview\",str2 = \"terviewin\") == \"interviewin\"\n assert candidate(str1 = \"longerstring\",str2 = \"short\") == \"shlongerstring\"\n"}, "metadata": {"canonical_parameter_names": ["str1", "str2"], "leetcode_dataset_entry_point": "Solution().shortestCommonSupersequence", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shortestCommonSupersequence = function(str1, str2) {", "container": null, "callable": "shortestCommonSupersequence", "parameters": [{"name": "str1", "type": "string"}, {"name": "str2", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1093, "task_id": "statistics-from-a-large-sample", "difficulty": "Medium", "problem_description": "You are given a large sample of integers in the range [0, 255]. Since the sample is so large, it is represented by an array count where count[k] is the number of times that k appears in the sample.\nCalculate the following statistics:\n\nminimum: The minimum element in the sample.\nmaximum: The maximum element in the sample.\nmean: The average of the sample, calculated as the total sum of all elements divided by the total number of elements.\nmedian:\n\t\nIf the sample has an odd number of elements, then the median is the middle element once the sample is sorted.\nIf the sample has an even number of elements, then the median is the average of the two middle elements once the sample is sorted.\n\n\nmode: The number that appears the most in the sample. It is guaranteed to be unique.\n\nReturn the statistics of the sample as an array of floating-point numbers [minimum, maximum, mean, median, mode]. Answers within 10-5 of the actual answer will be accepted.\n \nExample 1:\n\nInput: count = [0,1,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\nOutput: [1.00000,3.00000,2.37500,2.50000,3.00000]\nExplanation: The sample represented by count is [1,2,2,2,3,3,3,3].\nThe minimum and maximum are 1 and 3 respectively.\nThe mean is (1+2+2+2+3+3+3+3) / 8 = 19 / 8 = 2.375.\nSince the size of the sample is even, the median is the average of the two middle elements 2 and 3, which is 2.5.\nThe mode is 3 as it appears the most in the sample.\n\nExample 2:\n\nInput: count = [0,4,3,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\nOutput: [1.00000,4.00000,2.18182,2.00000,1.00000]\nExplanation: The sample represented by count is [1,1,1,1,2,2,2,3,3,4,4].\nThe minimum and maximum are 1 and 4 respectively.\nThe mean is (1+1+1+1+2+2+2+3+3+4+4) / 11 = 24 / 11 = 2.18181818... (for display purposes, the output shows the rounded number 2.18182).\nSince the size of the sample is odd, the median is the middle element 2.\nThe mode is 1 as it appears the most in the sample.\n\n \nConstraints:\n\ncount.length == 256\n0 <= count[i] <= 109\n1 <= sum(count) <= 109\nThe mode of the sample that count represents is unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(count = [0, 1, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [1, 3, 2.375, 2.5, 3]\n assert candidate(count = [0, 1, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [1, 3, 2.375, 2.5, 3]\n assert candidate(count = [0, 1, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [1, 3, 2.375, 2.5, 3]\n assert candidate(count = [0, 4, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [1, 4, 2.1818181818181817, 2, 1]\n assert candidate(count = [0, 4, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [1, 4, 2.1818181818181817, 2, 1]\n assert candidate(count = [0, 4, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [1, 4, 2.1818181818181817, 2, 1]\n assert candidate(count = [0, 4, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [1, 4, 2.1818181818181817, 2, 1]\n"}, "metadata": {"canonical_parameter_names": ["count"], "leetcode_dataset_entry_point": "Solution().sampleStats", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sampleStats = function(count) {", "container": null, "callable": "sampleStats", "parameters": [{"name": "count", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1094, "task_id": "car-pooling", "difficulty": "Medium", "problem_description": "There is a car with capacity empty seats. The vehicle only drives east (i.e., it cannot turn around and drive west).\nYou are given the integer capacity and an array trips where trips[i] = [numPassengersi, fromi, toi] indicates that the ith trip has numPassengersi passengers and the locations to pick them up and drop them off are fromi and toi respectively. The locations are given as the number of kilometers due east from the car's initial location.\nReturn true if it is possible to pick up and drop off all passengers for all the given trips, or false otherwise.\n \nExample 1:\n\nInput: trips = [[2,1,5],[3,3,7]], capacity = 4\nOutput: false\n\nExample 2:\n\nInput: trips = [[2,1,5],[3,3,7]], capacity = 5\nOutput: true\n\n \nConstraints:\n\n1 <= trips.length <= 1000\ntrips[i].length == 3\n1 <= numPassengersi <= 100\n0 <= fromi < toi <= 1000\n1 <= capacity <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(trips = [[3, 2, 8], [4, 4, 6], [10, 8, 10]],capacity = 12) == True\n assert candidate(trips = [[3, 2, 7], [2, 7, 9], [4, 1, 3]],capacity = 6) == False\n assert candidate(trips = [[2, 1, 5], [3, 5, 7]],capacity = 5) == True\n assert candidate(trips = [[2, 1, 6], [1, 3, 5], [4, 4, 8]],capacity = 9) == True\n assert candidate(trips = [[3, 2, 7], [3, 7, 9], [8, 3, 9]],capacity = 11) == True\n assert candidate(trips = [[2, 4, 5], [3, 1, 3], [3, 3, 7]],capacity = 5) == True\n assert candidate(trips = [[2, 1, 5], [3, 3, 7]],capacity = 5) == True\n assert candidate(trips = [[1, 3, 6], [2, 3, 7], [1, 8, 9]],capacity = 11) == True\n assert candidate(trips = [[2, 1, 5], [3, 5, 7], [2, 5, 8]],capacity = 6) == True\n assert candidate(trips = [[2, 1, 5], [3, 3, 7]],capacity = 4) == False\n assert candidate(trips = [[5, 2, 4], [3, 1, 3], [8, 6, 9], [2, 4, 8]],capacity = 15) == True\n assert candidate(trips = [[100, 0, 1], [1, 1, 2], [1, 2, 3], [1, 3, 4], [1, 4, 5], [1, 5, 6], [1, 6, 7], [1, 7, 8], [1, 8, 9]],capacity = 105) == True\n assert candidate(trips = [[1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 0, 1]],capacity = 8) == False\n assert candidate(trips = [[1, 1, 3], [1, 1, 4], [1, 1, 5], [1, 1, 6], [1, 1, 7], [1, 1, 8], [1, 1, 9], [1, 1, 10]],capacity = 7) == False\n assert candidate(trips = [[100, 0, 100], [50, 50, 150], [25, 75, 200]],capacity = 150) == False\n assert candidate(trips = [[5, 0, 100], [3, 10, 50], [4, 50, 90], [2, 60, 80]],capacity = 20) == True\n assert candidate(trips = [[10, 0, 20], [5, 5, 15], [3, 10, 20], [2, 15, 20]],capacity = 20) == True\n assert candidate(trips = [[5, 1, 3], [10, 2, 6], [1, 2, 10], [2, 5, 7]],capacity = 17) == True\n assert candidate(trips = [[1, 0, 1], [1, 1, 2], [1, 2, 3], [1, 3, 4], [1, 4, 5], [1, 5, 6]],capacity = 2) == True\n assert candidate(trips = [[1, 0, 20], [2, 0, 15], [3, 0, 10], [4, 0, 5]],capacity = 20) == True\n assert candidate(trips = [[1, 1, 10], [1, 10, 20], [1, 20, 30], [1, 30, 40], [1, 40, 50]],capacity = 10) == True\n assert candidate(trips = [[3, 1, 10], [2, 2, 8], [1, 5, 7], [4, 6, 9]],capacity = 10) == True\n assert candidate(trips = [[30, 0, 2], [50, 1, 3], [40, 2, 4], [20, 3, 5], [10, 4, 6]],capacity = 80) == False\n assert candidate(trips = [[10, 0, 5], [10, 5, 10], [10, 10, 15]],capacity = 25) == True\n assert candidate(trips = [[5, 1, 6], [5, 3, 8], [5, 5, 10], [5, 7, 12]],capacity = 15) == True\n assert candidate(trips = [[1, 0, 500], [2, 100, 400], [3, 200, 300], [4, 300, 400], [5, 400, 500]],capacity = 15) == True\n assert candidate(trips = [[2, 1, 4], [3, 2, 5], [4, 3, 6], [1, 4, 7], [1, 5, 8], [1, 6, 9]],capacity = 10) == True\n assert candidate(trips = [[1, 1, 5], [2, 1, 6], [1, 2, 7], [1, 3, 8], [1, 4, 9], [1, 5, 10]],capacity = 5) == False\n assert candidate(trips = [[2, 2, 3], [2, 3, 5], [2, 5, 7], [2, 7, 9]],capacity = 3) == True\n assert candidate(trips = [[10, 0, 10], [10, 10, 20], [10, 20, 30], [10, 30, 40], [10, 40, 50]],capacity = 40) == True\n assert candidate(trips = [[3, 1, 2], [4, 2, 3], [5, 3, 4], [4, 4, 5], [3, 5, 6], [2, 6, 7]],capacity = 15) == True\n assert candidate(trips = [[1, 1, 2], [2, 2, 3], [3, 3, 4], [4, 4, 5], [5, 5, 6], [6, 6, 7], [7, 7, 8], [8, 8, 9]],capacity = 7) == False\n assert candidate(trips = [[10, 0, 1], [10, 1, 2], [10, 2, 3], [10, 3, 4], [10, 4, 5], [10, 5, 6]],capacity = 10) == True\n assert candidate(trips = [[1, 1, 3], [2, 2, 5], [3, 3, 7], [4, 4, 8], [5, 5, 9]],capacity = 10) == False\n assert candidate(trips = [[1, 1, 2], [2, 2, 3], [3, 3, 4], [4, 4, 5], [5, 5, 6], [6, 6, 7], [7, 7, 8], [8, 8, 9]],capacity = 28) == True\n assert candidate(trips = [[100, 0, 1000], [100, 100, 900], [100, 200, 800], [100, 300, 700], [100, 400, 600]],capacity = 300) == False\n assert candidate(trips = [[1, 1, 2], [2, 2, 3], [3, 3, 4], [4, 4, 5], [5, 5, 6], [6, 6, 7]],capacity = 6) == True\n assert candidate(trips = [[5, 1, 3], [5, 3, 5], [5, 5, 7], [5, 7, 9], [5, 9, 11]],capacity = 20) == True\n assert candidate(trips = [[10, 1, 2], [10, 2, 3], [10, 3, 4], [10, 4, 5], [10, 5, 6], [10, 6, 7]],capacity = 25) == True\n assert candidate(trips = [[10, 0, 10], [5, 0, 5], [1, 6, 10], [2, 5, 8], [3, 7, 12]],capacity = 20) == True\n assert candidate(trips = [[20, 0, 30], [10, 10, 20], [5, 20, 30]],capacity = 25) == False\n assert candidate(trips = [[30, 0, 10], [20, 10, 20], [10, 20, 30], [5, 30, 40], [5, 40, 50]],capacity = 55) == True\n assert candidate(trips = [[1, 1, 3], [2, 3, 6], [3, 6, 9], [4, 9, 12], [5, 12, 15], [6, 15, 18], [7, 18, 21], [8, 21, 24]],capacity = 20) == True\n assert candidate(trips = [[20, 0, 1000], [20, 1000, 2000], [20, 2000, 3000], [20, 3000, 4000], [20, 4000, 5000]],capacity = 60) == True\n assert candidate(trips = [[5, 1, 3], [2, 2, 5], [4, 4, 8], [3, 5, 9]],capacity = 12) == True\n assert candidate(trips = [[1, 0, 2], [1, 2, 3], [1, 3, 4], [1, 4, 5], [1, 5, 6], [1, 6, 7]],capacity = 3) == True\n assert candidate(trips = [[1, 0, 100], [2, 50, 100], [3, 75, 100]],capacity = 6) == True\n assert candidate(trips = [[10, 0, 3], [5, 3, 6], [10, 6, 9], [5, 9, 12]],capacity = 20) == True\n assert candidate(trips = [[3, 0, 1], [3, 1, 2], [3, 2, 3], [3, 3, 4], [3, 4, 5], [3, 5, 6], [3, 6, 7], [3, 7, 8], [3, 8, 9]],capacity = 9) == True\n assert candidate(trips = [[5, 0, 3], [2, 3, 5], [7, 5, 10], [1, 10, 15]],capacity = 12) == True\n assert candidate(trips = [[3, 1, 4], [5, 1, 5], [2, 3, 7], [2, 4, 8]],capacity = 14) == True\n assert candidate(trips = [[10, 0, 1], [10, 0, 2], [10, 0, 3], [10, 0, 4], [10, 0, 5]],capacity = 50) == True\n assert candidate(trips = [[3, 1, 3], [2, 2, 4], [1, 3, 5], [4, 4, 6], [2, 5, 7], [1, 6, 8]],capacity = 10) == True\n assert candidate(trips = [[4, 1, 10], [2, 2, 5], [3, 3, 6], [1, 5, 12]],capacity = 15) == True\n assert candidate(trips = [[5, 0, 5], [4, 5, 10], [3, 10, 15], [2, 15, 20], [1, 20, 25]],capacity = 15) == True\n assert candidate(trips = [[10, 0, 10], [10, 10, 20], [10, 20, 30], [10, 30, 40], [10, 40, 50]],capacity = 20) == True\n assert candidate(trips = [[2, 1, 4], [3, 2, 5], [2, 3, 6], [1, 4, 7], [4, 5, 8], [3, 6, 9]],capacity = 8) == True\n assert candidate(trips = [[3, 0, 1], [3, 1, 2], [3, 2, 3], [3, 3, 4], [3, 4, 5], [3, 5, 6]],capacity = 10) == True\n assert candidate(trips = [[10, 0, 10], [20, 5, 15], [30, 10, 20], [40, 15, 25], [50, 20, 30]],capacity = 100) == True\n assert candidate(trips = [[10, 1, 10], [5, 2, 5], [3, 5, 7], [2, 7, 8]],capacity = 20) == True\n assert candidate(trips = [[3, 0, 1], [3, 1, 2], [3, 2, 3], [3, 3, 4], [3, 4, 5]],capacity = 12) == True\n assert candidate(trips = [[2, 1, 5], [3, 3, 7], [1, 1, 3], [4, 5, 9]],capacity = 7) == True\n assert candidate(trips = [[1, 1, 1000], [2, 2, 999], [3, 3, 998], [4, 4, 997], [5, 5, 996]],capacity = 15) == True\n assert candidate(trips = [[5, 1, 5], [3, 5, 9], [2, 9, 12], [1, 12, 15]],capacity = 15) == True\n assert candidate(trips = [[10, 0, 10], [20, 10, 20], [10, 15, 25], [20, 20, 30], [30, 25, 35]],capacity = 40) == False\n assert candidate(trips = [[2, 1, 3], [3, 2, 4], [4, 3, 5], [5, 4, 6], [6, 5, 7]],capacity = 15) == True\n assert candidate(trips = [[2, 1, 2], [2, 2, 3], [2, 3, 4], [2, 4, 5], [2, 5, 6]],capacity = 4) == True\n assert candidate(trips = [[3, 2, 7], [3, 2, 7], [3, 2, 7]],capacity = 9) == True\n assert candidate(trips = [[50, 0, 500], [50, 100, 600], [50, 200, 700], [50, 300, 800], [50, 400, 900]],capacity = 150) == False\n assert candidate(trips = [[100, 0, 1], [100, 1, 2], [100, 2, 3], [100, 3, 4], [100, 4, 5]],capacity = 100) == True\n assert candidate(trips = [[50, 10, 20], [30, 20, 30], [20, 30, 40], [10, 40, 50], [5, 50, 60]],capacity = 100) == True\n assert candidate(trips = [[50, 0, 500], [50, 500, 1000]],capacity = 100) == True\n assert candidate(trips = [[3, 2, 5], [3, 2, 7], [3, 3, 6], [3, 4, 8]],capacity = 9) == False\n assert candidate(trips = [[5, 1, 3], [2, 3, 8], [3, 5, 9], [1, 6, 10]],capacity = 15) == True\n assert candidate(trips = [[5, 0, 3], [4, 2, 5], [3, 4, 8], [2, 6, 10]],capacity = 14) == True\n assert candidate(trips = [[2, 0, 2], [2, 2, 4], [2, 4, 6], [2, 6, 8], [2, 8, 10], [2, 10, 12]],capacity = 12) == True\n assert candidate(trips = [[1, 1, 2], [1, 1, 2], [1, 1, 2], [1, 1, 2], [1, 1, 2]],capacity = 4) == False\n assert candidate(trips = [[1, 0, 1], [1, 1, 2], [1, 2, 3], [1, 3, 4], [1, 4, 5], [1, 5, 6], [1, 6, 7], [1, 7, 8], [1, 8, 9], [1, 9, 10]],capacity = 10) == True\n assert candidate(trips = [[1, 0, 3], [2, 1, 5], [3, 2, 7], [4, 3, 9], [5, 4, 10]],capacity = 15) == True\n assert candidate(trips = [[10, 0, 100], [10, 20, 120], [10, 40, 140], [10, 60, 160], [10, 80, 180]],capacity = 30) == False\n assert candidate(trips = [[10, 0, 5], [3, 5, 10], [4, 10, 15], [2, 15, 20]],capacity = 12) == True\n assert candidate(trips = [[20, 0, 1000], [10, 100, 900], [5, 200, 800], [1, 300, 700]],capacity = 50) == True\n assert candidate(trips = [[5, 1, 3], [2, 2, 5], [4, 3, 8], [3, 5, 7]],capacity = 10) == True\n assert candidate(trips = [[1, 0, 2], [1, 2, 4], [1, 4, 6], [1, 6, 8], [1, 8, 10], [1, 10, 12]],capacity = 5) == True\n assert candidate(trips = [[5, 1, 5], [3, 1, 4], [2, 3, 6], [1, 4, 7]],capacity = 10) == True\n assert candidate(trips = [[10, 0, 5], [2, 5, 10], [1, 10, 15], [10, 15, 20]],capacity = 12) == True\n assert candidate(trips = [[3, 1, 5], [2, 2, 6], [4, 3, 8], [1, 4, 9], [5, 5, 10]],capacity = 10) == False\n assert candidate(trips = [[6, 0, 20], [2, 10, 30], [4, 20, 40], [1, 30, 50], [3, 40, 60]],capacity = 15) == True\n assert candidate(trips = [[10, 0, 1], [9, 1, 2], [8, 2, 3], [7, 3, 4], [6, 4, 5], [5, 5, 6]],capacity = 10) == True\n assert candidate(trips = [[10, 0, 1], [10, 1, 2], [10, 2, 3], [10, 3, 4], [10, 4, 5]],capacity = 10) == True\n assert candidate(trips = [[1, 1, 2], [2, 2, 3], [3, 3, 4], [4, 4, 5], [5, 5, 6], [6, 6, 7], [7, 7, 8], [8, 8, 9], [9, 9, 10]],capacity = 45) == True\n assert candidate(trips = [[3, 0, 1], [3, 1, 2], [3, 2, 3], [3, 3, 4], [3, 4, 5], [3, 5, 6], [3, 6, 7]],capacity = 9) == True\n assert candidate(trips = [[1, 1, 100], [2, 2, 99], [3, 3, 98], [4, 4, 97]],capacity = 10) == True\n assert candidate(trips = [[1, 0, 1], [1, 1, 2], [1, 2, 3], [1, 3, 4], [1, 4, 5], [1, 5, 6], [1, 6, 7]],capacity = 1) == True\n assert candidate(trips = [[3, 1, 3], [3, 2, 5], [3, 3, 7], [3, 4, 8], [3, 5, 9], [3, 6, 10]],capacity = 9) == False\n assert candidate(trips = [[5, 1, 3], [5, 3, 5], [5, 5, 7], [5, 7, 9]],capacity = 10) == True\n assert candidate(trips = [[5, 1, 5], [2, 3, 8], [4, 5, 9], [3, 6, 10]],capacity = 12) == True\n assert candidate(trips = [[10, 0, 2], [5, 2, 5], [3, 5, 10], [7, 7, 12]],capacity = 15) == True\n assert candidate(trips = [[3, 0, 5], [2, 0, 10], [1, 5, 7], [4, 8, 10]],capacity = 10) == True\n assert candidate(trips = [[50, 0, 100], [20, 100, 200], [30, 200, 300], [40, 300, 400]],capacity = 150) == True\n assert candidate(trips = [[1, 1, 3], [2, 2, 4], [3, 3, 5], [4, 4, 6], [5, 5, 7], [6, 6, 8], [7, 7, 9]],capacity = 15) == True\n assert candidate(trips = [[50, 0, 10], [30, 5, 15], [20, 10, 20], [10, 15, 25]],capacity = 110) == True\n assert candidate(trips = [[1, 1, 1000], [1, 1000, 1000], [1, 500, 501], [1, 501, 502]],capacity = 3) == True\n assert candidate(trips = [[2, 1, 5], [3, 5, 8], [1, 8, 12], [4, 10, 15]],capacity = 10) == True\n assert candidate(trips = [[1, 0, 10], [2, 1, 9], [3, 2, 8], [4, 3, 7], [5, 4, 6]],capacity = 15) == True\n assert candidate(trips = [[10, 1, 4], [5, 5, 7], [2, 2, 6], [4, 6, 8]],capacity = 15) == True\n assert candidate(trips = [[2, 1, 2], [2, 2, 3], [2, 3, 4], [2, 4, 5], [2, 5, 6], [2, 6, 7], [2, 7, 8]],capacity = 3) == True\n assert candidate(trips = [[3, 1, 4], [5, 2, 5], [1, 2, 6], [2, 3, 7], [3, 4, 8]],capacity = 14) == True\n assert candidate(trips = [[2, 1, 5], [3, 3, 7], [5, 5, 10], [1, 7, 12], [4, 8, 13]],capacity = 15) == True\n assert candidate(trips = [[5, 1, 5], [6, 4, 9], [4, 9, 14], [3, 14, 19]],capacity = 15) == True\n assert candidate(trips = [[5, 1, 5], [2, 2, 8], [3, 4, 6], [1, 3, 10]],capacity = 12) == True\n assert candidate(trips = [[3, 1, 3], [2, 1, 4], [1, 2, 5], [4, 3, 6], [2, 4, 7]],capacity = 10) == True\n"}, "metadata": {"canonical_parameter_names": ["trips", "capacity"], "leetcode_dataset_entry_point": "Solution().carPooling", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var carPooling = function(trips, capacity) {", "container": null, "callable": "carPooling", "parameters": [{"name": "trips", "type": "number[][]"}, {"name": "capacity", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1096, "task_id": "brace-expansion-ii", "difficulty": "Hard", "problem_description": "Under the grammar given below, strings can represent a set of lowercase words. Let R(expr) denote the set of words the expression represents.\nThe grammar can best be understood through simple examples:\n\nSingle letters represent a singleton set containing that word.\n\t\nR(\"a\") = {\"a\"}\nR(\"w\") = {\"w\"}\n\n\nWhen we take a comma-delimited list of two or more expressions, we take the union of possibilities.\n\t\nR(\"{a,b,c}\") = {\"a\",\"b\",\"c\"}\nR(\"{{a,b},{b,c}}\") = {\"a\",\"b\",\"c\"} (notice the final set only contains each word at most once)\n\n\nWhen we concatenate two expressions, we take the set of possible concatenations between two words where the first word comes from the first expression and the second word comes from the second expression.\n\t\nR(\"{a,b}{c,d}\") = {\"ac\",\"ad\",\"bc\",\"bd\"}\nR(\"a{b,c}{d,e}f{g,h}\") = {\"abdfg\", \"abdfh\", \"abefg\", \"abefh\", \"acdfg\", \"acdfh\", \"acefg\", \"acefh\"}\n\n\n\nFormally, the three rules for our grammar:\n\nFor every lowercase letter x, we have R(x) = {x}.\nFor expressions e1, e2, ... , ek with k >= 2, we have R({e1, e2, ...}) = R(e1) ∪ R(e2) ∪ ...\nFor expressions e1 and e2, we have R(e1 + e2) = {a + b for (a, b) in R(e1) × R(e2)}, where + denotes concatenation, and × denotes the cartesian product.\n\nGiven an expression representing a set of words under the given grammar, return the sorted list of words that the expression represents.\n \nExample 1:\n\nInput: expression = \"{a,b}{c,{d,e}}\"\nOutput: [\"ac\",\"ad\",\"ae\",\"bc\",\"bd\",\"be\"]\n\nExample 2:\n\nInput: expression = \"{{a,z},a{b,c},{ab,z}}\"\nOutput: [\"a\",\"ab\",\"ac\",\"z\"]\nExplanation: Each distinct word is written only once in the final answer.\n\n \nConstraints:\n\n1 <= expression.length <= 60\nexpression[i] consists of '{', '}', ','or lowercase English letters.\nThe given expression represents a set of words based on the grammar given in the description.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(expression = \"a\") == ['a']\n assert candidate(expression = \"{a,bc,def}\") == ['a', 'bc', 'def']\n assert candidate(expression = \"a{b{c,d},e{f,g}}\") == ['abc', 'abd', 'aef', 'aeg']\n assert candidate(expression = \"{a,b,c}\") == ['a', 'b', 'c']\n assert candidate(expression = \"{a,b}c\") == ['ac', 'bc']\n assert candidate(expression = \"{abc}\") == ['abc']\n assert candidate(expression = \"a{b,c,d}e\") == ['abe', 'ace', 'ade']\n assert candidate(expression = \"{a,b}{c,{d,{e,f}}}\") == ['ac', 'ad', 'ae', 'af', 'bc', 'bd', 'be', 'bf']\n assert candidate(expression = \"a{b,c}\") == ['ab', 'ac']\n assert candidate(expression = \"{a,b}{c,d}\") == ['ac', 'ad', 'bc', 'bd']\n assert candidate(expression = \"a{b,c}d\") == ['abd', 'acd']\n assert candidate(expression = \"{a,b}{c,{d,e}}\") == ['ac', 'ad', 'ae', 'bc', 'bd', 'be']\n assert candidate(expression = \"a{b,c}d{e,f}\") == ['abde', 'abdf', 'acde', 'acdf']\n assert candidate(expression = \"{a,b}{c,{d{e,f},g}}\") == ['ac', 'ade', 'adf', 'ag', 'bc', 'bde', 'bdf', 'bg']\n assert candidate(expression = \"{a{b,c},d{e,f}}\") == ['ab', 'ac', 'de', 'df']\n assert candidate(expression = \"{a,b}{c,d,e}\") == ['ac', 'ad', 'ae', 'bc', 'bd', 'be']\n assert candidate(expression = \"{a,b,c}{d,e,f}\") == ['ad', 'ae', 'af', 'bd', 'be', 'bf', 'cd', 'ce', 'cf']\n assert candidate(expression = \"{{a,z},a{b,c},{ab,z}}\") == ['a', 'ab', 'ac', 'z']\n assert candidate(expression = \"{a{b{c,d},e{f,g}},{h{i,j},k{l,m,n}}}\") == ['abc', 'abd', 'aef', 'aeg', 'hi', 'hj', 'kl', 'km', 'kn']\n assert candidate(expression = \"{a,b}{c{d{e{f,g},h},i},j{k{l,m{no,pq{r,s}},t{u,v}}}}\") == ['acdef', 'acdeg', 'acdh', 'aci', 'ajkl', 'ajkmno', 'ajkmpqr', 'ajkmpqs', 'ajktu', 'ajktv', 'bcdef', 'bcdeg', 'bcdh', 'bci', 'bjkl', 'bjkmno', 'bjkmpqr', 'bjkmpqs', 'bjktu', 'bjktv']\n assert candidate(expression = \"{a,b{c,d{e,f}},g{h,i}}{j,k}\") == ['aj', 'ak', 'bcj', 'bck', 'bdej', 'bdek', 'bdfj', 'bdfk', 'ghj', 'ghk', 'gij', 'gik']\n assert candidate(expression = \"{a{b{c,d},e},f{g{h,i},j}}\") == ['abc', 'abd', 'ae', 'fgh', 'fgi', 'fj']\n assert candidate(expression = \"{a,b,c}{d,{e,f},{g,h}}{i,j}\") == ['adi', 'adj', 'aei', 'aej', 'afi', 'afj', 'agi', 'agj', 'ahi', 'ahj', 'bdi', 'bdj', 'bei', 'bej', 'bfi', 'bfj', 'bgi', 'bgj', 'bhi', 'bhj', 'cdi', 'cdj', 'cei', 'cej', 'cfi', 'cfj', 'cgi', 'cgj', 'chi', 'chj']\n assert candidate(expression = \"{a{b{c{d,e},f},g},h{i,j}}\") == ['abcd', 'abce', 'abf', 'ag', 'hi', 'hj']\n assert candidate(expression = \"{a,b}{c{d,e,f},g{h,i}}{j,k}\") == ['acdj', 'acdk', 'acej', 'acek', 'acfj', 'acfk', 'aghj', 'aghk', 'agij', 'agik', 'bcdj', 'bcdk', 'bcej', 'bcek', 'bcfj', 'bcfk', 'bghj', 'bghk', 'bgij', 'bgik']\n assert candidate(expression = \"{a,b}{c,d,e,f}{g,h,i}{j,k,l,m,n}{o,p,q,r,s,t,u,v,w,x,y,z}\") == ['acgjo', 'acgjp', 'acgjq', 'acgjr', 'acgjs', 'acgjt', 'acgju', 'acgjv', 'acgjw', 'acgjx', 'acgjy', 'acgjz', 'acgko', 'acgkp', 'acgkq', 'acgkr', 'acgks', 'acgkt', 'acgku', 'acgkv', 'acgkw', 'acgkx', 'acgky', 'acgkz', 'acglo', 'acglp', 'acglq', 'acglr', 'acgls', 'acglt', 'acglu', 'acglv', 'acglw', 'acglx', 'acgly', 'acglz', 'acgmo', 'acgmp', 'acgmq', 'acgmr', 'acgms', 'acgmt', 'acgmu', 'acgmv', 'acgmw', 'acgmx', 'acgmy', 'acgmz', 'acgno', 'acgnp', 'acgnq', 'acgnr', 'acgns', 'acgnt', 'acgnu', 'acgnv', 'acgnw', 'acgnx', 'acgny', 'acgnz', 'achjo', 'achjp', 'achjq', 'achjr', 'achjs', 'achjt', 'achju', 'achjv', 'achjw', 'achjx', 'achjy', 'achjz', 'achko', 'achkp', 'achkq', 'achkr', 'achks', 'achkt', 'achku', 'achkv', 'achkw', 'achkx', 'achky', 'achkz', 'achlo', 'achlp', 'achlq', 'achlr', 'achls', 'achlt', 'achlu', 'achlv', 'achlw', 'achlx', 'achly', 'achlz', 'achmo', 'achmp', 'achmq', 'achmr', 'achms', 'achmt', 'achmu', 'achmv', 'achmw', 'achmx', 'achmy', 'achmz', 'achno', 'achnp', 'achnq', 'achnr', 'achns', 'achnt', 'achnu', 'achnv', 'achnw', 'achnx', 'achny', 'achnz', 'acijo', 'acijp', 'acijq', 'acijr', 'acijs', 'acijt', 'aciju', 'acijv', 'acijw', 'acijx', 'acijy', 'acijz', 'aciko', 'acikp', 'acikq', 'acikr', 'aciks', 'acikt', 'aciku', 'acikv', 'acikw', 'acikx', 'aciky', 'acikz', 'acilo', 'acilp', 'acilq', 'acilr', 'acils', 'acilt', 'acilu', 'acilv', 'acilw', 'acilx', 'acily', 'acilz', 'acimo', 'acimp', 'acimq', 'acimr', 'acims', 'acimt', 'acimu', 'acimv', 'acimw', 'acimx', 'acimy', 'acimz', 'acino', 'acinp', 'acinq', 'acinr', 'acins', 'acint', 'acinu', 'acinv', 'acinw', 'acinx', 'aciny', 'acinz', 'adgjo', 'adgjp', 'adgjq', 'adgjr', 'adgjs', 'adgjt', 'adgju', 'adgjv', 'adgjw', 'adgjx', 'adgjy', 'adgjz', 'adgko', 'adgkp', 'adgkq', 'adgkr', 'adgks', 'adgkt', 'adgku', 'adgkv', 'adgkw', 'adgkx', 'adgky', 'adgkz', 'adglo', 'adglp', 'adglq', 'adglr', 'adgls', 'adglt', 'adglu', 'adglv', 'adglw', 'adglx', 'adgly', 'adglz', 'adgmo', 'adgmp', 'adgmq', 'adgmr', 'adgms', 'adgmt', 'adgmu', 'adgmv', 'adgmw', 'adgmx', 'adgmy', 'adgmz', 'adgno', 'adgnp', 'adgnq', 'adgnr', 'adgns', 'adgnt', 'adgnu', 'adgnv', 'adgnw', 'adgnx', 'adgny', 'adgnz', 'adhjo', 'adhjp', 'adhjq', 'adhjr', 'adhjs', 'adhjt', 'adhju', 'adhjv', 'adhjw', 'adhjx', 'adhjy', 'adhjz', 'adhko', 'adhkp', 'adhkq', 'adhkr', 'adhks', 'adhkt', 'adhku', 'adhkv', 'adhkw', 'adhkx', 'adhky', 'adhkz', 'adhlo', 'adhlp', 'adhlq', 'adhlr', 'adhls', 'adhlt', 'adhlu', 'adhlv', 'adhlw', 'adhlx', 'adhly', 'adhlz', 'adhmo', 'adhmp', 'adhmq', 'adhmr', 'adhms', 'adhmt', 'adhmu', 'adhmv', 'adhmw', 'adhmx', 'adhmy', 'adhmz', 'adhno', 'adhnp', 'adhnq', 'adhnr', 'adhns', 'adhnt', 'adhnu', 'adhnv', 'adhnw', 'adhnx', 'adhny', 'adhnz', 'adijo', 'adijp', 'adijq', 'adijr', 'adijs', 'adijt', 'adiju', 'adijv', 'adijw', 'adijx', 'adijy', 'adijz', 'adiko', 'adikp', 'adikq', 'adikr', 'adiks', 'adikt', 'adiku', 'adikv', 'adikw', 'adikx', 'adiky', 'adikz', 'adilo', 'adilp', 'adilq', 'adilr', 'adils', 'adilt', 'adilu', 'adilv', 'adilw', 'adilx', 'adily', 'adilz', 'adimo', 'adimp', 'adimq', 'adimr', 'adims', 'adimt', 'adimu', 'adimv', 'adimw', 'adimx', 'adimy', 'adimz', 'adino', 'adinp', 'adinq', 'adinr', 'adins', 'adint', 'adinu', 'adinv', 'adinw', 'adinx', 'adiny', 'adinz', 'aegjo', 'aegjp', 'aegjq', 'aegjr', 'aegjs', 'aegjt', 'aegju', 'aegjv', 'aegjw', 'aegjx', 'aegjy', 'aegjz', 'aegko', 'aegkp', 'aegkq', 'aegkr', 'aegks', 'aegkt', 'aegku', 'aegkv', 'aegkw', 'aegkx', 'aegky', 'aegkz', 'aeglo', 'aeglp', 'aeglq', 'aeglr', 'aegls', 'aeglt', 'aeglu', 'aeglv', 'aeglw', 'aeglx', 'aegly', 'aeglz', 'aegmo', 'aegmp', 'aegmq', 'aegmr', 'aegms', 'aegmt', 'aegmu', 'aegmv', 'aegmw', 'aegmx', 'aegmy', 'aegmz', 'aegno', 'aegnp', 'aegnq', 'aegnr', 'aegns', 'aegnt', 'aegnu', 'aegnv', 'aegnw', 'aegnx', 'aegny', 'aegnz', 'aehjo', 'aehjp', 'aehjq', 'aehjr', 'aehjs', 'aehjt', 'aehju', 'aehjv', 'aehjw', 'aehjx', 'aehjy', 'aehjz', 'aehko', 'aehkp', 'aehkq', 'aehkr', 'aehks', 'aehkt', 'aehku', 'aehkv', 'aehkw', 'aehkx', 'aehky', 'aehkz', 'aehlo', 'aehlp', 'aehlq', 'aehlr', 'aehls', 'aehlt', 'aehlu', 'aehlv', 'aehlw', 'aehlx', 'aehly', 'aehlz', 'aehmo', 'aehmp', 'aehmq', 'aehmr', 'aehms', 'aehmt', 'aehmu', 'aehmv', 'aehmw', 'aehmx', 'aehmy', 'aehmz', 'aehno', 'aehnp', 'aehnq', 'aehnr', 'aehns', 'aehnt', 'aehnu', 'aehnv', 'aehnw', 'aehnx', 'aehny', 'aehnz', 'aeijo', 'aeijp', 'aeijq', 'aeijr', 'aeijs', 'aeijt', 'aeiju', 'aeijv', 'aeijw', 'aeijx', 'aeijy', 'aeijz', 'aeiko', 'aeikp', 'aeikq', 'aeikr', 'aeiks', 'aeikt', 'aeiku', 'aeikv', 'aeikw', 'aeikx', 'aeiky', 'aeikz', 'aeilo', 'aeilp', 'aeilq', 'aeilr', 'aeils', 'aeilt', 'aeilu', 'aeilv', 'aeilw', 'aeilx', 'aeily', 'aeilz', 'aeimo', 'aeimp', 'aeimq', 'aeimr', 'aeims', 'aeimt', 'aeimu', 'aeimv', 'aeimw', 'aeimx', 'aeimy', 'aeimz', 'aeino', 'aeinp', 'aeinq', 'aeinr', 'aeins', 'aeint', 'aeinu', 'aeinv', 'aeinw', 'aeinx', 'aeiny', 'aeinz', 'afgjo', 'afgjp', 'afgjq', 'afgjr', 'afgjs', 'afgjt', 'afgju', 'afgjv', 'afgjw', 'afgjx', 'afgjy', 'afgjz', 'afgko', 'afgkp', 'afgkq', 'afgkr', 'afgks', 'afgkt', 'afgku', 'afgkv', 'afgkw', 'afgkx', 'afgky', 'afgkz', 'afglo', 'afglp', 'afglq', 'afglr', 'afgls', 'afglt', 'afglu', 'afglv', 'afglw', 'afglx', 'afgly', 'afglz', 'afgmo', 'afgmp', 'afgmq', 'afgmr', 'afgms', 'afgmt', 'afgmu', 'afgmv', 'afgmw', 'afgmx', 'afgmy', 'afgmz', 'afgno', 'afgnp', 'afgnq', 'afgnr', 'afgns', 'afgnt', 'afgnu', 'afgnv', 'afgnw', 'afgnx', 'afgny', 'afgnz', 'afhjo', 'afhjp', 'afhjq', 'afhjr', 'afhjs', 'afhjt', 'afhju', 'afhjv', 'afhjw', 'afhjx', 'afhjy', 'afhjz', 'afhko', 'afhkp', 'afhkq', 'afhkr', 'afhks', 'afhkt', 'afhku', 'afhkv', 'afhkw', 'afhkx', 'afhky', 'afhkz', 'afhlo', 'afhlp', 'afhlq', 'afhlr', 'afhls', 'afhlt', 'afhlu', 'afhlv', 'afhlw', 'afhlx', 'afhly', 'afhlz', 'afhmo', 'afhmp', 'afhmq', 'afhmr', 'afhms', 'afhmt', 'afhmu', 'afhmv', 'afhmw', 'afhmx', 'afhmy', 'afhmz', 'afhno', 'afhnp', 'afhnq', 'afhnr', 'afhns', 'afhnt', 'afhnu', 'afhnv', 'afhnw', 'afhnx', 'afhny', 'afhnz', 'afijo', 'afijp', 'afijq', 'afijr', 'afijs', 'afijt', 'afiju', 'afijv', 'afijw', 'afijx', 'afijy', 'afijz', 'afiko', 'afikp', 'afikq', 'afikr', 'afiks', 'afikt', 'afiku', 'afikv', 'afikw', 'afikx', 'afiky', 'afikz', 'afilo', 'afilp', 'afilq', 'afilr', 'afils', 'afilt', 'afilu', 'afilv', 'afilw', 'afilx', 'afily', 'afilz', 'afimo', 'afimp', 'afimq', 'afimr', 'afims', 'afimt', 'afimu', 'afimv', 'afimw', 'afimx', 'afimy', 'afimz', 'afino', 'afinp', 'afinq', 'afinr', 'afins', 'afint', 'afinu', 'afinv', 'afinw', 'afinx', 'afiny', 'afinz', 'bcgjo', 'bcgjp', 'bcgjq', 'bcgjr', 'bcgjs', 'bcgjt', 'bcgju', 'bcgjv', 'bcgjw', 'bcgjx', 'bcgjy', 'bcgjz', 'bcgko', 'bcgkp', 'bcgkq', 'bcgkr', 'bcgks', 'bcgkt', 'bcgku', 'bcgkv', 'bcgkw', 'bcgkx', 'bcgky', 'bcgkz', 'bcglo', 'bcglp', 'bcglq', 'bcglr', 'bcgls', 'bcglt', 'bcglu', 'bcglv', 'bcglw', 'bcglx', 'bcgly', 'bcglz', 'bcgmo', 'bcgmp', 'bcgmq', 'bcgmr', 'bcgms', 'bcgmt', 'bcgmu', 'bcgmv', 'bcgmw', 'bcgmx', 'bcgmy', 'bcgmz', 'bcgno', 'bcgnp', 'bcgnq', 'bcgnr', 'bcgns', 'bcgnt', 'bcgnu', 'bcgnv', 'bcgnw', 'bcgnx', 'bcgny', 'bcgnz', 'bchjo', 'bchjp', 'bchjq', 'bchjr', 'bchjs', 'bchjt', 'bchju', 'bchjv', 'bchjw', 'bchjx', 'bchjy', 'bchjz', 'bchko', 'bchkp', 'bchkq', 'bchkr', 'bchks', 'bchkt', 'bchku', 'bchkv', 'bchkw', 'bchkx', 'bchky', 'bchkz', 'bchlo', 'bchlp', 'bchlq', 'bchlr', 'bchls', 'bchlt', 'bchlu', 'bchlv', 'bchlw', 'bchlx', 'bchly', 'bchlz', 'bchmo', 'bchmp', 'bchmq', 'bchmr', 'bchms', 'bchmt', 'bchmu', 'bchmv', 'bchmw', 'bchmx', 'bchmy', 'bchmz', 'bchno', 'bchnp', 'bchnq', 'bchnr', 'bchns', 'bchnt', 'bchnu', 'bchnv', 'bchnw', 'bchnx', 'bchny', 'bchnz', 'bcijo', 'bcijp', 'bcijq', 'bcijr', 'bcijs', 'bcijt', 'bciju', 'bcijv', 'bcijw', 'bcijx', 'bcijy', 'bcijz', 'bciko', 'bcikp', 'bcikq', 'bcikr', 'bciks', 'bcikt', 'bciku', 'bcikv', 'bcikw', 'bcikx', 'bciky', 'bcikz', 'bcilo', 'bcilp', 'bcilq', 'bcilr', 'bcils', 'bcilt', 'bcilu', 'bcilv', 'bcilw', 'bcilx', 'bcily', 'bcilz', 'bcimo', 'bcimp', 'bcimq', 'bcimr', 'bcims', 'bcimt', 'bcimu', 'bcimv', 'bcimw', 'bcimx', 'bcimy', 'bcimz', 'bcino', 'bcinp', 'bcinq', 'bcinr', 'bcins', 'bcint', 'bcinu', 'bcinv', 'bcinw', 'bcinx', 'bciny', 'bcinz', 'bdgjo', 'bdgjp', 'bdgjq', 'bdgjr', 'bdgjs', 'bdgjt', 'bdgju', 'bdgjv', 'bdgjw', 'bdgjx', 'bdgjy', 'bdgjz', 'bdgko', 'bdgkp', 'bdgkq', 'bdgkr', 'bdgks', 'bdgkt', 'bdgku', 'bdgkv', 'bdgkw', 'bdgkx', 'bdgky', 'bdgkz', 'bdglo', 'bdglp', 'bdglq', 'bdglr', 'bdgls', 'bdglt', 'bdglu', 'bdglv', 'bdglw', 'bdglx', 'bdgly', 'bdglz', 'bdgmo', 'bdgmp', 'bdgmq', 'bdgmr', 'bdgms', 'bdgmt', 'bdgmu', 'bdgmv', 'bdgmw', 'bdgmx', 'bdgmy', 'bdgmz', 'bdgno', 'bdgnp', 'bdgnq', 'bdgnr', 'bdgns', 'bdgnt', 'bdgnu', 'bdgnv', 'bdgnw', 'bdgnx', 'bdgny', 'bdgnz', 'bdhjo', 'bdhjp', 'bdhjq', 'bdhjr', 'bdhjs', 'bdhjt', 'bdhju', 'bdhjv', 'bdhjw', 'bdhjx', 'bdhjy', 'bdhjz', 'bdhko', 'bdhkp', 'bdhkq', 'bdhkr', 'bdhks', 'bdhkt', 'bdhku', 'bdhkv', 'bdhkw', 'bdhkx', 'bdhky', 'bdhkz', 'bdhlo', 'bdhlp', 'bdhlq', 'bdhlr', 'bdhls', 'bdhlt', 'bdhlu', 'bdhlv', 'bdhlw', 'bdhlx', 'bdhly', 'bdhlz', 'bdhmo', 'bdhmp', 'bdhmq', 'bdhmr', 'bdhms', 'bdhmt', 'bdhmu', 'bdhmv', 'bdhmw', 'bdhmx', 'bdhmy', 'bdhmz', 'bdhno', 'bdhnp', 'bdhnq', 'bdhnr', 'bdhns', 'bdhnt', 'bdhnu', 'bdhnv', 'bdhnw', 'bdhnx', 'bdhny', 'bdhnz', 'bdijo', 'bdijp', 'bdijq', 'bdijr', 'bdijs', 'bdijt', 'bdiju', 'bdijv', 'bdijw', 'bdijx', 'bdijy', 'bdijz', 'bdiko', 'bdikp', 'bdikq', 'bdikr', 'bdiks', 'bdikt', 'bdiku', 'bdikv', 'bdikw', 'bdikx', 'bdiky', 'bdikz', 'bdilo', 'bdilp', 'bdilq', 'bdilr', 'bdils', 'bdilt', 'bdilu', 'bdilv', 'bdilw', 'bdilx', 'bdily', 'bdilz', 'bdimo', 'bdimp', 'bdimq', 'bdimr', 'bdims', 'bdimt', 'bdimu', 'bdimv', 'bdimw', 'bdimx', 'bdimy', 'bdimz', 'bdino', 'bdinp', 'bdinq', 'bdinr', 'bdins', 'bdint', 'bdinu', 'bdinv', 'bdinw', 'bdinx', 'bdiny', 'bdinz', 'begjo', 'begjp', 'begjq', 'begjr', 'begjs', 'begjt', 'begju', 'begjv', 'begjw', 'begjx', 'begjy', 'begjz', 'begko', 'begkp', 'begkq', 'begkr', 'begks', 'begkt', 'begku', 'begkv', 'begkw', 'begkx', 'begky', 'begkz', 'beglo', 'beglp', 'beglq', 'beglr', 'begls', 'beglt', 'beglu', 'beglv', 'beglw', 'beglx', 'begly', 'beglz', 'begmo', 'begmp', 'begmq', 'begmr', 'begms', 'begmt', 'begmu', 'begmv', 'begmw', 'begmx', 'begmy', 'begmz', 'begno', 'begnp', 'begnq', 'begnr', 'begns', 'begnt', 'begnu', 'begnv', 'begnw', 'begnx', 'begny', 'begnz', 'behjo', 'behjp', 'behjq', 'behjr', 'behjs', 'behjt', 'behju', 'behjv', 'behjw', 'behjx', 'behjy', 'behjz', 'behko', 'behkp', 'behkq', 'behkr', 'behks', 'behkt', 'behku', 'behkv', 'behkw', 'behkx', 'behky', 'behkz', 'behlo', 'behlp', 'behlq', 'behlr', 'behls', 'behlt', 'behlu', 'behlv', 'behlw', 'behlx', 'behly', 'behlz', 'behmo', 'behmp', 'behmq', 'behmr', 'behms', 'behmt', 'behmu', 'behmv', 'behmw', 'behmx', 'behmy', 'behmz', 'behno', 'behnp', 'behnq', 'behnr', 'behns', 'behnt', 'behnu', 'behnv', 'behnw', 'behnx', 'behny', 'behnz', 'beijo', 'beijp', 'beijq', 'beijr', 'beijs', 'beijt', 'beiju', 'beijv', 'beijw', 'beijx', 'beijy', 'beijz', 'beiko', 'beikp', 'beikq', 'beikr', 'beiks', 'beikt', 'beiku', 'beikv', 'beikw', 'beikx', 'beiky', 'beikz', 'beilo', 'beilp', 'beilq', 'beilr', 'beils', 'beilt', 'beilu', 'beilv', 'beilw', 'beilx', 'beily', 'beilz', 'beimo', 'beimp', 'beimq', 'beimr', 'beims', 'beimt', 'beimu', 'beimv', 'beimw', 'beimx', 'beimy', 'beimz', 'beino', 'beinp', 'beinq', 'beinr', 'beins', 'beint', 'beinu', 'beinv', 'beinw', 'beinx', 'beiny', 'beinz', 'bfgjo', 'bfgjp', 'bfgjq', 'bfgjr', 'bfgjs', 'bfgjt', 'bfgju', 'bfgjv', 'bfgjw', 'bfgjx', 'bfgjy', 'bfgjz', 'bfgko', 'bfgkp', 'bfgkq', 'bfgkr', 'bfgks', 'bfgkt', 'bfgku', 'bfgkv', 'bfgkw', 'bfgkx', 'bfgky', 'bfgkz', 'bfglo', 'bfglp', 'bfglq', 'bfglr', 'bfgls', 'bfglt', 'bfglu', 'bfglv', 'bfglw', 'bfglx', 'bfgly', 'bfglz', 'bfgmo', 'bfgmp', 'bfgmq', 'bfgmr', 'bfgms', 'bfgmt', 'bfgmu', 'bfgmv', 'bfgmw', 'bfgmx', 'bfgmy', 'bfgmz', 'bfgno', 'bfgnp', 'bfgnq', 'bfgnr', 'bfgns', 'bfgnt', 'bfgnu', 'bfgnv', 'bfgnw', 'bfgnx', 'bfgny', 'bfgnz', 'bfhjo', 'bfhjp', 'bfhjq', 'bfhjr', 'bfhjs', 'bfhjt', 'bfhju', 'bfhjv', 'bfhjw', 'bfhjx', 'bfhjy', 'bfhjz', 'bfhko', 'bfhkp', 'bfhkq', 'bfhkr', 'bfhks', 'bfhkt', 'bfhku', 'bfhkv', 'bfhkw', 'bfhkx', 'bfhky', 'bfhkz', 'bfhlo', 'bfhlp', 'bfhlq', 'bfhlr', 'bfhls', 'bfhlt', 'bfhlu', 'bfhlv', 'bfhlw', 'bfhlx', 'bfhly', 'bfhlz', 'bfhmo', 'bfhmp', 'bfhmq', 'bfhmr', 'bfhms', 'bfhmt', 'bfhmu', 'bfhmv', 'bfhmw', 'bfhmx', 'bfhmy', 'bfhmz', 'bfhno', 'bfhnp', 'bfhnq', 'bfhnr', 'bfhns', 'bfhnt', 'bfhnu', 'bfhnv', 'bfhnw', 'bfhnx', 'bfhny', 'bfhnz', 'bfijo', 'bfijp', 'bfijq', 'bfijr', 'bfijs', 'bfijt', 'bfiju', 'bfijv', 'bfijw', 'bfijx', 'bfijy', 'bfijz', 'bfiko', 'bfikp', 'bfikq', 'bfikr', 'bfiks', 'bfikt', 'bfiku', 'bfikv', 'bfikw', 'bfikx', 'bfiky', 'bfikz', 'bfilo', 'bfilp', 'bfilq', 'bfilr', 'bfils', 'bfilt', 'bfilu', 'bfilv', 'bfilw', 'bfilx', 'bfily', 'bfilz', 'bfimo', 'bfimp', 'bfimq', 'bfimr', 'bfims', 'bfimt', 'bfimu', 'bfimv', 'bfimw', 'bfimx', 'bfimy', 'bfimz', 'bfino', 'bfinp', 'bfinq', 'bfinr', 'bfins', 'bfint', 'bfinu', 'bfinv', 'bfinw', 'bfinx', 'bfiny', 'bfinz']\n assert candidate(expression = \"a{b{c,d},e{f,g}}h\") == ['abch', 'abdh', 'aefh', 'aegh']\n assert candidate(expression = \"{a,{b,{c,{d,e}}}}{f,g}\") == ['af', 'ag', 'bf', 'bg', 'cf', 'cg', 'df', 'dg', 'ef', 'eg']\n assert candidate(expression = \"{a,b,c}{d{e,f},g{h,i}}{j,k}\") == ['adej', 'adek', 'adfj', 'adfk', 'aghj', 'aghk', 'agij', 'agik', 'bdej', 'bdek', 'bdfj', 'bdfk', 'bghj', 'bghk', 'bgij', 'bgik', 'cdej', 'cdek', 'cdfj', 'cdfk', 'cghj', 'cghk', 'cgij', 'cgik']\n assert candidate(expression = \"{a,b,c}{d,e,f}{g,h}\") == ['adg', 'adh', 'aeg', 'aeh', 'afg', 'afh', 'bdg', 'bdh', 'beg', 'beh', 'bfg', 'bfh', 'cdg', 'cdh', 'ceg', 'ceh', 'cfg', 'cfh']\n assert candidate(expression = \"{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}a{b,c}\") == ['aab', 'aac', 'bab', 'bac', 'cab', 'cac', 'dab', 'dac', 'eab', 'eac', 'fab', 'fac', 'gab', 'gac', 'hab', 'hac', 'iab', 'iac', 'jab', 'jac', 'kab', 'kac', 'lab', 'lac', 'mab', 'mac', 'nab', 'nac', 'oab', 'oac', 'pab', 'pac', 'qab', 'qac', 'rab', 'rac', 'sab', 'sac', 'tab', 'tac', 'uab', 'uac', 'vab', 'vac', 'wab', 'wac', 'xab', 'xac', 'yab', 'yac', 'zab', 'zac']\n assert candidate(expression = \"{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}{x,y,z}\") == ['ax', 'ay', 'az', 'bx', 'by', 'bz', 'cx', 'cy', 'cz', 'dx', 'dy', 'dz', 'ex', 'ey', 'ez', 'fx', 'fy', 'fz', 'gx', 'gy', 'gz', 'hx', 'hy', 'hz', 'ix', 'iy', 'iz', 'jx', 'jy', 'jz', 'kx', 'ky', 'kz', 'lx', 'ly', 'lz', 'mx', 'my', 'mz', 'nx', 'ny', 'nz', 'ox', 'oy', 'oz', 'px', 'py', 'pz', 'qx', 'qy', 'qz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz', 'tx', 'ty', 'tz', 'ux', 'uy', 'uz', 'vx', 'vy', 'vz', 'wx', 'wy', 'wz', 'xx', 'xy', 'xz', 'yx', 'yy', 'yz', 'zx', 'zy', 'zz']\n assert candidate(expression = \"{a,b{c,d},e{f,g}}{h,i}\") == ['ah', 'ai', 'bch', 'bci', 'bdh', 'bdi', 'efh', 'efi', 'egh', 'egi']\n assert candidate(expression = \"{a,b{c,d{e,f}}}{g,h}\") == ['ag', 'ah', 'bcg', 'bch', 'bdeg', 'bdeh', 'bdfg', 'bdfh']\n assert candidate(expression = \"{a,b}{c{d,e}}{f,g{h,i}}{j,k{m,n}}\") == ['acdfj', 'acdfkm', 'acdfkn', 'acdghj', 'acdghkm', 'acdghkn', 'acdgij', 'acdgikm', 'acdgikn', 'acefj', 'acefkm', 'acefkn', 'aceghj', 'aceghkm', 'aceghkn', 'acegij', 'acegikm', 'acegikn', 'bcdfj', 'bcdfkm', 'bcdfkn', 'bcdghj', 'bcdghkm', 'bcdghkn', 'bcdgij', 'bcdgikm', 'bcdgikn', 'bcefj', 'bcefkm', 'bcefkn', 'bceghj', 'bceghkm', 'bceghkn', 'bcegij', 'bcegikm', 'bcegikn']\n assert candidate(expression = \"{a,{b,{c,d}}}{e,{f,{g,h}}}\") == ['ae', 'af', 'ag', 'ah', 'be', 'bf', 'bg', 'bh', 'ce', 'cf', 'cg', 'ch', 'de', 'df', 'dg', 'dh']\n assert candidate(expression = \"{a,b}{c,d,e}{f,g,h}{i,j,k}\") == ['acfi', 'acfj', 'acfk', 'acgi', 'acgj', 'acgk', 'achi', 'achj', 'achk', 'adfi', 'adfj', 'adfk', 'adgi', 'adgj', 'adgk', 'adhi', 'adhj', 'adhk', 'aefi', 'aefj', 'aefk', 'aegi', 'aegj', 'aegk', 'aehi', 'aehj', 'aehk', 'bcfi', 'bcfj', 'bcfk', 'bcgi', 'bcgj', 'bcgk', 'bchi', 'bchj', 'bchk', 'bdfi', 'bdfj', 'bdfk', 'bdgi', 'bdgj', 'bdgk', 'bdhi', 'bdhj', 'bdhk', 'befi', 'befj', 'befk', 'begi', 'begj', 'begk', 'behi', 'behj', 'behk']\n assert candidate(expression = \"{a,b,c}{d,e,f,g}\") == ['ad', 'ae', 'af', 'ag', 'bd', 'be', 'bf', 'bg', 'cd', 'ce', 'cf', 'cg']\n assert candidate(expression = \"{a,{b,{c,{d,e}}}}f\") == ['af', 'bf', 'cf', 'df', 'ef']\n assert candidate(expression = \"{a,b}{c{d,e},f{g,h}}{i,j}{k,l}\") == ['acdik', 'acdil', 'acdjk', 'acdjl', 'aceik', 'aceil', 'acejk', 'acejl', 'afgik', 'afgil', 'afgjk', 'afgjl', 'afhik', 'afhil', 'afhjk', 'afhjl', 'bcdik', 'bcdil', 'bcdjk', 'bcdjl', 'bceik', 'bceil', 'bcejk', 'bcejl', 'bfgik', 'bfgil', 'bfgjk', 'bfgjl', 'bfhik', 'bfhil', 'bfhjk', 'bfhjl']\n assert candidate(expression = \"{a,b}{c,d{e,f}}\") == ['ac', 'ade', 'adf', 'bc', 'bde', 'bdf']\n assert candidate(expression = \"{a,b,c}{d,e,f}{g,h,{i,j},{k,l}}\") == ['adg', 'adh', 'adi', 'adj', 'adk', 'adl', 'aeg', 'aeh', 'aei', 'aej', 'aek', 'ael', 'afg', 'afh', 'afi', 'afj', 'afk', 'afl', 'bdg', 'bdh', 'bdi', 'bdj', 'bdk', 'bdl', 'beg', 'beh', 'bei', 'bej', 'bek', 'bel', 'bfg', 'bfh', 'bfi', 'bfj', 'bfk', 'bfl', 'cdg', 'cdh', 'cdi', 'cdj', 'cdk', 'cdl', 'ceg', 'ceh', 'cei', 'cej', 'cek', 'cel', 'cfg', 'cfh', 'cfi', 'cfj', 'cfk', 'cfl']\n assert candidate(expression = \"{{a,b,c},{d,e,f},{g,h,i}}{j,k,l}\") == ['aj', 'ak', 'al', 'bj', 'bk', 'bl', 'cj', 'ck', 'cl', 'dj', 'dk', 'dl', 'ej', 'ek', 'el', 'fj', 'fk', 'fl', 'gj', 'gk', 'gl', 'hj', 'hk', 'hl', 'ij', 'ik', 'il']\n assert candidate(expression = \"{a,b}{c,{d,e}}{f,{g,h}}{i,j}\") == ['acfi', 'acfj', 'acgi', 'acgj', 'achi', 'achj', 'adfi', 'adfj', 'adgi', 'adgj', 'adhi', 'adhj', 'aefi', 'aefj', 'aegi', 'aegj', 'aehi', 'aehj', 'bcfi', 'bcfj', 'bcgi', 'bcgj', 'bchi', 'bchj', 'bdfi', 'bdfj', 'bdgi', 'bdgj', 'bdhi', 'bdhj', 'befi', 'befj', 'begi', 'begj', 'behi', 'behj']\n assert candidate(expression = \"{a,b}{c,{d,e,f}}{g,h}\") == ['acg', 'ach', 'adg', 'adh', 'aeg', 'aeh', 'afg', 'afh', 'bcg', 'bch', 'bdg', 'bdh', 'beg', 'beh', 'bfg', 'bfh']\n assert candidate(expression = \"{a,{b,{c,{d,{e,f}}}}}\") == ['a', 'b', 'c', 'd', 'e', 'f']\n assert candidate(expression = \"{a,b}{c,d}{e,f}\") == ['ace', 'acf', 'ade', 'adf', 'bce', 'bcf', 'bde', 'bdf']\n assert candidate(expression = \"{a,b}{c,d,e}{f,g,h,i}\") == ['acf', 'acg', 'ach', 'aci', 'adf', 'adg', 'adh', 'adi', 'aef', 'aeg', 'aeh', 'aei', 'bcf', 'bcg', 'bch', 'bci', 'bdf', 'bdg', 'bdh', 'bdi', 'bef', 'beg', 'beh', 'bei']\n assert candidate(expression = \"{a,b,c}{d,e,f}{g,h,i}{j,k,l,m,n,o,p}\") == ['adgj', 'adgk', 'adgl', 'adgm', 'adgn', 'adgo', 'adgp', 'adhj', 'adhk', 'adhl', 'adhm', 'adhn', 'adho', 'adhp', 'adij', 'adik', 'adil', 'adim', 'adin', 'adio', 'adip', 'aegj', 'aegk', 'aegl', 'aegm', 'aegn', 'aego', 'aegp', 'aehj', 'aehk', 'aehl', 'aehm', 'aehn', 'aeho', 'aehp', 'aeij', 'aeik', 'aeil', 'aeim', 'aein', 'aeio', 'aeip', 'afgj', 'afgk', 'afgl', 'afgm', 'afgn', 'afgo', 'afgp', 'afhj', 'afhk', 'afhl', 'afhm', 'afhn', 'afho', 'afhp', 'afij', 'afik', 'afil', 'afim', 'afin', 'afio', 'afip', 'bdgj', 'bdgk', 'bdgl', 'bdgm', 'bdgn', 'bdgo', 'bdgp', 'bdhj', 'bdhk', 'bdhl', 'bdhm', 'bdhn', 'bdho', 'bdhp', 'bdij', 'bdik', 'bdil', 'bdim', 'bdin', 'bdio', 'bdip', 'begj', 'begk', 'begl', 'begm', 'begn', 'bego', 'begp', 'behj', 'behk', 'behl', 'behm', 'behn', 'beho', 'behp', 'beij', 'beik', 'beil', 'beim', 'bein', 'beio', 'beip', 'bfgj', 'bfgk', 'bfgl', 'bfgm', 'bfgn', 'bfgo', 'bfgp', 'bfhj', 'bfhk', 'bfhl', 'bfhm', 'bfhn', 'bfho', 'bfhp', 'bfij', 'bfik', 'bfil', 'bfim', 'bfin', 'bfio', 'bfip', 'cdgj', 'cdgk', 'cdgl', 'cdgm', 'cdgn', 'cdgo', 'cdgp', 'cdhj', 'cdhk', 'cdhl', 'cdhm', 'cdhn', 'cdho', 'cdhp', 'cdij', 'cdik', 'cdil', 'cdim', 'cdin', 'cdio', 'cdip', 'cegj', 'cegk', 'cegl', 'cegm', 'cegn', 'cego', 'cegp', 'cehj', 'cehk', 'cehl', 'cehm', 'cehn', 'ceho', 'cehp', 'ceij', 'ceik', 'ceil', 'ceim', 'cein', 'ceio', 'ceip', 'cfgj', 'cfgk', 'cfgl', 'cfgm', 'cfgn', 'cfgo', 'cfgp', 'cfhj', 'cfhk', 'cfhl', 'cfhm', 'cfhn', 'cfho', 'cfhp', 'cfij', 'cfik', 'cfil', 'cfim', 'cfin', 'cfio', 'cfip']\n assert candidate(expression = \"{a{b,c},d{e,f}}{g{h,i},j{k,l}}\") == ['abgh', 'abgi', 'abjk', 'abjl', 'acgh', 'acgi', 'acjk', 'acjl', 'degh', 'degi', 'dejk', 'dejl', 'dfgh', 'dfgi', 'dfjk', 'dfjl']\n assert candidate(expression = \"{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}\") == ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n assert candidate(expression = \"{x{y,z},a{b,c}{d,e},f{g{h,i},j{k,l}},m{n{o,p},q{r,s}}}\") == ['abd', 'abe', 'acd', 'ace', 'fgh', 'fgi', 'fjk', 'fjl', 'mno', 'mnp', 'mqr', 'mqs', 'xy', 'xz']\n assert candidate(expression = \"{a,b{c{d,e},f},g{h,i}}{j,k}\") == ['aj', 'ak', 'bcdj', 'bcdk', 'bcej', 'bcek', 'bfj', 'bfk', 'ghj', 'ghk', 'gij', 'gik']\n assert candidate(expression = \"{a,b}c{d,e}\") == ['acd', 'ace', 'bcd', 'bce']\n assert candidate(expression = \"a{b{c{d,e},f},g{h,i{,j}}{k,l}}m\") == ['abcdm', 'abcem', 'abfm', 'aghkm', 'aghlm', 'agijkm', 'agijlm', 'agikm', 'agilm']\n assert candidate(expression = \"{a{b{c{d{e{f{g{h}}}}}}}}{i,j}{k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}\") == ['abcdefghik', 'abcdefghil', 'abcdefghim', 'abcdefghin', 'abcdefghio', 'abcdefghip', 'abcdefghiq', 'abcdefghir', 'abcdefghis', 'abcdefghit', 'abcdefghiu', 'abcdefghiv', 'abcdefghiw', 'abcdefghix', 'abcdefghiy', 'abcdefghiz', 'abcdefghjk', 'abcdefghjl', 'abcdefghjm', 'abcdefghjn', 'abcdefghjo', 'abcdefghjp', 'abcdefghjq', 'abcdefghjr', 'abcdefghjs', 'abcdefghjt', 'abcdefghju', 'abcdefghjv', 'abcdefghjw', 'abcdefghjx', 'abcdefghjy', 'abcdefghjz']\n assert candidate(expression = \"{a{b{c{d{e{f{g{h{i{j{k{l{m{n{o{p{q{r{s{t{u{v{w{x{y{z}}}}}}}}}}}}}}}}}}}}}\") == ['{a{b{c{d{efghijklmnopqrstuvwxyz']\n assert candidate(expression = \"{a,b,c,d}{e,f,g,h}\") == ['ae', 'af', 'ag', 'ah', 'be', 'bf', 'bg', 'bh', 'ce', 'cf', 'cg', 'ch', 'de', 'df', 'dg', 'dh']\n assert candidate(expression = \"{a,b}{{c,d},{e,f}}{g,h}\") == ['acg', 'ach', 'adg', 'adh', 'aeg', 'aeh', 'afg', 'afh', 'bcg', 'bch', 'bdg', 'bdh', 'beg', 'beh', 'bfg', 'bfh']\n assert candidate(expression = \"{a,{b,c{d,e}},f{g,h}}\") == ['a', 'b', 'cd', 'ce', 'fg', 'fh']\n assert candidate(expression = \"{a,b}{c{d,e},f{g,h}}\") == ['acd', 'ace', 'afg', 'afh', 'bcd', 'bce', 'bfg', 'bfh']\n assert candidate(expression = \"{a,b{c,d}}{e,f}\") == ['ae', 'af', 'bce', 'bcf', 'bde', 'bdf']\n assert candidate(expression = \"a{b,{c,{d,e}}}{f,g}\") == ['abf', 'abg', 'acf', 'acg', 'adf', 'adg', 'aef', 'aeg']\n assert candidate(expression = \"{a,b,c,d}{e,f,g,h}{i,j,k,l,m,n,o,p}{q,r,s,t,u,v,w,x,y,z}\") == ['aeiq', 'aeir', 'aeis', 'aeit', 'aeiu', 'aeiv', 'aeiw', 'aeix', 'aeiy', 'aeiz', 'aejq', 'aejr', 'aejs', 'aejt', 'aeju', 'aejv', 'aejw', 'aejx', 'aejy', 'aejz', 'aekq', 'aekr', 'aeks', 'aekt', 'aeku', 'aekv', 'aekw', 'aekx', 'aeky', 'aekz', 'aelq', 'aelr', 'aels', 'aelt', 'aelu', 'aelv', 'aelw', 'aelx', 'aely', 'aelz', 'aemq', 'aemr', 'aems', 'aemt', 'aemu', 'aemv', 'aemw', 'aemx', 'aemy', 'aemz', 'aenq', 'aenr', 'aens', 'aent', 'aenu', 'aenv', 'aenw', 'aenx', 'aeny', 'aenz', 'aeoq', 'aeor', 'aeos', 'aeot', 'aeou', 'aeov', 'aeow', 'aeox', 'aeoy', 'aeoz', 'aepq', 'aepr', 'aeps', 'aept', 'aepu', 'aepv', 'aepw', 'aepx', 'aepy', 'aepz', 'afiq', 'afir', 'afis', 'afit', 'afiu', 'afiv', 'afiw', 'afix', 'afiy', 'afiz', 'afjq', 'afjr', 'afjs', 'afjt', 'afju', 'afjv', 'afjw', 'afjx', 'afjy', 'afjz', 'afkq', 'afkr', 'afks', 'afkt', 'afku', 'afkv', 'afkw', 'afkx', 'afky', 'afkz', 'aflq', 'aflr', 'afls', 'aflt', 'aflu', 'aflv', 'aflw', 'aflx', 'afly', 'aflz', 'afmq', 'afmr', 'afms', 'afmt', 'afmu', 'afmv', 'afmw', 'afmx', 'afmy', 'afmz', 'afnq', 'afnr', 'afns', 'afnt', 'afnu', 'afnv', 'afnw', 'afnx', 'afny', 'afnz', 'afoq', 'afor', 'afos', 'afot', 'afou', 'afov', 'afow', 'afox', 'afoy', 'afoz', 'afpq', 'afpr', 'afps', 'afpt', 'afpu', 'afpv', 'afpw', 'afpx', 'afpy', 'afpz', 'agiq', 'agir', 'agis', 'agit', 'agiu', 'agiv', 'agiw', 'agix', 'agiy', 'agiz', 'agjq', 'agjr', 'agjs', 'agjt', 'agju', 'agjv', 'agjw', 'agjx', 'agjy', 'agjz', 'agkq', 'agkr', 'agks', 'agkt', 'agku', 'agkv', 'agkw', 'agkx', 'agky', 'agkz', 'aglq', 'aglr', 'agls', 'aglt', 'aglu', 'aglv', 'aglw', 'aglx', 'agly', 'aglz', 'agmq', 'agmr', 'agms', 'agmt', 'agmu', 'agmv', 'agmw', 'agmx', 'agmy', 'agmz', 'agnq', 'agnr', 'agns', 'agnt', 'agnu', 'agnv', 'agnw', 'agnx', 'agny', 'agnz', 'agoq', 'agor', 'agos', 'agot', 'agou', 'agov', 'agow', 'agox', 'agoy', 'agoz', 'agpq', 'agpr', 'agps', 'agpt', 'agpu', 'agpv', 'agpw', 'agpx', 'agpy', 'agpz', 'ahiq', 'ahir', 'ahis', 'ahit', 'ahiu', 'ahiv', 'ahiw', 'ahix', 'ahiy', 'ahiz', 'ahjq', 'ahjr', 'ahjs', 'ahjt', 'ahju', 'ahjv', 'ahjw', 'ahjx', 'ahjy', 'ahjz', 'ahkq', 'ahkr', 'ahks', 'ahkt', 'ahku', 'ahkv', 'ahkw', 'ahkx', 'ahky', 'ahkz', 'ahlq', 'ahlr', 'ahls', 'ahlt', 'ahlu', 'ahlv', 'ahlw', 'ahlx', 'ahly', 'ahlz', 'ahmq', 'ahmr', 'ahms', 'ahmt', 'ahmu', 'ahmv', 'ahmw', 'ahmx', 'ahmy', 'ahmz', 'ahnq', 'ahnr', 'ahns', 'ahnt', 'ahnu', 'ahnv', 'ahnw', 'ahnx', 'ahny', 'ahnz', 'ahoq', 'ahor', 'ahos', 'ahot', 'ahou', 'ahov', 'ahow', 'ahox', 'ahoy', 'ahoz', 'ahpq', 'ahpr', 'ahps', 'ahpt', 'ahpu', 'ahpv', 'ahpw', 'ahpx', 'ahpy', 'ahpz', 'beiq', 'beir', 'beis', 'beit', 'beiu', 'beiv', 'beiw', 'beix', 'beiy', 'beiz', 'bejq', 'bejr', 'bejs', 'bejt', 'beju', 'bejv', 'bejw', 'bejx', 'bejy', 'bejz', 'bekq', 'bekr', 'beks', 'bekt', 'beku', 'bekv', 'bekw', 'bekx', 'beky', 'bekz', 'belq', 'belr', 'bels', 'belt', 'belu', 'belv', 'belw', 'belx', 'bely', 'belz', 'bemq', 'bemr', 'bems', 'bemt', 'bemu', 'bemv', 'bemw', 'bemx', 'bemy', 'bemz', 'benq', 'benr', 'bens', 'bent', 'benu', 'benv', 'benw', 'benx', 'beny', 'benz', 'beoq', 'beor', 'beos', 'beot', 'beou', 'beov', 'beow', 'beox', 'beoy', 'beoz', 'bepq', 'bepr', 'beps', 'bept', 'bepu', 'bepv', 'bepw', 'bepx', 'bepy', 'bepz', 'bfiq', 'bfir', 'bfis', 'bfit', 'bfiu', 'bfiv', 'bfiw', 'bfix', 'bfiy', 'bfiz', 'bfjq', 'bfjr', 'bfjs', 'bfjt', 'bfju', 'bfjv', 'bfjw', 'bfjx', 'bfjy', 'bfjz', 'bfkq', 'bfkr', 'bfks', 'bfkt', 'bfku', 'bfkv', 'bfkw', 'bfkx', 'bfky', 'bfkz', 'bflq', 'bflr', 'bfls', 'bflt', 'bflu', 'bflv', 'bflw', 'bflx', 'bfly', 'bflz', 'bfmq', 'bfmr', 'bfms', 'bfmt', 'bfmu', 'bfmv', 'bfmw', 'bfmx', 'bfmy', 'bfmz', 'bfnq', 'bfnr', 'bfns', 'bfnt', 'bfnu', 'bfnv', 'bfnw', 'bfnx', 'bfny', 'bfnz', 'bfoq', 'bfor', 'bfos', 'bfot', 'bfou', 'bfov', 'bfow', 'bfox', 'bfoy', 'bfoz', 'bfpq', 'bfpr', 'bfps', 'bfpt', 'bfpu', 'bfpv', 'bfpw', 'bfpx', 'bfpy', 'bfpz', 'bgiq', 'bgir', 'bgis', 'bgit', 'bgiu', 'bgiv', 'bgiw', 'bgix', 'bgiy', 'bgiz', 'bgjq', 'bgjr', 'bgjs', 'bgjt', 'bgju', 'bgjv', 'bgjw', 'bgjx', 'bgjy', 'bgjz', 'bgkq', 'bgkr', 'bgks', 'bgkt', 'bgku', 'bgkv', 'bgkw', 'bgkx', 'bgky', 'bgkz', 'bglq', 'bglr', 'bgls', 'bglt', 'bglu', 'bglv', 'bglw', 'bglx', 'bgly', 'bglz', 'bgmq', 'bgmr', 'bgms', 'bgmt', 'bgmu', 'bgmv', 'bgmw', 'bgmx', 'bgmy', 'bgmz', 'bgnq', 'bgnr', 'bgns', 'bgnt', 'bgnu', 'bgnv', 'bgnw', 'bgnx', 'bgny', 'bgnz', 'bgoq', 'bgor', 'bgos', 'bgot', 'bgou', 'bgov', 'bgow', 'bgox', 'bgoy', 'bgoz', 'bgpq', 'bgpr', 'bgps', 'bgpt', 'bgpu', 'bgpv', 'bgpw', 'bgpx', 'bgpy', 'bgpz', 'bhiq', 'bhir', 'bhis', 'bhit', 'bhiu', 'bhiv', 'bhiw', 'bhix', 'bhiy', 'bhiz', 'bhjq', 'bhjr', 'bhjs', 'bhjt', 'bhju', 'bhjv', 'bhjw', 'bhjx', 'bhjy', 'bhjz', 'bhkq', 'bhkr', 'bhks', 'bhkt', 'bhku', 'bhkv', 'bhkw', 'bhkx', 'bhky', 'bhkz', 'bhlq', 'bhlr', 'bhls', 'bhlt', 'bhlu', 'bhlv', 'bhlw', 'bhlx', 'bhly', 'bhlz', 'bhmq', 'bhmr', 'bhms', 'bhmt', 'bhmu', 'bhmv', 'bhmw', 'bhmx', 'bhmy', 'bhmz', 'bhnq', 'bhnr', 'bhns', 'bhnt', 'bhnu', 'bhnv', 'bhnw', 'bhnx', 'bhny', 'bhnz', 'bhoq', 'bhor', 'bhos', 'bhot', 'bhou', 'bhov', 'bhow', 'bhox', 'bhoy', 'bhoz', 'bhpq', 'bhpr', 'bhps', 'bhpt', 'bhpu', 'bhpv', 'bhpw', 'bhpx', 'bhpy', 'bhpz', 'ceiq', 'ceir', 'ceis', 'ceit', 'ceiu', 'ceiv', 'ceiw', 'ceix', 'ceiy', 'ceiz', 'cejq', 'cejr', 'cejs', 'cejt', 'ceju', 'cejv', 'cejw', 'cejx', 'cejy', 'cejz', 'cekq', 'cekr', 'ceks', 'cekt', 'ceku', 'cekv', 'cekw', 'cekx', 'ceky', 'cekz', 'celq', 'celr', 'cels', 'celt', 'celu', 'celv', 'celw', 'celx', 'cely', 'celz', 'cemq', 'cemr', 'cems', 'cemt', 'cemu', 'cemv', 'cemw', 'cemx', 'cemy', 'cemz', 'cenq', 'cenr', 'cens', 'cent', 'cenu', 'cenv', 'cenw', 'cenx', 'ceny', 'cenz', 'ceoq', 'ceor', 'ceos', 'ceot', 'ceou', 'ceov', 'ceow', 'ceox', 'ceoy', 'ceoz', 'cepq', 'cepr', 'ceps', 'cept', 'cepu', 'cepv', 'cepw', 'cepx', 'cepy', 'cepz', 'cfiq', 'cfir', 'cfis', 'cfit', 'cfiu', 'cfiv', 'cfiw', 'cfix', 'cfiy', 'cfiz', 'cfjq', 'cfjr', 'cfjs', 'cfjt', 'cfju', 'cfjv', 'cfjw', 'cfjx', 'cfjy', 'cfjz', 'cfkq', 'cfkr', 'cfks', 'cfkt', 'cfku', 'cfkv', 'cfkw', 'cfkx', 'cfky', 'cfkz', 'cflq', 'cflr', 'cfls', 'cflt', 'cflu', 'cflv', 'cflw', 'cflx', 'cfly', 'cflz', 'cfmq', 'cfmr', 'cfms', 'cfmt', 'cfmu', 'cfmv', 'cfmw', 'cfmx', 'cfmy', 'cfmz', 'cfnq', 'cfnr', 'cfns', 'cfnt', 'cfnu', 'cfnv', 'cfnw', 'cfnx', 'cfny', 'cfnz', 'cfoq', 'cfor', 'cfos', 'cfot', 'cfou', 'cfov', 'cfow', 'cfox', 'cfoy', 'cfoz', 'cfpq', 'cfpr', 'cfps', 'cfpt', 'cfpu', 'cfpv', 'cfpw', 'cfpx', 'cfpy', 'cfpz', 'cgiq', 'cgir', 'cgis', 'cgit', 'cgiu', 'cgiv', 'cgiw', 'cgix', 'cgiy', 'cgiz', 'cgjq', 'cgjr', 'cgjs', 'cgjt', 'cgju', 'cgjv', 'cgjw', 'cgjx', 'cgjy', 'cgjz', 'cgkq', 'cgkr', 'cgks', 'cgkt', 'cgku', 'cgkv', 'cgkw', 'cgkx', 'cgky', 'cgkz', 'cglq', 'cglr', 'cgls', 'cglt', 'cglu', 'cglv', 'cglw', 'cglx', 'cgly', 'cglz', 'cgmq', 'cgmr', 'cgms', 'cgmt', 'cgmu', 'cgmv', 'cgmw', 'cgmx', 'cgmy', 'cgmz', 'cgnq', 'cgnr', 'cgns', 'cgnt', 'cgnu', 'cgnv', 'cgnw', 'cgnx', 'cgny', 'cgnz', 'cgoq', 'cgor', 'cgos', 'cgot', 'cgou', 'cgov', 'cgow', 'cgox', 'cgoy', 'cgoz', 'cgpq', 'cgpr', 'cgps', 'cgpt', 'cgpu', 'cgpv', 'cgpw', 'cgpx', 'cgpy', 'cgpz', 'chiq', 'chir', 'chis', 'chit', 'chiu', 'chiv', 'chiw', 'chix', 'chiy', 'chiz', 'chjq', 'chjr', 'chjs', 'chjt', 'chju', 'chjv', 'chjw', 'chjx', 'chjy', 'chjz', 'chkq', 'chkr', 'chks', 'chkt', 'chku', 'chkv', 'chkw', 'chkx', 'chky', 'chkz', 'chlq', 'chlr', 'chls', 'chlt', 'chlu', 'chlv', 'chlw', 'chlx', 'chly', 'chlz', 'chmq', 'chmr', 'chms', 'chmt', 'chmu', 'chmv', 'chmw', 'chmx', 'chmy', 'chmz', 'chnq', 'chnr', 'chns', 'chnt', 'chnu', 'chnv', 'chnw', 'chnx', 'chny', 'chnz', 'choq', 'chor', 'chos', 'chot', 'chou', 'chov', 'chow', 'chox', 'choy', 'choz', 'chpq', 'chpr', 'chps', 'chpt', 'chpu', 'chpv', 'chpw', 'chpx', 'chpy', 'chpz', 'deiq', 'deir', 'deis', 'deit', 'deiu', 'deiv', 'deiw', 'deix', 'deiy', 'deiz', 'dejq', 'dejr', 'dejs', 'dejt', 'deju', 'dejv', 'dejw', 'dejx', 'dejy', 'dejz', 'dekq', 'dekr', 'deks', 'dekt', 'deku', 'dekv', 'dekw', 'dekx', 'deky', 'dekz', 'delq', 'delr', 'dels', 'delt', 'delu', 'delv', 'delw', 'delx', 'dely', 'delz', 'demq', 'demr', 'dems', 'demt', 'demu', 'demv', 'demw', 'demx', 'demy', 'demz', 'denq', 'denr', 'dens', 'dent', 'denu', 'denv', 'denw', 'denx', 'deny', 'denz', 'deoq', 'deor', 'deos', 'deot', 'deou', 'deov', 'deow', 'deox', 'deoy', 'deoz', 'depq', 'depr', 'deps', 'dept', 'depu', 'depv', 'depw', 'depx', 'depy', 'depz', 'dfiq', 'dfir', 'dfis', 'dfit', 'dfiu', 'dfiv', 'dfiw', 'dfix', 'dfiy', 'dfiz', 'dfjq', 'dfjr', 'dfjs', 'dfjt', 'dfju', 'dfjv', 'dfjw', 'dfjx', 'dfjy', 'dfjz', 'dfkq', 'dfkr', 'dfks', 'dfkt', 'dfku', 'dfkv', 'dfkw', 'dfkx', 'dfky', 'dfkz', 'dflq', 'dflr', 'dfls', 'dflt', 'dflu', 'dflv', 'dflw', 'dflx', 'dfly', 'dflz', 'dfmq', 'dfmr', 'dfms', 'dfmt', 'dfmu', 'dfmv', 'dfmw', 'dfmx', 'dfmy', 'dfmz', 'dfnq', 'dfnr', 'dfns', 'dfnt', 'dfnu', 'dfnv', 'dfnw', 'dfnx', 'dfny', 'dfnz', 'dfoq', 'dfor', 'dfos', 'dfot', 'dfou', 'dfov', 'dfow', 'dfox', 'dfoy', 'dfoz', 'dfpq', 'dfpr', 'dfps', 'dfpt', 'dfpu', 'dfpv', 'dfpw', 'dfpx', 'dfpy', 'dfpz', 'dgiq', 'dgir', 'dgis', 'dgit', 'dgiu', 'dgiv', 'dgiw', 'dgix', 'dgiy', 'dgiz', 'dgjq', 'dgjr', 'dgjs', 'dgjt', 'dgju', 'dgjv', 'dgjw', 'dgjx', 'dgjy', 'dgjz', 'dgkq', 'dgkr', 'dgks', 'dgkt', 'dgku', 'dgkv', 'dgkw', 'dgkx', 'dgky', 'dgkz', 'dglq', 'dglr', 'dgls', 'dglt', 'dglu', 'dglv', 'dglw', 'dglx', 'dgly', 'dglz', 'dgmq', 'dgmr', 'dgms', 'dgmt', 'dgmu', 'dgmv', 'dgmw', 'dgmx', 'dgmy', 'dgmz', 'dgnq', 'dgnr', 'dgns', 'dgnt', 'dgnu', 'dgnv', 'dgnw', 'dgnx', 'dgny', 'dgnz', 'dgoq', 'dgor', 'dgos', 'dgot', 'dgou', 'dgov', 'dgow', 'dgox', 'dgoy', 'dgoz', 'dgpq', 'dgpr', 'dgps', 'dgpt', 'dgpu', 'dgpv', 'dgpw', 'dgpx', 'dgpy', 'dgpz', 'dhiq', 'dhir', 'dhis', 'dhit', 'dhiu', 'dhiv', 'dhiw', 'dhix', 'dhiy', 'dhiz', 'dhjq', 'dhjr', 'dhjs', 'dhjt', 'dhju', 'dhjv', 'dhjw', 'dhjx', 'dhjy', 'dhjz', 'dhkq', 'dhkr', 'dhks', 'dhkt', 'dhku', 'dhkv', 'dhkw', 'dhkx', 'dhky', 'dhkz', 'dhlq', 'dhlr', 'dhls', 'dhlt', 'dhlu', 'dhlv', 'dhlw', 'dhlx', 'dhly', 'dhlz', 'dhmq', 'dhmr', 'dhms', 'dhmt', 'dhmu', 'dhmv', 'dhmw', 'dhmx', 'dhmy', 'dhmz', 'dhnq', 'dhnr', 'dhns', 'dhnt', 'dhnu', 'dhnv', 'dhnw', 'dhnx', 'dhny', 'dhnz', 'dhoq', 'dhor', 'dhos', 'dhot', 'dhou', 'dhov', 'dhow', 'dhox', 'dhoy', 'dhoz', 'dhpq', 'dhpr', 'dhps', 'dhpt', 'dhpu', 'dhpv', 'dhpw', 'dhpx', 'dhpy', 'dhpz']\n assert candidate(expression = \"{a,b,c}{d,e{f,g{h,i}}}{j,k}\") == ['adj', 'adk', 'aefj', 'aefk', 'aeghj', 'aeghk', 'aegij', 'aegik', 'bdj', 'bdk', 'befj', 'befk', 'beghj', 'beghk', 'begij', 'begik', 'cdj', 'cdk', 'cefj', 'cefk', 'ceghj', 'ceghk', 'cegij', 'cegik']\n assert candidate(expression = \"{a,b,c}{d,e,f}{g,h,i}\") == ['adg', 'adh', 'adi', 'aeg', 'aeh', 'aei', 'afg', 'afh', 'afi', 'bdg', 'bdh', 'bdi', 'beg', 'beh', 'bei', 'bfg', 'bfh', 'bfi', 'cdg', 'cdh', 'cdi', 'ceg', 'ceh', 'cei', 'cfg', 'cfh', 'cfi']\n assert candidate(expression = \"{x,y}{a,b,c}{m,n}\") == ['xam', 'xan', 'xbm', 'xbn', 'xcm', 'xcn', 'yam', 'yan', 'ybm', 'ybn', 'ycm', 'ycn']\n assert candidate(expression = \"{a,b,c}{d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}\") == ['ad', 'ae', 'af', 'ag', 'ah', 'ai', 'aj', 'ak', 'al', 'am', 'an', 'ao', 'ap', 'aq', 'ar', 'as', 'at', 'au', 'av', 'aw', 'ax', 'ay', 'az', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bk', 'bl', 'bm', 'bn', 'bo', 'bp', 'bq', 'br', 'bs', 'bt', 'bu', 'bv', 'bw', 'bx', 'by', 'bz', 'cd', 'ce', 'cf', 'cg', 'ch', 'ci', 'cj', 'ck', 'cl', 'cm', 'cn', 'co', 'cp', 'cq', 'cr', 'cs', 'ct', 'cu', 'cv', 'cw', 'cx', 'cy', 'cz']\n assert candidate(expression = \"{a{b{c,d},e},f{g,h}}{i,j}\") == ['abci', 'abcj', 'abdi', 'abdj', 'aei', 'aej', 'fgi', 'fgj', 'fhi', 'fhj']\n assert candidate(expression = \"{a{b{c,d{e,f}},g{h,i{}}},j{k{l,m{n{o,p},q{r,s}}},x{y,z}}}\") == ['abc,jklabc', 'abc,jkljkl', 'abc,jkmnoabc', 'abc,jkmnojkmno', 'abc,jkmnpabc', 'abc,jkmnpjkmnp', 'abc,jkmqrabc', 'abc,jkmqrjkmqr', 'abc,jkmqsabc', 'abc,jkmqsjkmqs', 'abc,jxyabc', 'abc,jxyjxy', 'abc,jxzabc', 'abc,jxzjxz', 'abde,jklabde', 'abde,jkljkl', 'abde,jkmnoabde', 'abde,jkmnojkmno', 'abde,jkmnpabde', 'abde,jkmnpjkmnp', 'abde,jkmqrabde', 'abde,jkmqrjkmqr', 'abde,jkmqsabde', 'abde,jkmqsjkmqs', 'abde,jxyabde', 'abde,jxyjxy', 'abde,jxzabde', 'abde,jxzjxz', 'abdf,jklabdf', 'abdf,jkljkl', 'abdf,jkmnoabdf', 'abdf,jkmnojkmno', 'abdf,jkmnpabdf', 'abdf,jkmnpjkmnp', 'abdf,jkmqrabdf', 'abdf,jkmqrjkmqr', 'abdf,jkmqsabdf', 'abdf,jkmqsjkmqs', 'abdf,jxyabdf', 'abdf,jxyjxy', 'abdf,jxzabdf', 'abdf,jxzjxz', 'agh,jklagh', 'agh,jkljkl', 'agh,jkmnoagh', 'agh,jkmnojkmno', 'agh,jkmnpagh', 'agh,jkmnpjkmnp', 'agh,jkmqragh', 'agh,jkmqrjkmqr', 'agh,jkmqsagh', 'agh,jkmqsjkmqs', 'agh,jxyagh', 'agh,jxyjxy', 'agh,jxzagh', 'agh,jxzjxz', 'agi', 'agijkl', 'agijkmno', 'agijkmnp', 'agijkmqr', 'agijkmqs', 'agijxy', 'agijxz']\n assert candidate(expression = \"{a,b,c,d,e}{f,g,h,i,j,k}{l,m,n,o,p}\") == ['afl', 'afm', 'afn', 'afo', 'afp', 'agl', 'agm', 'agn', 'ago', 'agp', 'ahl', 'ahm', 'ahn', 'aho', 'ahp', 'ail', 'aim', 'ain', 'aio', 'aip', 'ajl', 'ajm', 'ajn', 'ajo', 'ajp', 'akl', 'akm', 'akn', 'ako', 'akp', 'bfl', 'bfm', 'bfn', 'bfo', 'bfp', 'bgl', 'bgm', 'bgn', 'bgo', 'bgp', 'bhl', 'bhm', 'bhn', 'bho', 'bhp', 'bil', 'bim', 'bin', 'bio', 'bip', 'bjl', 'bjm', 'bjn', 'bjo', 'bjp', 'bkl', 'bkm', 'bkn', 'bko', 'bkp', 'cfl', 'cfm', 'cfn', 'cfo', 'cfp', 'cgl', 'cgm', 'cgn', 'cgo', 'cgp', 'chl', 'chm', 'chn', 'cho', 'chp', 'cil', 'cim', 'cin', 'cio', 'cip', 'cjl', 'cjm', 'cjn', 'cjo', 'cjp', 'ckl', 'ckm', 'ckn', 'cko', 'ckp', 'dfl', 'dfm', 'dfn', 'dfo', 'dfp', 'dgl', 'dgm', 'dgn', 'dgo', 'dgp', 'dhl', 'dhm', 'dhn', 'dho', 'dhp', 'dil', 'dim', 'din', 'dio', 'dip', 'djl', 'djm', 'djn', 'djo', 'djp', 'dkl', 'dkm', 'dkn', 'dko', 'dkp', 'efl', 'efm', 'efn', 'efo', 'efp', 'egl', 'egm', 'egn', 'ego', 'egp', 'ehl', 'ehm', 'ehn', 'eho', 'ehp', 'eil', 'eim', 'ein', 'eio', 'eip', 'ejl', 'ejm', 'ejn', 'ejo', 'ejp', 'ekl', 'ekm', 'ekn', 'eko', 'ekp']\n assert candidate(expression = \"{a,b,c,d}{e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}\") == ['aea', 'aeb', 'aec', 'aed', 'aee', 'aef', 'aeg', 'aeh', 'aei', 'aej', 'aek', 'ael', 'aem', 'aen', 'aeo', 'aep', 'aeq', 'aer', 'aes', 'aet', 'aeu', 'aev', 'aew', 'aex', 'aey', 'aez', 'afa', 'afb', 'afc', 'afd', 'afe', 'aff', 'afg', 'afh', 'afi', 'afj', 'afk', 'afl', 'afm', 'afn', 'afo', 'afp', 'afq', 'afr', 'afs', 'aft', 'afu', 'afv', 'afw', 'afx', 'afy', 'afz', 'aga', 'agb', 'agc', 'agd', 'age', 'agf', 'agg', 'agh', 'agi', 'agj', 'agk', 'agl', 'agm', 'agn', 'ago', 'agp', 'agq', 'agr', 'ags', 'agt', 'agu', 'agv', 'agw', 'agx', 'agy', 'agz', 'aha', 'ahb', 'ahc', 'ahd', 'ahe', 'ahf', 'ahg', 'ahh', 'ahi', 'ahj', 'ahk', 'ahl', 'ahm', 'ahn', 'aho', 'ahp', 'ahq', 'ahr', 'ahs', 'aht', 'ahu', 'ahv', 'ahw', 'ahx', 'ahy', 'ahz', 'aia', 'aib', 'aic', 'aid', 'aie', 'aif', 'aig', 'aih', 'aii', 'aij', 'aik', 'ail', 'aim', 'ain', 'aio', 'aip', 'aiq', 'air', 'ais', 'ait', 'aiu', 'aiv', 'aiw', 'aix', 'aiy', 'aiz', 'aja', 'ajb', 'ajc', 'ajd', 'aje', 'ajf', 'ajg', 'ajh', 'aji', 'ajj', 'ajk', 'ajl', 'ajm', 'ajn', 'ajo', 'ajp', 'ajq', 'ajr', 'ajs', 'ajt', 'aju', 'ajv', 'ajw', 'ajx', 'ajy', 'ajz', 'aka', 'akb', 'akc', 'akd', 'ake', 'akf', 'akg', 'akh', 'aki', 'akj', 'akk', 'akl', 'akm', 'akn', 'ako', 'akp', 'akq', 'akr', 'aks', 'akt', 'aku', 'akv', 'akw', 'akx', 'aky', 'akz', 'ala', 'alb', 'alc', 'ald', 'ale', 'alf', 'alg', 'alh', 'ali', 'alj', 'alk', 'all', 'alm', 'aln', 'alo', 'alp', 'alq', 'alr', 'als', 'alt', 'alu', 'alv', 'alw', 'alx', 'aly', 'alz', 'ama', 'amb', 'amc', 'amd', 'ame', 'amf', 'amg', 'amh', 'ami', 'amj', 'amk', 'aml', 'amm', 'amn', 'amo', 'amp', 'amq', 'amr', 'ams', 'amt', 'amu', 'amv', 'amw', 'amx', 'amy', 'amz', 'ana', 'anb', 'anc', 'and', 'ane', 'anf', 'ang', 'anh', 'ani', 'anj', 'ank', 'anl', 'anm', 'ann', 'ano', 'anp', 'anq', 'anr', 'ans', 'ant', 'anu', 'anv', 'anw', 'anx', 'any', 'anz', 'aoa', 'aob', 'aoc', 'aod', 'aoe', 'aof', 'aog', 'aoh', 'aoi', 'aoj', 'aok', 'aol', 'aom', 'aon', 'aoo', 'aop', 'aoq', 'aor', 'aos', 'aot', 'aou', 'aov', 'aow', 'aox', 'aoy', 'aoz', 'apa', 'apb', 'apc', 'apd', 'ape', 'apf', 'apg', 'aph', 'api', 'apj', 'apk', 'apl', 'apm', 'apn', 'apo', 'app', 'apq', 'apr', 'aps', 'apt', 'apu', 'apv', 'apw', 'apx', 'apy', 'apz', 'aqa', 'aqb', 'aqc', 'aqd', 'aqe', 'aqf', 'aqg', 'aqh', 'aqi', 'aqj', 'aqk', 'aql', 'aqm', 'aqn', 'aqo', 'aqp', 'aqq', 'aqr', 'aqs', 'aqt', 'aqu', 'aqv', 'aqw', 'aqx', 'aqy', 'aqz', 'ara', 'arb', 'arc', 'ard', 'are', 'arf', 'arg', 'arh', 'ari', 'arj', 'ark', 'arl', 'arm', 'arn', 'aro', 'arp', 'arq', 'arr', 'ars', 'art', 'aru', 'arv', 'arw', 'arx', 'ary', 'arz', 'asa', 'asb', 'asc', 'asd', 'ase', 'asf', 'asg', 'ash', 'asi', 'asj', 'ask', 'asl', 'asm', 'asn', 'aso', 'asp', 'asq', 'asr', 'ass', 'ast', 'asu', 'asv', 'asw', 'asx', 'asy', 'asz', 'ata', 'atb', 'atc', 'atd', 'ate', 'atf', 'atg', 'ath', 'ati', 'atj', 'atk', 'atl', 'atm', 'atn', 'ato', 'atp', 'atq', 'atr', 'ats', 'att', 'atu', 'atv', 'atw', 'atx', 'aty', 'atz', 'aua', 'aub', 'auc', 'aud', 'aue', 'auf', 'aug', 'auh', 'aui', 'auj', 'auk', 'aul', 'aum', 'aun', 'auo', 'aup', 'auq', 'aur', 'aus', 'aut', 'auu', 'auv', 'auw', 'aux', 'auy', 'auz', 'ava', 'avb', 'avc', 'avd', 'ave', 'avf', 'avg', 'avh', 'avi', 'avj', 'avk', 'avl', 'avm', 'avn', 'avo', 'avp', 'avq', 'avr', 'avs', 'avt', 'avu', 'avv', 'avw', 'avx', 'avy', 'avz', 'awa', 'awb', 'awc', 'awd', 'awe', 'awf', 'awg', 'awh', 'awi', 'awj', 'awk', 'awl', 'awm', 'awn', 'awo', 'awp', 'awq', 'awr', 'aws', 'awt', 'awu', 'awv', 'aww', 'awx', 'awy', 'awz', 'axa', 'axb', 'axc', 'axd', 'axe', 'axf', 'axg', 'axh', 'axi', 'axj', 'axk', 'axl', 'axm', 'axn', 'axo', 'axp', 'axq', 'axr', 'axs', 'axt', 'axu', 'axv', 'axw', 'axx', 'axy', 'axz', 'aya', 'ayb', 'ayc', 'ayd', 'aye', 'ayf', 'ayg', 'ayh', 'ayi', 'ayj', 'ayk', 'ayl', 'aym', 'ayn', 'ayo', 'ayp', 'ayq', 'ayr', 'ays', 'ayt', 'ayu', 'ayv', 'ayw', 'ayx', 'ayy', 'ayz', 'aza', 'azb', 'azc', 'azd', 'aze', 'azf', 'azg', 'azh', 'azi', 'azj', 'azk', 'azl', 'azm', 'azn', 'azo', 'azp', 'azq', 'azr', 'azs', 'azt', 'azu', 'azv', 'azw', 'azx', 'azy', 'azz', 'bea', 'beb', 'bec', 'bed', 'bee', 'bef', 'beg', 'beh', 'bei', 'bej', 'bek', 'bel', 'bem', 'ben', 'beo', 'bep', 'beq', 'ber', 'bes', 'bet', 'beu', 'bev', 'bew', 'bex', 'bey', 'bez', 'bfa', 'bfb', 'bfc', 'bfd', 'bfe', 'bff', 'bfg', 'bfh', 'bfi', 'bfj', 'bfk', 'bfl', 'bfm', 'bfn', 'bfo', 'bfp', 'bfq', 'bfr', 'bfs', 'bft', 'bfu', 'bfv', 'bfw', 'bfx', 'bfy', 'bfz', 'bga', 'bgb', 'bgc', 'bgd', 'bge', 'bgf', 'bgg', 'bgh', 'bgi', 'bgj', 'bgk', 'bgl', 'bgm', 'bgn', 'bgo', 'bgp', 'bgq', 'bgr', 'bgs', 'bgt', 'bgu', 'bgv', 'bgw', 'bgx', 'bgy', 'bgz', 'bha', 'bhb', 'bhc', 'bhd', 'bhe', 'bhf', 'bhg', 'bhh', 'bhi', 'bhj', 'bhk', 'bhl', 'bhm', 'bhn', 'bho', 'bhp', 'bhq', 'bhr', 'bhs', 'bht', 'bhu', 'bhv', 'bhw', 'bhx', 'bhy', 'bhz', 'bia', 'bib', 'bic', 'bid', 'bie', 'bif', 'big', 'bih', 'bii', 'bij', 'bik', 'bil', 'bim', 'bin', 'bio', 'bip', 'biq', 'bir', 'bis', 'bit', 'biu', 'biv', 'biw', 'bix', 'biy', 'biz', 'bja', 'bjb', 'bjc', 'bjd', 'bje', 'bjf', 'bjg', 'bjh', 'bji', 'bjj', 'bjk', 'bjl', 'bjm', 'bjn', 'bjo', 'bjp', 'bjq', 'bjr', 'bjs', 'bjt', 'bju', 'bjv', 'bjw', 'bjx', 'bjy', 'bjz', 'bka', 'bkb', 'bkc', 'bkd', 'bke', 'bkf', 'bkg', 'bkh', 'bki', 'bkj', 'bkk', 'bkl', 'bkm', 'bkn', 'bko', 'bkp', 'bkq', 'bkr', 'bks', 'bkt', 'bku', 'bkv', 'bkw', 'bkx', 'bky', 'bkz', 'bla', 'blb', 'blc', 'bld', 'ble', 'blf', 'blg', 'blh', 'bli', 'blj', 'blk', 'bll', 'blm', 'bln', 'blo', 'blp', 'blq', 'blr', 'bls', 'blt', 'blu', 'blv', 'blw', 'blx', 'bly', 'blz', 'bma', 'bmb', 'bmc', 'bmd', 'bme', 'bmf', 'bmg', 'bmh', 'bmi', 'bmj', 'bmk', 'bml', 'bmm', 'bmn', 'bmo', 'bmp', 'bmq', 'bmr', 'bms', 'bmt', 'bmu', 'bmv', 'bmw', 'bmx', 'bmy', 'bmz', 'bna', 'bnb', 'bnc', 'bnd', 'bne', 'bnf', 'bng', 'bnh', 'bni', 'bnj', 'bnk', 'bnl', 'bnm', 'bnn', 'bno', 'bnp', 'bnq', 'bnr', 'bns', 'bnt', 'bnu', 'bnv', 'bnw', 'bnx', 'bny', 'bnz', 'boa', 'bob', 'boc', 'bod', 'boe', 'bof', 'bog', 'boh', 'boi', 'boj', 'bok', 'bol', 'bom', 'bon', 'boo', 'bop', 'boq', 'bor', 'bos', 'bot', 'bou', 'bov', 'bow', 'box', 'boy', 'boz', 'bpa', 'bpb', 'bpc', 'bpd', 'bpe', 'bpf', 'bpg', 'bph', 'bpi', 'bpj', 'bpk', 'bpl', 'bpm', 'bpn', 'bpo', 'bpp', 'bpq', 'bpr', 'bps', 'bpt', 'bpu', 'bpv', 'bpw', 'bpx', 'bpy', 'bpz', 'bqa', 'bqb', 'bqc', 'bqd', 'bqe', 'bqf', 'bqg', 'bqh', 'bqi', 'bqj', 'bqk', 'bql', 'bqm', 'bqn', 'bqo', 'bqp', 'bqq', 'bqr', 'bqs', 'bqt', 'bqu', 'bqv', 'bqw', 'bqx', 'bqy', 'bqz', 'bra', 'brb', 'brc', 'brd', 'bre', 'brf', 'brg', 'brh', 'bri', 'brj', 'brk', 'brl', 'brm', 'brn', 'bro', 'brp', 'brq', 'brr', 'brs', 'brt', 'bru', 'brv', 'brw', 'brx', 'bry', 'brz', 'bsa', 'bsb', 'bsc', 'bsd', 'bse', 'bsf', 'bsg', 'bsh', 'bsi', 'bsj', 'bsk', 'bsl', 'bsm', 'bsn', 'bso', 'bsp', 'bsq', 'bsr', 'bss', 'bst', 'bsu', 'bsv', 'bsw', 'bsx', 'bsy', 'bsz', 'bta', 'btb', 'btc', 'btd', 'bte', 'btf', 'btg', 'bth', 'bti', 'btj', 'btk', 'btl', 'btm', 'btn', 'bto', 'btp', 'btq', 'btr', 'bts', 'btt', 'btu', 'btv', 'btw', 'btx', 'bty', 'btz', 'bua', 'bub', 'buc', 'bud', 'bue', 'buf', 'bug', 'buh', 'bui', 'buj', 'buk', 'bul', 'bum', 'bun', 'buo', 'bup', 'buq', 'bur', 'bus', 'but', 'buu', 'buv', 'buw', 'bux', 'buy', 'buz', 'bva', 'bvb', 'bvc', 'bvd', 'bve', 'bvf', 'bvg', 'bvh', 'bvi', 'bvj', 'bvk', 'bvl', 'bvm', 'bvn', 'bvo', 'bvp', 'bvq', 'bvr', 'bvs', 'bvt', 'bvu', 'bvv', 'bvw', 'bvx', 'bvy', 'bvz', 'bwa', 'bwb', 'bwc', 'bwd', 'bwe', 'bwf', 'bwg', 'bwh', 'bwi', 'bwj', 'bwk', 'bwl', 'bwm', 'bwn', 'bwo', 'bwp', 'bwq', 'bwr', 'bws', 'bwt', 'bwu', 'bwv', 'bww', 'bwx', 'bwy', 'bwz', 'bxa', 'bxb', 'bxc', 'bxd', 'bxe', 'bxf', 'bxg', 'bxh', 'bxi', 'bxj', 'bxk', 'bxl', 'bxm', 'bxn', 'bxo', 'bxp', 'bxq', 'bxr', 'bxs', 'bxt', 'bxu', 'bxv', 'bxw', 'bxx', 'bxy', 'bxz', 'bya', 'byb', 'byc', 'byd', 'bye', 'byf', 'byg', 'byh', 'byi', 'byj', 'byk', 'byl', 'bym', 'byn', 'byo', 'byp', 'byq', 'byr', 'bys', 'byt', 'byu', 'byv', 'byw', 'byx', 'byy', 'byz', 'bza', 'bzb', 'bzc', 'bzd', 'bze', 'bzf', 'bzg', 'bzh', 'bzi', 'bzj', 'bzk', 'bzl', 'bzm', 'bzn', 'bzo', 'bzp', 'bzq', 'bzr', 'bzs', 'bzt', 'bzu', 'bzv', 'bzw', 'bzx', 'bzy', 'bzz', 'cea', 'ceb', 'cec', 'ced', 'cee', 'cef', 'ceg', 'ceh', 'cei', 'cej', 'cek', 'cel', 'cem', 'cen', 'ceo', 'cep', 'ceq', 'cer', 'ces', 'cet', 'ceu', 'cev', 'cew', 'cex', 'cey', 'cez', 'cfa', 'cfb', 'cfc', 'cfd', 'cfe', 'cff', 'cfg', 'cfh', 'cfi', 'cfj', 'cfk', 'cfl', 'cfm', 'cfn', 'cfo', 'cfp', 'cfq', 'cfr', 'cfs', 'cft', 'cfu', 'cfv', 'cfw', 'cfx', 'cfy', 'cfz', 'cga', 'cgb', 'cgc', 'cgd', 'cge', 'cgf', 'cgg', 'cgh', 'cgi', 'cgj', 'cgk', 'cgl', 'cgm', 'cgn', 'cgo', 'cgp', 'cgq', 'cgr', 'cgs', 'cgt', 'cgu', 'cgv', 'cgw', 'cgx', 'cgy', 'cgz', 'cha', 'chb', 'chc', 'chd', 'che', 'chf', 'chg', 'chh', 'chi', 'chj', 'chk', 'chl', 'chm', 'chn', 'cho', 'chp', 'chq', 'chr', 'chs', 'cht', 'chu', 'chv', 'chw', 'chx', 'chy', 'chz', 'cia', 'cib', 'cic', 'cid', 'cie', 'cif', 'cig', 'cih', 'cii', 'cij', 'cik', 'cil', 'cim', 'cin', 'cio', 'cip', 'ciq', 'cir', 'cis', 'cit', 'ciu', 'civ', 'ciw', 'cix', 'ciy', 'ciz', 'cja', 'cjb', 'cjc', 'cjd', 'cje', 'cjf', 'cjg', 'cjh', 'cji', 'cjj', 'cjk', 'cjl', 'cjm', 'cjn', 'cjo', 'cjp', 'cjq', 'cjr', 'cjs', 'cjt', 'cju', 'cjv', 'cjw', 'cjx', 'cjy', 'cjz', 'cka', 'ckb', 'ckc', 'ckd', 'cke', 'ckf', 'ckg', 'ckh', 'cki', 'ckj', 'ckk', 'ckl', 'ckm', 'ckn', 'cko', 'ckp', 'ckq', 'ckr', 'cks', 'ckt', 'cku', 'ckv', 'ckw', 'ckx', 'cky', 'ckz', 'cla', 'clb', 'clc', 'cld', 'cle', 'clf', 'clg', 'clh', 'cli', 'clj', 'clk', 'cll', 'clm', 'cln', 'clo', 'clp', 'clq', 'clr', 'cls', 'clt', 'clu', 'clv', 'clw', 'clx', 'cly', 'clz', 'cma', 'cmb', 'cmc', 'cmd', 'cme', 'cmf', 'cmg', 'cmh', 'cmi', 'cmj', 'cmk', 'cml', 'cmm', 'cmn', 'cmo', 'cmp', 'cmq', 'cmr', 'cms', 'cmt', 'cmu', 'cmv', 'cmw', 'cmx', 'cmy', 'cmz', 'cna', 'cnb', 'cnc', 'cnd', 'cne', 'cnf', 'cng', 'cnh', 'cni', 'cnj', 'cnk', 'cnl', 'cnm', 'cnn', 'cno', 'cnp', 'cnq', 'cnr', 'cns', 'cnt', 'cnu', 'cnv', 'cnw', 'cnx', 'cny', 'cnz', 'coa', 'cob', 'coc', 'cod', 'coe', 'cof', 'cog', 'coh', 'coi', 'coj', 'cok', 'col', 'com', 'con', 'coo', 'cop', 'coq', 'cor', 'cos', 'cot', 'cou', 'cov', 'cow', 'cox', 'coy', 'coz', 'cpa', 'cpb', 'cpc', 'cpd', 'cpe', 'cpf', 'cpg', 'cph', 'cpi', 'cpj', 'cpk', 'cpl', 'cpm', 'cpn', 'cpo', 'cpp', 'cpq', 'cpr', 'cps', 'cpt', 'cpu', 'cpv', 'cpw', 'cpx', 'cpy', 'cpz', 'cqa', 'cqb', 'cqc', 'cqd', 'cqe', 'cqf', 'cqg', 'cqh', 'cqi', 'cqj', 'cqk', 'cql', 'cqm', 'cqn', 'cqo', 'cqp', 'cqq', 'cqr', 'cqs', 'cqt', 'cqu', 'cqv', 'cqw', 'cqx', 'cqy', 'cqz', 'cra', 'crb', 'crc', 'crd', 'cre', 'crf', 'crg', 'crh', 'cri', 'crj', 'crk', 'crl', 'crm', 'crn', 'cro', 'crp', 'crq', 'crr', 'crs', 'crt', 'cru', 'crv', 'crw', 'crx', 'cry', 'crz', 'csa', 'csb', 'csc', 'csd', 'cse', 'csf', 'csg', 'csh', 'csi', 'csj', 'csk', 'csl', 'csm', 'csn', 'cso', 'csp', 'csq', 'csr', 'css', 'cst', 'csu', 'csv', 'csw', 'csx', 'csy', 'csz', 'cta', 'ctb', 'ctc', 'ctd', 'cte', 'ctf', 'ctg', 'cth', 'cti', 'ctj', 'ctk', 'ctl', 'ctm', 'ctn', 'cto', 'ctp', 'ctq', 'ctr', 'cts', 'ctt', 'ctu', 'ctv', 'ctw', 'ctx', 'cty', 'ctz', 'cua', 'cub', 'cuc', 'cud', 'cue', 'cuf', 'cug', 'cuh', 'cui', 'cuj', 'cuk', 'cul', 'cum', 'cun', 'cuo', 'cup', 'cuq', 'cur', 'cus', 'cut', 'cuu', 'cuv', 'cuw', 'cux', 'cuy', 'cuz', 'cva', 'cvb', 'cvc', 'cvd', 'cve', 'cvf', 'cvg', 'cvh', 'cvi', 'cvj', 'cvk', 'cvl', 'cvm', 'cvn', 'cvo', 'cvp', 'cvq', 'cvr', 'cvs', 'cvt', 'cvu', 'cvv', 'cvw', 'cvx', 'cvy', 'cvz', 'cwa', 'cwb', 'cwc', 'cwd', 'cwe', 'cwf', 'cwg', 'cwh', 'cwi', 'cwj', 'cwk', 'cwl', 'cwm', 'cwn', 'cwo', 'cwp', 'cwq', 'cwr', 'cws', 'cwt', 'cwu', 'cwv', 'cww', 'cwx', 'cwy', 'cwz', 'cxa', 'cxb', 'cxc', 'cxd', 'cxe', 'cxf', 'cxg', 'cxh', 'cxi', 'cxj', 'cxk', 'cxl', 'cxm', 'cxn', 'cxo', 'cxp', 'cxq', 'cxr', 'cxs', 'cxt', 'cxu', 'cxv', 'cxw', 'cxx', 'cxy', 'cxz', 'cya', 'cyb', 'cyc', 'cyd', 'cye', 'cyf', 'cyg', 'cyh', 'cyi', 'cyj', 'cyk', 'cyl', 'cym', 'cyn', 'cyo', 'cyp', 'cyq', 'cyr', 'cys', 'cyt', 'cyu', 'cyv', 'cyw', 'cyx', 'cyy', 'cyz', 'cza', 'czb', 'czc', 'czd', 'cze', 'czf', 'czg', 'czh', 'czi', 'czj', 'czk', 'czl', 'czm', 'czn', 'czo', 'czp', 'czq', 'czr', 'czs', 'czt', 'czu', 'czv', 'czw', 'czx', 'czy', 'czz', 'dea', 'deb', 'dec', 'ded', 'dee', 'def', 'deg', 'deh', 'dei', 'dej', 'dek', 'del', 'dem', 'den', 'deo', 'dep', 'deq', 'der', 'des', 'det', 'deu', 'dev', 'dew', 'dex', 'dey', 'dez', 'dfa', 'dfb', 'dfc', 'dfd', 'dfe', 'dff', 'dfg', 'dfh', 'dfi', 'dfj', 'dfk', 'dfl', 'dfm', 'dfn', 'dfo', 'dfp', 'dfq', 'dfr', 'dfs', 'dft', 'dfu', 'dfv', 'dfw', 'dfx', 'dfy', 'dfz', 'dga', 'dgb', 'dgc', 'dgd', 'dge', 'dgf', 'dgg', 'dgh', 'dgi', 'dgj', 'dgk', 'dgl', 'dgm', 'dgn', 'dgo', 'dgp', 'dgq', 'dgr', 'dgs', 'dgt', 'dgu', 'dgv', 'dgw', 'dgx', 'dgy', 'dgz', 'dha', 'dhb', 'dhc', 'dhd', 'dhe', 'dhf', 'dhg', 'dhh', 'dhi', 'dhj', 'dhk', 'dhl', 'dhm', 'dhn', 'dho', 'dhp', 'dhq', 'dhr', 'dhs', 'dht', 'dhu', 'dhv', 'dhw', 'dhx', 'dhy', 'dhz', 'dia', 'dib', 'dic', 'did', 'die', 'dif', 'dig', 'dih', 'dii', 'dij', 'dik', 'dil', 'dim', 'din', 'dio', 'dip', 'diq', 'dir', 'dis', 'dit', 'diu', 'div', 'diw', 'dix', 'diy', 'diz', 'dja', 'djb', 'djc', 'djd', 'dje', 'djf', 'djg', 'djh', 'dji', 'djj', 'djk', 'djl', 'djm', 'djn', 'djo', 'djp', 'djq', 'djr', 'djs', 'djt', 'dju', 'djv', 'djw', 'djx', 'djy', 'djz', 'dka', 'dkb', 'dkc', 'dkd', 'dke', 'dkf', 'dkg', 'dkh', 'dki', 'dkj', 'dkk', 'dkl', 'dkm', 'dkn', 'dko', 'dkp', 'dkq', 'dkr', 'dks', 'dkt', 'dku', 'dkv', 'dkw', 'dkx', 'dky', 'dkz', 'dla', 'dlb', 'dlc', 'dld', 'dle', 'dlf', 'dlg', 'dlh', 'dli', 'dlj', 'dlk', 'dll', 'dlm', 'dln', 'dlo', 'dlp', 'dlq', 'dlr', 'dls', 'dlt', 'dlu', 'dlv', 'dlw', 'dlx', 'dly', 'dlz', 'dma', 'dmb', 'dmc', 'dmd', 'dme', 'dmf', 'dmg', 'dmh', 'dmi', 'dmj', 'dmk', 'dml', 'dmm', 'dmn', 'dmo', 'dmp', 'dmq', 'dmr', 'dms', 'dmt', 'dmu', 'dmv', 'dmw', 'dmx', 'dmy', 'dmz', 'dna', 'dnb', 'dnc', 'dnd', 'dne', 'dnf', 'dng', 'dnh', 'dni', 'dnj', 'dnk', 'dnl', 'dnm', 'dnn', 'dno', 'dnp', 'dnq', 'dnr', 'dns', 'dnt', 'dnu', 'dnv', 'dnw', 'dnx', 'dny', 'dnz', 'doa', 'dob', 'doc', 'dod', 'doe', 'dof', 'dog', 'doh', 'doi', 'doj', 'dok', 'dol', 'dom', 'don', 'doo', 'dop', 'doq', 'dor', 'dos', 'dot', 'dou', 'dov', 'dow', 'dox', 'doy', 'doz', 'dpa', 'dpb', 'dpc', 'dpd', 'dpe', 'dpf', 'dpg', 'dph', 'dpi', 'dpj', 'dpk', 'dpl', 'dpm', 'dpn', 'dpo', 'dpp', 'dpq', 'dpr', 'dps', 'dpt', 'dpu', 'dpv', 'dpw', 'dpx', 'dpy', 'dpz', 'dqa', 'dqb', 'dqc', 'dqd', 'dqe', 'dqf', 'dqg', 'dqh', 'dqi', 'dqj', 'dqk', 'dql', 'dqm', 'dqn', 'dqo', 'dqp', 'dqq', 'dqr', 'dqs', 'dqt', 'dqu', 'dqv', 'dqw', 'dqx', 'dqy', 'dqz', 'dra', 'drb', 'drc', 'drd', 'dre', 'drf', 'drg', 'drh', 'dri', 'drj', 'drk', 'drl', 'drm', 'drn', 'dro', 'drp', 'drq', 'drr', 'drs', 'drt', 'dru', 'drv', 'drw', 'drx', 'dry', 'drz', 'dsa', 'dsb', 'dsc', 'dsd', 'dse', 'dsf', 'dsg', 'dsh', 'dsi', 'dsj', 'dsk', 'dsl', 'dsm', 'dsn', 'dso', 'dsp', 'dsq', 'dsr', 'dss', 'dst', 'dsu', 'dsv', 'dsw', 'dsx', 'dsy', 'dsz', 'dta', 'dtb', 'dtc', 'dtd', 'dte', 'dtf', 'dtg', 'dth', 'dti', 'dtj', 'dtk', 'dtl', 'dtm', 'dtn', 'dto', 'dtp', 'dtq', 'dtr', 'dts', 'dtt', 'dtu', 'dtv', 'dtw', 'dtx', 'dty', 'dtz', 'dua', 'dub', 'duc', 'dud', 'due', 'duf', 'dug', 'duh', 'dui', 'duj', 'duk', 'dul', 'dum', 'dun', 'duo', 'dup', 'duq', 'dur', 'dus', 'dut', 'duu', 'duv', 'duw', 'dux', 'duy', 'duz', 'dva', 'dvb', 'dvc', 'dvd', 'dve', 'dvf', 'dvg', 'dvh', 'dvi', 'dvj', 'dvk', 'dvl', 'dvm', 'dvn', 'dvo', 'dvp', 'dvq', 'dvr', 'dvs', 'dvt', 'dvu', 'dvv', 'dvw', 'dvx', 'dvy', 'dvz', 'dwa', 'dwb', 'dwc', 'dwd', 'dwe', 'dwf', 'dwg', 'dwh', 'dwi', 'dwj', 'dwk', 'dwl', 'dwm', 'dwn', 'dwo', 'dwp', 'dwq', 'dwr', 'dws', 'dwt', 'dwu', 'dwv', 'dww', 'dwx', 'dwy', 'dwz', 'dxa', 'dxb', 'dxc', 'dxd', 'dxe', 'dxf', 'dxg', 'dxh', 'dxi', 'dxj', 'dxk', 'dxl', 'dxm', 'dxn', 'dxo', 'dxp', 'dxq', 'dxr', 'dxs', 'dxt', 'dxu', 'dxv', 'dxw', 'dxx', 'dxy', 'dxz', 'dya', 'dyb', 'dyc', 'dyd', 'dye', 'dyf', 'dyg', 'dyh', 'dyi', 'dyj', 'dyk', 'dyl', 'dym', 'dyn', 'dyo', 'dyp', 'dyq', 'dyr', 'dys', 'dyt', 'dyu', 'dyv', 'dyw', 'dyx', 'dyy', 'dyz', 'dza', 'dzb', 'dzc', 'dzd', 'dze', 'dzf', 'dzg', 'dzh', 'dzi', 'dzj', 'dzk', 'dzl', 'dzm', 'dzn', 'dzo', 'dzp', 'dzq', 'dzr', 'dzs', 'dzt', 'dzu', 'dzv', 'dzw', 'dzx', 'dzy', 'dzz']\n assert candidate(expression = \"{a{b{c{d{e}}}}}{f{g{h{i}}}}\") == ['abcdefghi']\n assert candidate(expression = \"{a,b,c}{d,e,f}{g,h,i}{j,k,l}\") == ['adgj', 'adgk', 'adgl', 'adhj', 'adhk', 'adhl', 'adij', 'adik', 'adil', 'aegj', 'aegk', 'aegl', 'aehj', 'aehk', 'aehl', 'aeij', 'aeik', 'aeil', 'afgj', 'afgk', 'afgl', 'afhj', 'afhk', 'afhl', 'afij', 'afik', 'afil', 'bdgj', 'bdgk', 'bdgl', 'bdhj', 'bdhk', 'bdhl', 'bdij', 'bdik', 'bdil', 'begj', 'begk', 'begl', 'behj', 'behk', 'behl', 'beij', 'beik', 'beil', 'bfgj', 'bfgk', 'bfgl', 'bfhj', 'bfhk', 'bfhl', 'bfij', 'bfik', 'bfil', 'cdgj', 'cdgk', 'cdgl', 'cdhj', 'cdhk', 'cdhl', 'cdij', 'cdik', 'cdil', 'cegj', 'cegk', 'cegl', 'cehj', 'cehk', 'cehl', 'ceij', 'ceik', 'ceil', 'cfgj', 'cfgk', 'cfgl', 'cfhj', 'cfhk', 'cfhl', 'cfij', 'cfik', 'cfil']\n assert candidate(expression = \"{a,b}{c,d}{e,f}{g,h}\") == ['aceg', 'aceh', 'acfg', 'acfh', 'adeg', 'adeh', 'adfg', 'adfh', 'bceg', 'bceh', 'bcfg', 'bcfh', 'bdeg', 'bdeh', 'bdfg', 'bdfh']\n assert candidate(expression = \"{a,b}{c,d}{e,{f,g{h,i}}}\") == ['ace', 'acf', 'acgh', 'acgi', 'ade', 'adf', 'adgh', 'adgi', 'bce', 'bcf', 'bcgh', 'bcgi', 'bde', 'bdf', 'bdgh', 'bdgi']\n assert candidate(expression = \"{a{b{c,d},e},f{g,h}}\") == ['abc', 'abd', 'ae', 'fg', 'fh']\n assert candidate(expression = \"{a{b,c}{d,e}{f,g},{h,i}{j,k}{l,m},{n,o}{p,q}{r,s},{t,u}{v,w}{x,y,z}}\") == ['abdf', 'abdg', 'abef', 'abeg', 'acdf', 'acdg', 'acef', 'aceg', 'hjl', 'hjm', 'hkl', 'hkm', 'ijl', 'ijm', 'ikl', 'ikm', 'npr', 'nps', 'nqr', 'nqs', 'opr', 'ops', 'oqr', 'oqs', 'tvx', 'tvy', 'tvz', 'twx', 'twy', 'twz', 'uvx', 'uvy', 'uvz', 'uwx', 'uwy', 'uwz']\n assert candidate(expression = \"{a,b}{c,d,e}{f,g,h}\") == ['acf', 'acg', 'ach', 'adf', 'adg', 'adh', 'aef', 'aeg', 'aeh', 'bcf', 'bcg', 'bch', 'bdf', 'bdg', 'bdh', 'bef', 'beg', 'beh']\n assert candidate(expression = \"{a{b,c},{d,e}{f,g}}\") == ['ab', 'ac', 'df', 'dg', 'ef', 'eg']\n assert candidate(expression = \"{a,b,c}{d,e,f}{g,h,i,j}\") == ['adg', 'adh', 'adi', 'adj', 'aeg', 'aeh', 'aei', 'aej', 'afg', 'afh', 'afi', 'afj', 'bdg', 'bdh', 'bdi', 'bdj', 'beg', 'beh', 'bei', 'bej', 'bfg', 'bfh', 'bfi', 'bfj', 'cdg', 'cdh', 'cdi', 'cdj', 'ceg', 'ceh', 'cei', 'cej', 'cfg', 'cfh', 'cfi', 'cfj']\n assert candidate(expression = \"{a,b}{c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}\") == ['ac', 'ad', 'ae', 'af', 'ag', 'ah', 'ai', 'aj', 'ak', 'al', 'am', 'an', 'ao', 'ap', 'aq', 'ar', 'as', 'at', 'au', 'av', 'aw', 'ax', 'ay', 'az', 'bc', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bk', 'bl', 'bm', 'bn', 'bo', 'bp', 'bq', 'br', 'bs', 'bt', 'bu', 'bv', 'bw', 'bx', 'by', 'bz']\n assert candidate(expression = \"a{b,c}d{e,f}g{h,i}\") == ['abdegh', 'abdegi', 'abdfgh', 'abdfgi', 'acdegh', 'acdegi', 'acdfgh', 'acdfgi']\n assert candidate(expression = \"{a,b{c,d{e,f}},g{h,i{,j}}{k,l}}m{n,o{p,q}}\") == ['amn', 'amop', 'amoq', 'bcmn', 'bcmop', 'bcmoq', 'bdemn', 'bdemop', 'bdemoq', 'bdfmn', 'bdfmop', 'bdfmoq', 'ghkmn', 'ghkmop', 'ghkmoq', 'ghlmn', 'ghlmop', 'ghlmoq', 'gijkmn', 'gijkmop', 'gijkmoq', 'gijlmn', 'gijlmop', 'gijlmoq', 'gikmn', 'gikmop', 'gikmoq', 'gilmn', 'gilmop', 'gilmoq']\n assert candidate(expression = \"{a,b}{c{d,e{f,g}},h}\") == ['acd', 'acef', 'aceg', 'ah', 'bcd', 'bcef', 'bceg', 'bh']\n assert candidate(expression = \"{a,b}{c{d{e,f},g},h{ij,k}}\") == ['acde', 'acdf', 'acg', 'ahij', 'ahk', 'bcde', 'bcdf', 'bcg', 'bhij', 'bhk']\n assert candidate(expression = \"{a{b,c},d{e,f}}{g,h}\") == ['abg', 'abh', 'acg', 'ach', 'deg', 'deh', 'dfg', 'dfh']\n assert candidate(expression = \"{a,b{c,d{e,f}},g{h,i{,j}}}\") == ['a', 'bc', 'bde', 'bdf', 'gh', 'gi', 'gij']\n assert candidate(expression = \"{a{b{c{d{e{f{g{h{i{j{k{l{m{n{o{p{q{r{s{t{u{v{w{x{y{z{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}}}}}}}}}}}}}}}}}}}}}\") == ['{a{b{c{d{e{fghijklmnopqrstuvwxyza', '{a{b{c{d{e{fghijklmnopqrstuvwxyzb', '{a{b{c{d{e{fghijklmnopqrstuvwxyzc', '{a{b{c{d{e{fghijklmnopqrstuvwxyzd', '{a{b{c{d{e{fghijklmnopqrstuvwxyze', '{a{b{c{d{e{fghijklmnopqrstuvwxyzf', '{a{b{c{d{e{fghijklmnopqrstuvwxyzg', '{a{b{c{d{e{fghijklmnopqrstuvwxyzh', '{a{b{c{d{e{fghijklmnopqrstuvwxyzi', '{a{b{c{d{e{fghijklmnopqrstuvwxyzj', '{a{b{c{d{e{fghijklmnopqrstuvwxyzk', '{a{b{c{d{e{fghijklmnopqrstuvwxyzl', '{a{b{c{d{e{fghijklmnopqrstuvwxyzm', '{a{b{c{d{e{fghijklmnopqrstuvwxyzn', '{a{b{c{d{e{fghijklmnopqrstuvwxyzo', '{a{b{c{d{e{fghijklmnopqrstuvwxyzp', '{a{b{c{d{e{fghijklmnopqrstuvwxyzq', '{a{b{c{d{e{fghijklmnopqrstuvwxyzr', '{a{b{c{d{e{fghijklmnopqrstuvwxyzs', '{a{b{c{d{e{fghijklmnopqrstuvwxyzt', '{a{b{c{d{e{fghijklmnopqrstuvwxyzu', '{a{b{c{d{e{fghijklmnopqrstuvwxyzv', '{a{b{c{d{e{fghijklmnopqrstuvwxyzw', '{a{b{c{d{e{fghijklmnopqrstuvwxyzx', '{a{b{c{d{e{fghijklmnopqrstuvwxyzy', '{a{b{c{d{e{fghijklmnopqrstuvwxyzz']\n assert candidate(expression = \"{a,b{c,d}}{e,f{g,h}}{i,{j,k}}\") == ['aei', 'aej', 'aek', 'afgi', 'afgj', 'afgk', 'afhi', 'afhj', 'afhk', 'bcei', 'bcej', 'bcek', 'bcfgi', 'bcfgj', 'bcfgk', 'bcfhi', 'bcfhj', 'bcfhk', 'bdei', 'bdej', 'bdek', 'bdfgi', 'bdfgj', 'bdfgk', 'bdfhi', 'bdfhj', 'bdfhk']\n assert candidate(expression = \"{x{y,z},{a,b,c}{d,e},{f,g}{h,{i,j}}}\") == ['ad', 'ae', 'bd', 'be', 'cd', 'ce', 'fh', 'fi', 'fj', 'gh', 'gi', 'gj', 'xy', 'xz']\n assert candidate(expression = \"{a,b,c}{d,e,f}{g,{h,i}}\") == ['adg', 'adh', 'adi', 'aeg', 'aeh', 'aei', 'afg', 'afh', 'afi', 'bdg', 'bdh', 'bdi', 'beg', 'beh', 'bei', 'bfg', 'bfh', 'bfi', 'cdg', 'cdh', 'cdi', 'ceg', 'ceh', 'cei', 'cfg', 'cfh', 'cfi']\n assert candidate(expression = \"{x,y,z}{a,b,c}{m,n}\") == ['xam', 'xan', 'xbm', 'xbn', 'xcm', 'xcn', 'yam', 'yan', 'ybm', 'ybn', 'ycm', 'ycn', 'zam', 'zan', 'zbm', 'zbn', 'zcm', 'zcn']\n assert candidate(expression = \"{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}\") == ['aa', 'ab', 'ac', 'ad', 'ae', 'af', 'ag', 'ah', 'ai', 'aj', 'ak', 'al', 'am', 'an', 'ao', 'ap', 'aq', 'ar', 'as', 'at', 'au', 'av', 'aw', 'ax', 'ay', 'az', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bk', 'bl', 'bm', 'bn', 'bo', 'bp', 'bq', 'br', 'bs', 'bt', 'bu', 'bv', 'bw', 'bx', 'by', 'bz', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'cg', 'ch', 'ci', 'cj', 'ck', 'cl', 'cm', 'cn', 'co', 'cp', 'cq', 'cr', 'cs', 'ct', 'cu', 'cv', 'cw', 'cx', 'cy', 'cz', 'da', 'db', 'dc', 'dd', 'de', 'df', 'dg', 'dh', 'di', 'dj', 'dk', 'dl', 'dm', 'dn', 'do', 'dp', 'dq', 'dr', 'ds', 'dt', 'du', 'dv', 'dw', 'dx', 'dy', 'dz', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'eg', 'eh', 'ei', 'ej', 'ek', 'el', 'em', 'en', 'eo', 'ep', 'eq', 'er', 'es', 'et', 'eu', 'ev', 'ew', 'ex', 'ey', 'ez', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff', 'fg', 'fh', 'fi', 'fj', 'fk', 'fl', 'fm', 'fn', 'fo', 'fp', 'fq', 'fr', 'fs', 'ft', 'fu', 'fv', 'fw', 'fx', 'fy', 'fz', 'ga', 'gb', 'gc', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gj', 'gk', 'gl', 'gm', 'gn', 'go', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gv', 'gw', 'gx', 'gy', 'gz', 'ha', 'hb', 'hc', 'hd', 'he', 'hf', 'hg', 'hh', 'hi', 'hj', 'hk', 'hl', 'hm', 'hn', 'ho', 'hp', 'hq', 'hr', 'hs', 'ht', 'hu', 'hv', 'hw', 'hx', 'hy', 'hz', 'ia', 'ib', 'ic', 'id', 'ie', 'if', 'ig', 'ih', 'ii', 'ij', 'ik', 'il', 'im', 'in', 'io', 'ip', 'iq', 'ir', 'is', 'it', 'iu', 'iv', 'iw', 'ix', 'iy', 'iz', 'ja', 'jb', 'jc', 'jd', 'je', 'jf', 'jg', 'jh', 'ji', 'jj', 'jk', 'jl', 'jm', 'jn', 'jo', 'jp', 'jq', 'jr', 'js', 'jt', 'ju', 'jv', 'jw', 'jx', 'jy', 'jz', 'ka', 'kb', 'kc', 'kd', 'ke', 'kf', 'kg', 'kh', 'ki', 'kj', 'kk', 'kl', 'km', 'kn', 'ko', 'kp', 'kq', 'kr', 'ks', 'kt', 'ku', 'kv', 'kw', 'kx', 'ky', 'kz', 'la', 'lb', 'lc', 'ld', 'le', 'lf', 'lg', 'lh', 'li', 'lj', 'lk', 'll', 'lm', 'ln', 'lo', 'lp', 'lq', 'lr', 'ls', 'lt', 'lu', 'lv', 'lw', 'lx', 'ly', 'lz', 'ma', 'mb', 'mc', 'md', 'me', 'mf', 'mg', 'mh', 'mi', 'mj', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nb', 'nc', 'nd', 'ne', 'nf', 'ng', 'nh', 'ni', 'nj', 'nk', 'nl', 'nm', 'nn', 'no', 'np', 'nq', 'nr', 'ns', 'nt', 'nu', 'nv', 'nw', 'nx', 'ny', 'nz', 'oa', 'ob', 'oc', 'od', 'oe', 'of', 'og', 'oh', 'oi', 'oj', 'ok', 'ol', 'om', 'on', 'oo', 'op', 'oq', 'or', 'os', 'ot', 'ou', 'ov', 'ow', 'ox', 'oy', 'oz', 'pa', 'pb', 'pc', 'pd', 'pe', 'pf', 'pg', 'ph', 'pi', 'pj', 'pk', 'pl', 'pm', 'pn', 'po', 'pp', 'pq', 'pr', 'ps', 'pt', 'pu', 'pv', 'pw', 'px', 'py', 'pz', 'qa', 'qb', 'qc', 'qd', 'qe', 'qf', 'qg', 'qh', 'qi', 'qj', 'qk', 'ql', 'qm', 'qn', 'qo', 'qp', 'qq', 'qr', 'qs', 'qt', 'qu', 'qv', 'qw', 'qx', 'qy', 'qz', 'ra', 'rb', 'rc', 'rd', 're', 'rf', 'rg', 'rh', 'ri', 'rj', 'rk', 'rl', 'rm', 'rn', 'ro', 'rp', 'rq', 'rr', 'rs', 'rt', 'ru', 'rv', 'rw', 'rx', 'ry', 'rz', 'sa', 'sb', 'sc', 'sd', 'se', 'sf', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', 'sm', 'sn', 'so', 'sp', 'sq', 'sr', 'ss', 'st', 'su', 'sv', 'sw', 'sx', 'sy', 'sz', 'ta', 'tb', 'tc', 'td', 'te', 'tf', 'tg', 'th', 'ti', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tq', 'tr', 'ts', 'tt', 'tu', 'tv', 'tw', 'tx', 'ty', 'tz', 'ua', 'ub', 'uc', 'ud', 'ue', 'uf', 'ug', 'uh', 'ui', 'uj', 'uk', 'ul', 'um', 'un', 'uo', 'up', 'uq', 'ur', 'us', 'ut', 'uu', 'uv', 'uw', 'ux', 'uy', 'uz', 'va', 'vb', 'vc', 'vd', 've', 'vf', 'vg', 'vh', 'vi', 'vj', 'vk', 'vl', 'vm', 'vn', 'vo', 'vp', 'vq', 'vr', 'vs', 'vt', 'vu', 'vv', 'vw', 'vx', 'vy', 'vz', 'wa', 'wb', 'wc', 'wd', 'we', 'wf', 'wg', 'wh', 'wi', 'wj', 'wk', 'wl', 'wm', 'wn', 'wo', 'wp', 'wq', 'wr', 'ws', 'wt', 'wu', 'wv', 'ww', 'wx', 'wy', 'wz', 'xa', 'xb', 'xc', 'xd', 'xe', 'xf', 'xg', 'xh', 'xi', 'xj', 'xk', 'xl', 'xm', 'xn', 'xo', 'xp', 'xq', 'xr', 'xs', 'xt', 'xu', 'xv', 'xw', 'xx', 'xy', 'xz', 'ya', 'yb', 'yc', 'yd', 'ye', 'yf', 'yg', 'yh', 'yi', 'yj', 'yk', 'yl', 'ym', 'yn', 'yo', 'yp', 'yq', 'yr', 'ys', 'yt', 'yu', 'yv', 'yw', 'yx', 'yy', 'yz', 'za', 'zb', 'zc', 'zd', 'ze', 'zf', 'zg', 'zh', 'zi', 'zj', 'zk', 'zl', 'zm', 'zn', 'zo', 'zp', 'zq', 'zr', 'zs', 'zt', 'zu', 'zv', 'zw', 'zx', 'zy', 'zz']\n assert candidate(expression = \"{x{y,z},a{b{c,d{e,f}},g{h,i{}}},j{k{l,m{n{o,p},q{r,s}}},x{y,z}}{a{b,c},d{e,f}}}\") == ['abc,jklababc', 'abc,jklabjklab', 'abc,jklacabc', 'abc,jklacjklac', 'abc,jkldeabc', 'abc,jkldejklde', 'abc,jkldfabc', 'abc,jkldfjkldf', 'abc,jkmnoababc', 'abc,jkmnoabjkmnoab', 'abc,jkmnoacabc', 'abc,jkmnoacjkmnoac', 'abc,jkmnodeabc', 'abc,jkmnodejkmnode', 'abc,jkmnodfabc', 'abc,jkmnodfjkmnodf', 'abc,jkmnpababc', 'abc,jkmnpabjkmnpab', 'abc,jkmnpacabc', 'abc,jkmnpacjkmnpac', 'abc,jkmnpdeabc', 'abc,jkmnpdejkmnpde', 'abc,jkmnpdfabc', 'abc,jkmnpdfjkmnpdf', 'abc,jkmqrababc', 'abc,jkmqrabjkmqrab', 'abc,jkmqracabc', 'abc,jkmqracjkmqrac', 'abc,jkmqrdeabc', 'abc,jkmqrdejkmqrde', 'abc,jkmqrdfabc', 'abc,jkmqrdfjkmqrdf', 'abc,jkmqsababc', 'abc,jkmqsabjkmqsab', 'abc,jkmqsacabc', 'abc,jkmqsacjkmqsac', 'abc,jkmqsdeabc', 'abc,jkmqsdejkmqsde', 'abc,jkmqsdfabc', 'abc,jkmqsdfjkmqsdf', 'abc,jxyababc', 'abc,jxyabjxyab', 'abc,jxyacabc', 'abc,jxyacjxyac', 'abc,jxydeabc', 'abc,jxydejxyde', 'abc,jxydfabc', 'abc,jxydfjxydf', 'abc,jxzababc', 'abc,jxzabjxzab', 'abc,jxzacabc', 'abc,jxzacjxzac', 'abc,jxzdeabc', 'abc,jxzdejxzde', 'abc,jxzdfabc', 'abc,jxzdfjxzdf', 'abde,jklababde', 'abde,jklabjklab', 'abde,jklacabde', 'abde,jklacjklac', 'abde,jkldeabde', 'abde,jkldejklde', 'abde,jkldfabde', 'abde,jkldfjkldf', 'abde,jkmnoababde', 'abde,jkmnoabjkmnoab', 'abde,jkmnoacabde', 'abde,jkmnoacjkmnoac', 'abde,jkmnodeabde', 'abde,jkmnodejkmnode', 'abde,jkmnodfabde', 'abde,jkmnodfjkmnodf', 'abde,jkmnpababde', 'abde,jkmnpabjkmnpab', 'abde,jkmnpacabde', 'abde,jkmnpacjkmnpac', 'abde,jkmnpdeabde', 'abde,jkmnpdejkmnpde', 'abde,jkmnpdfabde', 'abde,jkmnpdfjkmnpdf', 'abde,jkmqrababde', 'abde,jkmqrabjkmqrab', 'abde,jkmqracabde', 'abde,jkmqracjkmqrac', 'abde,jkmqrdeabde', 'abde,jkmqrdejkmqrde', 'abde,jkmqrdfabde', 'abde,jkmqrdfjkmqrdf', 'abde,jkmqsababde', 'abde,jkmqsabjkmqsab', 'abde,jkmqsacabde', 'abde,jkmqsacjkmqsac', 'abde,jkmqsdeabde', 'abde,jkmqsdejkmqsde', 'abde,jkmqsdfabde', 'abde,jkmqsdfjkmqsdf', 'abde,jxyababde', 'abde,jxyabjxyab', 'abde,jxyacabde', 'abde,jxyacjxyac', 'abde,jxydeabde', 'abde,jxydejxyde', 'abde,jxydfabde', 'abde,jxydfjxydf', 'abde,jxzababde', 'abde,jxzabjxzab', 'abde,jxzacabde', 'abde,jxzacjxzac', 'abde,jxzdeabde', 'abde,jxzdejxzde', 'abde,jxzdfabde', 'abde,jxzdfjxzdf', 'abdf,jklababdf', 'abdf,jklabjklab', 'abdf,jklacabdf', 'abdf,jklacjklac', 'abdf,jkldeabdf', 'abdf,jkldejklde', 'abdf,jkldfabdf', 'abdf,jkldfjkldf', 'abdf,jkmnoababdf', 'abdf,jkmnoabjkmnoab', 'abdf,jkmnoacabdf', 'abdf,jkmnoacjkmnoac', 'abdf,jkmnodeabdf', 'abdf,jkmnodejkmnode', 'abdf,jkmnodfabdf', 'abdf,jkmnodfjkmnodf', 'abdf,jkmnpababdf', 'abdf,jkmnpabjkmnpab', 'abdf,jkmnpacabdf', 'abdf,jkmnpacjkmnpac', 'abdf,jkmnpdeabdf', 'abdf,jkmnpdejkmnpde', 'abdf,jkmnpdfabdf', 'abdf,jkmnpdfjkmnpdf', 'abdf,jkmqrababdf', 'abdf,jkmqrabjkmqrab', 'abdf,jkmqracabdf', 'abdf,jkmqracjkmqrac', 'abdf,jkmqrdeabdf', 'abdf,jkmqrdejkmqrde', 'abdf,jkmqrdfabdf', 'abdf,jkmqrdfjkmqrdf', 'abdf,jkmqsababdf', 'abdf,jkmqsabjkmqsab', 'abdf,jkmqsacabdf', 'abdf,jkmqsacjkmqsac', 'abdf,jkmqsdeabdf', 'abdf,jkmqsdejkmqsde', 'abdf,jkmqsdfabdf', 'abdf,jkmqsdfjkmqsdf', 'abdf,jxyababdf', 'abdf,jxyabjxyab', 'abdf,jxyacabdf', 'abdf,jxyacjxyac', 'abdf,jxydeabdf', 'abdf,jxydejxyde', 'abdf,jxydfabdf', 'abdf,jxydfjxydf', 'abdf,jxzababdf', 'abdf,jxzabjxzab', 'abdf,jxzacabdf', 'abdf,jxzacjxzac', 'abdf,jxzdeabdf', 'abdf,jxzdejxzde', 'abdf,jxzdfabdf', 'abdf,jxzdfjxzdf', 'agh,jklabagh', 'agh,jklabjklab', 'agh,jklacagh', 'agh,jklacjklac', 'agh,jkldeagh', 'agh,jkldejklde', 'agh,jkldfagh', 'agh,jkldfjkldf', 'agh,jkmnoabagh', 'agh,jkmnoabjkmnoab', 'agh,jkmnoacagh', 'agh,jkmnoacjkmnoac', 'agh,jkmnodeagh', 'agh,jkmnodejkmnode', 'agh,jkmnodfagh', 'agh,jkmnodfjkmnodf', 'agh,jkmnpabagh', 'agh,jkmnpabjkmnpab', 'agh,jkmnpacagh', 'agh,jkmnpacjkmnpac', 'agh,jkmnpdeagh', 'agh,jkmnpdejkmnpde', 'agh,jkmnpdfagh', 'agh,jkmnpdfjkmnpdf', 'agh,jkmqrabagh', 'agh,jkmqrabjkmqrab', 'agh,jkmqracagh', 'agh,jkmqracjkmqrac', 'agh,jkmqrdeagh', 'agh,jkmqrdejkmqrde', 'agh,jkmqrdfagh', 'agh,jkmqrdfjkmqrdf', 'agh,jkmqsabagh', 'agh,jkmqsabjkmqsab', 'agh,jkmqsacagh', 'agh,jkmqsacjkmqsac', 'agh,jkmqsdeagh', 'agh,jkmqsdejkmqsde', 'agh,jkmqsdfagh', 'agh,jkmqsdfjkmqsdf', 'agh,jxyabagh', 'agh,jxyabjxyab', 'agh,jxyacagh', 'agh,jxyacjxyac', 'agh,jxydeagh', 'agh,jxydejxyde', 'agh,jxydfagh', 'agh,jxydfjxydf', 'agh,jxzabagh', 'agh,jxzabjxzab', 'agh,jxzacagh', 'agh,jxzacjxzac', 'agh,jxzdeagh', 'agh,jxzdejxzde', 'agh,jxzdfagh', 'agh,jxzdfjxzdf', 'agi', 'agijklab', 'agijklac', 'agijklde', 'agijkldf', 'agijkmnoab', 'agijkmnoac', 'agijkmnode', 'agijkmnodf', 'agijkmnpab', 'agijkmnpac', 'agijkmnpde', 'agijkmnpdf', 'agijkmqrab', 'agijkmqrac', 'agijkmqrde', 'agijkmqrdf', 'agijkmqsab', 'agijkmqsac', 'agijkmqsde', 'agijkmqsdf', 'agijxyab', 'agijxyac', 'agijxyde', 'agijxydf', 'agijxzab', 'agijxzac', 'agijxzde', 'agijxzdf', 'xy,jklabjklab', 'xy,jklabxy', 'xy,jklacjklac', 'xy,jklacxy', 'xy,jkldejklde', 'xy,jkldexy', 'xy,jkldfjkldf', 'xy,jkldfxy', 'xy,jkmnoabjkmnoab', 'xy,jkmnoabxy', 'xy,jkmnoacjkmnoac', 'xy,jkmnoacxy', 'xy,jkmnodejkmnode', 'xy,jkmnodexy', 'xy,jkmnodfjkmnodf', 'xy,jkmnodfxy', 'xy,jkmnpabjkmnpab', 'xy,jkmnpabxy', 'xy,jkmnpacjkmnpac', 'xy,jkmnpacxy', 'xy,jkmnpdejkmnpde', 'xy,jkmnpdexy', 'xy,jkmnpdfjkmnpdf', 'xy,jkmnpdfxy', 'xy,jkmqrabjkmqrab', 'xy,jkmqrabxy', 'xy,jkmqracjkmqrac', 'xy,jkmqracxy', 'xy,jkmqrdejkmqrde', 'xy,jkmqrdexy', 'xy,jkmqrdfjkmqrdf', 'xy,jkmqrdfxy', 'xy,jkmqsabjkmqsab', 'xy,jkmqsabxy', 'xy,jkmqsacjkmqsac', 'xy,jkmqsacxy', 'xy,jkmqsdejkmqsde', 'xy,jkmqsdexy', 'xy,jkmqsdfjkmqsdf', 'xy,jkmqsdfxy', 'xy,jxyabjxyab', 'xy,jxyabxy', 'xy,jxyacjxyac', 'xy,jxyacxy', 'xy,jxydejxyde', 'xy,jxydexy', 'xy,jxydfjxydf', 'xy,jxydfxy', 'xy,jxzabjxzab', 'xy,jxzabxy', 'xy,jxzacjxzac', 'xy,jxzacxy', 'xy,jxzdejxzde', 'xy,jxzdexy', 'xy,jxzdfjxzdf', 'xy,jxzdfxy', 'xz,jklabjklab', 'xz,jklabxz', 'xz,jklacjklac', 'xz,jklacxz', 'xz,jkldejklde', 'xz,jkldexz', 'xz,jkldfjkldf', 'xz,jkldfxz', 'xz,jkmnoabjkmnoab', 'xz,jkmnoabxz', 'xz,jkmnoacjkmnoac', 'xz,jkmnoacxz', 'xz,jkmnodejkmnode', 'xz,jkmnodexz', 'xz,jkmnodfjkmnodf', 'xz,jkmnodfxz', 'xz,jkmnpabjkmnpab', 'xz,jkmnpabxz', 'xz,jkmnpacjkmnpac', 'xz,jkmnpacxz', 'xz,jkmnpdejkmnpde', 'xz,jkmnpdexz', 'xz,jkmnpdfjkmnpdf', 'xz,jkmnpdfxz', 'xz,jkmqrabjkmqrab', 'xz,jkmqrabxz', 'xz,jkmqracjkmqrac', 'xz,jkmqracxz', 'xz,jkmqrdejkmqrde', 'xz,jkmqrdexz', 'xz,jkmqrdfjkmqrdf', 'xz,jkmqrdfxz', 'xz,jkmqsabjkmqsab', 'xz,jkmqsabxz', 'xz,jkmqsacjkmqsac', 'xz,jkmqsacxz', 'xz,jkmqsdejkmqsde', 'xz,jkmqsdexz', 'xz,jkmqsdfjkmqsdf', 'xz,jkmqsdfxz', 'xz,jxyabjxyab', 'xz,jxyabxz', 'xz,jxyacjxyac', 'xz,jxyacxz', 'xz,jxydejxyde', 'xz,jxydexz', 'xz,jxydfjxydf', 'xz,jxydfxz', 'xz,jxzabjxzab', 'xz,jxzabxz', 'xz,jxzacjxzac', 'xz,jxzacxz', 'xz,jxzdejxzde', 'xz,jxzdexz', 'xz,jxzdfjxzdf', 'xz,jxzdfxz']\n assert candidate(expression = \"{{a,b},{c,d}}{e,f}{g,h}\") == ['aeg', 'aeh', 'afg', 'afh', 'beg', 'beh', 'bfg', 'bfh', 'ceg', 'ceh', 'cfg', 'cfh', 'deg', 'deh', 'dfg', 'dfh']\n assert candidate(expression = \"{a,b}c{d,e}{f,g}\") == ['acdf', 'acdg', 'acef', 'aceg', 'bcdf', 'bcdg', 'bcef', 'bceg']\n assert candidate(expression = \"{a,b{c{d,e}}}{f,g{h,i}}{j,k{m,n}}\") == ['afj', 'afkm', 'afkn', 'aghj', 'aghkm', 'aghkn', 'agij', 'agikm', 'agikn', 'bcdfj', 'bcdfkm', 'bcdfkn', 'bcdghj', 'bcdghkm', 'bcdghkn', 'bcdgij', 'bcdgikm', 'bcdgikn', 'bcefj', 'bcefkm', 'bcefkn', 'bceghj', 'bceghkm', 'bceghkn', 'bcegij', 'bcegikm', 'bcegikn']\n assert candidate(expression = \"{a,{b,{c,{d,{e,{f,g}}}}}}\") == ['a', 'b', 'c', 'd', 'e', 'f', 'g']\n assert candidate(expression = \"{a{b,c},{d,e}f}\") == ['ab', 'ac', 'df', 'ef']\n"}, "metadata": {"canonical_parameter_names": ["expression"], "leetcode_dataset_entry_point": "Solution().braceExpansionII", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var braceExpansionII = function(expression) {", "container": null, "callable": "braceExpansionII", "parameters": [{"name": "expression", "type": "string"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1103, "task_id": "distribute-candies-to-people", "difficulty": "Easy", "problem_description": "We distribute some number of candies, to a row of n = num_people people in the following way:\nWe then give 1 candy to the first person, 2 candies to the second person, and so on until we give n candies to the last person.\nThen, we go back to the start of the row, giving n + 1 candies to the first person, n + 2 candies to the second person, and so on until we give 2 * n candies to the last person.\nThis process repeats (with us giving one more candy each time, and moving to the start of the row after we reach the end) until we run out of candies.  The last person will receive all of our remaining candies (not necessarily one more than the previous gift).\nReturn an array (of length num_people and sum candies) that represents the final distribution of candies.\n \nExample 1:\n\nInput: candies = 7, num_people = 4\nOutput: [1,2,3,1]\nExplanation:\nOn the first turn, ans[0] += 1, and the array is [1,0,0,0].\nOn the second turn, ans[1] += 2, and the array is [1,2,0,0].\nOn the third turn, ans[2] += 3, and the array is [1,2,3,0].\nOn the fourth turn, ans[3] += 1 (because there is only one candy left), and the final array is [1,2,3,1].\n\nExample 2:\n\nInput: candies = 10, num_people = 3\nOutput: [5,2,3]\nExplanation: \nOn the first turn, ans[0] += 1, and the array is [1,0,0].\nOn the second turn, ans[1] += 2, and the array is [1,2,0].\nOn the third turn, ans[2] += 3, and the array is [1,2,3].\nOn the fourth turn, ans[0] += 4, and the final array is [5,2,3].\n\n \nConstraints:\n\n1 <= candies <= 10^9\n1 <= num_people <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(candies = 500000000,num_people = 500) == [1008064, 1008128, 1008192, 1008256, 1008320, 1008384, 1008448, 1008512, 1008576, 1008640, 1008704, 1008768, 1008832, 1008896, 1008960, 1009024, 1009088, 1009152, 1009216, 1009280, 1009344, 1009408, 1009472, 1009536, 1009600, 1009664, 1009728, 1009792, 1009856, 1009920, 1009984, 1010048, 1010112, 1010176, 1010240, 1010304, 1010368, 1010432, 1010496, 1010560, 1010624, 1010688, 1010752, 1010816, 1010880, 1010944, 1011008, 1011072, 1011136, 1011200, 1011264, 1011328, 1011392, 1011456, 1011520, 1011584, 1011648, 1011712, 1011776, 1011840, 1011904, 1011968, 1012032, 1012096, 1012160, 1012224, 1012288, 1012352, 1012416, 1012480, 1012544, 1012608, 1012672, 1012736, 1012800, 1012864, 1012928, 1012992, 1013056, 1013120, 1013184, 1013248, 1013312, 1013376, 1013440, 1013504, 1013568, 1013632, 1013696, 1013760, 1013824, 1013888, 1013952, 1014016, 1014080, 1014144, 1014208, 1014272, 1014336, 1014400, 1014464, 1014528, 1014592, 1014656, 1014720, 1014784, 1014848, 1014912, 1014976, 1015040, 1015104, 1015168, 1015232, 1015296, 1015360, 1015424, 1015488, 1015552, 1015616, 1015680, 1015744, 1015808, 992996, 984312, 984375, 984438, 984501, 984564, 984627, 984690, 984753, 984816, 984879, 984942, 985005, 985068, 985131, 985194, 985257, 985320, 985383, 985446, 985509, 985572, 985635, 985698, 985761, 985824, 985887, 985950, 986013, 986076, 986139, 986202, 986265, 986328, 986391, 986454, 986517, 986580, 986643, 986706, 986769, 986832, 986895, 986958, 987021, 987084, 987147, 987210, 987273, 987336, 987399, 987462, 987525, 987588, 987651, 987714, 987777, 987840, 987903, 987966, 988029, 988092, 988155, 988218, 988281, 988344, 988407, 988470, 988533, 988596, 988659, 988722, 988785, 988848, 988911, 988974, 989037, 989100, 989163, 989226, 989289, 989352, 989415, 989478, 989541, 989604, 989667, 989730, 989793, 989856, 989919, 989982, 990045, 990108, 990171, 990234, 990297, 990360, 990423, 990486, 990549, 990612, 990675, 990738, 990801, 990864, 990927, 990990, 991053, 991116, 991179, 991242, 991305, 991368, 991431, 991494, 991557, 991620, 991683, 991746, 991809, 991872, 991935, 991998, 992061, 992124, 992187, 992250, 992313, 992376, 992439, 992502, 992565, 992628, 992691, 992754, 992817, 992880, 992943, 993006, 993069, 993132, 993195, 993258, 993321, 993384, 993447, 993510, 993573, 993636, 993699, 993762, 993825, 993888, 993951, 994014, 994077, 994140, 994203, 994266, 994329, 994392, 994455, 994518, 994581, 994644, 994707, 994770, 994833, 994896, 994959, 995022, 995085, 995148, 995211, 995274, 995337, 995400, 995463, 995526, 995589, 995652, 995715, 995778, 995841, 995904, 995967, 996030, 996093, 996156, 996219, 996282, 996345, 996408, 996471, 996534, 996597, 996660, 996723, 996786, 996849, 996912, 996975, 997038, 997101, 997164, 997227, 997290, 997353, 997416, 997479, 997542, 997605, 997668, 997731, 997794, 997857, 997920, 997983, 998046, 998109, 998172, 998235, 998298, 998361, 998424, 998487, 998550, 998613, 998676, 998739, 998802, 998865, 998928, 998991, 999054, 999117, 999180, 999243, 999306, 999369, 999432, 999495, 999558, 999621, 999684, 999747, 999810, 999873, 999936, 999999, 1000062, 1000125, 1000188, 1000251, 1000314, 1000377, 1000440, 1000503, 1000566, 1000629, 1000692, 1000755, 1000818, 1000881, 1000944, 1001007, 1001070, 1001133, 1001196, 1001259, 1001322, 1001385, 1001448, 1001511, 1001574, 1001637, 1001700, 1001763, 1001826, 1001889, 1001952, 1002015, 1002078, 1002141, 1002204, 1002267, 1002330, 1002393, 1002456, 1002519, 1002582, 1002645, 1002708, 1002771, 1002834, 1002897, 1002960, 1003023, 1003086, 1003149, 1003212, 1003275, 1003338, 1003401, 1003464, 1003527, 1003590, 1003653, 1003716, 1003779, 1003842, 1003905, 1003968, 1004031, 1004094, 1004157, 1004220, 1004283, 1004346, 1004409, 1004472, 1004535, 1004598, 1004661, 1004724, 1004787, 1004850, 1004913, 1004976, 1005039, 1005102, 1005165, 1005228, 1005291, 1005354, 1005417, 1005480, 1005543, 1005606, 1005669, 1005732, 1005795, 1005858, 1005921, 1005984, 1006047, 1006110, 1006173, 1006236, 1006299, 1006362, 1006425, 1006488, 1006551, 1006614, 1006677, 1006740, 1006803, 1006866, 1006929, 1006992, 1007055, 1007118, 1007181, 1007244, 1007307, 1007370, 1007433, 1007496, 1007559, 1007622, 1007685, 1007748, 1007811, 1007874, 1007937, 1008000]\n assert candidate(candies = 1,num_people = 1) == [1]\n assert candidate(candies = 50,num_people = 5) == [7, 9, 11, 13, 10]\n assert candidate(candies = 20,num_people = 5) == [6, 2, 3, 4, 5]\n assert candidate(candies = 1000,num_people = 100) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(candies = 10,num_people = 5) == [1, 2, 3, 4, 0]\n assert candidate(candies = 7,num_people = 4) == [1, 2, 3, 1]\n assert candidate(candies = 1000000000,num_people = 1000) == [990045, 990090, 990135, 990180, 990225, 990270, 990315, 990360, 990405, 990450, 990495, 990540, 990585, 990630, 990675, 990720, 990765, 990810, 990855, 990900, 990945, 990990, 991035, 991080, 991125, 991170, 991215, 991260, 991305, 991350, 991395, 991440, 991485, 991530, 991575, 991620, 991665, 991710, 991755, 991800, 991845, 991890, 991935, 991980, 992025, 992070, 992115, 992160, 992205, 992250, 992295, 992340, 992385, 992430, 992475, 992520, 992565, 992610, 992655, 992700, 992745, 992790, 992835, 992880, 992925, 992970, 993015, 993060, 993105, 993150, 993195, 993240, 993285, 993330, 993375, 993420, 993465, 993510, 993555, 993600, 993645, 993690, 993735, 993780, 993825, 993870, 993915, 993960, 994005, 994050, 994095, 994140, 994185, 994230, 994275, 994320, 994365, 994410, 994455, 994500, 994545, 994590, 994635, 994680, 994725, 994770, 994815, 994860, 994905, 994950, 994995, 995040, 995085, 995130, 995175, 995220, 995265, 995310, 995355, 995400, 995445, 995490, 995535, 995580, 995625, 995670, 995715, 995760, 995805, 995850, 995895, 995940, 995985, 996030, 996075, 996120, 996165, 996210, 996255, 996300, 996345, 996390, 996435, 996480, 996525, 996570, 996615, 996660, 996705, 996750, 996795, 996840, 996885, 996930, 996975, 997020, 997065, 997110, 997155, 997200, 997245, 997290, 997335, 997380, 997425, 997470, 997515, 997560, 997605, 997650, 997695, 997740, 997785, 997830, 997875, 997920, 997965, 998010, 998055, 998100, 998145, 998190, 998235, 998280, 998325, 998370, 998415, 998460, 998505, 998550, 998595, 998640, 998685, 998730, 998775, 998820, 998865, 998910, 998955, 999000, 999045, 999090, 999135, 999180, 999225, 999270, 999315, 999360, 999405, 999450, 999495, 999540, 999585, 999630, 999675, 999720, 999765, 999810, 999855, 999900, 999945, 999990, 1000035, 1000080, 1000125, 1000170, 1000215, 1000260, 1000305, 1000350, 1000395, 1000440, 1000485, 1000530, 1000575, 1000620, 1000665, 1000710, 1000755, 1000800, 1000845, 1000890, 1000935, 1000980, 1001025, 1001070, 1001115, 1001160, 1001205, 1001250, 1001295, 1001340, 1001385, 1001430, 1001475, 1001520, 1001565, 1001610, 1001655, 1001700, 1001745, 1001790, 1001835, 1001880, 1001925, 1001970, 1002015, 1002060, 1002105, 1002150, 1002195, 1002240, 1002285, 1002330, 1002375, 1002420, 1002465, 1002510, 1002555, 1002600, 1002645, 1002690, 1002735, 1002780, 1002825, 1002870, 1002915, 1002960, 1003005, 1003050, 1003095, 1003140, 1003185, 1003230, 1003275, 1003320, 1003365, 1003410, 1003455, 1003500, 1003545, 1003590, 1003635, 1003680, 1003725, 1003770, 1003815, 1003860, 1003905, 1003950, 1003995, 1004040, 1004085, 1004130, 1004175, 1004220, 1004265, 1004310, 1004355, 1004400, 1004445, 1004490, 1004535, 1004580, 1004625, 1004670, 1004715, 1004760, 1004805, 1004850, 1004895, 1004940, 1004985, 1005030, 1005075, 1005120, 1005165, 1005210, 1005255, 1005300, 1005345, 1005390, 1005435, 1005480, 1005525, 1005570, 1005615, 1005660, 1005705, 1005750, 1005795, 1005840, 1005885, 1005930, 1005975, 1006020, 1006065, 1006110, 1006155, 1006200, 1006245, 1006290, 1006335, 1006380, 1006425, 1006470, 1006515, 1006560, 1006605, 1006650, 1006695, 1006740, 1006785, 1006830, 1006875, 1006920, 1006965, 1007010, 1007055, 1007100, 1007145, 1007190, 1007235, 1007280, 1007325, 1007370, 1007415, 1007460, 1007505, 1007550, 1007595, 1007640, 1007685, 1007730, 1007775, 1007820, 1007865, 1007910, 1007955, 1008000, 1008045, 1008090, 1008135, 1008180, 1008225, 1008270, 1008315, 1008360, 1008405, 1008450, 1008495, 1008540, 1008585, 1008630, 1008675, 1008720, 1008765, 1008810, 1008855, 1008900, 1008945, 1008990, 1009035, 1009080, 1009125, 1009170, 1009215, 1009260, 1009305, 1009350, 1009395, 1009440, 1009485, 1009530, 1009575, 1009620, 1009665, 1009710, 1009755, 1009800, 1009845, 1009890, 1009935, 1009980, 1010025, 1010070, 1010115, 1010160, 1010205, 1010250, 1010295, 1010340, 1010385, 1010430, 1010475, 1010520, 1010565, 1010610, 1010655, 1010700, 1010745, 1010790, 1010835, 1010880, 1010925, 1010970, 1011015, 1011060, 1011105, 1011150, 1011195, 1011240, 1011285, 1011330, 1011375, 1011420, 1011465, 1011510, 1011555, 1011600, 1011645, 1011690, 1011735, 1011780, 1011825, 1011870, 1011915, 1011960, 1012005, 1012050, 1012095, 1012140, 1012185, 1012230, 1012275, 1012320, 1012365, 1012410, 1012455, 1012500, 1012545, 1012590, 1012635, 1012680, 1012725, 1012770, 1012815, 1012860, 1012905, 1012950, 1012995, 1013040, 1013085, 1013130, 1013175, 1013220, 1013265, 1013310, 1013355, 1013400, 1013445, 1013490, 1013535, 1013580, 1013625, 1013670, 1013715, 1013760, 1013805, 1013850, 1013895, 1013940, 1013985, 1014030, 1014075, 1014120, 1014165, 1014210, 1014255, 1014300, 1014345, 1014390, 1014435, 1014480, 1014525, 1014570, 1014615, 1014660, 1014705, 1014750, 1014795, 1014840, 1014885, 1014930, 1014975, 1015020, 1015065, 1015110, 1015155, 1015200, 1015245, 1015290, 1015335, 1015380, 1015425, 1015470, 1015515, 1015560, 1015605, 1015650, 1015695, 1015740, 1015785, 1015830, 1015875, 1015920, 1015965, 1016010, 1016055, 1016100, 1016145, 1016190, 1016235, 1016280, 1016325, 1016370, 1016415, 1016460, 1016505, 1016550, 1016595, 1016640, 1016685, 1016730, 1016775, 1016820, 1016865, 1016910, 1016955, 1017000, 1017045, 1017090, 1017135, 1017180, 1017225, 1017270, 1017315, 1017360, 1017405, 1017450, 1017495, 1017540, 1017585, 1017630, 1017675, 1017720, 1017765, 1017810, 1017855, 1017900, 1017945, 1017990, 1018035, 1018080, 1018125, 1018170, 1018215, 1018260, 1018305, 1018350, 1018395, 1018440, 1018485, 1018530, 1018575, 1018620, 1018665, 1018710, 1018755, 1018800, 1018845, 1018890, 1018935, 1018980, 1019025, 1019070, 1019115, 1019160, 1019205, 1019250, 1019295, 1019340, 1019385, 1019430, 1019475, 1019520, 1019565, 1019610, 1019655, 1019700, 1019745, 1019790, 1019835, 1019880, 1019925, 1019970, 1020015, 1020060, 1020105, 1020150, 1020195, 1020240, 1020285, 1020330, 1020375, 1020420, 1020465, 1020510, 1020555, 1020600, 1020645, 1020690, 1020735, 1020780, 1020825, 1020870, 1020915, 1020960, 1021005, 1021050, 1021095, 1021140, 1021185, 1021230, 1021275, 1021320, 1021365, 1021410, 1021455, 1021500, 1021545, 1021590, 1021635, 1021680, 1021725, 1021770, 1021815, 1021860, 1021905, 1021950, 1021995, 1022040, 1022085, 1022130, 1022175, 1022220, 1022265, 1022310, 1022355, 1022400, 1016164, 977768, 977812, 977856, 977900, 977944, 977988, 978032, 978076, 978120, 978164, 978208, 978252, 978296, 978340, 978384, 978428, 978472, 978516, 978560, 978604, 978648, 978692, 978736, 978780, 978824, 978868, 978912, 978956, 979000, 979044, 979088, 979132, 979176, 979220, 979264, 979308, 979352, 979396, 979440, 979484, 979528, 979572, 979616, 979660, 979704, 979748, 979792, 979836, 979880, 979924, 979968, 980012, 980056, 980100, 980144, 980188, 980232, 980276, 980320, 980364, 980408, 980452, 980496, 980540, 980584, 980628, 980672, 980716, 980760, 980804, 980848, 980892, 980936, 980980, 981024, 981068, 981112, 981156, 981200, 981244, 981288, 981332, 981376, 981420, 981464, 981508, 981552, 981596, 981640, 981684, 981728, 981772, 981816, 981860, 981904, 981948, 981992, 982036, 982080, 982124, 982168, 982212, 982256, 982300, 982344, 982388, 982432, 982476, 982520, 982564, 982608, 982652, 982696, 982740, 982784, 982828, 982872, 982916, 982960, 983004, 983048, 983092, 983136, 983180, 983224, 983268, 983312, 983356, 983400, 983444, 983488, 983532, 983576, 983620, 983664, 983708, 983752, 983796, 983840, 983884, 983928, 983972, 984016, 984060, 984104, 984148, 984192, 984236, 984280, 984324, 984368, 984412, 984456, 984500, 984544, 984588, 984632, 984676, 984720, 984764, 984808, 984852, 984896, 984940, 984984, 985028, 985072, 985116, 985160, 985204, 985248, 985292, 985336, 985380, 985424, 985468, 985512, 985556, 985600, 985644, 985688, 985732, 985776, 985820, 985864, 985908, 985952, 985996, 986040, 986084, 986128, 986172, 986216, 986260, 986304, 986348, 986392, 986436, 986480, 986524, 986568, 986612, 986656, 986700, 986744, 986788, 986832, 986876, 986920, 986964, 987008, 987052, 987096, 987140, 987184, 987228, 987272, 987316, 987360, 987404, 987448, 987492, 987536, 987580, 987624, 987668, 987712, 987756, 987800, 987844, 987888, 987932, 987976, 988020, 988064, 988108, 988152, 988196, 988240, 988284, 988328, 988372, 988416, 988460, 988504, 988548, 988592, 988636, 988680, 988724, 988768, 988812, 988856, 988900, 988944, 988988, 989032, 989076, 989120, 989164, 989208, 989252, 989296, 989340, 989384, 989428, 989472, 989516, 989560, 989604, 989648, 989692, 989736, 989780, 989824, 989868, 989912, 989956, 990000]\n assert candidate(candies = 10,num_people = 3) == [5, 2, 3]\n assert candidate(candies = 100,num_people = 10) == [12, 14, 16, 13, 5, 6, 7, 8, 9, 10]\n assert candidate(candies = 20,num_people = 4) == [6, 7, 3, 4]\n assert candidate(candies = 500,num_people = 15) == [48, 23, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45]\n assert candidate(candies = 150,num_people = 5) == [34, 35, 24, 27, 30]\n assert candidate(candies = 99,num_people = 5) == [18, 21, 24, 21, 15]\n assert candidate(candies = 1000,num_people = 1) == [1000]\n assert candidate(candies = 100,num_people = 1) == [100]\n assert candidate(candies = 890123456,num_people = 456) == [1950861, 1950954, 1951047, 1951140, 1951233, 1951326, 1951419, 1951512, 1951605, 1951698, 1951791, 1951884, 1951977, 1952070, 1952163, 1952256, 1952349, 1952442, 1952535, 1952628, 1952721, 1952814, 1952907, 1953000, 1953093, 1953186, 1953279, 1953372, 1953465, 1953558, 1953651, 1953744, 1953837, 1953930, 1954023, 1954116, 1954209, 1954302, 1954395, 1954488, 1954581, 1954674, 1954767, 1954860, 1954953, 1955046, 1955139, 1955232, 1955325, 1955418, 1955511, 1955604, 1955697, 1955790, 1955883, 1955976, 1956069, 1956162, 1956255, 1956348, 1956441, 1956534, 1956627, 1956720, 1956813, 1956906, 1956999, 1957092, 1957185, 1957278, 1957371, 1957464, 1957557, 1957650, 1957743, 1957836, 1957929, 1958022, 1958115, 1958208, 1958301, 1958394, 1958487, 1958580, 1958673, 1958766, 1958859, 1958952, 1959045, 1959138, 1959231, 1959324, 1959417, 1959510, 1959603, 1959696, 1959789, 1959882, 1959975, 1960068, 1960161, 1960254, 1960347, 1960440, 1960533, 1960626, 1960719, 1960812, 1960905, 1960998, 1961091, 1961184, 1961277, 1961370, 1961463, 1961556, 1961649, 1961742, 1961835, 1961928, 1962021, 1962114, 1962207, 1962300, 1962393, 1962486, 1962579, 1962672, 1962765, 1962858, 1962951, 1963044, 1963137, 1963230, 1963323, 1963416, 1963509, 1963602, 1963695, 1963788, 1963881, 1963974, 1964067, 1964160, 1964253, 1964346, 1964439, 1964532, 1964625, 1964718, 1964811, 1964904, 1964997, 1965090, 1965183, 1965276, 1965369, 1965462, 1965555, 1965648, 1965741, 1965834, 1965927, 1966020, 1966113, 1966206, 1966299, 1966392, 1966485, 1966578, 1966671, 1966764, 1966857, 1966950, 1967043, 1967136, 1967229, 1967322, 1967415, 1967508, 1967601, 1967694, 1967787, 1967880, 1967973, 1968066, 1968159, 1968252, 1968345, 1968438, 1968531, 1968624, 1968717, 1968810, 1968903, 1968996, 1969089, 1969182, 1969275, 1969368, 1969461, 1969554, 1969647, 1969740, 1969833, 1969926, 1970019, 1970112, 1970205, 1970298, 1970391, 1970484, 1970577, 1970670, 1970763, 1970856, 1970949, 1971042, 1971135, 1971228, 1971321, 1971414, 1971507, 1971600, 1971693, 1971786, 1971879, 1971972, 1972065, 1972158, 1972251, 1972344, 1972437, 1972530, 1972623, 1972716, 1972809, 1972902, 1972995, 1973088, 1950916, 1931080, 1931172, 1931264, 1931356, 1931448, 1931540, 1931632, 1931724, 1931816, 1931908, 1932000, 1932092, 1932184, 1932276, 1932368, 1932460, 1932552, 1932644, 1932736, 1932828, 1932920, 1933012, 1933104, 1933196, 1933288, 1933380, 1933472, 1933564, 1933656, 1933748, 1933840, 1933932, 1934024, 1934116, 1934208, 1934300, 1934392, 1934484, 1934576, 1934668, 1934760, 1934852, 1934944, 1935036, 1935128, 1935220, 1935312, 1935404, 1935496, 1935588, 1935680, 1935772, 1935864, 1935956, 1936048, 1936140, 1936232, 1936324, 1936416, 1936508, 1936600, 1936692, 1936784, 1936876, 1936968, 1937060, 1937152, 1937244, 1937336, 1937428, 1937520, 1937612, 1937704, 1937796, 1937888, 1937980, 1938072, 1938164, 1938256, 1938348, 1938440, 1938532, 1938624, 1938716, 1938808, 1938900, 1938992, 1939084, 1939176, 1939268, 1939360, 1939452, 1939544, 1939636, 1939728, 1939820, 1939912, 1940004, 1940096, 1940188, 1940280, 1940372, 1940464, 1940556, 1940648, 1940740, 1940832, 1940924, 1941016, 1941108, 1941200, 1941292, 1941384, 1941476, 1941568, 1941660, 1941752, 1941844, 1941936, 1942028, 1942120, 1942212, 1942304, 1942396, 1942488, 1942580, 1942672, 1942764, 1942856, 1942948, 1943040, 1943132, 1943224, 1943316, 1943408, 1943500, 1943592, 1943684, 1943776, 1943868, 1943960, 1944052, 1944144, 1944236, 1944328, 1944420, 1944512, 1944604, 1944696, 1944788, 1944880, 1944972, 1945064, 1945156, 1945248, 1945340, 1945432, 1945524, 1945616, 1945708, 1945800, 1945892, 1945984, 1946076, 1946168, 1946260, 1946352, 1946444, 1946536, 1946628, 1946720, 1946812, 1946904, 1946996, 1947088, 1947180, 1947272, 1947364, 1947456, 1947548, 1947640, 1947732, 1947824, 1947916, 1948008, 1948100, 1948192, 1948284, 1948376, 1948468, 1948560, 1948652, 1948744, 1948836, 1948928, 1949020, 1949112, 1949204, 1949296, 1949388, 1949480, 1949572, 1949664, 1949756, 1949848, 1949940, 1950032, 1950124, 1950216, 1950308, 1950400, 1950492, 1950584, 1950676, 1950768]\n assert candidate(candies = 888888888,num_people = 999) == [902140, 902183, 902226, 902269, 902312, 902355, 902398, 902441, 902484, 902527, 902570, 902613, 902656, 902699, 902742, 902785, 902828, 902871, 902914, 902957, 903000, 903043, 903086, 903129, 903172, 903215, 903258, 903301, 903344, 903387, 903430, 903473, 903516, 903559, 903602, 903645, 903688, 903731, 903774, 903817, 903860, 903903, 903946, 903989, 904032, 904075, 904118, 904161, 904204, 904247, 904290, 904333, 904376, 904419, 904462, 904505, 904548, 904591, 904634, 904677, 904720, 904763, 904806, 904849, 904892, 904935, 904978, 905021, 905064, 905107, 905150, 905193, 905236, 905279, 905322, 905365, 905408, 905451, 905494, 905537, 905580, 905623, 905666, 905709, 905752, 905795, 905838, 905881, 905924, 905967, 906010, 906053, 906096, 906139, 906182, 906225, 906268, 906311, 906354, 906397, 906440, 906483, 906526, 906569, 906612, 906655, 906698, 906741, 906784, 906827, 906870, 906913, 906956, 906999, 907042, 907085, 907128, 907171, 907214, 907257, 907300, 907343, 907386, 907429, 907472, 907515, 907558, 907601, 907644, 907687, 907730, 907773, 907816, 907859, 907902, 907945, 907988, 908031, 908074, 908117, 908160, 908203, 908246, 908289, 908332, 908375, 908418, 908461, 908504, 908547, 908590, 908633, 908676, 908719, 908762, 908805, 908848, 908891, 908934, 908977, 909020, 909063, 909106, 909149, 909192, 909235, 909278, 909321, 909364, 909407, 909450, 909493, 909536, 909579, 909622, 909665, 909708, 909751, 909794, 909837, 909880, 909923, 909966, 910009, 910052, 910095, 910138, 910181, 910224, 910267, 910310, 910353, 910396, 910439, 910482, 910525, 910568, 910611, 910654, 910697, 910740, 910783, 910826, 910869, 910912, 877313, 868833, 868875, 868917, 868959, 869001, 869043, 869085, 869127, 869169, 869211, 869253, 869295, 869337, 869379, 869421, 869463, 869505, 869547, 869589, 869631, 869673, 869715, 869757, 869799, 869841, 869883, 869925, 869967, 870009, 870051, 870093, 870135, 870177, 870219, 870261, 870303, 870345, 870387, 870429, 870471, 870513, 870555, 870597, 870639, 870681, 870723, 870765, 870807, 870849, 870891, 870933, 870975, 871017, 871059, 871101, 871143, 871185, 871227, 871269, 871311, 871353, 871395, 871437, 871479, 871521, 871563, 871605, 871647, 871689, 871731, 871773, 871815, 871857, 871899, 871941, 871983, 872025, 872067, 872109, 872151, 872193, 872235, 872277, 872319, 872361, 872403, 872445, 872487, 872529, 872571, 872613, 872655, 872697, 872739, 872781, 872823, 872865, 872907, 872949, 872991, 873033, 873075, 873117, 873159, 873201, 873243, 873285, 873327, 873369, 873411, 873453, 873495, 873537, 873579, 873621, 873663, 873705, 873747, 873789, 873831, 873873, 873915, 873957, 873999, 874041, 874083, 874125, 874167, 874209, 874251, 874293, 874335, 874377, 874419, 874461, 874503, 874545, 874587, 874629, 874671, 874713, 874755, 874797, 874839, 874881, 874923, 874965, 875007, 875049, 875091, 875133, 875175, 875217, 875259, 875301, 875343, 875385, 875427, 875469, 875511, 875553, 875595, 875637, 875679, 875721, 875763, 875805, 875847, 875889, 875931, 875973, 876015, 876057, 876099, 876141, 876183, 876225, 876267, 876309, 876351, 876393, 876435, 876477, 876519, 876561, 876603, 876645, 876687, 876729, 876771, 876813, 876855, 876897, 876939, 876981, 877023, 877065, 877107, 877149, 877191, 877233, 877275, 877317, 877359, 877401, 877443, 877485, 877527, 877569, 877611, 877653, 877695, 877737, 877779, 877821, 877863, 877905, 877947, 877989, 878031, 878073, 878115, 878157, 878199, 878241, 878283, 878325, 878367, 878409, 878451, 878493, 878535, 878577, 878619, 878661, 878703, 878745, 878787, 878829, 878871, 878913, 878955, 878997, 879039, 879081, 879123, 879165, 879207, 879249, 879291, 879333, 879375, 879417, 879459, 879501, 879543, 879585, 879627, 879669, 879711, 879753, 879795, 879837, 879879, 879921, 879963, 880005, 880047, 880089, 880131, 880173, 880215, 880257, 880299, 880341, 880383, 880425, 880467, 880509, 880551, 880593, 880635, 880677, 880719, 880761, 880803, 880845, 880887, 880929, 880971, 881013, 881055, 881097, 881139, 881181, 881223, 881265, 881307, 881349, 881391, 881433, 881475, 881517, 881559, 881601, 881643, 881685, 881727, 881769, 881811, 881853, 881895, 881937, 881979, 882021, 882063, 882105, 882147, 882189, 882231, 882273, 882315, 882357, 882399, 882441, 882483, 882525, 882567, 882609, 882651, 882693, 882735, 882777, 882819, 882861, 882903, 882945, 882987, 883029, 883071, 883113, 883155, 883197, 883239, 883281, 883323, 883365, 883407, 883449, 883491, 883533, 883575, 883617, 883659, 883701, 883743, 883785, 883827, 883869, 883911, 883953, 883995, 884037, 884079, 884121, 884163, 884205, 884247, 884289, 884331, 884373, 884415, 884457, 884499, 884541, 884583, 884625, 884667, 884709, 884751, 884793, 884835, 884877, 884919, 884961, 885003, 885045, 885087, 885129, 885171, 885213, 885255, 885297, 885339, 885381, 885423, 885465, 885507, 885549, 885591, 885633, 885675, 885717, 885759, 885801, 885843, 885885, 885927, 885969, 886011, 886053, 886095, 886137, 886179, 886221, 886263, 886305, 886347, 886389, 886431, 886473, 886515, 886557, 886599, 886641, 886683, 886725, 886767, 886809, 886851, 886893, 886935, 886977, 887019, 887061, 887103, 887145, 887187, 887229, 887271, 887313, 887355, 887397, 887439, 887481, 887523, 887565, 887607, 887649, 887691, 887733, 887775, 887817, 887859, 887901, 887943, 887985, 888027, 888069, 888111, 888153, 888195, 888237, 888279, 888321, 888363, 888405, 888447, 888489, 888531, 888573, 888615, 888657, 888699, 888741, 888783, 888825, 888867, 888909, 888951, 888993, 889035, 889077, 889119, 889161, 889203, 889245, 889287, 889329, 889371, 889413, 889455, 889497, 889539, 889581, 889623, 889665, 889707, 889749, 889791, 889833, 889875, 889917, 889959, 890001, 890043, 890085, 890127, 890169, 890211, 890253, 890295, 890337, 890379, 890421, 890463, 890505, 890547, 890589, 890631, 890673, 890715, 890757, 890799, 890841, 890883, 890925, 890967, 891009, 891051, 891093, 891135, 891177, 891219, 891261, 891303, 891345, 891387, 891429, 891471, 891513, 891555, 891597, 891639, 891681, 891723, 891765, 891807, 891849, 891891, 891933, 891975, 892017, 892059, 892101, 892143, 892185, 892227, 892269, 892311, 892353, 892395, 892437, 892479, 892521, 892563, 892605, 892647, 892689, 892731, 892773, 892815, 892857, 892899, 892941, 892983, 893025, 893067, 893109, 893151, 893193, 893235, 893277, 893319, 893361, 893403, 893445, 893487, 893529, 893571, 893613, 893655, 893697, 893739, 893781, 893823, 893865, 893907, 893949, 893991, 894033, 894075, 894117, 894159, 894201, 894243, 894285, 894327, 894369, 894411, 894453, 894495, 894537, 894579, 894621, 894663, 894705, 894747, 894789, 894831, 894873, 894915, 894957, 894999, 895041, 895083, 895125, 895167, 895209, 895251, 895293, 895335, 895377, 895419, 895461, 895503, 895545, 895587, 895629, 895671, 895713, 895755, 895797, 895839, 895881, 895923, 895965, 896007, 896049, 896091, 896133, 896175, 896217, 896259, 896301, 896343, 896385, 896427, 896469, 896511, 896553, 896595, 896637, 896679, 896721, 896763, 896805, 896847, 896889, 896931, 896973, 897015, 897057, 897099, 897141, 897183, 897225, 897267, 897309, 897351, 897393, 897435, 897477, 897519, 897561, 897603, 897645, 897687, 897729, 897771, 897813, 897855, 897897, 897939, 897981, 898023, 898065, 898107, 898149, 898191, 898233, 898275, 898317, 898359, 898401, 898443, 898485, 898527, 898569, 898611, 898653, 898695, 898737, 898779, 898821, 898863, 898905, 898947, 898989, 899031, 899073, 899115, 899157, 899199, 899241, 899283, 899325, 899367, 899409, 899451, 899493, 899535, 899577, 899619, 899661, 899703, 899745, 899787, 899829, 899871, 899913, 899955, 899997, 900039, 900081, 900123, 900165, 900207, 900249, 900291, 900333, 900375, 900417, 900459, 900501, 900543, 900585, 900627, 900669, 900711, 900753, 900795, 900837, 900879, 900921, 900963, 901005, 901047, 901089, 901131, 901173, 901215, 901257, 901299, 901341, 901383, 901425, 901467, 901509, 901551, 901593, 901635, 901677, 901719, 901761, 901803, 901845, 901887, 901929, 901971, 902013, 902055, 902097]\n assert candidate(candies = 1000000000,num_people = 2) == [500008040, 499991960]\n assert candidate(candies = 1,num_people = 10) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(candies = 50,num_people = 8) == [10, 7, 3, 4, 5, 6, 7, 8]\n assert candidate(candies = 999999999,num_people = 500) == [2002590, 2002680, 2002770, 2002860, 2002950, 2003040, 2003130, 2003220, 2003310, 2003400, 2003490, 2003580, 2003670, 2003760, 2003850, 2003940, 2004030, 2004120, 2004210, 2004300, 2004390, 2004480, 2004570, 2004660, 2004750, 2004840, 2004930, 2005020, 2005110, 2005200, 2005290, 2005380, 2005470, 2005560, 2005650, 2005740, 2005830, 2005920, 2006010, 2006100, 2006190, 2006280, 2006370, 2006460, 2006550, 2006640, 2006730, 2006820, 2006910, 2007000, 2007090, 2007180, 2007270, 2007360, 2007450, 2007540, 2007630, 2007720, 2007810, 2007900, 2007990, 2008080, 2008170, 2008260, 2008350, 2008440, 2008530, 2008620, 2008710, 2008800, 2008890, 2008980, 2009070, 2009160, 2009250, 2009340, 2009430, 2009520, 2009610, 2009700, 2009790, 2009880, 2009970, 2010060, 2010150, 2010240, 2010330, 2010420, 2010510, 2010600, 2010690, 2010780, 2010870, 2010960, 2011050, 2011140, 2011230, 2011320, 2011410, 2011500, 2011590, 2011680, 2011770, 2011860, 2011950, 2012040, 2012130, 2012220, 2012310, 2012400, 2012490, 2012580, 2012670, 2012760, 2012850, 2012940, 2013030, 2013120, 2013210, 2013300, 2013390, 2013480, 2013570, 2013660, 2013750, 2013840, 2013930, 2014020, 2014110, 2014200, 2014290, 2014380, 2014470, 2014560, 2014650, 2014740, 2014830, 2014920, 2015010, 2015100, 2015190, 2015280, 2015370, 2015460, 2015550, 2015640, 2015730, 2015820, 2015910, 2016000, 2016090, 2016180, 2016270, 2016360, 2016450, 2016540, 2016630, 2016720, 2016810, 2016900, 2016990, 2017080, 2017170, 2017260, 2017350, 2017440, 2017530, 2017620, 2017710, 2017800, 2017890, 2017980, 2018070, 2018160, 2018250, 2018340, 2018430, 2018520, 2018610, 2018700, 2018790, 2018880, 2018970, 2019060, 2019150, 2019240, 2019330, 2019420, 2019510, 2019600, 2019690, 2019780, 2019870, 2019960, 2020050, 2020140, 2020230, 2020320, 2020410, 2020500, 2020590, 2020680, 2020770, 2020860, 2020950, 2021040, 2021130, 2021220, 2021310, 2021400, 2021490, 2021580, 2021670, 2021760, 2021850, 2021940, 2022030, 2022120, 2022210, 2022300, 2016108, 1977758, 1977847, 1977936, 1978025, 1978114, 1978203, 1978292, 1978381, 1978470, 1978559, 1978648, 1978737, 1978826, 1978915, 1979004, 1979093, 1979182, 1979271, 1979360, 1979449, 1979538, 1979627, 1979716, 1979805, 1979894, 1979983, 1980072, 1980161, 1980250, 1980339, 1980428, 1980517, 1980606, 1980695, 1980784, 1980873, 1980962, 1981051, 1981140, 1981229, 1981318, 1981407, 1981496, 1981585, 1981674, 1981763, 1981852, 1981941, 1982030, 1982119, 1982208, 1982297, 1982386, 1982475, 1982564, 1982653, 1982742, 1982831, 1982920, 1983009, 1983098, 1983187, 1983276, 1983365, 1983454, 1983543, 1983632, 1983721, 1983810, 1983899, 1983988, 1984077, 1984166, 1984255, 1984344, 1984433, 1984522, 1984611, 1984700, 1984789, 1984878, 1984967, 1985056, 1985145, 1985234, 1985323, 1985412, 1985501, 1985590, 1985679, 1985768, 1985857, 1985946, 1986035, 1986124, 1986213, 1986302, 1986391, 1986480, 1986569, 1986658, 1986747, 1986836, 1986925, 1987014, 1987103, 1987192, 1987281, 1987370, 1987459, 1987548, 1987637, 1987726, 1987815, 1987904, 1987993, 1988082, 1988171, 1988260, 1988349, 1988438, 1988527, 1988616, 1988705, 1988794, 1988883, 1988972, 1989061, 1989150, 1989239, 1989328, 1989417, 1989506, 1989595, 1989684, 1989773, 1989862, 1989951, 1990040, 1990129, 1990218, 1990307, 1990396, 1990485, 1990574, 1990663, 1990752, 1990841, 1990930, 1991019, 1991108, 1991197, 1991286, 1991375, 1991464, 1991553, 1991642, 1991731, 1991820, 1991909, 1991998, 1992087, 1992176, 1992265, 1992354, 1992443, 1992532, 1992621, 1992710, 1992799, 1992888, 1992977, 1993066, 1993155, 1993244, 1993333, 1993422, 1993511, 1993600, 1993689, 1993778, 1993867, 1993956, 1994045, 1994134, 1994223, 1994312, 1994401, 1994490, 1994579, 1994668, 1994757, 1994846, 1994935, 1995024, 1995113, 1995202, 1995291, 1995380, 1995469, 1995558, 1995647, 1995736, 1995825, 1995914, 1996003, 1996092, 1996181, 1996270, 1996359, 1996448, 1996537, 1996626, 1996715, 1996804, 1996893, 1996982, 1997071, 1997160, 1997249, 1997338, 1997427, 1997516, 1997605, 1997694, 1997783, 1997872, 1997961, 1998050, 1998139, 1998228, 1998317, 1998406, 1998495, 1998584, 1998673, 1998762, 1998851, 1998940, 1999029, 1999118, 1999207, 1999296, 1999385, 1999474, 1999563, 1999652, 1999741, 1999830, 1999919, 2000008, 2000097, 2000186, 2000275, 2000364, 2000453, 2000542, 2000631, 2000720, 2000809, 2000898, 2000987, 2001076, 2001165, 2001254, 2001343, 2001432, 2001521, 2001610, 2001699, 2001788, 2001877, 2001966, 2002055, 2002144, 2002233, 2002322, 2002411, 2002500]\n assert candidate(candies = 987654321,num_people = 999) == [989055, 989100, 989145, 989190, 989235, 989280, 989325, 989370, 989415, 989460, 989505, 989550, 989595, 989640, 989685, 989730, 989775, 989820, 989865, 989910, 989955, 990000, 990045, 990090, 990135, 990180, 990225, 990270, 990315, 990360, 990405, 990450, 990495, 990540, 990585, 990630, 990675, 990720, 990765, 990810, 990855, 990900, 990945, 990990, 991035, 991080, 991125, 991170, 991215, 991260, 991305, 991350, 991395, 991440, 991485, 991530, 991575, 991620, 991665, 991710, 991755, 991800, 991845, 991890, 991935, 991980, 992025, 992070, 992115, 992160, 992205, 992250, 992295, 992340, 992385, 992430, 992475, 992520, 992565, 992610, 992655, 992700, 992745, 992790, 992835, 992880, 992925, 992970, 993015, 993060, 993105, 993150, 993195, 993240, 993285, 993330, 993375, 993420, 993465, 993510, 993555, 993600, 993645, 993690, 993735, 993780, 993825, 993870, 993915, 993960, 994005, 994050, 994095, 994140, 994185, 994230, 994275, 994320, 994365, 994410, 994455, 994500, 994545, 994590, 994635, 994680, 994725, 994770, 994815, 994860, 994905, 994950, 994995, 995040, 995085, 995130, 995175, 995220, 995265, 995310, 995355, 995400, 995445, 995490, 995535, 995580, 995625, 995670, 995715, 995760, 995805, 995850, 995895, 995940, 995985, 996030, 996075, 996120, 996165, 996210, 996255, 996300, 996345, 996390, 996435, 996480, 996525, 996570, 996615, 996660, 996705, 996750, 996795, 996840, 996885, 996930, 996975, 997020, 997065, 997110, 997155, 997200, 997245, 997290, 997335, 997380, 997425, 997470, 997515, 997560, 997605, 997650, 997695, 997740, 997785, 997830, 997875, 997920, 997965, 998010, 998055, 998100, 998145, 998190, 998235, 998280, 998325, 998370, 998415, 998460, 998505, 998550, 998595, 998640, 998685, 998730, 998775, 998820, 998865, 998910, 998955, 999000, 999045, 999090, 999135, 999180, 999225, 999270, 999315, 999360, 999405, 999450, 999495, 999540, 999585, 999630, 999675, 999720, 999765, 999810, 999855, 999900, 999945, 999990, 1000035, 1000080, 1000125, 1000170, 1000215, 1000260, 1000305, 1000350, 1000395, 1000440, 1000485, 1000530, 1000575, 1000620, 1000665, 1000710, 1000755, 1000800, 1000845, 1000890, 1000935, 1000980, 1001025, 1001070, 1001115, 1001160, 1001205, 1001250, 1001295, 1001340, 1001385, 1001430, 1001475, 1001520, 1001565, 1001610, 1001655, 1001700, 1001745, 1001790, 1001835, 1001880, 1001925, 1001970, 1002015, 1002060, 1002105, 1002150, 1002195, 1002240, 1002285, 1002330, 1002375, 1002420, 1002465, 1002510, 1002555, 1002600, 1002645, 1002690, 1002735, 1002780, 1002825, 1002870, 1002915, 1002960, 1003005, 1003050, 1003095, 1003140, 1003185, 1003230, 1003275, 1003320, 1003365, 1003410, 1003455, 1003500, 1003545, 1003590, 1003635, 1003680, 1003725, 1003770, 1003815, 1003860, 1003905, 1003950, 1003995, 1004040, 1004085, 1004130, 1004175, 1004220, 1004265, 1004310, 1004355, 1004400, 1004445, 1004490, 1004535, 1004580, 1004625, 1004670, 1004715, 1004760, 1004805, 1004850, 1004895, 1004940, 1004985, 1005030, 1005075, 1005120, 1005165, 1005210, 1005255, 1005300, 1005345, 1005390, 1005435, 1005480, 1005525, 1005570, 1005615, 1005660, 1005705, 1005750, 1005795, 1005840, 1005885, 1005930, 1005975, 1006020, 1006065, 1006110, 1006155, 1006200, 1006245, 1006290, 1006335, 1006380, 1006425, 1006470, 1006515, 1006560, 1006605, 1006650, 1006695, 1006740, 1006785, 1006830, 1006875, 1006920, 1006965, 1007010, 1007055, 1007100, 1007145, 1007190, 1007235, 1007280, 1007325, 1007370, 1007415, 1007460, 1007505, 1007550, 1007595, 1007640, 1007685, 1007730, 1007775, 1007820, 1007865, 1007910, 1007955, 1008000, 1008045, 1008090, 1008135, 1008180, 1008225, 1008270, 1008315, 1008360, 1008405, 1008450, 1008495, 1008540, 1008585, 1008630, 1008675, 1008720, 1008765, 1008810, 1008855, 1008900, 1008945, 1008990, 1009035, 1009080, 1009125, 1009170, 1009215, 1009260, 1009305, 1009350, 1009395, 1009440, 1009485, 1009530, 1009575, 1009620, 1009665, 1009710, 1009755, 1009800, 1009845, 1009890, 1009935, 1009980, 1010025, 1010070, 1010115, 1010160, 1010205, 1010250, 1010295, 1010340, 1010385, 1010430, 1010475, 1010520, 1010565, 1010610, 1010655, 1010700, 1010745, 1010790, 1010835, 1010880, 1010925, 1008501, 966570, 966614, 966658, 966702, 966746, 966790, 966834, 966878, 966922, 966966, 967010, 967054, 967098, 967142, 967186, 967230, 967274, 967318, 967362, 967406, 967450, 967494, 967538, 967582, 967626, 967670, 967714, 967758, 967802, 967846, 967890, 967934, 967978, 968022, 968066, 968110, 968154, 968198, 968242, 968286, 968330, 968374, 968418, 968462, 968506, 968550, 968594, 968638, 968682, 968726, 968770, 968814, 968858, 968902, 968946, 968990, 969034, 969078, 969122, 969166, 969210, 969254, 969298, 969342, 969386, 969430, 969474, 969518, 969562, 969606, 969650, 969694, 969738, 969782, 969826, 969870, 969914, 969958, 970002, 970046, 970090, 970134, 970178, 970222, 970266, 970310, 970354, 970398, 970442, 970486, 970530, 970574, 970618, 970662, 970706, 970750, 970794, 970838, 970882, 970926, 970970, 971014, 971058, 971102, 971146, 971190, 971234, 971278, 971322, 971366, 971410, 971454, 971498, 971542, 971586, 971630, 971674, 971718, 971762, 971806, 971850, 971894, 971938, 971982, 972026, 972070, 972114, 972158, 972202, 972246, 972290, 972334, 972378, 972422, 972466, 972510, 972554, 972598, 972642, 972686, 972730, 972774, 972818, 972862, 972906, 972950, 972994, 973038, 973082, 973126, 973170, 973214, 973258, 973302, 973346, 973390, 973434, 973478, 973522, 973566, 973610, 973654, 973698, 973742, 973786, 973830, 973874, 973918, 973962, 974006, 974050, 974094, 974138, 974182, 974226, 974270, 974314, 974358, 974402, 974446, 974490, 974534, 974578, 974622, 974666, 974710, 974754, 974798, 974842, 974886, 974930, 974974, 975018, 975062, 975106, 975150, 975194, 975238, 975282, 975326, 975370, 975414, 975458, 975502, 975546, 975590, 975634, 975678, 975722, 975766, 975810, 975854, 975898, 975942, 975986, 976030, 976074, 976118, 976162, 976206, 976250, 976294, 976338, 976382, 976426, 976470, 976514, 976558, 976602, 976646, 976690, 976734, 976778, 976822, 976866, 976910, 976954, 976998, 977042, 977086, 977130, 977174, 977218, 977262, 977306, 977350, 977394, 977438, 977482, 977526, 977570, 977614, 977658, 977702, 977746, 977790, 977834, 977878, 977922, 977966, 978010, 978054, 978098, 978142, 978186, 978230, 978274, 978318, 978362, 978406, 978450, 978494, 978538, 978582, 978626, 978670, 978714, 978758, 978802, 978846, 978890, 978934, 978978, 979022, 979066, 979110, 979154, 979198, 979242, 979286, 979330, 979374, 979418, 979462, 979506, 979550, 979594, 979638, 979682, 979726, 979770, 979814, 979858, 979902, 979946, 979990, 980034, 980078, 980122, 980166, 980210, 980254, 980298, 980342, 980386, 980430, 980474, 980518, 980562, 980606, 980650, 980694, 980738, 980782, 980826, 980870, 980914, 980958, 981002, 981046, 981090, 981134, 981178, 981222, 981266, 981310, 981354, 981398, 981442, 981486, 981530, 981574, 981618, 981662, 981706, 981750, 981794, 981838, 981882, 981926, 981970, 982014, 982058, 982102, 982146, 982190, 982234, 982278, 982322, 982366, 982410, 982454, 982498, 982542, 982586, 982630, 982674, 982718, 982762, 982806, 982850, 982894, 982938, 982982, 983026, 983070, 983114, 983158, 983202, 983246, 983290, 983334, 983378, 983422, 983466, 983510, 983554, 983598, 983642, 983686, 983730, 983774, 983818, 983862, 983906, 983950, 983994, 984038, 984082, 984126, 984170, 984214, 984258, 984302, 984346, 984390, 984434, 984478, 984522, 984566, 984610, 984654, 984698, 984742, 984786, 984830, 984874, 984918, 984962, 985006, 985050, 985094, 985138, 985182, 985226, 985270, 985314, 985358, 985402, 985446, 985490, 985534, 985578, 985622, 985666, 985710, 985754, 985798, 985842, 985886, 985930, 985974, 986018, 986062, 986106, 986150, 986194, 986238, 986282, 986326, 986370, 986414, 986458, 986502, 986546, 986590, 986634, 986678, 986722, 986766, 986810, 986854, 986898, 986942, 986986, 987030, 987074, 987118, 987162, 987206, 987250, 987294, 987338, 987382, 987426, 987470, 987514, 987558, 987602, 987646, 987690, 987734, 987778, 987822, 987866, 987910, 987954, 987998, 988042, 988086, 988130, 988174, 988218, 988262, 988306, 988350, 988394, 988438, 988482, 988526, 988570, 988614, 988658, 988702, 988746, 988790, 988834, 988878, 988922, 988966, 989010]\n assert candidate(candies = 500,num_people = 1000) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(candies = 999999999,num_people = 999) == [989055, 989100, 989145, 989190, 989235, 989280, 989325, 989370, 989415, 989460, 989505, 989550, 989595, 989640, 989685, 989730, 989775, 989820, 989865, 989910, 989955, 990000, 990045, 990090, 990135, 990180, 990225, 990270, 990315, 990360, 990405, 990450, 990495, 990540, 990585, 990630, 990675, 990720, 990765, 990810, 990855, 990900, 990945, 990990, 991035, 991080, 991125, 991170, 991215, 991260, 991305, 991350, 991395, 991440, 991485, 991530, 991575, 991620, 991665, 991710, 991755, 991800, 991845, 991890, 991935, 991980, 992025, 992070, 992115, 992160, 992205, 992250, 992295, 992340, 992385, 992430, 992475, 992520, 992565, 992610, 992655, 992700, 992745, 992790, 992835, 992880, 992925, 992970, 993015, 993060, 993105, 993150, 993195, 993240, 993285, 993330, 993375, 993420, 993465, 993510, 993555, 993600, 993645, 993690, 993735, 993780, 993825, 993870, 993915, 993960, 994005, 994050, 994095, 994140, 994185, 994230, 994275, 994320, 994365, 994410, 994455, 994500, 994545, 994590, 994635, 994680, 994725, 994770, 994815, 994860, 994905, 994950, 994995, 995040, 995085, 995130, 995175, 995220, 995265, 995310, 995355, 995400, 995445, 995490, 995535, 995580, 995625, 995670, 995715, 995760, 995805, 995850, 995895, 995940, 995985, 996030, 996075, 996120, 996165, 996210, 996255, 996300, 996345, 996390, 996435, 996480, 996525, 996570, 996615, 996660, 996705, 996750, 996795, 996840, 996885, 996930, 996975, 997020, 997065, 997110, 997155, 997200, 997245, 997290, 997335, 997380, 997425, 997470, 997515, 997560, 997605, 997650, 997695, 997740, 997785, 997830, 997875, 997920, 997965, 998010, 998055, 998100, 998145, 998190, 998235, 998280, 998325, 998370, 998415, 998460, 998505, 998550, 998595, 998640, 998685, 998730, 998775, 998820, 998865, 998910, 998955, 999000, 999045, 999090, 999135, 999180, 999225, 999270, 999315, 999360, 999405, 999450, 999495, 999540, 999585, 999630, 999675, 999720, 999765, 999810, 999855, 999900, 999945, 999990, 1000035, 1000080, 1000125, 1000170, 1000215, 1000260, 1000305, 1000350, 1000395, 1000440, 1000485, 1000530, 1000575, 1000620, 1000665, 1000710, 1000755, 1000800, 1000845, 1000890, 1000935, 1000980, 1001025, 1001070, 1001115, 1001160, 1001205, 1001250, 1001295, 1001340, 1001385, 1001430, 1001475, 1001520, 1001565, 1001610, 1001655, 1001700, 1001745, 1001790, 1001835, 1001880, 1001925, 1001970, 1002015, 1002060, 1002105, 1002150, 1002195, 1002240, 1002285, 1002330, 1002375, 1002420, 1002465, 1002510, 1002555, 1002600, 1002645, 1002690, 1002735, 1002780, 1002825, 1002870, 1002915, 1002960, 1003005, 1003050, 1003095, 1003140, 1003185, 1003230, 1003275, 1003320, 1003365, 1003410, 1003455, 1003500, 1003545, 1003590, 1003635, 1003680, 1003725, 1003770, 1003815, 1003860, 1003905, 1003950, 1003995, 1004040, 1004085, 1004130, 1004175, 1004220, 1004265, 1004310, 1004355, 1004400, 1004445, 1004490, 1004535, 1004580, 1004625, 1004670, 1004715, 1004760, 1004805, 1004850, 1004895, 1004940, 1004985, 1005030, 1005075, 1005120, 1005165, 1005210, 1005255, 1005300, 1005345, 1005390, 1005435, 1005480, 1005525, 1005570, 1005615, 1005660, 1005705, 1005750, 1005795, 1005840, 1005885, 1005930, 1005975, 1006020, 1006065, 1006110, 1006155, 1006200, 1006245, 1006290, 1006335, 1006380, 1006425, 1006470, 1006515, 1006560, 1006605, 1006650, 1006695, 1006740, 1006785, 1006830, 1006875, 1006920, 1006965, 1007010, 1007055, 1007100, 1007145, 1007190, 1007235, 1007280, 1007325, 1007370, 1007415, 1007460, 1007505, 1007550, 1007595, 1007640, 1007685, 1007730, 1007775, 1007820, 1007865, 1007910, 1007955, 1008000, 1008045, 1008090, 1008135, 1008180, 1008225, 1008270, 1008315, 1008360, 1008405, 1008450, 1008495, 1008540, 1008585, 1008630, 1008675, 1008720, 1008765, 1008810, 1008855, 1008900, 1008945, 1008990, 1009035, 1009080, 1009125, 1009170, 1009215, 1009260, 1009305, 1009350, 1009395, 1009440, 1009485, 1009530, 1009575, 1009620, 1009665, 1009710, 1009755, 1009800, 1009845, 1009890, 1009935, 1009980, 1010025, 1010070, 1010115, 1010160, 1010205, 1010250, 1010295, 1010340, 1010385, 1010430, 1010475, 1010520, 1010565, 1010610, 1010655, 1010700, 1010745, 1010790, 1010835, 1010880, 1010925, 1010970, 1011015, 1011060, 1011105, 1011150, 1011195, 1011240, 1011285, 1011330, 1011375, 1011420, 1011465, 1011510, 1011555, 1011600, 1011645, 1011690, 1011735, 1011780, 1011825, 1011870, 1011915, 1011960, 1012005, 1012050, 1012095, 1012140, 1012185, 1012230, 1012275, 1012320, 1012365, 1012410, 1012455, 1012500, 1012545, 1012590, 1012635, 1012680, 1012725, 1012770, 1012815, 1012860, 1012905, 1012950, 1012995, 1013040, 1013085, 1013130, 1013175, 1013220, 1013265, 1013310, 1013355, 1013400, 1013445, 1013490, 1013535, 1013580, 1013625, 1013670, 1013715, 1013760, 1013805, 1013850, 1013895, 1013940, 1013985, 1014030, 1014075, 1014120, 1014165, 1014210, 1014255, 1014300, 1014345, 1014390, 1014435, 1014480, 1014525, 1014570, 1014615, 1014660, 1014705, 1014750, 1014795, 1014840, 1014885, 1014930, 1014975, 1015020, 1015065, 1015110, 1015155, 1015200, 1015245, 1015290, 1015335, 1015380, 1015425, 1015470, 1015515, 1015560, 1015605, 1015650, 1015695, 1015740, 1015785, 1015830, 1015875, 1015920, 1015965, 1016010, 1016055, 1016100, 1016145, 1016190, 1016235, 1016280, 1016325, 1016370, 1016415, 1016460, 1016505, 1016550, 1016595, 1016640, 1016685, 1016730, 1016775, 1016820, 1016865, 1016910, 1016955, 1017000, 1017045, 1017090, 1017135, 1017180, 1017225, 1017270, 1017315, 1017360, 1017405, 1017450, 1017495, 1017540, 1017585, 1017630, 1017675, 1017720, 1017765, 1017810, 1017855, 1017900, 1017945, 1017990, 1018035, 1018080, 1018125, 1018170, 1018215, 1018260, 1018305, 1018350, 1018395, 1018440, 1018485, 1018530, 1018575, 1018620, 1018665, 1018710, 1018755, 1018800, 1018845, 1018890, 1018935, 1018980, 1019025, 1019070, 1019115, 1019160, 1019205, 1019250, 1019295, 1019340, 1019385, 1019430, 1019475, 1019520, 1019565, 1019610, 1019655, 1019700, 1019745, 1019790, 1019835, 1019880, 1019925, 1019970, 1020015, 1020060, 1020105, 1020150, 1020195, 1020240, 1020285, 1020330, 1020375, 1020420, 1020465, 1020510, 1020555, 1020600, 1020645, 1020690, 1020735, 1020780, 1020825, 1020870, 1020915, 1020960, 1021005, 1021050, 1021095, 1021140, 1021185, 1021230, 1021275, 1021320, 1021365, 1021410, 1021455, 1021500, 1021545, 1021590, 1021635, 1021680, 1021725, 1021770, 1021815, 1021860, 1021905, 1021950, 1021995, 1022040, 1022085, 1022130, 1022175, 1022220, 1022265, 1022310, 1022355, 1022400, 1022445, 1022490, 1022535, 1022580, 1022625, 1022670, 1022715, 1022760, 1022805, 1022850, 1022895, 1022940, 1022985, 1023030, 1023075, 1023120, 1023165, 1023210, 1023255, 1023300, 1023345, 1023390, 1017153, 978758, 978802, 978846, 978890, 978934, 978978, 979022, 979066, 979110, 979154, 979198, 979242, 979286, 979330, 979374, 979418, 979462, 979506, 979550, 979594, 979638, 979682, 979726, 979770, 979814, 979858, 979902, 979946, 979990, 980034, 980078, 980122, 980166, 980210, 980254, 980298, 980342, 980386, 980430, 980474, 980518, 980562, 980606, 980650, 980694, 980738, 980782, 980826, 980870, 980914, 980958, 981002, 981046, 981090, 981134, 981178, 981222, 981266, 981310, 981354, 981398, 981442, 981486, 981530, 981574, 981618, 981662, 981706, 981750, 981794, 981838, 981882, 981926, 981970, 982014, 982058, 982102, 982146, 982190, 982234, 982278, 982322, 982366, 982410, 982454, 982498, 982542, 982586, 982630, 982674, 982718, 982762, 982806, 982850, 982894, 982938, 982982, 983026, 983070, 983114, 983158, 983202, 983246, 983290, 983334, 983378, 983422, 983466, 983510, 983554, 983598, 983642, 983686, 983730, 983774, 983818, 983862, 983906, 983950, 983994, 984038, 984082, 984126, 984170, 984214, 984258, 984302, 984346, 984390, 984434, 984478, 984522, 984566, 984610, 984654, 984698, 984742, 984786, 984830, 984874, 984918, 984962, 985006, 985050, 985094, 985138, 985182, 985226, 985270, 985314, 985358, 985402, 985446, 985490, 985534, 985578, 985622, 985666, 985710, 985754, 985798, 985842, 985886, 985930, 985974, 986018, 986062, 986106, 986150, 986194, 986238, 986282, 986326, 986370, 986414, 986458, 986502, 986546, 986590, 986634, 986678, 986722, 986766, 986810, 986854, 986898, 986942, 986986, 987030, 987074, 987118, 987162, 987206, 987250, 987294, 987338, 987382, 987426, 987470, 987514, 987558, 987602, 987646, 987690, 987734, 987778, 987822, 987866, 987910, 987954, 987998, 988042, 988086, 988130, 988174, 988218, 988262, 988306, 988350, 988394, 988438, 988482, 988526, 988570, 988614, 988658, 988702, 988746, 988790, 988834, 988878, 988922, 988966, 989010]\n assert candidate(candies = 120,num_people = 6) == [21, 24, 27, 14, 16, 18]\n assert candidate(candies = 999999,num_people = 500) == [1503, 1506, 1509, 1512, 1515, 1518, 1521, 1524, 1527, 1530, 1533, 1536, 1539, 1542, 1545, 1548, 1551, 1554, 1557, 1560, 1563, 1566, 1569, 1572, 1575, 1578, 1581, 1584, 1587, 1590, 1593, 1596, 1599, 1602, 1605, 1608, 1611, 1614, 1617, 1620, 1623, 1626, 1629, 1632, 1635, 1638, 1641, 1644, 1647, 1650, 1653, 1656, 1659, 1662, 1665, 1668, 1671, 1674, 1677, 1680, 1683, 1686, 1689, 1692, 1695, 1698, 1701, 1704, 1707, 1710, 1713, 1716, 1719, 1722, 1725, 1728, 1731, 1734, 1737, 1740, 1743, 1746, 1749, 1752, 1755, 1758, 1761, 1764, 1767, 1770, 1773, 1776, 1779, 1782, 1785, 1788, 1791, 1794, 1797, 1800, 1803, 1806, 1809, 1812, 1815, 1818, 1821, 1824, 1827, 1830, 1833, 1836, 1839, 1842, 1845, 1848, 1851, 1854, 1857, 1860, 1863, 1866, 1869, 1872, 1875, 1878, 1881, 1884, 1887, 1890, 1893, 1896, 1899, 1902, 1905, 1908, 1911, 1914, 1917, 1920, 1923, 1926, 1929, 1932, 1935, 1938, 1941, 1944, 1947, 1950, 1953, 1956, 1959, 1962, 1965, 1968, 1971, 1974, 1977, 1980, 1983, 1986, 1989, 1992, 1995, 1998, 2001, 2004, 2007, 2010, 2013, 2016, 2019, 2022, 2025, 2028, 2031, 2034, 2037, 2040, 2043, 2046, 2049, 2052, 2055, 2058, 2061, 2064, 2067, 2070, 2073, 2076, 2079, 2082, 2085, 2088, 2091, 2094, 2097, 2100, 2103, 2106, 2109, 2112, 2115, 2118, 2121, 2124, 2127, 2130, 2133, 2136, 2139, 2142, 2145, 2148, 2151, 2154, 2157, 2160, 2163, 2166, 2169, 2172, 2175, 2178, 2181, 2184, 2187, 2190, 2193, 2196, 2199, 2202, 2205, 2208, 2211, 2214, 2217, 2220, 2223, 2226, 2229, 2232, 2235, 2238, 2241, 2244, 2247, 2250, 2253, 2256, 2259, 2262, 2265, 2268, 2271, 2274, 2277, 2280, 2283, 2286, 2289, 2292, 2295, 2298, 2301, 2304, 2307, 2310, 2313, 2316, 2319, 2322, 2325, 2328, 2331, 2334, 2337, 2340, 2343, 2346, 2349, 2352, 2355, 2358, 2361, 2364, 2367, 2370, 2373, 2376, 2379, 2382, 2385, 2388, 2391, 2394, 2397, 2400, 2403, 2406, 2409, 2412, 2415, 2418, 2421, 2424, 2427, 2430, 2433, 2436, 2439, 2442, 2445, 2448, 2451, 2454, 2457, 2460, 2463, 2466, 2469, 2472, 2475, 2478, 2481, 2484, 2487, 2490, 2493, 2496, 2499, 2502, 2505, 2508, 2511, 2514, 2517, 2520, 2523, 2526, 2529, 2532, 2535, 2538, 2541, 2544, 2547, 2550, 2553, 2556, 2559, 2562, 2565, 2568, 2571, 2574, 2577, 2580, 2583, 2586, 2589, 2592, 2595, 2598, 2601, 2604, 2607, 2610, 2613, 2616, 2619, 2622, 2625, 2628, 2631, 2634, 2637, 2640, 2643, 2646, 2649, 2652, 2655, 2658, 2661, 2664, 2667, 2670, 2673, 2676, 2679, 2682, 2685, 2688, 2691, 2694, 2697, 2700, 2703, 2706, 2709, 2712, 2715, 2718, 2721, 2724, 2727, 2730, 2733, 2736, 2739, 2336, 1330, 1332, 1334, 1336, 1338, 1340, 1342, 1344, 1346, 1348, 1350, 1352, 1354, 1356, 1358, 1360, 1362, 1364, 1366, 1368, 1370, 1372, 1374, 1376, 1378, 1380, 1382, 1384, 1386, 1388, 1390, 1392, 1394, 1396, 1398, 1400, 1402, 1404, 1406, 1408, 1410, 1412, 1414, 1416, 1418, 1420, 1422, 1424, 1426, 1428, 1430, 1432, 1434, 1436, 1438, 1440, 1442, 1444, 1446, 1448, 1450, 1452, 1454, 1456, 1458, 1460, 1462, 1464, 1466, 1468, 1470, 1472, 1474, 1476, 1478, 1480, 1482, 1484, 1486, 1488, 1490, 1492, 1494, 1496, 1498, 1500]\n assert candidate(candies = 120,num_people = 15) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]\n assert candidate(candies = 123456,num_people = 789) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(candies = 81,num_people = 9) == [11, 13, 15, 7, 5, 6, 7, 8, 9]\n assert candidate(candies = 1000,num_people = 25) == [27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 30, 21, 22, 23, 24, 25]\n assert candidate(candies = 25,num_people = 3) == [9, 7, 9]\n assert candidate(candies = 200,num_people = 6) == [40, 34, 27, 30, 33, 36]\n assert candidate(candies = 1000,num_people = 2) == [494, 506]\n assert candidate(candies = 897654321,num_people = 500) == [1785085, 1785170, 1785255, 1785340, 1785425, 1785510, 1785595, 1785680, 1785765, 1785850, 1785935, 1786020, 1786105, 1786190, 1786275, 1786360, 1786445, 1786530, 1786615, 1786700, 1786785, 1786870, 1786955, 1787040, 1787125, 1787210, 1787295, 1787380, 1787465, 1787550, 1787635, 1787720, 1787805, 1787890, 1787975, 1788060, 1788145, 1788230, 1788315, 1788400, 1788485, 1788570, 1788655, 1788740, 1788825, 1788910, 1788995, 1789080, 1789165, 1789250, 1789335, 1789420, 1789505, 1789590, 1789675, 1789760, 1789845, 1789930, 1790015, 1790100, 1790185, 1790270, 1790355, 1790440, 1790525, 1790610, 1790695, 1790780, 1790865, 1790950, 1791035, 1791120, 1791205, 1791290, 1791375, 1791460, 1791545, 1791630, 1791715, 1791800, 1791885, 1791970, 1792055, 1792140, 1792225, 1792310, 1792395, 1792480, 1792565, 1792650, 1792735, 1792820, 1792905, 1792990, 1793075, 1793160, 1793245, 1793330, 1793415, 1793500, 1793585, 1793670, 1793755, 1793840, 1793925, 1794010, 1794095, 1794180, 1794265, 1794350, 1794435, 1794520, 1794605, 1794690, 1794775, 1794860, 1794945, 1795030, 1795115, 1795200, 1795285, 1795370, 1795455, 1795540, 1795625, 1795710, 1795795, 1795880, 1795965, 1796050, 1796135, 1796220, 1796305, 1796390, 1796475, 1796560, 1796645, 1796730, 1796815, 1796900, 1796985, 1797070, 1797155, 1797240, 1797325, 1797410, 1797495, 1797580, 1797665, 1797750, 1797835, 1797920, 1798005, 1798090, 1798175, 1798260, 1798345, 1798430, 1798515, 1798600, 1798685, 1798770, 1798855, 1798940, 1799025, 1799110, 1799195, 1799280, 1799365, 1799450, 1799535, 1799620, 1799705, 1799790, 1799875, 1799960, 1800045, 1800130, 1800215, 1800300, 1800385, 1800470, 1800555, 1800640, 1800725, 1800810, 1800895, 1800980, 1801065, 1801150, 1801235, 1801320, 1801405, 1801490, 1801575, 1801660, 1801745, 1801830, 1801915, 1802000, 1802085, 1802170, 1802255, 1802340, 1802425, 1802510, 1802595, 1802680, 1802765, 1802850, 1802935, 1803020, 1803105, 1803190, 1803275, 1803360, 1803445, 1803530, 1803615, 1803700, 1803785, 1803870, 1803955, 1804040, 1804125, 1804210, 1804295, 1804380, 1804465, 1804550, 1804635, 1804720, 1804805, 1804890, 1804975, 1805060, 1805145, 1805230, 1805315, 1805400, 1805485, 1805570, 1805655, 1805740, 1805825, 1805910, 1805995, 1806080, 1806165, 1806250, 1806335, 1806420, 1806505, 1806590, 1806675, 1806760, 1806845, 1806930, 1807015, 1807100, 1807185, 1807270, 1807355, 1807440, 1807525, 1807610, 1807695, 1807780, 1807865, 1807950, 1808035, 1808120, 1808205, 1808290, 1808375, 1808460, 1808545, 1808630, 1808715, 1808800, 1808885, 1808970, 1809055, 1809140, 1809225, 1809310, 1809395, 1809480, 1809565, 1809650, 1809735, 1809820, 1809905, 1809990, 1810075, 1810160, 1810245, 1810330, 1810415, 1810500, 1810585, 1810670, 1810755, 1810840, 1810925, 1811010, 1811095, 1811180, 1811265, 1811350, 1811435, 1811520, 1811605, 1811690, 1811775, 1811860, 1811945, 1812030, 1812115, 1812200, 1812285, 1812370, 1812455, 1812540, 1812625, 1812710, 1812795, 1812880, 1812965, 1813050, 1813135, 1813220, 1813305, 1813390, 1813475, 1813560, 1813645, 1813730, 1813815, 1813900, 1813985, 1814070, 1814155, 1814240, 1814325, 1814410, 1814495, 1814580, 1814665, 1814750, 1814835, 1814920, 1815005, 1815090, 1815175, 1815260, 1815345, 1815430, 1815515, 1815600, 1815685, 1815770, 1815855, 1815940, 1816025, 1816110, 1816195, 1816280, 1816365, 1816450, 1798850, 1774248, 1774332, 1774416, 1774500, 1774584, 1774668, 1774752, 1774836, 1774920, 1775004, 1775088, 1775172, 1775256, 1775340, 1775424, 1775508, 1775592, 1775676, 1775760, 1775844, 1775928, 1776012, 1776096, 1776180, 1776264, 1776348, 1776432, 1776516, 1776600, 1776684, 1776768, 1776852, 1776936, 1777020, 1777104, 1777188, 1777272, 1777356, 1777440, 1777524, 1777608, 1777692, 1777776, 1777860, 1777944, 1778028, 1778112, 1778196, 1778280, 1778364, 1778448, 1778532, 1778616, 1778700, 1778784, 1778868, 1778952, 1779036, 1779120, 1779204, 1779288, 1779372, 1779456, 1779540, 1779624, 1779708, 1779792, 1779876, 1779960, 1780044, 1780128, 1780212, 1780296, 1780380, 1780464, 1780548, 1780632, 1780716, 1780800, 1780884, 1780968, 1781052, 1781136, 1781220, 1781304, 1781388, 1781472, 1781556, 1781640, 1781724, 1781808, 1781892, 1781976, 1782060, 1782144, 1782228, 1782312, 1782396, 1782480, 1782564, 1782648, 1782732, 1782816, 1782900, 1782984, 1783068, 1783152, 1783236, 1783320, 1783404, 1783488, 1783572, 1783656, 1783740, 1783824, 1783908, 1783992, 1784076, 1784160, 1784244, 1784328, 1784412, 1784496, 1784580, 1784664, 1784748, 1784832, 1784916, 1785000]\n assert candidate(candies = 3456789,num_people = 12) == [288954, 286890, 287109, 287328, 287547, 287766, 287985, 288204, 288423, 288642, 288861, 289080]\n assert candidate(candies = 1000,num_people = 33) == [35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 22, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]\n assert candidate(candies = 2500,num_people = 7) == [340, 335, 345, 355, 365, 375, 385]\n assert candidate(candies = 1000,num_people = 10) == [105, 110, 115, 120, 90, 84, 88, 92, 96, 100]\n assert candidate(candies = 400,num_people = 15) == [17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 35, 14, 15]\n assert candidate(candies = 500,num_people = 1) == [500]\n assert candidate(candies = 25,num_people = 5) == [7, 6, 3, 4, 5]\n assert candidate(candies = 15,num_people = 2) == [9, 6]\n assert candidate(candies = 10000,num_people = 50) == [153, 156, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, 240, 243, 246, 249, 252, 255, 258, 261, 264, 267, 270, 262, 134, 136, 138, 140, 142, 144, 146, 148, 150]\n assert candidate(candies = 500000000,num_people = 250) == [2000377, 2000504, 2000631, 2000758, 2000885, 2001012, 2001139, 2001266, 2001393, 2001520, 2001647, 2001774, 2001901, 2002028, 2002155, 2002282, 2002409, 2002536, 2002663, 2002790, 2002917, 2003044, 2003171, 2003298, 2003425, 2003552, 2003679, 2003806, 2003933, 2004060, 2004187, 2004314, 2004441, 2004568, 2004695, 2004822, 2004949, 2005076, 2005203, 2005330, 2005457, 2005584, 2005711, 2005838, 2005965, 2006092, 2006219, 2006346, 2006473, 2006600, 2006727, 2006854, 2006981, 2007108, 2007235, 2007362, 2007489, 2007616, 2007743, 2007870, 2007997, 2008124, 2008251, 2008378, 2008505, 2008632, 2008759, 2008886, 2009013, 2009140, 2009267, 2009394, 2009521, 2009648, 2009775, 2009902, 2010029, 2010156, 2010283, 2010410, 2010537, 2010664, 2010791, 2010918, 2011045, 2011172, 2011299, 2011426, 2011553, 2011680, 2011807, 2011934, 2012061, 2012188, 2012315, 2012442, 2012569, 2012696, 2012823, 2012950, 2013077, 2013204, 2013331, 2013458, 2013585, 2013712, 2013839, 2013966, 2014093, 2014220, 2014347, 2014474, 2014601, 2014728, 2014855, 2014982, 2015109, 2015236, 2015363, 2015490, 2015617, 2015744, 1992995, 1984374, 1984500, 1984626, 1984752, 1984878, 1985004, 1985130, 1985256, 1985382, 1985508, 1985634, 1985760, 1985886, 1986012, 1986138, 1986264, 1986390, 1986516, 1986642, 1986768, 1986894, 1987020, 1987146, 1987272, 1987398, 1987524, 1987650, 1987776, 1987902, 1988028, 1988154, 1988280, 1988406, 1988532, 1988658, 1988784, 1988910, 1989036, 1989162, 1989288, 1989414, 1989540, 1989666, 1989792, 1989918, 1990044, 1990170, 1990296, 1990422, 1990548, 1990674, 1990800, 1990926, 1991052, 1991178, 1991304, 1991430, 1991556, 1991682, 1991808, 1991934, 1992060, 1992186, 1992312, 1992438, 1992564, 1992690, 1992816, 1992942, 1993068, 1993194, 1993320, 1993446, 1993572, 1993698, 1993824, 1993950, 1994076, 1994202, 1994328, 1994454, 1994580, 1994706, 1994832, 1994958, 1995084, 1995210, 1995336, 1995462, 1995588, 1995714, 1995840, 1995966, 1996092, 1996218, 1996344, 1996470, 1996596, 1996722, 1996848, 1996974, 1997100, 1997226, 1997352, 1997478, 1997604, 1997730, 1997856, 1997982, 1998108, 1998234, 1998360, 1998486, 1998612, 1998738, 1998864, 1998990, 1999116, 1999242, 1999368, 1999494, 1999620, 1999746, 1999872, 1999998, 2000124, 2000250]\n assert candidate(candies = 499999999,num_people = 500) == [1008064, 1008128, 1008192, 1008256, 1008320, 1008384, 1008448, 1008512, 1008576, 1008640, 1008704, 1008768, 1008832, 1008896, 1008960, 1009024, 1009088, 1009152, 1009216, 1009280, 1009344, 1009408, 1009472, 1009536, 1009600, 1009664, 1009728, 1009792, 1009856, 1009920, 1009984, 1010048, 1010112, 1010176, 1010240, 1010304, 1010368, 1010432, 1010496, 1010560, 1010624, 1010688, 1010752, 1010816, 1010880, 1010944, 1011008, 1011072, 1011136, 1011200, 1011264, 1011328, 1011392, 1011456, 1011520, 1011584, 1011648, 1011712, 1011776, 1011840, 1011904, 1011968, 1012032, 1012096, 1012160, 1012224, 1012288, 1012352, 1012416, 1012480, 1012544, 1012608, 1012672, 1012736, 1012800, 1012864, 1012928, 1012992, 1013056, 1013120, 1013184, 1013248, 1013312, 1013376, 1013440, 1013504, 1013568, 1013632, 1013696, 1013760, 1013824, 1013888, 1013952, 1014016, 1014080, 1014144, 1014208, 1014272, 1014336, 1014400, 1014464, 1014528, 1014592, 1014656, 1014720, 1014784, 1014848, 1014912, 1014976, 1015040, 1015104, 1015168, 1015232, 1015296, 1015360, 1015424, 1015488, 1015552, 1015616, 1015680, 1015744, 1015808, 992995, 984312, 984375, 984438, 984501, 984564, 984627, 984690, 984753, 984816, 984879, 984942, 985005, 985068, 985131, 985194, 985257, 985320, 985383, 985446, 985509, 985572, 985635, 985698, 985761, 985824, 985887, 985950, 986013, 986076, 986139, 986202, 986265, 986328, 986391, 986454, 986517, 986580, 986643, 986706, 986769, 986832, 986895, 986958, 987021, 987084, 987147, 987210, 987273, 987336, 987399, 987462, 987525, 987588, 987651, 987714, 987777, 987840, 987903, 987966, 988029, 988092, 988155, 988218, 988281, 988344, 988407, 988470, 988533, 988596, 988659, 988722, 988785, 988848, 988911, 988974, 989037, 989100, 989163, 989226, 989289, 989352, 989415, 989478, 989541, 989604, 989667, 989730, 989793, 989856, 989919, 989982, 990045, 990108, 990171, 990234, 990297, 990360, 990423, 990486, 990549, 990612, 990675, 990738, 990801, 990864, 990927, 990990, 991053, 991116, 991179, 991242, 991305, 991368, 991431, 991494, 991557, 991620, 991683, 991746, 991809, 991872, 991935, 991998, 992061, 992124, 992187, 992250, 992313, 992376, 992439, 992502, 992565, 992628, 992691, 992754, 992817, 992880, 992943, 993006, 993069, 993132, 993195, 993258, 993321, 993384, 993447, 993510, 993573, 993636, 993699, 993762, 993825, 993888, 993951, 994014, 994077, 994140, 994203, 994266, 994329, 994392, 994455, 994518, 994581, 994644, 994707, 994770, 994833, 994896, 994959, 995022, 995085, 995148, 995211, 995274, 995337, 995400, 995463, 995526, 995589, 995652, 995715, 995778, 995841, 995904, 995967, 996030, 996093, 996156, 996219, 996282, 996345, 996408, 996471, 996534, 996597, 996660, 996723, 996786, 996849, 996912, 996975, 997038, 997101, 997164, 997227, 997290, 997353, 997416, 997479, 997542, 997605, 997668, 997731, 997794, 997857, 997920, 997983, 998046, 998109, 998172, 998235, 998298, 998361, 998424, 998487, 998550, 998613, 998676, 998739, 998802, 998865, 998928, 998991, 999054, 999117, 999180, 999243, 999306, 999369, 999432, 999495, 999558, 999621, 999684, 999747, 999810, 999873, 999936, 999999, 1000062, 1000125, 1000188, 1000251, 1000314, 1000377, 1000440, 1000503, 1000566, 1000629, 1000692, 1000755, 1000818, 1000881, 1000944, 1001007, 1001070, 1001133, 1001196, 1001259, 1001322, 1001385, 1001448, 1001511, 1001574, 1001637, 1001700, 1001763, 1001826, 1001889, 1001952, 1002015, 1002078, 1002141, 1002204, 1002267, 1002330, 1002393, 1002456, 1002519, 1002582, 1002645, 1002708, 1002771, 1002834, 1002897, 1002960, 1003023, 1003086, 1003149, 1003212, 1003275, 1003338, 1003401, 1003464, 1003527, 1003590, 1003653, 1003716, 1003779, 1003842, 1003905, 1003968, 1004031, 1004094, 1004157, 1004220, 1004283, 1004346, 1004409, 1004472, 1004535, 1004598, 1004661, 1004724, 1004787, 1004850, 1004913, 1004976, 1005039, 1005102, 1005165, 1005228, 1005291, 1005354, 1005417, 1005480, 1005543, 1005606, 1005669, 1005732, 1005795, 1005858, 1005921, 1005984, 1006047, 1006110, 1006173, 1006236, 1006299, 1006362, 1006425, 1006488, 1006551, 1006614, 1006677, 1006740, 1006803, 1006866, 1006929, 1006992, 1007055, 1007118, 1007181, 1007244, 1007307, 1007370, 1007433, 1007496, 1007559, 1007622, 1007685, 1007748, 1007811, 1007874, 1007937, 1008000]\n assert candidate(candies = 200000000,num_people = 500) == [390040, 390080, 390120, 390160, 390200, 390240, 390280, 390320, 390360, 390400, 390440, 390480, 390520, 390560, 390600, 390640, 390680, 390720, 390760, 390800, 390840, 390880, 390920, 390960, 391000, 391040, 391080, 391120, 391160, 391200, 391240, 391280, 391320, 391360, 391400, 391440, 391480, 391520, 391560, 391600, 391640, 391680, 391720, 391760, 391800, 391840, 391880, 391920, 391960, 392000, 392040, 392080, 392120, 392160, 392200, 392240, 392280, 392320, 392360, 392400, 392440, 392480, 392520, 392560, 392600, 392640, 392680, 392720, 392760, 392800, 392840, 392880, 392920, 392960, 393000, 393040, 393080, 393120, 393160, 393200, 393240, 393280, 393320, 393360, 393400, 393440, 393480, 393520, 393560, 393600, 393640, 393680, 393720, 393760, 393800, 393840, 393880, 393920, 393960, 394000, 394040, 394080, 394120, 394160, 394200, 394240, 394280, 394320, 394360, 394400, 394440, 394480, 394520, 394560, 394600, 394640, 394680, 394720, 394760, 394800, 394840, 394880, 394920, 394960, 395000, 395040, 395080, 395120, 395160, 395200, 395240, 395280, 395320, 395360, 395400, 395440, 395480, 395520, 395560, 395600, 395640, 395680, 395720, 395760, 395800, 395840, 395880, 395920, 395960, 396000, 396040, 396080, 396120, 396160, 396200, 396240, 396280, 396320, 396360, 396400, 396440, 396480, 396520, 396560, 396600, 396640, 396680, 396720, 396760, 396800, 396840, 396880, 396920, 396960, 397000, 397040, 397080, 397120, 397160, 397200, 397240, 397280, 397320, 397360, 397400, 397440, 397480, 397520, 397560, 397600, 397640, 397680, 397720, 397760, 397800, 397840, 397880, 397920, 397960, 398000, 398040, 398080, 398120, 398160, 398200, 398240, 398280, 398320, 398360, 398400, 398440, 398480, 398520, 398560, 398600, 398640, 398680, 398720, 398760, 398800, 398840, 398880, 398920, 398960, 399000, 399040, 399080, 399120, 399160, 399200, 399240, 399280, 399320, 399360, 399400, 399440, 399480, 399520, 399560, 399600, 399640, 399680, 399720, 399760, 399800, 399840, 399880, 399920, 399960, 400000, 400040, 400080, 400120, 400160, 400200, 400240, 400280, 400320, 400360, 400400, 400440, 400480, 400520, 400560, 400600, 400640, 400680, 400720, 400760, 400800, 400840, 400880, 400920, 400960, 401000, 401040, 401080, 401120, 401160, 401200, 401240, 401280, 401320, 401360, 401400, 401440, 401480, 401520, 401560, 401600, 401640, 401680, 401720, 401760, 401800, 401840, 401880, 401920, 401960, 402000, 402040, 402080, 402120, 402160, 402200, 402240, 402280, 402320, 402360, 402400, 402440, 402480, 402520, 402560, 402600, 402640, 402680, 402720, 402760, 402800, 402840, 402880, 402920, 402960, 403000, 403040, 403080, 403120, 403160, 403200, 403240, 403280, 403320, 403360, 403400, 403440, 403480, 403520, 403560, 403600, 403640, 403680, 403720, 403760, 403800, 403840, 403880, 403920, 403960, 404000, 404040, 404080, 404120, 404160, 404200, 404240, 404280, 404320, 404360, 404400, 404440, 404480, 404520, 404560, 404600, 404640, 404680, 404720, 404760, 404800, 404840, 404880, 404920, 404960, 405000, 405040, 405080, 405120, 405160, 405200, 405240, 405280, 405320, 405360, 405400, 405440, 405480, 405520, 405560, 405600, 405640, 405680, 405720, 405760, 405800, 405840, 405880, 405920, 405960, 406000, 406040, 406080, 406120, 406160, 406200, 406240, 406280, 406320, 406360, 406400, 406440, 406480, 406520, 406560, 406600, 406640, 406680, 406720, 406760, 406800, 406840, 406880, 406920, 406960, 407000, 407040, 407080, 407120, 407160, 407200, 407240, 407280, 407320, 407360, 407400, 407440, 407480, 407520, 407560, 407600, 407640, 407680, 407720, 407760, 407800, 407840, 407880, 407920, 407960, 408000, 408040, 408080, 408120, 408160, 408200, 408240, 408280, 408320, 408360, 408400, 408440, 408480, 408520, 408560, 408600, 408640, 408680, 408720, 408760, 408800, 408840, 408880, 408920, 408960, 409000, 409040, 409080, 409120, 409160, 409200, 409240, 409280, 409320, 409360, 409400, 409440, 409480, 409520, 409560, 409600, 409640, 409680, 409720, 409760, 409800, 409840, 409880, 409920, 409960, 400000]\n assert candidate(candies = 999999999,num_people = 1000) == [990045, 990090, 990135, 990180, 990225, 990270, 990315, 990360, 990405, 990450, 990495, 990540, 990585, 990630, 990675, 990720, 990765, 990810, 990855, 990900, 990945, 990990, 991035, 991080, 991125, 991170, 991215, 991260, 991305, 991350, 991395, 991440, 991485, 991530, 991575, 991620, 991665, 991710, 991755, 991800, 991845, 991890, 991935, 991980, 992025, 992070, 992115, 992160, 992205, 992250, 992295, 992340, 992385, 992430, 992475, 992520, 992565, 992610, 992655, 992700, 992745, 992790, 992835, 992880, 992925, 992970, 993015, 993060, 993105, 993150, 993195, 993240, 993285, 993330, 993375, 993420, 993465, 993510, 993555, 993600, 993645, 993690, 993735, 993780, 993825, 993870, 993915, 993960, 994005, 994050, 994095, 994140, 994185, 994230, 994275, 994320, 994365, 994410, 994455, 994500, 994545, 994590, 994635, 994680, 994725, 994770, 994815, 994860, 994905, 994950, 994995, 995040, 995085, 995130, 995175, 995220, 995265, 995310, 995355, 995400, 995445, 995490, 995535, 995580, 995625, 995670, 995715, 995760, 995805, 995850, 995895, 995940, 995985, 996030, 996075, 996120, 996165, 996210, 996255, 996300, 996345, 996390, 996435, 996480, 996525, 996570, 996615, 996660, 996705, 996750, 996795, 996840, 996885, 996930, 996975, 997020, 997065, 997110, 997155, 997200, 997245, 997290, 997335, 997380, 997425, 997470, 997515, 997560, 997605, 997650, 997695, 997740, 997785, 997830, 997875, 997920, 997965, 998010, 998055, 998100, 998145, 998190, 998235, 998280, 998325, 998370, 998415, 998460, 998505, 998550, 998595, 998640, 998685, 998730, 998775, 998820, 998865, 998910, 998955, 999000, 999045, 999090, 999135, 999180, 999225, 999270, 999315, 999360, 999405, 999450, 999495, 999540, 999585, 999630, 999675, 999720, 999765, 999810, 999855, 999900, 999945, 999990, 1000035, 1000080, 1000125, 1000170, 1000215, 1000260, 1000305, 1000350, 1000395, 1000440, 1000485, 1000530, 1000575, 1000620, 1000665, 1000710, 1000755, 1000800, 1000845, 1000890, 1000935, 1000980, 1001025, 1001070, 1001115, 1001160, 1001205, 1001250, 1001295, 1001340, 1001385, 1001430, 1001475, 1001520, 1001565, 1001610, 1001655, 1001700, 1001745, 1001790, 1001835, 1001880, 1001925, 1001970, 1002015, 1002060, 1002105, 1002150, 1002195, 1002240, 1002285, 1002330, 1002375, 1002420, 1002465, 1002510, 1002555, 1002600, 1002645, 1002690, 1002735, 1002780, 1002825, 1002870, 1002915, 1002960, 1003005, 1003050, 1003095, 1003140, 1003185, 1003230, 1003275, 1003320, 1003365, 1003410, 1003455, 1003500, 1003545, 1003590, 1003635, 1003680, 1003725, 1003770, 1003815, 1003860, 1003905, 1003950, 1003995, 1004040, 1004085, 1004130, 1004175, 1004220, 1004265, 1004310, 1004355, 1004400, 1004445, 1004490, 1004535, 1004580, 1004625, 1004670, 1004715, 1004760, 1004805, 1004850, 1004895, 1004940, 1004985, 1005030, 1005075, 1005120, 1005165, 1005210, 1005255, 1005300, 1005345, 1005390, 1005435, 1005480, 1005525, 1005570, 1005615, 1005660, 1005705, 1005750, 1005795, 1005840, 1005885, 1005930, 1005975, 1006020, 1006065, 1006110, 1006155, 1006200, 1006245, 1006290, 1006335, 1006380, 1006425, 1006470, 1006515, 1006560, 1006605, 1006650, 1006695, 1006740, 1006785, 1006830, 1006875, 1006920, 1006965, 1007010, 1007055, 1007100, 1007145, 1007190, 1007235, 1007280, 1007325, 1007370, 1007415, 1007460, 1007505, 1007550, 1007595, 1007640, 1007685, 1007730, 1007775, 1007820, 1007865, 1007910, 1007955, 1008000, 1008045, 1008090, 1008135, 1008180, 1008225, 1008270, 1008315, 1008360, 1008405, 1008450, 1008495, 1008540, 1008585, 1008630, 1008675, 1008720, 1008765, 1008810, 1008855, 1008900, 1008945, 1008990, 1009035, 1009080, 1009125, 1009170, 1009215, 1009260, 1009305, 1009350, 1009395, 1009440, 1009485, 1009530, 1009575, 1009620, 1009665, 1009710, 1009755, 1009800, 1009845, 1009890, 1009935, 1009980, 1010025, 1010070, 1010115, 1010160, 1010205, 1010250, 1010295, 1010340, 1010385, 1010430, 1010475, 1010520, 1010565, 1010610, 1010655, 1010700, 1010745, 1010790, 1010835, 1010880, 1010925, 1010970, 1011015, 1011060, 1011105, 1011150, 1011195, 1011240, 1011285, 1011330, 1011375, 1011420, 1011465, 1011510, 1011555, 1011600, 1011645, 1011690, 1011735, 1011780, 1011825, 1011870, 1011915, 1011960, 1012005, 1012050, 1012095, 1012140, 1012185, 1012230, 1012275, 1012320, 1012365, 1012410, 1012455, 1012500, 1012545, 1012590, 1012635, 1012680, 1012725, 1012770, 1012815, 1012860, 1012905, 1012950, 1012995, 1013040, 1013085, 1013130, 1013175, 1013220, 1013265, 1013310, 1013355, 1013400, 1013445, 1013490, 1013535, 1013580, 1013625, 1013670, 1013715, 1013760, 1013805, 1013850, 1013895, 1013940, 1013985, 1014030, 1014075, 1014120, 1014165, 1014210, 1014255, 1014300, 1014345, 1014390, 1014435, 1014480, 1014525, 1014570, 1014615, 1014660, 1014705, 1014750, 1014795, 1014840, 1014885, 1014930, 1014975, 1015020, 1015065, 1015110, 1015155, 1015200, 1015245, 1015290, 1015335, 1015380, 1015425, 1015470, 1015515, 1015560, 1015605, 1015650, 1015695, 1015740, 1015785, 1015830, 1015875, 1015920, 1015965, 1016010, 1016055, 1016100, 1016145, 1016190, 1016235, 1016280, 1016325, 1016370, 1016415, 1016460, 1016505, 1016550, 1016595, 1016640, 1016685, 1016730, 1016775, 1016820, 1016865, 1016910, 1016955, 1017000, 1017045, 1017090, 1017135, 1017180, 1017225, 1017270, 1017315, 1017360, 1017405, 1017450, 1017495, 1017540, 1017585, 1017630, 1017675, 1017720, 1017765, 1017810, 1017855, 1017900, 1017945, 1017990, 1018035, 1018080, 1018125, 1018170, 1018215, 1018260, 1018305, 1018350, 1018395, 1018440, 1018485, 1018530, 1018575, 1018620, 1018665, 1018710, 1018755, 1018800, 1018845, 1018890, 1018935, 1018980, 1019025, 1019070, 1019115, 1019160, 1019205, 1019250, 1019295, 1019340, 1019385, 1019430, 1019475, 1019520, 1019565, 1019610, 1019655, 1019700, 1019745, 1019790, 1019835, 1019880, 1019925, 1019970, 1020015, 1020060, 1020105, 1020150, 1020195, 1020240, 1020285, 1020330, 1020375, 1020420, 1020465, 1020510, 1020555, 1020600, 1020645, 1020690, 1020735, 1020780, 1020825, 1020870, 1020915, 1020960, 1021005, 1021050, 1021095, 1021140, 1021185, 1021230, 1021275, 1021320, 1021365, 1021410, 1021455, 1021500, 1021545, 1021590, 1021635, 1021680, 1021725, 1021770, 1021815, 1021860, 1021905, 1021950, 1021995, 1022040, 1022085, 1022130, 1022175, 1022220, 1022265, 1022310, 1022355, 1022400, 1016163, 977768, 977812, 977856, 977900, 977944, 977988, 978032, 978076, 978120, 978164, 978208, 978252, 978296, 978340, 978384, 978428, 978472, 978516, 978560, 978604, 978648, 978692, 978736, 978780, 978824, 978868, 978912, 978956, 979000, 979044, 979088, 979132, 979176, 979220, 979264, 979308, 979352, 979396, 979440, 979484, 979528, 979572, 979616, 979660, 979704, 979748, 979792, 979836, 979880, 979924, 979968, 980012, 980056, 980100, 980144, 980188, 980232, 980276, 980320, 980364, 980408, 980452, 980496, 980540, 980584, 980628, 980672, 980716, 980760, 980804, 980848, 980892, 980936, 980980, 981024, 981068, 981112, 981156, 981200, 981244, 981288, 981332, 981376, 981420, 981464, 981508, 981552, 981596, 981640, 981684, 981728, 981772, 981816, 981860, 981904, 981948, 981992, 982036, 982080, 982124, 982168, 982212, 982256, 982300, 982344, 982388, 982432, 982476, 982520, 982564, 982608, 982652, 982696, 982740, 982784, 982828, 982872, 982916, 982960, 983004, 983048, 983092, 983136, 983180, 983224, 983268, 983312, 983356, 983400, 983444, 983488, 983532, 983576, 983620, 983664, 983708, 983752, 983796, 983840, 983884, 983928, 983972, 984016, 984060, 984104, 984148, 984192, 984236, 984280, 984324, 984368, 984412, 984456, 984500, 984544, 984588, 984632, 984676, 984720, 984764, 984808, 984852, 984896, 984940, 984984, 985028, 985072, 985116, 985160, 985204, 985248, 985292, 985336, 985380, 985424, 985468, 985512, 985556, 985600, 985644, 985688, 985732, 985776, 985820, 985864, 985908, 985952, 985996, 986040, 986084, 986128, 986172, 986216, 986260, 986304, 986348, 986392, 986436, 986480, 986524, 986568, 986612, 986656, 986700, 986744, 986788, 986832, 986876, 986920, 986964, 987008, 987052, 987096, 987140, 987184, 987228, 987272, 987316, 987360, 987404, 987448, 987492, 987536, 987580, 987624, 987668, 987712, 987756, 987800, 987844, 987888, 987932, 987976, 988020, 988064, 988108, 988152, 988196, 988240, 988284, 988328, 988372, 988416, 988460, 988504, 988548, 988592, 988636, 988680, 988724, 988768, 988812, 988856, 988900, 988944, 988988, 989032, 989076, 989120, 989164, 989208, 989252, 989296, 989340, 989384, 989428, 989472, 989516, 989560, 989604, 989648, 989692, 989736, 989780, 989824, 989868, 989912, 989956, 990000]\n assert candidate(candies = 15,num_people = 4) == [6, 2, 3, 4]\n assert candidate(candies = 50,num_people = 7) == [9, 11, 8, 4, 5, 6, 7]\n assert candidate(candies = 300000000,num_people = 200) == [1500723, 1500846, 1500969, 1501092, 1501215, 1501338, 1501461, 1501584, 1501707, 1501830, 1501953, 1502076, 1502199, 1502322, 1502445, 1502568, 1502691, 1502814, 1502937, 1503060, 1503183, 1503306, 1503429, 1503552, 1503675, 1503798, 1503921, 1504044, 1504167, 1504290, 1504413, 1504536, 1504659, 1504782, 1504905, 1505028, 1505151, 1505274, 1505397, 1505520, 1505643, 1505766, 1505889, 1506012, 1506135, 1506258, 1506381, 1506504, 1506627, 1506750, 1506873, 1506996, 1507119, 1507242, 1507365, 1507488, 1507611, 1507734, 1507857, 1507980, 1508103, 1508226, 1508349, 1508472, 1508595, 1508718, 1508841, 1508964, 1509087, 1509210, 1509333, 1509456, 1509579, 1509702, 1509825, 1509948, 1510071, 1510194, 1510317, 1510440, 1510563, 1510686, 1510809, 1510932, 1511055, 1511178, 1511301, 1511424, 1511547, 1511670, 1511793, 1511916, 1512039, 1512162, 1497525, 1487912, 1488034, 1488156, 1488278, 1488400, 1488522, 1488644, 1488766, 1488888, 1489010, 1489132, 1489254, 1489376, 1489498, 1489620, 1489742, 1489864, 1489986, 1490108, 1490230, 1490352, 1490474, 1490596, 1490718, 1490840, 1490962, 1491084, 1491206, 1491328, 1491450, 1491572, 1491694, 1491816, 1491938, 1492060, 1492182, 1492304, 1492426, 1492548, 1492670, 1492792, 1492914, 1493036, 1493158, 1493280, 1493402, 1493524, 1493646, 1493768, 1493890, 1494012, 1494134, 1494256, 1494378, 1494500, 1494622, 1494744, 1494866, 1494988, 1495110, 1495232, 1495354, 1495476, 1495598, 1495720, 1495842, 1495964, 1496086, 1496208, 1496330, 1496452, 1496574, 1496696, 1496818, 1496940, 1497062, 1497184, 1497306, 1497428, 1497550, 1497672, 1497794, 1497916, 1498038, 1498160, 1498282, 1498404, 1498526, 1498648, 1498770, 1498892, 1499014, 1499136, 1499258, 1499380, 1499502, 1499624, 1499746, 1499868, 1499990, 1500112, 1500234, 1500356, 1500478, 1500600]\n assert candidate(candies = 5000,num_people = 20) == [205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260, 265, 270, 275, 280, 285, 290, 295, 250]\n assert candidate(candies = 15,num_people = 1) == [15]\n assert candidate(candies = 123456789,num_people = 987) == [118456, 118472, 118488, 118504, 118520, 118536, 118552, 118568, 118584, 118600, 118616, 118632, 118648, 118664, 118680, 118696, 118712, 118728, 118744, 118760, 118776, 118792, 118808, 118824, 118840, 118856, 118872, 118888, 118904, 118920, 118936, 118952, 118968, 118984, 119000, 119016, 119032, 119048, 119064, 119080, 119096, 119112, 119128, 119144, 119160, 119176, 119192, 119208, 119224, 119240, 119256, 119272, 119288, 119304, 119320, 119336, 119352, 119368, 119384, 119400, 119416, 119432, 119448, 119464, 119480, 119496, 119512, 119528, 119544, 119560, 119576, 119592, 119608, 119624, 119640, 119656, 119672, 119688, 119704, 119720, 119736, 119752, 119768, 119784, 119800, 119816, 119832, 119848, 119864, 119880, 119896, 119912, 119928, 119944, 119960, 119976, 119992, 120008, 120024, 120040, 120056, 120072, 120088, 120104, 120120, 120136, 120152, 120168, 120184, 120200, 120216, 120232, 120248, 120264, 120280, 120296, 120312, 120328, 120344, 120360, 120376, 120392, 120408, 120424, 120440, 120456, 120472, 120488, 120504, 120520, 120536, 120552, 120568, 120584, 120600, 120616, 120632, 120648, 120664, 120680, 120696, 120712, 120728, 120744, 120760, 120776, 120792, 120808, 120824, 120840, 120856, 120872, 120888, 120904, 120920, 120936, 120952, 120968, 120984, 121000, 121016, 121032, 121048, 121064, 121080, 121096, 121112, 121128, 121144, 121160, 121176, 121192, 121208, 121224, 121240, 121256, 121272, 121288, 121304, 121320, 121336, 121352, 121368, 121384, 121400, 121416, 121432, 121448, 121464, 121480, 121496, 121512, 121528, 121544, 121560, 121576, 121592, 121608, 121624, 121640, 121656, 121672, 121688, 121704, 121720, 121736, 121752, 121768, 121784, 121800, 121816, 121832, 121848, 121864, 121880, 121896, 121912, 121928, 121944, 121960, 121976, 121992, 122008, 122024, 122040, 122056, 122072, 122088, 122104, 122120, 122136, 122152, 122168, 122184, 122200, 122216, 122232, 122248, 122264, 122280, 122296, 122312, 122328, 122344, 122360, 122376, 122392, 122408, 122424, 122440, 122456, 122472, 122488, 122504, 122520, 122536, 122552, 122568, 122584, 122600, 122616, 122632, 122648, 122664, 122680, 122696, 122712, 122728, 122744, 122760, 122776, 122792, 122808, 122824, 122840, 122856, 122872, 122888, 122904, 122920, 122936, 122952, 122968, 122984, 123000, 123016, 123032, 123048, 123064, 123080, 123096, 123112, 123128, 123144, 123160, 123176, 123192, 123208, 123224, 123240, 123256, 123272, 123288, 123304, 123320, 123336, 123352, 123368, 123384, 123400, 123416, 123432, 123448, 123464, 123480, 123496, 123512, 123528, 123544, 123560, 123576, 123592, 123608, 123624, 123640, 123656, 123672, 123688, 123704, 123720, 123736, 123752, 123768, 123784, 123800, 123816, 123832, 123848, 123864, 123880, 123896, 123912, 123928, 123944, 123960, 123976, 123992, 124008, 124024, 124040, 124056, 124072, 124088, 124104, 124120, 124136, 124152, 124168, 124184, 124200, 124216, 124232, 124248, 124264, 124280, 124296, 124312, 124328, 124344, 124360, 124376, 124392, 124408, 124424, 124440, 124456, 124472, 124488, 124504, 124520, 124536, 124552, 124568, 124584, 124600, 124616, 124632, 124648, 124664, 124680, 124696, 124712, 124728, 124744, 124760, 124776, 124792, 124808, 124824, 124840, 124856, 124872, 124888, 124904, 124920, 124936, 124952, 124968, 124984, 125000, 125016, 125032, 125048, 125064, 125080, 125096, 125112, 125128, 125144, 125160, 125176, 125192, 125208, 125224, 125240, 125256, 125272, 125288, 125304, 125320, 125336, 125352, 125368, 125384, 125400, 125416, 125432, 125448, 125464, 125480, 125496, 125512, 125528, 125544, 125560, 125576, 125592, 125608, 125624, 125640, 125656, 125672, 125688, 125704, 125720, 125736, 125752, 125768, 125784, 125800, 125816, 125832, 125848, 125864, 125880, 125896, 125912, 125928, 125944, 125960, 125976, 125992, 126008, 126024, 126040, 126056, 126072, 126088, 126104, 126120, 126136, 126152, 126168, 126184, 126200, 126216, 126232, 126248, 126264, 126280, 126296, 126312, 126328, 126344, 126360, 126376, 126392, 126408, 126424, 126440, 126456, 126472, 126488, 126504, 126520, 126536, 126552, 126568, 126584, 126600, 126616, 126632, 126648, 126664, 126680, 126696, 126712, 126728, 126744, 126760, 126776, 126792, 126808, 126824, 126840, 126856, 126872, 126888, 126904, 126920, 126936, 126952, 126968, 126984, 127000, 127016, 127032, 127048, 127064, 127080, 127096, 127112, 127128, 127144, 127160, 127176, 127192, 127208, 127224, 127240, 127256, 127272, 127288, 127304, 127320, 127336, 127352, 127368, 127384, 127400, 127416, 127432, 127448, 127464, 127480, 127496, 127512, 127528, 127544, 127560, 127576, 127592, 127608, 127624, 127640, 127656, 127672, 127688, 127704, 127720, 127736, 127752, 127768, 127784, 127800, 127816, 127832, 127848, 127864, 127880, 127896, 127912, 127928, 127944, 127960, 127976, 127992, 128008, 128024, 128040, 128056, 128072, 128088, 128104, 128120, 128136, 128152, 128168, 128184, 128200, 128216, 128232, 128248, 128264, 128280, 128296, 128312, 128328, 128344, 128360, 128376, 128392, 128408, 128424, 128440, 128456, 128472, 128488, 128504, 128520, 128536, 128552, 128568, 128584, 128600, 128616, 128632, 128648, 128664, 128680, 128696, 128712, 128728, 128744, 128760, 128776, 128792, 128808, 128824, 128840, 128856, 128872, 128888, 128904, 128920, 128936, 128952, 128968, 128984, 129000, 129016, 129032, 129048, 129064, 129080, 129096, 129112, 129128, 129144, 129160, 129176, 129192, 129208, 129224, 129240, 129256, 129272, 129288, 129304, 129320, 129336, 129352, 129368, 129384, 129400, 129416, 129432, 129448, 129464, 129480, 129496, 129512, 129528, 129544, 129560, 129576, 129592, 129608, 129624, 129640, 129656, 129672, 129688, 129704, 129720, 129736, 129752, 129768, 129784, 129800, 129816, 129832, 129848, 129864, 129880, 129896, 129912, 129928, 129944, 129960, 129976, 129992, 130008, 130024, 130040, 130056, 130072, 130088, 130104, 130120, 130136, 130152, 130168, 130184, 130200, 130216, 130232, 130248, 130264, 130280, 130296, 130312, 130328, 130344, 130360, 130376, 130392, 130408, 130424, 130440, 130456, 130472, 130488, 130504, 130520, 130536, 130552, 130568, 130584, 130600, 130616, 130632, 130648, 130664, 130680, 130696, 130712, 130728, 130744, 130760, 130776, 130792, 130808, 130824, 130840, 130856, 130872, 130888, 130904, 130920, 130936, 130952, 130968, 130984, 131000, 131016, 131032, 131048, 131064, 131080, 131096, 131112, 131128, 131144, 131160, 131176, 131192, 131208, 131224, 131240, 131256, 131272, 131288, 131304, 131320, 131336, 131352, 131368, 131384, 131400, 131416, 131432, 131448, 131464, 131480, 131496, 131512, 131528, 131544, 131560, 131576, 131592, 131608, 131624, 131640, 131656, 131672, 131688, 131704, 131720, 131736, 131752, 131768, 131784, 131800, 131816, 131832, 131848, 131864, 131880, 131896, 131912, 131928, 131944, 131960, 131976, 131992, 132008, 132024, 132040, 132056, 132072, 132088, 132104, 132120, 132136, 132152, 132168, 132184, 132200, 132216, 132232, 132248, 132264, 132280, 132296, 132312, 132328, 132344, 132360, 132376, 132392, 132408, 132424, 132440, 132456, 132472, 132488, 132504, 132520, 132536, 132552, 132568, 132584, 132600, 132616, 132632, 132648, 132664, 132680, 132696, 132712, 132728, 132744, 132760, 132776, 132792, 132808, 132824, 132840, 132856, 132872, 132888, 132904, 132920, 132936, 132952, 132716, 117270, 117285, 117300, 117315, 117330, 117345, 117360, 117375, 117390, 117405, 117420, 117435, 117450, 117465, 117480, 117495, 117510, 117525, 117540, 117555, 117570, 117585, 117600, 117615, 117630, 117645, 117660, 117675, 117690, 117705, 117720, 117735, 117750, 117765, 117780, 117795, 117810, 117825, 117840, 117855, 117870, 117885, 117900, 117915, 117930, 117945, 117960, 117975, 117990, 118005, 118020, 118035, 118050, 118065, 118080, 118095, 118110, 118125, 118140, 118155, 118170, 118185, 118200, 118215, 118230, 118245, 118260, 118275, 118290, 118305, 118320, 118335, 118350, 118365, 118380, 118395, 118410, 118425, 118440]\n assert candidate(candies = 150,num_people = 4) == [42, 32, 36, 40]\n assert candidate(candies = 100,num_people = 2) == [49, 51]\n assert candidate(candies = 123456789,num_people = 123) == [999872, 1000000, 1000128, 1000256, 1000384, 1000512, 1000640, 1000768, 1000896, 1001024, 1001152, 1001280, 1001408, 1001536, 1001664, 1001792, 1001920, 1002048, 1002176, 1002304, 1002432, 1002560, 1002688, 1002816, 1002944, 1003072, 1003200, 1003328, 1003456, 1003584, 1003712, 1003840, 1003968, 1004096, 1004224, 1004352, 1004480, 1004608, 1004736, 1004864, 1004992, 1005120, 1005248, 1005376, 1005504, 1005632, 1005760, 1005888, 1006016, 1006144, 1006272, 1006400, 1006528, 1006656, 1006784, 1006912, 1007040, 1007168, 1007296, 1007424, 1007552, 1007680, 1007808, 1007936, 1008064, 1008192, 1008320, 1008448, 1008576, 1008704, 1008832, 1008960, 1009088, 1009216, 1009344, 1009472, 1009600, 1009728, 1009856, 1009984, 1010112, 1010240, 1010368, 1010496, 1010624, 1010752, 1010880, 1011008, 1011136, 1011264, 1011392, 1011268, 995934, 996061, 996188, 996315, 996442, 996569, 996696, 996823, 996950, 997077, 997204, 997331, 997458, 997585, 997712, 997839, 997966, 998093, 998220, 998347, 998474, 998601, 998728, 998855, 998982, 999109, 999236, 999363, 999490, 999617, 999744]\n assert candidate(candies = 3000,num_people = 20) == [124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 185, 114, 117, 120]\n assert candidate(candies = 200,num_people = 1) == [200]\n assert candidate(candies = 9,num_people = 3) == [4, 2, 3]\n assert candidate(candies = 2000000000,num_people = 2) == [1000014129, 999985871]\n assert candidate(candies = 120,num_people = 2) == [64, 56]\n assert candidate(candies = 1500,num_people = 50) == [52, 54, 56, 58, 20, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]\n assert candidate(candies = 100000,num_people = 2) == [50048, 49952]\n assert candidate(candies = 200000000,num_people = 100) == [1990200, 1990400, 1990600, 1990800, 1991000, 1991200, 1991400, 1991600, 1991800, 1992000, 1992200, 1992400, 1992600, 1992800, 1993000, 1993200, 1993400, 1993600, 1993800, 1994000, 1994200, 1994400, 1994600, 1994800, 1995000, 1995200, 1995400, 1995600, 1995800, 1996000, 1996200, 1996400, 1996600, 1996800, 1997000, 1997200, 1997400, 1997600, 1997800, 1998000, 1998200, 1998400, 1998600, 1998800, 1999000, 1999200, 1999400, 1999600, 1999800, 2000000, 2000200, 2000400, 2000600, 2000800, 2001000, 2001200, 2001400, 2001600, 2001800, 2002000, 2002200, 2002400, 2002600, 2002800, 2003000, 2003200, 2003400, 2003600, 2003800, 2004000, 2004200, 2004400, 2004600, 2004800, 2005000, 2005200, 2005400, 2005600, 2005800, 2006000, 2006200, 2006400, 2006600, 2006800, 2007000, 2007200, 2007400, 2007600, 2007800, 2008000, 2008200, 2008400, 2008600, 2008800, 2009000, 2009200, 2009400, 2009600, 2009800, 2000000]\n assert candidate(candies = 20,num_people = 1) == [20]\n assert candidate(candies = 1000000,num_people = 100) == [10515, 10530, 10545, 10560, 10575, 10590, 10605, 10620, 10635, 10650, 10665, 10680, 10695, 10305, 9310, 9324, 9338, 9352, 9366, 9380, 9394, 9408, 9422, 9436, 9450, 9464, 9478, 9492, 9506, 9520, 9534, 9548, 9562, 9576, 9590, 9604, 9618, 9632, 9646, 9660, 9674, 9688, 9702, 9716, 9730, 9744, 9758, 9772, 9786, 9800, 9814, 9828, 9842, 9856, 9870, 9884, 9898, 9912, 9926, 9940, 9954, 9968, 9982, 9996, 10010, 10024, 10038, 10052, 10066, 10080, 10094, 10108, 10122, 10136, 10150, 10164, 10178, 10192, 10206, 10220, 10234, 10248, 10262, 10276, 10290, 10304, 10318, 10332, 10346, 10360, 10374, 10388, 10402, 10416, 10430, 10444, 10458, 10472, 10486, 10500]\n assert candidate(candies = 123456789,num_people = 300) == [413453, 413506, 413559, 413612, 413665, 413718, 413771, 413824, 413877, 413930, 413983, 414036, 414089, 414142, 414195, 414248, 414301, 414354, 414407, 414460, 414513, 414566, 414619, 414672, 414725, 414778, 414831, 414884, 414937, 414990, 415043, 415096, 415149, 415202, 415255, 415308, 415361, 415414, 415467, 415520, 415573, 415626, 415679, 415732, 415785, 415838, 415891, 415944, 415997, 416050, 416103, 416156, 416209, 416262, 416315, 416368, 416421, 416474, 416527, 416580, 416633, 416686, 416739, 416792, 416845, 416898, 416951, 417004, 417057, 417110, 417163, 417216, 417269, 417322, 417375, 417428, 417481, 417534, 417587, 417640, 417693, 417746, 417799, 417852, 417905, 417958, 418011, 418064, 418117, 418170, 418223, 418276, 418329, 418382, 418435, 418488, 418541, 418594, 418647, 418700, 418753, 418806, 418859, 418912, 418965, 419018, 419071, 419124, 419177, 419230, 419283, 419336, 419137, 403728, 403780, 403832, 403884, 403936, 403988, 404040, 404092, 404144, 404196, 404248, 404300, 404352, 404404, 404456, 404508, 404560, 404612, 404664, 404716, 404768, 404820, 404872, 404924, 404976, 405028, 405080, 405132, 405184, 405236, 405288, 405340, 405392, 405444, 405496, 405548, 405600, 405652, 405704, 405756, 405808, 405860, 405912, 405964, 406016, 406068, 406120, 406172, 406224, 406276, 406328, 406380, 406432, 406484, 406536, 406588, 406640, 406692, 406744, 406796, 406848, 406900, 406952, 407004, 407056, 407108, 407160, 407212, 407264, 407316, 407368, 407420, 407472, 407524, 407576, 407628, 407680, 407732, 407784, 407836, 407888, 407940, 407992, 408044, 408096, 408148, 408200, 408252, 408304, 408356, 408408, 408460, 408512, 408564, 408616, 408668, 408720, 408772, 408824, 408876, 408928, 408980, 409032, 409084, 409136, 409188, 409240, 409292, 409344, 409396, 409448, 409500, 409552, 409604, 409656, 409708, 409760, 409812, 409864, 409916, 409968, 410020, 410072, 410124, 410176, 410228, 410280, 410332, 410384, 410436, 410488, 410540, 410592, 410644, 410696, 410748, 410800, 410852, 410904, 410956, 411008, 411060, 411112, 411164, 411216, 411268, 411320, 411372, 411424, 411476, 411528, 411580, 411632, 411684, 411736, 411788, 411840, 411892, 411944, 411996, 412048, 412100, 412152, 412204, 412256, 412308, 412360, 412412, 412464, 412516, 412568, 412620, 412672, 412724, 412776, 412828, 412880, 412932, 412984, 413036, 413088, 413140, 413192, 413244, 413296, 413348, 413400]\n assert candidate(candies = 12345,num_people = 123) == [125, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 133, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123]\n assert candidate(candies = 250,num_people = 25) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 19, 0, 0, 0]\n assert candidate(candies = 50,num_people = 3) == [17, 15, 18]\n assert candidate(candies = 25,num_people = 25) == [1, 2, 3, 4, 5, 6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(candies = 10000,num_people = 2) == [5030, 4970]\n assert candidate(candies = 123456789,num_people = 500) == [248032, 248064, 248096, 248128, 248160, 248192, 248224, 248256, 248288, 248320, 248352, 248384, 248416, 248448, 248480, 248512, 248544, 248576, 248608, 248640, 248672, 248704, 248736, 248768, 248800, 248832, 248864, 248896, 248928, 248960, 248992, 249024, 249056, 249088, 249120, 249152, 249184, 249216, 249248, 249280, 249312, 249344, 249376, 249408, 249440, 249472, 249504, 249536, 249568, 249600, 249632, 249664, 249696, 249728, 249760, 249792, 249824, 249856, 249888, 249920, 249952, 249984, 250016, 250048, 250080, 250112, 250144, 250176, 250208, 250240, 250272, 250304, 250336, 250368, 250400, 250432, 250464, 250496, 250528, 250560, 250592, 250624, 250656, 250688, 250720, 250752, 250784, 250816, 250848, 250880, 250912, 250944, 250976, 251008, 251040, 251072, 251104, 251136, 251168, 251200, 251232, 251264, 251296, 251328, 251360, 251392, 251424, 251456, 251488, 251520, 251552, 251584, 251616, 251648, 251680, 251712, 251744, 251776, 251808, 251840, 251872, 251904, 251936, 251968, 252000, 252032, 252064, 252096, 252128, 252160, 252192, 252224, 252256, 252288, 252320, 252352, 252384, 252416, 252448, 252480, 252512, 252544, 252576, 252608, 252640, 252672, 252704, 252736, 252768, 252800, 252832, 252864, 252896, 252928, 252960, 252992, 253024, 253056, 253088, 253120, 253152, 253184, 253216, 253248, 253280, 253312, 253344, 253376, 253408, 253440, 253472, 253504, 253536, 253568, 253600, 253632, 253664, 253696, 253728, 253760, 253792, 253824, 253856, 253888, 253920, 253952, 253984, 254016, 254048, 254080, 254112, 254144, 254176, 254208, 254240, 254272, 254304, 254336, 254368, 254400, 254432, 254464, 254496, 254528, 254560, 254592, 254624, 254656, 254688, 254720, 254752, 254784, 254564, 239134, 239165, 239196, 239227, 239258, 239289, 239320, 239351, 239382, 239413, 239444, 239475, 239506, 239537, 239568, 239599, 239630, 239661, 239692, 239723, 239754, 239785, 239816, 239847, 239878, 239909, 239940, 239971, 240002, 240033, 240064, 240095, 240126, 240157, 240188, 240219, 240250, 240281, 240312, 240343, 240374, 240405, 240436, 240467, 240498, 240529, 240560, 240591, 240622, 240653, 240684, 240715, 240746, 240777, 240808, 240839, 240870, 240901, 240932, 240963, 240994, 241025, 241056, 241087, 241118, 241149, 241180, 241211, 241242, 241273, 241304, 241335, 241366, 241397, 241428, 241459, 241490, 241521, 241552, 241583, 241614, 241645, 241676, 241707, 241738, 241769, 241800, 241831, 241862, 241893, 241924, 241955, 241986, 242017, 242048, 242079, 242110, 242141, 242172, 242203, 242234, 242265, 242296, 242327, 242358, 242389, 242420, 242451, 242482, 242513, 242544, 242575, 242606, 242637, 242668, 242699, 242730, 242761, 242792, 242823, 242854, 242885, 242916, 242947, 242978, 243009, 243040, 243071, 243102, 243133, 243164, 243195, 243226, 243257, 243288, 243319, 243350, 243381, 243412, 243443, 243474, 243505, 243536, 243567, 243598, 243629, 243660, 243691, 243722, 243753, 243784, 243815, 243846, 243877, 243908, 243939, 243970, 244001, 244032, 244063, 244094, 244125, 244156, 244187, 244218, 244249, 244280, 244311, 244342, 244373, 244404, 244435, 244466, 244497, 244528, 244559, 244590, 244621, 244652, 244683, 244714, 244745, 244776, 244807, 244838, 244869, 244900, 244931, 244962, 244993, 245024, 245055, 245086, 245117, 245148, 245179, 245210, 245241, 245272, 245303, 245334, 245365, 245396, 245427, 245458, 245489, 245520, 245551, 245582, 245613, 245644, 245675, 245706, 245737, 245768, 245799, 245830, 245861, 245892, 245923, 245954, 245985, 246016, 246047, 246078, 246109, 246140, 246171, 246202, 246233, 246264, 246295, 246326, 246357, 246388, 246419, 246450, 246481, 246512, 246543, 246574, 246605, 246636, 246667, 246698, 246729, 246760, 246791, 246822, 246853, 246884, 246915, 246946, 246977, 247008, 247039, 247070, 247101, 247132, 247163, 247194, 247225, 247256, 247287, 247318, 247349, 247380, 247411, 247442, 247473, 247504, 247535, 247566, 247597, 247628, 247659, 247690, 247721, 247752, 247783, 247814, 247845, 247876, 247907, 247938, 247969, 248000]\n assert candidate(candies = 123456789,num_people = 200) == [616279, 616358, 616437, 616516, 616595, 616674, 616753, 616832, 616911, 616990, 617069, 617148, 617227, 617306, 617385, 617464, 617543, 617622, 617701, 617780, 617859, 617938, 618017, 618096, 618175, 618254, 618333, 618412, 618491, 618570, 618649, 618728, 618807, 618886, 618965, 619044, 619123, 619202, 619281, 619360, 619439, 619518, 619597, 619676, 619755, 619834, 619913, 619992, 620071, 620150, 620229, 620308, 620387, 620466, 620545, 620624, 620703, 620782, 620861, 620940, 621019, 621098, 621177, 621256, 621335, 621414, 621493, 621572, 621651, 621730, 621809, 621888, 621967, 622046, 622125, 622204, 622283, 622362, 622441, 622520, 622599, 622678, 622757, 622836, 622915, 622994, 623073, 623152, 623231, 623310, 623389, 623468, 623547, 623626, 623705, 623784, 623863, 623942, 624021, 624100, 624179, 624258, 624337, 624416, 624495, 624574, 624653, 624732, 624811, 624890, 624969, 625048, 624875, 609492, 609570, 609648, 609726, 609804, 609882, 609960, 610038, 610116, 610194, 610272, 610350, 610428, 610506, 610584, 610662, 610740, 610818, 610896, 610974, 611052, 611130, 611208, 611286, 611364, 611442, 611520, 611598, 611676, 611754, 611832, 611910, 611988, 612066, 612144, 612222, 612300, 612378, 612456, 612534, 612612, 612690, 612768, 612846, 612924, 613002, 613080, 613158, 613236, 613314, 613392, 613470, 613548, 613626, 613704, 613782, 613860, 613938, 614016, 614094, 614172, 614250, 614328, 614406, 614484, 614562, 614640, 614718, 614796, 614874, 614952, 615030, 615108, 615186, 615264, 615342, 615420, 615498, 615576, 615654, 615732, 615810, 615888, 615966, 616044, 616122, 616200]\n assert candidate(candies = 1000000,num_people = 50) == [20329, 20358, 20387, 20416, 20445, 20474, 20503, 20532, 20561, 20590, 20619, 20648, 20677, 20301, 19320, 19348, 19376, 19404, 19432, 19460, 19488, 19516, 19544, 19572, 19600, 19628, 19656, 19684, 19712, 19740, 19768, 19796, 19824, 19852, 19880, 19908, 19936, 19964, 19992, 20020, 20048, 20076, 20104, 20132, 20160, 20188, 20216, 20244, 20272, 20300]\n assert candidate(candies = 8,num_people = 3) == [3, 2, 3]\n assert candidate(candies = 8,num_people = 2) == [4, 4]\n assert candidate(candies = 1,num_people = 100) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(candies = 1,num_people = 1000) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(candies = 88,num_people = 10) == [12, 14, 13, 4, 5, 6, 7, 8, 9, 10]\n assert candidate(candies = 2,num_people = 1) == [2]\n assert candidate(candies = 25,num_people = 10) == [1, 2, 3, 4, 5, 6, 4, 0, 0, 0]\n assert candidate(candies = 150,num_people = 8) == [24, 12, 14, 16, 18, 20, 22, 24]\n assert candidate(candies = 5000,num_people = 499) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(candies = 200,num_people = 4) == [45, 50, 55, 50]\n assert candidate(candies = 1000000,num_people = 500) == [1503, 1506, 1509, 1512, 1515, 1518, 1521, 1524, 1527, 1530, 1533, 1536, 1539, 1542, 1545, 1548, 1551, 1554, 1557, 1560, 1563, 1566, 1569, 1572, 1575, 1578, 1581, 1584, 1587, 1590, 1593, 1596, 1599, 1602, 1605, 1608, 1611, 1614, 1617, 1620, 1623, 1626, 1629, 1632, 1635, 1638, 1641, 1644, 1647, 1650, 1653, 1656, 1659, 1662, 1665, 1668, 1671, 1674, 1677, 1680, 1683, 1686, 1689, 1692, 1695, 1698, 1701, 1704, 1707, 1710, 1713, 1716, 1719, 1722, 1725, 1728, 1731, 1734, 1737, 1740, 1743, 1746, 1749, 1752, 1755, 1758, 1761, 1764, 1767, 1770, 1773, 1776, 1779, 1782, 1785, 1788, 1791, 1794, 1797, 1800, 1803, 1806, 1809, 1812, 1815, 1818, 1821, 1824, 1827, 1830, 1833, 1836, 1839, 1842, 1845, 1848, 1851, 1854, 1857, 1860, 1863, 1866, 1869, 1872, 1875, 1878, 1881, 1884, 1887, 1890, 1893, 1896, 1899, 1902, 1905, 1908, 1911, 1914, 1917, 1920, 1923, 1926, 1929, 1932, 1935, 1938, 1941, 1944, 1947, 1950, 1953, 1956, 1959, 1962, 1965, 1968, 1971, 1974, 1977, 1980, 1983, 1986, 1989, 1992, 1995, 1998, 2001, 2004, 2007, 2010, 2013, 2016, 2019, 2022, 2025, 2028, 2031, 2034, 2037, 2040, 2043, 2046, 2049, 2052, 2055, 2058, 2061, 2064, 2067, 2070, 2073, 2076, 2079, 2082, 2085, 2088, 2091, 2094, 2097, 2100, 2103, 2106, 2109, 2112, 2115, 2118, 2121, 2124, 2127, 2130, 2133, 2136, 2139, 2142, 2145, 2148, 2151, 2154, 2157, 2160, 2163, 2166, 2169, 2172, 2175, 2178, 2181, 2184, 2187, 2190, 2193, 2196, 2199, 2202, 2205, 2208, 2211, 2214, 2217, 2220, 2223, 2226, 2229, 2232, 2235, 2238, 2241, 2244, 2247, 2250, 2253, 2256, 2259, 2262, 2265, 2268, 2271, 2274, 2277, 2280, 2283, 2286, 2289, 2292, 2295, 2298, 2301, 2304, 2307, 2310, 2313, 2316, 2319, 2322, 2325, 2328, 2331, 2334, 2337, 2340, 2343, 2346, 2349, 2352, 2355, 2358, 2361, 2364, 2367, 2370, 2373, 2376, 2379, 2382, 2385, 2388, 2391, 2394, 2397, 2400, 2403, 2406, 2409, 2412, 2415, 2418, 2421, 2424, 2427, 2430, 2433, 2436, 2439, 2442, 2445, 2448, 2451, 2454, 2457, 2460, 2463, 2466, 2469, 2472, 2475, 2478, 2481, 2484, 2487, 2490, 2493, 2496, 2499, 2502, 2505, 2508, 2511, 2514, 2517, 2520, 2523, 2526, 2529, 2532, 2535, 2538, 2541, 2544, 2547, 2550, 2553, 2556, 2559, 2562, 2565, 2568, 2571, 2574, 2577, 2580, 2583, 2586, 2589, 2592, 2595, 2598, 2601, 2604, 2607, 2610, 2613, 2616, 2619, 2622, 2625, 2628, 2631, 2634, 2637, 2640, 2643, 2646, 2649, 2652, 2655, 2658, 2661, 2664, 2667, 2670, 2673, 2676, 2679, 2682, 2685, 2688, 2691, 2694, 2697, 2700, 2703, 2706, 2709, 2712, 2715, 2718, 2721, 2724, 2727, 2730, 2733, 2736, 2739, 2337, 1330, 1332, 1334, 1336, 1338, 1340, 1342, 1344, 1346, 1348, 1350, 1352, 1354, 1356, 1358, 1360, 1362, 1364, 1366, 1368, 1370, 1372, 1374, 1376, 1378, 1380, 1382, 1384, 1386, 1388, 1390, 1392, 1394, 1396, 1398, 1400, 1402, 1404, 1406, 1408, 1410, 1412, 1414, 1416, 1418, 1420, 1422, 1424, 1426, 1428, 1430, 1432, 1434, 1436, 1438, 1440, 1442, 1444, 1446, 1448, 1450, 1452, 1454, 1456, 1458, 1460, 1462, 1464, 1466, 1468, 1470, 1472, 1474, 1476, 1478, 1480, 1482, 1484, 1486, 1488, 1490, 1492, 1494, 1496, 1498, 1500]\n assert candidate(candies = 8,num_people = 4) == [1, 2, 3, 2]\n"}, "metadata": {"canonical_parameter_names": ["candies", "num_people"], "leetcode_dataset_entry_point": "Solution().distributeCandies", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var distributeCandies = function(candies, num_people) {", "container": null, "callable": "distributeCandies", "parameters": [{"name": "candies", "type": "number"}, {"name": "num_people", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1104, "task_id": "path-in-zigzag-labelled-binary-tree", "difficulty": "Medium", "problem_description": "In an infinite binary tree where every node has two children, the nodes are labelled in row order.\nIn the odd numbered rows (ie., the first, third, fifth,...), the labelling is left to right, while in the even numbered rows (second, fourth, sixth,...), the labelling is right to left.\n\nGiven the label of a node in this tree, return the labels in the path from the root of the tree to the node with that label.\n \nExample 1:\n\nInput: label = 14\nOutput: [1,3,4,14]\n\nExample 2:\n\nInput: label = 26\nOutput: [1,2,6,10,26]\n\n \nConstraints:\n\n1 <= label <= 10^6\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(label = 14) == [1, 3, 4, 14]\n assert candidate(label = 1023) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023]\n assert candidate(label = 3) == [1, 3]\n assert candidate(label = 1000000) == [1, 3, 4, 15, 17, 61, 69, 244, 279, 976, 1118, 3906, 4475, 15625, 17901, 62500, 71607, 250000, 286431, 1000000]\n assert candidate(label = 255) == [1, 3, 4, 15, 16, 63, 64, 255]\n assert candidate(label = 4) == [1, 3, 4]\n assert candidate(label = 13) == [1, 3, 5, 13]\n assert candidate(label = 15) == [1, 3, 4, 15]\n assert candidate(label = 6) == [1, 2, 6]\n assert candidate(label = 11) == [1, 2, 6, 11]\n assert candidate(label = 2) == [1, 2]\n assert candidate(label = 64) == [1, 3, 4, 15, 16, 63, 64]\n assert candidate(label = 8) == [1, 2, 7, 8]\n assert candidate(label = 1048575) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024, 4095, 4096, 16383, 16384, 65535, 65536, 262143, 262144, 1048575]\n assert candidate(label = 1) == [1]\n assert candidate(label = 9) == [1, 2, 7, 9]\n assert candidate(label = 26) == [1, 2, 6, 10, 26]\n assert candidate(label = 12) == [1, 3, 5, 12]\n assert candidate(label = 10) == [1, 2, 6, 10]\n assert candidate(label = 7) == [1, 2, 7]\n assert candidate(label = 5) == [1, 3, 5]\n assert candidate(label = 16) == [1, 3, 4, 15, 16]\n assert candidate(label = 5000) == [1, 3, 4, 14, 19, 56, 78, 227, 312, 910, 1250, 3643, 5000]\n assert candidate(label = 1024) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024]\n assert candidate(label = 31) == [1, 2, 7, 8, 31]\n assert candidate(label = 32768) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048, 8191, 8192, 32767, 32768]\n assert candidate(label = 524288) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048, 8191, 8192, 32767, 32768, 131071, 131072, 524287, 524288]\n assert candidate(label = 8192) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048, 8191, 8192]\n assert candidate(label = 768) == [1, 3, 5, 12, 23, 48, 95, 192, 383, 768]\n assert candidate(label = 786432) == [1, 3, 5, 12, 23, 48, 95, 192, 383, 768, 1535, 3072, 6143, 12288, 24575, 49152, 98303, 196608, 393215, 786432]\n assert candidate(label = 789012) == [1, 3, 5, 12, 23, 48, 95, 192, 382, 770, 1530, 3082, 6123, 12328, 24495, 49313, 97981, 197253, 391925, 789012]\n assert candidate(label = 65536) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024, 4095, 4096, 16383, 16384, 65535, 65536]\n assert candidate(label = 4095) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024, 4095]\n assert candidate(label = 511) == [1, 2, 7, 8, 31, 32, 127, 128, 511]\n assert candidate(label = 524287) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048, 8191, 8192, 32767, 32768, 131071, 131072, 524287]\n assert candidate(label = 98304) == [1, 2, 6, 11, 24, 47, 96, 191, 384, 767, 1536, 3071, 6144, 12287, 24576, 49151, 98304]\n assert candidate(label = 393216) == [1, 2, 6, 11, 24, 47, 96, 191, 384, 767, 1536, 3071, 6144, 12287, 24576, 49151, 98304, 196607, 393216]\n assert candidate(label = 18) == [1, 3, 4, 14, 18]\n assert candidate(label = 16383) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024, 4095, 4096, 16383]\n assert candidate(label = 512) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512]\n assert candidate(label = 16384) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024, 4095, 4096, 16383, 16384]\n assert candidate(label = 131072) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048, 8191, 8192, 32767, 32768, 131071, 131072]\n assert candidate(label = 262143) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024, 4095, 4096, 16383, 16384, 65535, 65536, 262143]\n assert candidate(label = 127) == [1, 2, 7, 8, 31, 32, 127]\n assert candidate(label = 4096) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024, 4095, 4096]\n assert candidate(label = 32) == [1, 2, 7, 8, 31, 32]\n assert candidate(label = 1572864) == [1, 2, 6, 11, 24, 47, 96, 191, 384, 767, 1536, 3071, 6144, 12287, 24576, 49151, 98304, 196607, 393216, 786431, 1572864]\n assert candidate(label = 777777) == [1, 2, 6, 11, 24, 47, 97, 189, 388, 759, 1552, 3038, 6211, 12152, 24846, 48611, 99385, 194444, 397543, 777777]\n assert candidate(label = 262144) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024, 4095, 4096, 16383, 16384, 65535, 65536, 262143, 262144]\n assert candidate(label = 500000) == [1, 2, 7, 8, 30, 34, 122, 139, 488, 559, 1953, 2237, 7812, 8950, 31250, 35803, 125000, 143215, 500000]\n assert candidate(label = 1234567) == [1, 3, 4, 14, 18, 58, 75, 233, 301, 933, 1205, 3732, 4822, 14930, 19290, 59723, 77160, 238895, 308641, 955580, 1234567]\n assert candidate(label = 2048) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048]\n assert candidate(label = 150) == [1, 2, 7, 9, 29, 37, 116, 150]\n assert candidate(label = 999999) == [1, 3, 4, 15, 17, 61, 69, 244, 279, 976, 1118, 3906, 4475, 15624, 17902, 62499, 71608, 249999, 286432, 999999]\n assert candidate(label = 888888) == [1, 3, 5, 13, 20, 54, 83, 217, 333, 868, 1335, 3472, 5343, 13888, 21374, 55555, 85496, 222222, 341987, 888888]\n assert candidate(label = 8191) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048, 8191]\n assert candidate(label = 196608) == [1, 3, 5, 12, 23, 48, 95, 192, 383, 768, 1535, 3072, 6143, 12288, 24575, 49152, 98303, 196608]\n assert candidate(label = 2147483647) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048, 8191, 8192, 32767, 32768, 131071, 131072, 524287, 524288, 2097151, 2097152, 8388607, 8388608, 33554431, 33554432, 134217727, 134217728, 536870911, 536870912, 2147483647]\n assert candidate(label = 128) == [1, 2, 7, 8, 31, 32, 127, 128]\n assert candidate(label = 2047) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047]\n assert candidate(label = 2097151) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048, 8191, 8192, 32767, 32768, 131071, 131072, 524287, 524288, 2097151]\n assert candidate(label = 67108864) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024, 4095, 4096, 16383, 16384, 65535, 65536, 262143, 262144, 1048575, 1048576, 4194303, 4194304, 16777215, 16777216, 67108863, 67108864]\n assert candidate(label = 8388607) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048, 8191, 8192, 32767, 32768, 131071, 131072, 524287, 524288, 2097151, 2097152, 8388607]\n assert candidate(label = 65535) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024, 4095, 4096, 16383, 16384, 65535]\n assert candidate(label = 983041) == [1, 3, 4, 15, 17, 60, 71, 240, 287, 960, 1151, 3840, 4607, 15360, 18431, 61440, 73727, 245760, 294911, 983041]\n assert candidate(label = 393215) == [1, 3, 5, 12, 23, 48, 95, 192, 383, 768, 1535, 3072, 6143, 12288, 24575, 49152, 98303, 196608, 393215]\n assert candidate(label = 32767) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048, 8191, 8192, 32767]\n assert candidate(label = 200000) == [1, 3, 5, 12, 23, 48, 94, 195, 377, 781, 1509, 3125, 6037, 12500, 24151, 50000, 96607, 200000]\n assert candidate(label = 131071) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048, 8191, 8192, 32767, 32768, 131071]\n assert candidate(label = 100000) == [1, 2, 6, 11, 24, 47, 97, 188, 390, 754, 1562, 3018, 6250, 12075, 25000, 48303, 100000]\n assert candidate(label = 33554431) == [1, 2, 7, 8, 31, 32, 127, 128, 511, 512, 2047, 2048, 8191, 8192, 32767, 32768, 131071, 131072, 524287, 524288, 2097151, 2097152, 8388607, 8388608, 33554431]\n assert candidate(label = 800000) == [1, 3, 5, 12, 23, 48, 94, 195, 377, 781, 1509, 3125, 6037, 12500, 24151, 50000, 96607, 200000, 386431, 800000]\n assert candidate(label = 123456) == [1, 2, 7, 8, 30, 35, 120, 142, 482, 571, 1929, 2285, 7716, 9143, 30864, 36575, 123456]\n assert candidate(label = 1048576) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024, 4095, 4096, 16383, 16384, 65535, 65536, 262143, 262144, 1048575, 1048576]\n assert candidate(label = 63) == [1, 3, 4, 15, 16, 63]\n assert candidate(label = 16777215) == [1, 3, 4, 15, 16, 63, 64, 255, 256, 1023, 1024, 4095, 4096, 16383, 16384, 65535, 65536, 262143, 262144, 1048575, 1048576, 4194303, 4194304, 16777215]\n assert candidate(label = 256) == [1, 3, 4, 15, 16, 63, 64, 255, 256]\n assert candidate(label = 17) == [1, 3, 4, 15, 17]\n"}, "metadata": {"canonical_parameter_names": ["label"], "leetcode_dataset_entry_point": "Solution().pathInZigZagTree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var pathInZigZagTree = function(label) {", "container": null, "callable": "pathInZigZagTree", "parameters": [{"name": "label", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1105, "task_id": "filling-bookcase-shelves", "difficulty": "Medium", "problem_description": "You are given an array books where books[i] = [thicknessi, heighti] indicates the thickness and height of the ith book. You are also given an integer shelfWidth.\nWe want to place these books in order onto bookcase shelves that have a total width shelfWidth.\nWe choose some of the books to place on this shelf such that the sum of their thickness is less than or equal to shelfWidth, then build another level of the shelf of the bookcase so that the total height of the bookcase has increased by the maximum height of the books we just put down. We repeat this process until there are no more books to place.\nNote that at each step of the above process, the order of the books we place is the same order as the given sequence of books.\n\nFor example, if we have an ordered list of 5 books, we might place the first and second book onto the first shelf, the third book on the second shelf, and the fourth and fifth book on the last shelf.\n\nReturn the minimum possible height that the total bookshelf can be after placing shelves in this manner.\n \nExample 1:\n\n\nInput: books = [[1,1],[2,3],[2,3],[1,1],[1,1],[1,1],[1,2]], shelfWidth = 4\nOutput: 6\nExplanation:\nThe sum of the heights of the 3 shelves is 1 + 3 + 2 = 6.\nNotice that book number 2 does not have to be on the first shelf.\n\nExample 2:\n\nInput: books = [[1,3],[2,4],[3,2]], shelfWidth = 6\nOutput: 4\n\n \nConstraints:\n\n1 <= books.length <= 1000\n1 <= thicknessi <= shelfWidth <= 1000\n1 <= heighti <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(books = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]],shelfWidth = 1) == 10\n assert candidate(books = [[1, 1], [2, 2], [3, 3]],shelfWidth = 5) == 4\n assert candidate(books = [[10, 1], [2, 2], [3, 3], [4, 4]],shelfWidth = 10) == 5\n assert candidate(books = [[5, 5], [5, 5], [5, 5]],shelfWidth = 10) == 10\n assert candidate(books = [[3, 1], [2, 2], [4, 3], [1, 4], [2, 5]],shelfWidth = 6) == 9\n assert candidate(books = [[1, 1], [2, 3], [2, 3], [1, 1], [1, 1], [1, 1], [1, 2]],shelfWidth = 4) == 6\n assert candidate(books = [[1, 1], [1, 1], [1, 1], [1, 1]],shelfWidth = 2) == 2\n assert candidate(books = [[1, 3], [2, 4], [3, 2]],shelfWidth = 6) == 4\n assert candidate(books = [[5, 5], [5, 5], [5, 5], [5, 5]],shelfWidth = 10) == 10\n assert candidate(books = [[1, 1000], [1, 1000], [1, 1000]],shelfWidth = 3) == 1000\n assert candidate(books = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1]],shelfWidth = 1) == 5\n assert candidate(books = [[3, 1], [2, 2], [1, 3]],shelfWidth = 5) == 4\n assert candidate(books = [[1, 2], [2, 3], [3, 4], [4, 5]],shelfWidth = 10) == 5\n assert candidate(books = [[10, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1]],shelfWidth = 10) == 7\n assert candidate(books = [[5, 5], [5, 5], [5, 5], [5, 5], [5, 5]],shelfWidth = 15) == 10\n assert candidate(books = [[10, 100], [5, 200], [5, 300], [10, 400], [5, 500], [5, 600], [10, 700], [10, 800], [5, 900], [5, 1000]],shelfWidth = 20) == 2200\n assert candidate(books = [[2, 1], [3, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10]],shelfWidth = 5) == 49\n assert candidate(books = [[3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10]],shelfWidth = 10) == 21\n assert candidate(books = [[5, 1], [4, 2], [3, 3], [2, 4], [1, 5], [5, 1], [4, 2], [3, 3], [2, 4], [1, 5]],shelfWidth = 15) == 10\n assert candidate(books = [[500, 1], [500, 2], [500, 3], [500, 4], [500, 5], [500, 6], [500, 7], [500, 8], [500, 9], [500, 10], [500, 11], [500, 12], [500, 13], [500, 14], [500, 15]],shelfWidth = 1000) == 64\n assert candidate(books = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]],shelfWidth = 1) == 15\n assert candidate(books = [[300, 100], [300, 200], [300, 300], [100, 400], [100, 500], [100, 600], [100, 700]],shelfWidth = 600) == 1100\n assert candidate(books = [[3, 1], [2, 5], [4, 7], [1, 2], [5, 3], [3, 4]],shelfWidth = 10) == 11\n assert candidate(books = [[5, 1], [4, 2], [3, 3], [2, 4], [1, 5], [5, 1], [4, 2], [3, 3], [2, 4], [1, 5], [5, 1], [4, 2], [3, 3], [2, 4], [1, 5]],shelfWidth = 10) == 18\n assert candidate(books = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1]],shelfWidth = 10) == 31\n assert candidate(books = [[3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3]],shelfWidth = 6) == 15\n assert candidate(books = [[1, 500], [2, 500], [3, 500], [4, 500], [5, 500]],shelfWidth = 5) == 2000\n assert candidate(books = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]],shelfWidth = 10) == 48\n assert candidate(books = [[10, 10], [9, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1]],shelfWidth = 20) == 25\n assert candidate(books = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]],shelfWidth = 3) == 4\n assert candidate(books = [[100, 500], [99, 499], [98, 498], [97, 497], [96, 496], [95, 495]],shelfWidth = 300) == 997\n assert candidate(books = [[10, 100], [10, 100], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]],shelfWidth = 20) == 101\n assert candidate(books = [[10, 1], [9, 2], [8, 3], [7, 4], [6, 5], [5, 6], [4, 7], [3, 8], [2, 9], [1, 10]],shelfWidth = 20) == 19\n assert candidate(books = [[2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11]],shelfWidth = 15) == 47\n assert candidate(books = [[1, 100], [2, 200], [3, 300], [4, 400], [5, 500], [6, 600], [7, 700], [8, 800], [9, 900], [10, 1000]],shelfWidth = 5) == 5300\n assert candidate(books = [[2, 1], [3, 2], [4, 3], [5, 4], [6, 5]],shelfWidth = 12) == 8\n assert candidate(books = [[1, 5], [1, 5], [1, 5], [1, 5], [1, 5], [1, 5], [1, 5], [1, 5], [1, 5], [1, 5], [1, 5], [1, 5]],shelfWidth = 5) == 15\n assert candidate(books = [[1, 500], [2, 500], [3, 500], [4, 500], [5, 500]],shelfWidth = 10) == 1000\n assert candidate(books = [[10, 1], [9, 2], [8, 3], [7, 4], [6, 5], [5, 6], [4, 7], [3, 8], [2, 9], [1, 10]],shelfWidth = 15) == 21\n assert candidate(books = [[10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 6], [10, 7], [10, 8], [10, 9], [10, 10]],shelfWidth = 20) == 30\n assert candidate(books = [[100, 100], [100, 200], [100, 300], [100, 400], [100, 500], [100, 600], [100, 700], [100, 800], [100, 900], [100, 1000]],shelfWidth = 300) == 2200\n assert candidate(books = [[5, 10], [10, 5], [15, 10], [20, 5], [25, 10], [30, 5], [35, 10], [40, 5], [45, 10], [50, 5]],shelfWidth = 50) == 55\n assert candidate(books = [[100, 100], [90, 90], [80, 80], [70, 70], [60, 60], [50, 50], [40, 40], [30, 30], [20, 20], [10, 10]],shelfWidth = 100) == 480\n assert candidate(books = [[500, 500], [500, 400], [300, 300], [200, 200], [100, 100]],shelfWidth = 1000) == 800\n assert candidate(books = [[2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10]],shelfWidth = 5) == 30\n assert candidate(books = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11]],shelfWidth = 15) == 41\n assert candidate(books = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13]],shelfWidth = 13) == 77\n assert candidate(books = [[5, 1], [1, 5], [3, 3], [2, 2], [4, 4], [6, 6], [7, 7]],shelfWidth = 12) == 18\n assert candidate(books = [[100, 1], [200, 2], [300, 3], [400, 4], [500, 5], [600, 6], [700, 7], [800, 8], [900, 9], [1000, 10]],shelfWidth = 1000) == 48\n assert candidate(books = [[2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 1]],shelfWidth = 15) == 30\n assert candidate(books = [[5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10]],shelfWidth = 15) == 22\n assert candidate(books = [[1, 1000], [2, 999], [3, 998], [4, 997], [5, 996], [6, 995], [7, 994], [8, 993], [9, 992], [10, 991]],shelfWidth = 15) == 4971\n assert candidate(books = [[7, 7], [7, 6], [7, 5], [7, 4], [7, 3], [7, 2], [7, 1]],shelfWidth = 14) == 16\n assert candidate(books = [[10, 100], [20, 200], [30, 300], [40, 400], [50, 500], [60, 600], [70, 700], [80, 800], [90, 900]],shelfWidth = 150) == 2600\n assert candidate(books = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1]],shelfWidth = 15) == 21\n assert candidate(books = [[10, 1], [9, 2], [8, 3], [7, 4], [6, 5], [5, 6], [4, 7], [3, 8], [2, 9], [1, 10]],shelfWidth = 25) == 15\n assert candidate(books = [[2, 10], [1, 5], [3, 15], [4, 20], [2, 8]],shelfWidth = 10) == 28\n assert candidate(books = [[10, 5], [9, 4], [8, 3], [7, 2], [6, 1], [5, 6], [4, 7], [3, 8], [2, 9], [1, 10]],shelfWidth = 20) == 19\n assert candidate(books = [[7, 3], [8, 4], [6, 5], [5, 6], [9, 7], [10, 8], [8, 9]],shelfWidth = 20) == 20\n assert candidate(books = [[1, 100], [2, 200], [3, 300], [4, 400], [5, 500], [6, 600], [7, 700], [8, 800], [9, 900], [10, 1000]],shelfWidth = 10) == 4800\n assert candidate(books = [[1, 1000], [2, 999], [3, 998], [4, 997], [5, 996], [6, 995], [7, 994], [8, 993], [9, 992], [10, 991]],shelfWidth = 10) == 6961\n assert candidate(books = [[250, 500], [500, 250], [250, 750], [750, 250], [500, 500], [500, 500], [250, 250], [250, 250], [250, 250], [250, 250]],shelfWidth = 1000) == 1750\n assert candidate(books = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]],shelfWidth = 15) == 36\n assert candidate(books = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10]],shelfWidth = 5) == 15\n assert candidate(books = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50]],shelfWidth = 60) == 120\n assert candidate(books = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]],shelfWidth = 15) == 17\n assert candidate(books = [[5, 10], [4, 20], [3, 30], [2, 40], [1, 50], [5, 10], [4, 20], [3, 30], [2, 40], [1, 50]],shelfWidth = 15) == 100\n assert candidate(books = [[7, 8], [6, 7], [5, 6], [4, 5], [3, 4], [2, 3], [1, 2]],shelfWidth = 10) == 25\n assert candidate(books = [[3, 10], [2, 5], [1, 20], [4, 1], [5, 30], [3, 20], [2, 10], [1, 5], [4, 25], [5, 15]],shelfWidth = 10) == 75\n assert candidate(books = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10]],shelfWidth = 1) == 55\n assert candidate(books = [[5, 10], [4, 8], [3, 6], [2, 4], [1, 2], [1, 2], [2, 4], [3, 6], [4, 8], [5, 10]],shelfWidth = 10) == 32\n assert candidate(books = [[1000, 1], [1000, 2], [1000, 3], [1000, 4], [1000, 5], [1000, 6], [1000, 7], [1000, 8], [1000, 9], [1000, 10]],shelfWidth = 1000) == 55\n assert candidate(books = [[1, 500], [2, 400], [3, 300], [4, 200], [5, 100]],shelfWidth = 15) == 500\n assert candidate(books = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]],shelfWidth = 15) == 10\n assert candidate(books = [[10, 1], [20, 2], [30, 3], [40, 4], [50, 5], [60, 6], [70, 7], [80, 8], [90, 9], [100, 10]],shelfWidth = 150) == 36\n assert candidate(books = [[5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5]],shelfWidth = 15) == 20\n assert candidate(books = [[3, 1], [1, 2], [1, 3], [3, 4], [2, 5], [1, 1], [2, 2], [3, 3], [1, 1]],shelfWidth = 5) == 13\n assert candidate(books = [[2, 1], [1, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]],shelfWidth = 15) == 36\n assert candidate(books = [[3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10]],shelfWidth = 10) == 22\n assert candidate(books = [[10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 6], [10, 7], [10, 8], [10, 9], [10, 10]],shelfWidth = 10) == 55\n assert candidate(books = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]],shelfWidth = 5) == 2\n assert candidate(books = [[100, 1], [90, 2], [80, 3], [70, 4], [60, 5], [50, 6], [40, 7], [30, 8], [20, 9], [10, 10]],shelfWidth = 150) == 21\n assert candidate(books = [[5, 2], [3, 5], [4, 1], [6, 3], [2, 8], [1, 4], [7, 6]],shelfWidth = 15) == 15\n assert candidate(books = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]],shelfWidth = 5) == 53\n assert candidate(books = [[1, 1000], [2, 900], [3, 800], [4, 700], [5, 600], [6, 500], [7, 400], [8, 300], [9, 200], [10, 100]],shelfWidth = 15) == 2100\n assert candidate(books = [[1, 999], [2, 998], [3, 997], [4, 996], [5, 995], [6, 994], [7, 993], [8, 992], [9, 991], [10, 990]],shelfWidth = 1500) == 999\n assert candidate(books = [[1, 200], [1, 100], [1, 150], [1, 50], [1, 250], [1, 100]],shelfWidth = 2) == 600\n assert candidate(books = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]],shelfWidth = 10) == 29\n assert candidate(books = [[5, 10], [10, 5], [5, 5], [5, 10], [10, 5], [5, 5], [5, 10], [10, 5], [5, 5]],shelfWidth = 15) == 40\n assert candidate(books = [[1, 3], [2, 4], [3, 2], [4, 1], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]],shelfWidth = 12) == 44\n assert candidate(books = [[3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]],shelfWidth = 20) == 23\n assert candidate(books = [[5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5]],shelfWidth = 10) == 25\n assert candidate(books = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15]],shelfWidth = 10) == 113\n assert candidate(books = [[2, 10], [3, 9], [4, 8], [5, 7], [6, 6], [7, 5], [8, 4], [9, 3], [10, 2]],shelfWidth = 15) == 25\n assert candidate(books = [[3, 5], [2, 8], [1, 7], [4, 4], [5, 6], [6, 3], [7, 2], [8, 9]],shelfWidth = 12) == 25\n assert candidate(books = [[10, 1], [9, 2], [8, 3], [7, 4], [6, 5], [5, 6], [4, 7], [3, 8], [2, 9], [1, 10], [1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1]],shelfWidth = 20) == 30\n assert candidate(books = [[5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [5, 10]],shelfWidth = 20) == 18\n assert candidate(books = [[1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000], [1, 1000]],shelfWidth = 3) == 7000\n assert candidate(books = [[50, 50], [100, 100], [150, 150], [200, 200], [250, 250], [300, 300], [350, 350], [400, 400], [450, 450], [500, 500]],shelfWidth = 1000) == 1250\n assert candidate(books = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10]],shelfWidth = 10) == 10\n assert candidate(books = [[7, 8], [6, 9], [5, 10], [4, 11], [3, 12], [2, 13], [1, 14]],shelfWidth = 20) == 23\n"}, "metadata": {"canonical_parameter_names": ["books", "shelfWidth"], "leetcode_dataset_entry_point": "Solution().minHeightShelves", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minHeightShelves = function(books, shelfWidth) {", "container": null, "callable": "minHeightShelves", "parameters": [{"name": "books", "type": "number[][]"}, {"name": "shelfWidth", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1106, "task_id": "parsing-a-boolean-expression", "difficulty": "Hard", "problem_description": "A boolean expression is an expression that evaluates to either true or false. It can be in one of the following shapes:\n\n't' that evaluates to true.\n'f' that evaluates to false.\n'!(subExpr)' that evaluates to the logical NOT of the inner expression subExpr.\n'&(subExpr1, subExpr2, ..., subExprn)' that evaluates to the logical AND of the inner expressions subExpr1, subExpr2, ..., subExprn where n >= 1.\n'|(subExpr1, subExpr2, ..., subExprn)' that evaluates to the logical OR of the inner expressions subExpr1, subExpr2, ..., subExprn where n >= 1.\n\nGiven a string expression that represents a boolean expression, return the evaluation of that expression.\nIt is guaranteed that the given expression is valid and follows the given rules.\n \nExample 1:\n\nInput: expression = \"&(|(f))\"\nOutput: false\nExplanation: \nFirst, evaluate |(f) --> f. The expression is now \"&(f)\".\nThen, evaluate &(f) --> f. The expression is now \"f\".\nFinally, return false.\n\nExample 2:\n\nInput: expression = \"|(f,f,f,t)\"\nOutput: true\nExplanation: The evaluation of (false OR false OR false OR true) is true.\n\nExample 3:\n\nInput: expression = \"!(&(f,t))\"\nOutput: true\nExplanation: \nFirst, evaluate &(f,t) --> (false AND true) --> false --> f. The expression is now \"!(f)\".\nThen, evaluate !(f) --> NOT false --> true. We return true.\n\n \nConstraints:\n\n1 <= expression.length <= 2 * 104\nexpression[i] is one following characters: '(', ')', '&', '|', '!', 't', 'f', and ','.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(expression = \"!(!(t))\") == True\n assert candidate(expression = \"|(t,t,t)\") == True\n assert candidate(expression = \"|(f,f,f,t)\") == True\n assert candidate(expression = \"&(t,t,t,t,t,t)\") == True\n assert candidate(expression = \"!(&(&(t,f),|(t,t)))\") == True\n assert candidate(expression = \"&(|(f,t),&(t,f))\") == False\n assert candidate(expression = \"!(|(t,t))\") == False\n assert candidate(expression = \"|(&(t,f),&(f,t))\") == False\n assert candidate(expression = \"!(&(f,t))\") == True\n assert candidate(expression = \"|(f,t,f,t)\") == True\n assert candidate(expression = \"!(f)\") == True\n assert candidate(expression = \"&(f,t)\") == False\n assert candidate(expression = \"&(!(t),f)\") == False\n assert candidate(expression = \"!(&(|(f),&(f,t)))\") == True\n assert candidate(expression = \"&(t,|(f,f,f,t),!(&(f,t)))\") == True\n assert candidate(expression = \"&(t,t,t,t)\") == True\n assert candidate(expression = \"&(|(f))\") == False\n assert candidate(expression = \"!(&(|(t),|(f)),&(t,f))\") == True\n assert candidate(expression = \"|(f,f,f,f,f,f)\") == False\n assert candidate(expression = \"t\") == True\n assert candidate(expression = \"|(t,f)\") == True\n assert candidate(expression = \"f\") == False\n assert candidate(expression = \"|(|(t,f),&(f,f))\") == True\n assert candidate(expression = \"!(t)\") == False\n assert candidate(expression = \"|(&(t,f),t)\") == True\n assert candidate(expression = \"!(!(!(t)))\") == False\n assert candidate(expression = \"|(&(f,t),|(t,f))\") == True\n assert candidate(expression = \"&(|(t,f),&(f,t),|(t,t),&(f,f))\") == False\n assert candidate(expression = \"|(t,f,t,f)\") == True\n assert candidate(expression = \"&(t,t,t)\") == True\n assert candidate(expression = \"&(|(t,f),|(f,t))\") == True\n assert candidate(expression = \"|(f,&(t,f),|(f,f))\") == False\n assert candidate(expression = \"&(|(t,f),&(f,t))\") == False\n assert candidate(expression = \"|(&(t,f),|(t,t))\") == True\n assert candidate(expression = \"|(f,!(t),&(|(f,f),|(t,t)))\") == False\n assert candidate(expression = \"&(|(|(|(t,f),f),t),!(f),&(t,!(f)))\") == True\n assert candidate(expression = \"|(&(t,|(f,f),t),&(f,!(t),t),|(t,f,f))\") == True\n assert candidate(expression = \"!(&(|(f,t,f),&(t,f)),|(t,t,f))\") == True\n assert candidate(expression = \"&(|(t,&(f,f),t),&(f,|(t,f),t),|(&(f,t),f))\") == False\n assert candidate(expression = \"|(&(t,|(f,f,f)),!(|(t,t,t)),&(f,f))\") == False\n assert candidate(expression = \"&(|(&(t,f),&(f,f)),&(t,!(t)),f)\") == False\n assert candidate(expression = \"&(|(f,t),&(t,f),|(f,t),&(t,f),|(f,t),&(t,f),|(f,t),&(t,f))\") == False\n assert candidate(expression = \"&(f,!(t),|(&(t,!(t)),|(t,f,f,t,f)),&(f,f,t,t,t,t,f,t))\") == False\n assert candidate(expression = \"&(t,|(f,!(t),&(t,f,t,t),|(f,f,f,f)),&(f,|(t,f,t,t,t)),!(f,|(t,f,f,f,f)),&(t,t,t),t)\") == False\n assert candidate(expression = \"|(&(t,f),&(f,t),|(t,t),|(f,f),!(t),!(f),&(t,|(t,t)),|(t,&(t,f)))\") == True\n assert candidate(expression = \"|(&(f,t),&(t,f),&(f,t),&(t,f),&(f,t),&(t,f),&(f,t),&(t,f))\") == False\n assert candidate(expression = \"|(|(|(|(|(|(|(|(t),f),t),f),f),f),&(t,t,t,t,t,t,t,t),|(t,f,f,t,f),&(f,f,t,t,t,t,f,t),f,t)\") == False\n assert candidate(expression = \"|(&(t,!(f)),&(f,!(t)),&(t,t),!(f))\") == True\n assert candidate(expression = \"|(f,!(t),&(t,f),!(f))\") == True\n assert candidate(expression = \"|(&(f,t),|(t,f),!(f))\") == True\n assert candidate(expression = \"!(&(|(f,t),&(f,f)),|(t,t,t))\") == True\n assert candidate(expression = \"&(|(f,f,t),!(t),|(f,f,f),&(|(t,f),f),|(t,t,t))\") == False\n assert candidate(expression = \"!(&(|(t,f,f),f),|(t,t,t))\") == True\n assert candidate(expression = \"&(f,!(t),&(t,!(f)),|(f,t))\") == False\n assert candidate(expression = \"&(|(t,f),|(f,t),&(t,t),|(t,t),&(t,f),|(f,t))\") == False\n assert candidate(expression = \"!(&(|(f,!(t),&(t,f)),!(|(f,f,t)),&(t,f),|(f,t,t,t),&(t,|(f,f,f),t),&(t,f,f,t),|(t,!(f),f),f,!(t),&(f,t,f),|(t,f,t),f,!(t),&(f,t,f),|(t,f,t),f))\") == True\n assert candidate(expression = \"!(&(|(&(f,t),f),f))\") == True\n assert candidate(expression = \"|(f,!(f),&(t,f),|(t,t,f,f),&(t,t,t,t))\") == True\n assert candidate(expression = \"&(|(f,f,t),!(t),|(f,t,f))\") == False\n assert candidate(expression = \"!(&(|(&(t,f),&(f,f)),&(t,t),f))\") == True\n assert candidate(expression = \"&(f,!(t),|(f,f,t),&(t,t,t))\") == False\n assert candidate(expression = \"&(t,|(f,!(t),&(t,f,t),|(f,f,f)),&(f,|(t,f,t,t)),!(f,|(t,f)))\") == False\n assert candidate(expression = \"!(&(|(t,f),f),&(t,t,t))\") == True\n assert candidate(expression = \"&(t,|(f,!(t),&(t,f)),&(f,|(t,f,t)),!(f))\") == False\n assert candidate(expression = \"&(&(t,t),&(t,|(t,t)),&(t,|(t,|(t,t))),&(t,|(t,|(t,|(t,t)))))\") == True\n assert candidate(expression = \"!(&(|(f,t),&(t,f)),|(f,f,f,f))\") == True\n assert candidate(expression = \"&(|(f,f,t),!(t),|(f,f,f))\") == False\n assert candidate(expression = \"&(f,|(&(f,t),f),|(t,t),!(&(f,t)))\") == False\n assert candidate(expression = \"!(&(|(|(f,t),f),&(f,t,f,t)),|(f,f,f,f,f,t,t),&(t,t,t,t,t,t,t,t))\") == True\n assert candidate(expression = \"&(f,!(t),|(&(t,!(t)),|(t,f,f,t,f)),&(f,f,t,t,t,t),&(t,t,t,t,t,t,t,t),f)\") == False\n assert candidate(expression = \"&(|(|(|(f),f),t),&(t,f,t),!(f))\") == False\n assert candidate(expression = \"!(&(|(t,f),&(f,t)),|(t,t))\") == True\n assert candidate(expression = \"&(|(t,t,t),&(t,t,t),&(f,f,f),|(t,t,t),|(f,f,f))\") == False\n assert candidate(expression = \"!(&(!(f),t),|(f,&(t,f),f),&(t,f))\") == True\n assert candidate(expression = \"&(|(t,!(f),&(t,f)),!(|(f,f,t)),&(t,f),|(f,t,t,t))\") == False\n assert candidate(expression = \"&(|(t,!(f),&(f,t)),|(t,!(t),&(f,f)),|(t,t))\") == True\n assert candidate(expression = \"|(&(t,!(t)),f,!(f),t)\") == True\n assert candidate(expression = \"!(&(&(t,t),&(f,f)),|(&(t,f),&(t,t)))\") == True\n assert candidate(expression = \"&(f,|(&(f,t),f),|(t,t))\") == False\n assert candidate(expression = \"|(&(t,!(t)),f,!(f),t,!(|(&(f,t),f)))\") == True\n assert candidate(expression = \"!(&(f,|(&(t,f),f),&(t,t,t)))\") == True\n assert candidate(expression = \"|(f,&(|(t,f),&(t,f)),|(t,f))\") == True\n assert candidate(expression = \"&(t,!(f),|(&(t,t),|(f,f)),&(|(t,f),f))\") == False\n assert candidate(expression = \"!(&(|(&(t,f),t),&(f,|(t,f,t))),|(f,!(t),&(t,f,t)),!(f))\") == True\n assert candidate(expression = \"&(|(t,f),&(t,f),|(t,t),|(f,f),&(t,!(f)))\") == False\n assert candidate(expression = \"|(|(|(f),f),f)\") == False\n assert candidate(expression = \"&(f,!(t),&(t,!(f)),|(f,t),!(&(t,!(t))))\") == False\n assert candidate(expression = \"|(|(|(|(|(t),f),t),f),&(t,!(f)))\") == True\n assert candidate(expression = \"|(|(|(|(|(|(|(|(f),f),f),f),f),f),f),f)\") == False\n assert candidate(expression = \"!(&(|(f,f,f,t),!(t),|(t,t,t)),|(f,&(t,|(f,t),&(f,f)),!(f)))\") == True\n assert candidate(expression = \"&(|(|(|(|(t),f),t),f),&(t,t,t,t,t,t,t,t),|(t,f,f,t,f),&(f,f,t,t,t,t,f,t),f)\") == False\n assert candidate(expression = \"|(f,&(|(f,f),t),&(f,|(t,f),f),!(f))\") == True\n assert candidate(expression = \"&(|(|(t,f),f),&(t,!(f)),!(|(t,f)))\") == False\n assert candidate(expression = \"&(|(f,f,f),|(t,f,t),&(t,t))\") == False\n assert candidate(expression = \"&(|(t,&(f,t)),|(t,|(f,f)),&(t,|(t,|(f,t))),|(t,&(f,|(f,t))))\") == True\n assert candidate(expression = \"!(|(f,&(t,|(t,f)),!(t)))\") == False\n assert candidate(expression = \"!(&(|(|(|(|(f),t),f),t),&(t,f,t),!(f),|(t,f)))\") == True\n assert candidate(expression = \"!(&(|(t,f),&(f,f)),!(|(t,t,t,t)))\") == True\n assert candidate(expression = \"&(|(f,f,t),&(f,f,f),!(t),|(t,f,f,f,t),&(f,t,t,f))\") == False\n assert candidate(expression = \"!(&(|(&(t,|(f,t)),t),&(f,!(t),t)),|(t,!(f),&(f,f)))\") == True\n assert candidate(expression = \"&(|(f,f,f,t),|(t,f,t,f),&(t,t,t,t))\") == True\n assert candidate(expression = \"|(f,&(t,|(f,t),&(f,f)),!(f))\") == True\n assert candidate(expression = \"|(|(|(|(|(|(|(t),f),t),f),f),f),&(t,t,t,t,t,t,t,t),&(t,t,t,t,t,t,t,t))\") == True\n assert candidate(expression = \"&(|(t,f),!(f),&(t,t,t))\") == True\n assert candidate(expression = \"|(t,&(|(f,f),&(t,f)),&(t,|(t,f),&(f,f)))\") == True\n assert candidate(expression = \"!(|(|(|(f,t),t),f),&(f,|(t,!(t),f),&(t,t,t,t,t,t)))\") == True\n assert candidate(expression = \"!(|(&(f,t),|(t,f),&(f,f),|(t,t),&(t,f),|(f,f)))\") == False\n assert candidate(expression = \"|(&(t,t,t,t),|(|(f,f),f),&(t,f,f,t,t),!(t))\") == True\n assert candidate(expression = \"|(&(f,t),&(t,f),|(t,t))\") == True\n assert candidate(expression = \"|(|(f,f,f),&(t,t,t),!(|(f,f)))\") == True\n assert candidate(expression = \"!(&(|(&(f,f),t),f),|(f,|(t,f),&(f,t)))\") == True\n assert candidate(expression = \"|(&(t,t,t,t),|(f,f,f,f),&(t,f,t,f))\") == True\n assert candidate(expression = \"|(&(t,f,!(t)),&(t,f,t),&(f,!(t)),!(f),t)\") == True\n assert candidate(expression = \"&(|(|(f,t),t),f),&(f,|(t,!(t),f),&(t,t,t,t,t,t)),!(|(t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t))\") == False\n assert candidate(expression = \"!(&(t,!(f),&(t,t),|(t,f),&(t,!(t),&(f,f))))\") == True\n assert candidate(expression = \"!(&(|(f,f),&(t,t),&(t,f)),|(t,!(t),&(t,f)),&(t,t))\") == True\n assert candidate(expression = \"!(&(|(|(|(|(|(f),t),f),t),&(t,f,t),!(f),|(t,f)),&(f,t,t,f),!(t))\") == False\n assert candidate(expression = \"|(&(t,f),&(t,t,t),!(f),&(f,!(t)))\") == True\n assert candidate(expression = \"!(!(!(!(!(t)))))\") == False\n assert candidate(expression = \"&(|(t,f),|(f,t),&(t,t),|(t,t),&(t,f),|(f,t),!(t),!(f),&(t,|(t,t)),|(t,&(t,f)),&(f,|(t,f)),|(f,|(t,f)))\") == False\n assert candidate(expression = \"&(f,|(t,|(f,!(t))))\") == False\n assert candidate(expression = \"|(|(|(|(|(f),f),t),&(t,f,t),!(f),|(t,f)),&(f,t,t,f))\") == True\n assert candidate(expression = \"!(&(&(t,t),|(f,f),&(f,t)))\") == True\n assert candidate(expression = \"!(&(|(&(t,f),f),&(t,|(t,f))),|(t,!(f),t))\") == True\n assert candidate(expression = \"!(&(|(&(t,f),t),&(f,|(t,f))),|(f,!(t)))\") == True\n assert candidate(expression = \"&(f,&(|(f,f,t),!(t),|(f,f,f)),|(f,&(t,|(f,t),&(f,f)),!(f)),!(&(|(f,f,f,t),!(t),|(t,t,t)),|(f,&(t,|(f,t),&(f,f)),!(f))))\") == False\n assert candidate(expression = \"|(&(f,t,f),|(t,f,t),&(t,t,t,t,t))\") == True\n assert candidate(expression = \"|(|(|(t,f),f),&(|(t,t),&(f,t))),!(t)\") == True\n assert candidate(expression = \"!(|(t,!(t),&(t,!(f))))\") == False\n assert candidate(expression = \"!(|(&(t,!(t)),&(f,!(f)),&(t,t),!(f)))\") == False\n"}, "metadata": {"canonical_parameter_names": ["expression"], "leetcode_dataset_entry_point": "Solution().parseBoolExpr", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var parseBoolExpr = function(expression) {", "container": null, "callable": "parseBoolExpr", "parameters": [{"name": "expression", "type": "string"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1108, "task_id": "defanging-an-ip-address", "difficulty": "Easy", "problem_description": "Given a valid (IPv4) IP address, return a defanged version of that IP address.\\r\n\\r\nA defanged IP address replaces every period \".\" with \"[.]\".\\r\n\\r\n \\r\nExample 1:\\r\nInput: address = \"1.1.1.1\"\\r\nOutput: \"1[.]1[.]1[.]1\"\\r\nExample 2:\\r\nInput: address = \"255.100.50.0\"\\r\nOutput: \"255[.]100[.]50[.]0\"\\r\n\\r\n \\r\nConstraints:\\r\n\\r\n\\r\n\tThe given address is a valid IPv4 address.\\r\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(address = \"255.100.50.0\") == \"255[.]100[.]50[.]0\"\n assert candidate(address = \"255.255.255.255\") == \"255[.]255[.]255[.]255\"\n assert candidate(address = \"192.168.1.1\") == \"192[.]168[.]1[.]1\"\n assert candidate(address = \"0.0.0.0\") == \"0[.]0[.]0[.]0\"\n assert candidate(address = \"1.1.1.1\") == \"1[.]1[.]1[.]1\"\n assert candidate(address = \"198.18.0.0\") == \"198[.]18[.]0[.]0\"\n assert candidate(address = \"010.020.030.040\") == \"010[.]020[.]030[.]040\"\n assert candidate(address = \"13.37.13.37\") == \"13[.]37[.]13[.]37\"\n assert candidate(address = \"198.18.0.1\") == \"198[.]18[.]0[.]1\"\n assert candidate(address = \"224.0.0.251\") == \"224[.]0[.]0[.]251\"\n assert candidate(address = \"10.0.0.255\") == \"10[.]0[.]0[.]255\"\n assert candidate(address = \"224.0.0.224\") == \"224[.]0[.]0[.]224\"\n assert candidate(address = \"198.51.100.0\") == \"198[.]51[.]100[.]0\"\n assert candidate(address = \"254.254.254.254\") == \"254[.]254[.]254[.]254\"\n assert candidate(address = \"0.255.0.255\") == \"0[.]255[.]0[.]255\"\n assert candidate(address = \"169.254.1.2\") == \"169[.]254[.]1[.]2\"\n assert candidate(address = \"192.168.100.100\") == \"192[.]168[.]100[.]100\"\n assert candidate(address = \"169.254.169.254\") == \"169[.]254[.]169[.]254\"\n assert candidate(address = \"127.0.0.1\") == \"127[.]0[.]0[.]1\"\n assert candidate(address = \"172.31.255.255\") == \"172[.]31[.]255[.]255\"\n assert candidate(address = \"198.51.100.200\") == \"198[.]51[.]100[.]200\"\n assert candidate(address = \"169.254.0.1\") == \"169[.]254[.]0[.]1\"\n assert candidate(address = \"203.0.113.0\") == \"203[.]0[.]113[.]0\"\n assert candidate(address = \"001.002.003.004\") == \"001[.]002[.]003[.]004\"\n assert candidate(address = \"172.16.0.1\") == \"172[.]16[.]0[.]1\"\n assert candidate(address = \"111.222.333.444\") == \"111[.]222[.]333[.]444\"\n assert candidate(address = \"169.254.0.0\") == \"169[.]254[.]0[.]0\"\n assert candidate(address = \"10.10.10.10\") == \"10[.]10[.]10[.]10\"\n assert candidate(address = \"10.0.0.1\") == \"10[.]0[.]0[.]1\"\n assert candidate(address = \"224.0.0.1\") == \"224[.]0[.]0[.]1\"\n assert candidate(address = \"128.101.101.101\") == \"128[.]101[.]101[.]101\"\n assert candidate(address = \"100.100.100.100\") == \"100[.]100[.]100[.]100\"\n assert candidate(address = \"123.45.67.89\") == \"123[.]45[.]67[.]89\"\n assert candidate(address = \"114.114.114.114\") == \"114[.]114[.]114[.]114\"\n assert candidate(address = \"203.0.113.255\") == \"203[.]0[.]113[.]255\"\n assert candidate(address = \"99.99.99.99\") == \"99[.]99[.]99[.]99\"\n assert candidate(address = \"123.456.789.012\") == \"123[.]456[.]789[.]012\"\n assert candidate(address = \"169.254.100.50\") == \"169[.]254[.]100[.]50\"\n assert candidate(address = \"9.9.9.9\") == \"9[.]9[.]9[.]9\"\n assert candidate(address = \"240.240.240.240\") == \"240[.]240[.]240[.]240\"\n assert candidate(address = \"8.8.8.8\") == \"8[.]8[.]8[.]8\"\n assert candidate(address = \"1.12.123.123\") == \"1[.]12[.]123[.]123\"\n assert candidate(address = \"255.255.255.0\") == \"255[.]255[.]255[.]0\"\n assert candidate(address = \"239.255.255.250\") == \"239[.]255[.]255[.]250\"\n assert candidate(address = \"198.19.255.255\") == \"198[.]19[.]255[.]255\"\n assert candidate(address = \"100.200.050.025\") == \"100[.]200[.]050[.]025\"\n assert candidate(address = \"139.130.4.5\") == \"139[.]130[.]4[.]5\"\n assert candidate(address = \"208.67.222.222\") == \"208[.]67[.]222[.]222\"\n"}, "metadata": {"canonical_parameter_names": ["address"], "leetcode_dataset_entry_point": "Solution().defangIPaddr", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var defangIPaddr = function(address) {", "container": null, "callable": "defangIPaddr", "parameters": [{"name": "address", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1109, "task_id": "corporate-flight-bookings", "difficulty": "Medium", "problem_description": "There are n flights that are labeled from 1 to n.\nYou are given an array of flight bookings bookings, where bookings[i] = [firsti, lasti, seatsi] represents a booking for flights firsti through lasti (inclusive) with seatsi seats reserved for each flight in the range.\nReturn an array answer of length n, where answer[i] is the total number of seats reserved for flight i.\n \nExample 1:\n\nInput: bookings = [[1,2,10],[2,3,20],[2,5,25]], n = 5\nOutput: [10,55,45,25,25]\nExplanation:\nFlight labels: 1 2 3 4 5\nBooking 1 reserved: 10 10\nBooking 2 reserved: 20 20\nBooking 3 reserved: 25 25 25 25\nTotal seats: 10 55 45 25 25\nHence, answer = [10,55,45,25,25]\n\nExample 2:\n\nInput: bookings = [[1,2,10],[2,2,15]], n = 2\nOutput: [10,25]\nExplanation:\nFlight labels: 1 2\nBooking 1 reserved: 10 10\nBooking 2 reserved: 15\nTotal seats: 10 25\nHence, answer = [10,25]\n\n\n \nConstraints:\n\n1 <= n <= 2 * 104\n1 <= bookings.length <= 2 * 104\nbookings[i].length == 3\n1 <= firsti <= lasti <= n\n1 <= seatsi <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(bookings = [[1, 2, 100], [2, 5, 50], [3, 4, 20]],n = 5) == [100, 150, 70, 70, 50]\n assert candidate(bookings = [[1, 1, 5], [1, 2, 7], [1, 3, 9]],n = 3) == [21, 16, 9]\n assert candidate(bookings = [[1, 4, 5], [4, 5, 6], [2, 5, 3]],n = 5) == [5, 8, 8, 14, 9]\n assert candidate(bookings = [[1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4], [5, 5, 5]],n = 5) == [1, 2, 3, 4, 5]\n assert candidate(bookings = [[1, 1, 10], [2, 2, 20], [3, 3, 30], [4, 4, 40], [5, 5, 50]],n = 5) == [10, 20, 30, 40, 50]\n assert candidate(bookings = [[1, 5, 1], [1, 5, 1], [1, 5, 1], [1, 5, 1], [1, 5, 1]],n = 5) == [5, 5, 5, 5, 5]\n assert candidate(bookings = [[1, 5, 3], [2, 4, 2], [3, 3, 1]],n = 5) == [3, 5, 6, 5, 3]\n assert candidate(bookings = [[1, 1, 5], [2, 2, 7], [3, 3, 9]],n = 3) == [5, 7, 9]\n assert candidate(bookings = [[1, 5, 5], [2, 4, 10], [3, 3, 15]],n = 5) == [5, 15, 30, 15, 5]\n assert candidate(bookings = [[1, 2, 10], [2, 2, 15]],n = 2) == [10, 25]\n assert candidate(bookings = [[1, 5, 1], [2, 4, 2], [3, 3, 3]],n = 5) == [1, 3, 6, 3, 1]\n assert candidate(bookings = [[1, 2, 100], [2, 3, 200], [3, 4, 300], [4, 5, 400], [5, 5, 500]],n = 5) == [100, 300, 500, 700, 900]\n assert candidate(bookings = [[1, 2, 100], [2, 3, 100], [3, 4, 100], [4, 5, 100], [5, 5, 100]],n = 5) == [100, 200, 200, 200, 200]\n assert candidate(bookings = [[1, 2, 10], [2, 3, 20], [2, 5, 25]],n = 5) == [10, 55, 45, 25, 25]\n assert candidate(bookings = [[1, 5, 1], [2, 5, 2], [3, 5, 3], [4, 5, 4], [5, 5, 5]],n = 5) == [1, 3, 6, 10, 15]\n assert candidate(bookings = [[1, 2, 1], [1, 2, 1], [1, 2, 1]],n = 2) == [3, 3]\n assert candidate(bookings = [[1, 2, 10000], [2, 3, 9000], [3, 4, 8000], [4, 5, 7000], [5, 5, 6000], [1, 3, 5000], [2, 4, 4000], [3, 5, 3000], [4, 5, 2000], [5, 5, 1000]],n = 5) == [15000, 28000, 29000, 24000, 19000]\n assert candidate(bookings = [[1, 2, 10], [3, 4, 20], [1, 4, 5], [2, 5, 15], [1, 3, 25]],n = 5) == [40, 55, 65, 40, 15]\n assert candidate(bookings = [[1, 3, 10], [2, 4, 20], [3, 5, 30], [4, 5, 40], [1, 5, 50]],n = 5) == [60, 80, 110, 140, 120]\n assert candidate(bookings = [[1, 5, 10], [2, 6, 20], [3, 7, 30], [4, 8, 40], [5, 9, 50], [6, 10, 60], [7, 10, 70], [8, 10, 80]],n = 10) == [10, 30, 60, 100, 150, 200, 250, 300, 260, 210]\n assert candidate(bookings = [[1, 5, 1], [2, 4, 2], [3, 3, 3], [4, 5, 4], [5, 5, 5]],n = 5) == [1, 3, 6, 7, 10]\n assert candidate(bookings = [[1, 10, 10], [2, 9, 20], [3, 8, 30], [4, 7, 40], [5, 6, 50], [6, 6, 60]],n = 10) == [10, 30, 60, 100, 150, 210, 100, 60, 30, 10]\n assert candidate(bookings = [[1, 2, 5], [2, 3, 10], [3, 4, 15], [4, 5, 20], [5, 5, 25], [1, 5, 1]],n = 5) == [6, 16, 26, 36, 46]\n assert candidate(bookings = [[1, 2, 10], [2, 3, 20], [1, 5, 5], [3, 5, 15], [2, 4, 25]],n = 5) == [15, 60, 65, 45, 20]\n assert candidate(bookings = [[1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 5, 1], [1, 5, 1], [2, 5, 1], [3, 5, 1], [4, 5, 1], [5, 5, 1]],n = 5) == [2, 4, 5, 6, 7]\n assert candidate(bookings = [[1, 2, 1000], [2, 5, 500], [3, 4, 300], [1, 4, 200], [2, 5, 100]],n = 5) == [1200, 1800, 1100, 1100, 600]\n assert candidate(bookings = [[1, 10, 100], [2, 9, 200], [3, 8, 300], [4, 7, 400], [5, 6, 500], [6, 7, 600], [7, 8, 700], [8, 9, 800], [9, 10, 900]],n = 10) == [100, 300, 600, 1000, 1500, 2100, 2300, 2100, 2000, 1000]\n assert candidate(bookings = [[1, 3, 100], [1, 4, 200], [1, 5, 300], [1, 6, 400], [1, 7, 500], [1, 8, 600], [1, 9, 700], [1, 10, 800]],n = 10) == [3600, 3600, 3600, 3500, 3300, 3000, 2600, 2100, 1500, 800]\n assert candidate(bookings = [[1, 5, 10], [2, 4, 20], [3, 3, 30], [4, 5, 40], [5, 5, 50]],n = 5) == [10, 30, 60, 70, 100]\n assert candidate(bookings = [[1, 3, 10], [1, 4, 20], [1, 5, 30], [1, 6, 40], [1, 7, 50], [2, 3, 10], [2, 4, 20], [2, 5, 30], [2, 6, 40], [2, 7, 50]],n = 7) == [150, 300, 300, 280, 240, 180, 100]\n assert candidate(bookings = [[1, 5, 10], [1, 5, 20], [1, 5, 30], [1, 5, 40], [1, 5, 50]],n = 5) == [150, 150, 150, 150, 150]\n assert candidate(bookings = [[1, 5, 1000], [1, 2, 2000], [3, 5, 3000], [2, 3, 4000], [4, 5, 5000]],n = 5) == [3000, 7000, 8000, 9000, 9000]\n assert candidate(bookings = [[1, 2, 10], [1, 5, 20], [2, 3, 30], [3, 4, 40], [4, 5, 50]],n = 5) == [30, 60, 90, 110, 70]\n assert candidate(bookings = [[1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4], [5, 5, 5], [1, 5, 1]],n = 5) == [2, 3, 4, 5, 6]\n assert candidate(bookings = [[1, 3, 1000], [2, 4, 2000], [3, 5, 3000], [1, 5, 100], [2, 5, 200]],n = 5) == [1100, 3300, 6300, 5300, 3300]\n assert candidate(bookings = [[1, 2, 1000], [2, 3, 2000], [3, 4, 3000], [4, 5, 4000], [5, 5, 5000]],n = 5) == [1000, 3000, 5000, 7000, 9000]\n assert candidate(bookings = [[1, 2, 100], [2, 5, 50], [3, 4, 200], [1, 5, 10]],n = 5) == [110, 160, 260, 260, 60]\n assert candidate(bookings = [[1, 3, 10], [2, 4, 20], [3, 5, 30], [4, 5, 40]],n = 5) == [10, 30, 60, 90, 70]\n assert candidate(bookings = [[1, 2, 5], [2, 3, 5], [3, 4, 5], [4, 5, 5], [5, 5, 5]],n = 5) == [5, 10, 10, 10, 10]\n assert candidate(bookings = [[1, 5, 1], [1, 5, 2], [1, 5, 3], [1, 5, 4], [1, 5, 5], [1, 5, 6], [1, 5, 7], [1, 5, 8], [1, 5, 9], [1, 5, 10]],n = 5) == [55, 55, 55, 55, 55]\n assert candidate(bookings = [[1, 2, 10], [1, 2, 20], [1, 2, 30], [1, 2, 40], [1, 2, 50]],n = 2) == [150, 150]\n assert candidate(bookings = [[1, 5, 100], [1, 5, 200], [1, 5, 300], [1, 5, 400], [1, 5, 500]],n = 5) == [1500, 1500, 1500, 1500, 1500]\n assert candidate(bookings = [[1, 10, 100], [10, 10, 100], [1, 9, 200], [2, 8, 200], [2, 9, 300], [3, 8, 300], [3, 7, 400], [4, 7, 400], [4, 6, 500], [5, 6, 500], [5, 5, 600]],n = 10) == [300, 800, 1500, 2400, 3500, 2900, 1900, 1100, 600, 200]\n assert candidate(bookings = [[1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [7, 8, 1], [8, 9, 1], [9, 10, 1]],n = 10) == [1, 2, 2, 2, 2, 2, 2, 2, 2, 1]\n assert candidate(bookings = [[1, 5, 1], [2, 5, 2], [3, 5, 3], [4, 5, 4], [5, 5, 5], [1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40]],n = 5) == [11, 33, 56, 80, 55]\n assert candidate(bookings = [[1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [1, 5, 5]],n = 5) == [15, 35, 55, 75, 45]\n assert candidate(bookings = [[1, 5, 10], [2, 4, 20], [3, 3, 30], [4, 5, 40], [1, 2, 50], [2, 3, 60], [3, 4, 70], [4, 5, 80]],n = 5) == [60, 140, 190, 220, 130]\n assert candidate(bookings = [[1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [1, 5, 1]],n = 5) == [2, 3, 3, 3, 2]\n assert candidate(bookings = [[1, 1, 10], [1, 2, 10], [1, 3, 10], [1, 4, 10], [1, 5, 10]],n = 5) == [50, 40, 30, 20, 10]\n assert candidate(bookings = [[1, 2, 10], [2, 5, 20], [3, 3, 15], [4, 4, 25], [5, 5, 30], [1, 5, 5]],n = 5) == [15, 35, 40, 50, 55]\n assert candidate(bookings = [[1, 5, 10], [2, 5, 20], [3, 5, 30], [4, 5, 40], [5, 5, 50], [1, 5, 10], [2, 5, 20], [3, 5, 30], [4, 5, 40], [5, 5, 50]],n = 5) == [20, 60, 120, 200, 300]\n assert candidate(bookings = [[1, 2, 10], [2, 2, 20], [1, 5, 5], [3, 3, 30], [4, 5, 40], [1, 5, 50]],n = 5) == [65, 85, 85, 95, 95]\n assert candidate(bookings = [[1, 10, 5], [2, 9, 6], [3, 8, 7], [4, 7, 8], [5, 6, 9], [6, 6, 10], [1, 2, 1], [2, 3, 2], [3, 4, 3]],n = 10) == [6, 14, 23, 29, 35, 45, 26, 18, 11, 5]\n assert candidate(bookings = [[1, 2, 10], [2, 2, 20], [2, 3, 20], [3, 3, 30], [3, 4, 30], [4, 4, 40], [4, 5, 40], [5, 5, 50]],n = 5) == [10, 50, 80, 110, 90]\n assert candidate(bookings = [[1, 5, 10], [1, 5, 20], [1, 5, 30], [1, 5, 40], [1, 5, 50], [1, 5, 60], [1, 5, 70], [1, 5, 80], [1, 5, 90]],n = 5) == [450, 450, 450, 450, 450]\n assert candidate(bookings = [[1, 3, 5], [3, 5, 15], [5, 5, 25], [1, 4, 10]],n = 5) == [15, 15, 30, 25, 40]\n assert candidate(bookings = [[1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [1, 5, 50]],n = 5) == [60, 80, 100, 120, 90]\n assert candidate(bookings = [[1, 100, 1], [2, 99, 2], [3, 98, 3], [4, 97, 4], [5, 96, 5]],n = 100) == [1, 3, 6, 10, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 10, 6, 3, 1]\n assert candidate(bookings = [[1, 3, 5000], [2, 4, 4000], [3, 5, 3000], [4, 5, 2000], [1, 5, 1000]],n = 5) == [6000, 10000, 13000, 10000, 6000]\n assert candidate(bookings = [[1, 2, 100], [1, 5, 20], [2, 3, 150], [3, 4, 250], [4, 5, 300], [5, 6, 350], [6, 7, 400]],n = 7) == [120, 270, 420, 570, 670, 750, 400]\n assert candidate(bookings = [[1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4], [5, 5, 5], [6, 6, 6], [7, 7, 7], [8, 8, 8], [9, 9, 9], [10, 10, 10], [11, 11, 11], [12, 12, 12], [13, 13, 13], [14, 14, 14], [15, 15, 15]],n = 15) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]\n assert candidate(bookings = [[1, 5, 10], [2, 4, 20], [3, 3, 30], [4, 2, 40], [5, 1, 50]],n = 5) == [10, -20, -30, -20, 10]\n assert candidate(bookings = [[1, 5, 1], [1, 5, 2], [1, 5, 3], [1, 5, 4], [1, 5, 5]],n = 5) == [15, 15, 15, 15, 15]\n assert candidate(bookings = [[1, 1, 1000], [1, 2, 2000], [1, 3, 3000], [1, 4, 4000], [1, 5, 5000]],n = 5) == [15000, 14000, 12000, 9000, 5000]\n assert candidate(bookings = [[1, 1, 1000], [1, 5, 1000], [2, 2, 2000], [2, 3, 2000], [3, 3, 3000], [3, 4, 3000], [4, 4, 4000], [4, 5, 4000], [5, 5, 5000]],n = 5) == [2000, 5000, 9000, 12000, 10000]\n assert candidate(bookings = [[1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [5, 5, 50], [1, 5, 100]],n = 5) == [110, 130, 150, 170, 190]\n assert candidate(bookings = [[1, 2, 10000], [2, 3, 10000], [3, 4, 10000], [4, 5, 10000], [5, 5, 10000]],n = 5) == [10000, 20000, 20000, 20000, 20000]\n assert candidate(bookings = [[1, 2, 100], [2, 3, 200], [3, 4, 300], [4, 5, 400], [1, 5, 500], [5, 5, 600]],n = 5) == [600, 800, 1000, 1200, 1500]\n assert candidate(bookings = [[1, 20, 5], [5, 15, 10], [10, 20, 15], [15, 20, 20], [20, 20, 25]],n = 20) == [5, 5, 5, 5, 15, 15, 15, 15, 15, 30, 30, 30, 30, 30, 50, 40, 40, 40, 40, 65]\n assert candidate(bookings = [[1, 10, 10], [2, 9, 20], [3, 8, 30], [4, 7, 40], [5, 6, 50], [6, 5, 60], [7, 4, 70], [8, 3, 80], [9, 2, 90], [10, 1, 100]],n = 10) == [10, -70, -130, -170, -190, -190, -170, -130, -70, 10]\n assert candidate(bookings = [[1, 5, 100], [2, 4, 200], [3, 3, 300], [4, 4, 400], [5, 5, 500], [1, 5, 100], [2, 4, 200], [3, 3, 300], [4, 4, 400], [5, 5, 500]],n = 5) == [200, 600, 1200, 1400, 1200]\n assert candidate(bookings = [[1, 2, 500], [2, 3, 1000], [3, 4, 1500], [4, 5, 2000], [5, 6, 2500], [6, 7, 3000], [7, 8, 3500]],n = 8) == [500, 1500, 2500, 3500, 4500, 5500, 6500, 3500]\n assert candidate(bookings = [[100, 2000, 100], [200, 1900, 200], [300, 1800, 300], [400, 1700, 400], [500, 1600, 500]],n = 2000) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100]\n assert candidate(bookings = [[1, 3, 10], [2, 5, 20], [3, 1, 30], [4, 4, 40], [5, 5, 50]],n = 5) == [10, 0, 30, 60, 70]\n assert candidate(bookings = [[1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [5, 5, 50], [1, 5, 5]],n = 5) == [15, 35, 55, 75, 95]\n assert candidate(bookings = [[1, 2, 10], [2, 3, 15], [3, 4, 20], [4, 5, 25], [5, 6, 30], [6, 7, 35], [7, 8, 40]],n = 8) == [10, 25, 35, 45, 55, 65, 75, 40]\n assert candidate(bookings = [[1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40]],n = 5) == [20, 60, 100, 140, 80]\n assert candidate(bookings = [[1, 5, 1], [2, 5, 2], [3, 5, 3], [4, 5, 4], [5, 5, 5], [1, 5, 1], [2, 5, 2], [3, 5, 3], [4, 5, 4], [5, 5, 5]],n = 5) == [2, 6, 12, 20, 30]\n assert candidate(bookings = [[1, 2, 500], [2, 3, 1000], [3, 4, 1500], [4, 5, 2000], [5, 5, 2500]],n = 5) == [500, 1500, 2500, 3500, 4500]\n assert candidate(bookings = [[1, 3, 10], [2, 5, 20], [3, 4, 30], [4, 6, 40], [5, 7, 50]],n = 7) == [10, 30, 60, 90, 110, 90, 50]\n assert candidate(bookings = [[1, 5, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [5, 5, 50]],n = 5) == [10, 30, 60, 80, 100]\n assert candidate(bookings = [[1, 2000, 1], [2, 1999, 2], [3, 1998, 3], [4, 1997, 4], [5, 1996, 5]],n = 2000) == [1, 3, 6, 10, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 10, 6, 3, 1]\n assert candidate(bookings = [[1, 3, 50], [2, 5, 60], [3, 4, 70], [4, 5, 80], [1, 4, 20]],n = 5) == [70, 130, 200, 230, 140]\n assert candidate(bookings = [[1, 5, 5], [1, 5, 10], [1, 5, 15], [1, 5, 20], [1, 5, 25]],n = 5) == [75, 75, 75, 75, 75]\n assert candidate(bookings = [[1, 5, 10], [2, 4, 20], [3, 3, 30]],n = 5) == [10, 30, 60, 30, 10]\n assert candidate(bookings = [[1, 2, 100], [2, 3, 200], [3, 5, 300], [4, 5, 400], [1, 3, 100], [2, 4, 200]],n = 5) == [200, 600, 800, 900, 700]\n assert candidate(bookings = [[1, 3, 10], [2, 4, 20], [3, 5, 30], [4, 6, 40], [5, 7, 50]],n = 7) == [10, 30, 60, 90, 120, 90, 50]\n assert candidate(bookings = [[1, 2, 10], [3, 4, 20], [5, 6, 30], [7, 8, 40], [9, 10, 50]],n = 10) == [10, 10, 20, 20, 30, 30, 40, 40, 50, 50]\n assert candidate(bookings = [[1, 5, 10], [2, 3, 20], [3, 4, 30], [1, 2, 10], [4, 5, 20]],n = 5) == [20, 40, 60, 60, 30]\n assert candidate(bookings = [[1, 10, 1], [2, 9, 2], [3, 8, 3], [4, 7, 4], [5, 6, 5], [6, 5, 4], [7, 4, 3], [8, 3, 2], [9, 2, 1]],n = 10) == [1, 3, 5, 7, 9, 9, 7, 5, 3, 1]\n assert candidate(bookings = [[1, 5, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [1, 2, 50], [3, 5, 60]],n = 5) == [60, 80, 120, 140, 110]\n assert candidate(bookings = [[1, 1, 10000], [2, 2, 10000], [3, 3, 10000], [4, 4, 10000], [5, 5, 10000]],n = 5) == [10000, 10000, 10000, 10000, 10000]\n assert candidate(bookings = [[1, 2, 50], [2, 3, 50], [3, 4, 50], [4, 5, 50], [1, 5, 100]],n = 5) == [150, 200, 200, 200, 150]\n assert candidate(bookings = [[1, 5, 10], [2, 3, 20], [4, 5, 30], [1, 3, 40], [3, 4, 50]],n = 5) == [50, 70, 120, 90, 40]\n assert candidate(bookings = [[1, 1, 1000], [1, 1000, 1], [2, 2, 2000], [2, 999, 2], [3, 3, 3000], [3, 998, 3], [4, 4, 4000], [4, 997, 4], [5, 5, 5000], [5, 996, 5]],n = 1000) == [1001, 2003, 3006, 4010, 5015, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 10, 6, 3, 1]\n assert candidate(bookings = [[1, 1, 1000], [1, 2, 1000], [1, 3, 1000], [1, 4, 1000], [1, 5, 1000]],n = 5) == [5000, 4000, 3000, 2000, 1000]\n assert candidate(bookings = [[1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [1, 5, 50], [2, 5, 10], [3, 4, 20]],n = 5) == [60, 90, 130, 150, 100]\n assert candidate(bookings = [[1, 3, 15], [2, 3, 20], [3, 3, 25], [1, 2, 30], [2, 5, 50]],n = 5) == [45, 115, 110, 50, 50]\n assert candidate(bookings = [[1, 5, 10], [2, 4, 20], [3, 3, 30], [4, 5, 40], [1, 2, 50]],n = 5) == [60, 80, 60, 70, 50]\n assert candidate(bookings = [[1, 2, 100], [2, 3, 150], [3, 4, 200], [4, 5, 250], [5, 5, 300], [1, 5, 50]],n = 5) == [150, 300, 400, 500, 600]\n assert candidate(bookings = [[1, 2, 100], [1, 3, 200], [1, 4, 300], [1, 5, 400], [2, 5, 500]],n = 5) == [1000, 1500, 1400, 1200, 900]\n assert candidate(bookings = [[1, 1000, 1], [1001, 2000, 2], [500, 1500, 3], [1501, 2000, 4]],n = 2000) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]\n assert candidate(bookings = [[5, 5, 10], [4, 5, 20], [3, 5, 30], [2, 5, 40], [1, 5, 50]],n = 5) == [50, 90, 120, 140, 150]\n assert candidate(bookings = [[1, 1, 1000], [1, 2, 1000], [1, 3, 1000], [1, 4, 1000], [1, 5, 1000], [1, 6, 1000], [1, 7, 1000], [1, 8, 1000], [1, 9, 1000], [1, 10, 1000]],n = 10) == [10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000]\n assert candidate(bookings = [[1, 2, 10], [2, 5, 20], [3, 5, 30], [4, 5, 40], [5, 5, 50], [1, 2, 10], [2, 5, 20], [3, 5, 30], [4, 5, 40], [5, 5, 50]],n = 5) == [20, 60, 100, 180, 280]\n assert candidate(bookings = [[1, 2, 10], [2, 3, 20], [3, 4, 30], [4, 5, 40], [5, 5, 50], [1, 3, 10], [2, 4, 20], [3, 5, 30]],n = 5) == [20, 60, 110, 120, 120]\n assert candidate(bookings = [[1, 5, 10], [1, 5, 20], [1, 5, 30], [1, 5, 40], [1, 5, 50], [1, 5, 60], [1, 5, 70], [1, 5, 80], [1, 5, 90], [1, 5, 100]],n = 5) == [550, 550, 550, 550, 550]\n assert candidate(bookings = [[1, 2, 10], [2, 5, 20], [5, 5, 30], [1, 4, 40], [3, 4, 50], [2, 3, 60]],n = 5) == [50, 130, 170, 110, 50]\n assert candidate(bookings = [[1, 2, 5], [1, 5, 15], [2, 3, 10], [3, 5, 20], [1, 4, 25]],n = 5) == [45, 55, 70, 60, 35]\n"}, "metadata": {"canonical_parameter_names": ["bookings", "n"], "leetcode_dataset_entry_point": "Solution().corpFlightBookings", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var corpFlightBookings = function(bookings, n) {", "container": null, "callable": "corpFlightBookings", "parameters": [{"name": "bookings", "type": "number[][]"}, {"name": "n", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1111, "task_id": "maximum-nesting-depth-of-two-valid-parentheses-strings", "difficulty": "Medium", "problem_description": "A string is a valid parentheses string (denoted VPS) if and only if it consists of \"(\" and \")\" characters only, and:\\r\n\\r\n\\r\n\tIt is the empty string, or\\r\n\tIt can be written as AB (A concatenated with B), where A and B are VPS's, or\\r\n\tIt can be written as (A), where A is a VPS.\\r\n\\r\n\\r\nWe can similarly define the nesting depth depth(S) of any VPS S as follows:\\r\n\\r\n\\r\n\tdepth(\"\") = 0\\r\n\tdepth(A + B) = max(depth(A), depth(B)), where A and B are VPS's\\r\n\tdepth(\"(\" + A + \")\") = 1 + depth(A), where A is a VPS.\\r\n\\r\n\\r\nFor example,  \"\", \"()()\", and \"()(()())\" are VPS's (with nesting depths 0, 1, and 2), and \")(\" and \"(()\" are not VPS's.\\r\n\\r\n \\r\n\\r\nGiven a VPS seq, split it into two disjoint subsequences A and B, such that A and B are VPS's (and A.length + B.length = seq.length).\\r\n\\r\nNow choose any such A and B such that max(depth(A), depth(B)) is the minimum possible value.\\r\n\\r\nReturn an answer array (of length seq.length) that encodes such a choice of A and B:  answer[i] = 0 if seq[i] is part of A, else answer[i] = 1.  Note that even though multiple answers may exist, you may return any of them.\\r\n\n \nExample 1:\n\nInput: seq = \"(()())\"\nOutput: [0,1,1,1,1,0]\n\nExample 2:\n\nInput: seq = \"()(())()\"\nOutput: [0,0,0,1,1,0,1,1]\n\n \nConstraints:\n\n1 <= seq.size <= 10000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(seq = \"()\") == [0, 0]\n assert candidate(seq = \"(()())\") == [0, 1, 1, 1, 1, 0]\n assert candidate(seq = \"(()(()(())))\") == [0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"((())())()\") == [0, 1, 0, 0, 1, 1, 1, 0, 0, 0]\n assert candidate(seq = \"\") == []\n assert candidate(seq = \"((()))\") == [0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(())(())\") == [0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"(()(()))\") == [0, 1, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(()())(())\") == [0, 1, 1, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"(())()()\") == [0, 1, 1, 0, 0, 0, 0, 0]\n assert candidate(seq = \"(()(()(()())))\") == [0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0]\n assert candidate(seq = \"()()()()\") == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(seq = \"()(())()\") == [0, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(seq = \"((())())\") == [0, 1, 0, 0, 1, 1, 1, 0]\n assert candidate(seq = \"(((())))\") == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"()()()\") == [0, 0, 0, 0, 0, 0]\n assert candidate(seq = \"((((()))))\") == [0, 1, 0, 1, 0, 0, 1, 0, 1, 0]\n assert candidate(seq = \"((()))((()))((()))\") == [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(()(()))()((()))(())\") == [0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"(())(())(())\") == [0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"(()(()())(()(()())))\") == [0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0]\n assert candidate(seq = \"(()(()((()))()))\") == [0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0]\n assert candidate(seq = \"(()(()(()(()))))\") == [0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0]\n assert candidate(seq = \"((()(())))\") == [0, 1, 0, 0, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"((()()(()())))\") == [0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0]\n assert candidate(seq = \"((()()()())(()))\") == [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"((((()())))((())))\") == [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"()(()(()(())))()\") == [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0]\n assert candidate(seq = \"(((()())(()())))((()))\") == [0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(()()(()(())))\") == [0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"(((()()())))\") == [0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0]\n assert candidate(seq = \"()((()))(()())\") == [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0]\n assert candidate(seq = \"((()()()()()))\") == [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]\n assert candidate(seq = \"()((()))(())\") == [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"(()(((()(())))))\") == [0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0]\n assert candidate(seq = \"(((()()())))((()))\") == [0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"((()())(()))\") == [0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(((())))()(()())\") == [0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0]\n assert candidate(seq = \"()(((())))(())()\") == [0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(seq = \"()((()(()(()))))()\") == [0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0]\n assert candidate(seq = \"()(())()(())()(())\") == [0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0]\n assert candidate(seq = \"((((()))))((((()))))((((()))))\") == [0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]\n assert candidate(seq = \"()()()(((())))()()()(((())))\") == [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"((()()))((()()))\") == [0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0]\n assert candidate(seq = \"((((()))))(((())))\") == [0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"(()(()))()((()))()\") == [0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0]\n assert candidate(seq = \"(((())))(((())))\") == [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"(()(()(()))(()))\") == [0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(()())(())(())(())\") == [0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"()(())()((()))()(())\") == [0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0]\n assert candidate(seq = \"()()()()()()()()()()()()()()()\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(seq = \"((())(()(())))\") == [0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"((((())))(()))\") == [0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"((()()()))\") == [0, 1, 0, 0, 0, 0, 0, 0, 1, 0]\n assert candidate(seq = \"(((()(()))))\") == [0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0]\n assert candidate(seq = \"(()(())((())))\") == [0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"(()(()(()())(())))()()\") == [0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0]\n assert candidate(seq = \"(((((())))))\") == [0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0]\n assert candidate(seq = \"((()))(())(()(()))\") == [0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(()()())((()))\") == [0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"()((()))(())((()))\") == [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"()()(())(())()\") == [0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0]\n assert candidate(seq = \"()((()())(()))\") == [0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"((()()()()))((()()()()))\") == [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]\n assert candidate(seq = \"(()(()))((()))\") == [0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"()()()()()()\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(seq = \"()()()()()(())\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0]\n assert candidate(seq = \"(())(())(())(())\") == [0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"(()(()())((())))\") == [0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"()((()))()(())(((())))\") == [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"((())(()))((()()))\") == [0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0]\n assert candidate(seq = \"(()(()))(()(()))(()(()))\") == [0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"((((((()))))))\") == [0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(seq = \"()()()()()()()()()()\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(seq = \"()(((())))()\") == [0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0]\n assert candidate(seq = \"(()())(())((()))\") == [0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(((()))(()(())))\") == [0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"((((()))))(())(()(()))\") == [0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(()(()(()))(()(())))\") == [0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"(((()())(())))\") == [0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"((()(())))((()(())))\") == [0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"()(()(()))(()(()))\") == [0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"()((((()))))()\") == [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0]\n assert candidate(seq = \"((())())((()))\") == [0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"((((()(())))))\") == [0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0]\n assert candidate(seq = \"((((())))())(()())\") == [0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0]\n assert candidate(seq = \"(()())(()())\") == [0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0]\n assert candidate(seq = \"(()(()))()()\") == [0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0]\n assert candidate(seq = \"((())(()(()(()))))\") == [0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0]\n assert candidate(seq = \"(((())))(()(()))\") == [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"()()()()()()()()\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(seq = \"(()())()((()))\") == [0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(((())(())((()))))\") == [0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0]\n assert candidate(seq = \"((((()))))(())((()))((()))\") == [0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(((())))((()))\") == [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"()((()))()((()))()((()))\") == [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"((()())())\") == [0, 1, 0, 0, 0, 0, 1, 1, 1, 0]\n assert candidate(seq = \"(()((()))(())())\") == [0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0]\n assert candidate(seq = \"()()()()()()()()()\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(seq = \"()()(())()()(())()()\") == [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0]\n assert candidate(seq = \"((())())(())\") == [0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"((()())(()()))(())\") == [0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"()(()(()))()(()(()))\") == [0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(()(()(()(()(()(())))))())\") == [0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0]\n assert candidate(seq = \"()()(()())()()\") == [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0]\n assert candidate(seq = \"(())((()))(())((()))\") == [0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"()(()())(()())\") == [0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0]\n assert candidate(seq = \"((((()))((())))\") == [0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1]\n assert candidate(seq = \"(((())))()(())()(())\") == [0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0]\n assert candidate(seq = \"()((()())())\") == [0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0]\n assert candidate(seq = \"((((()))))((()))\") == [0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"()()()((()))()(())\") == [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0]\n assert candidate(seq = \"(()())((()))(()(()))\") == [0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"((()(()(()))))\") == [0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0]\n assert candidate(seq = \"(()((()))())(())\") == [0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"()(((())))()(((())))\") == [0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"()()()()()()()\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(seq = \"()()((()))\") == [0, 0, 0, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"((())())((())())\") == [0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0]\n assert candidate(seq = \"((((()))))(())\") == [0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"((((((((()))))))))))\") == [0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]\n assert candidate(seq = \"((()))((()))((()))((()))\") == [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(()(((()))))(()(((()))))\") == [0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0]\n assert candidate(seq = \"(((()(())))(()(())))\") == [0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"((()(()(()))))((()(()(()))))\") == [0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0]\n assert candidate(seq = \"()()(())(())(())\") == [0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"((()(()())))\") == [0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0]\n assert candidate(seq = \"((()))(()(()))((()))\") == [0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"((()))(())()(()(()))\") == [0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"((()))((())())\") == [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0]\n assert candidate(seq = \"()(()(()(()(()))))()\") == [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0]\n assert candidate(seq = \"((((()()()))))((()))\") == [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(()(()))(()(()))\") == [0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(()((())))\") == [0, 1, 1, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(seq = \"(((()))())()((()))\") == [0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"((()))()(())\") == [0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0]\n assert candidate(seq = \"(((())))((((()))))\") == [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]\n assert candidate(seq = \"((())()(()))\") == [0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(()())(()())(()())(()())\") == [0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0]\n assert candidate(seq = \"(((((())))))(((((())))))\") == [0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0]\n assert candidate(seq = \"((()))((()))\") == [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"()()((()))()()((()))\") == [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0]\n assert candidate(seq = \"(()())(()())(()())\") == [0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0]\n assert candidate(seq = \"()()()()()\") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(seq = \"(())(())(())(())(())\") == [0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]\n assert candidate(seq = \"()((()))()((()))\") == [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0]\n"}, "metadata": {"canonical_parameter_names": ["seq"], "leetcode_dataset_entry_point": "Solution().maxDepthAfterSplit", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxDepthAfterSplit = function(seq) {", "container": null, "callable": "maxDepthAfterSplit", "parameters": [{"name": "seq", "type": "string"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1122, "task_id": "relative-sort-array", "difficulty": "Easy", "problem_description": "Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1.\nSort the elements of arr1 such that the relative ordering of items in arr1 are the same as in arr2. Elements that do not appear in arr2 should be placed at the end of arr1 in ascending order.\n \nExample 1:\n\nInput: arr1 = [2,3,1,3,2,4,6,7,9,2,19], arr2 = [2,1,4,3,9,6]\nOutput: [2,2,2,1,4,3,3,9,6,7,19]\n\nExample 2:\n\nInput: arr1 = [28,6,22,8,44,17], arr2 = [22,28,8,6]\nOutput: [22,28,8,6,17,44]\n\n \nConstraints:\n\n1 <= arr1.length, arr2.length <= 1000\n0 <= arr1[i], arr2[i] <= 1000\nAll the elements of arr2 are distinct.\nEach arr2[i] is in arr1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr1 = [28, 6, 22, 8, 44, 17],arr2 = [22, 28, 8, 6]) == [22, 28, 8, 6, 17, 44]\n assert candidate(arr1 = [1, 2, 3],arr2 = [1, 2, 3, 4, 5]) == [1, 2, 3]\n assert candidate(arr1 = [10, 9, 8, 7, 6],arr2 = [10, 9, 8, 7, 6]) == [10, 9, 8, 7, 6]\n assert candidate(arr1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],arr2 = [0, 2, 4, 6, 8]) == [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [5, 4, 3, 2, 1]) == [5, 4, 3, 2, 1]\n assert candidate(arr1 = [3, 1, 2],arr2 = [3, 1]) == [3, 1, 2]\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [1, 3, 5, 7, 9]) == [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]\n assert candidate(arr1 = [2, 3, 1, 3, 2, 4, 6, 7, 9, 2, 19],arr2 = [2, 1, 4, 3, 9, 6]) == [2, 2, 2, 1, 4, 3, 3, 9, 6, 7, 19]\n assert candidate(arr1 = [10, 10, 20, 20, 30, 30],arr2 = [10, 20]) == [10, 10, 20, 20, 30, 30]\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [3, 4, 5]) == [3, 4, 5, 1, 2]\n assert candidate(arr1 = [5, 3, 1, 2, 4],arr2 = [1, 2, 3]) == [1, 2, 3, 4, 5]\n assert candidate(arr1 = [5, 5, 5, 5, 5],arr2 = [5]) == [5, 5, 5, 5, 5]\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [3, 2, 1]) == [3, 2, 1, 4, 5]\n assert candidate(arr1 = [9, 8, 7, 6, 5],arr2 = [5, 6, 7, 8, 9]) == [5, 6, 7, 8, 9]\n assert candidate(arr1 = [7, 8, 9],arr2 = [9, 8, 7]) == [9, 8, 7]\n assert candidate(arr1 = [1000, 1000, 1000],arr2 = [1000]) == [1000, 1000, 1000]\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [2, 4]) == [2, 4, 1, 3, 5]\n assert candidate(arr1 = [1, 1, 1, 1],arr2 = [1]) == [1, 1, 1, 1]\n assert candidate(arr1 = [5, 3, 1, 2, 4],arr2 = [5, 4, 3, 2, 1]) == [5, 4, 3, 2, 1]\n assert candidate(arr1 = [10, 20, 30, 40, 50],arr2 = [30, 10, 20]) == [30, 10, 20, 40, 50]\n assert candidate(arr1 = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],arr2 = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 0]) == [1000, 1000, 900, 900, 800, 800, 700, 700, 600, 600, 500, 500, 400, 400, 300, 300, 200, 200, 100, 100, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90]\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],arr2 = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11]) == [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n assert candidate(arr1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],arr2 = [100, 300, 500, 700, 900]) == [100, 300, 500, 700, 900, 200, 400, 600, 800, 1000]\n assert candidate(arr1 = [5, 3, 1, 2, 4, 3, 2, 5, 1, 2, 4, 3, 5],arr2 = [3, 2, 5]) == [3, 3, 3, 2, 2, 2, 5, 5, 5, 1, 1, 4, 4]\n assert candidate(arr1 = [50, 40, 30, 20, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50],arr2 = [50, 40, 30, 20, 10]) == [50, 50, 40, 40, 30, 30, 20, 20, 10, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(arr1 = [123, 456, 789, 123, 456, 789, 123, 456, 789],arr2 = [123, 456]) == [123, 123, 123, 456, 456, 456, 789, 789, 789]\n assert candidate(arr1 = [5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1],arr2 = [1, 3, 5]) == [1, 1, 1, 3, 3, 3, 5, 5, 5, 2, 2, 2, 4, 4, 4]\n assert candidate(arr1 = [111, 222, 333, 444, 555, 666, 777, 888, 999, 111, 222, 333, 444],arr2 = [111, 333, 555, 777, 999]) == [111, 111, 333, 333, 555, 777, 999, 222, 222, 444, 444, 666, 888]\n assert candidate(arr1 = [42, 78, 10, 42, 78, 10, 10, 42, 10, 78, 42, 10, 42],arr2 = [42, 10, 78]) == [42, 42, 42, 42, 42, 10, 10, 10, 10, 10, 78, 78, 78]\n assert candidate(arr1 = [88, 77, 66, 55, 44, 33, 22, 11],arr2 = [22, 44, 66, 88]) == [22, 44, 66, 88, 11, 33, 55, 77]\n assert candidate(arr1 = [42, 31, 56, 23, 56, 78, 23, 42, 65, 12, 56, 31],arr2 = [31, 56, 42, 78]) == [31, 31, 56, 56, 56, 42, 42, 78, 12, 23, 23, 65]\n assert candidate(arr1 = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5],arr2 = [1, 2, 3, 4, 5]) == [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]\n assert candidate(arr1 = [5, 3, 2, 5, 6, 1, 4, 2, 2],arr2 = [2, 5, 6]) == [2, 2, 2, 5, 5, 6, 1, 3, 4]\n assert candidate(arr1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],arr2 = [5, 10]) == [5, 10, 1, 2, 3, 4, 6, 7, 8, 9]\n assert candidate(arr1 = [5, 9, 3, 7, 5, 9, 2, 8, 4, 1],arr2 = [9, 3, 5]) == [9, 9, 3, 5, 5, 1, 2, 4, 7, 8]\n assert candidate(arr1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],arr2 = [100, 90, 80, 70, 60]) == [100, 90, 80, 70, 60, 10, 20, 30, 40, 50]\n assert candidate(arr1 = [15, 22, 13, 15, 28, 15, 22, 13, 30, 45, 50],arr2 = [22, 15, 13]) == [22, 22, 15, 15, 15, 13, 13, 28, 30, 45, 50]\n assert candidate(arr1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],arr2 = [10, 20, 30, 40, 50]) == [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]\n assert candidate(arr1 = [3, 1, 2, 1, 3, 2, 1, 3, 2, 1, 0, 100, 200, 300],arr2 = [300, 200, 100]) == [300, 200, 100, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3]\n assert candidate(arr1 = [28, 6, 22, 8, 44, 17, 17, 28, 6, 22, 8, 44],arr2 = [22, 28, 8, 6, 44, 17]) == [22, 22, 28, 28, 8, 8, 6, 6, 44, 44, 17, 17]\n assert candidate(arr1 = [7, 13, 5, 8, 1, 3, 4, 5, 9, 6, 2, 7, 8, 9, 13],arr2 = [13, 7, 5, 9]) == [13, 13, 7, 7, 5, 5, 9, 9, 1, 2, 3, 4, 6, 8, 8]\n assert candidate(arr1 = [23, 11, 34, 54, 78, 90, 33, 45, 12, 67],arr2 = [12, 34, 45, 54, 78]) == [12, 34, 45, 54, 78, 11, 23, 33, 67, 90]\n assert candidate(arr1 = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],arr2 = [2, 4, 6, 8, 10, 12, 14]) == [2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15]\n assert candidate(arr1 = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]\n assert candidate(arr1 = [7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15],arr2 = [15, 14, 13, 12, 11]) == [15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 7, 7, 8, 8, 9, 9, 10, 10]\n assert candidate(arr1 = [8, 6, 7, 5, 3, 0, 9],arr2 = [8, 6, 7, 5, 3]) == [8, 6, 7, 5, 3, 0, 9]\n assert candidate(arr1 = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5],arr2 = [1, 3, 5]) == [1, 1, 1, 3, 3, 3, 5, 5, 5, 2, 2, 2, 4, 4, 4]\n assert candidate(arr1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],arr2 = [1000, 900, 800, 700, 600, 500, 400, 300, 200]) == [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100]\n assert candidate(arr1 = [5, 3, 1, 2, 4, 6, 8, 7, 9],arr2 = [1, 3, 5, 7, 9]) == [1, 3, 5, 7, 9, 2, 4, 6, 8]\n assert candidate(arr1 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],arr2 = [9, 7, 5, 3, 1]) == [9, 9, 7, 7, 5, 5, 3, 3, 1, 1, 0, 0, 2, 2, 4, 4, 6, 6, 8, 8]\n assert candidate(arr1 = [5, 3, 2, 6, 4, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],arr2 = [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == [3, 3, 5, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 2, 4, 6, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]\n assert candidate(arr1 = [200, 100, 300, 500, 400, 200, 100],arr2 = [100, 200, 300]) == [100, 100, 200, 200, 300, 400, 500]\n assert candidate(arr1 = [7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3],arr2 = [6, 4, 2, 0]) == [6, 4, 2, 0, -3, -2, -1, 1, 3, 5, 7]\n assert candidate(arr1 = [200, 100, 300, 400, 500, 600, 700, 800, 900, 1000],arr2 = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100]) == [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100]\n assert candidate(arr1 = [2, 3, 1, 3, 2, 4, 6, 7, 9, 2, 19],arr2 = [19, 2, 9, 4, 6, 3, 7]) == [19, 2, 2, 2, 9, 4, 6, 3, 3, 7, 1]\n assert candidate(arr1 = [5, 3, 1, 5, 3, 1, 5, 3, 1, 5, 3, 1, 5, 3, 1, 5, 3, 1, 5, 3, 1],arr2 = [1, 3, 5]) == [1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5]\n assert candidate(arr1 = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],arr2 = [7]) == [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]\n assert candidate(arr1 = [8, 6, 7, 5, 3, 0, 9],arr2 = [6, 7, 8]) == [6, 7, 8, 0, 3, 5, 9]\n assert candidate(arr1 = [42, 42, 42, 42, 42, 42, 42, 42, 42, 42],arr2 = [42]) == [42, 42, 42, 42, 42, 42, 42, 42, 42, 42]\n assert candidate(arr1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31],arr2 = [1, 9, 17, 25, 31]) == [1, 9, 17, 25, 31, 3, 5, 7, 11, 13, 15, 19, 21, 23, 27, 29]\n assert candidate(arr1 = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],arr2 = [5, 4, 3, 2, 1]) == [5, 5, 4, 4, 3, 3, 2, 2, 1, 1]\n assert candidate(arr1 = [100, 200, 300, 400, 500, 600, 700, 800, 900],arr2 = [500, 700, 900]) == [500, 700, 900, 100, 200, 300, 400, 600, 800]\n assert candidate(arr1 = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4],arr2 = [3, 1, 4]) == [3, 3, 3, 1, 4, 4, 4, 4, 2, 2]\n assert candidate(arr1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],arr2 = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candidate(arr1 = [42, 42, 42, 42, 42, 42],arr2 = [42]) == [42, 42, 42, 42, 42, 42]\n assert candidate(arr1 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],arr2 = [0, 2, 4, 6, 8]) == [0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 1, 1, 3, 3, 5, 5, 7, 7, 9, 9]\n assert candidate(arr1 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],arr2 = [0, 9]) == [0, 9, 1, 2, 3, 4, 5, 6, 7, 8]\n assert candidate(arr1 = [3, 1, 2, 3, 4, 1, 2, 3, 5, 1, 2],arr2 = [1, 2, 3]) == [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 5]\n assert candidate(arr1 = [5, 3, 9, 1, 5, 3, 9, 2, 8, 1, 0, 4, 7],arr2 = [1, 3, 5, 7, 9]) == [1, 1, 3, 3, 5, 5, 7, 9, 9, 0, 2, 4, 8]\n assert candidate(arr1 = [99, 88, 77, 66, 55, 44, 33, 22, 11, 0],arr2 = [11, 22, 33, 44, 55]) == [11, 22, 33, 44, 55, 0, 66, 77, 88, 99]\n assert candidate(arr1 = [7, 5, 3, 9, 1, 2, 8, 6, 4],arr2 = [4, 5, 6, 7, 8]) == [4, 5, 6, 7, 8, 1, 2, 3, 9]\n assert candidate(arr1 = [88, 99, 77, 66, 55, 44, 33, 22, 11, 88, 99, 77, 66, 55, 44],arr2 = [99, 77, 55, 33, 11]) == [99, 99, 77, 77, 55, 55, 33, 11, 22, 44, 44, 66, 66, 88, 88]\n assert candidate(arr1 = [5, 3, 1, 2, 4, 3, 2, 1, 0],arr2 = [1, 2, 3, 4, 5]) == [1, 1, 2, 2, 3, 3, 4, 5, 0]\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(arr1 = [3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],arr2 = [1, 2]) == [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3]\n assert candidate(arr1 = [5, 3, 1, 2, 4, 3, 2, 1, 5, 4, 3, 2, 1],arr2 = [1, 2, 3]) == [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5]\n assert candidate(arr1 = [50, 25, 75, 100, 0, 50, 25, 75, 100],arr2 = [25, 50, 75]) == [25, 25, 50, 50, 75, 75, 0, 100, 100]\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n assert candidate(arr1 = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5],arr2 = [2, 4]) == [2, 2, 4, 4, 4, 4, 1, 3, 3, 3, 5, 5, 5, 5, 5]\n assert candidate(arr1 = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5],arr2 = [1, 2, 3, 4, 5]) == [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]\n assert candidate(arr1 = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5],arr2 = [1, 3, 5]) == [1, 1, 1, 1, 3, 3, 3, 3, 5, 5, 5, 5, 2, 2, 2, 2, 4, 4, 4, 4]\n assert candidate(arr1 = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10],arr2 = [10, 8, 6, 4, 2]) == [10, 8, 6, 4, 2, 1, 3, 5, 7, 9]\n assert candidate(arr1 = [500, 400, 300, 200, 100, 50, 20, 10, 5, 2, 1],arr2 = [500, 400, 300]) == [500, 400, 300, 1, 2, 5, 10, 20, 50, 100, 200]\n assert candidate(arr1 = [10, 5, 14, 10, 32, 10, 5, 15, 20, 32],arr2 = [10, 5, 32]) == [10, 10, 10, 5, 5, 32, 32, 14, 15, 20]\n assert candidate(arr1 = [200, 150, 100, 50, 0, 50, 100, 150, 200, 250, 300, 350],arr2 = [250, 300, 350]) == [250, 300, 350, 0, 50, 50, 100, 100, 150, 150, 200, 200]\n assert candidate(arr1 = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990],arr2 = [990, 992, 994, 996]) == [990, 992, 994, 996, 991, 993, 995, 997, 998, 999]\n assert candidate(arr1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],arr2 = [1, 3, 5, 7, 9]) == [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]\n assert candidate(arr1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],arr2 = [1000, 900, 800, 700, 600]) == [1000, 900, 800, 700, 600, 100, 200, 300, 400, 500]\n assert candidate(arr1 = [25, 36, 45, 78, 25, 36, 45, 78, 25, 36, 45, 78],arr2 = [25, 36]) == [25, 25, 25, 36, 36, 36, 45, 45, 45, 78, 78, 78]\n assert candidate(arr1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],arr2 = [1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n assert candidate(arr1 = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90],arr2 = [90, 92, 94, 96, 98]) == [90, 92, 94, 96, 98, 91, 93, 95, 97, 99]\n assert candidate(arr1 = [3, 1, 2, 1, 3, 2, 1, 3, 2, 1],arr2 = [1, 2, 3]) == [1, 1, 1, 1, 2, 2, 2, 3, 3, 3]\n assert candidate(arr1 = [50, 40, 30, 20, 10, 50, 40, 30, 20, 10, 50, 40, 30, 20, 10],arr2 = [10, 30, 50]) == [10, 10, 10, 30, 30, 30, 50, 50, 50, 20, 20, 20, 40, 40, 40]\n assert candidate(arr1 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],arr2 = [9, 7, 5, 3, 1]) == [9, 7, 5, 3, 1, 0, 2, 4, 6, 8]\n assert candidate(arr1 = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9],arr2 = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == [9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1]\n assert candidate(arr1 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],arr2 = [1, 3, 5, 7, 9]) == [1, 3, 5, 7, 9, 0, 2, 4, 6, 8]\n assert candidate(arr1 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],arr2 = [3, 6, 9, 1]) == [3, 6, 9, 1, 0, 2, 4, 5, 7, 8]\n assert candidate(arr1 = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5],arr2 = [1, 3, 5]) == [1, 1, 1, 3, 3, 3, 5, 5, 5, 2, 2, 2, 4, 4, 4]\n assert candidate(arr1 = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],arr2 = [4]) == [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]\n assert candidate(arr1 = [15, 10, 5, 0, -5, -10, -15],arr2 = [0, 15, -15]) == [0, 15, -15, -10, -5, 5, 10]\n assert candidate(arr1 = [12, 24, 36, 48, 60, 72, 84, 96, 108],arr2 = [108, 84, 60, 36, 12]) == [108, 84, 60, 36, 12, 24, 48, 72, 96]\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],arr2 = [1, 3, 5, 7, 9, 11, 13, 15]) == [1, 3, 5, 7, 9, 11, 13, 15, 2, 4, 6, 8, 10, 12, 14]\n assert candidate(arr1 = [89, 45, 67, 23, 89, 45, 67, 23, 89, 45, 67, 23],arr2 = [89, 67, 23]) == [89, 89, 89, 67, 67, 67, 23, 23, 23, 45, 45, 45]\n assert candidate(arr1 = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7],arr2 = [7]) == [7, 7, 7, 7, 7, 7, 7, 7, 7, 7]\n assert candidate(arr1 = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],arr2 = [3, 6, 9, 12, 15]) == [3, 6, 9, 12, 15, 1, 2, 4, 5, 7, 8, 10, 11, 13, 14]\n assert candidate(arr1 = [5, 3, 1, 2, 4, 9, 7, 8, 6],arr2 = [1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(arr1 = [250, 150, 350, 450, 550, 650, 750, 850, 950, 100],arr2 = [100, 150, 250, 350, 450]) == [100, 150, 250, 350, 450, 550, 650, 750, 850, 950]\n assert candidate(arr1 = [200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100],arr2 = [100, 200]) == [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200]\n assert candidate(arr1 = [45, 55, 55, 45, 45, 55, 55, 45, 45, 55],arr2 = [45, 55]) == [45, 45, 45, 45, 45, 55, 55, 55, 55, 55]\n assert candidate(arr1 = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5],arr2 = [1, 4, 5]) == [1, 4, 4, 4, 4, 5, 5, 5, 5, 5, 2, 2, 3, 3, 3]\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100],arr2 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99]) == [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100]\n assert candidate(arr1 = [100, 200, 300, 400, 500, 600, 700, 800, 900],arr2 = [900, 700, 500, 300, 100]) == [900, 700, 500, 300, 100, 200, 400, 600, 800]\n assert candidate(arr1 = [123, 456, 789, 123, 456, 789, 123, 456, 789, 123, 456, 789],arr2 = [789, 456]) == [789, 789, 789, 789, 456, 456, 456, 456, 123, 123, 123, 123]\n assert candidate(arr1 = [2, 3, 2, 1, 4, 3, 2, 4, 6, 7, 9, 2, 19, 10, 11],arr2 = [2, 1, 4, 3, 9, 6]) == [2, 2, 2, 2, 1, 4, 4, 3, 3, 9, 6, 7, 10, 11, 19]\n assert candidate(arr1 = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9],arr2 = [2, 4, 6, 8]) == [2, 2, 4, 4, 6, 6, 8, 8, 1, 1, 3, 3, 5, 5, 7, 7, 9, 9]\n assert candidate(arr1 = [15, 25, 35, 45, 55, 15, 25, 35, 45, 55],arr2 = [15, 25, 35]) == [15, 15, 25, 25, 35, 35, 45, 45, 55, 55]\n assert candidate(arr1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],arr2 = [10, 5, 2, 1]) == [10, 5, 2, 1, 3, 4, 6, 7, 8, 9]\n assert candidate(arr1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],arr2 = [19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == [19, 17, 15, 13, 11, 9, 7, 5, 3, 1]\n assert candidate(arr1 = [3, 1, 2, 1, 3, 2, 1, 3, 2, 1, 0, 100, 200, 300],arr2 = [1, 2, 3]) == [1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 0, 100, 200, 300]\n assert candidate(arr1 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],arr2 = [0, 2, 4, 6, 8]) == [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],arr2 = [1, 5, 10, 15]) == [1, 5, 10, 15, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14]\n assert candidate(arr1 = [42, 42, 42, 100, 100, 100, 21, 21, 21],arr2 = [100, 21, 42]) == [100, 100, 100, 21, 21, 21, 42, 42, 42]\n assert candidate(arr1 = [300, 200, 100, 400, 300, 200, 100, 500, 600, 700, 800, 900],arr2 = [100, 200, 300, 400]) == [100, 100, 200, 200, 300, 300, 400, 500, 600, 700, 800, 900]\n assert candidate(arr1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23],arr2 = [1, 5, 9, 13, 17, 21]) == [1, 5, 9, 13, 17, 21, 3, 7, 11, 15, 19, 23]\n assert candidate(arr1 = [200, 100, 300, 400, 500],arr2 = [100, 300, 500]) == [100, 300, 500, 200, 400]\n assert candidate(arr1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],arr2 = [0, 1, 2, 3, 4]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n assert candidate(arr1 = [45, 12, 67, 45, 23, 45, 89, 67, 12, 34, 56],arr2 = [45, 12, 67]) == [45, 45, 45, 12, 12, 67, 67, 23, 34, 56, 89]\n assert candidate(arr1 = [88, 77, 66, 55, 44, 33, 22, 11, 0, 99, 11, 22, 33, 44, 55, 66, 77, 88],arr2 = [22, 44, 66, 88]) == [22, 22, 44, 44, 66, 66, 88, 88, 0, 11, 11, 33, 33, 55, 55, 77, 77, 99]\n assert candidate(arr1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 20, 30, 40, 50],arr2 = [100, 90, 80, 70, 60]) == [100, 90, 80, 70, 60, 10, 10, 20, 20, 30, 30, 40, 40, 50, 50]\n assert candidate(arr1 = [1, 10, 2, 9, 3, 8, 4, 7, 5, 6],arr2 = [1, 3, 5, 7, 9]) == [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]\n"}, "metadata": {"canonical_parameter_names": ["arr1", "arr2"], "leetcode_dataset_entry_point": "Solution().relativeSortArray", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var relativeSortArray = function(arr1, arr2) {", "container": null, "callable": "relativeSortArray", "parameters": [{"name": "arr1", "type": "number[]"}, {"name": "arr2", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1123, "task_id": "lowest-common-ancestor-of-deepest-leaves", "difficulty": "Medium", "problem_description": "Given the root of a binary tree, return the lowest common ancestor of its deepest leaves.\nRecall that:\n\nThe node of a binary tree is a leaf if and only if it has no children\nThe depth of the root of the tree is 0. if the depth of a node is d, the depth of each of its children is d + 1.\nThe lowest common ancestor of a set S of nodes, is the node A with the largest depth such that every node in S is in the subtree with root A.\n\n \nExample 1:\n\n\nInput: root = [3,5,1,6,2,0,8,null,null,7,4]\nOutput: [2,7,4]\nExplanation: We return the node with value 2, colored in yellow in the diagram.\nThe nodes coloured in blue are the deepest leaf-nodes of the tree.\nNote that nodes 6, 0, and 8 are also leaf nodes, but the depth of them is 2, but the depth of nodes 7 and 4 is 3.\nExample 2:\n\nInput: root = [1]\nOutput: [1]\nExplanation: The root is the deepest node in the tree, and it's the lca of itself.\n\nExample 3:\n\nInput: root = [0,1,3,null,2]\nOutput: [2]\nExplanation: The deepest leaf node in the tree is 2, the lca of one node is itself.\n\n \nConstraints:\n\nThe number of nodes in the tree will be in the range [1, 1000].\n0 <= Node.val <= 1000\nThe values of the nodes in the tree are unique.\n\n \nNote: This question is the same as 865: https://leetcode.com/problems/smallest-subtree-with-all-the-deepest-nodes/\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7])), tree_node([1, 2, 3, 4, 5, 6, 7]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5])), tree_node([2, 4, 5]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5])), tree_node([5]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, None, None, 4, 5])), tree_node([3, 4, 5]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, None, None, 11, 12, None, 13, None, None, 14])), tree_node([4, 8, 9, 13, None, None, 14]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 3, None, 2])), tree_node([2]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, 4, None, 5, 6])), tree_node([2, 1, 3, 4, None, 5, 6]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3])), tree_node([2, 1, 3]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4])), tree_node([4]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4])), tree_node([2, 7, 4]))\n assert is_same_tree(candidate(root = tree_node([1])), tree_node([1]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, 16, None, 7, 4, None, None, None, 19])), tree_node([3, 5, 1, 6, 2, 0, 8, 16, None, 7, 4, None, None, None, 19]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])), tree_node([10]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, 8, 9, 10, 11, 12, 13, None, None, None, None, 14, 15, 16])), tree_node([6, 10, 11, 14, 15, 16]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, None, 8, None, None, 7, 4, 10, None, None, None, None, 9])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, None, None, None, None, 11, None, None, 12])), tree_node([12]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, None, 4, 5, 6, 7, 8, 9, None, None, None, None, 10, 11])), tree_node([8, 10, 11]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4, None, None, None, 5])), tree_node([5]))\n assert is_same_tree(candidate(root = tree_node([5, 1, 4, None, 2, 3, None, 6, 7, None, None, None, None, 8, 9])), tree_node([7, 8, 9]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, 10, 11, None, None, 12, None, None, 13, None, None, 14])), tree_node([14]))\n assert is_same_tree(candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6])), tree_node([6]))\n assert is_same_tree(candidate(root = tree_node([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5])), tree_node([4, 3, 5]))\n assert is_same_tree(candidate(root = tree_node([1, 2, None, 3, None, None, 4, None, None, 5, None, None, None, None, None, 6])), tree_node([4]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 3, 4, 5, None, None, 6, 7, 8, 9, None, None, None, None, None, 10])), tree_node([10]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, 10, None, None, None, 11])), tree_node([11]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, None, None, 9, 10])), tree_node([7, 9, 10]))\n assert is_same_tree(candidate(root = tree_node([2, 7, 4, None, None, 5, 6, None, 8, None, None, None, None, 9, None, 10])), tree_node([8]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, None, 4, None, None, 5])), tree_node([5]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])), tree_node([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, None, None, None, 9])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11])), tree_node([11]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8])), tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4, 5, 6, 7, None, None, 8, None, None, None, None, 9, None, None, 10, None, None, 11, None, None, 12])), tree_node([10]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, 11, 12, None, None, 13, 14])), tree_node([7, 13, 14]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5, None, None, None, 6, None, None, None, 7])), tree_node([5]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4, None, None, 5, 6, 7, 8, None, None, 9, 10, None, None, 11, 12])), tree_node([9, 11, 12]))\n assert is_same_tree(candidate(root = tree_node([5, 1, 4, None, 2, None, 3])), tree_node([5, 1, 4, None, 2, None, 3]))\n assert is_same_tree(candidate(root = tree_node([2, 1, 3, None, 4, 5, None, 6, None, 7, None, 8, None, 9, None, 10])), tree_node([10]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 2, 3, None, None, 3, 4, None, None, 4, 5, None, None, 5])), tree_node([1, 2, 2, 3, None, None, 3, 4, None, None, 4, 5, None, None, 5]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, None, None, None, None, 9])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, None, None, None, None, None, 9])), tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, None, None, None, None, None, 9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, None, 4, 5, 6, 7, 8, 9, 10, None, None, 11, 12, 13, None, None, 14, 15])), tree_node([10, 14, 15]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, None, 6, None, None, 7, None, None, 8, None, None, 9])), tree_node([7]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, 8, None, None, 9])), tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, 8, None, None, 9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, None, None, None, 4, 5, 6, 7, None, None, None, None, 8, 9])), tree_node([1, 2, 3]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])), tree_node([2, 4, 5, 8, 9, 10, 11, 16, 17, 18, 19, 20]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, None, None, 8, None, 9])), tree_node([0, 1, 2, 3, 4, 5, 6, 7, None, None, 8, None, 9]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, 16, 17, 7, 4, 18, 19])), tree_node([3, 5, 1, 6, 2, 0, 8, 16, 17, 7, 4, 18, 19]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 3, None, 2, None, 4, None, 5, None, 6])), tree_node([0, 1, 3, None, 2, None, 4, None, 5, None, 6]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, 8, None, None, None, None, 9, 10])), tree_node([7, 9, 10]))\n assert is_same_tree(candidate(root = tree_node([20, 8, 22, 4, 12, 10, 14])), tree_node([20, 8, 22, 4, 12, 10, 14]))\n assert is_same_tree(candidate(root = tree_node([5, 3, 6, 2, 4, None, 7, 1, None, None, None, 8, None, 9, None])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([8, 6, 5, None, 7, None, 3, 9, None, 2, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])), tree_node([8, 6, 5, None, 7, None, 3, 9, None, 2, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9, None, None, None, None, 10, 11])), tree_node([9, 10, 11]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4, 5, 6, None, 7, None, None, None, None, 8, 9])), tree_node([7, 8, 9]))\n assert is_same_tree(candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, 4, 6, 8, 12, 14, 17, 19])), tree_node([10, 5, 15, 3, 7, 13, 18, 1, 4, 6, 8, 12, 14, 17, 19]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, 8, None, None, None, 9, None, None, None, None, 10, None, None, None, None, 11])), tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, 8, None, None, None, 9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12])), tree_node([12]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, 15, None, None, None, None, 16])), tree_node([16]))\n assert is_same_tree(candidate(root = tree_node([7, 3, 8, 1, 4, 6, 9, None, None, 2, 5])), tree_node([4, 2, 5]))\n assert is_same_tree(candidate(root = tree_node([10, 20, 30, 40, 50, None, 60, None, 70, 80, 90, None, None, None, None, None, 100])), tree_node([100]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, None, 4, 5, 6, 7])), tree_node([4, 6, 7]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, None, None, None, None, None, 9, 10])), tree_node([10]))\n assert is_same_tree(candidate(root = tree_node([2, 7, 4, 1, 11, 5, 3, None, None, None, None, None, 8, 9])), tree_node([4, 5, 3, None, 8, 9]))\n assert is_same_tree(candidate(root = tree_node([5, 1, 4, None, None, 3, 6])), tree_node([4, 3, 6]))\n assert is_same_tree(candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])), tree_node([15]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 3, None, 2, None, 4, None, None, None, None, None, 5])), tree_node([0, 1, 3, None, 2, None, 4]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, None, None, 9])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, None, 4, None, 5, 6, None, 7, None, None, None, 8])), tree_node([8]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, 8, None, None, None, None, None, None, 9])), tree_node([8]))\n assert is_same_tree(candidate(root = tree_node([5, 1, 9, 2, None, 6, 10, None, 3, None, None, None, 4, 8, 11])), tree_node([3, 8, 11]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6])), tree_node([6]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, None, None, 12, 13])), tree_node([7, 12, 13]))\n assert is_same_tree(candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6])), tree_node([6]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, None, 6, None, None, 7])), tree_node([7]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, 10, 11, None, None, None, None, 12, 13, 14, 15])), tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, 10, 11, None, None, None, None, 12, 13, 14, 15]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, None, None, 5, 6, 7, None, None, 8, 9, 10, 11, None, None, 12, 13])), tree_node([9, 12, 13]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, 11, 12])), tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, 11, 12]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, 7, None, None, 8, 9, None, None, 10, 11])), tree_node([9, 10, 11]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, None, 8, None, None, 7, 4, 10, 13, None, None, None, None, 11, None, None, 12, None, 14])), tree_node([14]))\n assert is_same_tree(candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 2, 3, None, None, 3, 4, 4, 5, 5])), tree_node([1, 2, 2, 3, None, None, 3, 4, 4, 5, 5]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, None, 8, 7, 4, None, None, 10, None, None, 14])), tree_node([14]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8])), tree_node([8]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, None, None, 9, 10, 11, 12, 13])), tree_node([13]))\n assert is_same_tree(candidate(root = tree_node([1, 2, None, 3, 4, None, 5, 6, 7, 8, 9, None, 10, 11, 12])), tree_node([2, 3, 4, None, 5, 6, 7, 8, 9, None, 10, 11, 12]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, None, None, None, None, None, None, 9, None, None, None, 10, None, None, None, None, None, None, None, 11])), tree_node([9]))\n assert is_same_tree(candidate(root = tree_node([10, 20, 30, None, 40, 50, 60, None, 70, 80, None, None, 90])), tree_node([10, 20, 30, None, 40, 50, 60, None, 70, 80, None, None, 90]))\n assert is_same_tree(candidate(root = tree_node([0, 1, 2, 3, None, None, 4, None, None, 5, None, None, 6])), tree_node([6]))\n assert is_same_tree(candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, None, None, None, None, 9, None, None, 10])), tree_node([10]))\n assert is_same_tree(candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, 17, 18, 19, 20, 21, None, 23, 24, 25, 26, 27, 28, 29])), tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, 17, 18, 19, 20, 21, None, 23, 24, 25, 26, 27, 28, 29]))\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().lcaDeepestLeaves", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var lcaDeepestLeaves = function(root) {", "container": null, "callable": "lcaDeepestLeaves", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "TreeNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1124, "task_id": "longest-well-performing-interval", "difficulty": "Medium", "problem_description": "We are given hours, a list of the number of hours worked per day for a given employee.\nA day is considered to be a tiring day if and only if the number of hours worked is (strictly) greater than 8.\nA well-performing interval is an interval of days for which the number of tiring days is strictly larger than the number of non-tiring days.\nReturn the length of the longest well-performing interval.\n \nExample 1:\n\nInput: hours = [9,9,6,0,6,6,9]\nOutput: 3\nExplanation: The longest well-performing interval is [9,9,6].\n\nExample 2:\n\nInput: hours = [6,6,6]\nOutput: 0\n\n \nConstraints:\n\n1 <= hours.length <= 104\n0 <= hours[i] <= 16\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(hours = [9, 7, 9, 7, 9, 7, 9, 7]) == 7\n assert candidate(hours = [8, 9, 9, 10]) == 4\n assert candidate(hours = [9, 9, 9, 9, 9, 9, 9]) == 7\n assert candidate(hours = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n assert candidate(hours = [8, 9, 8, 9, 8, 9, 8, 9, 8, 9]) == 9\n assert candidate(hours = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(hours = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 3\n assert candidate(hours = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(hours = [16, 16, 16, 16]) == 4\n assert candidate(hours = [12, 13, 14, 15, 16, 0, 0, 0, 0, 0]) == 9\n assert candidate(hours = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 9]) == 1\n assert candidate(hours = [5, 5, 5, 5, 5, 5, 5, 5]) == 0\n assert candidate(hours = [8, 9, 9, 2, 5]) == 3\n assert candidate(hours = [12, 8, 9, 9, 9, 10, 8, 8, 9, 10, 12]) == 11\n assert candidate(hours = [10, 10, 10, 10, 10, 10, 10, 10]) == 8\n assert candidate(hours = [9, 9, 6, 0, 6, 6, 9]) == 3\n assert candidate(hours = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(hours = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 15\n assert candidate(hours = [10, 10, 10, 10]) == 4\n assert candidate(hours = [6, 6, 6]) == 0\n assert candidate(hours = [8, 8, 8, 8, 8, 8, 8, 8]) == 0\n assert candidate(hours = [7, 7, 7, 9, 9, 9]) == 5\n assert candidate(hours = [8, 9, 9, 2, 1, 0, 7]) == 3\n assert candidate(hours = [10, 8, 10, 8, 10, 8, 10, 8, 10, 8]) == 9\n assert candidate(hours = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 10\n assert candidate(hours = [6, 9, 6, 9, 6, 9, 6, 9]) == 7\n assert candidate(hours = [8, 9, 7, 8, 6, 4, 9, 8, 9, 8]) == 3\n assert candidate(hours = [7, 7, 7, 7, 7, 7, 7]) == 0\n assert candidate(hours = [16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0]) == 25\n assert candidate(hours = [8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9]) == 27\n assert candidate(hours = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7]) == 19\n assert candidate(hours = [9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6]) == 31\n assert candidate(hours = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1]) == 15\n assert candidate(hours = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 32\n assert candidate(hours = [8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 17\n assert candidate(hours = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 1, 2, 3, 4, 5]) == 15\n assert candidate(hours = [9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8]) == 101\n assert candidate(hours = [10, 7, 9, 6, 11, 4, 5, 12, 3, 14, 1, 2, 8, 9, 15, 0, 1, 6, 7, 10]) == 5\n assert candidate(hours = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 27\n assert candidate(hours = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 48\n assert candidate(hours = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 19\n assert candidate(hours = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 16, 15, 14, 13, 12]) == 9\n assert candidate(hours = [9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1]) == 21\n assert candidate(hours = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9]) == 1\n assert candidate(hours = [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0]) == 15\n assert candidate(hours = [8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9]) == 15\n assert candidate(hours = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 15\n assert candidate(hours = [16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3]) == 17\n assert candidate(hours = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9]) == 1\n assert candidate(hours = [9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9]) == 27\n assert candidate(hours = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 15, 14, 13, 12]) == 20\n assert candidate(hours = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7]) == 15\n assert candidate(hours = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8]) == 21\n assert candidate(hours = [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 15\n assert candidate(hours = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 33\n assert candidate(hours = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 31\n assert candidate(hours = [9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 20\n assert candidate(hours = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10]) == 1\n assert candidate(hours = [9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6]) == 15\n assert candidate(hours = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9]) == 1\n assert candidate(hours = [9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1]) == 19\n assert candidate(hours = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 31\n assert candidate(hours = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 10]) == 1\n assert candidate(hours = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 11\n assert candidate(hours = [9, 8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 65\n assert candidate(hours = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 20\n assert candidate(hours = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8]) == 15\n assert candidate(hours = [10, 1, 8, 12, 8, 9, 5, 6, 7, 10, 3, 11, 4, 8, 10]) == 3\n assert candidate(hours = [8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8]) == 51\n assert candidate(hours = [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 1]) == 25\n assert candidate(hours = [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16]) == 32\n assert candidate(hours = [8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9]) == 19\n assert candidate(hours = [9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6]) == 19\n assert candidate(hours = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4]) == 15\n assert candidate(hours = [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 31\n assert candidate(hours = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 20\n assert candidate(hours = [10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8]) == 19\n assert candidate(hours = [1, 9, 2, 8, 3, 7, 4, 6, 5, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 16, 15, 14, 13, 12, 11]) == 11\n assert candidate(hours = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 0\n assert candidate(hours = [1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8]) == 0\n assert candidate(hours = [8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9]) == 19\n assert candidate(hours = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 20\n assert candidate(hours = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 19\n assert candidate(hours = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5]) == 15\n assert candidate(hours = [9, 6, 7, 8, 5, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 0, 8, 8, 9]) == 15\n assert candidate(hours = [9, 10, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9]) == 20\n assert candidate(hours = [9, 8, 9, 8, 9, 8, 9, 8, 9, 8]) == 9\n assert candidate(hours = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 19\n assert candidate(hours = [9, 7, 8, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6]) == 17\n assert candidate(hours = [10, 5, 8, 10, 4, 6, 9, 11, 7, 3, 12, 8, 10, 9, 11, 13, 14, 6, 7, 8]) == 19\n assert candidate(hours = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 29\n assert candidate(hours = [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6]) == 11\n assert candidate(hours = [8, 9, 9, 10, 8, 8, 8, 8, 8, 9, 9, 10, 11, 12, 7, 6, 5, 4, 3, 2]) == 15\n assert candidate(hours = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 9, 9]) == 3\n assert candidate(hours = [9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8]) == 51\n assert candidate(hours = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5]) == 15\n assert candidate(hours = [9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0]) == 33\n assert candidate(hours = [6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9, 6, 9]) == 21\n assert candidate(hours = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n"}, "metadata": {"canonical_parameter_names": ["hours"], "leetcode_dataset_entry_point": "Solution().longestWPI", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var longestWPI = function(hours) {", "container": null, "callable": "longestWPI", "parameters": [{"name": "hours", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1125, "task_id": "smallest-sufficient-team", "difficulty": "Hard", "problem_description": "In a project, you have a list of required skills req_skills, and a list of people. The ith person people[i] contains a list of skills that the person has.\nConsider a sufficient team: a set of people such that for every required skill in req_skills, there is at least one person in the team who has that skill. We can represent these teams by the index of each person.\n\nFor example, team = [0, 1, 3] represents the people with skills people[0], people[1], and people[3].\n\nReturn any sufficient team of the smallest possible size, represented by the index of each person. You may return the answer in any order.\nIt is guaranteed an answer exists.\n \nExample 1:\nInput: req_skills = [\"java\",\"nodejs\",\"reactjs\"], people = [[\"java\"],[\"nodejs\"],[\"nodejs\",\"reactjs\"]]\nOutput: [0,2]\nExample 2:\nInput: req_skills = [\"algorithms\",\"math\",\"java\",\"reactjs\",\"csharp\",\"aws\"], people = [[\"algorithms\",\"math\",\"java\"],[\"algorithms\",\"math\",\"reactjs\"],[\"java\",\"csharp\",\"aws\"],[\"reactjs\",\"csharp\"],[\"csharp\",\"math\"],[\"aws\",\"java\"]]\nOutput: [1,2]\n\n \nConstraints:\n\n1 <= req_skills.length <= 16\n1 <= req_skills[i].length <= 16\nreq_skills[i] consists of lowercase English letters.\nAll the strings of req_skills are unique.\n1 <= people.length <= 60\n0 <= people[i].length <= 16\n1 <= people[i][j].length <= 16\npeople[i][j] consists of lowercase English letters.\nAll the strings of people[i] are unique.\nEvery skill in people[i] is a skill in req_skills.\nIt is guaranteed a sufficient team exists.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(req_skills = ['python', 'sql'],people = [['python'], ['sql'], ['python', 'sql']]) == [2]\n assert candidate(req_skills = ['java', 'nodejs', 'reactjs'],people = [['java'], ['nodejs'], ['nodejs', 'reactjs']]) == [2, 0]\n assert candidate(req_skills = ['programming', 'testing', 'design'],people = [['programming'], ['testing'], ['design'], ['programming', 'testing'], ['testing', 'design'], ['design', 'programming']]) == [4, 0]\n assert candidate(req_skills = ['a', 'b', 'c'],people = [['a', 'b'], ['b', 'c'], ['c'], ['a']]) == [1, 3]\n assert candidate(req_skills = ['network', 'database'],people = [['network'], ['database'], ['network', 'database']]) == [2]\n assert candidate(req_skills = ['skill1', 'skill2', 'skill3', 'skill4'],people = [['skill1'], ['skill2'], ['skill3'], ['skill4'], ['skill1', 'skill2', 'skill3', 'skill4']]) == [4]\n assert candidate(req_skills = ['coding', 'design', 'writing'],people = [['coding'], ['design'], ['writing'], ['coding', 'design', 'writing']]) == [3]\n assert candidate(req_skills = ['coding', 'design'],people = [['coding'], ['design'], ['coding', 'design']]) == [2]\n assert candidate(req_skills = ['skill1', 'skill2', 'skill3', 'skill4'],people = [['skill1'], ['skill2'], ['skill3'], ['skill4'], ['skill1', 'skill2'], ['skill3', 'skill4']]) == [5, 4]\n assert candidate(req_skills = ['algorithms', 'math', 'java', 'reactjs', 'csharp', 'aws'],people = [['algorithms', 'math', 'java'], ['algorithms', 'math', 'reactjs'], ['java', 'csharp', 'aws'], ['reactjs', 'csharp'], ['csharp', 'math'], ['aws', 'java']]) == [2, 1]\n assert candidate(req_skills = ['python', 'data', 'ai'],people = [['python'], ['data'], ['ai'], ['python', 'data'], ['data', 'ai'], ['python', 'ai']]) == [4, 0]\n assert candidate(req_skills = ['req1', 'req2'],people = [['req1'], ['req2'], ['req1', 'req2'], ['req1'], ['req2']]) == [2]\n assert candidate(req_skills = ['sql', 'noSql'],people = [['sql'], ['noSql'], ['sql', 'noSql'], ['sql'], ['noSql']]) == [2]\n assert candidate(req_skills = ['skill1', 'skill2', 'skill3'],people = [['skill1', 'skill2'], ['skill2', 'skill3'], ['skill3', 'skill1']]) == [1, 0]\n assert candidate(req_skills = ['a', 'b', 'c', 'd'],people = [['a', 'b'], ['b', 'c'], ['c', 'd'], ['d', 'a'], ['a', 'b', 'c', 'd']]) == [4]\n assert candidate(req_skills = ['devops', 'data_analysis', 'cloud_services', 'ui_ux'],people = [['devops'], ['data_analysis'], ['cloud_services'], ['ui_ux'], ['devops', 'data_analysis'], ['cloud_services', 'ui_ux'], ['devops', 'cloud_services'], ['data_analysis', 'ui_ux']]) == [5, 4]\n assert candidate(req_skills = ['machinelearning', 'deeplearning', 'computer_vision', 'nlp'],people = [['machinelearning'], ['deeplearning'], ['computer_vision'], ['nlp'], ['machinelearning', 'deeplearning'], ['computer_vision', 'nlp'], ['machinelearning', 'nlp']]) == [5, 4]\n assert candidate(req_skills = ['frontend', 'backend', 'fullstack', 'uiux', 'devops'],people = [['frontend'], ['backend'], ['fullstack'], ['uiux'], ['devops'], ['frontend', 'backend'], ['fullstack', 'uiux'], ['backend', 'devops'], ['fullstack', 'devops'], ['frontend', 'uiux'], ['frontend', 'backend', 'uiux']]) == [8, 10]\n assert candidate(req_skills = ['ui', 'ux', 'backend', 'frontend'],people = [['ui'], ['ux'], ['backend'], ['frontend'], ['ui', 'ux'], ['backend', 'frontend'], ['ui', 'backend'], ['ux', 'frontend'], ['ui', 'ux', 'backend', 'frontend']]) == [8]\n assert candidate(req_skills = ['python', 'javascript', 'c++', 'ruby'],people = [['python', 'javascript'], ['c++'], ['ruby'], ['python', 'c++'], ['javascript', 'ruby']]) == [4, 3]\n assert candidate(req_skills = ['frontend', 'backend', 'devops', 'qa'],people = [['frontend'], ['backend'], ['devops'], ['qa'], ['frontend', 'backend'], ['backend', 'devops'], ['devops', 'qa'], ['frontend', 'qa'], ['frontend', 'backend', 'devops'], ['backend', 'devops', 'qa'], ['frontend', 'devops', 'qa'], ['frontend', 'backend', 'qa'], ['frontend', 'backend', 'devops', 'qa']]) == [12]\n assert candidate(req_skills = ['sql', 'nosql', 'big_data', 'data_warehouse'],people = [['sql'], ['nosql'], ['big_data'], ['data_warehouse'], ['sql', 'nosql'], ['nosql', 'big_data'], ['big_data', 'data_warehouse'], ['sql', 'data_warehouse'], ['sql', 'nosql', 'big_data'], ['nosql', 'big_data', 'data_warehouse'], ['sql', 'big_data', 'data_warehouse'], ['sql', 'nosql', 'data_warehouse'], ['sql', 'nosql', 'big_data', 'data_warehouse']]) == [12]\n assert candidate(req_skills = ['mobiledev', 'webdev', 'devops', 'design', 'testing'],people = [['mobiledev'], ['webdev'], ['devops'], ['design'], ['testing'], ['mobiledev', 'webdev'], ['devops', 'design'], ['webdev', 'testing'], ['mobiledev', 'devops'], ['design', 'testing'], ['mobiledev', 'webdev', 'devops'], ['devops', 'design', 'testing']]) == [11, 5]\n assert candidate(req_skills = ['algorithm', 'datastructure', 'programming', 'problem-solving'],people = [['algorithm'], ['datastructure'], ['programming'], ['problem-solving'], ['algorithm', 'datastructure'], ['programming', 'problem-solving'], ['algorithm', 'problem-solving'], ['datastructure', 'programming'], ['algorithm', 'datastructure', 'programming', 'problem-solving']]) == [8]\n assert candidate(req_skills = ['iot', 'ml', 'ai', 'automation', 'cloudcomputing'],people = [['iot'], ['ml'], ['ai'], ['automation'], ['cloudcomputing'], ['iot', 'ml'], ['ai', 'automation'], ['cloudcomputing', 'ml'], ['iot', 'automation'], ['ai', 'cloudcomputing'], ['iot', 'ml', 'ai'], ['automation', 'cloudcomputing', 'ml']]) == [11, 10]\n assert candidate(req_skills = ['project_management', 'communication', 'problem_solving', 'decision_making'],people = [['project_management'], ['communication'], ['problem_solving'], ['decision_making'], ['project_management', 'communication'], ['problem_solving', 'decision_making'], ['project_management', 'problem_solving'], ['communication', 'decision_making'], ['project_management', 'communication', 'problem_solving'], ['communication', 'problem_solving', 'decision_making']]) == [9, 0]\n assert candidate(req_skills = ['database', 'frontend', 'backend', 'devops', 'cloud', 'security'],people = [['database'], ['frontend'], ['backend'], ['devops'], ['cloud'], ['security'], ['database', 'frontend'], ['backend', 'devops'], ['cloud', 'security'], ['database', 'backend'], ['frontend', 'devops'], ['cloud', 'frontend'], ['database', 'cloud'], ['devops', 'security'], ['database', 'frontend', 'backend'], ['devops', 'cloud', 'security']]) == [15, 14]\n assert candidate(req_skills = ['python', 'javascript', 'ruby', 'cpp'],people = [['python', 'cpp'], ['javascript'], ['ruby'], ['python', 'javascript'], ['cpp', 'ruby'], ['python', 'ruby']]) == [4, 3]\n assert candidate(req_skills = ['sql', 'nosql', 'devops', 'cloud', 'agile'],people = [['sql'], ['nosql'], ['devops'], ['cloud'], ['agile'], ['sql', 'nosql'], ['devops', 'cloud'], ['cloud', 'agile'], ['sql', 'devops'], ['nosql', 'agile']]) == [7, 8, 1]\n assert candidate(req_skills = ['leadership', 'communication', 'programming', 'project-management', 'design'],people = [['leadership'], ['communication'], ['programming'], ['project-management'], ['design'], ['leadership', 'communication'], ['programming', 'project-management'], ['design', 'communication'], ['leadership', 'programming'], ['project-management', 'design'], ['leadership', 'programming', 'design'], ['communication', 'project-management', 'design'], ['leadership', 'communication', 'design']]) == [11, 8]\n assert candidate(req_skills = ['javascript', 'typescript', 'angular', 'react'],people = [['javascript'], ['typescript'], ['angular'], ['react'], ['javascript', 'typescript'], ['angular', 'react'], ['javascript', 'angular'], ['typescript', 'react'], ['javascript', 'typescript', 'angular', 'react']]) == [8]\n assert candidate(req_skills = ['python', 'javascript', 'c++', 'ruby', 'go'],people = [['python', 'javascript'], ['c++', 'ruby'], ['go'], ['python', 'c++'], ['javascript', 'ruby', 'go']]) == [4, 3]\n assert candidate(req_skills = ['linux', 'windows', 'macos', 'docker'],people = [['linux'], ['windows'], ['macos'], ['docker'], ['linux', 'windows'], ['macos', 'docker'], ['linux', 'macos'], ['windows', 'docker'], ['linux', 'macos', 'docker'], ['windows', 'macos', 'docker'], ['linux', 'windows', 'docker'], ['linux', 'windows', 'macos', 'docker']]) == [11]\n assert candidate(req_skills = ['sql', 'nosql', 'bigdata', 'machinelearning', 'datascience'],people = [['sql', 'nosql'], ['bigdata', 'machinelearning'], ['datascience'], ['sql', 'bigdata'], ['nosql', 'machinelearning'], ['bigdata', 'datascience'], ['machinelearning', 'datascience'], ['sql', 'nosql', 'bigdata', 'machinelearning', 'datascience']]) == [7]\n assert candidate(req_skills = ['git', 'docker', 'jenkins', 'travis', 'circleci', 'aws'],people = [['git', 'docker'], ['jenkins', 'travis'], ['circleci', 'aws'], ['git', 'travis'], ['docker', 'circleci'], ['jenkins', 'aws'], ['git', 'docker', 'jenkins', 'travis', 'circleci', 'aws']]) == [6]\n assert candidate(req_skills = ['mongodb', 'postgresql', 'mysql', 'oracle'],people = [['mongodb'], ['postgresql'], ['mysql'], ['oracle'], ['mongodb', 'postgresql'], ['mysql', 'oracle'], ['mongodb', 'mysql'], ['postgresql', 'oracle'], ['mongodb', 'postgresql', 'mysql'], ['postgresql', 'mysql', 'oracle'], ['mongodb', 'mysql', 'oracle'], ['mongodb', 'postgresql', 'oracle'], ['mongodb', 'postgresql', 'mysql', 'oracle']]) == [12]\n assert candidate(req_skills = ['communication', 'problem_solving', 'critical_thinking', 'leadership'],people = [['communication'], ['problem_solving'], ['critical_thinking'], ['leadership'], ['communication', 'problem_solving'], ['critical_thinking', 'leadership'], ['communication', 'critical_thinking'], ['problem_solving', 'leadership'], ['communication', 'problem_solving', 'critical_thinking'], ['communication', 'problem_solving', 'leadership'], ['communication', 'critical_thinking', 'leadership'], ['problem_solving', 'critical_thinking', 'leadership'], ['communication', 'problem_solving', 'critical_thinking', 'leadership']]) == [12]\n assert candidate(req_skills = ['image_processing', 'natural_language_processing', 'deep_learning', 'computer_vision'],people = [['image_processing'], ['natural_language_processing'], ['deep_learning'], ['computer_vision'], ['image_processing', 'natural_language_processing'], ['deep_learning', 'computer_vision'], ['image_processing', 'deep_learning'], ['natural_language_processing', 'computer_vision'], ['image_processing', 'natural_language_processing', 'deep_learning'], ['natural_language_processing', 'deep_learning', 'computer_vision'], ['image_processing', 'deep_learning', 'computer_vision'], ['image_processing', 'natural_language_processing', 'deep_learning', 'computer_vision']]) == [11]\n assert candidate(req_skills = ['java', 'spring', 'hibernate', 'react'],people = [['java'], ['spring'], ['hibernate'], ['react'], ['java', 'spring'], ['spring', 'hibernate'], ['hibernate', 'react'], ['java', 'react'], ['java', 'spring', 'hibernate'], ['java', 'spring', 'react'], ['spring', 'hibernate', 'react'], ['java', 'spring', 'hibernate', 'react']]) == [11]\n assert candidate(req_skills = ['sql', 'python', 'frontend', 'backend'],people = [['sql'], ['python'], ['frontend'], ['backend'], ['sql', 'python'], ['frontend', 'backend']]) == [5, 4]\n assert candidate(req_skills = ['python', 'java', 'c++', 'ruby'],people = [['python'], ['java'], ['c++'], ['ruby'], ['python', 'java'], ['c++', 'ruby'], ['python', 'c++'], ['java', 'ruby']]) == [5, 4]\n assert candidate(req_skills = ['aws', 'azure', 'gcp'],people = [['aws', 'azure'], ['gcp'], ['aws'], ['azure', 'gcp'], ['aws', 'gcp'], ['azure'], ['aws', 'azure', 'gcp']]) == [6]\n assert candidate(req_skills = ['data_science', 'data_engineering', 'ai', 'ml'],people = [['data_science'], ['data_engineering'], ['ai'], ['ml'], ['data_science', 'data_engineering'], ['ai', 'ml'], ['data_science', 'ai'], ['data_engineering', 'ml'], ['data_science', 'data_engineering', 'ai'], ['data_engineering', 'ai', 'ml'], ['data_science', 'ai', 'ml'], ['data_science', 'data_engineering', 'ai', 'ml']]) == [11]\n assert candidate(req_skills = ['security', 'testing', 'projectmanagement', 'communication', 'design'],people = [['security'], ['testing'], ['projectmanagement'], ['communication'], ['design'], ['security', 'testing'], ['projectmanagement', 'communication'], ['design', 'security'], ['testing', 'communication'], ['security', 'projectmanagement', 'design'], ['testing', 'communication', 'design']]) == [9, 8]\n assert candidate(req_skills = ['coding', 'debugging', 'testing', 'design'],people = [['coding', 'debugging'], ['testing'], ['design'], ['coding', 'testing'], ['debugging', 'design']]) == [4, 3]\n assert candidate(req_skills = ['photoshop', 'illustrator', 'indesign', 'lightroom'],people = [['photoshop', 'illustrator'], ['indesign'], ['lightroom'], ['photoshop', 'indesign'], ['illustrator', 'lightroom'], ['photoshop', 'lightroom'], ['indesign', 'lightroom'], ['photoshop', 'illustrator', 'indesign'], ['illustrator', 'indesign', 'lightroom'], ['photoshop', 'indesign', 'lightroom'], ['photoshop', 'illustrator', 'lightroom'], ['photoshop', 'illustrator', 'indesign', 'lightroom']]) == [11]\n assert candidate(req_skills = ['algorithm', 'data-structures', 'database', 'networking', 'os'],people = [['algorithm', 'data-structures'], ['database'], ['networking'], ['os'], ['algorithm', 'os'], ['data-structures', 'networking'], ['database', 'os'], ['algorithm', 'data-structures', 'database'], ['networking', 'os'], ['algorithm', 'networking', 'os']]) == [8, 7]\n assert candidate(req_skills = ['security', 'analytics', 'ml', 'devops'],people = [['security'], ['analytics'], ['ml'], ['devops'], ['security', 'analytics'], ['ml', 'devops'], ['security', 'ml'], ['analytics', 'devops'], ['security', 'analytics', 'ml'], ['security', 'analytics', 'devops'], ['security', 'ml', 'devops'], ['analytics', 'ml', 'devops'], ['security', 'analytics', 'ml', 'devops']]) == [12]\n assert candidate(req_skills = ['sql', 'no_sql', 'big_data', 'cloud_computing'],people = [['sql'], ['no_sql'], ['big_data'], ['cloud_computing'], ['sql', 'no_sql'], ['big_data', 'cloud_computing'], ['sql', 'big_data'], ['no_sql', 'cloud_computing'], ['sql', 'no_sql', 'big_data'], ['no_sql', 'big_data', 'cloud_computing'], ['sql', 'big_data', 'cloud_computing'], ['sql', 'no_sql', 'cloud_computing']]) == [9, 0]\n assert candidate(req_skills = ['coding', 'debugging', 'design', 'deployment'],people = [['coding', 'debugging'], ['design'], ['deployment'], ['coding', 'deployment'], ['design', 'debugging']]) == [3, 4]\n assert candidate(req_skills = ['sql', 'nosql', 'bigdata', 'cloud', 'devops'],people = [['sql'], ['nosql'], ['bigdata'], ['cloud'], ['devops'], ['sql', 'nosql'], ['bigdata', 'cloud'], ['devops', 'sql'], ['nosql', 'cloud'], ['bigdata', 'devops'], ['sql', 'cloud'], ['nosql', 'devops'], ['bigdata', 'sql'], ['cloud', 'devops'], ['sql', 'nosql', 'cloud'], ['bigdata', 'sql', 'cloud'], ['nosql', 'cloud', 'devops']]) == [16, 12]\n assert candidate(req_skills = ['python', 'cpp', 'java', 'javascript'],people = [['python', 'cpp'], ['java'], ['javascript', 'java'], ['cpp', 'python'], ['cpp', 'java'], ['javascript']]) == [2, 0]\n assert candidate(req_skills = ['coding', 'debugging', 'testing', 'deployment'],people = [['coding'], ['debugging'], ['testing'], ['deployment'], ['coding', 'debugging'], ['testing', 'deployment'], ['coding', 'testing'], ['debugging', 'deployment'], ['coding', 'debugging', 'testing'], ['debugging', 'testing', 'deployment'], ['coding', 'debugging', 'deployment'], ['coding', 'testing', 'deployment'], ['coding', 'debugging', 'testing', 'deployment']]) == [12]\n assert candidate(req_skills = ['networking', 'security', 'project_management', 'budgeting'],people = [['networking'], ['security'], ['project_management'], ['budgeting'], ['networking', 'security'], ['project_management', 'budgeting'], ['networking', 'project_management'], ['security', 'budgeting'], ['networking', 'project_management', 'budgeting'], ['networking', 'security', 'project_management', 'budgeting']]) == [9]\n assert candidate(req_skills = ['aws', 'azure', 'gcp', 'docker', 'kubernetes'],people = [['aws', 'azure'], ['gcp', 'docker'], ['kubernetes'], ['aws', 'docker'], ['azure', 'gcp'], ['aws', 'gcp', 'kubernetes']]) == [5, 3, 0]\n assert candidate(req_skills = ['coding', 'testing', 'documentation', 'deployment'],people = [['coding', 'testing'], ['documentation', 'deployment'], ['coding', 'documentation'], ['testing', 'deployment'], ['coding', 'testing', 'documentation'], ['testing', 'documentation', 'deployment'], ['coding', 'documentation', 'deployment'], ['coding', 'testing', 'deployment'], ['coding', 'testing', 'documentation', 'deployment']]) == [8]\n assert candidate(req_skills = ['html', 'css', 'javascript', 'react', 'nodejs'],people = [['html', 'css'], ['javascript'], ['react', 'nodejs'], ['html', 'javascript'], ['css', 'nodejs'], ['react'], ['html', 'javascript', 'react']]) == [4, 6]\n assert candidate(req_skills = ['product', 'design', 'backend', 'frontend', 'testing'],people = [['product'], ['design'], ['backend'], ['frontend'], ['testing'], ['product', 'design'], ['backend', 'frontend'], ['testing', 'product'], ['design', 'backend'], ['frontend', 'testing'], ['product', 'backend', 'frontend', 'testing'], ['design', 'backend', 'frontend', 'testing']]) == [11, 0]\n assert candidate(req_skills = ['docker', 'kubernetes', 'aws', 'gcp'],people = [['docker'], ['kubernetes'], ['aws'], ['gcp'], ['docker', 'kubernetes'], ['aws', 'gcp'], ['docker', 'aws'], ['kubernetes', 'gcp']]) == [5, 4]\n assert candidate(req_skills = ['linux', 'windows', 'macos', 'unix'],people = [['linux'], ['windows'], ['macos'], ['unix'], ['linux', 'windows'], ['macos', 'unix'], ['linux', 'macos'], ['windows', 'unix'], ['linux', 'unix'], ['windows', 'macos'], ['linux', 'macos', 'unix'], ['linux', 'windows', 'unix'], ['windows', 'macos', 'unix'], ['linux', 'windows', 'macos'], ['linux', 'windows', 'macos', 'unix']]) == [14]\n assert candidate(req_skills = ['python', 'javascript', 'typescript', 'react', 'angular', 'vue'],people = [['python'], ['javascript'], ['typescript'], ['react'], ['angular'], ['vue'], ['python', 'javascript'], ['typescript', 'react'], ['angular', 'vue'], ['python', 'react'], ['javascript', 'vue']]) == [8, 7, 6]\n assert candidate(req_skills = ['html', 'css', 'javascript', 'react'],people = [['html', 'css'], ['javascript'], ['react'], ['css', 'javascript'], ['html', 'react'], ['html', 'css', 'javascript', 'react']]) == [5]\n assert candidate(req_skills = ['algorithm', 'data_structure', 'design_patterns', 'software_architecture'],people = [['algorithm'], ['data_structure'], ['design_patterns'], ['software_architecture'], ['algorithm', 'data_structure'], ['design_patterns', 'software_architecture'], ['algorithm', 'design_patterns'], ['data_structure', 'software_architecture'], ['algorithm', 'data_structure', 'design_patterns'], ['algorithm', 'data_structure', 'software_architecture'], ['algorithm', 'design_patterns', 'software_architecture'], ['data_structure', 'design_patterns', 'software_architecture'], ['algorithm', 'data_structure', 'design_patterns', 'software_architecture']]) == [12]\n assert candidate(req_skills = ['frontend', 'backend', 'devops', 'qa'],people = [['frontend'], ['backend'], ['devops'], ['qa'], ['frontend', 'backend'], ['devops', 'qa'], ['frontend', 'devops'], ['backend', 'qa'], ['frontend', 'devops', 'qa'], ['backend', 'devops', 'qa'], ['frontend', 'backend', 'devops'], ['frontend', 'backend', 'qa'], ['frontend', 'backend', 'devops', 'qa']]) == [12]\n assert candidate(req_skills = ['machine-learning', 'deep-learning', 'neural-networks', 'cv', 'nlp'],people = [['machine-learning'], ['deep-learning'], ['neural-networks'], ['cv'], ['nlp'], ['machine-learning', 'deep-learning'], ['neural-networks', 'cv'], ['nlp', 'machine-learning'], ['deep-learning', 'cv'], ['neural-networks', 'nlp'], ['machine-learning', 'cv'], ['deep-learning', 'nlp'], ['machine-learning', 'neural-networks'], ['deep-learning', 'neural-networks'], ['cv', 'nlp'], ['machine-learning', 'deep-learning', 'cv'], ['neural-networks', 'cv', 'nlp'], ['machine-learning', 'deep-learning', 'nlp'], ['neural-networks', 'deep-learning', 'cv', 'nlp'], ['machine-learning', 'neural-networks', 'cv', 'nlp']]) == [18, 0]\n assert candidate(req_skills = ['network_security', 'cyber_security', 'penetration_testing', 'vulnerability_assessment'],people = [['network_security'], ['cyber_security'], ['penetration_testing'], ['vulnerability_assessment'], ['network_security', 'cyber_security'], ['penetration_testing', 'vulnerability_assessment'], ['network_security', 'penetration_testing'], ['cyber_security', 'vulnerability_assessment'], ['network_security', 'vulnerability_assessment'], ['cyber_security', 'penetration_testing'], ['network_security', 'cyber_security', 'penetration_testing', 'vulnerability_assessment']]) == [10]\n assert candidate(req_skills = ['front_end', 'back_end', 'database', 'cloud_services'],people = [['front_end'], ['back_end'], ['database'], ['cloud_services'], ['front_end', 'back_end'], ['database', 'cloud_services'], ['front_end', 'database'], ['back_end', 'cloud_services'], ['front_end', 'back_end', 'database'], ['front_end', 'back_end', 'cloud_services'], ['front_end', 'database', 'cloud_services'], ['back_end', 'database', 'cloud_services'], ['front_end', 'back_end', 'database', 'cloud_services']]) == [12]\n assert candidate(req_skills = ['data_science', 'machine_learning', 'deep_learning', 'computer_vision'],people = [['data_science'], ['machine_learning'], ['deep_learning'], ['computer_vision'], ['machine_learning', 'deep_learning'], ['data_science', 'computer_vision'], ['data_science', 'machine_learning'], ['data_science', 'deep_learning'], ['machine_learning', 'computer_vision'], ['deep_learning', 'computer_vision']]) == [9, 6]\n assert candidate(req_skills = ['python', 'javascript', 'html', 'css', 'react', 'nodejs'],people = [['python'], ['javascript'], ['html'], ['css'], ['react'], ['nodejs'], ['python', 'javascript'], ['html', 'css'], ['react', 'nodejs'], ['python', 'html', 'css'], ['javascript', 'react', 'nodejs']]) == [10, 9]\n assert candidate(req_skills = ['machine_learning', 'deep_learning', 'cv', 'nlp'],people = [['machine_learning', 'deep_learning'], ['cv'], ['nlp'], ['deep_learning', 'cv'], ['machine_learning', 'nlp'], ['deep_learning', 'nlp', 'cv'], ['machine_learning', 'deep_learning', 'cv', 'nlp']]) == [6]\n assert candidate(req_skills = ['ux', 'ui', 'product', 'design', 'marketing'],people = [['ux'], ['ui'], ['product'], ['design'], ['marketing'], ['ux', 'ui'], ['product', 'design'], ['marketing', 'ux'], ['ui', 'product'], ['design', 'marketing'], ['ux', 'product'], ['ui', 'marketing'], ['product', 'design', 'marketing'], ['ux', 'ui', 'design'], ['ui', 'product', 'design'], ['ux', 'product', 'marketing'], ['ux', 'ui', 'product', 'design', 'marketing']]) == [16]\n assert candidate(req_skills = ['python', 'javascript', 'cpp', 'go'],people = [['python', 'cpp'], ['javascript'], ['go'], ['python', 'javascript', 'go'], ['cpp', 'javascript']]) == [3, 0]\n"}, "metadata": {"canonical_parameter_names": ["req_skills", "people"], "leetcode_dataset_entry_point": "Solution().smallestSufficientTeam", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var smallestSufficientTeam = function(req_skills, people) {", "container": null, "callable": "smallestSufficientTeam", "parameters": [{"name": "req_skills", "type": "string[]"}, {"name": "people", "type": "string[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1128, "task_id": "number-of-equivalent-domino-pairs", "difficulty": "Easy", "problem_description": "Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (a == c and b == d), or (a == d and b == c) - that is, one domino can be rotated to be equal to another domino.\nReturn the number of pairs (i, j) for which 0 <= i < j < dominoes.length, and dominoes[i] is equivalent to dominoes[j].\n \nExample 1:\n\nInput: dominoes = [[1,2],[2,1],[3,4],[5,6]]\nOutput: 1\n\nExample 2:\n\nInput: dominoes = [[1,2],[1,2],[1,1],[1,2],[2,2]]\nOutput: 3\n\n \nConstraints:\n\n1 <= dominoes.length <= 4 * 104\ndominoes[i].length == 2\n1 <= dominoes[i][j] <= 9\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(dominoes = [[7, 8], [8, 7], [9, 10], [10, 9], [11, 12]]) == 2\n assert candidate(dominoes = [[7, 8], [8, 7], [7, 8], [7, 8], [8, 7]]) == 10\n assert candidate(dominoes = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) == 10\n assert candidate(dominoes = [[1, 2], [2, 1], [3, 4], [5, 6]]) == 1\n assert candidate(dominoes = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 0\n assert candidate(dominoes = [[1, 2], [2, 3], [3, 4], [4, 5]]) == 0\n assert candidate(dominoes = [[1, 1], [2, 2], [1, 2], [2, 1]]) == 1\n assert candidate(dominoes = [[1, 1], [1, 1], [1, 1], [1, 1]]) == 6\n assert candidate(dominoes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 1]]) == 0\n assert candidate(dominoes = [[1, 2], [1, 2], [1, 1], [1, 2], [2, 2]]) == 3\n assert candidate(dominoes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 1]]) == 0\n assert candidate(dominoes = [[1, 9], [9, 1], [2, 8], [8, 2], [3, 7], [7, 3], [4, 6], [6, 4], [5, 5]]) == 4\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2]]) == 21\n assert candidate(dominoes = [[1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7], [9, 9], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [1, 2], [2, 1]]) == 10\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 3], [3, 1], [1, 4], [4, 1], [1, 5], [5, 1], [1, 6], [6, 1], [1, 7], [7, 1], [1, 8], [8, 1], [1, 9], [9, 1], [1, 2], [2, 1], [1, 3], [3, 1], [1, 4], [4, 1], [1, 5], [5, 1], [1, 6], [6, 1], [1, 7], [7, 1], [1, 8], [8, 1], [1, 9], [9, 1]]) == 48\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1]]) == 28\n assert candidate(dominoes = [[1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7], [9, 1], [1, 9], [2, 3], [3, 2]]) == 6\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1]]) == 120\n assert candidate(dominoes = [[3, 4], [4, 3], [3, 5], [5, 3], [3, 6], [6, 3], [3, 7], [7, 3], [3, 8], [8, 3], [3, 9], [9, 3]]) == 6\n assert candidate(dominoes = [[9, 1], [1, 9], [2, 3], [3, 2], [4, 5], [5, 4], [6, 7], [7, 6], [8, 9], [9, 8], [1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7], [1, 9], [9, 1]]) == 14\n assert candidate(dominoes = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) == 153\n assert candidate(dominoes = [[1, 9], [9, 1], [2, 8], [8, 2], [3, 7], [7, 3], [4, 6], [6, 4], [5, 5], [1, 9], [9, 1], [2, 8], [8, 2], [3, 7], [7, 3], [4, 6], [6, 4], [5, 5], [1, 9], [9, 1]]) == 34\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 2], [2, 1], [3, 4], [4, 3], [1, 2], [2, 1], [1, 2], [2, 1], [3, 4], [4, 3], [1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [5, 6], [6, 5], [1, 2], [2, 1]]) == 87\n assert candidate(dominoes = [[1, 1], [2, 2], [3, 3], [1, 2], [2, 1], [2, 3], [3, 2], [1, 3], [3, 1]]) == 3\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1]]) == 153\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 2], [2, 1], [1, 1], [1, 1], [2, 2], [2, 2], [3, 3], [3, 3]]) == 9\n assert candidate(dominoes = [[2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]]) == 120\n assert candidate(dominoes = [[1, 1], [1, 2], [2, 1], [1, 1], [2, 2], [1, 2], [2, 1], [1, 2], [2, 2], [2, 1], [1, 1]]) == 19\n assert candidate(dominoes = [[1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7], [9, 1], [1, 9], [2, 3], [3, 2], [4, 5], [5, 4], [6, 7], [7, 6]]) == 8\n assert candidate(dominoes = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) == 36\n assert candidate(dominoes = [[1, 9], [9, 1], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1]]) == 1\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 3], [3, 1], [2, 3], [3, 2], [1, 4], [4, 1], [2, 4], [4, 2], [3, 3], [3, 4], [4, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [9, 9], [9, 9], [9, 9], [9, 9], [9, 9], [9, 9], [9, 9]]) == 34\n assert candidate(dominoes = [[1, 2], [2, 1], [2, 1], [1, 2], [3, 4], [4, 3], [3, 4]]) == 9\n assert candidate(dominoes = [[1, 9], [9, 1], [2, 9], [9, 2], [3, 9], [9, 3], [4, 9], [9, 4], [5, 9], [9, 5], [6, 9], [9, 6], [7, 9], [9, 7], [8, 9], [9, 8], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [9, 9]]) == 9\n assert candidate(dominoes = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 9\n assert candidate(dominoes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 1]]) == 9\n assert candidate(dominoes = [[1, 9], [9, 1], [2, 8], [8, 2], [3, 7], [7, 3], [4, 6], [6, 4], [5, 5], [5, 5], [1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5]]) == 8\n assert candidate(dominoes = [[1, 2], [1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1], [2, 1], [1, 2], [1, 2], [1, 2], [2, 1], [2, 1], [1, 2], [2, 1], [2, 1], [1, 2], [1, 2], [2, 1], [2, 1], [1, 2], [2, 1], [2, 1], [1, 2], [1, 2]]) == 300\n assert candidate(dominoes = [[1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7], [9, 9]]) == 4\n assert candidate(dominoes = [[5, 5], [5, 5], [5, 5], [5, 5], [5, 5]]) == 10\n assert candidate(dominoes = [[1, 9], [2, 8], [3, 7], [4, 6], [5, 5], [6, 4], [7, 3], [8, 2], [9, 1], [1, 9]]) == 6\n assert candidate(dominoes = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [2, 1], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [3, 1], [3, 2], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [4, 1], [4, 2], [4, 3], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9]]) == 6\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 2], [2, 1], [3, 3], [3, 3], [3, 3]]) == 9\n assert candidate(dominoes = [[1, 2], [2, 1], [3, 4], [4, 3], [1, 2], [2, 1], [1, 2], [2, 1], [3, 4], [4, 3], [1, 2], [2, 1], [3, 4], [4, 3], [1, 2], [2, 1]]) == 60\n assert candidate(dominoes = [[1, 9], [9, 1], [2, 8], [8, 2], [3, 7], [7, 3], [4, 6], [6, 4], [5, 5], [5, 5]]) == 5\n assert candidate(dominoes = [[1, 9], [9, 1], [2, 8], [8, 2], [3, 7], [7, 3], [4, 6], [6, 4], [5, 5], [1, 1]]) == 4\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 3], [3, 1], [1, 4], [4, 1], [1, 5], [5, 1], [1, 6], [6, 1], [1, 7], [7, 1], [1, 8], [8, 1], [1, 9], [9, 1]]) == 8\n assert candidate(dominoes = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 1], [2, 1], [4, 3], [6, 5], [8, 7], [1, 9], [2, 3], [4, 5], [6, 7], [8, 9], [1, 2], [3, 4], [5, 6], [7, 8]]) == 13\n assert candidate(dominoes = [[1, 1], [2, 2], [1, 2], [2, 1], [3, 3], [2, 3], [3, 2], [4, 4], [3, 4], [4, 3], [5, 5], [4, 5], [5, 4], [6, 6], [5, 6], [6, 5], [7, 7], [6, 7], [7, 6], [8, 8], [7, 8], [8, 7], [9, 9], [8, 9], [9, 8], [1, 3], [3, 1], [1, 4], [4, 1], [1, 5], [5, 1], [1, 6], [6, 1], [1, 7], [7, 1], [1, 8], [8, 1], [1, 9], [9, 1]]) == 15\n assert candidate(dominoes = [[9, 1], [1, 9], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [1, 1], [2, 2], [3, 3]]) == 3\n assert candidate(dominoes = [[1, 9], [2, 8], [3, 7], [4, 6], [5, 5], [4, 6], [3, 7], [2, 8], [1, 9], [1, 9], [2, 8], [3, 7], [4, 6], [5, 5]]) == 13\n assert candidate(dominoes = [[1, 1], [1, 2], [2, 1], [1, 3], [3, 1], [2, 2], [2, 3], [3, 2], [1, 4], [4, 1], [2, 4], [4, 2], [3, 3], [3, 4], [4, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 6\n assert candidate(dominoes = [[1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [1, 2], [2, 1], [1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5]]) == 27\n assert candidate(dominoes = [[1, 2], [2, 1], [3, 4], [4, 3], [5, 5], [5, 5], [6, 7], [7, 6], [8, 8], [8, 8]]) == 5\n assert candidate(dominoes = [[9, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1], [1, 2], [2, 1], [1, 3], [3, 1], [1, 4], [4, 1], [1, 5], [5, 1], [1, 6], [6, 1], [1, 7], [7, 1], [1, 8], [8, 1], [1, 9], [9, 1]]) == 8\n assert candidate(dominoes = [[1, 3], [3, 1], [1, 3], [3, 1], [1, 3], [3, 1], [1, 3], [3, 1]]) == 28\n assert candidate(dominoes = [[4, 5], [5, 4], [4, 6], [6, 4], [4, 7], [7, 4], [4, 8], [8, 4], [4, 9], [9, 4], [4, 1], [1, 4], [4, 2], [2, 4], [4, 3], [3, 4]]) == 8\n assert candidate(dominoes = [[1, 9], [9, 1], [1, 8], [8, 1], [1, 7], [7, 1], [1, 6], [6, 1], [1, 5], [5, 1], [1, 4], [4, 1], [1, 3], [3, 1], [1, 2], [2, 1], [1, 1], [1, 1]]) == 9\n assert candidate(dominoes = [[2, 3], [3, 2], [2, 4], [4, 2], [2, 5], [5, 2], [2, 6], [6, 2], [2, 7], [7, 2]]) == 5\n assert candidate(dominoes = [[1, 1], [1, 1], [1, 1], [1, 1], [2, 2], [2, 2], [2, 2], [2, 2], [3, 3], [3, 3], [3, 3], [3, 3], [4, 4], [4, 4], [4, 4], [4, 4], [5, 5], [5, 5], [5, 5], [5, 5], [6, 6], [6, 6], [6, 6], [6, 6], [7, 7], [7, 7], [7, 7], [7, 7], [8, 8], [8, 8], [8, 8], [8, 8], [9, 9], [9, 9], [9, 9], [9, 9]]) == 54\n assert candidate(dominoes = [[1, 2], [2, 1], [2, 1], [1, 2], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) == 16\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 3], [3, 1], [2, 3], [3, 2], [1, 4], [4, 1], [2, 4], [4, 2], [3, 3], [3, 4], [4, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [1, 2], [2, 1], [1, 3], [3, 1], [2, 3], [3, 2]]) == 21\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 2], [2, 1], [1, 2], [2, 1]]) == 15\n assert candidate(dominoes = [[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) == 45\n assert candidate(dominoes = [[1, 9], [9, 1], [2, 8], [8, 2], [3, 7], [7, 3], [4, 6], [6, 4], [5, 5], [1, 9], [9, 1], [2, 8], [8, 2], [3, 7], [7, 3], [4, 6], [6, 4], [5, 5]]) == 25\n assert candidate(dominoes = [[1, 9], [9, 1], [2, 8], [8, 2], [3, 7], [7, 3], [4, 6], [6, 4], [5, 5], [5, 5], [5, 5]]) == 7\n assert candidate(dominoes = [[7, 8], [8, 7], [5, 9], [9, 5], [7, 8], [8, 7], [5, 9], [9, 5], [1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7]]) == 24\n assert candidate(dominoes = [[1, 2], [2, 1], [3, 4], [4, 3], [1, 2], [2, 1], [3, 4], [4, 3], [1, 2], [2, 1], [3, 4], [4, 3]]) == 30\n assert candidate(dominoes = [[1, 1], [2, 2], [3, 3], [4, 4], [1, 1], [2, 2], [3, 3]]) == 3\n assert candidate(dominoes = [[1, 9], [9, 1], [1, 8], [8, 1], [1, 7], [7, 1], [1, 6], [6, 1], [1, 5], [5, 1]]) == 5\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 3], [3, 1], [1, 4], [4, 1], [1, 5], [5, 1], [1, 6], [6, 1]]) == 5\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 3], [3, 1], [2, 3], [3, 2], [1, 4], [4, 1], [2, 4], [4, 2], [3, 4], [4, 3]]) == 6\n assert candidate(dominoes = [[1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3], [4, 5], [5, 4], [5, 6], [6, 5], [6, 7], [7, 6], [7, 8], [8, 7], [8, 9], [9, 8], [1, 9], [9, 1], [2, 9], [9, 2], [3, 9], [9, 3], [4, 9], [9, 4], [5, 9], [9, 5], [6, 9], [9, 6], [7, 9], [9, 7]]) == 15\n assert candidate(dominoes = [[9, 1], [1, 9], [2, 3], [3, 2], [4, 5], [5, 4], [6, 7], [7, 6], [8, 9], [9, 8]]) == 5\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 1], [1, 1], [1, 2], [2, 1], [1, 1], [1, 2], [2, 1], [1, 1]]) == 21\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 3], [3, 1], [1, 4], [4, 1], [1, 5], [5, 1], [1, 6], [6, 1], [1, 7], [7, 1], [1, 8], [8, 1], [1, 9], [9, 1], [2, 3], [3, 2], [2, 4], [4, 2], [2, 5], [5, 2], [2, 6], [6, 2], [2, 7], [7, 2], [2, 8], [8, 2], [2, 9], [9, 2], [3, 4], [4, 3], [3, 5], [5, 3], [3, 6], [6, 3], [3, 7], [7, 3], [3, 8], [8, 3], [3, 9], [9, 3], [4, 5], [5, 4], [4, 6], [6, 4], [4, 7], [7, 4], [4, 8], [8, 4], [4, 9], [9, 4], [5, 6], [6, 5], [5, 7], [7, 5], [5, 8], [8, 5], [5, 9], [9, 5], [6, 7], [7, 6], [6, 8], [8, 6], [6, 9], [9, 6], [7, 8], [8, 7], [7, 9], [9, 7], [8, 9], [9, 8]]) == 36\n assert candidate(dominoes = [[1, 9], [9, 1], [2, 9], [9, 2], [3, 9], [9, 3], [4, 9], [9, 4], [5, 9], [9, 5], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 5\n assert candidate(dominoes = [[1, 9], [2, 8], [3, 7], [4, 6], [5, 5], [4, 6], [3, 7], [2, 8], [1, 9], [9, 1], [8, 2], [7, 3]]) == 10\n assert candidate(dominoes = [[1, 1], [2, 2], [1, 2], [2, 1], [3, 3], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]) == 9\n assert candidate(dominoes = [[1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7], [9, 9], [1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7], [9, 9]]) == 25\n assert candidate(dominoes = [[1, 1], [2, 2], [1, 2], [2, 1], [3, 3], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 8\n assert candidate(dominoes = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [1, 1]]) == 1\n assert candidate(dominoes = [[1, 2], [2, 1], [1, 2], [2, 1], [3, 4], [4, 3], [3, 4], [4, 3], [5, 6], [6, 5], [5, 6], [6, 5], [7, 8], [8, 7], [7, 8], [8, 7], [9, 9], [9, 9]]) == 25\n assert candidate(dominoes = [[1, 1], [2, 2], [1, 2], [2, 1], [3, 3], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [1, 1], [2, 2]]) == 4\n assert candidate(dominoes = [[1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [7, 8], [8, 7], [9, 1], [1, 9], [2, 3], [3, 2], [4, 5], [5, 4], [6, 7], [7, 6], [8, 9], [9, 8], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 9\n assert candidate(dominoes = [[1, 2], [2, 1], [3, 4], [4, 3], [1, 2], [2, 1], [3, 4], [4, 3], [5, 6], [6, 5], [5, 6], [6, 5]]) == 18\n assert candidate(dominoes = [[1, 1], [2, 2], [3, 3], [1, 2], [2, 1], [1, 3], [3, 1], [2, 3], [3, 2], [4, 4], [5, 5]]) == 3\n assert candidate(dominoes = [[1, 2], [2, 1], [2, 1], [1, 2], [1, 3], [3, 1], [2, 3], [3, 2], [3, 3], [3, 3]]) == 9\n assert candidate(dominoes = [[1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [2, 1]]) == 45\n"}, "metadata": {"canonical_parameter_names": ["dominoes"], "leetcode_dataset_entry_point": "Solution().numEquivDominoPairs", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numEquivDominoPairs = function(dominoes) {", "container": null, "callable": "numEquivDominoPairs", "parameters": [{"name": "dominoes", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1129, "task_id": "shortest-path-with-alternating-colors", "difficulty": "Medium", "problem_description": "You are given an integer n, the number of nodes in a directed graph where the nodes are labeled from 0 to n - 1. Each edge is red or blue in this graph, and there could be self-edges and parallel edges.\nYou are given two arrays redEdges and blueEdges where:\n\nredEdges[i] = [ai, bi] indicates that there is a directed red edge from node ai to node bi in the graph, and\nblueEdges[j] = [uj, vj] indicates that there is a directed blue edge from node uj to node vj in the graph.\n\nReturn an array answer of length n, where each answer[x] is the length of the shortest path from node 0 to node x such that the edge colors alternate along the path, or -1 if such a path does not exist.\n \nExample 1:\n\nInput: n = 3, redEdges = [[0,1],[1,2]], blueEdges = []\nOutput: [0,1,-1]\n\nExample 2:\n\nInput: n = 3, redEdges = [[0,1]], blueEdges = [[2,1]]\nOutput: [0,1,-1]\n\n \nConstraints:\n\n1 <= n <= 100\n0 <= redEdges.length, blueEdges.length <= 400\nredEdges[i].length == blueEdges[j].length == 2\n0 <= ai, bi, uj, vj < n\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 4,redEdges = [[0, 1], [1, 2]],blueEdges = [[1, 3]]) == [0, 1, -1, 2]\n assert candidate(n = 4,redEdges = [[0, 1], [0, 2], [0, 3]],blueEdges = [[1, 2], [1, 3], [2, 3]]) == [0, 1, 1, 1]\n assert candidate(n = 2,redEdges = [[0, 0], [0, 0]],blueEdges = [[0, 0], [0, 0]]) == [0, -1]\n assert candidate(n = 3,redEdges = [[0, 1]],blueEdges = [[2, 1]]) == [0, 1, -1]\n assert candidate(n = 4,redEdges = [[0, 1], [0, 2], [1, 3]],blueEdges = [[2, 3]]) == [0, 1, 1, 2]\n assert candidate(n = 2,redEdges = [[0, 1]],blueEdges = [[1, 0]]) == [0, 1]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4]],blueEdges = []) == [0, 1, -1, -1, -1]\n assert candidate(n = 3,redEdges = [],blueEdges = [[0, 1], [1, 2]]) == [0, 1, -1]\n assert candidate(n = 5,redEdges = [[0, 1], [0, 2], [1, 2], [1, 3], [3, 4], [2, 4]],blueEdges = [[1, 2], [2, 3]]) == [0, 1, 1, 2, 3]\n assert candidate(n = 3,redEdges = [[0, 1], [1, 0]],blueEdges = [[2, 1]]) == [0, 1, -1]\n assert candidate(n = 3,redEdges = [[0, 1], [1, 2]],blueEdges = [[1, 2]]) == [0, 1, 2]\n assert candidate(n = 4,redEdges = [[0, 1], [0, 2], [1, 2]],blueEdges = [[0, 3], [2, 3]]) == [0, 1, 1, 1]\n assert candidate(n = 4,redEdges = [[0, 1], [1, 2], [2, 3]],blueEdges = [[0, 2]]) == [0, 1, 1, 2]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4]],blueEdges = [[1, 2], [2, 3], [3, 4]]) == [0, 1, 2, 3, 4]\n assert candidate(n = 3,redEdges = [[0, 1], [1, 2], [2, 0]],blueEdges = [[0, 2]]) == [0, 1, 1]\n assert candidate(n = 2,redEdges = [[0, 0]],blueEdges = [[0, 0]]) == [0, -1]\n assert candidate(n = 2,redEdges = [[0, 0]],blueEdges = [[1, 1]]) == [0, -1]\n assert candidate(n = 5,redEdges = [],blueEdges = [[0, 1], [1, 2], [2, 3], [3, 4]]) == [0, 1, -1, -1, -1]\n assert candidate(n = 3,redEdges = [[0, 1], [1, 2]],blueEdges = []) == [0, 1, -1]\n assert candidate(n = 4,redEdges = [[0, 1], [2, 3]],blueEdges = [[1, 2], [3, 0]]) == [0, 1, 2, 3]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4]],blueEdges = [[0, 2], [1, 3], [2, 4]]) == [0, 1, 1, 2, 3]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 0], [1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3], [4, 5], [5, 4]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 5]]) == [0, 1, 1, 2, 3, 3]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 0]],blueEdges = [[1, 3], [3, 1], [2, 4]]) == [0, 1, -1, 2, 3]\n assert candidate(n = 10,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 0]]) == [0, 1, 1, 2, 3, 3, 4, 5, 5, 6]\n assert candidate(n = 9,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8]],blueEdges = [[0, 3], [1, 4], [2, 5], [3, 6], [4, 7], [5, 8]]) == [0, 1, -1, 1, 2, 3, -1, 3, 4]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]],blueEdges = [[0, 3], [1, 4], [2, 5]]) == [0, 1, -1, 1, 2, 3]\n assert candidate(n = 6,redEdges = [[0, 1], [0, 2], [1, 3], [2, 4], [3, 5]],blueEdges = [[1, 2], [2, 3], [3, 4], [4, 5]]) == [0, 1, 1, 2, 3, 3]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]],blueEdges = [[0, 5], [5, 4], [4, 3], [3, 2], [2, 1], [1, 0]]) == [0, 1, -1, -1, -1, 1]\n assert candidate(n = 10,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],blueEdges = [[1, 3], [2, 4], [5, 7], [6, 8]]) == [0, 1, -1, 2, 3, -1, -1, -1, -1, -1]\n assert candidate(n = 8,redEdges = [[0, 1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7]],blueEdges = [[0, 3], [1, 4], [2, 5], [3, 6], [4, 7]]) == [0, 1, 1, 1, 2, 2, 3, 3]\n assert candidate(n = 5,redEdges = [[0, 1], [0, 2], [1, 3], [2, 4]],blueEdges = [[0, 3], [1, 2], [1, 4], [2, 3]]) == [0, 1, 1, 1, 2]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 0]]) == [0, 1, 1, 2, 3]\n assert candidate(n = 10,redEdges = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]],blueEdges = [[0, 9], [1, 8], [2, 7], [3, 6], [4, 5]]) == [0, 1, -1, -1, -1, -1, -1, -1, 2, 1]\n assert candidate(n = 10,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],blueEdges = [[9, 8], [8, 7], [7, 6], [6, 5], [5, 4], [4, 3], [3, 2], [2, 1], [1, 0]]) == [0, 1, -1, -1, -1, -1, -1, -1, -1, -1]\n assert candidate(n = 7,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],blueEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]]) == [0, 1, 2, 3, 4, 5, 6]\n assert candidate(n = 8,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0], [0, 4], [2, 6]],blueEdges = [[0, 2], [1, 3], [3, 5], [5, 7], [7, 1], [4, 6]]) == [0, 1, 1, 2, 1, 3, 2, 3]\n assert candidate(n = 7,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],blueEdges = [[6, 5], [5, 4], [4, 3], [3, 2], [2, 1], [1, 0]]) == [0, 1, -1, -1, -1, -1, -1]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 0], [1, 2], [2, 3], [3, 4], [4, 5]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 5], [4, 1]]) == [0, 1, 1, 2, 3, 3]\n assert candidate(n = 8,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]],blueEdges = [[7, 6], [6, 5], [5, 4], [4, 3], [3, 2], [2, 1], [1, 0]]) == [0, 1, -1, -1, -1, -1, -1, -1]\n assert candidate(n = 8,redEdges = [[0, 1], [1, 2], [2, 3], [3, 0]],blueEdges = [[1, 3], [3, 5], [5, 7], [7, 1], [0, 2], [2, 4], [4, 6], [6, 0]]) == [0, 1, 1, 2, -1, 3, -1, -1]\n assert candidate(n = 10,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],blueEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(n = 5,redEdges = [[0, 1], [0, 4], [1, 2], [2, 3], [3, 4]],blueEdges = [[0, 2], [1, 3], [2, 0], [3, 1], [4, 2]]) == [0, 1, 1, 2, 1]\n assert candidate(n = 15,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14]]) == [0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9]\n assert candidate(n = 7,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],blueEdges = [[1, 3], [3, 5], [5, 1], [2, 4], [4, 6], [6, 2]]) == [0, 1, -1, 2, 3, -1, 4]\n assert candidate(n = 6,redEdges = [[0, 1], [0, 2], [1, 3], [2, 4], [3, 5]],blueEdges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 0]]) == [0, 1, 1, 2, 3, 3]\n assert candidate(n = 15,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 0]],blueEdges = [[0, 7], [1, 8], [2, 9], [3, 10], [4, 11], [5, 12], [6, 13], [7, 14], [8, 0], [9, 1], [10, 2], [11, 3], [12, 4], [13, 5], [14, 6]]) == [0, 1, 5, 9, 13, 17, 21, 1, 2, 3, 7, 11, 15, 19, 23]\n assert candidate(n = 5,redEdges = [[0, 1], [0, 2], [1, 2], [1, 3], [2, 3], [3, 4]],blueEdges = [[0, 1], [1, 2], [2, 3], [3, 4]]) == [0, 1, 1, 2, 3]\n assert candidate(n = 12,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 0]],blueEdges = [[0, 6], [1, 7], [2, 8], [3, 9], [4, 10], [5, 11], [6, 0], [7, 1], [8, 2], [9, 3], [10, 4], [11, 5]]) == [0, 1, 4, 5, 8, 9, 1, 2, 3, 6, 7, 10]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]],blueEdges = [[5, 0], [0, 5], [1, 4], [4, 1], [2, 5], [5, 2]]) == [0, 1, 4, 5, 2, 1]\n assert candidate(n = 10,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],blueEdges = [[0, 4], [1, 5], [2, 6], [3, 7], [4, 8], [5, 9]]) == [0, 1, -1, -1, 1, 2, 3, -1, -1, 3]\n assert candidate(n = 10,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9]]) == [0, 1, 1, 2, 3, 3, 4, 5, 5, 6]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4]],blueEdges = [[4, 0], [3, 1], [2, 2], [1, 3], [0, 4]]) == [0, 1, -1, 2, 1]\n assert candidate(n = 7,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 0]],blueEdges = [[0, 3], [1, 4], [2, 5], [3, 6], [4, 1], [5, 2], [6, 4]]) == [0, 1, 4, 1, 2, 3, 6]\n assert candidate(n = 7,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],blueEdges = [[0, 3], [1, 4], [2, 5], [3, 6]]) == [0, 1, -1, 1, 2, 3, -1]\n assert candidate(n = 9,redEdges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 5], [4, 6]],blueEdges = [[5, 7], [5, 8], [6, 7], [6, 8], [7, 0], [7, 1], [8, 0], [8, 2], [0, 3], [0, 4]]) == [0, 1, 1, 1, 1, 2, 2, 2, 2]\n assert candidate(n = 10,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],blueEdges = [[9, 0], [0, 9], [1, 8], [8, 1], [2, 7], [7, 2], [3, 6], [6, 3], [4, 5], [5, 4]]) == [0, 1, -1, -1, -1, -1, -1, -1, 2, 1]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 2], [2, 3], [3, 0]],blueEdges = [[1, 3], [3, 4], [4, 5], [5, 1]]) == [0, 1, -1, 2, -1, -1]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 2], [2, 0], [3, 4], [4, 5]],blueEdges = [[0, 2], [2, 3], [3, 0], [4, 1], [5, 0]]) == [0, 1, 1, -1, -1, -1]\n assert candidate(n = 7,redEdges = [[0, 1], [2, 3], [4, 5], [5, 6]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 5], [4, 6]]) == [0, 1, 1, 2, -1, 3, 4]\n assert candidate(n = 8,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]],blueEdges = [[0, 7], [1, 6], [2, 5], [3, 4], [5, 3], [6, 2], [7, 1]]) == [0, 1, 5, 9, 10, 6, 2, 1]\n assert candidate(n = 8,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]],blueEdges = [[7, 0], [0, 7], [1, 6], [6, 1], [2, 5], [5, 2], [3, 4], [4, 3]]) == [0, 1, -1, -1, -1, -1, 2, 1]\n assert candidate(n = 7,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],blueEdges = [[0, 3], [2, 5]]) == [0, 1, -1, 1, 2, -1, -1]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]],blueEdges = [[5, 4], [4, 3], [3, 2], [2, 1], [1, 0]]) == [0, 1, -1, -1, -1, -1]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0], [0, 3]],blueEdges = [[0, 2], [2, 4], [4, 1], [1, 5]]) == [0, 1, 1, 1, -1, 2]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4]],blueEdges = [[0, 2], [2, 4]]) == [0, 1, 1, 2, -1]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]],blueEdges = [[1, 3], [3, 5]]) == [0, 1, -1, 2, 3, -1]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 5]]) == [0, 1, 1, 2, 3, 3]\n assert candidate(n = 10,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0]],blueEdges = [[0, 5], [1, 6], [2, 7], [3, 8], [4, 9]]) == [0, 1, -1, -1, -1, 1, 2, 3, -1, -1]\n assert candidate(n = 8,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]],blueEdges = [[1, 3], [2, 4], [5, 7]]) == [0, 1, -1, 2, 3, -1, -1, -1]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 0]],blueEdges = [[1, 3], [3, 2], [2, 0], [0, 1]]) == [0, 1, 2, 2, -1]\n assert candidate(n = 7,redEdges = [[0, 1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 0], [6, 1]],blueEdges = [[0, 3], [1, 4], [2, 5], [3, 6], [4, 0], [5, 1], [6, 2]]) == [0, 1, 1, 1, 2, 2, 3]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4]],blueEdges = [[1, 3], [2, 4]]) == [0, 1, -1, 2, 3]\n assert candidate(n = 10,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0], [0, 5], [2, 7], [3, 8], [4, 9]],blueEdges = [[0, 3], [1, 4], [2, 5], [3, 6], [4, 7], [5, 8], [6, 9], [7, 0], [8, 1], [9, 2]]) == [0, 1, 4, 1, 2, 1, 6, 3, 2, 3]\n assert candidate(n = 10,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]],blueEdges = [[0, 5], [1, 6], [2, 7], [3, 8], [4, 9]]) == [0, 1, -1, -1, -1, 1, 2, 3, -1, -1]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 0]],blueEdges = [[0, 2], [2, 4], [4, 1], [1, 3], [3, 0]]) == [0, 1, 1, 2, 3]\n assert candidate(n = 7,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],blueEdges = [[6, 0], [0, 6], [1, 5], [5, 1], [2, 4], [4, 2], [3, 6], [6, 3]]) == [0, 1, 6, 4, 5, 2, 1]\n assert candidate(n = 8,redEdges = [[0, 1], [0, 2], [1, 3], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]],blueEdges = [[1, 2], [2, 4], [3, 5], [4, 6], [5, 7], [6, 0], [7, 1], [0, 3]]) == [0, 1, 1, 1, 2, 3, 3, 4]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 0], [0, 4]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 1], [4, 3]]) == [0, 1, 1, 2, 1]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 0], [3, 4]],blueEdges = [[0, 2], [2, 3], [3, 0], [4, 1]]) == [0, 1, 1, -1, -1]\n assert candidate(n = 9,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8]]) == [0, 1, 1, 2, 3, 3, 4, 5, 5]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]],blueEdges = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 1]]) == [0, 1, 2, 3, 4, 5]\n assert candidate(n = 9,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 0], [1, 5], [2, 6], [3, 7]],blueEdges = [[0, 3], [1, 4], [2, 5], [3, 6], [4, 7], [5, 8], [6, 1], [7, 2], [8, 4]]) == [0, 1, 3, 1, 2, 3, 4, 2, 4]\n assert candidate(n = 9,redEdges = [[0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [5, 6], [6, 7], [7, 8]],blueEdges = [[8, 4], [4, 0], [0, 2], [2, 4], [5, 1], [1, 3], [3, 5], [7, 6]]) == [0, 1, 1, 2, -1, 3, 4, -1, -1]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 0]],blueEdges = [[1, 3], [3, 1], [2, 4], [4, 2]]) == [0, 1, 4, 2, 3]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 0], [1, 2], [2, 3], [3, 4]],blueEdges = [[0, 2], [1, 3], [2, 0], [3, 1], [4, 0]]) == [0, 1, 1, 2, 3]\n assert candidate(n = 9,redEdges = [[0, 1], [0, 3], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8]],blueEdges = [[0, 4], [1, 5], [2, 6], [3, 7], [4, 8]]) == [0, 1, -1, 1, 1, 2, 3, 2, 3]\n assert candidate(n = 8,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 0]]) == [0, 1, 1, 2, 3, 3, 4, 5]\n assert candidate(n = 10,redEdges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9]],blueEdges = [[0, 2], [0, 3], [1, 4], [1, 5], [2, 6], [2, 7], [3, 8], [4, 9]]) == [0, 1, 1, 1, 2, 2, 2, 2, 2, 3]\n assert candidate(n = 7,redEdges = [[0, 1], [0, 3], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 5], [4, 6]]) == [0, 1, 1, 1, 3, 2, 3]\n assert candidate(n = 10,redEdges = [[0, 2], [2, 4], [4, 6], [6, 8]],blueEdges = [[1, 3], [3, 5], [5, 7], [7, 9]]) == [0, -1, 1, -1, -1, -1, -1, -1, -1, -1]\n assert candidate(n = 7,redEdges = [[0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [5, 6], [6, 4]],blueEdges = [[0, 3], [1, 4], [2, 5], [3, 6], [4, 0], [5, 1], [6, 2]]) == [0, 1, 5, 1, 2, 3, 7]\n assert candidate(n = 8,redEdges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [4, 7]],blueEdges = [[0, 3], [0, 4], [1, 5], [1, 6], [2, 7]]) == [0, 1, 1, 1, 1, 2, 2, 2]\n assert candidate(n = 6,redEdges = [[0, 1], [1, 2], [2, 0], [2, 3], [3, 4], [4, 5]],blueEdges = [[1, 3], [2, 4], [3, 5], [4, 0], [5, 1], [5, 2]]) == [0, 1, -1, 2, 3, -1]\n assert candidate(n = 8,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]],blueEdges = [[0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7]]) == [0, 1, 1, 2, 3, 3, 4, 5]\n assert candidate(n = 7,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],blueEdges = [[0, 3], [1, 4], [2, 5]]) == [0, 1, -1, 1, 2, 3, -1]\n assert candidate(n = 7,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],blueEdges = [[1, 3], [2, 4], [3, 5], [4, 6]]) == [0, 1, -1, 2, 3, -1, 4]\n assert candidate(n = 5,redEdges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 0]],blueEdges = [[1, 2], [2, 3], [3, 4], [4, 0], [0, 1]]) == [0, 1, 2, 3, 4]\n"}, "metadata": {"canonical_parameter_names": ["n", "redEdges", "blueEdges"], "leetcode_dataset_entry_point": "Solution().shortestAlternatingPaths", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shortestAlternatingPaths = function(n, redEdges, blueEdges) {", "container": null, "callable": "shortestAlternatingPaths", "parameters": [{"name": "n", "type": "number"}, {"name": "redEdges", "type": "number[][]"}, {"name": "blueEdges", "type": "number[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1130, "task_id": "minimum-cost-tree-from-leaf-values", "difficulty": "Medium", "problem_description": "Given an array arr of positive integers, consider all binary trees such that:\n\nEach node has either 0 or 2 children;\nThe values of arr correspond to the values of each leaf in an in-order traversal of the tree.\nThe value of each non-leaf node is equal to the product of the largest leaf value in its left and right subtree, respectively.\n\nAmong all possible binary trees considered, return the smallest possible sum of the values of each non-leaf node. It is guaranteed this sum fits into a 32-bit integer.\nA node is a leaf if and only if it has zero children.\n \nExample 1:\n\n\nInput: arr = [6,2,4]\nOutput: 32\nExplanation: There are two possible trees shown.\nThe first has a non-leaf node sum 36, and the second has non-leaf node sum 32.\n\nExample 2:\n\n\nInput: arr = [4,11]\nOutput: 44\n\n \nConstraints:\n\n2 <= arr.length <= 40\n1 <= arr[i] <= 15\nIt is guaranteed that the answer fits into a 32-bit signed integer (i.e., it is less than 231).\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 2, 3, 4]) == 20\n assert candidate(arr = [3, 2, 1]) == 8\n assert candidate(arr = [15, 13, 5, 3, 15]) == 500\n assert candidate(arr = [4, 11]) == 44\n assert candidate(arr = [7, 12, 8, 10]) == 284\n assert candidate(arr = [3, 5, 6, 2, 5]) == 85\n assert candidate(arr = [7, 10, 2, 8, 1]) == 174\n assert candidate(arr = [8, 12, 15, 2, 5, 7]) == 426\n assert candidate(arr = [1, 2, 3, 4, 5]) == 40\n assert candidate(arr = [6, 2, 4]) == 32\n assert candidate(arr = [3, 5, 1, 2, 4]) == 45\n assert candidate(arr = [15, 13, 5, 3, 16, 17, 18]) == 1093\n assert candidate(arr = [2, 3, 1, 4]) == 21\n assert candidate(arr = [3, 5, 2, 1, 4]) == 45\n assert candidate(arr = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1120\n assert candidate(arr = [5, 4, 7, 2, 11, 6]) == 212\n assert candidate(arr = [15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == 1120\n assert candidate(arr = [5, 7, 8, 6, 2, 3]) == 163\n assert candidate(arr = [5, 4, 3, 2, 1, 6, 7]) == 112\n assert candidate(arr = [5, 2, 3, 1, 4, 6, 7]) == 113\n assert candidate(arr = [8, 7, 6, 5, 4, 3, 2, 1]) == 168\n assert candidate(arr = [13, 15, 7, 9, 8, 11, 14, 12, 5, 6, 2, 3, 1, 4, 10]) == 1216\n assert candidate(arr = [13, 7, 11, 10, 15, 2, 1, 12, 8, 6, 5, 9, 3, 4]) == 1037\n assert candidate(arr = [5, 10, 9, 2, 3, 15, 12, 8]) == 599\n assert candidate(arr = [7, 1, 9, 8, 4, 2, 5]) == 210\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 11, 12, 13, 14, 15]) == 1120\n assert candidate(arr = [15, 9, 5, 6, 11, 8, 12, 13, 14, 7, 10, 4, 3, 2, 1]) == 1221\n assert candidate(arr = [12, 4, 6, 1, 5, 9, 7]) == 284\n assert candidate(arr = [11, 13, 10, 9, 2, 15, 5, 12, 7, 14]) == 1098\n assert candidate(arr = [2, 3, 5, 7, 11, 13, 17, 19]) == 820\n assert candidate(arr = [10, 12, 7, 5, 4, 1, 6]) == 300\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40]) == 4200\n assert candidate(arr = [5, 3, 2, 7, 9, 10, 8]) == 289\n assert candidate(arr = [13, 5, 1, 12, 8, 9]) == 401\n assert candidate(arr = [7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 11, 12, 13, 14, 15]) == 1134\n assert candidate(arr = [2, 1, 3, 4, 5, 6, 7]) == 112\n assert candidate(arr = [10, 5, 15, 3, 8, 7]) == 400\n assert candidate(arr = [10, 1, 14, 7, 13, 3, 5, 2, 8, 6, 4, 9, 11, 12]) == 1019\n assert candidate(arr = [8, 3, 9, 6, 1, 10, 2]) == 266\n assert candidate(arr = [7, 11, 14, 13, 5, 15, 10]) == 838\n assert candidate(arr = [13, 7, 12, 1, 8, 5, 9, 4]) == 504\n assert candidate(arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9]) == 301\n assert candidate(arr = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2668\n assert candidate(arr = [8, 5, 1, 9, 2, 4, 3, 10, 6, 7, 11, 12, 14, 13, 15]) == 1177\n assert candidate(arr = [3, 15, 2, 8, 9, 11, 5, 10, 7, 6, 12, 4]) == 864\n assert candidate(arr = [10, 5, 15, 20, 12]) == 740\n assert candidate(arr = [1, 3, 2, 6, 8, 5, 4, 7, 9, 10]) == 348\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80]) == 16800\n assert candidate(arr = [2, 15, 8, 3, 10, 6, 7, 4, 11, 1, 9, 5, 12, 14, 13]) == 1229\n assert candidate(arr = [13, 15, 1, 5, 3]) == 290\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 4046\n assert candidate(arr = [3, 4, 5, 2, 6, 7, 8, 1]) == 178\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 33000\n assert candidate(arr = [15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 480\n assert candidate(arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]) == 220\n assert candidate(arr = [9, 7, 5, 3, 1, 2, 4, 6, 8, 10]) == 330\n assert candidate(arr = [10, 2, 5, 1, 3]) == 78\n assert candidate(arr = [11, 6, 5, 9, 3, 8, 2, 4, 7]) == 371\n assert candidate(arr = [14, 10, 1, 2, 15, 12, 8]) == 648\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 1120\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 1120\n assert candidate(arr = [12, 7, 11, 14, 10, 13, 6]) == 767\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 19\n assert candidate(arr = [5, 1, 3, 2, 10, 7, 4]) == 172\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 30\n assert candidate(arr = [5, 3, 8, 6, 2, 4, 1, 9]) == 211\n assert candidate(arr = [7, 14, 4, 14, 13, 2, 6, 13]) == 791\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 330\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90]) == 24000\n assert candidate(arr = [5, 3, 8, 1, 4, 7]) == 143\n assert candidate(arr = [13, 12, 8, 14, 15, 16, 17, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11]) == 1718\n assert candidate(arr = [6, 9, 4, 10, 5, 8, 7, 3, 11, 1, 12, 2, 13, 14, 15]) == 1202\n assert candidate(arr = [1, 15, 2, 14, 3, 13, 4, 12, 5, 11, 6, 10, 7, 9, 8]) == 1260\n assert candidate(arr = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 1320\n assert candidate(arr = [13, 15, 1, 7, 2]) == 321\n assert candidate(arr = [8, 3, 1, 14, 10, 6, 7, 2, 13, 9, 5, 4, 11, 12]) == 1029\n assert candidate(arr = [1, 15, 2, 14, 3, 13, 4, 12, 5, 11, 6, 10, 7, 9]) == 1188\n assert candidate(arr = [12, 15, 8, 3, 10, 6]) == 494\n assert candidate(arr = [15, 13, 11, 9, 7, 5, 3, 1]) == 553\n assert candidate(arr = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1120\n assert candidate(arr = [15, 10, 2, 3, 5, 1, 8, 6, 14, 7]) == 642\n assert candidate(arr = [15, 8, 3, 10, 6, 7, 4, 11, 1, 9, 2, 12, 5, 14, 13]) == 1232\n assert candidate(arr = [3, 5, 1, 9, 2, 4, 8, 10, 6, 7, 11, 12, 14, 13, 15]) == 1181\n assert candidate(arr = [2, 9, 3, 5, 6, 4]) == 141\n assert candidate(arr = [8, 5, 3, 2, 4, 6, 7]) == 166\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15]) == 553\n assert candidate(arr = [10, 6, 8, 3, 4, 12, 5, 14]) == 520\n assert candidate(arr = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2548\n assert candidate(arr = [1, 5, 2, 3, 6, 4, 7]) == 122\n assert candidate(arr = [8, 5, 9, 3, 6]) == 184\n assert candidate(arr = [7, 4, 9, 2, 5, 1, 8]) == 218\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 800\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 240\n assert candidate(arr = [8, 6, 10, 5, 12, 9, 7, 3, 11, 1, 4]) == 661\n assert candidate(arr = [12, 7, 4, 9, 2, 8, 5, 3]) == 342\n assert candidate(arr = [10, 15, 1, 2, 18, 9, 6]) == 668\n assert candidate(arr = [7, 6, 8, 2, 10, 5, 1, 3, 9, 4]) == 383\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 1360\n assert candidate(arr = [6, 9, 3, 7, 5, 1, 4]) == 197\n assert candidate(arr = [6, 5, 8, 10, 3, 9, 1, 14, 13, 2, 4, 7, 11, 12, 15]) == 1217\n assert candidate(arr = [4, 7, 10, 2, 13, 15, 5, 3, 8, 6, 9, 1, 14, 12, 11]) == 1263\n assert candidate(arr = [8, 9, 3, 8, 15, 2]) == 333\n assert candidate(arr = [1, 100, 1, 100, 1, 100]) == 20300\n assert candidate(arr = [11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 3831\n assert candidate(arr = [8, 3, 6, 1, 4, 7, 10, 2, 9, 5]) == 377\n assert candidate(arr = [8, 9, 10, 7, 6, 5, 4, 3, 2, 1]) == 344\n assert candidate(arr = [5, 3, 8, 6, 2, 4, 7, 1, 10, 9]) == 362\n assert candidate(arr = [7, 8, 6, 5, 4, 3, 2, 1]) == 174\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().mctFromLeafValues", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var mctFromLeafValues = function(arr) {", "container": null, "callable": "mctFromLeafValues", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1131, "task_id": "maximum-of-absolute-value-expression", "difficulty": "Medium", "problem_description": "Given two arrays of integers with equal lengths, return the maximum value of:\\r\n\\r\n|arr1[i] - arr1[j]| + |arr2[i] - arr2[j]| + |i - j|\\r\n\\r\nwhere the maximum is taken over all 0 <= i, j < arr1.length.\\r\n\n \nExample 1:\n\nInput: arr1 = [1,2,3,4], arr2 = [-1,4,5,6]\nOutput: 13\n\nExample 2:\n\nInput: arr1 = [1,-2,-5,0,10], arr2 = [0,-2,-1,-7,-4]\nOutput: 20\n\n \nConstraints:\n\n2 <= arr1.length == arr2.length <= 40000\n-10^6 <= arr1[i], arr2[i] <= 10^6\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr1 = [1, -2, -5, 0, 10],arr2 = [0, -2, -1, -7, -4]) == 20\n assert candidate(arr1 = [1, 3, 5, 7],arr2 = [2, 4, 6, 8]) == 15\n assert candidate(arr1 = [-1, -2, -3, -4, -5],arr2 = [1, 2, 3, 4, 5]) == 12\n assert candidate(arr1 = [1, 3, 5, 7, 9],arr2 = [9, 7, 5, 3, 1]) == 20\n assert candidate(arr1 = [0, 0, 0, 0, 0, 0],arr2 = [0, 0, 0, 0, 0, 0]) == 5\n assert candidate(arr1 = [-1000000, 1000000],arr2 = [1000000, -1000000]) == 4000001\n assert candidate(arr1 = [0, 0, 0, 0],arr2 = [0, 0, 0, 0]) == 3\n assert candidate(arr1 = [1, 2, 3, 4],arr2 = [-1, 4, 5, 6]) == 13\n assert candidate(arr1 = [1000000, -1000000],arr2 = [-1000000, 1000000]) == 4000001\n assert candidate(arr1 = [5, 5, 5, 5],arr2 = [5, 5, 5, 5]) == 3\n assert candidate(arr1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 918\n assert candidate(arr1 = [-1000000, -900000, -800000, -700000, -600000, -500000, -400000, -300000, -200000, -100000],arr2 = [-100000, -200000, -300000, -400000, -500000, -600000, -700000, -800000, -900000, -1000000]) == 1800009\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 38\n assert candidate(arr1 = [1, -2, 3, -4, 5],arr2 = [-5, 4, -3, 2, -1]) == 15\n assert candidate(arr1 = [0, -1, 1, -2, 2, -3, 3, -4, 4, -5],arr2 = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4]) == 23\n assert candidate(arr1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],arr2 = [19, 17, 15, 13, 11, 9, 7, 5, 3, 1]) == 45\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 27\n assert candidate(arr1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 108\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],arr2 = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 57\n assert candidate(arr1 = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],arr2 = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == 11\n assert candidate(arr1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],arr2 = [-10, -20, -30, -40, -50, -60, -70, -80, -90, -100]) == 189\n assert candidate(arr1 = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],arr2 = [10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000]) == 18009\n assert candidate(arr1 = [-100, 100, -200, 200, -300, 300, -400, 400, -500, 500],arr2 = [-1000, 1000, -900, 900, -800, 800, -700, 700, -600, 600]) == 2209\n assert candidate(arr1 = [-1, 1, -2, 2, -3, 3],arr2 = [-3, 3, -2, 2, -1, 1]) == 13\n assert candidate(arr1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 30\n assert candidate(arr1 = [123456, -234567, 345678, -456789, 567890],arr2 = [567890, -456789, 345678, -234567, 123456]) == 1382713\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 18\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 27\n assert candidate(arr1 = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],arr2 = [-512, -256, -128, -64, -32, -16, -8, -4, -2, -1]) == 1031\n assert candidate(arr1 = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5],arr2 = [1000, -1000, 900, -900, 800, -800, 700, -700, 600, -600]) == 2003\n assert candidate(arr1 = [1000000, 999999, 999998, 999997, 999996],arr2 = [0, 1, 2, 3, 4]) == 12\n assert candidate(arr1 = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5],arr2 = [5, -5, 4, -4, 3, -3, 2, -2, 1, -1]) == 21\n assert candidate(arr1 = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10],arr2 = [-10, 9, -8, 7, -6, 5, -4, 3, -2, 1]) == 31\n assert candidate(arr1 = [-100000, 100000, -50000, 50000, -25000, 25000],arr2 = [25000, -25000, 50000, -50000, 100000, -100000]) == 250005\n assert candidate(arr1 = [1000000, 0, -1000000, 500000, -500000],arr2 = [-1000000, 1000000, 0, -500000, 500000]) == 3000004\n assert candidate(arr1 = [1000000, -1000000, 500000, -500000],arr2 = [-1000000, 1000000, -500000, 500000]) == 4000001\n assert candidate(arr1 = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],arr2 = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20]) == 23\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],arr2 = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 42\n assert candidate(arr1 = [5, 6, 8, 10, 15, 20, 30, 40, 50, 60],arr2 = [60, 50, 40, 30, 20, 15, 10, 8, 6, 5]) == 119\n assert candidate(arr1 = [1000000, 999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991],arr2 = [999991, 999992, 999993, 999994, 999995, 999996, 999997, 999998, 999999, 1000000]) == 27\n assert candidate(arr1 = [-1000000, 0, 1000000, -500000, 500000],arr2 = [500000, -500000, 0, 1000000, -1000000]) == 3000004\n assert candidate(arr1 = [500000, 400000, 300000, 200000, 100000, 0, -100000, -200000, -300000, -400000],arr2 = [-500000, -400000, -300000, -200000, -100000, 0, 100000, 200000, 300000, 400000]) == 1800009\n assert candidate(arr1 = [1, -1, 2, -2, 3, -3],arr2 = [1, 2, 3, -1, -2, -3]) == 14\n assert candidate(arr1 = [1000000, 999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991],arr2 = [-1000000, -999999, -999998, -999997, -999996, -999995, -999994, -999993, -999992, -999991]) == 27\n assert candidate(arr1 = [10, -10, 20, -20, 30, -30],arr2 = [-30, 30, -20, 20, -10, 10]) == 85\n assert candidate(arr1 = [10000, -10000, 20000, -20000, 30000, -30000],arr2 = [-30000, 30000, -20000, 20000, -10000, 10000]) == 80005\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [-1, 0, 1, -1, 0, 1, -1, 0, 1, -1]) == 10\n assert candidate(arr1 = [1000000, -1000000, 1000000, -1000000, 1000000, -1000000, 1000000, -1000000, 1000000, -1000000],arr2 = [-1000000, 1000000, -1000000, 1000000, -1000000, 1000000, -1000000, 1000000, -1000000, 1000000]) == 4000009\n assert candidate(arr1 = [1000000, 500000, -500000, -1000000],arr2 = [-1000000, 500000, 1000000, -500000]) == 3500002\n assert candidate(arr1 = [0, 0, 0, 0, 0],arr2 = [-1, 1, -1, 1, -1]) == 5\n assert candidate(arr1 = [100, 200, 300, 400, 500],arr2 = [-100, -200, -300, -400, -500]) == 804\n assert candidate(arr1 = [1000000, -1000000, 500000, -500000],arr2 = [-500000, 500000, -1000000, 1000000]) == 3000003\n assert candidate(arr1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],arr2 = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100]) == 1809\n assert candidate(arr1 = [100, 200, 300, 400, 500],arr2 = [900, 800, 700, 600, 500]) == 804\n assert candidate(arr1 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],arr2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 27\n assert candidate(arr1 = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 27\n assert candidate(arr1 = [-1, 0, 1, -2, 2, -3, 3, -4, 4, -5, 5],arr2 = [5, -5, 4, -4, 3, -3, 2, -2, 1, -1, 0]) == 21\n assert candidate(arr1 = [42, 17, 9, 23, 5, 6, 8],arr2 = [3, 8, 1, 4, 7, 2, 9]) == 46\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]) == 9\n assert candidate(arr1 = [10, 20, 30, 40, 50],arr2 = [-10, -20, -30, -40, -50]) == 84\n assert candidate(arr1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],arr2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 18\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 108\n assert candidate(arr1 = [1000000, 500000, 0, -500000, -1000000],arr2 = [-1000000, -500000, 0, 500000, 1000000]) == 4000004\n assert candidate(arr1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],arr2 = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 189\n assert candidate(arr1 = [1, -100, 100, 0, 50, -50, 25, -25, 75, -75],arr2 = [100, 1, -1, 50, -50, 100, -100, 0, 75, -75]) == 301\n assert candidate(arr1 = [-1000000, 0, 1000000, -1000000, 0, 1000000],arr2 = [0, 1000000, -1000000, 0, 1000000, -1000000]) == 3000005\n assert candidate(arr1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],arr2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 9\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]) == 19\n assert candidate(arr1 = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],arr2 = [0, 0, 1, 1, 0, 0, 1, 1, 0, 0]) == 10\n assert candidate(arr1 = [1000000, -1000000, 1000000, -1000000, 1000000],arr2 = [-1000000, 1000000, -1000000, 1000000, -1000000]) == 4000003\n assert candidate(arr1 = [-10, -20, -30, -40, -50, -60, -70, -80, -90, -100],arr2 = [-100, -90, -80, -70, -60, -50, -40, -30, -20, -10]) == 189\n assert candidate(arr1 = [1, 10, 100, 1000, 10000, 100000, 1000000, -1, -10, -100],arr2 = [1000000, 100000, 10000, 1000, 100, 10, 1, -1000000, -100000, -10000]) == 2000009\n assert candidate(arr1 = [-1000000, -500000, 0, 500000, 1000000],arr2 = [1000000, 500000, 0, -500000, -1000000]) == 4000004\n assert candidate(arr1 = [123456, -123456, 234567, -234567, 345678, -345678],arr2 = [-345678, 345678, -234567, 234567, -123456, 123456]) == 938273\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1]) == 27\n assert candidate(arr1 = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5],arr2 = [-5, 5, -4, 4, -3, 3, -2, 2, -1, 1]) == 21\n assert candidate(arr1 = [123456, -123456, 654321, -654321, 234567, -234567],arr2 = [234567, -234567, 123456, -123456, 654321, -654321]) == 1777777\n assert candidate(arr1 = [-1, 0, 1, -2, 2, -3, 3],arr2 = [3, -3, 2, -2, 1, -1, 0]) == 13\n assert candidate(arr1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],arr2 = [1000000, 500000, 0, -500000, -1000000, -1500000, -2000000, -2500000, -3000000, -3500000]) == 4500009\n assert candidate(arr1 = [0, 1, 0, 1, 0, 1, 0],arr2 = [1, 0, 1, 0, 1, 0, 1]) == 7\n assert candidate(arr1 = [1000000, -1000000, 1000000, -1000000, 1000000],arr2 = [0, 1000000, 0, 1000000, 0]) == 3000003\n assert candidate(arr1 = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000],arr2 = [8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000]) == 14007\n assert candidate(arr1 = [1000000, 500000, -500000, -1000000, 0],arr2 = [0, 1000000, -1000000, 500000, -500000]) == 3000001\n assert candidate(arr1 = [0, 1, -1, 2, -2, 3, -3, 4, -4, 5],arr2 = [5, 4, 3, 2, 1, 0, -1, -2, -3, -4]) == 23\n assert candidate(arr1 = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1],arr2 = [-1, 1, -1, 1, -1, 1, -1, 1, -1, 1]) == 13\n assert candidate(arr1 = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],arr2 = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1]) == 30\n assert candidate(arr1 = [-1000000, 1000000, -1000000, 1000000, -1000000, 1000000],arr2 = [1000000, -1000000, 1000000, -1000000, 1000000, -1000000]) == 4000005\n assert candidate(arr1 = [10, 20, 30, 40, 50],arr2 = [50, 40, 30, 20, 10]) == 84\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],arr2 = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20]) == 57\n assert candidate(arr1 = [100000, 200000, 300000, 400000, 500000],arr2 = [500000, 400000, 300000, 200000, 100000]) == 800004\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [-5, -4, -3, -2, -1]) == 12\n assert candidate(arr1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 18\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 18\n assert candidate(arr1 = [1, 1, 1, 1, 1],arr2 = [-1, -1, -1, -1, -1]) == 4\n"}, "metadata": {"canonical_parameter_names": ["arr1", "arr2"], "leetcode_dataset_entry_point": "Solution().maxAbsValExpr", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxAbsValExpr = function(arr1, arr2) {", "container": null, "callable": "maxAbsValExpr", "parameters": [{"name": "arr1", "type": "number[]"}, {"name": "arr2", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1137, "task_id": "n-th-tribonacci-number", "difficulty": "Easy", "problem_description": "The Tribonacci sequence Tn is defined as follows: \nT0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0.\nGiven n, return the value of Tn.\n \nExample 1:\n\nInput: n = 4\nOutput: 4\nExplanation:\nT_3 = 0 + 1 + 1 = 2\nT_4 = 1 + 1 + 2 = 4\n\nExample 2:\n\nInput: n = 25\nOutput: 1389537\n\n \nConstraints:\n\n0 <= n <= 37\nThe answer is guaranteed to fit within a 32-bit integer, ie. answer <= 2^31 - 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 0) == 0\n assert candidate(n = 3) == 2\n assert candidate(n = 4) == 4\n assert candidate(n = 37) == 2082876103\n assert candidate(n = 2) == 1\n assert candidate(n = 1) == 1\n assert candidate(n = 25) == 1389537\n assert candidate(n = 30) == 29249425\n assert candidate(n = 15) == 3136\n assert candidate(n = 22) == 223317\n assert candidate(n = 12) == 504\n assert candidate(n = 35) == 615693474\n assert candidate(n = 26) == 2555757\n assert candidate(n = 27) == 4700770\n assert candidate(n = 18) == 19513\n assert candidate(n = 20) == 66012\n assert candidate(n = 10) == 149\n assert candidate(n = 5) == 7\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().tribonacci", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var tribonacci = function(n) {", "container": null, "callable": "tribonacci", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1138, "task_id": "alphabet-board-path", "difficulty": "Medium", "problem_description": "On an alphabet board, we start at position (0, 0), corresponding to character board[0][0].\\r\n\\r\nHere, board = [\"abcde\", \"fghij\", \"klmno\", \"pqrst\", \"uvwxy\", \"z\"], as shown in the diagram below.\\r\n\\r\n\\r\n\\r\nWe may make the following moves:\\r\n\\r\n\\r\n\t'U' moves our position up one row, if the position exists on the board;\\r\n\t'D' moves our position down one row, if the position exists on the board;\\r\n\t'L' moves our position left one column, if the position exists on the board;\\r\n\t'R' moves our position right one column, if the position exists on the board;\\r\n\t'!' adds the character board[r][c] at our current position (r, c) to the answer.\\r\n\\r\n\\r\n(Here, the only positions that exist on the board are positions with letters on them.)\\r\n\\r\nReturn a sequence of moves that makes our answer equal to target in the minimum number of moves.  You may return any path that does so.\\r\n\\r\n \\r\nExample 1:\\r\nInput: target = \"leet\"\\r\nOutput: \"DDR!UURRR!!DDD!\"\\r\nExample 2:\\r\nInput: target = \"code\"\\r\nOutput: \"RR!DDRR!UUL!R!\"\\r\n\\r\n \\r\nConstraints:\\r\n\\r\n\\r\n\t1 <= target.length <= 100\\r\n\ttarget consists only of English lowercase letters.\\r\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(target = \"azaz\") == \"!DDDDD!UUUUU!DDDDD!\"\n assert candidate(target = \"zm\") == \"DDDDD!UUURR!\"\n assert candidate(target = \"abcde\") == \"!R!R!R!R!\"\n assert candidate(target = \"leet\") == \"RDD!UURRR!!DDD!\"\n assert candidate(target = \"zuz\") == \"DDDDD!U!D!\"\n assert candidate(target = \"abc\") == \"!R!R!\"\n assert candidate(target = \"zb\") == \"DDDDD!UUUUUR!\"\n assert candidate(target = \"abcdefghijklmnopqrstuvwxyzzzzz\") == \"!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!!!!!\"\n assert candidate(target = \"zz\") == \"DDDDD!!\"\n assert candidate(target = \"abcdefghijklmnopqrstuvwxy\") == \"!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!\"\n assert candidate(target = \"xyz\") == \"RRRDDDD!R!LLLLD!\"\n assert candidate(target = \"zyxwvutsrqponmlkjihgfedcba\") == \"DDDDD!URRRR!L!L!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!\"\n assert candidate(target = \"zbcd\") == \"DDDDD!UUUUUR!R!R!\"\n assert candidate(target = \"zdz\") == \"DDDDD!UUUUURRR!LLLDDDDD!\"\n assert candidate(target = \"a\") == \"!\"\n assert candidate(target = \"mnopqrstuvwxyzz\") == \"RRDD!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!!\"\n assert candidate(target = \"zzz\") == \"DDDDD!!!\"\n assert candidate(target = \"code\") == \"RR!RRDD!LUU!R!\"\n assert candidate(target = \"zzzzz\") == \"DDDDD!!!!!\"\n assert candidate(target = \"az\") == \"!DDDDD!\"\n assert candidate(target = \"algorithms\") == \"!RDD!U!RRRD!LLD!UUR!RDD!LLUU!D!RD!\"\n assert candidate(target = \"inputs\") == \"RRRD!D!LLLD!D!URRRR!L!\"\n assert candidate(target = \"hello\") == \"RRD!URR!LLLDD!!RRR!\"\n assert candidate(target = \"elephant\") == \"RRRR!LLLDD!UURRR!LLLLDDD!UURR!LLU!RRRDD!RD!\"\n assert candidate(target = \"alphabet\") == \"!RDD!LD!UURR!LLU!R!RRR!DDD!\"\n assert candidate(target = \"aaaaaaaaaaaabbbbbbbbbbbbccccccccccccddddddddddddeeeeeeeeeeeefffffffffffgggggggggggghhhhhhhhhhhhiiiiiiiiiiiijjjjjjjjjjjjkkkkkkkkkkklllllllllllmmmmmmmmmmmnnnnnnnnnnnoooooooooppppppppppqqqqqqqqqqrrrrrrrrrrssssssssssttttttttttuuuuuuuuuuvvvvvvvvvvwwwwwwwwwxxxyyyyyyyyzzzzzzzz\") == \"!!!!!!!!!!!!R!!!!!!!!!!!!R!!!!!!!!!!!!R!!!!!!!!!!!!R!!!!!!!!!!!!LLLLD!!!!!!!!!!!R!!!!!!!!!!!!R!!!!!!!!!!!!R!!!!!!!!!!!!R!!!!!!!!!!!!LLLLD!!!!!!!!!!!R!!!!!!!!!!!R!!!!!!!!!!!R!!!!!!!!!!!R!!!!!!!!!LLLLD!!!!!!!!!!R!!!!!!!!!!R!!!!!!!!!!R!!!!!!!!!!R!!!!!!!!!!LLLLD!!!!!!!!!!R!!!!!!!!!!R!!!!!!!!!R!!!R!!!!!!!!LLLLD!!!!!!!!\"\n assert candidate(target = \"qrstuvwxyza\") == \"RDDD!R!R!R!LLLLD!R!R!R!R!LLLLD!UUUUU!\"\n assert candidate(target = \"minimum\") == \"RRDD!UR!D!U!LD!LLDD!UURR!\"\n assert candidate(target = \"zxywvutsrqponmlkjihgfedcba\") == \"DDDDD!URRR!R!LL!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!\"\n assert candidate(target = \"fish\") == \"D!RRR!DD!LUU!\"\n assert candidate(target = \"snake\") == \"RRRDDD!U!LLLUU!DD!UURRRR!\"\n assert candidate(target = \"uvwxyz\") == \"DDDD!R!R!R!R!LLLLD!\"\n assert candidate(target = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"DDDDD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n assert candidate(target = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab\") == \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!R!\"\n assert candidate(target = \"whale\") == \"RRDDDD!UUU!LLU!RDD!UURRR!\"\n assert candidate(target = \"mnopqrstuvwxyzabcde\") == \"RRDD!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!UUUUU!R!R!R!R!\"\n assert candidate(target = \"rhythm\") == \"RRDDD!UU!RRDDD!U!LLUU!D!\"\n assert candidate(target = \"abcdefghijklmnopqrstuvwxyz\") == \"!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!\"\n assert candidate(target = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"DDDDD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n assert candidate(target = \"testcase\") == \"RRRRDDD!UUU!LDDD!R!LLUUU!LL!RRRDDD!UUUR!\"\n assert candidate(target = \"hellofromtheotherside\") == \"RRD!URR!LLLDD!!RRR!LLLLU!RRDD!URR!LL!RRD!LLUU!URR!DD!D!LLUU!URR!LLDDD!R!UU!U!R!\"\n assert candidate(target = \"pythonprogramming\") == \"DDD!RRRRD!U!LLUU!RRD!L!LLLD!RR!URR!LLLU!RDD!LLUUU!RRDD!!UR!D!LLU!\"\n assert candidate(target = \"qpwoeiuytrmnbvcxzlkjhgfdsaz\") == \"RDDD!L!RRD!UURR!UU!LD!LLLDDD!RRRR!U!LL!U!R!LLUU!DDDD!UUUUR!RDDDD!LLLD!UUUR!L!URRRR!LL!L!L!URRR!DDD!LLLUUU!DDDDD!\"\n assert candidate(target = \"quicksand\") == \"RDDD!LD!UUURRR!LU!LLDD!RRRD!LLLUUU!RRRDD!UU!\"\n assert candidate(target = \"abacaxabacax\") == \"!R!L!RR!LL!RRRDDDD!LLLUUUU!R!L!RR!LL!RRRDDDD!\"\n assert candidate(target = \"movesteps\") == \"RRDD!RR!LLLDD!UUUURRR!LDDD!R!UUU!LLLLDDD!RRR!\"\n assert candidate(target = \"zzazzazzazz\") == \"DDDDD!!UUUUU!DDDDD!!UUUUU!DDDDD!!UUUUU!DDDDD!!\"\n assert candidate(target = \"ddddddddeeeeeeeeedddddddd\") == \"RRR!!!!!!!!R!!!!!!!!!L!!!!!!!!\"\n assert candidate(target = \"crocodile\") == \"RR!DDD!URR!LLUU!RRDD!LUU!D!LLD!UURRR!\"\n assert candidate(target = \"aaabbbcccddd\") == \"!!!R!!!R!!!R!!!\"\n assert candidate(target = \"microsoft\") == \"RRDD!UR!LU!DDD!URR!LD!UR!LLLLU!RRRRDD!\"\n assert candidate(target = \"mnopqrstuvwxyza\") == \"RRDD!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!UUUUU!\"\n assert candidate(target = \"uvwxyzz\") == \"DDDD!R!R!R!R!LLLLD!!\"\n assert candidate(target = \"board\") == \"R!RRRDD!LLLLUU!RRDDD!UUUR!\"\n assert candidate(target = \"solution\") == \"RRRDDD!UR!LLL!LDD!URRRR!LUU!RD!L!\"\n assert candidate(target = \"abcdefghijklmnopqrstuvwxyzaa\") == \"!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!UUUUU!!\"\n assert candidate(target = \"qpwoeirutyalskdjfhgzxcvbnm\") == \"RDDD!L!RRD!UURR!UU!LD!LDD!LLD!URRRR!D!LLLLUUUU!RDD!RRD!LLLU!UURRR!RD!LLLL!RR!L!LDDDD!URRR!LUUUU!LDDDD!UUUU!RRDD!L!\"\n assert candidate(target = \"xyzzzyxyzzz\") == \"RRRDDDD!R!LLLLD!!!URRRR!L!R!LLLLD!!!\"\n assert candidate(target = \"mnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba\") == \"RRDD!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!URRRR!L!L!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!\"\n assert candidate(target = \"challenge\") == \"RR!D!LLU!RDD!!UURRR!LDD!LLU!URRR!\"\n assert candidate(target = \"mnopqrstu\") == \"RRDD!R!R!LLLLD!R!R!R!R!LLLLD!\"\n assert candidate(target = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"DDDDD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n assert candidate(target = \"giraffe\") == \"RD!RR!LDD!LLUUU!D!!URRRR!\"\n assert candidate(target = \"zyxwvutsrqponmlkjihgfedcbaaabbbcccddd\") == \"DDDDD!URRRR!L!L!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!!!R!!!R!!!R!!!\"\n assert candidate(target = \"dolphin\") == \"RRR!RDD!LLL!LD!UURR!R!D!\"\n assert candidate(target = \"efficient\") == \"RRRR!LLLLD!!RRR!LU!RD!UR!LDD!RD!\"\n assert candidate(target = \"hellothere\") == \"RRD!URR!LLLDD!!RRR!D!LLUU!URR!LLDDD!UUURR!\"\n assert candidate(target = \"thequickbrownfoxjumpsoverthelazydog\") == \"RRRRDDD!LLUU!URR!LLLDDD!LD!UUURRR!LU!LLDD!UUR!RDDD!URR!LLDD!UUR!LLLU!RRRRD!LDD!UUUR!LLLLDDD!UURR!LLD!RRR!UR!LLLDD!UUUURRR!LLDDD!RR!LLUU!URR!LLLDD!LUU!DDDDD!URRRR!LUUUU!RDD!LLLU!\"\n assert candidate(target = \"mississippi\") == \"RRDD!UR!DD!!UU!DD!!UU!LLLDD!!UURRR!\"\n assert candidate(target = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == \"!!R!!R!!R!!R!!LLLLD!!R!!R!!R!!R!!LLLLD!!R!!R!!R!!R!!LLLLD!!R!!R!!R!!R!!LLLLD!!R!!R!!R!!R!!LLLLD!!\"\n assert candidate(target = \"dynamic\") == \"RRR!RDDDD!LUU!LLLUU!RRDD!UR!LU!\"\n assert candidate(target = \"programming\") == \"DDD!RR!URR!LLLU!RDD!LLUUU!RRDD!!UR!D!LLU!\"\n assert candidate(target = \"world\") == \"RRDDDD!UURR!LLD!LU!UURR!\"\n assert candidate(target = \"alphabetboardpath\") == \"!RDD!LD!UURR!LLU!R!RRR!DDD!LLLUUU!RRRDD!LLLLUU!RRDDD!UUUR!LLLDDD!UUU!RRRRDDD!LLUU!\"\n assert candidate(target = \"zzzz\") == \"DDDDD!!!!\"\n assert candidate(target = \"jump\") == \"RRRRD!LLLLDDD!UURR!LLD!\"\n assert candidate(target = \"interview\") == \"RRRD!D!RD!UUU!LLDDD!LD!UUURR!UR!LLDDDD!\"\n assert candidate(target = \"python\") == \"DDD!RRRRD!U!LLUU!RRD!L!\"\n assert candidate(target = \"qrstuvwxyzaa\") == \"RDDD!R!R!R!LLLLD!R!R!R!R!LLLLD!UUUUU!!\"\n assert candidate(target = \"xylophone\") == \"RRRDDDD!R!LLLUU!RRR!LLLLD!UURR!RRD!L!UUR!\"\n assert candidate(target = \"supercalifragilisticexpialidocious\") == \"RRRDDD!LLLD!U!UUURRRR!LLDDD!UUU!LL!RDD!URR!LLL!RRDD!LLUUU!RD!RR!LLD!URR!DD!R!LUU!LU!RR!LDDDD!LLLU!UURRR!LLLU!RDD!URR!U!RDD!LLUU!RD!RD!LLLLDD!URRR!\"\n assert candidate(target = \"quickbrownfox\") == \"RDDD!LD!UUURRR!LU!LLDD!UUR!RDDD!URR!LLDD!UUR!LLLU!RRRRD!LDD!\"\n assert candidate(target = \"complex\") == \"RR!RRDD!LL!LLD!UR!UURRR!LDDDD!\"\n assert candidate(target = \"hellozworld\") == \"RRD!URR!LLLDD!!RRR!LLLLDDD!URR!UURR!LLD!LU!UURR!\"\n assert candidate(target = \"abcdefghijklmnopqrstuvwxyzz\") == \"!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!!\"\n assert candidate(target = \"tiger\") == \"RRRRDDD!LUU!LL!URRR!LLDDD!\"\n assert candidate(target = \"lxyzzzz\") == \"RDD!RRDD!R!LLLLD!!!!\"\n assert candidate(target = \"abcdefghiz\") == \"!R!R!R!R!LLLLD!R!R!R!LLLDDDD!\"\n assert candidate(target = \"leetcode\") == \"RDD!UURRR!!DDD!LLUUU!RRDD!LUU!R!\"\n assert candidate(target = \"xyzzyx\") == \"RRRDDDD!R!LLLLD!!URRRR!L!\"\n assert candidate(target = \"bza\") == \"R!LDDDDD!UUUUU!\"\n assert candidate(target = \"mnonmlkjihgfedcba\") == \"RRDD!R!R!L!L!L!L!URRRR!L!L!L!L!URRRR!L!L!L!L!\"\n assert candidate(target = \"algorithm\") == \"!RDD!U!RRRD!LLD!UUR!RDD!LLUU!D!\"\n assert candidate(target = \"sequence\") == \"RRRDDD!UUUR!LLLDDD!LD!UUUURRRR!LDD!LUU!RR!\"\n assert candidate(target = \"leetcodeisfun\") == \"RDD!UURRR!!DDD!LLUUU!RRDD!LUU!R!LD!DD!LLLUU!DDD!UURRR!\"\n assert candidate(target = \"abcdefgHIJKLmnopqrstuvwxyz\") == \"!R!R!R!R!LLLLD!R!LUUUUUU!R!R!R!R!LLDDDDDDD!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!\"\n assert candidate(target = \"programmingisfun\") == \"DDD!RR!URR!LLLU!RDD!LLUUU!RRDD!!UR!D!LLU!RR!DD!LLLUU!DDD!UURRR!\"\n assert candidate(target = \"datastructures\") == \"RRR!LLL!RRRRDDD!LLLLUUU!RRRDDD!R!LL!LLD!UUUURR!RRDDD!LLLLD!URR!UUURR!LDDD!\"\n assert candidate(target = \"zzzzzzzzzz\") == \"DDDDD!!!!!!!!!!\"\n assert candidate(target = \"example\") == \"RRRR!LDDDD!LLLUUUU!RRDD!LLD!UR!UURRR!\"\n assert candidate(target = \"mnonmonmnonmo\") == \"RRDD!R!R!L!L!RR!L!L!R!R!L!L!RR!\"\n assert candidate(target = \"abcdefghijklmnopqrstuvwxyza\") == \"!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!R!R!R!R!LLLLD!UUUUU!\"\n assert candidate(target = \"question\") == \"RDDD!LD!UUUURRRR!LDDD!R!LUU!RD!L!\"\n"}, "metadata": {"canonical_parameter_names": ["target"], "leetcode_dataset_entry_point": "Solution().alphabetBoardPath", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var alphabetBoardPath = function(target) {", "container": null, "callable": "alphabetBoardPath", "parameters": [{"name": "target", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1139, "task_id": "largest-1-bordered-square", "difficulty": "Medium", "problem_description": "Given a 2D grid of 0s and 1s, return the number of elements in the largest square subgrid that has all 1s on its border, or 0 if such a subgrid doesn't exist in the grid.\\r\n\\r\n \\r\nExample 1:\\r\n\\r\n\\r\nInput: grid = [[1,1,1],[1,0,1],[1,1,1]]\\r\nOutput: 9\\r\n\\r\n\\r\nExample 2:\\r\n\\r\n\\r\nInput: grid = [[1,1,0,0]]\\r\nOutput: 1\\r\n\\r\n\\r\n \\r\nConstraints:\\r\n\\r\n\\r\n\t1 <= grid.length <= 100\\r\n\t1 <= grid[0].length <= 100\\r\n\tgrid[i][j] is 0 or 1\\r\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 1, 1, 1], [1, 0, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 25\n assert candidate(grid = [[1, 0], [0, 1]]) == 1\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 9\n assert candidate(grid = [[1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]]) == 16\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 25\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 16\n assert candidate(grid = [[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 1, 0], [1, 1, 1, 1]]) == 4\n assert candidate(grid = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 0, 0]]) == 1\n assert candidate(grid = [[1, 1], [1, 1]]) == 4\n assert candidate(grid = [[1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [1, 1, 1, 1, 1], [0, 1, 1, 1, 1], [0, 1, 1, 1, 1]]) == 9\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 0, 0], [1, 1, 1, 1, 1], [1, 1, 1, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 1]]) == 9\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == 49\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 0], [1, 0, 0, 1, 0], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]) == 9\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]) == 25\n assert candidate(grid = [[1, 1, 1, 1, 0], [1, 0, 0, 1, 0], [1, 1, 1, 1, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1]]) == 16\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]) == 25\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 64\n assert candidate(grid = [[1, 1, 0, 1, 1, 1], [1, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 1], [1, 1, 1, 1, 0, 1], [1, 1, 0, 1, 1, 1]]) == 4\n assert candidate(grid = [[1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [1, 1, 1, 1, 1, 1]]) == 4\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 81\n assert candidate(grid = [[1, 1, 1, 1, 0], [1, 0, 0, 1, 0], [1, 0, 0, 1, 0], [1, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 16\n assert candidate(grid = [[1, 1, 1, 0, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1]]) == 9\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 25\n assert candidate(grid = [[1, 1, 1, 0, 1], [1, 1, 1, 1, 1], [1, 0, 0, 1, 1], [1, 1, 1, 1, 1], [1, 0, 1, 1, 1]]) == 4\n assert candidate(grid = [[1, 1, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [1, 1, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 1]]) == 4\n assert candidate(grid = [[1, 1, 1, 0, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 1, 1, 1], [1, 0, 1, 1, 1]]) == 9\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]]) == 36\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 0, 1, 1], [1, 0, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1]]) == 9\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 100\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 64\n assert candidate(grid = [[0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [0, 1, 1, 1, 0]]) == 9\n assert candidate(grid = [[1, 1, 1, 0, 1], [1, 0, 1, 0, 1], [1, 1, 1, 0, 1], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1]]) == 9\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 0, 1, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 64\n assert candidate(grid = [[1, 1, 1, 1, 0, 0], [1, 0, 0, 1, 0, 0], [1, 0, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1], [1, 0, 0, 1, 0, 0], [1, 1, 1, 1, 0, 0]]) == 4\n assert candidate(grid = [[1, 1, 1, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1, 1]]) == 9\n assert candidate(grid = [[1, 1, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0], [1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]]) == 9\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == 49\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 81\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0]]) == 1\n assert candidate(grid = [[1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 0, 1, 0], [1, 1, 1, 0, 0, 1, 1]]) == 9\n assert candidate(grid = [[1, 1, 1, 1, 0], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 1]]) == 9\n assert candidate(grid = [[1, 1, 1, 0, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [1, 1, 1, 1, 1]]) == 9\n assert candidate(grid = [[1, 0, 0, 1, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [1, 0, 0, 1, 0]]) == 9\n assert candidate(grid = [[1, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0], [1, 1, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0]]) == 9\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 1, 0, 1, 0, 0, 0], [1, 1, 0, 1, 1, 1, 1], [0, 0, 0, 1, 1, 0, 1], [0, 1, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1]]) == 4\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 0, 1], [1, 0, 0, 1, 1], [1, 1, 0, 1, 1], [1, 0, 1, 1, 1]]) == 4\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().largest1BorderedSquare", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var largest1BorderedSquare = function(grid) {", "container": null, "callable": "largest1BorderedSquare", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1140, "task_id": "stone-game-ii", "difficulty": "Medium", "problem_description": "Alice and Bob continue their games with piles of stones. There are a number of piles arranged in a row, and each pile has a positive integer number of stones piles[i]. The objective of the game is to end with the most stones.\nAlice and Bob take turns, with Alice starting first.\nOn each player's turn, that player can take all the stones in the first X remaining piles, where 1 <= X <= 2M. Then, we set M = max(M, X). Initially, M = 1.\nThe game continues until all the stones have been taken.\nAssuming Alice and Bob play optimally, return the maximum number of stones Alice can get.\n \nExample 1:\n\nInput: piles = [2,7,9,4,4]\nOutput: 10\nExplanation:\n\nIf Alice takes one pile at the beginning, Bob takes two piles, then Alice takes 2 piles again. Alice can get 2 + 4 + 4 = 10 stones in total.\nIf Alice takes two piles at the beginning, then Bob can take all three piles left. In this case, Alice get 2 + 7 = 9 stones in total.\n\nSo we return 10 since it's larger.\n\nExample 2:\n\nInput: piles = [1,2,3,4,5,100]\nOutput: 104\n\n \nConstraints:\n\n1 <= piles.length <= 100\n1 <= piles[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(piles = [1, 2, 3, 4, 5, 100]) == 104\n assert candidate(piles = [10]) == 10\n assert candidate(piles = [100, 100, 100, 100]) == 200\n assert candidate(piles = [1, 2, 3]) == 3\n assert candidate(piles = [1, 100, 1, 100, 1, 100]) == 102\n assert candidate(piles = [3, 6, 9, 12]) == 15\n assert candidate(piles = [3, 3, 3, 3, 3, 3, 3, 3]) == 12\n assert candidate(piles = [8, 5, 7, 3, 8, 9]) == 24\n assert candidate(piles = [3, 3, 3, 3, 3, 3, 3]) == 12\n assert candidate(piles = [10, 20, 30, 40, 50]) == 80\n assert candidate(piles = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == 48\n assert candidate(piles = [5, 4, 3, 2, 1]) == 9\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 6\n assert candidate(piles = [3, 3, 3, 3, 3, 3]) == 9\n assert candidate(piles = [2, 7, 9, 4, 4]) == 10\n assert candidate(piles = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 260\n assert candidate(piles = [1, 100, 100, 1]) == 101\n assert candidate(piles = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 15\n assert candidate(piles = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 57\n assert candidate(piles = [1, 2, 3, 4, 5, 100, 1, 2, 3, 4, 5, 100, 1, 2, 3, 4, 5, 100, 1, 2, 3, 4, 5, 100]) == 237\n assert candidate(piles = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, 981, 980, 979, 978, 977, 976, 975, 974, 973, 972, 971, 970, 969, 968, 967, 966, 965, 964, 963, 962, 961, 960, 959, 958, 957, 956, 955, 954, 953, 952, 951, 950]) == 25360\n assert candidate(piles = [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]) == 128\n assert candidate(piles = [7, 14, 28, 56, 112, 224, 448, 896]) == 861\n assert candidate(piles = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 47\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 32\n assert candidate(piles = [5, 3, 9, 1, 10, 12, 8, 7, 6, 11, 4, 2]) == 39\n assert candidate(piles = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 540\n assert candidate(piles = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 172\n assert candidate(piles = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60]) == 466\n assert candidate(piles = [3, 8, 4, 5, 12, 10]) == 17\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 30\n assert candidate(piles = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10]) == 59\n assert candidate(piles = [5, 15, 20, 10, 35, 25, 40]) == 85\n assert candidate(piles = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 50\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 34\n assert candidate(piles = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 300\n assert candidate(piles = [5, 3, 7, 2, 9, 11, 4, 6, 8, 10, 1, 12, 14, 13]) == 54\n assert candidate(piles = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == 210\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 108\n assert candidate(piles = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 321\n assert candidate(piles = [3, 6, 7, 10, 20, 5, 15, 25, 30, 1]) == 59\n assert candidate(piles = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 114\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 108\n assert candidate(piles = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 87\n assert candidate(piles = [10000, 5000, 2500, 1250, 625, 312, 156, 78, 39, 19, 9, 4, 2, 1]) == 15308\n assert candidate(piles = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 300\n assert candidate(piles = [1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100]) == 505\n assert candidate(piles = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100]) == 3000\n assert candidate(piles = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3]) == 32\n assert candidate(piles = [3, 2, 10, 7, 8, 9, 1, 2, 10, 5]) == 28\n assert candidate(piles = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80]) == 913\n assert candidate(piles = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 205\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 140\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 30\n assert candidate(piles = [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 537\n assert candidate(piles = [1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000]) == 5005\n assert candidate(piles = [5, 3, 8, 9, 1, 2, 4, 6, 7, 10, 11, 12]) == 42\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 163\n assert candidate(piles = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == 235\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(piles = [3, 1, 5, 6, 8, 9, 2, 4, 7, 10]) == 28\n assert candidate(piles = [3, 8, 7, 2, 10, 5, 6, 4, 9, 1]) == 31\n assert candidate(piles = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36]) == 123\n assert candidate(piles = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 20\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 34\n assert candidate(piles = [300, 290, 280, 270, 260, 250, 240, 230, 220, 210, 200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 2410\n assert candidate(piles = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000]) == 10800\n assert candidate(piles = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 113\n assert candidate(piles = [100, 1, 1, 1, 100, 1, 1, 1, 100, 1]) == 204\n assert candidate(piles = [1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000]) == 15000\n assert candidate(piles = [100, 200, 300, 400, 500, 100, 200, 300, 400, 500, 100, 200, 300, 400, 500]) == 2300\n assert candidate(piles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 16\n assert candidate(piles = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 2600\n assert candidate(piles = [50, 25, 100, 75, 200, 150, 300, 125, 350, 225, 400, 275, 450, 325, 500, 375, 550, 425, 600, 475]) == 3025\n assert candidate(piles = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 20\n assert candidate(piles = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 60\n assert candidate(piles = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20]) == 150\n assert candidate(piles = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 86\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 410\n assert candidate(piles = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 600\n assert candidate(piles = [34, 54, 74, 94, 114, 134, 154, 174, 194, 214, 234, 254, 274, 294, 314, 334, 354, 374, 394, 414, 434, 454, 474, 494, 514, 534, 554, 574, 594, 614, 634, 654, 674, 694, 714, 734, 754, 774, 794, 814, 834, 854, 874, 894, 914, 934, 954, 974, 994]) == 12668\n assert candidate(piles = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 327\n assert candidate(piles = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 694\n assert candidate(piles = [5, 3, 7, 8, 4, 2, 6, 1, 9, 10, 11, 12]) == 43\n assert candidate(piles = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 288\n assert candidate(piles = [5, 1, 4, 2, 3, 6, 9, 8, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 235\n assert candidate(piles = [4, 6, 2, 8, 10, 5, 7, 3, 9, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]) == 916\n assert candidate(piles = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119]) == 1103\n assert candidate(piles = [9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 109\n assert candidate(piles = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21]) == 64\n assert candidate(piles = [10000, 1, 9999, 2, 9998, 3, 9997, 4, 9996, 5, 9995, 6, 9994, 7, 9993, 8, 9992, 9, 9991, 10, 9990, 11, 9989, 12, 9988, 13, 9987, 14, 9986, 15, 9985, 16, 9984, 17, 9983, 18, 9982, 19, 9981, 20, 9980, 21, 9979, 22, 9978, 23, 9977, 24, 9976, 25, 9975, 26, 9974, 27, 9973, 28, 9972, 29, 9971, 30, 9970, 31, 9969, 32, 9968, 33, 9967, 34, 9966, 35, 9965, 36, 9964, 37, 9963, 38, 9962, 39, 9961, 40, 9960, 41, 9959, 42, 9958, 43, 9957, 44, 9956, 45, 9955, 46, 9954, 47, 9953, 48, 9952, 49, 9951, 50]) == 250050\n assert candidate(piles = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 114\n assert candidate(piles = [23, 35, 18, 41, 7, 25, 38, 13, 29, 22, 33, 3, 19, 27, 15, 32, 6, 24, 20, 21, 8, 14, 16, 30, 34, 9, 26, 17, 31, 12, 28, 10, 36, 37, 4, 5, 11, 39, 40, 2, 42]) == 470\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]) == 2526\n assert candidate(piles = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300]) == 2330\n assert candidate(piles = [5, 8, 12, 21, 14, 9, 10, 4, 15, 6, 11, 3, 17, 7, 2, 13, 18, 20, 1, 16]) == 112\n"}, "metadata": {"canonical_parameter_names": ["piles"], "leetcode_dataset_entry_point": "Solution().stoneGameII", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var stoneGameII = function(piles) {", "container": null, "callable": "stoneGameII", "parameters": [{"name": "piles", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1143, "task_id": "longest-common-subsequence", "difficulty": "Medium", "problem_description": "Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0.\nA subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.\n\nFor example, \"ace\" is a subsequence of \"abcde\".\n\nA common subsequence of two strings is a subsequence that is common to both strings.\n \nExample 1:\n\nInput: text1 = \"abcde\", text2 = \"ace\" \nOutput: 3 \nExplanation: The longest common subsequence is \"ace\" and its length is 3.\n\nExample 2:\n\nInput: text1 = \"abc\", text2 = \"abc\"\nOutput: 3\nExplanation: The longest common subsequence is \"abc\" and its length is 3.\n\nExample 3:\n\nInput: text1 = \"abc\", text2 = \"def\"\nOutput: 0\nExplanation: There is no such common subsequence, so the result is 0.\n\n \nConstraints:\n\n1 <= text1.length, text2.length <= 1000\ntext1 and text2 consist of only lowercase English characters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(text1 = \"a\",text2 = \"b\") == 0\n assert candidate(text1 = \"xyz\",text2 = \"zyx\") == 1\n assert candidate(text1 = \"ezupkr\",text2 = \"ubmrapg\") == 2\n assert candidate(text1 = \"abcde\",text2 = \"ace\") == 3\n assert candidate(text1 = \"abc\",text2 = \"def\") == 0\n assert candidate(text1 = \"aabcc\",text2 = \"dbbca\") == 2\n assert candidate(text1 = \"programming\",text2 = \"gaming\") == 6\n assert candidate(text1 = \"ylqpfxxqy\",text2 = \"wxqxalnnsow\") == 2\n assert candidate(text1 = \"pqr\",text2 = \"stu\") == 0\n assert candidate(text1 = \"abcdgh\",text2 = \"aedfhr\") == 3\n assert candidate(text1 = \"hofubmnyg\",text2 = \"hvmpywxck\") == 3\n assert candidate(text1 = \"abcdef\",text2 = \"z\") == 0\n assert candidate(text1 = \"mhunuzqrkz\",text2 = \"dhlmfpnqjk\") == 4\n assert candidate(text1 = \"abcdefg\",text2 = \"abdfg\") == 5\n assert candidate(text1 = \"a\",text2 = \"a\") == 1\n assert candidate(text1 = \"abc\",text2 = \"\") == 0\n assert candidate(text1 = \"xyz\",text2 = \"abc\") == 0\n assert candidate(text1 = \"\",text2 = \"abc\") == 0\n assert candidate(text1 = \"psnw\",text2 = \"vozbbmloqjbpbprqs\") == 2\n assert candidate(text1 = \"abcxyz\",text2 = \"xyzabc\") == 3\n assert candidate(text1 = \"abc\",text2 = \"abc\") == 3\n assert candidate(text1 = \"abcdef\",text2 = \"zabcf\") == 4\n assert candidate(text1 = \"oxcpqrsvwf\",text2 = \"shmtulqrypy\") == 2\n assert candidate(text1 = \"\",text2 = \"\") == 0\n assert candidate(text1 = \"abcdxyz\",text2 = \"xyzabcd\") == 4\n assert candidate(text1 = \"aaaa\",text2 = \"aa\") == 2\n assert candidate(text1 = \"aggtab\",text2 = \"gxtxayb\") == 4\n assert candidate(text1 = \"abcxyzabc\",text2 = \"xyzabcxyz\") == 6\n assert candidate(text1 = \"aaaaaa\",text2 = \"aaaaaa\") == 6\n assert candidate(text1 = \"abacdfgdcaba\",text2 = \"abacdgfdcaba\") == 11\n assert candidate(text1 = \"aabccbb\",text2 = \"dbbcbab\") == 4\n assert candidate(text1 = \"longerstringone\",text2 = \"short\") == 3\n assert candidate(text1 = \"mississippi\",text2 = \"pississippi\") == 10\n assert candidate(text1 = \"abracadabra\",text2 = \"avadakedavra\") == 7\n assert candidate(text1 = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",text2 = \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\") == 0\n assert candidate(text1 = \"aquickbrownfoxjumpsoverthelazydog\",text2 = \"lazydog\") == 7\n assert candidate(text1 = \"abcdefghij\",text2 = \"acegik\") == 5\n assert candidate(text1 = \"abcdpqrs\",text2 = \"efghijkl\") == 0\n assert candidate(text1 = \"aaaabbbbccccddddeeeeffffgggghhhhiiii\",text2 = \"abcdefghi\") == 9\n assert candidate(text1 = \"xyzxyzxyz\",text2 = \"zyxzyxzyx\") == 5\n assert candidate(text1 = \"zyxwvutsrqponmlkjihgfedcba\",text2 = \"abcdefghijklmnopqrstuvwxyz\") == 1\n assert candidate(text1 = \"abcdabcdabcdabcdabcdabcdabcdabcd\",text2 = \"zyxwvutsrqponmlkjihgfedcba\") == 4\n assert candidate(text1 = \"abcdefghijklmnopqrstuvwxyz\",text2 = \"zyxwvutsrqponmlkjihgfedcba\") == 1\n assert candidate(text1 = \"longestcommonsubsequence\",text2 = \"shortestsub\") == 7\n assert candidate(text1 = \"mississippi\",text2 = \"ississippi\") == 10\n assert candidate(text1 = \"aaaaabaaaabaaaabaaaa\",text2 = \"bbbaabbaabbaabbaab\") == 11\n assert candidate(text1 = \"abcdeabcdeabcde\",text2 = \"deabcdea\") == 8\n assert candidate(text1 = \"interpersonal\",text2 = \"personality\") == 8\n assert candidate(text1 = \"aaaaabbbb\",text2 = \"ababababab\") == 6\n assert candidate(text1 = \"abcdefg\",text2 = \"hijklmn\") == 0\n assert candidate(text1 = \"pqrstuvwxyzabcdefghijklmno\",text2 = \"mnopqrstuvwxyzabcdefghijkl\") == 23\n assert candidate(text1 = \"pwwkew\",text2 = \"wkepwkew\") == 5\n assert candidate(text1 = \"aaaaaaab\",text2 = \"bbbbbaaa\") == 3\n assert candidate(text1 = \"abcdexyz\",text2 = \"zyxeabcd\") == 4\n assert candidate(text1 = \"abcdefghij\",text2 = \"0123456789abcdefghij\") == 10\n assert candidate(text1 = \"thisisaverylongstring\",text2 = \"shisivaverylongstring\") == 19\n assert candidate(text1 = \"acbdefgh\",text2 = \"bdfg\") == 4\n assert candidate(text1 = \"abc\",text2 = \"cba\") == 1\n assert candidate(text1 = \"abacabadabacaba\",text2 = \"abacabadabacab\") == 14\n assert candidate(text1 = \"abcabcabcabcabcabcabcabcabcabcabc\",text2 = \"abcabcabcabc\") == 12\n assert candidate(text1 = \"aaaabbbbcccc\",text2 = \"bbcccaabbbccc\") == 8\n assert candidate(text1 = \"aaaaabbbbbbccccccdddddeeeeeeeeeffffff\",text2 = \"dddddeeeeeeeeeccccccbbbbaaaaaa\") == 14\n assert candidate(text1 = \"aaaaaaaaaa\",text2 = \"aaaaaaaaaa\") == 10\n assert candidate(text1 = \"ab\",text2 = \"ba\") == 1\n assert candidate(text1 = \"aaaaaaabbbbbbbccccccdddddd\",text2 = \"abcde\") == 4\n assert candidate(text1 = \"ababcabcabc\",text2 = \"abcabcabc\") == 9\n assert candidate(text1 = \"abcdefghijk\",text2 = \"lmnopqrstuvwxyz\") == 0\n assert candidate(text1 = \"aabccba\",text2 = \"abcabcabc\") == 5\n assert candidate(text1 = \"abcdefghijlkmnopqrstuvwxyz\",text2 = \"zxywvutsrqponmlkjihgfedcba\") == 2\n assert candidate(text1 = \"repeatedrepeated\",text2 = \"repeated\") == 8\n assert candidate(text1 = \"abcdefghij\",text2 = \"acegikmopq\") == 5\n assert candidate(text1 = \"aabbccddeeffgghhiijj\",text2 = \"jjiihhggffeeddccbbaa\") == 2\n assert candidate(text1 = \"supercalifragilisticexpialidocious\",text2 = \"superfragilistic\") == 16\n assert candidate(text1 = \"aaaaaaabbbbbbbcccccc\",text2 = \"bbbbbbccccccdddddd\") == 12\n assert candidate(text1 = \"abcdefghigklmnopqrstuvwxyz\",text2 = \"zzzyyxxwwvvuuttrrqqppoonnmmllkkjjiihhggeeffddeeccbbbaa\") == 2\n assert candidate(text1 = \"abracadabraabracadabra\",text2 = \"alacazamalacazam\") == 10\n assert candidate(text1 = \"abcabcabcabcabcabcabcabcabcabc\",text2 = \"abcabcabc\") == 9\n assert candidate(text1 = \"abababababababababababababababab\",text2 = \"babababababababababababababababa\") == 31\n assert candidate(text1 = \"randomsequence\",text2 = \"sequence\") == 8\n assert candidate(text1 = \"abcdeabcdeabcde\",text2 = \"cdecdecdecde\") == 9\n assert candidate(text1 = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",text2 = \"mnopqrstuvwxyz\") == 14\n assert candidate(text1 = \"aaaaaaabaaaaaa\",text2 = \"bbbbbbbbaaaaaa\") == 7\n assert candidate(text1 = \"aaaaaaaaaaaaaaaaaaaaaaaaaa\",text2 = \"aaaaaaaaaaaaaaaaaaaaaaaaaa\") == 26\n assert candidate(text1 = \"abcdeabcdeabcde\",text2 = \"deabcdeabcdeabcdeab\") == 15\n assert candidate(text1 = \"abcdexyz\",text2 = \"xyzabcd\") == 4\n assert candidate(text1 = \"aaaabbbb\",text2 = \"bbaaaa\") == 4\n assert candidate(text1 = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",text2 = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") == 29\n assert candidate(text1 = \"pneumonoultramicroscopicsilicovolcanoconiosis\",text2 = \"ultramicroscopically\") == 18\n assert candidate(text1 = \"dynamicprogramming\",text2 = \"rhythmprogramming\") == 13\n assert candidate(text1 = \"aaaa\",text2 = \"bbbb\") == 0\n assert candidate(text1 = \"abcdpqrsabcd\",text2 = \"dcbapqrscba\") == 6\n assert candidate(text1 = \"longestcommonsubsequence\",text2 = \"shortestsubsequence\") == 15\n assert candidate(text1 = \"abacabadabacaba\",text2 = \"abacabadabacaba\") == 15\n assert candidate(text1 = \"findlongestcommonsubsequence\",text2 = \"longestsubsequence\") == 18\n assert candidate(text1 = \"xyxzyzyxyzyx\",text2 = \"zyzyxzyxzyzyxzyzyx\") == 12\n assert candidate(text1 = \"abcdefghijklnmopqrstuvwxyz\",text2 = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == 25\n assert candidate(text1 = \"abcdefghigklmnopqrstuvwxyz\",text2 = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == 25\n assert candidate(text1 = \"abcde\",text2 = \"\") == 0\n assert candidate(text1 = \"pneumonoultramicroscopicsilicovolcanoconiosis\",text2 = \"supercalifragilisticexpialidocious\") == 17\n assert candidate(text1 = \"papiermuh\",text2 = \"leidermuz\") == 5\n assert candidate(text1 = \"abcdabcdabcdabcdabcdabcdabcdabcd\",text2 = \"cdabcdabcdabcdabcdabcdabcdabcdabc\") == 31\n assert candidate(text1 = \"pwwkew\",text2 = \"wkep\") == 3\n assert candidate(text1 = \"xyxzyxyxzyx\",text2 = \"zyxzyxzyxzyx\") == 10\n assert candidate(text1 = \"xyzzaz\",text2 = \"yza\") == 3\n assert candidate(text1 = \"commonsubstring\",text2 = \"substring\") == 9\n assert candidate(text1 = \"abcde\",text2 = \"edcba\") == 1\n assert candidate(text1 = \"aabbaabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",text2 = \"ababababcabcacacacaddaddaeaeaeafaafagagahaiai\") == 20\n assert candidate(text1 = \"abcdabcdabcd\",text2 = \"dcbaabcd\") == 6\n assert candidate(text1 = \"\",text2 = \"abcde\") == 0\n assert candidate(text1 = \"aaaaabaaaacaaaaadaaaaa\",text2 = \"aaabaaaaaaacaaaaaa\") == 17\n assert candidate(text1 = \"thisisaverylongstringthatshouldtestthelimits\",text2 = \"stringthatshouldtest\") == 20\n assert candidate(text1 = \"mississippi\",text2 = \"issipi\") == 6\n assert candidate(text1 = \"longestcommonsubsequence\",text2 = \"shortcommonsequence\") == 16\n assert candidate(text1 = \"abcdabcdabcd\",text2 = \"ddd\") == 3\n assert candidate(text1 = \"longestcommonsubsequence\",text2 = \"commonsubsequences\") == 17\n assert candidate(text1 = \"longstringwithnocommonsubsequence\",text2 = \"anotherlongstringwithoutcommonsubsequence\") == 32\n assert candidate(text1 = \"abcdefghijabcdefghijabcdefghij\",text2 = \"abcdefghijabcdefghij\") == 20\n assert candidate(text1 = \"lclcl\",text2 = \"clcl\") == 4\n assert candidate(text1 = \"thequickbrownfoxjumpsoverthelazydog\",text2 = \"quickbrownfoxjumpsoverthelazydo\") == 31\n assert candidate(text1 = \"longestcommonsubsequenceproblem\",text2 = \"programmingproblemsolving\") == 12\n assert candidate(text1 = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",text2 = \"azbycxdwevfugthsirjqkplohnmgpfnoreqmtpslknjihgfedcba\") == 17\n assert candidate(text1 = \"abcabcabcabc\",text2 = \"cbacbacbacba\") == 7\n assert candidate(text1 = \"abcdeabcdeabcdeabcdeabcdeabcdeabcde\",text2 = \"abcdeabcde\") == 10\n assert candidate(text1 = \"xyzxyzxyzxyz\",text2 = \"zyxzyxzyxzyx\") == 7\n assert candidate(text1 = \"aabaaaabaaaaabaaaabaaabaaa\",text2 = \"abaababaabaaaaabaaabaaaaabaaaab\") == 24\n assert candidate(text1 = \"qwertypasdfghjklzxcvbnm\",text2 = \"qwertyuiopasdfghjklzxcvbnm\") == 23\n assert candidate(text1 = \"aabbccddeeff\",text2 = \"abcdefabcdef\") == 7\n assert candidate(text1 = \"abcxyzdefghijklmnopqrstuvwxyz\",text2 = \"xyzabcghijklmnopqrstuvwxyzdef\") == 23\n assert candidate(text1 = \"abcdabcdabcdabcd\",text2 = \"abcabcabcabc\") == 12\n assert candidate(text1 = \"thisisatestcase\",text2 = \"testingthestcase\") == 11\n assert candidate(text1 = \"abacabadabacaba\",text2 = \"cabacabacabaca\") == 12\n assert candidate(text1 = \"dynamicprogramming\",text2 = \"longestincreasingsubsequence\") == 8\n assert candidate(text1 = \"abcdefg\",text2 = \"xyz\") == 0\n assert candidate(text1 = \"1234567890\",text2 = \"0987654321\") == 1\n assert candidate(text1 = \"thisisatest\",text2 = \"testingthest\") == 7\n assert candidate(text1 = \"aaaaaaa\",text2 = \"aaaaaaaaa\") == 7\n assert candidate(text1 = \"longestcommonsubsequence\",text2 = \"commonsequences\") == 14\n assert candidate(text1 = \"abracadabra\",text2 = \"alacazam\") == 5\n assert candidate(text1 = \"mississippi\",text2 = \"issip\") == 5\n assert candidate(text1 = \"1234567890\",text2 = \"9876543210\") == 2\n assert candidate(text1 = \"thisisareallylongstringthatweneedtocheck\",text2 = \"thisstringislong\") == 11\n assert candidate(text1 = \"abcdabcde\",text2 = \"abcde\") == 5\n assert candidate(text1 = \"abcdefghij\",text2 = \"jihgfedcba\") == 1\n assert candidate(text1 = \"abababababababab\",text2 = \"babababababababa\") == 15\n assert candidate(text1 = \"mississippi\",text2 = \"mississsippississippi\") == 11\n assert candidate(text1 = \"aaaaabbbbbcccc\",text2 = \"cccbbaaaa\") == 4\n"}, "metadata": {"canonical_parameter_names": ["text1", "text2"], "leetcode_dataset_entry_point": "Solution().longestCommonSubsequence", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var longestCommonSubsequence = function(text1, text2) {", "container": null, "callable": "longestCommonSubsequence", "parameters": [{"name": "text1", "type": "string"}, {"name": "text2", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1144, "task_id": "decrease-elements-to-make-array-zigzag", "difficulty": "Medium", "problem_description": "Given an array nums of integers, a move consists of choosing any element and decreasing it by 1.\nAn array A is a zigzag array if either:\n\nEvery even-indexed element is greater than adjacent elements, ie. A[0] > A[1] < A[2] > A[3] < A[4] > ...\nOR, every odd-indexed element is greater than adjacent elements, ie. A[0] < A[1] > A[2] < A[3] > A[4] < ...\n\nReturn the minimum number of moves to transform the given array nums into a zigzag array.\n \nExample 1:\n\nInput: nums = [1,2,3]\nOutput: 2\nExplanation: We can decrease 2 to 0 or 3 to 1.\n\nExample 2:\n\nInput: nums = [9,6,1,6,2]\nOutput: 4\n\n \nConstraints:\n\n1 <= nums.length <= 1000\n1 <= nums[i] <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [4, 3, 2, 1]) == 2\n assert candidate(nums = [1, 3, 2, 2, 3, 1]) == 4\n assert candidate(nums = [1, 1, 1]) == 1\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 8\n assert candidate(nums = [9, 6, 1, 6, 2]) == 4\n assert candidate(nums = [1, 3, 5, 7, 9]) == 6\n assert candidate(nums = [1]) == 0\n assert candidate(nums = [3, 3, 3, 3, 3, 3]) == 3\n assert candidate(nums = [10, 9, 4, 7, 3, 8, 15]) == 10\n assert candidate(nums = [7, 6, 5, 4, 3, 2, 1]) == 6\n assert candidate(nums = [1000, 999, 998, 997, 996]) == 4\n assert candidate(nums = [2, 7, 10, 9, 8, 9]) == 4\n assert candidate(nums = [5, 4, 3, 2, 1, 2, 3, 4, 5]) == 8\n assert candidate(nums = [1, 2, 3, 4, 5]) == 4\n assert candidate(nums = [4, 3, 2, 1, 0]) == 4\n assert candidate(nums = [4, 3, 2, 1, 2, 3]) == 4\n assert candidate(nums = [1, 1, 1, 1, 1]) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6]) == 4\n assert candidate(nums = [1, 4, 3, 2, 5]) == 4\n assert candidate(nums = [1, 4, 3, 2, 1]) == 2\n assert candidate(nums = [1000, 1, 1000, 1, 1000]) == 0\n assert candidate(nums = [1, 1000, 1, 1000, 1]) == 0\n assert candidate(nums = [5, 5, 5, 5, 5, 5]) == 3\n assert candidate(nums = [1, 2, 2, 3, 4]) == 3\n assert candidate(nums = [1, 2]) == 0\n assert candidate(nums = [10, 4, 4, 10, 10]) == 8\n assert candidate(nums = [1, 2, 3]) == 2\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7]) == 6\n assert candidate(nums = [1000, 1000, 1000, 1000, 1000]) == 2\n assert candidate(nums = [5, 1, 4, 2, 3, 6, 7, 8, 9, 10]) == 8\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]) == 20\n assert candidate(nums = [1, 3, 2, 2, 3, 1, 4, 3]) == 4\n assert candidate(nums = [1, 4, 2, 5, 3, 6, 4, 7, 5, 8, 6, 9]) == 0\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 5\n assert candidate(nums = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 12\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 0\n assert candidate(nums = [1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10]) == 0\n assert candidate(nums = [1, 4, 2, 5, 3, 6, 4, 7, 5, 8]) == 0\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 10\n assert candidate(nums = [1, 5, 1, 5, 1, 5, 1, 5, 1, 5]) == 0\n assert candidate(nums = [9, 8, 9, 8, 9, 8, 9, 8, 9, 8]) == 0\n assert candidate(nums = [5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3]) == 12\n assert candidate(nums = [100, 101, 102, 101, 100, 101, 102, 101, 100, 101]) == 4\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 14\n assert candidate(nums = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == 8\n assert candidate(nums = [3, 2, 1, 2, 3, 2, 1, 2, 3, 2]) == 6\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(nums = [5, 3, 8, 1, 6, 2, 9, 4]) == 0\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7]) == 6\n assert candidate(nums = [10, 20, 15, 25, 20, 30, 25, 35, 30, 40, 35]) == 0\n assert candidate(nums = [5, 1, 3, 1, 3, 1, 3]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 16\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 6\n assert candidate(nums = [1000, 1, 1000, 1, 1000, 1, 1000, 1]) == 0\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 2]) == 5\n assert candidate(nums = [999, 1000, 999, 1000, 999, 1000, 999, 1000]) == 0\n assert candidate(nums = [7, 1, 8, 2, 9, 3, 10, 4, 11, 5]) == 0\n assert candidate(nums = [4, 1, 1, 3, 2, 1, 5]) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 14\n assert candidate(nums = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7]) == 0\n assert candidate(nums = [5, 1, 3, 1, 5, 1, 3, 1, 5]) == 0\n assert candidate(nums = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == 6\n assert candidate(nums = [1, 10, 1, 10, 1, 10, 1, 10, 1, 10]) == 0\n assert candidate(nums = [1, 3, 2, 2, 3, 1, 4, 5, 6, 7, 8, 9]) == 10\n assert candidate(nums = [5, 1, 4, 2, 3, 1, 3, 2, 1, 4, 5, 2, 1, 3]) == 11\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == 18\n assert candidate(nums = [1, 1000, 2, 1000, 3, 1000, 4, 1000, 5, 1000]) == 0\n assert candidate(nums = [5, 4, 5, 4, 5, 4, 5, 4, 5, 4]) == 0\n assert candidate(nums = [1, 100, 1, 100, 1, 100, 1]) == 0\n assert candidate(nums = [2, 3, 1, 4, 5, 3, 6, 7, 5, 8, 9, 7]) == 10\n assert candidate(nums = [10, 10, 10, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 7\n assert candidate(nums = [2, 1, 2, 1, 2, 1, 2, 1, 2]) == 0\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 5\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 5\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 12\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 7\n assert candidate(nums = [1, 3, 2, 2, 3, 1, 4, 5, 6, 7]) == 8\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 10\n assert candidate(nums = [1, 3, 2, 5, 4, 7, 6, 8, 7, 9]) == 0\n assert candidate(nums = [2, 1, 2, 3, 4, 3, 4, 5, 6, 5, 6, 7, 8, 7, 8, 9, 10, 9, 10, 11]) == 10\n assert candidate(nums = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 18\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 5\n assert candidate(nums = [3, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 2\n assert candidate(nums = [1, 10, 3, 8, 5, 6, 7, 2, 9, 4, 11]) == 18\n assert candidate(nums = [100, 1, 101, 1, 102, 1, 103, 1, 104, 1, 105, 1]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 18\n assert candidate(nums = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991]) == 8\n assert candidate(nums = [1, 2, 3, 2, 3, 2, 3, 2, 3, 2]) == 2\n assert candidate(nums = [1000, 999, 1000, 999, 1000, 999, 1000]) == 0\n assert candidate(nums = [10, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9]) == 2\n assert candidate(nums = [14, 13, 12, 11, 10, 9, 8, 7, 6, 5]) == 8\n assert candidate(nums = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1]) == 10\n assert candidate(nums = [1, 3, 2, 2, 3, 1, 4, 2]) == 4\n assert candidate(nums = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 11]) == 10\n assert candidate(nums = [1000, 999, 1000, 999, 1000, 999, 1000, 999]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 8\n assert candidate(nums = [1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10]) == 0\n assert candidate(nums = [2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9]) == 0\n assert candidate(nums = [1, 2, 3, 4, 3, 2, 3, 4, 5, 6]) == 8\n assert candidate(nums = [1000, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 8\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 20\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 14\n assert candidate(nums = [8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8]) == 12\n assert candidate(nums = [8, 9, 7, 6, 7, 8, 9, 10, 11]) == 7\n assert candidate(nums = [3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1]) == 0\n assert candidate(nums = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 8\n assert candidate(nums = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 0\n assert candidate(nums = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10]) == 18\n assert candidate(nums = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3]) == 0\n assert candidate(nums = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 14\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 24\n assert candidate(nums = [3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1]) == 8\n assert candidate(nums = [10, 20, 30, 40, 50, 40, 30, 20, 10, 20, 30, 40, 50, 40, 30, 20, 10]) == 66\n assert candidate(nums = [7, 10, 9, 10, 7, 10, 9, 10, 7]) == 0\n assert candidate(nums = [10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10]) == 0\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 88\n assert candidate(nums = [1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000]) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 4, 3, 2, 3, 4, 5, 4, 3, 2, 3]) == 10\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 15\n assert candidate(nums = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 44\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 5\n assert candidate(nums = [10, 1, 20, 3, 30, 5, 40, 7, 50, 9, 60, 11, 70, 13, 80, 15, 90, 17, 100, 19]) == 0\n assert candidate(nums = [3, 2, 3, 2, 3, 2, 3, 2, 3, 2]) == 0\n assert candidate(nums = [2, 10, 3, 8, 4, 7, 5, 6, 6, 5]) == 2\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7]) == 4\n assert candidate(nums = [1, 10, 1, 10, 1, 10, 1, 10, 1, 10]) == 0\n assert candidate(nums = [1, 3, 2, 2, 3, 1, 4, 3, 2, 5]) == 8\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 0\n assert candidate(nums = [1, 3, 2, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1]) == 3\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 99\n assert candidate(nums = [5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1]) == 0\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11]) == 8\n assert candidate(nums = [100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100]) == 0\n assert candidate(nums = [1, 3, 5, 3, 1, 3, 5, 3, 1]) == 6\n assert candidate(nums = [1, 9, 1, 9, 1, 9, 1, 9, 1, 9]) == 0\n assert candidate(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10]) == 10\n assert candidate(nums = [1, 3, 2, 2, 3, 1, 4, 4, 5]) == 5\n assert candidate(nums = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986]) == 14\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 7\n assert candidate(nums = [999, 1, 998, 2, 997, 3, 996, 4, 995, 5, 994, 6, 993, 7]) == 0\n assert candidate(nums = [1, 2, 3, 2, 3, 4, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(nums = [2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1]) == 6\n assert candidate(nums = [1, 3, 2, 5, 4, 7, 6]) == 0\n assert candidate(nums = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 0\n assert candidate(nums = [1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1]) == 25\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().movesToMakeZigzag", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var movesToMakeZigzag = function(nums) {", "container": null, "callable": "movesToMakeZigzag", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1145, "task_id": "binary-tree-coloring-game", "difficulty": "Medium", "problem_description": "Two players play a turn based game on a binary tree. We are given the root of this binary tree, and the number of nodes n in the tree. n is odd, and each node has a distinct value from 1 to n.\nInitially, the first player names a value x with 1 <= x <= n, and the second player names a value y with 1 <= y <= n and y != x. The first player colors the node with value x red, and the second player colors the node with value y blue.\nThen, the players take turns starting with the first player. In each turn, that player chooses a node of their color (red if player 1, blue if player 2) and colors an uncolored neighbor of the chosen node (either the left child, right child, or parent of the chosen node.)\nIf (and only if) a player cannot choose such a node in this way, they must pass their turn. If both players pass their turn, the game ends, and the winner is the player that colored more nodes.\nYou are the second player. If it is possible to choose such a y to ensure you win the game, return true. If it is not possible, return false.\n \nExample 1:\n\n\nInput: root = [1,2,3,4,5,6,7,8,9,10,11], n = 11, x = 3\nOutput: true\nExplanation: The second player can choose the node with value 2.\n\nExample 2:\n\nInput: root = [1,2,3], n = 3, x = 1\nOutput: false\n\n \nConstraints:\n\nThe number of nodes in the tree is n.\n1 <= x <= n <= 100\nn is odd.\n1 <= Node.val <= n\nAll the values of the tree are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]),n = 25,x = 13) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5]),n = 5,x = 2) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6]),n = 6,x = 4) == True\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, 6]),n = 7,x = 5) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]),n = 11,x = 3) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),n = 7,x = 5) == True\n assert candidate(root = tree_node([1, 2, 3]),n = 3,x = 1) == False\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10]),n = 10,x = 5) == False\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5]),n = 5,x = 1) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]),n = 31,x = 16) == True\n assert candidate(root = tree_node([4, 2, 7, 1, 3, 6, 9]),n = 7,x = 4) == False\n assert candidate(root = tree_node([6, 3, 8, 2, 4, 7, 9, 1, 5, None, None, None, None, None, None]),n = 9,x = 6) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9]),n = 9,x = 4) == True\n assert candidate(root = tree_node([3, 1, 5, 0, 2, 4, 6]),n = 7,x = 3) == False\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),n = 7,x = 4) == True\n assert candidate(root = tree_node([5, 3, 6, 2, 4, None, None, 1]),n = 7,x = 3) == False\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15]),n = 15,x = 7) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7]),n = 7,x = 2) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),n = 15,x = 8) == True\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),n = 15,x = 7) == True\n"}, "metadata": {"canonical_parameter_names": ["root", "n", "x"], "leetcode_dataset_entry_point": "Solution().btreeGameWinningMove", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var btreeGameWinningMove = function(root, n, x) {", "container": null, "callable": "btreeGameWinningMove", "parameters": [{"name": "root", "type": "TreeNode"}, {"name": "n", "type": "number"}, {"name": "x", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1147, "task_id": "longest-chunked-palindrome-decomposition", "difficulty": "Hard", "problem_description": "You are given a string text. You should split it to k substrings (subtext1, subtext2, ..., subtextk) such that:\n\nsubtexti is a non-empty string.\nThe concatenation of all the substrings is equal to text (i.e., subtext1 + subtext2 + ... + subtextk == text).\nsubtexti == subtextk - i + 1 for all valid values of i (i.e., 1 <= i <= k).\n\nReturn the largest possible value of k.\n \nExample 1:\n\nInput: text = \"ghiabcdefhelloadamhelloabcdefghi\"\nOutput: 7\nExplanation: We can split the string on \"(ghi)(abcdef)(hello)(adam)(hello)(abcdef)(ghi)\".\n\nExample 2:\n\nInput: text = \"merchant\"\nOutput: 1\nExplanation: We can split the string on \"(merchant)\".\n\nExample 3:\n\nInput: text = \"antaprezatepzapreanta\"\nOutput: 11\nExplanation: We can split the string on \"(a)(nt)(a)(pre)(za)(tep)(za)(pre)(a)(nt)(a)\".\n\n \nConstraints:\n\n1 <= text.length <= 1000\ntext consists only of lowercase English characters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(text = \"abcabc\") == 2\n assert candidate(text = \"abcabcabc\") == 3\n assert candidate(text = \"level\") == 5\n assert candidate(text = \"zyxzyxzyx\") == 3\n assert candidate(text = \"madam\") == 5\n assert candidate(text = \"aaaaa\") == 5\n assert candidate(text = \"merchant\") == 1\n assert candidate(text = \"aabbccddeedccbbaa\") == 15\n assert candidate(text = \"repaper\") == 7\n assert candidate(text = \"ghiabcdefhelloadamhelloabcdefghi\") == 7\n assert candidate(text = \"aaa\") == 3\n assert candidate(text = \"antaprezatepzapreanta\") == 11\n assert candidate(text = \"abcdabcdabcdabcd\") == 4\n assert candidate(text = \"abacaba\") == 7\n assert candidate(text = \"abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\") == 52\n assert candidate(text = \"xyzzyx\") == 6\n assert candidate(text = \"abcddcba\") == 8\n assert candidate(text = \"rotor\") == 5\n assert candidate(text = \"abcdedcba\") == 9\n assert candidate(text = \"refer\") == 5\n assert candidate(text = \"redder\") == 6\n assert candidate(text = \"peep\") == 4\n assert candidate(text = \"abba\") == 4\n assert candidate(text = \"racecar\") == 7\n assert candidate(text = \"civic\") == 5\n assert candidate(text = \"abcdabcd\") == 2\n assert candidate(text = \"a\") == 1\n assert candidate(text = \"abcabcabcabcabcabc\") == 6\n assert candidate(text = \"xyzzyxxyzzyx\") == 12\n assert candidate(text = \"noon\") == 4\n assert candidate(text = \"deified\") == 7\n assert candidate(text = \"racecarlevelracecar\") == 19\n assert candidate(text = \"deed\") == 4\n assert candidate(text = \"abccba\") == 6\n assert candidate(text = \"abab\") == 2\n assert candidate(text = \"aabbccddeeddccbbaa\") == 18\n assert candidate(text = \"abcba\") == 5\n assert candidate(text = \"abcdeedcba\") == 10\n assert candidate(text = \"levellevel\") == 10\n assert candidate(text = \"ababababab\") == 5\n assert candidate(text = \"bananaananabayananabanana\") == 13\n assert candidate(text = \"abcdabcabcabcabcd\") == 5\n assert candidate(text = \"racecarannakayakracecar\") == 15\n assert candidate(text = \"abcabcabcabcabcabcabc\") == 7\n assert candidate(text = \"xxyyxxyyxyyxxyyxxyy\") == 5\n assert candidate(text = \"xylophonephoneyloxyxylophonephoneyloxy\") == 10\n assert candidate(text = \"leveloneleveltwolevelonelevel\") == 23\n assert candidate(text = \"aaaaabaaaabaaaa\") == 13\n assert candidate(text = \"abacababacaba\") == 13\n assert candidate(text = \"rotorcarrot\") == 3\n assert candidate(text = \"leveloneonetwothreefourthreefourtwoonelevel\") == 15\n assert candidate(text = \"aaaaabaaaabaaaaaaaabaaaaabaaaabaaaa\") == 27\n assert candidate(text = \"noonnoonnoonnoonnoonnoon\") == 24\n assert candidate(text = \"annakayakannakayakannakayakannakayakannakayak\") == 5\n assert candidate(text = \"abcdefghihgfedcbaabcdefghihgfedcba\") == 34\n assert candidate(text = \"abcdefgfedcbaabcdefgfedcbaabcdefgfedcba\") == 39\n assert candidate(text = \"abacabaabacaba\") == 14\n assert candidate(text = \"qwertyuiopasdfghjklzxcvbnmmnbvcxzlkjhgfdsapoiuytrewq\") == 52\n assert candidate(text = \"madamimadamimadam\") == 17\n assert candidate(text = \"kayak\") == 5\n assert candidate(text = \"thisisaverylongstringwhichdoesnotrepeatthisisaverylongstring\") == 3\n assert candidate(text = \"deifiedrotorcarcaretordeified\") == 21\n assert candidate(text = \"madamimadamimadamimadamimadam\") == 29\n assert candidate(text = \"noonnoonnoonnoonnoonnoonnoonnoon\") == 32\n assert candidate(text = \"deifiedrotordeified\") == 19\n assert candidate(text = \"noonracecarnoon\") == 15\n assert candidate(text = \"madamimadam\") == 11\n assert candidate(text = \"repaperdeified\") == 1\n assert candidate(text = \"deededeed\") == 9\n assert candidate(text = \"ananaananaananananananananananana\") == 15\n assert candidate(text = \"racecarlevelracecarlevelracecarlevel\") == 3\n assert candidate(text = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\") == 18\n assert candidate(text = \"racecarlevelmadamracecar\") == 15\n assert candidate(text = \"leveloneonelevel\") == 12\n assert candidate(text = \"xyzyxzyzyxzyzyxzyx\") == 15\n assert candidate(text = \"abcdefghihgfedcba\") == 17\n assert candidate(text = \"abbaabbaabbaabbaabba\") == 20\n assert candidate(text = \"abacabaabacabaabacaba\") == 21\n assert candidate(text = \"abcdabcdeedcbadcbabcd\") == 3\n assert candidate(text = \"abccbaabccba\") == 12\n assert candidate(text = \"abracadabra\") == 7\n assert candidate(text = \"madammadam\") == 10\n assert candidate(text = \"aaaaaaaaabbbbbbbbbbbbbbbccccccccccccccccccccdd\") == 1\n assert candidate(text = \"deifiedrotorleveldeified\") == 15\n assert candidate(text = \"racecarlevelracecarlevelracecarlevelracecarlevel\") == 4\n assert candidate(text = \"madaminnadammadam\") == 11\n assert candidate(text = \"leveldeifiedmadamdeifiedlevel\") == 29\n assert candidate(text = \"abacabacabacabac\") == 4\n assert candidate(text = \"aaaabbbbccccaaaabbbbcccc\") == 2\n assert candidate(text = \"noonnoonnoon\") == 12\n assert candidate(text = \"xyzyxzyzyxzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyxzyzyx\") == 33\n assert candidate(text = \"abcdefgabcdefgabcdefg\") == 3\n assert candidate(text = \"abracadabraabracadabra\") == 14\n assert candidate(text = \"civiccivic\") == 10\n assert candidate(text = \"annakayakannakayakannakayakannakayakannakayakannakayakannakayak\") == 7\n assert candidate(text = \"rotorcarrots\") == 1\n assert candidate(text = \"abracadabraacarab\") == 11\n assert candidate(text = \"kayakkayakkayak\") == 15\n assert candidate(text = \"nun\") == 3\n assert candidate(text = \"annakayakannakayakannakayak\") == 3\n assert candidate(text = \"rotorlevelrotor\") == 15\n assert candidate(text = \"qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm\") == 2\n assert candidate(text = \"aabbccddeeddccbaa\") == 7\n assert candidate(text = \"abbaabbaabba\") == 12\n assert candidate(text = \"xyzxyzxyzxyzxyzxyzxyzxyz\") == 8\n assert candidate(text = \"levellevellevellevel\") == 20\n assert candidate(text = \"abccbaabccbaabccba\") == 18\n assert candidate(text = \"abcdeedcbaabcdeedcbaabcdeedcba\") == 30\n assert candidate(text = \"abcdefgfedcbaabcdefg\") == 3\n assert candidate(text = \"levelmadamlevel\") == 15\n assert candidate(text = \"abcabcabcabc\") == 4\n assert candidate(text = \"abacabadabacabaabacabadabacaba\") == 30\n assert candidate(text = \"rotorcarcaretor\") == 7\n assert candidate(text = \"annakayakannakayakannakayakannakayak\") == 4\n assert candidate(text = \"levellevellevellevellevellevellevellevellevellevellevellevel\") == 60\n assert candidate(text = \"levellevellevellevellevellevel\") == 30\n assert candidate(text = \"aaaaabbbbbaaaabbbbbaaaaa\") == 24\n assert candidate(text = \"abcdabcabcabcd\") == 4\n assert candidate(text = \"aaaabbbbccccbbbbaaaa\") == 20\n assert candidate(text = \"madamimadamimadamimadamimadamimadamimadamimadam\") == 47\n assert candidate(text = \"abcdxyzyxzyxcddcbaabcdxyzyxzyxcddcba\") == 18\n assert candidate(text = \"abacabadabacabadabacaba\") == 23\n assert candidate(text = \"deifieddeified\") == 14\n assert candidate(text = \"deifiedracecardeified\") == 21\n assert candidate(text = \"noonnoonnoonnoon\") == 16\n assert candidate(text = \"radar\") == 5\n assert candidate(text = \"abacabadabacaba\") == 15\n assert candidate(text = \"annakayakannakayak\") == 2\n assert candidate(text = \"abcdabcdefgabcdefgdcba\") == 10\n assert candidate(text = \"racecarannakayak\") == 1\n assert candidate(text = \"abbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabba\") == 44\n assert candidate(text = \"abacabadabacabad\") == 2\n assert candidate(text = \"rotorrotor\") == 10\n assert candidate(text = \"abcabcabcabcabc\") == 5\n assert candidate(text = \"abracadabracadabra\") == 11\n assert candidate(text = \"levellevellevellevellevel\") == 25\n assert candidate(text = \"aaaaaabaaaaa\") == 11\n assert candidate(text = \"aabbccddeedcbaabbccdd\") == 3\n assert candidate(text = \"hellohellobellohellobellohello\") == 4\n assert candidate(text = \"xyzzxyzzxyzz\") == 3\n assert candidate(text = \"xxyyzzzyyxxyyyzzzzyyxx\") == 15\n assert candidate(text = \"aabbccddeeeedddccbbaaa\") == 5\n assert candidate(text = \"deifiedrotor\") == 1\n assert candidate(text = \"abcdeedcbaabcdeedcba\") == 20\n assert candidate(text = \"abababababababab\") == 8\n assert candidate(text = \"abacabaabacabaabacabaabacaba\") == 28\n assert candidate(text = \"aaaabbbbccccddddeeeeffffeeeeggggccccbbbbaaaaffff\") == 1\n assert candidate(text = \"wow\") == 3\n assert candidate(text = \"abcdabccbaabcd\") == 8\n assert candidate(text = \"abcabcabcabcabcabcabcd\") == 1\n assert candidate(text = \"abcxyzzyxcba\") == 12\n assert candidate(text = \"racecarlevelracecarlevelracecarlevelracecarlevelracecarlevel\") == 5\n assert candidate(text = \"madamimadamimadamimadamimadamimadam\") == 35\n assert candidate(text = \"noonabbadacabbaaddaabbnoon\") == 15\n assert candidate(text = \"xyzzyxzyxzyxzyxzyxzyxzyxyz\") == 15\n assert candidate(text = \"levellevellevellevellevellevellevellevel\") == 40\n assert candidate(text = \"abababababababababababab\") == 12\n assert candidate(text = \"mississippiississimississimississippi\") == 17\n assert candidate(text = \"aabbccddeedcba\") == 3\n assert candidate(text = \"xyzyxzyzyxzyx\") == 11\n assert candidate(text = \"aaaaabaaa\") == 7\n assert candidate(text = \"abcdcdeabcdcdeabcdcdeabcd\") == 7\n assert candidate(text = \"racecarracecar\") == 14\n assert candidate(text = \"rotorrotorrotor\") == 15\n assert candidate(text = \"racecarlevelracecarlevel\") == 2\n assert candidate(text = \"kayakkayak\") == 10\n assert candidate(text = \"noonnoon\") == 8\n assert candidate(text = \"racecarlevelmadamracecarlevelmadam\") == 2\n assert candidate(text = \"abcxyzzyxcbaabcxyzzyxcba\") == 24\n assert candidate(text = \"redividerrotorredivider\") == 23\n assert candidate(text = \"ababababababababababababababababab\") == 17\n assert candidate(text = \"referrefer\") == 10\n assert candidate(text = \"noonnoonnoonnoonnoonnoonnoonnoonnoonnoon\") == 40\n assert candidate(text = \"madamimadamimadamimadam\") == 23\n assert candidate(text = \"abbaabbaabbaabba\") == 16\n assert candidate(text = \"mississippi\") == 1\n assert candidate(text = \"aabbccddeedccbbaaa\") == 5\n assert candidate(text = \"abcdeabcdeabcde\") == 3\n assert candidate(text = \"racecarracecarracecar\") == 21\n assert candidate(text = \"redivider\") == 9\n assert candidate(text = \"thisisaverylongstringwithnorepeatedpattern\") == 1\n"}, "metadata": {"canonical_parameter_names": ["text"], "leetcode_dataset_entry_point": "Solution().longestDecomposition", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var longestDecomposition = function(text) {", "container": null, "callable": "longestDecomposition", "parameters": [{"name": "text", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1154, "task_id": "day-of-the-year", "difficulty": "Easy", "problem_description": "Given a string date representing a Gregorian calendar date formatted as YYYY-MM-DD, return the day number of the year.\n \nExample 1:\n\nInput: date = \"2019-01-09\"\nOutput: 9\nExplanation: Given date is the 9th day of the year in 2019.\n\nExample 2:\n\nInput: date = \"2019-02-10\"\nOutput: 41\n\n \nConstraints:\n\ndate.length == 10\ndate[4] == date[7] == '-', and all other date[i]'s are digits\ndate represents a calendar date between Jan 1st, 1900 and Dec 31st, 2019.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(date = \"2017-03-01\") == 60\n assert candidate(date = \"2019-01-09\") == 9\n assert candidate(date = \"1900-02-28\") == 59\n assert candidate(date = \"2000-03-01\") == 61\n assert candidate(date = \"2018-08-20\") == 232\n assert candidate(date = \"2019-06-30\") == 181\n assert candidate(date = \"1900-12-31\") == 365\n assert candidate(date = \"2019-06-15\") == 166\n assert candidate(date = \"2019-02-10\") == 41\n assert candidate(date = \"1901-01-01\") == 1\n assert candidate(date = \"2000-02-29\") == 60\n assert candidate(date = \"2019-11-15\") == 319\n assert candidate(date = \"2019-05-25\") == 145\n assert candidate(date = \"2019-12-31\") == 365\n assert candidate(date = \"2016-03-01\") == 61\n assert candidate(date = \"2021-01-01\") == 1\n assert candidate(date = \"2018-08-22\") == 234\n assert candidate(date = \"2020-02-29\") == 60\n assert candidate(date = \"1900-01-01\") == 1\n assert candidate(date = \"2016-02-29\") == 60\n assert candidate(date = \"2019-07-17\") == 198\n assert candidate(date = \"1999-02-28\") == 59\n assert candidate(date = \"2019-12-15\") == 349\n assert candidate(date = \"2019-09-05\") == 248\n assert candidate(date = \"2019-06-21\") == 172\n assert candidate(date = \"2023-02-28\") == 59\n assert candidate(date = \"2020-12-31\") == 366\n assert candidate(date = \"2018-06-30\") == 181\n assert candidate(date = \"2019-09-30\") == 273\n assert candidate(date = \"2019-07-25\") == 206\n assert candidate(date = \"2023-01-01\") == 1\n assert candidate(date = \"2019-10-15\") == 288\n assert candidate(date = \"2019-08-15\") == 227\n assert candidate(date = \"2004-02-29\") == 60\n assert candidate(date = \"2018-03-15\") == 74\n assert candidate(date = \"2019-03-01\") == 60\n assert candidate(date = \"2019-07-18\") == 199\n assert candidate(date = \"2019-12-19\") == 353\n assert candidate(date = \"2019-03-20\") == 79\n assert candidate(date = \"2021-12-31\") == 365\n assert candidate(date = \"1996-06-30\") == 182\n assert candidate(date = \"2019-08-05\") == 217\n assert candidate(date = \"2019-06-25\") == 176\n assert candidate(date = \"1900-03-01\") == 60\n assert candidate(date = \"2019-12-20\") == 354\n assert candidate(date = \"2018-03-01\") == 60\n assert candidate(date = \"2024-02-29\") == 60\n assert candidate(date = \"2019-12-05\") == 339\n assert candidate(date = \"2019-06-05\") == 156\n assert candidate(date = \"2001-02-28\") == 59\n assert candidate(date = \"2017-04-30\") == 120\n assert candidate(date = \"2018-02-28\") == 59\n assert candidate(date = \"2019-01-01\") == 1\n assert candidate(date = \"2017-01-01\") == 1\n assert candidate(date = \"2019-05-31\") == 151\n assert candidate(date = \"2016-12-31\") == 366\n assert candidate(date = \"2019-10-10\") == 283\n assert candidate(date = \"2012-06-17\") == 169\n assert candidate(date = \"2024-06-30\") == 182\n assert candidate(date = \"2000-02-28\") == 59\n assert candidate(date = \"2019-04-25\") == 115\n assert candidate(date = \"2004-03-01\") == 61\n assert candidate(date = \"2023-12-31\") == 365\n assert candidate(date = \"1987-07-04\") == 185\n assert candidate(date = \"2019-06-10\") == 161\n assert candidate(date = \"2019-10-31\") == 304\n assert candidate(date = \"2019-08-10\") == 222\n assert candidate(date = \"2019-01-31\") == 31\n assert candidate(date = \"2019-12-30\") == 364\n assert candidate(date = \"2018-07-24\") == 205\n assert candidate(date = \"2020-01-01\") == 1\n assert candidate(date = \"2019-07-10\") == 191\n assert candidate(date = \"2019-02-28\") == 59\n assert candidate(date = \"2019-08-22\") == 234\n assert candidate(date = \"2023-03-01\") == 60\n assert candidate(date = \"2019-11-10\") == 314\n assert candidate(date = \"2021-11-11\") == 315\n assert candidate(date = \"2024-02-28\") == 59\n assert candidate(date = \"2021-03-01\") == 60\n assert candidate(date = \"2019-10-05\") == 278\n assert candidate(date = \"1955-10-31\") == 304\n assert candidate(date = \"2020-02-28\") == 59\n assert candidate(date = \"2019-12-01\") == 335\n assert candidate(date = \"2019-05-15\") == 135\n assert candidate(date = \"1899-12-31\") == 365\n assert candidate(date = \"2000-01-01\") == 1\n assert candidate(date = \"2100-02-28\") == 59\n assert candidate(date = \"1904-02-28\") == 59\n assert candidate(date = \"2019-03-30\") == 89\n assert candidate(date = \"1999-12-31\") == 365\n assert candidate(date = \"2019-11-30\") == 334\n assert candidate(date = \"2012-02-29\") == 60\n assert candidate(date = \"2019-07-15\") == 196\n assert candidate(date = \"2019-04-30\") == 120\n assert candidate(date = \"2019-08-31\") == 243\n assert candidate(date = \"1904-12-31\") == 366\n assert candidate(date = \"2020-07-15\") == 197\n assert candidate(date = \"2019-09-27\") == 270\n assert candidate(date = \"2019-01-02\") == 2\n assert candidate(date = \"1916-04-15\") == 106\n assert candidate(date = \"2019-03-31\") == 90\n assert candidate(date = \"2024-03-01\") == 61\n assert candidate(date = \"2019-05-20\") == 140\n assert candidate(date = \"2018-08-31\") == 243\n assert candidate(date = \"1904-02-29\") == 60\n assert candidate(date = \"2019-04-01\") == 91\n assert candidate(date = \"2019-11-20\") == 324\n assert candidate(date = \"2019-09-15\") == 258\n assert candidate(date = \"2019-10-12\") == 285\n assert candidate(date = \"2019-09-10\") == 253\n assert candidate(date = \"2019-12-25\") == 359\n assert candidate(date = \"2019-11-01\") == 305\n assert candidate(date = \"2019-08-09\") == 221\n assert candidate(date = \"2019-03-25\") == 84\n assert candidate(date = \"2020-03-01\") == 61\n assert candidate(date = \"2019-12-10\") == 344\n assert candidate(date = \"2019-11-05\") == 309\n assert candidate(date = \"2019-07-31\") == 212\n assert candidate(date = \"2019-11-08\") == 312\n"}, "metadata": {"canonical_parameter_names": ["date"], "leetcode_dataset_entry_point": "Solution().dayOfYear", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var dayOfYear = function(date) {", "container": null, "callable": "dayOfYear", "parameters": [{"name": "date", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1155, "task_id": "number-of-dice-rolls-with-target-sum", "difficulty": "Medium", "problem_description": "You have n dice, and each dice has k faces numbered from 1 to k.\nGiven three integers n, k, and target, return the number of possible ways (out of the kn total ways) to roll the dice, so the sum of the face-up numbers equals target. Since the answer may be too large, return it modulo 109 + 7.\n \nExample 1:\n\nInput: n = 1, k = 6, target = 3\nOutput: 1\nExplanation: You throw one die with 6 faces.\nThere is only one way to get a sum of 3.\n\nExample 2:\n\nInput: n = 2, k = 6, target = 7\nOutput: 6\nExplanation: You throw two dice, each with 6 faces.\nThere are 6 ways to get a sum of 7: 1+6, 2+5, 3+4, 4+3, 5+2, 6+1.\n\nExample 3:\n\nInput: n = 30, k = 30, target = 500\nOutput: 222616187\nExplanation: The answer must be returned modulo 109 + 7.\n\n \nConstraints:\n\n1 <= n, k <= 30\n1 <= target <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 15,k = 10,target = 100) == 794915145\n assert candidate(n = 4,k = 6,target = 12) == 125\n assert candidate(n = 30,k = 30,target = 500) == 222616187\n assert candidate(n = 2,k = 6,target = 7) == 6\n assert candidate(n = 10,k = 5,target = 30) == 856945\n assert candidate(n = 3,k = 4,target = 8) == 12\n assert candidate(n = 3,k = 2,target = 5) == 3\n assert candidate(n = 5,k = 4,target = 10) == 101\n assert candidate(n = 1,k = 6,target = 3) == 1\n assert candidate(n = 2,k = 2,target = 3) == 2\n assert candidate(n = 15,k = 4,target = 40) == 83372562\n assert candidate(n = 10,k = 10,target = 50) == 374894389\n assert candidate(n = 5,k = 5,target = 10) == 121\n assert candidate(n = 5,k = 10,target = 15) == 996\n assert candidate(n = 3,k = 2,target = 4) == 3\n assert candidate(n = 25,k = 20,target = 400) == 239696222\n assert candidate(n = 10,k = 5,target = 25) == 473694\n assert candidate(n = 18,k = 8,target = 100) == 428096078\n assert candidate(n = 26,k = 10,target = 130) == 900662957\n assert candidate(n = 28,k = 20,target = 250) == 754162082\n assert candidate(n = 30,k = 30,target = 800) == 740208408\n assert candidate(n = 29,k = 13,target = 385) == 0\n assert candidate(n = 15,k = 5,target = 60) == 49360405\n assert candidate(n = 27,k = 18,target = 380) == 570408071\n assert candidate(n = 27,k = 11,target = 243) == 976265632\n assert candidate(n = 14,k = 7,target = 98) == 1\n assert candidate(n = 12,k = 15,target = 120) == 545528539\n assert candidate(n = 25,k = 6,target = 100) == 165343714\n assert candidate(n = 19,k = 14,target = 260) == 134596\n assert candidate(n = 15,k = 8,target = 120) == 1\n assert candidate(n = 30,k = 5,target = 125) == 699555125\n assert candidate(n = 30,k = 12,target = 200) == 740079054\n assert candidate(n = 25,k = 10,target = 150) == 166392150\n assert candidate(n = 26,k = 12,target = 200) == 768259128\n assert candidate(n = 17,k = 9,target = 145) == 735471\n assert candidate(n = 22,k = 14,target = 280) == 879336869\n assert candidate(n = 27,k = 11,target = 220) == 441656611\n assert candidate(n = 30,k = 10,target = 150) == 793899040\n assert candidate(n = 16,k = 11,target = 105) == 811426869\n assert candidate(n = 30,k = 10,target = 250) == 128709914\n assert candidate(n = 22,k = 9,target = 180) == 44386487\n assert candidate(n = 28,k = 15,target = 350) == 471189138\n assert candidate(n = 15,k = 10,target = 150) == 1\n assert candidate(n = 30,k = 5,target = 90) == 337060208\n assert candidate(n = 18,k = 10,target = 150) == 182972231\n assert candidate(n = 29,k = 25,target = 400) == 266275143\n assert candidate(n = 30,k = 6,target = 150) == 37027173\n assert candidate(n = 24,k = 9,target = 155) == 405028518\n assert candidate(n = 18,k = 7,target = 120) == 100947\n assert candidate(n = 22,k = 7,target = 120) == 404679730\n assert candidate(n = 18,k = 8,target = 120) == 747503719\n assert candidate(n = 24,k = 14,target = 160) == 26411763\n assert candidate(n = 20,k = 15,target = 250) == 504797596\n assert candidate(n = 30,k = 6,target = 100) == 449826955\n assert candidate(n = 24,k = 15,target = 300) == 688942594\n assert candidate(n = 27,k = 11,target = 170) == 11802847\n assert candidate(n = 19,k = 9,target = 125) == 406671426\n assert candidate(n = 12,k = 7,target = 84) == 1\n assert candidate(n = 20,k = 20,target = 200) == 270319085\n assert candidate(n = 10,k = 15,target = 150) == 1\n assert candidate(n = 26,k = 9,target = 180) == 843161626\n assert candidate(n = 16,k = 6,target = 80) == 248705155\n assert candidate(n = 12,k = 3,target = 30) == 8074\n assert candidate(n = 18,k = 8,target = 150) == 0\n assert candidate(n = 22,k = 10,target = 155) == 612108463\n assert candidate(n = 22,k = 15,target = 180) == 215154082\n assert candidate(n = 28,k = 12,target = 200) == 507319147\n assert candidate(n = 20,k = 8,target = 100) == 891516101\n assert candidate(n = 28,k = 9,target = 252) == 1\n assert candidate(n = 20,k = 8,target = 160) == 1\n assert candidate(n = 20,k = 20,target = 350) == 690236765\n assert candidate(n = 25,k = 12,target = 150) == 800893074\n assert candidate(n = 12,k = 12,target = 75) == 6445237\n assert candidate(n = 30,k = 12,target = 360) == 1\n assert candidate(n = 19,k = 13,target = 221) == 611881535\n assert candidate(n = 20,k = 20,target = 400) == 1\n assert candidate(n = 28,k = 6,target = 100) == 333372447\n assert candidate(n = 14,k = 7,target = 90) == 203294\n assert candidate(n = 25,k = 6,target = 120) == 253411631\n assert candidate(n = 18,k = 6,target = 100) == 1078497\n assert candidate(n = 16,k = 7,target = 80) == 150185177\n assert candidate(n = 29,k = 7,target = 195) == 30259499\n assert candidate(n = 27,k = 30,target = 800) == 254186856\n assert candidate(n = 19,k = 25,target = 450) == 359043931\n assert candidate(n = 20,k = 10,target = 150) == 366736536\n assert candidate(n = 28,k = 12,target = 250) == 782356560\n assert candidate(n = 30,k = 25,target = 750) == 1\n assert candidate(n = 12,k = 7,target = 85) == 0\n assert candidate(n = 30,k = 25,target = 400) == 656098604\n assert candidate(n = 22,k = 9,target = 175) == 592474733\n assert candidate(n = 22,k = 8,target = 160) == 781347627\n assert candidate(n = 28,k = 18,target = 450) == 94890353\n assert candidate(n = 20,k = 15,target = 350) == 0\n assert candidate(n = 24,k = 18,target = 360) == 517019157\n assert candidate(n = 18,k = 12,target = 250) == 0\n assert candidate(n = 22,k = 15,target = 170) == 332380631\n assert candidate(n = 14,k = 20,target = 180) == 267746915\n assert candidate(n = 22,k = 6,target = 132) == 1\n assert candidate(n = 27,k = 18,target = 350) == 91344166\n assert candidate(n = 12,k = 12,target = 100) == 201258020\n assert candidate(n = 17,k = 9,target = 130) == 241842734\n assert candidate(n = 25,k = 15,target = 300) == 861212713\n assert candidate(n = 18,k = 7,target = 90) == 183069607\n assert candidate(n = 25,k = 20,target = 300) == 161591689\n assert candidate(n = 20,k = 10,target = 180) == 522663924\n assert candidate(n = 28,k = 15,target = 300) == 813819263\n assert candidate(n = 22,k = 7,target = 130) == 712806895\n assert candidate(n = 30,k = 20,target = 500) == 541650286\n"}, "metadata": {"canonical_parameter_names": ["n", "k", "target"], "leetcode_dataset_entry_point": "Solution().numRollsToTarget", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numRollsToTarget = function(n, k, target) {", "container": null, "callable": "numRollsToTarget", "parameters": [{"name": "n", "type": "number"}, {"name": "k", "type": "number"}, {"name": "target", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1156, "task_id": "swap-for-longest-repeated-character-substring", "difficulty": "Medium", "problem_description": "You are given a string text. You can swap two of the characters in the text.\nReturn the length of the longest substring with repeated characters.\n \nExample 1:\n\nInput: text = \"ababa\"\nOutput: 3\nExplanation: We can swap the first 'b' with the last 'a', or the last 'b' with the first 'a'. Then, the longest repeated character substring is \"aaa\" with length 3.\n\nExample 2:\n\nInput: text = \"aaabaaa\"\nOutput: 6\nExplanation: Swap 'b' with the last 'a' (or the first 'a'), and we get longest repeated character substring \"aaaaaa\" with length 6.\n\nExample 3:\n\nInput: text = \"aaaaa\"\nOutput: 5\nExplanation: No need to swap, longest repeated character substring is \"aaaaa\" with length is 5.\n\n \nConstraints:\n\n1 <= text.length <= 2 * 104\ntext consist of lowercase English characters only.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(text = \"ababababab\") == 3\n assert candidate(text = \"abababababababab\") == 3\n assert candidate(text = \"ababa\") == 3\n assert candidate(text = \"aaaaa\") == 5\n assert candidate(text = \"zzzzzzzzzz\") == 10\n assert candidate(text = \"aabbccddeeffgg\") == 2\n assert candidate(text = \"aabbccdd\") == 2\n assert candidate(text = \"abacabadabacaba\") == 3\n assert candidate(text = \"abbcccddddeeefffggghhh\") == 4\n assert candidate(text = \"zzzxxzzz\") == 4\n assert candidate(text = \"aabbaa\") == 3\n assert candidate(text = \"ababababababababababababababababababababababababababababababababababababababababababababababababababab\") == 3\n assert candidate(text = \"abcdefgabcdefgabcdefg\") == 2\n assert candidate(text = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == 106\n assert candidate(text = \"abcdabcabc\") == 2\n assert candidate(text = \"abbcccddddeee\") == 4\n assert candidate(text = \"zzzzzzzzzzzzzzzzzzzz\") == 20\n assert candidate(text = \"aabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccdd\") == 3\n assert candidate(text = \"ababcababcab\") == 3\n assert candidate(text = \"aabbccddeeffgghhii\") == 2\n assert candidate(text = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == 2\n assert candidate(text = \"aaabaaa\") == 6\n assert candidate(text = \"aabacaaa\") == 5\n assert candidate(text = \"abcdefgabcdefg\") == 2\n assert candidate(text = \"abcde\") == 1\n assert candidate(text = \"aaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabbaaab\") == 4\n assert candidate(text = \"zyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba\") == 2\n assert candidate(text = \"aabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccdd\") == 3\n assert candidate(text = \"aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnoooo\") == 4\n assert candidate(text = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\") == 2\n assert candidate(text = \"abababababababababababababab\") == 3\n assert candidate(text = \"abacabadabacabadabacabadabacabadabacabadabacabadabacabadabacabadabacabadabacabadabacabadabacabadaba\") == 3\n assert candidate(text = \"aabbccccaaaabbccccaaaabbccccaaaabbccccaaaabbccccaaaabbccccaaaabbccccaaaabbccccaaaabbccccaaaa\") == 5\n assert candidate(text = \"abacabadabacab\") == 3\n assert candidate(text = \"aabbccccddddddaaaabbbcccc\") == 6\n assert candidate(text = \"abracadabraabracadabraabracadabra\") == 3\n assert candidate(text = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == 2\n assert candidate(text = \"aaaaaaaaaabbbbbbbbbbccccccccccddddddddddaaaaaaaaaabbbbbbbbbbccccccccccddddddddddaaaaaaaaaabbbbbbbbbb\") == 11\n assert candidate(text = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzyxwvuutsrqponmlkjihgfedcba\") == 3\n assert candidate(text = \"abababababababababababababababababababababababababababababababababababababababababababababab\") == 3\n assert candidate(text = \"xyzyxyzyxyzyzyzyzyzyzyzyzyzyzyzyzyzyzyz\") == 3\n assert candidate(text = \"aaaaabbbbbbccccccdddddeeeeeffffffffgggggghhhhhhiiiiiiijjjjjjkkkkkkklllllllmmmmmmmnnnnnnnooooooo\") == 8\n assert candidate(text = \"aabccbaabbccbaabbccbaabbccbaabbccbaabbccbaabbccbaabbccbaabbccbaabbccbaabbccbaabbccbaabbccba\") == 3\n assert candidate(text = \"aabbaabbaaabbbaabbaabbaabb\") == 4\n assert candidate(text = \"qqqqwweerrttyyuiioopplkkjjhhggffddssaazzzxxxxccvvbbnmm\") == 4\n assert candidate(text = \"aabbaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccdd\") == 3\n assert candidate(text = \"ppppooooiiiiuuuueeeeooooooooaaaaaaaaaaaaaaaaaabbbbbbbbbbbb\") == 18\n assert candidate(text = \"abccbaabccbaabccbaabccba\") == 3\n assert candidate(text = \"abcabcabcabcabcabc\") == 2\n assert candidate(text = \"abcdabcabcdabcabcdabcabcd\") == 2\n assert candidate(text = \"aabbaaabbbaaabbaabbbaa\") == 4\n assert candidate(text = \"aabbbccddddeeefffggg\") == 4\n assert candidate(text = \"aabbaaabbbaaaabbbbaaabbbbaaaabbbbaaabbbbaaaabbbbaaabbbbaaaabbbbaaabbbbaaaabbbbaaabbbbaaaabb\") == 5\n assert candidate(text = \"xyzzzzzzzzzzzzzyxzzzzzzzzzzzzzyx\") == 14\n assert candidate(text = \"abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde\") == 2\n assert candidate(text = \"abcdeedcbaedcbaedcba\") == 3\n"}, "metadata": {"canonical_parameter_names": ["text"], "leetcode_dataset_entry_point": "Solution().maxRepOpt1", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxRepOpt1 = function(text) {", "container": null, "callable": "maxRepOpt1", "parameters": [{"name": "text", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1160, "task_id": "find-words-that-can-be-formed-by-characters", "difficulty": "Easy", "problem_description": "You are given an array of strings words and a string chars.\nA string is good if it can be formed by characters from chars (each character can only be used once).\nReturn the sum of lengths of all good strings in words.\n \nExample 1:\n\nInput: words = [\"cat\",\"bt\",\"hat\",\"tree\"], chars = \"atach\"\nOutput: 6\nExplanation: The strings that can be formed are \"cat\" and \"hat\" so the answer is 3 + 3 = 6.\n\nExample 2:\n\nInput: words = [\"hello\",\"world\",\"leetcode\"], chars = \"welldonehoneyr\"\nOutput: 10\nExplanation: The strings that can be formed are \"hello\" and \"world\" so the answer is 5 + 5 = 10.\n\n \nConstraints:\n\n1 <= words.length <= 1000\n1 <= words[i].length, chars.length <= 100\nwords[i] and chars consist of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['abcd', 'ab', 'bc', 'cd'],chars = \"abcd\") == 10\n assert candidate(words = ['cat', 'bt', 'hat', 'tree'],chars = \"atach\") == 6\n assert candidate(words = ['zxcvbnm', 'asdfghjkl', 'qwertyuiop'],chars = \"qwertyuiopasdfghjklzxcvbnm\") == 26\n assert candidate(words = ['abc', 'def', 'ghi'],chars = \"abcdefghi\") == 9\n assert candidate(words = ['xyz', 'zyx', 'wxy'],chars = \"xyzzyxw\") == 9\n assert candidate(words = ['apple', 'banana', 'cherry'],chars = \"abc\") == 0\n assert candidate(words = ['abc', 'abc', 'abc'],chars = \"aabbcc\") == 9\n assert candidate(words = ['test', 'case', 'word'],chars = \"tcws\") == 0\n assert candidate(words = ['a', 'b', 'c'],chars = \"abcde\") == 3\n assert candidate(words = ['a', 'b', 'c'],chars = \"abcabcabc\") == 3\n assert candidate(words = ['abcd', 'dcba', 'abcd'],chars = \"abcd\") == 12\n assert candidate(words = ['hello', 'world', 'leetcode'],chars = \"welldonehoneyr\") == 10\n assert candidate(words = ['zzz', 'yyy', 'xxx'],chars = \"zyxzyx\") == 0\n assert candidate(words = ['one', 'two', 'three'],chars = \"onetwothree\") == 11\n assert candidate(words = ['python', 'java', 'c++'],chars = \"pythjavacp\") == 4\n assert candidate(words = ['zzz', 'yyy', 'xxx'],chars = \"zyxwvutsrqponmlkjihgfedcba\") == 0\n assert candidate(words = ['a', 'b', 'c'],chars = \"abc\") == 3\n assert candidate(words = ['apple', 'apple', 'apple'],chars = \"ppale\") == 15\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa'],chars = \"aaaaa\") == 10\n assert candidate(words = ['aabbcc', 'abc', 'abc'],chars = \"aabbcc\") == 12\n assert candidate(words = ['aaa', 'bbb', 'ccc'],chars = \"aabbcc\") == 0\n assert candidate(words = ['abcd', 'efgh', 'ijkl'],chars = \"abcdefgh\") == 8\n assert candidate(words = ['aaa', 'bbb', 'ccc'],chars = \"abc\") == 0\n assert candidate(words = ['apple', 'banana', 'cherry'],chars = \"abcde\") == 0\n assert candidate(words = ['test', 'code', 'contest'],chars = \"testcode\") == 8\n assert candidate(words = ['challenge', 'python', 'code', 'fun'],chars = \"nclhpgfouitay\") == 9\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba'],chars = \"abcdefghijklmnopqrstuvwxyz\") == 52\n assert candidate(words = ['programming', 'language', 'python', 'java'],chars = \"npgmajoasrivl\") == 4\n assert candidate(words = ['', 'a', 'aa', 'aaa', 'aaaa'],chars = \"a\") == 1\n assert candidate(words = ['banana', 'ananas', 'panama', 'manana'],chars = \"anamnb\") == 0\n assert candidate(words = ['aabb', 'bbcc', 'ccdd', 'ddee', 'eeff', 'ffgg', 'gghh', 'hhiijj', 'kkll', 'mmnn', 'oorr', 'ppqq', 'sstt', 'uuvv', 'wwxx', 'yyzz'],chars = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == 66\n assert candidate(words = ['complex', 'words', 'here'],chars = \"owcpxlehre\") == 4\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'abacax'],chars = \"abcdefghijklmnopqrstuvwxyz\") == 52\n assert candidate(words = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'],chars = \"oentwfhivxsg\") == 21\n assert candidate(words = ['xxyyzz', 'yyzzxx', 'zzxxyy'],chars = \"xyzxyz\") == 18\n assert candidate(words = ['aabbccddeeff', 'aabbccddeeffgg', 'aabbccddeeffgghh', 'aabbccddeeffgghhiijj'],chars = \"aabbccddeeffgghhiijj\") == 62\n assert candidate(words = ['zzzz', 'zzz', 'zz', 'z'],chars = \"zzzzzzzzzz\") == 10\n assert candidate(words = ['xylophone', 'guitar', 'drum', 'bassoon', 'violin'],chars = \"guitardrumxyz\") == 10\n assert candidate(words = ['leetcode', 'challenge', 'contest', 'question'],chars = \"oelhctganegqisun\") == 8\n assert candidate(words = ['abacax', 'banana', 'grape'],chars = \"aaabbnagpr\") == 0\n assert candidate(words = ['ab', 'ba', 'abc', 'bca', 'acb', 'cab', 'cba', 'bac', 'bca', 'acb', 'cab', 'cba', 'bac', 'bca', 'acb', 'cab', 'cba', 'bac', 'bca', 'acb', 'cab', 'cba', 'bac', 'bca', 'acb', 'cab', 'cba', 'bac', 'bca', 'acb', 'cab', 'cba'],chars = \"abc\") == 94\n assert candidate(words = ['alibaba', 'babala', 'baliba', 'lalala'],chars = \"balibalab\") == 19\n assert candidate(words = ['aabbcc', 'bbccdd', 'aaccdd'],chars = \"aabbbccdd\") == 18\n assert candidate(words = ['abcdefghij', 'jihgfedcba', 'hgfedcb', 'fedcbghij'],chars = \"abcdefghij\") == 36\n assert candidate(words = ['aabbccddeeffgg', 'bbccddeeffgghh', 'ccddeeffgghhiijj'],chars = \"abcdefghij\") == 0\n assert candidate(words = ['algorithm', 'data', 'structure', 'binary', 'search'],chars = \"lgarithmtdastrucetubynrseahc\") == 25\n assert candidate(words = ['abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk'],chars = \"abcdefghij\") == 27\n assert candidate(words = ['abcdabcd', 'dcbaabcd', 'abcd', 'abcd'],chars = \"abcdabcd\") == 24\n assert candidate(words = ['programming', 'challenge', 'difficulty', 'algorithm'],chars = \"progaminld\") == 0\n assert candidate(words = ['aabbcc', 'aabbc', 'aabb', 'aa', 'a'],chars = \"aabbbcccc\") == 18\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba'],chars = \"abcdefghijklmnopqrstuvwxyz\") == 52\n assert candidate(words = ['multiple', 'words', 'with', 'same', 'letters'],chars = \"mlpuwihswtael\") == 16\n assert candidate(words = ['abcd', 'abcde', 'abcdef'],chars = \"abcdefg\") == 15\n assert candidate(words = ['hello', 'world', 'python', 'programming'],chars = \"helloworldpython\") == 16\n assert candidate(words = ['abc', 'abcd', 'abcde', 'abcdef', 'abcdefg'],chars = \"abcdefg\") == 25\n assert candidate(words = ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', 'zz', 'yy', 'xx'],chars = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == 58\n assert candidate(words = ['optimization', 'algorithm', 'datastructure'],chars = \"odginatrlhms\") == 9\n assert candidate(words = ['short', 'longerword', 'evenlonger', 'longestword', 'tiny'],chars = \"longestword\") == 11\n assert candidate(words = ['algorithm', 'data', 'structure'],chars = \"algorithmdstuct\") == 9\n assert candidate(words = ['aabbcc', 'abcabc', 'abacbc'],chars = \"aabbcc\") == 18\n assert candidate(words = ['aabbccddeeff', 'gghhiijjkk', 'llmmnnoopp', 'qqrrssttuu', 'vvwwxxyyzz'],chars = \"abcdefghijklmnopqrstuvwxyz\") == 0\n assert candidate(words = ['mississippi', 'tennessee', 'delaware', 'georgia', 'alabama'],chars = \"mississippitennessegeorgiaalamaba\") == 34\n assert candidate(words = ['unique', 'words', 'here'],chars = \"unewordhsere\") == 9\n assert candidate(words = ['x', 'xx', 'xxx', 'xxxx', 'xxxxx', 'xxxxxx', 'xxxxxxx', 'xxxxxxxx', 'xxxxxxxxx', 'xxxxxxxxxx'],chars = \"x\") == 1\n assert candidate(words = ['abcd', 'dcba', 'dcba', 'abcd', 'abcd'],chars = \"abcdabcdabcd\") == 20\n assert candidate(words = ['aaaaaabbbbcccc', 'bbbbbcccccc', 'cccccccc', 'ddddd'],chars = \"aabbbccccdddd\") == 0\n assert candidate(words = ['repeated', 'repeated', 'repeated', 'repeated'],chars = \"repeead\") == 0\n assert candidate(words = ['programming', 'code', 'challenge'],chars = \"mprogainlce\") == 0\n assert candidate(words = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba'],chars = \"abc\") == 18\n assert candidate(words = ['repeat', 'repear', 'preear', 'pareer'],chars = \"reapeart\") == 24\n assert candidate(words = ['unique', 'unigue', 'uneque'],chars = \"unequiq\") == 6\n assert candidate(words = ['programming', 'is', 'fun'],chars = \"gimnoprrstu\") == 2\n assert candidate(words = ['mississippi', 'mississippi', 'mississippi', 'mississippi'],chars = \"misp\") == 0\n assert candidate(words = ['abcdefg', 'bcdefga', 'cdefgab'],chars = \"abcdefg\") == 21\n assert candidate(words = ['abcdefghij', 'jihgfedcba', 'abcde', 'edcba'],chars = \"abcdefghijabcdefghij\") == 30\n assert candidate(words = ['abcd', 'dcba', 'abdc', 'dabc'],chars = \"abcd\") == 16\n assert candidate(words = ['unique', 'characters', 'only', 'here'],chars = \"uneicharstolonhyer\") == 8\n assert candidate(words = ['repeated', 'letters', 'example'],chars = \"repateledmx\") == 15\n assert candidate(words = ['programming', 'python', 'java', 'coding'],chars = \"gnimmargorpthonavajgnidoc\") == 21\n assert candidate(words = ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz'],chars = \"abcdefghijklmnopqrstuvwxyz\") == 0\n assert candidate(words = ['mississippi', 'missouri', 'mismatch', 'miss'],chars = \"mississippi\") == 15\n assert candidate(words = ['abcdefghijk', 'klmno', 'pqrstuvw', 'xyz', 'mnopqr', 'stuv', 'wxyz'],chars = \"abcdefghijklmnopqrstuvwxyz\") == 41\n assert candidate(words = ['abacax', 'banana', 'grape'],chars = \"aabacax\") == 6\n assert candidate(words = ['programming', 'python', 'java'],chars = \"pgoramythnvaj\") == 10\n assert candidate(words = ['unique', 'words', 'only', 'once'],chars = \"nuqowinco\") == 0\n assert candidate(words = ['programming', 'python', 'java', 'algorithm'],chars = \"pgmnoaahjy\") == 0\n assert candidate(words = ['aabbccddeeff', 'zzzzzzzzzz', 'yyyyyyyyyy'],chars = \"abcdefzy\") == 0\n assert candidate(words = ['aaaaaaaa', 'bbbbbbbb', 'cccccccc', 'dddddddd'],chars = \"abcd\") == 0\n assert candidate(words = ['longerword', 'evenlongerword', 'superduperlongword'],chars = \"lorenwdsupem\") == 0\n assert candidate(words = ['repeated', 'characters', 'here', 'are', 'some'],chars = \"reepeaddttcharseom\") == 19\n assert candidate(words = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'],chars = \"enifxsv\") == 7\n assert candidate(words = ['testtest', 'testtest', 'testtest'],chars = \"ttttseeeesss\") == 24\n assert candidate(words = ['abcd', 'dcba', 'efgh', 'hgfe'],chars = \"abcdefgh\") == 16\n assert candidate(words = ['qwerty', 'asdfgh', 'zxcvbn'],chars = \"qwertyasdfghzxcvbn\") == 18\n assert candidate(words = ['abacax', 'bacax', 'cax', 'ax', 'x'],chars = \"abacax\") == 17\n assert candidate(words = ['mississippi', 'babbling', 'bookkeeper'],chars = \"bmkpeorins\") == 0\n assert candidate(words = ['repeated', 'characters', 'example', 'strings', 'test'],chars = \"eeptxsa\") == 0\n assert candidate(words = ['this', 'is', 'a', 'test', 'case'],chars = \"tastciehins\") == 15\n assert candidate(words = ['banana', 'bandana', 'bandanna'],chars = \"bandanabandana\") == 21\n assert candidate(words = ['encyclopedia', 'dictionary', 'thesaurus'],chars = \"ctheosuraind\") == 0\n assert candidate(words = ['longword', 'another', 'wordset'],chars = \"longanotwrheds\") == 22\n assert candidate(words = ['repeated', 'characters', 'in', 'strings'],chars = \"repachint\") == 2\n assert candidate(words = ['unique', 'words', 'only', 'once'],chars = \"euqinowrsc\") == 4\n assert candidate(words = ['encyclopedia', 'dictionary', 'encyclopedia', 'encyclopediab'],chars = \"encyclopedia\") == 24\n assert candidate(words = ['banana', 'apple', 'orange', 'grape', 'peach'],chars = \"aapplleeorrnggbnpppe\") == 16\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],chars = \"zyxwvutsrqponmlkjihgfedcba\") == 26\n assert candidate(words = ['abracadabra', 'barack', 'rac', 'cabra'],chars = \"abracadabra\") == 19\n assert candidate(words = ['abcdefgh', 'ijklmnop', 'qrstuvwx', 'yz'],chars = \"abcdefghijklmnopqrstuvwxyz\") == 26\n assert candidate(words = ['algorithm', 'datastructure', 'programming'],chars = \"datastructureprogramming\") == 24\n assert candidate(words = ['one', 'two', 'three', 'four', 'five'],chars = \"onethreefourfive\") == 16\n assert candidate(words = ['mississippi', 'baby', 'racecar', 'level', 'rotor'],chars = \"ississippiabaycerracelevrotor\") == 12\n assert candidate(words = ['repetition', 'representation', 'reform'],chars = \"repitnfom\") == 0\n assert candidate(words = ['longwordhere', 'anotherlongword', 'shortword'],chars = \"lnwordhertahoes\") == 9\n assert candidate(words = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz'],chars = \"abcdefghijklmnopqrstuvwxyz\") == 26\n assert candidate(words = ['abcd', 'abce', 'abcf'],chars = \"abcd\") == 4\n assert candidate(words = ['abcd', 'abac', 'aabc', 'abcc', 'accc'],chars = \"abcc\") == 4\n assert candidate(words = ['mississippi', 'elephant', 'umbrella', 'java', 'python'],chars = \"ieelmpstuvy\") == 0\n assert candidate(words = ['aabbcc', 'abcabc', 'ccabba', 'baccab'],chars = \"aabbcc\") == 24\n assert candidate(words = ['algorithm', 'data', 'structure'],chars = \"gahlimstrucotad\") == 13\n assert candidate(words = ['abcdefgh', 'ijklmnop', 'qrstuvwx', 'yzabcd', 'efghij', 'klmnopqr', 'stuvwx', 'yzabcd', 'efghij', 'klmnopqr', 'stuvwx'],chars = \"abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba\") == 76\n assert candidate(words = ['abcdabcd', 'abcdabcdabcd', 'abcdabcdabcdabcd', 'abcd'],chars = \"abcdabcdabcdabcd\") == 40\n assert candidate(words = ['supercalifragilisticexpialidocious', 'antidisestablishmentarianism', 'floccinaucinihilipilification'],chars = \"supercalifragilisticexpialidociousantidisestablishmentarianismfloccinaucinihilipilification\") == 91\n assert candidate(words = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'mnopqrstuvwxyzabcde'],chars = \"abcdefghijklmnopqrstuvwxyzzzzzzzzzz\") == 71\n assert candidate(words = ['elephant', 'giraffe', 'hippopotamus'],chars = \"eplhgaifeotmups\") == 0\n assert candidate(words = ['repeat', 'repeat', 'repeat', 'repeat'],chars = \"eprta\") == 0\n assert candidate(words = ['hello', 'world', 'leetcode', 'challenge'],chars = \"helloworldleetcodechallenge\") == 27\n assert candidate(words = ['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yz'],chars = \"abcdefghijklmnopqrstuvwxyz\") == 26\n assert candidate(words = ['stackoverflow', 'overflow', 'underflow', 'flow'],chars = \"flowover\") == 12\n assert candidate(words = ['supercalifragilisticexpialidocious', 'supercalifragilistic', 'califragilistic', 'expialidocious'],chars = \"supercalifragilisticexpialidocious\") == 83\n assert candidate(words = ['umbrella', 'balloon', 'orange'],chars = \"mnbaylobnragoe\") == 6\n assert candidate(words = ['xylophone', 'triangle', 'piano', 'drum', 'guitar'],chars = \"tpirangedumxylophone\") == 32\n assert candidate(words = ['abcdefg', 'hijklmn', 'opqrstu', 'vwxyz'],chars = \"zyxwvutsrqponmlkjihgfedcba\") == 26\n assert candidate(words = ['character', 'char', 'act', 'react', 'actchar'],chars = \"character\") == 28\n assert candidate(words = ['programming', 'language', 'python', 'java', 'javascript', 'c', 'cpp'],chars = \"pgoramlngyjtahivsc\") == 21\n"}, "metadata": {"canonical_parameter_names": ["words", "chars"], "leetcode_dataset_entry_point": "Solution().countCharacters", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var countCharacters = function(words, chars) {", "container": null, "callable": "countCharacters", "parameters": [{"name": "words", "type": "string[]"}, {"name": "chars", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1161, "task_id": "maximum-level-sum-of-a-binary-tree", "difficulty": "Medium", "problem_description": "Given the root of a binary tree, the level of its root is 1, the level of its children is 2, and so on.\nReturn the smallest level x such that the sum of all the values of nodes at level x is maximal.\n \nExample 1:\n\n\nInput: root = [1,7,0,7,-8,null,null]\nOutput: 2\nExplanation: \nLevel 1 sum = 1.\nLevel 2 sum = 7 + 0 = 7.\nLevel 3 sum = 7 + -8 = -1.\nSo we return the level with the maximum sum which is level 2.\n\nExample 2:\n\nInput: root = [989,null,10250,98693,-89388,null,null,null,-32127]\nOutput: 2\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 104].\n-105 <= Node.val <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7])) == 3\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5])) == 5\n assert candidate(root = tree_node([1, -1, 2, -2, 3, -3, 4])) == 3\n assert candidate(root = tree_node([5, 2, -3])) == 1\n assert candidate(root = tree_node([-10, -20, -30, -40, -50, -60, -70])) == 1\n assert candidate(root = tree_node([1, -2, -3, 4, None, None, -4])) == 1\n assert candidate(root = tree_node([1, 7, 0, 7, -8, None, None])) == 2\n assert candidate(root = tree_node([989, None, 10250, 98693, -89388, None, None, None, -32127])) == 2\n assert candidate(root = tree_node([5])) == 1\n assert candidate(root = tree_node([-10000, 10000, -10000, 10000, -10000, 10000, -10000])) == 2\n assert candidate(root = tree_node([1])) == 1\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, 7, None, None, 8, None, 9, 10])) == 4\n assert candidate(root = tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, None, 1])) == 3\n assert candidate(root = tree_node([-1, -2, -3, -4, None, None, -5, None, -6, None, None, None, None, None, -7])) == 1\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, 8, 9, 10, 11, 12, 13, 14, 15])) == 5\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == 10\n assert candidate(root = tree_node([1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16, 17, -18, 19, -20])) == 4\n assert candidate(root = tree_node([1000, -1000, 2000, 3000, -4000, 5000, None, -6000, None, 7000, None, 8000, None, 9000, None, 10000])) == 5\n assert candidate(root = tree_node([100, -100, 100, -100, 100, -100, 100, -100, 100, -100, 100, -100, 100, -100, 100])) == 1\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == 5\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, None, None, None, 20])) == 3\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50])) == 6\n assert candidate(root = tree_node([10, 5, -3, 3, 2, None, 11, 3, -2, None, 1, None, None, -1, None, -1, 8])) == 3\n assert candidate(root = tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1, None, None, None, 9])) == 3\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8])) == 8\n assert candidate(root = tree_node([10, -5, 3, 4, -6, 10, -15, 0, 2, None, -8, None, 9, None, None, None, None, None, 5])) == 1\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19])) == 5\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])) == 4\n assert candidate(root = tree_node([10, 5, 15, None, None, 6, 20])) == 3\n assert candidate(root = tree_node([10, 9, 20, None, None, 15, 7, None, None, 5, None, None, 10, None, None, -10, None, None, -20, None, None, 30, None, None, 40, None, None, -50, None, None, -60])) == 2\n assert candidate(root = tree_node([1, 3, 2, 5, 3, None, 9, 0, 2, 5, 3, None, 9, 0, 2])) == 4\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, None, None, 2, None, 1])) == 2\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, None, 8, 9, None, None, 16, 17, None, None, 32, 33])) == 6\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1, -2, -3, -4, -5])) == 4\n assert candidate(root = tree_node([1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1])) == 1\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, 1, 2, 3, 4, 5, 6, 7, 8])) == 2\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, None, 12, 20])) == 4\n assert candidate(root = tree_node([100, -200, 300, -1000, 500, -1500, 700, 800, -900, 1000, -1100, 1200, -1300, 1400, -1500])) == 1\n assert candidate(root = tree_node([100, -100, 100, -100, 100, -100, 100, -100, 100, 100, -100, -100, 100, 100, -100])) == 1\n assert candidate(root = tree_node([1, None, 2, 3, 4, None, 5, 6, 7, None, None, 8, None, None, 9])) == 4\n assert candidate(root = tree_node([5, -4, 6, -7, 8, 9, -10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1])) == 4\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 30, 60, 90, 110, 140, 160, 190])) == 4\n assert candidate(root = tree_node([1000, 500, 1500, 250, 750, 1250, 1750, 125, 375, 625, 875, 1125, 1375, 1625, 1875])) == 4\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, -32])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15])) == 4\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15])) == 4\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11])) == 11\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, None, None, 5])) == 2\n assert candidate(root = tree_node([100, -200, 300, 400, None, -500, 600, None, None, 700, -800, None, None, 900])) == 5\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 15\n assert candidate(root = tree_node([100, 98, 102, None, None, 96, 104, 95, 99, 101, 103, 97, 105, None, None, None, None, None, None, None, None, 94, None, None, 93, None, None, 92, None, None, 91, None, None, 90, None, None, 89, None, None, 88, None, None, 87, None, None, 86, None, None, 85, None, None, 84, None, None, 83, None, None, 82, None, None, 81, None, None, 80])) == 4\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == 9\n assert candidate(root = tree_node([5, 2, -5, None, -1])) == 1\n assert candidate(root = tree_node([10, 9, 20, None, None, 15, 7, None, None, None, 30])) == 4\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8])) == 8\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == 5\n assert candidate(root = tree_node([-10, 9, 20, None, None, 15, 7])) == 2\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == 5\n assert candidate(root = tree_node([1, None, -2, -3, -4, 5, None, -6, None, -7, None, -8, None, -9])) == 1\n assert candidate(root = tree_node([10, 5, -3, 3, 2, None, 11, 3, -2, None, 1])) == 3\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == 5\n assert candidate(root = tree_node([-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15])) == 1\n assert candidate(root = tree_node([1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, -100, -200, -300, -400, -500])) == 3\n assert candidate(root = tree_node([0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14])) == 1\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, 7, None, None, 8, 9])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == 4\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, 25, 20, 10, 5, None, None, None, None, 30])) == 4\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, 6, None, 7, 8, None, None, 9, 10, None, None, 11, 12])) == 6\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == 4\n assert candidate(root = tree_node([100, 90, 110, 80, 95, 105, 120, 70, 85, 93, 97, 103, 107, 115, 125])) == 4\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == 5\n assert candidate(root = tree_node([100, 50, 150, 25, 75, 125, 175, 10, 40, 60, 90, 110, 140, 160, 190])) == 4\n assert candidate(root = tree_node([1, 2, 3, None, 5, None, 7, None, None, None, None, 14, None, None, 28])) == 3\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == 4\n assert candidate(root = tree_node([-10, 9, 20, None, None, 15, 7, -1, -2, -3, -4, -5, -6, -7, -8])) == 2\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])) == 5\n assert candidate(root = tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == 5\n assert candidate(root = tree_node([5, -6, 6, None, 7, 8, 9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20])) == 3\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -26, -27, -28, -29, -30, -31, -32, -33, -34, -35, -36, -37, -38, -39, -40, -41, -42, -43, -44, -45, -46, -47, -48, -49, -50])) == 4\n assert candidate(root = tree_node([10, 9, -10, None, -10, None, -10, None, -10])) == 1\n assert candidate(root = tree_node([1, None, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == 6\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8])) == 3\n assert candidate(root = tree_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 1\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6, None, 11, 14, 16, 19])) == 4\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, 7, None, None, 8, 9, None, None, 10, 11, 12, None, None, 13, 14, 15])) == 8\n assert candidate(root = tree_node([10, 5, -3, 3, 2, None, 11, 3, -2, None, 1, None, None, None, None])) == 3\n assert candidate(root = tree_node([10, 9, 20, None, None, 15, 7, 1, 2, 3, 4, 5, 6, 7, 8])) == 2\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().maxLevelSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxLevelSum = function(root) {", "container": null, "callable": "maxLevelSum", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1162, "task_id": "as-far-from-land-as-possible", "difficulty": "Medium", "problem_description": "Given an n x n grid containing only values 0 and 1, where 0 represents water and 1 represents land, find a water cell such that its distance to the nearest land cell is maximized, and return the distance. If no land or water exists in the grid, return -1.\nThe distance used in this problem is the Manhattan distance: the distance between two cells (x0, y0) and (x1, y1) is |x0 - x1| + |y0 - y1|.\n \nExample 1:\n\n\nInput: grid = [[1,0,1],[0,0,0],[1,0,1]]\nOutput: 2\nExplanation: The cell (1, 1) is as far as possible from all the land with distance 2.\n\nExample 2:\n\n\nInput: grid = [[1,0,0],[0,0,0],[0,0,0]]\nOutput: 4\nExplanation: The cell (2, 2) is as far as possible from all the land with distance 4.\n\n \nConstraints:\n\nn == grid.length\nn == grid[i].length\n1 <= n <= 100\ngrid[i][j] is 0 or 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == -1\n assert candidate(grid = [[1, 0, 1, 0], [0, 0, 0, 0], [1, 0, 1, 0], [0, 0, 0, 0]]) == 2\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 6\n assert candidate(grid = [[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 4\n assert candidate(grid = [[0, 1, 0, 0], [1, 0, 1, 1], [0, 1, 0, 0], [1, 1, 0, 1]]) == 1\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) == 3\n assert candidate(grid = [[1, 0, 0], [0, 0, 0], [0, 0, 0]]) == 4\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == -1\n assert candidate(grid = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == -1\n assert candidate(grid = [[1, 0, 1], [0, 0, 0], [1, 0, 1]]) == 2\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 10\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 2\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 4\n assert candidate(grid = [[0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0]]) == 2\n assert candidate(grid = [[1, 1, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 1, 1]]) == 5\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1]]) == 2\n assert candidate(grid = [[0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0]]) == 4\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 1, 0, 1, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 3\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1]]) == 6\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 7\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 4\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1]]) == 6\n assert candidate(grid = [[0, 1, 1, 1, 0], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [0, 1, 1, 1, 0]]) == 2\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1]]) == 7\n assert candidate(grid = [[0, 0, 0, 0, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [1, 0, 0, 0, 0]]) == 4\n assert candidate(grid = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 1\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 0, 0, 0, 0], [1, 0, 0, 0, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1]]) == 2\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 4\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 9\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 5\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 8\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [1, 0, 0, 0, 1]]) == 2\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0]]) == 5\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 1, 0]]) == 7\n assert candidate(grid = [[0, 0, 0, 1, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 1, 0, 0, 0]]) == 4\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1]]) == 8\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1]]) == 6\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 3\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) == 4\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[1, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 7\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [1, 0, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1]]) == 5\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 4\n assert candidate(grid = [[0, 0, 0, 1, 0], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 1, 0, 0, 0]]) == 3\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 7\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 9\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 4\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0]]) == 4\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 8\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().maxDistance", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxDistance = function(grid) {", "container": null, "callable": "maxDistance", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1163, "task_id": "last-substring-in-lexicographical-order", "difficulty": "Hard", "problem_description": "Given a string s, return the last substring of s in lexicographical order.\n \nExample 1:\n\nInput: s = \"abab\"\nOutput: \"bab\"\nExplanation: The substrings are [\"a\", \"ab\", \"aba\", \"abab\", \"b\", \"ba\", \"bab\"]. The lexicographically maximum substring is \"bab\".\n\nExample 2:\n\nInput: s = \"leetcode\"\nOutput: \"tcode\"\n\n \nConstraints:\n\n1 <= s.length <= 4 * 105\ns contains only lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"abab\") == \"bab\"\n assert candidate(s = \"mississippi\") == \"ssissippi\"\n assert candidate(s = \"abcdabcdabcd\") == \"dabcdabcd\"\n assert candidate(s = \"banana\") == \"nana\"\n assert candidate(s = \"zyxzy\") == \"zyxzy\"\n assert candidate(s = \"zyxzyxzyx\") == \"zyxzyxzyx\"\n assert candidate(s = \"a\") == \"a\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(s = \"aaa\") == \"aaa\"\n assert candidate(s = \"abcd\") == \"d\"\n assert candidate(s = \"akjflaweproqwoijrpprpwlekfawpqwlekfqpwoqpwlekjqwlkfqpwlkerpqwlkfjqwlekflpqwlekfqpwlkerpqwlekfqwlekjfqpwekfqpwlkjqwlekjfqpwlkerpqwlekfpwoqwjfwqppqwjflawejqawlkjqwlkfjqwlkfjqwlkfjqwlkfjqwlekjqwlekjqwlekjqwlekjqwlekjqwlekjqwlkjqwlekjqwlekjqwlekjqwlekjqwlekjqwlkjqwlekjqwlekjqwlekjqwlekjqwlekjqwlkjqwlekjqwlekjqwlekjqwlekjqwlekjqwlkj\") == \"wqppqwjflawejqawlkjqwlkfjqwlkfjqwlkfjqwlkfjqwlekjqwlekjqwlekjqwlekjqwlekjqwlekjqwlkjqwlekjqwlekjqwlekjqwlekjqwlekjqwlkjqwlekjqwlekjqwlekjqwlekjqwlekjqwlkjqwlekjqwlekjqwlekjqwlekjqwlekjqwlkj\"\n assert candidate(s = \"leetcode\") == \"tcode\"\n assert candidate(s = \"aaaa\") == \"aaaa\"\n assert candidate(s = \"aabbccddeeff\") == \"ff\"\n assert candidate(s = \"abcdabceabcdabcdabcdabceabcdabcdabcd\") == \"eabcdabcdabcdabceabcdabcdabcd\"\n assert candidate(s = \"aaaabbbbccccdddd\") == \"dddd\"\n assert candidate(s = \"leetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcode\") == \"tcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcode\"\n assert candidate(s = \"aaabaaaabaaaaabaaaaaaabaaaaaaaabaaaaaaaaaabaaaaaaaaaaabaaaaaaaaaaa\") == \"baaaabaaaaabaaaaaaabaaaaaaaabaaaaaaaaaabaaaaaaaaaaabaaaaaaaaaaa\"\n assert candidate(s = \"aaaabaaaabaaaaaa\") == \"baaaabaaaaaa\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\") == \"z\"\n assert candidate(s = \"ababababababababababab\") == \"babababababababababab\"\n assert candidate(s = \"ananananananananananananananan\") == \"nanananananananananananananan\"\n assert candidate(s = \"aaaabbaaaabbaaa\") == \"bbaaaabbaaa\"\n assert candidate(s = \"aabbaabbaabbaabbaabb\") == \"bbaabbaabbaabbaabb\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(s = \"thisisaverylongstringwithseveralrepeatedsubstringsrepeated\") == \"ylongstringwithseveralrepeatedsubstringsrepeated\"\n assert candidate(s = \"leetcodeloveleetcode\") == \"veleetcode\"\n assert candidate(s = \"abababababababababab\") == \"bababababababababab\"\n assert candidate(s = \"bcbcbcbcbcbcbcbc\") == \"cbcbcbcbcbcbcbc\"\n assert candidate(s = \"anananananananan\") == \"nananananananan\"\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\") == \"dabcdabcdabcdabcdabcdabcdabcdabcdabcd\"\n assert candidate(s = \"xyxxyxyxxyxyxxyxyxyxxyxyx\") == \"yxyxyxxyxyx\"\n assert candidate(s = \"abababababababa\") == \"bababababababa\"\n assert candidate(s = \"abracadabra\") == \"racadabra\"\n assert candidate(s = \"aaaaaabaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaab\") == \"baaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaab\"\n assert candidate(s = \"abcdbacdcbac\") == \"dcbac\"\n assert candidate(s = \"zzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzz\"\n assert candidate(s = \"bbaaabbaaabbaaa\") == \"bbaaabbaaabbaaa\"\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaab\") == \"b\"\n assert candidate(s = \"aaaabbbbccccddddeeeeffff\") == \"ffff\"\n assert candidate(s = \"abracadabraabracadabraabracadabraabracadabraabracadabra\") == \"racadabraabracadabraabracadabraabracadabraabracadabra\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(s = \"acbbccddeeefffggghhhh\") == \"hhhh\"\n assert candidate(s = \"racecar\") == \"racecar\"\n assert candidate(s = \"aaaaaaaaaaab\") == \"b\"\n assert candidate(s = \"abcabcabcabcabcabcabcabcabc\") == \"cabcabcabcabcabcabcabcabc\"\n assert candidate(s = \"abcdexyzxyzxyzxyzxyzxyzxyzxyzxyz\") == \"zxyzxyzxyzxyzxyzxyzxyzxyz\"\n assert candidate(s = \"rollingstonesrollingstonesrollingstones\") == \"tonesrollingstonesrollingstones\"\n assert candidate(s = \"abcdedcbaedcba\") == \"edcbaedcba\"\n assert candidate(s = \"aquickbrownfoxjumpsoverthelazydogaquickbrownfoxjumpsoverthelazydog\") == \"zydogaquickbrownfoxjumpsoverthelazydog\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\") == \"zzyxwvutsrqponmlkjihgfedcba\"\n assert candidate(s = \"ababababababab\") == \"babababababab\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\") == \"zabcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"racecar racecar racecar\") == \"racecar racecar racecar\"\n assert candidate(s = \"bananaananabananaananabananaananaba\") == \"nanabananaananabananaananaba\"\n assert candidate(s = \"bbaaaaaaaaaaaaaaaaaaab\") == \"bbaaaaaaaaaaaaaaaaaaab\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(s = \"aazzzzzaazzzzz\") == \"zzzzzaazzzzz\"\n assert candidate(s = \"mmmmmmmllllllllkkkkkkkkjjjjjjjjiiiiiiiioooooooonnnnnnnmmm\") == \"oooooooonnnnnnnmmm\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(s = \"aaaaaaaaaabaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaab\") == \"baaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaab\"\n assert candidate(s = \"aabbccddeeffgg\") == \"gg\"\n assert candidate(s = \"leetcodeisacodeleetcode\") == \"tcodeisacodeleetcode\"\n assert candidate(s = \"aabbaabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == \"zz\"\n assert candidate(s = \"zzzzzyzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzz\"\n assert candidate(s = \"xyzyxzyxyzyxzyxyzyxzyxyzyxzyxyzyxzyxyzyxzyxyzyxzyxyzyxzyx\") == \"zyxzyxyzyxzyxyzyxzyxyzyxzyxyzyxzyxyzyxzyxyzyxzyxyzyxzyx\"\n assert candidate(s = \"bananaananabananananaba\") == \"nanananaba\"\n assert candidate(s = \"zzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzz\"\n assert candidate(s = \"aaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccdddddddddddddddddddd\") == \"dddddddddddddddddddd\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(s = \"racecarbananaappleorangeorangeapplebananaorangeorangeapplebananaorange\") == \"rbananaappleorangeorangeapplebananaorangeorangeapplebananaorange\"\n assert candidate(s = \"abcdefgzyxwvutsrqpomnlkjihgfedcba\") == \"zyxwvutsrqpomnlkjihgfedcba\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == \"zz\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba\") == \"zyxwvutsrqponmlkjihgfedcba\"\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaabb\") == \"bb\"\n assert candidate(s = \"abcdzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\") == \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n assert candidate(s = \"aaaaaaabbbbbbbccccccdddddeeeeeeffffffff\") == \"ffffffff\"\n assert candidate(s = \"bbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabb\") == \"bbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabb\"\n assert candidate(s = \"aaaaaaaaaabaaaaaaaaaabaaaaaaaaaab\") == \"baaaaaaaaaabaaaaaaaaaab\"\n assert candidate(s = \"abcdedcbaabcdedcbaabcdedcbaabcdedcbaabcdedcbaabcdedcba\") == \"edcbaabcdedcbaabcdedcbaabcdedcbaabcdedcbaabcdedcba\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().lastSubstring", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var lastSubstring = function(s) {", "container": null, "callable": "lastSubstring", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1169, "task_id": "invalid-transactions", "difficulty": "Medium", "problem_description": "A transaction is possibly invalid if:\n\nthe amount exceeds $1000, or;\nif it occurs within (and including) 60 minutes of another transaction with the same name in a different city.\n\nYou are given an array of strings transaction where transactions[i] consists of comma-separated values representing the name, time (in minutes), amount, and city of the transaction.\nReturn a list of transactions that are possibly invalid. You may return the answer in any order.\n \nExample 1:\n\nInput: transactions = [\"alice,20,800,mtv\",\"alice,50,100,beijing\"]\nOutput: [\"alice,20,800,mtv\",\"alice,50,100,beijing\"]\nExplanation: The first transaction is invalid because the second transaction occurs within a difference of 60 minutes, have the same name and is in a different city. Similarly the second one is invalid too.\nExample 2:\n\nInput: transactions = [\"alice,20,800,mtv\",\"alice,50,1200,mtv\"]\nOutput: [\"alice,50,1200,mtv\"]\n\nExample 3:\n\nInput: transactions = [\"alice,20,800,mtv\",\"bob,50,1200,mtv\"]\nOutput: [\"bob,50,1200,mtv\"]\n\n \nConstraints:\n\ntransactions.length <= 1000\nEach transactions[i] takes the form \"{name},{time},{amount},{city}\"\nEach {name} and {city} consist of lowercase English letters, and have lengths between 1 and 10.\nEach {time} consist of digits, and represent an integer between 0 and 1000.\nEach {amount} consist of digits, and represent an integer between 0 and 2000.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(transactions = ['alice,20,800,mtv', 'alice,50,1200,mtv']) == ['alice,50,1200,mtv']\n assert candidate(transactions = ['alice,20,800,mtv', 'alice,50,100,beijing', 'bob,25,800,mtv', 'bob,100,100,beijing']) == ['alice,20,800,mtv', 'alice,50,100,beijing']\n assert candidate(transactions = ['alice,10,500,mtv', 'bob,20,600,mtv', 'alice,30,1100,newyork', 'bob,40,100,beijing']) == ['alice,10,500,mtv', 'bob,20,600,mtv', 'alice,30,1100,newyork', 'bob,40,100,beijing']\n assert candidate(transactions = ['alice,20,1100,mtv', 'bob,50,2000,mtv', 'alice,100,1000,beijing']) == ['alice,20,1100,mtv', 'bob,50,2000,mtv']\n assert candidate(transactions = ['alice,20,800,mtv', 'alice,50,100,mtv', 'alice,61,100,mtv']) == []\n assert candidate(transactions = ['alice,20,800,mtv', 'alice,60,100,mtv', 'alice,120,100,beijing']) == ['alice,60,100,mtv', 'alice,120,100,beijing']\n assert candidate(transactions = ['alice,20,800,mtv', 'alice,20,1000,mtv', 'alice,21,800,beijing']) == ['alice,20,800,mtv', 'alice,20,1000,mtv', 'alice,21,800,beijing']\n assert candidate(transactions = ['alice,20,800,mtv', 'bob,50,1200,mtv']) == ['bob,50,1200,mtv']\n assert candidate(transactions = ['alice,20,1500,mtv', 'alice,21,100,beijing', 'alice,22,2000,mtv']) == ['alice,20,1500,mtv', 'alice,21,100,beijing', 'alice,22,2000,mtv']\n assert candidate(transactions = ['alice,20,800,mtv', 'bob,20,800,mtv', 'alice,50,100,beijing']) == ['alice,20,800,mtv', 'alice,50,100,beijing']\n assert candidate(transactions = ['alice,20,1500,mtv', 'alice,25,800,mtv', 'alice,30,1200,beijing']) == ['alice,20,1500,mtv', 'alice,25,800,mtv', 'alice,30,1200,beijing']\n assert candidate(transactions = ['alice,20,800,mtv', 'bob,50,1200,mtv', 'alice,60,1200,mtv', 'bob,120,1200,beijing']) == ['bob,50,1200,mtv', 'alice,60,1200,mtv', 'bob,120,1200,beijing']\n assert candidate(transactions = ['alice,20,800,mtv', 'alice,20,1000,mtv', 'alice,20,1001,mtv']) == ['alice,20,1001,mtv']\n assert candidate(transactions = ['alice,20,1500,mtv', 'alice,20,100,beijing', 'alice,50,1200,mtv']) == ['alice,20,1500,mtv', 'alice,20,100,beijing', 'alice,50,1200,mtv']\n assert candidate(transactions = ['alice,20,800,mtv', 'bob,20,800,mtv', 'alice,80,800,beijing']) == ['alice,20,800,mtv', 'alice,80,800,beijing']\n assert candidate(transactions = ['alice,20,800,mtv', 'alice,50,100,beijing']) == ['alice,20,800,mtv', 'alice,50,100,beijing']\n assert candidate(transactions = ['alice,10,500,mtv', 'bob,10,600,mtv', 'alice,20,1200,newyork', 'bob,20,600,newyork', 'alice,30,600,beijing', 'bob,30,600,mtv', 'alice,40,600,newyork', 'bob,40,600,beijing', 'charlie,50,700,mtv', 'charlie,55,700,newyork', 'charlie,60,700,beijing', 'dave,5,800,mtv', 'dave,7,900,newyork', 'dave,10,1000,beijing', 'dave,15,1100,mtv']) == ['alice,10,500,mtv', 'bob,10,600,mtv', 'alice,20,1200,newyork', 'bob,20,600,newyork', 'alice,30,600,beijing', 'bob,30,600,mtv', 'alice,40,600,newyork', 'bob,40,600,beijing', 'charlie,50,700,mtv', 'charlie,55,700,newyork', 'charlie,60,700,beijing', 'dave,5,800,mtv', 'dave,7,900,newyork', 'dave,10,1000,beijing', 'dave,15,1100,mtv']\n assert candidate(transactions = ['alice,10,500,mtv', 'alice,70,500,mtv', 'alice,130,500,newyork', 'alice,190,500,mtv', 'alice,250,500,beijing', 'bob,10,1200,newyork', 'bob,70,1200,beijing', 'bob,130,1200,mtv', 'bob,190,1200,newyork', 'bob,250,1200,beijing']) == ['alice,70,500,mtv', 'alice,130,500,newyork', 'alice,190,500,mtv', 'alice,250,500,beijing', 'bob,10,1200,newyork', 'bob,70,1200,beijing', 'bob,130,1200,mtv', 'bob,190,1200,newyork', 'bob,250,1200,beijing']\n assert candidate(transactions = ['alice,10,500,mtv', 'alice,70,600,mtv', 'alice,120,800,newyork', 'alice,130,1100,newyork']) == ['alice,70,600,mtv', 'alice,120,800,newyork', 'alice,130,1100,newyork']\n assert candidate(transactions = ['alice,10,500,mtv', 'alice,70,1500,beijing', 'alice,130,1100,mtv', 'alice,190,900,beijing', 'bob,20,600,mtv', 'bob,80,1500,beijing', 'bob,140,1100,mtv', 'bob,200,900,beijing']) == ['alice,10,500,mtv', 'alice,70,1500,beijing', 'alice,130,1100,mtv', 'alice,190,900,beijing', 'bob,20,600,mtv', 'bob,80,1500,beijing', 'bob,140,1100,mtv', 'bob,200,900,beijing']\n assert candidate(transactions = ['ivan,10,1300,madrid', 'ivan,40,800,madrid', 'ivan,70,1100,barcelona', 'ivan,100,1200,madrid', 'ivan,130,900,valencia', 'ivan,160,1000,madrid', 'ivan,190,800,barcelona', 'ivan,220,1500,madrid', 'ivan,250,600,valencia', 'ivan,280,1200,madrid', 'ivan,310,800,barcelona', 'ivan,340,900,madrid', 'ivan,370,700,valencia', 'ivan,400,1500,madrid']) == ['ivan,10,1300,madrid', 'ivan,40,800,madrid', 'ivan,70,1100,barcelona', 'ivan,100,1200,madrid', 'ivan,130,900,valencia', 'ivan,160,1000,madrid', 'ivan,190,800,barcelona', 'ivan,220,1500,madrid', 'ivan,250,600,valencia', 'ivan,280,1200,madrid', 'ivan,310,800,barcelona', 'ivan,340,900,madrid', 'ivan,370,700,valencia', 'ivan,400,1500,madrid']\n assert candidate(transactions = ['frank,10,1200,mtv', 'frank,20,1000,beijing', 'frank,30,1500,mtv', 'frank,40,900,newyork', 'frank,50,1100,mtv', 'frank,60,800,beijing', 'frank,70,1000,newyork']) == ['frank,10,1200,mtv', 'frank,20,1000,beijing', 'frank,30,1500,mtv', 'frank,40,900,newyork', 'frank,50,1100,mtv', 'frank,60,800,beijing', 'frank,70,1000,newyork']\n assert candidate(transactions = ['eve,5,1000,berlin', 'eve,10,100,berlin', 'eve,70,1100,berlin', 'eve,120,1200,berlin', 'eve,180,1300,berlin']) == ['eve,70,1100,berlin', 'eve,120,1200,berlin', 'eve,180,1300,berlin']\n assert candidate(transactions = ['jane,10,900,sanfrancisco', 'jane,20,1100,sanfrancisco', 'jane,30,800,sanfrancisco', 'jane,40,1200,losangeles', 'jane,50,1000,losangeles', 'jane,60,950,sanfrancisco', 'jane,70,1050,sanfrancisco', 'jane,80,850,losangeles', 'jane,90,1150,sanfrancisco']) == ['jane,10,900,sanfrancisco', 'jane,20,1100,sanfrancisco', 'jane,30,800,sanfrancisco', 'jane,40,1200,losangeles', 'jane,50,1000,losangeles', 'jane,60,950,sanfrancisco', 'jane,70,1050,sanfrancisco', 'jane,80,850,losangeles', 'jane,90,1150,sanfrancisco']\n assert candidate(transactions = ['ivan,10,900,moscow', 'ivan,20,1100,moscow', 'ivan,30,800,moscow', 'ivan,40,1200,stuttgart', 'ivan,50,1000,stuttgart', 'ivan,60,950,moscow', 'ivan,70,1050,moscow', 'ivan,80,850,stuttgart']) == ['ivan,10,900,moscow', 'ivan,20,1100,moscow', 'ivan,30,800,moscow', 'ivan,40,1200,stuttgart', 'ivan,50,1000,stuttgart', 'ivan,60,950,moscow', 'ivan,70,1050,moscow', 'ivan,80,850,stuttgart']\n assert candidate(transactions = ['eve,5,1500,mtv', 'eve,65,1100,beijing', 'eve,70,500,mtv', 'eve,130,1000,newyork', 'eve,135,800,mtv', 'eve,190,1100,beijing']) == ['eve,5,1500,mtv', 'eve,65,1100,beijing', 'eve,70,500,mtv', 'eve,130,1000,newyork', 'eve,135,800,mtv', 'eve,190,1100,beijing']\n assert candidate(transactions = ['alice,10,500,mtv', 'bob,10,600,mtv', 'alice,20,1200,newyork', 'bob,20,600,newyork', 'alice,30,600,beijing', 'bob,30,600,mtv', 'alice,40,600,newyork', 'bob,40,600,beijing', 'charlie,50,700,mtv', 'charlie,55,700,newyork', 'charlie,60,700,beijing']) == ['alice,10,500,mtv', 'bob,10,600,mtv', 'alice,20,1200,newyork', 'bob,20,600,newyork', 'alice,30,600,beijing', 'bob,30,600,mtv', 'alice,40,600,newyork', 'bob,40,600,beijing', 'charlie,50,700,mtv', 'charlie,55,700,newyork', 'charlie,60,700,beijing']\n assert candidate(transactions = ['dave,5,500,boston', 'dave,30,1100,boston', 'dave,35,600,ny', 'dave,45,900,boston', 'dave,70,1500,ny']) == ['dave,5,500,boston', 'dave,30,1100,boston', 'dave,35,600,ny', 'dave,45,900,boston', 'dave,70,1500,ny']\n assert candidate(transactions = ['ian,10,500,tokyo', 'ian,20,600,tokyo', 'ian,30,700,tokyo', 'ian,40,800,tokyo', 'ian,50,900,tokyo', 'ian,60,1000,tokyo', 'ian,70,1100,tokyo', 'ian,80,1200,tokyo', 'ian,90,1300,tokyo', 'ian,100,1400,tokyo', 'ian,110,1500,tokyo', 'ian,120,1600,tokyo', 'ian,130,1700,tokyo', 'ian,140,1800,tokyo', 'ian,150,1900,tokyo', 'ian,160,1500,osaka', 'ian,170,1600,osaka', 'ian,180,1700,osaka', 'ian,190,1800,osaka', 'ian,200,1900,osaka']) == ['ian,70,1100,tokyo', 'ian,80,1200,tokyo', 'ian,90,1300,tokyo', 'ian,100,1400,tokyo', 'ian,110,1500,tokyo', 'ian,120,1600,tokyo', 'ian,130,1700,tokyo', 'ian,140,1800,tokyo', 'ian,150,1900,tokyo', 'ian,160,1500,osaka', 'ian,170,1600,osaka', 'ian,180,1700,osaka', 'ian,190,1800,osaka', 'ian,200,1900,osaka']\n assert candidate(transactions = ['grace,10,800,toronto', 'grace,30,700,toronto', 'grace,60,1200,vancouver', 'grace,90,600,toronto', 'grace,120,800,toronto', 'grace,150,900,montreal', 'grace,180,1500,toronto', 'grace,210,700,vancouver', 'grace,240,600,montreal', 'grace,270,1100,toronto', 'grace,300,900,vancouver', 'grace,330,800,montreal']) == ['grace,10,800,toronto', 'grace,30,700,toronto', 'grace,60,1200,vancouver', 'grace,90,600,toronto', 'grace,120,800,toronto', 'grace,150,900,montreal', 'grace,180,1500,toronto', 'grace,210,700,vancouver', 'grace,240,600,montreal', 'grace,270,1100,toronto', 'grace,300,900,vancouver', 'grace,330,800,montreal']\n assert candidate(transactions = ['alice,10,500,mtv', 'alice,10,1200,beijing', 'alice,20,500,newyork', 'bob,10,300,mtv', 'bob,11,1500,beijing']) == ['alice,10,500,mtv', 'alice,10,1200,beijing', 'alice,20,500,newyork', 'bob,10,300,mtv', 'bob,11,1500,beijing']\n assert candidate(transactions = ['charlie,10,1000,paris', 'charlie,50,2000,london', 'charlie,60,1500,paris', 'charlie,120,800,london']) == ['charlie,10,1000,paris', 'charlie,50,2000,london', 'charlie,60,1500,paris', 'charlie,120,800,london']\n assert candidate(transactions = ['frank,10,500,seattle', 'frank,20,500,sanfrancisco', 'frank,30,1500,seattle', 'frank,90,700,sanfrancisco', 'frank,150,1200,seattle']) == ['frank,10,500,seattle', 'frank,20,500,sanfrancisco', 'frank,30,1500,seattle', 'frank,90,700,sanfrancisco', 'frank,150,1200,seattle']\n assert candidate(transactions = ['grace,10,1500,chicago', 'grace,20,1600,chicago', 'grace,30,1700,chicago', 'grace,40,1800,chicago', 'grace,50,1900,chicago', 'grace,60,1500,paris', 'grace,70,1600,paris', 'grace,80,1700,paris', 'grace,90,1800,paris', 'grace,100,1900,paris']) == ['grace,10,1500,chicago', 'grace,20,1600,chicago', 'grace,30,1700,chicago', 'grace,40,1800,chicago', 'grace,50,1900,chicago', 'grace,60,1500,paris', 'grace,70,1600,paris', 'grace,80,1700,paris', 'grace,90,1800,paris', 'grace,100,1900,paris']\n assert candidate(transactions = ['grace,10,1000,mtv', 'grace,20,1100,newyork', 'grace,30,900,beijing', 'grace,90,1100,newyork', 'grace,150,1000,beijing', 'grace,210,1500,mtv', 'grace,220,800,newyork', 'grace,300,1200,beijing', 'grace,350,1100,mtv']) == ['grace,10,1000,mtv', 'grace,20,1100,newyork', 'grace,30,900,beijing', 'grace,90,1100,newyork', 'grace,150,1000,beijing', 'grace,210,1500,mtv', 'grace,220,800,newyork', 'grace,300,1200,beijing', 'grace,350,1100,mtv']\n assert candidate(transactions = ['alice,20,800,mtv', 'alice,50,1000,newyork', 'alice,70,900,beijing', 'bob,40,1000,mtv', 'bob,120,1500,newyork']) == ['alice,20,800,mtv', 'alice,50,1000,newyork', 'alice,70,900,beijing', 'bob,120,1500,newyork']\n assert candidate(transactions = ['charlie,10,1500,paris', 'charlie,20,1000,boston', 'charlie,30,500,paris', 'charlie,40,1200,newyork', 'charlie,50,800,boston']) == ['charlie,10,1500,paris', 'charlie,20,1000,boston', 'charlie,30,500,paris', 'charlie,40,1200,newyork', 'charlie,50,800,boston']\n assert candidate(transactions = ['alice,10,500,mtv', 'alice,70,1000,mtv', 'alice,130,1100,newyork', 'alice,190,900,mtv', 'alice,250,100,beijing']) == ['alice,70,1000,mtv', 'alice,130,1100,newyork', 'alice,190,900,mtv', 'alice,250,100,beijing']\n assert candidate(transactions = ['charlie,10,900,paris', 'david,15,1100,london', 'charlie,20,700,paris', 'david,60,800,paris']) == ['david,15,1100,london', 'david,60,800,paris']\n assert candidate(transactions = ['ivan,1,1000,boston', 'ivan,10,500,boston', 'ivan,60,1500,newyork', 'ivan,65,2000,chicago', 'ivan,120,800,newyork', 'ivan,125,1200,lasvegas', 'ivan,180,600,newyork']) == ['ivan,1,1000,boston', 'ivan,10,500,boston', 'ivan,60,1500,newyork', 'ivan,65,2000,chicago', 'ivan,120,800,newyork', 'ivan,125,1200,lasvegas', 'ivan,180,600,newyork']\n assert candidate(transactions = ['frank,1,1100,chicago', 'frank,10,600,chicago', 'frank,11,2000,newyork', 'frank,20,500,chicago', 'frank,30,3000,newyork', 'frank,40,1500,chicago']) == ['frank,1,1100,chicago', 'frank,10,600,chicago', 'frank,11,2000,newyork', 'frank,20,500,chicago', 'frank,30,3000,newyork', 'frank,40,1500,chicago']\n assert candidate(transactions = ['charlie,10,1500,nyc', 'david,20,1100,paris', 'charlie,30,1200,nyc', 'david,40,900,london', 'charlie,60,1000,paris']) == ['charlie,10,1500,nyc', 'david,20,1100,paris', 'charlie,30,1200,nyc', 'david,40,900,london', 'charlie,60,1000,paris']\n assert candidate(transactions = ['dave,5,2500,london', 'eve,10,1100,london', 'dave,15,600,birmingham', 'eve,20,400,london', 'dave,25,900,glasgow', 'eve,30,1000,birmingham']) == ['dave,5,2500,london', 'eve,10,1100,london', 'dave,15,600,birmingham', 'eve,20,400,london', 'dave,25,900,glasgow', 'eve,30,1000,birmingham']\n assert candidate(transactions = ['hank,5,900,chicago', 'hank,35,800,chicago', 'hank,65,700,losangeles', 'hank,95,1500,chicago', 'hank,125,600,losangeles', 'hank,155,1200,chicago', 'hank,185,800,losangeles', 'hank,215,900,chicago', 'hank,245,700,losangeles', 'hank,275,1500,chicago', 'hank,305,600,losangeles', 'hank,335,1200,chicago', 'hank,365,800,losangeles', 'hank,395,900,chicago']) == ['hank,5,900,chicago', 'hank,35,800,chicago', 'hank,65,700,losangeles', 'hank,95,1500,chicago', 'hank,125,600,losangeles', 'hank,155,1200,chicago', 'hank,185,800,losangeles', 'hank,215,900,chicago', 'hank,245,700,losangeles', 'hank,275,1500,chicago', 'hank,305,600,losangeles', 'hank,335,1200,chicago', 'hank,365,800,losangeles', 'hank,395,900,chicago']\n assert candidate(transactions = ['heidi,1,1000,boston', 'heidi,60,1000,newyork', 'heidi,120,1000,boston', 'heidi,180,1000,newyork', 'heidi,240,1000,boston', 'heidi,300,1000,newyork']) == ['heidi,1,1000,boston', 'heidi,60,1000,newyork', 'heidi,120,1000,boston', 'heidi,180,1000,newyork', 'heidi,240,1000,boston', 'heidi,300,1000,newyork']\n assert candidate(transactions = ['heidi,10,900,berlin', 'heidi,20,1100,berlin', 'heidi,30,800,berlin', 'heidi,40,1200,munich', 'heidi,50,1000,munich', 'heidi,60,950,berlin', 'heidi,70,1050,berlin']) == ['heidi,10,900,berlin', 'heidi,20,1100,berlin', 'heidi,30,800,berlin', 'heidi,40,1200,munich', 'heidi,50,1000,munich', 'heidi,60,950,berlin', 'heidi,70,1050,berlin']\n assert candidate(transactions = ['grace,10,900,rome', 'grace,20,1100,rome', 'grace,30,800,rome', 'grace,40,1200,paris', 'grace,50,1000,paris', 'grace,60,950,rome']) == ['grace,10,900,rome', 'grace,20,1100,rome', 'grace,30,800,rome', 'grace,40,1200,paris', 'grace,50,1000,paris', 'grace,60,950,rome']\n assert candidate(transactions = ['grace,10,500,mtv', 'grace,110,600,mtv', 'grace,210,1100,newyork', 'grace,310,100,beijing', 'grace,410,1300,mtv', 'grace,510,1000,beijing']) == ['grace,210,1100,newyork', 'grace,410,1300,mtv']\n assert candidate(transactions = ['ivan,10,500,chicago', 'ivan,20,500,chicago', 'ivan,25,1000,boston', 'ivan,30,600,boston', 'ivan,85,700,chicago', 'ivan,90,2000,boston', 'ivan,140,1200,chicago', 'ivan,180,800,boston']) == ['ivan,10,500,chicago', 'ivan,20,500,chicago', 'ivan,25,1000,boston', 'ivan,30,600,boston', 'ivan,85,700,chicago', 'ivan,90,2000,boston', 'ivan,140,1200,chicago', 'ivan,180,800,boston']\n assert candidate(transactions = ['frank,10,500,sf', 'frank,20,600,sf', 'frank,30,700,sf', 'frank,40,800,sf', 'frank,50,900,sf', 'frank,60,1000,sf', 'frank,70,1100,sf', 'frank,80,1200,sf', 'frank,90,1300,sf', 'frank,100,1400,sf']) == ['frank,90,1300,sf', 'frank,100,1400,sf', 'frank,70,1100,sf', 'frank,80,1200,sf']\n assert candidate(transactions = ['alice,20,800,mtv', 'alice,50,1200,beijing', 'alice,120,1000,mtv', 'bob,20,600,mtv', 'bob,80,600,newyork', 'bob,150,600,mtv']) == ['alice,20,800,mtv', 'alice,50,1200,beijing', 'bob,20,600,mtv', 'bob,80,600,newyork']\n assert candidate(transactions = ['alice,20,800,mtv', 'bob,50,1200,mtv', 'charlie,30,1500,newyork', 'dave,40,100,beijing', 'eve,60,900,mtv', 'frank,80,2000,newyork', 'grace,100,1100,beijing']) == ['bob,50,1200,mtv', 'charlie,30,1500,newyork', 'frank,80,2000,newyork', 'grace,100,1100,beijing']\n assert candidate(transactions = ['alice,10,1000,mtv', 'bob,20,1100,mtv', 'charlie,30,900,newyork', 'dave,40,100,beijing', 'eve,60,900,mtv', 'frank,80,2000,newyork', 'grace,100,1100,beijing', 'heidi,120,1000,mtv', 'ivan,140,1200,newyork', 'juliet,160,1300,beijing', 'karen,180,1400,mtv', 'leo,200,1500,newyork', 'mike,220,1600,beijing']) == ['bob,20,1100,mtv', 'frank,80,2000,newyork', 'grace,100,1100,beijing', 'ivan,140,1200,newyork', 'juliet,160,1300,beijing', 'karen,180,1400,mtv', 'leo,200,1500,newyork', 'mike,220,1600,beijing']\n assert candidate(transactions = ['alice,10,500,mtv', 'bob,20,600,mtv', 'charlie,30,1100,newyork', 'dave,40,100,beijing', 'eve,50,900,mtv', 'frank,60,500,newyork', 'grace,70,1500,mtv', 'heidi,80,600,beijing']) == ['charlie,30,1100,newyork', 'grace,70,1500,mtv']\n assert candidate(transactions = ['grace,5,300,losangeles', 'grace,10,1500,lasvegas', 'grace,15,800,lasvegas', 'grace,75,1000,losangeles', 'grace,80,600,lasvegas', 'grace,130,900,losangeles']) == ['grace,5,300,losangeles', 'grace,10,1500,lasvegas', 'grace,15,800,lasvegas', 'grace,75,1000,losangeles', 'grace,80,600,lasvegas', 'grace,130,900,losangeles']\n assert candidate(transactions = ['frank,5,500,mtv', 'frank,20,1500,mtv', 'frank,30,1000,newyork', 'frank,70,900,newyork', 'frank,90,800,beijing', 'frank,120,700,beijing', 'frank,150,1200,mtv', 'frank,170,1100,newyork']) == ['frank,5,500,mtv', 'frank,20,1500,mtv', 'frank,30,1000,newyork', 'frank,70,900,newyork', 'frank,90,800,beijing', 'frank,120,700,beijing', 'frank,150,1200,mtv', 'frank,170,1100,newyork']\n assert candidate(transactions = ['grace,5,900,sanfrancisco', 'grace,10,1200,sanfrancisco', 'grace,20,800,sanfrancisco', 'grace,25,1000,sanfrancisco', 'grace,30,600,sanfrancisco', 'grace,40,1200,sanfrancisco']) == ['grace,10,1200,sanfrancisco', 'grace,40,1200,sanfrancisco']\n assert candidate(transactions = ['eve,10,1500,mtv', 'eve,10,900,newyork', 'eve,60,1000,beijing', 'eve,110,1100,newyork', 'eve,150,1200,mtv', 'eve,200,1300,beijing']) == ['eve,10,1500,mtv', 'eve,10,900,newyork', 'eve,60,1000,beijing', 'eve,110,1100,newyork', 'eve,150,1200,mtv', 'eve,200,1300,beijing']\n assert candidate(transactions = ['eve,10,500,boston', 'eve,40,600,boston', 'eve,70,550,boston', 'eve,100,900,boston', 'eve,130,1100,boston']) == ['eve,130,1100,boston']\n assert candidate(transactions = ['alice,10,500,mtv', 'bob,20,600,mtv', 'alice,30,1100,newyork', 'bob,40,100,beijing', 'alice,50,900,mtv', 'alice,60,500,newyork']) == ['alice,10,500,mtv', 'bob,20,600,mtv', 'alice,30,1100,newyork', 'bob,40,100,beijing', 'alice,50,900,mtv', 'alice,60,500,newyork']\n assert candidate(transactions = ['frank,10,1200,newyork', 'frank,40,800,chicago', 'frank,60,1500,boston', 'frank,100,1100,boston', 'frank,140,1000,chicago']) == ['frank,10,1200,newyork', 'frank,40,800,chicago', 'frank,60,1500,boston', 'frank,100,1100,boston', 'frank,140,1000,chicago']\n assert candidate(transactions = ['charlie,10,1000,mtv', 'charlie,15,900,newyork', 'dave,30,1100,beijing', 'dave,60,1200,newyork', 'dave,80,1300,mtv']) == ['charlie,10,1000,mtv', 'charlie,15,900,newyork', 'dave,30,1100,beijing', 'dave,60,1200,newyork', 'dave,80,1300,mtv']\n assert candidate(transactions = ['hannah,10,1500,mtv', 'hannah,20,1000,beijing', 'hannah,30,1200,mtv', 'hannah,40,800,newyork', 'hannah,50,1100,mtv', 'hannah,60,900,beijing', 'hannah,70,1000,newyork', 'hannah,80,1300,mtv', 'hannah,90,1000,beijing']) == ['hannah,10,1500,mtv', 'hannah,20,1000,beijing', 'hannah,30,1200,mtv', 'hannah,40,800,newyork', 'hannah,50,1100,mtv', 'hannah,60,900,beijing', 'hannah,70,1000,newyork', 'hannah,80,1300,mtv', 'hannah,90,1000,beijing']\n assert candidate(transactions = ['alice,10,1500,mtv', 'bob,20,1200,beijing', 'alice,30,1300,newyork', 'bob,40,1400,mtv', 'alice,50,1600,newyork', 'bob,60,1100,newyork']) == ['alice,10,1500,mtv', 'bob,20,1200,beijing', 'alice,30,1300,newyork', 'bob,40,1400,mtv', 'alice,50,1600,newyork', 'bob,60,1100,newyork']\n assert candidate(transactions = ['alice,10,500,mtv', 'alice,20,800,beijing', 'alice,30,1100,mtv', 'bob,10,500,mtv', 'bob,20,800,beijing', 'bob,30,1100,mtv', 'charlie,10,500,newyork', 'charlie,20,800,newyork', 'charlie,30,1100,newyork']) == ['alice,10,500,mtv', 'alice,20,800,beijing', 'alice,30,1100,mtv', 'bob,10,500,mtv', 'bob,20,800,beijing', 'bob,30,1100,mtv', 'charlie,30,1100,newyork']\n assert candidate(transactions = ['alice,10,1500,mtv', 'alice,70,900,beijing', 'bob,30,600,mtv', 'bob,100,1200,newyork', 'charlie,50,1300,mtv', 'charlie,110,1000,beijing']) == ['alice,10,1500,mtv', 'alice,70,900,beijing', 'bob,100,1200,newyork', 'charlie,50,1300,mtv', 'charlie,110,1000,beijing']\n assert candidate(transactions = ['alice,10,500,mtv', 'alice,70,1500,beijing', 'bob,20,600,mtv', 'bob,80,1500,beijing', 'charlie,30,1100,newyork', 'charlie,90,1500,newyork', 'dave,40,100,beijing', 'dave,100,1500,beijing']) == ['alice,10,500,mtv', 'alice,70,1500,beijing', 'bob,20,600,mtv', 'bob,80,1500,beijing', 'charlie,30,1100,newyork', 'charlie,90,1500,newyork', 'dave,100,1500,beijing']\n assert candidate(transactions = ['eve,15,1200,chicago', 'eve,20,900,chicago', 'eve,75,1000,boston', 'eve,80,600,boston', 'eve,130,800,chicago']) == ['eve,15,1200,chicago', 'eve,20,900,chicago', 'eve,75,1000,boston', 'eve,80,600,boston', 'eve,130,800,chicago']\n assert candidate(transactions = ['charlie,10,1500,london', 'charlie,40,900,paris', 'charlie,90,1100,london', 'dave,20,800,berlin', 'dave,70,800,berlin', 'dave,110,800,moscow', 'eve,30,500,rome', 'eve,90,2000,venice', 'eve,150,400,london']) == ['charlie,10,1500,london', 'charlie,40,900,paris', 'charlie,90,1100,london', 'dave,70,800,berlin', 'dave,110,800,moscow', 'eve,30,500,rome', 'eve,90,2000,venice', 'eve,150,400,london']\n assert candidate(transactions = ['heidi,1,2000,newyork', 'heidi,5,500,newyork', 'heidi,10,1000,boston', 'heidi,15,600,boston', 'heidi,30,700,newyork', 'heidi,65,2000,boston', 'heidi,120,800,newyork']) == ['heidi,1,2000,newyork', 'heidi,5,500,newyork', 'heidi,10,1000,boston', 'heidi,15,600,boston', 'heidi,30,700,newyork', 'heidi,65,2000,boston', 'heidi,120,800,newyork']\n assert candidate(transactions = ['alice,10,1500,mtv', 'alice,15,1600,newyork', 'alice,20,1700,beijing', 'alice,25,1800,mtv', 'alice,30,1900,newyork', 'alice,35,2000,beijing']) == ['alice,10,1500,mtv', 'alice,15,1600,newyork', 'alice,20,1700,beijing', 'alice,25,1800,mtv', 'alice,30,1900,newyork', 'alice,35,2000,beijing']\n assert candidate(transactions = ['alice,10,1500,mtv', 'bob,20,800,newyork', 'alice,30,900,beijing', 'alice,60,1000,mtv', 'bob,80,1100,newyork', 'alice,120,800,mtv', 'bob,140,900,beijing']) == ['alice,10,1500,mtv', 'alice,30,900,beijing', 'alice,60,1000,mtv', 'bob,80,1100,newyork', 'bob,140,900,beijing']\n assert candidate(transactions = ['alice,10,500,mtv', 'bob,10,600,mtv', 'alice,20,1200,newyork', 'bob,20,600,newyork', 'alice,30,600,beijing', 'bob,30,600,mtv', 'alice,40,600,newyork', 'bob,40,600,beijing']) == ['alice,10,500,mtv', 'bob,10,600,mtv', 'alice,20,1200,newyork', 'bob,20,600,newyork', 'alice,30,600,beijing', 'bob,30,600,mtv', 'alice,40,600,newyork', 'bob,40,600,beijing']\n assert candidate(transactions = ['frank,10,700,boston', 'frank,30,1500,boston', 'frank,60,900,boston', 'frank,90,1200,newyork', 'frank,120,1100,paris', 'frank,150,800,boston', 'frank,180,1200,boston', 'frank,210,1100,paris', 'frank,240,800,boston', 'frank,270,1500,newyork']) == ['frank,30,1500,boston', 'frank,60,900,boston', 'frank,90,1200,newyork', 'frank,120,1100,paris', 'frank,150,800,boston', 'frank,180,1200,boston', 'frank,210,1100,paris', 'frank,240,800,boston', 'frank,270,1500,newyork']\n assert candidate(transactions = ['alice,5,500,mtv', 'bob,10,1500,beijing', 'alice,15,500,mtv', 'bob,20,1000,beijing', 'alice,25,500,beijing', 'bob,30,1000,newyork']) == ['alice,5,500,mtv', 'bob,10,1500,beijing', 'alice,15,500,mtv', 'bob,20,1000,beijing', 'alice,25,500,beijing', 'bob,30,1000,newyork']\n assert candidate(transactions = ['alice,10,500,mtv', 'bob,10,500,beijing', 'alice,70,1500,newyork', 'bob,70,1500,mtv', 'alice,120,2000,newyork', 'bob,120,2000,beijing']) == ['alice,10,500,mtv', 'bob,10,500,beijing', 'alice,70,1500,newyork', 'bob,70,1500,mtv', 'alice,120,2000,newyork', 'bob,120,2000,beijing']\n assert candidate(transactions = ['alice,10,1500,mtv', 'alice,20,800,beijing', 'alice,30,1100,mtv', 'bob,10,1500,newyork', 'bob,20,700,beijing', 'bob,30,900,newyork']) == ['alice,10,1500,mtv', 'alice,20,800,beijing', 'alice,30,1100,mtv', 'bob,10,1500,newyork', 'bob,20,700,beijing', 'bob,30,900,newyork']\n assert candidate(transactions = ['hannah,10,1000,moscow', 'hannah,20,900,moscow', 'hannah,30,800,moscow', 'hannah,40,700,moscow', 'hannah,50,600,moscow', 'hannah,60,1000,moscow', 'hannah,70,900,moscow', 'hannah,80,800,moscow', 'hannah,90,700,moscow', 'hannah,100,600,moscow', 'hannah,110,1500,paris', 'hannah,120,1600,paris', 'hannah,130,1700,paris', 'hannah,140,1800,paris', 'hannah,150,1900,paris']) == ['hannah,50,600,moscow', 'hannah,60,1000,moscow', 'hannah,70,900,moscow', 'hannah,80,800,moscow', 'hannah,90,700,moscow', 'hannah,100,600,moscow', 'hannah,110,1500,paris', 'hannah,120,1600,paris', 'hannah,130,1700,paris', 'hannah,140,1800,paris', 'hannah,150,1900,paris']\n"}, "metadata": {"canonical_parameter_names": ["transactions"], "leetcode_dataset_entry_point": "Solution().invalidTransactions", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var invalidTransactions = function(transactions) {", "container": null, "callable": "invalidTransactions", "parameters": [{"name": "transactions", "type": "string[]"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1170, "task_id": "compare-strings-by-frequency-of-the-smallest-character", "difficulty": "Medium", "problem_description": "Let the function f(s) be the frequency of the lexicographically smallest character in a non-empty string s. For example, if s = \"dcce\" then f(s) = 2 because the lexicographically smallest character is 'c', which has a frequency of 2.\nYou are given an array of strings words and another array of query strings queries. For each query queries[i], count the number of words in words such that f(queries[i]) < f(W) for each W in words.\nReturn an integer array answer, where each answer[i] is the answer to the ith query.\n \nExample 1:\n\nInput: queries = [\"cbd\"], words = [\"zaaaz\"]\nOutput: [1]\nExplanation: On the first query we have f(\"cbd\") = 1, f(\"zaaaz\") = 3 so f(\"cbd\") < f(\"zaaaz\").\n\nExample 2:\n\nInput: queries = [\"bbb\",\"cc\"], words = [\"a\",\"aa\",\"aaa\",\"aaaa\"]\nOutput: [1,2]\nExplanation: On the first query only f(\"bbb\") < f(\"aaaa\"). On the second query both f(\"aaa\") and f(\"aaaa\") are both > f(\"cc\").\n\n \nConstraints:\n\n1 <= queries.length <= 2000\n1 <= words.length <= 2000\n1 <= queries[i].length, words[i].length <= 10\nqueries[i][j], words[i][j] consist of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(queries = ['ccc'],words = ['a', 'bb', 'ccc', 'dddd']) == [1]\n assert candidate(queries = ['a', 'b', 'c'],words = ['d', 'e', 'f', 'g']) == [0, 0, 0]\n assert candidate(queries = ['abc', 'def'],words = ['ghi', 'jkl']) == [0, 0]\n assert candidate(queries = ['zzz'],words = ['aaa', 'bbb', 'ccc']) == [0]\n assert candidate(queries = ['abc', 'bcd'],words = ['def', 'ghi']) == [0, 0]\n assert candidate(queries = ['aaa', 'bbb', 'ccc'],words = ['ddd', 'eee', 'fff']) == [0, 0, 0]\n assert candidate(queries = ['a', 'aa', 'aaa'],words = ['b', 'bb', 'bbb', 'bbbb']) == [3, 2, 1]\n assert candidate(queries = ['cbd'],words = ['zaaaz']) == [1]\n assert candidate(queries = ['bbb', 'cc'],words = ['a', 'aa', 'aaa', 'aaaa']) == [1, 2]\n assert candidate(queries = ['a'],words = ['b', 'c', 'd']) == [0]\n assert candidate(queries = ['abc', 'bcd'],words = ['cde', 'def', 'efg']) == [0, 0]\n assert candidate(queries = ['xyz'],words = ['aaa', 'bbb', 'ccc', 'ddd', 'eee']) == [5]\n assert candidate(queries = ['a', 'aa'],words = ['b', 'bb', 'bbb']) == [2, 1]\n assert candidate(queries = ['xyz'],words = ['abc', 'def', 'ghi']) == [0]\n assert candidate(queries = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'],words = ['k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't']) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(queries = ['zz', 'zaz', 'zzz'],words = ['aaa', 'aa', 'a', 'aaaaa', 'aaaa', 'aaaab']) == [4, 5, 3]\n assert candidate(queries = ['aabbcc', 'ddeeff', 'gghhii'],words = ['jjkkll', 'mmnnoo', 'ppqqrr', 'ssttuu']) == [0, 0, 0]\n assert candidate(queries = ['aaa', 'aab', 'aac'],words = ['bbb', 'bbc', 'bba', 'abb', 'aba', 'aab']) == [0, 1, 1]\n assert candidate(queries = ['ab', 'bc', 'cd'],words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']) == [0, 0, 0]\n assert candidate(queries = ['abcd', 'dcba', 'abcd', 'dcba'],words = ['abcd', 'dcba', 'abcd', 'dcba', 'abcd', 'dcba']) == [0, 0, 0, 0]\n assert candidate(queries = ['abcd', 'abdc', 'acdb'],words = ['bcde', 'cdef', 'defg', 'efgh']) == [0, 0, 0]\n assert candidate(queries = ['aaaa', 'bbb', 'cc'],words = ['zzzz', 'zzz', 'zz', 'z']) == [0, 1, 2]\n assert candidate(queries = ['a', 'b', 'c', 'd', 'e', 'f'],words = ['g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p']) == [0, 0, 0, 0, 0, 0]\n assert candidate(queries = ['abcdabcd', 'bcdbcd', 'cdcdcd'],words = ['ddd', 'dddd', 'ddddd']) == [3, 3, 2]\n assert candidate(queries = ['a', 'a', 'a', 'a'],words = ['b', 'b', 'b', 'b']) == [0, 0, 0, 0]\n assert candidate(queries = ['abcde', 'bcdef', 'cdefg'],words = ['defgh', 'efghi', 'fghij', 'ghijk', 'hijkl', 'ijklm']) == [0, 0, 0]\n assert candidate(queries = ['zzzzzzz', 'zzzzzz', 'zzzzz', 'zzzz', 'zzz'],words = ['zzzz', 'zzz', 'zz', 'z', 'a']) == [0, 0, 0, 0, 1]\n assert candidate(queries = ['hello', 'world'],words = ['python', 'java', 'csharp', 'ruby', 'swift']) == [1, 1]\n assert candidate(queries = ['abcd', 'ab', 'abc'],words = ['abcd', 'abc', 'ab', 'a']) == [0, 0, 0]\n assert candidate(queries = ['x', 'xx', 'xxx', 'xxxx', 'xxxxx'],words = ['y', 'yy', 'yyy', 'yyyy', 'yyyyy', 'yyyyyy']) == [5, 4, 3, 2, 1]\n assert candidate(queries = ['xyxzyz', 'yzyzyx', 'zxzyxz'],words = ['zxyzxy', 'xyzxyz', 'yzxyzx', 'zyxzyz']) == [0, 3, 0]\n assert candidate(queries = ['abcdefghij', 'bcdefghijk', 'cdefghijkl'],words = ['defghijklm', 'efghijklmn', 'fghijklmno', 'ghijklmnop', 'hijklmnopq', 'ijklmnopqr']) == [0, 0, 0]\n assert candidate(queries = ['xyz', 'xyzz', 'xyzzz'],words = ['wxyz', 'wwxyz', 'wwwxyz', 'wwwwxyz']) == [3, 3, 3]\n assert candidate(queries = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba'],words = ['qwertyuiopasdfghjklzxcvbnm', 'mnbvcxzasdfghjklpoiuytrewq']) == [0, 0]\n assert candidate(queries = ['zzzzzz', 'yyyyyy', 'xxxxxx'],words = ['wwwwww', 'vvvvvv', 'uuuuuu', 'tttttt']) == [0, 0, 0]\n assert candidate(queries = ['aabbcc', 'bbccdd', 'ccddee', 'ddeeff', 'eeffgg'],words = ['ffgghh', 'gghhiijj', 'hhiijjkk', 'iijjkkll', 'jjkkllmm']) == [0, 0, 0, 0, 0]\n assert candidate(queries = ['abcdef', 'bcdefg', 'cdefgh'],words = ['defghi', 'efghij', 'fghijk', 'ghijkl', 'hijklm', 'ijklmn']) == [0, 0, 0]\n assert candidate(queries = ['zzz', 'zzzz'],words = ['aaaaa', 'aaa', 'aa', 'a']) == [1, 1]\n assert candidate(queries = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa'],words = ['z', 'zz', 'zzz', 'zzzz', 'zzzzz', 'zzzzzz']) == [5, 4, 3, 2, 1]\n assert candidate(queries = ['zzzzz', 'zzzz', 'zzz', 'zz', 'z'],words = ['zzzzzz', 'zzzzz', 'zzzz', 'zzz', 'zz', 'z', 'a']) == [1, 2, 3, 4, 5]\n assert candidate(queries = ['zzz', 'zz', 'z'],words = ['aaa', 'aa', 'a', 'aaaa']) == [1, 2, 3]\n assert candidate(queries = ['aabbcc', 'bbaacc', 'ccaabb'],words = ['aabbb', 'bbccc', 'ccaaa', 'abcabc', 'aabbccaa']) == [2, 2, 2]\n assert candidate(queries = ['aab', 'abb', 'abc'],words = ['aab', 'abb', 'abc', 'acc', 'bac', 'bca', 'cab', 'cba', 'cca']) == [0, 1, 1]\n assert candidate(queries = ['aaaaab', 'aaaabb', 'aaabbb', 'aabbbb', 'abbbbb'],words = ['bbbbb', 'bbbb', 'bbb', 'bb', 'b']) == [0, 1, 2, 3, 4]\n assert candidate(queries = ['apple', 'banana', 'cherry'],words = ['date', 'elderberry', 'fig', 'grape', 'kiwi', 'lemon', 'mango', 'nectarine', 'orange', 'papaya']) == [2, 0, 2]\n assert candidate(queries = ['apple', 'banana', 'cherry'],words = ['date', 'fig', 'grape', 'kiwi']) == [1, 0, 1]\n assert candidate(queries = ['aabbcc', 'bbaacc', 'ccaabb'],words = ['aabbc', 'bbccc', 'ccaab', 'aaabb', 'bbcca', 'ccaab']) == [1, 1, 1]\n assert candidate(queries = ['apple', 'banana', 'cherry'],words = ['date', 'elderberry', 'fig', 'grape']) == [0, 0, 0]\n assert candidate(queries = ['zzzzz', 'zzzz', 'zzz', 'zz', 'z'],words = ['aaaaa', 'aaaa', 'aaa', 'aa', 'a']) == [0, 1, 2, 3, 4]\n assert candidate(queries = ['mnopqr', 'nopqrs', 'opqrst'],words = ['pqrsqt', 'qrstuv', 'rstuvw', 'stuvwx', 'tuvwxy', 'uvwxyx']) == [0, 0, 0]\n assert candidate(queries = ['zzz', 'yyy', 'xxx'],words = ['www', 'vvv', 'uuu', 'ttt', 'ss']) == [0, 0, 0]\n assert candidate(queries = ['aabbcc', 'bbccdd', 'ccddeeff'],words = ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh', 'ghi', 'hij']) == [0, 0, 0]\n assert candidate(queries = ['abcd', 'abc', 'ab'],words = ['zzzz', 'zzz', 'zz', 'z']) == [3, 3, 3]\n assert candidate(queries = ['aabbcc', 'bbccdd', 'ccddaa'],words = ['ddeeff', 'eeffgg', 'ffgghh']) == [0, 0, 0]\n assert candidate(queries = ['aab', 'aabbb', 'aabbbb'],words = ['b', 'bb', 'bbb', 'bbbb', 'bbbbb', 'bbbbbb', 'bbbbbbb']) == [5, 5, 5]\n assert candidate(queries = ['leetcode', 'challenge', 'python'],words = ['programming', 'interview', 'solution', 'difficulty', 'easy', 'hard', 'medium']) == [1, 1, 1]\n assert candidate(queries = ['abcd', 'abcde', 'abcdef'],words = ['bcdefg', 'cdefgh', 'defghi', 'efghij']) == [0, 0, 0]\n assert candidate(queries = ['abcd', 'abdc', 'adcb'],words = ['bcde', 'dcbe', 'debc', 'edcb']) == [0, 0, 0]\n assert candidate(queries = ['mississippi', 'delaware', 'kentucky'],words = ['alabama', 'missouri', 'georgia', 'texas', 'california', 'arizona', 'wyoming']) == [0, 1, 4]\n assert candidate(queries = ['abcdefg', 'hijklmn', 'opqrstu', 'vwxyzab'],words = ['cdefghi', 'defghij', 'efghijk', 'fghijkl', 'ghijklm']) == [0, 0, 0, 0]\n assert candidate(queries = ['abcdef', 'ghijkl', 'mnopqr'],words = ['stuvwx', 'yzabcd', 'efghij', 'klmnop', 'qrstuv']) == [0, 0, 0]\n assert candidate(queries = ['apple', 'banana', 'cherry'],words = ['date', 'fig', 'grape', 'kiwi', 'lemon', 'mango']) == [1, 0, 1]\n assert candidate(queries = ['hello', 'world'],words = ['python', 'java', 'c++', 'ruby']) == [1, 1]\n assert candidate(queries = ['abcd', 'abdc', 'aabc'],words = ['aaa', 'aaab', 'baaab', 'baaabbb']) == [4, 4, 4]\n assert candidate(queries = ['a'],words = ['aaaaaaaaaab', 'aaaaaaaaaa', 'aaaaaaaaa', 'aaaaaaaa', 'aaaaaaa', 'aaaaaa', 'aaaaa', 'aaaa', 'aaa', 'aa', 'a']) == [10]\n assert candidate(queries = ['a', 'b', 'c', 'd', 'e', 'f'],words = ['g', 'h', 'i', 'j', 'k', 'l', 'm']) == [0, 0, 0, 0, 0, 0]\n assert candidate(queries = ['zzz', 'zzzz', 'zzzzz'],words = ['zzzzzz', 'zzzzzzz', 'zzzzzzzz', 'zzzzzzzzz']) == [4, 4, 4]\n assert candidate(queries = ['zzzzzz', 'zzzzz', 'zzzz', 'zzz', 'zz', 'z'],words = ['aaaaaa', 'aaaaa', 'aaaa', 'aaa', 'aa', 'a']) == [0, 1, 2, 3, 4, 5]\n assert candidate(queries = ['abcdef', 'bcdefg', 'cdefgh'],words = ['defghi', 'efghij', 'fghijk', 'ghijkl', 'hijklm']) == [0, 0, 0]\n assert candidate(queries = ['xylophone', 'guitar', 'piano'],words = ['flute', 'harmonica', 'trumpet', 'violin', 'cello', 'saxophone', 'trombone', 'tuba']) == [2, 2, 2]\n assert candidate(queries = ['zz', 'yy', 'xx'],words = ['ww', 'vv', 'uu', 'tt', 'ss', 'rr', 'qq', 'pp', 'oo', 'nn']) == [0, 0, 0]\n assert candidate(queries = ['abcxyz', 'zzzz', 'uvw'],words = ['mnop', 'qrst', 'xyz', 'aabbcc']) == [1, 0, 1]\n assert candidate(queries = ['mnop', 'qrst', 'uvwx', 'yzab', 'cdef'],words = ['efgh', 'ghij', 'ijkl', 'klmn', 'lmno']) == [0, 0, 0, 0, 0]\n assert candidate(queries = ['zzz', 'yyy', 'xxx'],words = ['www', 'vvv', 'uuu', 'ttt']) == [0, 0, 0]\n assert candidate(queries = ['xyzz', 'zzyx', 'zzyy'],words = ['zzzz', 'zzyz', 'zyzz', 'zzzy', 'zyyz', 'zyzy', 'zyzz', 'zzzyz']) == [3, 3, 1]\n assert candidate(queries = ['a', 'b', 'c', 'd', 'e'],words = ['f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o']) == [0, 0, 0, 0, 0]\n assert candidate(queries = ['zzz', 'zzzz', 'zzzzz'],words = ['zzzzzz', 'zzzzzzz', 'zzzzzzzz', 'zzzzzzzzz', 'zzzzzzzzzz']) == [5, 5, 5]\n assert candidate(queries = ['aaaaa', 'bbb', 'cccc'],words = ['ddd', 'eee', 'ffff', 'ggggg']) == [0, 2, 1]\n assert candidate(queries = ['mnop', 'qrst', 'uvwx', 'yzab'],words = ['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yzab']) == [0, 0, 0, 0]\n assert candidate(queries = ['abcdabcd', 'abcdeabcde', 'abcdefabcdef'],words = ['bcdefgbcdefg', 'cdefghcdefgh', 'defghidefghi']) == [0, 0, 0]\n assert candidate(queries = ['zzzz', 'yyyy', 'xxxx', 'wwww'],words = ['vvvv', 'uuuu', 'tttt', 'ssss', 'rrrr', 'qqqq', 'pppp', 'oooo', 'nnnn', 'mmmm']) == [0, 0, 0, 0]\n assert candidate(queries = ['applepie', 'bananabread', 'cherrypie'],words = ['strawberry', 'blueberry', 'raspberry']) == [1, 0, 1]\n assert candidate(queries = ['abcd', 'abcde', 'abcdef'],words = ['bcde', 'bcdef', 'bcdefg', 'bcdefgh', 'bcdefghi', 'bcdefghij']) == [0, 0, 0]\n assert candidate(queries = ['zzz', 'yyy', 'xxx'],words = ['www', 'vvv', 'uuu', 'ttt', 'sss']) == [0, 0, 0]\n assert candidate(queries = ['abc', 'abcd', 'abcde', 'abcdef'],words = ['bcde', 'cdef', 'defg', 'efgh', 'fghi', 'ghij', 'hijk', 'ijkl']) == [0, 0, 0, 0]\n assert candidate(queries = ['xyz', 'xyzz', 'xyzzz'],words = ['uvw', 'uvwv', 'uvwvv', 'uvwvvv', 'uvwvvvv', 'uvwvvvvv']) == [0, 0, 0]\n assert candidate(queries = ['aabbcc', 'bbccdd', 'ccddee'],words = ['ddeeff', 'eeffgg', 'ffgghh', 'gghhii']) == [0, 0, 0]\n assert candidate(queries = ['zzzzz', 'yyyyy', 'xxxxx'],words = ['wwwww', 'vvvvv', 'uuuuu', 'ttttt', 'sssss']) == [0, 0, 0]\n assert candidate(queries = ['abcdefgh', 'hgfedcba', 'fedcbahg'],words = ['ghfedcba', 'ahgfedcb', 'bahgfedc', 'cbahgfed', 'dcbahegf', 'efgdcba', 'gfedcba', 'hgfedcb', 'abcdefgh']) == [0, 0, 0]\n assert candidate(queries = ['abcdabcd', 'bcdbcd', 'cdab'],words = ['ababcdabcd', 'bcdbcdabcd', 'cdababcd', 'abcdabcdabcd', 'bcdabcd', 'cdabcd', 'abcd']) == [2, 2, 3]\n assert candidate(queries = ['ab', 'abc', 'abcd'],words = ['bc', 'bcd', 'bcde', 'bcdef', 'bcdefg', 'bcdefgh']) == [0, 0, 0]\n assert candidate(queries = ['zzzzzzzzzz', 'zzzzzzzzz', 'zzzzzzzz', 'zzzzzzz', 'zzzzzz', 'zzzzz', 'zzzz', 'zzz', 'zz', 'z'],words = ['aaaaaaaaaa', 'aaaaaaaaa', 'aaaaaaaa', 'aaaaaaa', 'aaaaaa', 'aaaaa', 'aaaa', 'aaa', 'aa', 'a']) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n assert candidate(queries = ['zz', 'yy', 'xx', 'ww', 'vv'],words = ['uu', 'tt', 'ss', 'rr', 'qq', 'pp', 'oo', 'nn', 'mm', 'll']) == [0, 0, 0, 0, 0]\n assert candidate(queries = ['abcdef', 'ghijkl', 'mnopqr'],words = ['stuvwx', 'yzabcd', 'efghij', 'klmnop']) == [0, 0, 0]\n assert candidate(queries = ['mmmmmm', 'nnnnnn', 'oooooo', 'pppppp'],words = ['qqqqqq', 'rrrrrr', 'ssssss', 'tttttt']) == [0, 0, 0, 0]\n assert candidate(queries = ['qwerty', 'asdfgh', 'zxcvbn'],words = ['poiuyt', 'lkjhgf', 'mnbvcx', 'tyuiop', 'ghjklcvbnm']) == [0, 0, 0]\n assert candidate(queries = ['xyz', 'zyx', 'yxz'],words = ['qrs', 'rsq', 'srq']) == [0, 0, 0]\n assert candidate(queries = ['aaaaaaaa', 'bbbbbbbb', 'cccccccc'],words = ['dddddddd', 'eeeeeeee', 'ffffffff', 'gggggggg', 'hhhhhhhh', 'iiiiiiii', 'jjjjjjjj', 'kkkkkkkk', 'llllllll']) == [0, 0, 0]\n assert candidate(queries = ['ab', 'bc', 'cd', 'de', 'ef'],words = ['zz', 'zy', 'yx', 'xw', 'vw', 'uv', 'tu', 'ts', 'sr', 'rq', 'qp', 'po', 'on', 'nm', 'ml', 'lk', 'kj', 'ji', 'ih', 'hg', 'gf', 'fe', 'ed', 'dc', 'cb', 'ba']) == [1, 1, 1, 1, 1]\n assert candidate(queries = ['apple', 'banana', 'cherry'],words = ['date', 'elderberry', 'fig', 'grape', 'honeydew']) == [0, 0, 0]\n"}, "metadata": {"canonical_parameter_names": ["queries", "words"], "leetcode_dataset_entry_point": "Solution().numSmallerByFrequency", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numSmallerByFrequency = function(queries, words) {", "container": null, "callable": "numSmallerByFrequency", "parameters": [{"name": "queries", "type": "string[]"}, {"name": "words", "type": "string[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1171, "task_id": "remove-zero-sum-consecutive-nodes-from-linked-list", "difficulty": "Medium", "problem_description": "Given the head of a linked list, we repeatedly delete consecutive sequences of nodes that sum to 0 until there are no such sequences.\\r\n\\r\nAfter doing so, return the head of the final linked list.  You may return any such answer.\\r\n\n \n(Note that in the examples below, all sequences are serializations of ListNode objects.)\nExample 1:\n\nInput: head = [1,2,-3,3,1]\nOutput: [3,1]\nNote: The answer [1,2,1] would also be accepted.\n\nExample 2:\n\nInput: head = [1,2,3,-3,4]\nOutput: [1,2,4]\n\nExample 3:\n\nInput: head = [1,2,3,-3,-2]\nOutput: [1]\n\n \nConstraints:\n\nThe given linked list will contain between 1 and 1000 nodes.\nEach node in the linked list has -1000 <= node.val <= 1000.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(head = list_node([0, 0, 0, 0])) == None\n assert is_same_list(candidate(head = list_node([1, 0, 1, -1, 2])), list_node([1, 2]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5])), list_node([1, 2, 3, 4, 5]))\n assert is_same_list(candidate(head = list_node([10, 20, -30, 40, -50, 60, -10, -50])), list_node([40, -50]))\n assert candidate(head = list_node([1, -1, 1, -1])) == None\n assert is_same_list(candidate(head = list_node([1, 2, 3, -3, 4])), list_node([1, 2, 4]))\n assert is_same_list(candidate(head = list_node([1, -1, 2, -2, 3])), list_node([3]))\n assert candidate(head = list_node([-1, 1, -1, 1, -1, 1])) == None\n assert is_same_list(candidate(head = list_node([1])), list_node([1]))\n assert candidate(head = list_node([-1, 1, 0])) == None\n assert candidate(head = list_node([1, -1, 2, -2, 3, -3, 4, -4])) == None\n assert is_same_list(candidate(head = list_node([1, 0, -1, 2])), list_node([2]))\n assert candidate(head = list_node([-1, 1])) == None\n assert is_same_list(candidate(head = list_node([10, 5, -5, 3, 2, -2])), list_node([10, 3]))\n assert candidate(head = list_node([-1, 1, -1, 1, -1, 1, -1, 1])) == None\n assert candidate(head = list_node([0])) == None\n assert candidate(head = list_node([0, 0, 0])) == None\n assert is_same_list(candidate(head = list_node([-1])), list_node([-1]))\n assert is_same_list(candidate(head = list_node([1, 2, -3, 3, 1])), list_node([3, 1]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, -3, -2])), list_node([1]))\n assert candidate(head = list_node([10, 5, 3, -3, -5, -10])) == None\n assert candidate(head = list_node([1, -1, 2, -2, 3, -3])) == None\n assert is_same_list(candidate(head = list_node([1, 2, 3, 0, 4, 0, -4])), list_node([1, 2, 3]))\n assert candidate(head = list_node([5, 6, 7, -7, -6, -5])) == None\n assert is_same_list(candidate(head = list_node([10, 20, -10, -10])), list_node([10]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, -5, 4, -4, 3, -3, 2, -2, 1, -1])), list_node([1, 2, 3, 4]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, -28, 8, 9])), list_node([8, 9]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, -10, 1, 2, 3, 4])), list_node([1, 2, 3, 4]))\n assert candidate(head = list_node([-1, 1, -2, 2, -3, 3, -4, 4, 5, -5])) == None\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, -15, 5, 6, 7, 8, -30, 10, 11])), list_node([5, 6, 7, 8, -30, 10, 11]))\n assert candidate(head = list_node([1, 2, 3, 4, 5, -5, -4, -3, -2, -1])) == None\n assert is_same_list(candidate(head = list_node([10, -5, -5, 3, 2, -2, 1, -1])), list_node([3]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, -6, 2, 3, 4, -9, 1, 2])), list_node([1, 2]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, -10, 1, 2, 3])), list_node([1, 2, 3, 2, 3]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, -2, -1, 1, 4])), list_node([1, 2, 1, 4]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, -6, 4, -4, 5, 0, -5, 6])), list_node([6]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, -21, 7, 8, 9, 10, -35, 11, 12])), list_node([7, 8, 9, 10, -35, 11, 12]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, -6, 2, 3, 4, -9, 5])), list_node([5]))\n assert is_same_list(candidate(head = list_node([100, -50, -50, 200, 300, -500, 400, 500, -1000, 600])), list_node([400, 500, -1000, 600]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 0, 0, 0, 4, 5, -9])), list_node([1, 2, 3]))\n assert is_same_list(candidate(head = list_node([1, -1, 2, -2, 3, -3, 4, -4, 5])), list_node([5]))\n assert candidate(head = list_node([100, -50, -50, 25, -25, 50, -50, 25, -25, 100, -100])) == None\n assert is_same_list(candidate(head = list_node([10, -10, 20, -20, 30, -30, 40])), list_node([40]))\n assert is_same_list(candidate(head = list_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, -5, 5, -3, -2])), list_node([1]))\n assert is_same_list(candidate(head = list_node([0, 0, 0, 1, 2, -3, 3, -2, 2])), list_node([3]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, -3, -2, -1, 4, -4, 5])), list_node([5]))\n assert is_same_list(candidate(head = list_node([1, -1, 2, -2, 3, -3, 4, -4, 5])), list_node([5]))\n assert candidate(head = list_node([1, -2, 3, -3, 2, -1, 4, -4, 5, -5])) == None\n assert candidate(head = list_node([0, 1, 2, 3, 0, -3, -2, -1, 0])) == None\n assert is_same_list(candidate(head = list_node([1, 2, -3, 3, -2, 2, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8])), list_node([3]))\n assert is_same_list(candidate(head = list_node([10, -10, 20, -20, 30, -30, 40])), list_node([40]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -120, 16])), list_node([16]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, -5, 5, -6, 6, -7, 7, 8])), list_node([1, 2, 7, 8]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, -10, 5, 5, -5])), list_node([5]))\n assert candidate(head = list_node([1, -1, 1, -1, 1, -1, 1, -1])) == None\n assert is_same_list(candidate(head = list_node([1, 0, -1, 0, 1, 0, -1, 0, 1])), list_node([1]))\n assert is_same_list(candidate(head = list_node([5, 1, 4, -10, 20, -5, -15, 2, 3, 4, -9, 1])), list_node([1]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, -10, 5, 6, 7, 8, -30, 9, 10])), list_node([5, 10]))\n assert is_same_list(candidate(head = list_node([10, -2, 3, -1, 5, -3, 2, -2, 1, -1])), list_node([10, 5, -3]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, -3, -5, -10, 20])), list_node([1, 2, 20]))\n assert candidate(head = list_node([1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9])) == None\n assert is_same_list(candidate(head = list_node([5, 3, -5, 2, -2, 1])), list_node([5, -2, 1]))\n assert is_same_list(candidate(head = list_node([5, 6, -6, 7, 8, -15, 9])), list_node([5, 9]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, -21, 7, 8, 9, 10, -35, 1, 2, 3])), list_node([2, 3]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, -10, 5, 5])), list_node([5, 5]))\n assert candidate(head = list_node([1, 2, 3, 4, 5, -5, -4, -3, -2, -1, 6, 7, 8, -8, -7, -6])) == None\n assert is_same_list(candidate(head = list_node([5, 6, 7, -18, 19, 20, -39, 21, 22, 23, -65, 24])), list_node([21, 22, 23, -65, 24]))\n assert is_same_list(candidate(head = list_node([100, -50, -50, 200, -100, -100, 300, -200, -200, 400])), list_node([300]))\n assert candidate(head = list_node([1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9])) == None\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, -21, 7, 8, 9])), list_node([7, 8, 9]))\n assert candidate(head = list_node([5, -5, 5, -5, 5, -5])) == None\n assert is_same_list(candidate(head = list_node([0, 0, 0, 1, 2, 3, -6, 7, 8, -15, 9])), list_node([9]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, -10, 3, 4, 5, -12, 6, 7])), list_node([6, 7]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 0, 0, 0, 4, 5])), list_node([1, 2, 3, 4, 5]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, -15, 6, 7, 8, 9, 10, -33, 11, 12])), list_node([6, 7, 8, 9]))\n assert candidate(head = list_node([1, 2, 3, 4, -10, 2, 3, 4, 5, -14])) == None\n assert is_same_list(candidate(head = list_node([5, 0, 5, -5, 10, -10, 15, -15, 20])), list_node([5, 20]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, -3, 4, -4, 5])), list_node([1, 2, 5]))\n assert candidate(head = list_node([0, 0, 0, 0, 0, 0, 0])) == None\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, -10, 10, 1, 2, 3, 4, -10, 10])), list_node([10, 10]))\n assert candidate(head = list_node([0, 1, 2, 3, 4, 5, -5, -4, -3, -2, -1, 0])) == None\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, -10, 5, 6, 7, 8, 9, 10, -5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -50])), list_node([5, 6, 7, 8, 9, 10]))\n assert is_same_list(candidate(head = list_node([1000, -500, -250, 250, -250, 500, -1000, 2000, -2000, 3000, -3000])), list_node([1000, -500, -250, 500, -1000]))\n assert is_same_list(candidate(head = list_node([5, -5, 10, -10, 15, -15, 20, -20, 25])), list_node([25]))\n assert is_same_list(candidate(head = list_node([1, 2, -3, 3, -2, 2, 1, -1])), list_node([3]))\n assert candidate(head = list_node([1, 2, 3, -6, 3, 2, 1, 0, -1, -2, -3, 0])) == None\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -55, 11, 12, 13, 14, 15, 16])), list_node([11, 12, 13, 14, 15, 16]))\n assert is_same_list(candidate(head = list_node([5, 6, -11, 1, 2, 3, -5, -6, 7])), list_node([1, -6, 7]))\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, -45])) == None\n assert is_same_list(candidate(head = list_node([1, 0, 0, 0, 0, 0, 1])), list_node([1, 1]))\n assert is_same_list(candidate(head = list_node([5, 6, -11, 10, 5, -10])), list_node([10, 5, -10]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, -15, 6])), list_node([6]))\n assert candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -55])) == None\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -55, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])), list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))\n assert candidate(head = list_node([100, -50, 25, -25, -25, 25, -100, 50])) == None\n assert is_same_list(candidate(head = list_node([1, 2, 3, -3, 4, 0, 5, -5, 6])), list_node([1, 2, 4, 6]))\n assert is_same_list(candidate(head = list_node([10, -3, 4, -3, 6, -6, 2])), list_node([10]))\n assert is_same_list(candidate(head = list_node([100, -50, 50, -50, 50, -50, 50, -50, 50, -50])), list_node([100, -50]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -55, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])), list_node([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 0, -5, 0, 0, 0, 6, 7, 8, -20])), list_node([1, 2, 3, 4, 6, 7, 8, -20]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 6, 7, 8, -24])), list_node([1, 2, 3, 4, 5, 6, 7, 8, -24]))\n assert candidate(head = list_node([7, 8, 9, -9, -8, -7, 10, -10, 11, 12, -12, -11])) == None\n assert is_same_list(candidate(head = list_node([10, 20, -10, -10, 30, 40, -70, 80])), list_node([10, 80]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -45, 5, 5, -10])), list_node([1, 2, 3, 4]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, -45, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -190])), list_node([10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -190]))\n assert is_same_list(candidate(head = list_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])), list_node([1]))\n assert is_same_list(candidate(head = list_node([0, 0, 0, 0, 1, 2, 3, 4, 5, -14, 0, 0])), list_node([1]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 0, 0, 0, 4, 5, -9, 6, 7, -13])), list_node([1, 2, 3]))\n assert is_same_list(candidate(head = list_node([10, -5, 5, -10, 20, -10, 5])), list_node([20, -10, 5]))\n assert is_same_list(candidate(head = list_node([5, 6, 7, 8, -20, 3, 4, 5, 6, -18, 1, 2])), list_node([5, 6, 7, 6, -18, 1, 2]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -45, 11, 12, 13, 14, 15, 16, -80])), list_node([1, 2, 3, 4, 11, 12, 13, 14, 15, 16, -80]))\n assert candidate(head = list_node([-1, 1, 1, -1, 1, -1, 1, 1, -1, -1])) == None\n assert candidate(head = list_node([1, -1, 2, -2, 3, -3, 4, -4, 5, -5])) == None\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, -10, 5, 6, 7, 8, 9, 10, -40, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])), list_node([5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))\n assert is_same_list(candidate(head = list_node([0, 1, 2, 3, 4, 5, -15, 10])), list_node([10]))\n assert is_same_list(candidate(head = list_node([10, -5, -3, 2, 3, -2, 1, 2, -1, 0, 0, 0])), list_node([10, -5, 1, 2, -1]))\n assert is_same_list(candidate(head = list_node([10, 20, -10, -10, 30, 40, -50, 20])), list_node([10, 30, 40, -50, 20]))\n assert is_same_list(candidate(head = list_node([1, 2, 3, 4, 5, -1, 0, 1, -1, 0])), list_node([1, 2, 3, 4, 5, -1]))\n assert candidate(head = list_node([-1, 1, -2, 2, -3, 3, -4, 4, 5, -5])) == None\n"}, "metadata": {"canonical_parameter_names": ["head"], "leetcode_dataset_entry_point": "Solution().removeZeroSumSublists", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var removeZeroSumSublists = function(head) {", "container": null, "callable": "removeZeroSumSublists", "parameters": [{"name": "head", "type": "ListNode"}], "return_type": "ListNode", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1175, "task_id": "prime-arrangements", "difficulty": "Easy", "problem_description": "Return the number of permutations of 1 to n so that prime numbers are at prime indices (1-indexed.)\n(Recall that an integer is prime if and only if it is greater than 1, and cannot be written as a product of two positive integers both smaller than it.)\nSince the answer may be large, return the answer modulo 10^9 + 7.\n \nExample 1:\n\nInput: n = 5\nOutput: 12\nExplanation: For example [1,2,5,4,3] is a valid permutation, but [5,2,3,4,1] is not because the prime number 5 is at index 1.\n\nExample 2:\n\nInput: n = 100\nOutput: 682289015\n\n \nConstraints:\n\n1 <= n <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 30) == 13697484\n assert candidate(n = 99) == 75763854\n assert candidate(n = 75) == 918450925\n assert candidate(n = 20) == 344376809\n assert candidate(n = 2) == 1\n assert candidate(n = 19) == 445364737\n assert candidate(n = 100) == 682289015\n assert candidate(n = 50) == 451768713\n assert candidate(n = 1) == 1\n assert candidate(n = 10) == 17280\n assert candidate(n = 5) == 12\n assert candidate(n = 97) == 519081041\n assert candidate(n = 3) == 2\n assert candidate(n = 61) == 250895270\n assert candidate(n = 47) == 627742601\n assert candidate(n = 70) == 892906519\n assert candidate(n = 60) == 125049738\n assert candidate(n = 40) == 965722612\n assert candidate(n = 4) == 4\n assert candidate(n = 37) == 546040181\n assert candidate(n = 98) == 892915734\n assert candidate(n = 73) == 78238453\n assert candidate(n = 80) == 405243354\n assert candidate(n = 89) == 673469112\n assert candidate(n = 85) == 430788419\n assert candidate(n = 83) == 913651722\n assert candidate(n = 90) == 448961084\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().numPrimeArrangements", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numPrimeArrangements = function(n) {", "container": null, "callable": "numPrimeArrangements", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1177, "task_id": "can-make-palindrome-from-substring", "difficulty": "Medium", "problem_description": "You are given a string s and array queries where queries[i] = [lefti, righti, ki]. We may rearrange the substring s[lefti...righti] for each query and then choose up to ki of them to replace with any lowercase English letter.\nIf the substring is possible to be a palindrome string after the operations above, the result of the query is true. Otherwise, the result is false.\nReturn a boolean array answer where answer[i] is the result of the ith query queries[i].\nNote that each letter is counted individually for replacement, so if, for example s[lefti...righti] = \"aaa\", and ki = 2, we can only replace two of the letters. Also, note that no query modifies the initial string s.\n \nExample :\n\nInput: s = \"abcda\", queries = [[3,3,0],[1,2,0],[0,3,1],[0,3,2],[0,4,1]]\nOutput: [true,false,false,true,true]\nExplanation:\nqueries[0]: substring = \"d\", is palidrome.\nqueries[1]: substring = \"bc\", is not palidrome.\nqueries[2]: substring = \"abcd\", is not palidrome after replacing only 1 character.\nqueries[3]: substring = \"abcd\", could be changed to \"abba\" which is palidrome. Also this can be changed to \"baab\" first rearrange it \"bacd\" then replace \"cd\" with \"ab\".\nqueries[4]: substring = \"abcda\", could be changed to \"abcba\" which is palidrome.\n\nExample 2:\n\nInput: s = \"lyb\", queries = [[0,1,0],[2,2,1]]\nOutput: [false,true]\n\n \nConstraints:\n\n1 <= s.length, queries.length <= 105\n0 <= lefti <= righti < s.length\n0 <= ki <= s.length\ns consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"abcd\",queries = [[0, 2, 1], [1, 3, 1]]) == [True, True]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",queries = [[0, 25, 12], [0, 25, 13], [0, 25, 14]]) == [False, True, True]\n assert candidate(s = \"zaz\",queries = [[0, 2, 1], [0, 1, 0], [1, 2, 0]]) == [True, False, False]\n assert candidate(s = \"abcda\",queries = [[3, 3, 0], [1, 2, 0], [0, 3, 1], [0, 3, 2], [0, 4, 1]]) == [True, False, False, True, True]\n assert candidate(s = \"aaaa\",queries = [[0, 3, 0], [1, 2, 0]]) == [True, True]\n assert candidate(s = \"aabbc\",queries = [[0, 4, 2], [1, 3, 1]]) == [True, True]\n assert candidate(s = \"aaaa\",queries = [[0, 3, 0], [0, 2, 0], [1, 3, 0]]) == [True, True, True]\n assert candidate(s = \"aabbc\",queries = [[0, 4, 1], [1, 3, 0]]) == [True, True]\n assert candidate(s = \"lyb\",queries = [[0, 1, 0], [2, 2, 1]]) == [False, True]\n assert candidate(s = \"abcd\",queries = [[0, 0, 0], [1, 1, 0], [2, 2, 0], [3, 3, 0], [0, 3, 2]]) == [True, True, True, True, True]\n assert candidate(s = \"abcdedcba\",queries = [[0, 8, 0], [1, 7, 1], [2, 6, 2]]) == [True, True, True]\n assert candidate(s = \"abcd\",queries = [[0, 0, 0], [1, 1, 0], [2, 2, 0], [3, 3, 0], [0, 3, 2], [0, 3, 3]]) == [True, True, True, True, True, True]\n assert candidate(s = \"aabbc\",queries = [[0, 4, 0], [0, 4, 1], [0, 4, 2]]) == [True, True, True]\n assert candidate(s = \"mississippi\",queries = [[0, 10, 3], [2, 8, 2], [0, 4, 1]]) == [True, True, True]\n assert candidate(s = \"abcdefghijkilmnopqrstuvwxyz\",queries = [[0, 25, 12], [1, 24, 11], [2, 23, 10], [3, 22, 9], [4, 21, 8], [5, 20, 7], [6, 19, 6]]) == [True, True, True, True, True, True, True]\n assert candidate(s = \"racecar\",queries = [[0, 6, 0], [1, 5, 0], [2, 4, 0], [0, 5, 1], [1, 4, 1]]) == [True, True, True, True, True]\n assert candidate(s = \"mississippi\",queries = [[0, 4, 1], [1, 5, 1], [2, 6, 1], [3, 7, 1], [4, 8, 1], [5, 9, 1], [6, 10, 1]]) == [True, True, True, True, True, True, True]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",queries = [[0, 51, 12], [10, 20, 5], [30, 40, 10], [25, 45, 20]]) == [True, True, True, True]\n assert candidate(s = \"aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd\",queries = [[0, 9, 4], [10, 19, 5], [20, 29, 6], [30, 39, 7], [0, 39, 20]]) == [True, True, True, True, True]\n assert candidate(s = \"almostapalindromeexample\",queries = [[0, 20, 5], [5, 15, 3], [10, 20, 6], [0, 20, 8], [5, 15, 2]]) == [True, False, True, True, False]\n assert candidate(s = \"a\",queries = [[0, 0, 0], [0, 0, 1]]) == [True, True]\n assert candidate(s = \"abcdefghij\",queries = [[0, 4, 2], [5, 9, 2], [0, 9, 4], [0, 9, 5], [2, 7, 2]]) == [True, True, False, True, False]\n assert candidate(s = \"anagram\",queries = [[0, 6, 3], [1, 5, 2], [2, 4, 1], [0, 5, 2], [1, 4, 1], [2, 3, 0]]) == [True, True, True, True, False, False]\n assert candidate(s = \"palindrome\",queries = [[0, 7, 3], [1, 6, 2], [2, 5, 1], [0, 6, 2], [1, 5, 1]]) == [False, False, False, False, False]\n assert candidate(s = \"racecar\",queries = [[0, 6, 0], [1, 5, 0], [2, 4, 0], [0, 5, 1], [1, 4, 1], [0, 4, 2]]) == [True, True, True, True, True, True]\n assert candidate(s = \"mississippi\",queries = [[0, 4, 1], [0, 6, 2], [0, 8, 3], [0, 10, 4], [1, 5, 1], [2, 6, 2], [3, 7, 3], [4, 8, 4], [5, 9, 3], [6, 10, 4]]) == [True, True, True, True, True, True, True, True, True, True]\n assert candidate(s = \"abacabadabacaba\",queries = [[0, 4, 1], [5, 9, 2], [10, 14, 3], [0, 14, 7], [0, 14, 8], [0, 14, 9]]) == [True, True, True, True, True, True]\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",queries = [[0, 25, 12], [10, 20, 5], [0, 15, 8], [5, 25, 15], [0, 10, 3]]) == [False, True, True, True, False]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",queries = [[0, 51, 13], [10, 40, 15], [20, 30, 10]]) == [True, True, True]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",queries = [[0, 51, 25], [10, 30, 15], [0, 26, 13], [27, 51, 13], [13, 39, 20]]) == [True, True, True, True, True]\n assert candidate(s = \"racecar\",queries = [[0, 6, 0], [1, 5, 0], [2, 4, 0], [0, 5, 1], [1, 4, 1], [2, 3, 1], [0, 4, 2], [1, 3, 2], [0, 3, 3], [0, 2, 2]]) == [True, True, True, True, True, True, True, True, True, True]\n assert candidate(s = \"noonnoonnoon\",queries = [[0, 3, 1], [4, 7, 1], [8, 11, 1], [0, 11, 2], [0, 11, 3], [0, 11, 4]]) == [True, True, True, True, True, True]\n assert candidate(s = \"aaaaabbbbbccccddddeeeeeffffffggggghhhhhhiiiiii\",queries = [[0, 41, 20], [5, 35, 15], [10, 30, 10], [0, 41, 25], [15, 35, 8]]) == [True, True, True, True, True]\n assert candidate(s = \"thisisaverylongstringwithseveralcharacters\",queries = [[0, 4, 1], [5, 9, 2], [10, 14, 3], [15, 19, 4], [20, 24, 5], [0, 25, 10]]) == [True, True, True, True, True, True]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",queries = [[0, 51, 26], [0, 50, 25], [10, 40, 15], [15, 35, 10], [20, 30, 5]]) == [True, True, True, True, True]\n assert candidate(s = \"racecar\",queries = [[0, 6, 0], [1, 5, 0], [2, 4, 0], [0, 3, 1], [3, 6, 1], [1, 4, 1], [2, 5, 1]]) == [True, True, True, False, False, True, True]\n assert candidate(s = \"aaabbbccc\",queries = [[0, 8, 3], [0, 2, 1], [3, 5, 1], [6, 8, 1]]) == [True, True, True, True]\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",queries = [[0, 25, 12], [0, 25, 13], [0, 25, 14], [0, 12, 6], [13, 25, 6]]) == [False, True, True, True, True]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",queries = [[0, 50, 13], [0, 50, 14], [0, 25, 10], [25, 50, 10]]) == [True, True, True, True]\n assert candidate(s = \"mississippi\",queries = [[0, 4, 1], [1, 3, 1], [2, 4, 1], [3, 5, 1], [4, 6, 1], [5, 7, 1], [6, 8, 1], [7, 9, 1], [8, 10, 1]]) == [True, True, True, True, True, True, True, True, True]\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",queries = [[0, 25, 12], [3, 22, 9], [5, 19, 8], [7, 15, 4], [10, 14, 2]]) == [False, False, True, True, True]\n assert candidate(s = \"racecar\",queries = [[0, 6, 0], [1, 5, 1], [2, 4, 0], [0, 2, 0], [3, 5, 0]]) == [True, True, True, False, False]\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",queries = [[0, 25, 12], [0, 25, 13], [0, 25, 14], [0, 25, 15]]) == [False, True, True, True]\n assert candidate(s = \"abcdabcdabcdabcd\",queries = [[0, 15, 7], [1, 14, 7], [2, 13, 7], [3, 12, 6], [4, 11, 6], [5, 10, 5], [6, 9, 4]]) == [True, True, True, True, True, True, True]\n assert candidate(s = \"abacabadabacaba\",queries = [[0, 14, 3], [5, 10, 2], [2, 12, 4]]) == [True, True, True]\n assert candidate(s = \"abcdefghij\",queries = [[0, 9, 5], [1, 8, 4], [2, 7, 3], [3, 6, 2], [4, 5, 1], [0, 8, 4], [1, 7, 3], [2, 6, 2], [3, 5, 1], [0, 7, 3], [1, 6, 2], [2, 5, 1], [0, 6, 2], [1, 5, 1], [0, 5, 1]]) == [True, True, True, True, True, True, True, True, True, False, False, False, False, False, False]\n assert candidate(s = \"ab\",queries = [[0, 1, 0], [0, 1, 1]]) == [False, True]\n assert candidate(s = \"noon\",queries = [[0, 3, 0], [1, 2, 0], [0, 2, 0], [1, 3, 1], [0, 1, 0], [2, 3, 0]]) == [True, True, True, True, False, False]\n assert candidate(s = \"aaaabbbbcccc\",queries = [[0, 9, 3], [1, 8, 3], [2, 7, 3], [3, 6, 2], [4, 5, 1], [0, 5, 3], [5, 10, 3]]) == [True, True, True, True, True, True, True]\n assert candidate(s = \"mississippi\",queries = [[0, 4, 1], [0, 9, 2], [4, 9, 2], [0, 10, 3], [0, 10, 2]]) == [True, True, True, True, True]\n assert candidate(s = \"aabbaa\",queries = [[0, 5, 1], [1, 4, 0], [2, 3, 1]]) == [True, True, True]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",queries = [[0, 51, 13], [5, 46, 25], [10, 41, 17], [15, 36, 10], [20, 31, 5]]) == [True, True, True, True, True]\n assert candidate(s = \"abacabadabacaba\",queries = [[0, 14, 3], [2, 12, 4], [5, 9, 2], [1, 13, 5]]) == [True, True, True, True]\n assert candidate(s = \"abacabadabacaba\",queries = [[0, 14, 3], [1, 13, 3], [2, 12, 3], [3, 11, 3], [4, 10, 3], [5, 9, 3], [6, 8, 3]]) == [True, True, True, True, True, True, True]\n assert candidate(s = \"mississippi\",queries = [[0, 4, 1], [4, 10, 2], [0, 10, 2], [0, 10, 3], [0, 10, 4], [0, 10, 5]]) == [True, True, True, True, True, True]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyza\",queries = [[0, 25, 12], [1, 24, 12], [2, 23, 12], [3, 22, 12], [4, 21, 12]]) == [False, True, True, True, True]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\",queries = [[0, 51, 25], [10, 40, 15], [25, 50, 10], [0, 51, 13], [20, 30, 5]]) == [True, True, False, True, True]\n assert candidate(s = \"level\",queries = [[0, 4, 0], [1, 3, 0], [2, 2, 0], [0, 3, 1], [1, 2, 1]]) == [True, True, True, True, True]\n assert candidate(s = \"aabbccddeeffgg\",queries = [[0, 5, 2], [0, 11, 3], [0, 7, 2], [7, 11, 2]]) == [True, True, True, True]\n assert candidate(s = \"banana\",queries = [[0, 5, 2], [1, 4, 1], [2, 3, 0], [0, 3, 1], [1, 2, 0], [3, 5, 2]]) == [True, True, False, True, False, True]\n assert candidate(s = \"mississippi\",queries = [[0, 4, 1], [4, 10, 2], [1, 7, 2], [0, 10, 2], [3, 6, 1]]) == [True, True, True, True, True]\n assert candidate(s = \"mississippi\",queries = [[0, 4, 2], [1, 3, 0], [0, 10, 4], [5, 9, 1], [2, 8, 3]]) == [True, True, True, True, True]\n assert candidate(s = \"mamad\",queries = [[3, 3, 0], [1, 2, 0], [0, 3, 1], [0, 3, 2], [0, 4, 1]]) == [True, False, True, True, True]\n assert candidate(s = \"nootnoitnoitnoitnoit\",queries = [[0, 17, 8], [1, 16, 7], [2, 15, 6], [3, 14, 5], [4, 13, 4]]) == [True, True, True, True, True]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",queries = [[0, 51, 13], [5, 45, 25], [10, 40, 10], [0, 51, 26], [25, 51, 20]]) == [True, True, True, True, True]\n assert candidate(s = \"racecar\",queries = [[0, 6, 0], [1, 5, 1], [0, 4, 2]]) == [True, True, True]\n assert candidate(s = \"abacaxb\",queries = [[0, 6, 2], [0, 3, 1], [3, 6, 1], [0, 6, 3]]) == [True, True, False, True]\n assert candidate(s = \"abacabadabacaba\",queries = [[0, 14, 3], [5, 10, 2], [0, 6, 1], [7, 13, 2], [1, 13, 6]]) == [True, True, True, True, True]\n assert candidate(s = \"mamamamamamamama\",queries = [[0, 13, 3], [1, 12, 4], [2, 11, 2], [3, 10, 1], [4, 9, 0]]) == [True, True, True, True, False]\n assert candidate(s = \"repeatedcharactersinthisstring\",queries = [[0, 24, 10], [5, 15, 5], [10, 20, 8], [0, 24, 12], [5, 15, 3]]) == [True, True, True, True, True]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\",queries = [[0, 51, 25], [0, 51, 26], [0, 51, 27], [13, 27, 7], [25, 51, 13]]) == [True, True, True, True, True]\n assert candidate(s = \"banana\",queries = [[0, 5, 1], [1, 4, 1], [2, 3, 1], [0, 3, 2], [1, 2, 2], [3, 4, 2], [2, 5, 2]]) == [True, True, True, True, True, True, True]\n assert candidate(s = \"noonnoonnoon\",queries = [[0, 5, 1], [6, 11, 2], [0, 11, 3], [3, 8, 2], [0, 11, 6]]) == [True, True, True, True, True]\n assert candidate(s = \"racecar\",queries = [[0, 4, 0], [1, 3, 1], [2, 2, 0], [0, 6, 2]]) == [False, True, True, True]\n assert candidate(s = \"racecar\",queries = [[0, 6, 0], [1, 5, 0], [2, 4, 0], [0, 5, 1], [1, 4, 1], [2, 3, 1]]) == [True, True, True, True, True, True]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\",queries = [[0, 25, 12], [26, 51, 13], [0, 51, 26], [13, 38, 18]]) == [False, True, True, True]\n assert candidate(s = \"abcdefgfedcba\",queries = [[0, 12, 0], [1, 11, 1], [2, 10, 2], [3, 9, 3], [4, 8, 4]]) == [True, True, True, True, True]\n assert candidate(s = \"xyzxyzxyzxyzxyz\",queries = [[0, 14, 4], [1, 13, 4], [2, 12, 4], [3, 11, 4], [4, 10, 4], [5, 9, 4]]) == [True, True, True, True, True, True]\n assert candidate(s = \"thisisaverylongandrandomstringfornumberofqueries\",queries = [[0, 40, 15], [10, 35, 10], [20, 30, 5], [0, 40, 20], [15, 25, 8]]) == [True, True, True, True, True]\n assert candidate(s = \"xyzzyx\",queries = [[0, 5, 2], [1, 4, 1], [2, 3, 0]]) == [True, True, True]\n assert candidate(s = \"xyzzazxy\",queries = [[0, 7, 2], [1, 6, 1], [2, 5, 0]]) == [True, False, False]\n assert candidate(s = \"abababababababab\",queries = [[0, 15, 4], [0, 7, 3], [8, 15, 3], [0, 15, 7]]) == [True, True, True, True]\n assert candidate(s = \"abcdefghij\",queries = [[0, 9, 4], [0, 4, 2], [5, 9, 2], [0, 9, 5]]) == [False, True, True, True]\n assert candidate(s = \"palindromechecker\",queries = [[0, 12, 6], [1, 11, 5], [2, 10, 4], [3, 9, 3], [4, 8, 2]]) == [True, True, True, True, True]\n assert candidate(s = \"mississippi\",queries = [[0, 10, 3], [1, 9, 2], [2, 8, 1], [0, 10, 4], [3, 7, 2]]) == [True, True, True, True, True]\n assert candidate(s = \"aabbaa\",queries = [[0, 5, 0], [0, 2, 0], [1, 4, 0], [2, 3, 0]]) == [True, True, True, True]\n assert candidate(s = \"noonnoon\",queries = [[0, 7, 1], [1, 6, 1], [2, 5, 1], [3, 4, 0], [0, 3, 1], [4, 7, 1], [1, 5, 1]]) == [True, True, True, True, True, True, True]\n assert candidate(s = \"qpalzmw\",queries = [[0, 6, 2], [1, 5, 2], [2, 4, 2], [3, 6, 2], [0, 5, 3]]) == [False, True, True, True, True]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",queries = [[0, 51, 12], [0, 51, 13], [0, 51, 14], [26, 51, 6], [0, 25, 12], [26, 51, 13]]) == [True, True, True, True, True, True]\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",queries = [[0, 51, 13], [10, 30, 15], [20, 40, 20], [35, 49, 8]]) == [True, True, True, True]\n assert candidate(s = \"racecar\",queries = [[0, 4, 0], [0, 5, 1], [0, 6, 1], [1, 5, 1]]) == [False, True, True, True]\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\",queries = [[0, 51, 25], [5, 45, 20], [10, 40, 15]]) == [True, True, True]\n assert candidate(s = \"abacabadabacaba\",queries = [[0, 3, 1], [0, 4, 1], [1, 5, 2], [2, 6, 1], [3, 7, 2], [4, 8, 3]]) == [True, True, True, True, True, True]\n"}, "metadata": {"canonical_parameter_names": ["s", "queries"], "leetcode_dataset_entry_point": "Solution().canMakePaliQueries", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var canMakePaliQueries = function(s, queries) {", "container": null, "callable": "canMakePaliQueries", "parameters": [{"name": "s", "type": "string"}, {"name": "queries", "type": "number[][]"}], "return_type": "boolean[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1178, "task_id": "number-of-valid-words-for-each-puzzle", "difficulty": "Hard", "problem_description": "With respect to a given puzzle string, a word is valid if both the following conditions are satisfied:\n\nword contains the first letter of puzzle.\nFor each letter in word, that letter is in puzzle.\n\t\nFor example, if the puzzle is \"abcdefg\", then valid words are \"faced\", \"cabbage\", and \"baggage\", while\ninvalid words are \"beefed\" (does not include 'a') and \"based\" (includes 's' which is not in the puzzle).\n\n\n\nReturn an array answer, where answer[i] is the number of words in the given word list words that is valid with respect to the puzzle puzzles[i].\n \nExample 1:\n\nInput: words = [\"aaaa\",\"asas\",\"able\",\"ability\",\"actt\",\"actor\",\"access\"], puzzles = [\"aboveyz\",\"abrodyz\",\"abslute\",\"absoryz\",\"actresz\",\"gaswxyz\"]\nOutput: [1,1,3,2,4,0]\nExplanation: \n1 valid word for \"aboveyz\" : \"aaaa\" \n1 valid word for \"abrodyz\" : \"aaaa\"\n3 valid words for \"abslute\" : \"aaaa\", \"asas\", \"able\"\n2 valid words for \"absoryz\" : \"aaaa\", \"asas\"\n4 valid words for \"actresz\" : \"aaaa\", \"asas\", \"actt\", \"access\"\nThere are no valid words for \"gaswxyz\" cause none of the words in the list contains letter 'g'.\n\nExample 2:\n\nInput: words = [\"apple\",\"pleas\",\"please\"], puzzles = [\"aelwxyz\",\"aelpxyz\",\"aelpsxy\",\"saelpxy\",\"xaelpsy\"]\nOutput: [0,1,3,2,0]\n\n \nConstraints:\n\n1 <= words.length <= 105\n4 <= words[i].length <= 50\n1 <= puzzles.length <= 104\npuzzles[i].length == 7\nwords[i] and puzzles[i] consist of lowercase English letters.\nEach puzzles[i] does not contain repeated characters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['apple', 'pleas', 'please'],puzzles = ['aelwxyz', 'aelpxyz', 'aelpsxy', 'saelpxy', 'xaelpsy']) == [0, 1, 3, 2, 0]\n assert candidate(words = ['hello', 'world', 'abc', 'def', 'ghi'],puzzles = ['ahelloz', 'dworldz', 'abcdefg', 'xyzghif', 'mnopqrs']) == [0, 1, 1, 0, 0]\n assert candidate(words = ['aaaa', 'asas', 'able', 'ability', 'actt', 'actor', 'access'],puzzles = ['aboveyz', 'abrodyz', 'abslute', 'absoryz', 'actresz', 'gaswxyz']) == [1, 1, 3, 2, 4, 0]\n assert candidate(words = ['hello', 'world'],puzzles = ['ehlol', 'dlrow']) == [1, 1]\n assert candidate(words = ['cat', 'dog', 'bird'],puzzles = ['act', 'dgo', 'bdir']) == [1, 1, 1]\n assert candidate(words = ['zzzz', 'zzz', 'zz', 'z'],puzzles = ['zabcdefghijklmnopqrstuvwxy']) == [4]\n assert candidate(words = ['aaaa', 'aaa', 'aa', 'a'],puzzles = ['abcdefg', 'gfedcba', 'agfedcb', 'bagfedc', 'cagfedb']) == [4, 0, 4, 0, 0]\n assert candidate(words = ['aaa', 'aa', 'a'],puzzles = ['abcdefg', 'ghijklm', 'nopqrst']) == [3, 0, 0]\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g'],puzzles = ['abcdefg']) == [1]\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g'],puzzles = ['abcdefg', 'gfedcba', 'agfedcb', 'bagfedc', 'cagfedb']) == [1, 1, 1, 1, 1]\n assert candidate(words = ['a', 'b', 'c'],puzzles = ['abc', 'def', 'ghi']) == [1, 0, 0]\n assert candidate(words = ['abcdefg'],puzzles = ['abcdefg']) == [1]\n assert candidate(words = ['abc', 'def', 'ghi'],puzzles = ['abcdefg', 'ghijklm', 'nopqrst']) == [1, 1, 0]\n assert candidate(words = ['abcd', 'abce', 'abcf', 'abcg', 'abch', 'abci', 'abcj', 'abck', 'abcl', 'abcm', 'abcp', 'abcd', 'abcde', 'abcdf', 'abcde', 'abcde', 'abcdf'],puzzles = ['abcdefg', 'gfedcba', 'agfedcb', 'bagfedc', 'cagfedb', 'defghij', 'ghijklm', 'ijklmno', 'jklmnop', 'klmnopq', 'lmnopqr', 'mnopqrs', 'nopqrst', 'opqrstu', 'pqrstuv', 'qrstuvw', 'rstuvwx', 'stuvwxy', 'tuvwxyz']) == [10, 1, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(words = ['ab', 'bc', 'cd', 'de', 'ef', 'fg', 'gh'],puzzles = ['abcdefgh', 'bcdefghi', 'cdefghij', 'defghijk', 'efghijkl']) == [1, 1, 1, 1, 1]\n assert candidate(words = ['abcdefghijklmnop', 'qrstuvwxyz'],puzzles = ['abcdefghijklnoprstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba']) == [0, 1]\n assert candidate(words = ['abacax', 'bacbac', 'cababc', 'xdsv', 'abcd', 'dcba', 'abdc', 'bacd', 'acbd', 'cabd'],puzzles = ['abcaxd', 'bacxzd', 'cabxdz', 'xdsvab', 'abcdx', 'dcba', 'abcd', 'bacd', 'acbd', 'cabd']) == [9, 9, 9, 1, 9, 6, 8, 8, 8, 8]\n assert candidate(words = ['abcdefgh', 'ijklmnop', 'qrstuvwx', 'yzabcdef', 'mnopqrst', 'vwxyzabc'],puzzles = ['abcdefgh', 'ijklmnop', 'qrstuvwx', 'yzabcdef', 'mnopqrst', 'vwxyzabc']) == [1, 1, 1, 1, 1, 1]\n assert candidate(words = ['umbrella', 'raincoat', 'boot', 'galoshes', 'sunglasses', 'scarf', 'jacket', 'boots', 'mittens', 'hat'],puzzles = ['blutgos', 'mireach', 'nabstgr', 'lgohtua', 'ogtsbem', 'rtgpsha', 'suboegt', 'ahrctbq', 'smrguth', 'bmeghiu']) == [2, 0, 0, 0, 2, 0, 1, 1, 0, 0]\n assert candidate(words = ['hello', 'world', 'python', 'programming', 'challenge', 'algorithms', 'data', 'structure', 'complexity', 'algorithm'],puzzles = ['ehlol', 'dlrow', 'htpon', 'gnimmargorp', 'llengec', 'smhtloga', 'aadtt', 'ctreusd', 'xytacpml', 'lgoitamha']) == [1, 1, 0, 1, 0, 0, 1, 1, 0, 0]\n assert candidate(words = ['apple', 'pleas', 'please', 'apples', 'please', 'applesauce', 'pease', 'app', 'leap', 'pelase'],puzzles = ['aelwxyz', 'aelpxyz', 'aelpsxy', 'saelpxy', 'xaelpsy', 'applsey', 'peasely', 'ppleasy', 'leaps', 'peaslp']) == [0, 3, 9, 6, 0, 9, 9, 9, 7, 9]\n assert candidate(words = ['banana', 'orange', 'apple', 'grape', 'melon', 'kiwi', 'watermelon', 'strawberry', 'blueberry', 'raspberry', 'blackberry', 'mango', 'papaya', 'pineapple'],puzzles = ['aegimno', 'abegijm', 'aceimnu', 'agikmnp', 'agiknpw', 'aegilmn', 'bcehikn', 'abefhij', 'acdefln', 'acdelpw', 'aeghijn', 'aeiklnt', 'agilnop', 'abcklmn']) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1]\n assert candidate(words = ['abcdef', 'bcdefg', 'cdefgh', 'defghi', 'efghij', 'fghijk', 'ghijkl', 'hijklm'],puzzles = ['abcdefg', 'bcdefgh', 'cdefghi', 'defghij', 'efghijk', 'fghijkl', 'ghijklm', 'hijklmn']) == [1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(words = ['abcdefgh', 'ijklmnop', 'qrstuvwx', 'yzabcdef', 'mnopqrst', 'vwxyzabc', 'defghijk', 'lmnopqrs', 'tuvwxyz', 'abcdeefg'],puzzles = ['aaaabbbb', 'ccccdddd', 'eeeeffff', 'ggggghhh', 'iiiijjjj', 'kkkkllll', 'mmmmnnnn', 'oooooooo', 'pppppppp', 'qqqqqqqq', 'rrrrrrrr', 'ssssssss', 'tttttttt', 'uuuuuuuu', 'vvvvvvvv', 'wwwwwwww', 'xxxxxxxx', 'yyyyyyyy', 'zzzzzzzz']) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(words = ['aabbcc', 'bbccdd', 'ccddeeff', 'ddeeffgg', 'effgghhi', 'ffgghhii', 'gghhiijj', 'hhiijjkk'],puzzles = ['abcdefgh', 'hgfedcba', 'ijklmnop', 'ponmlkj', 'efghijkl', 'ghijklmn', 'opqrstuv', 'wzyxvutsr']) == [1, 0, 0, 0, 1, 1, 0, 0]\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],puzzles = ['abcdefg', 'hijklmn', 'opqrstu', 'vwxyzab', 'cdefghi', 'jklmnop', 'qrstuvw', 'xyzabcd', 'efghijk', 'lmnopqr', 'stuvxyz', 'abcdefghi', 'jklmnopqr', 'stuvwxyz', 'abcdefghijklmnop', 'qrstuvwxyzabc', 'defghijklmn', 'opqrstuvwxy', 'zabcdefghij', 'klmnopqrstu', 'vwxyzabcde', 'fghijklmnop', 'ghijklmnopq', 'ijklmnopqr', 'jklmnopqrs', 'klmnopqrst', 'mnopqrstu', 'nopqrstuv', 'opqrstuvw', 'pqrsuvwxy', 'qrstuvxyz', 'rstuvwxyz', 'stuvwxyz', 'tuvwxyz', 'uvwxyz', 'vwxyz', 'wxyz', 'xyz', 'yz', 'z']) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(words = ['small', 'larger', 'largest', 'tiny', 'little', 'biggest'],puzzles = ['smallest', 'largestp', 'tinyabc', 'littlezyx', 'biggestuvw', 'smallxyz']) == [1, 2, 1, 1, 1, 1]\n assert candidate(words = ['algorithm', 'backpack', 'calculator', 'database', 'encoder', 'firewall', 'government', 'hierarchy', 'identifier', 'jungle', 'kangaroo', 'lemonade', 'molecule', 'narrative', 'occasion', 'printer', 'queue', 'rabbit', 'snapshot', 'treatment', 'umbrella', 'vaccinate', 'wonderful', 'xylophone', 'yield', 'zoo'],puzzles = ['acdeinor', 'bfjkpstu', 'aghlmopt', 'cddegkln', 'egilnoqs', 'fhiklmpr', 'ajnpqrsv', 'bcdghstv', 'adeikmou', 'bcfgimnp']) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(words = ['quick', 'brown', 'fox', 'jumps', 'over', 'lazy', 'dogs'],puzzles = ['quickbz', 'brownxz', 'foxgjkl', 'jumpsxz', 'overmnp', 'lazyuvw', 'dogswyz']) == [1, 1, 1, 1, 1, 1, 1]\n assert candidate(words = ['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff', 'ggg', 'hhh', 'iii', 'jjj', 'kkk', 'lll', 'mmm', 'nnn', 'ooo', 'ppp', 'qqq', 'rrr', 'sss', 'ttt', 'uuu', 'vvv', 'www', 'xxx', 'yyy', 'zzz'],puzzles = ['abcdefgh', 'ijklmnop', 'qrstuvwx', 'yzabcdef', 'mnopqrst', 'vwxyzabc', 'defghijk', 'lmnopqrs', 'tuvwxyz', 'abcdeefg']) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(words = ['abcdefgh', 'efghijkl', 'ijklmnop', 'mnopqrst', 'opqrstuv', 'qrstuvwx', 'stuvwxyz', 'vwxyzabc', 'wxyzabcd', 'xyzabcde', 'yzabcdef', 'abcdefgh', 'ijklmnop', 'qrstuvwx', 'wxyzabcd'],puzzles = ['abcdefghijkl', 'mnopqrstuv', 'qrstuvwxy', 'stuvwxyzab', 'vwxyzabcde', 'wxyzabcdef', 'xyzabcdefg', 'yzabcdefgh', 'zabcdefghi', 'abcdefghij', 'bcdefghijk', 'cdefghijkl', 'defghijklm', 'efghijklmn', 'fghijklmno', 'ghijklmnop', 'hijklmnopq', 'ijklmnopqr', 'jklmnopqrs', 'klmnopqrst', 'lmnopqrstu', 'mnopqrstuv', 'nopqrstuvw', 'opqrstuvwx', 'pqrstuvwxy', 'qrstuvwx', 'rstuvwxy', 'stuvwxyz', 'tuvwxyz', 'uvwxyz', 'vwxyz', 'wxyz', 'xyz', 'yz', 'z']) == [2, 1, 2, 1, 1, 2, 1, 1, 0, 2, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(words = ['alphabet', 'apricot', 'banana', 'character', 'date', 'elderberry', 'fig', 'grape', 'honeydew'],puzzles = ['abcdefgh', 'bdegijkm', 'aehlstu', 'cfimnpr', 'dgoqrsv', 'fhiklmt', 'ajnoprt', 'bgpqwxyz']) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(words = ['apple', 'apricot', 'banana', 'berry', 'blueberry', 'grape', 'orange', 'peach', 'pear', 'pineapple', 'plum', 'raspberry', 'strawberry'],puzzles = ['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy', 'zabcde', 'efghij', 'klmnop', 'qrstuv', 'vwxyz', 'abcdefg', 'hijklmnop', 'qrstuvwxy']) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(words = ['programming', 'puzzle', 'valid', 'word', 'condition', 'satisfied', 'contain', 'letter', 'each', 'given', 'example', 'explained', 'characters', 'repeated', 'wordlist', 'respect', 'array', 'answer', 'number', 'words', 'validity', 'requirements', 'constraint', 'solution', 'algorithm', 'datastructure', 'python', 'java', 'cpp', 'ruby', 'javascript'],puzzles = ['rogrammping', 'zlepuz', 'dlivav', 'drwo', 'noitcnidio', 'tdiatseifas', 'naicton', 'ttelr', 'aech', 'nevig', 'elpmaxe', 'dnaiexpleid', 'srcahracter', 'tepreprea', 'ltsidrowd', 'ectspor', 'yarra', 'srnaa', 'mrubov', 'noitpircsaj', 'vaftsiw', 'ogp', 'tsur', 'perl', 'alcas', 'niltok', 'lleksah', 'tpircsavaj', 'tekcarr', 'ual', 'gnerl', 'xirele', 'ailuj', 'lboc']) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]\n assert candidate(words = ['abcdefg', 'hijklmnop', 'qrstuvwxyz'],puzzles = ['abcdefg', 'hijklmnop', 'qrstuvwxyz', 'mnopqrstuvw', 'abcdefgxyz']) == [1, 1, 1, 0, 1]\n assert candidate(words = ['leetcode', 'contest', 'coding', 'challenges'],puzzles = ['leetcodez', 'contestx', 'codingv', 'challengesm']) == [1, 1, 1, 1]\n assert candidate(words = ['aabbcc', 'bbaacc', 'ccddaa', 'aabbdd', 'bbccdd', 'aaccbb', 'aaddee', 'bbffee', 'ccddee', 'ddeeff', 'aabb', 'bbcc', 'ccdd', 'aadd', 'bbeeff', 'ddeegg'],puzzles = ['abcdeff', 'aabbbcc', 'ccdddee', 'bbffeea', 'ddeeggh', 'ffggggg', 'aabbccc', 'dddeeff', 'aabbccf', 'aabbbcc', 'aacceeg', 'bbddeee', 'cdddeee', 'ddeeffe', 'eefffgg', 'bbbeeee']) == [8, 4, 2, 3, 1, 0, 4, 1, 4, 4, 0, 0, 2, 1, 0, 0]\n assert candidate(words = ['puzzle', 'word', 'game', 'challenge', 'dictionary', 'trivia', 'clue'],puzzles = ['elpuzs', 'drow', 'emag', 'nllgcahe', 'arnidcwoy', 'arvit', 'ucl']) == [1, 1, 1, 1, 0, 1, 0]\n assert candidate(words = ['algorithm', 'datastructure', 'binarysearch', 'hashmap'],puzzles = ['agrthmo', 'dtaustruc', 'binaryzse', 'hashmpq']) == [0, 0, 0, 1]\n assert candidate(words = ['abcdefgh', 'ijklmnop', 'qrstuvwx', 'yzabcdef'],puzzles = ['abcdefgh', 'ijklmnop', 'qrstuvwx', 'yzabcdef']) == [1, 1, 1, 1]\n assert candidate(words = ['algorithm', 'datastructure', 'programming', 'python', 'java', 'csharp'],puzzles = ['adphgrm', 'lstcrud', 'gyproam', 'nohtyp', 'avaj', 'rphscwa']) == [0, 0, 0, 1, 1, 1]\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa'],puzzles = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa']) == [5, 5, 5, 5, 5]\n assert candidate(words = ['aaaa', 'asas', 'able', 'ability', 'actt', 'actor', 'access', 'zzzz', 'zzzzz', 'zzzzzz'],puzzles = ['aboveyz', 'abrodyz', 'abslute', 'absoryz', 'actresz', 'gaswxyz', 'zzzzzzy', 'zzzzzzz', 'zzzzzz', 'zzzzz']) == [1, 1, 3, 2, 4, 0, 3, 3, 3, 3]\n assert candidate(words = ['unique', 'words', 'only', 'once'],puzzles = ['uniqwxyz', 'wordpqr', 'onlyzxcv', 'oncevbnm']) == [0, 0, 1, 1]\n assert candidate(words = ['apple', 'banana', 'cherry', 'date', 'elderberry', 'fig', 'grape'],puzzles = ['plea', 'anab', 'rehcyr', 'ated', 'rielderby', 'gfi', 'erap']) == [1, 1, 1, 1, 1, 1, 0]\n assert candidate(words = ['aaaaa', 'abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy', 'zabcd', 'efghi', 'jklmn', 'opqrs', 'tuvwx', 'yzabc'],puzzles = ['abcdefgh', 'ijklmnop', 'qrstuvwx', 'yzabcdef', 'ghijklmn', 'opqrstuv', 'wxyzabcd', 'efghijkl', 'mnopqrst', 'uvwxabcd', 'yzmnopqr', 'abcdefgh']) == [2, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 2]\n assert candidate(words = ['aabbcc', 'bbaacc', 'ccaabb', 'abbcdd', 'ddeebf', 'ffgghh', 'iiijjk', 'kkllmm', 'nnoopp', 'qqrstu', 'vwxyzw', 'abcdefg', 'hijklmn', 'opqrstu', 'vwxyzab'],puzzles = ['abcdefg', 'hijklmn', 'opqrstu', 'vwxyzab', 'bcdefgh', 'cdefghi', 'defghij', 'efghijk', 'fghijkl', 'ghijklm', 'hijklmn', 'ijklmno', 'jklmnop', 'klmnopq', 'lmnopqr', 'mnopqrs', 'nopqrst', 'opqrstu', 'pqrstuv', 'qrstuvw', 'rstuvwx', 'stuvwxy', 'tuvwxyz', 'uvwxyzx', 'vwxyzwy']) == [5, 1, 1, 2, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1]\n assert candidate(words = ['optimization', 'performance', 'complexity', 'computation', 'algorithm', 'graph', 'network'],puzzles = ['optimiz', 'perforanc', 'complex', 'compute', 'algorit', 'graphno', 'network']) == [0, 0, 0, 0, 0, 1, 1]\n assert candidate(words = ['python', 'java', 'javascript', 'csharp', 'ruby', 'swift', 'go', 'kotlin', 'typescript', 'scala'],puzzles = ['japvoty', 'pryanst', 'thcykop', 'itvslgo', 'khpscrw', 'gytrskf', 'sptiygo', 'otpsrga', 'ksvcrtp', 'dgipyst']) == [1, 0, 0, 0, 0, 0, 0, 1, 0, 0]\n assert candidate(words = ['zebra', 'elephant', 'giraffe', 'hippopotamus', 'kangaroo', 'koala', 'panda', 'penguin', 'rhinoceros', 'sloth', 'tiger', 'wombat'],puzzles = ['zebraele', 'elephantg', 'giraffehi', 'hippopota', 'kangaroop', 'koalapd', 'pandarh', 'penguinr', 'rhinocerosl', 'slothti', 'tigerwo', 'wombatze']) == [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(words = ['qwertyuiop', 'asdfghjklz', 'xcvbnm', 'python', 'java', 'csharp', 'javascript', 'html', 'css'],puzzles = ['qwertyui', 'asdfghjk', 'zxcvbnmq', 'pythonj', 'javabc', 'csharpx', 'javascriptz', 'htmlc', 'cssd']) == [0, 0, 0, 1, 1, 2, 2, 1, 1]\n assert candidate(words = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn'],puzzles = ['abcdefghijkl', 'ijklmnopqr', 'mnopqrstuvwx', 'nopqrstuvwxy', 'opqrstuvwxy', 'pqrstuvwxy', 'qrstuvwxyzab', 'rstuvwxy', 'stuvwxyz', 'tuvwxyz', 'uvwxyz', 'vwxyz', 'wxyz', 'xyz', 'yz', 'z']) == [12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(words = ['algorithm', 'data', 'structure', 'binary', 'tree', 'graph', 'queue', 'stack'],puzzles = ['dabtr', 'qagtr', 'stgfa', 'gihrq', 'pholm', 'thrue', 'qrtha']) == [1, 0, 0, 0, 0, 1, 0]\n assert candidate(words = ['aaaaab', 'bbbbb', 'ccccc', 'ddddd', 'eeeee', 'fffff', 'ggggg'],puzzles = ['abccccd', 'bccdde', 'ccdee', 'ddeeef', 'eeefff', 'fffggg', 'gggggh']) == [1, 1, 1, 1, 1, 1, 1]\n assert candidate(words = ['algorithm', 'data', 'structure', 'binary', 'tree', 'graph', 'queue', 'stack', 'hashmap', 'trie', 'heap', 'array', 'linkedlist', 'hashset', 'deque', 'priorityqueue', 'bloomfilter', 'bitmask', 'segmenttree', 'binarysearchtree'],puzzles = ['hsdcafr', 'gimnhpt', 'qertabc', 'xylotzp', 'qexhtab', 'qabctrs', 'dhracgp', 'fgihmpr', 'afbnmpt', 'bcdehmp']) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(words = ['ability', 'actt', 'actor', 'access', 'apple', 'pleas', 'please', 'zzzz', 'zzyz', 'zzx', 'zzy', 'zzzzz'],puzzles = ['aboveyz', 'abrodyz', 'abslute', 'absoryz', 'actresz', 'gaswxyz', 'zzzzzzz', 'zzzzzzy', 'zzzzzzy', 'zzzzzzx', 'zzzzzzy', 'zzzzzzz']) == [0, 0, 0, 0, 2, 0, 2, 4, 4, 3, 4, 2]\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg'],puzzles = ['abcdefg', 'bagfedc', 'cagfedb', 'bcadefg', 'abcgfed', 'gfedcba', 'agfedcb', 'bagfedc', 'cagfedb', 'bcadefg', 'abcgfed', 'gfedcba', 'agfedcb', 'bagfedc', 'cagfedb', 'bcadefg', 'abcgfed', 'gfedcba', 'agfedcb', 'bagfedc', 'cagfedb', 'bcadefg', 'abcgfed', 'gfedcba', 'agfedcb', 'bagfedc', 'cagfedb']) == [10, 6, 5, 6, 10, 1, 10, 6, 5, 6, 10, 1, 10, 6, 5, 6, 10, 1, 10, 6, 5, 6, 10, 1, 10, 6, 5]\n assert candidate(words = ['abcdef', 'abcdefg', 'bcdefg', 'cdefgh', 'defghi', 'efghij', 'fghijk', 'ghijkl'],puzzles = ['abcdefgh', 'bcdefghi', 'cdefghij', 'defghijk', 'efghijkl', 'fghijklm', 'ghijklmn']) == [2, 1, 1, 1, 1, 1, 1]\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],puzzles = ['abcdefg', 'hijklmn', 'opqrstu', 'vwxyzab', 'cdefghi', 'jklmnop', 'qrstuvi', 'wxyzabc', 'defghij', 'klmnopq', 'rstuvwx', 'yzabcde', 'fghijkl', 'mnopqrs', 'tuvwxy', 'xyzabcd', 'ghijklm', 'nopqrst', 'stuvwxy', 'tuvwxya', 'uvwxyab', 'vwxyzabc', 'wxyzabcd', 'xyzabcde']) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(words = ['xylophone', 'wonderful', 'algorithm', 'backpack', 'calculator', 'database', 'encoder', 'firewall', 'government', 'hierarchy', 'identifier', 'jungle', 'kangaroo', 'lemonade', 'molecule', 'narrative', 'occasion', 'printer', 'queue', 'rabbit', 'snapshot', 'treatment', 'umbrella', 'vaccinate', 'yield', 'zoo'],puzzles = ['zxylophon', 'wonderfll', 'algorithm', 'bacpack', 'calcutor', 'datbase', 'enconder', 'frwall', 'govrnment', 'hierchy', 'idenfitier', 'jngl', 'kngroo', 'lmndade', 'mclucule', 'nrrtive', 'oacasion', 'printer', 'queue', 'rabbit', 'snapshot', 'tratment', 'umbrlla', 'vcninate', 'yeld', 'zoo']) == [1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1]\n assert candidate(words = ['abcdefgh', 'bcdefgha', 'cdefghab', 'defghabc', 'efghabcd', 'fghabcde', 'ghabcdef', 'habcdefg'],puzzles = ['abcdefgh', 'ghfedcba', 'bagfedch', 'cbaghfed', 'dcbagfhe', 'edcbaghf', 'fedcbagh', 'gfedcbah']) == [8, 8, 8, 8, 8, 8, 8, 8]\n assert candidate(words = ['abc', 'bcd', 'cde', 'def', 'efg', 'fgh', 'ghi', 'hij', 'ijk', 'jkl', 'klm', 'lmn', 'mno', 'nop', 'opq', 'pqr', 'qrs', 'rst', 'stu', 'tuv', 'uvw', 'vwx', 'wxy', 'xyz'],puzzles = ['abcdef', 'bcdefg', 'cdefgh', 'defghi', 'efghij', 'fghijk', 'ghijkl', 'hijklm', 'ijklmn', 'jklmno', 'klmnop', 'lmnopq', 'mnopqr', 'nopqrs', 'opqrst', 'pqrstu', 'qrstuv', 'rstuvw', 'stuvwx', 'tuvwxy', 'uvwxy', 'vwxyz', 'wxyz', 'xyz']) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n assert candidate(words = ['hello', 'world', 'python', 'programming'],puzzles = ['hellozp', 'dlrowxy', 'thonpqr', 'grammxyz']) == [1, 1, 0, 0]\n assert candidate(words = ['aabbcc', 'abcde', 'xyz', 'mnopqr', 'stuv', 'wxyz', 'abcdefgh', 'ijklmnop', 'qrstuv', 'vwxyz'],puzzles = ['abcdefgh', 'hgfedcba', 'ijklmnop', 'ponmlkji', 'qrstuv', 'vutsrq', 'wxyz', 'zyxw', 'mnopqrs', 'tuvwxyz']) == [3, 1, 1, 1, 1, 2, 1, 2, 1, 0]\n assert candidate(words = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa'],puzzles = ['aabcdef', 'aabbcde', 'aaccdde', 'aadddee', 'aaeefgg', 'aaffggg', 'aaggghh']) == [7, 7, 7, 7, 7, 7, 7]\n assert candidate(words = ['abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh'],puzzles = ['abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh', 'abcdefgh']) == [33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33]\n assert candidate(words = ['algorithm', 'data', 'structure', 'binary', 'search', 'tree'],puzzles = ['abcdert', 'datastr', 'binsear', 'algorithm']) == [1, 1, 0, 1]\n assert candidate(words = ['programming', 'coding', 'debugging', 'optimization', 'compilation', 'execution', 'interpretation', 'software'],puzzles = ['cpdibqr', 'gingqru', 'eohpamg', 'spgroit', 'qtoadfn', 'hpramgi', 'ironsgd', 'digspqr']) == [0, 0, 0, 0, 0, 0, 0, 0]\n"}, "metadata": {"canonical_parameter_names": ["words", "puzzles"], "leetcode_dataset_entry_point": "Solution().findNumOfValidWords", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findNumOfValidWords = function(words, puzzles) {", "container": null, "callable": "findNumOfValidWords", "parameters": [{"name": "words", "type": "string[]"}, {"name": "puzzles", "type": "string[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1184, "task_id": "distance-between-bus-stops", "difficulty": "Easy", "problem_description": "A bus has n stops numbered from 0 to n - 1 that form a circle. We know the distance between all pairs of neighboring stops where distance[i] is the distance between the stops number i and (i + 1) % n.\\r\n\\r\nThe bus goes along both directions i.e. clockwise and counterclockwise.\\r\n\\r\nReturn the shortest distance between the given start and destination stops.\\r\n\\r\n \\r\nExample 1:\\r\n\\r\n\\r\n\\r\n\\r\nInput: distance = [1,2,3,4], start = 0, destination = 1\\r\nOutput: 1\\r\nExplanation: Distance between 0 and 1 is 1 or 9, minimum is 1.\\r\n\\r\n \\r\n\\r\nExample 2:\\r\n\\r\n\\r\n\\r\n\\r\nInput: distance = [1,2,3,4], start = 0, destination = 2\\r\nOutput: 3\\r\nExplanation: Distance between 0 and 2 is 3 or 7, minimum is 3.\\r\n\\r\n\\r\n \\r\n\\r\nExample 3:\\r\n\\r\n\\r\n\\r\n\\r\nInput: distance = [1,2,3,4], start = 0, destination = 3\\r\nOutput: 4\\r\nExplanation: Distance between 0 and 3 is 6 or 4, minimum is 4.\\r\n\\r\n\\r\n \\r\nConstraints:\\r\n\\r\n\\r\n\t1 <= n <= 10^4\\r\n\tdistance.length == n\\r\n\t0 <= start, destination < n\\r\n\t0 <= distance[i] <= 10^4\\r\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(distance = [7, 10, 1, 12, 11, 14, 5, 0],start = 7,destination = 2) == 17\n assert candidate(distance = [1, 2, 3, 4],start = 0,destination = 2) == 3\n assert candidate(distance = [4, 3, 2],start = 0,destination = 2) == 2\n assert candidate(distance = [1, 2, 3, 4],start = 0,destination = 1) == 1\n assert candidate(distance = [3, 6, 7, 2, 9, 12, 5, 10, 15, 8],start = 3,destination = 7) == 28\n assert candidate(distance = [3, 6, 7, 2, 9, 12, 5, 10, 1],start = 6,destination = 8) == 15\n assert candidate(distance = [3, 6, 7, 2, 9, 12, 5, 10, 15, 8],start = 5,destination = 9) == 35\n assert candidate(distance = [3, 6, 7, 2, 9, 12, 5, 10, 1],start = 5,destination = 8) == 27\n assert candidate(distance = [1, 2, 3, 4],start = 0,destination = 3) == 4\n assert candidate(distance = [3, 4, 5, 1, 2],start = 2,destination = 1) == 4\n assert candidate(distance = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],start = 0,destination = 9) == 1000\n assert candidate(distance = [50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350],start = 10,destination = 20) == 1950\n assert candidate(distance = [5, 8, 12, 4, 6, 7, 9, 3, 10, 1, 11],start = 2,destination = 6) == 29\n assert candidate(distance = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140],start = 3,destination = 17) == 441\n assert candidate(distance = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],start = 24,destination = 50) == 1625\n assert candidate(distance = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],start = 10,destination = 20) == 155\n assert candidate(distance = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],start = 15,destination = 5) == 105\n assert candidate(distance = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],start = 4,destination = 13) == 39\n assert candidate(distance = [5, 8, 12, 15, 20, 25, 30, 35, 40, 45, 50],start = 2,destination = 8) == 137\n assert candidate(distance = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105],start = 5,destination = 10) == 230\n assert candidate(distance = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],start = 12,destination = 5) == 106\n assert candidate(distance = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],start = 7,destination = 3) == 22000\n assert candidate(distance = [2, 10, 3, 5, 1, 7, 8, 6, 9, 4, 12, 11],start = 4,destination = 11) == 31\n assert candidate(distance = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105],start = 0,destination = 10) == 105\n assert candidate(distance = [15, 20, 25, 30, 35, 40, 45, 50],start = 0,destination = 7) == 50\n assert candidate(distance = [7, 5, 3, 1, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],start = 6,destination = 13) == 92\n assert candidate(distance = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000],start = 8,destination = 17) == 4650\n assert candidate(distance = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],start = 9,destination = 1) == 1100\n assert candidate(distance = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300],start = 25,destination = 5) == 1550\n assert candidate(distance = [100, 200, 150, 100, 50, 250, 300, 50, 100, 200, 150, 250],start = 3,destination = 11) == 700\n assert candidate(distance = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],start = 0,destination = 50) == 75\n assert candidate(distance = [100, 200, 300, 400, 500],start = 1,destination = 3) == 500\n assert candidate(distance = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],start = 25,destination = 5) == 50\n assert candidate(distance = [7, 3, 8, 4, 2, 9, 1, 6, 5],start = 5,destination = 3) == 6\n assert candidate(distance = [13, 26, 39, 52, 65, 78, 91, 104, 117, 130, 143, 156, 169, 182, 195, 208, 221, 234, 247, 260],start = 5,destination = 18) == 702\n assert candidate(distance = [12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 168, 180, 192, 204, 216, 228, 240],start = 10,destination = 18) == 1128\n assert candidate(distance = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],start = 12,destination = 7) == 50\n assert candidate(distance = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],start = 18,destination = 3) == 90\n assert candidate(distance = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],start = 0,destination = 19) == 20\n assert candidate(distance = [50, 40, 30, 20, 10, 5, 2, 1, 9, 8, 7, 6, 4, 3, 2],start = 4,destination = 11) == 42\n assert candidate(distance = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],start = 0,destination = 19) == 1\n assert candidate(distance = [9, 8, 7, 6, 5, 4, 3, 2, 1],start = 3,destination = 7) == 18\n assert candidate(distance = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],start = 0,destination = 100) == 30\n assert candidate(distance = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],start = 0,destination = 5) == 150\n assert candidate(distance = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105],start = 7,destination = 2) == 225\n assert candidate(distance = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],start = 23,destination = 17) == 123\n assert candidate(distance = [23, 17, 11, 5, 3, 8, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, 109, 115, 121, 127, 133, 139, 145, 151, 157],start = 15,destination = 25) == 940\n assert candidate(distance = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],start = 9,destination = 0) == 100\n assert candidate(distance = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],start = 8,destination = 3) == 25\n assert candidate(distance = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70],start = 4,destination = 11) == 245\n assert candidate(distance = [9, 8, 7, 6, 5, 4, 3, 2, 1],start = 2,destination = 7) == 20\n assert candidate(distance = [123, 456, 789, 101, 202, 303, 404, 505, 606, 707, 808, 909, 1010, 1111, 1212, 1313, 1414, 1515, 1616, 1717],start = 19,destination = 5) == 3388\n assert candidate(distance = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],start = 10,destination = 20) == 185\n assert candidate(distance = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500],start = 6,destination = 13) == 5000\n assert candidate(distance = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],start = 2,destination = 7) == 250\n assert candidate(distance = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47],start = 3,destination = 14) == 57\n assert candidate(distance = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],start = 2,destination = 6) == 180\n assert candidate(distance = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],start = 14,destination = 6) == 36\n assert candidate(distance = [8, 16, 24, 32, 40, 48, 56, 64, 72, 80],start = 2,destination = 9) == 104\n assert candidate(distance = [5, 10, 15, 20, 25, 30, 35, 40],start = 1,destination = 6) == 80\n assert candidate(distance = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300],start = 0,destination = 12) == 1300\n assert candidate(distance = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],start = 0,destination = 29) == 3\n assert candidate(distance = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],start = 0,destination = 39) == 8\n assert candidate(distance = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],start = 5,destination = 2) == 1200\n assert candidate(distance = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],start = 0,destination = 9) == 100\n assert candidate(distance = [7, 3, 5, 2, 8, 6, 4, 1, 9, 11, 13, 15, 17],start = 5,destination = 10) == 31\n assert candidate(distance = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24],start = 5,destination = 11) == 54\n assert candidate(distance = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77],start = 0,destination = 10) == 77\n"}, "metadata": {"canonical_parameter_names": ["distance", "start", "destination"], "leetcode_dataset_entry_point": "Solution().distanceBetweenBusStops", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var distanceBetweenBusStops = function(distance, start, destination) {", "container": null, "callable": "distanceBetweenBusStops", "parameters": [{"name": "distance", "type": "number[]"}, {"name": "start", "type": "number"}, {"name": "destination", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1185, "task_id": "day-of-the-week", "difficulty": "Easy", "problem_description": "Given a date, return the corresponding day of the week for that date.\nThe input is given as three integers representing the day, month and year respectively.\nReturn the answer as one of the following values {\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"}.\n \nExample 1:\n\nInput: day = 31, month = 8, year = 2019\nOutput: \"Saturday\"\n\nExample 2:\n\nInput: day = 18, month = 7, year = 1999\nOutput: \"Sunday\"\n\nExample 3:\n\nInput: day = 15, month = 8, year = 1993\nOutput: \"Sunday\"\n\n \nConstraints:\n\nThe given dates are valid dates between the years 1971 and 2100.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(day = 31,month = 12,year = 2100) == \"Friday\"\n assert candidate(day = 15,month = 8,year = 1993) == \"Sunday\"\n assert candidate(day = 10,month = 9,year = 2023) == \"Sunday\"\n assert candidate(day = 18,month = 7,year = 1999) == \"Sunday\"\n assert candidate(day = 31,month = 8,year = 2019) == \"Saturday\"\n assert candidate(day = 4,month = 7,year = 2023) == \"Tuesday\"\n assert candidate(day = 25,month = 12,year = 2023) == \"Monday\"\n assert candidate(day = 29,month = 2,year = 2004) == \"Sunday\"\n assert candidate(day = 1,month = 1,year = 1971) == \"Friday\"\n assert candidate(day = 29,month = 2,year = 2000) == \"Tuesday\"\n assert candidate(day = 28,month = 2,year = 1900) == \"Wednesday\"\n assert candidate(day = 14,month = 2,year = 2000) == \"Monday\"\n assert candidate(day = 31,month = 10,year = 1984) == \"Wednesday\"\n assert candidate(day = 1,month = 3,year = 1999) == \"Monday\"\n assert candidate(day = 14,month = 3,year = 2047) == \"Thursday\"\n assert candidate(day = 15,month = 6,year = 2050) == \"Wednesday\"\n assert candidate(day = 30,month = 4,year = 2020) == \"Thursday\"\n assert candidate(day = 7,month = 11,year = 2025) == \"Friday\"\n assert candidate(day = 1,month = 9,year = 2001) == \"Saturday\"\n"}, "metadata": {"canonical_parameter_names": ["day", "month", "year"], "leetcode_dataset_entry_point": "Solution().dayOfTheWeek", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var dayOfTheWeek = function(day, month, year) {", "container": null, "callable": "dayOfTheWeek", "parameters": [{"name": "day", "type": "number"}, {"name": "month", "type": "number"}, {"name": "year", "type": "number"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1186, "task_id": "maximum-subarray-sum-with-one-deletion", "difficulty": "Medium", "problem_description": "Given an array of integers, return the maximum sum for a non-empty subarray (contiguous elements) with at most one element deletion. In other words, you want to choose a subarray and optionally delete one element from it so that there is still at least one element left and the sum of the remaining elements is maximum possible.\nNote that the subarray needs to be non-empty after deleting one element.\n \nExample 1:\n\nInput: arr = [1,-2,0,3]\nOutput: 4\nExplanation: Because we can choose [1, -2, 0, 3] and drop -2, thus the subarray [1, 0, 3] becomes the maximum value.\nExample 2:\n\nInput: arr = [1,-2,-2,3]\nOutput: 3\nExplanation: We just choose [3] and it's the maximum sum.\n\nExample 3:\n\nInput: arr = [-1,-1,-1,-1]\nOutput: -1\nExplanation: The final subarray needs to be non-empty. You can't choose [-1] and delete -1 from it, then get an empty subarray to make the sum equals to 0.\n\n \nConstraints:\n\n1 <= arr.length <= 105\n-104 <= arr[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [-1, 0, -2, 3, 4, -5, 3]) == 10\n assert candidate(arr = [5, -1, 5, -1, 5]) == 14\n assert candidate(arr = [2, 3, -2, 5, -3]) == 10\n assert candidate(arr = [-10000]) == -10000\n assert candidate(arr = [5, -3, -2, 7, 1]) == 11\n assert candidate(arr = [2, 1, -2, -5, -2]) == 3\n assert candidate(arr = [5, 5, 5, 5, 5]) == 25\n assert candidate(arr = [1, -2, 0, 3]) == 4\n assert candidate(arr = [10000, -5000, 3000, -2000, 1000]) == 13000\n assert candidate(arr = [-2, 1, -3, 4, -1, 2, 1, -5, 4]) == 10\n assert candidate(arr = [-1, -1, -1, -1]) == -1\n assert candidate(arr = [100, -1, 50, -100, 200]) == 349\n assert candidate(arr = [-10000, 5000, -3000, 2000, -1000]) == 7000\n assert candidate(arr = [1]) == 1\n assert candidate(arr = [-1, 0, -2, 3, 4, -5, 1]) == 8\n assert candidate(arr = [10000, -5000, 5000, -10000, 10000]) == 20000\n assert candidate(arr = [5, -1, 5, -2, 3, -3, 7]) == 17\n assert candidate(arr = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5]) == 15\n assert candidate(arr = [-1, 0, 1, -2, 2]) == 3\n assert candidate(arr = [0, 0, 0, 0, 0]) == 0\n assert candidate(arr = [-10000, 10000]) == 10000\n assert candidate(arr = [-10000, 10000, -10000, 10000]) == 20000\n assert candidate(arr = [5, -1, 5]) == 10\n assert candidate(arr = [1, -2, -2, 3]) == 3\n assert candidate(arr = [-5, -4, -3, -2, -1]) == -1\n assert candidate(arr = [-2, -3, 4, -1, -2, 1, 5, -3]) == 9\n assert candidate(arr = [0, 0, 0, 0, 0]) == 0\n assert candidate(arr = [-2, -3, -1, -5]) == -1\n assert candidate(arr = [100, -50, 50, -25, 25, -75, 75, -100, 100]) == 200\n assert candidate(arr = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15]) == 28\n assert candidate(arr = [1, 2, 3, 4, -10, 5, 6, 7]) == 28\n assert candidate(arr = [-1, -2, -3, -4, 5, 4, 3, 2, 1, -5, -1, -1, -1, 10]) == 22\n assert candidate(arr = [1, -3, 2, 1, -1, 3, -2, 3, 4, -5]) == 12\n assert candidate(arr = [10, -3, 4, -2, -1, 10, -5, 20, -15]) == 38\n assert candidate(arr = [100, -1, 200, -2, 300, -3, 400, -4, 500, -5]) == 1494\n assert candidate(arr = [-1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1]) == 4\n assert candidate(arr = [-10, 1, 2, 3, -4, 5, 6, -7, 8, 9, -10, 11, 12, -13]) == 46\n assert candidate(arr = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8]) == 15\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, -9, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 18\n assert candidate(arr = [10, 20, 30, -5, -10, -15, -20, 50, 60, 70]) == 210\n assert candidate(arr = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5]) == 9\n assert candidate(arr = [100, -50, 50, -100, 200, -300, 400, -500, 600]) == 1000\n assert candidate(arr = [3, -2, 5, -1, 4, -3, 2, -2]) == 11\n assert candidate(arr = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]) == 15\n assert candidate(arr = [-1, -2, -3, -4, 5, 6, 7, -8, 9, -10, 11]) == 30\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -50]) == 28\n assert candidate(arr = [1, 2, 3, -6, 4, 5, -3, 2]) == 15\n assert candidate(arr = [5, -3, 8, -1, 6, -4, 9, -2, 7, -5, 10]) == 35\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -100, 11, 12, 13, 14, 15]) == 120\n assert candidate(arr = [1, 2, -5, 1, 2, -1, 5, -1, -2, 3, 4, -2, 3, 4]) == 19\n assert candidate(arr = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11]) == 20\n assert candidate(arr = [-1, 0, 1, -2, 2, -3, 3, -4, 4, -5, 5]) == 9\n assert candidate(arr = [-10, 100, -50, 50, -25, 25, -75, 75]) == 175\n assert candidate(arr = [1, -2, 3, -4, 5, -6, 7, -8, 9]) == 16\n assert candidate(arr = [10, -3, 4, -2, -1, 10, -5, 1, 2, -1]) == 21\n assert candidate(arr = [10, 20, 30, 40, 50, -100, 10, 20, 30, 40, 50, -100, 10, 20, 30, 40, 50]) == 350\n assert candidate(arr = [-10, -20, 30, -40, 50, -60, 70, -80, 90]) == 160\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]) == 1\n assert candidate(arr = [1, -4, 2, -3, 5, -6, 7]) == 12\n assert candidate(arr = [10, -5, -7, 3, 15, -10, 6, -4, 5]) == 25\n assert candidate(arr = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16, 17, -18, 19, -20]) == 36\n assert candidate(arr = [-10, -20, -30, 15, 25, 35, -45, 55, 65, 75]) == 270\n assert candidate(arr = [10, -1, 20, -2, 30, -3, 40, -4, 50, -5, 60, -6, 70, -7]) == 265\n assert candidate(arr = [100, 200, 300, -500, 100, 200, 300, -500, 100, 200, 300]) == 1300\n assert candidate(arr = [1, 2, 3, -6, 1, 2, 3, -6, 1, 2, 3, -6, 1, 2, 3]) == 12\n assert candidate(arr = [0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10]) == 18\n assert candidate(arr = [1, -1, 2, -2, 3, -3, 4, -4]) == 7\n assert candidate(arr = [20, -10, -5, -1, 5, 10, -15, 5, 10, -10, -5, 5]) == 34\n assert candidate(arr = [-10, 20, -30, 40, -50, 60, -70, 80, -90, 100, -110, 120]) == 220\n assert candidate(arr = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14]) == -1\n assert candidate(arr = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1]) == 2\n assert candidate(arr = [-1, -1, -1, -1, 5, -1, -1, -1, -1]) == 5\n assert candidate(arr = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14]) == 26\n assert candidate(arr = [1000, -500, 2000, -1000, 3000, -1500, 4000, -2000, 5000]) == 12000\n assert candidate(arr = [5, -2, -3, 5, -2, -3, 5]) == 8\n assert candidate(arr = [-1000, -900, -800, -700, -600, -500, -400, -300, -200, -100]) == -100\n assert candidate(arr = [-5, -2, -4, -1, -3, -2, -5]) == -1\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 55\n assert candidate(arr = [1, 2, 3, -6, 4, 5, 6, -10, 7, 8, 9]) == 39\n assert candidate(arr = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1]) == 2\n assert candidate(arr = [3, -1, -1, -1, 3, -1, -1, -1, 3]) == 4\n assert candidate(arr = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6]) == 11\n assert candidate(arr = [1000, 2000, 3000, 4000, 5000, -5000, 6000, 7000, 8000, 9000]) == 45000\n assert candidate(arr = [10, -3, 4, -1, -2, 1, 5, -3, 4, -2, 0, 1]) == 18\n assert candidate(arr = [100, -101, 200, -201, 300, -301, 400, -401]) == 700\n assert candidate(arr = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10]) == 16\n assert candidate(arr = [-15, 14, -13, 12, -11, 10, -9, 8, -7, 6, -5, 4, -3, 2, -1]) == 26\n assert candidate(arr = [10, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 10\n assert candidate(arr = [1, 1, 1, 1, -1, -1, -1, -1, 2, 2, 2, 2, -2, -2, -2, -2]) == 9\n assert candidate(arr = [1, 2, 3, -1, -2, -3, 4, 5, 6, -7, 8, 9, 10]) == 42\n assert candidate(arr = [100, -50, 200, -100, 300, -150, 400, -200, 500]) == 1200\n assert candidate(arr = [-1, -2, 3, 4, -5, 6, -7, 8]) == 16\n assert candidate(arr = [0, 1, -1, 2, -2, 3, -3, 4, -4, 5]) == 9\n assert candidate(arr = [1, 2, 3, -6, 1, 2, 3, -6, 1, 2, 3]) == 12\n assert candidate(arr = [-5, 4, -2, 3, -4, 4, -1, -2, 4, 3]) == 13\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(arr = [-1, -2, -3, -4, -5, 10, 1, 2, 3, -1, -2, -3, -4, -5]) == 16\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 55\n assert candidate(arr = [1, -10, 2, -20, 3, -30, 4, -40, 5, -50]) == 9\n assert candidate(arr = [-1, 4, -2, 3, -2, 3, 7, -5, 1]) == 15\n assert candidate(arr = [-1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0]) == 2\n assert candidate(arr = [-100, 200, -300, 400, -500, 600, -700, 800, -900, 1000]) == 1800\n assert candidate(arr = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == -1\n assert candidate(arr = [5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == 15\n assert candidate(arr = [100, -1, -1, -1, -1, -1, -1, -1, 100]) == 194\n assert candidate(arr = [5, -3, 8, -1, -2, 7, -4, 9, -6, 10]) == 29\n assert candidate(arr = [100, -100, 200, -200, 300, -300, 400, -400]) == 700\n assert candidate(arr = [-10, 20, -30, 40, -50, 60, -70, 80, -90, 100]) == 180\n assert candidate(arr = [3, -1, -1, 4, -10, 2, 1, -1, 2, 1, -5, 4]) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, -10, 6, 7, 8, 9, 10]) == 55\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -55, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 210\n assert candidate(arr = [10, -5, 1, -3, 2, -1, 5, -2, 3, -4, 6]) == 17\n assert candidate(arr = [1, 2, 3, 4, 5, -100, 1, 2, 3, 4, 5]) == 30\n assert candidate(arr = [1000, -500, 100, -50, 10, -5, 1, -1, 0, 1, -1, 10, -10, 100, -100, 500, -500]) == 1555\n assert candidate(arr = [100, -50, 200, -300, 400, -500, 600, -700, 800]) == 1400\n assert candidate(arr = [1, -3, 2, 1, -1, 3, -2, 3]) == 8\n assert candidate(arr = [100, -1000, 500, -300, 200, -100, 400, -500, 600]) == 1300\n assert candidate(arr = [1, 2, -3, 4, -5, 6, -7, 8, -9]) == 14\n assert candidate(arr = [1, 2, -5, 1, 2, -1]) == 6\n assert candidate(arr = [-1, 4, -2, 5, -5, 2, -1, 3, -3, 2]) == 11\n assert candidate(arr = [-100, -101, -102, -103, -104, -105]) == -100\n assert candidate(arr = [1, 1, 1, 1, -5, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(arr = [1, 2, 3, 4, -10, 1, 2, 3, 4]) == 20\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -50, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 110\n assert candidate(arr = [-5, -2, -1, -3, -4, -6, -1, -2, -3]) == -1\n assert candidate(arr = [3, -2, 2, -3, 4, -1, -2, 1, 5, -3]) == 10\n assert candidate(arr = [10, -20, 30, -40, 50, -60, 70, -80, 90]) == 160\n assert candidate(arr = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8]) == 15\n assert candidate(arr = [1, 2, 3, -6, 4, 5, 6, 7, 8, 9, 10]) == 55\n assert candidate(arr = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1]) == 1\n assert candidate(arr = [1, 2, 3, 4, 5, -15, 6, 7, 8, 9, 10]) == 55\n assert candidate(arr = [1000, -1000, 2000, -2000, 3000, -3000, 4000, -4000]) == 7000\n assert candidate(arr = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10]) == 18\n assert candidate(arr = [-1, 4, -2, 3, -2, 3, -1, 2, -3, 5]) == 12\n assert candidate(arr = [-1, 4, -2, 3, -2, 3, -1, 2, 1]) == 10\n assert candidate(arr = [100, -1, -2, -3, 100, -1, -2, -3, 100]) == 291\n assert candidate(arr = [7, -4, 3, -6, 2, 1, -5, 4, 3, -1]) == 11\n assert candidate(arr = [3, -1, -1, 3, -1, 3, -1, 3, -1, 3, -1]) == 11\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().maximumSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maximumSum = function(arr) {", "container": null, "callable": "maximumSum", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1187, "task_id": "make-array-strictly-increasing", "difficulty": "Hard", "problem_description": "Given two integer arrays arr1 and arr2, return the minimum number of operations (possibly zero) needed to make arr1 strictly increasing.\nIn one operation, you can choose two indices 0 <= i < arr1.length and 0 <= j < arr2.length and do the assignment arr1[i] = arr2[j].\nIf there is no way to make arr1 strictly increasing, return -1.\n \nExample 1:\n\nInput: arr1 = [1,5,3,6,7], arr2 = [1,3,2,4]\nOutput: 1\nExplanation: Replace 5 with 2, then arr1 = [1, 2, 3, 6, 7].\n\nExample 2:\n\nInput: arr1 = [1,5,3,6,7], arr2 = [4,3,1]\nOutput: 2\nExplanation: Replace 5 with 3 and then replace 3 with 4. arr1 = [1, 3, 4, 6, 7].\n\nExample 3:\n\nInput: arr1 = [1,5,3,6,7], arr2 = [1,6,3,3]\nOutput: -1\nExplanation: You can't make arr1 strictly increasing.\n \nConstraints:\n\n1 <= arr1.length, arr2.length <= 2000\n0 <= arr1[i], arr2[i] <= 10^9\n\n \n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr1 = [1, 3, 5, 7],arr2 = [2, 4, 6, 8]) == 0\n assert candidate(arr1 = [1, 5, 3, 6, 7],arr2 = [1, 6, 3, 3]) == -1\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [6, 7, 8, 9]) == 0\n assert candidate(arr1 = [1, 5, 3, 6, 7],arr2 = [1, 3, 2, 4]) == 1\n assert candidate(arr1 = [10, 11, 12],arr2 = [5, 6, 7]) == 0\n assert candidate(arr1 = [1],arr2 = [2]) == 0\n assert candidate(arr1 = [1, 5, 3, 6, 7],arr2 = [4, 3, 1]) == 2\n assert candidate(arr1 = [5, 4, 3, 2, 1],arr2 = [1, 2, 3, 4, 5]) == 4\n assert candidate(arr1 = [1, 2, 3, 4],arr2 = [2, 3, 4, 5]) == 0\n assert candidate(arr1 = [10, 9, 8, 7, 6],arr2 = [1, 2, 3, 4, 5]) == 4\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [5, 4, 3, 2, 1]) == 0\n assert candidate(arr1 = [1, 3, 5, 7, 9],arr2 = [2, 4, 6, 8, 10]) == 0\n assert candidate(arr1 = [1, 10, 20, 30],arr2 = [5, 15, 25, 35]) == 0\n assert candidate(arr1 = [1, 2, 2, 3, 4],arr2 = [2, 3, 4, 5, 6]) == 3\n assert candidate(arr1 = [10, 9, 8, 7, 6],arr2 = [5, 4, 3, 2, 1]) == 4\n assert candidate(arr1 = [1, 1, 1, 1],arr2 = [2, 2, 2, 2]) == -1\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [6, 7, 8, 9, 10]) == 0\n assert candidate(arr1 = [1, 1, 1],arr2 = [2, 2, 2]) == -1\n assert candidate(arr1 = [1, 1, 1, 1, 1],arr2 = [2, 2, 2, 2, 2]) == -1\n assert candidate(arr1 = [1, 2000],arr2 = [1000]) == 0\n assert candidate(arr1 = [10, 20, 30],arr2 = [5, 15, 25, 35]) == 0\n assert candidate(arr1 = [1, 2, 3],arr2 = [1, 2, 3]) == 0\n assert candidate(arr1 = [1, 2, 3],arr2 = [4, 5, 6]) == 0\n assert candidate(arr1 = [1, 1, 1, 1, 1],arr2 = [1, 2, 3, 4, 5]) == 4\n assert candidate(arr1 = [1, 2, 2, 3, 4],arr2 = [3, 4, 5]) == 3\n assert candidate(arr1 = [1, 2, 2, 4, 3, 5, 6, 7, 8],arr2 = [2, 3, 5, 7, 9]) == -1\n assert candidate(arr1 = [1, 3, 2, 5, 4],arr2 = [2, 3, 4, 5, 6, 7]) == 2\n assert candidate(arr1 = [1, 2, 2, 3, 3, 4, 5],arr2 = [2, 3, 4, 5, 6, 7, 8]) == 5\n assert candidate(arr1 = [1, 3, 3, 3, 3],arr2 = [2, 4, 6, 8, 10]) == 3\n assert candidate(arr1 = [1, 1, 1, 1, 1],arr2 = [2, 3, 4, 5, 6]) == 4\n assert candidate(arr1 = [1, 3, 2, 5, 4],arr2 = [2, 2, 2, 2, 2, 2]) == -1\n assert candidate(arr1 = [1, 100, 200, 300, 400],arr2 = [2, 150, 250, 350]) == 0\n assert candidate(arr1 = [1, 2, 2, 2, 2],arr2 = [3, 4, 5, 6, 7]) == 3\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 0\n assert candidate(arr1 = [10, 9, 8, 7, 6],arr2 = [1, 2, 3, 4, 5, 11, 12]) == 4\n assert candidate(arr1 = [1, 1, 1, 1, 1],arr2 = [2, 3, 4, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(arr1 = [1, 10, 9, 10, 9, 10],arr2 = [2, 3, 4, 5, 6, 7, 8, 9]) == 3\n assert candidate(arr1 = [1, 100, 200, 300, 400],arr2 = [50, 150, 250, 350]) == 0\n assert candidate(arr1 = [1, 2, 3, 10, 1],arr2 = [4, 5, 6, 7, 8, 9]) == 2\n assert candidate(arr1 = [5, 2, 1, 3, 4],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(arr1 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],arr2 = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == 0\n assert candidate(arr1 = [10, 20, 30, 40, 50],arr2 = [15, 25, 35, 45, 55]) == 0\n assert candidate(arr1 = [1, 3, 3, 4, 5],arr2 = [2, 2, 2, 6, 7]) == 1\n assert candidate(arr1 = [1, 5, 2, 3, 4, 6, 7, 8, 9, 10],arr2 = [1, 2, 3, 4, 5]) == 4\n assert candidate(arr1 = [9, 8, 7, 6, 5, 4, 3, 2, 1],arr2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 8\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6],arr2 = [2, 3, 4, 5, 6, 7, 8, 9]) == 0\n assert candidate(arr1 = [1000000000, 999999999, 999999998],arr2 = [1, 2, 3, 1000000001]) == 2\n assert candidate(arr1 = [1, 100, 2, 101, 3, 102, 4],arr2 = [50, 51, 52, 53, 54]) == -1\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 9\n assert candidate(arr1 = [10, 5, 3, 8, 2],arr2 = [1, 4, 6, 9, 11]) == 3\n assert candidate(arr1 = [1, 5, 9, 13, 17, 21],arr2 = [2, 6, 10, 14, 18, 22]) == 0\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == 0\n assert candidate(arr1 = [1, 2, 10, 3, 4],arr2 = [5, 6, 7, 8, 9]) == 3\n assert candidate(arr1 = [3, 2, 1],arr2 = [4, 5, 6]) == 2\n assert candidate(arr1 = [1, 3, 2, 4, 5],arr2 = [1, 2, 3, 4, 5]) == 2\n assert candidate(arr1 = [5, 4, 3, 2, 1],arr2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 4\n assert candidate(arr1 = [10, 10, 10, 10],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 3\n assert candidate(arr1 = [1, 2, 2, 2, 2],arr2 = [2, 2, 2, 2, 2]) == -1\n assert candidate(arr1 = [1, 5, 5, 5, 5],arr2 = [2, 3, 4, 6, 7, 8]) == 3\n assert candidate(arr1 = [1, 3, 5, 7, 9],arr2 = [1, 3, 5, 7, 9]) == 0\n assert candidate(arr1 = [5, 5, 5, 5, 5],arr2 = [6, 6, 6, 6, 6]) == -1\n assert candidate(arr1 = [1, 3, 5, 7, 9],arr2 = [8, 9, 10, 11, 12]) == 0\n assert candidate(arr1 = [5, 25, 100, 150, 200],arr2 = [1, 20, 50, 125]) == 0\n assert candidate(arr1 = [1, 5, 3, 6, 7, 8, 2, 10, 11, 12],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr1 = [1, 5, 3, 6, 7],arr2 = [2, 4, 6, 8, 10, 12, 14]) == 1\n assert candidate(arr1 = [5, 6, 3, 4, 8, 9],arr2 = [2, 3, 7, 8, 11]) == -1\n assert candidate(arr1 = [10, 9, 8, 7, 6, 5],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 5\n assert candidate(arr1 = [3, 1, 1, 3],arr2 = [2, 4]) == -1\n assert candidate(arr1 = [1, 2, 3, 1, 2, 3],arr2 = [2, 3, 4, 5, 6]) == 3\n assert candidate(arr1 = [1, 2, 2, 3, 4, 5, 6, 7, 8, 9],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 8\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [5, 5, 5, 5, 5]) == 0\n assert candidate(arr1 = [1, 2, 2, 3, 4],arr2 = [2, 3, 4, 5]) == 3\n assert candidate(arr1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 9\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 0\n assert candidate(arr1 = [10, 20, 30, 40, 50],arr2 = [5, 15, 25, 35, 45, 55]) == 0\n assert candidate(arr1 = [5, 4, 3, 2, 1],arr2 = [6, 7, 8, 9, 10]) == 4\n assert candidate(arr1 = [5, 6, 7, 8, 9, 10],arr2 = [1, 2, 3, 4, 5, 6]) == 0\n assert candidate(arr1 = [1, 10, 20, 30, 40],arr2 = [5, 15, 25, 35]) == 0\n assert candidate(arr1 = [1, 3, 5, 7, 9, 11, 13],arr2 = [2, 4, 6, 8, 10, 12, 14]) == 0\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 0\n assert candidate(arr1 = [1, 3, 3, 5, 7],arr2 = [2, 2, 4, 6, 8]) == 1\n assert candidate(arr1 = [1, 9, 8, 7, 6],arr2 = [2, 3, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(arr1 = [1, 2, 2, 3, 3, 4, 4],arr2 = [1, 2, 3, 4, 5]) == -1\n assert candidate(arr1 = [5, 3, 1, 2, 4, 6, 7, 8, 9, 10],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 5\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 0\n assert candidate(arr1 = [1, 2, 3, 4, 100],arr2 = [2, 5, 8, 9]) == 0\n assert candidate(arr1 = [1, 1000000000, 2, 999999999, 3],arr2 = [500000000, 600000000, 700000000, 800000000, 900000000]) == 4\n assert candidate(arr1 = [3, 3, 3, 3, 3],arr2 = [1, 2, 2, 2, 4, 5]) == 4\n assert candidate(arr1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 0\n assert candidate(arr1 = [5, 14, 13, 8, 12],arr2 = [1, 4, 3, 9, 11, 10]) == 3\n assert candidate(arr1 = [10, 9, 8, 7, 6],arr2 = [1, 2, 3, 4, 5]) == 4\n assert candidate(arr1 = [10, 20, 30, 40, 50],arr2 = [5, 15, 25, 35, 45, 55]) == 0\n assert candidate(arr1 = [100, 200, 300, 400, 500],arr2 = [150, 250, 350, 450, 550]) == 0\n assert candidate(arr1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],arr2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 9\n assert candidate(arr1 = [1, 10, 10, 10, 1],arr2 = [2, 3, 4, 5, 6]) == 4\n assert candidate(arr1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == -1\n assert candidate(arr1 = [1, 1, 1, 1, 1],arr2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == -1\n assert candidate(arr1 = [1, 10, 2, 9, 3, 8, 4, 7, 5, 6],arr2 = [2, 5, 8, 11, 14]) == -1\n assert candidate(arr1 = [1, 2, 3, 100, 100],arr2 = [4, 5, 6, 7]) == 1\n assert candidate(arr1 = [5, 5, 5, 5, 5],arr2 = [1, 2, 3, 4, 5]) == 4\n assert candidate(arr1 = [9, 8, 7, 6, 5],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 4\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [1, 3, 5, 7, 9]) == 0\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 0\n assert candidate(arr1 = [100, 200, 150, 300, 250],arr2 = [120, 160, 180, 220, 260]) == 2\n assert candidate(arr1 = [1, 2, 2, 2, 2],arr2 = [2, 3, 4, 5, 6]) == 3\n assert candidate(arr1 = [5, 5, 5, 5, 5, 5, 5],arr2 = [1, 2, 3, 4, 5, 6, 7]) == 6\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [5, 6, 7, 8, 9]) == 0\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [1, 2, 3, 4, 5]) == 0\n assert candidate(arr1 = [1, 10, 20, 30, 40],arr2 = [5, 15, 25, 35, 45]) == 0\n assert candidate(arr1 = [1, 5, 3, 6, 7, 8, 9],arr2 = [1, 3, 2, 4, 5, 6, 7]) == 1\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [2, 4, 6, 8, 10]) == 0\n assert candidate(arr1 = [1, 2, 2, 3, 4],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(arr1 = [6, 7, 8, 10, 9],arr2 = [2, 3, 5, 6, 11, 13, 15]) == 1\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 0\n assert candidate(arr1 = [100, 90, 80, 70, 60],arr2 = [55, 65, 75, 85, 95, 105]) == 4\n assert candidate(arr1 = [1, 1000000000, 1, 1000000000, 1],arr2 = [2, 3, 4, 5]) == 4\n assert candidate(arr1 = [1, 50, 200, 250, 300],arr2 = [2, 20, 100, 225]) == 0\n assert candidate(arr1 = [10, 12, 14, 16, 18],arr2 = [9, 11, 13, 15, 17]) == 0\n assert candidate(arr1 = [1, 2, 2, 4, 5],arr2 = [1, 3, 5]) == 1\n assert candidate(arr1 = [1, 3, 2, 4, 3, 5],arr2 = [2, 3, 4, 5, 6]) == 4\n assert candidate(arr1 = [1, 20, 3, 40, 5],arr2 = [2, 19, 4, 39, 6]) == 2\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [5, 6, 7, 8, 9, 10]) == 0\n assert candidate(arr1 = [1, 3, 5, 7, 9],arr2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 0\n assert candidate(arr1 = [1000000000, 1000000000, 1000000000],arr2 = [500000000, 500000000, 500000000]) == -1\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [10, 11, 12, 13, 14, 15]) == 0\n assert candidate(arr1 = [1, 5, 9, 13, 17],arr2 = [2, 6, 10, 14, 18]) == 0\n assert candidate(arr1 = [1, 3, 2, 4, 6, 5, 7, 8, 10, 9],arr2 = [2, 5, 6, 8, 9, 11]) == -1\n assert candidate(arr1 = [2000, 1999, 1998, 1997, 1996],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(arr1 = [10, 20, 30, 40, 50],arr2 = [25, 35, 45, 55, 65]) == 0\n assert candidate(arr1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],arr2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 0\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [5, 4, 3, 2, 1]) == 0\n assert candidate(arr1 = [1, 2, 3, 4, 5],arr2 = [3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(arr1 = [1, 10, 100, 1000, 10000],arr2 = [5000, 500, 50, 5, 50000]) == 0\n assert candidate(arr1 = [5, 3, 4, 2, 1],arr2 = [1, 2, 3, 4, 5, 6]) == 3\n assert candidate(arr1 = [1, 9, 5, 7, 3],arr2 = [2, 4, 6, 8, 10]) == 2\n assert candidate(arr1 = [10, 20, 30, 25, 40, 50],arr2 = [15, 22, 28, 35, 45, 55]) == 1\n assert candidate(arr1 = [1000000000, 1000000000, 1000000000],arr2 = [1, 2, 3]) == 2\n assert candidate(arr1 = [1, 3, 5, 7, 9],arr2 = [2, 4, 6, 8, 10, 12, 14, 16, 18]) == 0\n assert candidate(arr1 = [1, 3, 2, 4, 5, 6],arr2 = [2, 3, 4, 5, 6, 7]) == 2\n assert candidate(arr1 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],arr2 = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 0\n assert candidate(arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],arr2 = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == 0\n assert candidate(arr1 = [1, 3, 20, 30, 100],arr2 = [2, 15, 25, 90]) == 0\n assert candidate(arr1 = [1, 3, 2, 4, 3, 5, 4],arr2 = [2, 3, 4, 5, 6, 7]) == 5\n"}, "metadata": {"canonical_parameter_names": ["arr1", "arr2"], "leetcode_dataset_entry_point": "Solution().makeArrayIncreasing", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var makeArrayIncreasing = function(arr1, arr2) {", "container": null, "callable": "makeArrayIncreasing", "parameters": [{"name": "arr1", "type": "number[]"}, {"name": "arr2", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1189, "task_id": "maximum-number-of-balloons", "difficulty": "Easy", "problem_description": "Given a string text, you want to use the characters of text to form as many instances of the word \"balloon\" as possible.\nYou can use each character in text at most once. Return the maximum number of instances that can be formed.\n \nExample 1:\n\n\nInput: text = \"nlaebolko\"\nOutput: 1\n\nExample 2:\n\n\nInput: text = \"loonbalxballpoon\"\nOutput: 2\n\nExample 3:\n\nInput: text = \"leetcode\"\nOutput: 0\n\n \nConstraints:\n\n1 <= text.length <= 104\ntext consists of lower case English letters only.\n\n \nNote: This question is the same as 2287: Rearrange Characters to Make Target String.\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(text = \"\") == 0\n assert candidate(text = \"bbaalllooonn\") == 1\n assert candidate(text = \"ppooaallbboonn\") == 1\n assert candidate(text = \"leetcode\") == 0\n assert candidate(text = \"balloonballoonballoonballoonballoon\") == 5\n assert candidate(text = \"loonbalxballpoon\") == 2\n assert candidate(text = \"aabbccddeeffgghhiijjkklmmooppqqrrssttuuvvwwxxyyzz\") == 0\n assert candidate(text = \"axbxcxdxeoylno\") == 0\n assert candidate(text = \"bbonnallloo\") == 1\n assert candidate(text = \"bal\") == 0\n assert candidate(text = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\") == 1\n assert candidate(text = \"ballon\") == 0\n assert candidate(text = \"balon\") == 0\n assert candidate(text = \"bnlbaonlbaonlbaon\") == 1\n assert candidate(text = \"balloonballoon\") == 2\n assert candidate(text = \"abcde\") == 0\n assert candidate(text = \"nlaebolko\") == 1\n assert candidate(text = \"balblablaballlaalllooonnnnnnnnn\") == 1\n assert candidate(text = \"balloonballoonballoon\") == 3\n assert candidate(text = \"bbbaalllllooooonnnnballoonballoonballoonballoonballoonballoonballoonballoonballoonballoon\") == 12\n assert candidate(text = \"balloonballoonballoonballoonballoonballoonballoonballoonballoonballoon\") == 10\n assert candidate(text = \"bbbbbaaaaaallllllloooooonnnnnn\") == 3\n assert candidate(text = \"abracadabraballoonballoon\") == 2\n assert candidate(text = \"bnlaebolkoonnballoon\") == 2\n assert candidate(text = \"blbaloonnnballoonballoonballoonballoonballoonballoonballoonballoon\") == 9\n assert candidate(text = \"bablllooonnnballoon\") == 2\n assert candidate(text = \"blllllaaaaoonnballoon\") == 2\n assert candidate(text = \"bnaloonballoonballoonballoon\") == 3\n assert candidate(text = \"balllllllllooooooonnnnnnnnn\") == 1\n assert candidate(text = \"balbalbalbalbal\") == 0\n assert candidate(text = \"baloonballoonballoon\") == 2\n assert candidate(text = \"bnllobbannolllobnballoon\") == 2\n assert candidate(text = \"balloonballlooballlloon\") == 2\n assert candidate(text = \"baanlloonnn\") == 1\n assert candidate(text = \"balloonballoonbaloonballoonbaloonballoonballoonbaloon\") == 6\n assert candidate(text = \"balloonballoonballoonballoonballoonballoonballoon\") == 7\n assert candidate(text = \"balooba\") == 0\n assert candidate(text = \"balloonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoon\") == 16\n assert candidate(text = \"balloonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoon\") == 11\n assert candidate(text = \"abcdeballoonabcde\") == 1\n assert candidate(text = \"bbaallonnnbballoonnballoonballoon\") == 3\n assert candidate(text = \"lnoobaalllnobo\") == 2\n assert candidate(text = \"balloonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoon\") == 14\n assert candidate(text = \"blbaloonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoon\") == 16\n assert candidate(text = \"balonbalonbalonbalon\") == 2\n assert candidate(text = \"balloonyballoonballoon\") == 3\n assert candidate(text = \"balloonballoonballoonballoonballoonballoon\") == 6\n assert candidate(text = \"blbloonnbaalononballoon\") == 2\n assert candidate(text = \"ballbaloonn\") == 1\n assert candidate(text = \"loballoonbaloonballoon\") == 3\n assert candidate(text = \"balloonballoonballoonbaloonbaloonballoon\") == 5\n assert candidate(text = \"balloonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoon\") == 17\n assert candidate(text = \"ballbalbalbalbalbalbal\") == 0\n assert candidate(text = \"balloonballoonbaloon\") == 2\n assert candidate(text = \"nballoonballoonballoonbaloon\") == 3\n assert candidate(text = \"abbblllooonnnn\") == 1\n assert candidate(text = \"balllllllllooooonnnnnn\") == 1\n assert candidate(text = \"balonbalonbalonbalonbalonbalonbalon\") == 3\n assert candidate(text = \"balloonbaloon\") == 1\n assert candidate(text = \"balllonballlonballlon\") == 1\n assert candidate(text = \"balloonbaloonballoonballoonballoon\") == 4\n assert candidate(text = \"balloonbaloonballoonballoon\") == 3\n assert candidate(text = \"balloonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoon\") == 12\n assert candidate(text = \"baloobaloobalooballoonballoon\") == 2\n assert candidate(text = \"noenolbballo\") == 1\n assert candidate(text = \"bllbaaoonnnballoon\") == 2\n assert candidate(text = \"baloonbaloonbaloonbaloonbaloonbaloonbaloonbaloon\") == 4\n assert candidate(text = \"bbbbbaaaaalllllooooonn\") == 2\n assert candidate(text = \"balloonballoonbaloonballoonbaloonballoonballoonbaloonballoon\") == 7\n assert candidate(text = \"ballooballloonballoonbaloon\") == 3\n assert candidate(text = \"balloonballoonbaloonballoonbaloonballoonballoonbaloonbaloonballoon\") == 8\n assert candidate(text = \"balbaloobnoallnoobbaalllnoonnoob\") == 3\n assert candidate(text = \"balloonballoonballoonbaloonbaloon\") == 4\n assert candidate(text = \"abcbabcabcabc\") == 0\n assert candidate(text = \"blablablablablablablablablablaloboon\") == 1\n assert candidate(text = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzballoon\") == 2\n assert candidate(text = \"bloonboonballoonbalo\") == 2\n assert candidate(text = \"balloonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoon\") == 15\n assert candidate(text = \"ballonballoonballoon\") == 2\n assert candidate(text = \"balloonballoonballoonballoon\") == 4\n assert candidate(text = \"ballooonnballoon\") == 2\n assert candidate(text = \"balloonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoon\") == 13\n assert candidate(text = \"bloonbaloonballonballoonballoon\") == 4\n assert candidate(text = \"bnaloonballoonballoon\") == 2\n assert candidate(text = \"loonballballoon\") == 2\n assert candidate(text = \"baloobaloobaloobalooballoona\") == 1\n assert candidate(text = \"blllaaooonnballoon\") == 2\n assert candidate(text = \"lalalallballboonbaloon\") == 2\n assert candidate(text = \"balllonballlonballlonballlon\") == 2\n assert candidate(text = \"ballooonballoonballoonballoon\") == 4\n assert candidate(text = \"bbbbbaaaaalllllooooonnnn\") == 2\n assert candidate(text = \"balllllllllllooonnnnballoon\") == 2\n assert candidate(text = \"ballooonballoonballoonballoonballoon\") == 5\n assert candidate(text = \"xxxxxyyyyyzzzzzbbaalllooonn\") == 1\n assert candidate(text = \"balloonballoonballoonballoonballoonballoonballoonballoon\") == 8\n assert candidate(text = \"abbaalllllooonnxxxx\") == 1\n assert candidate(text = \"balonbalonbalon\") == 1\n assert candidate(text = \"baaalllooonnballoonballoon\") == 3\n assert candidate(text = \"abcdefghijklmnopqrstuvwxyzballoon\") == 1\n assert candidate(text = \"lllaaabbbooonnn\") == 1\n assert candidate(text = \"bbaalllllooonnballoon\") == 2\n assert candidate(text = \"baloonbaloonbaloonbaloonbaloon\") == 2\n assert candidate(text = \"baloobaloobaloobaloobalooballoon\") == 1\n assert candidate(text = \"balloonbaloonbaloonbaloonbaloon\") == 3\n assert candidate(text = \"balloonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoonballoon\") == 18\n assert candidate(text = \"balloonballoonballoonbaloonbaloonbaloonballoon\") == 5\n assert candidate(text = \"balllllloooneeeennn\") == 1\n assert candidate(text = \"lloonnbbaaallooonnxx\") == 2\n assert candidate(text = \"ballballoonloonballoon\") == 3\n assert candidate(text = \"balltooloon\") == 1\n assert candidate(text = \"xxxxxxxxxxxxxxxx\") == 0\n assert candidate(text = \"balloonballoonballoonballoonballoonballoonballoonballoonballoon\") == 9\n assert candidate(text = \"ballllooooooonnn\") == 1\n assert candidate(text = \"balllllooonnnnballoon\") == 2\n assert candidate(text = \"looballonnoballoon\") == 2\n assert candidate(text = \"balllllllllllllllllllllllllllllllllooonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnballoon\") == 2\n assert candidate(text = \"bnllobbannolllobnballoonbnllobbannolllobnballoon\") == 4\n"}, "metadata": {"canonical_parameter_names": ["text"], "leetcode_dataset_entry_point": "Solution().maxNumberOfBalloons", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxNumberOfBalloons = function(text) {", "container": null, "callable": "maxNumberOfBalloons", "parameters": [{"name": "text", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1190, "task_id": "reverse-substrings-between-each-pair-of-parentheses", "difficulty": "Medium", "problem_description": "You are given a string s that consists of lower case English letters and brackets.\nReverse the strings in each pair of matching parentheses, starting from the innermost one.\nYour result should not contain any brackets.\n \nExample 1:\n\nInput: s = \"(abcd)\"\nOutput: \"dcba\"\n\nExample 2:\n\nInput: s = \"(u(love)i)\"\nOutput: \"iloveu\"\nExplanation: The substring \"love\" is reversed first, then the whole string is reversed.\n\nExample 3:\n\nInput: s = \"(ed(et(oc))el)\"\nOutput: \"leetcode\"\nExplanation: First, we reverse the substring \"oc\", then \"etco\", and finally, the whole string.\n\n \nConstraints:\n\n1 <= s.length <= 2000\ns only contains lower case English characters and parentheses.\nIt is guaranteed that all parentheses are balanced.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"(a(b(c)d)e)\") == \"ebcda\"\n assert candidate(s = \"(a(b)c(d(e)f)g)\") == \"gdefcba\"\n assert candidate(s = \"(abc)(def)\") == \"cbafed\"\n assert candidate(s = \"(a(b)c(d)e(f)g)\") == \"gfedcba\"\n assert candidate(s = \"(z)\") == \"z\"\n assert candidate(s = \"(abcd)\") == \"dcba\"\n assert candidate(s = \"a(b)c(d(e)f)g\") == \"abcfedg\"\n assert candidate(s = \"(ed(et(oc))el)\") == \"leetcode\"\n assert candidate(s = \"x(abc)d(efg)h(ij(k(lm)n)op)q\") == \"xcbadgfehpokmlnjiq\"\n assert candidate(s = \"abcdefghij(klmnop(qrstuvwxyz))\") == \"abcdefghijqrstuvwxyzponmlk\"\n assert candidate(s = \"abc\") == \"abc\"\n assert candidate(s = \"(abc)d(efg)\") == \"cbadgfe\"\n assert candidate(s = \"(a(b(c)d)e(f(g)h)i\") == \"(adcbehgfi\"\n assert candidate(s = \"()\") == \"\"\n assert candidate(s = \"a(bcdefghijkl(mno)p)q\") == \"apmnolkjihgfedcbq\"\n assert candidate(s = \"(a)\") == \"a\"\n assert candidate(s = \"(u(love)i)\") == \"iloveu\"\n assert candidate(s = \"ab(c(d(e(fg)h)i)j)k\") == \"abjdhfgeick\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o\") == \"(anclejghifkdmbo\"\n assert candidate(s = \"x(y(z(wvu)tsr)qpo)nm\") == \"xopqzuvwtsrynm\"\n assert candidate(s = \"(a(b(c)d)e(f(g(h)i)j)k)l\") == \"kfihgjebcdal\"\n assert candidate(s = \"a(bc(def(ghi)jkl)mno(pqr(stu)vwx)y(z))\") == \"azypqrutsvwxonmdefihgjklcb\"\n assert candidate(s = \"a(b(c)d(e(f(g)h)i)j(k(l(m)n)o)p\") == \"a(bcdifghejolmnkp\"\n assert candidate(s = \"a(bc(def(ghi(jkl(mno)pqr)stu)vwx(yz))\") == \"a(bcyzxwvghirqpmnolkjstufed\"\n assert candidate(s = \"a(b(c)d(e(f(g(h)i)j)k)l)m\") == \"alejghifkdcbm\"\n assert candidate(s = \"x(y(z))a(b(c)d)e(f(g(h)i)j)k\") == \"xzyadcbejghifk\"\n assert candidate(s = \"x(y(z))w\") == \"xzyw\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p(q(r(s(t(u(v(w(x(y(z))))))))))))))))))))z(y(x(w(v(u(t(s(r(q(p(o(n(m(l(k(j(i(h(g(f(e(d(c(b(a))))))))))))))))))))\") == \"(a(b(c(d(e(fhjlnprtvxzywusqomkigz(y(x(w(v(usqomkigecabdfhjlnprt\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p)q)r)s)t)u)v)w)x)y)z))))\") == \"(a(bdfyhwjulsnqpormtkvixgzec\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p(q(r(s(t(u(v(w(x(y(z)))))))))))))))))))))(a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p(q(r(s(t(u(v(w(x(y(z))))))))))))))))))))\") == \"(a(b(c(d(egikmoqsuwyzxvtrpnljhf(a(b(c(d(e(fhjlnprtvxzywusqomkig\"\n assert candidate(s = \"(abc)(def)((ghi)(jkl))(mno)(pqr)((stu)(vwx))(yz)\") == \"cbafedjklghionmrqpvwxstuzy\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h(i))))))))\") == \"(acegihfdb\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p)q)r)s)t)u)v)w)x)y)z))))z(y(x(w(v(u(t(s(r(q(p(o(n(m(l(k(j(i(h(g(f(e(d(c(b(a))))))))))))))))))))\") == \"(a(bdfyhwjulsnqpormtkvixgzecz(y(x(w(v(usqomkigecabdfhjlnprt\"\n assert candidate(s = \"p(q(r(s)t)u)v(w(x(y(z))w)v)u\") == \"purstqvvxzywwu\"\n assert candidate(s = \"a(b(c(d(e(f(g)h)i)j)k)l)m\") == \"alcjehgfidkbm\"\n assert candidate(s = \"(a(bc)de)\") == \"edbca\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r(s(t(u(v(w(x(yz))))))))))\") == \"(anclejghifkdmboqsuwyzxvtrp\"\n assert candidate(s = \"a(bc(def(ghi(jkl(mno(pqr(stu(vwx(yz)))))))))b\") == \"adefjklpqrvwxzyutsonmihgcbb\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r(s(t(u)v)w)x)y)z)\") == \"(anclejghifkdmbozqxsvutwryp\"\n assert candidate(s = \"abcdefgh(ijklmnopqrstuvwxyz)\") == \"abcdefghzyxwvutsrqponmlkji\"\n assert candidate(s = \"(abc(def(ghi(jkl(mno)pqr)stu)vwx(yz))(abc(def(ghi(jkl(mno)pqr)stu)vwx(yz))\") == \"(abcyzxwvghirqpmnolkjstufed(abcyzxwvghirqpmnolkjstufed\"\n assert candidate(s = \"(abcdefgh)ijklmnopqrstuvwxyz\") == \"hgfedcbaijklmnopqrstuvwxyz\"\n assert candidate(s = \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r(s(t(u(vw)x)y)z)))\") == \"anclejghifkdmbo(prztxvwuysq\"\n assert candidate(s = \"a(b(c)d(e(f)g)h)i\") == \"ahefgdcbi\"\n assert candidate(s = \"((abc)(def))\") == \"defabc\"\n assert candidate(s = \"(a(b(c)d)e(f(g(h)i)j)k)\") == \"kfihgjebcda\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k(l)m)n)o(p(q(r)s)t)u(v(w)x)y(z)))\") == \"(acnejghifklmdotqrspuxwvyzb\"\n assert candidate(s = \"a(b(c)d(e(f(g)h)i)j(k(l(m)n)o)p(q(r)s)t(u(v)w)x(y(z)))\") == \"ayzxuvwtqrspknmlojehgfidcb\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r(s(t(u(v(w(x(y(z(u(v(w(x)y)z))))))))))))))\") == \"prtvxzvyxwzuywusqobmdkfihgjelcna\"\n assert candidate(s = \"a(b(c)d)e(f(g(h)i)j)k(l(m(n(o)p)q)r)s(t(u(v)w)x)yz\") == \"adcbejghifkrmponqlsxuvwtyz\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r)s)t)u(v(w)x)y(z))\") == \"zyvwxupsrqtobmdkfihgjelcna\"\n assert candidate(s = \"(a(b(c)d)e(f(g)h)i)\") == \"ifghebcda\"\n assert candidate(s = \"abc(def(ghi)jkl)(mno(pqr)stu)(vw(x(yz)))\") == \"abclkjghifedutspqronmxzywv\"\n assert candidate(s = \"a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p(q(r(s(t(u(v(w(x(y(z))))))))))))))))))))b)c\") == \"a(b(c(d(ebgikmoqsuwyzxvtrpnljhfc\"\n assert candidate(s = \"a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p(q(r)s)t)u)v)w)x)y)z)))))))))\") == \"acegizkxmvotqrspunwlyjhfdb\"\n assert candidate(s = \"(ab)(cd)(ef)(gh)(ij)(kl)(mn)(op)(qr)(st)(uv)(wx)(yz)\") == \"badcfehgjilknmporqtsvuxwzy\"\n assert candidate(s = \"(abcdefgh(i(jklm(nopq)rst)uv)wxyz)\") == \"zyxwitsrnopqmlkjuvhgfedcba\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r(s(t(u)v(w)x)y)z)))\") == \"(anclejghifkdmboqzsxwvutyrp\"\n assert candidate(s = \"(p(q(r)s)t)(u(v(w)x)y)\") == \"tqrspyvwxu\"\n assert candidate(s = \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r)s)t)u\") == \"anclejghifkdmbotqrspu\"\n assert candidate(s = \"(ab(cd(ef(gh(ij)kl)mn)op)qr)st\") == \"rqcdnmghjiklfeopbast\"\n assert candidate(s = \"(x(y(z)))\") == \"yzx\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r(s(t(u(v(w)x)y)z)u)v)w)x)y(z))\") == \"zypwrutyvwxuzsvqxobmdkfihgjelcna\"\n assert candidate(s = \"(a(b)c(d(e(f(g)h)i)j)k(l(m)n)o(p(q(r)s)t)u)\") == \"upsrqtolmnkdifghejcba\"\n assert candidate(s = \"((a(b)c)(d(e(f)g)h)i(j(k(l(m(n(o(p(q(r(s(t(u(v(w(x(y(z))))))))))))))))j)\") == \"(cbahefgdijkmoqsuwyzxvtrpnlj\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i(j)k)l)m)n)o(p(q(r)s)t)u)v)\") == \"(avcnelghijkfmdotqrspub\"\n assert candidate(s = \"x(y(z))\") == \"xzy\"\n assert candidate(s = \"x(a(y(b(z(c)d)e)f)g)h(i(j(k(l)m)n)o)p\") == \"xgyezcdbfahojmlknip\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r(s(t(u(v(w(x)y)z)u)v)w)x)y(z))w)x)y(z)\") == \"xpzyrwtuvyxwzuvsxqwobmdkfihgjelcnayz\"\n assert candidate(s = \"(ab)(cd)((ef)(gh))(ij(kl(mn(op)qr)st)(uv(w(x(yz))))\") == \"badcghef(ijtsmnpoqrlkwyzxvu\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p(q(r(s(t(u(v(w(x(y(z))))))))))))))))))))\") == \"(a(b(c(d(e(fhjlnprtvxzywusqomkig\"\n assert candidate(s = \"x(y(z)(w))v(u(t(s(r(q(p(o(n(m(l(k(j(i(h(g(f(e(d(c(b(a))))))))))))))))))))\") == \"xwzyv(usqomkigecabdfhjlnprt\"\n assert candidate(s = \"((((((((((((a))))))))))))\") == \"a\"\n assert candidate(s = \"((a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r(s(t(u)v)w)x)y)z))\") == \"(pyrwtuvsxqzobmdkfihgjelcna\"\n assert candidate(s = \"x(y(z))a(b(c)d)e(f(g(h)i)j)k(l(m)n)o(p(q(r)s)t(u(v)w)x(y(z)))\") == \"xzyadcbejghifknmloyzxuvwtqrsp\"\n assert candidate(s = \"(a(b(c(d(e(f(g)))))))\") == \"bdfgeca\"\n assert candidate(s = \"m(n(o(p(q(r(s(t(u(v(w(x(y(z(abc)def)ghi)jkl)mno)pqr)stu)vwx)yzz)\") == \"m(n(o(p(q(rzzytutsvonmxihgzcbadefyjklwpqruvwxs\"\n assert candidate(s = \"(p(q(r(s(t(u(v(w(x(y(z)))))))))))\") == \"qsuwyzxvtrp\"\n assert candidate(s = \"a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p(q(r(s(t(u(v(w(x(y(z))))))))))))))))))))b\") == \"a(b(c(d(e(fhjlnprtvxzywusqomkigb\"\n assert candidate(s = \"(p(q(r(s(t(u)v)w)x)y)z)\") == \"zqxsvutwryp\"\n assert candidate(s = \"(abc(def(ghi(jkl(mno(pqr(stu(vwx(yz)))))))))\") == \"defjklpqrvwxzyutsonmihgcba\"\n assert candidate(s = \"a(b(c(d(e(f(g)h)i)j)k)l)\") == \"alcjehgfidkb\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h(ij)kl)mno)pqr)stu)vw)xy)z)\") == \"(azcwverqpglkijhmnofstudxyb\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r)s)t(u(v)w)x)y(z))\") == \"zypsrqtwvuxobmdkfihgjelcna\"\n assert candidate(s = \"(a(bc(def)ghi)jkl)\") == \"lkjbcfedghia\"\n assert candidate(s = \"x(y(z)(w(v(u(t(s(r(q(p(o(n(m(l(k(j(i(h(g(f(e(d(c(b(a))))))))))))))))))))\") == \"x(yz(w(v(usqomkigecabdfhjlnprt\"\n assert candidate(s = \"((a(b)c)(d(e(f)g)h)i(j(k(l(m)n)o)p)q\") == \"(cbahefgdipknmlojq\"\n assert candidate(s = \"abc(def(ghi(jkl(mno(pqr(stu(vwx)y(z)))))))\") == \"abcghimnostuxwvyzrqplkjfed\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k(l)m)n)o(p(q(r)s)t)u(v(w)x)y(z)))(a(b(c(d(e(f(g(h)i)j)k(l)m)n)o(p(q(r)s)t)u(v(w)x)y(z))))\") == \"(acnejghifklmdotqrspuxwvyzbbzyvwxupsrqtodmlkfihgjenca\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p(q(r(s(t(u(v(w(x(y(z))))))))))))))))))))l(m(n(o(p(q(r(s(t(u(v(w(x(y(z))))))))))))))))\") == \"(a(b(c(dfhjlnprtvxzywusqomkiglnprtvxzywusqome\"\n assert candidate(s = \"(a(b(c(d(e(f)g)h)i)j)\") == \"(ajchefgdib\"\n assert candidate(s = \"x(y(z((a)(b))c)d)e\") == \"xdzbacye\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h(i(jk)lm)n)o)p)q)r)s)t)u)\") == \"ubsdqfohmljkingpercta\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().reverseParentheses", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var reverseParentheses = function(s) {", "container": null, "callable": "reverseParentheses", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1191, "task_id": "k-concatenation-maximum-sum", "difficulty": "Medium", "problem_description": "Given an integer array arr and an integer k, modify the array by repeating it k times.\nFor example, if arr = [1, 2] and k = 3 then the modified array will be [1, 2, 1, 2, 1, 2].\nReturn the maximum sub-array sum in the modified array. Note that the length of the sub-array can be 0 and its sum in that case is 0.\nAs the answer can be very large, return the answer modulo 109 + 7.\n \nExample 1:\n\nInput: arr = [1,2], k = 3\nOutput: 9\n\nExample 2:\n\nInput: arr = [1,-2,1], k = 5\nOutput: 2\n\nExample 3:\n\nInput: arr = [-1,-2], k = 7\nOutput: 0\n\n \nConstraints:\n\n1 <= arr.length <= 105\n1 <= k <= 105\n-104 <= arr[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [1],k = 1) == 1\n assert candidate(arr = [-1, 0, 1],k = 3) == 1\n assert candidate(arr = [1, -2, 1],k = 5) == 2\n assert candidate(arr = [3, -2, 2, -3],k = 3) == 3\n assert candidate(arr = [10000, -10000],k = 2) == 10000\n assert candidate(arr = [10000, -10000],k = 100000) == 10000\n assert candidate(arr = [-10000, 10000],k = 100000) == 10000\n assert candidate(arr = [5, -1, 5],k = 3) == 27\n assert candidate(arr = [-1],k = 1) == 0\n assert candidate(arr = [0, 0, 0],k = 100000) == 0\n assert candidate(arr = [-1, -2, -3, -4, -5],k = 1) == 0\n assert candidate(arr = [3, -2, 2, -3],k = 5) == 3\n assert candidate(arr = [5],k = 1) == 5\n assert candidate(arr = [1, 2],k = 3) == 9\n assert candidate(arr = [1, 2, 3, 4, 5],k = 1) == 15\n assert candidate(arr = [0, 0, 0],k = 1) == 0\n assert candidate(arr = [1, -1, 1, -1, 1, -1],k = 100000) == 1\n assert candidate(arr = [1, -10, 1],k = 1) == 1\n assert candidate(arr = [5],k = 10) == 50\n assert candidate(arr = [-1, -2],k = 7) == 0\n assert candidate(arr = [1, -1],k = 200000) == 1\n assert candidate(arr = [1, 1, 1],k = 100000) == 300000\n assert candidate(arr = [-5],k = 1) == 0\n assert candidate(arr = [10000, -9999],k = 2) == 10001\n assert candidate(arr = [10000, -10000, 20000, -20000, 30000],k = 20) == 600000\n assert candidate(arr = [5, -1, 3, -2, 5],k = 10) == 100\n assert candidate(arr = [1, 2, 3, 4, 5],k = 1) == 15\n assert candidate(arr = [2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 540\n assert candidate(arr = [-5, -1, -8, -9],k = 4) == 0\n assert candidate(arr = [-1, -2, -3, -4, -5],k = 50000) == 0\n assert candidate(arr = [-10, 5, -5, 10, -10, 5],k = 7) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 275\n assert candidate(arr = [100, -50, 200, -150, 300, -250, 400, -350, 500, -450],k = 7) == 2200\n assert candidate(arr = [0, 0, 0, 0, 0],k = 100000) == 0\n assert candidate(arr = [-10, -20, -30, -40, -50],k = 2) == 0\n assert candidate(arr = [10, -9, 10, -9, 10, -9, 10, -9, 10, -9],k = 50000) == 250009\n assert candidate(arr = [7, -2, 5, -1, 3, -3, 2, 1],k = 100) == 1200\n assert candidate(arr = [5, -1, 5],k = 100000) == 900000\n assert candidate(arr = [3, -4, 2, -3, -1, 7, -5],k = 10) == 7\n assert candidate(arr = [-10, 100, -1, 100, -100],k = 2) == 288\n assert candidate(arr = [-5, -3, -1, 2, 4, 6],k = 2) == 15\n assert candidate(arr = [1, 2, -3, 4, -5, 6],k = 100000) == 500001\n assert candidate(arr = [100, -200, 300, -400, 500],k = 1000) == 300200\n assert candidate(arr = [2, -1, 2, -1, 2],k = 200000) == 800000\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 100000) == 0\n assert candidate(arr = [5, -1, 5],k = 10) == 90\n assert candidate(arr = [-10, 9, -20, 10, -30, 20, -40, 30, -50, 40],k = 5) == 40\n assert candidate(arr = [1000, -1000, 2000, -2000, 3000, -3000],k = 50000) == 3000\n assert candidate(arr = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 100000) == 1\n assert candidate(arr = [5, -1, 2, 3, -2],k = 10) == 72\n assert candidate(arr = [5, -1, 3, -4, 2],k = 10) == 52\n assert candidate(arr = [5, -1, 3, -4, 2, 6, -5],k = 10) == 65\n assert candidate(arr = [10, -3, 4, -2, -1, 10],k = 7) == 126\n assert candidate(arr = [-5, -1, -2, -3, -2],k = 4) == 0\n assert candidate(arr = [-5, -1, -8, -2, -4],k = 50000) == 0\n assert candidate(arr = [10000, -9999, 10000, -9999],k = 50000) == 109999\n assert candidate(arr = [-10000, 10000, -9999, 9999, -9998, 9998],k = 50000) == 10000\n assert candidate(arr = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1],k = 100000) == 0\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0],k = 100000) == 0\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 550\n assert candidate(arr = [-5, 5, -10, 10, -15, 15],k = 3) == 15\n assert candidate(arr = [-1, 0, 1],k = 100000) == 1\n assert candidate(arr = [10000, -5000, 2000, -3000, 1000],k = 50000) == 250005000\n assert candidate(arr = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1],k = 50000) == 1\n assert candidate(arr = [10000, -9999, 10000, -9999, 10000],k = 50000) == 500100000\n assert candidate(arr = [1, -3, 2, 1, -1],k = 1) == 3\n assert candidate(arr = [10, 20, 30, 40, 50],k = 100000) == 15000000\n assert candidate(arr = [10000, -9999],k = 10) == 10009\n assert candidate(arr = [5, -3, 5, -2, 4, -1],k = 10) == 81\n assert candidate(arr = [0, 0, 0, 0, 0],k = 50000) == 0\n assert candidate(arr = [-1, -2, -3, -4],k = 3) == 0\n assert candidate(arr = [100, -1, 1, -1, 1, -1, 100],k = 5) == 995\n assert candidate(arr = [10, -20, 10, -20, 10],k = 4) == 20\n assert candidate(arr = [-1, -2, -3, -4, -5],k = 100000) == 0\n assert candidate(arr = [-10, 1, -2, 3, -4, 5, -6, 7, -8, 9],k = 3) == 9\n assert candidate(arr = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000],k = 100000) == 999999937\n assert candidate(arr = [1, -1, 1, -1, 1],k = 5) == 5\n assert candidate(arr = [0, 0, 0, 0],k = 100000) == 0\n assert candidate(arr = [1, -1, 1, -1, 1],k = 100000) == 100000\n assert candidate(arr = [1, -1, 1, -1, 1],k = 99999) == 99999\n assert candidate(arr = [-5, -4, -3, -2, -1],k = 50000) == 0\n assert candidate(arr = [-1, 0, -2],k = 3) == 0\n assert candidate(arr = [10, -3, 4, -1, -2, 1, 5, -3],k = 50) == 553\n assert candidate(arr = [-10, -20, -30, -40],k = 100000) == 0\n assert candidate(arr = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5],k = 10) == 15\n assert candidate(arr = [-5, -1, -8, -9],k = 2) == 0\n assert candidate(arr = [7, 1, 5, -3, 6, 7],k = 7) == 161\n assert candidate(arr = [-1, -2, -3, -4, -5],k = 7) == 0\n assert candidate(arr = [10000, -10000, 10000, -10000],k = 10000) == 10000\n assert candidate(arr = [-1, -2, -3, -4, -5],k = 2) == 0\n assert candidate(arr = [-10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000],k = 50000) == 10000\n assert candidate(arr = [10, -9, 1, 2, 3],k = 50000) == 350003\n assert candidate(arr = [10000, -9999, 10000, -9999, 10000],k = 100000) == 199993\n assert candidate(arr = [100, -50, 25, -25, 10],k = 6) == 400\n assert candidate(arr = [5, -3, 5, -2, 1, 3],k = 10) == 90\n assert candidate(arr = [5, -3, 5, -2, 7, -1],k = 4) == 45\n assert candidate(arr = [-1, 4, -2, 3, -2],k = 100000) == 200003\n assert candidate(arr = [5, -4, 6, -3, 4],k = 10) == 80\n assert candidate(arr = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1],k = 5) == 0\n assert candidate(arr = [10000, -9999],k = 10000) == 19999\n assert candidate(arr = [10000, -9999, 9998, -9997, 9996, -9995, 9994, -9993, 9992, -9991],k = 5000) == 34995\n assert candidate(arr = [10, -10, 20, -20, 30, -30, 40, -40, 50, -50],k = 100) == 50\n assert candidate(arr = [1, -1, 1, -1, 1, -1, 1],k = 100000) == 100000\n assert candidate(arr = [9, -4, 5, 1, -2, -3, 7],k = 100) == 1300\n assert candidate(arr = [-1, -2, -3, -4, -5],k = 3) == 0\n assert candidate(arr = [-5, -2, -3, -1],k = 3) == 0\n"}, "metadata": {"canonical_parameter_names": ["arr", "k"], "leetcode_dataset_entry_point": "Solution().kConcatenationMaxSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var kConcatenationMaxSum = function(arr, k) {", "container": null, "callable": "kConcatenationMaxSum", "parameters": [{"name": "arr", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1192, "task_id": "critical-connections-in-a-network", "difficulty": "Hard", "problem_description": "There are n servers numbered from 0 to n - 1 connected by undirected server-to-server connections forming a network where connections[i] = [ai, bi] represents a connection between servers ai and bi. Any server can reach other servers directly or indirectly through the network.\nA critical connection is a connection that, if removed, will make some servers unable to reach some other server.\nReturn all critical connections in the network in any order.\n \nExample 1:\n\n\nInput: n = 4, connections = [[0,1],[1,2],[2,0],[1,3]]\nOutput: [[1,3]]\nExplanation: [[3,1]] is also accepted.\n\nExample 2:\n\nInput: n = 2, connections = [[0,1]]\nOutput: [[0,1]]\n\n \nConstraints:\n\n2 <= n <= 105\nn - 1 <= connections.length <= 105\n0 <= ai, bi <= n - 1\nai != bi\nThere are no repeated connections.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 7,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 0], [1, 5]]) == []\n assert candidate(n = 6,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0], [2, 4]]) == []\n assert candidate(n = 6,connections = [[0, 1], [1, 2], [2, 0], [1, 3], [3, 4], [4, 5], [5, 3]]) == [[1, 3]]\n assert candidate(n = 5,connections = [[0, 1], [0, 2], [1, 3], [2, 4]]) == [[1, 3], [0, 1], [2, 4], [0, 2]]\n assert candidate(n = 5,connections = [[0, 1], [0, 2], [1, 2], [1, 3], [1, 4]]) == [[1, 3], [1, 4]]\n assert candidate(n = 5,connections = [[0, 1], [0, 2], [1, 3], [2, 3], [2, 4]]) == [[2, 4]]\n assert candidate(n = 4,connections = [[0, 1], [1, 2], [2, 0], [1, 3]]) == [[1, 3]]\n assert candidate(n = 5,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 0], [2, 4]]) == []\n assert candidate(n = 2,connections = [[0, 1]]) == [[0, 1]]\n assert candidate(n = 6,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0]]) == []\n assert candidate(n = 3,connections = [[0, 1], [1, 2]]) == [[1, 2], [0, 1]]\n assert candidate(n = 15,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 0], [1, 8], [2, 9], [3, 10], [4, 11], [5, 12], [6, 13], [7, 14]]) == []\n assert candidate(n = 10,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0], [0, 5]]) == []\n assert candidate(n = 8,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [0, 7], [1, 6], [2, 5], [3, 4]]) == []\n assert candidate(n = 25,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 0], [1, 3], [3, 5], [5, 7], [7, 9], [9, 11], [11, 13], [13, 15], [15, 17], [17, 19], [19, 21], [21, 23]]) == []\n assert candidate(n = 8,connections = [[0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [5, 6], [6, 7], [7, 4], [0, 4], [1, 5], [2, 6], [3, 7]]) == []\n assert candidate(n = 7,connections = [[0, 1], [0, 2], [1, 2], [1, 3], [2, 3], [3, 4], [3, 5], [4, 5], [4, 6], [5, 6]]) == []\n assert candidate(n = 9,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 0], [0, 4], [1, 5], [2, 6], [3, 7]]) == []\n assert candidate(n = 20,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 15]]) == [[14, 15], [13, 14], [12, 13], [11, 12], [10, 11], [9, 10], [8, 9], [7, 8], [6, 7], [5, 6], [4, 5], [3, 4], [2, 3], [1, 2], [0, 1]]\n assert candidate(n = 10,connections = [[0, 1], [0, 2], [1, 2], [1, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 4]]) == [[3, 4], [1, 3]]\n assert candidate(n = 15,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 0], [1, 5], [3, 7], [6, 10]]) == []\n assert candidate(n = 12,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 0], [1, 3], [4, 6], [7, 9], [2, 10]]) == []\n assert candidate(n = 20,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 0], [5, 10], [11, 16], [3, 8], [0, 15]]) == []\n assert candidate(n = 12,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [0, 11], [1, 3], [5, 7], [8, 11]]) == []\n assert candidate(n = 12,connections = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 5]]) == []\n assert candidate(n = 10,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0], [4, 7], [2, 8]]) == []\n assert candidate(n = 20,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 0], [1, 12], [2, 13], [3, 14], [4, 15], [5, 16], [6, 17], [7, 18], [8, 19], [9, 10], [10, 11], [0, 5], [5, 10], [10, 15]]) == []\n assert candidate(n = 9,connections = [[0, 1], [0, 2], [1, 3], [2, 3], [4, 5], [5, 6], [6, 7], [7, 8], [8, 4], [3, 8], [3, 4]]) == []\n assert candidate(n = 8,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 0], [5, 6], [6, 7], [7, 5], [0, 5], [1, 6], [2, 7], [3, 4]]) == []\n assert candidate(n = 7,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 0], [1, 3], [4, 5], [5, 6], [6, 1]]) == []\n assert candidate(n = 20,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 0], [1, 3], [3, 5], [5, 7], [7, 9], [9, 11], [11, 13], [13, 15], [15, 17], [17, 19]]) == []\n assert candidate(n = 7,connections = [[0, 1], [0, 2], [1, 2], [1, 3], [1, 4], [2, 3], [3, 5], [4, 5], [5, 6], [4, 6]]) == []\n assert candidate(n = 20,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 0], [0, 5], [5, 10], [10, 15]]) == []\n assert candidate(n = 8,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0], [3, 5], [1, 4], [2, 6], [0, 7]]) == []\n assert candidate(n = 30,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], [25, 26], [26, 27], [27, 28], [28, 29], [29, 0], [1, 3], [3, 5], [5, 7], [7, 9], [9, 11], [11, 13], [13, 15], [15, 17], [17, 19], [19, 21], [21, 23], [23, 25], [25, 27], [27, 29]]) == []\n assert candidate(n = 11,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [0, 5]]) == [[9, 10], [8, 9], [7, 8], [6, 7], [5, 6]]\n assert candidate(n = 7,connections = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 4], [5, 6], [0, 3]]) == [[0, 2]]\n assert candidate(n = 11,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 0], [1, 5], [3, 7], [6, 0]]) == []\n assert candidate(n = 15,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 0], [1, 4], [2, 5], [3, 6], [7, 10], [8, 11], [9, 12], [10, 13], [11, 14]]) == []\n assert candidate(n = 9,connections = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 5], [5, 6]]) == [[3, 7], [3, 8], [1, 3]]\n assert candidate(n = 10,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == [[8, 9], [7, 8], [6, 7], [5, 6], [4, 5], [3, 4], [2, 3], [1, 2], [0, 1]]\n assert candidate(n = 15,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 0], [3, 7], [1, 8], [2, 9], [0, 11], [5, 13]]) == []\n assert candidate(n = 12,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 5], [5, 0]]) == []\n assert candidate(n = 12,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 0], [2, 8], [4, 6]]) == []\n assert candidate(n = 15,connections = [[0, 1], [1, 2], [2, 0], [3, 4], [4, 5], [5, 3], [6, 7], [7, 8], [8, 9], [9, 6], [10, 11], [11, 12], [12, 13], [13, 14], [14, 10]]) == []\n assert candidate(n = 10,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0], [1, 3], [5, 7]]) == []\n assert candidate(n = 8,connections = [[0, 1], [1, 2], [2, 3], [3, 0], [2, 4], [4, 5], [5, 6], [6, 7], [7, 4]]) == [[2, 4]]\n assert candidate(n = 10,connections = [[0, 1], [0, 2], [1, 2], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 3]]) == []\n assert candidate(n = 10,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [0, 9], [1, 8], [2, 7], [3, 6], [4, 5]]) == []\n assert candidate(n = 12,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 0], [1, 7], [3, 9], [5, 11]]) == []\n assert candidate(n = 12,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 0], [0, 6], [3, 9], [5, 7]]) == []\n assert candidate(n = 15,connections = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [5, 6], [7, 8], [8, 9], [10, 11], [11, 12], [12, 13], [13, 14], [10, 14]]) == [[0, 1], [0, 2]]\n assert candidate(n = 9,connections = [[0, 1], [0, 2], [0, 3], [0, 4], [1, 5], [1, 6], [2, 7], [2, 8], [3, 5], [3, 7], [4, 6], [4, 8]]) == []\n assert candidate(n = 15,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 0], [2, 5], [4, 7], [6, 9], [8, 11], [10, 13]]) == []\n assert candidate(n = 20,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 0]]) == []\n assert candidate(n = 7,connections = [[0, 1], [0, 2], [1, 2], [1, 3], [2, 3], [3, 4], [4, 5], [4, 6], [5, 6], [0, 4]]) == []\n assert candidate(n = 20,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [0, 19], [10, 15], [5, 12]]) == []\n assert candidate(n = 20,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 0], [5, 10], [10, 15], [0, 5], [5, 15], [10, 18], [15, 18]]) == []\n assert candidate(n = 8,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [0, 7], [1, 4], [2, 5], [3, 6]]) == []\n assert candidate(n = 10,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0], [0, 3], [3, 6], [6, 9]]) == []\n assert candidate(n = 15,connections = [[0, 1], [1, 2], [2, 0], [3, 4], [4, 5], [5, 3], [6, 7], [7, 8], [8, 9], [9, 6], [10, 11], [11, 12], [12, 10], [13, 14], [14, 13]]) == []\n assert candidate(n = 10,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0], [1, 3], [3, 5], [5, 7], [7, 9]]) == []\n assert candidate(n = 15,connections = [[0, 1], [0, 2], [1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4], [5, 6], [6, 7], [7, 8], [8, 5], [4, 8], [6, 9], [9, 10], [10, 11], [11, 12], [12, 9], [13, 14]]) == [[6, 9], [4, 8]]\n assert candidate(n = 7,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 0], [2, 5]]) == []\n assert candidate(n = 15,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 0], [1, 3], [3, 5], [5, 7], [7, 9], [9, 11], [11, 13]]) == []\n assert candidate(n = 10,connections = [[0, 1], [1, 2], [2, 0], [3, 4], [4, 5], [5, 3], [6, 7], [7, 8], [8, 9], [9, 6]]) == []\n assert candidate(n = 10,connections = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [5, 6], [7, 8], [8, 9]]) == [[0, 1], [0, 2]]\n assert candidate(n = 8,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0], [1, 5]]) == []\n assert candidate(n = 10,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 5]]) == [[4, 5], [3, 4], [2, 3], [1, 2], [0, 1]]\n assert candidate(n = 15,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 10], [0, 14], [1, 13], [2, 12], [3, 11], [4, 10]]) == []\n assert candidate(n = 16,connections = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 0], [0, 8], [1, 9], [2, 10], [3, 11], [4, 12], [5, 13], [6, 14], [7, 15]]) == []\n"}, "metadata": {"canonical_parameter_names": ["n", "connections"], "leetcode_dataset_entry_point": "Solution().criticalConnections", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var criticalConnections = function(n, connections) {", "container": null, "callable": "criticalConnections", "parameters": [{"name": "n", "type": "number"}, {"name": "connections", "type": "number[][]"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1200, "task_id": "minimum-absolute-difference", "difficulty": "Easy", "problem_description": "Given an array of distinct integers arr, find all pairs of elements with the minimum absolute difference of any two elements.\nReturn a list of pairs in ascending order(with respect to pairs), each pair [a, b] follows\n\na, b are from arr\na < b\nb - a equals to the minimum absolute difference of any two elements in arr\n\n \nExample 1:\n\nInput: arr = [4,2,1,3]\nOutput: [[1,2],[2,3],[3,4]]\nExplanation: The minimum absolute difference is 1. List all pairs with difference equal to 1 in ascending order.\nExample 2:\n\nInput: arr = [1,3,6,10,15]\nOutput: [[1,3]]\n\nExample 3:\n\nInput: arr = [3,8,-10,23,19,-4,-14,27]\nOutput: [[-14,-10],[19,23],[23,27]]\n\n \nConstraints:\n\n2 <= arr.length <= 105\n-106 <= arr[i] <= 106\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [5, 1, 4, 1, 3]) == [[1, 1]]\n assert candidate(arr = [4, 2, 1, 3]) == [[1, 2], [2, 3], [3, 4]]\n assert candidate(arr = [3, 8, -10, 23, 19, -4, -14, 27]) == [[-14, -10], [19, 23], [23, 27]]\n assert candidate(arr = [100000, -100000, 0]) == [[-100000, 0], [0, 100000]]\n assert candidate(arr = [1, 3, 6, 10, 15]) == [[1, 3]]\n assert candidate(arr = [100000, -100000, 50000, -50000]) == [[-100000, -50000], [50000, 100000]]\n assert candidate(arr = [-5, -2, -6, -3, -4]) == [[-6, -5], [-5, -4], [-4, -3], [-3, -2]]\n assert candidate(arr = [1, 2]) == [[1, 2]]\n assert candidate(arr = [-1, 2, 1, -4]) == [[1, 2]]\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]\n assert candidate(arr = [10, 5, 2, 3, 18]) == [[2, 3]]\n assert candidate(arr = [5, 1, 4, 1, 2]) == [[1, 1]]\n assert candidate(arr = [-5, -2, -4, -1]) == [[-5, -4], [-2, -1]]\n assert candidate(arr = [0, 100, 200, 300]) == [[0, 100], [100, 200], [200, 300]]\n assert candidate(arr = [500000, 499999, 499998, 499997, 499996, 499995, 499994, 499993, 499992, 499991, 499990, 499989, 499988, 499987, 499986]) == [[499986, 499987], [499987, 499988], [499988, 499989], [499989, 499990], [499990, 499991], [499991, 499992], [499992, 499993], [499993, 499994], [499994, 499995], [499995, 499996], [499996, 499997], [499997, 499998], [499998, 499999], [499999, 500000]]\n assert candidate(arr = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153]) == [[1, 3]]\n assert candidate(arr = [7, 22, 15, 8, 30, 19, 5, 27, 12, 3]) == [[7, 8]]\n assert candidate(arr = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520]) == [[500, 501], [501, 502], [502, 503], [503, 504], [504, 505], [505, 506], [506, 507], [507, 508], [508, 509], [509, 510], [510, 511], [511, 512], [512, 513], [513, 514], [514, 515], [515, 516], [516, 517], [517, 518], [518, 519], [519, 520]]\n assert candidate(arr = [0, -1, 1, -2, 2, -3, 3, -4, 4, -5, 5, -6, 6, -7, 7, -8, 8, -9, 9, -10, 10]) == [[-10, -9], [-9, -8], [-8, -7], [-7, -6], [-6, -5], [-5, -4], [-4, -3], [-3, -2], [-2, -1], [-1, 0], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]\n assert candidate(arr = [1, 1000000, 500000, 750000, 250000, 125000, 375000, 625000, 875000]) == [[1, 125000]]\n assert candidate(arr = [1, 2, 3, 5, 6, 8, 9, 10, 12, 13, 15, 16, 18, 19, 21, 22, 24, 25, 27, 28, 30, 31]) == [[1, 2], [2, 3], [5, 6], [8, 9], [9, 10], [12, 13], [15, 16], [18, 19], [21, 22], [24, 25], [27, 28], [30, 31]]\n assert candidate(arr = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55]) == [[1, 3]]\n assert candidate(arr = [5, 3, 1, 9, 7, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]) == [[1, 3], [3, 5], [5, 7], [7, 9], [9, 11], [11, 13], [13, 15], [15, 17], [17, 19], [19, 21], [21, 23], [23, 25], [25, 27], [27, 29]]\n assert candidate(arr = [1000000, -1000000, 500000, -500000, 0]) == [[-1000000, -500000], [-500000, 0], [0, 500000], [500000, 1000000]]\n assert candidate(arr = [1, 1000000, 2, 999999, 3, 999998]) == [[1, 2], [2, 3], [999998, 999999], [999999, 1000000]]\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == [[1, 3], [3, 5], [5, 7], [7, 9], [9, 11], [11, 13], [13, 15], [15, 17], [17, 19], [19, 21], [21, 23], [23, 25], [25, 27], [27, 29], [29, 31], [31, 33], [33, 35], [35, 37], [37, 39], [39, 41], [41, 43], [43, 45], [45, 47], [47, 49], [49, 51], [51, 53], [53, 55], [55, 57], [57, 59]]\n assert candidate(arr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]) == [[2, 3]]\n assert candidate(arr = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765]) == [[1, 2], [2, 3]]\n assert candidate(arr = [1, 10, 100, 1000, 10000, 100000, 1000000, -1, -10, -100, -1000, -10000, -100000, -1000000]) == [[-1, 1]]\n assert candidate(arr = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000]) == [[1, 10]]\n assert candidate(arr = [100000, -100000, 50000, -50000, 25000, -25000]) == [[-50000, -25000], [25000, 50000]]\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100], [100, 110], [110, 120], [120, 130], [130, 140], [140, 150]]\n assert candidate(arr = [999999, -999999, 500000, -500000, 250000, -250000, 750000, -750000]) == [[-999999, -750000], [750000, 999999]]\n assert candidate(arr = [-1, -3, -2, -5, -4, -6, -7, -8, -9, -10]) == [[-10, -9], [-9, -8], [-8, -7], [-7, -6], [-6, -5], [-5, -4], [-4, -3], [-3, -2], [-2, -1]]\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110]) == [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100], [100, 110]]\n assert candidate(arr = [2, 20, 200, 2000, 20000, 200000, 2000000, 20000000]) == [[2, 20]]\n assert candidate(arr = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]) == [[1, 10]]\n assert candidate(arr = [-1, 0, 1, -2, 2, -3, 3, -4, 4, -5, 5, -6, 6, -7, 7, -8, 8, -9, 9, -10, 10]) == [[-10, -9], [-9, -8], [-8, -7], [-7, -6], [-6, -5], [-5, -4], [-4, -3], [-3, -2], [-2, -1], [-1, 0], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]\n assert candidate(arr = [50, 40, 30, 20, 10, 0, -10, -20, -30, -40, -50, -60, -70, -80, -90, -100]) == [[-100, -90], [-90, -80], [-80, -70], [-70, -60], [-60, -50], [-50, -40], [-40, -30], [-30, -20], [-20, -10], [-10, 0], [0, 10], [10, 20], [20, 30], [30, 40], [40, 50]]\n assert candidate(arr = [1000000, -1000000, 500000, -500000, 250000, -250000]) == [[-500000, -250000], [250000, 500000]]\n assert candidate(arr = [-3, -1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == [[-1, 0]]\n assert candidate(arr = [1000000, 999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991, 999990, 999989]) == [[999989, 999990], [999990, 999991], [999991, 999992], [999992, 999993], [999993, 999994], [999994, 999995], [999995, 999996], [999996, 999997], [999997, 999998], [999998, 999999], [999999, 1000000]]\n assert candidate(arr = [1000, 1001, 1003, 1006, 1010, 1015, 1021, 1028, 1036, 1045, 1055, 1066, 1078, 1091, 1105, 1120]) == [[1000, 1001]]\n assert candidate(arr = [-100, -200, -300, -400, -500, -600, -700, -800, -900, -1000, -1100, -1200, -1300]) == [[-1300, -1200], [-1200, -1100], [-1100, -1000], [-1000, -900], [-900, -800], [-800, -700], [-700, -600], [-600, -500], [-500, -400], [-400, -300], [-300, -200], [-200, -100]]\n assert candidate(arr = [-1000000, -999999, -999998, -999997, -999996]) == [[-1000000, -999999], [-999999, -999998], [-999998, -999997], [-999997, -999996]]\n assert candidate(arr = [-1000, -500, -250, -125, -62, -31, -15, -7, -3, -1, 0, 1, 3, 7, 15, 31, 62, 125, 250, 500, 1000]) == [[-1, 0], [0, 1]]\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500]) == [[100, 200], [200, 300], [300, 400], [400, 500], [500, 600], [600, 700], [700, 800], [800, 900], [900, 1000], [1000, 1100], [1100, 1200], [1200, 1300], [1300, 1400], [1400, 1500], [1500, 1600], [1600, 1700], [1700, 1800], [1800, 1900], [1900, 2000], [2000, 2100], [2100, 2200], [2200, 2300], [2300, 2400], [2400, 2500]]\n assert candidate(arr = [1000, 2000, 3000, 4000, 5000, 1001, 2001, 3001, 4001, 5001]) == [[1000, 1001], [2000, 2001], [3000, 3001], [4000, 4001], [5000, 5001]]\n assert candidate(arr = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120]) == [[1, 3]]\n assert candidate(arr = [100, 200, 300, 400, 500, 101, 201, 301, 401, 501]) == [[100, 101], [200, 201], [300, 301], [400, 401], [500, 501]]\n assert candidate(arr = [34, -56, 78, -90, 123, -123, 45, -45, 67, -67, 89, -89]) == [[-90, -89]]\n assert candidate(arr = [1, 1000000, 2, 999999, 3, 999998, 4, 999997]) == [[1, 2], [2, 3], [3, 4], [999997, 999998], [999998, 999999], [999999, 1000000]]\n assert candidate(arr = [123456, 654321, 111111, 222222, 333333, 444444, 555555, 666666, 777777, 888888, 999999]) == [[111111, 123456], [654321, 666666]]\n assert candidate(arr = [-1000000, 1000000, -999999, 999999, -999998, 999998, -999997, 999997, -999996, 999996]) == [[-1000000, -999999], [-999999, -999998], [-999998, -999997], [-999997, -999996], [999996, 999997], [999997, 999998], [999998, 999999], [999999, 1000000]]\n assert candidate(arr = [100000, -100000, 50000, -50000, 0, 25000, -25000]) == [[-50000, -25000], [-25000, 0], [0, 25000], [25000, 50000]]\n assert candidate(arr = [5, 9, 15, 22, 30, 38, 47, 57, 68, 80, 93, 107, 122, 138, 155]) == [[5, 9]]\n assert candidate(arr = [5, 3, 1, 4, 2, 8, 6, 7, 10, 9]) == [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]\n assert candidate(arr = [-1, -10, -100, -1000, -10000, -100000, -1000000, -10000000, -100000000, -1000000000]) == [[-10, -1]]\n assert candidate(arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]) == [[1, 1], [3, 3], [5, 5], [5, 5]]\n assert candidate(arr = [1000000, 999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992]) == [[999992, 999993], [999993, 999994], [999994, 999995], [999995, 999996], [999996, 999997], [999997, 999998], [999998, 999999], [999999, 1000000]]\n assert candidate(arr = [100, 200, 300, 400, 500, 150, 250, 350, 450, 550]) == [[100, 150], [150, 200], [200, 250], [250, 300], [300, 350], [350, 400], [400, 450], [450, 500], [500, 550]]\n assert candidate(arr = [100000, -100000, 50000, -50000, 25000, -25000, 75000, -75000]) == [[-100000, -75000], [-75000, -50000], [-50000, -25000], [25000, 50000], [50000, 75000], [75000, 100000]]\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384]) == [[1, 2]]\n assert candidate(arr = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000]) == [[1000, 2000], [2000, 3000], [3000, 4000], [4000, 5000], [5000, 6000], [6000, 7000], [7000, 8000], [8000, 9000], [9000, 10000], [10000, 11000], [11000, 12000], [12000, 13000], [13000, 14000], [14000, 15000]]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15]]\n assert candidate(arr = [10, 2, 8, 4, 6, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == [[2, 4], [4, 6], [6, 8], [8, 10], [10, 12], [12, 14], [14, 16], [16, 18], [18, 20], [20, 22], [22, 24], [24, 26], [26, 28], [28, 30]]\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == [[100, 200], [200, 300], [300, 400], [400, 500], [500, 600], [600, 700], [700, 800], [800, 900], [900, 1000], [1000, 1100], [1100, 1200], [1200, 1300], [1300, 1400], [1400, 1500]]\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10, -20, -30, -40]) == [[-40, -30], [-30, -20], [-20, -10], [-10, 0], [0, 10], [10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100]]\n assert candidate(arr = [-1000000, 1000000, 0, -1, 1, -2, 2, -3, 3, -4, 4]) == [[-4, -3], [-3, -2], [-2, -1], [-1, 0], [0, 1], [1, 2], [2, 3], [3, 4]]\n assert candidate(arr = [1, 1000000, 2, 999999, 3, 999998, 4, 999997, 5, 999996]) == [[1, 2], [2, 3], [3, 4], [4, 5], [999996, 999997], [999997, 999998], [999998, 999999], [999999, 1000000]]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25]]\n assert candidate(arr = [1, 3, 6, 8, 10, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39]) == [[1, 3], [6, 8], [8, 10], [10, 12]]\n assert candidate(arr = [1, 10, 100, 1000, 10000, 100000, 1000000]) == [[1, 10]]\n assert candidate(arr = [-10, -20, -30, -40, -50, 10, 20, 30, 40, 50]) == [[-50, -40], [-40, -30], [-30, -20], [-20, -10], [10, 20], [20, 30], [30, 40], [40, 50]]\n assert candidate(arr = [5, 3, 8, 6, 7, 2, 4, 1, 9, 10]) == [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]\n assert candidate(arr = [243, 456, 123, 789, 101, 321, 654, 987, 123, 456, 789, 101, 321, 654, 987]) == [[101, 101], [123, 123], [321, 321], [456, 456], [654, 654], [789, 789], [987, 987]]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20]]\n assert candidate(arr = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97]) == [[1, 5], [5, 9], [9, 13], [13, 17], [17, 21], [21, 25], [25, 29], [29, 33], [33, 37], [37, 41], [41, 45], [45, 49], [49, 53], [53, 57], [57, 61], [61, 65], [65, 69], [69, 73], [73, 77], [77, 81], [81, 85], [85, 89], [89, 93], [93, 97]]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == [[-10, -9], [-9, -8], [-8, -7], [-7, -6], [-6, -5], [-5, -4], [-4, -3], [-3, -2], [-2, -1], [-1, 0], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80], [80, 90], [90, 100], [100, 110], [110, 120], [120, 130], [130, 140], [140, 150], [150, 160], [160, 170], [170, 180], [180, 190], [190, 200]]\n assert candidate(arr = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == [[-10, -9], [-9, -8], [-8, -7], [-7, -6], [-6, -5], [-5, -4], [-4, -3], [-3, -2], [-2, -1]]\n assert candidate(arr = [999999, 1000000, 999998, 1000001, 999997]) == [[999997, 999998], [999998, 999999], [999999, 1000000], [1000000, 1000001]]\n assert candidate(arr = [1, 2, 3, 5, 6, 8, 9, 11, 12, 14, 15]) == [[1, 2], [2, 3], [5, 6], [8, 9], [11, 12], [14, 15]]\n assert candidate(arr = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115]) == [[100, 101], [101, 102], [102, 103], [103, 104], [104, 105], [105, 106], [106, 107], [107, 108], [108, 109], [109, 110], [110, 111], [111, 112], [112, 113], [113, 114], [114, 115]]\n assert candidate(arr = [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20]) == [[-20, -19], [-19, -18], [-18, -17], [-17, -16], [-16, -15], [-15, -14], [-14, -13], [-13, -12], [-12, -11], [-11, -10], [-10, -9], [-9, -8], [-8, -7], [-7, -6], [-6, -5], [-5, -4], [-4, -3], [-3, -2], [-2, -1]]\n assert candidate(arr = [999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991, 999990]) == [[999990, 999991], [999991, 999992], [999992, 999993], [999993, 999994], [999994, 999995], [999995, 999996], [999996, 999997], [999997, 999998], [999998, 999999]]\n assert candidate(arr = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70]) == [[70, 71], [71, 72], [72, 73], [73, 74], [74, 75], [75, 76], [76, 77], [77, 78], [78, 79], [79, 80], [80, 81], [81, 82], [82, 83], [83, 84], [84, 85], [85, 86], [86, 87], [87, 88], [88, 89], [89, 90], [90, 91], [91, 92], [92, 93], [93, 94], [94, 95], [95, 96], [96, 97], [97, 98], [98, 99], [99, 100]]\n assert candidate(arr = [100000, 100001, 100002, 100003, 100004, 100005, 100006, 100007, 100008, 100009, 100010, 100011, 100012, 100013, 100014]) == [[100000, 100001], [100001, 100002], [100002, 100003], [100003, 100004], [100004, 100005], [100005, 100006], [100006, 100007], [100007, 100008], [100008, 100009], [100009, 100010], [100010, 100011], [100011, 100012], [100012, 100013], [100013, 100014]]\n assert candidate(arr = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70]) == [[7, 14], [14, 21], [21, 28], [28, 35], [35, 42], [42, 49], [49, 56], [56, 63], [63, 70]]\n assert candidate(arr = [234, 534, 123, 999, 456, 12, 78, 345, 876, 543, 213, 678, 987, 1234, 5678]) == [[534, 543]]\n assert candidate(arr = [5, 23, 7, 11, 3, 15, 2, 18, 6, 14, 8, 12, 10, 4, 17, 19, 13, 9, 1, 16, 20, 21, 22]) == [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23]]\n assert candidate(arr = [100000, 99998, 99999, 100001, 99997]) == [[99997, 99998], [99998, 99999], [99999, 100000], [100000, 100001]]\n assert candidate(arr = [123456, 654321, 111111, 222222, 333333, 444444, 555555, 666666, 777777, 888888, 999999, 1000000]) == [[999999, 1000000]]\n assert candidate(arr = [42, 84, 126, 168, 210, 252, 294, 336, 378, 420]) == [[42, 84], [84, 126], [126, 168], [168, 210], [210, 252], [252, 294], [294, 336], [336, 378], [378, 420]]\n assert candidate(arr = [500, 400, 300, 200, 100, 0, -100, -200, -300, -400, -500, -600, -700, -800, -900]) == [[-900, -800], [-800, -700], [-700, -600], [-600, -500], [-500, -400], [-400, -300], [-300, -200], [-200, -100], [-100, 0], [0, 100], [100, 200], [200, 300], [300, 400], [400, 500]]\n assert candidate(arr = [1000, 1001, 1003, 1006, 1010, 1015, 1021, 1028, 1036, 1045]) == [[1000, 1001]]\n assert candidate(arr = [-1000000, 1000000, -500000, 500000, 0]) == [[-1000000, -500000], [-500000, 0], [0, 500000], [500000, 1000000]]\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536]) == [[1, 2]]\n assert candidate(arr = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231]) == [[1, 3]]\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]) == [[1, 2]]\n assert candidate(arr = [-100, -99, -97, -94, -90, -85, -80, -75, -70, -65]) == [[-100, -99]]\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().minimumAbsDifference", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minimumAbsDifference = function(arr) {", "container": null, "callable": "minimumAbsDifference", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1201, "task_id": "ugly-number-iii", "difficulty": "Medium", "problem_description": "An ugly number is a positive integer that is divisible by a, b, or c.\nGiven four integers n, a, b, and c, return the nth ugly number.\n \nExample 1:\n\nInput: n = 3, a = 2, b = 3, c = 5\nOutput: 4\nExplanation: The ugly numbers are 2, 3, 4, 5, 6, 8, 9, 10... The 3rd is 4.\n\nExample 2:\n\nInput: n = 4, a = 2, b = 3, c = 4\nOutput: 6\nExplanation: The ugly numbers are 2, 3, 4, 6, 8, 9, 10, 12... The 4th is 6.\n\nExample 3:\n\nInput: n = 5, a = 2, b = 11, c = 13\nOutput: 10\nExplanation: The ugly numbers are 2, 4, 6, 8, 10, 11, 12, 13... The 5th is 10.\n\n \nConstraints:\n\n1 <= n, a, b, c <= 109\n1 <= a * b * c <= 1018\nIt is guaranteed that the result will be in range [1, 2 * 109].\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 4,a = 2,b = 3,c = 4) == 6\n assert candidate(n = 1,a = 1000000000,b = 1000000000,c = 1000000000) == 1000000000\n assert candidate(n = 1,a = 2,b = 3,c = 5) == 2\n assert candidate(n = 3,a = 2,b = 3,c = 5) == 4\n assert candidate(n = 10,a = 2,b = 7,c = 13) == 16\n assert candidate(n = 10,a = 5,b = 7,c = 15) == 30\n assert candidate(n = 10,a = 6,b = 8,c = 14) == 32\n assert candidate(n = 5,a = 2,b = 11,c = 13) == 10\n assert candidate(n = 1000000,a = 2,b = 217983653,c = 336916467) == 2000000\n assert candidate(n = 10,a = 6,b = 7,c = 8) == 28\n assert candidate(n = 1000000,a = 11,b = 17,c = 19) == 5279350\n assert candidate(n = 100,a = 15,b = 25,c = 35) == 925\n assert candidate(n = 100000000,a = 41,b = 89,c = 97) == 2000000000\n assert candidate(n = 1000,a = 10,b = 20,c = 30) == 10000\n assert candidate(n = 500000,a = 17,b = 23,c = 29) == 3822991\n assert candidate(n = 1000000,a = 7,b = 17,c = 19) == 4242027\n assert candidate(n = 500,a = 7,b = 11,c = 13) == 1782\n assert candidate(n = 89,a = 23,b = 31,c = 41) == 902\n assert candidate(n = 500000,a = 7,b = 11,c = 13) == 1781136\n assert candidate(n = 1000000,a = 13,b = 17,c = 19) == 5651417\n assert candidate(n = 100,a = 23,b = 47,c = 83) == 1328\n assert candidate(n = 25,a = 12,b = 18,c = 30) == 204\n assert candidate(n = 200000,a = 89,b = 97,c = 101) == 6427123\n assert candidate(n = 1000000,a = 2,b = 11,c = 17) == 1747664\n assert candidate(n = 10000,a = 11,b = 19,c = 29) == 59367\n assert candidate(n = 1000000,a = 3,b = 17,c = 19) == 2465649\n assert candidate(n = 999999,a = 5,b = 6,c = 7) == 2333330\n assert candidate(n = 1500,a = 2,b = 5,c = 17) == 2405\n assert candidate(n = 1000000,a = 3,b = 11,c = 17) == 2327802\n assert candidate(n = 100,a = 10,b = 15,c = 20) == 750\n assert candidate(n = 100000,a = 13,b = 17,c = 19) == 565148\n assert candidate(n = 1000000,a = 999999937,b = 999999931,c = 999999929) == 2000000000\n assert candidate(n = 100000,a = 5,b = 7,c = 11) == 265518\n assert candidate(n = 100000,a = 11,b = 13,c = 17) == 475735\n assert candidate(n = 500,a = 11,b = 19,c = 23) == 2838\n assert candidate(n = 1000000,a = 5,b = 11,c = 13) == 3042555\n assert candidate(n = 1000000,a = 3,b = 7,c = 13) == 2116281\n assert candidate(n = 10000000,a = 29,b = 61,c = 67) == 155073912\n assert candidate(n = 50,a = 17,b = 23,c = 29) == 374\n assert candidate(n = 1234567,a = 3,b = 5,c = 7) == 2274202\n assert candidate(n = 1000000,a = 11,b = 13,c = 19) == 4877917\n assert candidate(n = 250000,a = 47,b = 53,c = 61) == 4505704\n assert candidate(n = 7,a = 11,b = 13,c = 17) == 34\n assert candidate(n = 30,a = 4,b = 6,c = 8) == 90\n assert candidate(n = 200000,a = 13,b = 17,c = 19) == 1130285\n assert candidate(n = 999999,a = 2,b = 3,c = 4) == 1499998\n assert candidate(n = 100000,a = 31,b = 37,c = 41) == 1228811\n assert candidate(n = 500000,a = 3,b = 1000000000,c = 1000000001) == 1500000\n assert candidate(n = 100,a = 7,b = 13,c = 17) == 391\n assert candidate(n = 750000,a = 31,b = 37,c = 41) == 9216182\n assert candidate(n = 10000000,a = 3,b = 5,c = 7) == 18421053\n assert candidate(n = 150,a = 2,b = 3,c = 5) == 205\n assert candidate(n = 500000000,a = 2,b = 217983653,c = 336916467) == 999999994\n assert candidate(n = 1000000,a = 7,b = 14,c = 21) == 7000000\n assert candidate(n = 100,a = 4,b = 6,c = 8) == 300\n assert candidate(n = 50000,a = 19,b = 23,c = 29) == 399779\n assert candidate(n = 250,a = 4,b = 6,c = 8) == 750\n assert candidate(n = 1000000,a = 11,b = 13,c = 17) == 4757346\n assert candidate(n = 987654,a = 1000000,b = 2000000,c = 3000000) == 2000000000\n assert candidate(n = 30,a = 17,b = 23,c = 29) == 230\n assert candidate(n = 2000000,a = 11,b = 19,c = 29) == 11872682\n assert candidate(n = 50,a = 10,b = 15,c = 20) == 375\n assert candidate(n = 50000000,a = 37,b = 79,c = 83) == 981984141\n assert candidate(n = 750,a = 6,b = 14,c = 21) == 3150\n assert candidate(n = 100,a = 2,b = 3,c = 5) == 136\n assert candidate(n = 1000000,a = 2,b = 4,c = 8) == 2000000\n assert candidate(n = 50,a = 13,b = 17,c = 19) == 285\n assert candidate(n = 150000,a = 13,b = 17,c = 19) == 847717\n assert candidate(n = 100000,a = 999999937,b = 999999931,c = 999999919) == 2000000000\n assert candidate(n = 50000,a = 3,b = 5,c = 7) == 92105\n assert candidate(n = 1000,a = 3,b = 7,c = 11) == 2082\n assert candidate(n = 1000000,a = 2,b = 3,c = 7) == 1400000\n assert candidate(n = 1000000,a = 2,b = 5,c = 7) == 1521738\n assert candidate(n = 999999,a = 23,b = 31,c = 41) == 10318743\n assert candidate(n = 10,a = 2,b = 3,c = 5) == 14\n assert candidate(n = 999999999,a = 3,b = 5,c = 7) == 1842105261\n assert candidate(n = 1000000,a = 7,b = 11,c = 13) == 3562279\n assert candidate(n = 2000000,a = 3,b = 5,c = 7) == 3684212\n assert candidate(n = 30,a = 9,b = 21,c = 28) == 180\n assert candidate(n = 500000,a = 25,b = 45,c = 65) == 7276125\n assert candidate(n = 1000000,a = 1000000000,b = 1000000000,c = 1000000000) == 2000000000\n assert candidate(n = 2000000,a = 123456789,b = 987654321,c = 1122334455) == 2000000000\n assert candidate(n = 1000000,a = 2,b = 17,c = 19) == 1804468\n assert candidate(n = 1000000,a = 2,b = 13,c = 19) == 1776978\n assert candidate(n = 5000,a = 17,b = 37,c = 41) == 46904\n assert candidate(n = 1000000,a = 3,b = 6,c = 9) == 3000000\n assert candidate(n = 1000,a = 123,b = 456,c = 789) == 86838\n assert candidate(n = 500000,a = 6,b = 10,c = 15) == 1875000\n assert candidate(n = 100,a = 4,b = 9,c = 25) == 276\n assert candidate(n = 600000,a = 59,b = 61,c = 67) == 12632448\n assert candidate(n = 300000,a = 3,b = 5,c = 11) == 582354\n assert candidate(n = 10,a = 3,b = 3,c = 3) == 30\n assert candidate(n = 1000000,a = 3,b = 5,c = 11) == 1941177\n assert candidate(n = 100,a = 2,b = 2,c = 3) == 150\n assert candidate(n = 7,a = 5,b = 7,c = 11) == 20\n assert candidate(n = 750000,a = 2,b = 3,c = 6) == 1125000\n assert candidate(n = 500000,a = 2,b = 2,c = 3) == 750000\n assert candidate(n = 1000,a = 11,b = 22,c = 33) == 11000\n assert candidate(n = 50,a = 4,b = 6,c = 8) == 150\n assert candidate(n = 1000000000,a = 1000000000,b = 999999999,c = 999999998) == 2000000000\n assert candidate(n = 200,a = 7,b = 11,c = 13) == 714\n assert candidate(n = 20,a = 3,b = 5,c = 7) == 36\n assert candidate(n = 5000,a = 9,b = 14,c = 21) == 26250\n assert candidate(n = 1000000,a = 2,b = 7,c = 13) == 1654546\n assert candidate(n = 500,a = 100,b = 200,c = 300) == 50000\n assert candidate(n = 1000000,a = 3,b = 13,c = 19) == 2398058\n assert candidate(n = 1000000,a = 5,b = 10,c = 15) == 5000000\n assert candidate(n = 50,a = 2,b = 4,c = 8) == 100\n assert candidate(n = 1000000,a = 23,b = 53,c = 59) == 12914523\n assert candidate(n = 1000000,a = 5,b = 7,c = 11) == 2655170\n assert candidate(n = 1000000,a = 5,b = 17,c = 19) == 3488125\n assert candidate(n = 750000,a = 17,b = 23,c = 29) == 5734491\n assert candidate(n = 2500,a = 8,b = 15,c = 20) == 12500\n assert candidate(n = 1000,a = 1000000000,b = 1000000000,c = 1000000000) == 2000000000\n assert candidate(n = 500,a = 5,b = 17,c = 19) == 1745\n assert candidate(n = 800000,a = 29,b = 31,c = 37) == 8802636\n assert candidate(n = 100000,a = 19,b = 43,c = 47) == 1059864\n assert candidate(n = 30,a = 7,b = 11,c = 13) == 105\n assert candidate(n = 20000000,a = 31,b = 71,c = 73) == 339223049\n assert candidate(n = 20,a = 2,b = 3,c = 5) == 27\n assert candidate(n = 10000000,a = 1000000,b = 1000001,c = 1000002) == 2000000000\n assert candidate(n = 15,a = 4,b = 6,c = 8) == 44\n assert candidate(n = 1000000,a = 2,b = 5,c = 11) == 1571428\n assert candidate(n = 1000000,a = 7,b = 13,c = 17) == 3916458\n assert candidate(n = 25,a = 11,b = 13,c = 17) == 117\n assert candidate(n = 1000,a = 13,b = 29,c = 31) == 7280\n assert candidate(n = 1000000000,a = 10,b = 11,c = 12) == 2000000000\n assert candidate(n = 10000,a = 7,b = 11,c = 13) == 35623\n assert candidate(n = 1000000,a = 3,b = 5,c = 7) == 1842106\n assert candidate(n = 2000000,a = 5,b = 10,c = 15) == 10000000\n assert candidate(n = 1000,a = 4,b = 6,c = 8) == 3000\n assert candidate(n = 1000000,a = 5,b = 13,c = 17) == 3278930\n assert candidate(n = 6,a = 10,b = 15,c = 20) == 45\n"}, "metadata": {"canonical_parameter_names": ["n", "a", "b", "c"], "leetcode_dataset_entry_point": "Solution().nthUglyNumber", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var nthUglyNumber = function(n, a, b, c) {", "container": null, "callable": "nthUglyNumber", "parameters": [{"name": "n", "type": "number"}, {"name": "a", "type": "number"}, {"name": "b", "type": "number"}, {"name": "c", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1202, "task_id": "smallest-string-with-swaps", "difficulty": "Medium", "problem_description": "You are given a string s, and an array of pairs of indices in the string pairs where pairs[i] = [a, b] indicates 2 indices(0-indexed) of the string.\nYou can swap the characters at any pair of indices in the given pairs any number of times.\nReturn the lexicographically smallest string that s can be changed to after using the swaps.\n \nExample 1:\n\nInput: s = \"dcab\", pairs = [[0,3],[1,2]]\nOutput: \"bacd\"\nExplaination: \nSwap s[0] and s[3], s = \"bcad\"\nSwap s[1] and s[2], s = \"bacd\"\n\nExample 2:\n\nInput: s = \"dcab\", pairs = [[0,3],[1,2],[0,2]]\nOutput: \"abcd\"\nExplaination: \nSwap s[0] and s[3], s = \"bcad\"\nSwap s[0] and s[2], s = \"acbd\"\nSwap s[1] and s[2], s = \"abcd\"\nExample 3:\n\nInput: s = \"cba\", pairs = [[0,1],[1,2]]\nOutput: \"abc\"\nExplaination: \nSwap s[0] and s[1], s = \"bca\"\nSwap s[1] and s[2], s = \"bac\"\nSwap s[0] and s[1], s = \"abc\"\n\n \nConstraints:\n\n1 <= s.length <= 10^5\n0 <= pairs.length <= 10^5\n0 <= pairs[i][0], pairs[i][1] < s.length\ns only contains lower case English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"acbd\",pairs = [[0, 3], [1, 2]]) == \"abcd\"\n assert candidate(s = \"cba\",pairs = [[0, 1], [1, 2]]) == \"abc\"\n assert candidate(s = \"aabbcc\",pairs = [[0, 1], [2, 3], [4, 5]]) == \"aabbcc\"\n assert candidate(s = \"zyx\",pairs = [[0, 1], [1, 2]]) == \"xyz\"\n assert candidate(s = \"abcd\",pairs = [[0, 1], [1, 2], [2, 3]]) == \"abcd\"\n assert candidate(s = \"leetcode\",pairs = [[0, 2], [1, 3]]) == \"eeltcode\"\n assert candidate(s = \"dcab\",pairs = [[0, 3], [1, 2]]) == \"bacd\"\n assert candidate(s = \"dcab\",pairs = [[0, 3], [1, 2], [0, 2]]) == \"abcd\"\n assert candidate(s = \"qwe\",pairs = [[0, 2]]) == \"ewq\"\n assert candidate(s = \"abdc\",pairs = [[0, 3]]) == \"abdc\"\n assert candidate(s = \"vokh\",pairs = [[0, 1], [1, 3], [0, 3]]) == \"hokv\"\n assert candidate(s = \"abcdefgh\",pairs = [[0, 7], [1, 6], [2, 5], [3, 4], [0, 6], [1, 5], [2, 4]]) == \"abcdefgh\"\n assert candidate(s = \"jklmno\",pairs = [[0, 3], [1, 4], [2, 5], [0, 5], [1, 3]]) == \"jklmno\"\n assert candidate(s = \"dcabxy\",pairs = [[0, 3], [1, 2], [4, 5], [0, 2]]) == \"abcdxy\"\n assert candidate(s = \"aazaa\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4]]) == \"aaaaz\"\n assert candidate(s = \"aefdcba\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]]) == \"aabcdef\"\n assert candidate(s = \"xyzabc\",pairs = [[0, 5], [1, 4], [2, 3], [0, 2]]) == \"abcxyz\"\n assert candidate(s = \"xyzabc\",pairs = [[0, 5], [1, 4], [2, 3]]) == \"cbazyx\"\n assert candidate(s = \"abcdeffedcba\",pairs = [[0, 11], [1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [5, 7], [6, 7]]) == \"abcdeeffdcba\"\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnm\",pairs = [[0, 25], [1, 24], [2, 23], [3, 22], [4, 21], [5, 20], [6, 19], [7, 18], [8, 17], [9, 16], [10, 15], [11, 14], [12, 13]]) == \"mnbrcxuikjagdfshpolzytvewq\"\n assert candidate(s = \"bdcagf\",pairs = [[0, 3], [1, 4], [2, 5]]) == \"adcbgf\"\n assert candidate(s = \"racecar\",pairs = [[0, 6], [1, 5], [2, 4]]) == \"racecar\"\n assert candidate(s = \"abcdefghijk\",pairs = [[0, 3], [1, 4], [2, 5], [3, 6], [4, 7], [5, 8], [6, 9], [7, 10]]) == \"abcdefghijk\"\n assert candidate(s = \"abcdefg\",pairs = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6]]) == \"abcdefg\"\n assert candidate(s = \"leetcode\",pairs = [[0, 2], [1, 3], [4, 5], [6, 7]]) == \"eeltcode\"\n assert candidate(s = \"zyxzyx\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0]]) == \"xxyyzz\"\n assert candidate(s = \"abcdefghijk\",pairs = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10]]) == \"abcdefghijk\"\n assert candidate(s = \"abacabad\",pairs = [[0, 2], [1, 3], [4, 6], [5, 7]]) == \"abacabad\"\n assert candidate(s = \"lkjihgfedcba\",pairs = [[0, 10], [1, 9], [2, 8], [3, 7], [4, 6], [0, 5], [1, 6]]) == \"bcdefghijkla\"\n assert candidate(s = \"algorithm\",pairs = [[0, 6], [1, 5], [2, 4], [3, 7]]) == \"aighrltom\"\n assert candidate(s = \"abcd\",pairs = [[0, 1], [1, 2], [2, 3], [0, 3], [1, 2]]) == \"abcd\"\n assert candidate(s = \"acbdf\",pairs = [[0, 1], [0, 2], [1, 2], [3, 4]]) == \"abcdf\"\n assert candidate(s = \"aabbccddeeff\",pairs = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [0, 2], [1, 3], [4, 6], [5, 7], [8, 10], [9, 11]]) == \"aabbccddeeff\"\n assert candidate(s = \"stuvwx\",pairs = [[0, 3], [1, 4], [2, 5], [0, 5], [1, 3], [2, 4]]) == \"stuvwx\"\n assert candidate(s = \"abcde\",pairs = [[0, 1], [0, 4], [1, 2], [2, 3]]) == \"abcde\"\n assert candidate(s = \"ympxz\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4]]) == \"mpxyz\"\n assert candidate(s = \"ekzpz\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4]]) == \"ekpzz\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",pairs = [[0, 25], [1, 24], [2, 23], [3, 22], [4, 21]]) == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"fedcba\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]]) == \"abcdef\"\n assert candidate(s = \"abacabadabacaba\",pairs = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [0, 2], [2, 4], [4, 6], [6, 8], [8, 10], [10, 12], [1, 3], [3, 5], [5, 7], [7, 9], [9, 11], [1, 13]]) == \"aaaaaaabbbbccda\"\n assert candidate(s = \"abcdefg\",pairs = [[0, 3], [1, 4], [2, 5], [0, 5], [1, 2], [3, 4]]) == \"abcdefg\"\n assert candidate(s = \"hellothereeveryone\",pairs = [[0, 8], [1, 3], [2, 9], [5, 11], [6, 7], [12, 16], [13, 14], [15, 17]]) == \"heelotehrleveryeno\"\n assert candidate(s = \"dcabxyz\",pairs = [[0, 3], [1, 2], [3, 5], [4, 6]]) == \"bacdxyz\"\n assert candidate(s = \"xyzab\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4], [0, 3]]) == \"abxyz\"\n assert candidate(s = \"uvuuvuvuvu\",pairs = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [0, 2], [2, 4], [4, 6], [6, 8], [1, 3], [3, 5], [5, 7], [7, 9], [0, 9]]) == \"uuuuuuvvvv\"\n assert candidate(s = \"abcdefghijk\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == \"abcdefghijk\"\n assert candidate(s = \"uvazyx\",pairs = [[0, 5], [1, 4], [2, 3]]) == \"uvazyx\"\n assert candidate(s = \"xyzxyz\",pairs = [[0, 3], [1, 4], [2, 5]]) == \"xyzxyz\"\n assert candidate(s = \"abcdefghij\",pairs = [[0, 9], [1, 8], [2, 7], [3, 6], [4, 5], [0, 8], [1, 7], [2, 6], [3, 5]]) == \"abcdefghij\"\n assert candidate(s = \"programming\",pairs = [[0, 8], [1, 7], [2, 6], [3, 5], [4, 9]]) == \"immangorprg\"\n assert candidate(s = \"ufyx\",pairs = [[0, 3], [1, 2], [0, 2], [1, 3]]) == \"fuxy\"\n assert candidate(s = \"lkjhgfedcba\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == \"abcdefghjkl\"\n assert candidate(s = \"aaaabbbbccccdddd\",pairs = [[0, 8], [1, 9], [2, 10], [3, 11], [4, 12], [5, 13], [6, 14], [7, 15], [0, 4], [1, 5], [2, 6], [3, 7], [0, 1], [2, 3], [4, 5], [6, 7]]) == \"aaaabbbbccccdddd\"\n assert candidate(s = \"abcdef\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [0, 5]]) == \"abcdef\"\n assert candidate(s = \"nmosq\",pairs = [[0, 3], [1, 2], [2, 3], [3, 4]]) == \"mnoqs\"\n assert candidate(s = \"abcdefgh\",pairs = [[0, 7], [1, 6], [2, 5], [3, 4], [0, 3], [1, 4]]) == \"abcdefgh\"\n assert candidate(s = \"helloworld\",pairs = [[0, 8], [1, 7], [2, 6], [3, 5]]) == \"helloworld\"\n assert candidate(s = \"abcdefghij\",pairs = [[0, 9], [1, 8], [2, 7], [3, 6], [4, 5], [0, 5], [1, 4], [2, 3], [0, 1], [8, 9]]) == \"abcdefghij\"\n assert candidate(s = \"abacabadaba\",pairs = [[0, 10], [1, 9], [2, 8], [3, 7], [4, 6], [0, 5], [1, 4], [2, 3], [0, 1], [8, 9], [5, 6]]) == \"aaaaaabbbcd\"\n assert candidate(s = \"programming\",pairs = [[0, 8], [1, 7], [2, 6], [3, 5], [1, 9]]) == \"immargonprg\"\n assert candidate(s = \"zxcvbnmlkjhgfdsapoiuytrewq\",pairs = [[0, 23], [1, 22], [2, 21], [3, 20], [4, 19], [5, 18], [6, 17], [7, 16], [8, 15], [9, 14], [10, 13], [11, 12]]) == \"ercvbimlajdfghskponuytxzwq\"\n assert candidate(s = \"abcdefghij\",pairs = [[0, 9], [1, 8], [2, 7], [3, 6], [4, 5]]) == \"abcdefghij\"\n assert candidate(s = \"xyz\",pairs = [[0, 1], [1, 2], [2, 0]]) == \"xyz\"\n assert candidate(s = \"xzy\",pairs = [[0, 1], [1, 2], [0, 2], [1, 2], [0, 1]]) == \"xyz\"\n assert candidate(s = \"abcdefghijk\",pairs = [[0, 10], [1, 9], [2, 8], [3, 7], [4, 6], [0, 9], [1, 8], [2, 7], [3, 6], [4, 5]]) == \"abcdefghijk\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",pairs = [[0, 25], [1, 24], [2, 23], [3, 22], [4, 21], [5, 20], [6, 19], [7, 18], [8, 17], [9, 16], [10, 15], [11, 14], [12, 13]]) == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",pairs = [[0, 25], [1, 24], [2, 23], [3, 22], [4, 21], [5, 20], [6, 19], [7, 18], [8, 17], [9, 16], [10, 15], [11, 14], [12, 13], [0, 13], [1, 14], [2, 15], [3, 16], [4, 17], [5, 18], [6, 19], [7, 20], [8, 21], [9, 22], [10, 23], [11, 24], [12, 25]]) == \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\"\n assert candidate(s = \"abcdefgh\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [0, 7]]) == \"abcdefgh\"\n assert candidate(s = \"aaabbbccc\",pairs = [[0, 1], [2, 3], [4, 5], [0, 5], [1, 4], [2, 8]]) == \"aaabbbccc\"\n assert candidate(s = \"abcdexyz\",pairs = [[0, 7], [1, 6], [2, 5], [3, 4]]) == \"abcdexyz\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25]]) == \"abcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"abcdefghij\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == \"abcdefghij\"\n assert candidate(s = \"abcdef\",pairs = [[0, 5], [1, 4], [2, 3]]) == \"abcdef\"\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",pairs = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25]]) == \"abcdefghijklmnopqrstuvwxyz\"\n"}, "metadata": {"canonical_parameter_names": ["s", "pairs"], "leetcode_dataset_entry_point": "Solution().smallestStringWithSwaps", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var smallestStringWithSwaps = function(s, pairs) {", "container": null, "callable": "smallestStringWithSwaps", "parameters": [{"name": "s", "type": "string"}, {"name": "pairs", "type": "number[][]"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1203, "task_id": "sort-items-by-groups-respecting-dependencies", "difficulty": "Hard", "problem_description": "There are n items each belonging to zero or one of m groups where group[i] is the group that the i-th item belongs to and it's equal to -1 if the i-th item belongs to no group. The items and the groups are zero indexed. A group can have no item belonging to it.\nReturn a sorted list of the items such that:\n\nThe items that belong to the same group are next to each other in the sorted list.\nThere are some relations between these items where beforeItems[i] is a list containing all the items that should come before the i-th item in the sorted array (to the left of the i-th item).\n\nReturn any solution if there is more than one solution and return an empty list if there is no solution.\n \nExample 1:\n\n\nInput: n = 8, m = 2, group = [-1,-1,1,0,0,1,0,-1], beforeItems = [[],[6],[5],[6],[3,6],[],[],[]]\nOutput: [6,3,4,1,5,2,0,7]\n\nExample 2:\n\nInput: n = 8, m = 2, group = [-1,-1,1,0,0,1,0,-1], beforeItems = [[],[6],[5],[6],[3],[],[4],[]]\nOutput: []\nExplanation: This is the same as example 1 except that 4 needs to be before 6 in the sorted list.\n\n \nConstraints:\n\n1 <= m <= n <= 3 * 104\ngroup.length == beforeItems.length == n\n-1 <= group[i] <= m - 1\n0 <= beforeItems[i].length <= n - 1\n0 <= beforeItems[i][j] <= n - 1\ni != beforeItems[i][j]\nbeforeItems[i] does not contain duplicates elements.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 4,m = 2,group = [-1, -1, -1, -1],beforeItems = [[], [2, 3], [3], [3]]) == []\n assert candidate(n = 8,m = 2,group = [-1, -1, 1, 0, 0, 1, 0, -1],beforeItems = [[], [6], [5], [6], [3, 6], [], [], []]) == [6, 3, 4, 5, 2, 0, 7, 1]\n assert candidate(n = 5,m = 3,group = [0, 0, 1, 1, -1],beforeItems = [[], [2], [3], [], [1, 3]]) == [3, 2, 0, 1, 4]\n assert candidate(n = 8,m = 2,group = [-1, -1, 1, 0, 0, 1, 0, -1],beforeItems = [[], [6], [5], [6], [3], [], [4], []]) == []\n assert candidate(n = 5,m = 3,group = [-1, 0, 0, 1, -1],beforeItems = [[], [2, 3], [3], [], []]) == [3, 0, 4, 2, 1]\n assert candidate(n = 5,m = 3,group = [1, 2, 0, -1, -1],beforeItems = [[], [2, 4, 3], [3, 0], [4], [4]]) == []\n assert candidate(n = 3,m = 1,group = [-1, -1, -1],beforeItems = [[], [2], [1]]) == []\n assert candidate(n = 4,m = 2,group = [0, 0, 1, 1],beforeItems = [[], [2], [0], [1]]) == []\n assert candidate(n = 5,m = 1,group = [0, 0, 0, 0, 0],beforeItems = [[], [0], [0], [1, 2], [1]]) == [0, 1, 2, 4, 3]\n assert candidate(n = 6,m = 2,group = [1, 0, -1, -1, 0, 1],beforeItems = [[], [2, 3], [], [5], [], []]) == [0, 5, 2, 3, 1, 4]\n assert candidate(n = 10,m = 3,group = [0, 0, 0, 1, 1, 1, 2, 2, -1, -1],beforeItems = [[], [6], [7], [5, 8], [9], [3], [4], [], [], []]) == []\n assert candidate(n = 20,m = 4,group = [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, -1, -1, -1, -1],beforeItems = [[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2], [5, 6, 7], [4, 6, 7], [4, 5, 7], [4, 5, 6], [9, 10, 11], [8, 10, 11], [8, 9, 11], [8, 9, 10], [13, 14, 15], [12, 14, 15], [12, 13, 15], [12, 13, 14], [16], [17, 18, 19], [16, 18, 19], [16, 17, 19], [16, 17, 18]]) == []\n assert candidate(n = 6,m = 3,group = [-1, 0, 0, 1, 1, 2],beforeItems = [[], [3], [4], [5], [], [1]]) == []\n assert candidate(n = 15,m = 4,group = [0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, -1],beforeItems = [[], [1], [2], [3], [4, 5], [6], [7, 8], [9, 10], [11], [12], [13], [14], [], [], []]) == []\n assert candidate(n = 7,m = 2,group = [0, 0, 0, 0, 1, 1, -1],beforeItems = [[5, 6], [3, 6], [5, 6], [2, 6], [4], [0, 3], []]) == []\n assert candidate(n = 20,m = 5,group = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, -1, -1],beforeItems = [[1, 5], [6, 8], [3, 4], [7, 9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19], [], [], [], [], [], [], [], [], [], [], []]) == [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 6, 7, 8, 3, 4, 5, 1, 2, 0]\n assert candidate(n = 9,m = 4,group = [0, 0, 1, 1, 2, 2, 3, 3, -1],beforeItems = [[], [3], [0], [4], [1], [5], [6], [7], [0, 1, 2, 3, 4, 5, 6, 7]]) == []\n assert candidate(n = 6,m = 3,group = [0, 0, 1, 1, -1, -1],beforeItems = [[2, 3], [3], [], [], [1, 5], [0]]) == [2, 3, 0, 1, 5, 4]\n assert candidate(n = 25,m = 7,group = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],beforeItems = [[1, 5], [6], [8, 10], [9, 11], [3, 7], [8], [0, 2], [1, 4], [13], [14], [12], [13], [14], [10], [11], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24]]) == []\n assert candidate(n = 15,m = 4,group = [0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, -1, -1],beforeItems = [[], [4], [5], [6, 8], [9, 12], [10, 11], [9, 12], [], [], [7], [3, 13], [12], [5, 7, 8], [7], [0, 8, 10]]) == []\n assert candidate(n = 18,m = 6,group = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5],beforeItems = [[], [2], [1, 3], [11, 12], [7], [3, 7], [9], [6], [7], [14], [12], [3], [11], [12, 14], [], [15, 17], [16], [15]]) == []\n assert candidate(n = 10,m = 5,group = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4],beforeItems = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [0], [3, 4, 5, 6, 7, 8, 9], [2, 5, 6, 7, 8, 9], [2, 3, 6, 7, 8, 9], [2, 3, 4, 7, 8, 9], [2, 3, 4, 5, 8, 9], [2, 3, 4, 5, 6, 9], [2, 3, 4, 5, 6, 7, 9], [2, 3, 4, 5, 6, 7, 8]]) == []\n assert candidate(n = 12,m = 6,group = [0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5],beforeItems = [[], [5], [6], [7], [8], [9], [10], [11], [1], [3], [4], [0]]) == []\n assert candidate(n = 15,m = 4,group = [0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, -1, -1, -1, -1],beforeItems = [[], [4, 5], [3], [6, 7], [1], [2], [], [8], [9], [], [10], [], [11, 13], [12], [14]]) == []\n assert candidate(n = 12,m = 5,group = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, -1],beforeItems = [[1, 5], [3, 9], [2, 7], [8, 10], [4], [3, 8], [5, 9], [6, 11], [0, 1, 10], [3, 6], [7, 11], []]) == []\n assert candidate(n = 15,m = 5,group = [-1, -1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4],beforeItems = [[1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], [0, 7, 8, 9, 10, 11, 12, 13, 14], [1, 3, 11, 12, 13], [2, 5, 6, 10, 11, 12, 13, 14], [3, 4, 6, 7, 8, 9, 12, 13, 14], [0, 1, 3, 4, 8, 9, 10, 11, 12, 13, 14], [1, 2, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14], [2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14], [0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14], [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14], [2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 14], [2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]]) == []\n assert candidate(n = 15,m = 5,group = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, -1, -1, -1, -1, -1],beforeItems = [[1, 5], [6], [8, 10], [9, 11], [3, 7], [8], [0, 2], [1, 4], [13], [14], [12], [13], [14], [10], [11]]) == []\n assert candidate(n = 7,m = 3,group = [-1, 0, 0, 1, 1, 1, 2],beforeItems = [[3], [4, 5], [5], [6], [], [], [1]]) == []\n assert candidate(n = 20,m = 6,group = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, -1, -1, -1, -1, -1, -1, -1, -1],beforeItems = [[1, 5], [6], [8, 10], [9, 11], [3, 7], [8], [0, 2], [1, 4], [13], [14], [12], [13], [14], [10], [11], [15], [16], [17], [18], [19]]) == []\n assert candidate(n = 9,m = 2,group = [0, 0, 0, 0, 1, 1, 1, 1, -1],beforeItems = [[4], [5], [6], [7], [], [], [], [], [0, 1, 2, 3]]) == [4, 5, 6, 7, 0, 1, 2, 3, 8]\n assert candidate(n = 20,m = 5,group = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, -1],beforeItems = [[], [1], [2], [3], [4, 5], [6], [7, 8], [9, 10], [11], [12], [13], [14], [15], [16], [17, 18], [], [], [19], [], []]) == []\n assert candidate(n = 12,m = 3,group = [0, 0, 1, 1, 2, 2, -1, -1, -1, -1, -1, -1],beforeItems = [[], [2, 3], [4], [5], [6], [7], [8], [9], [10], [11], [], []]) == [10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1]\n assert candidate(n = 10,m = 3,group = [0, 0, 1, 1, 2, 2, -1, -1, -1, -1],beforeItems = [[], [6], [5, 9], [6, 8], [3, 7], [8], [], [6], [1], [0]]) == []\n assert candidate(n = 8,m = 4,group = [0, 1, 2, 3, 2, 1, 0, -1],beforeItems = [[1, 2], [3, 4], [5, 6], [7], [], [], [], [1]]) == []\n assert candidate(n = 10,m = 4,group = [0, 0, 1, 1, 2, 2, 2, 3, 3, -1],beforeItems = [[1], [3], [4], [6], [7], [8], [9], [], [], [0]]) == []\n assert candidate(n = 15,m = 5,group = [0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, -1],beforeItems = [[], [2, 3], [4], [5], [7], [6], [7], [], [8, 9], [10], [11], [12], [13], [14], []]) == []\n assert candidate(n = 14,m = 7,group = [0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6],beforeItems = [[], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13]]) == []\n assert candidate(n = 9,m = 3,group = [-1, -1, 0, 0, 1, 1, 1, 2, -1],beforeItems = [[], [7], [6, 8], [5, 7], [1, 3], [1, 7, 8], [1, 5], [2, 8], [2, 3, 5, 6]]) == []\n assert candidate(n = 10,m = 2,group = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1],beforeItems = [[], [2, 3, 4], [1, 3, 5], [2, 4, 6], [1, 5, 7], [2, 6, 8], [3, 5, 9], [4, 6], [5, 7], [6, 8]]) == []\n assert candidate(n = 7,m = 5,group = [0, 1, 2, 3, 4, -1, -1],beforeItems = [[1], [2], [3], [4], [], [0], [5]]) == [4, 3, 2, 1, 0, 5, 6]\n assert candidate(n = 12,m = 4,group = [0, 0, 1, 1, 2, 2, 3, 3, -1, -1, -1, -1],beforeItems = [[3, 4], [5, 6], [7, 8], [9, 10], [], [], [], [], [], [], [], []]) == [4, 5, 6, 7, 8, 9, 10, 11, 2, 3, 0, 1]\n assert candidate(n = 20,m = 5,group = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],beforeItems = [[], [2, 3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [], []]) == [18, 19, 16, 17, 14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1]\n assert candidate(n = 9,m = 4,group = [0, 0, 1, 1, 2, 2, 3, 3, -1],beforeItems = [[], [2], [1, 5], [2, 3], [6], [3, 7], [8], [5, 8], [7]]) == []\n assert candidate(n = 10,m = 3,group = [0, 0, 1, 1, 1, 2, 2, -1, -1, -1],beforeItems = [[3, 4], [4], [5, 6], [6], [], [], [], [1], [2], [5]]) == [5, 6, 2, 3, 4, 9, 0, 1, 8, 7]\n assert candidate(n = 9,m = 3,group = [0, 0, 0, 1, 1, 1, 2, 2, 2],beforeItems = [[1, 2], [2], [3], [4, 5], [5], [], [], [6], [7]]) == [5, 4, 3, 6, 7, 8, 2, 1, 0]\n assert candidate(n = 10,m = 3,group = [0, 0, 0, 1, 1, 1, -1, -1, -1, -1],beforeItems = [[], [6], [5], [8, 9], [6, 7], [3, 6], [], [], [], []]) == [6, 7, 8, 9, 3, 4, 5, 0, 1, 2]\n assert candidate(n = 8,m = 4,group = [-1, 0, 0, 1, 1, 2, 2, 3],beforeItems = [[], [4], [4], [5], [6], [], [], [7]]) == []\n assert candidate(n = 15,m = 5,group = [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, -1, -1, -1, -1, -1],beforeItems = [[], [5], [6], [7], [8], [9], [10], [11], [12], [13], [0, 1], [2, 3], [4], [], []]) == []\n assert candidate(n = 11,m = 3,group = [0, 0, 1, 1, 2, 2, -1, -1, -1, -1, -1],beforeItems = [[], [4], [5], [6], [], [], [7], [8], [9], [10], [1]]) == [4, 5, 0, 1, 10, 9, 8, 7, 6, 2, 3]\n assert candidate(n = 10,m = 3,group = [-1, 0, 0, 1, 1, 2, 2, -1, -1, 2],beforeItems = [[5, 7], [9], [3, 4], [8], [3, 7], [1, 4], [3, 6, 8], [], [], [4]]) == []\n assert candidate(n = 10,m = 3,group = [0, 0, 1, 1, 2, 2, -1, -1, -1, -1],beforeItems = [[], [2, 3], [5], [5], [3, 6], [], [], [9], [8], [7]]) == []\n assert candidate(n = 15,m = 5,group = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4],beforeItems = [[], [3], [1, 3], [11, 12], [7], [3, 7], [9], [6], [7], [14], [12], [3], [11], [12, 14], []]) == []\n assert candidate(n = 12,m = 3,group = [0, 0, 0, 1, 1, 1, -1, -1, -1, -1, -1, -1],beforeItems = [[], [6, 10], [5, 11], [3, 6], [3], [6, 7], [8], [5, 8], [7, 10], [7, 11], [0, 3], [0, 4]]) == []\n assert candidate(n = 7,m = 3,group = [-1, -1, 0, 0, 1, 1, 2],beforeItems = [[3, 4], [6], [5], [6], [0], [1], [0]]) == []\n assert candidate(n = 12,m = 4,group = [0, 0, 1, 1, 2, 2, 3, 3, -1, -1, -1, -1],beforeItems = [[5, 9], [6], [8, 10], [9, 11], [3, 7], [8], [0, 2], [1, 4], [], [6], [1], [3]]) == []\n assert candidate(n = 20,m = 6,group = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, -1, -1, -1, -1, -1, -1, -1, -1],beforeItems = [[], [2, 3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [], []]) == [18, 19, 16, 17, 14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1]\n assert candidate(n = 8,m = 3,group = [0, 0, 1, 1, 2, 2, -1, -1],beforeItems = [[], [3], [0], [4], [1], [5], [6], [7]]) == []\n assert candidate(n = 8,m = 3,group = [0, 0, 1, 1, 2, 2, -1, -1],beforeItems = [[1, 2, 3, 4, 5, 6, 7], [0], [0, 3, 4, 5, 6, 7], [2, 5, 6, 7], [2, 3, 6, 7], [2, 3, 4, 7], [2, 3, 4, 5], [2, 3, 4, 5, 6]]) == []\n assert candidate(n = 25,m = 5,group = [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4],beforeItems = [[], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [0, 1], [2, 3], [4], [], [], [15], [16], [17], [18], [19]]) == []\n assert candidate(n = 12,m = 6,group = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, -1],beforeItems = [[1, 3, 5], [0], [3, 4], [2], [1, 3], [4], [7], [6, 8], [5, 7], [6], [8, 9], [10]]) == []\n assert candidate(n = 6,m = 3,group = [-1, 0, 0, 1, 1, 2],beforeItems = [[], [1, 2], [3], [4], [5], []]) == []\n assert candidate(n = 10,m = 3,group = [0, 0, 1, 1, 2, 2, -1, -1, -1, -1],beforeItems = [[], [3, 6], [7, 8], [4], [5], [9], [0, 1], [], [], [2]]) == []\n assert candidate(n = 9,m = 4,group = [0, 0, 1, 1, 2, 2, 3, 3, -1],beforeItems = [[], [4], [5], [7], [8], [], [0, 1], [2, 3], [1]]) == []\n assert candidate(n = 10,m = 3,group = [0, 0, 0, 1, 1, 1, 2, 2, 2, -1],beforeItems = [[], [2], [1], [4, 5], [5], [3], [8], [7], [6], [1, 2]]) == []\n assert candidate(n = 10,m = 4,group = [0, 0, 1, 1, 2, 2, 3, 3, -1, -1],beforeItems = [[], [2, 5], [3, 6], [7], [8], [8], [9], [9], [3, 6], [7]]) == []\n assert candidate(n = 12,m = 5,group = [0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, -1],beforeItems = [[], [1, 2], [3], [4], [5], [6], [7], [8], [9], [10], [], []]) == []\n assert candidate(n = 10,m = 4,group = [0, 1, 2, 3, 0, 1, 2, 3, -1, -1],beforeItems = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [0, 5, 8], [1, 6, 9], [0, 4, 7], [1, 3, 8], [2, 4, 9], [], []]) == []\n assert candidate(n = 20,m = 4,group = [0, 0, 1, 1, 2, 2, 3, 3, 0, 0, 1, 1, 2, 2, 3, 3, -1, -1, -1, -1],beforeItems = [[], [1, 13], [14], [3, 7], [4], [17], [5, 10], [18], [9, 12], [2], [16], [8], [15], [6], [11], [19], [0], [], [], []]) == []\n assert candidate(n = 12,m = 4,group = [0, 0, 1, 1, 2, 2, 3, 3, -1, -1, -1, -1],beforeItems = [[], [5, 6], [3], [5], [6], [7], [], [8], [11], [10], [9], [10]]) == []\n assert candidate(n = 15,m = 5,group = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, -1, -1, -1, -1, -1],beforeItems = [[], [2], [3], [1, 4], [5, 6], [4], [7, 8], [3], [9], [8], [10, 11], [12], [13], [14], [12]]) == []\n assert candidate(n = 18,m = 7,group = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, -1],beforeItems = [[1, 2, 3, 4, 5], [0, 2, 3, 4, 5], [0, 1, 3, 4, 5], [6, 7, 8, 9, 10], [5, 6, 7, 8, 10], [5, 6, 7, 8, 9], [11, 12, 13, 14, 15], [10, 12, 13, 14, 15], [10, 11, 13, 14, 15], [12, 13, 14, 15], [12, 13, 14, 15], [13, 14, 15], [16, 17], [16], [16, 17], [16, 17], [16, 17], [16, 17], [16]]) == []\n assert candidate(n = 16,m = 5,group = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, -1, -1, -1, -1, -1, -1],beforeItems = [[], [2, 3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [], []]) == [14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1]\n"}, "metadata": {"canonical_parameter_names": ["n", "m", "group", "beforeItems"], "leetcode_dataset_entry_point": "Solution().sortItems", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sortItems = function(n, m, group, beforeItems) {", "container": null, "callable": "sortItems", "parameters": [{"name": "n", "type": "number"}, {"name": "m", "type": "number"}, {"name": "group", "type": "number[]"}, {"name": "beforeItems", "type": "number[][]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1207, "task_id": "unique-number-of-occurrences", "difficulty": "Easy", "problem_description": "Given an array of integers arr, return true if the number of occurrences of each value in the array is unique or false otherwise.\n \nExample 1:\n\nInput: arr = [1,2,2,1,1,3]\nOutput: true\nExplanation: The value 1 has 3 occurrences, 2 has 2 and 3 has 1. No two values have the same number of occurrences.\nExample 2:\n\nInput: arr = [1,2]\nOutput: false\n\nExample 3:\n\nInput: arr = [-3,0,1,-3,1,1,1,-3,10,0]\nOutput: true\n\n \nConstraints:\n\n1 <= arr.length <= 1000\n-1000 <= arr[i] <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [-3, 0, 1, -3, 1, 1, 1, -3, 10, 0]) == True\n assert candidate(arr = [1, 2]) == False\n assert candidate(arr = [5]) == True\n assert candidate(arr = [5, 5, 5, 5, 5]) == True\n assert candidate(arr = [1, 1, 2, 2, 3, 3]) == False\n assert candidate(arr = [-1, -1, -2, -2, -3, -3]) == False\n assert candidate(arr = [5, 5, 5, 5]) == True\n assert candidate(arr = [1]) == True\n assert candidate(arr = [1000, -1000, 0]) == False\n assert candidate(arr = [1, 2, 2, 1, 1, 3]) == True\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == True\n assert candidate(arr = [1, 2, 3, 4, 5]) == False\n assert candidate(arr = [0, 0, 0, 0, 0]) == True\n assert candidate(arr = [1, 1, 1, 2, 2, 3, 4, 4, 4, 4]) == True\n assert candidate(arr = [1, -1, 1, -1, 1, -1]) == False\n assert candidate(arr = [1000, -1000, 1000, -1000]) == False\n assert candidate(arr = [1, 2, 3, 2, 1]) == False\n assert candidate(arr = [1000, 1000, -1000, -1000]) == False\n assert candidate(arr = [-1, -2, -3, -2, -1]) == False\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 3, 3]) == True\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4]) == False\n assert candidate(arr = [5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9]) == True\n assert candidate(arr = [100, -100, 100, -100, 100, -100, 100, -100, 100, -100]) == False\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6]) == False\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == True\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == True\n assert candidate(arr = [-1000, 1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000, 1000]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == False\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == True\n assert candidate(arr = [10, 20, 30, 40, 50, 10, 20, 30, 40, 50, 10, 20, 30, 40, 50, 10, 20, 30, 40, 50]) == False\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == False\n assert candidate(arr = [5, 5, 5, 5, 5, 6, 6, 6, 7, 7, 8]) == True\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == False\n assert candidate(arr = [10, 20, 30, 40, 50, 10, 20, 30, 40, 50, 10, 20, 30, 40, 50, 10, 20, 30, 40, 50, 10]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 100, 200, 300, 400, 500]) == False\n assert candidate(arr = [999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999]) == True\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [-500, -499, -498, -497, -496, -495, -494, -493, -492, -491]) == False\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(arr = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == False\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8]) == False\n assert candidate(arr = [-1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6, -7, -7, -8, -8, -9, -9, -10, -10]) == False\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 10]) == False\n assert candidate(arr = [1000, 1000, 1000, 999, 999, 998, 997, 996, 995, 994]) == False\n assert candidate(arr = [1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == False\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == True\n assert candidate(arr = [-50, -50, -50, -50, -50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == True\n assert candidate(arr = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == True\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(arr = [0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6]) == True\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == True\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6]) == True\n assert candidate(arr = [1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == False\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7]) == False\n assert candidate(arr = [-10, -20, -30, -40, -50, -50, -40, -30, -20, -10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == False\n assert candidate(arr = [5, 5, 5, 5, 4, 4, 4, 3, 3, 2, 1]) == False\n assert candidate(arr = [10, 20, 20, 10, 30, 30, 30, 40, 40, 40, 40]) == False\n assert candidate(arr = [1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000]) == False\n assert candidate(arr = [999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986, 985, 984]) == False\n assert candidate(arr = [1000, -1000, 500, -500, 0, 0, 0, 0, 0, 0, 0, 0]) == False\n assert candidate(arr = [1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]) == False\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == False\n assert candidate(arr = [-5, -5, -5, -5, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(arr = [1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000, 1000, -1000]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == False\n assert candidate(arr = [100, 200, 100, 200, 100, 200, 100, 200, 100, 200, 100, 200, 100, 200, 100, 200]) == False\n assert candidate(arr = [10, 10, 20, 20, 30, 30, 40, 40, 50, 50, 60, 60, 70, 70, 80, 80, 90, 90, 100, 100]) == False\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3]) == True\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [10, 20, 10, 10, 30, 40, 40, 50, 50, 50]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == False\n assert candidate(arr = [10, 20, 20, 10, 30, 30, 30, 40, 40, 40, 40]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n assert candidate(arr = [-1, -2, -3, -4, -5, -5, -4, -3, -2, -1, 0, 0, 0, 0, 0]) == False\n assert candidate(arr = [0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 6, 7, 8, 9]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6]) == False\n assert candidate(arr = [1, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1]) == False\n assert candidate(arr = [1, 1, 1, 2, 2, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [-1000, 1000, -1000, 1000, -1000, 1000, -1000, 1000, 0, 0, 0, 0, 0, 0, 0]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == False\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == False\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(arr = [10, 20, 20, 10, 30, 40, 40, 40, 50, 50, 50, 50]) == False\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == True\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().uniqueOccurrences", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var uniqueOccurrences = function(arr) {", "container": null, "callable": "uniqueOccurrences", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1208, "task_id": "get-equal-substrings-within-budget", "difficulty": "Medium", "problem_description": "You are given two strings s and t of the same length and an integer maxCost.\nYou want to change s to t. Changing the ith character of s to ith character of t costs |s[i] - t[i]| (i.e., the absolute difference between the ASCII values of the characters).\nReturn the maximum length of a substring of s that can be changed to be the same as the corresponding substring of t with a cost less than or equal to maxCost. If there is no substring from s that can be changed to its corresponding substring from t, return 0.\n \nExample 1:\n\nInput: s = \"abcd\", t = \"bcdf\", maxCost = 3\nOutput: 3\nExplanation: \"abc\" of s can change to \"bcd\".\nThat costs 3, so the maximum length is 3.\n\nExample 2:\n\nInput: s = \"abcd\", t = \"cdef\", maxCost = 3\nOutput: 1\nExplanation: Each character in s costs 2 to change to character in t, so the maximum length is 1.\n\nExample 3:\n\nInput: s = \"abcd\", t = \"acde\", maxCost = 0\nOutput: 1\nExplanation: You cannot make any change, so the maximum length is 1.\n\n \nConstraints:\n\n1 <= s.length <= 105\nt.length == s.length\n0 <= maxCost <= 106\ns and t consist of only lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"a\",t = \"b\",maxCost = 1) == 1\n assert candidate(s = \"a\",t = \"a\",maxCost = 0) == 1\n assert candidate(s = \"krrgw\",t = \"grkwa\",maxCost = 3) == 1\n assert candidate(s = \"abcd\",t = \"abce\",maxCost = 1) == 4\n assert candidate(s = \"abcdefgh\",t = \"efghabcd\",maxCost = 10) == 2\n assert candidate(s = \"krrgw\",t = \"zjxss\",maxCost = 19) == 2\n assert candidate(s = \"zzzzz\",t = \"bbbbb\",maxCost = 100) == 4\n assert candidate(s = \"abcd\",t = \"cdef\",maxCost = 3) == 1\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",t = \"zyxwvutsrqponmlkjihgfedcba\",maxCost = 26) == 7\n assert candidate(s = \"pxezla\",t = \"sllerr\",maxCost = 5) == 1\n assert candidate(s = \"abcde\",t = \"bcdef\",maxCost = 5) == 5\n assert candidate(s = \"a\",t = \"b\",maxCost = 0) == 0\n assert candidate(s = \"abcd\",t = \"abcd\",maxCost = 10) == 4\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",t = \"zyxwvutsrqponmlkjihgfedcba\",maxCost = 25) == 7\n assert candidate(s = \"abcdabcdabcd\",t = \"dddddddddddd\",maxCost = 10) == 7\n assert candidate(s = \"abcd\",t = \"bcdf\",maxCost = 3) == 3\n assert candidate(s = \"abcde\",t = \"fghij\",maxCost = 10) == 2\n assert candidate(s = \"abcd\",t = \"acde\",maxCost = 0) == 1\n assert candidate(s = \"zzzzzzzzzz\",t = \"aaaaaaaaaa\",maxCost = 25) == 1\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",t = \"zyxwvutsrqponmlkjihgfedcba\",maxCost = 100) == 14\n assert candidate(s = \"aaaaabbbbbccccc\",t = \"bbbbbccccdaaaaa\",maxCost = 15) == 12\n assert candidate(s = \"a\",t = \"z\",maxCost = 25) == 1\n assert candidate(s = \"thisisaverylongstring\",t = \"thisisaverylongstring\",maxCost = 50) == 21\n assert candidate(s = \"abcde\",t = \"fghij\",maxCost = 15) == 3\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzz\",t = \"aaaaaaaaaaaaaaaaaaaaaaaaaaa\",maxCost = 130) == 5\n assert candidate(s = \"abracadabra\",t = \"abracadabra\",maxCost = 5) == 11\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzz\",t = \"aaaaaaaaaaaaaaaaaaaaaaaaaaa\",maxCost = 100) == 4\n assert candidate(s = \"xylophone\",t = \"pneumonia\",maxCost = 20) == 5\n assert candidate(s = \"aabbaabbaabb\",t = \"bbaabbaabbab\",maxCost = 20) == 12\n assert candidate(s = \"pneumonoultramicroscopicsilicovolcanoconiosis\",t = \"pneumonoultramicroscopicsilicovolcanoconiosis\",maxCost = 0) == 45\n assert candidate(s = \"abcdefghij\",t = \"abcdefghij\",maxCost = 50) == 10\n assert candidate(s = \"thisisaverylongstringthatweneedtocompare\",t = \"thisisaverylongstringthatweneedtoreplace\",maxCost = 50) == 40\n assert candidate(s = \"xyzz\",t = \"zzyx\",maxCost = 10) == 4\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcd\",t = \"dddddddddddddddddddddddddddddddd\",maxCost = 200) == 32\n assert candidate(s = \"ababababababab\",t = \"bababababababa\",maxCost = 12) == 12\n assert candidate(s = \"mnopqr\",t = \"qrstuv\",maxCost = 12) == 3\n assert candidate(s = \"abacabadabacaba\",t = \"xyzxyzxyzxyzxyzxyzx\",maxCost = 30) == 1\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",t = \"abcdefghijklmnopqrstuvwxyz\",maxCost = 0) == 26\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",t = \"zzyyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbbaa\",maxCost = 1300) == 52\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",t = \"zyxwvutsrqponmlkjihgfedcba\",maxCost = 50) == 10\n assert candidate(s = \"aaaabbbbcccc\",t = \"ccccbbbbaaaa\",maxCost = 16) == 12\n assert candidate(s = \"ababababab\",t = \"bababababa\",maxCost = 15) == 10\n assert candidate(s = \"abcabcabcabcabc\",t = \"abcabcabcabcabc\",maxCost = 0) == 15\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",t = \"zzyyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggeeffddccbbaa\",maxCost = 52) == 14\n assert candidate(s = \"ababababababababababababababababababababababababab\",t = \"bababababababababababababababababababababababababa\",maxCost = 25) == 25\n assert candidate(s = \"mississippi\",t = \"abababababa\",maxCost = 10) == 1\n assert candidate(s = \"abcdefghij\",t = \"abcdefghja\",maxCost = 9) == 9\n assert candidate(s = \"abcdefghij\",t = \"abcdefghkj\",maxCost = 2) == 10\n assert candidate(s = \"acabababcababcaba\",t = \"bacbababcababcaba\",maxCost = 25) == 17\n assert candidate(s = \"oneonetwoonetwo\",t = \"twoonetwoonetwo\",maxCost = 8) == 12\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",t = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",maxCost = 200) == 8\n assert candidate(s = \"xyzzzzzzzzzzzzzzzzzzzzzzzzzzz\",t = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzx\",maxCost = 50) == 29\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\",t = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\",maxCost = 0) == 52\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\",t = \"zyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba\",maxCost = 100) == 14\n assert candidate(s = \"abcdabcdabcdabcdabcd\",t = \"dddddddddddddddddddd\",maxCost = 15) == 11\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",t = \"bcdefghijklmnopqrstuvwxyza\",maxCost = 51) == 26\n assert candidate(s = \"thisisateststring\",t = \"jajajajajajajajaj\",maxCost = 50) == 5\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",t = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\",maxCost = 100) == 20\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",t = \"zzyyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbbaa\",maxCost = 200) == 28\n assert candidate(s = \"aaaabbbbcccc\",t = \"ccccbbbbaaaaffff\",maxCost = 15) == 11\n assert candidate(s = \"abcdefghij\",t = \"abcdefghij\",maxCost = 1) == 10\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaa\",t = \"zzzzzzzzzzzzzzzzzzzzzzzzzz\",maxCost = 250) == 10\n assert candidate(s = \"abcdefghij\",t = \"jihgfedcba\",maxCost = 100) == 10\n assert candidate(s = \"abcdefghij\",t = \"jihgfedcba\",maxCost = 50) == 10\n assert candidate(s = \"abcabcabcabcabcabcabcabc\",t = \"bcbcbcbcbcbcbcbcbcbcbcbcbcbc\",maxCost = 30) == 24\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaa\",t = \"bbbbbbbbbbbbbbbbbbbbbbbbbb\",maxCost = 100) == 26\n assert candidate(s = \"abacabadabacaba\",t = \"xyzxyzxyzxyzxyz\",maxCost = 26) == 1\n assert candidate(s = \"samecharacters\",t = \"samecharacters\",maxCost = 0) == 14\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabc\",t = \"xyzxyzxyzxyzxyzxyzxyzxyzxyzxyz\",maxCost = 30) == 1\n assert candidate(s = \"abcdefghij\",t = \"abcdefghjk\",maxCost = 1) == 9\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\",t = \"xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz\",maxCost = 500) == 21\n assert candidate(s = \"aabbccddeeff\",t = \"zzeeffgghhii\",maxCost = 15) == 5\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",t = \"bcdefghijklmnopqrstuvwxyza\",maxCost = 25) == 25\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",t = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",maxCost = 0) == 48\n assert candidate(s = \"abcd\",t = \"acde\",maxCost = 2) == 3\n assert candidate(s = \"abcabcabcabcabcabc\",t = \"defdefdefdefdefdef\",maxCost = 18) == 6\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabc\",t = \"defdefdefdefdefdefdefdefdefdefdefdef\",maxCost = 27) == 9\n assert candidate(s = \"aaaaabbbbbaaaa\",t = \"zzzzzaaaaazzzz\",maxCost = 40) == 6\n assert candidate(s = \"abcdabcdabcd\",t = \"abcdbacdabca\",maxCost = 15) == 12\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",t = \"zabcdefghijklmnopqrstuvwxy\",maxCost = 25) == 25\n assert candidate(s = \"ab\",t = \"ba\",maxCost = 100) == 2\n assert candidate(s = \"zzzzyyyyxxxwwwwvvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbbbaaa\",t = \"aaabbbcccdddeeefffggghhiijjkkllmmnnoopppqqrrssttuuvvvwwwxxxxyyyyzzzz\",maxCost = 200) == 28\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaa\",t = \"zzzzzzzzzzzzzzzzzzzzzzzzzz\",maxCost = 100) == 4\n assert candidate(s = \"abacabadabacaba\",t = \"zyxwzyxwzyxwzyx\",maxCost = 50) == 2\n assert candidate(s = \"abcd\",t = \"xyzw\",maxCost = 12) == 0\n assert candidate(s = \"aaaabbbbccccdddd\",t = \"ddddccccbbbbaaaa\",maxCost = 20) == 12\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\",t = \"zyxwzyxwzyxwzyxwzyxwzyxwzyxwzyxwzyxwzyxw\",maxCost = 50) == 2\n assert candidate(s = \"abcdefghij\",t = \"jihgfedcba\",maxCost = 30) == 7\n assert candidate(s = \"aaaaaaaaaa\",t = \"zzzzzzzzzz\",maxCost = 250) == 10\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",t = \"zyxwvutsrqponmlkjihgfedcba\",maxCost = 150) == 17\n assert candidate(s = \"aabbaabbaabbaabbaabbaabbaabbaabbaabbaabb\",t = \"zzyyzzyyzzyyzzyyzzyyzzyyzzyyzzyyzzyyzzyy\",maxCost = 150) == 6\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnm\",t = \"qwertyuiopasdfghjklzxcvbnm\",maxCost = 0) == 26\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnm\",t = \"mnbvcxzlkjhgfdsapoiuytrewq\",maxCost = 150) == 25\n assert candidate(s = \"zzzzzzzzzz\",t = \"aaaaaaaaaa\",maxCost = 100) == 4\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",t = \"zabcdefghijklmnopqrstuvwxy\",maxCost = 26) == 25\n"}, "metadata": {"canonical_parameter_names": ["s", "t", "maxCost"], "leetcode_dataset_entry_point": "Solution().equalSubstring", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var equalSubstring = function(s, t, maxCost) {", "container": null, "callable": "equalSubstring", "parameters": [{"name": "s", "type": "string"}, {"name": "t", "type": "string"}, {"name": "maxCost", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1209, "task_id": "remove-all-adjacent-duplicates-in-string-ii", "difficulty": "Medium", "problem_description": "You are given a string s and an integer k, a k duplicate removal consists of choosing k adjacent and equal letters from s and removing them, causing the left and the right side of the deleted substring to concatenate together.\nWe repeatedly make k duplicate removals on s until we no longer can.\nReturn the final string after all such duplicate removals have been made. It is guaranteed that the answer is unique.\n \nExample 1:\n\nInput: s = \"abcd\", k = 2\nOutput: \"abcd\"\nExplanation: There's nothing to delete.\nExample 2:\n\nInput: s = \"deeedbbcccbdaa\", k = 3\nOutput: \"aa\"\nExplanation: \nFirst delete \"eee\" and \"ccc\", get \"ddbbbdaa\"\nThen delete \"bbb\", get \"dddaa\"\nFinally delete \"ddd\", get \"aa\"\nExample 3:\n\nInput: s = \"pbbcggttciiippooaais\", k = 2\nOutput: \"ps\"\n\n \nConstraints:\n\n1 <= s.length <= 105\n2 <= k <= 104\ns only contains lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"a\",k = 2) == \"a\"\n assert candidate(s = \"mississippi\",k = 2) == \"m\"\n assert candidate(s = \"deeedbbcccbdaa\",k = 3) == \"aa\"\n assert candidate(s = \"abcd\",k = 2) == \"abcd\"\n assert candidate(s = \"abcde\",k = 5) == \"abcde\"\n assert candidate(s = \"abcdabcdabcdabcd\",k = 4) == \"abcdabcdabcdabcd\"\n assert candidate(s = \"aabbccddeee\",k = 3) == \"aabbccdd\"\n assert candidate(s = \"aaaabbbccc\",k = 4) == \"bbbccc\"\n assert candidate(s = \"pbbcggttciiippooaais\",k = 2) == \"ps\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzz\",k = 5) == \"zzz\"\n assert candidate(s = \"aabbccddeee\",k = 2) == \"e\"\n assert candidate(s = \"zzzzzzzzzz\",k = 3) == \"z\"\n assert candidate(s = \"abababababababab\",k = 2) == \"abababababababab\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzz\",k = 10) == \"\"\n assert candidate(s = \"abcabcabc\",k = 3) == \"abcabcabc\"\n assert candidate(s = \"a\",k = 1) == \"\"\n assert candidate(s = \"aaabbbcccddd\",k = 3) == \"\"\n assert candidate(s = \"abcdabcdabcd\",k = 4) == \"abcdabcdabcd\"\n assert candidate(s = \"abcde\",k = 2) == \"abcde\"\n assert candidate(s = \"aaabbbccc\",k = 3) == \"\"\n assert candidate(s = \"nnnnttttuuuu\",k = 4) == \"\"\n assert candidate(s = \"aabbcc\",k = 2) == \"\"\n assert candidate(s = \"bbaabaaaabbbbccccdddd\",k = 3) == \"bbaababcd\"\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\",k = 5) == \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\"\n assert candidate(s = \"abcdefghijaaaabbbbccccddddeeeeffffgggghhhhiiii\",k = 4) == \"abcdefghij\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\",k = 26) == \"abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\"\n assert candidate(s = \"mmnnmmllooonnmmllooonn\",k = 3) == \"mmnnmmllnnmmllnn\"\n assert candidate(s = \"pppppqqqppppqqqqqqqqq\",k = 5) == \"qqqppppqqqq\"\n assert candidate(s = \"aabbccddeeefffggghhhiiiijjjkkklllmmmnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzzzzzzz\",k = 4) == \"aabbccddeeefffggghhhjjjkkklllmmmnnooopppqqqrrrssstttuuuvvvwwwxxxyyy\"\n assert candidate(s = \"xyxxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyx\",k = 3) == \"xyxxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyx\"\n assert candidate(s = \"aaabbbcccdddeeefffggghhhiiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxxxyyyyyzzzzz\",k = 3) == \"ixxyyzz\"\n assert candidate(s = \"nnnnooooffffgggg\",k = 4) == \"\"\n assert candidate(s = \"aabbbccddeeefffggghhhiiijjjkkklllmmmnnooopppqqqrrrssstttuuuuvvvwwwxxyyzz\",k = 3) == \"aaccddnnuxxyyzz\"\n assert candidate(s = \"ppppqqqqrrrrssssttttuuuuvvvvwwwwxxxxyyyyzzzz\",k = 5) == \"ppppqqqqrrrrssssttttuuuuvvvvwwwwxxxxyyyyzzzz\"\n assert candidate(s = \"mississippiiiiiiiiii\",k = 5) == \"mississipp\"\n assert candidate(s = \"aabbccddeeefffggghhhiiiijjjkkklllmmmnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz\",k = 3) == \"aabbccddinn\"\n assert candidate(s = \"pppqqqrrrssstttuuuvvvwwwww\",k = 5) == \"pppqqqrrrssstttuuuvvv\"\n assert candidate(s = \"aabbccddeeefffggghhhiiiijjjjkkkkllllmmmmnnnnooooppppqqqq\",k = 4) == \"aabbccddeeefffggghhh\"\n assert candidate(s = \"ppppqqqrrrssstttuuuvvvwwwwwxxxxyyyyzzzz\",k = 4) == \"qqqrrrssstttuuuvvvw\"\n assert candidate(s = \"abababababababababababababababab\",k = 3) == \"abababababababababababababababab\"\n assert candidate(s = \"mississippiississi\",k = 3) == \"mississippiississi\"\n assert candidate(s = \"abcabcabcabc\",k = 4) == \"abcabcabcabc\"\n assert candidate(s = \"zzzzyyyyyyyyyzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",k = 7) == \"zzzzyy\"\n assert candidate(s = \"abababababab\",k = 3) == \"abababababab\"\n assert candidate(s = \"mmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz\",k = 3) == \"mm\"\n assert candidate(s = \"abcdefghijkllllllllllllmnopqrstuvwxyz\",k = 10) == \"abcdefghijkllmnopqrstuvwxyz\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\",k = 26) == \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"xyzzzzzzzzxy\",k = 6) == \"xyzzxy\"\n assert candidate(s = \"abcdefggggggfedcba\",k = 5) == \"abcdefgfedcba\"\n assert candidate(s = \"ababababababababababababababababababababababababababababababababababababab\",k = 20) == \"ababababababababababababababababababababababababababababababababababababab\"\n assert candidate(s = \"qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\",k = 10) == \"qqqq\"\n assert candidate(s = \"zzzzzyzzzz\",k = 5) == \"yzzzz\"\n assert candidate(s = \"wwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzz\",k = 6) == \"wwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzzwwzzzzz\"\n assert candidate(s = \"pppppaaaabbbbcccccccdddddddd\",k = 4) == \"pccc\"\n assert candidate(s = \"aabaaaacccaaabbbcccbbccaa\",k = 3) == \"aababbccaa\"\n assert candidate(s = \"abcdefghijkllllllllllllmnopqrstuv\",k = 11) == \"abcdefghijklmnopqrstuv\"\n assert candidate(s = \"aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffgggggggggghhhhhhhhiiiiiiiiiijjjjjjjjjjkkkkkkkkkkllllllllllmmmmmmmmmmnnnnnnnnnnooooooooooppppppppppqqqqqqqqqqrrrrrrrrrrssssssssssttttttttttuuuuuuuuuuvvvvvvvvvvwwwwwwwwwwxxxxxxxxxxxxxyyyyyyyyyyzzzzzzzzzz\",k = 10) == \"hhhhhhhhxxx\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzzzz\",k = 6) == \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyy\"\n assert candidate(s = \"abcdabcdabcdabcdabcdabcd\",k = 6) == \"abcdabcdabcdabcdabcdabcd\"\n assert candidate(s = \"xyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzy\",k = 5) == \"xyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzyzy\"\n assert candidate(s = \"aabbccddeeefffggghhhiiiijjjjkkkk\",k = 4) == \"aabbccddeeefffggghhh\"\n assert candidate(s = \"pppppppppaaaabbbbccccdddd\",k = 4) == \"p\"\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabc\",k = 10) == \"abcabcabcabcabcabcabcabcabcabc\"\n assert candidate(s = \"aabbccddeeefffggghhhiiijjjkkklllmnnnooopppqqqrrrssstttuuuvvvwwxxyyzz\",k = 3) == \"aabbccddmwwxxyyzz\"\n assert candidate(s = \"xyzzzzzzzzzzzyyxwwwwwwwwwwwwwxvvvvvvvvvvvvvuuuuuuuuuuuuuutttttttttttttsssssssssssssrrrrrrrrrrrrrqqqqqqqqqqqqqpnnnnnnnnnnnnnoommmmmmmmmmmmmllllllllllllllkkkkkkkkkkkkkkjjjjjjjjjjjjjjiiiiiiiiiiiiiiiihhhhhhhhhhhhhhhhhgggggggggggggggggffffffffffffffffeeeeeeeeeeeeeeeeedddddddddddddddddccccccccccccccccccbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaa\",k = 20) == \"xyzzzzzzzzzzzyyxwwwwwwwwwwwwwxvvvvvvvvvvvvvuuuuuuuuuuuuuutttttttttttttsssssssssssssrrrrrrrrrrrrrqqqqqqqqqqqqqpnnnnnnnnnnnnnoommmmmmmmmmmmmllllllllllllllkkkkkkkkkkkkkkjjjjjjjjjjjjjjiiiiiiiiiiiiiiiihhhhhhhhhhhhhhhhhgggggggggggggggggffffffffffffffffeeeeeeeeeeeeeeeeedddddddddddddddddccccccccccccccccccbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaa\"\n assert candidate(s = \"mnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba\",k = 2) == \"lkjihgfedcba\"\n assert candidate(s = \"mississippiissiippiiissipiissipiissipiissipiissipiissipiissipiissipiis\",k = 3) == \"mississippiissiippssipiissipiissipiissipiissipiissipiissipiissipiis\"\n assert candidate(s = \"aaabaaaabbbaaa\",k = 3) == \"ba\"\n assert candidate(s = \"aaaabbbbccccdddd\",k = 4) == \"\"\n assert candidate(s = \"zzzzzyyyxx\",k = 4) == \"zyyyxx\"\n assert candidate(s = \"zzzzzzzzzzzz\",k = 5) == \"zz\"\n assert candidate(s = \"zzzzzyyyyyxxxwwwwvvvvuuuuuuttttssssrrrrqqqqppppooooonnnnmmmmmllllkkkkjjjjiiihhhhggggffffeeee\",k = 5) == \"xxxwwwwvvvvuttttssssrrrrqqqqppppnnnnllllkkkkjjjjiiihhhhggggffffeeee\"\n assert candidate(s = \"xyzyxyzyxyzyxyzyxyzy\",k = 3) == \"xyzyxyzyxyzyxyzyxyzy\"\n assert candidate(s = \"ppppppqqqqqqrrrrrr\",k = 6) == \"\"\n assert candidate(s = \"abacabadabacabadabacabadabacabad\",k = 4) == \"abacabadabacabadabacabadabacabad\"\n assert candidate(s = \"xyzzzzxyzzzz\",k = 5) == \"xyzzzzxyzzzz\"\n assert candidate(s = \"abababababababababababababababab\",k = 7) == \"abababababababababababababababab\"\n assert candidate(s = \"abccbaabccbaabccba\",k = 3) == \"abccbaabccbaabccba\"\n assert candidate(s = \"aabbbbccccddddaaaabbbbccccddddaaaabbbbccccdddd\",k = 4) == \"aa\"\n assert candidate(s = \"aabbccddeeefffgghhiiijjjkkklllmmmnnooopppqqqrrrssstttuuuvvvwww\",k = 5) == \"aabbccddeeefffgghhiiijjjkkklllmmmnnooopppqqqrrrssstttuuuvvvwww\"\n assert candidate(s = \"aaaabaaaabaaaabaaaab\",k = 4) == \"\"\n assert candidate(s = \"aabbccddeeefff\",k = 2) == \"ef\"\n assert candidate(s = \"aaaaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeefffffffff\",k = 10) == \"bbbbbbbbccccccccddddddddeeeeeeeeefffffffff\"\n assert candidate(s = \"zzzzzyyyyyxxxxxxwwwwvvvvvuuuuu\",k = 5) == \"xwwww\"\n assert candidate(s = \"aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnoooo\",k = 4) == \"\"\n assert candidate(s = \"aabbccccddeeeeffffgggghhhiiijjjkkk\",k = 4) == \"aabbddhhhiiijjjkkk\"\n assert candidate(s = \"mnopqrstuvw\",k = 2) == \"mnopqrstuvw\"\n assert candidate(s = \"zzzxxxyyyzzzxxxyyy\",k = 3) == \"\"\n assert candidate(s = \"abcdefghijklaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb\",k = 10) == \"abcdefghijklabbbbbbbb\"\n assert candidate(s = \"aabbccddeeefffggg\",k = 3) == \"aabbccdd\"\n assert candidate(s = \"qqqqwwwwrrrreeee\",k = 4) == \"\"\n assert candidate(s = \"mississippiissippi\",k = 4) == \"mississippiissippi\"\n assert candidate(s = \"zzzzzyyyyxxxxwwwwvvvvuuuu\",k = 5) == \"yyyyxxxxwwwwvvvvuuuu\"\n assert candidate(s = \"abcdefghijkllllllllllmnopqrstuvwxyz\",k = 10) == \"abcdefghijkmnopqrstuvwxyz\"\n assert candidate(s = \"zzzzzzzzzz\",k = 4) == \"zz\"\n assert candidate(s = \"abababababababababab\",k = 5) == \"abababababababababab\"\n assert candidate(s = \"qqwweerrttyyuuiiooppaassddffgghhjjkkllzzxciwoqjfqioejqwojfioqwjfiqwjefioqwjfeiqwjeofiqwjeofiqwjefiqwjf\",k = 2) == \"xciwoqjfqioejqwojfioqwjfiqwjefioqwjfeiqwjeofiqwjeofiqwjefiqwjf\"\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",k = 10) == \"zzzz\"\n assert candidate(s = \"mmnnnnoooopprrrssstttuuuuvvvvwwxxxyyyzzzzzz\",k = 6) == \"mmnnnnoooopprrrssstttuuuuvvvvwwxxxyyy\"\n assert candidate(s = \"aaaaaaaaabbbbbbbbccccccccddddddddd\",k = 8) == \"ad\"\n assert candidate(s = \"abcdefghijaaaaklmnopqrstuuvwxyz\",k = 3) == \"abcdefghijaklmnopqrstuuvwxyz\"\n assert candidate(s = \"aabbccddeeefffggghhhiiiijjjjkkkkllllmmmmnnnnoooopppp\",k = 5) == \"aabbccddeeefffggghhhiiiijjjjkkkkllllmmmmnnnnoooopppp\"\n assert candidate(s = \"qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\",k = 20) == \"qqqqqqqqqqqqqq\"\n assert candidate(s = \"abbaccccbaa\",k = 4) == \"abbabaa\"\n assert candidate(s = \"abcdefghijabcdefghijabcdefghij\",k = 10) == \"abcdefghijabcdefghijabcdefghij\"\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",k = 2) == \"\"\n assert candidate(s = \"abcdabcdabcdabcd\",k = 3) == \"abcdabcdabcdabcd\"\n"}, "metadata": {"canonical_parameter_names": ["s", "k"], "leetcode_dataset_entry_point": "Solution().removeDuplicates", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var removeDuplicates = function(s, k) {", "container": null, "callable": "removeDuplicates", "parameters": [{"name": "s", "type": "string"}, {"name": "k", "type": "number"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1210, "task_id": "minimum-moves-to-reach-target-with-rotations", "difficulty": "Hard", "problem_description": "In an n*n grid, there is a snake that spans 2 cells and starts moving from the top left corner at (0, 0) and (0, 1). The grid has empty cells represented by zeros and blocked cells represented by ones. The snake wants to reach the lower right corner at (n-1, n-2) and (n-1, n-1).\nIn one move the snake can:\n\nMove one cell to the right if there are no blocked cells there. This move keeps the horizontal/vertical position of the snake as it is.\nMove down one cell if there are no blocked cells there. This move keeps the horizontal/vertical position of the snake as it is.\nRotate clockwise if it's in a horizontal position and the two cells under it are both empty. In that case the snake moves from (r, c) and (r, c+1) to (r, c) and (r+1, c).\n\nRotate counterclockwise if it's in a vertical position and the two cells to its right are both empty. In that case the snake moves from (r, c) and (r+1, c) to (r, c) and (r, c+1).\n\n\nReturn the minimum number of moves to reach the target.\nIf there is no way to reach the target, return -1.\n \nExample 1:\n\n\nInput: grid = [[0,0,0,0,0,1],\n [1,1,0,0,1,0],\n  [0,0,0,0,1,1],\n  [0,0,1,0,1,0],\n  [0,1,1,0,0,0],\n  [0,1,1,0,0,0]]\nOutput: 11\nExplanation:\nOne possible solution is [right, right, rotate clockwise, right, down, down, down, down, rotate counterclockwise, right, down].\n\nExample 2:\n\nInput: grid = [[0,0,1,1,1,1],\n  [0,0,0,0,1,1],\n  [1,1,0,0,0,1],\n  [1,1,1,0,0,1],\n  [1,1,1,0,0,1],\n  [1,1,1,0,0,0]]\nOutput: 9\n\n \nConstraints:\n\n2 <= n <= 100\n0 <= grid[i][j] <= 1\nIt is guaranteed that the snake starts at empty cells.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 1, 0], [0, 0, 0, 0, 1, 1], [0, 0, 1, 0, 1, 0], [0, 1, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0]]) == 11\n assert candidate(grid = [[0, 0, 1], [0, 1, 0], [0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1], [1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0]]) == 9\n assert candidate(grid = [[0, 1, 1], [0, 0, 0], [0, 0, 0]]) == 3\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 3\n assert candidate(grid = [[0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 17\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0], [0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 17\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 17\n assert candidate(grid = [[0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 1, 1, 1, 1], [0, 1, 0, 0, 0, 1, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 21\n assert candidate(grid = [[0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 1, 0, 0], [0, 0, 1, 1, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 19\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 21\n assert candidate(grid = [[0, 0, 0, 0, 1, 0, 0], [0, 1, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0, 0, 1, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 17\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 1, 1, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 17\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 37\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 19\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 19\n assert candidate(grid = [[0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 11\n assert candidate(grid = [[0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 17\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 17\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 19\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == -1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 11\n assert candidate(grid = [[0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 23\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == -1\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().minimumMoves", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minimumMoves = function(grid) {", "container": null, "callable": "minimumMoves", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1217, "task_id": "minimum-cost-to-move-chips-to-the-same-position", "difficulty": "Easy", "problem_description": "We have n chips, where the position of the ith chip is position[i].\nWe need to move all the chips to the same position. In one step, we can change the position of the ith chip from position[i] to:\n\nposition[i] + 2 or position[i] - 2 with cost = 0.\nposition[i] + 1 or position[i] - 1 with cost = 1.\n\nReturn the minimum cost needed to move all the chips to the same position.\n \nExample 1:\n\n\nInput: position = [1,2,3]\nOutput: 1\nExplanation: First step: Move the chip at position 3 to position 1 with cost = 0.\nSecond step: Move the chip at position 2 to position 1 with cost = 1.\nTotal cost is 1.\n\nExample 2:\n\n\nInput: position = [2,2,2,3,3]\nOutput: 2\nExplanation: We can move the two chips at position 3 to position 2. Each move has cost = 1. The total cost = 2.\n\nExample 3:\n\nInput: position = [1,1000000000]\nOutput: 1\n\n \nConstraints:\n\n1 <= position.length <= 100\n1 <= position[i] <= 10^9\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(position = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(position = [1, 1000000000]) == 1\n assert candidate(position = [1, 2, 2, 2, 3, 3, 3]) == 3\n assert candidate(position = [5, 5, 5, 5, 5]) == 0\n assert candidate(position = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 0\n assert candidate(position = [1, 3, 5, 7, 9]) == 0\n assert candidate(position = [1, 1, 1, 1, 1]) == 0\n assert candidate(position = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 5\n assert candidate(position = [999999999, 999999998, 999999997, 999999996]) == 2\n assert candidate(position = [2, 4, 6, 8, 10]) == 0\n assert candidate(position = [1, 2, 2, 2, 3, 3, 3, 3]) == 3\n assert candidate(position = [1, 1, 1, 2, 2, 3]) == 2\n assert candidate(position = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 4\n assert candidate(position = [2, 2, 2, 3, 3]) == 2\n assert candidate(position = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 4\n assert candidate(position = [1, 3, 5, 7]) == 0\n assert candidate(position = [1, 2, 2, 3, 4, 5]) == 3\n assert candidate(position = [1000000000, 1000000000, 1000000000]) == 0\n assert candidate(position = [1]) == 0\n assert candidate(position = [1, 2, 2, 3, 3, 3, 4]) == 3\n assert candidate(position = [999999999, 1000000000, 1000000001]) == 1\n assert candidate(position = [4, 6, 8, 10, 12]) == 0\n assert candidate(position = [2, 4, 6, 8]) == 0\n assert candidate(position = [10, 20, 30, 40, 50]) == 0\n assert candidate(position = [1, 1, 2, 2, 3, 3, 4, 4]) == 4\n assert candidate(position = [1, 2, 3]) == 1\n assert candidate(position = [1, 1, 2, 2, 3, 3, 3, 3]) == 2\n assert candidate(position = [100, 200, 300, 400, 500, 600]) == 0\n assert candidate(position = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192]) == 1\n assert candidate(position = [2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3]) == 10\n assert candidate(position = [1, 3, 5, 7, 9, 11, 13, 15]) == 0\n assert candidate(position = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50]) == 0\n assert candidate(position = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 10\n assert candidate(position = [5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43]) == 0\n assert candidate(position = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 0\n assert candidate(position = [500000000, 500000001, 500000002, 500000003, 500000004, 500000005]) == 3\n assert candidate(position = [999999999, 1000000000, 1000000001, 1000000002, 1000000003, 1000000004, 1000000005, 1000000006, 1000000007, 1000000008]) == 5\n assert candidate(position = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(position = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 0\n assert candidate(position = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 0\n assert candidate(position = [5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == 5\n assert candidate(position = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 10\n assert candidate(position = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 24\n assert candidate(position = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 10\n assert candidate(position = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7]) == 12\n assert candidate(position = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200]) == 20\n assert candidate(position = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 12\n assert candidate(position = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 7\n assert candidate(position = [1, 3, 5, 7, 9, 11, 13]) == 0\n assert candidate(position = [1000000000, 999999998, 999999996, 999999994, 999999992]) == 0\n assert candidate(position = [2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 3\n assert candidate(position = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 33\n assert candidate(position = [1000000000, 1000000002, 1000000004, 1000000006, 1000000008, 1000000010]) == 0\n assert candidate(position = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 10\n assert candidate(position = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]) == 0\n assert candidate(position = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 17\n assert candidate(position = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == 14\n assert candidate(position = [1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 11\n assert candidate(position = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == 0\n assert candidate(position = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105]) == 0\n assert candidate(position = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205]) == 0\n assert candidate(position = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]) == 1\n assert candidate(position = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7]) == 9\n assert candidate(position = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 12\n assert candidate(position = [999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992, 999999991]) == 4\n assert candidate(position = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == 10\n assert candidate(position = [1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4]) == 10\n assert candidate(position = [2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5]) == 10\n assert candidate(position = [1000000000, 999999998, 999999996, 999999994, 999999992, 999999990]) == 0\n assert candidate(position = [2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20]) == 0\n assert candidate(position = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584]) == 6\n assert candidate(position = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000001]) == 1\n assert candidate(position = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 10\n assert candidate(position = [999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992]) == 4\n assert candidate(position = [1000000000, 999999998, 999999996, 999999994, 999999992, 999999990]) == 0\n assert candidate(position = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 0\n assert candidate(position = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 0\n assert candidate(position = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946]) == 7\n assert candidate(position = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3]) == 7\n assert candidate(position = [1000000001, 1000000003, 1000000005, 1000000007, 1000000009]) == 0\n assert candidate(position = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 0\n assert candidate(position = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]) == 0\n assert candidate(position = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49]) == 0\n assert candidate(position = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 0\n assert candidate(position = [1000000001, 1000000003, 1000000005, 1000000007, 1000000009]) == 0\n assert candidate(position = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 0\n assert candidate(position = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 25\n assert candidate(position = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115]) == 8\n assert candidate(position = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 15\n assert candidate(position = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 15\n assert candidate(position = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) == 0\n assert candidate(position = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == 9\n assert candidate(position = [1000000001, 1000000002, 1000000003, 1000000004, 1000000005]) == 2\n assert candidate(position = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000]) == 1\n assert candidate(position = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]) == 0\n assert candidate(position = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == 15\n assert candidate(position = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 7\n assert candidate(position = [500000000, 500000001, 500000002, 500000003, 500000004, 500000005, 500000006, 500000007, 500000008, 500000009]) == 5\n assert candidate(position = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8]) == 16\n assert candidate(position = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000]) == 0\n assert candidate(position = [5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6]) == 16\n assert candidate(position = [1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 21, 23, 23, 25, 25, 27, 27, 29, 29, 31, 31, 33, 33, 35, 35, 37, 37, 39, 39, 41, 41]) == 0\n assert candidate(position = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == 0\n assert candidate(position = [1000000000, 1000000001, 1000000002, 1000000003, 1000000004, 1000000005]) == 3\n assert candidate(position = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 0\n"}, "metadata": {"canonical_parameter_names": ["position"], "leetcode_dataset_entry_point": "Solution().minCostToMoveChips", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minCostToMoveChips = function(position) {", "container": null, "callable": "minCostToMoveChips", "parameters": [{"name": "position", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1218, "task_id": "longest-arithmetic-subsequence-of-given-difference", "difficulty": "Medium", "problem_description": "Given an integer array arr and an integer difference, return the length of the longest subsequence in arr which is an arithmetic sequence such that the difference between adjacent elements in the subsequence equals difference.\nA subsequence is a sequence that can be derived from arr by deleting some or no elements without changing the order of the remaining elements.\n \nExample 1:\n\nInput: arr = [1,2,3,4], difference = 1\nOutput: 4\nExplanation: The longest arithmetic subsequence is [1,2,3,4].\nExample 2:\n\nInput: arr = [1,3,5,7], difference = 1\nOutput: 1\nExplanation: The longest arithmetic subsequence is any single element.\n\nExample 3:\n\nInput: arr = [1,5,7,8,5,3,4,2,1], difference = -2\nOutput: 4\nExplanation: The longest arithmetic subsequence is [7,5,3,1].\n\n \nConstraints:\n\n1 <= arr.length <= 105\n-104 <= arr[i], difference <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [3, 0, -3, 4, -5, 0, -7, 1],difference = -3) == 3\n assert candidate(arr = [1, 2, 3, 4],difference = 1) == 4\n assert candidate(arr = [1, 3, 5, 7],difference = 1) == 1\n assert candidate(arr = [1, 1, 1, 1, 1],difference = 0) == 5\n assert candidate(arr = [5, 4, 3, 2, 1],difference = -1) == 5\n assert candidate(arr = [1, 3, 5, 7, 9],difference = 2) == 5\n assert candidate(arr = [4, 12, 10, 0, -2, 7, -8, 9, -9, -12, -12, 8, 8],difference = 0) == 2\n assert candidate(arr = [1, 2, 3, 4, 5],difference = 2) == 3\n assert candidate(arr = [1, 5, 7, 8, 5, 3, 4, 2, 1],difference = -2) == 4\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],difference = 1) == 10\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],difference = -1) == 10\n assert candidate(arr = [4, 1, 1, 5, 2, 3, 4, 1],difference = 1) == 4\n assert candidate(arr = [1, 4, 7, 10],difference = 3) == 4\n assert candidate(arr = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44],difference = 3) == 15\n assert candidate(arr = [30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0, -2, -4, -6, -8, -10, -12, -14, -16, -18, -20, -22, -24, -26, -28, -30],difference = -2) == 31\n assert candidate(arr = [20, 10, 30, 20, 40, 50, 60, 70, 80, 90, 100],difference = 10) == 9\n assert candidate(arr = [10, 8, 6, 4, 2, -2, -4, -6, -8, -10],difference = -2) == 5\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21],difference = 2) == 11\n assert candidate(arr = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89],difference = 1) == 3\n assert candidate(arr = [5, 1, 5, 1, 5, 1, 5, 1, 5, 1],difference = 4) == 2\n assert candidate(arr = [2, 4, 6, 8, 10, 12, 14, 16],difference = 2) == 8\n assert candidate(arr = [1000, -999, -998, -997, -996, -995, -994, -993, -992, -991],difference = 1) == 9\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21],difference = 1) == 1\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75],difference = 5) == 15\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],difference = 2) == 13\n assert candidate(arr = [100, 98, 96, 94, 92, 90, 88, 86, 84, 82, 80, 78, 76, 74, 72, 70, 68, 66, 64, 62, 60, 58, 56, 54, 52, 50],difference = -2) == 26\n assert candidate(arr = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97, 100],difference = 3) == 34\n assert candidate(arr = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8],difference = 2) == 4\n assert candidate(arr = [15, 20, 25, 30, 35, 40, 45, 50, 55, 60],difference = 5) == 10\n assert candidate(arr = [40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0, -2, -4, -6, -8, -10, -12, -14, -16, -18, -20, -22, -24, -26, -28, -30, -32, -34, -36, -38, -40],difference = -2) == 41\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],difference = 1) == 30\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],difference = 2) == 20\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31],difference = 2) == 4\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],difference = 1) == 40\n assert candidate(arr = [1, 7, 13, 19, 25, 31, 37, 43, 49, 55],difference = 6) == 10\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],difference = 2) == 10\n assert candidate(arr = [10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50],difference = 2) == 21\n assert candidate(arr = [30, 27, 24, 21, 18, 15, 12, 9, 6, 3, 0, -3, -6, -9, -12, -15, -18, -21, -24, -27],difference = -3) == 20\n assert candidate(arr = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10],difference = 1) == 8\n assert candidate(arr = [10, 7, 4, 3, 2, 1],difference = -3) == 4\n assert candidate(arr = [1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13],difference = 1) == 4\n assert candidate(arr = [1, 2, 3, 4, 6, 8, 10, 14, 18, 22, 26],difference = 2) == 5\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],difference = 100) == 10\n assert candidate(arr = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144],difference = 3) == 3\n assert candidate(arr = [100, 95, 90, 85, 80, 75, 70, 65, 60, 55],difference = -5) == 10\n assert candidate(arr = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37],difference = 4) == 10\n assert candidate(arr = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4],difference = 1) == 4\n assert candidate(arr = [5, 3, 1, -1, -3, -5, -7, -9],difference = -2) == 8\n assert candidate(arr = [1, 6, 11, 16, 21, 26, 31, 36, 41, 46],difference = 5) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],difference = 1) == 15\n assert candidate(arr = [5, 6, 7, 10, 11, 12, 15, 16, 17, 20, 21, 22],difference = 1) == 3\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],difference = 1) == 50\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],difference = 10) == 15\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5],difference = 1) == 5\n assert candidate(arr = [3, 9, 15, 21, 27, 33, 39, 45, 51, 57, 63],difference = 6) == 11\n assert candidate(arr = [1, 2, 4, 5, 7, 8, 10, 11, 13, 14],difference = 1) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],difference = 1) == 20\n assert candidate(arr = [1, 2, 3, 4, 6, 8, 10, 12, 14, 16, 18, 20],difference = 2) == 10\n assert candidate(arr = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3],difference = 0) == 10\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70],difference = 10) == 7\n assert candidate(arr = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89],difference = 3) == 3\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],difference = -1) == 10\n assert candidate(arr = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43],difference = 3) == 15\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0],difference = -10) == 11\n assert candidate(arr = [5, 8, 11, 14, 17, 20, 23, 26, 29, 32],difference = 3) == 10\n assert candidate(arr = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29],difference = 3) == 10\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],difference = 2) == 2\n assert candidate(arr = [10, 15, 20, 25, 30, 35, 40, 45, 50],difference = 5) == 9\n assert candidate(arr = [1, 5, 9, 13, 17, 21, 25],difference = 4) == 7\n assert candidate(arr = [5, 7, 9, 11, 13, 15, 17, 19, 21],difference = 2) == 9\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55],difference = 5) == 11\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41],difference = 2) == 21\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10],difference = -1) == 21\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13],difference = 2) == 7\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],difference = 5) == 10\n assert candidate(arr = [2, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19],difference = 2) == 10\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110],difference = 10) == 11\n assert candidate(arr = [1, 10, 19, 28, 37, 46, 55, 64, 73, 82, 91],difference = 9) == 11\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],difference = 2) == 20\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14],difference = 2) == 8\n assert candidate(arr = [10, 2, 5, 8, 4, 6, 1, 3, 7],difference = 3) == 3\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49],difference = 2) == 25\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],difference = 10) == 10\n assert candidate(arr = [5, 1, 5, 1, 5, 1, 5, 1, 5, 1],difference = 4) == 2\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],difference = 2) == 15\n assert candidate(arr = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987],difference = 13) == 3\n assert candidate(arr = [25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, -1, -3, -5, -7, -9, -11, -13, -15, -17, -19, -21, -23, -25],difference = -2) == 26\n assert candidate(arr = [10000, 9998, 9996, 9994, 9992, 9990, 9988, 9986, 9984, 9982],difference = -2) == 10\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21],difference = 2) == 11\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024],difference = 2) == 2\n assert candidate(arr = [1, 2, 3, 6, 7, 8, 10, 11],difference = 1) == 3\n assert candidate(arr = [1, 6, 11, 16, 21, 26, 31],difference = 5) == 7\n assert candidate(arr = [10, 21, 32, 43, 54, 65, 76, 87, 98, 109],difference = 11) == 10\n assert candidate(arr = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40],difference = 3) == 14\n assert candidate(arr = [100, 97, 94, 91, 88, 85, 82, 79, 76, 73, 70, 67, 64, 61, 58, 55, 52, 49, 46, 43, 40, 37, 34, 31, 28, 25, 22, 19, 16, 13, 10, 7, 4, 1, -2, -5, -8, -11, -14, -17, -20, -23, -26, -29, -32, -35, -38, -41, -44, -47, -50],difference = -3) == 51\n assert candidate(arr = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28],difference = 3) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],difference = 1) == 15\n assert candidate(arr = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31],difference = 3) == 11\n assert candidate(arr = [3, 0, -3, -6, -9, -12, -15],difference = -3) == 7\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],difference = 0) == 20\n assert candidate(arr = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49],difference = 4) == 13\n assert candidate(arr = [10, 4, 7, 2, 5, 8, 11, 14],difference = 3) == 5\n assert candidate(arr = [1, 2, 3, 8, 7, 6, 5, 4],difference = -1) == 5\n assert candidate(arr = [50, 45, 40, 35, 30, 25, 20, 15, 10, 5, 0, -5, -10, -15, -20, -25, -30, -35, -40, -45, -50],difference = -5) == 21\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],difference = 1) == 20\n assert candidate(arr = [1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 13, 13, 14],difference = 1) == 14\n assert candidate(arr = [3, 0, -3, -6, -9, -12, -15, -18],difference = -3) == 8\n assert candidate(arr = [10, 7, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6],difference = -3) == 6\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],difference = 2) == 10\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],difference = 5) == 20\n assert candidate(arr = [3, 0, -3, -6, -9, -12, -15, -18, -21, -24],difference = -3) == 10\n assert candidate(arr = [3, 7, 11, 15, 19, 23, 27, 31, 35, 39],difference = 4) == 10\n assert candidate(arr = [5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41],difference = 3) == 13\n assert candidate(arr = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7],difference = 0) == 10\n assert candidate(arr = [1, 4, 7, 10, 13, 16, 19, 22],difference = 3) == 8\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25],difference = 2) == 13\n assert candidate(arr = [20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0, -2, -4, -6, -8, -10, -12, -14, -16, -18],difference = -2) == 20\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10],difference = -10) == 12\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10],difference = 2) == 6\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],difference = -1) == 20\n assert candidate(arr = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],difference = 1) == 10\n assert candidate(arr = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991, 990, 989, 988, 987, 986],difference = -1) == 15\n assert candidate(arr = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993, -9992, -9991],difference = 1) == 10\n assert candidate(arr = [1, 2, 3, 6, 7, 8, 11, 12, 13, 16, 17, 18],difference = 3) == 2\n assert candidate(arr = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41],difference = 4) == 11\n assert candidate(arr = [100, -99, 198, -297, 396, -495, 594, -693, 792, -891, 990, -1089, 1188, -1287, 1386],difference = -198) == 7\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10],difference = -10) == 10\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],difference = 10) == 10\n assert candidate(arr = [100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50],difference = -5) == 11\n assert candidate(arr = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30],difference = 3) == 10\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],difference = 1) == 30\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],difference = 1) == 10\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65],difference = 5) == 13\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],difference = 1) == 25\n assert candidate(arr = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],difference = 1) == 3\n assert candidate(arr = [1, 2, 4, 5, 7, 8, 10, 11, 13, 14],difference = 1) == 2\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],difference = 1) == 2\n assert candidate(arr = [0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6],difference = 1) == 7\n assert candidate(arr = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536],difference = 2) == 2\n assert candidate(arr = [50, 47, 44, 41, 38, 35, 32, 29, 26, 23, 20, 17, 14, 11, 8, 5, 2, -1, -4, -7],difference = -3) == 20\n assert candidate(arr = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77],difference = 4) == 20\n assert candidate(arr = [1, 2, 3, 5, 9, 17, 33, 65, 129, 257],difference = 1) == 3\n assert candidate(arr = [10, 5, 0, -5, -10, -15, -20, -25, -30],difference = -5) == 9\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],difference = 1) == 26\n assert candidate(arr = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55],difference = 2) == 2\n assert candidate(arr = [200, 195, 190, 185, 180, 175, 170, 165, 160, 155, 150, 145, 140, 135, 130, 125, 120, 115, 110],difference = -5) == 19\n assert candidate(arr = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37],difference = 3) == 13\n assert candidate(arr = [5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5],difference = -1) == 11\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10, -20, -30, -40, -50, -60, -70, -80, -90, -100],difference = -10) == 21\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],difference = 3) == 1\n assert candidate(arr = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987],difference = 1) == 3\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],difference = 10) == 15\n assert candidate(arr = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],difference = 0) == 10\n assert candidate(arr = [4, 12, 10, 0, -2, 7, 15, 22, 29, 36, 43],difference = 7) == 5\n"}, "metadata": {"canonical_parameter_names": ["arr", "difference"], "leetcode_dataset_entry_point": "Solution().longestSubsequence", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var longestSubsequence = function(arr, difference) {", "container": null, "callable": "longestSubsequence", "parameters": [{"name": "arr", "type": "number[]"}, {"name": "difference", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1219, "task_id": "path-with-maximum-gold", "difficulty": "Medium", "problem_description": "In a gold mine grid of size m x n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty.\nReturn the maximum amount of gold you can collect under the conditions:\n\nEvery time you are located in a cell you will collect all the gold in that cell.\nFrom your position, you can walk one step to the left, right, up, or down.\nYou can't visit the same cell more than once.\nNever visit a cell with 0 gold.\nYou can start and stop collecting gold from any position in the grid that has some gold.\n\n \nExample 1:\n\nInput: grid = [[0,6,0],[5,8,7],[0,9,0]]\nOutput: 24\nExplanation:\n[[0,6,0],\n [5,8,7],\n [0,9,0]]\nPath to get the maximum gold, 9 -> 8 -> 7.\n\nExample 2:\n\nInput: grid = [[1,0,7],[2,0,6],[3,4,5],[0,3,0],[9,0,20]]\nOutput: 28\nExplanation:\n[[1,0,7],\n [2,0,6],\n [3,4,5],\n [0,3,0],\n [9,0,20]]\nPath to get the maximum gold, 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7.\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m, n <= 15\n0 <= grid[i][j] <= 100\nThere are at most 25 cells containing gold.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1, 0, 7, 0], [2, 0, 6, 8], [0, 4, 5, 0], [3, 0, 3, 0], [9, 0, 20, 0]]) == 42\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 6], [7, 0, 0, 0], [0, 0, 0, 8]]) == 8\n assert candidate(grid = [[0, 6, 0], [5, 8, 7], [0, 9, 0]]) == 24\n assert candidate(grid = [[10, 0, 0], [0, 0, 0], [0, 0, 10]]) == 10\n assert candidate(grid = [[1, 3, 1, 5], [2, 2, 4, 1], [5, 0, 2, 3], [0, 6, 1, 2]]) == 37\n assert candidate(grid = [[1, 0, 7, 0], [2, 0, 6, 8], [0, 4, 5, 0], [9, 3, 0, 20]]) == 35\n assert candidate(grid = [[1, 0, 1], [0, 0, 0], [1, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == 9\n assert candidate(grid = [[10]]) == 10\n assert candidate(grid = [[1, 0, 7], [2, 0, 6], [3, 4, 5], [0, 3, 0], [9, 0, 20]]) == 28\n assert candidate(grid = [[0, 0], [0, 1]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 2, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 2\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 8\n assert candidate(grid = [[0, 0, 0], [0, 2, 0], [0, 0, 0]]) == 2\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(grid = [[1]]) == 1\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 8]]) == 8\n assert candidate(grid = [[10, 33], [8, 3]]) == 54\n assert candidate(grid = [[0, 2, 0, 0], [0, 0, 0, 0], [0, 1, 0, 0]]) == 2\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == 45\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]) == 120\n assert candidate(grid = [[10, 10, 10, 10, 10], [10, 0, 0, 0, 10], [10, 0, 50, 0, 10], [10, 0, 0, 0, 10], [10, 10, 10, 10, 10]]) == 160\n assert candidate(grid = [[8, 1, 0, 0, 0], [0, 0, 0, 2, 0], [0, 3, 4, 0, 0], [0, 0, 0, 5, 0], [0, 0, 0, 0, 6]]) == 9\n assert candidate(grid = [[10, 10, 10, 10, 10], [10, 10, 10, 10, 10], [10, 10, 10, 10, 10], [10, 10, 10, 10, 10], [10, 10, 10, 10, 10]]) == 250\n assert candidate(grid = [[100, 0, 100, 0, 100], [0, 100, 0, 100, 0], [100, 0, 100, 0, 100], [0, 100, 0, 100, 0], [100, 0, 100, 0, 100]]) == 100\n assert candidate(grid = [[0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1], [0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 3, 6, 3, 0], [0, 6, 0, 6, 0], [0, 3, 6, 3, 0], [0, 0, 0, 0, 0]]) == 36\n assert candidate(grid = [[1, 0, 7, 0, 9], [2, 0, 6, 0, 8], [3, 4, 5, 0, 10], [0, 3, 0, 0, 11], [9, 0, 20, 0, 12]]) == 50\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 2, 0, 4, 0, 0], [0, 0, 6, 0, 8, 0], [0, 10, 0, 12, 0, 0], [0, 0, 14, 0, 16, 0], [0, 18, 0, 20, 0, 0]]) == 20\n assert candidate(grid = [[1, 0, 3, 0, 5], [0, 8, 0, 2, 0], [3, 0, 4, 0, 6], [0, 5, 0, 8, 0], [4, 0, 1, 0, 7]]) == 8\n assert candidate(grid = [[0, 0, 0, 0], [0, 100, 0, 0], [0, 0, 100, 0], [0, 0, 0, 0]]) == 100\n assert candidate(grid = [[0, 1, 0, 0, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1]]) == 22\n assert candidate(grid = [[1, 2, 3, 4, 5], [0, 0, 0, 0, 6], [7, 8, 9, 10, 11], [0, 0, 0, 0, 12], [13, 14, 15, 16, 17]]) == 132\n assert candidate(grid = [[5, 10, 15, 20, 25], [30, 35, 40, 45, 50], [55, 60, 0, 65, 70], [75, 80, 85, 90, 95], [100, 105, 110, 115, 120]]) == 1500\n assert candidate(grid = [[0, 20, 0, 0], [0, 0, 0, 30], [40, 0, 50, 0], [0, 60, 0, 0]]) == 60\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 16\n assert candidate(grid = [[0, 3, 0, 4, 0], [2, 0, 5, 0, 6], [0, 7, 0, 8, 0], [9, 0, 10, 0, 11], [0, 12, 0, 13, 0]]) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 2, 3, 4, 5, 6, 0], [0, 7, 8, 9, 10, 11, 12, 0], [0, 13, 14, 15, 16, 17, 18, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 171\n assert candidate(grid = [[5, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5]]) == 5\n assert candidate(grid = [[1, 0, 0, 0, 2], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [2, 0, 0, 0, 1]]) == 2\n assert candidate(grid = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) == 136\n assert candidate(grid = [[1, 2, 0, 1, 1], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [1, 0, 0, 0, 1]]) == 12\n assert candidate(grid = [[0, 0, 10, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 10]]) == 10\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 1, 0, 0], [1, 1, 1, 1, 1], [0, 1, 1, 0, 0], [1, 0, 1, 0, 1]]) == 9\n assert candidate(grid = [[5, 0, 10, 0, 15], [0, 20, 0, 25, 0], [30, 0, 35, 0, 40], [0, 45, 0, 50, 0], [55, 0, 60, 0, 65]]) == 65\n assert candidate(grid = [[3, 0, 1, 0, 3], [0, 1, 0, 1, 0], [1, 0, 2, 0, 1], [0, 1, 0, 1, 0], [3, 0, 1, 0, 3]]) == 3\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]) == 78\n assert candidate(grid = [[10, 10, 10], [10, 0, 10], [10, 10, 10]]) == 80\n assert candidate(grid = [[0, 34, 0, 0, 12], [23, 0, 0, 11, 0], [0, 0, 22, 0, 0], [0, 10, 0, 0, 33], [11, 0, 0, 21, 0]]) == 34\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]]) == 38\n assert candidate(grid = [[2, 0, 6, 0, 1, 0], [0, 3, 0, 5, 0, 8], [5, 0, 2, 0, 9, 0], [0, 7, 0, 1, 0, 4], [6, 0, 9, 0, 3, 0]]) == 9\n assert candidate(grid = [[5, 0, 2, 0, 5], [0, 1, 0, 1, 0], [2, 0, 3, 0, 2], [0, 1, 0, 1, 0], [5, 0, 2, 0, 5]]) == 5\n assert candidate(grid = [[30, 15, 15, 15, 30], [15, 0, 0, 0, 15], [15, 0, 0, 0, 15], [15, 0, 0, 0, 15], [30, 15, 15, 15, 30]]) == 300\n assert candidate(grid = [[100, 0, 100, 0, 100], [0, 0, 0, 0, 0], [100, 0, 100, 0, 100], [0, 0, 0, 0, 0], [100, 0, 100, 0, 100]]) == 100\n assert candidate(grid = [[10, 20, 30], [0, 0, 0], [40, 50, 60]]) == 150\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 2, 3, 4, 5, 0], [0, 6, 7, 8, 9, 0, 0], [0, 5, 4, 3, 2, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 59\n assert candidate(grid = [[0, 3, 0, 4, 0], [2, 0, 2, 0, 1], [0, 6, 0, 7, 0], [3, 0, 4, 0, 2], [0, 5, 0, 6, 0]]) == 7\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 20, 0, 0], [0, 19, 0, 18, 0], [0, 0, 17, 0, 0], [0, 0, 0, 0, 0]]) == 20\n assert candidate(grid = [[1, 0, 2, 0, 3], [0, 4, 0, 5, 0], [6, 0, 7, 0, 8], [0, 9, 0, 10, 0], [11, 0, 12, 0, 13]]) == 13\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]) == 19\n assert candidate(grid = [[5, 0, 0, 0, 0, 5], [0, 4, 0, 0, 4, 0], [0, 0, 3, 3, 0, 0], [0, 0, 3, 3, 0, 0], [0, 4, 0, 0, 4, 0], [5, 0, 0, 0, 0, 5]]) == 12\n assert candidate(grid = [[1, 3, 1, 5], [2, 0, 0, 0], [5, 1, 1, 0], [4, 3, 2, 1]]) == 29\n assert candidate(grid = [[10, 10, 10, 10], [10, 0, 0, 10], [10, 0, 0, 10], [10, 10, 10, 10]]) == 120\n assert candidate(grid = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]]) == 125\n assert candidate(grid = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7]]) == 64\n assert candidate(grid = [[5, 0, 3, 0, 0], [0, 0, 0, 0, 0], [4, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) == 5\n assert candidate(grid = [[1, 0, 0, 0, 5], [0, 2, 0, 4, 0], [0, 0, 3, 0, 0], [0, 6, 0, 7, 0], [8, 0, 0, 0, 9]]) == 9\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 25\n assert candidate(grid = [[0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0]]) == 1\n assert candidate(grid = [[1, 0, 3, 0, 5], [0, 8, 0, 10, 0], [11, 0, 13, 0, 15], [0, 16, 0, 18, 0], [19, 0, 21, 0, 23]]) == 23\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 0, 1, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 30\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 2, 3, 4, 0], [0, 2, 3, 4, 5, 0], [0, 3, 4, 5, 6, 0], [0, 4, 5, 6, 7, 0], [0, 0, 0, 0, 0, 0]]) == 64\n assert candidate(grid = [[8, 0, 0, 0, 0, 5, 0, 0, 0], [0, 1, 2, 3, 0, 0, 0, 4, 0], [0, 0, 3, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 8\n assert candidate(grid = [[10, 20, 0, 0, 30], [0, 0, 50, 0, 0], [40, 0, 0, 0, 0], [0, 0, 60, 0, 0], [0, 70, 0, 80, 0]]) == 80\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 7, 9], [9, 7, 5, 3, 1], [2, 4, 6, 8, 10]]) == 110\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 2, 0, 2, 0], [0, 0, 3, 0, 0], [0, 4, 0, 4, 0], [1, 0, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 0, 6, 4, 8], [2, 0, 0, 0, 0], [3, 0, 5, 1, 3], [0, 0, 0, 0, 0], [9, 0, 20, 0, 7]]) == 20\n assert candidate(grid = [[1, 3, 1, 5], [2, 0, 4, 0], [5, 3, 0, 2], [3, 2, 1, 1]]) == 26\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[5, 0, 0, 0, 5], [0, 5, 5, 5, 0], [0, 5, 0, 5, 0], [0, 5, 5, 5, 0], [5, 0, 0, 0, 5]]) == 40\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 3, 1], [2, 4, 6, 4, 2], [3, 5, 7, 5, 3]]) == 84\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 0, 0, 0, 0, 0, 0, 0, 0], [9, 8, 7, 6, 5, 4, 3, 2, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 0, 0, 0, 0, 0, 0, 0, 0], [9, 8, 7, 6, 5, 4, 3, 2, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 2, 3, 4, 5, 6, 7, 8, 9]]) == 45\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 2, 0, 0, 0, 0], [0, 0, 0, 3, 0, 0, 0], [0, 0, 0, 0, 4, 0, 0], [0, 0, 0, 0, 0, 5, 0], [0, 0, 0, 0, 0, 0, 6]]) == 6\n assert candidate(grid = [[30, 0, 40, 0, 50], [0, 20, 0, 30, 0], [40, 0, 50, 0, 60], [0, 30, 0, 40, 0], [50, 0, 60, 0, 70]]) == 70\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 100, 0, 100, 0], [0, 0, 0, 0, 0], [0, 100, 0, 100, 0], [0, 0, 0, 0, 0]]) == 100\n assert candidate(grid = [[0, 0, 0, 0], [0, 100, 100, 0], [0, 100, 100, 0], [0, 0, 0, 0]]) == 400\n assert candidate(grid = [[1, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0], [0, 0, 3, 0, 0, 0], [0, 0, 0, 4, 0, 0], [0, 0, 0, 0, 5, 0], [0, 0, 0, 0, 0, 6]]) == 6\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 2, 0, 2, 0], [0, 0, 0, 0, 0], [0, 2, 0, 2, 0], [0, 0, 0, 0, 0]]) == 2\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [6, 7, 8, 9, 0], [0, 9, 8, 7, 6], [1, 2, 3, 4, 5]]) == 105\n assert candidate(grid = [[9, 0, 8, 0, 7], [0, 6, 0, 5, 0], [4, 0, 3, 0, 2], [0, 1, 0, 0, 0], [0, 0, 0, 0, 0]]) == 9\n assert candidate(grid = [[5, 1, 3, 1, 5], [1, 0, 2, 0, 1], [3, 0, 0, 0, 3], [1, 0, 2, 0, 1], [5, 1, 3, 1, 5]]) == 42\n assert candidate(grid = [[1, 0, 2, 0, 1], [0, 3, 0, 3, 0], [2, 0, 4, 0, 2], [0, 5, 0, 5, 0], [1, 0, 2, 0, 1]]) == 5\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 2, 0, 2, 0, 0], [0, 0, 3, 0, 2, 0], [0, 2, 0, 2, 0, 0], [0, 0, 2, 0, 2, 0], [0, 0, 0, 0, 0, 0]]) == 3\n assert candidate(grid = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]]) == 4\n assert candidate(grid = [[0, 2, 0, 8, 0], [4, 0, 0, 0, 6], [0, 3, 0, 1, 0], [0, 7, 0, 0, 9], [0, 0, 5, 0, 0]]) == 10\n assert candidate(grid = [[0, 30, 5, 0], [10, 0, 0, 10], [0, 20, 0, 0], [10, 0, 0, 0]]) == 35\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().getMaximumGold", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var getMaximumGold = function(grid) {", "container": null, "callable": "getMaximumGold", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1220, "task_id": "count-vowels-permutation", "difficulty": "Hard", "problem_description": "Given an integer n, your task is to count how many strings of length n can be formed under the following rules:\n\nEach character is a lower case vowel ('a', 'e', 'i', 'o', 'u')\nEach vowel 'a' may only be followed by an 'e'.\nEach vowel 'e' may only be followed by an 'a' or an 'i'.\nEach vowel 'i' may not be followed by another 'i'.\nEach vowel 'o' may only be followed by an 'i' or a 'u'.\nEach vowel 'u' may only be followed by an 'a'.\n\nSince the answer may be too large, return it modulo 10^9 + 7.\n \nExample 1:\n\nInput: n = 1\nOutput: 5\nExplanation: All possible strings are: \"a\", \"e\", \"i\" , \"o\" and \"u\".\n\nExample 2:\n\nInput: n = 2\nOutput: 10\nExplanation: All possible strings are: \"ae\", \"ea\", \"ei\", \"ia\", \"ie\", \"io\", \"iu\", \"oi\", \"ou\" and \"ua\".\n\nExample 3: \n\nInput: n = 5\nOutput: 68\n \nConstraints:\n\n1 <= n <= 2 * 10^4\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 1000) == 89945857\n assert candidate(n = 100) == 173981881\n assert candidate(n = 20000) == 759959057\n assert candidate(n = 200) == 670333618\n assert candidate(n = 10000) == 76428576\n assert candidate(n = 5000) == 598627501\n assert candidate(n = 2000) == 793084836\n assert candidate(n = 2) == 10\n assert candidate(n = 20) == 1151090\n assert candidate(n = 1) == 5\n assert candidate(n = 500) == 518032023\n assert candidate(n = 50) == 227130014\n assert candidate(n = 10) == 1739\n assert candidate(n = 5) == 68\n assert candidate(n = 15000) == 381635004\n assert candidate(n = 3) == 19\n assert candidate(n = 12345) == 480007966\n assert candidate(n = 4) == 35\n assert candidate(n = 30000) == 770607143\n assert candidate(n = 75) == 467397509\n assert candidate(n = 150) == 965179800\n assert candidate(n = 6) == 129\n assert candidate(n = 19999) == 706457669\n assert candidate(n = 19000) == 70562691\n assert candidate(n = 18000) == 596349393\n assert candidate(n = 25) == 29599477\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().countVowelPermutation", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var countVowelPermutation = function(n) {", "container": null, "callable": "countVowelPermutation", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1221, "task_id": "split-a-string-in-balanced-strings", "difficulty": "Easy", "problem_description": "Balanced strings are those that have an equal quantity of 'L' and 'R' characters.\nGiven a balanced string s, split it into some number of substrings such that:\n\nEach substring is balanced.\n\nReturn the maximum number of balanced strings you can obtain.\n \nExample 1:\n\nInput: s = \"RLRRLLRLRL\"\nOutput: 4\nExplanation: s can be split into \"RL\", \"RRLL\", \"RL\", \"RL\", each substring contains same number of 'L' and 'R'.\n\nExample 2:\n\nInput: s = \"RLRRRLLRLL\"\nOutput: 2\nExplanation: s can be split into \"RL\", \"RRRLLRLL\", each substring contains same number of 'L' and 'R'.\nNote that s cannot be split into \"RL\", \"RR\", \"RL\", \"LR\", \"LL\", because the 2nd and 5th substrings are not balanced.\nExample 3:\n\nInput: s = \"LLLLRRRR\"\nOutput: 1\nExplanation: s can be split into \"LLLLRRRR\".\n\n \nConstraints:\n\n2 <= s.length <= 1000\ns[i] is either 'L' or 'R'.\ns is a balanced string.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"RRLLRRLL\") == 2\n assert candidate(s = \"RLRRRLLRLL\") == 2\n assert candidate(s = \"RRRRLLLLRRRRLLLL\") == 2\n assert candidate(s = \"LRRLLRRL\") == 4\n assert candidate(s = \"LLLLRRRRLLRRRR\") == 2\n assert candidate(s = \"RLLLLRRR\") == 2\n assert candidate(s = \"RLLRRLRR\") == 3\n assert candidate(s = \"RLRRLLRLRL\") == 4\n assert candidate(s = \"RRLLRRLLRL\") == 3\n assert candidate(s = \"LLRRLLRRLL\") == 2\n assert candidate(s = \"RRLRRLRLRL\") == 0\n assert candidate(s = \"RRLLRRLLRR\") == 2\n assert candidate(s = \"RLRRLLRL\") == 3\n assert candidate(s = \"LRRLRLLRRL\") == 5\n assert candidate(s = \"RLRLRLRLRL\") == 5\n assert candidate(s = \"LLRRLLRR\") == 2\n assert candidate(s = \"RLRLRLRL\") == 4\n assert candidate(s = \"RRRRLLLL\") == 1\n assert candidate(s = \"RRLRLLRLRL\") == 3\n assert candidate(s = \"LLRRLLRRLR\") == 3\n assert candidate(s = \"LRLRLRLRLR\") == 5\n assert candidate(s = \"LLRRRLLL\") == 2\n assert candidate(s = \"LRLRLRLR\") == 4\n assert candidate(s = \"LLLLRRRR\") == 1\n assert candidate(s = \"RLRRLLRRLLRRRRLLLLRRLLRR\") == 5\n assert candidate(s = \"RRLLRRLLRRLLRRLL\") == 4\n assert candidate(s = \"LLLLLLLLRRRRRRRR\") == 1\n assert candidate(s = \"LLLLRRRLLLLRRRLLLLRRR\") == 0\n assert candidate(s = \"RRRLLLRRRLLLRRRLLL\") == 3\n assert candidate(s = \"LLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRR\") == 13\n assert candidate(s = \"LRLRLRLRLRRRRLLLLRRRRLLLL\") == 8\n assert candidate(s = \"RLLLLRRRRLLRLRRLRRLLRLRLRL\") == 10\n assert candidate(s = \"RLRLRLRLRLRLRLRLRL\") == 9\n assert candidate(s = \"RLRRLLRLRRLLRLRRLLRLRRLLRLRLRRLLRLRRLLRLRLRR\") == 15\n assert candidate(s = \"RLRLRLRLRLRLRLRL\") == 8\n assert candidate(s = \"RLLLLRRRRLLRRRRLLR\") == 4\n assert candidate(s = \"RLRRLLRLRRLLRLRLRRLLRLRL\") == 9\n assert candidate(s = \"LRRLRLRLRLRLRLRLRL\") == 9\n assert candidate(s = \"RRRRRRLLLLLLRRRRLL\") == 1\n assert candidate(s = \"LLLLRRRRLLLLRRRRLLLLRRRRLLLLRRRRLLLLRRRR\") == 5\n assert candidate(s = \"RRLRRLRRLRRLRRLRRL\") == 0\n assert candidate(s = \"RLRRLLRLRRLLRLRLRRLLRLRLRRLLRLRLRRLLRLRL\") == 15\n assert candidate(s = \"RRRLLLLLRRRLLLLLRRRLLLLL\") == 3\n assert candidate(s = \"LRLRLRLRRRLLLLRRRLLLLRRRLRLR\") == 10\n assert candidate(s = \"LLRRLRRLRRLRRLRR\") == 3\n assert candidate(s = \"RLRLRLRLRLRLRLRLRLRL\") == 10\n assert candidate(s = \"RRRRLLLLRRRRLLLLRRRRLLLLRRRRLLLLRRRRLLLLRRRRLLLL\") == 6\n assert candidate(s = \"RLLLLLLLLLLLLLLLLRRRRRRRRRRRRRRRR\") == 2\n assert candidate(s = \"RRLLRRLRLRRLRLRR\") == 1\n assert candidate(s = \"RLRLRLRLRRRRLLLL\") == 5\n assert candidate(s = \"LRLRLRLRLRLRLRLRLR\") == 9\n assert candidate(s = \"RLLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRRLL\") == 21\n assert candidate(s = \"LLLLLLLLRRRRRRRRLLLLLLLLRRRRRRRRLLLLLLLLRRRRRRRR\") == 3\n assert candidate(s = \"RLLLLRRRRLLLLRRRRLLLLRRRRLLLLRRRRLLLLRRRR\") == 10\n assert candidate(s = \"LRRRLLRRLRRRLLRRRLLR\") == 2\n assert candidate(s = \"RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL\") == 16\n assert candidate(s = \"LLLLRRRRRRRRLLLLRRRR\") == 2\n assert candidate(s = \"LLLLLLLLRRRRRRRRRRRRRRRR\") == 1\n assert candidate(s = \"LLRRRLLLLRRRRLLLLRRRR\") == 5\n assert candidate(s = \"LLRRLLRRLLLLRRRR\") == 3\n assert candidate(s = \"RLLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRR\") == 16\n assert candidate(s = \"RRRRLLLLRRRRRRLLLLLLLLRRRRLLLLLLLLRRRRLLLL\") == 4\n assert candidate(s = \"RRRRLLLLLRRRRLLLLLRRRRLLLLLRRRRLLLLL\") == 7\n assert candidate(s = \"LLLLLLRRRRRRLLLLLLRRRRRRLLLLLLRRRRRR\") == 3\n assert candidate(s = \"RRRRRRLLLLLLRRRRRRLLLLLLRRRRRRLLLLLL\") == 3\n assert candidate(s = \"LRRRRLLLLLRRRRLLLLLRRRRLLLLLRRRRLLLLL\") == 7\n assert candidate(s = \"RLRRLLRLRLRLRRLLRLRLRRLLRLRL\") == 11\n assert candidate(s = \"LLLLRRRRLLLLRRRR\") == 2\n assert candidate(s = \"LLLLRRRRRLRRLLRRLLRRLLRRRRLLLLRRLLRRRRLLLLRRLLRR\") == 9\n assert candidate(s = \"RRRRRRLLLLLLLLRRRRRRLLLLLLLLRRRRRRLLLLLLLL\") == 5\n assert candidate(s = \"RRRRRRRRRRLLLLLLLLLLRRRRRRRRRRLLLLLLLLLL\") == 2\n assert candidate(s = \"LRRLRLRLRLRLRLRL\") == 8\n assert candidate(s = \"RRRLLRLLRRLRRLLRLLRR\") == 2\n assert candidate(s = \"RLRRLLRLRLRRLLRLRLRRLLRLRL\") == 10\n assert candidate(s = \"LLRRLLRRLLRRLLRRLLRRLLRR\") == 6\n assert candidate(s = \"LLLLRRRRLLLLRRRRLLLLRRRR\") == 3\n assert candidate(s = \"RRLLRRLLRRLLRRLLRRLL\") == 5\n assert candidate(s = \"RRRRLLLLRRRRLLLLRRRRLLLLRRRR\") == 3\n assert candidate(s = \"RLLLLLLLLLLLLLLRRRRRRRRRRRRRRRRRRRRLLLLLLLLLLLLL\") == 3\n assert candidate(s = \"LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR\") == 26\n assert candidate(s = \"RLRRLLRLRRLLRLRL\") == 6\n assert candidate(s = \"LRLRLRLRLRLRLRLR\") == 8\n assert candidate(s = \"RRLLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRRLL\") == 10\n assert candidate(s = \"RLLLLRRRRRLRRRLLLLLRRRRRLLLL\") == 5\n assert candidate(s = \"RRLLRRLLRRLLRRLLRRLLRRLL\") == 6\n assert candidate(s = \"RRRRLLLLRRRRLLLLRRRRLLLLRRRRLLLL\") == 4\n assert candidate(s = \"LLLLLLLLLLLLRRRRRRRRRRRR\") == 1\n assert candidate(s = \"RRLLRLRLRRLLRLRL\") == 6\n assert candidate(s = \"RRRRRRRRLLLLLLLL\") == 1\n assert candidate(s = \"RLRRLLRLRLRLRRLLRLRRLLRLRL\") == 10\n assert candidate(s = \"LLRRLLRRLLRRLLRRLLRRLLRRLLRRLLRR\") == 8\n assert candidate(s = \"RLLLLLLLLLLLLRRRRRRRRRRRRR\") == 2\n assert candidate(s = \"LLLLRRRRRRRRLLLL\") == 2\n assert candidate(s = \"RRRLLLLRRRLLLLRRRLLLL\") == 5\n assert candidate(s = \"RLRRLLRLLRLRRLLRLR\") == 8\n assert candidate(s = \"RRRRLLLLRRRLLLLRRRRLLLLRRRLLLLRRRRLLLLRRRLLLLRRR\") == 11\n assert candidate(s = \"RLRRLLRLRLRRLLRLRL\") == 7\n assert candidate(s = \"RLRRLLRLRRLLRLRLRR\") == 6\n assert candidate(s = \"RRRRLLLLLLLLRRRRLLLL\") == 2\n assert candidate(s = \"RLRRRLRRRLRRRLRRRLRRRLRRRLRRRLRRRLRRRLRR\") == 1\n assert candidate(s = \"RRRRLLLLRRLLRRLLRRLLRRLL\") == 5\n assert candidate(s = \"RRRRRRRRLLLLLLLLRRRRRRRRLLLLLLLLRRRRRRRRLLLLLLLL\") == 3\n assert candidate(s = \"LLRRLLRRLLRRLLRR\") == 4\n assert candidate(s = \"LRRRLLLRRLRRLLRR\") == 5\n assert candidate(s = \"LLLLRRRRLLLLRRRRLLLLRRRRLLLLRRRR\") == 4\n assert candidate(s = \"RLRRLLRLRLRLRLRRLLRLRLRRLLRLRLRLRRLLRLRL\") == 16\n assert candidate(s = \"RLLLLRRRRLLRRLLRRLRRLRL\") == 7\n assert candidate(s = \"RRRRLLLLRRRRLLLLRRRRLLLL\") == 3\n assert candidate(s = \"RRLLLLRRLLLLRRLLLL\") == 2\n assert candidate(s = \"LRRLLRRLLRRLLRRLLRRLLRRLL\") == 12\n assert candidate(s = \"RLRRLLRLRRLLRLRRLLRLRRLL\") == 8\n assert candidate(s = \"LRRRRLLLLRRRRLLLL\") == 4\n assert candidate(s = \"RRRLLRLLRRRLLRLL\") == 2\n assert candidate(s = \"RLRLRLRLRLRRLLRRLLRLRLRLRL\") == 11\n assert candidate(s = \"LLRRLRRLRRLRRLRRLRRL\") == 3\n assert candidate(s = \"RRRRRRRRLLLLLLLLRRRRRRRRLLLLLLLL\") == 2\n assert candidate(s = \"RLLLLLRRRRLLRRRLLLRLLLLLRRRRRRLLLLRRRLLRRRRLLRLLL\") == 8\n assert candidate(s = \"LLLLLLLLLLLLLLLLRRRRRRRRRRRRRRRR\") == 1\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().balancedStringSplit", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var balancedStringSplit = function(s) {", "container": null, "callable": "balancedStringSplit", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1222, "task_id": "queens-that-can-attack-the-king", "difficulty": "Medium", "problem_description": "On a 0-indexed 8 x 8 chessboard, there can be multiple black queens and one white king.\nYou are given a 2D integer array queens where queens[i] = [xQueeni, yQueeni] represents the position of the ith black queen on the chessboard. You are also given an integer array king of length 2 where king = [xKing, yKing] represents the position of the white king.\nReturn the coordinates of the black queens that can directly attack the king. You may return the answer in any order.\n \nExample 1:\n\n\nInput: queens = [[0,1],[1,0],[4,0],[0,4],[3,3],[2,4]], king = [0,0]\nOutput: [[0,1],[1,0],[3,3]]\nExplanation: The diagram above shows the three queens that can directly attack the king and the three queens that cannot attack the king (i.e., marked with red dashes).\n\nExample 2:\n\n\nInput: queens = [[0,0],[1,1],[2,2],[3,4],[3,5],[4,4],[4,5]], king = [3,3]\nOutput: [[2,2],[3,4],[4,4]]\nExplanation: The diagram above shows the three queens that can directly attack the king and the three queens that cannot attack the king (i.e., marked with red dashes).\n\n \nConstraints:\n\n1 <= queens.length < 64\nqueens[i].length == king.length == 2\n0 <= xQueeni, yQueeni, xKing, yKing < 8\nAll the given positions are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(queens = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]],king = [4, 4]) == [[3, 3], [5, 5]]\n assert candidate(queens = [[6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5], [0, 5], [0, 0]],king = [3, 5]) == [[2, 5], [4, 5]]\n assert candidate(queens = [[0, 3], [6, 3], [3, 0], [3, 6]],king = [3, 3]) == [[0, 3], [3, 0], [3, 6], [6, 3]]\n assert candidate(queens = [[2, 0], [3, 1], [4, 2], [5, 3], [6, 4], [7, 5], [0, 6], [0, 7]],king = [0, 0]) == [[0, 6], [2, 0]]\n assert candidate(queens = [[0, 1], [1, 0], [4, 0], [0, 4], [3, 3], [2, 4]],king = [0, 0]) == [[0, 1], [1, 0], [3, 3]]\n assert candidate(queens = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]],king = [3, 3]) == [[2, 2], [4, 4]]\n assert candidate(queens = [[7, 7], [0, 7], [7, 0], [5, 5], [2, 2], [4, 4], [6, 6], [1, 1]],king = [3, 3]) == [[2, 2], [4, 4]]\n assert candidate(queens = [[5, 6], [7, 7], [2, 1], [0, 7], [1, 6], [5, 1], [3, 7], [0, 3], [4, 0], [1, 2], [6, 3], [5, 0], [0, 4], [2, 2], [1, 1], [6, 4]],king = [0, 0]) == [[0, 3], [4, 0], [1, 1]]\n assert candidate(queens = [[0, 7], [7, 0]],king = [3, 3]) == []\n assert candidate(queens = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [0, 0]],king = [1, 0]) == [[0, 0], [1, 1]]\n assert candidate(queens = [[2, 5], [4, 1], [0, 7], [4, 2], [3, 0], [5, 3], [4, 5], [1, 4], [2, 3], [3, 4], [0, 5], [2, 7], [1, 2], [6, 3], [0, 6], [5, 0], [0, 1], [6, 4], [2, 0], [5, 2]],king = [3, 3]) == [[2, 3], [0, 6], [3, 0], [3, 4], [4, 2], [5, 3]]\n assert candidate(queens = [[0, 0], [7, 7], [0, 7], [7, 0]],king = [3, 3]) == [[0, 0], [7, 7]]\n assert candidate(queens = [[0, 0], [1, 1], [2, 2], [3, 4], [3, 5], [4, 4], [4, 5]],king = [3, 3]) == [[2, 2], [3, 4], [4, 4]]\n assert candidate(queens = [[2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7]],king = [2, 4]) == [[2, 3], [2, 5]]\n assert candidate(queens = [[0, 3], [1, 4], [2, 5], [3, 6], [4, 7]],king = [3, 3]) == [[0, 3], [3, 6]]\n assert candidate(queens = [[4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [0, 0]],king = [4, 0]) == [[0, 0], [4, 1]]\n assert candidate(queens = [[7, 0], [6, 1], [5, 2], [4, 3], [3, 4], [2, 5], [1, 6], [0, 7]],king = [3, 3]) == [[3, 4], [4, 3]]\n assert candidate(queens = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7]],king = [0, 3]) == [[0, 2], [0, 4]]\n assert candidate(queens = [[1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [6, 3], [0, 3], [7, 3], [3, 0], [3, 1], [3, 2], [3, 4], [3, 5], [3, 6], [3, 7]],king = [3, 3]) == [[2, 3], [3, 2], [3, 4], [4, 3]]\n assert candidate(queens = [[3, 0], [3, 1], [3, 2], [3, 4], [3, 5], [3, 6], [3, 7], [0, 3], [1, 3], [2, 3], [4, 3], [5, 3], [6, 3], [7, 3]],king = [3, 3]) == [[2, 3], [3, 2], [3, 4], [4, 3]]\n assert candidate(queens = [[0, 4], [1, 5], [2, 6], [3, 7], [4, 0], [5, 1], [6, 2], [7, 3], [0, 3], [1, 2], [2, 1], [3, 0], [4, 7], [5, 6], [6, 5], [7, 4]],king = [3, 3]) == [[0, 3], [1, 5], [3, 0], [3, 7], [5, 1], [7, 3]]\n assert candidate(queens = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [1, 3], [2, 3], [3, 3], [4, 3], [1, 4], [2, 4], [3, 4], [1, 5], [2, 5], [3, 5], [1, 6], [2, 6], [3, 6], [1, 7], [2, 7], [3, 7]],king = [3, 3]) == [[2, 2], [2, 3], [2, 4], [3, 2], [3, 4], [4, 2], [4, 3]]\n assert candidate(queens = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0]],king = [3, 3]) == [[2, 3], [3, 4]]\n assert candidate(queens = [[0, 3], [1, 4], [2, 5], [3, 6], [4, 7], [5, 0], [6, 1], [7, 2], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 0], [7, 1]],king = [3, 3]) == [[1, 3], [2, 4], [3, 5], [6, 0]]\n assert candidate(queens = [[7, 7], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]],king = [3, 3]) == [[2, 2], [4, 4]]\n assert candidate(queens = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [0, 7], [1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7]],king = [3, 3]) == [[0, 0], [3, 0], [3, 7], [6, 0], [7, 7]]\n assert candidate(queens = [[0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [0, 2], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2], [0, 3], [1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [6, 3], [7, 3], [0, 4], [1, 4], [2, 4], [3, 4], [4, 4], [5, 4], [6, 4], [7, 4]],king = [3, 3]) == [[2, 2], [2, 3], [2, 4], [3, 2], [3, 4], [4, 2], [4, 3], [4, 4]]\n assert candidate(queens = [[1, 1], [1, 5], [5, 1], [5, 5], [2, 2], [2, 6], [6, 2], [6, 6], [3, 0], [3, 7], [4, 3], [7, 4]],king = [3, 3]) == [[2, 2], [1, 5], [3, 0], [3, 7], [5, 1], [4, 3], [5, 5]]\n assert candidate(queens = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 6], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 0], [7, 1]],king = [3, 3]) == [[2, 2], [2, 3], [2, 4], [3, 4], [6, 0], [4, 4]]\n assert candidate(queens = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [0, 0], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0]],king = [3, 3]) == [[2, 2], [3, 4], [4, 3], [4, 4]]\n assert candidate(queens = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0]],king = [3, 3]) == [[2, 3], [2, 4], [3, 4], [4, 2]]\n assert candidate(queens = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [0, 2], [1, 1], [2, 0]],king = [3, 3]) == [[1, 1], [2, 3], [3, 2], [3, 4], [4, 3]]\n assert candidate(queens = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [7, 0], [6, 1], [5, 2], [4, 3], [3, 4], [2, 5], [1, 6], [0, 7]],king = [3, 3]) == [[2, 2], [3, 4], [4, 3], [4, 4]]\n assert candidate(queens = [[1, 1], [1, 3], [2, 2], [3, 1], [3, 4], [4, 3], [5, 2], [6, 1], [6, 5], [7, 4]],king = [3, 3]) == [[2, 2], [1, 3], [3, 1], [3, 4], [4, 3]]\n assert candidate(queens = [[0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0], [0, 0], [7, 7], [1, 1], [6, 6], [2, 2], [5, 5], [3, 3]],king = [3, 3]) == [[2, 2], [3, 4], [4, 3], [5, 5]]\n assert candidate(queens = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [7, 0], [6, 1], [5, 2], [4, 3], [3, 4], [2, 5], [1, 6], [0, 7]],king = [3, 3]) == [[2, 2], [3, 4], [4, 3], [4, 4]]\n assert candidate(queens = [[0, 1], [1, 0], [1, 1], [2, 2], [2, 3], [3, 2], [3, 4], [4, 3], [4, 5], [5, 4], [5, 6], [6, 5], [6, 7], [7, 6]],king = [3, 3]) == [[2, 2], [2, 3], [3, 2], [3, 4], [4, 3]]\n assert candidate(queens = [[0, 1], [1, 0], [2, 3], [3, 2], [4, 5], [5, 4], [6, 7], [7, 6]],king = [3, 3]) == [[2, 3], [3, 2]]\n assert candidate(queens = [[7, 0], [6, 1], [5, 2], [4, 3], [3, 4], [2, 5], [1, 6], [0, 7]],king = [7, 7]) == [[0, 7], [7, 0]]\n assert candidate(queens = [[7, 0], [6, 1], [5, 2], [4, 3], [3, 4], [2, 5], [1, 6], [0, 7], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6]],king = [3, 3]) == [[2, 2], [3, 0], [3, 4], [6, 0], [4, 3], [4, 4]]\n assert candidate(queens = [[0, 2], [1, 5], [2, 7], [3, 0], [4, 6], [5, 1], [6, 3], [7, 4]],king = [3, 3]) == [[1, 5], [3, 0], [5, 1], [6, 3]]\n assert candidate(queens = [[3, 2], [2, 1], [1, 0], [4, 2], [5, 2], [6, 2], [7, 2], [2, 3], [2, 4], [2, 5], [2, 6]],king = [2, 2]) == [[2, 1], [2, 3], [3, 2]]\n assert candidate(queens = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [3, 1], [3, 2], [3, 3], [3, 4], [4, 1], [4, 2], [4, 3], [5, 1], [5, 2], [5, 3], [6, 1], [6, 2], [6, 3]],king = [3, 3]) == [[2, 2], [2, 3], [2, 4], [3, 2], [3, 4], [4, 2], [4, 3]]\n assert candidate(queens = [[0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 0], [7, 1]],king = [3, 3]) == [[1, 3], [2, 4], [3, 5], [6, 0]]\n assert candidate(queens = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [1, 0], [1, 7], [2, 0], [2, 7], [3, 0], [3, 7], [4, 0], [4, 7], [5, 0], [5, 7], [6, 0], [6, 7], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6], [7, 7]],king = [3, 3]) == [[0, 0], [0, 3], [0, 6], [3, 0], [3, 7], [6, 0], [7, 3], [7, 7]]\n assert candidate(queens = [[7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1], [0, 0]],king = [3, 3]) == [[2, 2], [4, 4]]\n assert candidate(queens = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0]],king = [3, 3]) == [[2, 2], [3, 4], [4, 3], [4, 4]]\n assert candidate(queens = [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0]],king = [0, 0]) == [[0, 1], [1, 0]]\n assert candidate(queens = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0]],king = [3, 3]) == [[2, 2], [3, 0], [6, 0], [4, 4]]\n assert candidate(queens = [[0, 1], [0, 5], [1, 0], [1, 7], [2, 2], [2, 6], [3, 3], [4, 2], [4, 4], [5, 1], [5, 5], [6, 0], [6, 7], [7, 3]],king = [3, 3]) == [[2, 2], [4, 2], [7, 3], [4, 4]]\n assert candidate(queens = [[1, 7], [2, 6], [3, 5], [4, 4], [5, 3], [6, 2], [7, 1]],king = [0, 0]) == [[4, 4]]\n assert candidate(queens = [[1, 1], [1, 6], [6, 1], [6, 6], [3, 2], [4, 4], [5, 3]],king = [3, 3]) == [[1, 1], [3, 2], [5, 3], [4, 4]]\n assert candidate(queens = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7]],king = [3, 4]) == [[0, 1], [0, 4], [0, 7], [3, 0], [7, 0]]\n assert candidate(queens = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]],king = [3, 3]) == [[2, 2], [4, 4]]\n assert candidate(queens = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0], [0, 2], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2]],king = [3, 3]) == [[2, 2], [3, 2], [3, 4], [4, 2], [4, 3], [4, 4]]\n assert candidate(queens = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0]],king = [3, 3]) == [[2, 2], [3, 0], [6, 0], [4, 4]]\n assert candidate(queens = [[0, 0], [0, 7], [7, 0], [7, 7], [3, 3], [2, 2], [4, 4], [5, 5], [1, 6], [6, 1]],king = [3, 3]) == [[2, 2], [4, 4]]\n assert candidate(queens = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]],king = [3, 3]) == [[2, 2], [0, 3], [0, 6], [4, 4]]\n assert candidate(queens = [[0, 0], [7, 7], [0, 7], [7, 0], [4, 4], [3, 3]],king = [3, 3]) == [[0, 0], [4, 4]]\n assert candidate(queens = [[1, 7], [7, 1], [2, 6], [6, 2], [3, 5], [5, 3], [4, 4], [0, 0], [7, 7], [0, 7], [7, 0]],king = [3, 3]) == [[0, 0], [3, 5], [5, 3], [4, 4]]\n assert candidate(queens = [[1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6]],king = [7, 7]) == [[6, 7], [7, 6]]\n assert candidate(queens = [[0, 0], [7, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1]],king = [3, 3]) == [[0, 0], [3, 4], [4, 3], [7, 7]]\n assert candidate(queens = [[0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0]],king = [7, 7]) == [[0, 7], [7, 0]]\n assert candidate(queens = [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 6], [7, 5], [7, 4], [7, 3], [7, 2], [7, 1]],king = [3, 3]) == [[0, 3], [0, 6], [3, 0], [3, 7], [6, 0], [7, 3]]\n assert candidate(queens = [[0, 2], [1, 4], [2, 6], [3, 0], [3, 7], [4, 1], [4, 5], [5, 3], [5, 7], [6, 0], [6, 4], [7, 2]],king = [3, 3]) == [[3, 0], [3, 7], [6, 0], [5, 3]]\n assert candidate(queens = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]],king = [0, 0]) == [[1, 1]]\n assert candidate(queens = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [0, 7], [1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7], [0, 1], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 1]],king = [3, 3]) == [[2, 2], [3, 0], [3, 7], [6, 0], [4, 4]]\n assert candidate(queens = [[0, 3], [2, 1], [4, 0], [5, 2], [6, 1], [7, 3], [1, 0], [1, 6], [3, 1], [3, 5], [5, 6], [6, 4]],king = [3, 3]) == [[0, 3], [3, 1], [3, 5], [7, 3]]\n assert candidate(queens = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1]],king = [0, 0]) == [[1, 1]]\n assert candidate(queens = [[0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0], [7, 1], [6, 2], [5, 3], [4, 4], [3, 5], [2, 6], [1, 7], [0, 6], [0, 5], [0, 4], [0, 3], [0, 2], [0, 1]],king = [3, 3]) == [[0, 3], [0, 6], [3, 4], [4, 3], [4, 4]]\n assert candidate(queens = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [0, 7], [1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7], [0, 2], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2]],king = [3, 3]) == [[2, 2], [3, 2], [3, 7], [4, 2], [7, 7]]\n assert candidate(queens = [[0, 3], [1, 3], [2, 3], [3, 2], [3, 3], [3, 4], [4, 3], [5, 3], [6, 3], [7, 3]],king = [3, 3]) == [[2, 3], [3, 2], [3, 4], [4, 3]]\n assert candidate(queens = [[1, 0], [1, 7], [2, 1], [2, 6], [3, 2], [3, 5], [4, 3], [4, 4], [5, 2], [5, 5], [6, 1], [6, 6], [7, 0], [7, 7]],king = [3, 3]) == [[3, 2], [3, 5], [4, 3], [4, 4]]\n assert candidate(queens = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0]],king = [3, 3]) == [[2, 2], [2, 3], [3, 4], [4, 4]]\n assert candidate(queens = [[0, 0], [1, 2], [2, 1], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [0, 1], [1, 0], [2, 3], [3, 2], [4, 5], [5, 4], [6, 7], [7, 6]],king = [3, 3]) == [[0, 0], [2, 3], [3, 2], [4, 4]]\n assert candidate(queens = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [1, 7], [2, 6], [3, 5], [4, 4], [5, 3], [6, 2], [7, 1]],king = [3, 3]) == [[3, 2], [3, 5], [4, 3], [4, 4]]\n assert candidate(queens = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 6], [6, 5], [5, 4], [4, 3], [3, 2], [2, 1], [1, 0]],king = [3, 3]) == [[2, 3], [3, 2], [3, 4], [4, 3]]\n assert candidate(queens = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0], [0, 7], [1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6]],king = [3, 3]) == [[2, 3], [3, 2], [3, 4], [4, 3]]\n assert candidate(queens = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [1, 7], [2, 6], [3, 5], [4, 4], [5, 3], [6, 2], [7, 1]],king = [3, 3]) == [[2, 3], [3, 2], [3, 4], [4, 3], [4, 4]]\n assert candidate(queens = [[0, 0], [0, 7], [7, 0], [7, 7], [3, 3], [4, 4], [2, 2], [5, 5], [1, 1], [6, 6], [0, 3], [3, 0], [3, 6], [6, 3]],king = [3, 3]) == [[2, 2], [0, 3], [3, 0], [3, 6], [6, 3], [4, 4]]\n assert candidate(queens = [[0, 0], [0, 4], [0, 7], [1, 1], [1, 3], [1, 5], [1, 7], [2, 2], [2, 4], [2, 6], [3, 0], [3, 2], [3, 6], [4, 1], [4, 3], [4, 5], [5, 0], [5, 2], [5, 4], [5, 7], [6, 1], [6, 3], [6, 5], [7, 0], [7, 3], [7, 7]],king = [3, 3]) == [[2, 2], [1, 3], [2, 4], [3, 2], [3, 6], [4, 3], [7, 7]]\n assert candidate(queens = [[0, 0], [0, 7], [7, 0], [7, 7], [1, 1], [1, 6], [6, 1], [6, 6], [2, 2], [2, 5], [5, 2], [5, 5], [3, 3]],king = [3, 3]) == [[2, 2], [5, 5]]\n assert candidate(queens = [[1, 2], [2, 4], [3, 6], [4, 0], [5, 1], [6, 3], [7, 5]],king = [4, 4]) == [[2, 4], [4, 0]]\n assert candidate(queens = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0], [7, 7], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [6, 6]],king = [3, 3]) == [[2, 3], [2, 4], [3, 0], [3, 4], [4, 2], [6, 6]]\n assert candidate(queens = [[1, 0], [0, 1], [2, 1], [1, 2], [0, 2], [2, 0], [3, 1], [2, 2], [1, 3], [0, 3], [3, 0], [4, 1], [3, 2], [2, 3], [1, 4], [0, 4]],king = [3, 3]) == [[2, 2], [2, 3], [3, 2]]\n assert candidate(queens = [[0, 4], [1, 3], [2, 2], [3, 1], [4, 0], [5, 7], [6, 6], [7, 5], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1]],king = [3, 3]) == [[2, 2], [1, 3], [2, 4], [3, 1], [3, 4], [4, 2], [4, 3], [6, 6]]\n assert candidate(queens = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [0, 7], [7, 0]],king = [3, 3]) == [[2, 2], [4, 4]]\n assert candidate(queens = [[0, 3], [1, 4], [2, 5], [3, 6], [4, 5], [5, 4], [6, 3], [7, 2]],king = [3, 3]) == [[0, 3], [3, 6], [6, 3]]\n assert candidate(queens = [[0, 0], [7, 7], [0, 7], [7, 0], [3, 3], [2, 2], [4, 4], [5, 5]],king = [3, 3]) == [[2, 2], [4, 4]]\n assert candidate(queens = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0], [6, 1], [7, 2]],king = [3, 3]) == [[2, 3], [3, 2], [3, 4]]\n assert candidate(queens = [[0, 3], [1, 3], [2, 3], [3, 0], [3, 1], [3, 2], [3, 4], [3, 5], [3, 6], [3, 7], [4, 3], [5, 3], [6, 3], [7, 3]],king = [3, 3]) == [[2, 3], [3, 2], [3, 4], [4, 3]]\n assert candidate(queens = [[0, 0], [7, 7], [7, 0], [0, 7], [3, 3], [4, 4], [3, 0], [0, 3]],king = [3, 3]) == [[0, 0], [0, 3], [3, 0], [4, 4]]\n assert candidate(queens = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1]],king = [3, 3]) == [[2, 2], [3, 4], [4, 3], [4, 4]]\n assert candidate(queens = [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4], [6, 5], [7, 6], [0, 7], [2, 0], [3, 1], [4, 2], [5, 3], [6, 4], [7, 5], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 0]],king = [3, 3]) == [[1, 3], [2, 4], [3, 2], [3, 5], [4, 2], [4, 3]]\n assert candidate(queens = [[0, 2], [1, 5], [2, 0], [3, 7], [4, 3], [5, 6], [6, 1], [7, 4]],king = [3, 3]) == [[1, 5], [3, 7], [4, 3]]\n assert candidate(queens = [[0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0]],king = [3, 3]) == [[3, 4], [4, 3]]\n assert candidate(queens = [[1, 1], [1, 6], [6, 1], [6, 6], [2, 2], [2, 5], [5, 2], [5, 5], [3, 4], [4, 3]],king = [3, 3]) == [[2, 2], [3, 4], [4, 3], [5, 5]]\n assert candidate(queens = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [7, 6], [6, 5], [5, 4], [4, 3], [3, 2], [2, 1], [1, 0]],king = [3, 3]) == [[2, 2], [3, 2], [4, 3], [4, 4]]\n assert candidate(queens = [[0, 1], [0, 4], [0, 6], [1, 2], [1, 5], [1, 7], [2, 0], [2, 3], [2, 5], [2, 7], [3, 1], [3, 2], [3, 4], [3, 6], [4, 0], [4, 3], [4, 5], [4, 7], [5, 1], [5, 2], [5, 4], [5, 6], [6, 0], [6, 3], [6, 5], [6, 7], [7, 1], [7, 4]],king = [3, 3]) == [[2, 3], [1, 5], [3, 2], [3, 4], [5, 1], [4, 3]]\n assert candidate(queens = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0], [0, 3], [1, 4], [2, 5], [3, 6], [4, 7], [5, 0], [6, 1], [7, 2]],king = [3, 3]) == [[2, 3], [3, 4]]\n assert candidate(queens = [[1, 2], [2, 4], [3, 6], [4, 0], [5, 1], [6, 3], [7, 5], [0, 6], [1, 0], [2, 3], [3, 2], [4, 5], [5, 4], [6, 7], [7, 1]],king = [3, 3]) == [[2, 3], [2, 4], [3, 2], [3, 6], [5, 1], [6, 3]]\n assert candidate(queens = [[0, 0], [0, 7], [7, 0], [7, 7], [1, 2], [1, 5], [6, 2], [6, 5], [2, 1], [2, 6], [5, 1], [5, 6], [3, 3]],king = [3, 3]) == [[0, 0], [1, 5], [5, 1], [7, 7]]\n"}, "metadata": {"canonical_parameter_names": ["queens", "king"], "leetcode_dataset_entry_point": "Solution().queensAttacktheKing", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var queensAttacktheKing = function(queens, king) {", "container": null, "callable": "queensAttacktheKing", "parameters": [{"name": "queens", "type": "number[][]"}, {"name": "king", "type": "number[]"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1223, "task_id": "dice-roll-simulation", "difficulty": "Hard", "problem_description": "A die simulator generates a random number from 1 to 6 for each roll. You introduced a constraint to the generator such that it cannot roll the number i more than rollMax[i] (1-indexed) consecutive times.\nGiven an array of integers rollMax and an integer n, return the number of distinct sequences that can be obtained with exact n rolls. Since the answer may be too large, return it modulo 109 + 7.\nTwo sequences are considered different if at least one element differs from each other.\n \nExample 1:\n\nInput: n = 2, rollMax = [1,1,2,2,2,3]\nOutput: 34\nExplanation: There will be 2 rolls of die, if there are no constraints on the die, there are 6 * 6 = 36 possible combinations. In this case, looking at rollMax array, the numbers 1 and 2 appear at most once consecutively, therefore sequences (1,1) and (2,2) cannot occur, so the final answer is 36-2 = 34.\n\nExample 2:\n\nInput: n = 2, rollMax = [1,1,1,1,1,1]\nOutput: 30\n\nExample 3:\n\nInput: n = 3, rollMax = [1,1,1,2,2,3]\nOutput: 181\n\n \nConstraints:\n\n1 <= n <= 5000\nrollMax.length == 6\n1 <= rollMax[i] <= 15\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 5,rollMax = [2, 2, 2, 2, 2, 2]) == 7200\n assert candidate(n = 1,rollMax = [1, 1, 1, 1, 1, 1]) == 6\n assert candidate(n = 1,rollMax = [15, 15, 15, 15, 15, 15]) == 6\n assert candidate(n = 10,rollMax = [2, 3, 4, 5, 6, 7]) == 58240426\n assert candidate(n = 2,rollMax = [1, 1, 2, 2, 2, 3]) == 34\n assert candidate(n = 2,rollMax = [1, 1, 1, 1, 1, 1]) == 30\n assert candidate(n = 5,rollMax = [1, 2, 3, 4, 5, 6]) == 6919\n assert candidate(n = 5,rollMax = [1, 1, 1, 1, 1, 1]) == 3750\n assert candidate(n = 4,rollMax = [1, 2, 3, 4, 5, 6]) == 1188\n assert candidate(n = 3,rollMax = [1, 1, 1, 2, 2, 3]) == 181\n assert candidate(n = 50,rollMax = [5, 5, 5, 5, 5, 5]) == 808684040\n assert candidate(n = 300,rollMax = [1, 1, 1, 15, 1, 15]) == 728503686\n assert candidate(n = 150,rollMax = [1, 2, 2, 3, 3, 4]) == 917820088\n assert candidate(n = 300,rollMax = [3, 3, 3, 3, 3, 3]) == 197968606\n assert candidate(n = 25,rollMax = [15, 14, 13, 12, 11, 10]) == 470351288\n assert candidate(n = 350,rollMax = [2, 3, 4, 5, 6, 7]) == 326686679\n assert candidate(n = 100,rollMax = [5, 5, 5, 5, 5, 5]) == 505697887\n assert candidate(n = 15,rollMax = [1, 1, 2, 2, 3, 3]) == 758892805\n assert candidate(n = 4,rollMax = [3, 2, 1, 2, 3, 4]) == 1176\n assert candidate(n = 150,rollMax = [5, 5, 5, 5, 5, 5]) == 488934088\n assert candidate(n = 10,rollMax = [1, 1, 1, 2, 3, 4]) == 27915907\n assert candidate(n = 50,rollMax = [2, 3, 4, 5, 6, 7]) == 197242731\n assert candidate(n = 10,rollMax = [2, 3, 1, 1, 4, 5]) == 36308544\n assert candidate(n = 50,rollMax = [3, 4, 5, 6, 7, 8]) == 753899520\n assert candidate(n = 400,rollMax = [1, 2, 1, 2, 1, 2]) == 987298539\n assert candidate(n = 200,rollMax = [2, 3, 4, 5, 6, 7]) == 221148447\n assert candidate(n = 50,rollMax = [1, 2, 1, 2, 1, 2]) == 825497499\n assert candidate(n = 50,rollMax = [1, 2, 3, 4, 5, 15]) == 992520282\n assert candidate(n = 200,rollMax = [2, 2, 2, 2, 2, 2]) == 818530237\n assert candidate(n = 10,rollMax = [1, 1, 1, 1, 1, 1]) == 11718750\n assert candidate(n = 100,rollMax = [10, 10, 10, 10, 10, 10]) == 568370197\n assert candidate(n = 30,rollMax = [1, 2, 1, 2, 1, 2]) == 679107530\n assert candidate(n = 100,rollMax = [1, 1, 2, 2, 3, 3]) == 12398650\n assert candidate(n = 100,rollMax = [1, 1, 1, 1, 1, 1]) == 776377743\n assert candidate(n = 400,rollMax = [15, 14, 13, 12, 11, 10]) == 379975553\n assert candidate(n = 20,rollMax = [5, 5, 5, 5, 5, 5]) == 703140572\n assert candidate(n = 100,rollMax = [1, 1, 2, 2, 3, 3]) == 12398650\n assert candidate(n = 20,rollMax = [2, 3, 4, 5, 6, 7]) == 412603689\n assert candidate(n = 400,rollMax = [4, 4, 4, 4, 4, 4]) == 418009264\n assert candidate(n = 150,rollMax = [7, 6, 5, 4, 3, 2]) == 3950632\n assert candidate(n = 40,rollMax = [3, 1, 2, 4, 1, 3]) == 255974937\n"}, "metadata": {"canonical_parameter_names": ["n", "rollMax"], "leetcode_dataset_entry_point": "Solution().dieSimulator", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var dieSimulator = function(n, rollMax) {", "container": null, "callable": "dieSimulator", "parameters": [{"name": "n", "type": "number"}, {"name": "rollMax", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1224, "task_id": "maximum-equal-frequency", "difficulty": "Hard", "problem_description": "Given an array nums of positive integers, return the longest possible length of an array prefix of nums, such that it is possible to remove exactly one element from this prefix so that every number that has appeared in it will have the same number of occurrences.\nIf after removing one element there are no remaining elements, it's still considered that every appeared number has the same number of ocurrences (0).\n \nExample 1:\n\nInput: nums = [2,2,1,1,5,3,3,5]\nOutput: 7\nExplanation: For the subarray [2,2,1,1,5,3,3] of length 7, if we remove nums[4] = 5, we will get [2,2,1,1,3,3], so that each number will appear exactly twice.\n\nExample 2:\n\nInput: nums = [1,1,1,2,2,2,3,3,3,4,4,4,5]\nOutput: 13\n\n \nConstraints:\n\n2 <= nums.length <= 105\n1 <= nums[i] <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 10, 10, 10, 1, 1, 1, 2, 2, 3]) == 7\n assert candidate(nums = [1, 2, 2, 2, 1, 1]) == 5\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == 7\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10]) == 11\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4]) == 7\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 20\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 3, 3, 4]) == 7\n assert candidate(nums = [10, 2, 8, 9, 3, 8, 1, 5, 2, 3, 7, 6]) == 8\n assert candidate(nums = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 21\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 19\n assert candidate(nums = [100000, 100000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 12\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1]) == 11\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == 5\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5]) == 13\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 10\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 17\n assert candidate(nums = [2, 2, 1, 1, 5, 3, 3, 5]) == 7\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 11\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == 5\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7]) == 7\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 41\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20]) == 21\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 21\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 9, 9, 9]) == 5\n assert candidate(nums = [10, 20, 20, 30, 30, 30, 40, 40, 40, 40, 50, 50, 50, 50, 50, 60, 60, 60, 60, 60, 60]) == 5\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6]) == 11\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 10\n assert candidate(nums = [2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 9\n assert candidate(nums = [10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15]) == 7\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 16\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 19\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 30\n assert candidate(nums = [7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9]) == 25\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6]) == 7\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10]) == 28\n assert candidate(nums = [10, 20, 20, 30, 30, 30, 40, 40, 40, 40, 50, 50, 50, 50, 50]) == 5\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 15, 15, 15]) == 46\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7]) == 5\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5]) == 7\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 25\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == 29\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 40\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 32\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == 5\n assert candidate(nums = [2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8]) == 7\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9]) == 19\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) == 5\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 22\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 39\n assert candidate(nums = [1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 7\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 21\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30]) == 31\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 2, 2]) == 21\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12]) == 45\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 36\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11]) == 41\n assert candidate(nums = [1, 2, 3, 2, 1, 4, 5, 6, 5, 4, 3, 2, 1, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 11\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2]) == 31\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 7\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == 31\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 21\n assert candidate(nums = [1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5]) == 9\n assert candidate(nums = [100000, 100000, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8]) == 11\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10]) == 31\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 19\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 10\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14]) == 27\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 41\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 25\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 33\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 16\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5]) == 7\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 21\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10]) == 5\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 28\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8]) == 5\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 7\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 21\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 7\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30]) == 59\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 21\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 11\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10]) == 21\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 22\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 21\n assert candidate(nums = [1, 2, 3, 4, 5, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5]) == 21\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 16\n assert candidate(nums = [10, 20, 20, 10, 30, 30, 30, 40, 40, 40, 40, 50, 50, 50, 50, 50, 60, 60, 60, 60, 60, 60]) == 9\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9]) == 7\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 6]) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 21\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == 7\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 9\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5]) == 10\n assert candidate(nums = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 17\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().maxEqualFreq", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxEqualFreq = function(nums) {", "container": null, "callable": "maxEqualFreq", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1227, "task_id": "airplane-seat-assignment-probability", "difficulty": "Medium", "problem_description": "n passengers board an airplane with exactly n seats. The first passenger has lost the ticket and picks a seat randomly. But after that, the rest of the passengers will:\n\nTake their own seat if it is still available, and\nPick other seats randomly when they find their seat occupied\n\nReturn the probability that the nth person gets his own seat.\n \nExample 1:\n\nInput: n = 1\nOutput: 1.00000\nExplanation: The first person can only get the first seat.\nExample 2:\n\nInput: n = 2\nOutput: 0.50000\nExplanation: The second person has a probability of 0.5 to get the second seat (when first person gets the first seat).\n\n \nConstraints:\n\n1 <= n <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 3) == 0.5\n assert candidate(n = 100000) == 0.5\n assert candidate(n = 100) == 0.5\n assert candidate(n = 10000) == 0.5\n assert candidate(n = 2) == 0.5\n assert candidate(n = 1) == 1\n assert candidate(n = 1000) == 0.5\n assert candidate(n = 10) == 0.5\n assert candidate(n = 99999) == 0.5\n assert candidate(n = 2000) == 0.5\n assert candidate(n = 50000) == 0.5\n assert candidate(n = 50) == 0.5\n assert candidate(n = 5) == 0.5\n assert candidate(n = 10001) == 0.5\n assert candidate(n = 250000) == 0.5\n assert candidate(n = 4) == 0.5\n assert candidate(n = 750000) == 0.5\n assert candidate(n = 1001) == 0.5\n assert candidate(n = 200000) == 0.5\n assert candidate(n = 101) == 0.5\n assert candidate(n = 20000) == 0.5\n assert candidate(n = 5000) == 0.5\n assert candidate(n = 20) == 0.5\n assert candidate(n = 9999) == 0.5\n assert candidate(n = 50001) == 0.5\n assert candidate(n = 2500) == 0.5\n assert candidate(n = 500000) == 0.5\n assert candidate(n = 200) == 0.5\n assert candidate(n = 99998) == 0.5\n assert candidate(n = 1000000) == 0.5\n assert candidate(n = 100001) == 0.5\n assert candidate(n = 500) == 0.5\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().nthPersonGetsNthSeat", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var nthPersonGetsNthSeat = function(n) {", "container": null, "callable": "nthPersonGetsNthSeat", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1232, "task_id": "check-if-it-is-a-straight-line", "difficulty": "Easy", "problem_description": "You are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight line in the XY plane.\n \n \nExample 1:\n\n\nInput: coordinates = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]]\nOutput: true\n\nExample 2:\n\n\nInput: coordinates = [[1,1],[2,2],[3,4],[4,5],[5,6],[7,7]]\nOutput: false\n\n \nConstraints:\n\n2 <= coordinates.length <= 1000\ncoordinates[i].length == 2\n-10^4 <= coordinates[i][0], coordinates[i][1] <= 10^4\ncoordinates contains no duplicate point.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(coordinates = [[0, 0], [0, 1], [0, 2], [0, 3]]) == True\n assert candidate(coordinates = [[-10000, -10000], [0, 0], [10000, 10000]]) == True\n assert candidate(coordinates = [[-4, -3], [1, 0], [3, -1], [0, -1], [-5, 2]]) == False\n assert candidate(coordinates = [[0, 0], [5, 5], [10, 10], [15, 15]]) == True\n assert candidate(coordinates = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 4]]) == False\n assert candidate(coordinates = [[1, 1], [2, 2], [3, 5]]) == False\n assert candidate(coordinates = [[1, 1], [2, 2], [3, 4], [4, 5], [5, 6], [7, 7]]) == False\n assert candidate(coordinates = [[-1, 0], [0, 1], [1, 2], [2, 3]]) == True\n assert candidate(coordinates = [[1, 2], [2, 1], [3, 0], [4, -1], [5, -2]]) == True\n assert candidate(coordinates = [[-1, -1], [0, 0], [1, 1], [2, 2], [3, 3]]) == True\n assert candidate(coordinates = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6]]) == True\n assert candidate(coordinates = [[0, 0], [1, 1], [2, 2], [3, 3]]) == True\n assert candidate(coordinates = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7]]) == True\n assert candidate(coordinates = [[1, 1], [2, 2], [2, 3]]) == False\n assert candidate(coordinates = [[-4, -3], [-1, 1], [2, 5], [5, 9]]) == True\n assert candidate(coordinates = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == True\n assert candidate(coordinates = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8]]) == True\n assert candidate(coordinates = [[-1, -1], [0, 0], [1, 1], [2, 2]]) == True\n assert candidate(coordinates = [[0, 1], [1, 3], [-1, -1], [2, 5]]) == True\n assert candidate(coordinates = [[1, 1], [2, 2], [3, 3], [4, 6]]) == False\n assert candidate(coordinates = [[1, 2], [2, 3], [3, 5]]) == False\n assert candidate(coordinates = [[-1, 0], [0, 1], [1, 0], [2, 1], [3, 0]]) == False\n assert candidate(coordinates = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5]]) == True\n assert candidate(coordinates = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]]) == True\n assert candidate(coordinates = [[-1, 0], [0, 1], [1, 2], [2, 3], [3, 4]]) == True\n assert candidate(coordinates = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == True\n assert candidate(coordinates = [[10, 5], [15, 10], [20, 15], [25, 20]]) == True\n assert candidate(coordinates = [[10000, 10000], [5000, 5000], [0, 0]]) == True\n assert candidate(coordinates = [[2, 4], [2, 5], [2, 6]]) == True\n assert candidate(coordinates = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4]]) == True\n assert candidate(coordinates = [[-1, 0], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == True\n assert candidate(coordinates = [[5, -10], [10, -5], [15, 0], [20, 5], [25, 10]]) == True\n assert candidate(coordinates = [[-1, -2], [-2, -3], [-3, -4], [-4, -5], [-5, -6]]) == True\n assert candidate(coordinates = [[-10, 5], [-5, 10], [0, 15], [5, 20], [10, 25], [15, 30], [20, 35], [25, 40]]) == True\n assert candidate(coordinates = [[-2, -4], [-1, -2], [0, 0], [1, 2], [2, 4]]) == True\n assert candidate(coordinates = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10]]) == True\n assert candidate(coordinates = [[1000, 2000], [2000, 4000], [3000, 6000], [4000, 8000], [5000, 10000]]) == True\n assert candidate(coordinates = [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100], [60, 120]]) == True\n assert candidate(coordinates = [[1, 2], [2, 3], [4, 5], [5, 6], [7, 8], [8, 9], [10, 11]]) == True\n assert candidate(coordinates = [[-5, -20], [0, -10], [5, 0], [10, 10], [15, 20]]) == True\n assert candidate(coordinates = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 8]]) == False\n assert candidate(coordinates = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14]]) == True\n assert candidate(coordinates = [[-1, -2], [-2, -4], [-3, -6], [-4, -8], [-5, -10]]) == True\n assert candidate(coordinates = [[-10, 15], [-5, 10], [0, 5], [5, 0], [10, -5], [15, -10]]) == True\n assert candidate(coordinates = [[2, 2], [4, 4], [6, 6], [8, 8], [10, 10], [12, 12], [14, 14], [16, 16]]) == True\n assert candidate(coordinates = [[1, 3], [2, 5], [3, 7], [4, 9], [5, 11]]) == True\n assert candidate(coordinates = [[-2, 3], [-1, 4], [0, 5], [1, 6], [2, 7], [3, 8], [4, 9], [5, 10]]) == True\n assert candidate(coordinates = [[10000, 10000], [5000, 5000], [0, 0], [-5000, -5000], [-10000, -10000]]) == True\n assert candidate(coordinates = [[-20, -30], [-10, -15], [0, 0], [10, 15], [20, 30]]) == True\n assert candidate(coordinates = [[-5, 5], [-10, 10], [-15, 15], [-20, 20], [-25, 25], [-30, 30]]) == True\n assert candidate(coordinates = [[1, 1], [2, 3], [3, 5], [4, 7], [5, 9], [6, 11], [7, 13], [8, 15]]) == True\n assert candidate(coordinates = [[-5, -10], [0, 0], [5, 10], [10, 20], [15, 30]]) == True\n assert candidate(coordinates = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0]]) == True\n assert candidate(coordinates = [[10, 5], [20, 10], [30, 15], [40, 20], [50, 25], [60, 30], [70, 35]]) == True\n assert candidate(coordinates = [[-3, -3], [-2, -2], [-1, -1], [0, 0], [1, 1], [2, 2], [3, 3]]) == True\n assert candidate(coordinates = [[-2, 1], [-1, 3], [0, 5], [1, 7], [2, 9], [3, 11]]) == True\n assert candidate(coordinates = [[0, -10000], [10000, -10000], [20000, -10000], [30000, -10000]]) == True\n assert candidate(coordinates = [[-4, -2], [-2, 0], [0, 2], [2, 4], [4, 6]]) == True\n assert candidate(coordinates = [[-100, 100], [-50, 150], [0, 200], [50, 250], [100, 300]]) == True\n assert candidate(coordinates = [[-2, 2], [0, 0], [2, -2], [4, -4], [6, -6]]) == True\n assert candidate(coordinates = [[-1, -2], [1, 0], [3, 2], [5, 4], [7, 6], [9, 8]]) == True\n assert candidate(coordinates = [[-10, 15], [-5, 10], [0, 5], [5, 0], [10, -5]]) == True\n assert candidate(coordinates = [[5, 0], [5, 1], [5, 2], [5, 3], [5, 4]]) == True\n assert candidate(coordinates = [[0, -10], [0, -5], [0, 0], [0, 5], [0, 10], [0, 15]]) == True\n assert candidate(coordinates = [[100, 200], [200, 400], [300, 600], [400, 800], [500, 1000]]) == True\n assert candidate(coordinates = [[0, 1], [1, 3], [2, 5], [3, 7], [4, 9]]) == True\n assert candidate(coordinates = [[-3, 7], [-2, 5], [-1, 3], [0, 1], [1, -1], [2, -3]]) == True\n assert candidate(coordinates = [[-1, -2], [1, 0], [3, 2], [5, 4], [7, 6], [9, 8], [11, 10]]) == True\n assert candidate(coordinates = [[-5, -5], [0, -2.5], [5, 0], [10, 2.5], [15, 5]]) == True\n assert candidate(coordinates = [[-500, 500], [-250, 750], [0, 1000], [250, 1250], [500, 1500]]) == True\n assert candidate(coordinates = [[0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1]]) == True\n assert candidate(coordinates = [[-1, 0], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5]]) == True\n assert candidate(coordinates = [[-10, 0], [-5, 0], [0, 0], [5, 0], [10, 0], [15, 0]]) == True\n assert candidate(coordinates = [[-2, -1], [0, 0], [2, 1], [4, 2], [6, 3], [8, 4]]) == True\n assert candidate(coordinates = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == True\n assert candidate(coordinates = [[-2, -3], [-1, -1], [0, 1], [1, 3], [2, 5], [3, 7]]) == True\n assert candidate(coordinates = [[-3, -3], [-2, -2], [-1, -1], [0, 0], [1, 1], [2, 2], [3, 3]]) == True\n assert candidate(coordinates = [[-100, 200], [-200, 400], [-300, 600], [-400, 800], [-500, 1000]]) == True\n assert candidate(coordinates = [[-5, -10], [0, 0], [5, 10], [10, 20], [15, 30]]) == True\n assert candidate(coordinates = [[-5, -10], [-4, -8], [-3, -6], [-2, -4], [-1, -2], [0, 0]]) == True\n assert candidate(coordinates = [[-5, -5], [0, 0], [5, 5], [10, 10], [15, 15], [20, 20]]) == True\n assert candidate(coordinates = [[-100, 100], [-50, 50], [0, 0], [50, -50], [100, -100]]) == True\n assert candidate(coordinates = [[-5, 5], [-4, 4], [-3, 3], [-2, 2], [-1, 1], [0, 0]]) == True\n assert candidate(coordinates = [[-100, -100], [-50, -50], [0, 0], [50, 50], [100, 100]]) == True\n assert candidate(coordinates = [[-5, 5], [0, 10], [5, 15], [10, 20], [15, 25], [20, 30], [25, 35]]) == True\n assert candidate(coordinates = [[100, -200], [200, -400], [300, -600], [400, -800], [500, -1000]]) == True\n assert candidate(coordinates = [[1, 3], [2, 5], [3, 7], [4, 9], [5, 11], [6, 13], [7, 15], [8, 17], [9, 19], [10, 21]]) == True\n assert candidate(coordinates = [[-1, -2], [-2, -4], [-3, -6], [-4, -8], [-5, -10]]) == True\n assert candidate(coordinates = [[100, 100], [200, 200], [300, 300], [400, 401], [500, 500]]) == False\n assert candidate(coordinates = [[-100, 100], [100, -100], [0, 0]]) == True\n assert candidate(coordinates = [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]) == True\n assert candidate(coordinates = [[-3, 3], [-6, 6], [-9, 9], [-12, 12], [-15, 15]]) == True\n assert candidate(coordinates = [[-1, 0], [0, 1], [1, 0], [0, -1], [-1, 0]]) == False\n assert candidate(coordinates = [[-10, -20], [0, 0], [10, 20], [20, 40], [30, 60]]) == True\n assert candidate(coordinates = [[1, 1], [3, 5], [5, 9], [7, 13], [9, 17]]) == True\n assert candidate(coordinates = [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]) == True\n assert candidate(coordinates = [[-1, -5], [0, -2], [1, 1], [2, 4], [3, 7], [4, 10]]) == True\n assert candidate(coordinates = [[0, 1000], [1000, 1000], [2000, 1000], [3000, 1000], [4000, 1000]]) == True\n assert candidate(coordinates = [[-2, -3], [-1, -1], [0, 1], [1, 3], [2, 5]]) == True\n assert candidate(coordinates = [[1, 2], [2, 4], [4, 8], [8, 16], [16, 32], [32, 64]]) == True\n assert candidate(coordinates = [[-100, -200], [-200, -400], [-300, -600], [-400, -800], [-500, -1000]]) == True\n assert candidate(coordinates = [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10], [6, 12], [7, 14]]) == True\n assert candidate(coordinates = [[1, 2], [4, 6], [7, 10], [10, 14], [13, 18], [16, 22], [19, 26]]) == True\n assert candidate(coordinates = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50]]) == True\n assert candidate(coordinates = [[-3, -6], [1, -2], [5, 2], [7, 3]]) == False\n assert candidate(coordinates = [[-100, 0], [0, 0], [100, 0], [200, 0], [300, 0]]) == True\n assert candidate(coordinates = [[-1000, 2000], [0, 0], [1000, -2000]]) == True\n assert candidate(coordinates = [[-5, -10], [0, 0], [5, 10], [10, 20], [15, 30], [20, 40]]) == True\n assert candidate(coordinates = [[-10, 0], [0, 5], [10, 10], [20, 15], [30, 20], [40, 25], [50, 30], [60, 35]]) == True\n assert candidate(coordinates = [[-1, 1], [0, 0], [1, -1], [2, -2], [3, -3]]) == True\n assert candidate(coordinates = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == True\n assert candidate(coordinates = [[0, 0], [1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]) == True\n assert candidate(coordinates = [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5]]) == True\n assert candidate(coordinates = [[-10, -10], [-5, -5], [0, 0], [5, 5], [10, 10]]) == True\n assert candidate(coordinates = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]) == True\n assert candidate(coordinates = [[0, 1], [1, 2], [2, 3], [3, 5], [4, 6], [5, 8]]) == False\n assert candidate(coordinates = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 15]]) == False\n assert candidate(coordinates = [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70], [70, 80]]) == True\n assert candidate(coordinates = [[-1, -1], [1, 1], [3, 3], [5, 5], [7, 7], [9, 9]]) == True\n assert candidate(coordinates = [[-1000, 0], [-500, 0], [0, 0], [500, 0], [1000, 0]]) == True\n assert candidate(coordinates = [[-10000, 10000], [-5000, 10000], [0, 10000], [5000, 10000], [10000, 10000]]) == True\n assert candidate(coordinates = [[5, 3], [10, 6], [15, 9], [20, 12], [25, 15]]) == True\n assert candidate(coordinates = [[1, 1], [2, 2], [3, 3], [4, 3], [5, 5]]) == False\n assert candidate(coordinates = [[-2, 4], [-1, 2], [0, 0], [1, -2], [2, -4]]) == True\n assert candidate(coordinates = [[0, 5], [1, 5], [2, 5], [3, 5], [4, 5]]) == True\n"}, "metadata": {"canonical_parameter_names": ["coordinates"], "leetcode_dataset_entry_point": "Solution().checkStraightLine", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var checkStraightLine = function(coordinates) {", "container": null, "callable": "checkStraightLine", "parameters": [{"name": "coordinates", "type": "number[][]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1233, "task_id": "remove-sub-folders-from-the-filesystem", "difficulty": "Medium", "problem_description": "Given a list of folders folder, return the folders after removing all sub-folders in those folders. You may return the answer in any order.\nIf a folder[i] is located within another folder[j], it is called a sub-folder of it. A sub-folder of folder[j] must start with folder[j], followed by a \"/\". For example, \"/a/b\" is a sub-folder of \"/a\", but \"/b\" is not a sub-folder of \"/a/b/c\".\nThe format of a path is one or more concatenated strings of the form: '/' followed by one or more lowercase English letters.\n\nFor example, \"/leetcode\" and \"/leetcode/problems\" are valid paths while an empty string and \"/\" are not.\n\n \nExample 1:\n\nInput: folder = [\"/a\",\"/a/b\",\"/c/d\",\"/c/d/e\",\"/c/f\"]\nOutput: [\"/a\",\"/c/d\",\"/c/f\"]\nExplanation: Folders \"/a/b\" is a subfolder of \"/a\" and \"/c/d/e\" is inside of folder \"/c/d\" in our filesystem.\n\nExample 2:\n\nInput: folder = [\"/a\",\"/a/b/c\",\"/a/b/d\"]\nOutput: [\"/a\"]\nExplanation: Folders \"/a/b/c\" and \"/a/b/d\" will be removed because they are subfolders of \"/a\".\n\nExample 3:\n\nInput: folder = [\"/a/b/c\",\"/a/b/ca\",\"/a/b/d\"]\nOutput: [\"/a/b/c\",\"/a/b/ca\",\"/a/b/d\"]\n\n \nConstraints:\n\n1 <= folder.length <= 4 * 104\n2 <= folder[i].length <= 100\nfolder[i] contains only lowercase letters and '/'.\nfolder[i] always starts with the character '/'.\nEach folder name is unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(folder = ['/a', '/a/b', '/c/d', '/c/d/e', '/c/f']) == ['/a', '/c/d', '/c/f']\n assert candidate(folder = ['/a', '/a/b/c', '/a/b/d']) == ['/a']\n assert candidate(folder = ['/m', '/m/n/o', '/m/n', '/p/q', '/p/q/r/s', '/p/q/t']) == ['/m', '/p/q']\n assert candidate(folder = ['/one', '/one/two', '/three', '/three/four', '/three/four/five']) == ['/one', '/three']\n assert candidate(folder = ['/a/b/c', '/a/b/ca', '/a/b/d']) == ['/a/b/c', '/a/b/ca', '/a/b/d']\n assert candidate(folder = ['/x', '/x/y/z', '/x/y', '/z/a', '/z/a/b']) == ['/x', '/z/a']\n assert candidate(folder = ['/x', '/x/y', '/x/y/z', '/x/y/za', '/w']) == ['/w', '/x']\n assert candidate(folder = ['/a', '/a/b/c', '/a/b/d']) == ['/a']\n assert candidate(folder = ['/x', '/x/y/z', '/x/y', '/z', '/z/w']) == ['/x', '/z']\n assert candidate(folder = ['/x', '/x/y/z', '/x/y', '/w']) == ['/w', '/x']\n assert candidate(folder = ['/a/b/c', '/a/b/ca', '/a/b/d']) == ['/a/b/c', '/a/b/ca', '/a/b/d']\n assert candidate(folder = ['/one/two/three', '/one/two/three/four', '/one', '/two/three']) == ['/one', '/two/three']\n assert candidate(folder = ['/m/n', '/m/no', '/m/no/p', '/m/no/qr', '/m/ns']) == ['/m/n', '/m/no', '/m/ns']\n assert candidate(folder = ['/a', '/a/b', '/c/d', '/c/d/e', '/c/f']) == ['/a', '/c/d', '/c/f']\n assert candidate(folder = ['/x/y/z', '/x/y/z/alpha', '/x/y/z/beta', '/x/y/z/gamma/delta', '/x/y/z/gamma/epsilon']) == ['/x/y/z']\n assert candidate(folder = ['/x/y/z', '/x/y/z1', '/x/y1/z', '/x1/y/z']) == ['/x/y/z', '/x/y/z1', '/x/y1/z', '/x1/y/z']\n assert candidate(folder = ['/var/log/nginx/access.log', '/var/log/nginx/error.log', '/var/log/syslog', '/var/log/auth.log', '/var/log/dpkg.log']) == ['/var/log/auth.log', '/var/log/dpkg.log', '/var/log/nginx/access.log', '/var/log/nginx/error.log', '/var/log/syslog']\n assert candidate(folder = ['/home', '/home/user', '/home/user/projects', '/home/user/projects/work', '/home/user/projects/personal', '/home/user/projects/work/client_a', '/home/user/projects/work/client_b', '/home/user/downloads']) == ['/home']\n assert candidate(folder = ['/x/y/z', '/x/y', '/x/y/z/a', '/x/y/z/b/c', '/w/x/y/z', '/w/x/y']) == ['/w/x/y', '/x/y']\n assert candidate(folder = ['/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30', '/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29', '/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28', '/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27', '/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26', '/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/32/33/34/35/36/37/38/39/40/41/42/43/44/45/46/47/48/49/50']) == ['/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26']\n assert candidate(folder = ['/lib/modules/5.4.0-generic', '/lib/modules/5.4.0-generic/kernel', '/lib/modules/5.4.0-generic/kernel/net', '/lib/modules/5.4.0-generic/kernel/net/core', '/lib/modules/5.4.0-generic/kernel/net/ipv4']) == ['/lib/modules/5.4.0-generic']\n assert candidate(folder = ['/level1/level2/level3/level4', '/level1/level2/level3', '/level1/level2/level3/level5', '/level1/level2/other']) == ['/level1/level2/level3', '/level1/level2/other']\n assert candidate(folder = ['/root/user/documents', '/root/user/documents/reports', '/root/user/images', '/root/user/images/profile']) == ['/root/user/documents', '/root/user/images']\n assert candidate(folder = ['/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n', '/a/b/c/d/e/f/g/h/i/j/k/l/m', '/a/b/c/d/e/f/g/h/i/j/k/l', '/a/b/c/d/e/f/g/h/i/j/k', '/a/b/c/d/e/f/g/h/i/j', '/a/b/c/d/e/f/g/h/i', '/a/b/c/d/e/f/g/h', '/a/b/c/d/e/f/g', '/a/b/c/d/e/f', '/a/b/c/d/e', '/a/b/c/d', '/a/b/c', '/a/b', '/a']) == ['/a']\n assert candidate(folder = ['/var/log', '/var/log/syslog', '/var/log/user.log', '/var/log/nginx', '/var/log/nginx/access.log', '/var/log/nginx/error.log', '/var/log/audit', '/var/log/audit/audit.log']) == ['/var/log']\n assert candidate(folder = ['/home/user/projects/website/client', '/home/user/projects/website/server', '/home/user/projects/website', '/home/user/projects/api', '/home/user/projects/api/v1', '/home/user/projects/api/v2', '/home/user']) == ['/home/user']\n assert candidate(folder = ['/library/books', '/library/books/fiction', '/library/books/fiction/scifi', '/library/books/fiction/scifi/fantasy', '/library/books/fiction/romance', '/library/books/nonfiction', '/library/books/nonfiction/biography', '/library/books/nonfiction/history']) == ['/library/books']\n assert candidate(folder = ['/a/1/2/3', '/a/1/2/3/4', '/a/1/2/3/4/5', '/a/1/2/3/4/5/6', '/a/1/2/3/7']) == ['/a/1/2/3']\n assert candidate(folder = ['/folder1/folder2/folder3', '/folder1/folder2/folder3/folder4', '/folder1/folder2/folder3/folder4/folder5', '/folder1/folder2/folder3a', '/folder1/folder2a/folder3']) == ['/folder1/folder2/folder3', '/folder1/folder2/folder3a', '/folder1/folder2a/folder3']\n assert candidate(folder = ['/m/n/o/p/q/r/s/t/u/v', '/m/n/o/p/q/r/s/t/u/v/w/x/y/z', '/m/n/o/p/q/r/s/t/u', '/m/n/o/p', '/m/n/o/p/q']) == ['/m/n/o/p']\n assert candidate(folder = ['/books/science', '/books/science/physics', '/books/science/chemistry', '/books/science/biology', '/books/history', '/books/history/europe', '/books/history/asia']) == ['/books/history', '/books/science']\n assert candidate(folder = ['/alpha/beta/gamma/delta/epsilon/phi/chi', '/alpha/beta/gamma/delta/epsilon/phi/chi/psi', '/alpha/beta/gamma/delta/epsilon/phi/chi/psi/omega', '/alpha/beta/gamma/delta/epsilon/phi/theta']) == ['/alpha/beta/gamma/delta/epsilon/phi/chi', '/alpha/beta/gamma/delta/epsilon/phi/theta']\n assert candidate(folder = ['/system/logs/2023/01/01', '/system/logs/2023/01', '/system/logs/2023/02/01', '/system/logs/2023/02', '/system/logs/2023', '/system/config']) == ['/system/config', '/system/logs/2023']\n assert candidate(folder = ['/a1/b1/c1/d1/e1/f1/g1/h1/i1/j1/k1/l1/m1/n1/o1/p1/q1/r1/s1/t1/u1/v1/w1/x1/y1/z1', '/a1/b1/c1/d1/e1/f1/g1/h1/i1/j1/k1/l1/m1/n1/o1/p1/q1/r1/s1/t1/u1/v1/w1/x1/y1/z1/a2', '/a1/b1/c1/d1/e1/f1/g1/h1/i1/j1/k1/l1/m1/n1/o1/p1/q1/r1/s1/t1/u1/v1/w1/x1/y1/z1/a2/b2', '/a1/b1/c1/d1/e1/f1/g1/h1/i1/j1/k1/l1/m1/n1/o1/p1/q1/r1/s1/t1/u1/v1/w1/x1/y1/z1/a2/b2/c2']) == ['/a1/b1/c1/d1/e1/f1/g1/h1/i1/j1/k1/l1/m1/n1/o1/p1/q1/r1/s1/t1/u1/v1/w1/x1/y1/z1']\n assert candidate(folder = ['/home/user/data/2020', '/home/user/data/2020/01', '/home/user/data/2020/02', '/home/user/data/2019', '/home/user/data/2020/01/report1', '/home/user/data/2020/01/report2']) == ['/home/user/data/2019', '/home/user/data/2020']\n assert candidate(folder = ['/root/user/documents', '/root/user/documents/projects', '/root/user/downloads', '/root/user/downloads/archive', '/root/user/downloads/archive/old']) == ['/root/user/documents', '/root/user/downloads']\n assert candidate(folder = ['/home/user1', '/home/user1/projects', '/home/user1/projects/python', '/home/user1/projects/java', '/home/user2', '/home/user2/music', '/home/user2/music/genres', '/home/user2/music/genres/classic']) == ['/home/user1', '/home/user2']\n assert candidate(folder = ['/root/level1/level2/level3/level4', '/root/level1/level2/level3', '/root/level1/level2', '/root/level1', '/root']) == ['/root']\n assert candidate(folder = ['/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10', '/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9', '/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8', '/dir1/dir2/dir3/dir4/dir5/dir6/dir7', '/dir1/dir2/dir3/dir4/dir5/dir6', '/dir1/dir2/dir3/dir4/dir5', '/dir1/dir2/dir3/dir4', '/dir1/dir2/dir3', '/dir1/dir2', '/dir1']) == ['/dir1']\n assert candidate(folder = ['/root/user/docs', '/root/user/docs/2020', '/root/user/docs/2021', '/root/user/docs/2020/financials', '/root/user/docs/2020/financials/quarter1']) == ['/root/user/docs']\n assert candidate(folder = ['/deep/nested/folder/structure/here', '/deep/nested/folder/structure/here/is', '/deep/nested/folder/structure/here/is/a', '/deep/nested/folder/structure/here/is/a/test', '/deep/nested/folder/structure/here/is/a/test/file']) == ['/deep/nested/folder/structure/here']\n assert candidate(folder = ['/root/user/projects', '/root/user/projects/phase1', '/root/user/projects/phase2', '/root/user/docs', '/root/user/docs/specifications']) == ['/root/user/docs', '/root/user/projects']\n assert candidate(folder = ['/x/y/z', '/x/y/z/w', '/x/y/z/w/x', '/x/y/z/w/x/y', '/x/y/z/w/x/y/z', '/x/y/z/w/x/y/z/a']) == ['/x/y/z']\n assert candidate(folder = ['/user/home/documents', '/user/home/documents/reports/2020', '/user/home/documents/reports/2021', '/user/home/photos/vacation/2020', '/user/home/photos/vacation/2021/europe']) == ['/user/home/documents', '/user/home/photos/vacation/2020', '/user/home/photos/vacation/2021/europe']\n assert candidate(folder = ['/abc/def/ghi/jkl', '/abc/def/ghi/jkl/mno', '/abc/def/ghi/jkl/mno/pqr', '/abc/def/ghi/jkl/mno/pqr/stu', '/abc/def/ghi/jkl/mno/pqr/vwx', '/abc/def/ghi/jkl/mno/pqr/vwx/yz']) == ['/abc/def/ghi/jkl']\n assert candidate(folder = ['/x/y/z', '/x/y/z/w', '/x/y/zx', '/x/y/z/xy']) == ['/x/y/z', '/x/y/zx']\n assert candidate(folder = ['/root/project/src/main/java/com/example', '/root/project/src', '/root/project/tests/unit', '/root/project']) == ['/root/project']\n assert candidate(folder = ['/root/child/grandchild', '/root/child', '/root/child2', '/root/child2/grandchild2']) == ['/root/child', '/root/child2']\n assert candidate(folder = ['/system/core/libs', '/system/core/libs/graphics', '/system/core/libs/graphics/opengl', '/system/core/libs/graphics/opengl/gl32', '/system/core/libs/graphics/opengl/gl32/shaders', '/system/core/libs/graphics/opengl/gl32/shaders/vertex', '/system/core/libs/graphics/opengl/gl32/shaders/fragment']) == ['/system/core/libs']\n assert candidate(folder = ['/project/src/main/java/com/example/model', '/project/src/main/java/com/example/service', '/project/src/main/java/com/example/model/User', '/project/src/main/java/com/example/service/UserService', '/project/src/main/java/com/example/service/UserServiceImpl']) == ['/project/src/main/java/com/example/model', '/project/src/main/java/com/example/service']\n assert candidate(folder = ['/alpha/beta/gamma/delta', '/alpha/beta/gamma/delta/epsilon', '/alpha/beta/gamma/delta/epsilon/zeta', '/alpha/beta/gamma/delta/eta', '/alpha/beta/gamma/delta/eta/theta', '/alpha/beta/gamma/delta/eta/theta/iota']) == ['/alpha/beta/gamma/delta']\n assert candidate(folder = ['/alpha/bravo/charlie/delta', '/alpha/bravo/charlie/delta/echo', '/alpha/bravo/charlie/delta/echo/foxtrot', '/alpha/bravo/charlie/delta/echo/foxtrot/golf']) == ['/alpha/bravo/charlie/delta']\n assert candidate(folder = ['/root/a/b/c/d/e/f/g/h/i', '/root/a/b/c/d/e/f/g', '/root/a/b/c/d/e', '/root/a/b/c']) == ['/root/a/b/c']\n assert candidate(folder = ['/one/two/three/four/five/six/seven', '/one/two/three/four/five/six/seven/eight', '/one/two/three/four/five/six/seven/eight/nine', '/one/two/three/four/five/six/seven/eight/ten']) == ['/one/two/three/four/five/six/seven']\n assert candidate(folder = ['/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w']) == ['/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w']\n assert candidate(folder = ['/nested/folder1', '/nested/folder1/folder2', '/nested/folder1/folder2/folder3', '/nested/folder1/folder2/folder3/folder4', '/nested/folder1/folder2/folder3/folder4/folder5']) == ['/nested/folder1']\n assert candidate(folder = ['/documents/2023/january', '/documents/2023/february/reports', '/documents/2023/february/presentations', '/documents/2023/march', '/documents/2023/april/meetings', '/documents/2023/april/holidays']) == ['/documents/2023/april/holidays', '/documents/2023/april/meetings', '/documents/2023/february/presentations', '/documents/2023/february/reports', '/documents/2023/january', '/documents/2023/march']\n assert candidate(folder = ['/complex/folder/structure/with/deep/nesting/level1/level2/level3/level4/level5/level6/level7/level8/level9/level10/level11/level12/level13/level14/level15/level16/level17/level18/level19/level20']) == ['/complex/folder/structure/with/deep/nesting/level1/level2/level3/level4/level5/level6/level7/level8/level9/level10/level11/level12/level13/level14/level15/level16/level17/level18/level19/level20']\n assert candidate(folder = ['/a/b/c/d/e', '/a/b/c/d', '/a/b/c/d/f', '/a/b/c/d/f/g', '/a/b/c/d/f/h']) == ['/a/b/c/d']\n assert candidate(folder = ['/base/a', '/base/a/b', '/base/a/b/c', '/base/a/b/d', '/base/a/b/e/f', '/base/a/b/e/g', '/base/a/b/h/i/j/k', '/base/a/b/h/i/l', '/base/a/b/h/i/m/n/o/p']) == ['/base/a']\n assert candidate(folder = ['/project/src/module1', '/project/src/module2', '/project/src/module1/submodule1', '/project/src/module2/submodule1', '/project/src/module1/submodule1/subsubmodule1', '/project/docs', '/project/docs/user_guide']) == ['/project/docs', '/project/src/module1', '/project/src/module2']\n assert candidate(folder = ['/root/user/documents/projects/python', '/root/user/documents/projects/java', '/root/user/documents/music', '/root/user/downloads', '/root/user/pictures/vacation/2020', '/root/user/pictures/vacation/2021']) == ['/root/user/documents/music', '/root/user/documents/projects/java', '/root/user/documents/projects/python', '/root/user/downloads', '/root/user/pictures/vacation/2020', '/root/user/pictures/vacation/2021']\n assert candidate(folder = ['/zoo/animals/mammals/carnivores/lions', '/zoo/animals/mammals/carnivores/tigers', '/zoo/animals/mammals/herbivores/elephants', '/zoo/animals/mammals/herbivores/giraffes', '/zoo/animals/birds/flying/eagles', '/zoo/animals/birds/flying/penguins', '/zoo/animals/birds/nonflying/ostriches', '/zoo/animals/birds/nonflying/emus']) == ['/zoo/animals/birds/flying/eagles', '/zoo/animals/birds/flying/penguins', '/zoo/animals/birds/nonflying/emus', '/zoo/animals/birds/nonflying/ostriches', '/zoo/animals/mammals/carnivores/lions', '/zoo/animals/mammals/carnivores/tigers', '/zoo/animals/mammals/herbivores/elephants', '/zoo/animals/mammals/herbivores/giraffes']\n assert candidate(folder = ['/level1/level2/level3/level4/level5/level6/level7/level8/level9/level10', '/level1/level2/level3/level4/level5/level6/level7/level8/level9', '/level1/level2/level3/level4/level5/level6/level7/level8', '/level1/level2/level3/level4/level5/level6/level7', '/level1/level2/level3/level4/level5/level6', '/level1/level2/level3/level4/level5', '/level1/level2/level3/level4', '/level1/level2/level3', '/level1/level2', '/level1']) == ['/level1']\n assert candidate(folder = ['/root/a', '/root/a/b', '/root/a/b/c', '/root/a/b/d', '/root/a/b/e/f', '/root/a/b/e/g', '/root/a/b/e', '/root/a/b/e/g/h']) == ['/root/a']\n assert candidate(folder = ['/data/warehouse/logs', '/data/warehouse/logs/2021', '/data/warehouse/logs/2021/01', '/data/warehouse/logs/2021/02', '/data/warehouse/data', '/data/warehouse/data/raw', '/data/warehouse/data/processed']) == ['/data/warehouse/data', '/data/warehouse/logs']\n assert candidate(folder = ['/a/b/c/d', '/a/b/c/d/e', '/a/b/c/d/f', '/a/b/c/d/g', '/a/b/c/d/h/i']) == ['/a/b/c/d']\n assert candidate(folder = ['/database/backups/2023/01', '/database/backups/2023/01/01', '/database/backups/2023/01/02', '/database/backups/2023/02', '/database/backups/2023/02/01', '/database/backups/2023/02/02', '/database/backups/2023', '/database/backups']) == ['/database/backups']\n assert candidate(folder = ['/user/documents/report2021', '/user/documents/report2021/financials', '/user/documents/report2022', '/user/pictures/vacation2021', '/user/pictures/vacation2021/europe', '/user/pictures/vacation2022']) == ['/user/documents/report2021', '/user/documents/report2022', '/user/pictures/vacation2021', '/user/pictures/vacation2022']\n assert candidate(folder = ['/projects/alpha/beta/gamma/delta/epsilon/zeta', '/projects/alpha/beta/gamma/delta/epsilon/eta', '/projects/alpha/beta/gamma/delta', '/projects/alpha/beta/gamma', '/projects/alpha/beta']) == ['/projects/alpha/beta']\n assert candidate(folder = ['/level1/level2/level3/level4', '/level1/level2/level3', '/level1/level2', '/level1/level2/level3/level4/level5', '/level1/level2/level3/level6', '/level1/level7']) == ['/level1/level2', '/level1/level7']\n assert candidate(folder = ['/base/folder1/folder2/folder3', '/base/folder1/folder2/folder3/folder4', '/base/folder5', '/base/folder5/folder6', '/base/folder5/folder6/folder7', '/base/folder5/folder6/folder7/folder8']) == ['/base/folder1/folder2/folder3', '/base/folder5']\n assert candidate(folder = ['/x/y/z', '/x/y', '/x/y/z/w', '/x/y/v', '/x/y/z/v', '/x/y/v/w', '/x/u/v']) == ['/x/u/v', '/x/y']\n assert candidate(folder = ['/x/y/z', '/x/y/za', '/x/ya', '/x/yb', '/x/yc/zc', '/x/yc/zb']) == ['/x/y/z', '/x/y/za', '/x/ya', '/x/yb', '/x/yc/zb', '/x/yc/zc']\n assert candidate(folder = ['/a/b/c/d', '/a/b/c', '/a/b', '/a', '/a/b/c/d/e', '/a/b/c/f', '/a/g', '/a/g/h', '/a/g/i/j', '/a/g/i/j/k']) == ['/a']\n assert candidate(folder = ['/projects/webapp/client', '/projects/webapp/client/src', '/projects/webapp/client/src/components', '/projects/webapp/server', '/projects/webapp/server/routes', '/projects/webapp/server/models']) == ['/projects/webapp/client', '/projects/webapp/server']\n assert candidate(folder = ['/deep/path/to/file1', '/deep/path/to/file2', '/deep/path/to/another/deep/path/to/file3', '/deep/path/to/another/deep/path/to/file4', '/deep/path/to/another/deep/path/to/another/deep/path/to/file5']) == ['/deep/path/to/another/deep/path/to/another/deep/path/to/file5', '/deep/path/to/another/deep/path/to/file3', '/deep/path/to/another/deep/path/to/file4', '/deep/path/to/file1', '/deep/path/to/file2']\n assert candidate(folder = ['/home/user1', '/home/user1/documents', '/home/user1/downloads', '/home/user1/downloads/software', '/home/user1/downloads/music', '/home/user2', '/home/user2/photos', '/home/user2/photos/vacation', '/home/user2/photos/vacation/beach']) == ['/home/user1', '/home/user2']\n assert candidate(folder = ['/photos/travel/2022', '/photos/travel/2022/summer', '/photos/travel/2022/winter', '/photos/travel/2023', '/photos/travel/2023/spring', '/photos/travel/2023/autumn']) == ['/photos/travel/2022', '/photos/travel/2023']\n assert candidate(folder = ['/root/user/documents', '/root/user/documents/reports', '/root/user/pictures', '/root/user/pictures/vacation', '/root/user/pictures/vacation/2021']) == ['/root/user/documents', '/root/user/pictures']\n assert candidate(folder = ['/project/src/main/java/com/example', '/project/src/main/java/com/example/model', '/project/src/main/java/com/example/service', '/project/src/test/java/com/example/service', '/project/src/test/resources', '/project/src/main/resources']) == ['/project/src/main/java/com/example', '/project/src/main/resources', '/project/src/test/java/com/example/service', '/project/src/test/resources']\n assert candidate(folder = ['/x/y/z', '/x/y/za', '/x/y', '/x/y/z/zzz', '/x/y/z/zza']) == ['/x/y']\n assert candidate(folder = ['/code/base', '/code/base/core', '/code/base/core/utils', '/code/base/core/utils/a', '/code/base/core/utils/b', '/code/base/core/models', '/code/base/core/models/user', '/code/base/core/models/group']) == ['/code/base']\n assert candidate(folder = ['/a/b', '/a/b/c', '/a/b/c/d', '/a/b/c/d/e', '/a/b/c/d/e/f', '/a/b/c/d/e/f/g', '/a/b/c/d/e/f/g/h', '/a/b/c/d/e/f/g/h/i', '/a/b/c/d/e/f/g/h/i/j', '/a/b/c/d/e/f/g/h/i/j/k', '/a/b/c/d/e/f/g/h/i/j/k/l', '/a/b/c/d/e/f/g/h/i/j/k/l/m', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p', '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q']) == ['/a/b']\n assert candidate(folder = ['/m/n/o/p/q/r', '/m/n/o/p/q/r/s', '/m/n/o/p/q/r/s/t', '/m/n/o/p/q/r/u', '/m/n/o/p/v', '/m/n/o/p/v/w', '/m/n/o/p/v/w/x']) == ['/m/n/o/p/q/r', '/m/n/o/p/v']\n assert candidate(folder = ['/folder1/subfolder1/subsubfolder1', '/folder1/subfolder1/subsubfolder2', '/folder1/subfolder2', '/folder2', '/folder2/subfolder1', '/folder2/subfolder2', '/folder3/subfolder1/subsubfolder1']) == ['/folder1/subfolder1/subsubfolder1', '/folder1/subfolder1/subsubfolder2', '/folder1/subfolder2', '/folder2', '/folder3/subfolder1/subsubfolder1']\n assert candidate(folder = ['/mnt/external/storage', '/mnt/external/storage/backup', '/mnt/external/storage/photos', '/mnt/external/storage/photos/vacation', '/mnt/external/storage/photos/wedding', '/mnt/external/storage/videos', '/mnt/external/storage/videos/home', '/mnt/external/storage/videos/travel']) == ['/mnt/external/storage']\n assert candidate(folder = ['/server/logs', '/server/logs/2020', '/server/logs/2020/01', '/server/logs/2020/01/01', '/server/logs/2020/01/02', '/server/logs/2020/02', '/server/logs/2020/02/01', '/server/logs/2020/02/02', '/server/logs/2020/03', '/server/logs/2020/03/01', '/server/logs/2020/03/02']) == ['/server/logs']\n assert candidate(folder = ['/user/home', '/user/home/settings', '/user/home/settings/preferences', '/user/home/settings/notifications', '/user/home/documents', '/user/home/documents/work', '/user/home/documents/personal']) == ['/user/home']\n assert candidate(folder = ['/data/warehouse/sales/2020/january', '/data/warehouse/sales/2020/february', '/data/warehouse/sales/2020', '/data/warehouse/marketing/2020/january', '/data/warehouse/marketing/2020', '/data/warehouse']) == ['/data/warehouse']\n assert candidate(folder = ['/p/q/r', '/p/q/r/s', '/p/q/r/s/t', '/p/q/r/s/u', '/p/q/v', '/p/q/v/w', '/p/q/v/w/x', '/p/q/v/w/y']) == ['/p/q/r', '/p/q/v']\n assert candidate(folder = ['/nested/folder1/subfolder1', '/nested/folder1/subfolder2/subsubfolder1', '/nested/folder1/subfolder2/subsubfolder2', '/nested/folder2/subfolder1', '/nested/folder2/subfolder2', '/nested/folder3']) == ['/nested/folder1/subfolder1', '/nested/folder1/subfolder2/subsubfolder1', '/nested/folder1/subfolder2/subsubfolder2', '/nested/folder2/subfolder1', '/nested/folder2/subfolder2', '/nested/folder3']\n assert candidate(folder = ['/data/backups', '/data/backups/weekly', '/data/backups/monthly', '/data/backups/yearly', '/data/backups/weekly/2021-01-01', '/data/backups/weekly/2021-02-01', '/data/backups/monthly/2021-01', '/data/backups/yearly/2020']) == ['/data/backups']\n assert candidate(folder = ['/project/src', '/project/src/components', '/project/src/components/button', '/project/src/components/input', '/project/src/utils', '/project/src/utils/helpers', '/project/src/utils/api', '/project/src/assets', '/project/src/assets/images', '/project/src/assets/fonts', '/project/src/assets/icons']) == ['/project/src']\n assert candidate(folder = ['/a/b/c/d/e/f', '/a/b/c/d', '/a/b/c', '/a/b', '/a', '/z/y/x', '/z/y', '/z']) == ['/a', '/z']\n assert candidate(folder = ['/folder1/folder2/folder3/folder4/folder5', '/folder1/folder2/folder3/folder4/folder5/folder6', '/folder1/folder2/folder3/folder4/folder5/folder7/subfolder', '/folder1/folder2/folder3/folder4/folder5/folder7/subfolder/deeper/subfolder']) == ['/folder1/folder2/folder3/folder4/folder5']\n assert candidate(folder = ['/apps/production/app1', '/apps/production/app1/v1', '/apps/production/app1/v2', '/apps/staging/app1', '/apps/staging/app1/v1']) == ['/apps/production/app1', '/apps/staging/app1']\n"}, "metadata": {"canonical_parameter_names": ["folder"], "leetcode_dataset_entry_point": "Solution().removeSubfolders", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var removeSubfolders = function(folder) {", "container": null, "callable": "removeSubfolders", "parameters": [{"name": "folder", "type": "string[]"}], "return_type": "string[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1234, "task_id": "replace-the-substring-for-balanced-string", "difficulty": "Medium", "problem_description": "You are given a string s of length n containing only four kinds of characters: 'Q', 'W', 'E', and 'R'.\nA string is said to be balanced if each of its characters appears n / 4 times where n is the length of the string.\nReturn the minimum length of the substring that can be replaced with any other string of the same length to make s balanced. If s is already balanced, return 0.\n \nExample 1:\n\nInput: s = \"QWER\"\nOutput: 0\nExplanation: s is already balanced.\n\nExample 2:\n\nInput: s = \"QQWE\"\nOutput: 1\nExplanation: We need to replace a 'Q' to 'R', so that \"RQWE\" (or \"QRWE\") is balanced.\n\nExample 3:\n\nInput: s = \"QQQW\"\nOutput: 2\nExplanation: We can replace the first \"QQ\" to \"ER\". \n\n \nConstraints:\n\nn == s.length\n4 <= n <= 105\nn is a multiple of 4.\ns contains only 'Q', 'W', 'E', and 'R'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"QQQQQQQQWWWWEEEEEEEERRRRRRRR\") == 14\n assert candidate(s = \"QQQQWWER\") == 2\n assert candidate(s = \"WQQQQQERQQ\") == 5\n assert candidate(s = \"WWEERRQQQWEEERRQQQWEEERRQQQWEEERR\") == 5\n assert candidate(s = \"QQWQWQQWEEWEEWRRWRRWRRW\") == 7\n assert candidate(s = \"QQQQWWWWEEEERRRR\") == 0\n assert candidate(s = \"WQWRQQQWQWQQQQRRWEWRRWQQQWQRWEQWQWRRRRWQQQWRRQWEQWQQWRWRRWQQWEWRRQWQWQWQWQW\") == 24\n assert candidate(s = \"QQWWRRER\") == 1\n assert candidate(s = \"QQQQWWWEERRR\") == 1\n assert candidate(s = \"QQQQQQQQWWWWWWWWEEEEEEEERRRRRRRR\") == 0\n assert candidate(s = \"QQQWEEERRRQQQWEEERRR\") == 5\n assert candidate(s = \"QWERQWERQWERQWER\") == 0\n assert candidate(s = \"QQQWEEEERRRQ\") == 3\n assert candidate(s = \"QQWE\") == 1\n assert candidate(s = \"QQQW\") == 2\n assert candidate(s = \"QQWEQRQQQQEEEEWWRR\") == 4\n assert candidate(s = \"QWER\") == 0\n assert candidate(s = \"QQQQEEEERRRR\") == 6\n assert candidate(s = \"WQEEWRQQQWEEEERRR\") == 2\n assert candidate(s = \"QQWWEERRRR\") == 2\n assert candidate(s = \"WQWRQQQW\") == 3\n assert candidate(s = \"QQQQWEEEWWRR\") == 1\n assert candidate(s = \"QWQWQWQW\") == 4\n assert candidate(s = \"QQQQEEEEWWWWRRRR\") == 0\n assert candidate(s = \"QQQQWWEERR\") == 2\n assert candidate(s = \"QQQQWEEEERRR\") == 3\n assert candidate(s = \"QQQQWWRRRRWWRRRQQQ\") == 6\n assert candidate(s = \"QQQQWWEERRRRQQQQ\") == 4\n assert candidate(s = \"QQQWEEEERRRR\") == 2\n assert candidate(s = \"QQQQQQQQQQWWWWWWWWQQQQQQQQWWWWWWWWEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRR\") == 4\n assert candidate(s = \"QQWWEERRRRQQWWEERRRRQQWWEERRRR\") == 11\n assert candidate(s = \"QQQQWWWEEERRRR\") == 8\n assert candidate(s = \"QQQQWEEEEEERRRRQQQWEEEERRRRWWWWQQQQQQQQWWWWEEEEQQQQRRRRWWWWEEEEQQQQ\") == 13\n assert candidate(s = \"QQQQQQQQWWWWWWWWEEEEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRQQQQQQQQWWWWWWWWEEEEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\") == 42\n assert candidate(s = \"QQQQQQQQQQQQQQQQEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\") == 32\n assert candidate(s = \"QQQQWWEERRQQWWEERRQQWWEERRQQWWEERR\") == 2\n assert candidate(s = \"QQQQWEEEEEERRRRQQQ\") == 6\n assert candidate(s = \"QQQWEEEEERRRRRRRRRRRRRRRRRRRR\") == 13\n assert candidate(s = \"QQQWEEEERRRRQQ\") == 7\n assert candidate(s = \"QQQQQWWEERRRQQ\") == 4\n assert candidate(s = \"QQQQQQQQWWWWWWWWEEEEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRQQQQQQQQWWWWWWWWEEEEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRQQQQQQQQWWWWWWWWEEEEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\") == 87\n assert candidate(s = \"QQQQWEEEEEERRRRQQQWEEEERRRRWWWWQQQQ\") == 6\n assert candidate(s = \"QWEQRWEQRWEQRWEQWEQRWEQRWEQRWE\") == 3\n assert candidate(s = \"QQWWEERRQQWWEERRQQWWEERR\") == 0\n assert candidate(s = \"QQQQQQQQQQWWWWWWWWWWEEEEEEEEEEERRRRRRRRRR\") == 1\n assert candidate(s = \"QQQQQWEEEEERRRRR\") == 8\n assert candidate(s = \"QQQQWEEEERRRR\") == 7\n assert candidate(s = \"WWWWWWWWQQQQEEEERRRR\") == 3\n assert candidate(s = \"QQQQQQQQQQWWWWWWWWWWWEEEEEEEEEEEERRRRRRRRRRRRRRRR\") == 4\n assert candidate(s = \"QWQWQWQWQWQWQWQWQWQWQWQWQWQWQWQW\") == 16\n assert candidate(s = \"EEEEWWRRQQQQEEEEWWRRQQQQ\") == 4\n assert candidate(s = \"QQQQWEEEEEERRRRQQQWEEEERRRRWWWWQQQQQQQQWWWW\") == 5\n assert candidate(s = \"QQQQWWWWEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRR\") == 14\n assert candidate(s = \"QQQQWEEEEEERRRRWWW\") == 2\n assert candidate(s = \"EEEEEEEEWWWWWWWWRRRRRRRRQQQQQQQQ\") == 0\n assert candidate(s = \"QQQQWEEEEEERRRRQQQWEEEERRRRWWWWQQQQQQQQWWWWEEEE\") == 8\n assert candidate(s = \"QQQQWEEEEEERRRRQQQWEEEERRRRWWW\") == 4\n assert candidate(s = \"WWWWWWWWWWEEEEEEEEQQQQQQQQQQRRRRRRRRRR\") == 20\n assert candidate(s = \"QQQQWEEEEEERRRRQQQWEEEERRRRWWWWQQQQQQQQWWWWEEEEQQQQ\") == 13\n assert candidate(s = \"QQQQQQQQWWWWWWWWEEEEEEEEERRRRRRRRR\") == 2\n assert candidate(s = \"QWQWQWQWQWQWQWQW\") == 8\n assert candidate(s = \"QQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERR\") == 14\n assert candidate(s = \"QQQQWEEEERRRRRRRRRRRR\") == 7\n assert candidate(s = \"QQQQQQWWEERRRRWWWWRRRRQQQQQQWWEERRRRWWWWRRRRQQQQQQWWEERRRRWWWWRRRR\") == 14\n assert candidate(s = \"QQQQQQQQQQQQQQEEEEWWRR\") == 9\n assert candidate(s = \"QQQQQQQQWWWWWWWWWEEEEEEEEEEEEEEEEERRRRRRRRRRRRRR\") == 7\n assert candidate(s = \"QQQQWEEEEEERRRRQQQWEEEERRRRWWWWQQQQQQQQ\") == 15\n assert candidate(s = \"QWEQQWEQQWEQQWEQQWEQQWEQQWEQQWE\") == 14\n assert candidate(s = \"QQQQQQQQQQWWWWWWWWWWEEEEEEEEERRRRRRRRRR\") == 21\n assert candidate(s = \"QQQQQQQQQQQQQQQQEEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRR\") == 32\n assert candidate(s = \"QQQQQQQQWWWWWWWWEEEEEEEERRRRRRRRRRRRRRRRRRRR\") == 9\n assert candidate(s = \"QQQWEEEEEEERRRR\") == 5\n assert candidate(s = \"QQQQQQQQQQQQQQQQEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\") == 31\n assert candidate(s = \"QQQQQQQQWWWWWWWWQQQQQQQQWWWWWWWWQQQQQQQQWWWWWWWWEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\") == 10\n assert candidate(s = \"QQWWEERRRRWWWWRRRRWWWWRRRRWWWWRRRR\") == 14\n assert candidate(s = \"WWWWQQQEEEERRR\") == 5\n assert candidate(s = \"QQQQQQQQQQQQQQQQWWWWWWWWWWWWWWWWEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRR\") == 5\n assert candidate(s = \"QQQQQWEEEEERRRRRR\") == 9\n assert candidate(s = \"QQQQWWEERRRRQQQWWEERRRR\") == 5\n assert candidate(s = \"QQQQQQWWWEEEEEEEEEERRRRRRRR\") == 6\n assert candidate(s = \"WWWWWQQQQQQQQQQQQQQQQQQEEEERRRRRRRRRRRRRRRRRRRRRRRR\") == 22\n assert candidate(s = \"QQQQWEEEEEERRRRQQQWEEEERRRRWWWW\") == 4\n assert candidate(s = \"QQQWWWWWWWWEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRR\") == 11\n assert candidate(s = \"QQWWEERRRRWWWWRRRRWWWWRRRRWWWWRRRRQQQWEEERRRRWWWWRRRR\") == 19\n assert candidate(s = \"WQQQWEWQERWREWER\") == 1\n assert candidate(s = \"QWQWQWQWQQQQQQQQEEEEWWRRQQQQ\") == 10\n assert candidate(s = \"QQQQQQQQQQQQQQQQWWEERRRRRRRRRRRRRR\") == 18\n assert candidate(s = \"QQQWEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\") == 23\n assert candidate(s = \"QQQQQQQQWEEEEEEEEEERRRRRRRRR\") == 14\n assert candidate(s = \"QQQQQQWWEEEERRRR\") == 2\n assert candidate(s = \"QQQQQQQQWWWWWWWWEEEEEEEERRRRRR\") == 10\n assert candidate(s = \"QQQQQQQQWWWWWWWWEEEEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRQQQQQQQQWWWWWWWWEEEEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRQQQQQQQQWWWWWWWWEEEEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRQQQQQQQQWWWWWWWWEEEEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\") == 102\n assert candidate(s = \"QQQQWWEEREEE\") == 5\n assert candidate(s = \"QQWWEERRQQWWEERR\") == 0\n assert candidate(s = \"QQQWWWWWEEEEERRRRRQQQWWWWWEEEEERRRRRQQQWWWWWEEEEERRRRR\") == 9\n assert candidate(s = \"QQQQWWWWEEEERRRRQQQQWWWWEEEE\") == 6\n assert candidate(s = \"QQQWWEERRRRQQQQWWEERRRRQQQQWWEERRRR\") == 7\n assert candidate(s = \"QWQWQWQWQWQWQWQWQWQWQWQWQWQWQWQWQW\") == 18\n assert candidate(s = \"QQQWEEERRRRRRRRRRRRRRRRRR\") == 12\n assert candidate(s = \"QQQWEEEERRRRQQQWEEEERRRR\") == 4\n assert candidate(s = \"QQQQQQQQQQQQQQEEEEWWRRQQQQQQQQQQQQ\") == 26\n assert candidate(s = \"QQQQWEEEERRRRWWWWQQQQWEEEERRRRWWWW\") == 2\n assert candidate(s = \"QQQWQQQQQQQQQQEEEEWWRRQQQQ\") == 12\n assert candidate(s = \"QQQQWWWWWWWWEEEEERRRRRRRR\") == 9\n assert candidate(s = \"QQQWEEERQQQWEEERRQQQWEEERRQQQWEEERR\") == 11\n assert candidate(s = \"QQQQQQQQWEEEEEEEEEEEEEERRRRRRRRRRRR\") == 10\n assert candidate(s = \"QQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERR\") == 16\n assert candidate(s = \"QQQWEEERRQQQWEEERRQQQWEEERRQQQWEEEERR\") == 8\n assert candidate(s = \"QQQWEEERRRRQQQWEEERRRRQQQWEEERRRRQQQWEEERRRRQQQWEEERRRRQQQWEEERRRRQQQWEEERRRRQQQWEEERRRRQQQWEEERRRR\") == 26\n assert candidate(s = \"QQQQQQQQQQQQWWWWWWWWWWWWEEEEEEEEEEEEERRRRRRRRRRRR\") == 1\n assert candidate(s = \"QQQWEEERRRRQQQWEEERRRRQQQWEEERRRRQQQWEEERRRRQQQWEEERRRRQQQWEEERRRRQQQWEEERRRRQQQWEEERRRR\") == 24\n assert candidate(s = \"QQQQQQQQQQQQQQQQEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\") == 31\n assert candidate(s = \"QQQQQQQQEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRR\") == 14\n assert candidate(s = \"QQQQWEEEEEERRRRQQQWEEEERRRRWWWWQQQQQQQQWWWWEEEEQQQQRRRR\") == 11\n assert candidate(s = \"QQQQWEEEERRRRRRRRR\") == 5\n assert candidate(s = \"QQQQQQQQWWEERRRRRR\") == 10\n assert candidate(s = \"QQQWQWQWQWQWQWQWQWQWQWQWQWQWQW\") == 16\n assert candidate(s = \"QQQWWEERRRRQQQQWWEERRRR\") == 5\n assert candidate(s = \"WQQQWQQQWQQQWQQQEEEEWWRRQQQQ\") == 11\n assert candidate(s = \"QQQWEEEERRRRRR\") == 4\n assert candidate(s = \"QQQQQQQQQQQQQQQQEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\") == 31\n assert candidate(s = \"QQQWEEEEEERRRR\") == 4\n assert candidate(s = \"QQQQQQWEEEEEEEEEEEEERRRRRRRRRR\") == 9\n assert candidate(s = \"QQQQWEEEEEERRRRQQQWEEEERRRRWWWWQQQQQQQQWWWWEEEEQQQQRRRRWWWWEEEE\") == 7\n assert candidate(s = \"QQQWEEEEWWRRQQQQEEEEWWRR\") == 3\n assert candidate(s = \"QWQWQWQWQWQWQQQQWWRRQQQQ\") == 12\n assert candidate(s = \"QQQQQQWWWWWWEEEEEEEEEERRRRRRRRRRRRRR\") == 6\n assert candidate(s = \"QQQQWQQQQWQQQQEEEEWWRRQQQQEEEEWWRR\") == 9\n assert candidate(s = \"QQQQQQQWEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRR\") == 17\n assert candidate(s = \"WWWWQQQEEERRRR\") == 8\n assert candidate(s = \"QQQQWEEEEEERRRRQQQWEEEERRRRWWWWQQQQQQQQWWWWEEEEQQQQRRRRWWWWEEEEQQQQRRRR\") == 11\n assert candidate(s = \"QWQQQQQQQQQWEWEWEWRR\") == 5\n assert candidate(s = \"QQQWEEEERRR\") == 7\n assert candidate(s = \"QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\") == 68\n assert candidate(s = \"QQQWWEERQQRRQWRE\") == 2\n assert candidate(s = \"QQQQEEEEWWRR\") == 2\n assert candidate(s = \"QQQQQQQQQQQQQQQQEEEEEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\") == 30\n assert candidate(s = \"QQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERR\") == 16\n assert candidate(s = \"QQQQQQQQQQQQQQQQEEEEEEEERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\") == 28\n assert candidate(s = \"QQQQWWEERRRRQQQQWWEERRRR\") == 4\n assert candidate(s = \"QQQQQQWWWEEEEERRRR\") == 6\n assert candidate(s = \"QQQQWWEERRRRQQQQWWEERRRRQQQQWWEERRRR\") == 6\n assert candidate(s = \"QQQQWEEEEEERRRRR\") == 3\n assert candidate(s = \"WQWRQQQQEERRRR\") == 6\n assert candidate(s = \"QQQQQQQQWWWWWWWWWWWWWWWWWWEEEEEERRRR\") == 9\n assert candidate(s = \"QQQQWEEEEEERRRRQQQWEEEERRRRWWWWQQQQQQQQWWWWEEEEQQQQRRRRWWWW\") == 5\n assert candidate(s = \"QQQWEEEEEERRRRQQ\") == 4\n assert candidate(s = \"QQQWEEERRRRRRRRRR\") == 6\n assert candidate(s = \"RRRRRRRRQQQQQQQQWWWWWWWWEEEEEEEE\") == 0\n assert candidate(s = \"QQQQQQQQWWWWQQQQWWWWEEEEEEEEEEEEEEEERRRRRRRRRRRRRR\") == 6\n assert candidate(s = \"QQWWEERRRRWWWWRRRRQQQWEEERRRRWWWWRRRRQQQWEEERRRRWWWWRRRR\") == 21\n assert candidate(s = \"QQQQQQQQWWWWWWEEEERRRRRRRRRRRR\") == 16\n assert candidate(s = \"QQWWEERRRRWWWWRRRRWWWWRRRRWWWWRRRRQQWWEERRRRWWWWRRRR\") == 19\n assert candidate(s = \"WWWWQQQQEEEERRRRWWWWQQQQEEEERRRR\") == 0\n assert candidate(s = \"QQQQQQQQWWEERRRR\") == 4\n assert candidate(s = \"QQWWEERRWWEERRWWEERRWWEERR\") == 6\n assert candidate(s = \"QQWWEERRRRWWWWRRRRQQQWEEERRRRWWWWRRRRQQQWEEERRRRWWWWRRRRQQQWEEERRRRWWWWRRRR\") == 29\n assert candidate(s = \"QQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERRQQQWEEERR\") == 12\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().balancedString", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var balancedString = function(s) {", "container": null, "callable": "balancedString", "parameters": [{"name": "s", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1235, "task_id": "maximum-profit-in-job-scheduling", "difficulty": "Hard", "problem_description": "We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i].\nYou're given the startTime, endTime and profit arrays, return the maximum profit you can take such that there are no two jobs in the subset with overlapping time range.\nIf you choose a job that ends at time X you will be able to start another job that starts at time X.\n \nExample 1:\n\n\nInput: startTime = [1,2,3,3], endTime = [3,4,5,6], profit = [50,10,40,70]\nOutput: 120\nExplanation: The subset chosen is the first and fourth job. \nTime range [1-3]+[3-6] , we get profit of 120 = 50 + 70.\n\nExample 2:\n \n\nInput: startTime = [1,2,3,4,6], endTime = [3,5,10,6,9], profit = [20,20,100,70,60]\nOutput: 150\nExplanation: The subset chosen is the first, fourth and fifth job. \nProfit obtained 150 = 20 + 70 + 60.\n\nExample 3:\n\n\nInput: startTime = [1,1,1], endTime = [2,3,4], profit = [5,6,4]\nOutput: 6\n\n \nConstraints:\n\n1 <= startTime.length == endTime.length == profit.length <= 5 * 104\n1 <= startTime[i] < endTime[i] <= 109\n1 <= profit[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(startTime = [1, 10, 4, 3, 8, 9],endTime = [2, 11, 5, 7, 9, 10],profit = [3, 1, 5, 6, 4, 3]) == 17\n assert candidate(startTime = [1, 3, 5, 6, 7],endTime = [3, 5, 9, 8, 9],profit = [50, 20, 60, 40, 30]) == 130\n assert candidate(startTime = [1, 10, 100, 1000],endTime = [2, 20, 200, 2000],profit = [5, 50, 500, 5000]) == 5555\n assert candidate(startTime = [1, 3, 6, 8],endTime = [2, 5, 10, 12],profit = [50, 20, 100, 80]) == 170\n assert candidate(startTime = [3, 1, 1, 2],endTime = [4, 2, 4, 3],profit = [50, 10, 40, 70]) == 130\n assert candidate(startTime = [3, 5, 10],endTime = [15, 18, 19],profit = [20, 20, 100]) == 100\n assert candidate(startTime = [1],endTime = [2],profit = [5]) == 5\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],endTime = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 550\n assert candidate(startTime = [1, 3, 6, 8, 12, 14],endTime = [4, 5, 10, 11, 14, 15],profit = [5, 6, 8, 3, 10, 4]) == 28\n assert candidate(startTime = [1, 2, 3, 4, 5, 6],endTime = [2, 3, 4, 5, 6, 7],profit = [1, 2, 3, 4, 5, 6]) == 21\n assert candidate(startTime = [1, 1, 1],endTime = [2, 3, 4],profit = [5, 6, 4]) == 6\n assert candidate(startTime = [1, 2, 3, 3],endTime = [3, 4, 5, 6],profit = [50, 10, 40, 70]) == 120\n assert candidate(startTime = [1, 2, 3, 4, 6],endTime = [3, 5, 10, 6, 9],profit = [20, 20, 100, 70, 60]) == 150\n assert candidate(startTime = [5, 8, 4, 1, 1],endTime = [6, 10, 7, 8, 2],profit = [100, 500, 100, 200, 300]) == 900\n assert candidate(startTime = [1, 3, 6, 8],endTime = [5, 7, 10, 12],profit = [50, 20, 100, 200]) == 250\n assert candidate(startTime = [2, 5, 8, 11],endTime = [5, 7, 10, 14],profit = [20, 30, 40, 50]) == 140\n assert candidate(startTime = [5, 10, 15, 20, 25],endTime = [10, 15, 20, 25, 30],profit = [100, 150, 200, 250, 300]) == 1000\n assert candidate(startTime = [100, 200, 300],endTime = [200, 300, 400],profit = [1000, 2000, 3000]) == 6000\n assert candidate(startTime = [1, 2, 4, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37],endTime = [5, 6, 9, 10, 13, 14, 17, 18, 21, 22, 25, 26, 29, 30, 33, 34, 37, 38, 41, 42],profit = [100, 200, 150, 300, 100, 500, 400, 300, 600, 700, 800, 600, 400, 300, 200, 100, 900, 800, 700, 600]) == 3400\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],endTime = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 1000\n assert candidate(startTime = [1, 1, 1, 1, 1, 1],endTime = [2, 3, 4, 5, 6, 7],profit = [100, 200, 300, 400, 500, 600]) == 600\n assert candidate(startTime = [1, 2, 3, 5, 6, 8, 10, 12, 14, 16],endTime = [5, 4, 6, 9, 8, 11, 13, 15, 17, 19],profit = [5, 3, 7, 9, 8, 6, 4, 2, 1, 10]) == 33\n assert candidate(startTime = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],endTime = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],profit = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55]) == 325\n assert candidate(startTime = [1, 1, 2, 2, 3, 4, 5, 5, 6, 7],endTime = [3, 4, 4, 5, 6, 7, 7, 8, 9, 10],profit = [50, 40, 30, 20, 60, 10, 20, 100, 5, 45]) == 155\n assert candidate(startTime = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],endTime = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 2100\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],endTime = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21],profit = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 20\n assert candidate(startTime = [1, 5, 8, 11, 13, 16, 19, 22, 25, 28],endTime = [4, 9, 12, 15, 17, 20, 23, 26, 29, 32],profit = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110]) == 370\n assert candidate(startTime = [3, 7, 10, 12, 13, 14, 15, 16, 18, 20],endTime = [5, 8, 13, 14, 15, 17, 20, 21, 22, 23],profit = [5, 8, 13, 14, 15, 17, 20, 21, 22, 23]) == 84\n assert candidate(startTime = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140],endTime = [5, 14, 24, 34, 44, 54, 64, 74, 84, 94, 104, 114, 124, 134, 144],profit = [50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190]) == 1800\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],endTime = [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],profit = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200, 1250]) == 12350\n assert candidate(startTime = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],endTime = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],profit = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100]) == 1000\n assert candidate(startTime = [1, 2, 3, 5, 8, 11, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50],endTime = [4, 6, 9, 13, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600]) == 6900\n assert candidate(startTime = [1, 5, 10, 15, 20, 25, 30],endTime = [4, 9, 14, 19, 24, 29, 34],profit = [100, 200, 300, 400, 500, 600, 700]) == 2800\n assert candidate(startTime = [1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20],endTime = [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 22],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110]) == 360\n assert candidate(startTime = [1, 3, 6, 8, 12, 15, 18, 20, 25, 30],endTime = [5, 7, 10, 14, 16, 19, 22, 24, 30, 35],profit = [50, 20, 70, 10, 120, 30, 50, 25, 80, 60]) == 430\n assert candidate(startTime = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4],endTime = [2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7, 5, 6, 7, 8],profit = [10, 10, 10, 10, 15, 15, 15, 15, 20, 20, 20, 20, 25, 25, 25, 25]) == 70\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],endTime = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000]) == 3000\n assert candidate(startTime = [1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16],endTime = [2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18, 20, 19, 21, 22, 23, 24],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 42\n assert candidate(startTime = [3, 5, 8, 10, 11, 12, 15, 18, 20, 22],endTime = [4, 9, 11, 13, 14, 17, 19, 23, 24, 25],profit = [20, 30, 5, 10, 50, 40, 70, 60, 10, 20]) == 190\n assert candidate(startTime = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],endTime = [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32],profit = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]) == 720\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],endTime = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21],profit = [50, 40, 30, 20, 10, 50, 40, 30, 20, 10, 50, 40, 30, 20, 10, 50, 40, 30, 20, 10]) == 600\n assert candidate(startTime = [1, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41],endTime = [6, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48],profit = [30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220]) == 730\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],endTime = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],profit = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750]) == 4600\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],endTime = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 1200\n assert candidate(startTime = [1, 3, 6, 8, 10, 13, 16, 18, 20, 23],endTime = [4, 7, 10, 12, 14, 17, 20, 22, 24, 27],profit = [500, 400, 300, 200, 100, 50, 75, 125, 175, 225]) == 1250\n assert candidate(startTime = [1000000000, 900000000, 800000000, 700000000, 600000000, 500000000, 400000000, 300000000, 200000000, 100000000],endTime = [1000000001, 900000001, 800000001, 700000001, 600000001, 500000001, 400000001, 300000001, 200000001, 100000001],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 55\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],endTime = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],profit = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000]) == 120000\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],endTime = [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == 260\n assert candidate(startTime = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],endTime = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],profit = [20, 15, 10, 5, 40, 35, 30, 25, 20, 15, 10, 5, 40, 35, 30]) == 335\n assert candidate(startTime = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31],endTime = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]) == 1360\n assert candidate(startTime = [1, 2, 5, 6, 8, 12, 15, 18, 20, 25],endTime = [5, 5, 10, 10, 13, 17, 20, 22, 28, 30],profit = [50, 20, 70, 10, 30, 60, 5, 40, 90, 25]) == 270\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],endTime = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 450\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],endTime = [5, 4, 8, 10, 9, 11, 13, 14, 16, 17, 18, 19, 20, 21, 22],profit = [100, 200, 150, 300, 250, 200, 400, 350, 300, 250, 200, 150, 100, 50, 100]) == 750\n assert candidate(startTime = [1, 100, 200, 300, 400, 500, 600, 700, 800, 900],endTime = [900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800],profit = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 100\n assert candidate(startTime = [1, 5, 8, 10, 13, 16, 18, 20, 22, 25, 27, 29],endTime = [4, 9, 11, 12, 15, 17, 19, 21, 24, 26, 28, 30],profit = [100, 150, 100, 50, 200, 100, 150, 50, 100, 200, 50, 150]) == 1300\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],endTime = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 4500\n assert candidate(startTime = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],endTime = [2, 8, 6, 10, 12, 14, 18, 20, 22, 24],profit = [10, 30, 20, 40, 50, 70, 60, 80, 90, 100]) == 250\n assert candidate(startTime = [1, 3, 4, 5, 6, 8, 9],endTime = [2, 5, 7, 7, 9, 10, 11],profit = [10, 20, 40, 10, 30, 50, 20]) == 100\n assert candidate(startTime = [3, 5, 9, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, 81],endTime = [6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90],profit = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750]) == 3200\n assert candidate(startTime = [1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16],endTime = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22],profit = [20, 25, 20, 30, 35, 40, 35, 45, 50, 55, 50, 60, 65, 70, 65, 75, 80, 85, 90, 95]) == 275\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],endTime = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 100\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],endTime = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18],profit = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80]) == 250\n assert candidate(startTime = [1000000000, 900000000, 800000000, 700000000, 600000000],endTime = [1000000001, 900000001, 800000001, 700000001, 600000001],profit = [100, 200, 300, 400, 500]) == 1500\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],endTime = [3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 21, 23],profit = [10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20, 10, 20]) == 110\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],endTime = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20],profit = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 50\n assert candidate(startTime = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288],endTime = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576],profit = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000]) == 210000\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],endTime = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],profit = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000]) == 3850\n assert candidate(startTime = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],endTime = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 100\n assert candidate(startTime = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],endTime = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],profit = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 100\n assert candidate(startTime = [1, 5, 7, 8, 9, 10, 12, 15, 16, 19],endTime = [5, 8, 9, 10, 12, 15, 16, 20, 21, 25],profit = [100, 80, 40, 60, 70, 50, 30, 90, 20, 150]) == 440\n assert candidate(startTime = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],endTime = [2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200]) == 1010\n assert candidate(startTime = [1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],endTime = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],profit = [20, 40, 30, 60, 50, 80, 70, 100, 90, 120, 110, 140, 130, 160, 150, 180, 170, 200, 190, 220, 210, 240, 230]) == 750\n assert candidate(startTime = [1, 2, 2, 4, 6, 7, 9, 10],endTime = [3, 3, 5, 8, 7, 10, 12, 15],profit = [50, 20, 30, 40, 60, 70, 80, 90]) == 270\n assert candidate(startTime = [3, 12, 8, 4, 9, 15, 18, 20, 25, 30],endTime = [7, 16, 13, 5, 11, 20, 22, 23, 32, 31],profit = [100, 150, 90, 60, 120, 200, 80, 40, 180, 160]) == 640\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],endTime = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 465\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],endTime = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 165\n assert candidate(startTime = [1, 2, 4, 6, 8, 10, 12, 14, 16, 18],endTime = [3, 5, 7, 9, 11, 13, 15, 17, 19, 21],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 300\n assert candidate(startTime = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],endTime = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],profit = [500, 300, 700, 100, 400, 800, 200, 600, 900, 1000]) == 5500\n assert candidate(startTime = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],endTime = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105],profit = [10, 50, 20, 60, 30, 70, 40, 80, 50, 90, 60]) == 560\n assert candidate(startTime = [1, 2, 3, 5, 8, 13, 21],endTime = [5, 4, 6, 8, 10, 15, 25],profit = [20, 20, 10, 40, 20, 30, 50]) == 160\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],endTime = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 1100\n assert candidate(startTime = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],endTime = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],profit = [1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 6050\n assert candidate(startTime = [5, 7, 9, 11, 13, 15, 17, 19, 21, 23],endTime = [6, 8, 10, 12, 14, 16, 18, 20, 22, 24],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 5500\n assert candidate(startTime = [1, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900],endTime = [2, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],profit = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000]) == 21000\n assert candidate(startTime = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],endTime = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 10\n assert candidate(startTime = [3, 15, 5, 10, 20, 25],endTime = [10, 20, 10, 15, 25, 30],profit = [50, 70, 30, 60, 100, 40]) == 320\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],endTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51],profit = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == 1275\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],endTime = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20],profit = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 100\n assert candidate(startTime = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],endTime = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],profit = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000]) == 77000\n assert candidate(startTime = [1, 2, 3, 5, 7, 9, 10, 12, 15, 18, 20],endTime = [5, 6, 8, 10, 12, 14, 17, 20, 22, 25, 27],profit = [100, 50, 70, 60, 80, 90, 120, 150, 200, 180, 220]) == 550\n assert candidate(startTime = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],endTime = [15, 25, 35, 45, 55, 65, 75, 85, 95, 105],profit = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500]) == 2750\n assert candidate(startTime = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],endTime = [9, 14, 19, 24, 29, 34, 39, 44, 49, 54],profit = [100, 150, 200, 250, 300, 350, 400, 450, 500, 550]) == 3250\n"}, "metadata": {"canonical_parameter_names": ["startTime", "endTime", "profit"], "leetcode_dataset_entry_point": "Solution().jobScheduling", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var jobScheduling = function(startTime, endTime, profit) {", "container": null, "callable": "jobScheduling", "parameters": [{"name": "startTime", "type": "number[]"}, {"name": "endTime", "type": "number[]"}, {"name": "profit", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1238, "task_id": "circular-permutation-in-binary-representation", "difficulty": "Medium", "problem_description": "Given 2 integers n and start. Your task is return any permutation p of (0,1,2.....,2^n -1) such that :\\r\n\\r\n\\r\n\tp[0] = start\\r\n\tp[i] and p[i+1] differ by only one bit in their binary representation.\\r\n\tp[0] and p[2^n -1] must also differ by only one bit in their binary representation.\\r\n\\r\n\\r\n \\r\nExample 1:\\r\n\\r\n\\r\nInput: n = 2, start = 3\\r\nOutput: [3,2,0,1]\\r\nExplanation: The binary representation of the permutation is (11,10,00,01). \\r\nAll the adjacent element differ by one bit. Another valid permutation is [3,1,0,2]\\r\n\\r\n\\r\nExample 2:\\r\n\\r\n\\r\nInput: n = 3, start = 2\\r\nOutput: [2,6,7,5,4,0,1,3]\\r\nExplanation: The binary representation of the permutation is (010,110,111,101,100,000,001,011).\\r\n\\r\n\\r\n \\r\nConstraints:\\r\n\\r\n\\r\n\t1 <= n <= 16\\r\n\t0 <= start < 2 ^ n\\r\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 1,start = 0) == [0, 1]\n assert candidate(n = 12,start = 2048) == [2048, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 1536, 1537, 1539, 1538, 1542, 1543, 1541, 1540, 1548, 1549, 1551, 1550, 1546, 1547, 1545, 1544, 1560, 1561, 1563, 1562, 1566, 1567, 1565, 1564, 1556, 1557, 1559, 1558, 1554, 1555, 1553, 1552, 1584, 1585, 1587, 1586, 1590, 1591, 1589, 1588, 1596, 1597, 1599, 1598, 1594, 1595, 1593, 1592, 1576, 1577, 1579, 1578, 1582, 1583, 1581, 1580, 1572, 1573, 1575, 1574, 1570, 1571, 1569, 1568, 1632, 1633, 1635, 1634, 1638, 1639, 1637, 1636, 1644, 1645, 1647, 1646, 1642, 1643, 1641, 1640, 1656, 1657, 1659, 1658, 1662, 1663, 1661, 1660, 1652, 1653, 1655, 1654, 1650, 1651, 1649, 1648, 1616, 1617, 1619, 1618, 1622, 1623, 1621, 1620, 1628, 1629, 1631, 1630, 1626, 1627, 1625, 1624, 1608, 1609, 1611, 1610, 1614, 1615, 1613, 1612, 1604, 1605, 1607, 1606, 1602, 1603, 1601, 1600, 1728, 1729, 1731, 1730, 1734, 1735, 1733, 1732, 1740, 1741, 1743, 1742, 1738, 1739, 1737, 1736, 1752, 1753, 1755, 1754, 1758, 1759, 1757, 1756, 1748, 1749, 1751, 1750, 1746, 1747, 1745, 1744, 1776, 1777, 1779, 1778, 1782, 1783, 1781, 1780, 1788, 1789, 1791, 1790, 1786, 1787, 1785, 1784, 1768, 1769, 1771, 1770, 1774, 1775, 1773, 1772, 1764, 1765, 1767, 1766, 1762, 1763, 1761, 1760, 1696, 1697, 1699, 1698, 1702, 1703, 1701, 1700, 1708, 1709, 1711, 1710, 1706, 1707, 1705, 1704, 1720, 1721, 1723, 1722, 1726, 1727, 1725, 1724, 1716, 1717, 1719, 1718, 1714, 1715, 1713, 1712, 1680, 1681, 1683, 1682, 1686, 1687, 1685, 1684, 1692, 1693, 1695, 1694, 1690, 1691, 1689, 1688, 1672, 1673, 1675, 1674, 1678, 1679, 1677, 1676, 1668, 1669, 1671, 1670, 1666, 1667, 1665, 1664, 1920, 1921, 1923, 1922, 1926, 1927, 1925, 1924, 1932, 1933, 1935, 1934, 1930, 1931, 1929, 1928, 1944, 1945, 1947, 1946, 1950, 1951, 1949, 1948, 1940, 1941, 1943, 1942, 1938, 1939, 1937, 1936, 1968, 1969, 1971, 1970, 1974, 1975, 1973, 1972, 1980, 1981, 1983, 1982, 1978, 1979, 1977, 1976, 1960, 1961, 1963, 1962, 1966, 1967, 1965, 1964, 1956, 1957, 1959, 1958, 1954, 1955, 1953, 1952, 2016, 2017, 2019, 2018, 2022, 2023, 2021, 2020, 2028, 2029, 2031, 2030, 2026, 2027, 2025, 2024, 2040, 2041, 2043, 2042, 2046, 2047, 2045, 2044, 2036, 2037, 2039, 2038, 2034, 2035, 2033, 2032, 2000, 2001, 2003, 2002, 2006, 2007, 2005, 2004, 2012, 2013, 2015, 2014, 2010, 2011, 2009, 2008, 1992, 1993, 1995, 1994, 1998, 1999, 1997, 1996, 1988, 1989, 1991, 1990, 1986, 1987, 1985, 1984, 1856, 1857, 1859, 1858, 1862, 1863, 1861, 1860, 1868, 1869, 1871, 1870, 1866, 1867, 1865, 1864, 1880, 1881, 1883, 1882, 1886, 1887, 1885, 1884, 1876, 1877, 1879, 1878, 1874, 1875, 1873, 1872, 1904, 1905, 1907, 1906, 1910, 1911, 1909, 1908, 1916, 1917, 1919, 1918, 1914, 1915, 1913, 1912, 1896, 1897, 1899, 1898, 1902, 1903, 1901, 1900, 1892, 1893, 1895, 1894, 1890, 1891, 1889, 1888, 1824, 1825, 1827, 1826, 1830, 1831, 1829, 1828, 1836, 1837, 1839, 1838, 1834, 1835, 1833, 1832, 1848, 1849, 1851, 1850, 1854, 1855, 1853, 1852, 1844, 1845, 1847, 1846, 1842, 1843, 1841, 1840, 1808, 1809, 1811, 1810, 1814, 1815, 1813, 1812, 1820, 1821, 1823, 1822, 1818, 1819, 1817, 1816, 1800, 1801, 1803, 1802, 1806, 1807, 1805, 1804, 1796, 1797, 1799, 1798, 1794, 1795, 1793, 1792, 1280, 1281, 1283, 1282, 1286, 1287, 1285, 1284, 1292, 1293, 1295, 1294, 1290, 1291, 1289, 1288, 1304, 1305, 1307, 1306, 1310, 1311, 1309, 1308, 1300, 1301, 1303, 1302, 1298, 1299, 1297, 1296, 1328, 1329, 1331, 1330, 1334, 1335, 1333, 1332, 1340, 1341, 1343, 1342, 1338, 1339, 1337, 1336, 1320, 1321, 1323, 1322, 1326, 1327, 1325, 1324, 1316, 1317, 1319, 1318, 1314, 1315, 1313, 1312, 1376, 1377, 1379, 1378, 1382, 1383, 1381, 1380, 1388, 1389, 1391, 1390, 1386, 1387, 1385, 1384, 1400, 1401, 1403, 1402, 1406, 1407, 1405, 1404, 1396, 1397, 1399, 1398, 1394, 1395, 1393, 1392, 1360, 1361, 1363, 1362, 1366, 1367, 1365, 1364, 1372, 1373, 1375, 1374, 1370, 1371, 1369, 1368, 1352, 1353, 1355, 1354, 1358, 1359, 1357, 1356, 1348, 1349, 1351, 1350, 1346, 1347, 1345, 1344, 1472, 1473, 1475, 1474, 1478, 1479, 1477, 1476, 1484, 1485, 1487, 1486, 1482, 1483, 1481, 1480, 1496, 1497, 1499, 1498, 1502, 1503, 1501, 1500, 1492, 1493, 1495, 1494, 1490, 1491, 1489, 1488, 1520, 1521, 1523, 1522, 1526, 1527, 1525, 1524, 1532, 1533, 1535, 1534, 1530, 1531, 1529, 1528, 1512, 1513, 1515, 1514, 1518, 1519, 1517, 1516, 1508, 1509, 1511, 1510, 1506, 1507, 1505, 1504, 1440, 1441, 1443, 1442, 1446, 1447, 1445, 1444, 1452, 1453, 1455, 1454, 1450, 1451, 1449, 1448, 1464, 1465, 1467, 1466, 1470, 1471, 1469, 1468, 1460, 1461, 1463, 1462, 1458, 1459, 1457, 1456, 1424, 1425, 1427, 1426, 1430, 1431, 1429, 1428, 1436, 1437, 1439, 1438, 1434, 1435, 1433, 1432, 1416, 1417, 1419, 1418, 1422, 1423, 1421, 1420, 1412, 1413, 1415, 1414, 1410, 1411, 1409, 1408, 1152, 1153, 1155, 1154, 1158, 1159, 1157, 1156, 1164, 1165, 1167, 1166, 1162, 1163, 1161, 1160, 1176, 1177, 1179, 1178, 1182, 1183, 1181, 1180, 1172, 1173, 1175, 1174, 1170, 1171, 1169, 1168, 1200, 1201, 1203, 1202, 1206, 1207, 1205, 1204, 1212, 1213, 1215, 1214, 1210, 1211, 1209, 1208, 1192, 1193, 1195, 1194, 1198, 1199, 1197, 1196, 1188, 1189, 1191, 1190, 1186, 1187, 1185, 1184, 1248, 1249, 1251, 1250, 1254, 1255, 1253, 1252, 1260, 1261, 1263, 1262, 1258, 1259, 1257, 1256, 1272, 1273, 1275, 1274, 1278, 1279, 1277, 1276, 1268, 1269, 1271, 1270, 1266, 1267, 1265, 1264, 1232, 1233, 1235, 1234, 1238, 1239, 1237, 1236, 1244, 1245, 1247, 1246, 1242, 1243, 1241, 1240, 1224, 1225, 1227, 1226, 1230, 1231, 1229, 1228, 1220, 1221, 1223, 1222, 1218, 1219, 1217, 1216, 1088, 1089, 1091, 1090, 1094, 1095, 1093, 1092, 1100, 1101, 1103, 1102, 1098, 1099, 1097, 1096, 1112, 1113, 1115, 1114, 1118, 1119, 1117, 1116, 1108, 1109, 1111, 1110, 1106, 1107, 1105, 1104, 1136, 1137, 1139, 1138, 1142, 1143, 1141, 1140, 1148, 1149, 1151, 1150, 1146, 1147, 1145, 1144, 1128, 1129, 1131, 1130, 1134, 1135, 1133, 1132, 1124, 1125, 1127, 1126, 1122, 1123, 1121, 1120, 1056, 1057, 1059, 1058, 1062, 1063, 1061, 1060, 1068, 1069, 1071, 1070, 1066, 1067, 1065, 1064, 1080, 1081, 1083, 1082, 1086, 1087, 1085, 1084, 1076, 1077, 1079, 1078, 1074, 1075, 1073, 1072, 1040, 1041, 1043, 1042, 1046, 1047, 1045, 1044, 1052, 1053, 1055, 1054, 1050, 1051, 1049, 1048, 1032, 1033, 1035, 1034, 1038, 1039, 1037, 1036, 1028, 1029, 1031, 1030, 1026, 1027, 1025, 1024, 3072, 3073, 3075, 3074, 3078, 3079, 3077, 3076, 3084, 3085, 3087, 3086, 3082, 3083, 3081, 3080, 3096, 3097, 3099, 3098, 3102, 3103, 3101, 3100, 3092, 3093, 3095, 3094, 3090, 3091, 3089, 3088, 3120, 3121, 3123, 3122, 3126, 3127, 3125, 3124, 3132, 3133, 3135, 3134, 3130, 3131, 3129, 3128, 3112, 3113, 3115, 3114, 3118, 3119, 3117, 3116, 3108, 3109, 3111, 3110, 3106, 3107, 3105, 3104, 3168, 3169, 3171, 3170, 3174, 3175, 3173, 3172, 3180, 3181, 3183, 3182, 3178, 3179, 3177, 3176, 3192, 3193, 3195, 3194, 3198, 3199, 3197, 3196, 3188, 3189, 3191, 3190, 3186, 3187, 3185, 3184, 3152, 3153, 3155, 3154, 3158, 3159, 3157, 3156, 3164, 3165, 3167, 3166, 3162, 3163, 3161, 3160, 3144, 3145, 3147, 3146, 3150, 3151, 3149, 3148, 3140, 3141, 3143, 3142, 3138, 3139, 3137, 3136, 3264, 3265, 3267, 3266, 3270, 3271, 3269, 3268, 3276, 3277, 3279, 3278, 3274, 3275, 3273, 3272, 3288, 3289, 3291, 3290, 3294, 3295, 3293, 3292, 3284, 3285, 3287, 3286, 3282, 3283, 3281, 3280, 3312, 3313, 3315, 3314, 3318, 3319, 3317, 3316, 3324, 3325, 3327, 3326, 3322, 3323, 3321, 3320, 3304, 3305, 3307, 3306, 3310, 3311, 3309, 3308, 3300, 3301, 3303, 3302, 3298, 3299, 3297, 3296, 3232, 3233, 3235, 3234, 3238, 3239, 3237, 3236, 3244, 3245, 3247, 3246, 3242, 3243, 3241, 3240, 3256, 3257, 3259, 3258, 3262, 3263, 3261, 3260, 3252, 3253, 3255, 3254, 3250, 3251, 3249, 3248, 3216, 3217, 3219, 3218, 3222, 3223, 3221, 3220, 3228, 3229, 3231, 3230, 3226, 3227, 3225, 3224, 3208, 3209, 3211, 3210, 3214, 3215, 3213, 3212, 3204, 3205, 3207, 3206, 3202, 3203, 3201, 3200, 3456, 3457, 3459, 3458, 3462, 3463, 3461, 3460, 3468, 3469, 3471, 3470, 3466, 3467, 3465, 3464, 3480, 3481, 3483, 3482, 3486, 3487, 3485, 3484, 3476, 3477, 3479, 3478, 3474, 3475, 3473, 3472, 3504, 3505, 3507, 3506, 3510, 3511, 3509, 3508, 3516, 3517, 3519, 3518, 3514, 3515, 3513, 3512, 3496, 3497, 3499, 3498, 3502, 3503, 3501, 3500, 3492, 3493, 3495, 3494, 3490, 3491, 3489, 3488, 3552, 3553, 3555, 3554, 3558, 3559, 3557, 3556, 3564, 3565, 3567, 3566, 3562, 3563, 3561, 3560, 3576, 3577, 3579, 3578, 3582, 3583, 3581, 3580, 3572, 3573, 3575, 3574, 3570, 3571, 3569, 3568, 3536, 3537, 3539, 3538, 3542, 3543, 3541, 3540, 3548, 3549, 3551, 3550, 3546, 3547, 3545, 3544, 3528, 3529, 3531, 3530, 3534, 3535, 3533, 3532, 3524, 3525, 3527, 3526, 3522, 3523, 3521, 3520, 3392, 3393, 3395, 3394, 3398, 3399, 3397, 3396, 3404, 3405, 3407, 3406, 3402, 3403, 3401, 3400, 3416, 3417, 3419, 3418, 3422, 3423, 3421, 3420, 3412, 3413, 3415, 3414, 3410, 3411, 3409, 3408, 3440, 3441, 3443, 3442, 3446, 3447, 3445, 3444, 3452, 3453, 3455, 3454, 3450, 3451, 3449, 3448, 3432, 3433, 3435, 3434, 3438, 3439, 3437, 3436, 3428, 3429, 3431, 3430, 3426, 3427, 3425, 3424, 3360, 3361, 3363, 3362, 3366, 3367, 3365, 3364, 3372, 3373, 3375, 3374, 3370, 3371, 3369, 3368, 3384, 3385, 3387, 3386, 3390, 3391, 3389, 3388, 3380, 3381, 3383, 3382, 3378, 3379, 3377, 3376, 3344, 3345, 3347, 3346, 3350, 3351, 3349, 3348, 3356, 3357, 3359, 3358, 3354, 3355, 3353, 3352, 3336, 3337, 3339, 3338, 3342, 3343, 3341, 3340, 3332, 3333, 3335, 3334, 3330, 3331, 3329, 3328, 3840, 3841, 3843, 3842, 3846, 3847, 3845, 3844, 3852, 3853, 3855, 3854, 3850, 3851, 3849, 3848, 3864, 3865, 3867, 3866, 3870, 3871, 3869, 3868, 3860, 3861, 3863, 3862, 3858, 3859, 3857, 3856, 3888, 3889, 3891, 3890, 3894, 3895, 3893, 3892, 3900, 3901, 3903, 3902, 3898, 3899, 3897, 3896, 3880, 3881, 3883, 3882, 3886, 3887, 3885, 3884, 3876, 3877, 3879, 3878, 3874, 3875, 3873, 3872, 3936, 3937, 3939, 3938, 3942, 3943, 3941, 3940, 3948, 3949, 3951, 3950, 3946, 3947, 3945, 3944, 3960, 3961, 3963, 3962, 3966, 3967, 3965, 3964, 3956, 3957, 3959, 3958, 3954, 3955, 3953, 3952, 3920, 3921, 3923, 3922, 3926, 3927, 3925, 3924, 3932, 3933, 3935, 3934, 3930, 3931, 3929, 3928, 3912, 3913, 3915, 3914, 3918, 3919, 3917, 3916, 3908, 3909, 3911, 3910, 3906, 3907, 3905, 3904, 4032, 4033, 4035, 4034, 4038, 4039, 4037, 4036, 4044, 4045, 4047, 4046, 4042, 4043, 4041, 4040, 4056, 4057, 4059, 4058, 4062, 4063, 4061, 4060, 4052, 4053, 4055, 4054, 4050, 4051, 4049, 4048, 4080, 4081, 4083, 4082, 4086, 4087, 4085, 4084, 4092, 4093, 4095, 4094, 4090, 4091, 4089, 4088, 4072, 4073, 4075, 4074, 4078, 4079, 4077, 4076, 4068, 4069, 4071, 4070, 4066, 4067, 4065, 4064, 4000, 4001, 4003, 4002, 4006, 4007, 4005, 4004, 4012, 4013, 4015, 4014, 4010, 4011, 4009, 4008, 4024, 4025, 4027, 4026, 4030, 4031, 4029, 4028, 4020, 4021, 4023, 4022, 4018, 4019, 4017, 4016, 3984, 3985, 3987, 3986, 3990, 3991, 3989, 3988, 3996, 3997, 3999, 3998, 3994, 3995, 3993, 3992, 3976, 3977, 3979, 3978, 3982, 3983, 3981, 3980, 3972, 3973, 3975, 3974, 3970, 3971, 3969, 3968, 3712, 3713, 3715, 3714, 3718, 3719, 3717, 3716, 3724, 3725, 3727, 3726, 3722, 3723, 3721, 3720, 3736, 3737, 3739, 3738, 3742, 3743, 3741, 3740, 3732, 3733, 3735, 3734, 3730, 3731, 3729, 3728, 3760, 3761, 3763, 3762, 3766, 3767, 3765, 3764, 3772, 3773, 3775, 3774, 3770, 3771, 3769, 3768, 3752, 3753, 3755, 3754, 3758, 3759, 3757, 3756, 3748, 3749, 3751, 3750, 3746, 3747, 3745, 3744, 3808, 3809, 3811, 3810, 3814, 3815, 3813, 3812, 3820, 3821, 3823, 3822, 3818, 3819, 3817, 3816, 3832, 3833, 3835, 3834, 3838, 3839, 3837, 3836, 3828, 3829, 3831, 3830, 3826, 3827, 3825, 3824, 3792, 3793, 3795, 3794, 3798, 3799, 3797, 3796, 3804, 3805, 3807, 3806, 3802, 3803, 3801, 3800, 3784, 3785, 3787, 3786, 3790, 3791, 3789, 3788, 3780, 3781, 3783, 3782, 3778, 3779, 3777, 3776, 3648, 3649, 3651, 3650, 3654, 3655, 3653, 3652, 3660, 3661, 3663, 3662, 3658, 3659, 3657, 3656, 3672, 3673, 3675, 3674, 3678, 3679, 3677, 3676, 3668, 3669, 3671, 3670, 3666, 3667, 3665, 3664, 3696, 3697, 3699, 3698, 3702, 3703, 3701, 3700, 3708, 3709, 3711, 3710, 3706, 3707, 3705, 3704, 3688, 3689, 3691, 3690, 3694, 3695, 3693, 3692, 3684, 3685, 3687, 3686, 3682, 3683, 3681, 3680, 3616, 3617, 3619, 3618, 3622, 3623, 3621, 3620, 3628, 3629, 3631, 3630, 3626, 3627, 3625, 3624, 3640, 3641, 3643, 3642, 3646, 3647, 3645, 3644, 3636, 3637, 3639, 3638, 3634, 3635, 3633, 3632, 3600, 3601, 3603, 3602, 3606, 3607, 3605, 3604, 3612, 3613, 3615, 3614, 3610, 3611, 3609, 3608, 3592, 3593, 3595, 3594, 3598, 3599, 3597, 3596, 3588, 3589, 3591, 3590, 3586, 3587, 3585, 3584, 2560, 2561, 2563, 2562, 2566, 2567, 2565, 2564, 2572, 2573, 2575, 2574, 2570, 2571, 2569, 2568, 2584, 2585, 2587, 2586, 2590, 2591, 2589, 2588, 2580, 2581, 2583, 2582, 2578, 2579, 2577, 2576, 2608, 2609, 2611, 2610, 2614, 2615, 2613, 2612, 2620, 2621, 2623, 2622, 2618, 2619, 2617, 2616, 2600, 2601, 2603, 2602, 2606, 2607, 2605, 2604, 2596, 2597, 2599, 2598, 2594, 2595, 2593, 2592, 2656, 2657, 2659, 2658, 2662, 2663, 2661, 2660, 2668, 2669, 2671, 2670, 2666, 2667, 2665, 2664, 2680, 2681, 2683, 2682, 2686, 2687, 2685, 2684, 2676, 2677, 2679, 2678, 2674, 2675, 2673, 2672, 2640, 2641, 2643, 2642, 2646, 2647, 2645, 2644, 2652, 2653, 2655, 2654, 2650, 2651, 2649, 2648, 2632, 2633, 2635, 2634, 2638, 2639, 2637, 2636, 2628, 2629, 2631, 2630, 2626, 2627, 2625, 2624, 2752, 2753, 2755, 2754, 2758, 2759, 2757, 2756, 2764, 2765, 2767, 2766, 2762, 2763, 2761, 2760, 2776, 2777, 2779, 2778, 2782, 2783, 2781, 2780, 2772, 2773, 2775, 2774, 2770, 2771, 2769, 2768, 2800, 2801, 2803, 2802, 2806, 2807, 2805, 2804, 2812, 2813, 2815, 2814, 2810, 2811, 2809, 2808, 2792, 2793, 2795, 2794, 2798, 2799, 2797, 2796, 2788, 2789, 2791, 2790, 2786, 2787, 2785, 2784, 2720, 2721, 2723, 2722, 2726, 2727, 2725, 2724, 2732, 2733, 2735, 2734, 2730, 2731, 2729, 2728, 2744, 2745, 2747, 2746, 2750, 2751, 2749, 2748, 2740, 2741, 2743, 2742, 2738, 2739, 2737, 2736, 2704, 2705, 2707, 2706, 2710, 2711, 2709, 2708, 2716, 2717, 2719, 2718, 2714, 2715, 2713, 2712, 2696, 2697, 2699, 2698, 2702, 2703, 2701, 2700, 2692, 2693, 2695, 2694, 2690, 2691, 2689, 2688, 2944, 2945, 2947, 2946, 2950, 2951, 2949, 2948, 2956, 2957, 2959, 2958, 2954, 2955, 2953, 2952, 2968, 2969, 2971, 2970, 2974, 2975, 2973, 2972, 2964, 2965, 2967, 2966, 2962, 2963, 2961, 2960, 2992, 2993, 2995, 2994, 2998, 2999, 2997, 2996, 3004, 3005, 3007, 3006, 3002, 3003, 3001, 3000, 2984, 2985, 2987, 2986, 2990, 2991, 2989, 2988, 2980, 2981, 2983, 2982, 2978, 2979, 2977, 2976, 3040, 3041, 3043, 3042, 3046, 3047, 3045, 3044, 3052, 3053, 3055, 3054, 3050, 3051, 3049, 3048, 3064, 3065, 3067, 3066, 3070, 3071, 3069, 3068, 3060, 3061, 3063, 3062, 3058, 3059, 3057, 3056, 3024, 3025, 3027, 3026, 3030, 3031, 3029, 3028, 3036, 3037, 3039, 3038, 3034, 3035, 3033, 3032, 3016, 3017, 3019, 3018, 3022, 3023, 3021, 3020, 3012, 3013, 3015, 3014, 3010, 3011, 3009, 3008, 2880, 2881, 2883, 2882, 2886, 2887, 2885, 2884, 2892, 2893, 2895, 2894, 2890, 2891, 2889, 2888, 2904, 2905, 2907, 2906, 2910, 2911, 2909, 2908, 2900, 2901, 2903, 2902, 2898, 2899, 2897, 2896, 2928, 2929, 2931, 2930, 2934, 2935, 2933, 2932, 2940, 2941, 2943, 2942, 2938, 2939, 2937, 2936, 2920, 2921, 2923, 2922, 2926, 2927, 2925, 2924, 2916, 2917, 2919, 2918, 2914, 2915, 2913, 2912, 2848, 2849, 2851, 2850, 2854, 2855, 2853, 2852, 2860, 2861, 2863, 2862, 2858, 2859, 2857, 2856, 2872, 2873, 2875, 2874, 2878, 2879, 2877, 2876, 2868, 2869, 2871, 2870, 2866, 2867, 2865, 2864, 2832, 2833, 2835, 2834, 2838, 2839, 2837, 2836, 2844, 2845, 2847, 2846, 2842, 2843, 2841, 2840, 2824, 2825, 2827, 2826, 2830, 2831, 2829, 2828, 2820, 2821, 2823, 2822, 2818, 2819, 2817, 2816, 2304, 2305, 2307, 2306, 2310, 2311, 2309, 2308, 2316, 2317, 2319, 2318, 2314, 2315, 2313, 2312, 2328, 2329, 2331, 2330, 2334, 2335, 2333, 2332, 2324, 2325, 2327, 2326, 2322, 2323, 2321, 2320, 2352, 2353, 2355, 2354, 2358, 2359, 2357, 2356, 2364, 2365, 2367, 2366, 2362, 2363, 2361, 2360, 2344, 2345, 2347, 2346, 2350, 2351, 2349, 2348, 2340, 2341, 2343, 2342, 2338, 2339, 2337, 2336, 2400, 2401, 2403, 2402, 2406, 2407, 2405, 2404, 2412, 2413, 2415, 2414, 2410, 2411, 2409, 2408, 2424, 2425, 2427, 2426, 2430, 2431, 2429, 2428, 2420, 2421, 2423, 2422, 2418, 2419, 2417, 2416, 2384, 2385, 2387, 2386, 2390, 2391, 2389, 2388, 2396, 2397, 2399, 2398, 2394, 2395, 2393, 2392, 2376, 2377, 2379, 2378, 2382, 2383, 2381, 2380, 2372, 2373, 2375, 2374, 2370, 2371, 2369, 2368, 2496, 2497, 2499, 2498, 2502, 2503, 2501, 2500, 2508, 2509, 2511, 2510, 2506, 2507, 2505, 2504, 2520, 2521, 2523, 2522, 2526, 2527, 2525, 2524, 2516, 2517, 2519, 2518, 2514, 2515, 2513, 2512, 2544, 2545, 2547, 2546, 2550, 2551, 2549, 2548, 2556, 2557, 2559, 2558, 2554, 2555, 2553, 2552, 2536, 2537, 2539, 2538, 2542, 2543, 2541, 2540, 2532, 2533, 2535, 2534, 2530, 2531, 2529, 2528, 2464, 2465, 2467, 2466, 2470, 2471, 2469, 2468, 2476, 2477, 2479, 2478, 2474, 2475, 2473, 2472, 2488, 2489, 2491, 2490, 2494, 2495, 2493, 2492, 2484, 2485, 2487, 2486, 2482, 2483, 2481, 2480, 2448, 2449, 2451, 2450, 2454, 2455, 2453, 2452, 2460, 2461, 2463, 2462, 2458, 2459, 2457, 2456, 2440, 2441, 2443, 2442, 2446, 2447, 2445, 2444, 2436, 2437, 2439, 2438, 2434, 2435, 2433, 2432, 2176, 2177, 2179, 2178, 2182, 2183, 2181, 2180, 2188, 2189, 2191, 2190, 2186, 2187, 2185, 2184, 2200, 2201, 2203, 2202, 2206, 2207, 2205, 2204, 2196, 2197, 2199, 2198, 2194, 2195, 2193, 2192, 2224, 2225, 2227, 2226, 2230, 2231, 2229, 2228, 2236, 2237, 2239, 2238, 2234, 2235, 2233, 2232, 2216, 2217, 2219, 2218, 2222, 2223, 2221, 2220, 2212, 2213, 2215, 2214, 2210, 2211, 2209, 2208, 2272, 2273, 2275, 2274, 2278, 2279, 2277, 2276, 2284, 2285, 2287, 2286, 2282, 2283, 2281, 2280, 2296, 2297, 2299, 2298, 2302, 2303, 2301, 2300, 2292, 2293, 2295, 2294, 2290, 2291, 2289, 2288, 2256, 2257, 2259, 2258, 2262, 2263, 2261, 2260, 2268, 2269, 2271, 2270, 2266, 2267, 2265, 2264, 2248, 2249, 2251, 2250, 2254, 2255, 2253, 2252, 2244, 2245, 2247, 2246, 2242, 2243, 2241, 2240, 2112, 2113, 2115, 2114, 2118, 2119, 2117, 2116, 2124, 2125, 2127, 2126, 2122, 2123, 2121, 2120, 2136, 2137, 2139, 2138, 2142, 2143, 2141, 2140, 2132, 2133, 2135, 2134, 2130, 2131, 2129, 2128, 2160, 2161, 2163, 2162, 2166, 2167, 2165, 2164, 2172, 2173, 2175, 2174, 2170, 2171, 2169, 2168, 2152, 2153, 2155, 2154, 2158, 2159, 2157, 2156, 2148, 2149, 2151, 2150, 2146, 2147, 2145, 2144, 2080, 2081, 2083, 2082, 2086, 2087, 2085, 2084, 2092, 2093, 2095, 2094, 2090, 2091, 2089, 2088, 2104, 2105, 2107, 2106, 2110, 2111, 2109, 2108, 2100, 2101, 2103, 2102, 2098, 2099, 2097, 2096, 2064, 2065, 2067, 2066, 2070, 2071, 2069, 2068, 2076, 2077, 2079, 2078, 2074, 2075, 2073, 2072, 2056, 2057, 2059, 2058, 2062, 2063, 2061, 2060, 2052, 2053, 2055, 2054, 2050, 2051, 2049]\n assert candidate(n = 8,start = 128) == [128, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129]\n assert candidate(n = 5,start = 15) == [15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13]\n assert candidate(n = 11,start = 1023) == [1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 1536, 1537, 1539, 1538, 1542, 1543, 1541, 1540, 1548, 1549, 1551, 1550, 1546, 1547, 1545, 1544, 1560, 1561, 1563, 1562, 1566, 1567, 1565, 1564, 1556, 1557, 1559, 1558, 1554, 1555, 1553, 1552, 1584, 1585, 1587, 1586, 1590, 1591, 1589, 1588, 1596, 1597, 1599, 1598, 1594, 1595, 1593, 1592, 1576, 1577, 1579, 1578, 1582, 1583, 1581, 1580, 1572, 1573, 1575, 1574, 1570, 1571, 1569, 1568, 1632, 1633, 1635, 1634, 1638, 1639, 1637, 1636, 1644, 1645, 1647, 1646, 1642, 1643, 1641, 1640, 1656, 1657, 1659, 1658, 1662, 1663, 1661, 1660, 1652, 1653, 1655, 1654, 1650, 1651, 1649, 1648, 1616, 1617, 1619, 1618, 1622, 1623, 1621, 1620, 1628, 1629, 1631, 1630, 1626, 1627, 1625, 1624, 1608, 1609, 1611, 1610, 1614, 1615, 1613, 1612, 1604, 1605, 1607, 1606, 1602, 1603, 1601, 1600, 1728, 1729, 1731, 1730, 1734, 1735, 1733, 1732, 1740, 1741, 1743, 1742, 1738, 1739, 1737, 1736, 1752, 1753, 1755, 1754, 1758, 1759, 1757, 1756, 1748, 1749, 1751, 1750, 1746, 1747, 1745, 1744, 1776, 1777, 1779, 1778, 1782, 1783, 1781, 1780, 1788, 1789, 1791, 1790, 1786, 1787, 1785, 1784, 1768, 1769, 1771, 1770, 1774, 1775, 1773, 1772, 1764, 1765, 1767, 1766, 1762, 1763, 1761, 1760, 1696, 1697, 1699, 1698, 1702, 1703, 1701, 1700, 1708, 1709, 1711, 1710, 1706, 1707, 1705, 1704, 1720, 1721, 1723, 1722, 1726, 1727, 1725, 1724, 1716, 1717, 1719, 1718, 1714, 1715, 1713, 1712, 1680, 1681, 1683, 1682, 1686, 1687, 1685, 1684, 1692, 1693, 1695, 1694, 1690, 1691, 1689, 1688, 1672, 1673, 1675, 1674, 1678, 1679, 1677, 1676, 1668, 1669, 1671, 1670, 1666, 1667, 1665, 1664, 1920, 1921, 1923, 1922, 1926, 1927, 1925, 1924, 1932, 1933, 1935, 1934, 1930, 1931, 1929, 1928, 1944, 1945, 1947, 1946, 1950, 1951, 1949, 1948, 1940, 1941, 1943, 1942, 1938, 1939, 1937, 1936, 1968, 1969, 1971, 1970, 1974, 1975, 1973, 1972, 1980, 1981, 1983, 1982, 1978, 1979, 1977, 1976, 1960, 1961, 1963, 1962, 1966, 1967, 1965, 1964, 1956, 1957, 1959, 1958, 1954, 1955, 1953, 1952, 2016, 2017, 2019, 2018, 2022, 2023, 2021, 2020, 2028, 2029, 2031, 2030, 2026, 2027, 2025, 2024, 2040, 2041, 2043, 2042, 2046, 2047, 2045, 2044, 2036, 2037, 2039, 2038, 2034, 2035, 2033, 2032, 2000, 2001, 2003, 2002, 2006, 2007, 2005, 2004, 2012, 2013, 2015, 2014, 2010, 2011, 2009, 2008, 1992, 1993, 1995, 1994, 1998, 1999, 1997, 1996, 1988, 1989, 1991, 1990, 1986, 1987, 1985, 1984, 1856, 1857, 1859, 1858, 1862, 1863, 1861, 1860, 1868, 1869, 1871, 1870, 1866, 1867, 1865, 1864, 1880, 1881, 1883, 1882, 1886, 1887, 1885, 1884, 1876, 1877, 1879, 1878, 1874, 1875, 1873, 1872, 1904, 1905, 1907, 1906, 1910, 1911, 1909, 1908, 1916, 1917, 1919, 1918, 1914, 1915, 1913, 1912, 1896, 1897, 1899, 1898, 1902, 1903, 1901, 1900, 1892, 1893, 1895, 1894, 1890, 1891, 1889, 1888, 1824, 1825, 1827, 1826, 1830, 1831, 1829, 1828, 1836, 1837, 1839, 1838, 1834, 1835, 1833, 1832, 1848, 1849, 1851, 1850, 1854, 1855, 1853, 1852, 1844, 1845, 1847, 1846, 1842, 1843, 1841, 1840, 1808, 1809, 1811, 1810, 1814, 1815, 1813, 1812, 1820, 1821, 1823, 1822, 1818, 1819, 1817, 1816, 1800, 1801, 1803, 1802, 1806, 1807, 1805, 1804, 1796, 1797, 1799, 1798, 1794, 1795, 1793, 1792, 1280, 1281, 1283, 1282, 1286, 1287, 1285, 1284, 1292, 1293, 1295, 1294, 1290, 1291, 1289, 1288, 1304, 1305, 1307, 1306, 1310, 1311, 1309, 1308, 1300, 1301, 1303, 1302, 1298, 1299, 1297, 1296, 1328, 1329, 1331, 1330, 1334, 1335, 1333, 1332, 1340, 1341, 1343, 1342, 1338, 1339, 1337, 1336, 1320, 1321, 1323, 1322, 1326, 1327, 1325, 1324, 1316, 1317, 1319, 1318, 1314, 1315, 1313, 1312, 1376, 1377, 1379, 1378, 1382, 1383, 1381, 1380, 1388, 1389, 1391, 1390, 1386, 1387, 1385, 1384, 1400, 1401, 1403, 1402, 1406, 1407, 1405, 1404, 1396, 1397, 1399, 1398, 1394, 1395, 1393, 1392, 1360, 1361, 1363, 1362, 1366, 1367, 1365, 1364, 1372, 1373, 1375, 1374, 1370, 1371, 1369, 1368, 1352, 1353, 1355, 1354, 1358, 1359, 1357, 1356, 1348, 1349, 1351, 1350, 1346, 1347, 1345, 1344, 1472, 1473, 1475, 1474, 1478, 1479, 1477, 1476, 1484, 1485, 1487, 1486, 1482, 1483, 1481, 1480, 1496, 1497, 1499, 1498, 1502, 1503, 1501, 1500, 1492, 1493, 1495, 1494, 1490, 1491, 1489, 1488, 1520, 1521, 1523, 1522, 1526, 1527, 1525, 1524, 1532, 1533, 1535, 1534, 1530, 1531, 1529, 1528, 1512, 1513, 1515, 1514, 1518, 1519, 1517, 1516, 1508, 1509, 1511, 1510, 1506, 1507, 1505, 1504, 1440, 1441, 1443, 1442, 1446, 1447, 1445, 1444, 1452, 1453, 1455, 1454, 1450, 1451, 1449, 1448, 1464, 1465, 1467, 1466, 1470, 1471, 1469, 1468, 1460, 1461, 1463, 1462, 1458, 1459, 1457, 1456, 1424, 1425, 1427, 1426, 1430, 1431, 1429, 1428, 1436, 1437, 1439, 1438, 1434, 1435, 1433, 1432, 1416, 1417, 1419, 1418, 1422, 1423, 1421, 1420, 1412, 1413, 1415, 1414, 1410, 1411, 1409, 1408, 1152, 1153, 1155, 1154, 1158, 1159, 1157, 1156, 1164, 1165, 1167, 1166, 1162, 1163, 1161, 1160, 1176, 1177, 1179, 1178, 1182, 1183, 1181, 1180, 1172, 1173, 1175, 1174, 1170, 1171, 1169, 1168, 1200, 1201, 1203, 1202, 1206, 1207, 1205, 1204, 1212, 1213, 1215, 1214, 1210, 1211, 1209, 1208, 1192, 1193, 1195, 1194, 1198, 1199, 1197, 1196, 1188, 1189, 1191, 1190, 1186, 1187, 1185, 1184, 1248, 1249, 1251, 1250, 1254, 1255, 1253, 1252, 1260, 1261, 1263, 1262, 1258, 1259, 1257, 1256, 1272, 1273, 1275, 1274, 1278, 1279, 1277, 1276, 1268, 1269, 1271, 1270, 1266, 1267, 1265, 1264, 1232, 1233, 1235, 1234, 1238, 1239, 1237, 1236, 1244, 1245, 1247, 1246, 1242, 1243, 1241, 1240, 1224, 1225, 1227, 1226, 1230, 1231, 1229, 1228, 1220, 1221, 1223, 1222, 1218, 1219, 1217, 1216, 1088, 1089, 1091, 1090, 1094, 1095, 1093, 1092, 1100, 1101, 1103, 1102, 1098, 1099, 1097, 1096, 1112, 1113, 1115, 1114, 1118, 1119, 1117, 1116, 1108, 1109, 1111, 1110, 1106, 1107, 1105, 1104, 1136, 1137, 1139, 1138, 1142, 1143, 1141, 1140, 1148, 1149, 1151, 1150, 1146, 1147, 1145, 1144, 1128, 1129, 1131, 1130, 1134, 1135, 1133, 1132, 1124, 1125, 1127, 1126, 1122, 1123, 1121, 1120, 1056, 1057, 1059, 1058, 1062, 1063, 1061, 1060, 1068, 1069, 1071, 1070, 1066, 1067, 1065, 1064, 1080, 1081, 1083, 1082, 1086, 1087, 1085, 1084, 1076, 1077, 1079, 1078, 1074, 1075, 1073, 1072, 1040, 1041, 1043, 1042, 1046, 1047, 1045, 1044, 1052, 1053, 1055, 1054, 1050, 1051, 1049, 1048, 1032, 1033, 1035, 1034, 1038, 1039, 1037, 1036, 1028, 1029, 1031, 1030, 1026, 1027, 1025, 1024, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021]\n assert candidate(n = 4,start = 0) == [0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8]\n assert candidate(n = 6,start = 20) == [20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28]\n assert candidate(n = 4,start = 5) == [5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 0, 1, 3, 2, 6, 7]\n assert candidate(n = 3,start = 2) == [2, 6, 7, 5, 4, 0, 1, 3]\n assert candidate(n = 2,start = 3) == [3, 2, 0, 1]\n assert candidate(n = 5,start = 10) == [10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14]\n assert candidate(n = 7,start = 42) == [42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43]\n assert candidate(n = 10,start = 510) == [510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506]\n assert candidate(n = 9,start = 255) == [255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253]\n assert candidate(n = 12,start = 2047) == [2047, 2045, 2044, 2036, 2037, 2039, 2038, 2034, 2035, 2033, 2032, 2000, 2001, 2003, 2002, 2006, 2007, 2005, 2004, 2012, 2013, 2015, 2014, 2010, 2011, 2009, 2008, 1992, 1993, 1995, 1994, 1998, 1999, 1997, 1996, 1988, 1989, 1991, 1990, 1986, 1987, 1985, 1984, 1856, 1857, 1859, 1858, 1862, 1863, 1861, 1860, 1868, 1869, 1871, 1870, 1866, 1867, 1865, 1864, 1880, 1881, 1883, 1882, 1886, 1887, 1885, 1884, 1876, 1877, 1879, 1878, 1874, 1875, 1873, 1872, 1904, 1905, 1907, 1906, 1910, 1911, 1909, 1908, 1916, 1917, 1919, 1918, 1914, 1915, 1913, 1912, 1896, 1897, 1899, 1898, 1902, 1903, 1901, 1900, 1892, 1893, 1895, 1894, 1890, 1891, 1889, 1888, 1824, 1825, 1827, 1826, 1830, 1831, 1829, 1828, 1836, 1837, 1839, 1838, 1834, 1835, 1833, 1832, 1848, 1849, 1851, 1850, 1854, 1855, 1853, 1852, 1844, 1845, 1847, 1846, 1842, 1843, 1841, 1840, 1808, 1809, 1811, 1810, 1814, 1815, 1813, 1812, 1820, 1821, 1823, 1822, 1818, 1819, 1817, 1816, 1800, 1801, 1803, 1802, 1806, 1807, 1805, 1804, 1796, 1797, 1799, 1798, 1794, 1795, 1793, 1792, 1280, 1281, 1283, 1282, 1286, 1287, 1285, 1284, 1292, 1293, 1295, 1294, 1290, 1291, 1289, 1288, 1304, 1305, 1307, 1306, 1310, 1311, 1309, 1308, 1300, 1301, 1303, 1302, 1298, 1299, 1297, 1296, 1328, 1329, 1331, 1330, 1334, 1335, 1333, 1332, 1340, 1341, 1343, 1342, 1338, 1339, 1337, 1336, 1320, 1321, 1323, 1322, 1326, 1327, 1325, 1324, 1316, 1317, 1319, 1318, 1314, 1315, 1313, 1312, 1376, 1377, 1379, 1378, 1382, 1383, 1381, 1380, 1388, 1389, 1391, 1390, 1386, 1387, 1385, 1384, 1400, 1401, 1403, 1402, 1406, 1407, 1405, 1404, 1396, 1397, 1399, 1398, 1394, 1395, 1393, 1392, 1360, 1361, 1363, 1362, 1366, 1367, 1365, 1364, 1372, 1373, 1375, 1374, 1370, 1371, 1369, 1368, 1352, 1353, 1355, 1354, 1358, 1359, 1357, 1356, 1348, 1349, 1351, 1350, 1346, 1347, 1345, 1344, 1472, 1473, 1475, 1474, 1478, 1479, 1477, 1476, 1484, 1485, 1487, 1486, 1482, 1483, 1481, 1480, 1496, 1497, 1499, 1498, 1502, 1503, 1501, 1500, 1492, 1493, 1495, 1494, 1490, 1491, 1489, 1488, 1520, 1521, 1523, 1522, 1526, 1527, 1525, 1524, 1532, 1533, 1535, 1534, 1530, 1531, 1529, 1528, 1512, 1513, 1515, 1514, 1518, 1519, 1517, 1516, 1508, 1509, 1511, 1510, 1506, 1507, 1505, 1504, 1440, 1441, 1443, 1442, 1446, 1447, 1445, 1444, 1452, 1453, 1455, 1454, 1450, 1451, 1449, 1448, 1464, 1465, 1467, 1466, 1470, 1471, 1469, 1468, 1460, 1461, 1463, 1462, 1458, 1459, 1457, 1456, 1424, 1425, 1427, 1426, 1430, 1431, 1429, 1428, 1436, 1437, 1439, 1438, 1434, 1435, 1433, 1432, 1416, 1417, 1419, 1418, 1422, 1423, 1421, 1420, 1412, 1413, 1415, 1414, 1410, 1411, 1409, 1408, 1152, 1153, 1155, 1154, 1158, 1159, 1157, 1156, 1164, 1165, 1167, 1166, 1162, 1163, 1161, 1160, 1176, 1177, 1179, 1178, 1182, 1183, 1181, 1180, 1172, 1173, 1175, 1174, 1170, 1171, 1169, 1168, 1200, 1201, 1203, 1202, 1206, 1207, 1205, 1204, 1212, 1213, 1215, 1214, 1210, 1211, 1209, 1208, 1192, 1193, 1195, 1194, 1198, 1199, 1197, 1196, 1188, 1189, 1191, 1190, 1186, 1187, 1185, 1184, 1248, 1249, 1251, 1250, 1254, 1255, 1253, 1252, 1260, 1261, 1263, 1262, 1258, 1259, 1257, 1256, 1272, 1273, 1275, 1274, 1278, 1279, 1277, 1276, 1268, 1269, 1271, 1270, 1266, 1267, 1265, 1264, 1232, 1233, 1235, 1234, 1238, 1239, 1237, 1236, 1244, 1245, 1247, 1246, 1242, 1243, 1241, 1240, 1224, 1225, 1227, 1226, 1230, 1231, 1229, 1228, 1220, 1221, 1223, 1222, 1218, 1219, 1217, 1216, 1088, 1089, 1091, 1090, 1094, 1095, 1093, 1092, 1100, 1101, 1103, 1102, 1098, 1099, 1097, 1096, 1112, 1113, 1115, 1114, 1118, 1119, 1117, 1116, 1108, 1109, 1111, 1110, 1106, 1107, 1105, 1104, 1136, 1137, 1139, 1138, 1142, 1143, 1141, 1140, 1148, 1149, 1151, 1150, 1146, 1147, 1145, 1144, 1128, 1129, 1131, 1130, 1134, 1135, 1133, 1132, 1124, 1125, 1127, 1126, 1122, 1123, 1121, 1120, 1056, 1057, 1059, 1058, 1062, 1063, 1061, 1060, 1068, 1069, 1071, 1070, 1066, 1067, 1065, 1064, 1080, 1081, 1083, 1082, 1086, 1087, 1085, 1084, 1076, 1077, 1079, 1078, 1074, 1075, 1073, 1072, 1040, 1041, 1043, 1042, 1046, 1047, 1045, 1044, 1052, 1053, 1055, 1054, 1050, 1051, 1049, 1048, 1032, 1033, 1035, 1034, 1038, 1039, 1037, 1036, 1028, 1029, 1031, 1030, 1026, 1027, 1025, 1024, 3072, 3073, 3075, 3074, 3078, 3079, 3077, 3076, 3084, 3085, 3087, 3086, 3082, 3083, 3081, 3080, 3096, 3097, 3099, 3098, 3102, 3103, 3101, 3100, 3092, 3093, 3095, 3094, 3090, 3091, 3089, 3088, 3120, 3121, 3123, 3122, 3126, 3127, 3125, 3124, 3132, 3133, 3135, 3134, 3130, 3131, 3129, 3128, 3112, 3113, 3115, 3114, 3118, 3119, 3117, 3116, 3108, 3109, 3111, 3110, 3106, 3107, 3105, 3104, 3168, 3169, 3171, 3170, 3174, 3175, 3173, 3172, 3180, 3181, 3183, 3182, 3178, 3179, 3177, 3176, 3192, 3193, 3195, 3194, 3198, 3199, 3197, 3196, 3188, 3189, 3191, 3190, 3186, 3187, 3185, 3184, 3152, 3153, 3155, 3154, 3158, 3159, 3157, 3156, 3164, 3165, 3167, 3166, 3162, 3163, 3161, 3160, 3144, 3145, 3147, 3146, 3150, 3151, 3149, 3148, 3140, 3141, 3143, 3142, 3138, 3139, 3137, 3136, 3264, 3265, 3267, 3266, 3270, 3271, 3269, 3268, 3276, 3277, 3279, 3278, 3274, 3275, 3273, 3272, 3288, 3289, 3291, 3290, 3294, 3295, 3293, 3292, 3284, 3285, 3287, 3286, 3282, 3283, 3281, 3280, 3312, 3313, 3315, 3314, 3318, 3319, 3317, 3316, 3324, 3325, 3327, 3326, 3322, 3323, 3321, 3320, 3304, 3305, 3307, 3306, 3310, 3311, 3309, 3308, 3300, 3301, 3303, 3302, 3298, 3299, 3297, 3296, 3232, 3233, 3235, 3234, 3238, 3239, 3237, 3236, 3244, 3245, 3247, 3246, 3242, 3243, 3241, 3240, 3256, 3257, 3259, 3258, 3262, 3263, 3261, 3260, 3252, 3253, 3255, 3254, 3250, 3251, 3249, 3248, 3216, 3217, 3219, 3218, 3222, 3223, 3221, 3220, 3228, 3229, 3231, 3230, 3226, 3227, 3225, 3224, 3208, 3209, 3211, 3210, 3214, 3215, 3213, 3212, 3204, 3205, 3207, 3206, 3202, 3203, 3201, 3200, 3456, 3457, 3459, 3458, 3462, 3463, 3461, 3460, 3468, 3469, 3471, 3470, 3466, 3467, 3465, 3464, 3480, 3481, 3483, 3482, 3486, 3487, 3485, 3484, 3476, 3477, 3479, 3478, 3474, 3475, 3473, 3472, 3504, 3505, 3507, 3506, 3510, 3511, 3509, 3508, 3516, 3517, 3519, 3518, 3514, 3515, 3513, 3512, 3496, 3497, 3499, 3498, 3502, 3503, 3501, 3500, 3492, 3493, 3495, 3494, 3490, 3491, 3489, 3488, 3552, 3553, 3555, 3554, 3558, 3559, 3557, 3556, 3564, 3565, 3567, 3566, 3562, 3563, 3561, 3560, 3576, 3577, 3579, 3578, 3582, 3583, 3581, 3580, 3572, 3573, 3575, 3574, 3570, 3571, 3569, 3568, 3536, 3537, 3539, 3538, 3542, 3543, 3541, 3540, 3548, 3549, 3551, 3550, 3546, 3547, 3545, 3544, 3528, 3529, 3531, 3530, 3534, 3535, 3533, 3532, 3524, 3525, 3527, 3526, 3522, 3523, 3521, 3520, 3392, 3393, 3395, 3394, 3398, 3399, 3397, 3396, 3404, 3405, 3407, 3406, 3402, 3403, 3401, 3400, 3416, 3417, 3419, 3418, 3422, 3423, 3421, 3420, 3412, 3413, 3415, 3414, 3410, 3411, 3409, 3408, 3440, 3441, 3443, 3442, 3446, 3447, 3445, 3444, 3452, 3453, 3455, 3454, 3450, 3451, 3449, 3448, 3432, 3433, 3435, 3434, 3438, 3439, 3437, 3436, 3428, 3429, 3431, 3430, 3426, 3427, 3425, 3424, 3360, 3361, 3363, 3362, 3366, 3367, 3365, 3364, 3372, 3373, 3375, 3374, 3370, 3371, 3369, 3368, 3384, 3385, 3387, 3386, 3390, 3391, 3389, 3388, 3380, 3381, 3383, 3382, 3378, 3379, 3377, 3376, 3344, 3345, 3347, 3346, 3350, 3351, 3349, 3348, 3356, 3357, 3359, 3358, 3354, 3355, 3353, 3352, 3336, 3337, 3339, 3338, 3342, 3343, 3341, 3340, 3332, 3333, 3335, 3334, 3330, 3331, 3329, 3328, 3840, 3841, 3843, 3842, 3846, 3847, 3845, 3844, 3852, 3853, 3855, 3854, 3850, 3851, 3849, 3848, 3864, 3865, 3867, 3866, 3870, 3871, 3869, 3868, 3860, 3861, 3863, 3862, 3858, 3859, 3857, 3856, 3888, 3889, 3891, 3890, 3894, 3895, 3893, 3892, 3900, 3901, 3903, 3902, 3898, 3899, 3897, 3896, 3880, 3881, 3883, 3882, 3886, 3887, 3885, 3884, 3876, 3877, 3879, 3878, 3874, 3875, 3873, 3872, 3936, 3937, 3939, 3938, 3942, 3943, 3941, 3940, 3948, 3949, 3951, 3950, 3946, 3947, 3945, 3944, 3960, 3961, 3963, 3962, 3966, 3967, 3965, 3964, 3956, 3957, 3959, 3958, 3954, 3955, 3953, 3952, 3920, 3921, 3923, 3922, 3926, 3927, 3925, 3924, 3932, 3933, 3935, 3934, 3930, 3931, 3929, 3928, 3912, 3913, 3915, 3914, 3918, 3919, 3917, 3916, 3908, 3909, 3911, 3910, 3906, 3907, 3905, 3904, 4032, 4033, 4035, 4034, 4038, 4039, 4037, 4036, 4044, 4045, 4047, 4046, 4042, 4043, 4041, 4040, 4056, 4057, 4059, 4058, 4062, 4063, 4061, 4060, 4052, 4053, 4055, 4054, 4050, 4051, 4049, 4048, 4080, 4081, 4083, 4082, 4086, 4087, 4085, 4084, 4092, 4093, 4095, 4094, 4090, 4091, 4089, 4088, 4072, 4073, 4075, 4074, 4078, 4079, 4077, 4076, 4068, 4069, 4071, 4070, 4066, 4067, 4065, 4064, 4000, 4001, 4003, 4002, 4006, 4007, 4005, 4004, 4012, 4013, 4015, 4014, 4010, 4011, 4009, 4008, 4024, 4025, 4027, 4026, 4030, 4031, 4029, 4028, 4020, 4021, 4023, 4022, 4018, 4019, 4017, 4016, 3984, 3985, 3987, 3986, 3990, 3991, 3989, 3988, 3996, 3997, 3999, 3998, 3994, 3995, 3993, 3992, 3976, 3977, 3979, 3978, 3982, 3983, 3981, 3980, 3972, 3973, 3975, 3974, 3970, 3971, 3969, 3968, 3712, 3713, 3715, 3714, 3718, 3719, 3717, 3716, 3724, 3725, 3727, 3726, 3722, 3723, 3721, 3720, 3736, 3737, 3739, 3738, 3742, 3743, 3741, 3740, 3732, 3733, 3735, 3734, 3730, 3731, 3729, 3728, 3760, 3761, 3763, 3762, 3766, 3767, 3765, 3764, 3772, 3773, 3775, 3774, 3770, 3771, 3769, 3768, 3752, 3753, 3755, 3754, 3758, 3759, 3757, 3756, 3748, 3749, 3751, 3750, 3746, 3747, 3745, 3744, 3808, 3809, 3811, 3810, 3814, 3815, 3813, 3812, 3820, 3821, 3823, 3822, 3818, 3819, 3817, 3816, 3832, 3833, 3835, 3834, 3838, 3839, 3837, 3836, 3828, 3829, 3831, 3830, 3826, 3827, 3825, 3824, 3792, 3793, 3795, 3794, 3798, 3799, 3797, 3796, 3804, 3805, 3807, 3806, 3802, 3803, 3801, 3800, 3784, 3785, 3787, 3786, 3790, 3791, 3789, 3788, 3780, 3781, 3783, 3782, 3778, 3779, 3777, 3776, 3648, 3649, 3651, 3650, 3654, 3655, 3653, 3652, 3660, 3661, 3663, 3662, 3658, 3659, 3657, 3656, 3672, 3673, 3675, 3674, 3678, 3679, 3677, 3676, 3668, 3669, 3671, 3670, 3666, 3667, 3665, 3664, 3696, 3697, 3699, 3698, 3702, 3703, 3701, 3700, 3708, 3709, 3711, 3710, 3706, 3707, 3705, 3704, 3688, 3689, 3691, 3690, 3694, 3695, 3693, 3692, 3684, 3685, 3687, 3686, 3682, 3683, 3681, 3680, 3616, 3617, 3619, 3618, 3622, 3623, 3621, 3620, 3628, 3629, 3631, 3630, 3626, 3627, 3625, 3624, 3640, 3641, 3643, 3642, 3646, 3647, 3645, 3644, 3636, 3637, 3639, 3638, 3634, 3635, 3633, 3632, 3600, 3601, 3603, 3602, 3606, 3607, 3605, 3604, 3612, 3613, 3615, 3614, 3610, 3611, 3609, 3608, 3592, 3593, 3595, 3594, 3598, 3599, 3597, 3596, 3588, 3589, 3591, 3590, 3586, 3587, 3585, 3584, 2560, 2561, 2563, 2562, 2566, 2567, 2565, 2564, 2572, 2573, 2575, 2574, 2570, 2571, 2569, 2568, 2584, 2585, 2587, 2586, 2590, 2591, 2589, 2588, 2580, 2581, 2583, 2582, 2578, 2579, 2577, 2576, 2608, 2609, 2611, 2610, 2614, 2615, 2613, 2612, 2620, 2621, 2623, 2622, 2618, 2619, 2617, 2616, 2600, 2601, 2603, 2602, 2606, 2607, 2605, 2604, 2596, 2597, 2599, 2598, 2594, 2595, 2593, 2592, 2656, 2657, 2659, 2658, 2662, 2663, 2661, 2660, 2668, 2669, 2671, 2670, 2666, 2667, 2665, 2664, 2680, 2681, 2683, 2682, 2686, 2687, 2685, 2684, 2676, 2677, 2679, 2678, 2674, 2675, 2673, 2672, 2640, 2641, 2643, 2642, 2646, 2647, 2645, 2644, 2652, 2653, 2655, 2654, 2650, 2651, 2649, 2648, 2632, 2633, 2635, 2634, 2638, 2639, 2637, 2636, 2628, 2629, 2631, 2630, 2626, 2627, 2625, 2624, 2752, 2753, 2755, 2754, 2758, 2759, 2757, 2756, 2764, 2765, 2767, 2766, 2762, 2763, 2761, 2760, 2776, 2777, 2779, 2778, 2782, 2783, 2781, 2780, 2772, 2773, 2775, 2774, 2770, 2771, 2769, 2768, 2800, 2801, 2803, 2802, 2806, 2807, 2805, 2804, 2812, 2813, 2815, 2814, 2810, 2811, 2809, 2808, 2792, 2793, 2795, 2794, 2798, 2799, 2797, 2796, 2788, 2789, 2791, 2790, 2786, 2787, 2785, 2784, 2720, 2721, 2723, 2722, 2726, 2727, 2725, 2724, 2732, 2733, 2735, 2734, 2730, 2731, 2729, 2728, 2744, 2745, 2747, 2746, 2750, 2751, 2749, 2748, 2740, 2741, 2743, 2742, 2738, 2739, 2737, 2736, 2704, 2705, 2707, 2706, 2710, 2711, 2709, 2708, 2716, 2717, 2719, 2718, 2714, 2715, 2713, 2712, 2696, 2697, 2699, 2698, 2702, 2703, 2701, 2700, 2692, 2693, 2695, 2694, 2690, 2691, 2689, 2688, 2944, 2945, 2947, 2946, 2950, 2951, 2949, 2948, 2956, 2957, 2959, 2958, 2954, 2955, 2953, 2952, 2968, 2969, 2971, 2970, 2974, 2975, 2973, 2972, 2964, 2965, 2967, 2966, 2962, 2963, 2961, 2960, 2992, 2993, 2995, 2994, 2998, 2999, 2997, 2996, 3004, 3005, 3007, 3006, 3002, 3003, 3001, 3000, 2984, 2985, 2987, 2986, 2990, 2991, 2989, 2988, 2980, 2981, 2983, 2982, 2978, 2979, 2977, 2976, 3040, 3041, 3043, 3042, 3046, 3047, 3045, 3044, 3052, 3053, 3055, 3054, 3050, 3051, 3049, 3048, 3064, 3065, 3067, 3066, 3070, 3071, 3069, 3068, 3060, 3061, 3063, 3062, 3058, 3059, 3057, 3056, 3024, 3025, 3027, 3026, 3030, 3031, 3029, 3028, 3036, 3037, 3039, 3038, 3034, 3035, 3033, 3032, 3016, 3017, 3019, 3018, 3022, 3023, 3021, 3020, 3012, 3013, 3015, 3014, 3010, 3011, 3009, 3008, 2880, 2881, 2883, 2882, 2886, 2887, 2885, 2884, 2892, 2893, 2895, 2894, 2890, 2891, 2889, 2888, 2904, 2905, 2907, 2906, 2910, 2911, 2909, 2908, 2900, 2901, 2903, 2902, 2898, 2899, 2897, 2896, 2928, 2929, 2931, 2930, 2934, 2935, 2933, 2932, 2940, 2941, 2943, 2942, 2938, 2939, 2937, 2936, 2920, 2921, 2923, 2922, 2926, 2927, 2925, 2924, 2916, 2917, 2919, 2918, 2914, 2915, 2913, 2912, 2848, 2849, 2851, 2850, 2854, 2855, 2853, 2852, 2860, 2861, 2863, 2862, 2858, 2859, 2857, 2856, 2872, 2873, 2875, 2874, 2878, 2879, 2877, 2876, 2868, 2869, 2871, 2870, 2866, 2867, 2865, 2864, 2832, 2833, 2835, 2834, 2838, 2839, 2837, 2836, 2844, 2845, 2847, 2846, 2842, 2843, 2841, 2840, 2824, 2825, 2827, 2826, 2830, 2831, 2829, 2828, 2820, 2821, 2823, 2822, 2818, 2819, 2817, 2816, 2304, 2305, 2307, 2306, 2310, 2311, 2309, 2308, 2316, 2317, 2319, 2318, 2314, 2315, 2313, 2312, 2328, 2329, 2331, 2330, 2334, 2335, 2333, 2332, 2324, 2325, 2327, 2326, 2322, 2323, 2321, 2320, 2352, 2353, 2355, 2354, 2358, 2359, 2357, 2356, 2364, 2365, 2367, 2366, 2362, 2363, 2361, 2360, 2344, 2345, 2347, 2346, 2350, 2351, 2349, 2348, 2340, 2341, 2343, 2342, 2338, 2339, 2337, 2336, 2400, 2401, 2403, 2402, 2406, 2407, 2405, 2404, 2412, 2413, 2415, 2414, 2410, 2411, 2409, 2408, 2424, 2425, 2427, 2426, 2430, 2431, 2429, 2428, 2420, 2421, 2423, 2422, 2418, 2419, 2417, 2416, 2384, 2385, 2387, 2386, 2390, 2391, 2389, 2388, 2396, 2397, 2399, 2398, 2394, 2395, 2393, 2392, 2376, 2377, 2379, 2378, 2382, 2383, 2381, 2380, 2372, 2373, 2375, 2374, 2370, 2371, 2369, 2368, 2496, 2497, 2499, 2498, 2502, 2503, 2501, 2500, 2508, 2509, 2511, 2510, 2506, 2507, 2505, 2504, 2520, 2521, 2523, 2522, 2526, 2527, 2525, 2524, 2516, 2517, 2519, 2518, 2514, 2515, 2513, 2512, 2544, 2545, 2547, 2546, 2550, 2551, 2549, 2548, 2556, 2557, 2559, 2558, 2554, 2555, 2553, 2552, 2536, 2537, 2539, 2538, 2542, 2543, 2541, 2540, 2532, 2533, 2535, 2534, 2530, 2531, 2529, 2528, 2464, 2465, 2467, 2466, 2470, 2471, 2469, 2468, 2476, 2477, 2479, 2478, 2474, 2475, 2473, 2472, 2488, 2489, 2491, 2490, 2494, 2495, 2493, 2492, 2484, 2485, 2487, 2486, 2482, 2483, 2481, 2480, 2448, 2449, 2451, 2450, 2454, 2455, 2453, 2452, 2460, 2461, 2463, 2462, 2458, 2459, 2457, 2456, 2440, 2441, 2443, 2442, 2446, 2447, 2445, 2444, 2436, 2437, 2439, 2438, 2434, 2435, 2433, 2432, 2176, 2177, 2179, 2178, 2182, 2183, 2181, 2180, 2188, 2189, 2191, 2190, 2186, 2187, 2185, 2184, 2200, 2201, 2203, 2202, 2206, 2207, 2205, 2204, 2196, 2197, 2199, 2198, 2194, 2195, 2193, 2192, 2224, 2225, 2227, 2226, 2230, 2231, 2229, 2228, 2236, 2237, 2239, 2238, 2234, 2235, 2233, 2232, 2216, 2217, 2219, 2218, 2222, 2223, 2221, 2220, 2212, 2213, 2215, 2214, 2210, 2211, 2209, 2208, 2272, 2273, 2275, 2274, 2278, 2279, 2277, 2276, 2284, 2285, 2287, 2286, 2282, 2283, 2281, 2280, 2296, 2297, 2299, 2298, 2302, 2303, 2301, 2300, 2292, 2293, 2295, 2294, 2290, 2291, 2289, 2288, 2256, 2257, 2259, 2258, 2262, 2263, 2261, 2260, 2268, 2269, 2271, 2270, 2266, 2267, 2265, 2264, 2248, 2249, 2251, 2250, 2254, 2255, 2253, 2252, 2244, 2245, 2247, 2246, 2242, 2243, 2241, 2240, 2112, 2113, 2115, 2114, 2118, 2119, 2117, 2116, 2124, 2125, 2127, 2126, 2122, 2123, 2121, 2120, 2136, 2137, 2139, 2138, 2142, 2143, 2141, 2140, 2132, 2133, 2135, 2134, 2130, 2131, 2129, 2128, 2160, 2161, 2163, 2162, 2166, 2167, 2165, 2164, 2172, 2173, 2175, 2174, 2170, 2171, 2169, 2168, 2152, 2153, 2155, 2154, 2158, 2159, 2157, 2156, 2148, 2149, 2151, 2150, 2146, 2147, 2145, 2144, 2080, 2081, 2083, 2082, 2086, 2087, 2085, 2084, 2092, 2093, 2095, 2094, 2090, 2091, 2089, 2088, 2104, 2105, 2107, 2106, 2110, 2111, 2109, 2108, 2100, 2101, 2103, 2102, 2098, 2099, 2097, 2096, 2064, 2065, 2067, 2066, 2070, 2071, 2069, 2068, 2076, 2077, 2079, 2078, 2074, 2075, 2073, 2072, 2056, 2057, 2059, 2058, 2062, 2063, 2061, 2060, 2052, 2053, 2055, 2054, 2050, 2051, 2049, 2048, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 1536, 1537, 1539, 1538, 1542, 1543, 1541, 1540, 1548, 1549, 1551, 1550, 1546, 1547, 1545, 1544, 1560, 1561, 1563, 1562, 1566, 1567, 1565, 1564, 1556, 1557, 1559, 1558, 1554, 1555, 1553, 1552, 1584, 1585, 1587, 1586, 1590, 1591, 1589, 1588, 1596, 1597, 1599, 1598, 1594, 1595, 1593, 1592, 1576, 1577, 1579, 1578, 1582, 1583, 1581, 1580, 1572, 1573, 1575, 1574, 1570, 1571, 1569, 1568, 1632, 1633, 1635, 1634, 1638, 1639, 1637, 1636, 1644, 1645, 1647, 1646, 1642, 1643, 1641, 1640, 1656, 1657, 1659, 1658, 1662, 1663, 1661, 1660, 1652, 1653, 1655, 1654, 1650, 1651, 1649, 1648, 1616, 1617, 1619, 1618, 1622, 1623, 1621, 1620, 1628, 1629, 1631, 1630, 1626, 1627, 1625, 1624, 1608, 1609, 1611, 1610, 1614, 1615, 1613, 1612, 1604, 1605, 1607, 1606, 1602, 1603, 1601, 1600, 1728, 1729, 1731, 1730, 1734, 1735, 1733, 1732, 1740, 1741, 1743, 1742, 1738, 1739, 1737, 1736, 1752, 1753, 1755, 1754, 1758, 1759, 1757, 1756, 1748, 1749, 1751, 1750, 1746, 1747, 1745, 1744, 1776, 1777, 1779, 1778, 1782, 1783, 1781, 1780, 1788, 1789, 1791, 1790, 1786, 1787, 1785, 1784, 1768, 1769, 1771, 1770, 1774, 1775, 1773, 1772, 1764, 1765, 1767, 1766, 1762, 1763, 1761, 1760, 1696, 1697, 1699, 1698, 1702, 1703, 1701, 1700, 1708, 1709, 1711, 1710, 1706, 1707, 1705, 1704, 1720, 1721, 1723, 1722, 1726, 1727, 1725, 1724, 1716, 1717, 1719, 1718, 1714, 1715, 1713, 1712, 1680, 1681, 1683, 1682, 1686, 1687, 1685, 1684, 1692, 1693, 1695, 1694, 1690, 1691, 1689, 1688, 1672, 1673, 1675, 1674, 1678, 1679, 1677, 1676, 1668, 1669, 1671, 1670, 1666, 1667, 1665, 1664, 1920, 1921, 1923, 1922, 1926, 1927, 1925, 1924, 1932, 1933, 1935, 1934, 1930, 1931, 1929, 1928, 1944, 1945, 1947, 1946, 1950, 1951, 1949, 1948, 1940, 1941, 1943, 1942, 1938, 1939, 1937, 1936, 1968, 1969, 1971, 1970, 1974, 1975, 1973, 1972, 1980, 1981, 1983, 1982, 1978, 1979, 1977, 1976, 1960, 1961, 1963, 1962, 1966, 1967, 1965, 1964, 1956, 1957, 1959, 1958, 1954, 1955, 1953, 1952, 2016, 2017, 2019, 2018, 2022, 2023, 2021, 2020, 2028, 2029, 2031, 2030, 2026, 2027, 2025, 2024, 2040, 2041, 2043, 2042, 2046]\n assert candidate(n = 10,start = 511) == [511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510]\n assert candidate(n = 7,start = 64) == [64, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65]\n assert candidate(n = 6,start = 32) == [32, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33]\n assert candidate(n = 3,start = 7) == [7, 5, 4, 0, 1, 3, 2, 6]\n assert candidate(n = 5,start = 16) == [16, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17]\n assert candidate(n = 8,start = 255) == [255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253]\n assert candidate(n = 7,start = 56) == [56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57]\n assert candidate(n = 7,start = 48) == [48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16]\n assert candidate(n = 9,start = 127) == [127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126]\n assert candidate(n = 9,start = 256) == [256, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257]\n assert candidate(n = 8,start = 15) == [15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13]\n assert candidate(n = 11,start = 2047) == [2047, 2045, 2044, 2036, 2037, 2039, 2038, 2034, 2035, 2033, 2032, 2000, 2001, 2003, 2002, 2006, 2007, 2005, 2004, 2012, 2013, 2015, 2014, 2010, 2011, 2009, 2008, 1992, 1993, 1995, 1994, 1998, 1999, 1997, 1996, 1988, 1989, 1991, 1990, 1986, 1987, 1985, 1984, 1856, 1857, 1859, 1858, 1862, 1863, 1861, 1860, 1868, 1869, 1871, 1870, 1866, 1867, 1865, 1864, 1880, 1881, 1883, 1882, 1886, 1887, 1885, 1884, 1876, 1877, 1879, 1878, 1874, 1875, 1873, 1872, 1904, 1905, 1907, 1906, 1910, 1911, 1909, 1908, 1916, 1917, 1919, 1918, 1914, 1915, 1913, 1912, 1896, 1897, 1899, 1898, 1902, 1903, 1901, 1900, 1892, 1893, 1895, 1894, 1890, 1891, 1889, 1888, 1824, 1825, 1827, 1826, 1830, 1831, 1829, 1828, 1836, 1837, 1839, 1838, 1834, 1835, 1833, 1832, 1848, 1849, 1851, 1850, 1854, 1855, 1853, 1852, 1844, 1845, 1847, 1846, 1842, 1843, 1841, 1840, 1808, 1809, 1811, 1810, 1814, 1815, 1813, 1812, 1820, 1821, 1823, 1822, 1818, 1819, 1817, 1816, 1800, 1801, 1803, 1802, 1806, 1807, 1805, 1804, 1796, 1797, 1799, 1798, 1794, 1795, 1793, 1792, 1280, 1281, 1283, 1282, 1286, 1287, 1285, 1284, 1292, 1293, 1295, 1294, 1290, 1291, 1289, 1288, 1304, 1305, 1307, 1306, 1310, 1311, 1309, 1308, 1300, 1301, 1303, 1302, 1298, 1299, 1297, 1296, 1328, 1329, 1331, 1330, 1334, 1335, 1333, 1332, 1340, 1341, 1343, 1342, 1338, 1339, 1337, 1336, 1320, 1321, 1323, 1322, 1326, 1327, 1325, 1324, 1316, 1317, 1319, 1318, 1314, 1315, 1313, 1312, 1376, 1377, 1379, 1378, 1382, 1383, 1381, 1380, 1388, 1389, 1391, 1390, 1386, 1387, 1385, 1384, 1400, 1401, 1403, 1402, 1406, 1407, 1405, 1404, 1396, 1397, 1399, 1398, 1394, 1395, 1393, 1392, 1360, 1361, 1363, 1362, 1366, 1367, 1365, 1364, 1372, 1373, 1375, 1374, 1370, 1371, 1369, 1368, 1352, 1353, 1355, 1354, 1358, 1359, 1357, 1356, 1348, 1349, 1351, 1350, 1346, 1347, 1345, 1344, 1472, 1473, 1475, 1474, 1478, 1479, 1477, 1476, 1484, 1485, 1487, 1486, 1482, 1483, 1481, 1480, 1496, 1497, 1499, 1498, 1502, 1503, 1501, 1500, 1492, 1493, 1495, 1494, 1490, 1491, 1489, 1488, 1520, 1521, 1523, 1522, 1526, 1527, 1525, 1524, 1532, 1533, 1535, 1534, 1530, 1531, 1529, 1528, 1512, 1513, 1515, 1514, 1518, 1519, 1517, 1516, 1508, 1509, 1511, 1510, 1506, 1507, 1505, 1504, 1440, 1441, 1443, 1442, 1446, 1447, 1445, 1444, 1452, 1453, 1455, 1454, 1450, 1451, 1449, 1448, 1464, 1465, 1467, 1466, 1470, 1471, 1469, 1468, 1460, 1461, 1463, 1462, 1458, 1459, 1457, 1456, 1424, 1425, 1427, 1426, 1430, 1431, 1429, 1428, 1436, 1437, 1439, 1438, 1434, 1435, 1433, 1432, 1416, 1417, 1419, 1418, 1422, 1423, 1421, 1420, 1412, 1413, 1415, 1414, 1410, 1411, 1409, 1408, 1152, 1153, 1155, 1154, 1158, 1159, 1157, 1156, 1164, 1165, 1167, 1166, 1162, 1163, 1161, 1160, 1176, 1177, 1179, 1178, 1182, 1183, 1181, 1180, 1172, 1173, 1175, 1174, 1170, 1171, 1169, 1168, 1200, 1201, 1203, 1202, 1206, 1207, 1205, 1204, 1212, 1213, 1215, 1214, 1210, 1211, 1209, 1208, 1192, 1193, 1195, 1194, 1198, 1199, 1197, 1196, 1188, 1189, 1191, 1190, 1186, 1187, 1185, 1184, 1248, 1249, 1251, 1250, 1254, 1255, 1253, 1252, 1260, 1261, 1263, 1262, 1258, 1259, 1257, 1256, 1272, 1273, 1275, 1274, 1278, 1279, 1277, 1276, 1268, 1269, 1271, 1270, 1266, 1267, 1265, 1264, 1232, 1233, 1235, 1234, 1238, 1239, 1237, 1236, 1244, 1245, 1247, 1246, 1242, 1243, 1241, 1240, 1224, 1225, 1227, 1226, 1230, 1231, 1229, 1228, 1220, 1221, 1223, 1222, 1218, 1219, 1217, 1216, 1088, 1089, 1091, 1090, 1094, 1095, 1093, 1092, 1100, 1101, 1103, 1102, 1098, 1099, 1097, 1096, 1112, 1113, 1115, 1114, 1118, 1119, 1117, 1116, 1108, 1109, 1111, 1110, 1106, 1107, 1105, 1104, 1136, 1137, 1139, 1138, 1142, 1143, 1141, 1140, 1148, 1149, 1151, 1150, 1146, 1147, 1145, 1144, 1128, 1129, 1131, 1130, 1134, 1135, 1133, 1132, 1124, 1125, 1127, 1126, 1122, 1123, 1121, 1120, 1056, 1057, 1059, 1058, 1062, 1063, 1061, 1060, 1068, 1069, 1071, 1070, 1066, 1067, 1065, 1064, 1080, 1081, 1083, 1082, 1086, 1087, 1085, 1084, 1076, 1077, 1079, 1078, 1074, 1075, 1073, 1072, 1040, 1041, 1043, 1042, 1046, 1047, 1045, 1044, 1052, 1053, 1055, 1054, 1050, 1051, 1049, 1048, 1032, 1033, 1035, 1034, 1038, 1039, 1037, 1036, 1028, 1029, 1031, 1030, 1026, 1027, 1025, 1024, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 1536, 1537, 1539, 1538, 1542, 1543, 1541, 1540, 1548, 1549, 1551, 1550, 1546, 1547, 1545, 1544, 1560, 1561, 1563, 1562, 1566, 1567, 1565, 1564, 1556, 1557, 1559, 1558, 1554, 1555, 1553, 1552, 1584, 1585, 1587, 1586, 1590, 1591, 1589, 1588, 1596, 1597, 1599, 1598, 1594, 1595, 1593, 1592, 1576, 1577, 1579, 1578, 1582, 1583, 1581, 1580, 1572, 1573, 1575, 1574, 1570, 1571, 1569, 1568, 1632, 1633, 1635, 1634, 1638, 1639, 1637, 1636, 1644, 1645, 1647, 1646, 1642, 1643, 1641, 1640, 1656, 1657, 1659, 1658, 1662, 1663, 1661, 1660, 1652, 1653, 1655, 1654, 1650, 1651, 1649, 1648, 1616, 1617, 1619, 1618, 1622, 1623, 1621, 1620, 1628, 1629, 1631, 1630, 1626, 1627, 1625, 1624, 1608, 1609, 1611, 1610, 1614, 1615, 1613, 1612, 1604, 1605, 1607, 1606, 1602, 1603, 1601, 1600, 1728, 1729, 1731, 1730, 1734, 1735, 1733, 1732, 1740, 1741, 1743, 1742, 1738, 1739, 1737, 1736, 1752, 1753, 1755, 1754, 1758, 1759, 1757, 1756, 1748, 1749, 1751, 1750, 1746, 1747, 1745, 1744, 1776, 1777, 1779, 1778, 1782, 1783, 1781, 1780, 1788, 1789, 1791, 1790, 1786, 1787, 1785, 1784, 1768, 1769, 1771, 1770, 1774, 1775, 1773, 1772, 1764, 1765, 1767, 1766, 1762, 1763, 1761, 1760, 1696, 1697, 1699, 1698, 1702, 1703, 1701, 1700, 1708, 1709, 1711, 1710, 1706, 1707, 1705, 1704, 1720, 1721, 1723, 1722, 1726, 1727, 1725, 1724, 1716, 1717, 1719, 1718, 1714, 1715, 1713, 1712, 1680, 1681, 1683, 1682, 1686, 1687, 1685, 1684, 1692, 1693, 1695, 1694, 1690, 1691, 1689, 1688, 1672, 1673, 1675, 1674, 1678, 1679, 1677, 1676, 1668, 1669, 1671, 1670, 1666, 1667, 1665, 1664, 1920, 1921, 1923, 1922, 1926, 1927, 1925, 1924, 1932, 1933, 1935, 1934, 1930, 1931, 1929, 1928, 1944, 1945, 1947, 1946, 1950, 1951, 1949, 1948, 1940, 1941, 1943, 1942, 1938, 1939, 1937, 1936, 1968, 1969, 1971, 1970, 1974, 1975, 1973, 1972, 1980, 1981, 1983, 1982, 1978, 1979, 1977, 1976, 1960, 1961, 1963, 1962, 1966, 1967, 1965, 1964, 1956, 1957, 1959, 1958, 1954, 1955, 1953, 1952, 2016, 2017, 2019, 2018, 2022, 2023, 2021, 2020, 2028, 2029, 2031, 2030, 2026, 2027, 2025, 2024, 2040, 2041, 2043, 2042, 2046]\n assert candidate(n = 9,start = 511) == [511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510]\n assert candidate(n = 8,start = 3) == [3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 0, 1]\n assert candidate(n = 5,start = 7) == [7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 0, 1, 3, 2, 6]\n assert candidate(n = 8,start = 7) == [7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 0, 1, 3, 2, 6]\n assert candidate(n = 8,start = 31) == [31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30]\n assert candidate(n = 10,start = 7) == [7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 0, 1, 3, 2, 6]\n assert candidate(n = 6,start = 31) == [31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30]\n assert candidate(n = 2,start = 2) == [2, 0, 1, 3]\n assert candidate(n = 10,start = 63) == [63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61]\n assert candidate(n = 10,start = 31) == [31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30]\n assert candidate(n = 12,start = 4095) == [4095, 4094, 4090, 4091, 4089, 4088, 4072, 4073, 4075, 4074, 4078, 4079, 4077, 4076, 4068, 4069, 4071, 4070, 4066, 4067, 4065, 4064, 4000, 4001, 4003, 4002, 4006, 4007, 4005, 4004, 4012, 4013, 4015, 4014, 4010, 4011, 4009, 4008, 4024, 4025, 4027, 4026, 4030, 4031, 4029, 4028, 4020, 4021, 4023, 4022, 4018, 4019, 4017, 4016, 3984, 3985, 3987, 3986, 3990, 3991, 3989, 3988, 3996, 3997, 3999, 3998, 3994, 3995, 3993, 3992, 3976, 3977, 3979, 3978, 3982, 3983, 3981, 3980, 3972, 3973, 3975, 3974, 3970, 3971, 3969, 3968, 3712, 3713, 3715, 3714, 3718, 3719, 3717, 3716, 3724, 3725, 3727, 3726, 3722, 3723, 3721, 3720, 3736, 3737, 3739, 3738, 3742, 3743, 3741, 3740, 3732, 3733, 3735, 3734, 3730, 3731, 3729, 3728, 3760, 3761, 3763, 3762, 3766, 3767, 3765, 3764, 3772, 3773, 3775, 3774, 3770, 3771, 3769, 3768, 3752, 3753, 3755, 3754, 3758, 3759, 3757, 3756, 3748, 3749, 3751, 3750, 3746, 3747, 3745, 3744, 3808, 3809, 3811, 3810, 3814, 3815, 3813, 3812, 3820, 3821, 3823, 3822, 3818, 3819, 3817, 3816, 3832, 3833, 3835, 3834, 3838, 3839, 3837, 3836, 3828, 3829, 3831, 3830, 3826, 3827, 3825, 3824, 3792, 3793, 3795, 3794, 3798, 3799, 3797, 3796, 3804, 3805, 3807, 3806, 3802, 3803, 3801, 3800, 3784, 3785, 3787, 3786, 3790, 3791, 3789, 3788, 3780, 3781, 3783, 3782, 3778, 3779, 3777, 3776, 3648, 3649, 3651, 3650, 3654, 3655, 3653, 3652, 3660, 3661, 3663, 3662, 3658, 3659, 3657, 3656, 3672, 3673, 3675, 3674, 3678, 3679, 3677, 3676, 3668, 3669, 3671, 3670, 3666, 3667, 3665, 3664, 3696, 3697, 3699, 3698, 3702, 3703, 3701, 3700, 3708, 3709, 3711, 3710, 3706, 3707, 3705, 3704, 3688, 3689, 3691, 3690, 3694, 3695, 3693, 3692, 3684, 3685, 3687, 3686, 3682, 3683, 3681, 3680, 3616, 3617, 3619, 3618, 3622, 3623, 3621, 3620, 3628, 3629, 3631, 3630, 3626, 3627, 3625, 3624, 3640, 3641, 3643, 3642, 3646, 3647, 3645, 3644, 3636, 3637, 3639, 3638, 3634, 3635, 3633, 3632, 3600, 3601, 3603, 3602, 3606, 3607, 3605, 3604, 3612, 3613, 3615, 3614, 3610, 3611, 3609, 3608, 3592, 3593, 3595, 3594, 3598, 3599, 3597, 3596, 3588, 3589, 3591, 3590, 3586, 3587, 3585, 3584, 2560, 2561, 2563, 2562, 2566, 2567, 2565, 2564, 2572, 2573, 2575, 2574, 2570, 2571, 2569, 2568, 2584, 2585, 2587, 2586, 2590, 2591, 2589, 2588, 2580, 2581, 2583, 2582, 2578, 2579, 2577, 2576, 2608, 2609, 2611, 2610, 2614, 2615, 2613, 2612, 2620, 2621, 2623, 2622, 2618, 2619, 2617, 2616, 2600, 2601, 2603, 2602, 2606, 2607, 2605, 2604, 2596, 2597, 2599, 2598, 2594, 2595, 2593, 2592, 2656, 2657, 2659, 2658, 2662, 2663, 2661, 2660, 2668, 2669, 2671, 2670, 2666, 2667, 2665, 2664, 2680, 2681, 2683, 2682, 2686, 2687, 2685, 2684, 2676, 2677, 2679, 2678, 2674, 2675, 2673, 2672, 2640, 2641, 2643, 2642, 2646, 2647, 2645, 2644, 2652, 2653, 2655, 2654, 2650, 2651, 2649, 2648, 2632, 2633, 2635, 2634, 2638, 2639, 2637, 2636, 2628, 2629, 2631, 2630, 2626, 2627, 2625, 2624, 2752, 2753, 2755, 2754, 2758, 2759, 2757, 2756, 2764, 2765, 2767, 2766, 2762, 2763, 2761, 2760, 2776, 2777, 2779, 2778, 2782, 2783, 2781, 2780, 2772, 2773, 2775, 2774, 2770, 2771, 2769, 2768, 2800, 2801, 2803, 2802, 2806, 2807, 2805, 2804, 2812, 2813, 2815, 2814, 2810, 2811, 2809, 2808, 2792, 2793, 2795, 2794, 2798, 2799, 2797, 2796, 2788, 2789, 2791, 2790, 2786, 2787, 2785, 2784, 2720, 2721, 2723, 2722, 2726, 2727, 2725, 2724, 2732, 2733, 2735, 2734, 2730, 2731, 2729, 2728, 2744, 2745, 2747, 2746, 2750, 2751, 2749, 2748, 2740, 2741, 2743, 2742, 2738, 2739, 2737, 2736, 2704, 2705, 2707, 2706, 2710, 2711, 2709, 2708, 2716, 2717, 2719, 2718, 2714, 2715, 2713, 2712, 2696, 2697, 2699, 2698, 2702, 2703, 2701, 2700, 2692, 2693, 2695, 2694, 2690, 2691, 2689, 2688, 2944, 2945, 2947, 2946, 2950, 2951, 2949, 2948, 2956, 2957, 2959, 2958, 2954, 2955, 2953, 2952, 2968, 2969, 2971, 2970, 2974, 2975, 2973, 2972, 2964, 2965, 2967, 2966, 2962, 2963, 2961, 2960, 2992, 2993, 2995, 2994, 2998, 2999, 2997, 2996, 3004, 3005, 3007, 3006, 3002, 3003, 3001, 3000, 2984, 2985, 2987, 2986, 2990, 2991, 2989, 2988, 2980, 2981, 2983, 2982, 2978, 2979, 2977, 2976, 3040, 3041, 3043, 3042, 3046, 3047, 3045, 3044, 3052, 3053, 3055, 3054, 3050, 3051, 3049, 3048, 3064, 3065, 3067, 3066, 3070, 3071, 3069, 3068, 3060, 3061, 3063, 3062, 3058, 3059, 3057, 3056, 3024, 3025, 3027, 3026, 3030, 3031, 3029, 3028, 3036, 3037, 3039, 3038, 3034, 3035, 3033, 3032, 3016, 3017, 3019, 3018, 3022, 3023, 3021, 3020, 3012, 3013, 3015, 3014, 3010, 3011, 3009, 3008, 2880, 2881, 2883, 2882, 2886, 2887, 2885, 2884, 2892, 2893, 2895, 2894, 2890, 2891, 2889, 2888, 2904, 2905, 2907, 2906, 2910, 2911, 2909, 2908, 2900, 2901, 2903, 2902, 2898, 2899, 2897, 2896, 2928, 2929, 2931, 2930, 2934, 2935, 2933, 2932, 2940, 2941, 2943, 2942, 2938, 2939, 2937, 2936, 2920, 2921, 2923, 2922, 2926, 2927, 2925, 2924, 2916, 2917, 2919, 2918, 2914, 2915, 2913, 2912, 2848, 2849, 2851, 2850, 2854, 2855, 2853, 2852, 2860, 2861, 2863, 2862, 2858, 2859, 2857, 2856, 2872, 2873, 2875, 2874, 2878, 2879, 2877, 2876, 2868, 2869, 2871, 2870, 2866, 2867, 2865, 2864, 2832, 2833, 2835, 2834, 2838, 2839, 2837, 2836, 2844, 2845, 2847, 2846, 2842, 2843, 2841, 2840, 2824, 2825, 2827, 2826, 2830, 2831, 2829, 2828, 2820, 2821, 2823, 2822, 2818, 2819, 2817, 2816, 2304, 2305, 2307, 2306, 2310, 2311, 2309, 2308, 2316, 2317, 2319, 2318, 2314, 2315, 2313, 2312, 2328, 2329, 2331, 2330, 2334, 2335, 2333, 2332, 2324, 2325, 2327, 2326, 2322, 2323, 2321, 2320, 2352, 2353, 2355, 2354, 2358, 2359, 2357, 2356, 2364, 2365, 2367, 2366, 2362, 2363, 2361, 2360, 2344, 2345, 2347, 2346, 2350, 2351, 2349, 2348, 2340, 2341, 2343, 2342, 2338, 2339, 2337, 2336, 2400, 2401, 2403, 2402, 2406, 2407, 2405, 2404, 2412, 2413, 2415, 2414, 2410, 2411, 2409, 2408, 2424, 2425, 2427, 2426, 2430, 2431, 2429, 2428, 2420, 2421, 2423, 2422, 2418, 2419, 2417, 2416, 2384, 2385, 2387, 2386, 2390, 2391, 2389, 2388, 2396, 2397, 2399, 2398, 2394, 2395, 2393, 2392, 2376, 2377, 2379, 2378, 2382, 2383, 2381, 2380, 2372, 2373, 2375, 2374, 2370, 2371, 2369, 2368, 2496, 2497, 2499, 2498, 2502, 2503, 2501, 2500, 2508, 2509, 2511, 2510, 2506, 2507, 2505, 2504, 2520, 2521, 2523, 2522, 2526, 2527, 2525, 2524, 2516, 2517, 2519, 2518, 2514, 2515, 2513, 2512, 2544, 2545, 2547, 2546, 2550, 2551, 2549, 2548, 2556, 2557, 2559, 2558, 2554, 2555, 2553, 2552, 2536, 2537, 2539, 2538, 2542, 2543, 2541, 2540, 2532, 2533, 2535, 2534, 2530, 2531, 2529, 2528, 2464, 2465, 2467, 2466, 2470, 2471, 2469, 2468, 2476, 2477, 2479, 2478, 2474, 2475, 2473, 2472, 2488, 2489, 2491, 2490, 2494, 2495, 2493, 2492, 2484, 2485, 2487, 2486, 2482, 2483, 2481, 2480, 2448, 2449, 2451, 2450, 2454, 2455, 2453, 2452, 2460, 2461, 2463, 2462, 2458, 2459, 2457, 2456, 2440, 2441, 2443, 2442, 2446, 2447, 2445, 2444, 2436, 2437, 2439, 2438, 2434, 2435, 2433, 2432, 2176, 2177, 2179, 2178, 2182, 2183, 2181, 2180, 2188, 2189, 2191, 2190, 2186, 2187, 2185, 2184, 2200, 2201, 2203, 2202, 2206, 2207, 2205, 2204, 2196, 2197, 2199, 2198, 2194, 2195, 2193, 2192, 2224, 2225, 2227, 2226, 2230, 2231, 2229, 2228, 2236, 2237, 2239, 2238, 2234, 2235, 2233, 2232, 2216, 2217, 2219, 2218, 2222, 2223, 2221, 2220, 2212, 2213, 2215, 2214, 2210, 2211, 2209, 2208, 2272, 2273, 2275, 2274, 2278, 2279, 2277, 2276, 2284, 2285, 2287, 2286, 2282, 2283, 2281, 2280, 2296, 2297, 2299, 2298, 2302, 2303, 2301, 2300, 2292, 2293, 2295, 2294, 2290, 2291, 2289, 2288, 2256, 2257, 2259, 2258, 2262, 2263, 2261, 2260, 2268, 2269, 2271, 2270, 2266, 2267, 2265, 2264, 2248, 2249, 2251, 2250, 2254, 2255, 2253, 2252, 2244, 2245, 2247, 2246, 2242, 2243, 2241, 2240, 2112, 2113, 2115, 2114, 2118, 2119, 2117, 2116, 2124, 2125, 2127, 2126, 2122, 2123, 2121, 2120, 2136, 2137, 2139, 2138, 2142, 2143, 2141, 2140, 2132, 2133, 2135, 2134, 2130, 2131, 2129, 2128, 2160, 2161, 2163, 2162, 2166, 2167, 2165, 2164, 2172, 2173, 2175, 2174, 2170, 2171, 2169, 2168, 2152, 2153, 2155, 2154, 2158, 2159, 2157, 2156, 2148, 2149, 2151, 2150, 2146, 2147, 2145, 2144, 2080, 2081, 2083, 2082, 2086, 2087, 2085, 2084, 2092, 2093, 2095, 2094, 2090, 2091, 2089, 2088, 2104, 2105, 2107, 2106, 2110, 2111, 2109, 2108, 2100, 2101, 2103, 2102, 2098, 2099, 2097, 2096, 2064, 2065, 2067, 2066, 2070, 2071, 2069, 2068, 2076, 2077, 2079, 2078, 2074, 2075, 2073, 2072, 2056, 2057, 2059, 2058, 2062, 2063, 2061, 2060, 2052, 2053, 2055, 2054, 2050, 2051, 2049, 2048, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 1536, 1537, 1539, 1538, 1542, 1543, 1541, 1540, 1548, 1549, 1551, 1550, 1546, 1547, 1545, 1544, 1560, 1561, 1563, 1562, 1566, 1567, 1565, 1564, 1556, 1557, 1559, 1558, 1554, 1555, 1553, 1552, 1584, 1585, 1587, 1586, 1590, 1591, 1589, 1588, 1596, 1597, 1599, 1598, 1594, 1595, 1593, 1592, 1576, 1577, 1579, 1578, 1582, 1583, 1581, 1580, 1572, 1573, 1575, 1574, 1570, 1571, 1569, 1568, 1632, 1633, 1635, 1634, 1638, 1639, 1637, 1636, 1644, 1645, 1647, 1646, 1642, 1643, 1641, 1640, 1656, 1657, 1659, 1658, 1662, 1663, 1661, 1660, 1652, 1653, 1655, 1654, 1650, 1651, 1649, 1648, 1616, 1617, 1619, 1618, 1622, 1623, 1621, 1620, 1628, 1629, 1631, 1630, 1626, 1627, 1625, 1624, 1608, 1609, 1611, 1610, 1614, 1615, 1613, 1612, 1604, 1605, 1607, 1606, 1602, 1603, 1601, 1600, 1728, 1729, 1731, 1730, 1734, 1735, 1733, 1732, 1740, 1741, 1743, 1742, 1738, 1739, 1737, 1736, 1752, 1753, 1755, 1754, 1758, 1759, 1757, 1756, 1748, 1749, 1751, 1750, 1746, 1747, 1745, 1744, 1776, 1777, 1779, 1778, 1782, 1783, 1781, 1780, 1788, 1789, 1791, 1790, 1786, 1787, 1785, 1784, 1768, 1769, 1771, 1770, 1774, 1775, 1773, 1772, 1764, 1765, 1767, 1766, 1762, 1763, 1761, 1760, 1696, 1697, 1699, 1698, 1702, 1703, 1701, 1700, 1708, 1709, 1711, 1710, 1706, 1707, 1705, 1704, 1720, 1721, 1723, 1722, 1726, 1727, 1725, 1724, 1716, 1717, 1719, 1718, 1714, 1715, 1713, 1712, 1680, 1681, 1683, 1682, 1686, 1687, 1685, 1684, 1692, 1693, 1695, 1694, 1690, 1691, 1689, 1688, 1672, 1673, 1675, 1674, 1678, 1679, 1677, 1676, 1668, 1669, 1671, 1670, 1666, 1667, 1665, 1664, 1920, 1921, 1923, 1922, 1926, 1927, 1925, 1924, 1932, 1933, 1935, 1934, 1930, 1931, 1929, 1928, 1944, 1945, 1947, 1946, 1950, 1951, 1949, 1948, 1940, 1941, 1943, 1942, 1938, 1939, 1937, 1936, 1968, 1969, 1971, 1970, 1974, 1975, 1973, 1972, 1980, 1981, 1983, 1982, 1978, 1979, 1977, 1976, 1960, 1961, 1963, 1962, 1966, 1967, 1965, 1964, 1956, 1957, 1959, 1958, 1954, 1955, 1953, 1952, 2016, 2017, 2019, 2018, 2022, 2023, 2021, 2020, 2028, 2029, 2031, 2030, 2026, 2027, 2025, 2024, 2040, 2041, 2043, 2042, 2046, 2047, 2045, 2044, 2036, 2037, 2039, 2038, 2034, 2035, 2033, 2032, 2000, 2001, 2003, 2002, 2006, 2007, 2005, 2004, 2012, 2013, 2015, 2014, 2010, 2011, 2009, 2008, 1992, 1993, 1995, 1994, 1998, 1999, 1997, 1996, 1988, 1989, 1991, 1990, 1986, 1987, 1985, 1984, 1856, 1857, 1859, 1858, 1862, 1863, 1861, 1860, 1868, 1869, 1871, 1870, 1866, 1867, 1865, 1864, 1880, 1881, 1883, 1882, 1886, 1887, 1885, 1884, 1876, 1877, 1879, 1878, 1874, 1875, 1873, 1872, 1904, 1905, 1907, 1906, 1910, 1911, 1909, 1908, 1916, 1917, 1919, 1918, 1914, 1915, 1913, 1912, 1896, 1897, 1899, 1898, 1902, 1903, 1901, 1900, 1892, 1893, 1895, 1894, 1890, 1891, 1889, 1888, 1824, 1825, 1827, 1826, 1830, 1831, 1829, 1828, 1836, 1837, 1839, 1838, 1834, 1835, 1833, 1832, 1848, 1849, 1851, 1850, 1854, 1855, 1853, 1852, 1844, 1845, 1847, 1846, 1842, 1843, 1841, 1840, 1808, 1809, 1811, 1810, 1814, 1815, 1813, 1812, 1820, 1821, 1823, 1822, 1818, 1819, 1817, 1816, 1800, 1801, 1803, 1802, 1806, 1807, 1805, 1804, 1796, 1797, 1799, 1798, 1794, 1795, 1793, 1792, 1280, 1281, 1283, 1282, 1286, 1287, 1285, 1284, 1292, 1293, 1295, 1294, 1290, 1291, 1289, 1288, 1304, 1305, 1307, 1306, 1310, 1311, 1309, 1308, 1300, 1301, 1303, 1302, 1298, 1299, 1297, 1296, 1328, 1329, 1331, 1330, 1334, 1335, 1333, 1332, 1340, 1341, 1343, 1342, 1338, 1339, 1337, 1336, 1320, 1321, 1323, 1322, 1326, 1327, 1325, 1324, 1316, 1317, 1319, 1318, 1314, 1315, 1313, 1312, 1376, 1377, 1379, 1378, 1382, 1383, 1381, 1380, 1388, 1389, 1391, 1390, 1386, 1387, 1385, 1384, 1400, 1401, 1403, 1402, 1406, 1407, 1405, 1404, 1396, 1397, 1399, 1398, 1394, 1395, 1393, 1392, 1360, 1361, 1363, 1362, 1366, 1367, 1365, 1364, 1372, 1373, 1375, 1374, 1370, 1371, 1369, 1368, 1352, 1353, 1355, 1354, 1358, 1359, 1357, 1356, 1348, 1349, 1351, 1350, 1346, 1347, 1345, 1344, 1472, 1473, 1475, 1474, 1478, 1479, 1477, 1476, 1484, 1485, 1487, 1486, 1482, 1483, 1481, 1480, 1496, 1497, 1499, 1498, 1502, 1503, 1501, 1500, 1492, 1493, 1495, 1494, 1490, 1491, 1489, 1488, 1520, 1521, 1523, 1522, 1526, 1527, 1525, 1524, 1532, 1533, 1535, 1534, 1530, 1531, 1529, 1528, 1512, 1513, 1515, 1514, 1518, 1519, 1517, 1516, 1508, 1509, 1511, 1510, 1506, 1507, 1505, 1504, 1440, 1441, 1443, 1442, 1446, 1447, 1445, 1444, 1452, 1453, 1455, 1454, 1450, 1451, 1449, 1448, 1464, 1465, 1467, 1466, 1470, 1471, 1469, 1468, 1460, 1461, 1463, 1462, 1458, 1459, 1457, 1456, 1424, 1425, 1427, 1426, 1430, 1431, 1429, 1428, 1436, 1437, 1439, 1438, 1434, 1435, 1433, 1432, 1416, 1417, 1419, 1418, 1422, 1423, 1421, 1420, 1412, 1413, 1415, 1414, 1410, 1411, 1409, 1408, 1152, 1153, 1155, 1154, 1158, 1159, 1157, 1156, 1164, 1165, 1167, 1166, 1162, 1163, 1161, 1160, 1176, 1177, 1179, 1178, 1182, 1183, 1181, 1180, 1172, 1173, 1175, 1174, 1170, 1171, 1169, 1168, 1200, 1201, 1203, 1202, 1206, 1207, 1205, 1204, 1212, 1213, 1215, 1214, 1210, 1211, 1209, 1208, 1192, 1193, 1195, 1194, 1198, 1199, 1197, 1196, 1188, 1189, 1191, 1190, 1186, 1187, 1185, 1184, 1248, 1249, 1251, 1250, 1254, 1255, 1253, 1252, 1260, 1261, 1263, 1262, 1258, 1259, 1257, 1256, 1272, 1273, 1275, 1274, 1278, 1279, 1277, 1276, 1268, 1269, 1271, 1270, 1266, 1267, 1265, 1264, 1232, 1233, 1235, 1234, 1238, 1239, 1237, 1236, 1244, 1245, 1247, 1246, 1242, 1243, 1241, 1240, 1224, 1225, 1227, 1226, 1230, 1231, 1229, 1228, 1220, 1221, 1223, 1222, 1218, 1219, 1217, 1216, 1088, 1089, 1091, 1090, 1094, 1095, 1093, 1092, 1100, 1101, 1103, 1102, 1098, 1099, 1097, 1096, 1112, 1113, 1115, 1114, 1118, 1119, 1117, 1116, 1108, 1109, 1111, 1110, 1106, 1107, 1105, 1104, 1136, 1137, 1139, 1138, 1142, 1143, 1141, 1140, 1148, 1149, 1151, 1150, 1146, 1147, 1145, 1144, 1128, 1129, 1131, 1130, 1134, 1135, 1133, 1132, 1124, 1125, 1127, 1126, 1122, 1123, 1121, 1120, 1056, 1057, 1059, 1058, 1062, 1063, 1061, 1060, 1068, 1069, 1071, 1070, 1066, 1067, 1065, 1064, 1080, 1081, 1083, 1082, 1086, 1087, 1085, 1084, 1076, 1077, 1079, 1078, 1074, 1075, 1073, 1072, 1040, 1041, 1043, 1042, 1046, 1047, 1045, 1044, 1052, 1053, 1055, 1054, 1050, 1051, 1049, 1048, 1032, 1033, 1035, 1034, 1038, 1039, 1037, 1036, 1028, 1029, 1031, 1030, 1026, 1027, 1025, 1024, 3072, 3073, 3075, 3074, 3078, 3079, 3077, 3076, 3084, 3085, 3087, 3086, 3082, 3083, 3081, 3080, 3096, 3097, 3099, 3098, 3102, 3103, 3101, 3100, 3092, 3093, 3095, 3094, 3090, 3091, 3089, 3088, 3120, 3121, 3123, 3122, 3126, 3127, 3125, 3124, 3132, 3133, 3135, 3134, 3130, 3131, 3129, 3128, 3112, 3113, 3115, 3114, 3118, 3119, 3117, 3116, 3108, 3109, 3111, 3110, 3106, 3107, 3105, 3104, 3168, 3169, 3171, 3170, 3174, 3175, 3173, 3172, 3180, 3181, 3183, 3182, 3178, 3179, 3177, 3176, 3192, 3193, 3195, 3194, 3198, 3199, 3197, 3196, 3188, 3189, 3191, 3190, 3186, 3187, 3185, 3184, 3152, 3153, 3155, 3154, 3158, 3159, 3157, 3156, 3164, 3165, 3167, 3166, 3162, 3163, 3161, 3160, 3144, 3145, 3147, 3146, 3150, 3151, 3149, 3148, 3140, 3141, 3143, 3142, 3138, 3139, 3137, 3136, 3264, 3265, 3267, 3266, 3270, 3271, 3269, 3268, 3276, 3277, 3279, 3278, 3274, 3275, 3273, 3272, 3288, 3289, 3291, 3290, 3294, 3295, 3293, 3292, 3284, 3285, 3287, 3286, 3282, 3283, 3281, 3280, 3312, 3313, 3315, 3314, 3318, 3319, 3317, 3316, 3324, 3325, 3327, 3326, 3322, 3323, 3321, 3320, 3304, 3305, 3307, 3306, 3310, 3311, 3309, 3308, 3300, 3301, 3303, 3302, 3298, 3299, 3297, 3296, 3232, 3233, 3235, 3234, 3238, 3239, 3237, 3236, 3244, 3245, 3247, 3246, 3242, 3243, 3241, 3240, 3256, 3257, 3259, 3258, 3262, 3263, 3261, 3260, 3252, 3253, 3255, 3254, 3250, 3251, 3249, 3248, 3216, 3217, 3219, 3218, 3222, 3223, 3221, 3220, 3228, 3229, 3231, 3230, 3226, 3227, 3225, 3224, 3208, 3209, 3211, 3210, 3214, 3215, 3213, 3212, 3204, 3205, 3207, 3206, 3202, 3203, 3201, 3200, 3456, 3457, 3459, 3458, 3462, 3463, 3461, 3460, 3468, 3469, 3471, 3470, 3466, 3467, 3465, 3464, 3480, 3481, 3483, 3482, 3486, 3487, 3485, 3484, 3476, 3477, 3479, 3478, 3474, 3475, 3473, 3472, 3504, 3505, 3507, 3506, 3510, 3511, 3509, 3508, 3516, 3517, 3519, 3518, 3514, 3515, 3513, 3512, 3496, 3497, 3499, 3498, 3502, 3503, 3501, 3500, 3492, 3493, 3495, 3494, 3490, 3491, 3489, 3488, 3552, 3553, 3555, 3554, 3558, 3559, 3557, 3556, 3564, 3565, 3567, 3566, 3562, 3563, 3561, 3560, 3576, 3577, 3579, 3578, 3582, 3583, 3581, 3580, 3572, 3573, 3575, 3574, 3570, 3571, 3569, 3568, 3536, 3537, 3539, 3538, 3542, 3543, 3541, 3540, 3548, 3549, 3551, 3550, 3546, 3547, 3545, 3544, 3528, 3529, 3531, 3530, 3534, 3535, 3533, 3532, 3524, 3525, 3527, 3526, 3522, 3523, 3521, 3520, 3392, 3393, 3395, 3394, 3398, 3399, 3397, 3396, 3404, 3405, 3407, 3406, 3402, 3403, 3401, 3400, 3416, 3417, 3419, 3418, 3422, 3423, 3421, 3420, 3412, 3413, 3415, 3414, 3410, 3411, 3409, 3408, 3440, 3441, 3443, 3442, 3446, 3447, 3445, 3444, 3452, 3453, 3455, 3454, 3450, 3451, 3449, 3448, 3432, 3433, 3435, 3434, 3438, 3439, 3437, 3436, 3428, 3429, 3431, 3430, 3426, 3427, 3425, 3424, 3360, 3361, 3363, 3362, 3366, 3367, 3365, 3364, 3372, 3373, 3375, 3374, 3370, 3371, 3369, 3368, 3384, 3385, 3387, 3386, 3390, 3391, 3389, 3388, 3380, 3381, 3383, 3382, 3378, 3379, 3377, 3376, 3344, 3345, 3347, 3346, 3350, 3351, 3349, 3348, 3356, 3357, 3359, 3358, 3354, 3355, 3353, 3352, 3336, 3337, 3339, 3338, 3342, 3343, 3341, 3340, 3332, 3333, 3335, 3334, 3330, 3331, 3329, 3328, 3840, 3841, 3843, 3842, 3846, 3847, 3845, 3844, 3852, 3853, 3855, 3854, 3850, 3851, 3849, 3848, 3864, 3865, 3867, 3866, 3870, 3871, 3869, 3868, 3860, 3861, 3863, 3862, 3858, 3859, 3857, 3856, 3888, 3889, 3891, 3890, 3894, 3895, 3893, 3892, 3900, 3901, 3903, 3902, 3898, 3899, 3897, 3896, 3880, 3881, 3883, 3882, 3886, 3887, 3885, 3884, 3876, 3877, 3879, 3878, 3874, 3875, 3873, 3872, 3936, 3937, 3939, 3938, 3942, 3943, 3941, 3940, 3948, 3949, 3951, 3950, 3946, 3947, 3945, 3944, 3960, 3961, 3963, 3962, 3966, 3967, 3965, 3964, 3956, 3957, 3959, 3958, 3954, 3955, 3953, 3952, 3920, 3921, 3923, 3922, 3926, 3927, 3925, 3924, 3932, 3933, 3935, 3934, 3930, 3931, 3929, 3928, 3912, 3913, 3915, 3914, 3918, 3919, 3917, 3916, 3908, 3909, 3911, 3910, 3906, 3907, 3905, 3904, 4032, 4033, 4035, 4034, 4038, 4039, 4037, 4036, 4044, 4045, 4047, 4046, 4042, 4043, 4041, 4040, 4056, 4057, 4059, 4058, 4062, 4063, 4061, 4060, 4052, 4053, 4055, 4054, 4050, 4051, 4049, 4048, 4080, 4081, 4083, 4082, 4086, 4087, 4085, 4084, 4092, 4093]\n assert candidate(n = 9,start = 123) == [123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121]\n assert candidate(n = 7,start = 1) == [1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 0]\n assert candidate(n = 9,start = 500) == [500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508]\n assert candidate(n = 10,start = 15) == [15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13]\n assert candidate(n = 1,start = 1) == [1, 0]\n assert candidate(n = 6,start = 24) == [24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8]\n assert candidate(n = 11,start = 1024) == [1024, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 1536, 1537, 1539, 1538, 1542, 1543, 1541, 1540, 1548, 1549, 1551, 1550, 1546, 1547, 1545, 1544, 1560, 1561, 1563, 1562, 1566, 1567, 1565, 1564, 1556, 1557, 1559, 1558, 1554, 1555, 1553, 1552, 1584, 1585, 1587, 1586, 1590, 1591, 1589, 1588, 1596, 1597, 1599, 1598, 1594, 1595, 1593, 1592, 1576, 1577, 1579, 1578, 1582, 1583, 1581, 1580, 1572, 1573, 1575, 1574, 1570, 1571, 1569, 1568, 1632, 1633, 1635, 1634, 1638, 1639, 1637, 1636, 1644, 1645, 1647, 1646, 1642, 1643, 1641, 1640, 1656, 1657, 1659, 1658, 1662, 1663, 1661, 1660, 1652, 1653, 1655, 1654, 1650, 1651, 1649, 1648, 1616, 1617, 1619, 1618, 1622, 1623, 1621, 1620, 1628, 1629, 1631, 1630, 1626, 1627, 1625, 1624, 1608, 1609, 1611, 1610, 1614, 1615, 1613, 1612, 1604, 1605, 1607, 1606, 1602, 1603, 1601, 1600, 1728, 1729, 1731, 1730, 1734, 1735, 1733, 1732, 1740, 1741, 1743, 1742, 1738, 1739, 1737, 1736, 1752, 1753, 1755, 1754, 1758, 1759, 1757, 1756, 1748, 1749, 1751, 1750, 1746, 1747, 1745, 1744, 1776, 1777, 1779, 1778, 1782, 1783, 1781, 1780, 1788, 1789, 1791, 1790, 1786, 1787, 1785, 1784, 1768, 1769, 1771, 1770, 1774, 1775, 1773, 1772, 1764, 1765, 1767, 1766, 1762, 1763, 1761, 1760, 1696, 1697, 1699, 1698, 1702, 1703, 1701, 1700, 1708, 1709, 1711, 1710, 1706, 1707, 1705, 1704, 1720, 1721, 1723, 1722, 1726, 1727, 1725, 1724, 1716, 1717, 1719, 1718, 1714, 1715, 1713, 1712, 1680, 1681, 1683, 1682, 1686, 1687, 1685, 1684, 1692, 1693, 1695, 1694, 1690, 1691, 1689, 1688, 1672, 1673, 1675, 1674, 1678, 1679, 1677, 1676, 1668, 1669, 1671, 1670, 1666, 1667, 1665, 1664, 1920, 1921, 1923, 1922, 1926, 1927, 1925, 1924, 1932, 1933, 1935, 1934, 1930, 1931, 1929, 1928, 1944, 1945, 1947, 1946, 1950, 1951, 1949, 1948, 1940, 1941, 1943, 1942, 1938, 1939, 1937, 1936, 1968, 1969, 1971, 1970, 1974, 1975, 1973, 1972, 1980, 1981, 1983, 1982, 1978, 1979, 1977, 1976, 1960, 1961, 1963, 1962, 1966, 1967, 1965, 1964, 1956, 1957, 1959, 1958, 1954, 1955, 1953, 1952, 2016, 2017, 2019, 2018, 2022, 2023, 2021, 2020, 2028, 2029, 2031, 2030, 2026, 2027, 2025, 2024, 2040, 2041, 2043, 2042, 2046, 2047, 2045, 2044, 2036, 2037, 2039, 2038, 2034, 2035, 2033, 2032, 2000, 2001, 2003, 2002, 2006, 2007, 2005, 2004, 2012, 2013, 2015, 2014, 2010, 2011, 2009, 2008, 1992, 1993, 1995, 1994, 1998, 1999, 1997, 1996, 1988, 1989, 1991, 1990, 1986, 1987, 1985, 1984, 1856, 1857, 1859, 1858, 1862, 1863, 1861, 1860, 1868, 1869, 1871, 1870, 1866, 1867, 1865, 1864, 1880, 1881, 1883, 1882, 1886, 1887, 1885, 1884, 1876, 1877, 1879, 1878, 1874, 1875, 1873, 1872, 1904, 1905, 1907, 1906, 1910, 1911, 1909, 1908, 1916, 1917, 1919, 1918, 1914, 1915, 1913, 1912, 1896, 1897, 1899, 1898, 1902, 1903, 1901, 1900, 1892, 1893, 1895, 1894, 1890, 1891, 1889, 1888, 1824, 1825, 1827, 1826, 1830, 1831, 1829, 1828, 1836, 1837, 1839, 1838, 1834, 1835, 1833, 1832, 1848, 1849, 1851, 1850, 1854, 1855, 1853, 1852, 1844, 1845, 1847, 1846, 1842, 1843, 1841, 1840, 1808, 1809, 1811, 1810, 1814, 1815, 1813, 1812, 1820, 1821, 1823, 1822, 1818, 1819, 1817, 1816, 1800, 1801, 1803, 1802, 1806, 1807, 1805, 1804, 1796, 1797, 1799, 1798, 1794, 1795, 1793, 1792, 1280, 1281, 1283, 1282, 1286, 1287, 1285, 1284, 1292, 1293, 1295, 1294, 1290, 1291, 1289, 1288, 1304, 1305, 1307, 1306, 1310, 1311, 1309, 1308, 1300, 1301, 1303, 1302, 1298, 1299, 1297, 1296, 1328, 1329, 1331, 1330, 1334, 1335, 1333, 1332, 1340, 1341, 1343, 1342, 1338, 1339, 1337, 1336, 1320, 1321, 1323, 1322, 1326, 1327, 1325, 1324, 1316, 1317, 1319, 1318, 1314, 1315, 1313, 1312, 1376, 1377, 1379, 1378, 1382, 1383, 1381, 1380, 1388, 1389, 1391, 1390, 1386, 1387, 1385, 1384, 1400, 1401, 1403, 1402, 1406, 1407, 1405, 1404, 1396, 1397, 1399, 1398, 1394, 1395, 1393, 1392, 1360, 1361, 1363, 1362, 1366, 1367, 1365, 1364, 1372, 1373, 1375, 1374, 1370, 1371, 1369, 1368, 1352, 1353, 1355, 1354, 1358, 1359, 1357, 1356, 1348, 1349, 1351, 1350, 1346, 1347, 1345, 1344, 1472, 1473, 1475, 1474, 1478, 1479, 1477, 1476, 1484, 1485, 1487, 1486, 1482, 1483, 1481, 1480, 1496, 1497, 1499, 1498, 1502, 1503, 1501, 1500, 1492, 1493, 1495, 1494, 1490, 1491, 1489, 1488, 1520, 1521, 1523, 1522, 1526, 1527, 1525, 1524, 1532, 1533, 1535, 1534, 1530, 1531, 1529, 1528, 1512, 1513, 1515, 1514, 1518, 1519, 1517, 1516, 1508, 1509, 1511, 1510, 1506, 1507, 1505, 1504, 1440, 1441, 1443, 1442, 1446, 1447, 1445, 1444, 1452, 1453, 1455, 1454, 1450, 1451, 1449, 1448, 1464, 1465, 1467, 1466, 1470, 1471, 1469, 1468, 1460, 1461, 1463, 1462, 1458, 1459, 1457, 1456, 1424, 1425, 1427, 1426, 1430, 1431, 1429, 1428, 1436, 1437, 1439, 1438, 1434, 1435, 1433, 1432, 1416, 1417, 1419, 1418, 1422, 1423, 1421, 1420, 1412, 1413, 1415, 1414, 1410, 1411, 1409, 1408, 1152, 1153, 1155, 1154, 1158, 1159, 1157, 1156, 1164, 1165, 1167, 1166, 1162, 1163, 1161, 1160, 1176, 1177, 1179, 1178, 1182, 1183, 1181, 1180, 1172, 1173, 1175, 1174, 1170, 1171, 1169, 1168, 1200, 1201, 1203, 1202, 1206, 1207, 1205, 1204, 1212, 1213, 1215, 1214, 1210, 1211, 1209, 1208, 1192, 1193, 1195, 1194, 1198, 1199, 1197, 1196, 1188, 1189, 1191, 1190, 1186, 1187, 1185, 1184, 1248, 1249, 1251, 1250, 1254, 1255, 1253, 1252, 1260, 1261, 1263, 1262, 1258, 1259, 1257, 1256, 1272, 1273, 1275, 1274, 1278, 1279, 1277, 1276, 1268, 1269, 1271, 1270, 1266, 1267, 1265, 1264, 1232, 1233, 1235, 1234, 1238, 1239, 1237, 1236, 1244, 1245, 1247, 1246, 1242, 1243, 1241, 1240, 1224, 1225, 1227, 1226, 1230, 1231, 1229, 1228, 1220, 1221, 1223, 1222, 1218, 1219, 1217, 1216, 1088, 1089, 1091, 1090, 1094, 1095, 1093, 1092, 1100, 1101, 1103, 1102, 1098, 1099, 1097, 1096, 1112, 1113, 1115, 1114, 1118, 1119, 1117, 1116, 1108, 1109, 1111, 1110, 1106, 1107, 1105, 1104, 1136, 1137, 1139, 1138, 1142, 1143, 1141, 1140, 1148, 1149, 1151, 1150, 1146, 1147, 1145, 1144, 1128, 1129, 1131, 1130, 1134, 1135, 1133, 1132, 1124, 1125, 1127, 1126, 1122, 1123, 1121, 1120, 1056, 1057, 1059, 1058, 1062, 1063, 1061, 1060, 1068, 1069, 1071, 1070, 1066, 1067, 1065, 1064, 1080, 1081, 1083, 1082, 1086, 1087, 1085, 1084, 1076, 1077, 1079, 1078, 1074, 1075, 1073, 1072, 1040, 1041, 1043, 1042, 1046, 1047, 1045, 1044, 1052, 1053, 1055, 1054, 1050, 1051, 1049, 1048, 1032, 1033, 1035, 1034, 1038, 1039, 1037, 1036, 1028, 1029, 1031, 1030, 1026, 1027, 1025]\n assert candidate(n = 4,start = 15) == [15, 14, 10, 11, 9, 8, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13]\n assert candidate(n = 10,start = 1023) == [1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021]\n assert candidate(n = 5,start = 31) == [31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30]\n assert candidate(n = 10,start = 255) == [255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253]\n assert candidate(n = 9,start = 63) == [63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61]\n assert candidate(n = 7,start = 127) == [127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126]\n assert candidate(n = 10,start = 512) == [512, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126, 127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513]\n assert candidate(n = 6,start = 63) == [63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61]\n assert candidate(n = 10,start = 127) == [127, 125, 124, 116, 117, 119, 118, 114, 115, 113, 112, 80, 81, 83, 82, 86, 87, 85, 84, 92, 93, 95, 94, 90, 91, 89, 88, 72, 73, 75, 74, 78, 79, 77, 76, 68, 69, 71, 70, 66, 67, 65, 64, 192, 193, 195, 194, 198, 199, 197, 196, 204, 205, 207, 206, 202, 203, 201, 200, 216, 217, 219, 218, 222, 223, 221, 220, 212, 213, 215, 214, 210, 211, 209, 208, 240, 241, 243, 242, 246, 247, 245, 244, 252, 253, 255, 254, 250, 251, 249, 248, 232, 233, 235, 234, 238, 239, 237, 236, 228, 229, 231, 230, 226, 227, 225, 224, 160, 161, 163, 162, 166, 167, 165, 164, 172, 173, 175, 174, 170, 171, 169, 168, 184, 185, 187, 186, 190, 191, 189, 188, 180, 181, 183, 182, 178, 179, 177, 176, 144, 145, 147, 146, 150, 151, 149, 148, 156, 157, 159, 158, 154, 155, 153, 152, 136, 137, 139, 138, 142, 143, 141, 140, 132, 133, 135, 134, 130, 131, 129, 128, 384, 385, 387, 386, 390, 391, 389, 388, 396, 397, 399, 398, 394, 395, 393, 392, 408, 409, 411, 410, 414, 415, 413, 412, 404, 405, 407, 406, 402, 403, 401, 400, 432, 433, 435, 434, 438, 439, 437, 436, 444, 445, 447, 446, 442, 443, 441, 440, 424, 425, 427, 426, 430, 431, 429, 428, 420, 421, 423, 422, 418, 419, 417, 416, 480, 481, 483, 482, 486, 487, 485, 484, 492, 493, 495, 494, 490, 491, 489, 488, 504, 505, 507, 506, 510, 511, 509, 508, 500, 501, 503, 502, 498, 499, 497, 496, 464, 465, 467, 466, 470, 471, 469, 468, 476, 477, 479, 478, 474, 475, 473, 472, 456, 457, 459, 458, 462, 463, 461, 460, 452, 453, 455, 454, 450, 451, 449, 448, 320, 321, 323, 322, 326, 327, 325, 324, 332, 333, 335, 334, 330, 331, 329, 328, 344, 345, 347, 346, 350, 351, 349, 348, 340, 341, 343, 342, 338, 339, 337, 336, 368, 369, 371, 370, 374, 375, 373, 372, 380, 381, 383, 382, 378, 379, 377, 376, 360, 361, 363, 362, 366, 367, 365, 364, 356, 357, 359, 358, 354, 355, 353, 352, 288, 289, 291, 290, 294, 295, 293, 292, 300, 301, 303, 302, 298, 299, 297, 296, 312, 313, 315, 314, 318, 319, 317, 316, 308, 309, 311, 310, 306, 307, 305, 304, 272, 273, 275, 274, 278, 279, 277, 276, 284, 285, 287, 286, 282, 283, 281, 280, 264, 265, 267, 266, 270, 271, 269, 268, 260, 261, 263, 262, 258, 259, 257, 256, 768, 769, 771, 770, 774, 775, 773, 772, 780, 781, 783, 782, 778, 779, 777, 776, 792, 793, 795, 794, 798, 799, 797, 796, 788, 789, 791, 790, 786, 787, 785, 784, 816, 817, 819, 818, 822, 823, 821, 820, 828, 829, 831, 830, 826, 827, 825, 824, 808, 809, 811, 810, 814, 815, 813, 812, 804, 805, 807, 806, 802, 803, 801, 800, 864, 865, 867, 866, 870, 871, 869, 868, 876, 877, 879, 878, 874, 875, 873, 872, 888, 889, 891, 890, 894, 895, 893, 892, 884, 885, 887, 886, 882, 883, 881, 880, 848, 849, 851, 850, 854, 855, 853, 852, 860, 861, 863, 862, 858, 859, 857, 856, 840, 841, 843, 842, 846, 847, 845, 844, 836, 837, 839, 838, 834, 835, 833, 832, 960, 961, 963, 962, 966, 967, 965, 964, 972, 973, 975, 974, 970, 971, 969, 968, 984, 985, 987, 986, 990, 991, 989, 988, 980, 981, 983, 982, 978, 979, 977, 976, 1008, 1009, 1011, 1010, 1014, 1015, 1013, 1012, 1020, 1021, 1023, 1022, 1018, 1019, 1017, 1016, 1000, 1001, 1003, 1002, 1006, 1007, 1005, 1004, 996, 997, 999, 998, 994, 995, 993, 992, 928, 929, 931, 930, 934, 935, 933, 932, 940, 941, 943, 942, 938, 939, 937, 936, 952, 953, 955, 954, 958, 959, 957, 956, 948, 949, 951, 950, 946, 947, 945, 944, 912, 913, 915, 914, 918, 919, 917, 916, 924, 925, 927, 926, 922, 923, 921, 920, 904, 905, 907, 906, 910, 911, 909, 908, 900, 901, 903, 902, 898, 899, 897, 896, 640, 641, 643, 642, 646, 647, 645, 644, 652, 653, 655, 654, 650, 651, 649, 648, 664, 665, 667, 666, 670, 671, 669, 668, 660, 661, 663, 662, 658, 659, 657, 656, 688, 689, 691, 690, 694, 695, 693, 692, 700, 701, 703, 702, 698, 699, 697, 696, 680, 681, 683, 682, 686, 687, 685, 684, 676, 677, 679, 678, 674, 675, 673, 672, 736, 737, 739, 738, 742, 743, 741, 740, 748, 749, 751, 750, 746, 747, 745, 744, 760, 761, 763, 762, 766, 767, 765, 764, 756, 757, 759, 758, 754, 755, 753, 752, 720, 721, 723, 722, 726, 727, 725, 724, 732, 733, 735, 734, 730, 731, 729, 728, 712, 713, 715, 714, 718, 719, 717, 716, 708, 709, 711, 710, 706, 707, 705, 704, 576, 577, 579, 578, 582, 583, 581, 580, 588, 589, 591, 590, 586, 587, 585, 584, 600, 601, 603, 602, 606, 607, 605, 604, 596, 597, 599, 598, 594, 595, 593, 592, 624, 625, 627, 626, 630, 631, 629, 628, 636, 637, 639, 638, 634, 635, 633, 632, 616, 617, 619, 618, 622, 623, 621, 620, 612, 613, 615, 614, 610, 611, 609, 608, 544, 545, 547, 546, 550, 551, 549, 548, 556, 557, 559, 558, 554, 555, 553, 552, 568, 569, 571, 570, 574, 575, 573, 572, 564, 565, 567, 566, 562, 563, 561, 560, 528, 529, 531, 530, 534, 535, 533, 532, 540, 541, 543, 542, 538, 539, 537, 536, 520, 521, 523, 522, 526, 527, 525, 524, 516, 517, 519, 518, 514, 515, 513, 512, 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 96, 97, 99, 98, 102, 103, 101, 100, 108, 109, 111, 110, 106, 107, 105, 104, 120, 121, 123, 122, 126]\n assert candidate(n = 6,start = 12) == [12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16, 48, 49, 51, 50, 54, 55, 53, 52, 60, 61, 63, 62, 58, 59, 57, 56, 40, 41, 43, 42, 46, 47, 45, 44, 36, 37, 39, 38, 34, 35, 33, 32, 0, 1, 3, 2, 6, 7, 5, 4]\n"}, "metadata": {"canonical_parameter_names": ["n", "start"], "leetcode_dataset_entry_point": "Solution().circularPermutation", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var circularPermutation = function(n, start) {", "container": null, "callable": "circularPermutation", "parameters": [{"name": "n", "type": "number"}, {"name": "start", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1239, "task_id": "maximum-length-of-a-concatenated-string-with-unique-characters", "difficulty": "Medium", "problem_description": "You are given an array of strings arr. A string s is formed by the concatenation of a subsequence of arr that has unique characters.\nReturn the maximum possible length of s.\nA subsequence is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.\n \nExample 1:\n\nInput: arr = [\"un\",\"iq\",\"ue\"]\nOutput: 4\nExplanation: All the valid concatenations are:\n- \"\"\n- \"un\"\n- \"iq\"\n- \"ue\"\n- \"uniq\" (\"un\" + \"iq\")\n- \"ique\" (\"iq\" + \"ue\")\nMaximum length is 4.\n\nExample 2:\n\nInput: arr = [\"cha\",\"r\",\"act\",\"ers\"]\nOutput: 6\nExplanation: Possible longest valid concatenations are \"chaers\" (\"cha\" + \"ers\") and \"acters\" (\"act\" + \"ers\").\n\nExample 3:\n\nInput: arr = [\"abcdefghijklmnopqrstuvwxyz\"]\nOutput: 26\nExplanation: The only string in arr has all 26 characters.\n\n \nConstraints:\n\n1 <= arr.length <= 16\n1 <= arr[i].length <= 26\narr[i] contains only lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = ['abcd', 'abef', 'cdgh', 'cdef']) == 8\n assert candidate(arr = ['un', 'iq', 'ue']) == 4\n assert candidate(arr = ['abcdefghijklmnopqrstuvwxyz']) == 26\n assert candidate(arr = ['unique', 'strings', 'with', 'no', 'common', 'characters']) == 6\n assert candidate(arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p']) == 16\n assert candidate(arr = ['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yz']) == 26\n assert candidate(arr = ['ab', 'cd', 'ef', 'gh', 'ij', 'kl', 'mn', 'op', 'qr', 'st', 'uv', 'wx', 'yz']) == 26\n assert candidate(arr = ['zzzz', 'zzyy', 'xxzz', 'xxyy', 'abcd']) == 4\n assert candidate(arr = ['aaaa', 'bbbb', 'cccc', 'dddd', 'eeee', 'ffff', 'gggg', 'hhhh', 'iiii', 'jjjj']) == 0\n assert candidate(arr = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz']) == 26\n assert candidate(arr = ['xyy', 'zmk']) == 3\n assert candidate(arr = ['a', 'ab', 'abc', 'abcd', 'abcde']) == 5\n assert candidate(arr = ['abc', 'de', 'fgh', 'ij', 'klm', 'nop', 'qrs', 'tuv', 'wxy', 'z']) == 26\n assert candidate(arr = ['a', 'b', 'c']) == 3\n assert candidate(arr = ['abcd', 'aabbccdd', 'abcde', 'mnopqr', 'stuvwx', 'yz']) == 19\n assert candidate(arr = ['aabbcc', 'ddeeff', 'gghhiijj']) == 0\n assert candidate(arr = ['cha', 'r', 'act', 'ers']) == 6\n assert candidate(arr = ['aabbcc', 'ddeeff', 'gghhii', 'jklmno', 'pqqrst', 'uvwxyz']) == 12\n assert candidate(arr = ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz']) == 0\n assert candidate(arr = ['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yzab', 'cdef', 'ghij', 'klmn', 'opqr', 'stuv', 'wxyz', 'abcd', 'efgh']) == 24\n assert candidate(arr = ['abcdefghijk', 'lmnopqrst', 'uvwxyzabc', 'defghijkl', 'mnopqrstu', 'vwxyzabcd', 'efghijklm', 'nopqrstuv', 'wxyzabcde', 'fghijklmn', 'opqrstuvw', 'xyzabcdefg', 'ghijklmno', 'pqrstuvwx', 'yzabcdefgh', 'hijklmnop', 'qrstuvwxy', 'zabcdefghij']) == 20\n assert candidate(arr = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz']) == 26\n assert candidate(arr = ['xyzz', 'abxy', 'mnop', 'qrst', 'uvwz', 'mnop', 'qrst', 'uvwz', 'mnop', 'qrst', 'uvwz', 'mnop', 'qrst', 'uvwz', 'mnop', 'qrst']) == 16\n assert candidate(arr = ['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff', 'ggg', 'hhh', 'iii', 'jjj', 'kkk', 'lll', 'mmm', 'nnn', 'ooo', 'ppp']) == 0\n assert candidate(arr = ['ab', 'bc', 'cd', 'de', 'ef', 'fg', 'gh', 'hi', 'ij', 'jk', 'kl', 'lm', 'mn', 'no', 'op', 'pq', 'qr', 'rs', 'st', 'tu', 'uv', 'vw', 'wx', 'xy', 'yz', 'za', 'bz', 'cy', 'dx', 'ew', 'fv', 'gu', 'ht', 'is', 'jr', 'kq', 'lp', 'mo', 'np', 'oq', 'pr', 'qs', 'rt', 'su', 'tv', 'uw', 'vx', 'wy', 'xz']) == 26\n assert candidate(arr = ['unique', 'strings', 'with', 'distinct', 'chars', 'in', 'each', 'subsequence']) == 7\n assert candidate(arr = ['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yzab', 'cdef', 'ghij', 'klmn', 'opqr', 'stuv', 'wxyz', 'mnop', 'qrst', 'uvwxy']) == 25\n assert candidate(arr = ['xyz', 'uvw', 'tuv', 'stu', 'rst', 'qrs', 'pqr', 'opq', 'nop', 'mno', 'lmn', 'klm', 'jkl', 'ikl', 'ihg', 'fgh']) == 18\n assert candidate(arr = ['xyz', 'uvw', 'tuv', 'stu', 'rst', 'qrs', 'pqr', 'opq', 'nop', 'mno', 'lmo', 'kln', 'jkl', 'ihg', 'fgh', 'efg', 'def', 'cde', 'bcd', 'abc']) == 24\n assert candidate(arr = ['aabb', 'ccdd', 'eeff', 'gghh', 'iijj', 'kklm', 'nopq', 'rstu', 'vwxy', 'zz']) == 12\n assert candidate(arr = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yzabcd', 'efghij', 'klmnop', 'qrstuv', 'wxyza', 'bcdefg', 'hijklm', 'nopqrs', 'tuvwxy', 'zabcde']) == 24\n assert candidate(arr = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz']) == 26\n assert candidate(arr = ['abcdexyz', 'mnop', 'qrstuvw', 'zabcd', 'ef', 'ghijkl', 'mnopqr', 'stuv', 'wxyz', 'abcdefghij', 'klmnopqr', 'stuvwxyz']) == 26\n assert candidate(arr = ['abcdefgh', 'ijklmnop', 'qrstuvwxyz', 'abcdefgh', 'ijklmnop', 'qrstuvwxyz']) == 26\n assert candidate(arr = ['abcd', 'defg', 'hijk', 'lmno', 'pqrs', 'tuvw', 'xyza']) == 24\n assert candidate(arr = ['xyz', 'xy', 'xz', 'yz', 'x', 'y', 'z', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz', 'ab', 'ac', 'ad', 'ae', 'af', 'ag', 'ah', 'ai', 'aj', 'ak', 'al', 'am', 'an', 'ao', 'ap', 'aq', 'ar', 'as', 'at', 'au', 'av', 'aw', 'ax', 'ay', 'az']) == 26\n assert candidate(arr = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz', 'a', 'b', 'c', 'd']) == 26\n assert candidate(arr = ['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yzab', 'cded', 'efgi', 'hjkl', 'mnop', 'qrst', 'uvwz', 'abcd']) == 24\n assert candidate(arr = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yz', 'abcdefghijklmnopqrstuvwxyz', 'abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yz']) == 26\n assert candidate(arr = ['abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi']) == 9\n assert candidate(arr = ['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy', 'zabcd', 'efghi', 'jklmn', 'opqrs', 'tuvwx', 'yzabc', 'defgh']) == 25\n assert candidate(arr = ['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yzab']) == 24\n assert candidate(arr = ['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'abcdefghij', 'klmnopqr', 'stuvwxyz']) == 26\n assert candidate(arr = ['aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee', 'fffff']) == 0\n assert candidate(arr = ['xyz', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz', 'ab', 'cd', 'ef', 'gh', 'ij', 'kl', 'mn', 'op', 'qr', 'st', 'uv', 'wx']) == 26\n assert candidate(arr = ['zyxwvutsrqpomnlkjihgfedcba', 'abcdefghijklmnopqrstuvwxyz', 'mnopqrstuvwxyza', 'bcdefghijklmnopqr', 'stuvwxyzabcde']) == 26\n assert candidate(arr = ['aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee', 'ffffff', 'ggggg']) == 0\n assert candidate(arr = ['abcd', 'def', 'ghij', 'klmno', 'pqrst', 'uvwxy', 'z']) == 24\n assert candidate(arr = ['abcd', 'efgh', 'abcd', 'efgh', 'ijkl', 'mnop', 'ijkl', 'mnop', 'qrst', 'uvwx', 'qrst', 'uvwx', 'yz', 'yz', 'abcd']) == 26\n assert candidate(arr = ['aaaa', 'bbbb', 'cccc', 'dddd', 'eeee', 'ffff', 'gggg', 'hhhh']) == 0\n assert candidate(arr = ['abcd', 'abef', 'acgh', 'adei', 'afjk', 'aglm', 'ahno', 'aipq', 'arst', 'auvw', 'axyz']) == 4\n assert candidate(arr = ['abcdefgh', 'ijklmnop', 'qrstuvwxyz', 'abcdefgh', 'ijklmnop', 'qrstuvwxyz', 'abcdefgh', 'ijklmnop', 'qrstuvwxyz']) == 26\n assert candidate(arr = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yz', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz']) == 26\n assert candidate(arr = ['abc', 'defgh', 'ijkl', 'mnopqr', 'stuvwx', 'yz', 'abcdefgh', 'ijklmnop', 'qrstuvwx', 'yzab', 'cdefghij', 'klmnopqr', 'stuvwx', 'yz', 'abcdef', 'ghijklmnop', 'qrstuvwx', 'yzab']) == 26\n assert candidate(arr = ['abcdefgh', 'yzabcd', 'efghij', 'mnopqr', 'stuvwx', 'qrstuv', 'wxyzab']) == 24\n assert candidate(arr = ['long', 'strings', 'with', 'repeated', 'characters', 'are', 'not', 'allowed', 'in', 'this', 'problem']) == 11\n assert candidate(arr = ['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy', 'z', 'yz', 'wxy', 'vwx', 'uwv', 'tuv', 'stu', 'rst', 'qrs', 'pqr', 'opq', 'nop', 'mno', 'lmn', 'kln', 'jkl', 'ihg', 'fgh', 'efg', 'def', 'cde', 'bcd', 'abc']) == 26\n assert candidate(arr = ['zyxwvutsrqponmlkjihgfedcba', 'abcdefghijklmnopqrstuvwxy', 'abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'abcdefghijklmnopqrstuvwxy', 'abcdefghijklmnopqrstuvwxyz']) == 26\n assert candidate(arr = ['ab', 'cd', 'ef', 'gh', 'ij', 'kl', 'mn', 'op', 'qr', 'st', 'uv', 'wx', 'yz']) == 26\n assert candidate(arr = ['abcd', 'ab', 'cd', 'ef', 'gh', 'ij', 'kl', 'mn', 'op', 'qr', 'st', 'uv', 'wx', 'yz']) == 26\n assert candidate(arr = ['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yzab', 'mnop', 'qrst', 'uvwx', 'yzab', 'mnop', 'qrst', 'uvwx', 'yzab', 'mnop', 'qrst']) == 24\n assert candidate(arr = ['abcdefgh', 'ijklmnop', 'qrstuvwxyz', 'abcdefgh', 'ijklmnop', 'qrstuvwxyz']) == 26\n assert candidate(arr = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yz', 'abcdefghijklmnop', 'qrstuvwxyz', 'abcdefghij', 'klmnopqr', 'stuvwxyz', 'abcdefg', 'hijklmnop', 'qrstuvwxy', 'zabcdefghijk', 'lmnopqrstuvw', 'xyzabcdefghi', 'jklmnopqrstu', 'vwxyzabcdef', 'ghijklmnopqrstu', 'vwxyzabcdefghij', 'klmnopqrstuvwxyzabc']) == 26\n assert candidate(arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == 26\n assert candidate(arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == 26\n assert candidate(arr = ['unique', 'letters', 'only', 'here', 'now', 'this', 'that', 'these', 'those', 'other', 'another', 'either', 'neither', 'both', 'few', 'more', 'most', 'other', 'some', 'any', 'all', 'several', 'both']) == 11\n assert candidate(arr = ['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy', 'zabcd', 'efghi', 'jklmn', 'opqrs', 'tuvwx', 'yzabc']) == 25\n assert candidate(arr = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yzabcd', 'efghij', 'klmnop', 'qrstuv', 'wxyzab', 'cdefgh', 'ijklmn', 'opqrst']) == 24\n assert candidate(arr = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz', 'abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy', 'zabcd']) == 26\n assert candidate(arr = ['xyz', 'abcdef', 'ghijklm', 'nopqr', 'stuv', 'wxyz', 'mnop', 'qrstuv', 'xyzuvw', 'abcdefg']) == 26\n assert candidate(arr = ['aaaa', 'bbbb', 'cccc', 'dddd', 'eeee', 'ffff', 'gggg', 'hhhh', 'iiii', 'jjjj', 'kkkk', 'llll', 'mmmm', 'nnnn', 'oooo', 'pppp']) == 0\n assert candidate(arr = ['aabbcc', 'ddeeff', 'gghhii', 'jkkllm', 'nnoopq', 'rrsstt', 'uuvvww', 'xxyyzz']) == 0\n assert candidate(arr = ['abcdefghijklmnop', 'qrstuvwxyz', 'abcdefghijkl', 'mnopqrstuv', 'wxyzabcdef', 'ghijklmnop', 'qrstuvwxy', 'zabcdefghij']) == 26\n assert candidate(arr = ['abcdefgh', 'ijklmnop', 'qrstuvwx', 'yzabcd', 'efghij', 'klmnopqr', 'stuvwxyz', 'abcdefg', 'hijklmnop', 'qrstuvwxy', 'zabcdef', 'ghijklmnopqr', 'vwxyzabcd', 'efghijklmno', 'pqrs', 'tuvwx', 'yz', 'abcd', 'ef', 'ghij', 'klm', 'nop', 'qrs', 'tuv', 'wxy', 'z']) == 26\n assert candidate(arr = ['aaaa', 'bbbb', 'cccc', 'dddd', 'eeee', 'ffff', 'gggg', 'hhhh']) == 0\n assert candidate(arr = ['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yzab']) == 24\n assert candidate(arr = ['abcdexyz', 'mnopqr', 'stuvwx', 'yzabcd', 'efghij', 'klmno', 'pqrst', 'uvwxy', 'zabcde', 'fghijk', 'lmnopq', 'rstuvw', 'xyzabc', 'defghi', 'jklmno', 'pqrstu', 'vwxyz']) == 26\n assert candidate(arr = ['zyxwvutsrqponmlkjihgfedcba', 'abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'abcdefghijklmnopqrstuvwxyz']) == 26\n assert candidate(arr = ['unique', 'chars', 'only', 'here', 'subseq', 'concat', 'maximum', 'length', 'string', 'concatenation']) == 9\n assert candidate(arr = ['aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', 'zzyyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbbaa', 'mnopqrstuvwxyzmnopqrstuvwxyzmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd']) == 0\n assert candidate(arr = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yzabcd', 'efghij', 'klmno', 'pqrstu', 'vwxyz']) == 24\n assert candidate(arr = ['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy', 'zabcd', 'efghi', 'jklmn', 'opqrs', 'tuvwx', 'yzabc', 'defgh', 'ijklm', 'nopqr', 'stuvw', 'xyzab', 'cdefg', 'hijkl', 'mnopq', 'rstuv', 'wxyza', 'bcdef', 'ghijk', 'lmnop', 'qrstu', 'vwxyz']) == 25\n assert candidate(arr = ['abcdefgh', 'ijklmnop', 'qrstuvwx', 'yzabcdef', 'ghijklmn', 'opqrstuv', 'wxyzab', 'cdefghij', 'klmnopqr', 'stuvwxy']) == 24\n assert candidate(arr = ['abcdef', 'ghijkl', 'mnopqr', 'stuvwx', 'yzabcd', 'efghij', 'klmnop', 'qrstuv']) == 24\n assert candidate(arr = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz', 'abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yzab']) == 26\n assert candidate(arr = ['zyxwvutsrqponmlkjihgfedcba', 'qazwsxedcrfvtgbyhnujmiklop', 'plmoknijbuhvgtfrdyecwsxzqa', 'onmlkjihgfedcbazyxwvutsrqpxz']) == 26\n assert candidate(arr = ['unique', 'chars', 'only', 'here', 'are', 'some', 'strings', 'with', 'various', 'lengths']) == 11\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().maxLength", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxLength = function(arr) {", "container": null, "callable": "maxLength", "parameters": [{"name": "arr", "type": "string[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1240, "task_id": "tiling-a-rectangle-with-the-fewest-squares", "difficulty": "Hard", "problem_description": "Given a rectangle of size n x m, return the minimum number of integer-sided squares that tile the rectangle.\n \nExample 1:\n\n\nInput: n = 2, m = 3\nOutput: 3\nExplanation: 3 squares are necessary to cover the rectangle.\n2 (squares of 1x1)\n1 (square of 2x2)\nExample 2:\n\n\nInput: n = 5, m = 8\nOutput: 5\n\nExample 3:\n\n\nInput: n = 11, m = 13\nOutput: 6\n\n \nConstraints:\n\n1 <= n, m <= 13\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 8,m = 8) == 1\n assert candidate(n = 1,m = 1) == 1\n assert candidate(n = 10,m = 14) == 5\n assert candidate(n = 7,m = 7) == 1\n assert candidate(n = 9,m = 10) == 6\n assert candidate(n = 7,m = 8) == 7\n assert candidate(n = 6,m = 7) == 5\n assert candidate(n = 6,m = 10) == 4\n assert candidate(n = 8,m = 9) == 7\n assert candidate(n = 3,m = 3) == 1\n assert candidate(n = 4,m = 10) == 4\n assert candidate(n = 11,m = 13) == 6\n assert candidate(n = 5,m = 8) == 5\n assert candidate(n = 12,m = 13) == 7\n assert candidate(n = 4,m = 6) == 3\n assert candidate(n = 10,m = 11) == 6\n assert candidate(n = 9,m = 12) == 4\n assert candidate(n = 9,m = 11) == 7\n assert candidate(n = 13,m = 13) == 1\n assert candidate(n = 3,m = 5) == 4\n assert candidate(n = 2,m = 3) == 3\n assert candidate(n = 10,m = 10) == 1\n assert candidate(n = 6,m = 6) == 1\n assert candidate(n = 7,m = 12) == 6\n assert candidate(n = 3,m = 11) == 6\n assert candidate(n = 11,m = 10) == 6\n assert candidate(n = 13,m = 5) == 6\n assert candidate(n = 12,m = 7) == 6\n assert candidate(n = 13,m = 7) == 6\n assert candidate(n = 5,m = 11) == 6\n assert candidate(n = 5,m = 12) == 6\n assert candidate(n = 3,m = 14) == 7\n assert candidate(n = 8,m = 15) == 8\n assert candidate(n = 7,m = 13) == 6\n assert candidate(n = 9,m = 9) == 1\n assert candidate(n = 3,m = 7) == 5\n assert candidate(n = 4,m = 15) == 7\n assert candidate(n = 6,m = 11) == 6\n assert candidate(n = 14,m = 14) == 1\n assert candidate(n = 2,m = 13) == 8\n assert candidate(n = 6,m = 13) == 6\n assert candidate(n = 6,m = 9) == 3\n assert candidate(n = 4,m = 9) == 6\n assert candidate(n = 8,m = 12) == 3\n assert candidate(n = 4,m = 11) == 6\n assert candidate(n = 13,m = 12) == 7\n assert candidate(n = 10,m = 5) == 2\n assert candidate(n = 4,m = 7) == 5\n assert candidate(n = 7,m = 10) == 6\n assert candidate(n = 12,m = 5) == 6\n assert candidate(n = 12,m = 14) == 5\n assert candidate(n = 9,m = 7) == 6\n assert candidate(n = 10,m = 12) == 5\n assert candidate(n = 8,m = 13) == 6\n assert candidate(n = 12,m = 11) == 7\n assert candidate(n = 10,m = 15) == 3\n assert candidate(n = 9,m = 14) == 7\n assert candidate(n = 8,m = 10) == 5\n assert candidate(n = 3,m = 10) == 6\n assert candidate(n = 11,m = 9) == 7\n assert candidate(n = 8,m = 11) == 6\n assert candidate(n = 13,m = 6) == 6\n assert candidate(n = 5,m = 9) == 6\n assert candidate(n = 4,m = 13) == 7\n assert candidate(n = 12,m = 15) == 5\n assert candidate(n = 12,m = 10) == 5\n"}, "metadata": {"canonical_parameter_names": ["n", "m"], "leetcode_dataset_entry_point": "Solution().tilingRectangle", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var tilingRectangle = function(n, m) {", "container": null, "callable": "tilingRectangle", "parameters": [{"name": "n", "type": "number"}, {"name": "m", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1247, "task_id": "minimum-swaps-to-make-strings-equal", "difficulty": "Medium", "problem_description": "You are given two strings s1 and s2 of equal length consisting of letters \"x\" and \"y\" only. Your task is to make these two strings equal to each other. You can swap any two characters that belong to different strings, which means: swap s1[i] and s2[j].\nReturn the minimum number of swaps required to make s1 and s2 equal, or return -1 if it is impossible to do so.\n \nExample 1:\n\nInput: s1 = \"xx\", s2 = \"yy\"\nOutput: 1\nExplanation: Swap s1[0] and s2[1], s1 = \"yx\", s2 = \"yx\".\n\nExample 2:\n\nInput: s1 = \"xy\", s2 = \"yx\"\nOutput: 2\nExplanation: Swap s1[0] and s2[0], s1 = \"yy\", s2 = \"xx\".\nSwap s1[0] and s2[1], s1 = \"xy\", s2 = \"xy\".\nNote that you cannot swap s1[0] and s1[1] to make s1 equal to \"yx\", cause we can only swap chars in different strings.\n\nExample 3:\n\nInput: s1 = \"xx\", s2 = \"xy\"\nOutput: -1\n\n \nConstraints:\n\n1 <= s1.length, s2.length <= 1000\ns1.length == s2.length\ns1, s2 only contain 'x' or 'y'.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s1 = \"xyyy\",s2 = \"yxxx\") == 3\n assert candidate(s1 = \"xx\",s2 = \"yy\") == 1\n assert candidate(s1 = \"xxyy\",s2 = \"xyxy\") == 2\n assert candidate(s1 = \"xxyyxyxyxx\",s2 = \"xyyxyxxxyx\") == 4\n assert candidate(s1 = \"xxxyyy\",s2 = \"yyyxxx\") == 4\n assert candidate(s1 = \"xyyx\",s2 = \"xxyy\") == 2\n assert candidate(s1 = \"yx\",s2 = \"xy\") == 2\n assert candidate(s1 = \"xxxx\",s2 = \"yyyy\") == 2\n assert candidate(s1 = \"yxyy\",s2 = \"xyyx\") == -1\n assert candidate(s1 = \"xx\",s2 = \"xy\") == -1\n assert candidate(s1 = \"yy\",s2 = \"xx\") == 1\n assert candidate(s1 = \"xyyx\",s2 = \"xyyx\") == 0\n assert candidate(s1 = \"yyyy\",s2 = \"xxxx\") == 2\n assert candidate(s1 = \"xyxy\",s2 = \"yxyx\") == 2\n assert candidate(s1 = \"xyxx\",s2 = \"xyyx\") == -1\n assert candidate(s1 = \"xxyx\",s2 = \"xyxy\") == -1\n assert candidate(s1 = \"xy\",s2 = \"yx\") == 2\n assert candidate(s1 = \"xyxyxy\",s2 = \"yxyxyx\") == 4\n assert candidate(s1 = \"xyxyxyxyxyxyxyxyxyxyxyxyxy\",s2 = \"yxyxyxyxyxyxyxyxyxyxyxyxyx\") == 14\n assert candidate(s1 = \"xyxxxyxxyy\",s2 = \"yxyyxyyxxy\") == 3\n assert candidate(s1 = \"xyyyxy\",s2 = \"yxyxyx\") == -1\n assert candidate(s1 = \"xxyyxx\",s2 = \"yyxxxy\") == -1\n assert candidate(s1 = \"xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxy\",s2 = \"yxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyx\") == 16\n assert candidate(s1 = \"xyxyyx\",s2 = \"yxyxyx\") == 2\n assert candidate(s1 = \"xyxyxyxyxyxyxyxyxyxyxyxyxyxy\",s2 = \"yxyxyxyxyxyxyxyxyxyxyxyxyxyx\") == 14\n assert candidate(s1 = \"xyxyxyxyxyxy\",s2 = \"yxyxyxyxyxyx\") == 6\n assert candidate(s1 = \"xxxyyyxx\",s2 = \"yyxxxyyy\") == 3\n assert candidate(s1 = \"xyyxxyyyxy\",s2 = \"yxyyxxyxyx\") == -1\n assert candidate(s1 = \"xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxy\",s2 = \"yxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyx\") == 20\n assert candidate(s1 = \"yxyxyxyxyx\",s2 = \"xyxyxyxyxy\") == 6\n assert candidate(s1 = \"xyyxxyyxxy\",s2 = \"yxyxyxyxyx\") == 4\n assert candidate(s1 = \"xxxyyyy\",s2 = \"yyyxxxx\") == -1\n assert candidate(s1 = \"xyyxxyyx\",s2 = \"yxyxyxyx\") == 2\n assert candidate(s1 = \"xxyyyy\",s2 = \"yyxxyx\") == -1\n assert candidate(s1 = \"xxxxxyyyyy\",s2 = \"yyyyyyxxxx\") == -1\n assert candidate(s1 = \"xxyxyxyy\",s2 = \"yyxyxyyx\") == -1\n assert candidate(s1 = \"xyxyxxxy\",s2 = \"yyxxyxyx\") == -1\n assert candidate(s1 = \"xxyxxyxyxy\",s2 = \"yxyxyxyxyy\") == 3\n assert candidate(s1 = \"xxxyyyxy\",s2 = \"yyxxyxxy\") == 2\n assert candidate(s1 = \"xyyx\",s2 = \"yxyx\") == 2\n assert candidate(s1 = \"xxyyxyyx\",s2 = \"yyxyxxxy\") == 4\n assert candidate(s1 = \"xxyxxy\",s2 = \"yyxyyx\") == 3\n assert candidate(s1 = \"xyyxxyxyxy\",s2 = \"yxyxyxyxyy\") == -1\n assert candidate(s1 = \"xyxyxyxyxyxyxy\",s2 = \"yxyxyxyxyxyxyx\") == 8\n assert candidate(s1 = \"xxyyxy\",s2 = \"yyxyxx\") == 2\n assert candidate(s1 = \"xyxyxy\",s2 = \"yxyxyy\") == -1\n assert candidate(s1 = \"xyxxyyxy\",s2 = \"yxyyyxyx\") == -1\n assert candidate(s1 = \"xxyxyxyxyx\",s2 = \"yxyxyxyxyx\") == -1\n assert candidate(s1 = \"xxyyxyxyx\",s2 = \"yyxyxyxyx\") == -1\n assert candidate(s1 = \"yxyxyxyxyx\",s2 = \"xyxyxyxyyx\") == 4\n assert candidate(s1 = \"xyxxyxxyxy\",s2 = \"yxyxyxyxyx\") == -1\n assert candidate(s1 = \"xyxyxyyxyx\",s2 = \"xyxyxyxyxy\") == 2\n assert candidate(s1 = \"xxxxxy\",s2 = \"yyyxxx\") == 3\n assert candidate(s1 = \"xxyyxxxyyy\",s2 = \"yyxxyyxyxx\") == 4\n assert candidate(s1 = \"xxxxxx\",s2 = \"yyyyyy\") == 3\n assert candidate(s1 = \"xyxyxyxyxy\",s2 = \"yxyxyxyxyx\") == 6\n assert candidate(s1 = \"xxxxxyyyy\",s2 = \"yyyyxxxyx\") == -1\n assert candidate(s1 = \"xxyx\",s2 = \"xyyx\") == -1\n assert candidate(s1 = \"xxxxxxxx\",s2 = \"yyyyyyyy\") == 4\n assert candidate(s1 = \"xxxxxxxxxx\",s2 = \"yyyyyyyyyy\") == 5\n assert candidate(s1 = \"xyxxyxxyx\",s2 = \"yxyxyxyyx\") == 3\n assert candidate(s1 = \"xyxxyy\",s2 = \"yxyxyx\") == 2\n assert candidate(s1 = \"xxyxyxyx\",s2 = \"yxyxyxyy\") == 1\n assert candidate(s1 = \"xyxyxxxyyx\",s2 = \"yxyxyxxyxy\") == -1\n assert candidate(s1 = \"xxyyxxyyxx\",s2 = \"yyxyxxyyxy\") == 3\n assert candidate(s1 = \"xyxyxyxyxyxyxyxyxyxy\",s2 = \"yxyxyxyxyxyxyxyxyxyx\") == 10\n assert candidate(s1 = \"xyxyxyxy\",s2 = \"yxyxyxyx\") == 4\n assert candidate(s1 = \"xxyy\",s2 = \"yyxx\") == 2\n assert candidate(s1 = \"xxyxyxyxyxyxyxyxyx\",s2 = \"xyxyxyxyxyxyxyxyyx\") == -1\n assert candidate(s1 = \"xxyyxyxyxyxyxy\",s2 = \"yyxyxyxyxyxyyx\") == -1\n assert candidate(s1 = \"xyxyy\",s2 = \"yxyyx\") == 2\n assert candidate(s1 = \"xyyxxyyxxyyx\",s2 = \"yxyxyxyxyxyy\") == -1\n assert candidate(s1 = \"xxyxyxyx\",s2 = \"xyxyxyyx\") == -1\n assert candidate(s1 = \"xxxxxyyy\",s2 = \"yyyyxxxx\") == -1\n assert candidate(s1 = \"xyxyxyxyyy\",s2 = \"yxyxyxyxxx\") == 5\n assert candidate(s1 = \"yyxyyyxxxyyy\",s2 = \"xyxxyyxyxxyx\") == -1\n assert candidate(s1 = \"yxyxyxyx\",s2 = \"xyxyxyxy\") == 4\n assert candidate(s1 = \"xyxxyxyxyx\",s2 = \"xyxyxyxyyx\") == -1\n assert candidate(s1 = \"xyxxyxyx\",s2 = \"yxxyxyyx\") == -1\n assert candidate(s1 = \"xxxxxxyy\",s2 = \"yyxxxxyx\") == -1\n assert candidate(s1 = \"xyxyxyxyxyxyxyxyxyxyxy\",s2 = \"yxyxyxyxyxyxyxyxyxyxyx\") == 12\n assert candidate(s1 = \"xxyyxyyx\",s2 = \"yyxyxyyx\") == -1\n assert candidate(s1 = \"xxxyyyxyyx\",s2 = \"yyxyyxyxxy\") == -1\n assert candidate(s1 = \"xxyxxyxyxy\",s2 = \"yxyxyxyxyx\") == -1\n assert candidate(s1 = \"xyxxyxxyxxyxyy\",s2 = \"yxyxyxyxyxyyxy\") == 5\n assert candidate(s1 = \"xxyxyxx\",s2 = \"yyxyxyy\") == -1\n assert candidate(s1 = \"xxyxyxyxyx\",s2 = \"xyxyxyxyyx\") == -1\n assert candidate(s1 = \"xyxyxyyy\",s2 = \"yxyxyxxx\") == 5\n assert candidate(s1 = \"xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxy\",s2 = \"yxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyx\") == 18\n assert candidate(s1 = \"xxyxyxyxyx\",s2 = \"xyxxyxyxyx\") == 2\n assert candidate(s1 = \"xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxy\",s2 = \"yxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyx\") == 18\n assert candidate(s1 = \"xyyxxyxyxy\",s2 = \"yxyxyxyxyx\") == 4\n assert candidate(s1 = \"xxyxyx\",s2 = \"yyxyxy\") == 3\n assert candidate(s1 = \"xxyyyy\",s2 = \"yyyxxx\") == -1\n assert candidate(s1 = \"xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxy\",s2 = \"yxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyx\") == 20\n assert candidate(s1 = \"xyxxyxyx\",s2 = \"xyxyxyyx\") == -1\n assert candidate(s1 = \"xyxyxyxyxy\",s2 = \"yxyxyxyxyy\") == -1\n assert candidate(s1 = \"xyxxyxxyx\",s2 = \"yxyxyxyxy\") == 3\n assert candidate(s1 = \"xyxxyxyxyxyxyxyxyxyxyxyxyxyx\",s2 = \"xyxyxyxyxyxyxyxyxyxyxyxyxyxy\") == -1\n assert candidate(s1 = \"xxyxyxyxyy\",s2 = \"yyxyxyxyyx\") == -1\n assert candidate(s1 = \"xyxyxyxyxyxyxyxy\",s2 = \"yxyxyxyxyxyxyxyx\") == 8\n assert candidate(s1 = \"xyxxxy\",s2 = \"yxyyxy\") == 3\n assert candidate(s1 = \"xxyxyyxy\",s2 = \"yyxyxyyx\") == -1\n"}, "metadata": {"canonical_parameter_names": ["s1", "s2"], "leetcode_dataset_entry_point": "Solution().minimumSwap", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minimumSwap = function(s1, s2) {", "container": null, "callable": "minimumSwap", "parameters": [{"name": "s1", "type": "string"}, {"name": "s2", "type": "string"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1248, "task_id": "count-number-of-nice-subarrays", "difficulty": "Medium", "problem_description": "Given an array of integers nums and an integer k. A continuous subarray is called nice if there are k odd numbers on it.\nReturn the number of nice sub-arrays.\n \nExample 1:\n\nInput: nums = [1,1,2,1,1], k = 3\nOutput: 2\nExplanation: The only sub-arrays with 3 odd numbers are [1,1,2,1] and [1,2,1,1].\n\nExample 2:\n\nInput: nums = [2,4,6], k = 1\nOutput: 0\nExplanation: There are no odd numbers in the array.\n\nExample 3:\n\nInput: nums = [2,2,2,1,2,2,1,2,2,2], k = 2\nOutput: 16\n\n \nConstraints:\n\n1 <= nums.length <= 50000\n1 <= nums[i] <= 10^5\n1 <= k <= nums.length\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 4, 5],k = 3) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == 2\n assert candidate(nums = [2],k = 1) == 0\n assert candidate(nums = [2, 4, 6],k = 1) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 3) == 10\n assert candidate(nums = [1],k = 1) == 1\n assert candidate(nums = [1, 3, 5, 7, 9],k = 5) == 1\n assert candidate(nums = [2, 2, 2, 2, 2],k = 1) == 0\n assert candidate(nums = [2, 2, 2, 1, 2, 2, 1, 2, 2, 2],k = 2) == 16\n assert candidate(nums = [1, 3, 5, 7, 9],k = 2) == 4\n assert candidate(nums = [1, 1, 2, 1, 1],k = 3) == 2\n assert candidate(nums = [2, 2, 2, 2, 2],k = 0) == 15\n assert candidate(nums = [10, 15, 20, 25, 30],k = 1) == 8\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 0) == 55\n assert candidate(nums = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],k = 5) == 44\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 15) == 16\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],k = 1) == 0\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],k = 0) == 120\n assert candidate(nums = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7],k = 10) == 61\n assert candidate(nums = [1, 3, 5, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34],k = 5) == 0\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2],k = 1) == 81\n assert candidate(nums = [2, 4, 6, 8, 10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23],k = 5) == 13\n assert candidate(nums = [2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2],k = 4) == 16\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 20) == 54\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2],k = 5) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 15) == 2\n assert candidate(nums = [10, 15, 20, 25, 30, 35, 40, 45, 50, 55],k = 2) == 14\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 5) == 16\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 21\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10) == 2\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 1, 3, 5, 7, 9, 2, 4, 6, 8, 10],k = 3) == 18\n assert candidate(nums = [2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3],k = 5) == 42\n assert candidate(nums = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9],k = 3) == 10\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 2) == 9\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 5) == 12\n assert candidate(nums = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],k = 3) == 36\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59],k = 20) == 11\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],k = 5) == 22\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 1) == 20\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],k = 0) == 210\n assert candidate(nums = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11],k = 4) == 6\n assert candidate(nums = [11, 22, 33, 44, 55, 66, 77, 88, 99, 100],k = 5) == 2\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21],k = 3) == 9\n assert candidate(nums = [1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2],k = 4) == 57\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80],k = 0) == 820\n assert candidate(nums = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9],k = 7) == 4\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],k = 15) == 6\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49],k = 10) == 16\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 5) == 16\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 1, 3, 5, 7, 9],k = 5) == 11\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],k = 1) == 640\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 3) == 13\n assert candidate(nums = [100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 100000],k = 3) == 0\n assert candidate(nums = [1, 2, 3, 2, 1, 2, 3, 2, 1],k = 2) == 12\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 6) == 18\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6],k = 3) == 29\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 11\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 3) == 22\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 10) == 21\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],k = 5) == 22\n assert candidate(nums = [1, 1, 2, 1, 2, 1, 2, 1, 2, 1],k = 3) == 10\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40],k = 1) == 0\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 5) == 22\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 20) == 25\n assert candidate(nums = [2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3],k = 3) == 14\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 4) == 6\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 5) == 35\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],k = 7) == 9\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().numberOfSubarrays", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numberOfSubarrays = function(nums, k) {", "container": null, "callable": "numberOfSubarrays", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1249, "task_id": "minimum-remove-to-make-valid-parentheses", "difficulty": "Medium", "problem_description": "Given a string s of '(' , ')' and lowercase English characters.\nYour task is to remove the minimum number of parentheses ( '(' or ')', in any positions ) so that the resulting parentheses string is valid and return any valid string.\nFormally, a parentheses string is valid if and only if:\n\nIt is the empty string, contains only lowercase characters, or\nIt can be written as AB (A concatenated with B), where A and B are valid strings, or\nIt can be written as (A), where A is a valid string.\n\n \nExample 1:\n\nInput: s = \"lee(t(c)o)de)\"\nOutput: \"lee(t(c)o)de\"\nExplanation: \"lee(t(co)de)\" , \"lee(t(c)ode)\" would also be accepted.\n\nExample 2:\n\nInput: s = \"a)b(c)d\"\nOutput: \"ab(c)d\"\n\nExample 3:\n\nInput: s = \"))((\"\nOutput: \"\"\nExplanation: An empty string is also valid.\n\n \nConstraints:\n\n1 <= s.length <= 105\ns[i] is either '(' , ')', or lowercase English letter.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"(a(b)c)d(e(fg)h\") == \"(a(b)c)de(fg)h\"\n assert candidate(s = \"()\") == \"()\"\n assert candidate(s = \"))(()\") == \"()\"\n assert candidate(s = \"ab(c(d)e)f(g(h)i)j(kl)\") == \"ab(c(d)e)f(g(h)i)j(kl)\"\n assert candidate(s = \"a)b(c)d\") == \"ab(c)d\"\n assert candidate(s = \"()()\") == \"()()\"\n assert candidate(s = \"\") == \"\"\n assert candidate(s = \"(a(b)c)d(e(f)g)h(i)\") == \"(a(b)c)d(e(f)g)h(i)\"\n assert candidate(s = \"))(())\") == \"(())\"\n assert candidate(s = \"(a(b)c)d(e(f)g)h\") == \"(a(b)c)d(e(f)g)h\"\n assert candidate(s = \"lee(t(c)o)de)\") == \"lee(t(c)o)de\"\n assert candidate(s = \"a(b)c)d(e(fg)h)i(j(k(l)m)n)o(pq(r)s)t(uv(w)x)y(z)\") == \"a(b)cd(e(fg)h)i(j(k(l)m)n)o(pq(r)s)t(uv(w)x)y(z)\"\n assert candidate(s = \"a(b(c)d)e(f(g(h)i)j)k(l(m)n)o(p)q(r)s)t(u)v(w(x)y)z(((())\") == \"a(b(c)d)e(f(g(h)i)j)k(l(m)n)o(p)q(r)st(u)v(w(x)y)z(())\"\n assert candidate(s = \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p)q(r)s)t(u)v(w(x)y)z\") == \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p)q(r)st(u)v(w(x)y)z\"\n assert candidate(s = \"a((b)c)d(e(f)g)h(i(j(k(l)m)n)o(p(q(r)s)t(uv(w)x)y(z))))\") == \"a((b)c)d(e(f)g)h(i(j(k(l)m)n)o(p(q(r)s)t(uv(w)x)y(z)))\"\n assert candidate(s = \"a(b(c)d(e(f)g)h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y(z)\") == \"a(b(c)d(e(f)g)h)i(j(k(l)m)n)o(p)q(r)st(u)v(w)xy(z)\"\n assert candidate(s = \"a(b(c)d(e(f)g(h)i)j)k\") == \"a(b(c)d(e(f)g(h)i)j)k\"\n assert candidate(s = \"(())((()())())(()(()))(()(()())())(()(()))(()(()())())\") == \"(())((()())())(()(()))(()(()())())(()(()))(()(()())())\"\n assert candidate(s = \"a(b(c)d(e(f(g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z))))\") == \"a(b(c)d(e(f(g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z)))\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p)\") == \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p)\"\n assert candidate(s = \"(x(y(z)))a(b(c)d(e(f)g)h)i)j)k\") == \"(x(y(z)))a(b(c)d(e(f)g)h)ijk\"\n assert candidate(s = \"a(b)c(d(e(f)g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z)\") == \"a(b)c(d(e(f)g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z)\"\n assert candidate(s = \"(a(b(c)d(e(f(g(h)i)j)k)l)m)n)o)p)q)r)s)t)u)v)w)x)y)z\") == \"(a(b(c)d(e(f(g(h)i)j)k)l)m)nopqrstuvwxyz\"\n assert candidate(s = \"((((((((((a))))))))))\") == \"((((((((((a))))))))))\"\n assert candidate(s = \"a(b(c)d(e(f)g)h)i(j(k(l)m)n)o\") == \"a(b(c)d(e(f)g)h)i(j(k(l)m)n)o\"\n assert candidate(s = \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)o)p(q(r)s)t(u(v(w)x)y(z))\") == \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)op(q(r)s)t(u(v(w)x)y(z))\"\n assert candidate(s = \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)o)p(q(r)s)t(u(v(w)x)y(z)))\") == \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)op(q(r)s)t(u(v(w)x)y(z))\"\n assert candidate(s = \"a(b(c(d(e(f(g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z)\") == \"abcde(f(g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z)\"\n assert candidate(s = \"a(b(c)d(e(f(g(h)i)j)k)l)m)n)o)p)q)r)s)t)u)v)w)x)y)z\") == \"a(b(c)d(e(f(g(h)i)j)k)l)mnopqrstuvwxyz\"\n assert candidate(s = \"a(b(c)d(e(f(g(h)i)j)k)l)m)n)o)p)q)r)s)t)u)v)w)x)y)z)\") == \"a(b(c)d(e(f(g(h)i)j)k)l)mnopqrstuvwxyz\"\n assert candidate(s = \"((abc)(def))ghi(jkl(mno)pqr)stu(vwx(yz)\") == \"((abc)(def))ghi(jkl(mno)pqr)stuvwx(yz)\"\n assert candidate(s = \"((a(b)c)d)e(f(g(h)i)j)k(lmno)p(q(rst)uvw)x(y(z))\") == \"((a(b)c)d)e(f(g(h)i)j)k(lmno)p(q(rst)uvw)x(y(z))\"\n assert candidate(s = \"((((((((a))))))))\") == \"((((((((a))))))))\"\n assert candidate(s = \"(a(b(c)d(e(f)g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z))))\") == \"(a(b(c)d(e(f)g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z))\"\n assert candidate(s = \"(())((())())(((())))\") == \"(())((())())(((())))\"\n assert candidate(s = \"a((((((((((b))))))))))\") == \"a((((((((((b))))))))))\"\n assert candidate(s = \"((((a)bb)ccc)d)eeee(f)ggg(h)iii\") == \"((((a)bb)ccc)d)eeee(f)ggg(h)iii\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p)q(r)s)t(u)v(w)x(y)z\") == \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p)q(r)s)t(u)v(w)x(y)z\"\n assert candidate(s = \"a(b)c)d(e(f(g)h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z\") == \"a(b)cd(e(f(g)h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z\"\n assert candidate(s = \"abc(def(ghi)jkl)mno(pqr)stu(vwxyz)\") == \"abc(def(ghi)jkl)mno(pqr)stu(vwxyz)\"\n assert candidate(s = \"((a(b)c)d(e(f)g)h(i)j)k(l(m)n)o(p)q(r)s)t\") == \"((a(b)c)d(e(f)g)h(i)j)k(l(m)n)o(p)q(r)st\"\n assert candidate(s = \"a(b(c)d)e(f(g(h)i)j)k(l(m)n)o(p)q(r)s)t(u)v(w(x)y)z)()(()\") == \"a(b(c)d)e(f(g(h)i)j)k(l(m)n)o(p)q(r)st(u)v(w(x)y)z()()\"\n assert candidate(s = \"a(b(c)d(e(f)g)h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z)\") == \"a(b(c)d(e(f)g)h)i(j(k(l)m)n)o(p)q(r)st(u)v(w)x(y)z\"\n assert candidate(s = \"(abc(def(ghi(jkl(mnopqr(stu(vwx(yz)))))))\") == \"abc(def(ghi(jkl(mnopqr(stu(vwx(yz)))))))\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q)r)s)t(u)v(w)x(y)z)))\") == \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q)r)s)t(u)v(w)x(y)z\"\n assert candidate(s = \"a(b(c(d(e(f(g(h)i(j)k)l)m)n)o(p)q(r)s)t(u)v(w)x(y)z)\") == \"a(b(c(d(e(f(g(h)i(j)k)l)m)n)o(p)q(r)s)t(u)v(w)x(y)z)\"\n assert candidate(s = \"((((((((((((((((((((((()))))))))))))))))))))))))\") == \"((((((((((((((((((((((()))))))))))))))))))))))\"\n assert candidate(s = \"(((((a(b)c)d)e)f)g)h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w(x)y)z\") == \"(((((a(b)c)d)e)f)g)hi(j(k(l)m)n)o(p)q(r)st(u)v(w(x)y)z\"\n assert candidate(s = \"((((((((((a))))))))))b\") == \"((((((((((a))))))))))b\"\n assert candidate(s = \"()()()((()))(())(((()))(()(()))(())(()))\") == \"()()()((()))(())(((()))(()(()))(())(()))\"\n assert candidate(s = \"((((((((((()))))))))))\") == \"((((((((((()))))))))))\"\n assert candidate(s = \"(((abc)def)ghijklmnopqrst)uv(wxyz)\") == \"(((abc)def)ghijklmnopqrst)uv(wxyz)\"\n assert candidate(s = \"abc)def(ghi)jkl(mno)pqr(stu)vwx(yz\") == \"abcdef(ghi)jkl(mno)pqr(stu)vwxyz\"\n assert candidate(s = \"((a)(b)(c)(d))\") == \"((a)(b)(c)(d))\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz(abcdefghijklmnopqrstuvwxyz)\") == \"abcdefghijklmnopqrstuvwxyz(abcdefghijklmnopqrstuvwxyz)\"\n assert candidate(s = \"((((((((((((((((((((()))))))))))))))))))))))))))))()\") == \"((((((((((((((((((((()))))))))))))))))))))()\"\n assert candidate(s = \"((((a(b)c)d(e(f)g)h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z))))\") == \"((((a(b)c)d(e(f)g)h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z)\"\n assert candidate(s = \"(a(b)c)d(e(f(g)h)i(j(k(l)m)n)o)p(q(r)s)t(u(v(w)x)y(z)))\") == \"(a(b)c)d(e(f(g)h)i(j(k(l)m)n)o)p(q(r)s)t(u(v(w)x)y(z))\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q)r)s)t(u)v(w)x(y)z)\") == \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q)r)s)t(u)v(w)x(y)z\"\n assert candidate(s = \"a(b(c(d(e(f(g(h)i(j)k)l)m)n)o(p(q(r)s)t)u(v(w(x)y(z)u)v)w)x)y)z\") == \"a(b(c(d(e(f(g(h)i(j)k)l)m)n)o(p(q(r)s)t)u(v(w(x)y(z)u)v)w)x)yz\"\n assert candidate(s = \"((((((a(b)c)d))))))\") == \"((((((a(b)c)d)))))\"\n assert candidate(s = \"a(b(c)d(e(f(g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y(z))))\") == \"ab(c)d(e(f(g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y(z))))\"\n assert candidate(s = \"((((((((((((((((((((((()\") == \"()\"\n assert candidate(s = \"a(b)c)d(e(f)g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z\") == \"a(b)cd(e(f)g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z\"\n assert candidate(s = \"(a(b)c)d(e(f(g)h)i(j(k(l)m)n)o)p(q(r)s)t(u(v)w)x(y(z)))\") == \"(a(b)c)d(e(f(g)h)i(j(k(l)m)n)o)p(q(r)s)t(u(v)w)x(y(z))\"\n assert candidate(s = \"a(b(c)d)e(f(g)h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w(x)y)z\") == \"a(b(c)d)e(f(g)h)i(j(k(l)m)n)o(p)q(r)st(u)v(w(x)y)z\"\n assert candidate(s = \"a(b(c)d(e(f(g(h)i)j)k)l)m)n)o)p)q)r)s)t)u)v)w)x)y)z(abc)\") == \"a(b(c)d(e(f(g(h)i)j)k)l)mnopqrstuvwxyz(abc)\"\n assert candidate(s = \"((a(b)c)d(e(f)g)h)i(j(k(l)m)n)o(p)\") == \"((a(b)c)d(e(f)g)h)i(j(k(l)m)n)o(p)\"\n assert candidate(s = \"(a(b(c)d(e(f(g(h)i)j)k)l)m)n)o)p)q)r)s)t)u)v)w)x)y)z)\") == \"(a(b(c)d(e(f(g(h)i)j)k)l)m)nopqrstuvwxyz\"\n assert candidate(s = \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r)s)t)u(v(w(x)y)z)\") == \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r)s)t)u(v(w(x)y)z)\"\n assert candidate(s = \"(a(b(c)d(e(f(g(h)i)j)k)l)m)n)o)p)q)r)s)t)u)v)w)x)y)z)abc(def)\") == \"(a(b(c)d(e(f(g(h)i)j)k)l)m)nopqrstuvwxyzabc(def)\"\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz)abcdefghijklmnopqrstuvwxyz(\") == \"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r)s)t(u(v(w)x)y)z)\") == \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q(r)s)t(u(v(w)x)y)z)\"\n assert candidate(s = \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q)r)s)t(u)v(w)x(y)(z)\") == \"(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q)r)s)t(u)v(w)x(y)(z)\"\n assert candidate(s = \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q)r)s)t(u)v(w)x(y)z)(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q)r)s)t(u)v(w)x(y)z)\") == \"a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q)r)st(u)v(w)x(y)z(a(b(c(d(e(f(g(h)i)j)k)l)m)n)o(p(q)r)s)t(u)v(w)x(y)z\"\n assert candidate(s = \"(a(b(c)d(e(f(g(h)i)j)k)l)m)n)o)p)q)r)s)t)u)v)w)x)y)z)abc\") == \"(a(b(c)d(e(f(g(h)i)j)k)l)m)nopqrstuvwxyzabc\"\n assert candidate(s = \"a(b(c(d(e(f(g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z))))\") == \"ab(c(d(e(f(g(h)i(j(k(l)m)n)o(p)q(r)s)t(u)v(w)x(y)z))))\"\n"}, "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().minRemoveToMakeValid", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minRemoveToMakeValid = function(s) {", "container": null, "callable": "minRemoveToMakeValid", "parameters": [{"name": "s", "type": "string"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1250, "task_id": "check-if-it-is-a-good-array", "difficulty": "Hard", "problem_description": "Given an array nums of positive integers. Your task is to select some subset of nums, multiply each element by an integer and add all these numbers. The array is said to be good if you can obtain a sum of 1 from the array by any possible subset and multiplicand.\nReturn True if the array is good otherwise return False.\n \nExample 1:\n\nInput: nums = [12,5,7,23]\nOutput: true\nExplanation: Pick numbers 5 and 7.\n5*3 + 7*(-2) = 1\n\nExample 2:\n\nInput: nums = [29,6,10]\nOutput: true\nExplanation: Pick numbers 29, 6 and 10.\n29*1 + 6*(-3) + 10*(-1) = 1\n\nExample 3:\n\nInput: nums = [3,6]\nOutput: false\n\n \nConstraints:\n\n1 <= nums.length <= 10^5\n1 <= nums[i] <= 10^9\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [7, 13, 19]) == True\n assert candidate(nums = [100, 200, 300, 400]) == False\n assert candidate(nums = [7, 13, 19, 29]) == True\n assert candidate(nums = [29, 6, 10]) == True\n assert candidate(nums = [7, 14, 21, 35]) == False\n assert candidate(nums = [2, 4, 6, 8, 10]) == False\n assert candidate(nums = [7, 14, 21, 28]) == False\n assert candidate(nums = [2, 3, 5]) == True\n assert candidate(nums = [1]) == True\n assert candidate(nums = [1000000000]) == False\n assert candidate(nums = [11, 22, 33, 44]) == False\n assert candidate(nums = [3, 6]) == False\n assert candidate(nums = [12, 5, 7, 23]) == True\n assert candidate(nums = [1000000000, 1000000000, 1000000000]) == False\n assert candidate(nums = [100, 200, 300]) == False\n assert candidate(nums = [5, 5, 5, 5]) == False\n assert candidate(nums = [1, 2, 3, 4, 5]) == True\n assert candidate(nums = [3, 5, 7, 11, 13]) == True\n assert candidate(nums = [17, 19, 23, 29]) == True\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == False\n assert candidate(nums = [8, 12, 16, 20]) == False\n assert candidate(nums = [7, 14, 21, 28, 35]) == False\n assert candidate(nums = [5, 10, 15]) == False\n assert candidate(nums = [5, 10, 15, 20, 25]) == False\n assert candidate(nums = [11, 22, 33, 44, 55]) == False\n assert candidate(nums = [1, 2, 3]) == True\n assert candidate(nums = [11, 13, 17, 19]) == True\n assert candidate(nums = [5]) == False\n assert candidate(nums = [1000000000, 1000000000, 1000000000, 1]) == True\n assert candidate(nums = [123456789, 987654321, 246813579, 864204864]) == False\n assert candidate(nums = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576]) == False\n assert candidate(nums = [97, 101, 103, 107, 109, 113, 127, 131, 137, 139]) == True\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70]) == False\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == False\n assert candidate(nums = [41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157]) == True\n assert candidate(nums = [13195, 26390, 39585, 52780, 65975, 79170, 92365, 105560, 118755, 131950]) == False\n assert candidate(nums = [13, 17, 19, 23, 29]) == True\n assert candidate(nums = [1000000007, 1000000009, 1000000021, 1000000033, 1000000037, 1000000087, 1000000093]) == True\n assert candidate(nums = [101, 103, 107, 109, 113, 127, 131, 137, 139]) == True\n assert candidate(nums = [111111111, 222222222, 333333333, 444444444]) == False\n assert candidate(nums = [4, 9, 25, 49, 121, 169, 289, 361]) == True\n assert candidate(nums = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]) == True\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]) == False\n assert candidate(nums = [9973, 9967, 9959, 9949, 9941, 9931, 9929, 9923, 9919, 9907]) == True\n assert candidate(nums = [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42]) == False\n assert candidate(nums = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000]) == False\n assert candidate(nums = [13, 17, 19, 23, 29]) == True\n assert candidate(nums = [131, 137, 139, 149, 151, 157, 163, 167, 173, 179]) == True\n assert candidate(nums = [8, 14, 21, 35, 56]) == True\n assert candidate(nums = [999999999, 888888888, 777777777, 666666666, 555555555, 444444444, 333333333, 222222222, 111111111]) == False\n assert candidate(nums = [17, 23, 19, 5, 3, 2]) == True\n assert candidate(nums = [7, 21, 35, 56, 112, 140]) == False\n assert candidate(nums = [15, 30, 45, 60, 75, 90, 105, 120, 135, 150]) == False\n assert candidate(nums = [13, 17, 19, 23, 29, 31]) == True\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]) == True\n assert candidate(nums = [8, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72]) == False\n assert candidate(nums = [1000000007, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]) == True\n assert candidate(nums = [123456789, 987654321, 111111111, 222222222, 333333333]) == False\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30]) == False\n assert candidate(nums = [41, 43, 47, 53, 59, 61, 67, 71, 73, 79]) == True\n assert candidate(nums = [1000000007, 1000000009, 1000000011]) == True\n assert candidate(nums = [101, 103, 107, 109, 113]) == True\n assert candidate(nums = [42, 105, 210, 35]) == False\n assert candidate(nums = [1000000007, 1000000009, 1000000021]) == True\n assert candidate(nums = [49, 77, 91, 119, 133, 161, 187, 203, 221, 247, 259, 287, 301, 329, 343, 371, 399, 413, 437, 469, 497, 511, 539, 553, 581]) == True\n assert candidate(nums = [11, 22, 33, 44, 55, 66, 77, 88, 99]) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [3, 5, 8, 11, 19]) == True\n assert candidate(nums = [555, 1110, 1665, 2220, 2775]) == False\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384]) == True\n assert candidate(nums = [999999999, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]) == True\n assert candidate(nums = [1000000000, 500000000, 250000000, 125000000, 62500000]) == False\n assert candidate(nums = [15, 21, 35, 525, 630]) == True\n assert candidate(nums = [30, 60, 90, 120, 150, 180, 210, 240, 270, 300]) == False\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]) == True\n assert candidate(nums = [2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70, 74, 78, 82, 86, 90, 94, 98]) == False\n assert candidate(nums = [17, 23, 41, 59]) == True\n assert candidate(nums = [1000000000, 999999999, 1, 2]) == True\n assert candidate(nums = [8, 12, 18, 24, 30, 36, 42, 48, 54]) == False\n assert candidate(nums = [15, 25, 35, 45, 55, 65, 75, 85, 95, 105]) == False\n assert candidate(nums = [7, 11, 13, 17, 19, 23, 29]) == True\n assert candidate(nums = [1000000001, 1000000003, 1000000007, 1000000009]) == True\n assert candidate(nums = [15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70]) == False\n assert candidate(nums = [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]) == True\n assert candidate(nums = [1000000000, 2000000000, 3000000000, 4000000000, 5000000000, 6000000000, 7000000000, 8000000000, 9000000000, 10000000000]) == False\n assert candidate(nums = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31]) == True\n assert candidate(nums = [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]) == False\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384]) == True\n assert candidate(nums = [11, 22, 33, 44, 55, 66, 77, 88, 99, 110]) == False\n assert candidate(nums = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145]) == False\n assert candidate(nums = [123, 456, 789, 101, 137]) == True\n assert candidate(nums = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]) == False\n assert candidate(nums = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000]) == False\n assert candidate(nums = [31, 37, 41, 43, 47, 53, 59, 61, 67, 71]) == True\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45]) == False\n assert candidate(nums = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]) == True\n assert candidate(nums = [13, 17, 19, 23, 29, 31]) == True\n assert candidate(nums = [41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113]) == True\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]) == True\n assert candidate(nums = [35, 105, 175, 245, 315]) == False\n assert candidate(nums = [97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149]) == True\n assert candidate(nums = [19, 38, 57, 76, 95, 114, 133, 152]) == False\n assert candidate(nums = [1000000000, 1000000001, 1000000002, 1000000003, 1000000004, 1000000005]) == True\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]) == True\n assert candidate(nums = [17, 29, 41, 53, 67, 83]) == True\n assert candidate(nums = [3, 9, 27, 81, 243]) == False\n assert candidate(nums = [60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900, 960, 1020, 1080, 1140, 1200]) == False\n assert candidate(nums = [1000000001, 1000000002, 1000000003, 1000000004]) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [101, 201, 301, 401, 501, 601, 701, 801, 901, 1001]) == True\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98]) == False\n assert candidate(nums = [31, 37, 41, 43, 47, 53, 59]) == True\n assert candidate(nums = [123456789, 987654321, 234567891, 345678912]) == False\n assert candidate(nums = [37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127]) == True\n assert candidate(nums = [111111111, 222222222, 333333333, 444444444, 555555555]) == False\n assert candidate(nums = [3, 9, 27, 81, 243, 729, 2187, 6561]) == False\n assert candidate(nums = [500000000, 500000001, 500000002, 500000003, 500000004, 500000005, 500000006, 500000007, 500000008, 500000009]) == True\n assert candidate(nums = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == True\n assert candidate(nums = [1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020]) == True\n assert candidate(nums = [41, 43, 47, 53, 59, 61]) == True\n assert candidate(nums = [101, 202, 303, 404, 505]) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(nums = [89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191]) == True\n assert candidate(nums = [15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125]) == False\n assert candidate(nums = [1000000007, 2, 3, 5, 7]) == True\n assert candidate(nums = [13, 17, 19, 23, 29, 31, 37, 41, 43, 47]) == True\n assert candidate(nums = [333333333, 666666667, 333333333, 666666667, 333333333, 666666667, 333333333, 666666667, 333333333, 666666667]) == True\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]) == True\n assert candidate(nums = [97, 1, 101, 1, 103, 1, 107, 1, 109, 1]) == True\n assert candidate(nums = [5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59]) == True\n assert candidate(nums = [71, 113, 151, 199, 239, 283, 317, 359, 401, 443]) == True\n assert candidate(nums = [1000000007, 1000000009, 1000000021, 1000000033]) == True\n assert candidate(nums = [17, 31, 41, 43, 59, 61]) == True\n assert candidate(nums = [101, 103, 107, 109, 113]) == True\n assert candidate(nums = [1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 10000000]) == False\n assert candidate(nums = [15, 21, 25, 35, 45]) == True\n assert candidate(nums = [100, 101, 102, 103, 104]) == True\n assert candidate(nums = [3, 5, 7, 11, 13, 17]) == True\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().isGoodArray", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isGoodArray = function(nums) {", "container": null, "callable": "isGoodArray", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1252, "task_id": "cells-with-odd-values-in-a-matrix", "difficulty": "Easy", "problem_description": "There is an m x n matrix that is initialized to all 0's. There is also a 2D array indices where each indices[i] = [ri, ci] represents a 0-indexed location to perform some increment operations on the matrix.\nFor each location indices[i], do both of the following:\n\nIncrement all the cells on row ri.\nIncrement all the cells on column ci.\n\nGiven m, n, and indices, return the number of odd-valued cells in the matrix after applying the increment to all locations in indices.\n \nExample 1:\n\n\nInput: m = 2, n = 3, indices = [[0,1],[1,1]]\nOutput: 6\nExplanation: Initial matrix = [[0,0,0],[0,0,0]].\nAfter applying first increment it becomes [[1,2,1],[0,1,0]].\nThe final matrix is [[1,3,1],[1,3,1]], which contains 6 odd numbers.\n\nExample 2:\n\n\nInput: m = 2, n = 2, indices = [[1,1],[0,0]]\nOutput: 0\nExplanation: Final matrix = [[2,2],[2,2]]. There are no odd numbers in the final matrix.\n\n \nConstraints:\n\n1 <= m, n <= 50\n1 <= indices.length <= 100\n0 <= ri < m\n0 <= ci < n\n\n \nFollow up: Could you solve this in O(n + m + indices.length) time with only O(n + m) extra space?\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(m = 2,n = 3,indices = [[0, 1], [1, 1]]) == 6\n assert candidate(m = 50,n = 50,indices = [[0, 0], [1, 1], [2, 2], [3, 3]]) == 368\n assert candidate(m = 4,n = 5,indices = [[0, 1], [0, 1], [1, 2], [2, 3], [3, 4]]) == 9\n assert candidate(m = 1,n = 1,indices = [[0, 0]]) == 0\n assert candidate(m = 5,n = 4,indices = [[0, 0], [0, 0], [0, 0]]) == 7\n assert candidate(m = 4,n = 5,indices = [[0, 1], [2, 3], [1, 4]]) == 9\n assert candidate(m = 3,n = 4,indices = [[0, 0], [1, 2], [2, 3]]) == 3\n assert candidate(m = 5,n = 5,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == 0\n assert candidate(m = 3,n = 4,indices = [[0, 1], [1, 2], [2, 3]]) == 3\n assert candidate(m = 3,n = 3,indices = [[0, 0], [1, 1], [2, 2]]) == 0\n assert candidate(m = 3,n = 4,indices = [[0, 0], [1, 1], [2, 2], [0, 3]]) == 4\n assert candidate(m = 2,n = 2,indices = [[1, 1], [0, 0]]) == 0\n assert candidate(m = 5,n = 5,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4]]) == 20\n assert candidate(m = 4,n = 5,indices = [[0, 1], [1, 2], [2, 3], [3, 4]]) == 4\n assert candidate(m = 5,n = 5,indices = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 0]]) == 0\n assert candidate(m = 3,n = 3,indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) == 0\n assert candidate(m = 8,n = 8,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [0, 7], [7, 0], [0, 3], [3, 0]]) == 24\n assert candidate(m = 7,n = 3,indices = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [0, 2], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2]]) == 0\n assert candidate(m = 10,n = 10,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 0\n assert candidate(m = 4,n = 5,indices = [[0, 1], [0, 2], [2, 3], [3, 4], [1, 0]]) == 5\n assert candidate(m = 10,n = 1,indices = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0]]) == 10\n assert candidate(m = 10,n = 10,indices = [[5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == 0\n assert candidate(m = 5,n = 5,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == 0\n assert candidate(m = 5,n = 3,indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2]]) == 0\n assert candidate(m = 4,n = 6,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [0, 5], [1, 4], [2, 3], [3, 2], [0, 1], [1, 0]]) == 12\n assert candidate(m = 8,n = 4,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3], [4, 0], [4, 1], [4, 2], [4, 3], [5, 0], [5, 1], [5, 2], [5, 3], [6, 0], [6, 1], [6, 2], [6, 3], [7, 0], [7, 1], [7, 2], [7, 3]]) == 0\n assert candidate(m = 5,n = 5,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 4], [4, 0]]) == 12\n assert candidate(m = 5,n = 1,indices = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]) == 0\n assert candidate(m = 6,n = 6,indices = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0], [0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0]]) == 0\n assert candidate(m = 5,n = 5,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 1], [1, 2], [2, 3], [3, 4], [4, 0]]) == 0\n assert candidate(m = 7,n = 2,indices = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1]]) == 14\n assert candidate(m = 10,n = 10,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [5, 9], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6], [6, 7], [6, 8], [6, 9], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6], [7, 7], [7, 8], [7, 9], [8, 0], [8, 1], [8, 2], [8, 3], [8, 4], [8, 5], [8, 6], [8, 7], [8, 8], [8, 9], [9, 0], [9, 1], [9, 2], [9, 3], [9, 4], [9, 5], [9, 6], [9, 7], [9, 8], [9, 9]]) == 0\n assert candidate(m = 10,n = 10,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 9], [1, 8], [2, 7], [3, 6], [4, 5], [5, 4], [6, 3], [7, 2], [8, 1], [9, 0]]) == 0\n assert candidate(m = 5,n = 4,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [0, 3], [1, 2], [2, 1], [3, 0], [0, 2], [1, 3], [2, 0], [3, 1]]) == 4\n assert candidate(m = 1,n = 5,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4]]) == 0\n assert candidate(m = 10,n = 10,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 9], [9, 0]]) == 32\n assert candidate(m = 7,n = 3,indices = [[0, 0], [1, 1], [2, 2], [0, 2], [1, 0], [2, 1]]) == 0\n assert candidate(m = 7,n = 8,indices = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7]]) == 38\n assert candidate(m = 3,n = 7,indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [0, 3], [0, 4], [0, 5], [0, 6]]) == 0\n assert candidate(m = 15,n = 15,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14]]) == 0\n assert candidate(m = 6,n = 6,indices = [[0, 1], [1, 0], [2, 3], [3, 2], [4, 5], [5, 4], [0, 5], [1, 4], [2, 1], [3, 0], [4, 3], [5, 2]]) == 0\n assert candidate(m = 10,n = 5,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4]]) == 35\n assert candidate(m = 4,n = 5,indices = [[0, 0], [0, 0], [0, 0], [1, 1], [1, 1], [2, 2], [2, 2], [3, 3], [3, 3], [0, 4], [1, 3], [2, 2], [3, 1]]) == 5\n assert candidate(m = 9,n = 7,indices = [[0, 0], [0, 1], [0, 2], [1, 3], [1, 4], [1, 5], [2, 6], [3, 0], [4, 1], [5, 2], [6, 3], [7, 4], [8, 5]]) == 54\n assert candidate(m = 5,n = 3,indices = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [0, 2], [1, 2], [2, 2], [3, 2], [4, 2]]) == 0\n assert candidate(m = 4,n = 5,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 0], [2, 0], [3, 0]]) == 4\n assert candidate(m = 10,n = 10,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9]]) == 100\n assert candidate(m = 7,n = 7,indices = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 0], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [6, 0]]) == 0\n assert candidate(m = 5,n = 6,indices = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]]) == 5\n assert candidate(m = 8,n = 8,indices = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0]]) == 0\n assert candidate(m = 2,n = 7,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6]]) == 14\n assert candidate(m = 1,n = 10,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9]]) == 10\n assert candidate(m = 4,n = 3,indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2]]) == 12\n assert candidate(m = 4,n = 4,indices = [[0, 0], [0, 0], [1, 1], [1, 1], [2, 2], [2, 2], [3, 3], [3, 3]]) == 0\n assert candidate(m = 3,n = 5,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4]]) == 0\n assert candidate(m = 6,n = 4,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3]]) == 24\n assert candidate(m = 50,n = 50,indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [2, 0]]) == 192\n assert candidate(m = 6,n = 7,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [0, 0]]) == 11\n assert candidate(m = 30,n = 20,indices = [[0, 0], [0, 1], [0, 2], [1, 3], [1, 4], [1, 5], [2, 6], [2, 7], [2, 8], [3, 9], [3, 10], [3, 11], [4, 12], [4, 13], [4, 14], [5, 15], [5, 16], [5, 17], [6, 18], [6, 19]]) == 480\n assert candidate(m = 4,n = 6,indices = [[0, 0], [0, 1], [1, 1], [1, 2], [2, 2], [3, 3], [0, 3], [1, 4], [2, 5]]) == 12\n assert candidate(m = 6,n = 6,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [0, 5], [5, 0], [0, 4], [4, 0], [0, 3], [3, 0], [0, 2], [2, 0], [0, 1], [1, 0]]) == 0\n assert candidate(m = 10,n = 10,indices = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0]]) == 0\n assert candidate(m = 7,n = 8,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1]]) == 14\n assert candidate(m = 3,n = 3,indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [0, 0], [1, 1], [2, 2]]) == 0\n assert candidate(m = 4,n = 6,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5]]) == 0\n assert candidate(m = 8,n = 5,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 0], [6, 1], [7, 2]]) == 24\n assert candidate(m = 7,n = 7,indices = [[0, 1], [0, 3], [1, 0], [1, 2], [1, 4], [1, 6], [2, 1], [2, 3], [2, 5], [3, 0], [3, 2], [3, 4], [3, 6], [4, 1], [4, 3], [4, 5], [5, 0], [5, 2], [5, 4], [5, 6], [6, 1], [6, 3], [6, 5]]) == 26\n assert candidate(m = 3,n = 3,indices = [[0, 0], [1, 1], [2, 2], [0, 1], [1, 2], [2, 0]]) == 0\n assert candidate(m = 4,n = 6,indices = [[0, 1], [0, 1], [0, 1], [3, 5], [3, 5]]) == 8\n assert candidate(m = 6,n = 5,indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4]]) == 30\n assert candidate(m = 5,n = 6,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 5], [1, 4], [2, 3], [3, 2], [4, 1]]) == 10\n assert candidate(m = 6,n = 4,indices = [[0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [0, 0], [0, 2], [0, 3]]) == 8\n assert candidate(m = 3,n = 3,indices = [[0, 0], [0, 0], [1, 1], [1, 1], [2, 2], [2, 2]]) == 0\n assert candidate(m = 6,n = 6,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [0, 5], [5, 0], [3, 2], [2, 3]]) == 16\n assert candidate(m = 8,n = 8,indices = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [0, 7], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1], [7, 0]]) == 0\n"}, "metadata": {"canonical_parameter_names": ["m", "n", "indices"], "leetcode_dataset_entry_point": "Solution().oddCells", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var oddCells = function(m, n, indices) {", "container": null, "callable": "oddCells", "parameters": [{"name": "m", "type": "number"}, {"name": "n", "type": "number"}, {"name": "indices", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1253, "task_id": "reconstruct-a-2-row-binary-matrix", "difficulty": "Medium", "problem_description": "Given the following details of a matrix with n columns and 2 rows :\n\nThe matrix is a binary matrix, which means each element in the matrix can be 0 or 1.\nThe sum of elements of the 0-th(upper) row is given as upper.\nThe sum of elements of the 1-st(lower) row is given as lower.\nThe sum of elements in the i-th column(0-indexed) is colsum[i], where colsum is given as an integer array with length n.\n\nYour task is to reconstruct the matrix with upper, lower and colsum.\nReturn it as a 2-D integer array.\nIf there are more than one valid solution, any of them will be accepted.\nIf no valid solution exists, return an empty 2-D array.\n \nExample 1:\n\nInput: upper = 2, lower = 1, colsum = [1,1,1]\nOutput: [[1,1,0],[0,0,1]]\nExplanation: [[1,0,1],[0,1,0]], and [[0,1,1],[1,0,0]] are also correct answers.\n\nExample 2:\n\nInput: upper = 2, lower = 3, colsum = [2,2,1,1]\nOutput: []\n\nExample 3:\n\nInput: upper = 5, lower = 5, colsum = [2,1,2,0,1,0,1,2,0,1]\nOutput: [[1,1,1,0,1,0,0,1,0,0],[1,0,1,0,0,0,1,1,0,1]]\n\n \nConstraints:\n\n1 <= colsum.length <= 10^5\n0 <= upper, lower <= colsum.length\n0 <= colsum[i] <= 2\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(upper = 2,lower = 3,colsum = [2, 2, 1, 1]) == []\n assert candidate(upper = 1,lower = 1,colsum = [1, 0, 1]) == [[0, 0, 1], [1, 0, 0]]\n assert candidate(upper = 4,lower = 2,colsum = [2, 1, 1, 0, 0]) == []\n assert candidate(upper = 3,lower = 3,colsum = [2, 0, 2, 0, 2]) == [[1, 0, 1, 0, 1], [1, 0, 1, 0, 1]]\n assert candidate(upper = 0,lower = 0,colsum = [0, 0, 0, 0]) == [[0, 0, 0, 0], [0, 0, 0, 0]]\n assert candidate(upper = 5,lower = 5,colsum = [2, 1, 2, 0, 1, 0, 1, 2, 0, 1]) == [[1, 0, 1, 0, 1, 0, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 1, 1, 0, 0]]\n assert candidate(upper = 2,lower = 1,colsum = [1, 1, 1]) == [[1, 0, 1], [0, 1, 0]]\n assert candidate(upper = 10,lower = 10,colsum = [2, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == []\n assert candidate(upper = 0,lower = 0,colsum = [0, 0, 0, 0, 0]) == [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]\n assert candidate(upper = 5,lower = 5,colsum = [2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == []\n assert candidate(upper = 15,lower = 5,colsum = [2, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == []\n assert candidate(upper = 3,lower = 2,colsum = [2, 1, 1, 0, 1]) == [[1, 1, 0, 0, 1], [1, 0, 1, 0, 0]]\n assert candidate(upper = 3,lower = 3,colsum = [1, 1, 1, 1, 1, 1]) == [[0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]\n assert candidate(upper = 6,lower = 4,colsum = [2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == []\n assert candidate(upper = 5,lower = 5,colsum = [2, 1, 1, 0, 0, 0, 1, 1, 1, 1]) == []\n assert candidate(upper = 6,lower = 4,colsum = [2, 2, 1, 1, 0, 0, 1]) == []\n assert candidate(upper = 10,lower = 6,colsum = [2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0]) == []\n assert candidate(upper = 7,lower = 5,colsum = [1, 2, 1, 2, 1, 1, 1]) == []\n assert candidate(upper = 5,lower = 5,colsum = [2, 1, 2, 0, 1, 0, 1, 2, 0, 1]) == [[1, 0, 1, 0, 1, 0, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 1, 1, 0, 0]]\n assert candidate(upper = 5,lower = 5,colsum = [0, 1, 2, 0, 0, 1, 2, 1, 0]) == []\n assert candidate(upper = 8,lower = 2,colsum = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == []\n assert candidate(upper = 3,lower = 1,colsum = [1, 2, 1, 1, 0]) == []\n assert candidate(upper = 3,lower = 2,colsum = [1, 1, 1, 1, 0]) == []\n assert candidate(upper = 1,lower = 1,colsum = [2]) == [[1], [1]]\n assert candidate(upper = 3,lower = 6,colsum = [2, 2, 1, 1, 1, 2, 1]) == []\n assert candidate(upper = 5,lower = 5,colsum = [2, 1, 0, 1, 0, 2, 1, 0]) == []\n assert candidate(upper = 2,lower = 2,colsum = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == []\n assert candidate(upper = 1,lower = 2,colsum = [1, 1, 0, 0, 1]) == [[0, 0, 0, 0, 1], [1, 1, 0, 0, 0]]\n assert candidate(upper = 4,lower = 4,colsum = [2, 0, 1, 1, 2, 1, 1, 0]) == [[1, 0, 0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 1, 1, 0, 0]]\n assert candidate(upper = 1,lower = 1,colsum = [2, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]\n assert candidate(upper = 2,lower = 2,colsum = [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]) == [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]\n assert candidate(upper = 3,lower = 3,colsum = [2, 0, 1, 1, 2]) == [[1, 0, 0, 1, 1], [1, 0, 1, 0, 1]]\n assert candidate(upper = 5,lower = 5,colsum = [1, 2, 0, 2, 1, 0, 1]) == []\n assert candidate(upper = 8,lower = 8,colsum = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == []\n assert candidate(upper = 4,lower = 4,colsum = [2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0]) == []\n assert candidate(upper = 6,lower = 6,colsum = [2, 1, 0, 2, 1, 0, 1, 1, 0, 0, 2, 1]) == []\n assert candidate(upper = 7,lower = 3,colsum = [1, 0, 1, 2, 1, 0, 1, 1, 0]) == []\n assert candidate(upper = 3,lower = 3,colsum = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == []\n assert candidate(upper = 3,lower = 2,colsum = [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == []\n assert candidate(upper = 5,lower = 5,colsum = [0, 1, 2, 1, 1, 0, 2, 0]) == []\n assert candidate(upper = 3,lower = 4,colsum = [1, 2, 1, 1, 0, 1]) == []\n assert candidate(upper = 6,lower = 4,colsum = [2, 1, 1, 1, 1, 2, 0, 1, 1, 0]) == [[1, 1, 1, 0, 1, 1, 0, 0, 1, 0], [1, 0, 0, 1, 0, 1, 0, 1, 0, 0]]\n assert candidate(upper = 7,lower = 3,colsum = [1, 2, 1, 1, 1, 0, 0, 2]) == []\n assert candidate(upper = 10,lower = 10,colsum = [2, 2, 2, 2, 2, 0, 0, 0, 0, 0]) == []\n assert candidate(upper = 5,lower = 3,colsum = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == []\n assert candidate(upper = 5,lower = 5,colsum = [0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0]) == []\n assert candidate(upper = 9,lower = 9,colsum = [2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2]) == []\n assert candidate(upper = 8,lower = 6,colsum = [2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]) == []\n assert candidate(upper = 8,lower = 7,colsum = [2, 2, 2, 0, 1, 1, 0, 1]) == []\n assert candidate(upper = 10,lower = 10,colsum = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 2, 2]) == []\n assert candidate(upper = 5,lower = 4,colsum = [2, 1, 1, 1, 0, 1]) == []\n assert candidate(upper = 8,lower = 4,colsum = [2, 2, 2, 2, 0, 0, 0, 0]) == []\n assert candidate(upper = 4,lower = 5,colsum = [1, 1, 1, 1, 2, 1, 0, 1]) == []\n assert candidate(upper = 5,lower = 3,colsum = [1, 1, 1, 2, 1, 2, 0, 0]) == [[1, 1, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0]]\n assert candidate(upper = 10,lower = 5,colsum = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]) == []\n assert candidate(upper = 7,lower = 3,colsum = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [[1, 1, 1, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 0, 1, 0]]\n assert candidate(upper = 3,lower = 3,colsum = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == [[0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]]\n assert candidate(upper = 10,lower = 10,colsum = [2, 2, 2, 2, 1, 1, 1, 1, 1, 1]) == []\n assert candidate(upper = 8,lower = 8,colsum = [1, 2, 2, 1, 2, 1, 1, 2]) == []\n assert candidate(upper = 1,lower = 1,colsum = [0, 0, 0, 0, 0, 2]) == [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1]]\n assert candidate(upper = 0,lower = 0,colsum = [0, 0, 0, 0, 0]) == [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]\n assert candidate(upper = 3,lower = 4,colsum = [2, 1, 2, 0, 1]) == []\n assert candidate(upper = 10,lower = 10,colsum = [2, 1, 2, 1, 0, 0, 0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 0, 1, 1, 0]) == []\n assert candidate(upper = 7,lower = 3,colsum = [1, 2, 1, 1, 0, 2, 1, 0]) == []\n assert candidate(upper = 7,lower = 8,colsum = [2, 2, 1, 1, 1, 1, 1, 1, 1, 1]) == []\n assert candidate(upper = 7,lower = 5,colsum = [1, 2, 2, 1, 1, 0, 0, 0, 1, 1]) == []\n assert candidate(upper = 3,lower = 3,colsum = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == []\n assert candidate(upper = 5,lower = 5,colsum = [2, 0, 2, 0, 1, 1]) == []\n assert candidate(upper = 7,lower = 3,colsum = [2, 1, 2, 1, 0, 0, 0, 1, 1, 0, 0, 1]) == []\n assert candidate(upper = 10,lower = 5,colsum = [2, 2, 2, 1, 1, 1, 1, 1, 1, 0]) == []\n assert candidate(upper = 6,lower = 6,colsum = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == []\n assert candidate(upper = 4,lower = 4,colsum = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == []\n"}, "metadata": {"canonical_parameter_names": ["upper", "lower", "colsum"], "leetcode_dataset_entry_point": "Solution().reconstructMatrix", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var reconstructMatrix = function(upper, lower, colsum) {", "container": null, "callable": "reconstructMatrix", "parameters": [{"name": "upper", "type": "number"}, {"name": "lower", "type": "number"}, {"name": "colsum", "type": "number[]"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1254, "task_id": "number-of-closed-islands", "difficulty": "Medium", "problem_description": "Given a 2D grid consists of 0s (land) and 1s (water).  An island is a maximal 4-directionally connected group of 0s and a closed island is an island totally (all left, top, right, bottom) surrounded by 1s.\nReturn the number of closed islands.\n \nExample 1:\n\n\nInput: grid = [[1,1,1,1,1,1,1,0],[1,0,0,0,0,1,1,0],[1,0,1,0,1,1,1,0],[1,0,0,0,0,1,0,1],[1,1,1,1,1,1,1,0]]\nOutput: 2\nExplanation: \nIslands in gray are closed because they are completely surrounded by water (group of 1s).\nExample 2:\n\n\nInput: grid = [[0,0,1,0,0],[0,1,0,1,0],[0,1,1,1,0]]\nOutput: 1\n\nExample 3:\n\nInput: grid = [[1,1,1,1,1,1,1],\n  [1,0,0,0,0,0,1],\n  [1,0,1,1,1,0,1],\n  [1,0,1,0,1,0,1],\n  [1,0,1,1,1,0,1],\n  [1,0,0,0,0,0,1],\n [1,1,1,1,1,1,1]]\nOutput: 2\n\n \nConstraints:\n\n1 <= grid.length, grid[0].length <= 100\n0 <= grid[i][j] <=1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0]]) == 1\n assert candidate(grid = [[1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 0, 1, 1]]) == 0\n assert candidate(grid = [[0, 0, 0, 0], [0, 1, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 1, 1, 0], [1, 0, 1, 0, 1, 1, 1, 0], [1, 0, 0, 0, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 0]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 6\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 3\n assert candidate(grid = [[1, 0, 1, 1, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 1, 1, 1, 1, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 1, 0, 0, 0, 1, 1], [1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 1, 0, 0, 0, 1, 1], [0, 0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 1, 1, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 1, 0, 0, 1], [1, 0, 1, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 1, 0, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1, 1]]) == 3\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 0, 1, 1, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 1, 1, 1, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 1, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 0, 1], [1, 0, 0, 0, 1, 0, 0, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 3\n assert candidate(grid = [[1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 1, 0, 0, 1, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 0, 0, 0, 0, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1], [1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1], [1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 3\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 1, 1, 1, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 0, 0, 1, 0, 1, 0], [1, 0, 1, 1, 1, 1, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 1, 0, 1, 0]]) == 1\n assert candidate(grid = [[1, 1, 1, 0, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 1, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 3\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 3\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 1, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 0, 1], [1, 0, 0, 0, 1, 0, 0, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 3\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 1, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 14\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 1, 0, 1, 0, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 7\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1, 1, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 0, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 4\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 31\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 5\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 0, 1], [1, 0, 0, 0, 1, 0, 0, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 4\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().closedIsland", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var closedIsland = function(grid) {", "container": null, "callable": "closedIsland", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1255, "task_id": "maximum-score-words-formed-by-letters", "difficulty": "Hard", "problem_description": "Given a list of words, list of  single letters (might be repeating) and score of every character.\nReturn the maximum score of any valid set of words formed by using the given letters (words[i] cannot be used two or more times).\nIt is not necessary to use all characters in letters and each letter can only be used once. Score of letters 'a', 'b', 'c', ... ,'z' is given by score[0], score[1], ... , score[25] respectively.\n \nExample 1:\n\nInput: words = [\"dog\",\"cat\",\"dad\",\"good\"], letters = [\"a\",\"a\",\"c\",\"d\",\"d\",\"d\",\"g\",\"o\",\"o\"], score = [1,0,9,5,0,0,3,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0]\nOutput: 23\nExplanation:\nScore a=1, c=9, d=5, g=3, o=2\nGiven letters, we can form the words \"dad\" (5+1+5) and \"good\" (3+2+2+5) with a score of 23.\nWords \"dad\" and \"dog\" only get a score of 21.\nExample 2:\n\nInput: words = [\"xxxz\",\"ax\",\"bx\",\"cx\"], letters = [\"z\",\"a\",\"b\",\"c\",\"x\",\"x\",\"x\"], score = [4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,10]\nOutput: 27\nExplanation:\nScore a=4, b=4, c=4, x=5, z=10\nGiven letters, we can form the words \"ax\" (4+5), \"bx\" (4+5) and \"cx\" (4+5) with a score of 27.\nWord \"xxxz\" only get a score of 25.\nExample 3:\n\nInput: words = [\"leetcode\"], letters = [\"l\",\"e\",\"t\",\"c\",\"o\",\"d\"], score = [0,0,1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0]\nOutput: 0\nExplanation:\nLetter \"e\" can only be used once.\n \nConstraints:\n\n1 <= words.length <= 14\n1 <= words[i].length <= 15\n1 <= letters.length <= 100\nletters[i].length == 1\nscore.length == 26\n0 <= score[i] <= 10\nwords[i], letters[i] contains only lower case English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(words = ['xxxz', 'ax', 'bx', 'cx'],letters = ['z', 'a', 'b', 'c', 'x', 'x', 'x'],score = [4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 10]) == 27\n assert candidate(words = ['leetcode'],letters = ['l', 'e', 't', 'c', 'o', 'd'],score = [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(words = ['dog', 'cat', 'dad', 'good'],letters = ['a', 'a', 'c', 'd', 'd', 'd', 'g', 'o', 'o'],score = [1, 0, 9, 5, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 23\n assert candidate(words = ['supercalifragilisticexpialidocious', 'antidisestablishmentarianism', 'floccinaucinihilipilification'],letters = ['s', 'u', 'p', 'e', 'r', 'c', 'a', 'l', 'i', 'f', 'r', 'a', 'g', 'i', 'l', 'i', 's', 't', 'i', 'c', 'e', 'x', 'p', 'i', 'a', 'l', 'i', 'd', 'o', 'c', 'i', 'o', 'u', 's', 'a', 'n', 't', 'i', 'd', 'i', 's', 'e', 't', 'a', 'b', 'l', 'i', 's', 'h', 'm', 'e', 'n', 't', 'a', 'r', 'i', 'a', 'n', 'i', 's', 'm', 'f', 'l', 'o', 'c', 'c', 'i', 'n', 'a', 'u', 'c', 'i', 'n', 'i', 'h', 'i', 'l', 'i', 'p', 'i', 'l', 'i', 'f', 'i', 'c', 'a', 't', 'i', 'o', 'n'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 659\n assert candidate(words = ['dynamic', 'programming', 'complexity', 'analysis'],letters = ['d', 'y', 'n', 'a', 'm', 'i', 'c', 'p', 'r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g', 'c', 'o', 'm', 'p', 'l', 'e', 'x', 'i', 't', 'y', 'a', 'n', 'a', 'l', 'y', 's', 'i', 's'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 184\n assert candidate(words = ['quartz', 'pearl', 'opal'],letters = ['q', 'u', 'a', 'r', 't', 'z', 'p', 'e', 'a', 'r', 'l', 'o', 'p', 'a', 'l'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 10]) == 38\n assert candidate(words = ['programming', 'code', 'python', 'challenge'],letters = ['a', 'c', 'd', 'e', 'e', 'g', 'h', 'i', 'l', 'l', 'm', 'n', 'n', 'n', 'o', 'o', 'p', 'p', 'r', 'r', 'r', 's', 't', 'u', 'y', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 24\n assert candidate(words = ['university', 'college', 'school'],letters = ['u', 'n', 'i', 'v', 'e', 'r', 's', 'i', 't', 'y', 'c', 'o', 'l', 'l', 'e', 'g', 'e', 's', 'c', 'h', 'o', 'o', 'l'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 10]) == 38\n assert candidate(words = ['complex', 'example', 'test'],letters = ['c', 'o', 'm', 'p', 'l', 'e', 'x', 'e', 'a', 'm', 'p', 'l', 'e', 't', 'e', 's', 't', 'c', 'o', 'm', 'p', 'l', 'e', 'x'],score = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260]) == 2280\n assert candidate(words = ['zebra', 'elephant', 'giraffe', 'hippo'],letters = ['a', 'e', 'e', 'f', 'g', 'h', 'i', 'i', 'l', 'n', 'o', 'p', 'p', 'r', 'r', 's', 't', 'u', 'z', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 13\n assert candidate(words = ['kangaroo', 'koala', 'hippopotamus'],letters = ['k', 'a', 'n', 'g', 'a', 'r', 'o', 'o', 'o', 'o', 'l', 'i', 'p', 'p', 'o', 't', 'a', 'm', 'u', 's'],score = [8, 1, 13, 3, 1, 1, 1, 1, 1, 1, 4, 1, 5, 9, 7, 6, 5, 3, 0, 9, 0, 5, 5, 0, 0, 0]) == 47\n assert candidate(words = ['optimization', 'performance', 'scalability', 'expert', 'knowledge', 'skill'],letters = ['o', 'p', 't', 'i', 'm', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'p', 'e', 'r', 'f', 'o', 'r', 'm', 'a', 'n', 'c', 'e', 's', 'c', 'a', 'l', 'a', 'b', 'i', 'l', 'i', 't', 'y', 'e', 'x', 'p', 'e', 'r', 't', 'k', 'n', 'o', 'w', 'l', 'e', 'd', 'g', 'e', 's', 'k', 'i', 'l', 'l'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 4, 8, 8, 10]) == 118\n assert candidate(words = ['onomatopoeia', 'palindrome', 'multifarious'],letters = ['o', 'n', 'o', 'm', 'a', 't', 'o', 'p', 'o', 'e', 'i', 'a', 'p', 'a', 'l', 'i', 'n', 'd', 'r', 'o', 'm', 'e', 'm', 'u', 'l', 't', 'i', 'f', 'a', 'r', 'i', 'o', 'u', 's'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 10]) == 56\n assert candidate(words = ['abcd', 'abcde', 'abcdef', 'abcdefg'],letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'c', 'd', 'e', 'f', 'g'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 74\n assert candidate(words = ['optimization', 'performance', 'efficiency'],letters = ['o', 'p', 't', 'i', 'm', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'p', 'e', 'r', 'f', 'o', 'r', 'm', 'a', 'n', 'c', 'e', 'e', 'f', 'f', 'i', 'c', 'i', 'e', 'n', 'c', 'y'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 2]) == 66\n assert candidate(words = ['mississippi', 'alabama', 'tennessee'],letters = ['m', 'i', 's', 's', 'i', 's', 's', 'i', 'p', 'p', 'i', 'a', 'l', 'a', 'b', 'a', 'm', 'a', 't', 'e', 'n', 'n', 'e', 's', 's', 'e'],score = [3, 1, 9, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3, 8, 5, 5, 0, 2, 3, 9]) == 88\n assert candidate(words = ['zzzz', 'zzz', 'zz', 'z'],letters = ['z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 260\n assert candidate(words = ['algorithm', 'datastructure', 'machinelearning'],letters = ['a', 'l', 'g', 'o', 'r', 'i', 't', 'h', 'm', 'd', 'a', 't', 'a', 's', 't', 'r', 'u', 'c', 't', 'u', 'r', 'e', 'm', 'a', 'c', 'h', 'i', 'n', 'e', 'l', 'e', 'a', 'r', 'n', 'i', 'n', 'g'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 2]) == 65\n assert candidate(words = ['amazing', 'zebra', 'apple'],letters = ['a', 'm', 'a', 'z', 'i', 'n', 'g', 'z', 'e', 'b', 'r', 'a', 'a', 'p', 'p', 'l'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 10]) == 38\n assert candidate(words = ['algorithm', 'data', 'structure'],letters = ['a', 'l', 'g', 'o', 'r', 'i', 't', 'h', 'm', 'd', 'a', 't', 'a', 's', 't', 'r', 'u', 'c', 't', 'u', 'r', 'e'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 274\n assert candidate(words = ['syzygy', 'zygote', 'zygomycete'],letters = ['s', 'y', 'z', 'y', 'g', 'y', 'z', 'y', 'g', 'o', 't', 'e', 'z', 'y', 'g', 'o', 'm', 'y', 'c', 'e', 't', 'e'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 10]) == 56\n assert candidate(words = ['zebra', 'monkey', 'giraffe'],letters = ['z', 'e', 'r', 'b', 'a', 'o', 'n', 'k', 'm', 'y', 'g', 'i', 'r', 'a', 'f', 'f', 'e'],score = [1, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0]) == 12\n assert candidate(words = ['algorithm', 'data', 'structure', 'software'],letters = ['a', 'a', 'a', 'c', 'd', 'd', 'e', 'g', 'h', 'i', 'i', 'l', 'm', 'n', 'o', 'o', 'o', 'r', 's', 's', 's', 't', 'u', 'w', 'y'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 15\n assert candidate(words = ['algorithm', 'data', 'structure', 'code'],letters = ['a', 'l', 'g', 'o', 'r', 'i', 't', 'h', 'm', 'd', 'a', 't', 'a', 's', 't', 'r', 'u', 'c', 't', 'u', 'r', 'e', 'c', 'o', 'd', 'e'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 301\n assert candidate(words = ['abacaxi', 'kiwi', 'pineapple'],letters = ['a', 'b', 'a', 'c', 'a', 'x', 'i', 'k', 'i', 'w', 'i', 'p', 'i', 'n', 'e', 'a', 'p', 'p', 'l', 'e'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 10]) == 41\n assert candidate(words = ['kitten', 'puppy', 'dog', 'cat'],letters = ['a', 'c', 'd', 'd', 'd', 'g', 'k', 'n', 'o', 'p', 'p', 'p', 'p', 'p', 't', 'u', 'y', 'y'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 24\n assert candidate(words = ['hello', 'world', 'python', 'java'],letters = ['h', 'e', 'l', 'l', 'o', 'w', 'r', 'd', 'p', 'y', 't', 'h', 'o', 'n', 'j', 'a', 'v'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 26\n assert candidate(words = ['algorithm', 'data', 'structure'],letters = ['a', 'l', 'g', 'o', 'r', 'i', 't', 'h', 'm', 'd', 'a', 't', 'a', 's', 't', 'r', 'u', 'c', 't', 'u', 'r', 'e'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 4, 8, 8, 10]) == 33\n assert candidate(words = ['apple', 'banana', 'cherry', 'date'],letters = ['a', 'a', 'b', 'b', 'c', 'd', 'e', 'e', 'e', 'h', 'i', 'l', 'n', 'n', 'p', 'r', 't', 'u'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 5\n assert candidate(words = ['zebra', 'elephant', 'giraffe'],letters = ['z', 'e', 'b', 'r', 'a', 'e', 'l', 'p', 'h', 'a', 'n', 't', 'g', 'i', 'r', 'a', 'f', 'f', 'e'],score = [5, 1, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 36\n assert candidate(words = ['xylophone', 'guitar', 'piano', 'drums'],letters = ['a', 'd', 'e', 'g', 'h', 'i', 'l', 'm', 'n', 'n', 'n', 'o', 'o', 'p', 'p', 'r', 's', 't', 'u', 'u', 'x', 'y', 'y', 'y', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 32\n assert candidate(words = ['complexity', 'theory', 'graph', 'tree'],letters = ['a', 'b', 'c', 'c', 'd', 'd', 'e', 'e', 'f', 'g', 'g', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'n', 'n', 'o', 'o', 'o', 'o', 'p', 'q', 'r', 'r', 's', 's', 't', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 5]) == 19\n assert candidate(words = ['hello', 'world', 'python', 'code'],letters = ['h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd', 'p', 'y', 't', 'h', 'o', 'n', 'c', 'o', 'd', 'e'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 249\n assert candidate(words = ['expert', 'knowledge', 'skill'],letters = ['e', 'x', 'p', 'e', 'r', 't', 'k', 'n', 'o', 'w', 'l', 'e', 'd', 'g', 'e', 's', 'k', 'i', 'l', 'l'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 4, 8, 8, 10]) == 45\n assert candidate(words = ['apple', 'banana', 'cherry'],letters = ['a', 'a', 'b', 'b', 'c', 'c', 'e', 'e', 'h', 'n', 'n', 'p', 'p', 'r', 'r', 'y'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 5, 9, 7]) == 17\n assert candidate(words = ['programming', 'contest', 'challenge'],letters = ['p', 'r', 'o', 'g', 'a', 'm', 'm', 'i', 'n', 'g', 'c', 'o', 'n', 't', 'e', 's', 't', 'c', 'h', 'a', 'l', 'l', 'e', 'n', 'g', 'e'],score = [3, 5, 1, 3, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10, 8, 7, 5, 4, 4, 3, 7, 2, 9, 4]) == 60\n assert candidate(words = ['fantastic', 'extraordinary', 'amazing'],letters = ['f', 'a', 'n', 't', 'a', 's', 't', 'i', 'c', 'e', 'x', 't', 'r', 'o', 'd', 'i', 'n', 'a', 'r', 'y', 'a', 'm', 'a', 'z', 'i', 'n', 'g'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 10]) == 39\n assert candidate(words = ['complex', 'challenging', 'problems', 'solutions'],letters = ['c', 'o', 'm', 'p', 'l', 'e', 'x', 'c', 'h', 'a', 'l', 'l', 'e', 'n', 'g', 'i', 'n', 'g', 'p', 'r', 'o', 'b', 'l', 'e', 'm', 's', 'o', 'l', 'u', 't', 'i', 'o', 'n', 's'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 2]) == 54\n assert candidate(words = ['backtracking', 'heuristic', 'algorithm', 'search'],letters = ['b', 'a', 'c', 'k', 't', 'r', 'a', 'c', 'k', 'i', 'n', 'g', 'h', 'e', 'u', 'r', 'i', 's', 't', 'i', 'c', 'a', 'l', 'g', 'o', 'r', 'i', 't', 'h', 'm', 's', 'e', 'a', 'r', 'c', 'h'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 165\n assert candidate(words = ['fantastic', 'breathtaking', 'transformation', 'unbelievable'],letters = ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'c', 'd', 'd', 'e', 'e', 'e', 'e', 'f', 'g', 'h', 'i', 'i', 'i', 'k', 'l', 'm', 'n', 'n', 'n', 'o', 'o', 'o', 'o', 'p', 'r', 'r', 's', 't', 't', 't', 'u', 'u', 'v', 'w', 'x', 'y', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 25\n assert candidate(words = ['python', 'java', 'csharp', 'javascript'],letters = ['a', 'a', 'a', 'b', 'c', 'c', 'd', 'd', 'e', 'e', 'f', 'g', 'g', 'h', 'i', 'i', 'j', 'j', 'k', 'k', 'l', 'm', 'n', 'n', 'o', 'o', 'p', 'p', 'q', 'q', 'r', 's', 't', 't', 'u', 'u', 'v', 'w', 'x', 'y', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 5]) == 38\n assert candidate(words = ['optimization', 'algorithm', 'data', 'structure'],letters = ['a', 'a', 'a', 'b', 'c', 'c', 'd', 'd', 'e', 'e', 'g', 'h', 'i', 'i', 'l', 'm', 'n', 'o', 'o', 'p', 'p', 'r', 's', 't', 't', 'u', 'v', 'x', 'y', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 5]) == 20\n assert candidate(words = ['zebra', 'xylophone', 'quartz', 'jigsaw'],letters = ['a', 'a', 'e', 'g', 'h', 'i', 'j', 'j', 'k', 'l', 'o', 'o', 'p', 'q', 'r', 's', 't', 'u', 'w', 'x', 'y', 'z', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 41\n assert candidate(words = ['wizard', 'oracle', 'sorcerer'],letters = ['w', 'i', 'z', 'a', 'r', 'd', 'o', 'r', 'a', 'c', 'l', 'e', 's', 'o', 'r', 'c', 'e', 'r', 'e'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 10]) == 27\n assert candidate(words = ['hello', 'world', 'python', 'code'],letters = ['h', 'e', 'l', 'l', 'o', 'w', 'r', 'd', 'p', 'y', 't', 'h', 'o', 'n', 'c', 'o', 'd', 'e'],score = [4, 5, 1, 2, 4, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 190\n assert candidate(words = ['abcdefg', 'hijklmn', 'opqrstu', 'vwxyz'],letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 351\n assert candidate(words = ['greedy', 'algorithm', 'optimization', 'heuristic'],letters = ['g', 'r', 'e', 'e', 'd', 'y', 'a', 'l', 'g', 'o', 'r', 'i', 't', 'h', 'm', 'o', 'p', 't', 'i', 'm', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'h', 'e', 'u', 'r', 'i', 's', 't', 'i', 'c'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 188\n assert candidate(words = ['programming', 'code', 'hackathon', 'python'],letters = ['p', 'r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g', 'c', 'o', 'd', 'e', 'h', 'a', 'c', 'k', 'a', 't', 'h', 'o', 'n', 'p', 'y', 't', 'h', 'o', 'n'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 2]) == 67\n assert candidate(words = ['orange', 'grape', 'apple', 'banana'],letters = ['a', 'a', 'a', 'b', 'e', 'g', 'n', 'n', 'n', 'o', 'p', 'r', 'r', 'r', 's', 't', 'u', 'u', 'u', 'u', 'u'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 8\n assert candidate(words = ['interview', 'question', 'programming', 'challenge'],letters = ['i', 'n', 't', 'e', 'r', 'v', 'i', 'e', 'w', 'q', 'u', 'e', 's', 't', 'i', 'o', 'n', 'p', 'r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g', 'c', 'h', 'a', 'l', 'l', 'e', 'n', 'g', 'e'],score = [1, 2, 3, 4, 5, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5]) == 175\n assert candidate(words = ['abacax', 'banana', 'cherry'],letters = ['a', 'b', 'a', 'c', 'a', 'x', 'b', 'a', 'n', 'a', 'n', 'a', 'c', 'h', 'e', 'r', 'r', 'y', 'a', 'b', 'a', 'c', 'a', 'x'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 142\n assert candidate(words = ['xylophone', 'guitar', 'piano', 'drums'],letters = ['a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'd', 'd', 'd', 'e', 'e', 'e', 'f', 'g', 'g', 'h', 'i', 'i', 'j', 'k', 'l', 'm', 'n', 'n', 'o', 'o', 'p', 'p', 'q', 'r', 'r', 's', 't', 'u', 'u', 'v', 'w', 'x', 'x', 'y', 'y', 'z', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10, 9, 7, 5, 3, 2, 1, 6, 4, 2, 9, 7, 5, 3, 2, 1, 6, 4, 2]) == 39\n assert candidate(words = ['abracadabra', 'alakazam', 'sorcery', 'spellbound'],letters = ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'c', 'd', 'e', 'e', 'e', 'i', 'l', 'l', 'l', 'm', 'o', 'o', 'o', 'p', 'r', 'r', 'r', 's', 's', 't', 'u', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 18\n assert candidate(words = ['supercalifragilisticexpialidocious', 'antidisestablishmentarianism', 'floccinaucinihilipilification'],letters = ['s', 'u', 'p', 'e', 'r', 'c', 'a', 'l', 'i', 'f', 'r', 'a', 'g', 'i', 'l', 'i', 's', 't', 'i', 'c', 'e', 'x', 'p', 'i', 'a', 'l', 'i', 'd', 'o', 'c', 'i', 'o', 'u', 's', 'a', 'n', 't', 'i', 'd', 'i', 's', 'e', 't', 'a', 'b', 'l', 'i', 's', 'h', 'm', 'e', 'n', 't', 'a', 'r', 'i', 'a', 'n', 'i', 's', 'm', 'f', 'l', 'o', 'c', 'c', 'i', 'n', 'a', 'u', 'c', 'i', 'n', 'i', 'h', 'i', 'l', 'i', 'p', 'i', 'l', 'i', 'f', 'i', 'c', 'a', 't', 'i', 'o', 'n'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 10]) == 112\n assert candidate(words = ['abcdefghij', 'klmnopqrstu', 'vwxyz'],letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 2]) == 74\n assert candidate(words = ['abcdefghij', 'jihgfedcba', 'mnopqrstuv'],letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]) == 110\n assert candidate(words = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz'],letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 90\n assert candidate(words = ['apple', 'banana', 'cherry', 'date'],letters = ['a', 'a', 'a', 'b', 'c', 'd', 'e', 'e', 'e', 'e', 'n', 'n', 'r', 't', 'y'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 5]) == 14\n assert candidate(words = ['optimization', 'resource', 'constraint', 'solution'],letters = ['o', 'p', 't', 'i', 'm', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e', 'c', 'o', 'n', 's', 't', 'r', 'a', 'i', 'n', 't', 's', 'o', 'l', 'u', 't', 'i', 'o', 'n'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 169\n assert candidate(words = ['abcdefg', 'hijklmnop', 'qrstuvwxyz'],letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 351\n assert candidate(words = ['quantum', 'computing', 'artificial', 'intelligence'],letters = ['q', 'u', 'a', 'n', 't', 'u', 'm', 'c', 'o', 'm', 'p', 'u', 't', 'i', 'n', 'g', 'a', 'r', 't', 'i', 'f', 'i', 'c', 'i', 'a', 'l', 'i', 'n', 't', 'e', 'l', 'l', 'i', 'g', 'e', 'n', 'c', 'e'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 2]) == 79\n assert candidate(words = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'],letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 136\n assert candidate(words = ['programming', 'challenge', 'solution'],letters = ['p', 'r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g', 'c', 'h', 'a', 'l', 'l', 'e', 'n', 'g', 'e', 's', 'o', 'l', 'u', 't', 'i', 'o', 'n'],score = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 28\n assert candidate(words = ['aabbcc', 'ddeeff', 'gghhii'],letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'],score = [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 18\n assert candidate(words = ['apple', 'banana', 'cherry', 'date'],letters = ['a', 'b', 'c', 'd', 'e', 'e', 'e', 'g', 'h', 'i', 'n', 'n', 'p', 'p', 'r', 't', 'u'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 5\n assert candidate(words = ['apple', 'banana', 'grape', 'orange'],letters = ['a', 'a', 'p', 'l', 'e', 'b', 'a', 'n', 'a', 'n', 'a', 'g', 'r', 'a', 'p', 'e', 'o', 'r', 'a', 'n', 'g', 'e'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 24\n assert candidate(words = ['apple', 'banana', 'cherry'],letters = ['a', 'p', 'p', 'l', 'e', 'b', 'a', 'n', 'a', 'n', 'a', 'c', 'h', 'e', 'r', 'r', 'y'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 2]) == 34\n assert candidate(words = ['xylophone', 'violin', 'guitar'],letters = ['x', 'y', 'l', 'o', 'p', 'h', 'o', 'n', 'e', 'v', 'i', 'o', 'l', 'i', 'n', 'g', 'u', 'i', 't', 'a', 'r'],score = [8, 24, 12, 15, 15, 19, 6, 9, 8, 4, 4, 8, 9, 9, 5, 14, 9, 7, 8, 6, 5, 7, 4, 6, 10, 10]) == 166\n assert candidate(words = ['programming', 'is', 'fun', 'and', 'educational'],letters = ['a', 'a', 'a', 'b', 'c', 'd', 'e', 'e', 'e', 'e', 'f', 'g', 'h', 'i', 'i', 'i', 'j', 'k', 'l', 'm', 'n', 'n', 'n', 'o', 'o', 'p', 'p', 'p', 'p', 'r', 'r', 's', 't', 'u', 'u', 'v', 'w', 'x', 'y', 'z'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 5]) == 30\n assert candidate(words = ['optimization', 'performance', 'scalability'],letters = ['o', 'p', 't', 'i', 'm', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'p', 'e', 'r', 'f', 'o', 'r', 'm', 'a', 'n', 'c', 'e', 's', 'c', 'a', 'l', 'a', 'b', 'i', 'l', 'i', 't', 'y'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 4, 8, 8, 10]) == 73\n assert candidate(words = ['abcd', 'efgh', 'ijkl', 'mnop'],letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 136\n assert candidate(words = ['zebra', 'giraffe', 'hippo'],letters = ['z', 'e', 'b', 'r', 'a', 'g', 'i', 'r', 'a', 'f', 'f', 'e', 'h', 'i', 'p', 'p', 'o'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 2, 4, 2, 4, 1, 2]) == 34\n assert candidate(words = ['apple', 'banana', 'cherry'],letters = ['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'c', 'h', 'e', 'r', 'r', 'y', 'n'],score = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]) == 14\n assert candidate(words = ['abcd', 'dcba', 'bacd', 'cadb'],letters = ['a', 'b', 'c', 'd', 'a', 'b', 'c', 'd', 'a', 'b', 'c', 'd', 'a', 'b', 'c', 'd'],score = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 40\n assert candidate(words = ['programming', 'python', 'java', 'code'],letters = ['p', 'r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g', 'p', 'y', 't', 'h', 'o', 'n', 'j', 'a', 'v', 'a', 'c', 'o', 'd', 'e'],score = [3, 1, 3, 7, 2, 2, 4, 6, 5, 3, 5, 1, 3, 7, 2, 1, 4, 6, 5, 3, 5, 1, 3, 7, 2, 1]) == 89\n assert candidate(words = ['algorithm', 'data', 'structure', 'code'],letters = ['a', 'l', 'g', 'o', 'r', 'i', 't', 'h', 'm', 'd', 'a', 't', 'a', 's', 't', 'r', 'u', 'c', 't', 'u', 'r', 'e', 'c', 'o', 'd', 'e'],score = [1, 3, 2, 2, 1, 2, 3, 5, 1, 1, 1, 1, 2, 1, 1, 1, 2, 4, 2, 4, 1, 6, 2, 5, 3, 5]) == 59\n"}, "metadata": {"canonical_parameter_names": ["words", "letters", "score"], "leetcode_dataset_entry_point": "Solution().maxScoreWords", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxScoreWords = function(words, letters, score) {", "container": null, "callable": "maxScoreWords", "parameters": [{"name": "words", "type": "string[]"}, {"name": "letters", "type": "character[]"}, {"name": "score", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1260, "task_id": "shift-2d-grid", "difficulty": "Easy", "problem_description": "Given a 2D grid of size m x n and an integer k. You need to shift the grid k times.\nIn one shift operation:\n\nElement at grid[i][j] moves to grid[i][j + 1].\nElement at grid[i][n - 1] moves to grid[i + 1][0].\nElement at grid[m - 1][n - 1] moves to grid[0][0].\n\nReturn the 2D grid after applying shift operation k times.\n \nExample 1:\n\n\nInput: grid = [[1,2,3],[4,5,6],[7,8,9]], k = 1\nOutput: [[9,1,2],[3,4,5],[6,7,8]]\n\nExample 2:\n\n\nInput: grid = [[3,8,1,9],[19,7,2,5],[4,6,11,10],[12,0,21,13]], k = 4\nOutput: [[12,0,21,13],[3,8,1,9],[19,7,2,5],[4,6,11,10]]\n\nExample 3:\n\nInput: grid = [[1,2,3],[4,5,6],[7,8,9]], k = 9\nOutput: [[1,2,3],[4,5,6],[7,8,9]]\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m <= 50\n1 <= n <= 50\n-1000 <= grid[i][j] <= 1000\n0 <= k <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[3, 8, 1, 9], [19, 7, 2, 5], [4, 6, 11, 10], [12, 0, 21, 13]],k = 4) == [[12, 0, 21, 13], [3, 8, 1, 9], [19, 7, 2, 5], [4, 6, 11, 10]]\n assert candidate(grid = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]],k = 2) == [[-8, -9, -1], [-2, -3, -4], [-5, -6, -7]]\n assert candidate(grid = [[1000, -1000], [1000, -1000]],k = 1) == [[-1000, 1000], [-1000, 1000]]\n assert candidate(grid = [[1]],k = 0) == [[1]]\n assert candidate(grid = [[1]],k = 100) == [[1]]\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],k = 9) == [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n assert candidate(grid = [[1, 2], [3, 4]],k = 50) == [[3, 4], [1, 2]]\n assert candidate(grid = [[1, 2], [3, 4]],k = 2) == [[3, 4], [1, 2]]\n assert candidate(grid = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]],k = 15) == [[-4, -5, -6], [-7, -8, -9], [-1, -2, -3]]\n assert candidate(grid = [[10, 20, 30], [40, 50, 60]],k = 2) == [[50, 60, 10], [20, 30, 40]]\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],k = 1) == [[9, 1, 2], [3, 4, 5], [6, 7, 8]]\n assert candidate(grid = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]],k = 10) == [[3, 4, 5, 6], [7, 8, 9, 10], [11, 12, 1, 2]]\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]],k = 100) == [[0, 0, 0], [0, 0, 0], [0, 0, 0]]\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]],k = 10) == [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]\n assert candidate(grid = [[9, 8, 7, 6, 5, 4, 3, 2, 1], [2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19]],k = 11) == [[9, 10, 11, 12, 13, 14, 15, 16, 17], [18, 19, 9, 8, 7, 6, 5, 4, 3], [2, 1, 2, 3, 4, 5, 6, 7, 8]]\n assert candidate(grid = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [20, 21, 22, 23, 24, 25, 26, 27, 28, 29]],k = 15) == [[15, 16, 17, 18, 19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]]\n assert candidate(grid = [[-1, -1, 0, 1, 1], [-2, -2, 0, 2, 2], [-3, -3, 0, 3, 3], [-4, -4, 0, 4, 4], [-5, -5, 0, 5, 5]],k = 3) == [[0, 5, 5, -1, -1], [0, 1, 1, -2, -2], [0, 2, 2, -3, -3], [0, 3, 3, -4, -4], [0, 4, 4, -5, -5]]\n assert candidate(grid = [[-10, -20, -30], [-40, -50, -60], [-70, -80, -90], [-100, -110, -120]],k = 7) == [[-60, -70, -80], [-90, -100, -110], [-120, -10, -20], [-30, -40, -50]]\n assert candidate(grid = [[9, 9, 9, 9, 9], [9, 9, 9, 9, 9], [9, 9, 9, 9, 9], [9, 9, 9, 9, 9]],k = 7) == [[9, 9, 9, 9, 9], [9, 9, 9, 9, 9], [9, 9, 9, 9, 9], [9, 9, 9, 9, 9]]\n assert candidate(grid = [[5, 1, 9, 11], [2, 4, 8, 10], [13, 3, 6, 7], [15, 14, 12, 16]],k = 23) == [[3, 6, 7, 15], [14, 12, 16, 5], [1, 9, 11, 2], [4, 8, 10, 13]]\n assert candidate(grid = [[-1, -2, -3, -4, -5], [-6, -7, -8, -9, -10], [-11, -12, -13, -14, -15], [-16, -17, -18, -19, -20], [-21, -22, -23, -24, -25]],k = 25) == [[-1, -2, -3, -4, -5], [-6, -7, -8, -9, -10], [-11, -12, -13, -14, -15], [-16, -17, -18, -19, -20], [-21, -22, -23, -24, -25]]\n assert candidate(grid = [[-1000, -900, -800], [-700, -600, -500], [-400, -300, -200], [-100, 0, 100], [200, 300, 400], [500, 600, 700]],k = 30) == [[-400, -300, -200], [-100, 0, 100], [200, 300, 400], [500, 600, 700], [-1000, -900, -800], [-700, -600, -500]]\n assert candidate(grid = [[-1000, 1000, -500, 500], [200, -200, 300, -300], [400, -400, 500, -500]],k = 100) == [[400, -400, 500, -500], [-1000, 1000, -500, 500], [200, -200, 300, -300]]\n assert candidate(grid = [[100, 200, 300], [400, 500, 600], [700, 800, 900], [1000, 1100, 1200], [1300, 1400, 1500], [1600, 1700, 1800]],k = 45) == [[1000, 1100, 1200], [1300, 1400, 1500], [1600, 1700, 1800], [100, 200, 300], [400, 500, 600], [700, 800, 900]]\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],k = 20) == [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]\n assert candidate(grid = [[-5, -4, -3, -2, -1], [0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19]],k = 25) == [[-5, -4, -3, -2, -1], [0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19]]\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]],k = 18) == [[13, 14, 15, 16, 17, 18, 19, 20, 21, 22], [23, 24, 25, 26, 27, 28, 29, 30, 1, 2], [3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]\n assert candidate(grid = [[1000, -1000, 1000], [-1000, 1000, -1000], [1000, -1000, 1000]],k = 63) == [[1000, -1000, 1000], [-1000, 1000, -1000], [1000, -1000, 1000]]\n assert candidate(grid = [[100, 200, 300], [400, 500, 600], [700, 800, 900], [1000, 1100, 1200]],k = 37) == [[1200, 100, 200], [300, 400, 500], [600, 700, 800], [900, 1000, 1100]]\n assert candidate(grid = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]],k = 30) == [[21, 22, 23, 24, 25], [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]\n assert candidate(grid = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]],k = 15) == [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]]\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]],k = 50) == [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]\n assert candidate(grid = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],k = 15) == [[6, 7], [8, 9], [10, 1], [2, 3], [4, 5]]\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]],k = 25) == [[6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [16, 17, 18, 19, 20, 21, 22, 23, 24, 25], [26, 27, 28, 29, 30, 1, 2, 3, 4, 5]]\n assert candidate(grid = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],k = 13) == [[8, 9], [10, 1], [2, 3], [4, 5], [6, 7]]\n assert candidate(grid = [[5, 4, 3, 2, 1], [10, 9, 8, 7, 6], [15, 14, 13, 12, 11], [20, 19, 18, 17, 16]],k = 35) == [[10, 9, 8, 7, 6], [15, 14, 13, 12, 11], [20, 19, 18, 17, 16], [5, 4, 3, 2, 1]]\n assert candidate(grid = [[5, 10, 15, 20, 25, 30, 35, 40, 45, 50], [55, 60, 65, 70, 75, 80, 85, 90, 95, 100], [105, 110, 115, 120, 125, 130, 135, 140, 145, 150]],k = 15) == [[80, 85, 90, 95, 100, 105, 110, 115, 120, 125], [130, 135, 140, 145, 150, 5, 10, 15, 20, 25], [30, 35, 40, 45, 50, 55, 60, 65, 70, 75]]\n assert candidate(grid = [[45, 67, 89], [12, 34, 56], [78, 90, 23]],k = 25) == [[89, 12, 34], [56, 78, 90], [23, 45, 67]]\n assert candidate(grid = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]],k = 11) == [[15, 16, 17, 18, 19], [20, 21, 22, 23, 24], [25, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14]]\n assert candidate(grid = [[-5, -10, -15], [-20, -25, -30], [-35, -40, -45], [-50, -55, -60]],k = 15) == [[-50, -55, -60], [-5, -10, -15], [-20, -25, -30], [-35, -40, -45]]\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]],k = 7) == [[24, 25, 26, 27, 28, 29, 30, 1, 2, 3], [4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [14, 15, 16, 17, 18, 19, 20, 21, 22, 23]]\n assert candidate(grid = [[100, -100, 200, -200], [300, -300, 400, -400], [500, -500, 600, -600]],k = 25) == [[-600, 100, -100, 200], [-200, 300, -300, 400], [-400, 500, -500, 600]]\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]],k = 100) == [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]\n assert candidate(grid = [[-1, 0, 1], [-1, 0, 1], [-1, 0, 1], [-1, 0, 1], [-1, 0, 1]],k = 12) == [[-1, 0, 1], [-1, 0, 1], [-1, 0, 1], [-1, 0, 1], [-1, 0, 1]]\n assert candidate(grid = [[10, 20, 30, 40, 50, 60], [70, 80, 90, 100, 110, 120], [130, 140, 150, 160, 170, 180]],k = 10) == [[90, 100, 110, 120, 130, 140], [150, 160, 170, 180, 10, 20], [30, 40, 50, 60, 70, 80]]\n assert candidate(grid = [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19]],k = 15) == [[5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [0, 1, 2, 3, 4]]\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]],k = 30) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]]\n assert candidate(grid = [[42]],k = 0) == [[42]]\n assert candidate(grid = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [19, 17, 15, 13, 11, 9, 7, 5, 3, 1]],k = 23) == [[2, 1, 0, 1, 3, 5, 7, 9, 11, 13], [15, 17, 19, 19, 17, 15, 13, 11, 9, 7], [5, 3, 1, 0, 1, 2, 3, 4, 5, 6], [7, 8, 9, 9, 8, 7, 6, 5, 4, 3]]\n assert candidate(grid = [[1000, 0, -1000, 500], [500, 1000, 0, -500], [-500, -1000, 500, 0], [0, 500, -500, 1000]],k = 65) == [[1000, 1000, 0, -1000], [500, 500, 1000, 0], [-500, -500, -1000, 500], [0, 0, 500, -500]]\n assert candidate(grid = [[10, 20, 30, 40, 50], [60, 70, 80, 90, 100], [110, 120, 130, 140, 150], [160, 170, 180, 190, 200]],k = 7) == [[140, 150, 160, 170, 180], [190, 200, 10, 20, 30], [40, 50, 60, 70, 80], [90, 100, 110, 120, 130]]\n assert candidate(grid = [[-1000, 1000, -500, 500], [0, -999, 999, 0], [250, -250, 750, -750]],k = 100) == [[250, -250, 750, -750], [-1000, 1000, -500, 500], [0, -999, 999, 0]]\n assert candidate(grid = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]],k = 8) == [[13, 14], [15, 16], [17, 18], [19, 20], [1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]]\n assert candidate(grid = [[100, 200, 300], [400, 500, 600], [700, 800, 900], [1000, 1100, 1200]],k = 5) == [[800, 900, 1000], [1100, 1200, 100], [200, 300, 400], [500, 600, 700]]\n assert candidate(grid = [[1000, -1000, 1000], [-1000, 1000, -1000], [1000, -1000, 1000]],k = 50) == [[1000, -1000, 1000], [-1000, 1000, 1000], [-1000, 1000, -1000]]\n assert candidate(grid = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],k = 1) == [[10, 1], [2, 3], [4, 5], [6, 7], [8, 9]]\n assert candidate(grid = [[0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17], [18, 19, 20, 21, 22, 23], [24, 25, 26, 27, 28, 29]],k = 15) == [[15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26], [27, 28, 29, 0, 1, 2], [3, 4, 5, 6, 7, 8], [9, 10, 11, 12, 13, 14]]\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]],k = 33) == [[8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27], [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 1, 2, 3, 4, 5, 6, 7]]\n assert candidate(grid = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15], [16, 17, 18, 19]],k = 25) == [[15, 16, 17, 18], [19, 0, 1, 2], [3, 4, 5, 6], [7, 8, 9, 10], [11, 12, 13, 14]]\n assert candidate(grid = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],k = 3) == [[8, 9], [10, 1], [2, 3], [4, 5], [6, 7]]\n assert candidate(grid = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]],k = 24) == [[2, 3, 4, 5, 6], [7, 8, 9, 10, 11], [12, 13, 14, 15, 16], [17, 18, 19, 20, 21], [22, 23, 24, 25, 1]]\n assert candidate(grid = [[5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5]],k = 25) == [[5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5]]\n assert candidate(grid = [[100, 200, 300], [400, 500, 600], [700, 800, 900], [1000, 1100, 1200]],k = 10) == [[300, 400, 500], [600, 700, 800], [900, 1000, 1100], [1200, 100, 200]]\n assert candidate(grid = [[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4], [5, 5, 5, 5, 5]],k = 25) == [[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4], [5, 5, 5, 5, 5]]\n assert candidate(grid = [[1000, 1000, 1000], [1000, 1000, 1000], [1000, 1000, 1000]],k = 81) == [[1000, 1000, 1000], [1000, 1000, 1000], [1000, 1000, 1000]]\n assert candidate(grid = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]],k = 100) == [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]]\n assert candidate(grid = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],k = 100) == [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]\n assert candidate(grid = [[-10, -20, -30, -40], [-50, -60, -70, -80], [-90, -100, -110, -120], [-130, -140, -150, -160]],k = 100) == [[-130, -140, -150, -160], [-10, -20, -30, -40], [-50, -60, -70, -80], [-90, -100, -110, -120]]\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18], [19, 20, 21], [22, 23, 24], [25, 26, 27], [28, 29, 30]],k = 19) == [[12, 13, 14], [15, 16, 17], [18, 19, 20], [21, 22, 23], [24, 25, 26], [27, 28, 29], [30, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]\n assert candidate(grid = [[10, 20, 30, 40, 50], [60, 70, 80, 90, 100], [110, 120, 130, 140, 150], [160, 170, 180, 190, 200], [210, 220, 230, 240, 250]],k = 17) == [[90, 100, 110, 120, 130], [140, 150, 160, 170, 180], [190, 200, 210, 220, 230], [240, 250, 10, 20, 30], [40, 50, 60, 70, 80]]\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]],k = 20) == [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [1, 0, 1, 0, 1]]\n assert candidate(grid = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],k = 10) == [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]\n assert candidate(grid = [[5, 1, 4, 2, 8], [0, 3, 9, 7, 6], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [20, 21, 22, 23, 24]],k = 13) == [[12, 13, 14, 15, 16], [17, 18, 19, 20, 21], [22, 23, 24, 5, 1], [4, 2, 8, 0, 3], [9, 7, 6, 10, 11]]\n assert candidate(grid = [[5, -5, 15, -15, 25, -25], [35, -35, 45, -45, 55, -55], [65, -65, 75, -75, 85, -85]],k = 20) == [[85, -85, 5, -5, 15, -15], [25, -25, 35, -35, 45, -45], [55, -55, 65, -65, 75, -75]]\n assert candidate(grid = [[-1, 2, -3, 4, -5, 6], [7, -8, 9, -10, 11, -12], [13, -14, 15, -16, 17, -18]],k = 100) == [[9, -10, 11, -12, 13, -14], [15, -16, 17, -18, -1, 2], [-3, 4, -5, 6, 7, -8]]\n assert candidate(grid = [[999, 999, 999], [999, 999, 999], [999, 999, 999], [999, 999, 999], [999, 999, 999]],k = 50) == [[999, 999, 999], [999, 999, 999], [999, 999, 999], [999, 999, 999], [999, 999, 999]]\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]],k = 19) == [[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1]]\n assert candidate(grid = [[-1, -2, -3, -4, -5], [-6, -7, -8, -9, -10], [-11, -12, -13, -14, -15], [-16, -17, -18, -19, -20], [-21, -22, -23, -24, -25]],k = 100) == [[-1, -2, -3, -4, -5], [-6, -7, -8, -9, -10], [-11, -12, -13, -14, -15], [-16, -17, -18, -19, -20], [-21, -22, -23, -24, -25]]\n assert candidate(grid = [[10, 20, 30, 40, 50], [60, 70, 80, 90, 100], [110, 120, 130, 140, 150], [160, 170, 180, 190, 200]],k = 3) == [[180, 190, 200, 10, 20], [30, 40, 50, 60, 70], [80, 90, 100, 110, 120], [130, 140, 150, 160, 170]]\n assert candidate(grid = [[5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16], [17, 18, 19, 20, 21, 22], [23, 24, 25, 26, 27, 28], [29, 30, 31, 32, 33, 34]],k = 30) == [[5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16], [17, 18, 19, 20, 21, 22], [23, 24, 25, 26, 27, 28], [29, 30, 31, 32, 33, 34]]\n assert candidate(grid = [[-1000, 1000], [-1000, 1000], [-1000, 1000], [-1000, 1000], [-1000, 1000]],k = 50) == [[-1000, 1000], [-1000, 1000], [-1000, 1000], [-1000, 1000], [-1000, 1000]]\n assert candidate(grid = [[10, 20, 30, 40], [50, 60, 70, 80], [90, 100, 110, 120], [130, 140, 150, 160]],k = 15) == [[20, 30, 40, 50], [60, 70, 80, 90], [100, 110, 120, 130], [140, 150, 160, 10]]\n assert candidate(grid = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],k = 7) == [[4, 5], [6, 7], [8, 9], [10, 1], [2, 3]]\n assert candidate(grid = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]],k = 3) == [[8], [9], [10], [1], [2], [3], [4], [5], [6], [7]]\n"}, "metadata": {"canonical_parameter_names": ["grid", "k"], "leetcode_dataset_entry_point": "Solution().shiftGrid", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shiftGrid = function(grid, k) {", "container": null, "callable": "shiftGrid", "parameters": [{"name": "grid", "type": "number[][]"}, {"name": "k", "type": "number"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1262, "task_id": "greatest-sum-divisible-by-three", "difficulty": "Medium", "problem_description": "Given an integer array nums, return the maximum possible sum of elements of the array such that it is divisible by three.\n \nExample 1:\n\nInput: nums = [3,6,5,1,8]\nOutput: 18\nExplanation: Pick numbers 3, 6, 1 and 8 their sum is 18 (maximum sum divisible by 3).\nExample 2:\n\nInput: nums = [4]\nOutput: 0\nExplanation: Since 4 is not divisible by 3, do not pick any number.\n\nExample 3:\n\nInput: nums = [1,2,3,4,4]\nOutput: 12\nExplanation: Pick numbers 1, 3, 4 and 4 their sum is 12 (maximum sum divisible by 3).\n\n \nConstraints:\n\n1 <= nums.length <= 4 * 104\n1 <= nums[i] <= 104\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 18\n assert candidate(nums = [2, 3, 5, 7, 11]) == 21\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 30\n assert candidate(nums = [4]) == 0\n assert candidate(nums = [10000, 10000, 10000, 10000]) == 30000\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 54\n assert candidate(nums = [2, 5, 8, 11, 14, 17, 20]) == 75\n assert candidate(nums = [1, 4, 7, 10, 13, 16]) == 51\n assert candidate(nums = [1, 2, 3, 5, 7, 11, 13]) == 42\n assert candidate(nums = [3, 3, 3, 3, 3, 3]) == 18\n assert candidate(nums = [1, 2, 4, 5, 7, 10]) == 27\n assert candidate(nums = [10, 20, 30, 40, 50]) == 150\n assert candidate(nums = [5, 5, 5, 5, 5]) == 15\n assert candidate(nums = [1, 2, 4, 5, 7, 8, 11]) == 36\n assert candidate(nums = [9, 9, 9, 9, 9, 9]) == 54\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 9\n assert candidate(nums = [2, 2, 2, 2, 2, 2]) == 12\n assert candidate(nums = [1, 2, 3, 4, 4]) == 12\n assert candidate(nums = [5, 5, 5, 5, 5, 5]) == 30\n assert candidate(nums = [2, 6, 2, 2, 7, 10]) == 27\n assert candidate(nums = [3, 6, 5, 1, 8]) == 18\n assert candidate(nums = [1, 4, 7, 10, 13, 16, 19]) == 69\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3]) == 21\n assert candidate(nums = [1, 2, 3]) == 6\n assert candidate(nums = [1, 1, 1, 1, 1, 1]) == 6\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3]) == 18\n assert candidate(nums = [1, 2, 4, 5, 7, 8, 11, 13, 17, 19, 23, 29]) == 138\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2]) == 12\n assert candidate(nums = [3, 9, 12, 18, 21, 24, 27, 30]) == 144\n assert candidate(nums = [33, 66, 99, 132, 165, 198, 231, 264, 297, 330]) == 1815\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]) == 1050\n assert candidate(nums = [1, 2, 0, 3, 0, 6, 0, 9, 0, 12, 0, 15, 0, 18, 0, 21, 0, 24, 0, 27, 0, 30]) == 168\n assert candidate(nums = [8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50]) == 435\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 5400\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]) == 1048575\n assert candidate(nums = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50, 53, 56, 59, 62, 65, 68, 71, 74, 77, 80, 83, 86, 89, 92, 95, 98, 101, 104, 107, 110, 113, 116, 119, 122, 125, 128, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 161, 164, 167, 170, 173, 176, 179, 182, 185, 188, 191, 194, 197, 200]) == 6765\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 45\n assert candidate(nums = [1, 2, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99]) == 1686\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60]) == 390\n assert candidate(nums = [13, 19, 3, 11, 27, 5, 23, 29, 31, 37, 41, 43, 47]) == 324\n assert candidate(nums = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41]) == 294\n assert candidate(nums = [6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120]) == 1260\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60]) == 930\n assert candidate(nums = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]) == 270\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]) == 321\n assert candidate(nums = [101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == 2109\n assert candidate(nums = [1, 2, 4, 5, 7, 8, 11, 13, 17, 19, 23, 29, 31]) == 168\n assert candidate(nums = [7, 11, 13, 17, 19, 23, 29, 31, 37, 41]) == 228\n assert candidate(nums = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50, 53, 56, 59]) == 603\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000]) == 60000\n assert candidate(nums = [5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89]) == 705\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30]) == 165\n assert candidate(nums = [3, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63]) == 687\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60]) == 390\n assert candidate(nums = [1234, 4567, 7890, 3456, 6789, 2345, 5678, 8901, 123, 456]) == 41439\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 270\n assert candidate(nums = [8, 10, 5, 7, 6, 9, 3, 12, 15, 18, 21, 24, 27, 30, 33]) == 228\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70]) == 525\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 108\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384]) == 32766\n assert candidate(nums = [13, 16, 19, 22, 25, 28, 31, 34, 37, 40]) == 252\n assert candidate(nums = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38]) == 258\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 36\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15]) == 240\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]) == 639\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981, 9980]) == 189810\n assert candidate(nums = [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57]) == 435\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]) == 639\n assert candidate(nums = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40]) == 282\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000]) == 90000\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70]) == 378\n assert candidate(nums = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58]) == 585\n assert candidate(nums = [10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009, 10010]) == 90054\n assert candidate(nums = [3, 9, 27, 81, 243, 729]) == 1092\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 210\n assert candidate(nums = [8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160]) == 1680\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384]) == 32766\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105]) == 840\n assert candidate(nums = [10000, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985, 9984, 9983, 9982, 9981]) == 189828\n assert candidate(nums = [10000, 9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990]) == 99954\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60]) == 630\n assert candidate(nums = [9, 12, 3, 15, 6, 3, 18, 21, 24, 27]) == 138\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 465\n assert candidate(nums = [3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1]) == 39\n assert candidate(nums = [123, 456, 789, 1011, 1213, 1415, 1617, 1819, 2021, 2223, 2425]) == 13899\n assert candidate(nums = [3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049]) == 88572\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 540\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == 12000\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45]) == 360\n assert candidate(nums = [5, 10, 15, 20, 25, 30]) == 105\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]) == 1053\n assert candidate(nums = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58]) == 585\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 450\n assert candidate(nums = [3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == 174\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990, 9989, 9988, 9987, 9986, 9985]) == 149880\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40]) == 420\n assert candidate(nums = [3, 1, 2, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]) == 1059\n assert candidate(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 108\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 90\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75]) == 600\n assert candidate(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == 2310\n assert candidate(nums = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43]) == 330\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75]) == 975\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 210\n assert candidate(nums = [10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009, 10010, 10011, 10012, 10013, 10014, 10015, 10016, 10017, 10018, 10019]) == 200190\n assert candidate(nums = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105]) == 840\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90]) == 1395\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]) == 1111111110\n assert candidate(nums = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73]) == 705\n assert candidate(nums = [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90]) == 1395\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 30\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 399\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6]) == 42\n assert candidate(nums = [1, 2, 4, 5, 7, 8, 11, 13, 17, 19, 23, 29, 31, 37, 41]) == 246\n assert candidate(nums = [3, 9, 12, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45]) == 339\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 30\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 5, 5, 5, 6, 7, 8, 9]) == 63\n assert candidate(nums = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 5, 1, 0, 5, 8, 2, 0, 9, 7, 4, 9, 4, 4, 5, 9, 2, 3, 0, 7, 8, 1, 6, 4, 0, 6, 2, 8, 6, 2, 0, 8, 9, 9, 8, 6, 2, 8, 0, 3, 4, 8, 2, 5, 3, 4, 2, 1, 1, 7, 0, 6, 7]) == 462\n assert candidate(nums = [104, 101, 102, 103, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == 1455\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 180\n assert candidate(nums = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28]) == 144\n assert candidate(nums = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29]) == 153\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 36\n assert candidate(nums = [104729, 104743, 104723, 104747, 104728, 104752, 104731, 104755, 104732, 104756]) == 1047396\n assert candidate(nums = [1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6]) == 81\n assert candidate(nums = [9997, 9998, 9999, 10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009, 10010]) == 140049\n assert candidate(nums = [5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000]) == 75000\n assert candidate(nums = [33, 66, 99, 132, 165, 198, 231, 264, 297, 330, 363, 396, 429, 462, 495]) == 3960\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 540\n assert candidate(nums = [1, 2, 5, 8, 11, 14, 17, 20, 23, 26, 29]) == 156\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 18\n assert candidate(nums = [9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990]) == 99945\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19]) == 75\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 8, 9, 10]) == 111\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40]) == 180\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 147\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 5400\n assert candidate(nums = [1, 2, 4, 5, 7, 8, 11, 13, 17, 19, 23, 29]) == 138\n assert candidate(nums = [4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60]) == 480\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().maxSumDivThree", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxSumDivThree = function(nums) {", "container": null, "callable": "maxSumDivThree", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1263, "task_id": "minimum-moves-to-move-a-box-to-their-target-location", "difficulty": "Hard", "problem_description": "A storekeeper is a game in which the player pushes boxes around in a warehouse trying to get them to target locations.\nThe game is represented by an m x n grid of characters grid where each element is a wall, floor, or box.\nYour task is to move the box 'B' to the target position 'T' under the following rules:\n\nThe character 'S' represents the player. The player can move up, down, left, right in grid if it is a floor (empty cell).\nThe character '.' represents the floor which means a free cell to walk.\nThe character '#' represents the wall which means an obstacle (impossible to walk there).\nThere is only one box 'B' and one target cell 'T' in the grid.\nThe box can be moved to an adjacent free cell by standing next to the box and then moving in the direction of the box. This is a push.\nThe player cannot walk through the box.\n\nReturn the minimum number of pushes to move the box to the target. If there is no way to reach the target, return -1.\n \nExample 1:\n\n\nInput: grid = [[\"#\",\"#\",\"#\",\"#\",\"#\",\"#\"],\n [\"#\",\"T\",\"#\",\"#\",\"#\",\"#\"],\n [\"#\",\".\",\".\",\"B\",\".\",\"#\"],\n [\"#\",\".\",\"#\",\"#\",\".\",\"#\"],\n [\"#\",\".\",\".\",\".\",\"S\",\"#\"],\n [\"#\",\"#\",\"#\",\"#\",\"#\",\"#\"]]\nOutput: 3\nExplanation: We return only the number of times the box is pushed.\nExample 2:\n\nInput: grid = [[\"#\",\"#\",\"#\",\"#\",\"#\",\"#\"],\n [\"#\",\"T\",\"#\",\"#\",\"#\",\"#\"],\n [\"#\",\".\",\".\",\"B\",\".\",\"#\"],\n [\"#\",\"#\",\"#\",\"#\",\".\",\"#\"],\n [\"#\",\".\",\".\",\".\",\"S\",\"#\"],\n [\"#\",\"#\",\"#\",\"#\",\"#\",\"#\"]]\nOutput: -1\n\nExample 3:\n\nInput: grid = [[\"#\",\"#\",\"#\",\"#\",\"#\",\"#\"],\n [\"#\",\"T\",\".\",\".\",\"#\",\"#\"],\n [\"#\",\".\",\"#\",\"B\",\".\",\"#\"],\n [\"#\",\".\",\".\",\".\",\".\",\"#\"],\n [\"#\",\".\",\".\",\".\",\"S\",\"#\"],\n [\"#\",\"#\",\"#\",\"#\",\"#\",\"#\"]]\nOutput: 5\nExplanation: push the box down, left, left, up and up.\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m, n <= 20\ngrid contains only characters '.', '#', 'S', 'T', or 'B'.\nThere is only one character 'S', 'B', and 'T' in the grid.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '#', '#', '#', '#'], ['#', '.', '.', 'B', '.', '#'], ['#', '.', '#', '#', '.', '#'], ['#', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#'], ['#', 'T', '.', '#'], ['#', '.', 'B', '#'], ['#', 'S', '.', '#'], ['#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '#', '#'], ['#', '.', '#', 'B', '.', '#'], ['#', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#']]) == 5\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '#', '#', '#', '#'], ['#', '.', '.', 'B', '.', '#'], ['#', '#', '#', '#', '.', '#'], ['#', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '#', '#', '#', '#'], ['#', '.', 'B', '.', '.', '#'], ['#', '#', '#', '#', '.', '#'], ['#', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '#', '#', '#', '#'], ['#', '.', '.', 'B', '.', '#'], ['#', '.', '#', '#', '.', '#'], ['#', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '#', '#'], ['#', '.', '.', 'B', '#', '#'], ['#', '.', '#', '.', '.', '#'], ['#', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '#', '#'], ['#', '.', '#', 'B', '.', '#'], ['#', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#']]) == 5\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '#', '#', '#', '#'], ['#', '.', '.', 'B', '.', '#'], ['#', '.', '#', 'S', '.', '#'], ['#', '.', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '#', '#', '#', '#'], ['#', '.', '.', '.', 'B', '#'], ['#', '.', '#', '#', '.', '#'], ['#', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', 'S', '.', '.', '.', '.', '#'], ['#', '#', '.', '.', '.', 'T', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '#', '#', '#', '.', '#'], ['#', '.', '.', 'S', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '#'], ['#', '.', '#', 'B', '.', '#'], ['#', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '#', '.', '.', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', 'B', '.', '.', '#'], ['#', 'S', '.', '.', '#', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', 'B', '.', '#'], ['#', '.', '#', '.', '.', '.', '.', '#'], ['#', '.', '.', 'S', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', 'T', '#'], ['#', '#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '#', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', 'S', '#', '#', '#', 'T', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '#', '#', '.', '.', '#'], ['#', '.', 'S', '.', '.', '.', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 5\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', '.', '.', '#'], ['#', '.', '.', '.', 'B', '.', '#'], ['#', '.', '#', '.', 'S', '.', '#'], ['#', '.', '.', '.', '.', '.', 'T', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', 'B', '.', '#'], ['#', '.', '.', '#', '.', '.', '#'], ['#', '.', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'S', '.', '.', '.', '.', '#'], ['#', '.', '#', 'B', '#', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', 'T', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', 'B', '.', '#'], ['#', '.', '#', '#', '.', '#', '.', '#'], ['#', '.', '.', 'S', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#', '#']]) == 5\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '#'], ['#', '#', '#', 'B', '.', '#'], ['#', '.', '.', '.', '.', 'S'], ['#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', 'S', '#'], ['#', '.', '.', '.', '#', '#', '.', '#'], ['#', '#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', '.', '.', 'T', '#', '#'], ['#', '.', '#', '#', '#', '#'], ['#', '.', '.', 'B', '.', '#'], ['#', '.', 'S', '.', '.', '#'], ['#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', 'T', '#'], ['#', '.', '#', '#', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', 'S', '.', 'B', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', 'B', '#', '.', '#'], ['#', '.', '#', '.', '#', '.', '#'], ['#', '.', '.', '.', '.', 'T', '#'], ['#', 'S', '#', '#', '#', '#', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', '#', '.', '#'], ['#', '.', 'B', '.', 'T', '.', '#'], ['#', '.', '.', 'S', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 2\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', '#', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '#', '.', '#', '.', '#'], ['#', '.', '.', '.', '.', 'T', '#'], ['#', 'S', '#', '#', '#', '#', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '#', '.', '.', '.', '#', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '#', '.', 'T', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', 'S', '#', '#', '#', '#', '#']]) == 2\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', 'S', 'T', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '#', '.', '.', '#'], ['#', '.', '.', '.', '.', '#'], ['#', '.', 'B', '.', '.', '#'], ['#', 'S', '#', '.', '.', '#'], ['#', '#', '#', '#', '#', '#']]) == 5\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '#', 'B', '#', '.', '.', '#'], ['#', '.', '.', 'S', '.', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#', '#', '#']]) == 5\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '#', '#', '.', '.', '#'], ['#', '.', '.', 'S', '.', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'S', '.', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '#', '#', '#', '#', '.', '#'], ['#', '.', '.', '.', 'T', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '.', '#', 'B', '#', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '#'], ['#', 'S', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#']]) == 5\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', 'B', '.', '#'], ['#', '.', '.', '#', '#', '.', '#'], ['#', '.', '.', '.', '.', 'S', '#'], ['#', '.', '.', '.', 'T', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 7\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', 'T', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', 'B', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '.', 'S', '.', 'T', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', 'S', '.', '.', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '.', '#'], ['#', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', '#', 'B', '.', '#'], ['#', '.', '.', '.', '.', '.', 'T', '#'], ['#', '#', '#', '#', '#', '#', '#', '#']]) == 2\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'S', '.', '.', '.', 'T', '#'], ['#', '.', '#', '#', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '#', '#', '#', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '#'], ['#', '.', 'S', '.', '.', '#'], ['#', '.', '.', '#', '.', '#'], ['#', '.', '.', 'B', '.', '#'], ['#', '.', '.', 'T', '.', '#'], ['#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', '.', '.', '#'], ['#', '.', '#', 'B', '.', '.', '#'], ['#', '.', '.', 'T', 'S', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '#', '#', '#', '#', '#'], ['#', '#', '.', '.', '.', '.', 'T', '#'], ['#', '.', '.', 'B', '.', '#', '.', '#'], ['#', '.', '.', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#', '#', '#'], ['#', '#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', 'T', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', '.', 'B', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', '#', '#', '#', 'T', '#'], ['#', '.', '#', '.', '.', '#'], ['#', '.', '.', '.', 'B', '#'], ['#', '.', '.', '.', '.', '#'], ['#', 'S', '#', '#', '#', '#']]) == 2\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', 'S', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', 'T', '.', '#'], ['#', '#', '#', '#', '#', '#', '#', '#', '#']]) == 7\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '#', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', 'T', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', 'S', '#', '#', '#', '#', '#']]) == 2\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', 'S', '.', 'B', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', 'T', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', 'B', '.', '#'], ['#', '.', '.', '#', '.', '.', '#'], ['#', '.', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '.', '#'], ['#', '#', '.', '.', '.', '.', '#', '#'], ['#', '.', '.', 'B', '.', '.', '.', '#'], ['#', '.', '#', '.', 'T', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '.', '#'], ['#', 'S', '#', '#', '#', '#', '#', '#']]) == 2\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', 'S', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', 'T', '.', '#'], ['#', '#', '#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '#', '.', '#'], ['#', '.', '#', '#', 'S', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#', '#']]) == 6\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', 'S', '.', '.', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', '.', '#', '.', '#'], ['#', '.', '#', 'B', 'T', '#', '.', '#'], ['#', '.', '.', 'S', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '#', '#', '#'], ['#', '.', '.', '.', '#', '#'], ['#', '#', '#', 'B', '.', '#'], ['#', '.', '.', '.', '.', 'S'], ['#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', 'B', '.', '.', '#'], ['#', '.', '.', '.', '.', 'S', '#'], ['#', '.', '.', 'T', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 2\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '#', 'B', '#', '.', '.', '#'], ['#', '.', '.', '.', 'S', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#', '#', '#']]) == 5\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '#', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', 'S', '#', '#', '#', '#', 'T']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', 'B', '.', '.', '.', '#'], ['#', '.', '.', '#', '.', '.', '#'], ['#', '.', '.', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '#', '.', '.', '#'], ['#', '.', '.', '.', 'B', '#'], ['#', '.', '.', '#', '.', '#'], ['#', 'S', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '#'], ['#', '.', '.', '#', '.', '#'], ['#', '.', '.', 'B', '.', '#'], ['#', '#', '.', '.', '.', '#'], ['#', 'S', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', 'S', '.', '.', '.', '.', '#'], ['#', '#', '#', 'T', '#', '#', '#']]) == 2\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', 'B', '#'], ['#', '.', '.', '#', '.', '#'], ['#', 'S', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', 'T', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', '.', 'B', '.', '.', '.', '#'], ['#', 'S', '.', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '#', '.', '.', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', 'B', '.', '#'], ['#', 'S', '.', '.', '#', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 5\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', 'S', '#'], ['#', 'B', '.', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#'], ['#', 'S', '.', 'B', '#'], ['#', '.', '.', '.', '#'], ['#', '.', '.', 'T', '#'], ['#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', 'S', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', 'T', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', 'B', '.', '#'], ['#', '.', '.', 'S', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', 'S', '.', '.', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '#', '.', '.', '.', 'T', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', '.', '.', '.', '#'], ['#', '.', '.', '.', 'B', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', 'S', '#'], ['#', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', 'T', '.', '#'], ['#', '#', '#', '#', '#', '#', '#', '#']]) == 4\n assert candidate(grid = [['#', '#', '#', '#', '#'], ['#', 'S', '.', '.', '#'], ['#', '.', '#', '.', '#'], ['#', '.', '.', 'B', '#'], ['#', 'T', '.', '.', '#'], ['#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', 'B', '.', '#'], ['#', '.', 'S', '.', '.', '.', '#'], ['#', '.', '.', '.', 'T', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 2\n assert candidate(grid = [['#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', 'T', '#'], ['#', '.', 'B', '.', '.', '#'], ['#', '.', '#', '.', '.', '#'], ['#', 'S', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', 'T', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '.', '.', '#', '.', '.', '#'], ['#', '.', 'S', '#', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == 3\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', 'B', '.', '#'], ['#', '.', '.', '.', '#', '.', '#'], ['#', '.', 'S', '.', '.', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', 'T', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', '#', '.', '#'], ['#', '.', '#', 'B', '.', '.', '#'], ['#', '.', '#', '.', '.', 'S', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', 'T', '.', '.', '#'], ['#', '.', '#', '#', '#', '.', '#'], ['#', '.', '.', 'B', '.', '.', '#'], ['#', '#', '#', '#', '#', '.', '#'], ['#', '.', '.', '.', 'S', '.', '#'], ['#', '#', '#', '#', '#', '#', '#']]) == -1\n assert candidate(grid = [['#', '#', '#', '#', '#', '#', '#', '#'], ['#', '.', '.', '.', '.', '.', '.', '#'], ['#', '.', '#', '#', '.', '.', '.', '#'], ['#', '.', '.', '.', 'B', '.', '.', '#'], ['#', '.', '#', '.', '.', '.', '.', '#'], ['#', '.', '.', '.', '.', '.', 'S', '#'], ['#', '.', '.', '.', '.', '.', 'T', '#'], ['#', '#', '#', '#', '#', '#', '#', '#']]) == 5\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().minPushBox", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minPushBox = function(grid) {", "container": null, "callable": "minPushBox", "parameters": [{"name": "grid", "type": "character[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1266, "task_id": "minimum-time-visiting-all-points", "difficulty": "Easy", "problem_description": "On a 2D plane, there are n points with integer coordinates points[i] = [xi, yi]. Return the minimum time in seconds to visit all the points in the order given by points.\nYou can move according to these rules:\n\nIn 1 second, you can either:\n\n\t\nmove vertically by one unit,\nmove horizontally by one unit, or\nmove diagonally sqrt(2) units (in other words, move one unit vertically then one unit horizontally in 1 second).\n\n\nYou have to visit the points in the same order as they appear in the array.\nYou are allowed to pass through points that appear later in the order, but these do not count as visits.\n\n \nExample 1:\n\n\nInput: points = [[1,1],[3,4],[-1,0]]\nOutput: 7\nExplanation: One optimal path is [1,1] -> [2,2] -> [3,3] -> [3,4] -> [2,3] -> [1,2] -> [0,1] -> [-1,0] \nTime from [1,1] to [3,4] = 3 seconds \nTime from [3,4] to [-1,0] = 4 seconds\nTotal time = 7 seconds\nExample 2:\n\nInput: points = [[3,2],[-2,2]]\nOutput: 5\n\n \nConstraints:\n\npoints.length == n\n1 <= n <= 100\npoints[i].length == 2\n-1000 <= points[i][0], points[i][1] <= 1000\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(points = [[0, 0], [1, 1], [0, 0], [1, 1]]) == 3\n assert candidate(points = [[5, 5], [5, 5], [5, 5], [5, 5]]) == 0\n assert candidate(points = [[-5, -5], [-4, -4], [-3, -3], [-2, -2]]) == 3\n assert candidate(points = [[0, 0], [0, 1], [0, 2], [0, 3]]) == 3\n assert candidate(points = [[-1000, -1000], [1000, 1000], [-1000, 1000], [1000, -1000]]) == 6000\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [4, 5]]) == 3\n assert candidate(points = [[5, 5], [4, 4], [3, 3], [2, 2], [1, 1]]) == 4\n assert candidate(points = [[3, 2], [-2, 2]]) == 5\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8]]) == 6\n assert candidate(points = [[-1, -1], [1, 1], [-1, -1], [1, 1]]) == 6\n assert candidate(points = [[0, 0], [1, 1], [1, 0], [0, 1]]) == 3\n assert candidate(points = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 4\n assert candidate(points = [[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]) == 4\n assert candidate(points = [[-1, -1], [-2, -2], [-3, -3], [-4, -4]]) == 3\n assert candidate(points = [[1, 1], [3, 4], [-1, 0]]) == 7\n assert candidate(points = [[-1000, -1000], [1000, 1000]]) == 2000\n assert candidate(points = [[1, 1], [2, 2], [2, 1], [1, 2], [0, 0]]) == 5\n assert candidate(points = [[0, 0], [5, 5], [10, 10]]) == 10\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3]]) == 3\n assert candidate(points = [[0, 0], [1, 0], [2, 0], [3, 0]]) == 3\n assert candidate(points = [[0, 0], [1000, 1000]]) == 1000\n assert candidate(points = [[10, 10], [0, 0], [5, 5]]) == 15\n assert candidate(points = [[-1, -1], [1, 1], [-2, -2], [2, 2]]) == 9\n assert candidate(points = [[10, 10], [5, 5], [0, 0], [-5, -5], [-10, -10]]) == 20\n assert candidate(points = [[1000, 1000], [-1000, -1000], [1000, -1000], [-1000, 1000]]) == 6000\n assert candidate(points = [[1000, 1000], [-1000, -1000], [0, 0]]) == 3000\n assert candidate(points = [[-1000, 0], [1000, 0], [0, -1000], [0, 1000]]) == 5000\n assert candidate(points = [[999, 999], [1000, 1000], [999, 1000], [1000, 999], [999, 999], [0, 0], [-1, -1], [-1000, -1000]]) == 2003\n assert candidate(points = [[-500, 500], [500, -500], [-500, -500], [500, 500], [-1, 1], [1, -1]]) == 3503\n assert candidate(points = [[-100, -100], [-90, -90], [-80, -80], [-70, -70], [-60, -60], [-50, -50], [-40, -40]]) == 60\n assert candidate(points = [[-1, -1], [1, 1], [-1, 1], [1, -1], [-2, -2], [2, 2], [-2, 2], [2, -2]]) == 21\n assert candidate(points = [[1, 1], [2, 3], [3, 5], [5, 7], [7, 9], [9, 11], [11, 13], [13, 15], [15, 17], [17, 19]]) == 18\n assert candidate(points = [[0, 0], [1, 0], [1, 1], [0, 1], [0, 2], [1, 2], [1, 3], [0, 3], [0, 4], [1, 4], [1, 5], [0, 5], [0, 6], [1, 6], [1, 7], [0, 7], [0, 8], [1, 8], [1, 9], [0, 9]]) == 19\n assert candidate(points = [[5, 5], [5, 15], [15, 15], [15, 5], [5, 5], [10, 10], [15, 5], [5, 15]]) == 60\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 9\n assert candidate(points = [[-2, -2], [-2, 2], [2, 2], [2, -2], [-2, -2], [1, 1], [0, 0], [-1, -1]]) == 21\n assert candidate(points = [[100, 200], [200, 300], [300, 400], [400, 500], [500, 600], [600, 700], [700, 800]]) == 600\n assert candidate(points = [[5, 5], [1, 1], [-3, -3], [-5, -5], [0, 0], [5, 5], [10, 10], [5, 5]]) == 30\n assert candidate(points = [[0, 0], [0, 2], [2, 2], [2, 0], [0, 0], [2, 0], [0, 2], [2, 2], [0, 0], [2, 2]]) == 18\n assert candidate(points = [[-10, 10], [0, 0], [10, -10], [0, 0], [-10, 10], [0, 0], [10, -10]]) == 60\n assert candidate(points = [[10, 10], [10, 11], [11, 11], [12, 12], [12, 13], [13, 13], [13, 14], [14, 14]]) == 7\n assert candidate(points = [[-999, -999], [-998, -998], [-997, -997], [-996, -996], [-995, -995], [-994, -994], [-993, -993]]) == 6\n assert candidate(points = [[0, 0], [1000, 0], [0, 1000], [1000, 1000], [500, 500], [0, 0], [1000, 0], [0, 1000]]) == 6000\n assert candidate(points = [[0, 0], [1, 1], [2, 0], [1, -1], [0, 0], [-1, -1], [-2, 0], [-1, 1]]) == 7\n assert candidate(points = [[-1000, -1000], [-999, -999], [-998, -998], [-997, -997], [-996, -996], [-995, -995], [-994, -994], [-993, -993]]) == 7\n assert candidate(points = [[100, 0], [0, 100], [100, 100], [0, 0], [50, 50], [50, 0], [0, 50]]) == 450\n assert candidate(points = [[0, 1], [1, 0], [0, -1], [-1, 0], [0, 1], [1, 0], [0, -1], [-1, 0], [0, 0]]) == 8\n assert candidate(points = [[-100, -100], [-99, -101], [-98, -102], [-97, -103], [-96, -104], [-95, -105], [-94, -106]]) == 6\n assert candidate(points = [[100, 100], [200, 150], [300, 200], [350, 250], [400, 300], [500, 350], [600, 400]]) == 500\n assert candidate(points = [[100, 200], [200, 300], [300, 200], [200, 100], [100, 200], [200, 300], [300, 400], [400, 300]]) == 700\n assert candidate(points = [[1, 1], [1, 2], [2, 2], [3, 3], [3, 4], [4, 4], [5, 5], [5, 6], [6, 6], [7, 7], [7, 8], [8, 8], [9, 9], [9, 10], [10, 10]]) == 14\n assert candidate(points = [[0, 0], [1, 2], [2, 4], [3, 6], [4, 8], [5, 10], [6, 12], [7, 14], [8, 16], [9, 18], [10, 20]]) == 20\n assert candidate(points = [[-900, 0], [-800, -100], [-700, -200], [-600, -300], [-500, -400], [-400, -500], [-300, -600], [-200, -700], [-100, -800], [0, -900]]) == 900\n assert candidate(points = [[10, 10], [20, 20], [15, 25], [25, 15], [30, 30], [40, 40], [35, 35], [45, 45]]) == 65\n assert candidate(points = [[0, 0], [999, 999], [1, 1], [998, 998], [2, 2], [997, 997], [3, 3], [996, 996], [4, 4]]) == 7964\n assert candidate(points = [[0, 0], [1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18]]) == 18\n assert candidate(points = [[5, 5], [5, 15], [15, 15], [15, 5], [5, 5], [5, 25], [25, 25], [25, 5], [5, 5]]) == 120\n assert candidate(points = [[0, 0], [1, 0], [0, 1], [2, 0], [0, 2], [3, 0], [0, 3], [4, 0], [0, 4], [5, 0], [0, 5]]) == 30\n assert candidate(points = [[5, 5], [10, 5], [15, 5], [20, 5], [25, 5], [30, 5], [35, 5], [40, 5], [45, 5], [50, 5]]) == 45\n assert candidate(points = [[1, 2], [2, 5], [5, 4], [7, 8], [10, 10], [5, 5], [3, 3], [2, 2], [1, 1]]) == 22\n assert candidate(points = [[-500, 500], [500, -500], [-500, -500], [500, 500], [0, 0], [-1000, 1000], [1000, -1000]]) == 6500\n assert candidate(points = [[0, 0], [1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == 10\n assert candidate(points = [[1, 1], [1000, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 2005\n assert candidate(points = [[100, 100], [200, 200], [300, 100], [200, 0], [100, 100]]) == 400\n assert candidate(points = [[0, 0], [10, 0], [20, 0], [30, 0], [40, 0], [50, 0], [60, 0], [70, 0], [80, 0], [90, 0], [100, 0]]) == 100\n assert candidate(points = [[1000, 0], [0, 1000], [1000, 1000], [0, 0], [500, 500], [250, 250], [750, 750]]) == 4250\n assert candidate(points = [[-100, -100], [-50, -100], [0, -100], [50, -100], [100, -100], [100, -50], [100, 0], [100, 50], [100, 100], [50, 100], [0, 100], [-50, 100], [-100, 100], [-100, 50], [-100, 0], [-100, -50]]) == 750\n assert candidate(points = [[-1, -1], [0, 0], [1, 1], [2, 2], [3, 3], [2, 2], [1, 1], [0, 0], [-1, -1]]) == 8\n assert candidate(points = [[-1, -1], [0, 0], [1, 1], [0, 0], [-1, -1], [1, 1], [0, 0], [-1, -1], [1, 1]]) == 10\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]]) == 14\n assert candidate(points = [[-100, 100], [100, -100], [-100, -100], [100, 100], [-100, 100]]) == 800\n assert candidate(points = [[0, 0], [1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]]) == 16\n assert candidate(points = [[-10, 10], [20, -20], [30, 30], [-40, -40], [50, 50], [0, 0], [-50, -50]]) == 340\n assert candidate(points = [[-1, -2], [-3, -4], [-5, -6], [-7, -8], [-9, -10], [-11, -12], [-13, -14], [-15, -16], [-17, -18]]) == 16\n assert candidate(points = [[-999, 999], [0, 0], [999, -999], [0, 0], [-999, 999]]) == 3996\n assert candidate(points = [[-100, 0], [0, -100], [100, 0], [0, 100], [0, 0], [-100, 0], [0, -100], [100, 0], [0, 100]]) == 800\n assert candidate(points = [[-500, -500], [500, 500], [-500, 500], [500, -500], [-500, -500], [0, 0], [500, 500], [0, 0]]) == 5500\n assert candidate(points = [[-100, -100], [0, 0], [100, 100], [0, 0], [-100, -100]]) == 400\n assert candidate(points = [[0, 0], [0, 500], [500, 0], [1000, 500], [500, 1000], [0, 500], [500, 0]]) == 3000\n assert candidate(points = [[10, 10], [5, 5], [0, 0], [-5, -5], [-10, -10], [-5, -5], [0, 0], [5, 5], [10, 10]]) == 40\n assert candidate(points = [[-1, 0], [0, -1], [1, 0], [0, 1], [-1, 0]]) == 4\n assert candidate(points = [[-1000, 0], [0, 1000], [1000, 0], [0, -1000], [-1000, -1000]]) == 4000\n assert candidate(points = [[0, 0], [1, 0], [2, 1], [2, 2], [3, 3], [3, 4], [4, 4]]) == 6\n assert candidate(points = [[1, 1], [2, 3], [3, 5], [4, 7], [5, 9], [6, 11], [7, 13], [8, 15], [9, 17], [10, 19]]) == 18\n assert candidate(points = [[0, 0], [0, 1], [1, 1], [1, 0], [0, 0], [0, -1], [-1, -1], [-1, 0], [0, 0]]) == 8\n assert candidate(points = [[100, 100], [200, 200], [300, 300], [400, 400], [500, 500], [600, 600], [700, 700], [800, 800], [900, 900]]) == 800\n assert candidate(points = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10]]) == 10\n assert candidate(points = [[0, 0], [1, 1], [2, 0], [1, 0], [0, 1], [0, 2], [1, 1]]) == 6\n assert candidate(points = [[-300, -300], [-200, -200], [-100, -100], [0, 0], [100, 100], [200, 200], [300, 300]]) == 600\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20]]) == 18\n assert candidate(points = [[100, 0], [90, 10], [80, 20], [70, 30], [60, 40], [50, 50], [40, 60], [30, 70], [20, 80], [10, 90], [0, 100]]) == 100\n assert candidate(points = [[-999, 999], [999, -999], [-999, -999], [999, 999], [0, 0], [-100, 100], [100, -100]]) == 7293\n assert candidate(points = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]]) == 10\n assert candidate(points = [[0, 0], [100, 0], [100, 100], [0, 100], [0, 0], [100, 100], [100, 0], [0, 0]]) == 700\n assert candidate(points = [[500, 500], [0, 0], [500, 0], [0, 500], [500, 500], [250, 250], [750, 750], [250, 750], [750, 250]]) == 3750\n assert candidate(points = [[100, 0], [50, 50], [0, 100], [-50, 50], [-100, 0], [-50, -50], [0, -100], [50, -50]]) == 350\n assert candidate(points = [[-1000, 0], [0, -1000], [1000, 0], [0, 1000]]) == 3000\n assert candidate(points = [[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5], [-6, -6], [-7, -7], [-8, -8], [-9, -9], [-10, -10]]) == 9\n assert candidate(points = [[-10, -10], [10, 10], [-5, 5], [5, -5], [0, 0], [-5, -5], [5, 5], [-10, -10], [10, 10]]) == 100\n assert candidate(points = [[-500, -500], [-400, -400], [-300, -300], [-200, -200], [-100, -100], [0, 0], [100, 100], [200, 200], [300, 300], [400, 400], [500, 500]]) == 1000\n assert candidate(points = [[100, 100], [200, 200], [300, 300], [400, 400], [500, 500], [0, 0]]) == 900\n assert candidate(points = [[0, 0], [1, 2], [2, 4], [3, 6], [4, 8], [5, 10], [6, 12], [7, 14], [8, 16], [9, 18]]) == 18\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 9\n assert candidate(points = [[-300, -400], [400, 300], [-200, 100], [200, -200], [0, 0]]) == 1900\n assert candidate(points = [[500, 500], [450, 550], [400, 600], [350, 650], [300, 700], [250, 750], [200, 800]]) == 300\n assert candidate(points = [[0, 0], [100, 100], [200, 0], [300, 100], [400, 0], [500, 100], [600, 0], [700, 100], [800, 0], [900, 100]]) == 900\n assert candidate(points = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]) == 10\n assert candidate(points = [[-1, 1], [-2, 2], [-3, 3], [-4, 4], [-5, 5], [-6, 6], [-7, 7], [-8, 8], [-9, 9]]) == 8\n assert candidate(points = [[-500, 0], [0, 500], [500, 0], [0, -500], [-500, 0], [0, 0], [500, 500], [-500, -500]]) == 4000\n assert candidate(points = [[1, 1], [10, 10], [1, 10], [10, 1], [1, 1], [10, 10], [1, 10], [10, 1], [1, 1]]) == 72\n assert candidate(points = [[-1, -2], [-3, -4], [-5, -6], [-7, -8], [-9, -10], [-11, -12], [-13, -14], [-15, -16], [-17, -18], [-19, -20]]) == 18\n assert candidate(points = [[0, 0], [1000, 0], [0, 1000], [1000, 1000], [500, 500], [0, 0]]) == 4000\n assert candidate(points = [[-1, 2], [3, -4], [5, 6], [-7, 8], [9, -10], [-11, 12], [13, -14], [-15, 16], [0, 0]]) == 140\n assert candidate(points = [[0, 0], [1, 1], [2, 0], [3, 1], [4, 0], [5, 1], [6, 0], [7, 1], [8, 0], [9, 1]]) == 9\n assert candidate(points = [[-1, 1], [1, -1], [-2, 2], [2, -2], [-3, 3], [3, -3], [-4, 4], [4, -4], [-5, 5], [5, -5]]) == 54\n assert candidate(points = [[-100, -100], [-90, -90], [-80, -80], [-70, -70], [-60, -60], [-50, -50], [-40, -40], [-30, -30], [-20, -20], [-10, -10]]) == 90\n assert candidate(points = [[-500, 500], [0, 0], [500, -500], [0, 0], [-500, 500], [0, 0], [500, -500], [0, 0]]) == 3500\n assert candidate(points = [[0, 0], [1000, 1000], [-1000, -1000], [500, 500], [-500, -500], [1, -1], [0, 0]]) == 6002\n assert candidate(points = [[1, 1], [2, 3], [3, 2], [4, 5], [5, 4], [6, 6], [7, 5], [8, 7], [9, 8], [10, 10]]) == 15\n assert candidate(points = [[-1000, 1000], [1000, 0], [0, 1000], [1000, -1000], [0, 0]]) == 6000\n"}, "metadata": {"canonical_parameter_names": ["points"], "leetcode_dataset_entry_point": "Solution().minTimeToVisitAllPoints", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minTimeToVisitAllPoints = function(points) {", "container": null, "callable": "minTimeToVisitAllPoints", "parameters": [{"name": "points", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1267, "task_id": "count-servers-that-communicate", "difficulty": "Medium", "problem_description": "You are given a map of a server center, represented as a m * n integer matrix grid, where 1 means that on that cell there is a server and 0 means that it is no server. Two servers are said to communicate if they are on the same row or on the same column.\n\nReturn the number of servers that communicate with any other server.\n \nExample 1:\n\n\nInput: grid = [[1,0],[0,1]]\nOutput: 0\nExplanation: No servers can communicate with others.\nExample 2:\n\n\nInput: grid = [[1,0],[1,1]]\nOutput: 3\nExplanation: All three servers can communicate with at least one other server.\n\nExample 3:\n\n\nInput: grid = [[1,1,0,0],[0,0,1,0],[0,0,1,0],[0,0,0,1]]\nOutput: 4\nExplanation: The two servers in the first row can communicate with each other. The two servers in the third column can communicate with each other. The server at right bottom corner can't communicate with any other server.\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m <= 250\n1 <= n <= 250\ngrid[i][j] == 0 or 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1, 1, 1, 0], [0, 0, 0, 0], [1, 1, 1, 0], [0, 0, 0, 0]]) == 6\n assert candidate(grid = [[1, 0], [1, 1]]) == 3\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]]) == 8\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 12\n assert candidate(grid = [[1, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0]]) == 4\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 13\n assert candidate(grid = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == 8\n assert candidate(grid = [[1, 1, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) == 0\n assert candidate(grid = [[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == 8\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 1], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 0]]) == 4\n assert candidate(grid = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 8\n assert candidate(grid = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 0, 0]]) == 2\n assert candidate(grid = [[1, 0, 1], [0, 0, 0], [1, 0, 1]]) == 4\n assert candidate(grid = [[0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 10\n assert candidate(grid = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 0, 0], [0, 0, 1, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) == 4\n assert candidate(grid = [[0, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) == 0\n assert candidate(grid = [[0, 0, 0], [0, 0, 1], [1, 0, 0], [0, 1, 0]]) == 0\n assert candidate(grid = [[1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 1, 1, 0], [0, 0, 0, 0, 1]]) == 8\n assert candidate(grid = [[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == 6\n assert candidate(grid = [[1, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0]]) == 7\n assert candidate(grid = [[1, 0, 1], [0, 1, 0], [1, 0, 1]]) == 4\n assert candidate(grid = [[1, 0, 0, 1], [0, 0, 0, 0], [0, 1, 0, 0], [1, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 8\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) == 0\n assert candidate(grid = [[0]]) == 0\n assert candidate(grid = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1]]) == 8\n assert candidate(grid = [[1, 1, 0], [1, 0, 0], [0, 0, 1]]) == 3\n assert candidate(grid = [[1, 1, 0], [1, 0, 1], [0, 1, 1]]) == 6\n assert candidate(grid = [[1, 0], [0, 1]]) == 0\n assert candidate(grid = [[1, 1, 0], [0, 0, 0], [0, 0, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 16\n assert candidate(grid = [[1, 1, 0, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1], [1, 0, 0, 0, 0], [0, 1, 0, 0, 0]]) == 4\n assert candidate(grid = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1]]) == 0\n assert candidate(grid = [[0, 0, 0], [0, 1, 0], [0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == 9\n assert candidate(grid = [[1, 1], [1, 1], [1, 1]]) == 6\n assert candidate(grid = [[1, 0, 0, 1], [1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0], [1, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 1, 1]]) == 4\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().countServers", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var countServers = function(grid) {", "container": null, "callable": "countServers", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1268, "task_id": "search-suggestions-system", "difficulty": "Medium", "problem_description": "You are given an array of strings products and a string searchWord.\nDesign a system that suggests at most three product names from products after each character of searchWord is typed. Suggested products should have common prefix with searchWord. If there are more than three products with a common prefix return the three lexicographically minimums products.\nReturn a list of lists of the suggested products after each character of searchWord is typed.\n \nExample 1:\n\nInput: products = [\"mobile\",\"mouse\",\"moneypot\",\"monitor\",\"mousepad\"], searchWord = \"mouse\"\nOutput: [[\"mobile\",\"moneypot\",\"monitor\"],[\"mobile\",\"moneypot\",\"monitor\"],[\"mouse\",\"mousepad\"],[\"mouse\",\"mousepad\"],[\"mouse\",\"mousepad\"]]\nExplanation: products sorted lexicographically = [\"mobile\",\"moneypot\",\"monitor\",\"mouse\",\"mousepad\"].\nAfter typing m and mo all products match and we show user [\"mobile\",\"moneypot\",\"monitor\"].\nAfter typing mou, mous and mouse the system suggests [\"mouse\",\"mousepad\"].\n\nExample 2:\n\nInput: products = [\"havana\"], searchWord = \"havana\"\nOutput: [[\"havana\"],[\"havana\"],[\"havana\"],[\"havana\"],[\"havana\"],[\"havana\"]]\nExplanation: The only word \"havana\" will be always suggested while typing the search word.\n\n \nConstraints:\n\n1 <= products.length <= 1000\n1 <= products[i].length <= 3000\n1 <= sum(products[i].length) <= 2 * 104\nAll the strings of products are unique.\nproducts[i] consists of lowercase English letters.\n1 <= searchWord.length <= 1000\nsearchWord consists of lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(products = ['keyboard', 'keypad', 'keys', 'kick'],searchWord = \"key\") == [['keyboard', 'keypad', 'keys'], ['keyboard', 'keypad', 'keys'], ['keyboard', 'keypad', 'keys']]\n assert candidate(products = ['keyboard', 'keypad', 'mousepad'],searchWord = \"key\") == [['keyboard', 'keypad'], ['keyboard', 'keypad'], ['keyboard', 'keypad']]\n assert candidate(products = ['apple', 'banana', 'grape', 'orange'],searchWord = \"or\") == [['orange'], ['orange']]\n assert candidate(products = ['aaa', 'aaab', 'aaac', 'aab'],searchWord = \"aa\") == [['aaa', 'aaab', 'aaac'], ['aaa', 'aaab', 'aaac']]\n assert candidate(products = ['charger', 'cable', 'case'],searchWord = \"ca\") == [['cable', 'case', 'charger'], ['cable', 'case']]\n assert candidate(products = ['bag', 'bags', 'banner', 'box', 'car'],searchWord = \"ba\") == [['bag', 'bags', 'banner'], ['bag', 'bags', 'banner']]\n assert candidate(products = ['aaa', 'aab', 'aac', 'aad', 'aae'],searchWord = \"aa\") == [['aaa', 'aab', 'aac'], ['aaa', 'aab', 'aac']]\n assert candidate(products = ['aaa', 'aab', 'aac', 'aad'],searchWord = \"aa\") == [['aaa', 'aab', 'aac'], ['aaa', 'aab', 'aac']]\n assert candidate(products = ['apple', 'apples', 'application'],searchWord = \"app\") == [['apple', 'apples', 'application'], ['apple', 'apples', 'application'], ['apple', 'apples', 'application']]\n assert candidate(products = ['apple', 'banana', 'grape', 'orange'],searchWord = \"ba\") == [['banana'], ['banana']]\n assert candidate(products = ['keyboard', 'keypad', 'keyboard', 'keychain'],searchWord = \"key\") == [['keyboard', 'keyboard', 'keychain'], ['keyboard', 'keyboard', 'keychain'], ['keyboard', 'keyboard', 'keychain']]\n assert candidate(products = ['havana'],searchWord = \"havana\") == [['havana'], ['havana'], ['havana'], ['havana'], ['havana'], ['havana']]\n assert candidate(products = ['keyboard', 'keypad', 'kiosk'],searchWord = \"key\") == [['keyboard', 'keypad', 'kiosk'], ['keyboard', 'keypad'], ['keyboard', 'keypad']]\n assert candidate(products = ['apple', 'banana', 'grape', 'orange', 'peach'],searchWord = \"app\") == [['apple'], ['apple'], ['apple']]\n assert candidate(products = ['apple', 'apricot', 'banana', 'bat', 'berry'],searchWord = \"ba\") == [['banana', 'bat', 'berry'], ['banana', 'bat']]\n assert candidate(products = ['keyboard', 'keypad', 'keyboardpad'],searchWord = \"key\") == [['keyboard', 'keyboardpad', 'keypad'], ['keyboard', 'keyboardpad', 'keypad'], ['keyboard', 'keyboardpad', 'keypad']]\n assert candidate(products = ['mobile', 'mouse', 'moneypot', 'monitor', 'mousepad'],searchWord = \"mouse\") == [['mobile', 'moneypot', 'monitor'], ['mobile', 'moneypot', 'monitor'], ['mouse', 'mousepad'], ['mouse', 'mousepad'], ['mouse', 'mousepad']]\n assert candidate(products = ['aardvark', 'aardwolf', 'albatross', 'alligator', 'alpaca', 'antelope', 'anteater'],searchWord = \"aa\") == [['aardvark', 'aardwolf', 'albatross'], ['aardvark', 'aardwolf']]\n assert candidate(products = ['xylophone', 'xylography', 'xylem', 'xenon', 'xerox', 'xerophyte', 'xenodochial'],searchWord = \"xero\") == [['xenodochial', 'xenon', 'xerophyte'], ['xenodochial', 'xenon', 'xerophyte'], ['xerophyte', 'xerox'], ['xerophyte', 'xerox']]\n assert candidate(products = ['jacket', 'jaguar', 'jar', 'jasmine', 'jeep'],searchWord = \"ja\") == [['jacket', 'jaguar', 'jar'], ['jacket', 'jaguar', 'jar']]\n assert candidate(products = ['ant', 'anteater', 'antelope', 'antenna', 'antique', 'antfarm', 'antler'],searchWord = \"ant\") == [['ant', 'anteater', 'antelope'], ['ant', 'anteater', 'antelope'], ['ant', 'anteater', 'antelope']]\n assert candidate(products = ['television', 'telescope', 'temperature', 'tennis', 'tense'],searchWord = \"te\") == [['telescope', 'television', 'temperature'], ['telescope', 'television', 'temperature']]\n assert candidate(products = ['apple', 'apricot', 'banana', 'bat', 'berry', 'blackberry', 'blueberry'],searchWord = \"b\") == [['banana', 'bat', 'berry']]\n assert candidate(products = ['grape', 'grapefruit', 'grapevine', 'graph', 'grapejuice'],searchWord = \"gr\") == [['grape', 'grapefruit', 'grapejuice'], ['grape', 'grapefruit', 'grapejuice']]\n assert candidate(products = ['dog', 'dolphin', 'dome', 'domestic', 'domino'],searchWord = \"dom\") == [['dog', 'dolphin', 'dome'], ['dog', 'dolphin', 'dome'], ['dome', 'domestic', 'domino']]\n assert candidate(products = ['magnifier', 'magnificent', 'magnet', 'magnolia', 'magnitude'],searchWord = \"magn\") == [['magnet', 'magnificent', 'magnifier'], ['magnet', 'magnificent', 'magnifier'], ['magnet', 'magnificent', 'magnifier'], ['magnet', 'magnificent', 'magnifier']]\n assert candidate(products = ['apple', 'application', 'appliance', 'appropriate', 'appetizer'],searchWord = \"appl\") == [['appetizer', 'apple', 'appliance'], ['appetizer', 'apple', 'appliance'], ['appetizer', 'apple', 'appliance'], ['apple', 'appliance', 'application']]\n assert candidate(products = ['grape', 'grapefruit', 'grapejuice', 'graphite', 'grapevine', 'grapefruitjuice'],searchWord = \"grape\") == [['grape', 'grapefruit', 'grapefruitjuice'], ['grape', 'grapefruit', 'grapefruitjuice'], ['grape', 'grapefruit', 'grapefruitjuice'], ['grape', 'grapefruit', 'grapefruitjuice'], ['grape', 'grapefruit', 'grapefruitjuice']]\n assert candidate(products = ['algorithm', 'array', 'binary', 'bit', 'bitset', 'bucket', 'class', 'collection', 'datatype', 'enumerate', 'file', 'float', 'function', 'garbage', 'graph', 'hash', 'id', 'implementation', 'integer', 'java', 'keyword', 'list', 'map', 'namespace', 'None', 'object', 'operator', 'pair', 'pointer', 'queue', 'range', 'reference', 'set', 'stack', 'string', 'struct', 'template', 'typedef', 'union', 'variable', 'while', 'xor'],searchWord = \"algo\") == [['algorithm', 'array'], ['algorithm'], ['algorithm'], ['algorithm']]\n assert candidate(products = ['hamburger', 'hammock', 'hammer', 'hammerhead', 'handheld'],searchWord = \"ham\") == [['hamburger', 'hammer', 'hammerhead'], ['hamburger', 'hammer', 'hammerhead'], ['hamburger', 'hammer', 'hammerhead']]\n assert candidate(products = ['watermelon', 'water', 'wave', 'wonder', 'wonderland'],searchWord = \"wat\") == [['water', 'watermelon', 'wave'], ['water', 'watermelon', 'wave'], ['water', 'watermelon']]\n assert candidate(products = ['amazon', 'amazing', 'ambassador', 'ambient', 'amplifier'],searchWord = \"ambi\") == [['amazing', 'amazon', 'ambassador'], ['amazing', 'amazon', 'ambassador'], ['ambassador', 'ambient'], ['ambient']]\n assert candidate(products = ['xylophone', 'xylography', 'xylophone', 'xylophone', 'xylophone'],searchWord = \"xylo\") == [['xylography', 'xylophone', 'xylophone'], ['xylography', 'xylophone', 'xylophone'], ['xylography', 'xylophone', 'xylophone'], ['xylography', 'xylophone', 'xylophone']]\n assert candidate(products = ['car', 'card', 'cardboard', 'cargo', 'cartoon'],searchWord = \"car\") == [['car', 'card', 'cardboard'], ['car', 'card', 'cardboard'], ['car', 'card', 'cardboard']]\n assert candidate(products = ['abcd', 'abce', 'abcf', 'abcg', 'abch', 'abci', 'abcj', 'abck', 'abcl', 'abcm'],searchWord = \"abc\") == [['abcd', 'abce', 'abcf'], ['abcd', 'abce', 'abcf'], ['abcd', 'abce', 'abcf']]\n assert candidate(products = ['zebra', 'zinc', 'zoo', 'zesty', 'zoning', 'zest', 'zookeeper'],searchWord = \"ze\") == [['zebra', 'zest', 'zesty'], ['zebra', 'zest', 'zesty']]\n assert candidate(products = ['aardvark', 'aardwolf', 'aardvark', 'aardvark', 'aardvark'],searchWord = \"aard\") == [['aardvark', 'aardvark', 'aardvark'], ['aardvark', 'aardvark', 'aardvark'], ['aardvark', 'aardvark', 'aardvark'], ['aardvark', 'aardvark', 'aardvark']]\n assert candidate(products = ['umbrella', 'umber', 'umbilical', 'umbrella', 'umbrella'],searchWord = \"umb\") == [['umber', 'umbilical', 'umbrella'], ['umber', 'umbilical', 'umbrella'], ['umber', 'umbilical', 'umbrella']]\n assert candidate(products = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij'],searchWord = \"abcdefghijk\") == [['a', 'ab', 'abc'], ['ab', 'abc', 'abcd'], ['abc', 'abcd', 'abcde'], ['abcd', 'abcde', 'abcdef'], ['abcde', 'abcdef', 'abcdefg'], ['abcdef', 'abcdefg', 'abcdefgh'], ['abcdefg', 'abcdefgh', 'abcdefghi'], ['abcdefgh', 'abcdefghi', 'abcdefghij'], ['abcdefghi', 'abcdefghij'], ['abcdefghij'], []]\n assert candidate(products = ['apple', 'apricot', 'banana', 'bat', 'berry', 'blueberry', 'blackberry'],searchWord = \"ba\") == [['banana', 'bat', 'berry'], ['banana', 'bat']]\n assert candidate(products = ['zebra', 'zebrafish', 'zebrafly', 'zebratail', 'zebralight', 'zebrashoe', 'zebragram', 'zebratic', 'zebrastriped'],searchWord = \"zebra\") == [['zebra', 'zebrafish', 'zebrafly'], ['zebra', 'zebrafish', 'zebrafly'], ['zebra', 'zebrafish', 'zebrafly'], ['zebra', 'zebrafish', 'zebrafly'], ['zebra', 'zebrafish', 'zebrafly']]\n assert candidate(products = ['infinite', 'infinity', 'infinitesimal', 'infinity', 'infinitary'],searchWord = \"inf\") == [['infinitary', 'infinite', 'infinitesimal'], ['infinitary', 'infinite', 'infinitesimal'], ['infinitary', 'infinite', 'infinitesimal']]\n assert candidate(products = ['orange', 'oregano', 'organ', 'organize', 'organism'],searchWord = \"org\") == [['orange', 'oregano', 'organ'], ['orange', 'oregano', 'organ'], ['organ', 'organism', 'organize']]\n assert candidate(products = ['xenon', 'xerox', 'xenophobe', 'xenial', 'xenolith', 'xenoliths', 'xenonarc', 'xenonarcosis', 'xenolithologist'],searchWord = \"xen\") == [['xenial', 'xenolith', 'xenolithologist'], ['xenial', 'xenolith', 'xenolithologist'], ['xenial', 'xenolith', 'xenolithologist']]\n assert candidate(products = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aab', 'aac', 'aad', 'aaf', 'aag'],searchWord = \"aa\") == [['a', 'aa', 'aaa'], ['aa', 'aaa', 'aaaa']]\n assert candidate(products = ['laptop', 'laptopbag', 'laser', 'lateral', 'latitude'],searchWord = \"lap\") == [['laptop', 'laptopbag', 'laser'], ['laptop', 'laptopbag', 'laser'], ['laptop', 'laptopbag']]\n assert candidate(products = ['cherry', 'cranberry', 'cantaloupe', 'carrot', 'corn', 'cucumber'],searchWord = \"car\") == [['cantaloupe', 'carrot', 'cherry'], ['cantaloupe', 'carrot'], ['carrot']]\n assert candidate(products = ['umbrella', 'umbrella', 'umbrella', 'umbrella', 'umbrella', 'umbrella', 'umbrella', 'umbrella', 'umbrella', 'umbrella'],searchWord = \"umbrella\") == [['umbrella', 'umbrella', 'umbrella'], ['umbrella', 'umbrella', 'umbrella'], ['umbrella', 'umbrella', 'umbrella'], ['umbrella', 'umbrella', 'umbrella'], ['umbrella', 'umbrella', 'umbrella'], ['umbrella', 'umbrella', 'umbrella'], ['umbrella', 'umbrella', 'umbrella'], ['umbrella', 'umbrella', 'umbrella']]\n assert candidate(products = ['aardvark', 'aardwolf', 'albatross', 'albino', 'alligator', 'alpaca', 'almighty'],searchWord = \"al\") == [['aardvark', 'aardwolf', 'albatross'], ['albatross', 'albino', 'alligator']]\n assert candidate(products = ['zebra', 'zealot', 'zealous', 'zebrafish', 'zebra', 'zebrahead'],searchWord = \"ze\") == [['zealot', 'zealous', 'zebra'], ['zealot', 'zealous', 'zebra']]\n assert candidate(products = ['navigate', 'navigation', 'navigator', 'navy', 'navel'],searchWord = \"nav\") == [['navel', 'navigate', 'navigation'], ['navel', 'navigate', 'navigation'], ['navel', 'navigate', 'navigation']]\n assert candidate(products = ['electronics', 'electric', 'elephant', 'elbow', 'eleven'],searchWord = \"ele\") == [['elbow', 'electric', 'electronics'], ['elbow', 'electric', 'electronics'], ['electric', 'electronics', 'elephant']]\n assert candidate(products = ['apple', 'apricot', 'banana', 'bat', 'berry', 'blackberry', 'blueberry', 'bluebird', 'bluetooth'],searchWord = \"bl\") == [['banana', 'bat', 'berry'], ['blackberry', 'blueberry', 'bluebird']]\n assert candidate(products = ['abacaxi', 'abalone', 'abana', 'abanga', 'abaperture', 'abara', 'abaraxas', 'abarth', 'abart', 'abat', 'abate', 'abati', 'abatis', 'abator', 'abatt', 'abature', 'abavure', 'abaya', 'abaze', 'abba', 'abbe', 'abbe', 'abbe', 'abbe', 'abbe', 'abbe', 'abbe', 'abbe', 'abbe', 'abbe'],searchWord = \"ab\") == [['abacaxi', 'abalone', 'abana'], ['abacaxi', 'abalone', 'abana']]\n assert candidate(products = ['applepie', 'applesauce', 'appleskin', 'apple', 'applejack'],searchWord = \"appl\") == [['apple', 'applejack', 'applepie'], ['apple', 'applejack', 'applepie'], ['apple', 'applejack', 'applepie'], ['apple', 'applejack', 'applepie']]\n assert candidate(products = ['camera', 'camcorder', 'cameralens', 'cameraman', 'cameraobscura', 'camouflage', 'camcorder', 'camera', 'camcorder'],searchWord = \"cam\") == [['camcorder', 'camcorder', 'camcorder'], ['camcorder', 'camcorder', 'camcorder'], ['camcorder', 'camcorder', 'camcorder']]\n assert candidate(products = ['chocolate', 'chocolatebar', 'chocolatechip', 'chocolate', 'chocolatefudge'],searchWord = \"chocolate\") == [['chocolate', 'chocolate', 'chocolatebar'], ['chocolate', 'chocolate', 'chocolatebar'], ['chocolate', 'chocolate', 'chocolatebar'], ['chocolate', 'chocolate', 'chocolatebar'], ['chocolate', 'chocolate', 'chocolatebar'], ['chocolate', 'chocolate', 'chocolatebar'], ['chocolate', 'chocolate', 'chocolatebar'], ['chocolate', 'chocolate', 'chocolatebar'], ['chocolate', 'chocolate', 'chocolatebar']]\n assert candidate(products = ['queen', 'queens', 'queenship', 'queer', 'queue'],searchWord = \"quee\") == [['queen', 'queens', 'queenship'], ['queen', 'queens', 'queenship'], ['queen', 'queens', 'queenship'], ['queen', 'queens', 'queenship']]\n assert candidate(products = ['apple', 'apricot', 'avocado', 'banana', 'bat', 'berry', 'blackberry', 'blueberry', 'cherry', 'cantaloupe', 'cranberry'],searchWord = \"ap\") == [['apple', 'apricot', 'avocado'], ['apple', 'apricot']]\n assert candidate(products = ['applepie', 'applesauce', 'apple', 'appletart', 'apples', 'apricot'],searchWord = \"apple\") == [['apple', 'applepie', 'apples'], ['apple', 'applepie', 'apples'], ['apple', 'applepie', 'apples'], ['apple', 'applepie', 'apples'], ['apple', 'applepie', 'apples']]\n assert candidate(products = ['guitar', 'guitarcase', 'guitarhero', 'guitarpick', 'guitarstand', 'guitartuner', 'guitarstring'],searchWord = \"gu\") == [['guitar', 'guitarcase', 'guitarhero'], ['guitar', 'guitarcase', 'guitarhero']]\n assert candidate(products = ['ocean', 'ocelot', 'octopus', 'octagon', 'octagonal'],searchWord = \"oct\") == [['ocean', 'ocelot', 'octagon'], ['ocean', 'ocelot', 'octagon'], ['octagon', 'octagonal', 'octopus']]\n assert candidate(products = ['elephant', 'elephant', 'elephant', 'elephant', 'elephant', 'elephant', 'elephant', 'elephant', 'elephant', 'elephant'],searchWord = \"elephant\") == [['elephant', 'elephant', 'elephant'], ['elephant', 'elephant', 'elephant'], ['elephant', 'elephant', 'elephant'], ['elephant', 'elephant', 'elephant'], ['elephant', 'elephant', 'elephant'], ['elephant', 'elephant', 'elephant'], ['elephant', 'elephant', 'elephant'], ['elephant', 'elephant', 'elephant']]\n assert candidate(products = ['chocolate', 'chips', 'chipmunk', 'cheese', 'cherry', 'chili'],searchWord = \"ch\") == [['cheese', 'cherry', 'chili'], ['cheese', 'cherry', 'chili']]\n assert candidate(products = ['abcd', 'abce', 'abcf', 'abcg', 'abch'],searchWord = \"abc\") == [['abcd', 'abce', 'abcf'], ['abcd', 'abce', 'abcf'], ['abcd', 'abce', 'abcf']]\n assert candidate(products = ['zebra', 'zulu', 'zymurgy', 'zestful', 'zestfully', 'zestless', 'zippy', 'zoo', 'zoology', 'zucchini'],searchWord = \"zoo\") == [['zebra', 'zestful', 'zestfully'], ['zoo', 'zoology'], ['zoo', 'zoology']]\n assert candidate(products = ['fishing', 'fishtank', 'fish', 'fishmonger', 'fisherman', 'fishhook', 'fishnet'],searchWord = \"fish\") == [['fish', 'fisherman', 'fishhook'], ['fish', 'fisherman', 'fishhook'], ['fish', 'fisherman', 'fishhook'], ['fish', 'fisherman', 'fishhook']]\n assert candidate(products = ['watermelon', 'water', 'waterproof', 'watering', 'waterfall', 'watermelon', 'watercolor', 'watergun', 'watermelon', 'watermark'],searchWord = \"waterm\") == [['water', 'watercolor', 'waterfall'], ['water', 'watercolor', 'waterfall'], ['water', 'watercolor', 'waterfall'], ['water', 'watercolor', 'waterfall'], ['water', 'watercolor', 'waterfall'], ['watermark', 'watermelon', 'watermelon']]\n assert candidate(products = ['banana', 'band', 'bangalore', 'bank', 'banner'],searchWord = \"ban\") == [['banana', 'band', 'bangalore'], ['banana', 'band', 'bangalore'], ['banana', 'band', 'bangalore']]\n assert candidate(products = ['paint', 'painter', 'painting', 'paintball', 'paintbrush'],searchWord = \"pain\") == [['paint', 'paintball', 'paintbrush'], ['paint', 'paintball', 'paintbrush'], ['paint', 'paintball', 'paintbrush'], ['paint', 'paintball', 'paintbrush']]\n assert candidate(products = ['xyz', 'xylophone', 'xylography', 'xylograph', 'xylography', 'xylographer', 'xylographs', 'xylography', 'xylography'],searchWord = \"xylo\") == [['xylograph', 'xylographer', 'xylographs'], ['xylograph', 'xylographer', 'xylographs'], ['xylograph', 'xylographer', 'xylographs'], ['xylograph', 'xylographer', 'xylographs']]\n assert candidate(products = ['microphone', 'microwave', 'microscope', 'microphone', 'micronutrient'],searchWord = \"micr\") == [['micronutrient', 'microphone', 'microphone'], ['micronutrient', 'microphone', 'microphone'], ['micronutrient', 'microphone', 'microphone'], ['micronutrient', 'microphone', 'microphone']]\n assert candidate(products = ['flower', 'flour', 'flow', 'flourish', 'flourmill'],searchWord = \"flow\") == [['flour', 'flourish', 'flourmill'], ['flour', 'flourish', 'flourmill'], ['flour', 'flourish', 'flourmill'], ['flow', 'flower']]\n assert candidate(products = ['car', 'card', 'care', 'careful', 'careless'],searchWord = \"ca\") == [['car', 'card', 'care'], ['car', 'card', 'care']]\n assert candidate(products = ['football', 'footwear', 'footbridge', 'footnote', 'footrest', 'footlocker', 'footrace', 'footlight'],searchWord = \"foot\") == [['football', 'footbridge', 'footlight'], ['football', 'footbridge', 'footlight'], ['football', 'footbridge', 'footlight'], ['football', 'footbridge', 'footlight']]\n assert candidate(products = ['bicycle', 'bicycling', 'bicycle', 'bicycle', 'bicycle'],searchWord = \"bicy\") == [['bicycle', 'bicycle', 'bicycle'], ['bicycle', 'bicycle', 'bicycle'], ['bicycle', 'bicycle', 'bicycle'], ['bicycle', 'bicycle', 'bicycle']]\n assert candidate(products = ['giraffe', 'giraffe', 'giraffe', 'giraffe', 'giraffe', 'giraffe', 'giraffe', 'giraffe', 'giraffe', 'giraffe'],searchWord = \"giraff\") == [['giraffe', 'giraffe', 'giraffe'], ['giraffe', 'giraffe', 'giraffe'], ['giraffe', 'giraffe', 'giraffe'], ['giraffe', 'giraffe', 'giraffe'], ['giraffe', 'giraffe', 'giraffe'], ['giraffe', 'giraffe', 'giraffe']]\n assert candidate(products = ['strawberry', 'straw', 'stratosphere', 'stranger', 'strategy'],searchWord = \"stra\") == [['stranger', 'strategy', 'stratosphere'], ['stranger', 'strategy', 'stratosphere'], ['stranger', 'strategy', 'stratosphere'], ['stranger', 'strategy', 'stratosphere']]\n assert candidate(products = ['apple', 'apricot', 'banana', 'bat', 'berry', 'blackberry', 'blueberry'],searchWord = \"ba\") == [['banana', 'bat', 'berry'], ['banana', 'bat']]\n assert candidate(products = ['watermelon', 'water', 'waterfall', 'watershed', 'watercolor'],searchWord = \"water\") == [['water', 'watercolor', 'waterfall'], ['water', 'watercolor', 'waterfall'], ['water', 'watercolor', 'waterfall'], ['water', 'watercolor', 'waterfall'], ['water', 'watercolor', 'waterfall']]\n assert candidate(products = ['computer', 'computational', 'compute', 'computing', 'computerized'],searchWord = \"compute\") == [['computational', 'compute', 'computer'], ['computational', 'compute', 'computer'], ['computational', 'compute', 'computer'], ['computational', 'compute', 'computer'], ['computational', 'compute', 'computer'], ['computational', 'compute', 'computer'], ['compute', 'computer', 'computerized']]\n assert candidate(products = ['photography', 'photoalbum', 'photobook', 'photoframe', 'photograph', 'photokino', 'photocopy', 'photography'],searchWord = \"phot\") == [['photoalbum', 'photobook', 'photocopy'], ['photoalbum', 'photobook', 'photocopy'], ['photoalbum', 'photobook', 'photocopy'], ['photoalbum', 'photobook', 'photocopy']]\n assert candidate(products = ['strawberry', 'straw', 'strange', 'strategy', 'stranger'],searchWord = \"stra\") == [['strange', 'stranger', 'strategy'], ['strange', 'stranger', 'strategy'], ['strange', 'stranger', 'strategy'], ['strange', 'stranger', 'strategy']]\n assert candidate(products = ['elephant', 'elephantine', 'elegant', 'elevate', 'elementary'],searchWord = \"ele\") == [['elegant', 'elementary', 'elephant'], ['elegant', 'elementary', 'elephant'], ['elegant', 'elementary', 'elephant']]\n assert candidate(products = ['orange', 'ornament', 'organ', 'orchid', 'orchard', 'organize'],searchWord = \"or\") == [['orange', 'orchard', 'orchid'], ['orange', 'orchard', 'orchid']]\n assert candidate(products = ['aaab', 'aaac', 'aaad', 'aaae', 'aaaf', 'aaag', 'aaah', 'aaai', 'aaaj', 'aaak', 'aaal', 'aaam', 'aaan', 'aaao', 'aaap', 'aaaq', 'aaar', 'aaas', 'aaat', 'aaau', 'aaav', 'aaaw', 'aaax', 'aaay', 'aaaz'],searchWord = \"aaa\") == [['aaab', 'aaac', 'aaad'], ['aaab', 'aaac', 'aaad'], ['aaab', 'aaac', 'aaad']]\n assert candidate(products = ['piano', 'piano', 'piano', 'piano', 'piano', 'piano', 'piano', 'piano', 'piano', 'piano'],searchWord = \"piano\") == [['piano', 'piano', 'piano'], ['piano', 'piano', 'piano'], ['piano', 'piano', 'piano'], ['piano', 'piano', 'piano'], ['piano', 'piano', 'piano']]\n assert candidate(products = ['firefly', 'fireworks', 'firefly', 'firearm', 'firetruck', 'firewall', 'firefly', 'firefly', 'firefly', 'firefly'],searchWord = \"fire\") == [['firearm', 'firefly', 'firefly'], ['firearm', 'firefly', 'firefly'], ['firearm', 'firefly', 'firefly'], ['firearm', 'firefly', 'firefly']]\n assert candidate(products = ['internet', 'interact', 'interest', 'interior', 'interfere'],searchWord = \"inte\") == [['interact', 'interest', 'interfere'], ['interact', 'interest', 'interfere'], ['interact', 'interest', 'interfere'], ['interact', 'interest', 'interfere']]\n assert candidate(products = ['computer', 'compute', 'computation', 'compositor', 'composite', 'compress', 'compression', 'compressor', 'compressed'],searchWord = \"compre\") == [['composite', 'compositor', 'compress'], ['composite', 'compositor', 'compress'], ['composite', 'compositor', 'compress'], ['composite', 'compositor', 'compress'], ['compress', 'compressed', 'compression'], ['compress', 'compressed', 'compression']]\n assert candidate(products = ['apple', 'banana', 'cherry', 'date', 'elderberry', 'fig', 'grape', 'honeydew', 'kiwi', 'lemon', 'mango', 'nectarine', 'orange', 'papaya', 'quince', 'raspberry', 'strawberry', 'tangerine', 'ugli', 'vanilla', 'watermelon', 'xigua', 'yellow', 'zucchini'],searchWord = \"a\") == [['apple']]\n assert candidate(products = ['dog', 'doghouse', 'dogwood', 'dog', 'doghouse'],searchWord = \"dog\") == [['dog', 'dog', 'doghouse'], ['dog', 'dog', 'doghouse'], ['dog', 'dog', 'doghouse']]\n assert candidate(products = ['abcd', 'abce', 'abcg', 'abch', 'abci', 'abcj', 'abck', 'abcl', 'abcm', 'abcn', 'abcd', 'abce', 'abcg', 'abch', 'abci', 'abcj', 'abck', 'abcl', 'abcm', 'abcn'],searchWord = \"abc\") == [['abcd', 'abcd', 'abce'], ['abcd', 'abcd', 'abce'], ['abcd', 'abcd', 'abce']]\n assert candidate(products = ['radio', 'radiance', 'radiant', 'radioactive', 'radioactivity'],searchWord = \"radi\") == [['radiance', 'radiant', 'radio'], ['radiance', 'radiant', 'radio'], ['radiance', 'radiant', 'radio'], ['radiance', 'radiant', 'radio']]\n assert candidate(products = ['keyboard', 'keychain', 'keyhole', 'keylogger', 'keynote'],searchWord = \"key\") == [['keyboard', 'keychain', 'keyhole'], ['keyboard', 'keychain', 'keyhole'], ['keyboard', 'keychain', 'keyhole']]\n assert candidate(products = ['starship', 'stars', 'start', 'star', 'startrek', 'starfish'],searchWord = \"star\") == [['star', 'starfish', 'stars'], ['star', 'starfish', 'stars'], ['star', 'starfish', 'stars'], ['star', 'starfish', 'stars']]\n assert candidate(products = ['ant', 'antelope', 'antibody', 'antacid', 'antaeus', 'antarctica', 'anteater', 'antelope', 'antelope', 'antler'],searchWord = \"ante\") == [['ant', 'antacid', 'antaeus'], ['ant', 'antacid', 'antaeus'], ['ant', 'antacid', 'antaeus'], ['anteater', 'antelope', 'antelope']]\n assert candidate(products = ['dog', 'dove', 'donkey', 'dragon', 'drone', 'drill', 'door'],searchWord = \"dr\") == [['dog', 'donkey', 'door'], ['dragon', 'drill', 'drone']]\n assert candidate(products = ['guitar', 'guitarist', 'guilt', 'guilty', 'gully'],searchWord = \"guil\") == [['guilt', 'guilty', 'guitar'], ['guilt', 'guilty', 'guitar'], ['guilt', 'guilty', 'guitar'], ['guilt', 'guilty']]\n assert candidate(products = ['algorithm', 'algebra', 'alabama', 'alaska', 'alligator'],searchWord = \"al\") == [['alabama', 'alaska', 'algebra'], ['alabama', 'alaska', 'algebra']]\n assert candidate(products = ['zebra', 'zebrafish', 'zebra', 'zebrahead', 'zebra'],searchWord = \"zebra\") == [['zebra', 'zebra', 'zebra'], ['zebra', 'zebra', 'zebra'], ['zebra', 'zebra', 'zebra'], ['zebra', 'zebra', 'zebra'], ['zebra', 'zebra', 'zebra']]\n assert candidate(products = ['abcd', 'abce', 'abcf', 'abcg', 'abch', 'abci', 'abcj', 'abck', 'abcl', 'abcm', 'abcn'],searchWord = \"abcd\") == [['abcd', 'abce', 'abcf'], ['abcd', 'abce', 'abcf'], ['abcd', 'abce', 'abcf'], ['abcd']]\n assert candidate(products = ['zebra', 'zeal', 'zero', 'zone', 'zoo', 'zap', 'zest'],searchWord = \"ze\") == [['zap', 'zeal', 'zebra'], ['zeal', 'zebra', 'zero']]\n assert candidate(products = ['zebra', 'zoo', 'zoom', 'zoning', 'zone', 'zany', 'zap', 'zest', 'zigzag', 'zither'],searchWord = \"z\") == [['zany', 'zap', 'zebra']]\n assert candidate(products = ['piano', 'piccolo', 'pipe', 'pipeorgan', 'pitchfork'],searchWord = \"pi\") == [['piano', 'piccolo', 'pipe'], ['piano', 'piccolo', 'pipe']]\n assert candidate(products = ['umbrella', 'underwear', 'universe', 'unique', 'unit', 'unity', 'university', 'unicycle', 'unicorn', 'unzip'],searchWord = \"uni\") == [['umbrella', 'underwear', 'unicorn'], ['underwear', 'unicorn', 'unicycle'], ['unicorn', 'unicycle', 'unique']]\n assert candidate(products = ['product', 'produces', 'productivity', 'productive', 'productize', 'production', 'productivity', 'productize', 'productivity', 'productize'],searchWord = \"product\") == [['produces', 'product', 'production'], ['produces', 'product', 'production'], ['produces', 'product', 'production'], ['produces', 'product', 'production'], ['produces', 'product', 'production'], ['produces', 'product', 'production'], ['product', 'production', 'productive']]\n assert candidate(products = ['umbrella', 'umbilical', 'umbrella', 'umbrella', 'umbrella'],searchWord = \"umb\") == [['umbilical', 'umbrella', 'umbrella'], ['umbilical', 'umbrella', 'umbrella'], ['umbilical', 'umbrella', 'umbrella']]\n assert candidate(products = ['banana', 'bandanna', 'bandage', 'band', 'bandwidth'],searchWord = \"band\") == [['banana', 'band', 'bandage'], ['banana', 'band', 'bandage'], ['banana', 'band', 'bandage'], ['band', 'bandage', 'bandanna']]\n"}, "metadata": {"canonical_parameter_names": ["products", "searchWord"], "leetcode_dataset_entry_point": "Solution().suggestedProducts", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var suggestedProducts = function(products, searchWord) {", "container": null, "callable": "suggestedProducts", "parameters": [{"name": "products", "type": "string[]"}, {"name": "searchWord", "type": "string"}], "return_type": "string[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1269, "task_id": "number-of-ways-to-stay-in-the-same-place-after-some-steps", "difficulty": "Hard", "problem_description": "You have a pointer at index 0 in an array of size arrLen. At each step, you can move 1 position to the left, 1 position to the right in the array, or stay in the same place (The pointer should not be placed outside the array at any time).\nGiven two integers steps and arrLen, return the number of ways such that your pointer is still at index 0 after exactly steps steps. Since the answer may be too large, return it modulo 109 + 7.\n \nExample 1:\n\nInput: steps = 3, arrLen = 2\nOutput: 4\nExplanation: There are 4 differents ways to stay at index 0 after 3 steps.\nRight, Left, Stay\nStay, Right, Left\nRight, Stay, Left\nStay, Stay, Stay\n\nExample 2:\n\nInput: steps = 2, arrLen = 4\nOutput: 2\nExplanation: There are 2 differents ways to stay at index 0 after 2 steps\nRight, Left\nStay, Stay\n\nExample 3:\n\nInput: steps = 4, arrLen = 2\nOutput: 8\n\n \nConstraints:\n\n1 <= steps <= 500\n1 <= arrLen <= 106\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(steps = 5,arrLen = 3) == 21\n assert candidate(steps = 10,arrLen = 5) == 2187\n assert candidate(steps = 5,arrLen = 5) == 21\n assert candidate(steps = 2,arrLen = 4) == 2\n assert candidate(steps = 3,arrLen = 2) == 4\n assert candidate(steps = 10,arrLen = 1) == 1\n assert candidate(steps = 10,arrLen = 3) == 1682\n assert candidate(steps = 1,arrLen = 3) == 1\n assert candidate(steps = 4,arrLen = 2) == 8\n assert candidate(steps = 350,arrLen = 150) == 426619980\n assert candidate(steps = 20,arrLen = 10) == 50852018\n assert candidate(steps = 100,arrLen = 1000000) == 345787718\n assert candidate(steps = 200,arrLen = 10) == 27369014\n assert candidate(steps = 300,arrLen = 500) == 337584699\n assert candidate(steps = 200,arrLen = 1000) == 404113244\n assert candidate(steps = 250,arrLen = 100000) == 266783101\n assert candidate(steps = 250,arrLen = 250) == 266783101\n assert candidate(steps = 1,arrLen = 5) == 1\n assert candidate(steps = 200,arrLen = 50) == 228436718\n assert candidate(steps = 400,arrLen = 150) == 792402924\n assert candidate(steps = 100,arrLen = 5) == 361798919\n assert candidate(steps = 300,arrLen = 300) == 337584699\n assert candidate(steps = 150,arrLen = 100) == 924870032\n assert candidate(steps = 300,arrLen = 1) == 1\n assert candidate(steps = 400,arrLen = 10000) == 990505357\n assert candidate(steps = 100,arrLen = 20) == 227326058\n assert candidate(steps = 400,arrLen = 500) == 990505357\n assert candidate(steps = 400,arrLen = 20) == 378873335\n assert candidate(steps = 450,arrLen = 1000) == 679622497\n assert candidate(steps = 100,arrLen = 250) == 345787718\n assert candidate(steps = 7,arrLen = 7) == 127\n assert candidate(steps = 300,arrLen = 10) == 202608062\n assert candidate(steps = 100,arrLen = 500) == 345787718\n assert candidate(steps = 250,arrLen = 2) == 771819109\n assert candidate(steps = 200,arrLen = 300) == 404113244\n assert candidate(steps = 450,arrLen = 900) == 679622497\n assert candidate(steps = 150,arrLen = 50) == 700273839\n assert candidate(steps = 400,arrLen = 1) == 1\n assert candidate(steps = 50,arrLen = 5) == 316310597\n assert candidate(steps = 200,arrLen = 5) == 143744346\n assert candidate(steps = 30,arrLen = 5) == 559846999\n assert candidate(steps = 300,arrLen = 1000) == 337584699\n assert candidate(steps = 150,arrLen = 200) == 924870032\n assert candidate(steps = 20,arrLen = 5) == 44991659\n assert candidate(steps = 100,arrLen = 1000) == 345787718\n assert candidate(steps = 300,arrLen = 100) == 266213554\n assert candidate(steps = 350,arrLen = 350) == 47176184\n assert candidate(steps = 125,arrLen = 75) == 534594928\n assert candidate(steps = 150,arrLen = 10) == 809029961\n assert candidate(steps = 450,arrLen = 250) == 679622497\n assert candidate(steps = 250,arrLen = 1000) == 266783101\n assert candidate(steps = 150,arrLen = 1) == 1\n assert candidate(steps = 400,arrLen = 200) == 990505356\n assert candidate(steps = 120,arrLen = 300) == 991528385\n assert candidate(steps = 200,arrLen = 500000) == 404113244\n assert candidate(steps = 450,arrLen = 500) == 679622497\n assert candidate(steps = 180,arrLen = 10) == 513914322\n assert candidate(steps = 3,arrLen = 10) == 4\n assert candidate(steps = 100,arrLen = 10) == 836991026\n assert candidate(steps = 250,arrLen = 100) == 694490842\n assert candidate(steps = 250,arrLen = 5000) == 266783101\n assert candidate(steps = 250,arrLen = 10) == 321394621\n assert candidate(steps = 50,arrLen = 10) == 48059843\n assert candidate(steps = 250,arrLen = 50) == 739582172\n assert candidate(steps = 400,arrLen = 2) == 99483769\n"}, "metadata": {"canonical_parameter_names": ["steps", "arrLen"], "leetcode_dataset_entry_point": "Solution().numWays", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numWays = function(steps, arrLen) {", "container": null, "callable": "numWays", "parameters": [{"name": "steps", "type": "number"}, {"name": "arrLen", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1275, "task_id": "find-winner-on-a-tic-tac-toe-game", "difficulty": "Easy", "problem_description": "Tic-tac-toe is played by two players A and B on a 3 x 3 grid. The rules of Tic-Tac-Toe are:\n\nPlayers take turns placing characters into empty squares ' '.\nThe first player A always places 'X' characters, while the second player B always places 'O' characters.\n'X' and 'O' characters are always placed into empty squares, never on filled ones.\nThe game ends when there are three of the same (non-empty) character filling any row, column, or diagonal.\nThe game also ends if all squares are non-empty.\nNo more moves can be played if the game is over.\n\nGiven a 2D integer array moves where moves[i] = [rowi, coli] indicates that the ith move will be played on grid[rowi][coli]. return the winner of the game if it exists (A or B). In case the game ends in a draw return \"Draw\". If there are still movements to play return \"Pending\".\nYou can assume that moves is valid (i.e., it follows the rules of Tic-Tac-Toe), the grid is initially empty, and A will play first.\n \nExample 1:\n\n\nInput: moves = [[0,0],[2,0],[1,1],[2,1],[2,2]]\nOutput: \"A\"\nExplanation: A wins, they always play first.\n\nExample 2:\n\n\nInput: moves = [[0,0],[1,1],[0,1],[0,2],[1,0],[2,0]]\nOutput: \"B\"\nExplanation: B wins.\n\nExample 3:\n\n\nInput: moves = [[0,0],[1,1],[2,0],[1,0],[1,2],[2,1],[0,1],[0,2],[2,2]]\nOutput: \"Draw\"\nExplanation: The game ends in a draw since there are no moves to make.\n\n \nConstraints:\n\n1 <= moves.length <= 9\nmoves[i].length == 2\n0 <= rowi, coli <= 2\nThere are no repeated elements on moves.\nmoves follow the rules of tic tac toe.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(moves = [[0, 0], [1, 1], [2, 2], [1, 0], [1, 2], [2, 0], [2, 1]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [2, 0], [1, 1], [2, 1], [2, 2]]) == \"A\"\n assert candidate(moves = [[0, 2], [1, 1], [2, 0]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 2], [0, 2], [0, 1], [1, 0], [2, 0], [2, 1], [1, 2]]) == \"Draw\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 0], [1, 0], [1, 2], [2, 1]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [0, 1], [0, 2], [1, 0], [2, 0]]) == \"B\"\n assert candidate(moves = [[0, 0], [0, 1], [0, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 0], [1, 0], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 2], [0, 2], [1, 0], [2, 0]]) == \"B\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 2], [0, 1], [1, 2], [2, 0], [1, 0]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [2, 2], [1, 1], [2, 0], [2, 1], [0, 2], [1, 0], [1, 2], [0, 1]]) == \"A\"\n assert candidate(moves = [[0, 0], [2, 0], [0, 1], [1, 1], [0, 2], [2, 1], [2, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 1], [0, 1], [0, 2], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 2], [0, 1], [1, 2], [2, 0], [0, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 0], [1, 0], [1, 2], [2, 1], [0, 1], [0, 2], [2, 2]]) == \"Draw\"\n assert candidate(moves = [[0, 0], [2, 0], [1, 1], [2, 1], [1, 2], [0, 1], [0, 2], [1, 0], [2, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 0], [0, 1], [1, 0], [2, 1], [0, 2], [1, 2], [2, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 1], [0, 1], [0, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 2], [2, 0], [1, 1], [2, 1], [0, 1], [0, 0], [1, 0]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [2, 2], [1, 1], [0, 1], [2, 1], [0, 2], [2, 0]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [2, 2], [1, 1]]) == \"Pending\"\n assert candidate(moves = [[0, 2], [1, 1], [0, 1], [0, 0], [1, 2], [2, 0], [2, 2], [2, 1]]) == \"Pending\"\n assert candidate(moves = [[1, 0], [0, 0], [1, 1], [0, 1], [2, 0], [0, 2], [2, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 2], [2, 0], [1, 1], [1, 0], [0, 0], [2, 2], [2, 1], [0, 1], [1, 2]]) == \"Draw\"\n assert candidate(moves = [[2, 0], [1, 1], [0, 2], [0, 0], [1, 0], [1, 2], [2, 2], [2, 1], [0, 1]]) == \"Draw\"\n assert candidate(moves = [[0, 0], [2, 2], [1, 1], [0, 2], [1, 2], [2, 1], [0, 1]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [0, 2], [1, 0], [1, 2], [2, 0]]) == \"Pending\"\n assert candidate(moves = [[2, 1], [0, 0], [1, 1], [1, 0], [2, 0], [1, 2], [2, 2], [0, 1], [0, 2]]) == \"A\"\n assert candidate(moves = [[1, 0], [2, 0], [0, 0], [0, 1], [1, 1], [2, 1], [0, 2], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[2, 0], [1, 1], [0, 0], [1, 0], [2, 1], [2, 2], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [1, 0], [0, 2], [2, 0], [2, 1], [1, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 1], [0, 2], [2, 0], [1, 0]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [2, 2], [0, 1], [1, 1], [2, 0], [0, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 2], [1, 1], [2, 0], [0, 0], [2, 2], [1, 0], [2, 1]]) == \"A\"\n assert candidate(moves = [[0, 1], [2, 0], [1, 1], [0, 0], [2, 2], [1, 2], [0, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 0], [0, 1], [1, 1], [0, 2], [2, 0], [2, 1], [2, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [0, 1], [1, 1], [0, 2], [2, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 0], [2, 0], [1, 1], [1, 2], [2, 2], [2, 1]]) == \"Pending\"\n assert candidate(moves = [[0, 2], [1, 1], [0, 1], [0, 0], [1, 0], [2, 2], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[2, 1], [1, 1], [0, 0], [0, 1], [0, 2], [2, 0], [2, 2], [1, 0], [1, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 0], [2, 0], [1, 1], [0, 1], [2, 1], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [0, 1], [0, 2], [1, 0], [2, 0], [2, 1]]) == \"Pending\"\n assert candidate(moves = [[2, 0], [1, 1], [0, 0], [2, 1], [0, 1], [2, 2]]) == \"Pending\"\n assert candidate(moves = [[2, 2], [0, 0], [0, 2], [2, 0], [1, 1], [1, 0], [2, 1]]) == \"Pending\"\n assert candidate(moves = [[2, 0], [1, 1], [0, 0], [1, 0], [2, 2], [0, 2], [2, 1]]) == \"A\"\n assert candidate(moves = [[0, 0], [2, 0], [1, 1], [1, 0], [0, 2], [2, 1], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[2, 2], [0, 0], [1, 0], [0, 1], [1, 1], [0, 2]]) == \"B\"\n assert candidate(moves = [[0, 0], [2, 0], [1, 0], [0, 1], [2, 1], [0, 2], [1, 1]]) == \"Pending\"\n assert candidate(moves = [[0, 2], [1, 1], [2, 2], [1, 0], [0, 1], [0, 0], [2, 0]]) == \"Pending\"\n assert candidate(moves = [[1, 1], [2, 0], [0, 2], [1, 0], [0, 0], [1, 2], [2, 1], [2, 2]]) == \"Pending\"\n assert candidate(moves = [[1, 1], [2, 0], [1, 0], [0, 0], [1, 2], [2, 1], [0, 1]]) == \"A\"\n assert candidate(moves = [[2, 0], [1, 1], [0, 0], [0, 2], [2, 2], [1, 2], [1, 0]]) == \"A\"\n assert candidate(moves = [[0, 1], [1, 1], [2, 1], [0, 0], [1, 0]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [1, 0], [0, 1], [1, 2], [0, 2], [2, 0], [2, 1], [2, 2]]) == \"A\"\n assert candidate(moves = [[2, 0], [1, 1], [0, 2], [0, 0], [2, 2], [1, 2], [1, 0]]) == \"Pending\"\n assert candidate(moves = [[2, 0], [1, 0], [0, 0], [2, 1], [1, 1], [0, 1], [2, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [2, 2], [1, 1], [1, 0], [2, 1], [0, 2], [2, 0], [1, 2], [0, 1]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 0], [2, 0], [0, 1], [0, 2], [1, 1], [2, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) == \"A\"\n assert candidate(moves = [[0, 1], [2, 0], [1, 0], [2, 1], [1, 1], [0, 2], [2, 2], [0, 0]]) == \"Pending\"\n assert candidate(moves = [[1, 1], [2, 2], [0, 0], [1, 0], [2, 0], [0, 2], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[2, 2], [0, 2], [1, 1], [2, 0], [2, 1]]) == \"Pending\"\n assert candidate(moves = [[1, 0], [0, 1], [2, 0], [1, 2], [0, 2], [2, 1], [1, 1]]) == \"A\"\n assert candidate(moves = [[0, 1], [1, 1], [2, 1], [0, 0], [0, 2], [2, 0], [2, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 2], [0, 1], [0, 2], [1, 2], [2, 1]]) == \"Pending\"\n assert candidate(moves = [[0, 1], [0, 0], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [2, 2], [0, 1], [1, 1], [2, 0], [1, 0], [0, 2], [2, 1], [1, 2]]) == \"A\"\n assert candidate(moves = [[2, 1], [1, 1], [0, 0], [0, 1], [2, 0], [0, 2], [1, 0], [2, 2], [1, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 0], [2, 0], [0, 1], [1, 1], [2, 1], [0, 2], [1, 2], [2, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 0], [0, 1], [1, 1], [0, 2], [2, 1], [1, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 0], [0, 1], [1, 1], [0, 2], [2, 2], [2, 0], [2, 1]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 0], [1, 1], [2, 0], [2, 2], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[2, 2], [0, 0], [1, 1], [2, 1], [2, 0], [0, 1], [1, 0], [1, 2], [0, 2]]) == \"A\"\n assert candidate(moves = [[1, 0], [0, 0], [2, 0], [1, 1], [2, 2], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 2], [2, 0], [1, 1], [1, 0], [2, 1], [0, 1], [2, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [0, 2], [2, 2], [1, 0], [1, 2], [2, 0], [2, 1], [0, 1], [1, 1]]) == \"A\"\n assert candidate(moves = [[0, 0], [0, 1], [1, 1], [1, 0], [2, 2]]) == \"A\"\n assert candidate(moves = [[1, 1], [0, 0], [0, 1], [0, 2], [1, 2], [2, 0], [1, 0]]) == \"A\"\n assert candidate(moves = [[1, 1], [0, 0], [2, 0], [1, 0], [2, 2], [0, 1], [0, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 2], [0, 1], [1, 0], [0, 2], [1, 2], [2, 1]]) == \"B\"\n assert candidate(moves = [[0, 0], [1, 1], [1, 0], [0, 1], [0, 2], [2, 0], [2, 2], [1, 2], [2, 1]]) == \"Draw\"\n assert candidate(moves = [[2, 0], [0, 1], [1, 1], [0, 0], [2, 2], [1, 2], [2, 1]]) == \"A\"\n assert candidate(moves = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1]]) == \"B\"\n assert candidate(moves = [[0, 0], [0, 1], [0, 2], [1, 1], [1, 2], [2, 0], [2, 2]]) == \"A\"\n assert candidate(moves = [[2, 2], [0, 2], [2, 1], [0, 1], [2, 0], [0, 0], [1, 0], [1, 1]]) == \"B\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 0], [1, 0], [2, 1], [0, 1]]) == \"Pending\"\n assert candidate(moves = [[1, 0], [0, 0], [1, 1], [1, 2], [0, 1], [2, 1], [0, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1]]) == \"Pending\"\n assert candidate(moves = [[2, 2], [0, 0], [1, 1], [0, 1], [0, 2], [2, 1], [2, 0]]) == \"A\"\n assert candidate(moves = [[2, 2], [1, 1], [0, 0], [1, 2], [0, 1], [2, 1], [0, 2]]) == \"A\"\n assert candidate(moves = [[2, 0], [1, 1], [0, 2], [1, 0], [0, 0], [2, 2], [2, 1], [1, 2]]) == \"B\"\n assert candidate(moves = [[0, 0], [2, 2], [1, 1], [0, 1], [0, 2], [2, 0], [2, 1]]) == \"Pending\"\n assert candidate(moves = [[0, 1], [2, 2], [1, 1], [0, 2], [1, 2], [2, 0], [1, 0]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 2], [0, 1], [2, 1], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 2], [0, 1], [1, 2], [2, 0], [1, 0], [0, 2]]) == \"B\"\n assert candidate(moves = [[0, 2], [1, 1], [0, 1], [0, 0], [2, 0], [2, 1], [2, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [1, 1], [0, 1], [1, 2], [0, 2], [1, 0], [2, 0], [2, 2], [2, 1]]) == \"A\"\n assert candidate(moves = [[1, 1], [0, 0], [2, 0], [1, 0], [2, 2], [0, 1], [2, 1]]) == \"A\"\n assert candidate(moves = [[0, 1], [1, 1], [2, 1], [0, 0], [0, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 2], [1, 1], [2, 0], [0, 1], [1, 2], [2, 1]]) == \"B\"\n assert candidate(moves = [[2, 0], [1, 0], [1, 1], [0, 2], [1, 2], [2, 1], [0, 1]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [0, 2], [1, 1], [2, 2], [1, 0], [2, 0]]) == \"Pending\"\n assert candidate(moves = [[2, 0], [0, 0], [1, 1], [0, 1], [2, 1], [0, 2]]) == \"B\"\n assert candidate(moves = [[1, 1], [0, 0], [2, 2], [1, 0], [2, 1], [0, 2], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[0, 0], [2, 0], [0, 1], [2, 1], [0, 2], [1, 1], [2, 2], [1, 0], [1, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 0], [1, 0], [1, 2], [0, 2], [2, 1], [2, 2]]) == \"Pending\"\n assert candidate(moves = [[2, 2], [1, 1], [1, 0], [0, 0], [0, 2], [2, 0], [1, 2]]) == \"A\"\n assert candidate(moves = [[0, 0], [2, 2], [1, 0], [1, 1], [0, 1], [2, 0], [1, 2]]) == \"Pending\"\n assert candidate(moves = [[1, 1], [0, 0], [0, 1], [2, 2], [2, 0], [2, 1], [1, 0]]) == \"Pending\"\n assert candidate(moves = [[0, 2], [1, 1], [0, 1], [0, 0], [2, 0], [1, 0], [2, 2], [1, 2], [2, 1]]) == \"A\"\n assert candidate(moves = [[0, 0], [2, 0], [1, 1], [0, 1], [2, 2], [1, 0], [2, 1]]) == \"A\"\n assert candidate(moves = [[0, 0], [1, 1], [2, 2], [0, 2], [1, 0], [2, 0], [0, 1]]) == \"Pending\"\n assert candidate(moves = [[0, 2], [1, 1], [0, 1], [1, 0], [2, 0], [0, 0]]) == \"Pending\"\n"}, "metadata": {"canonical_parameter_names": ["moves"], "leetcode_dataset_entry_point": "Solution().tictactoe", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var tictactoe = function(moves) {", "container": null, "callable": "tictactoe", "parameters": [{"name": "moves", "type": "number[][]"}], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1276, "task_id": "number-of-burgers-with-no-waste-of-ingredients", "difficulty": "Medium", "problem_description": "Given two integers tomatoSlices and cheeseSlices. The ingredients of different burgers are as follows:\n\nJumbo Burger: 4 tomato slices and 1 cheese slice.\nSmall Burger: 2 Tomato slices and 1 cheese slice.\n\nReturn [total_jumbo, total_small] so that the number of remaining tomatoSlices equal to 0 and the number of remaining cheeseSlices equal to 0. If it is not possible to make the remaining tomatoSlices and cheeseSlices equal to 0 return [].\n \nExample 1:\n\nInput: tomatoSlices = 16, cheeseSlices = 7\nOutput: [1,6]\nExplantion: To make one jumbo burger and 6 small burgers we need 4*1 + 2*6 = 16 tomato and 1 + 6 = 7 cheese.\nThere will be no remaining ingredients.\n\nExample 2:\n\nInput: tomatoSlices = 17, cheeseSlices = 4\nOutput: []\nExplantion: There will be no way to use all ingredients to make small and jumbo burgers.\n\nExample 3:\n\nInput: tomatoSlices = 4, cheeseSlices = 17\nOutput: []\nExplantion: Making 1 jumbo burger there will be 16 cheese remaining and making 2 small burgers there will be 15 cheese remaining.\n\n \nConstraints:\n\n0 <= tomatoSlices, cheeseSlices <= 107\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(tomatoSlices = 10000000,cheeseSlices = 5000000) == [0, 5000000]\n assert candidate(tomatoSlices = 16,cheeseSlices = 7) == [1, 6]\n assert candidate(tomatoSlices = 14,cheeseSlices = 5) == [2, 3]\n assert candidate(tomatoSlices = 8,cheeseSlices = 2) == [2, 0]\n assert candidate(tomatoSlices = 20,cheeseSlices = 5) == [5, 0]\n assert candidate(tomatoSlices = 0,cheeseSlices = 0) == [0, 0]\n assert candidate(tomatoSlices = 10,cheeseSlices = 3) == [2, 1]\n assert candidate(tomatoSlices = 4,cheeseSlices = 17) == []\n assert candidate(tomatoSlices = 8,cheeseSlices = 4) == [0, 4]\n assert candidate(tomatoSlices = 2,cheeseSlices = 1) == [0, 1]\n assert candidate(tomatoSlices = 6,cheeseSlices = 3) == [0, 3]\n assert candidate(tomatoSlices = 10000000,cheeseSlices = 2500000) == [2500000, 0]\n assert candidate(tomatoSlices = 17,cheeseSlices = 4) == []\n assert candidate(tomatoSlices = 10,cheeseSlices = 5) == [0, 5]\n assert candidate(tomatoSlices = 22,cheeseSlices = 5) == []\n assert candidate(tomatoSlices = 22,cheeseSlices = 6) == [5, 1]\n assert candidate(tomatoSlices = 20000000,cheeseSlices = 5000000) == [5000000, 0]\n assert candidate(tomatoSlices = 1000,cheeseSlices = 250) == [250, 0]\n assert candidate(tomatoSlices = 1,cheeseSlices = 1) == []\n assert candidate(tomatoSlices = 12,cheeseSlices = 3) == [3, 0]\n assert candidate(tomatoSlices = 42,cheeseSlices = 14) == [7, 7]\n assert candidate(tomatoSlices = 28,cheeseSlices = 7) == [7, 0]\n assert candidate(tomatoSlices = 5000000,cheeseSlices = 2000000) == [500000, 1500000]\n assert candidate(tomatoSlices = 30,cheeseSlices = 8) == [7, 1]\n assert candidate(tomatoSlices = 22,cheeseSlices = 11) == [0, 11]\n assert candidate(tomatoSlices = 15,cheeseSlices = 5) == []\n assert candidate(tomatoSlices = 7,cheeseSlices = 2) == []\n assert candidate(tomatoSlices = 88,cheeseSlices = 22) == [22, 0]\n assert candidate(tomatoSlices = 7,cheeseSlices = 3) == []\n assert candidate(tomatoSlices = 18,cheeseSlices = 5) == [4, 1]\n assert candidate(tomatoSlices = 18,cheeseSlices = 8) == [1, 7]\n assert candidate(tomatoSlices = 40,cheeseSlices = 10) == [10, 0]\n assert candidate(tomatoSlices = 9,cheeseSlices = 3) == []\n assert candidate(tomatoSlices = 12,cheeseSlices = 5) == [1, 4]\n assert candidate(tomatoSlices = 5,cheeseSlices = 3) == []\n assert candidate(tomatoSlices = 22,cheeseSlices = 9) == [2, 7]\n assert candidate(tomatoSlices = 50,cheeseSlices = 12) == []\n assert candidate(tomatoSlices = 32,cheeseSlices = 8) == [8, 0]\n assert candidate(tomatoSlices = 10000002,cheeseSlices = 2500000) == []\n assert candidate(tomatoSlices = 100,cheeseSlices = 30) == [20, 10]\n assert candidate(tomatoSlices = 24,cheeseSlices = 6) == [6, 0]\n assert candidate(tomatoSlices = 32,cheeseSlices = 10) == [6, 4]\n assert candidate(tomatoSlices = 14,cheeseSlices = 7) == [0, 7]\n assert candidate(tomatoSlices = 7,cheeseSlices = 4) == []\n assert candidate(tomatoSlices = 80,cheeseSlices = 15) == []\n assert candidate(tomatoSlices = 34,cheeseSlices = 8) == []\n assert candidate(tomatoSlices = 20,cheeseSlices = 8) == [2, 6]\n assert candidate(tomatoSlices = 40000000,cheeseSlices = 10000000) == [10000000, 0]\n assert candidate(tomatoSlices = 28,cheeseSlices = 6) == []\n assert candidate(tomatoSlices = 14,cheeseSlices = 4) == [3, 1]\n assert candidate(tomatoSlices = 40000002,cheeseSlices = 10000000) == []\n assert candidate(tomatoSlices = 16,cheeseSlices = 10) == []\n assert candidate(tomatoSlices = 123456,cheeseSlices = 65432) == []\n assert candidate(tomatoSlices = 50,cheeseSlices = 15) == [10, 5]\n assert candidate(tomatoSlices = 34,cheeseSlices = 9) == [8, 1]\n assert candidate(tomatoSlices = 10,cheeseSlices = 2) == []\n assert candidate(tomatoSlices = 12,cheeseSlices = 6) == [0, 6]\n assert candidate(tomatoSlices = 8,cheeseSlices = 3) == [1, 2]\n assert candidate(tomatoSlices = 34,cheeseSlices = 11) == [6, 5]\n assert candidate(tomatoSlices = 25,cheeseSlices = 8) == []\n assert candidate(tomatoSlices = 18,cheeseSlices = 6) == [3, 3]\n assert candidate(tomatoSlices = 5000000,cheeseSlices = 1250000) == [1250000, 0]\n assert candidate(tomatoSlices = 14,cheeseSlices = 3) == []\n assert candidate(tomatoSlices = 9999998,cheeseSlices = 4999999) == [0, 4999999]\n assert candidate(tomatoSlices = 22,cheeseSlices = 7) == [4, 3]\n assert candidate(tomatoSlices = 28,cheeseSlices = 10) == [4, 6]\n assert candidate(tomatoSlices = 30,cheeseSlices = 10) == [5, 5]\n assert candidate(tomatoSlices = 4,cheeseSlices = 0) == []\n assert candidate(tomatoSlices = 12,cheeseSlices = 4) == [2, 2]\n assert candidate(tomatoSlices = 10,cheeseSlices = 4) == [1, 3]\n assert candidate(tomatoSlices = 100,cheeseSlices = 25) == [25, 0]\n assert candidate(tomatoSlices = 44,cheeseSlices = 11) == [11, 0]\n assert candidate(tomatoSlices = 34,cheeseSlices = 13) == [4, 9]\n"}, "metadata": {"canonical_parameter_names": ["tomatoSlices", "cheeseSlices"], "leetcode_dataset_entry_point": "Solution().numOfBurgers", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var numOfBurgers = function(tomatoSlices, cheeseSlices) {", "container": null, "callable": "numOfBurgers", "parameters": [{"name": "tomatoSlices", "type": "number"}, {"name": "cheeseSlices", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1277, "task_id": "count-square-submatrices-with-all-ones", "difficulty": "Medium", "problem_description": "Given a m * n matrix of ones and zeros, return how many square submatrices have all ones.\n \nExample 1:\n\nInput: matrix =\n[\n  [0,1,1,1],\n  [1,1,1,1],\n  [0,1,1,1]\n]\nOutput: 15\nExplanation: \nThere are 10 squares of side 1.\nThere are 4 squares of side 2.\nThere is 1 square of side 3.\nTotal number of squares = 10 + 4 + 1 = 15.\n\nExample 2:\n\nInput: matrix = \n[\n [1,0,1],\n [1,1,0],\n [1,1,0]\n]\nOutput: 7\nExplanation: \nThere are 6 squares of side 1. \nThere is 1 square of side 2. \nTotal number of squares = 6 + 1 = 7.\n\n \nConstraints:\n\n1 <= arr.length <= 300\n1 <= arr[0].length <= 300\n0 <= arr[i][j] <= 1\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(matrix = [[1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1]]) == 24\n assert candidate(matrix = [[1]]) == 1\n assert candidate(matrix = [[0]]) == 0\n assert candidate(matrix = [[0, 1, 1, 1], [1, 1, 1, 1], [0, 1, 1, 1]]) == 15\n assert candidate(matrix = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(matrix = [[1, 0, 1], [1, 1, 0], [1, 1, 0]]) == 7\n assert candidate(matrix = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == 14\n assert candidate(matrix = [[1, 1], [1, 1]]) == 5\n assert candidate(matrix = [[1, 1, 0, 1, 0, 1], [1, 1, 1, 1, 0, 1], [0, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 1, 1]]) == 42\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]]) == 112\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]]) == 140\n assert candidate(matrix = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 40\n assert candidate(matrix = [[0, 1, 1, 0, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1]]) == 25\n assert candidate(matrix = [[0, 1, 1, 1, 0], [1, 1, 1, 1, 1], [1, 1, 1, 1, 0], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0]]) == 34\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == 15\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 0, 0, 0, 1], [1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == 43\n assert candidate(matrix = [[1, 1, 0, 0, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1]]) == 24\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == 91\n assert candidate(matrix = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 13\n assert candidate(matrix = [[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == 8\n assert candidate(matrix = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]]) == 12\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 18\n assert candidate(matrix = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 55\n assert candidate(matrix = [[1, 1, 0, 1, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 1, 1, 1], [1, 1, 0, 1, 1]]) == 30\n assert candidate(matrix = [[1, 1, 0, 0, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 38\n assert candidate(matrix = [[1, 0, 1, 1, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 1, 1, 0], [1, 0, 1, 0, 1]]) == 26\n assert candidate(matrix = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [0, 1, 0, 1, 0], [1, 1, 1, 1, 1]]) == 20\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 204\n assert candidate(matrix = [[1, 1, 1, 1, 0, 1], [0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1], [0, 1, 1, 1, 0, 0], [1, 0, 0, 1, 0, 1]]) == 36\n assert candidate(matrix = [[1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [1, 1, 1, 1, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 1]]) == 29\n assert candidate(matrix = [[1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1]]) == 48\n assert candidate(matrix = [[1, 1, 1, 0, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 1, 1, 1], [1, 1, 1, 0, 1]]) == 30\n assert candidate(matrix = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 10\n assert candidate(matrix = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 30\n assert candidate(matrix = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 20\n assert candidate(matrix = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 14\n assert candidate(matrix = [[1, 1, 1, 1, 0], [1, 1, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 1, 0], [1, 0, 1, 0, 0]]) == 15\n assert candidate(matrix = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 30\n assert candidate(matrix = [[1, 0, 1, 1, 1, 0], [0, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 0], [1, 0, 1, 1, 1, 0], [0, 1, 1, 1, 1, 0]]) == 43\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]]) == 25\n assert candidate(matrix = [[1, 1, 1, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 1]]) == 11\n assert candidate(matrix = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 10\n assert candidate(matrix = [[1, 1, 0, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0]]) == 32\n assert candidate(matrix = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1]]) == 25\n assert candidate(matrix = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == 70\n assert candidate(matrix = [[1, 1, 0, 1, 1], [1, 0, 0, 1, 0], [0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 1, 1, 1, 1]]) == 16\n assert candidate(matrix = [[0, 1, 0, 1], [1, 1, 1, 1], [0, 1, 0, 1], [1, 1, 1, 1]]) == 12\n assert candidate(matrix = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]]) == 5\n assert candidate(matrix = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 40\n assert candidate(matrix = [[1, 1, 0, 0, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 1, 1, 1]]) == 30\n assert candidate(matrix = [[1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 1, 1, 1]]) == 32\n assert candidate(matrix = [[1, 1, 0, 1], [1, 1, 0, 1], [0, 0, 0, 0], [1, 1, 1, 1]]) == 11\n assert candidate(matrix = [[0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1], [1, 0, 0, 1, 0, 1, 1, 0], [1, 1, 0, 0, 1, 0, 1, 0], [0, 0, 1, 1, 1, 1, 0, 1]]) == 32\n assert candidate(matrix = [[1, 0, 0, 1, 0], [0, 1, 1, 0, 1], [0, 1, 1, 0, 1], [1, 0, 0, 1, 0], [0, 1, 1, 0, 1]]) == 14\n assert candidate(matrix = [[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]]) == 10\n assert candidate(matrix = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 8\n assert candidate(matrix = [[1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0]]) == 27\n assert candidate(matrix = [[0, 1, 1, 1, 1], [1, 1, 1, 1, 0], [1, 1, 0, 1, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 1]]) == 29\n assert candidate(matrix = [[1, 1, 1, 0, 0, 1], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1]]) == 51\n assert candidate(matrix = [[1, 1, 1, 0, 0], [0, 1, 1, 1, 0], [0, 1, 1, 0, 0], [1, 0, 0, 1, 1], [1, 0, 0, 1, 1]]) == 17\n assert candidate(matrix = [[0, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 0], [0, 1, 1, 0, 0], [1, 0, 0, 1, 1]]) == 26\n assert candidate(matrix = [[1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]) == 21\n assert candidate(matrix = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 12\n assert candidate(matrix = [[0, 1, 0, 1, 0], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 1, 1, 1], [0, 1, 0, 1, 0]]) == 22\n assert candidate(matrix = [[0, 1, 0, 1, 0], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 18\n assert candidate(matrix = [[1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 0, 1, 1, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 1]]) == 17\n assert candidate(matrix = [[1, 0, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 0]]) == 43\n"}, "metadata": {"canonical_parameter_names": ["matrix"], "leetcode_dataset_entry_point": "Solution().countSquares", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var countSquares = function(matrix) {", "container": null, "callable": "countSquares", "parameters": [{"name": "matrix", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1278, "task_id": "palindrome-partitioning-iii", "difficulty": "Hard", "problem_description": "You are given a string s containing lowercase letters and an integer k. You need to :\n\nFirst, change some characters of s to other lowercase English letters.\nThen divide s into k non-empty disjoint substrings such that each substring is a palindrome.\n\nReturn the minimal number of characters that you need to change to divide the string.\n \nExample 1:\n\nInput: s = \"abc\", k = 2\nOutput: 1\nExplanation: You can split the string into \"ab\" and \"c\", and change 1 character in \"ab\" to make it palindrome.\n\nExample 2:\n\nInput: s = \"aabbc\", k = 3\nOutput: 0\nExplanation: You can split the string into \"aa\", \"bb\" and \"c\", all of them are palindrome.\nExample 3:\n\nInput: s = \"leetcode\", k = 8\nOutput: 0\n\n \nConstraints:\n\n1 <= k <= s.length <= 100.\ns only contains lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"abc\",k = 2) == 1\n assert candidate(s = \"abababa\",k = 4) == 1\n assert candidate(s = \"aaaa\",k = 2) == 0\n assert candidate(s = \"leetcode\",k = 8) == 0\n assert candidate(s = \"abcd\",k = 2) == 1\n assert candidate(s = \"racecar\",k = 5) == 0\n assert candidate(s = \"nnn\",k = 1) == 0\n assert candidate(s = \"abac\",k = 3) == 1\n assert candidate(s = \"racecar\",k = 1) == 0\n assert candidate(s = \"aabbc\",k = 3) == 0\n assert candidate(s = \"abacdfgdcaba\",k = 3) == 1\n assert candidate(s = \"palindrome\",k = 2) == 4\n assert candidate(s = \"aaaabbbbcccc\",k = 3) == 0\n assert candidate(s = \"aabbccdd\",k = 4) == 0\n assert candidate(s = \"zzzzzzzzzz\",k = 1) == 0\n assert candidate(s = \"palindrome\",k = 4) == 3\n assert candidate(s = \"mississippi\",k = 4) == 0\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",k = 13) == 14\n assert candidate(s = \"banana\",k = 2) == 0\n assert candidate(s = \"abcdefg\",k = 7) == 0\n assert candidate(s = \"aabbaabbaabbaabb\",k = 4) == 0\n assert candidate(s = \"ababababab\",k = 5) == 1\n assert candidate(s = \"abcdefg\",k = 4) == 2\n assert candidate(s = \"aabbccddeeff\",k = 6) == 0\n assert candidate(s = \"abcdcbaabcdcba\",k = 4) == 0\n assert candidate(s = \"xyxyxyxyxy\",k = 5) == 1\n assert candidate(s = \"mamamamamama\",k = 5) == 1\n assert candidate(s = \"zxyxzyxzyxzyx\",k = 4) == 2\n assert candidate(s = \"aababababa\",k = 5) == 0\n assert candidate(s = \"xyxyxyxyxyxyxyxyxy\",k = 9) == 1\n assert candidate(s = \"zazapapa\",k = 3) == 1\n assert candidate(s = \"xyxyxyxyx\",k = 5) == 0\n assert candidate(s = \"abababab\",k = 5) == 1\n assert candidate(s = \"abcde\",k = 3) == 1\n assert candidate(s = \"mnopqrstu\",k = 5) == 2\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",k = 50) == 0\n assert candidate(s = \"abcdedcba\",k = 3) == 0\n assert candidate(s = \"abcbcaabc\",k = 3) == 1\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",k = 26) == 0\n assert candidate(s = \"abcdefgabcdefg\",k = 2) == 6\n assert candidate(s = \"aaaaaaaaaaa\",k = 2) == 0\n assert candidate(s = \"aabbaa\",k = 3) == 0\n assert candidate(s = \"racecar\",k = 3) == 0\n assert candidate(s = \"abcdefghijk\",k = 3) == 4\n assert candidate(s = \"aabbccddeeffgghh\",k = 8) == 0\n assert candidate(s = \"xyzzyxzyxzyxzyxzyxzyx\",k = 5) == 4\n assert candidate(s = \"levelmadammadam\",k = 4) == 0\n assert candidate(s = \"abcdefghij\",k = 5) == 3\n assert candidate(s = \"abcdabcdabcd\",k = 3) == 3\n assert candidate(s = \"noonnoonnoon\",k = 6) == 0\n assert candidate(s = \"aaaaaaaaaa\",k = 5) == 0\n assert candidate(s = \"banana\",k = 3) == 1\n assert candidate(s = \"noonnoonnoon\",k = 4) == 0\n assert candidate(s = \"racecar\",k = 2) == 3\n assert candidate(s = \"abacdefghijklmnopqrstuvwxyz\",k = 26) == 1\n assert candidate(s = \"xyzyxzyzxzyx\",k = 6) == 0\n assert candidate(s = \"abcbabc\",k = 3) == 0\n assert candidate(s = \"aabbaa\",k = 2) == 1\n assert candidate(s = \"aaaaabbbbb\",k = 2) == 0\n assert candidate(s = \"abccba\",k = 1) == 0\n assert candidate(s = \"abcbabcba\",k = 4) == 1\n assert candidate(s = \"abcdefghi\",k = 3) == 3\n assert candidate(s = \"abcdefgh\",k = 8) == 0\n assert candidate(s = \"abcdefghi\",k = 9) == 0\n assert candidate(s = \"xyzyzyzyzyzyz\",k = 3) == 0\n assert candidate(s = \"abcdefg\",k = 3) == 2\n assert candidate(s = \"aabaaa\",k = 2) == 0\n assert candidate(s = \"abcdefg\",k = 1) == 3\n assert candidate(s = \"ababab\",k = 2) == 0\n assert candidate(s = \"abcdabc\",k = 3) == 1\n assert candidate(s = \"xyzxyzxyz\",k = 3) == 2\n assert candidate(s = \"abccccba\",k = 2) == 2\n assert candidate(s = \"mississippi\",k = 3) == 1\n assert candidate(s = \"zzzzzzzzzz\",k = 5) == 0\n assert candidate(s = \"abababababababababab\",k = 10) == 0\n assert candidate(s = \"ababababa\",k = 5) == 0\n assert candidate(s = \"abacabadabacaba\",k = 7) == 0\n assert candidate(s = \"abccccba\",k = 3) == 0\n assert candidate(s = \"abcdefghi\",k = 5) == 2\n assert candidate(s = \"abacaxaba\",k = 4) == 1\n assert candidate(s = \"aababbaab\",k = 4) == 0\n assert candidate(s = \"aaaaabbbbbcccccddddd\",k = 10) == 0\n assert candidate(s = \"racecarannakayak\",k = 4) == 1\n assert candidate(s = \"abbaabba\",k = 4) == 0\n assert candidate(s = \"abacaxabac\",k = 5) == 1\n assert candidate(s = \"zzzzzzzzz\",k = 5) == 0\n assert candidate(s = \"aaaaabbbbb\",k = 5) == 0\n assert candidate(s = \"abcdabcdabcd\",k = 4) == 2\n assert candidate(s = \"zyxwvutsrqponmlkjihgfedcba\",k = 26) == 0\n"}, "metadata": {"canonical_parameter_names": ["s", "k"], "leetcode_dataset_entry_point": "Solution().palindromePartition", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var palindromePartition = function(s, k) {", "container": null, "callable": "palindromePartition", "parameters": [{"name": "s", "type": "string"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1281, "task_id": "subtract-the-product-and-sum-of-digits-of-an-integer", "difficulty": "Easy", "problem_description": "Given an integer number n, return the difference between the product of its digits and the sum of its digits.\n \nExample 1:\n\nInput: n = 234\nOutput: 15 \nExplanation: \nProduct of digits = 2 * 3 * 4 = 24 \nSum of digits = 2 + 3 + 4 = 9 \nResult = 24 - 9 = 15\n\nExample 2:\n\nInput: n = 4421\nOutput: 21\nExplanation: \nProduct of digits = 4 * 4 * 2 * 1 = 32 \nSum of digits = 4 + 4 + 2 + 1 = 11 \nResult = 32 - 11 = 21\n\n \nConstraints:\n\n1 <= n <= 10^5\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 99999) == 59004\n assert candidate(n = 11111) == -4\n assert candidate(n = 789) == 480\n assert candidate(n = 1111) == -3\n assert candidate(n = 234) == 15\n assert candidate(n = 12345) == 105\n assert candidate(n = 456) == 105\n assert candidate(n = 10000) == -1\n assert candidate(n = 9999) == 6525\n assert candidate(n = 100) == -1\n assert candidate(n = 105) == -6\n assert candidate(n = 1000) == -1\n assert candidate(n = 4421) == 21\n assert candidate(n = 4321) == 14\n assert candidate(n = 123) == 0\n assert candidate(n = 33333) == 228\n assert candidate(n = 199999) == 59003\n assert candidate(n = 55555) == 3100\n assert candidate(n = 10987) == -25\n assert candidate(n = 77777) == 16772\n assert candidate(n = 67890) == -30\n assert candidate(n = 111111) == -5\n assert candidate(n = 86420) == -20\n assert candidate(n = 56789) == 15085\n assert candidate(n = 888888) == 262096\n assert candidate(n = 24680) == -20\n assert candidate(n = 987654) == 60441\n assert candidate(n = 59382) == 2133\n assert candidate(n = 80808) == -24\n assert candidate(n = 50400) == -9\n assert candidate(n = 234567) == 5013\n assert candidate(n = 44444) == 1004\n assert candidate(n = 102030405) == -15\n assert candidate(n = 59876) == 15085\n assert candidate(n = 100000) == -1\n assert candidate(n = 10401) == -6\n assert candidate(n = 10101) == -3\n assert candidate(n = 7654321) == 5012\n assert candidate(n = 29999) == 13084\n assert candidate(n = 22222) == 22\n assert candidate(n = 987654321) == 362835\n assert candidate(n = 13579) == 920\n assert candidate(n = 101010) == -3\n assert candidate(n = 90909) == -27\n assert candidate(n = 98765) == 15085\n assert candidate(n = 43210) == -10\n assert candidate(n = 95135) == 652\n assert candidate(n = 91123) == 38\n assert candidate(n = 314159) == 517\n assert candidate(n = 999999) == 531387\n assert candidate(n = 123456) == 699\n assert candidate(n = 10010) == -2\n assert candidate(n = 54321) == 105\n assert candidate(n = 505050) == -15\n assert candidate(n = 76543) == 2495\n"}, "metadata": {"canonical_parameter_names": ["n"], "leetcode_dataset_entry_point": "Solution().subtractProductAndSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var subtractProductAndSum = function(n) {", "container": null, "callable": "subtractProductAndSum", "parameters": [{"name": "n", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1282, "task_id": "group-the-people-given-the-group-size-they-belong-to", "difficulty": "Medium", "problem_description": "There are n people that are split into some unknown number of groups. Each person is labeled with a unique ID from 0 to n - 1.\nYou are given an integer array groupSizes, where groupSizes[i] is the size of the group that person i is in. For example, if groupSizes[1] = 3, then person 1 must be in a group of size 3.\nReturn a list of groups such that each person i is in a group of size groupSizes[i].\nEach person should appear in exactly one group, and every person must be in a group. If there are multiple answers, return any of them. It is guaranteed that there will be at least one valid solution for the given input.\n \nExample 1:\n\nInput: groupSizes = [3,3,3,3,3,1,3]\nOutput: [[5],[0,1,2],[3,4,6]]\nExplanation: \nThe first group is [5]. The size is 1, and groupSizes[5] = 1.\nThe second group is [0,1,2]. The size is 3, and groupSizes[0] = groupSizes[1] = groupSizes[2] = 3.\nThe third group is [3,4,6]. The size is 3, and groupSizes[3] = groupSizes[4] = groupSizes[6] = 3.\nOther possible solutions are [[2,1,6],[5],[0,4,3]] and [[5],[0,6,2],[4,3,1]].\n\nExample 2:\n\nInput: groupSizes = [2,1,3,3,3,2]\nOutput: [[1],[0,5],[2,3,4]]\n\n \nConstraints:\n\ngroupSizes.length == n\n1 <= n <= 500\n1 <= groupSizes[i] <= n\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(groupSizes = [1, 2, 2, 1, 1]) == [[0], [3], [4], [1, 2]]\n assert candidate(groupSizes = [1, 1, 1, 1, 1, 1]) == [[0], [1], [2], [3], [4], [5]]\n assert candidate(groupSizes = [1, 2, 2, 1]) == [[0], [3], [1, 2]]\n assert candidate(groupSizes = [2, 2, 2, 2, 2, 2]) == [[0, 1], [2, 3], [4, 5]]\n assert candidate(groupSizes = [2, 2, 3, 3, 3, 4, 4, 4, 4]) == [[0, 1], [2, 3, 4], [5, 6, 7, 8]]\n assert candidate(groupSizes = [2, 2, 3, 3, 3]) == [[0, 1], [2, 3, 4]]\n assert candidate(groupSizes = [2, 2, 3, 3, 3, 3, 3, 3]) == [[0, 1], [2, 3, 4], [5, 6, 7]]\n assert candidate(groupSizes = [2, 2, 1, 1]) == [[0, 1], [2], [3]]\n assert candidate(groupSizes = [2, 1, 3, 3, 3, 2]) == [[0, 5], [1], [2, 3, 4]]\n assert candidate(groupSizes = [1, 1, 1, 1, 1]) == [[0], [1], [2], [3], [4]]\n assert candidate(groupSizes = [3, 3, 3, 3, 3, 1, 3]) == [[0, 1, 2], [3, 4, 6], [5]]\n assert candidate(groupSizes = [1, 2, 3, 4, 5]) == [[0], [1], [2], [3], [4]]\n assert candidate(groupSizes = [5, 5, 5, 5, 5]) == [[0, 1, 2, 3, 4]]\n assert candidate(groupSizes = [4, 4, 4, 4]) == [[0, 1, 2, 3]]\n assert candidate(groupSizes = [5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3]) == [[0, 1, 2, 3, 4], [5], [6], [7], [8], [9], [10, 11], [12, 13, 14]]\n assert candidate(groupSizes = [5, 5, 5, 5, 5, 1, 1, 1, 1, 1]) == [[0, 1, 2, 3, 4], [5], [6], [7], [8], [9]]\n assert candidate(groupSizes = [4, 4, 4, 4, 4, 4, 4, 4]) == [[0, 1, 2, 3], [4, 5, 6, 7]]\n assert candidate(groupSizes = [5, 5, 5, 5, 5, 4, 4, 4, 3, 3, 2, 2, 1]) == [[0, 1, 2, 3, 4], [5, 6, 7], [8, 9], [10, 11], [12]]\n assert candidate(groupSizes = [7, 2, 2, 7, 7, 2, 2, 2, 7, 7, 7, 7, 7]) == [[0, 3, 4, 8, 9, 10, 11], [12], [1, 2], [5, 6], [7]]\n assert candidate(groupSizes = [3, 3, 3, 3, 3, 2, 2]) == [[0, 1, 2], [3, 4], [5, 6]]\n assert candidate(groupSizes = [5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2]) == [[0, 1, 2, 3, 4], [5], [6], [7], [8], [9], [10, 11], [12, 13], [14]]\n assert candidate(groupSizes = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]]\n assert candidate(groupSizes = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == [[0, 1, 2, 3, 4, 5, 6, 7, 8], [9, 10, 11, 12, 13, 14, 15, 16, 17], [18, 19, 20, 21, 22, 23, 24, 25, 26], [27, 28, 29, 30, 31, 32, 33, 34, 35], [36, 37, 38, 39, 40, 41, 42, 43]]\n assert candidate(groupSizes = [2, 3, 3, 2, 3, 3, 1]) == [[0, 3], [1, 2, 4], [5], [6]]\n assert candidate(groupSizes = [3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 4, 4, 4, 4]) == [[0, 1, 2], [3], [4, 5], [6], [7], [8], [9], [10], [11, 12, 13, 14]]\n assert candidate(groupSizes = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13]]\n assert candidate(groupSizes = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 1, 1]) == [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [10], [11], [12], [13], [14]]\n assert candidate(groupSizes = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19]]\n assert candidate(groupSizes = [2, 3, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == [[0, 2], [3], [1, 4, 5], [6], [7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20, 21]]\n assert candidate(groupSizes = [2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2]) == [[0, 3], [4, 7], [8, 11], [1, 2, 5], [6, 9, 10]]\n assert candidate(groupSizes = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) == [[0], [1, 2], [3, 4, 5], [6, 7, 8, 9]]\n assert candidate(groupSizes = [2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3]) == [[0, 2], [4, 6], [8, 10], [12, 14], [1, 3, 5], [7, 9, 11], [13, 15]]\n assert candidate(groupSizes = [1, 2, 3, 2, 1, 3, 4, 3, 4, 2, 1, 4, 3, 2, 1, 3, 4, 3, 2, 1, 4]) == [[0], [4], [10], [14], [19], [1, 3], [9, 13], [18], [2, 5, 7], [12, 15, 17], [6, 8, 11, 16], [20]]\n assert candidate(groupSizes = [2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6]) == [[0, 5], [10], [1, 6, 11], [2, 7, 12], [3, 8, 13], [4, 9, 14]]\n assert candidate(groupSizes = [2, 2, 3, 3, 3, 3, 4, 4, 4, 4]) == [[0, 1], [2, 3, 4], [5], [6, 7, 8, 9]]\n assert candidate(groupSizes = [3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [[0, 1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30]]\n assert candidate(groupSizes = [3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1]) == [[0, 1, 2], [3], [4, 5], [6], [7], [8], [9], [10]]\n assert candidate(groupSizes = [7, 7, 7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2]) == [[0, 1, 2, 3, 4, 5, 6], [7], [8], [9], [10], [11], [12], [13], [14, 15], [16]]\n assert candidate(groupSizes = [2, 3, 2, 3, 3, 2, 3]) == [[0, 2], [5], [1, 3, 4], [6]]\n assert candidate(groupSizes = [7, 7, 7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 1, 1]) == [[0, 1, 2, 3, 4, 5, 6], [7], [8], [9], [10], [11], [12], [13]]\n assert candidate(groupSizes = [3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [[0, 1, 2], [3, 4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19]]\n assert candidate(groupSizes = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == [[0], [1, 2], [3, 4, 5], [6, 7, 8, 9], [10, 11, 12, 13, 14]]\n assert candidate(groupSizes = [4, 3, 3, 4, 2, 2, 4, 3, 3, 4, 2, 2, 4, 3, 3, 4, 2, 2]) == [[0, 3, 6, 9], [12, 15], [1, 2, 7], [8, 13, 14], [4, 5], [10, 11], [16, 17]]\n assert candidate(groupSizes = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14]]\n assert candidate(groupSizes = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19], [20, 21, 22], [23, 24, 25], [26, 27, 28], [29], [30, 31, 32, 33], [34, 35, 36, 37], [38, 39, 40, 41], [42, 43, 44, 45]]\n assert candidate(groupSizes = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1]) == [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15], [16], [17], [18], [19]]\n assert candidate(groupSizes = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == [[0], [10], [1, 9], [2, 8], [3, 7], [4, 6], [5]]\n assert candidate(groupSizes = [4, 4, 4, 4, 3, 3, 3, 2, 2, 1]) == [[0, 1, 2, 3], [4, 5, 6], [7, 8], [9]]\n assert candidate(groupSizes = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]\n assert candidate(groupSizes = [4, 4, 4, 4, 4, 4, 4, 4]) == [[0, 1, 2, 3], [4, 5, 6, 7]]\n assert candidate(groupSizes = [5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1]) == [[0, 5, 10, 15], [1, 6, 11, 16], [2, 7, 12], [17], [3, 8], [13, 18], [4], [9], [14], [19]]\n assert candidate(groupSizes = [7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == [[0, 1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12, 13, 14], [15, 16, 17, 18, 19, 20, 21, 22, 23]]\n assert candidate(groupSizes = [3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1]) == [[0, 1, 2], [3, 4], [5, 6], [7, 8], [9], [10], [11], [12]]\n assert candidate(groupSizes = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [20, 21, 22, 23, 24], [25, 26, 27, 28, 29], [30]]\n assert candidate(groupSizes = [2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3]) == [[0, 2], [4, 6], [8, 10], [1, 3, 5], [7, 9, 11]]\n assert candidate(groupSizes = [6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7]) == [[0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11, 12], [13, 14]]\n assert candidate(groupSizes = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]) == [[0], [10], [1, 9], [2, 8], [3, 7], [4, 6], [5]]\n assert candidate(groupSizes = [3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == [[0, 1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [21, 22], [23, 24], [25, 26], [27, 28], [29, 30], [31, 32], [33, 34], [35, 36], [37, 38], [39, 40], [41, 42], [43]]\n assert candidate(groupSizes = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19]]\n assert candidate(groupSizes = [3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1]) == [[0, 1, 2], [3, 4], [5, 6], [7, 8], [9], [10], [11]]\n assert candidate(groupSizes = [4, 4, 4, 4, 2, 2, 2, 2]) == [[0, 1, 2, 3], [4, 5], [6, 7]]\n assert candidate(groupSizes = [4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [[0, 1, 2, 3], [4], [5, 6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31], [32], [33], [34], [35], [36]]\n assert candidate(groupSizes = [2, 3, 2, 3, 3, 2, 2, 3, 2]) == [[0, 2], [5, 6], [8], [1, 3, 4], [7]]\n assert candidate(groupSizes = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 5, 5, 5, 5, 5, 3, 3, 3, 2, 2]) == [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17], [18, 19]]\n assert candidate(groupSizes = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16, 17, 18], [19], [20, 21, 22, 23, 24, 25, 26, 27], [28, 29], [30, 31, 32, 33, 34, 35, 36], [37, 38, 39], [40, 41, 42, 43, 44, 45], [46, 47, 48, 49], [50, 51, 52, 53, 54], [55, 56, 57, 58, 59], [60, 61, 62, 63], [64, 65, 66, 67], [68, 69], [70, 71, 72], [73, 74, 75], [76, 77, 78], [79], [80, 81], [82, 83], [84, 85], [86, 87], [88, 89], [90], [91], [92], [93], [94], [95], [96], [97], [98], [99]]\n assert candidate(groupSizes = [2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15]]\n assert candidate(groupSizes = [2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [[0, 9], [1, 10], [2, 11], [3, 12], [4, 13], [5, 14], [6, 15], [7, 16], [8, 17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31], [32], [33]]\n assert candidate(groupSizes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]\n assert candidate(groupSizes = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]]\n assert candidate(groupSizes = [3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 2]) == [[0, 1, 2], [7, 8, 9], [10], [3, 4], [5, 6], [11]]\n assert candidate(groupSizes = [5, 1, 5, 1, 5, 1, 5, 1, 5, 1]) == [[0, 2, 4, 6, 8], [1], [3], [5], [7], [9]]\n assert candidate(groupSizes = [8, 1, 8, 8, 8, 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 1, 8, 8, 8, 8, 1]) == [[0, 2, 3, 4, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16, 17], [18, 19, 20, 22, 23, 24, 25], [1], [5], [21], [26]]\n assert candidate(groupSizes = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19], [20, 21], [22, 23], [24, 25], [26], [27]]\n assert candidate(groupSizes = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8]) == [[0], [1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15]]\n assert candidate(groupSizes = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14]]\n assert candidate(groupSizes = [5, 1, 5, 5, 5, 1, 5, 5, 5, 5, 1]) == [[0, 2, 3, 4, 6], [7, 8, 9], [1], [5], [10]]\n assert candidate(groupSizes = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14], [15, 16, 17], [18, 19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29]]\n assert candidate(groupSizes = [6, 6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1]) == [[0, 1, 2, 3, 4, 5], [6], [7], [8], [9], [10], [11]]\n assert candidate(groupSizes = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]\n assert candidate(groupSizes = [3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [[0, 1, 2], [3, 4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29]]\n assert candidate(groupSizes = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == [[0], [5], [1, 6], [2, 7], [3, 8], [4, 9]]\n assert candidate(groupSizes = [2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6]) == [[0], [1, 2], [3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16]]\n assert candidate(groupSizes = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == [[0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11]]\n"}, "metadata": {"canonical_parameter_names": ["groupSizes"], "leetcode_dataset_entry_point": "Solution().groupThePeople", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var groupThePeople = function(groupSizes) {", "container": null, "callable": "groupThePeople", "parameters": [{"name": "groupSizes", "type": "number[]"}], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1283, "task_id": "find-the-smallest-divisor-given-a-threshold", "difficulty": "Medium", "problem_description": "Given an array of integers nums and an integer threshold, we will choose a positive integer divisor, divide all the array by it, and sum the division's result. Find the smallest divisor such that the result mentioned above is less than or equal to threshold.\nEach result of the division is rounded to the nearest integer greater than or equal to that element. (For example: 7/3 = 3 and 10/2 = 5).\nThe test cases are generated so that there will be an answer.\n \nExample 1:\n\nInput: nums = [1,2,5,9], threshold = 6\nOutput: 5\nExplanation: We can get a sum to 17 (1+2+5+9) if the divisor is 1. \nIf the divisor is 4 we can get a sum of 7 (1+1+2+3) and if the divisor is 5 the sum will be 5 (1+1+1+2). \n\nExample 2:\n\nInput: nums = [44,22,33,11,1], threshold = 5\nOutput: 44\n\n \nConstraints:\n\n1 <= nums.length <= 5 * 104\n1 <= nums[i] <= 106\nnums.length <= threshold <= 106\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 20, 30, 40, 50],threshold = 15) == 10\n assert candidate(nums = [44, 22, 33, 11, 1],threshold = 5) == 44\n assert candidate(nums = [1, 1, 1, 1, 1],threshold = 5) == 1\n assert candidate(nums = [10, 20, 30, 40, 50],threshold = 100) == 2\n assert candidate(nums = [999999, 999999, 999999],threshold = 2999997) == 1\n assert candidate(nums = [1, 1, 1, 1, 1],threshold = 1) == 2\n assert candidate(nums = [1, 2, 5, 9],threshold = 6) == 5\n assert candidate(nums = [1000000],threshold = 1000000) == 1\n assert candidate(nums = [123456, 234567, 345678, 456789, 567890, 678901, 789012, 890123, 901234, 1012345],threshold = 2500000) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],threshold = 30) == 30\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15],threshold = 50) == 7\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],threshold = 20) == 7\n assert candidate(nums = [500000, 500000, 500000, 500000, 500000],threshold = 1000000) == 3\n assert candidate(nums = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],threshold = 1000) == 17\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],threshold = 18) == 9\n assert candidate(nums = [100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000],threshold = 1000000) == 6\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],threshold = 100) == 4\n assert candidate(nums = [100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000],threshold = 5000000) == 2\n assert candidate(nums = [1000000, 1000000, 1000000, 1000000, 1000000],threshold = 500000) == 10\n assert candidate(nums = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288],threshold = 1000000) == 2\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],threshold = 100) == 58\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1],threshold = 20) == 3\n assert candidate(nums = [500, 400, 300, 200, 100],threshold = 50) == 32\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],threshold = 50) == 9\n assert candidate(nums = [1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000],threshold = 10000000) == 1\n assert candidate(nums = [987654, 876543, 765432, 654321, 543210, 432109, 321098, 210987, 109876],threshold = 4000000) == 2\n assert candidate(nums = [1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 10000000],threshold = 55000000) == 1\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],threshold = 50) == 25\n assert candidate(nums = [999999, 999999, 999999, 999999, 999999, 999999, 999999, 999999, 999999, 999999],threshold = 9999990) == 1\n assert candidate(nums = [1000000, 500000, 250000, 125000, 62500, 31250],threshold = 1000000) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],threshold = 30) == 2\n assert candidate(nums = [800, 800, 800, 800, 800, 800, 800, 800, 800, 800],threshold = 10) == 800\n assert candidate(nums = [987654, 321456, 789012, 456789, 234567],threshold = 2000000) == 2\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71],threshold = 50) == 16\n assert candidate(nums = [100000, 200000, 300000, 400000, 500000],threshold = 200000) == 8\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],threshold = 100) == 24\n assert candidate(nums = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],threshold = 30) == 5\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],threshold = 10) == 6\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],threshold = 50) == 2\n assert candidate(nums = [123456, 654321, 111111, 222222, 333333, 444444, 555555, 666666, 777777, 888888],threshold = 1000000) == 5\n assert candidate(nums = [123456, 654321, 111111, 222222, 333333, 444444, 555555],threshold = 1000000) == 3\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500],threshold = 300) == 41\n assert candidate(nums = [500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000],threshold = 1000000) == 5\n assert candidate(nums = [888888, 888887, 888886, 888885, 888884, 888883, 888882, 888881, 888880, 888879],threshold = 8888800) == 2\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000],threshold = 20) == 834\n assert candidate(nums = [1000000, 999999, 999998, 999997],threshold = 3999990) == 2\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],threshold = 20) == 20\n assert candidate(nums = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000],threshold = 50000) == 2\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],threshold = 20) == 5\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],threshold = 10) == 10\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],threshold = 50) == 1200\n assert candidate(nums = [123456, 789012, 345678, 901234, 567890],threshold = 2000000) == 2\n assert candidate(nums = [500000, 1000000, 1500000, 2000000, 2500000],threshold = 5000000) == 2\n assert candidate(nums = [123456, 234567, 345678, 456789, 567890],threshold = 500000) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],threshold = 25) == 3\n assert candidate(nums = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100],threshold = 25) == 100\n assert candidate(nums = [500000, 400000, 300000, 200000, 100000],threshold = 1000000) == 2\n assert candidate(nums = [1000000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],threshold = 10000000) == 1\n assert candidate(nums = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],threshold = 75) == 16\n assert candidate(nums = [1000000, 999999, 999998, 999997, 999996],threshold = 5000000) == 1\n assert candidate(nums = [500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500],threshold = 10000) == 1\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000],threshold = 210101) == 6\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000],threshold = 111111) == 11\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],threshold = 25) == 267\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],threshold = 18) == 4\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],threshold = 75) == 18\n assert candidate(nums = [123456, 234567, 345678, 456789, 567890],threshold = 1500000) == 2\n assert candidate(nums = [987654, 987654, 987654, 987654, 987654, 987654, 987654, 987654, 987654, 987654],threshold = 5000000) == 2\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000],threshold = 1111111) == 1\n assert candidate(nums = [1000000, 999999, 888888, 777777, 666666],threshold = 5000000) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],threshold = 100) == 3\n assert candidate(nums = [1000000, 500000, 250000, 125000, 62500, 31250, 15625],threshold = 2000000) == 1\n assert candidate(nums = [1000000, 500000, 250000, 125000, 62500, 31250, 15625, 7812, 3906, 1953, 976, 488, 244, 122, 61, 30, 15, 7, 3, 1],threshold = 20) == 1000000\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],threshold = 50) == 120\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000],threshold = 2101011) == 1\n assert candidate(nums = [500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000, 500000],threshold = 5000000) == 1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],threshold = 12) == 8\n assert candidate(nums = [999, 999, 999, 999, 999, 999, 999, 999, 999, 999],threshold = 1000) == 10\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],threshold = 1000) == 22\n assert candidate(nums = [500000, 499999, 499998, 499997, 499996],threshold = 2499980) == 2\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],threshold = 20) == 10\n"}, "metadata": {"canonical_parameter_names": ["nums", "threshold"], "leetcode_dataset_entry_point": "Solution().smallestDivisor", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var smallestDivisor = function(nums, threshold) {", "container": null, "callable": "smallestDivisor", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "threshold", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1284, "task_id": "minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix", "difficulty": "Hard", "problem_description": "Given a m x n binary matrix mat. In one step, you can choose one cell and flip it and all the four neighbors of it if they exist (Flip is changing 1 to 0 and 0 to 1). A pair of cells are called neighbors if they share one edge.\nReturn the minimum number of steps required to convert mat to a zero matrix or -1 if you cannot.\nA binary matrix is a matrix with all cells equal to 0 or 1 only.\nA zero matrix is a matrix with all cells equal to 0.\n \nExample 1:\n\n\nInput: mat = [[0,0],[0,1]]\nOutput: 3\nExplanation: One possible solution is to flip (1, 0) then (0, 1) and finally (1, 1) as shown.\n\nExample 2:\n\nInput: mat = [[0]]\nOutput: 0\nExplanation: Given matrix is a zero matrix. We do not need to change it.\n\nExample 3:\n\nInput: mat = [[1,0,0],[1,0,0]]\nOutput: -1\nExplanation: Given matrix cannot be a zero matrix.\n\n \nConstraints:\n\nm == mat.length\nn == mat[i].length\n1 <= m, n <= 3\nmat[i][j] is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(mat = [[0, 0], [0, 1]]) == 3\n assert candidate(mat = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == 5\n assert candidate(mat = [[1, 1], [1, 1]]) == 4\n assert candidate(mat = [[0]]) == 0\n assert candidate(mat = [[1, 1, 0], [0, 0, 0], [0, 0, 1]]) == 6\n assert candidate(mat = [[0, 1, 0], [1, 0, 1], [0, 1, 0]]) == 4\n assert candidate(mat = [[1, 0, 0], [1, 0, 0]]) == -1\n assert candidate(mat = [[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]]) == -1\n assert candidate(mat = [[1, 0, 1, 1], [0, 1, 0, 0], [1, 0, 1, 0], [1, 0, 0, 1]]) == -1\n assert candidate(mat = [[1, 1, 0, 0], [0, 1, 1, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == -1\n assert candidate(mat = [[1, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == -1\n assert candidate(mat = [[1, 0, 1, 1], [0, 1, 0, 0], [1, 0, 1, 1], [0, 0, 0, 1]]) == -1\n assert candidate(mat = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]]) == 4\n assert candidate(mat = [[0, 1, 1], [1, 1, 0], [1, 0, 1]]) == 8\n assert candidate(mat = [[1, 1, 1, 0], [0, 0, 1, 1], [1, 0, 0, 1], [0, 1, 1, 0]]) == -1\n assert candidate(mat = [[1, 1, 0, 1], [0, 0, 0, 1], [1, 0, 1, 1], [0, 1, 1, 0]]) == -1\n assert candidate(mat = [[0, 0, 1, 0], [0, 1, 0, 0], [1, 0, 0, 1], [0, 0, 1, 0]]) == -1\n assert candidate(mat = [[1, 1, 1, 0], [1, 0, 0, 1], [0, 1, 1, 0], [0, 0, 1, 1]]) == -1\n assert candidate(mat = [[0, 1, 1, 0], [1, 0, 0, 1], [1, 0, 0, 1], [0, 1, 1, 0]]) == 4\n assert candidate(mat = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1]]) == 4\n assert candidate(mat = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 0\n assert candidate(mat = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]]) == 6\n assert candidate(mat = [[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == -1\n assert candidate(mat = [[1, 0, 1], [0, 1, 0], [1, 0, 1], [0, 1, 0]]) == 7\n assert candidate(mat = [[1, 0, 1], [0, 1, 0], [1, 0, 1]]) == 9\n assert candidate(mat = [[1, 1, 1], [0, 1, 0], [1, 1, 1]]) == 3\n assert candidate(mat = [[0, 1, 0], [1, 1, 1], [0, 1, 0]]) == 1\n assert candidate(mat = [[0, 1, 1], [1, 0, 1], [1, 1, 0]]) == 2\n assert candidate(mat = [[1, 1, 0], [1, 0, 1], [0, 1, 1]]) == 2\n assert candidate(mat = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 4\n assert candidate(mat = [[1, 1, 1], [1, 1, 0], [1, 0, 1]]) == 5\n assert candidate(mat = [[1, 1, 1], [1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 8\n assert candidate(mat = [[1, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 1]]) == 6\n assert candidate(mat = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 8\n assert candidate(mat = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0\n assert candidate(mat = [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) == -1\n assert candidate(mat = [[0, 0, 1, 1], [1, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1]]) == 5\n assert candidate(mat = [[1, 1, 0, 0], [0, 0, 1, 1], [1, 1, 0, 0], [0, 0, 1, 1]]) == -1\n assert candidate(mat = [[1, 1, 1], [1, 0, 1], [1, 1, 1], [1, 0, 1]]) == 9\n assert candidate(mat = [[0, 0, 1, 1], [0, 0, 1, 1], [1, 1, 0, 0], [1, 1, 0, 0]]) == -1\n assert candidate(mat = [[0, 0, 1, 1], [0, 1, 0, 1], [1, 0, 1, 0], [1, 1, 0, 0]]) == -1\n assert candidate(mat = [[0, 1, 1, 1, 0], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [0, 1, 1, 1, 0]]) == 5\n assert candidate(mat = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 7\n assert candidate(mat = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) == 3\n assert candidate(mat = [[0, 0, 1, 1], [1, 1, 0, 0], [0, 0, 1, 1], [1, 1, 0, 0]]) == -1\n assert candidate(mat = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == -1\n assert candidate(mat = [[0, 0, 0], [0, 1, 0], [0, 0, 0]]) == 5\n assert candidate(mat = [[1, 0, 1, 1], [0, 1, 0, 0], [1, 0, 1, 1], [0, 0, 0, 0]]) == -1\n assert candidate(mat = [[1, 1, 1, 0], [0, 0, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == -1\n assert candidate(mat = [[1, 1, 0], [1, 1, 0], [0, 0, 0]]) == 6\n assert candidate(mat = [[1, 1, 1], [0, 0, 0], [1, 1, 1]]) == 2\n assert candidate(mat = [[1, 1, 1, 0], [0, 1, 0, 1], [1, 0, 0, 1], [0, 1, 1, 0]]) == -1\n assert candidate(mat = [[0, 0, 1], [0, 1, 0], [1, 0, 0]]) == 3\n"}, "metadata": {"canonical_parameter_names": ["mat"], "leetcode_dataset_entry_point": "Solution().minFlips", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minFlips = function(mat) {", "container": null, "callable": "minFlips", "parameters": [{"name": "mat", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1287, "task_id": "element-appearing-more-than-25-in-sorted-array", "difficulty": "Easy", "problem_description": "Given an integer array sorted in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time, return that integer.\n \nExample 1:\n\nInput: arr = [1,2,2,6,6,6,6,7,10]\nOutput: 6\n\nExample 2:\n\nInput: arr = [1,1]\nOutput: 1\n\n \nConstraints:\n\n1 <= arr.length <= 104\n0 <= arr[i] <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 2, 3, 4, 4, 4, 4, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(arr = [1, 1]) == 1\n assert candidate(arr = [1, 2, 2, 2, 3, 4, 5, 6]) == 2\n assert candidate(arr = [1, 1, 2, 3, 4, 4, 4, 4, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(arr = [0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 0\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 9, 10]) == 8\n assert candidate(arr = [1, 2, 3, 4, 4, 4, 4, 4, 4, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 5\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 9, 10, 11, 12]) == 8\n assert candidate(arr = [1, 1, 1, 1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(arr = [1, 2, 3, 3, 3, 3, 4, 5, 6, 7]) == 3\n assert candidate(arr = [0, 0, 0, 0, 1, 2, 3, 4, 5, 6]) == 0\n assert candidate(arr = [7, 7, 7, 7, 8, 9, 10]) == 7\n assert candidate(arr = [3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]) == 3\n assert candidate(arr = [1, 2, 2, 6, 6, 6, 6, 7, 10]) == 6\n assert candidate(arr = [3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(arr = [3, 3, 3, 3, 4, 5, 6, 7, 8, 9]) == 3\n assert candidate(arr = [1, 2, 2, 2, 3, 3, 4, 4, 4, 4]) == 2\n assert candidate(arr = [1, 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]) == 10\n assert candidate(arr = [5, 5, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == 5\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 3, 3, 4, 5]) == 3\n assert candidate(arr = [1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(arr = [5, 5, 5, 5, 6, 7, 8, 9, 10]) == 5\n assert candidate(arr = [10, 10, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]) == 10\n assert candidate(arr = [3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == 3\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(arr = [1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 11, 12, 13, 14]) == 10\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 4\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 2\n assert candidate(arr = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10]) == 5\n assert candidate(arr = [1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 6\n assert candidate(arr = [0, 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 5, 6, 7, 8, 9, 10]) == 4\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10]) == 2\n assert candidate(arr = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 4\n assert candidate(arr = [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 5]) == 2\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 2\n assert candidate(arr = [1, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 1\n assert candidate(arr = [1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5]) == 5\n assert candidate(arr = [25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == 25\n assert candidate(arr = [1, 2, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 5\n assert candidate(arr = [10, 20, 20, 20, 20, 30, 30, 30, 30, 40, 40, 40, 40, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 50\n assert candidate(arr = [1, 2, 3, 4, 5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == 5\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 5\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 5\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == 5\n assert candidate(arr = [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5]) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10]) == 5\n assert candidate(arr = [0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 0\n assert candidate(arr = [0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 9, 9, 9, 9, 9, 10, 11, 12]) == 9\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5]) == 1\n assert candidate(arr = [10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40]) == 20\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 5\n assert candidate(arr = [1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 6\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 10\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 1\n assert candidate(arr = [1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 2\n assert candidate(arr = [1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) == 6\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\n assert candidate(arr = [1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10]) == 3\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4]) == 1\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 1\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 1\n assert candidate(arr = [100, 100, 100, 100, 100, 100, 100, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]) == 100\n assert candidate(arr = [1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10]) == 5\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == 6\n assert candidate(arr = [1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 4\n assert candidate(arr = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 1\n assert candidate(arr = [1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10]) == 4\n assert candidate(arr = [1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 3\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3]) == 1\n assert candidate(arr = [0, 0, 0, 0, 1, 2, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10]) == 5\n assert candidate(arr = [1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 5\n assert candidate(arr = [1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]) == 3\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5]) == 1\n assert candidate(arr = [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4]) == 1\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().findSpecialInteger", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findSpecialInteger = function(arr) {", "container": null, "callable": "findSpecialInteger", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1288, "task_id": "remove-covered-intervals", "difficulty": "Medium", "problem_description": "Given an array intervals where intervals[i] = [li, ri] represent the interval [li, ri), remove all intervals that are covered by another interval in the list.\nThe interval [a, b) is covered by the interval [c, d) if and only if c <= a and b <= d.\nReturn the number of remaining intervals.\n \nExample 1:\n\nInput: intervals = [[1,4],[3,6],[2,8]]\nOutput: 2\nExplanation: Interval [3,6] is covered by [2,8], therefore it is removed.\n\nExample 2:\n\nInput: intervals = [[1,4],[2,3]]\nOutput: 1\n\n \nConstraints:\n\n1 <= intervals.length <= 1000\nintervals[i].length == 2\n0 <= li < ri <= 105\nAll the given intervals are unique.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5]]) == 4\n assert candidate(intervals = [[1, 100], [2, 50], [3, 75]]) == 1\n assert candidate(intervals = [[1, 3], [2, 4], [3, 5]]) == 3\n assert candidate(intervals = [[1, 4], [3, 6], [2, 8]]) == 2\n assert candidate(intervals = [[1, 2], [1, 4], [3, 4]]) == 1\n assert candidate(intervals = [[1, 4], [2, 3]]) == 1\n assert candidate(intervals = [[0, 10], [5, 12]]) == 2\n assert candidate(intervals = [[1, 100], [50, 51], [51, 101]]) == 2\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4]]) == 3\n assert candidate(intervals = [[1, 2], [1, 3], [1, 4]]) == 1\n assert candidate(intervals = [[0, 10], [5, 15], [15, 20]]) == 3\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6]]) == 5\n assert candidate(intervals = [[1, 5], [2, 5], [3, 5]]) == 1\n assert candidate(intervals = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6]]) == 1\n assert candidate(intervals = [[1, 2]]) == 1\n assert candidate(intervals = [[1, 5], [2, 3], [4, 6], [5, 7], [6, 8]]) == 4\n assert candidate(intervals = [[3, 10], [5, 7], [7, 9], [8, 10], [2, 3]]) == 2\n assert candidate(intervals = [[1, 10], [2, 5], [3, 7], [4, 8], [5, 9]]) == 1\n assert candidate(intervals = [[1, 100], [1, 50], [1, 25], [1, 125]]) == 1\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8]]) == 7\n assert candidate(intervals = [[2, 5], [3, 7], [5, 10], [1, 15]]) == 1\n assert candidate(intervals = [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [10, 60]]) == 1\n assert candidate(intervals = [[1, 5], [5, 10], [10, 15], [15, 20], [20, 25]]) == 5\n assert candidate(intervals = [[1, 5], [2, 3], [4, 9], [5, 7], [6, 8]]) == 2\n assert candidate(intervals = [[1, 500], [50, 1000], [100, 1500], [150, 2000], [200, 2500]]) == 5\n assert candidate(intervals = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9]]) == 7\n assert candidate(intervals = [[1, 20], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == 1\n assert candidate(intervals = [[1, 100000], [2, 99999], [3, 99998], [4, 99997]]) == 1\n assert candidate(intervals = [[5, 10], [10, 20], [15, 25], [20, 30], [25, 35]]) == 5\n assert candidate(intervals = [[1, 3], [3, 5], [5, 7], [7, 9], [9, 11], [1, 11]]) == 1\n assert candidate(intervals = [[1, 10], [2, 5], [3, 7], [8, 9], [5, 6]]) == 1\n assert candidate(intervals = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6]]) == 1\n assert candidate(intervals = [[1, 10], [2, 5], [3, 7], [5, 9], [6, 8]]) == 1\n assert candidate(intervals = [[1, 10], [1, 9], [1, 8], [1, 7], [1, 6], [1, 5], [1, 4], [1, 3], [1, 2]]) == 1\n assert candidate(intervals = [[10, 20], [15, 25], [5, 30], [20, 30], [25, 35]]) == 2\n assert candidate(intervals = [[5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12]]) == 7\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]]) == 6\n assert candidate(intervals = [[5, 10], [6, 9], [7, 8], [8, 7], [9, 10], [10, 11]]) == 2\n assert candidate(intervals = [[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2]]) == 1\n assert candidate(intervals = [[1, 100], [50, 150], [10, 50], [20, 30], [70, 100]]) == 2\n assert candidate(intervals = [[1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 13]]) == 9\n assert candidate(intervals = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]]) == 8\n assert candidate(intervals = [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60]]) == 5\n assert candidate(intervals = [[1, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 13], [10, 14]]) == 10\n assert candidate(intervals = [[1, 5], [6, 10], [11, 15], [16, 20], [21, 25], [26, 30]]) == 6\n assert candidate(intervals = [[5, 10], [10, 15], [15, 20], [1, 5], [5, 5]]) == 4\n assert candidate(intervals = [[10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [15, 45]]) == 4\n assert candidate(intervals = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10]]) == 8\n assert candidate(intervals = [[1, 10], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9]]) == 1\n assert candidate(intervals = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 5\n assert candidate(intervals = [[1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10]]) == 1\n assert candidate(intervals = [[1, 100], [5, 95], [10, 90], [15, 85], [20, 80], [25, 75], [30, 70], [35, 65], [40, 60], [45, 55]]) == 1\n assert candidate(intervals = [[1, 10], [11, 20], [21, 30], [31, 40], [41, 50]]) == 5\n assert candidate(intervals = [[1, 4], [2, 5], [3, 9], [4, 8], [5, 7]]) == 3\n assert candidate(intervals = [[1, 10], [5, 15], [10, 20], [0, 30]]) == 1\n assert candidate(intervals = [[5, 10], [6, 15], [10, 15], [15, 20], [16, 20]]) == 3\n assert candidate(intervals = [[1, 10], [11, 20], [21, 30], [31, 40], [41, 50]]) == 5\n assert candidate(intervals = [[10, 20], [20, 30], [30, 40], [40, 50], [10, 50], [15, 45], [25, 35]]) == 1\n assert candidate(intervals = [[1, 4], [2, 8], [3, 12], [4, 16], [5, 20], [6, 24], [7, 28]]) == 7\n assert candidate(intervals = [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]) == 5\n assert candidate(intervals = [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10]]) == 1\n assert candidate(intervals = [[1, 4], [1, 5], [1, 6], [1, 7]]) == 1\n assert candidate(intervals = [[5, 10], [10, 15], [15, 20], [20, 25], [25, 30], [30, 35]]) == 6\n assert candidate(intervals = [[10, 20], [15, 25], [5, 30], [25, 35], [30, 40]]) == 3\n assert candidate(intervals = [[10, 20], [15, 25], [20, 30], [25, 35], [30, 40], [5, 45]]) == 1\n assert candidate(intervals = [[5, 10], [10, 15], [15, 20], [5, 20], [10, 16]]) == 1\n assert candidate(intervals = [[1, 5], [2, 6], [3, 7], [4, 8], [5, 9]]) == 5\n assert candidate(intervals = [[1, 4], [2, 3], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9]]) == 6\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == 9\n assert candidate(intervals = [[1, 100], [50, 150], [100, 200], [200, 300], [250, 350]]) == 5\n assert candidate(intervals = [[1, 20], [2, 3], [3, 19], [19, 20], [15, 18]]) == 1\n assert candidate(intervals = [[1, 10], [2, 5], [5, 7], [6, 9], [8, 10]]) == 1\n assert candidate(intervals = [[1, 10], [2, 5], [3, 7], [6, 9], [4, 8]]) == 1\n assert candidate(intervals = [[5, 10], [10, 15], [15, 20], [20, 25], [25, 30], [30, 35], [5, 35]]) == 1\n assert candidate(intervals = [[0, 5], [5, 10], [10, 15], [15, 20], [0, 20], [1, 19], [2, 18], [3, 17]]) == 1\n assert candidate(intervals = [[1, 5], [2, 3], [4, 6], [3, 7], [8, 10], [9, 11], [10, 12]]) == 5\n assert candidate(intervals = [[5, 10], [4, 9], [3, 8], [2, 7], [1, 6]]) == 5\n assert candidate(intervals = [[5, 10], [10, 20], [20, 30], [30, 40], [40, 50], [50, 60], [60, 70]]) == 7\n assert candidate(intervals = [[10, 20], [20, 30], [25, 40], [35, 50], [45, 60]]) == 5\n assert candidate(intervals = [[1, 20], [10, 20], [15, 20], [5, 25], [1, 30], [25, 35], [30, 40]]) == 3\n assert candidate(intervals = [[10, 20], [15, 25], [20, 30], [25, 35], [30, 40], [5, 15], [10, 30], [15, 35], [20, 40]]) == 4\n assert candidate(intervals = [[0, 1000], [1, 999], [2, 998], [3, 997], [4, 996]]) == 1\n assert candidate(intervals = [[1, 1000], [50, 550], [100, 900], [200, 800], [300, 700], [400, 600], [500, 550], [600, 650], [700, 750]]) == 1\n assert candidate(intervals = [[5, 10], [10, 15], [15, 20], [20, 25], [25, 30], [30, 35], [35, 40], [40, 45], [45, 50]]) == 9\n assert candidate(intervals = [[100, 200], [150, 250], [50, 150], [200, 300]]) == 4\n assert candidate(intervals = [[1, 10], [2, 5], [3, 7], [4, 9], [5, 6]]) == 1\n assert candidate(intervals = [[100, 200], [100, 200], [150, 250], [50, 150], [200, 300]]) == 4\n assert candidate(intervals = [[1, 10], [11, 20], [21, 30], [31, 40], [41, 50], [51, 60], [61, 70]]) == 7\n assert candidate(intervals = [[1, 5], [2, 4], [3, 3], [4, 2], [5, 1]]) == 1\n assert candidate(intervals = [[1, 4], [2, 5], [3, 6], [4, 7], [5, 8], [6, 9], [7, 10]]) == 7\n assert candidate(intervals = [[5, 10], [10, 15], [15, 20], [20, 25], [5, 25]]) == 1\n assert candidate(intervals = [[1, 4], [1, 6], [1, 8], [1, 10], [1, 12]]) == 1\n assert candidate(intervals = [[1, 4], [2, 3], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == 7\n assert candidate(intervals = [[1, 5], [5, 10], [10, 15], [15, 20], [20, 25], [25, 30], [30, 35], [35, 40]]) == 8\n assert candidate(intervals = [[1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10], [1, 2], [2, 3], [3, 4]]) == 1\n assert candidate(intervals = [[1, 3], [2, 5], [4, 7], [6, 9], [8, 10]]) == 5\n assert candidate(intervals = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8], [7, 9], [8, 10], [9, 11], [10, 12], [11, 13], [12, 14]]) == 12\n assert candidate(intervals = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7]]) == 5\n assert candidate(intervals = [[1, 10], [1, 5], [1, 3], [1, 2], [2, 10], [2, 5], [2, 3], [3, 10], [3, 5], [4, 10]]) == 1\n assert candidate(intervals = [[1, 10], [2, 8], [3, 6], [4, 5], [5, 4], [6, 3], [8, 2], [10, 1]]) == 1\n assert candidate(intervals = [[0, 10], [5, 15], [10, 20], [15, 25]]) == 4\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == 8\n assert candidate(intervals = [[1, 10000], [2, 9999], [3, 9998], [4, 9997], [5, 9996]]) == 1\n assert candidate(intervals = [[1, 3], [3, 5], [5, 7], [7, 9], [9, 11], [1, 11]]) == 1\n assert candidate(intervals = [[1, 100], [50, 150], [100, 200], [150, 250], [200, 300]]) == 5\n assert candidate(intervals = [[10, 20], [15, 25], [20, 30], [25, 35], [30, 40]]) == 5\n assert candidate(intervals = [[1, 5], [5, 10], [10, 15], [15, 20], [20, 25], [1, 25]]) == 1\n assert candidate(intervals = [[1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9]]) == 1\n assert candidate(intervals = [[1, 10], [2, 5], [3, 7], [8, 15], [5, 12]]) == 3\n assert candidate(intervals = [[5, 10], [1, 3], [4, 5], [8, 11], [10, 15]]) == 5\n assert candidate(intervals = [[1, 100], [5, 50], [10, 90], [20, 80], [30, 70], [40, 60]]) == 1\n"}, "metadata": {"canonical_parameter_names": ["intervals"], "leetcode_dataset_entry_point": "Solution().removeCoveredIntervals", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var removeCoveredIntervals = function(intervals) {", "container": null, "callable": "removeCoveredIntervals", "parameters": [{"name": "intervals", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1289, "task_id": "minimum-falling-path-sum-ii", "difficulty": "Hard", "problem_description": "Given an n x n integer matrix grid, return the minimum sum of a falling path with non-zero shifts.\nA falling path with non-zero shifts is a choice of exactly one element from each row of grid such that no two elements chosen in adjacent rows are in the same column.\n \nExample 1:\n\n\nInput: grid = [[1,2,3],[4,5,6],[7,8,9]]\nOutput: 13\nExplanation: \nThe possible falling paths are:\n[1,5,9], [1,5,7], [1,6,7], [1,6,8],\n[2,4,8], [2,4,9], [2,6,7], [2,6,8],\n[3,4,8], [3,4,9], [3,5,7], [3,5,9]\nThe falling path with the smallest sum is [1,5,7], so the answer is 13.\n\nExample 2:\n\nInput: grid = [[7]]\nOutput: 7\n\n \nConstraints:\n\nn == grid.length == grid[i].length\n1 <= n <= 200\n-99 <= grid[i][j] <= 99\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[3, 1, 1], [1, 2, 3], [2, 3, 4]]) == 5\n assert candidate(grid = [[10, 20, 30], [30, 20, 10], [10, 10, 10]]) == 30\n assert candidate(grid = [[100, 0, 0], [0, 100, 0], [0, 0, 100]]) == 0\n assert candidate(grid = [[7]]) == 7\n assert candidate(grid = [[3, 1, 1], [1, 7, 6], [2, 7, 7]]) == 9\n assert candidate(grid = [[-99, -98, -97], [-96, -95, -94], [-93, -92, -91]]) == -287\n assert candidate(grid = [[1, 2], [3, 4]]) == 5\n assert candidate(grid = [[0, 1, 2, 3], [3, 2, 1, 0], [0, 3, 2, 1], [1, 0, 3, 2]]) == 0\n assert candidate(grid = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]]) == -17\n assert candidate(grid = [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [9, 8, 7, 6, 5], [4, 3, 2, 1, 0], [0, 1, 0, 1, 0]]) == 12\n assert candidate(grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == 13\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(grid = [[5, 3], [2, 1]]) == 5\n assert candidate(grid = [[10, 20, 30, 40, 50, 60], [60, 50, 40, 30, 20, 10], [10, 30, 50, 70, 90, 110], [110, 90, 70, 50, 30, 10], [10, 20, 30, 40, 50, 60], [60, 50, 40, 30, 20, 10]]) == 60\n assert candidate(grid = [[1, 2, 3, 4, 5], [10, 9, 8, 7, 6], [11, 12, 13, 14, 15], [20, 19, 18, 17, 16], [25, 24, 23, 22, 21]]) == 56\n assert candidate(grid = [[-1, -2, -3, -4, -5], [-10, -20, -30, -40, -50], [-5, -15, -25, -35, -45], [-6, -12, -18, -24, -30], [-7, -14, -21, -28, -35]]) == -149\n assert candidate(grid = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) == 30\n assert candidate(grid = [[100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110], [110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100], [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89], [88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78], [77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67], [66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56], [55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45], [44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34], [33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23], [22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12], [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]]) == 610\n assert candidate(grid = [[-10, -20, -30], [-30, -10, -20], [-20, -30, -10]]) == -90\n assert candidate(grid = [[100, -200, 300], [-100, 200, -300], [150, -150, 250]]) == -650\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]]) == 8\n assert candidate(grid = [[9, 3, 2, 4, 1], [5, 6, 7, 8, 9], [1, 2, 3, 4, 5], [4, 3, 2, 1, 0], [5, 6, 7, 8, 9]]) == 13\n assert candidate(grid = [[10, 50, 20, 30], [40, 10, 60, 70], [80, 90, 10, 40], [50, 20, 30, 60]]) == 50\n assert candidate(grid = [[5, 3, 8, 1], [2, 7, 1, 6], [9, 2, 5, 3], [4, 8, 2, 9]]) == 6\n assert candidate(grid = [[10, 20, 30, 40, 50], [50, 40, 30, 20, 10], [10, 30, 50, 20, 40], [40, 20, 10, 50, 30], [30, 50, 40, 10, 20]]) == 50\n assert candidate(grid = [[0, 1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1, 0], [0, 6, 5, 4, 3, 2, 1], [1, 0, 6, 5, 4, 3, 2], [2, 1, 0, 6, 5, 4, 3], [3, 2, 1, 0, 6, 5, 4], [4, 3, 2, 1, 0, 6, 5]]) == 0\n assert candidate(grid = [[99, -99, 99, -99, 99, -99, 99, -99, 99, -99], [99, 99, -99, 99, -99, 99, -99, 99, -99, 99], [-99, 99, 99, -99, 99, -99, 99, -99, 99, 99]]) == -297\n assert candidate(grid = [[-1, -2, -3], [-3, -4, -5], [-5, -6, -7]]) == -14\n assert candidate(grid = [[-1, 2, -3, 4, -5], [5, -4, 3, -2, 1], [-1, 2, 3, -4, 5], [5, 4, -3, 2, -1], [-2, -3, 4, -5, 1]]) == -21\n assert candidate(grid = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) == 0\n assert candidate(grid = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]]) == 7\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]]) == 5\n assert candidate(grid = [[0, -1, 1], [-1, 0, 1], [1, 0, -1]]) == -3\n assert candidate(grid = [[-1, -2, -3, -4, -5], [-5, -4, -3, -2, -1], [1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [-1, 1, -2, 2, -3]]) == -9\n assert candidate(grid = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]) == 57\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1], [2, 4, 6, 8, 10, 1, 3, 5, 7, 9], [9, 7, 5, 3, 1, 10, 8, 6, 4, 2], [3, 6, 9, 12, 15, 1, 4, 7, 10, 13], [13, 10, 7, 4, 1, 16, 13, 10, 7, 4], [4, 7, 10, 13, 16, 19, 22, 25, 28, 31], [31, 28, 25, 22, 19, 32, 35, 38, 41, 44]]) == 31\n assert candidate(grid = [[-100, 0, 100], [0, -100, 100], [100, 0, -100]]) == -300\n assert candidate(grid = [[10, -7, 10, -7, 10], [5, 4, -1, 6, -7], [1, 0, -2, -5, -3], [2, 6, -1, 8, -1], [0, -2, -1, 1, 2]]) == -22\n assert candidate(grid = [[5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5], [5, 5, 5, 5, 5]]) == 25\n assert candidate(grid = [[-50, -60, -70, -80, -90], [-90, -50, -60, -70, -80], [-80, -90, -50, -60, -70], [-70, -80, -90, -50, -60], [-60, -70, -80, -90, -50]]) == -450\n assert candidate(grid = [[-10, -6, -3, 0, 2], [-5, -2, 1, 2, 4], [6, 2, 0, -1, -3], [5, 2, 5, -2, 1], [8, -3, -2, 2, 2]]) == -20\n assert candidate(grid = [[-10, 10, -20, 20, -30, 30], [30, -30, 20, -20, 10, -10], [-10, 10, -20, 20, -30, 30], [30, -30, 20, -20, 10, -10], [-10, 10, -20, 20, -30, 30]]) == -150\n assert candidate(grid = [[-1, 2, -3, 4], [4, -3, 2, -1], [-2, 1, -4, 3], [3, -4, 1, -2]]) == -14\n assert candidate(grid = [[1, 3, 1, 2], [1, 2, 2, 4], [5, 3, 5, 3], [6, 4, 6, 5]]) == 9\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [2, 3, 4, 5, 6], [6, 5, 4, 3, 2], [3, 4, 5, 6, 7]]) == 9\n assert candidate(grid = [[-1, -2, -3], [-3, -2, -1], [-2, -1, -3]]) == -9\n assert candidate(grid = [[-99, -98, -97, -96, -95, -94, -93, -92, -91, -90], [-89, -88, -87, -86, -85, -84, -83, -82, -81, -80], [-79, -78, -77, -76, -75, -74, -73, -72, -71, -70]]) == -266\n assert candidate(grid = [[5, 3, 8, 6, 2], [9, 4, 1, 7, 3], [2, 6, 4, 8, 5], [7, 1, 9, 3, 6], [3, 7, 2, 5, 8]]) == 8\n assert candidate(grid = [[10, -10, 10, -10, 10], [10, 10, -10, -10, 10], [-10, 10, -10, 10, -10], [10, -10, 10, -10, 10], [-10, 10, -10, 10, -10]]) == -50\n assert candidate(grid = [[99, -99, 45, -45], [-45, 45, -99, 99], [0, 0, 0, 0], [-1, 1, -2, 2]]) == -200\n assert candidate(grid = [[-1, -10, -20, -30], [-40, -50, -60, -70], [-80, -90, -100, -110], [-120, -130, -140, -150]]) == -340\n assert candidate(grid = [[10, 20, 30, 40, 50], [50, 40, 30, 20, 10], [15, 25, 35, 45, 55], [55, 45, 35, 25, 15], [12, 22, 32, 42, 52]]) == 62\n assert candidate(grid = [[100, -50, 200], [-150, 250, -300], [350, -400, 450]]) == -750\n assert candidate(grid = [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [9, 8, 7, 6, 5], [4, 3, 2, 1, 0], [1, 3, 5, 7, 9]]) == 13\n assert candidate(grid = [[100, 200, 300, 400], [400, 300, 200, 100], [200, 100, 400, 300], [300, 400, 100, 200]]) == 400\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20], [20, 18, 16, 14, 12, 10, 8, 6, 4, 2]]) == 2\n assert candidate(grid = [[-10, -5, -8, -6], [-1, -3, -7, -4], [-3, -7, -2, -5], [-9, -4, -6, -6]]) == -33\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 5, 7, 9], [9, 7, 5, 3, 1], [2, 4, 6, 8, 10]]) == 6\n assert candidate(grid = [[10, 20, 30, 40], [40, 30, 20, 10], [10, 30, 20, 40], [40, 20, 30, 10]]) == 40\n assert candidate(grid = [[-10, 100, 200, -300, 400], [500, -600, 700, 800, -900], [100, 200, -300, 400, 500], [600, 700, 800, 900, -1000], [100, -200, 300, -400, 500]]) == -2900\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == 6\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [2, 3, 4, 5, 1], [1, 5, 4, 3, 2], [3, 2, 1, 5, 4]]) == 6\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [2, 3, 4, 5, 6], [6, 5, 4, 3, 2], [3, 4, 5, 6, 7]]) == 9\n assert candidate(grid = [[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], [100, 90, 80, 70, 60, 50, 40, 30, 20, 10], [5, 15, 25, 35, 45, 55, 65, 75, 85, 95], [95, 85, 75, 65, 55, 45, 35, 25, 15, 5], [1, 11, 21, 31, 41, 51, 61, 71, 81, 91]]) == 51\n assert candidate(grid = [[5, 10, 15, 20, 25], [30, 35, 40, 45, 50], [55, 60, 65, 70, 75], [80, 85, 90, 95, 100], [105, 110, 115, 120, 125]]) == 285\n assert candidate(grid = [[-10, 15, -20, 25], [5, -5, 0, 10], [30, -35, 40, -45], [50, -55, 60, -65]]) == -125\n assert candidate(grid = [[-1, -2, -3, -4], [-2, -3, -4, -5], [-3, -4, -5, -6], [-4, -5, -6, -7]]) == -20\n assert candidate(grid = [[-10, -50, 20, -30], [15, 10, -45, 5], [25, -20, 5, -5], [30, 20, 0, 10]]) == -115\n assert candidate(grid = [[50, 20, 30, 40], [10, 60, 70, 80], [90, 10, 40, 20], [50, 80, 60, 30]]) == 70\n assert candidate(grid = [[7, 2, 9, 3, 1], [2, 8, 3, 9, 2], [1, 5, 4, 6, 8], [6, 9, 2, 5, 3], [4, 7, 1, 6, 8]]) == 9\n assert candidate(grid = [[-10, -9, -8, -7, -6, -5, -4, -3, -2, -1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 4, 6, 8, 10, 1, 3, 5, 7, 9], [-9, -8, -7, -6, -5, -4, -3, -2, -1, 0]]) == -14\n assert candidate(grid = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [6, 7, 8, 9, 10], [10, 9, 8, 7, 6], [11, 12, 13, 14, 15]]) == 25\n assert candidate(grid = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 8, 6, 4, 2, 1, 3, 5, 7, 9]]) == 1\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[-1, 0, -1, -2, -3], [0, 1, -1, -2, -3], [2, -1, 1, -2, -3], [-1, 2, -2, 1, -3], [-2, -3, 3, 1, 0]]) == -13\n assert candidate(grid = [[100, -100, 50, -50], [-50, 50, -100, 100], [10, -10, 20, -20], [-20, 20, -10, 10]]) == -240\n assert candidate(grid = [[50, 50, 50], [50, 50, 50], [50, 50, 50]]) == 150\n assert candidate(grid = [[1, -1, 1, -1], [1, -1, 1, -1], [1, -1, 1, -1], [1, -1, 1, -1]]) == -4\n assert candidate(grid = [[-99, 99, -98, 98], [-97, 97, -96, 96], [-95, 95, -94, 94], [-93, 93, -92, 92]]) == -382\n assert candidate(grid = [[-1, 3, 2, 2, 0], [-2, 0, -1, -1, -1], [0, -3, -2, -1, 1], [1, -1, 1, -2, -2], [1, 2, 0, -1, -1]]) == -8\n assert candidate(grid = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]]) == 0\n assert candidate(grid = [[-99, 0, 99], [-99, 0, 99], [-99, 0, 99]]) == -198\n"}, "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().minFallingPathSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var minFallingPathSum = function(grid) {", "container": null, "callable": "minFallingPathSum", "parameters": [{"name": "grid", "type": "number[][]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1290, "task_id": "convert-binary-number-in-a-linked-list-to-integer", "difficulty": "Easy", "problem_description": "Given head which is a reference node to a singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the binary representation of a number.\nReturn the decimal value of the number in the linked list.\nThe most significant bit is at the head of the linked list.\n \nExample 1:\n\n\nInput: head = [1,0,1]\nOutput: 5\nExplanation: (101) in base 2 = (5) in base 10\n\nExample 2:\n\nInput: head = [0]\nOutput: 0\n\n \nConstraints:\n\nThe Linked List is not empty.\nNumber of nodes will not exceed 30.\nEach node's value is either 0 or 1.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(head = list_node([1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0])) == 1648386068\n assert candidate(head = list_node([1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0])) == 18880\n assert candidate(head = list_node([1, 0, 0, 1, 1, 0, 1])) == 77\n assert candidate(head = list_node([0])) == 0\n assert candidate(head = list_node([1, 0, 0, 1, 0, 1])) == 37\n assert candidate(head = list_node([1, 1, 0, 0])) == 12\n assert candidate(head = list_node([1])) == 1\n assert candidate(head = list_node([1, 1, 0, 0, 1, 1, 1, 0, 1, 0])) == 826\n assert candidate(head = list_node([1, 0, 1])) == 5\n assert candidate(head = list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 2147483647\n assert candidate(head = list_node([1, 0, 0, 1, 0])) == 18\n assert candidate(head = list_node([1, 1, 1])) == 7\n assert candidate(head = list_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])) == 1073741825\n assert candidate(head = list_node([1, 1, 1, 1])) == 15\n assert candidate(head = list_node([1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0])) == 954437176\n assert candidate(head = list_node([1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])) == 648719018\n assert candidate(head = list_node([0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 134217728\n assert candidate(head = list_node([1, 0, 1, 1, 0, 1, 1, 0, 1])) == 365\n assert candidate(head = list_node([1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0])) == 1304806852\n assert candidate(head = list_node([1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])) == 984263338\n assert candidate(head = list_node([1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 894784853\n assert candidate(head = list_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1])) == 715827883\n assert candidate(head = list_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])) == 1\n assert candidate(head = list_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0])) == 1431655766\n assert candidate(head = list_node([1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])) == 939524097\n assert candidate(head = list_node([1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0])) == 920350134\n assert candidate(head = list_node([1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0])) == 969831324\n assert candidate(head = list_node([0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0])) == 536870910\n assert candidate(head = list_node([1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0])) == 900557658\n assert candidate(head = list_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1])) == 3\n assert candidate(head = list_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 536870912\n assert candidate(head = list_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0])) == 715827882\n assert candidate(head = list_node([0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0])) == 214748364\n assert candidate(head = list_node([1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0])) == 899337574\n assert candidate(head = list_node([1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0])) == 843654290\n assert candidate(head = list_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1])) == 3\n assert candidate(head = list_node([1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1])) == 966367641\n assert candidate(head = list_node([1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 760567125\n assert candidate(head = list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == 1073741823\n assert candidate(head = list_node([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 357913941\n assert candidate(head = list_node([1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) == 939524096\n assert candidate(head = list_node([0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1])) == 178956971\n assert candidate(head = list_node([1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0])) == 644245094\n assert candidate(head = list_node([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1])) == 715827883\n assert candidate(head = list_node([0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1])) == 429496729\n assert candidate(head = list_node([1, 0, 1, 1, 0, 1, 1, 1, 0, 1])) == 733\n assert candidate(head = list_node([1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1])) == 858993459\n assert candidate(head = list_node([1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0])) == 1010580540\n assert candidate(head = list_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])) == 536870913\n assert candidate(head = list_node([1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1])) == 697932185\n assert candidate(head = list_node([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])) == 1431655765\n assert candidate(head = list_node([1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0])) == 900310682\n assert candidate(head = list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0])) == 4294967292\n assert candidate(head = list_node([1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0])) == 613566756\n assert candidate(head = list_node([1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0])) == 692736660\n assert candidate(head = list_node([0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0])) == 107374182\n assert candidate(head = list_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])) == 1\n assert candidate(head = list_node([0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0])) == 143165576\n assert candidate(head = list_node([1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1])) == 769045933\n assert candidate(head = list_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1])) == 3\n assert candidate(head = list_node([1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1])) == 1002159035\n"}, "metadata": {"canonical_parameter_names": ["head"], "leetcode_dataset_entry_point": "Solution().getDecimalValue", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var getDecimalValue = function(head) {", "container": null, "callable": "getDecimalValue", "parameters": [{"name": "head", "type": "ListNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1291, "task_id": "sequential-digits", "difficulty": "Medium", "problem_description": "An integer has sequential digits if and only if each digit in the number is one more than the previous digit.\nReturn a sorted list of all the integers in the range [low, high] inclusive that have sequential digits.\n \nExample 1:\nInput: low = 100, high = 300\nOutput: [123,234]\nExample 2:\nInput: low = 1000, high = 13000\nOutput: [1234,2345,3456,4567,5678,6789,12345]\n\n \nConstraints:\n\n10 <= low <= high <= 10^9\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(low = 567,high = 6789) == [567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789]\n assert candidate(low = 500,high = 700) == [567, 678]\n assert candidate(low = 10,high = 100) == [12, 23, 34, 45, 56, 67, 78, 89]\n assert candidate(low = 123456789,high = 123456789) == [123456789]\n assert candidate(low = 11,high = 22) == [12]\n assert candidate(low = 111,high = 999) == [123, 234, 345, 456, 567, 678, 789]\n assert candidate(low = 50,high = 500) == [56, 67, 78, 89, 123, 234, 345, 456]\n assert candidate(low = 789,high = 98765) == [789, 1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789]\n assert candidate(low = 123,high = 456) == [123, 234, 345, 456]\n assert candidate(low = 9876,high = 98765) == [12345, 23456, 34567, 45678, 56789]\n assert candidate(low = 1234,high = 5678) == [1234, 2345, 3456, 4567, 5678]\n assert candidate(low = 9,high = 10) == []\n assert candidate(low = 100,high = 300) == [123, 234]\n assert candidate(low = 1,high = 1000000000) == [12, 23, 34, 45, 56, 67, 78, 89, 123, 234, 345, 456, 567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 1000,high = 13000) == [1234, 2345, 3456, 4567, 5678, 6789, 12345]\n assert candidate(low = 100000,high = 999999) == [123456, 234567, 345678, 456789]\n assert candidate(low = 234567,high = 345678) == [234567, 345678]\n assert candidate(low = 123,high = 987654321) == [123, 234, 345, 456, 567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 1111,high = 2222) == [1234]\n assert candidate(low = 99999999,high = 1000000000) == [123456789]\n assert candidate(low = 80000,high = 85000) == []\n assert candidate(low = 234,high = 345678) == [234, 345, 456, 567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678]\n assert candidate(low = 50000,high = 90000) == [56789]\n assert candidate(low = 50000,high = 80000) == [56789]\n assert candidate(low = 56,high = 789) == [56, 67, 78, 89, 123, 234, 345, 456, 567, 678, 789]\n assert candidate(low = 100000,high = 200000) == [123456]\n assert candidate(low = 111,high = 123456789) == [123, 234, 345, 456, 567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 987,high = 9876) == [1234, 2345, 3456, 4567, 5678, 6789]\n assert candidate(low = 4567,high = 87654) == [4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789]\n assert candidate(low = 1234567,high = 7654321) == [1234567, 2345678, 3456789]\n assert candidate(low = 111,high = 222) == [123]\n assert candidate(low = 789,high = 789) == [789]\n assert candidate(low = 1,high = 10) == []\n assert candidate(low = 2345678,high = 3456789) == [2345678, 3456789]\n assert candidate(low = 111,high = 999999) == [123, 234, 345, 456, 567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789]\n assert candidate(low = 12345678,high = 23456789) == [12345678, 23456789]\n assert candidate(low = 1111,high = 4444) == [1234, 2345, 3456]\n assert candidate(low = 2000,high = 40000) == [2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567]\n assert candidate(low = 12345678,high = 87654321) == [12345678, 23456789]\n assert candidate(low = 4321,high = 987654321) == [4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 12,high = 89) == [12, 23, 34, 45, 56, 67, 78, 89]\n assert candidate(low = 99,high = 100) == []\n assert candidate(low = 34567,high = 987654321) == [34567, 45678, 56789, 123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 10000,high = 99999) == [12345, 23456, 34567, 45678, 56789]\n assert candidate(low = 1234567,high = 3456789) == [1234567, 2345678, 3456789]\n assert candidate(low = 300000,high = 500000) == [345678, 456789]\n assert candidate(low = 4567,high = 8901) == [4567, 5678, 6789]\n assert candidate(low = 150,high = 10000) == [234, 345, 456, 567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789]\n assert candidate(low = 10,high = 98) == [12, 23, 34, 45, 56, 67, 78, 89]\n assert candidate(low = 3456,high = 87654) == [3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789]\n assert candidate(low = 1111,high = 22222) == [1234, 2345, 3456, 4567, 5678, 6789, 12345]\n assert candidate(low = 111111,high = 222222) == [123456]\n assert candidate(low = 56789,high = 98765) == [56789]\n assert candidate(low = 88888888,high = 99999999) == []\n assert candidate(low = 123456,high = 678910) == [123456, 234567, 345678, 456789]\n assert candidate(low = 12345,high = 67890) == [12345, 23456, 34567, 45678, 56789]\n assert candidate(low = 111,high = 987654321) == [123, 234, 345, 456, 567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 1234,high = 23456789) == [1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789]\n assert candidate(low = 4000,high = 5000) == [4567]\n assert candidate(low = 890,high = 123456789) == [1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 120,high = 123) == [123]\n assert candidate(low = 1111111,high = 7777777) == [1234567, 2345678, 3456789]\n assert candidate(low = 56789,high = 67890) == [56789]\n assert candidate(low = 98765,high = 987654321) == [123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 9876,high = 1000000) == [12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789]\n assert candidate(low = 23456,high = 67890) == [23456, 34567, 45678, 56789]\n assert candidate(low = 3456789,high = 4567890) == [3456789]\n assert candidate(low = 123456,high = 123456789) == [123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 123456,high = 789012) == [123456, 234567, 345678, 456789]\n assert candidate(low = 4000000,high = 6000000) == []\n assert candidate(low = 10,high = 999999999) == [12, 23, 34, 45, 56, 67, 78, 89, 123, 234, 345, 456, 567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 987654,high = 987654321) == [1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 56789,high = 654321) == [56789, 123456, 234567, 345678, 456789]\n assert candidate(low = 300000,high = 350000) == [345678]\n assert candidate(low = 10000000,high = 99999999) == [12345678, 23456789]\n assert candidate(low = 23456,high = 345678) == [23456, 34567, 45678, 56789, 123456, 234567, 345678]\n assert candidate(low = 12,high = 123456789) == [12, 23, 34, 45, 56, 67, 78, 89, 123, 234, 345, 456, 567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 1000000,high = 1500000) == [1234567]\n assert candidate(low = 234,high = 456789) == [234, 345, 456, 567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789]\n assert candidate(low = 10000,high = 20000) == [12345]\n assert candidate(low = 250,high = 950) == [345, 456, 567, 678, 789]\n assert candidate(low = 1234,high = 56789) == [1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789]\n assert candidate(low = 890,high = 987654321) == [1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789, 1234567, 2345678, 3456789, 12345678, 23456789, 123456789]\n assert candidate(low = 50,high = 200) == [56, 67, 78, 89, 123]\n assert candidate(low = 222,high = 55555) == [234, 345, 456, 567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678]\n assert candidate(low = 900,high = 1000) == []\n assert candidate(low = 345,high = 3456789) == [345, 456, 567, 678, 789, 1234, 2345, 3456, 4567, 5678, 6789, 12345, 23456, 34567, 45678, 56789, 123456, 234567, 345678, 456789, 1234567, 2345678, 3456789]\n assert candidate(low = 9876543,high = 987654321) == [12345678, 23456789, 123456789]\n"}, "metadata": {"canonical_parameter_names": ["low", "high"], "leetcode_dataset_entry_point": "Solution().sequentialDigits", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var sequentialDigits = function(low, high) {", "container": null, "callable": "sequentialDigits", "parameters": [{"name": "low", "type": "number"}, {"name": "high", "type": "number"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1292, "task_id": "maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold", "difficulty": "Medium", "problem_description": "Given a m x n matrix mat and an integer threshold, return the maximum side-length of a square with a sum less than or equal to threshold or return 0 if there is no such square.\n \nExample 1:\n\n\nInput: mat = [[1,1,3,2,4,3,2],[1,1,3,2,4,3,2],[1,1,3,2,4,3,2]], threshold = 4\nOutput: 2\nExplanation: The maximum side length of square with sum less than 4 is 2 as shown.\n\nExample 2:\n\nInput: mat = [[2,2,2,2,2],[2,2,2,2,2],[2,2,2,2,2],[2,2,2,2,2],[2,2,2,2,2]], threshold = 1\nOutput: 0\n\n \nConstraints:\n\nm == mat.length\nn == mat[i].length\n1 <= m, n <= 300\n0 <= mat[i][j] <= 104\n0 <= threshold <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(mat = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],threshold = 10) == 3\n assert candidate(mat = [[1, 1, 3, 2, 4, 3, 2], [1, 1, 3, 2, 4, 3, 2], [1, 1, 3, 2, 4, 3, 2]],threshold = 4) == 2\n assert candidate(mat = [[2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2]],threshold = 1) == 0\n assert candidate(mat = [[10, 20, 30], [40, 50, 60], [70, 80, 90]],threshold = 100) == 1\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],threshold = 15) == 2\n assert candidate(mat = [[100, 200, 300], [200, 300, 400], [300, 400, 500]],threshold = 600) == 1\n assert candidate(mat = [[100, 200, 300], [400, 500, 600], [700, 800, 900]],threshold = 2500) == 2\n assert candidate(mat = [[100, 200, 300, 400], [500, 600, 700, 800], [900, 1000, 1100, 1200], [1300, 1400, 1500, 1600]],threshold = 2500) == 2\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [20, 18, 16, 14, 12, 10, 8, 6, 4, 2], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],threshold = 50) == 3\n assert candidate(mat = [[5, 5, 5, 5], [5, 5, 5, 5], [5, 5, 5, 5], [5, 5, 5, 5]],threshold = 20) == 2\n assert candidate(mat = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]],threshold = 30) == 3\n assert candidate(mat = [[5, 2, 4, 1, 3, 6, 8, 7, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9], [5, 2, 4, 1, 3, 6, 8, 7, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9], [5, 2, 4, 1, 3, 6, 8, 7, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9], [5, 2, 4, 1, 3, 6, 8, 7, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9], [5, 2, 4, 1, 3, 6, 8, 7, 9]],threshold = 30) == 3\n assert candidate(mat = [[5, 10, 15, 20, 25, 30], [30, 25, 20, 15, 10, 5], [5, 10, 15, 20, 25, 30], [30, 25, 20, 15, 10, 5], [5, 10, 15, 20, 25, 30], [30, 25, 20, 15, 10, 5]],threshold = 100) == 2\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 2, 4, 6, 8], [8, 6, 4, 2, 0, 1, 3, 5, 7], [2, 4, 6, 8, 0, 9, 7, 5, 3]],threshold = 30) == 3\n assert candidate(mat = [[10, 20, 30, 40], [50, 60, 70, 80], [90, 100, 110, 120], [130, 140, 150, 160]],threshold = 250) == 2\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9]],threshold = 20) == 2\n assert candidate(mat = [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]],threshold = 20) == 2\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18], [19, 20, 21]],threshold = 30) == 2\n assert candidate(mat = [[5, 5, 5, 5], [5, 5, 5, 5], [5, 5, 5, 5], [5, 5, 5, 5], [5, 5, 5, 5]],threshold = 10) == 1\n assert candidate(mat = [[100, 100, 100, 100, 100, 100], [100, 100, 100, 100, 100, 100], [100, 100, 100, 100, 100, 100], [100, 100, 100, 100, 100, 100], [100, 100, 100, 100, 100, 100]],threshold = 500) == 2\n assert candidate(mat = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]],threshold = 2) == 2\n assert candidate(mat = [[1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6, 7], [3, 4, 5, 6, 7, 8], [4, 5, 6, 7, 8, 9], [5, 6, 7, 8, 9, 10], [6, 7, 8, 9, 10, 11]],threshold = 40) == 3\n assert candidate(mat = [[2, 3, 5], [3, 8, 13], [5, 13, 21]],threshold = 20) == 2\n assert candidate(mat = [[100, 100, 100], [100, 100, 100], [100, 100, 100], [100, 100, 100]],threshold = 250) == 1\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 3, 3, 3, 3, 3, 3, 2, 1], [1, 2, 3, 4, 4, 4, 4, 3, 2, 1], [1, 2, 3, 4, 5, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 4, 4, 3, 2, 1], [1, 2, 3, 4, 5, 4, 3, 3, 2, 1], [1, 2, 3, 4, 5, 4, 3, 2, 2, 1], [1, 2, 3, 4, 5, 4, 3, 2, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],threshold = 15) == 3\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]],threshold = 30) == 2\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],threshold = 25) == 5\n assert candidate(mat = [[9, 9, 9, 9, 9, 9, 9, 9, 9, 9], [9, 9, 9, 9, 9, 9, 9, 9, 9, 9], [9, 9, 9, 9, 9, 9, 9, 9, 9, 9], [9, 9, 9, 9, 9, 9, 9, 9, 9, 9], [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]],threshold = 50) == 2\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],threshold = 15) == 3\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18]],threshold = 18) == 2\n assert candidate(mat = [[10, 11, 12], [13, 14, 15], [16, 17, 18]],threshold = 39) == 1\n assert candidate(mat = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]],threshold = 1) == 5\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]],threshold = 100) == 3\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36, 37, 38, 39, 40], [41, 42, 43, 44, 45, 46, 47, 48, 49, 50]],threshold = 100) == 2\n assert candidate(mat = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1]],threshold = 1) == 1\n assert candidate(mat = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]],threshold = 20) == 2\n assert candidate(mat = [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]],threshold = 25) == 2\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],threshold = 20) == 4\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18], [19, 20, 21]],threshold = 40) == 2\n assert candidate(mat = [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]],threshold = 20) == 2\n assert candidate(mat = [[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]],threshold = 10) == 3\n assert candidate(mat = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],threshold = 1) == 5\n assert candidate(mat = [[9, 9, 9, 9, 9], [9, 9, 9, 9, 9], [9, 9, 9, 9, 9], [9, 9, 9, 9, 9], [9, 9, 9, 9, 9]],threshold = 81) == 3\n assert candidate(mat = [[100, 200, 300], [400, 500, 600], [700, 800, 900]],threshold = 1000) == 1\n assert candidate(mat = [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]],threshold = 25) == 2\n assert candidate(mat = [[10, 10, 10, 10, 10], [10, 10, 10, 10, 10], [10, 10, 10, 10, 10], [10, 10, 10, 10, 10], [10, 10, 10, 10, 10], [10, 10, 10, 10, 10]],threshold = 50) == 2\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1]],threshold = 14) == 3\n assert candidate(mat = [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]],threshold = 100) == 4\n assert candidate(mat = [[1, 3, 1, 5, 6, 2], [2, 4, 6, 8, 7, 3], [5, 7, 8, 9, 10, 1], [6, 8, 9, 10, 11, 2], [7, 9, 10, 11, 12, 3]],threshold = 20) == 2\n assert candidate(mat = [[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4], [5, 5, 5, 5, 5]],threshold = 10) == 2\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],threshold = 20) == 4\n assert candidate(mat = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]],threshold = 15) == 2\n assert candidate(mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]],threshold = 20) == 2\n assert candidate(mat = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]],threshold = 1) == 5\n assert candidate(mat = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 2, 2, 2, 2, 2, 2, 1, 0], [0, 1, 2, 3, 3, 3, 3, 2, 1, 0], [0, 1, 2, 3, 4, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 4, 3, 2, 0], [0, 1, 2, 3, 4, 4, 3, 2, 1, 0], [0, 1, 2, 3, 3, 3, 3, 2, 1, 0], [0, 1, 2, 2, 2, 2, 2, 2, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],threshold = 20) == 4\n assert candidate(mat = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]],threshold = 10) == 2\n assert candidate(mat = [[5, 9, 6, 8, 7], [4, 6, 4, 4, 3], [8, 5, 3, 3, 1], [7, 8, 4, 6, 2], [1, 1, 2, 7, 3]],threshold = 15) == 2\n assert candidate(mat = [[1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 2, 1, 2, 1]],threshold = 5) == 1\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]],threshold = 16) == 4\n assert candidate(mat = [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]],threshold = 25) == 2\n assert candidate(mat = [[9, 5, 6, 7, 8], [8, 7, 6, 5, 9], [7, 6, 5, 4, 8], [6, 5, 4, 3, 7], [5, 4, 3, 2, 6]],threshold = 30) == 2\n assert candidate(mat = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]],threshold = 3) == 2\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]],threshold = 50) == 3\n assert candidate(mat = [[10, 20, 30, 40, 50], [5, 15, 25, 35, 45], [1, 11, 21, 31, 41], [6, 16, 26, 36, 46], [12, 22, 32, 42, 52]],threshold = 150) == 3\n assert candidate(mat = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]],threshold = 2) == 2\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [2, 3, 4, 5, 6, 7, 8, 9, 10], [3, 4, 5, 6, 7, 8, 9, 10, 11], [4, 5, 6, 7, 8, 9, 10, 11, 12], [5, 6, 7, 8, 9, 10, 11, 12, 13], [6, 7, 8, 9, 10, 11, 12, 13, 14]],threshold = 100) == 4\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 11, 13, 15, 17], [17, 15, 13, 11, 9, 7, 5, 3, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 11, 13, 15, 17], [17, 15, 13, 11, 9, 7, 5, 3, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9]],threshold = 50) == 3\n assert candidate(mat = [[9, 1, 2], [1, 9, 1], [2, 1, 9]],threshold = 15) == 2\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],threshold = 150) == 12\n assert candidate(mat = [[9, 8, 7, 6], [8, 7, 6, 5], [7, 6, 5, 4], [6, 5, 4, 3]],threshold = 30) == 2\n assert candidate(mat = [[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]],threshold = 5) == 2\n assert candidate(mat = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]],threshold = 5) == 1\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [5, 6, 7, 8, 9, 10, 11, 12, 13, 14], [6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [7, 8, 9, 10, 11, 12, 13, 14, 15, 16], [8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [9, 10, 11, 12, 13, 14, 15, 16, 17, 18], [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]],threshold = 100) == 4\n assert candidate(mat = [[9, 9, 9, 9, 9, 9, 9], [9, 9, 9, 9, 9, 9, 9], [9, 9, 9, 9, 9, 9, 9], [9, 9, 9, 9, 9, 9, 9], [9, 9, 9, 9, 9, 9, 9]],threshold = 81) == 3\n assert candidate(mat = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],threshold = 1) == 10\n assert candidate(mat = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]],threshold = 15) == 1\n assert candidate(mat = [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 2, 3, 4, 5]],threshold = 25) == 3\n assert candidate(mat = [[3, 3, 3], [3, 3, 3], [3, 3, 3], [3, 3, 3], [3, 3, 3], [3, 3, 3], [3, 3, 3], [3, 3, 3]],threshold = 25) == 2\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],threshold = 50) == 7\n assert candidate(mat = [[10, 20, 30, 40, 50], [60, 70, 80, 90, 100], [110, 120, 130, 140, 150], [160, 170, 180, 190, 200], [210, 220, 230, 240, 250]],threshold = 500) == 2\n assert candidate(mat = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]],threshold = 3) == 1\n assert candidate(mat = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],threshold = 1) == 5\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],threshold = 15) == 3\n assert candidate(mat = [[5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5]],threshold = 25) == 2\n assert candidate(mat = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],threshold = 15) == 3\n"}, "metadata": {"canonical_parameter_names": ["mat", "threshold"], "leetcode_dataset_entry_point": "Solution().maxSideLength", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxSideLength = function(mat, threshold) {", "container": null, "callable": "maxSideLength", "parameters": [{"name": "mat", "type": "number[][]"}, {"name": "threshold", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1293, "task_id": "shortest-path-in-a-grid-with-obstacles-elimination", "difficulty": "Hard", "problem_description": "You are given an m x n integer matrix grid where each cell is either 0 (empty) or 1 (obstacle). You can move up, down, left, or right from and to an empty cell in one step.\nReturn the minimum number of steps to walk from the upper left corner (0, 0) to the lower right corner (m - 1, n - 1) given that you can eliminate at most k obstacles. If it is not possible to find such walk return -1.\n \nExample 1:\n\n\nInput: grid = [[0,0,0],[1,1,0],[0,0,0],[0,1,1],[0,0,0]], k = 1\nOutput: 6\nExplanation: \nThe shortest path without eliminating any obstacle is 10.\nThe shortest path with one obstacle elimination at position (3,2) is 6. Such path is (0,0) -> (0,1) -> (0,2) -> (1,2) -> (2,2) -> (3,2) -> (4,2).\n\nExample 2:\n\n\nInput: grid = [[0,1,1],[1,1,1],[1,0,0]], k = 1\nOutput: -1\nExplanation: We need to eliminate at least two obstacles to find such a walk.\n\n \nConstraints:\n\nm == grid.length\nn == grid[i].length\n1 <= m, n <= 40\n1 <= k <= m * n\ngrid[i][j] is either 0 or 1.\ngrid[0][0] == grid[m - 1][n - 1] == 0\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]],k = 2) == 4\n assert candidate(grid = [[0, 1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0]],k = 2) == 9\n assert candidate(grid = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 0, 0, 0], [0, 1, 1, 0]],k = 2) == 6\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]],k = 1) == 4\n assert candidate(grid = [[0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0]],k = 2) == 8\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 1, 0, 1, 0], [0, 1, 0, 1, 0], [0, 0, 0, 0, 0]],k = 1) == 7\n assert candidate(grid = [[0, 1, 0, 0, 0], [0, 1, 0, 1, 0], [0, 0, 0, 1, 0]],k = 1) == 6\n assert candidate(grid = [[0, 0], [1, 0]],k = 1) == 2\n assert candidate(grid = [[0, 1, 1], [1, 1, 1], [1, 0, 0]],k = 1) == -1\n assert candidate(grid = [[0, 0, 0], [1, 1, 0], [0, 0, 0], [0, 1, 1], [0, 0, 0]],k = 1) == 6\n assert candidate(grid = [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]],k = 1) == 7\n assert candidate(grid = [[0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 1, 1], [1, 0, 0, 1, 0, 0], [0, 1, 1, 0, 0, 1], [1, 0, 1, 1, 1, 0]],k = 2) == -1\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]],k = 0) == 4\n assert candidate(grid = [[0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 0, 0, 0, 1, 0, 0]],k = 4) == 12\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 6) == 16\n assert candidate(grid = [[0, 1, 1, 0, 1, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [1, 1, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 3) == 13\n assert candidate(grid = [[0, 1, 1, 1, 1, 0], [1, 0, 0, 0, 1, 0], [1, 0, 1, 0, 1, 1], [1, 1, 1, 0, 0, 1], [0, 1, 0, 0, 0, 0]],k = 4) == 9\n assert candidate(grid = [[0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0], [1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0]],k = 2) == 10\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 3) == 15\n assert candidate(grid = [[0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]],k = 3) == 8\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0]],k = 3) == 10\n assert candidate(grid = [[0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 6) == 18\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]],k = 5) == 12\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 15) == 18\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 6) == 15\n assert candidate(grid = [[0, 1, 1, 1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 3) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],k = 6) == 15\n assert candidate(grid = [[0, 0, 1, 1, 0, 1, 1, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 1, 1, 0, 1, 1, 1, 0, 0]],k = 8) == 13\n assert candidate(grid = [[0, 1, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 0, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0]],k = 3) == 13\n assert candidate(grid = [[0, 1, 0, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],k = 3) == 12\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0], [1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],k = 7) == 17\n assert candidate(grid = [[0, 1, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 1, 0], [1, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0], [1, 0, 1, 0, 0, 1, 0, 1]],k = 3) == 12\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 5) == 13\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 0, 1], [1, 1, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0]],k = 5) == 13\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 1, 0, 1], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 4) == 13\n assert candidate(grid = [[0, 0, 1, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 7) == 18\n assert candidate(grid = [[0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]],k = 5) == 16\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 8) == 17\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 8) == 17\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 8) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 7) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0]],k = 6) == 14\n assert candidate(grid = [[0, 1, 1, 1, 1], [1, 1, 1, 1, 0], [0, 0, 1, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]],k = 2) == 8\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0]],k = 3) == 10\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 0, 0, 0, 0]],k = 6) == 15\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 0]],k = 8) == 17\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 0, 1], [0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 4) == 14\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 5) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 4) == 13\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 8) == 17\n assert candidate(grid = [[0, 0, 0, 0, 0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]],k = 5) == 13\n assert candidate(grid = [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1], [0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 8) == 20\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 10) == 21\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 5) == 14\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0], [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],k = 8) == 18\n assert candidate(grid = [[0, 1, 1, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 1, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0]],k = 4) == 13\n assert candidate(grid = [[0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0]],k = 5) == 16\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 10) == 14\n assert candidate(grid = [[0, 1, 1, 1, 0, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 1, 1, 0, 1, 0, 0]],k = 4) == 13\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]],k = 10) == 13\n assert candidate(grid = [[0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 6) == 15\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 2) == 12\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0, 0, 0, 1, 1], [1, 0, 0, 1, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 1, 1, 1, 1, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0]],k = 5) == 15\n assert candidate(grid = [[0, 0, 0, 0, 1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 5) == 15\n assert candidate(grid = [[0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [0, 0, 0, 0, 0], [1, 1, 1, 1, 0], [0, 0, 0, 1, 0], [0, 1, 0, 0, 0]],k = 2) == 9\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 6) == 14\n assert candidate(grid = [[0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 3) == 12\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]],k = 4) == 12\n assert candidate(grid = [[0, 0, 1, 0, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0], [1, 1, 1, 1, 0], [0, 0, 0, 0, 0]],k = 2) == 8\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 5) == 18\n assert candidate(grid = [[0, 1, 1, 0, 0, 1, 0, 0, 0], [1, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 3) == 12\n assert candidate(grid = [[0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 5) == 12\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 10) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],k = 15) == 23\n assert candidate(grid = [[0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 1, 0, 1, 1, 0], [0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]],k = 4) == 11\n"}, "metadata": {"canonical_parameter_names": ["grid", "k"], "leetcode_dataset_entry_point": "Solution().shortestPath", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var shortestPath = function(grid, k) {", "container": null, "callable": "shortestPath", "parameters": [{"name": "grid", "type": "number[][]"}, {"name": "k", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1295, "task_id": "find-numbers-with-even-number-of-digits", "difficulty": "Easy", "problem_description": "Given an array nums of integers, return how many of them contain an even number of digits.\n \nExample 1:\n\nInput: nums = [12,345,2,6,7896]\nOutput: 2\nExplanation: \n12 contains 2 digits (even number of digits). \n345 contains 3 digits (odd number of digits). \n2 contains 1 digit (odd number of digits). \n6 contains 1 digit (odd number of digits). \n7896 contains 4 digits (even number of digits). \nTherefore only 12 and 7896 contain an even number of digits.\n\nExample 2:\n\nInput: nums = [555,901,482,1771]\nOutput: 1 \nExplanation: \nOnly 1771 contains an even number of digits.\n\n \nConstraints:\n\n1 <= nums.length <= 500\n1 <= nums[i] <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 100, 1000, 10000, 100000]) == 3\n assert candidate(nums = [10, 100, 1000, 10000]) == 2\n assert candidate(nums = [10, 22, 333, 4444, 55555]) == 3\n assert candidate(nums = [100000, 10000, 1000, 100, 10]) == 3\n assert candidate(nums = [555, 901, 482, 1771]) == 1\n assert candidate(nums = [1, 22, 333, 4444, 55555, 666666]) == 3\n assert candidate(nums = [12, 345, 2, 6, 7896]) == 2\n assert candidate(nums = [1, 3, 5, 7, 9]) == 0\n assert candidate(nums = [1, 22, 333, 4444, 55555]) == 2\n assert candidate(nums = [1234, 56789, 101112, 13141516, 1718192021]) == 4\n assert candidate(nums = [9, 99, 999, 9999, 99999]) == 2\n assert candidate(nums = [100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000]) == 9\n assert candidate(nums = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 1\n assert candidate(nums = [111, 2222, 33333, 444444, 5555555, 66666666]) == 3\n assert candidate(nums = [1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144]) == 6\n assert candidate(nums = [123456789, 987654321, 111213141, 222324252, 333435363]) == 0\n assert candidate(nums = [10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000]) == 0\n assert candidate(nums = [1, 11, 111, 1111, 11111, 111111]) == 3\n assert candidate(nums = [987654, 321, 654321, 987, 65432]) == 2\n assert candidate(nums = [222222, 444444, 666666, 888888, 1111111]) == 4\n assert candidate(nums = [111, 222, 333, 444, 555, 666, 777, 888, 999, 1000]) == 1\n assert candidate(nums = [123456, 789012, 34567, 11, 222222]) == 4\n assert candidate(nums = [111111, 222222, 333333, 444444, 555555, 666666, 777777, 888888, 999999]) == 9\n assert candidate(nums = [12, 345, 6789, 101112, 13141516]) == 4\n assert candidate(nums = [1234, 56789, 101112, 13141516, 1718192021]) == 4\n assert candidate(nums = [5, 55, 555, 5555, 55555, 555555, 5555555]) == 3\n assert candidate(nums = [9999, 88888, 777777, 6666666, 55555555]) == 3\n assert candidate(nums = [5555555555, 333333333, 11111111, 9999999, 777777, 55555, 3333, 111, 99, 7, 5]) == 5\n assert candidate(nums = [12345678, 87654321, 11223344, 55667788]) == 4\n assert candidate(nums = [1111111111, 222222222, 33333333, 4444444, 555555, 66666, 7777, 888, 99, 9]) == 5\n assert candidate(nums = [999, 8888, 77777, 666666, 5555555]) == 2\n assert candidate(nums = [987654, 876543, 765432, 654321, 543210]) == 5\n assert candidate(nums = [9, 99, 999, 9999, 99999, 999999, 9999999, 99999999]) == 4\n assert candidate(nums = [99999, 88888, 77777, 66666, 55555, 44444, 33333, 22222, 11111]) == 0\n assert candidate(nums = [123456789, 987654321, 1122334455, 6677889900, 1010101010]) == 3\n assert candidate(nums = [102030, 204060, 306090, 408120, 510150]) == 5\n assert candidate(nums = [1, 11, 111, 1111, 11111, 111111, 1111111, 11111111, 111111111, 1111111111]) == 5\n assert candidate(nums = [11, 22, 33, 44, 55, 66, 77, 88, 99, 100]) == 9\n assert candidate(nums = [1234567, 876543, 234567, 765432, 345678]) == 4\n assert candidate(nums = [1, 11, 111, 1111, 11111, 111111, 1111111, 11111111]) == 4\n assert candidate(nums = [987654, 123456789, 98765, 43210, 111111, 2222222]) == 2\n assert candidate(nums = [54321, 12345, 67890, 98765, 43210, 11111, 22222, 33333]) == 0\n assert candidate(nums = [12345, 67890, 13579, 24680, 111213, 415161, 718191]) == 3\n assert candidate(nums = [1000000000, 200000000, 30000000, 4000000, 500000, 60000, 7000, 800, 90, 10]) == 6\n assert candidate(nums = [102030, 405060, 708090, 11121314, 1516171819]) == 5\n assert candidate(nums = [123456, 111222, 222333, 333444, 444555]) == 5\n assert candidate(nums = [102030, 405060, 708090, 112131, 141516]) == 5\n assert candidate(nums = [12345678, 98765432, 13579246, 86420864, 24681357]) == 5\n assert candidate(nums = [1234, 5678, 9101, 1122, 3344, 5566, 7788, 8899]) == 8\n assert candidate(nums = [12, 345, 6789, 101112, 13141516, 1718192021]) == 5\n assert candidate(nums = [123, 4567, 89012, 345678, 9012345]) == 2\n assert candidate(nums = [1000, 20000, 300000, 4000000, 50000000]) == 3\n assert candidate(nums = [9876543210, 123456789, 1000000000, 11111111, 2222]) == 4\n assert candidate(nums = [1234, 56789, 123456, 7890123, 45678901]) == 3\n assert candidate(nums = [10101010, 2020202, 303030, 40404, 5050, 606, 70, 8]) == 4\n assert candidate(nums = [50000, 40000, 30000, 20000, 10000, 9999, 8888, 7777, 6666, 5555]) == 5\n assert candidate(nums = [1000000, 200000, 30000, 4000, 500]) == 2\n assert candidate(nums = [100001, 100010, 100100, 101000, 110000, 200000, 300000, 400000, 500000, 600000]) == 10\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]) == 5\n assert candidate(nums = [12, 345, 6789, 101112, 13141516, 17181920]) == 5\n assert candidate(nums = [5, 100000, 123456, 789012, 34567890]) == 4\n assert candidate(nums = [9876543210, 123456789, 98765432, 1234567, 87654]) == 2\n assert candidate(nums = [100000, 200000, 300000, 400000, 500000]) == 5\n assert candidate(nums = [10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000]) == 1\n assert candidate(nums = [10001, 20002, 30003, 40004, 50005, 60006, 70007, 80008, 90009]) == 0\n assert candidate(nums = [100000, 20000, 300, 40, 5]) == 2\n assert candidate(nums = [123456, 789012, 3333, 444444, 5555555]) == 4\n assert candidate(nums = [100, 2000, 30000, 400000, 5000000]) == 2\n assert candidate(nums = [123456, 789012, 333333, 111, 2222]) == 4\n assert candidate(nums = [123456, 789012, 345678, 901234, 567890]) == 5\n assert candidate(nums = [9, 99, 999, 9999, 99999, 999999]) == 3\n assert candidate(nums = [11111111, 22222222, 33333333, 44444444, 55555555, 66666666, 77777777, 88888888, 99999999]) == 9\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000]) == 9\n assert candidate(nums = [123, 4567, 89012, 345678, 9012345, 67890123]) == 3\n assert candidate(nums = [112233, 445566, 778899, 1122334455, 6677889900]) == 5\n assert candidate(nums = [1234567, 2345678, 3456789, 4567890, 5678901]) == 0\n assert candidate(nums = [100000, 99999, 88888, 77777, 66666, 55555, 44444, 33333, 22222, 11111]) == 1\n assert candidate(nums = [123456789, 987654321, 246813579, 864208642, 135791357, 975319753, 246824682, 86428642, 13571357, 9759759]) == 2\n assert candidate(nums = [123, 4567, 89012, 345678, 9012345, 67890123, 456789012, 34567890123, 2345678901234, 123456789012345]) == 3\n assert candidate(nums = [500000, 400000, 300000, 200000, 100000, 99999]) == 5\n assert candidate(nums = [102030, 405060, 708090, 123456789, 987654321]) == 3\n assert candidate(nums = [1001, 2002, 3003, 4004, 5005, 6006, 7007, 8008, 9009]) == 9\n assert candidate(nums = [123456789, 9876543210, 1122334455, 6677889900, 1234]) == 4\n assert candidate(nums = [1010, 2020, 3030, 4040, 5050, 6060, 7070, 8080, 9090]) == 9\n assert candidate(nums = [100000, 10000, 1000, 100, 10, 1, 11, 1111, 111111, 11111111]) == 7\n assert candidate(nums = [5, 55, 555, 5555, 55555, 555555, 5555555, 55555555, 555555555, 5555555555]) == 5\n assert candidate(nums = [999999, 88888, 7777, 666, 55]) == 3\n assert candidate(nums = [9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999, 9999999999]) == 5\n assert candidate(nums = [987654, 321, 456789, 123, 9009, 101010]) == 4\n assert candidate(nums = [1001, 22222, 333333, 4444444, 55555555, 666666666, 7777777777]) == 4\n assert candidate(nums = [123456, 12345, 1234, 123, 12, 1]) == 3\n assert candidate(nums = [98765, 4321, 8642, 13579, 24680]) == 2\n assert candidate(nums = [11111111, 22222222, 33333333, 44444444, 55555555]) == 5\n assert candidate(nums = [123456, 789012, 333333, 1111, 222222, 9999]) == 6\n assert candidate(nums = [101010, 202020, 303030, 404040, 505050]) == 5\n assert candidate(nums = [1, 10, 100, 1000, 10000, 100000]) == 3\n assert candidate(nums = [1234, 5678, 1122, 3344, 5566, 7788, 9900, 1100, 2200, 3300, 4400, 5500, 6600, 7700, 8800, 9900]) == 16\n assert candidate(nums = [123, 456789, 1000000, 999999, 1001001, 2002002, 3003003, 4004004, 5005005, 6006006]) == 2\n assert candidate(nums = [100, 1000, 10000, 100000, 1000000]) == 2\n assert candidate(nums = [222222, 33333, 444444, 5555555, 666666]) == 3\n assert candidate(nums = [123456789, 98765432, 87654321, 7654321, 654321, 54321, 4321, 321, 21, 1]) == 5\n assert candidate(nums = [123, 4567, 89012, 345678, 901234, 5678901, 23456789]) == 4\n assert candidate(nums = [11223344, 55667788, 99001122, 33445566, 77889900]) == 5\n assert candidate(nums = [11, 222, 3333, 44444, 555555, 6666666, 77777777]) == 4\n assert candidate(nums = [24680, 13579, 2468013579, 9876543210, 1122334455]) == 3\n assert candidate(nums = [1234, 123456, 12345678, 1234567890]) == 4\n assert candidate(nums = [1000, 20002, 300030, 4000400, 50005000]) == 3\n assert candidate(nums = [999999, 888888, 77777, 6666, 555, 44, 3]) == 4\n assert candidate(nums = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]) == 9\n assert candidate(nums = [111111, 222222, 333333, 444444, 555555]) == 5\n"}, "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().findNumbers", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findNumbers = function(nums) {", "container": null, "callable": "findNumbers", "parameters": [{"name": "nums", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1296, "task_id": "divide-array-in-sets-of-k-consecutive-numbers", "difficulty": "Medium", "problem_description": "Given an array of integers nums and a positive integer k, check whether it is possible to divide this array into sets of k consecutive numbers.\nReturn true if it is possible. Otherwise, return false.\n \nExample 1:\n\nInput: nums = [1,2,3,3,4,4,5,6], k = 4\nOutput: true\nExplanation: Array can be divided into [1,2,3,4] and [3,4,5,6].\n\nExample 2:\n\nInput: nums = [3,2,1,2,3,4,3,4,5,9,10,11], k = 3\nOutput: true\nExplanation: Array can be divided into [1,2,3] , [2,3,4] , [3,4,5] and [9,10,11].\n\nExample 3:\n\nInput: nums = [1,2,3,4], k = 3\nOutput: false\nExplanation: Each array should be divided in subarrays of size 3.\n\n \nConstraints:\n\n1 <= k <= nums.length <= 105\n1 <= nums[i] <= 109\n\n \nNote: This question is the same as 846: https://leetcode.com/problems/hand-of-straights/", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 6],k = 4) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5],k = 2) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],k = 4) == True\n assert candidate(nums = [1, 2, 3, 4],k = 3) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3],k = 3) == True\n assert candidate(nums = [3, 2, 1, 2, 3, 4, 3, 4, 5, 9, 10, 11],k = 3) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6],k = 3) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],k = 5) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9],k = 1) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],k = 3) == True\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30],k = 3) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10],k = 6) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8],k = 8) == False\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 5) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],k = 10) == True\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 31],k = 5) == False\n assert candidate(nums = [5, 6, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14],k = 4) == False\n assert candidate(nums = [1, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20],k = 4) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],k = 5) == True\n assert candidate(nums = [1, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10],k = 3) == False\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15],k = 5) == False\n assert candidate(nums = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],k = 10) == False\n assert candidate(nums = [1, 3, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14],k = 4) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7],k = 5) == False\n assert candidate(nums = [1, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11],k = 4) == False\n assert candidate(nums = [3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7],k = 4) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8],k = 4) == False\n assert candidate(nums = [1, 2, 3, 4, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16],k = 4) == False\n assert candidate(nums = [5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20],k = 4) == False\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11],k = 3) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9],k = 5) == False\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7],k = 7) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],k = 15) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8],k = 6) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15],k = 2) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],k = 5) == True\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9],k = 3) == True\n assert candidate(nums = [5, 8, 9, 10, 11, 5, 8, 9, 10, 11, 5, 8, 9, 10, 11, 5, 8, 9, 10, 11],k = 5) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],k = 5) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 7) == False\n assert candidate(nums = [1, 3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],k = 5) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15],k = 5) == True\n assert candidate(nums = [10, 10, 20, 20, 30, 30, 40, 40, 50, 50, 60, 60, 70, 70, 80, 80, 90, 90, 100, 100, 110, 110, 120, 120, 130, 130, 140, 140, 150, 150, 160, 160, 170, 170, 180, 180, 190, 190, 200, 200],k = 10) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],k = 10) == True\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7],k = 7) == False\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9],k = 4) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45],k = 15) == True\n assert candidate(nums = [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 5) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],k = 4) == True\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12],k = 5) == False\n assert candidate(nums = [5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20],k = 5) == False\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5],k = 5) == False\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12],k = 3) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30],k = 5) == True\n assert candidate(nums = [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10, 11, 12],k = 4) == False\n assert candidate(nums = [5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10],k = 5) == False\n assert candidate(nums = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],k = 5) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12],k = 6) == False\n assert candidate(nums = [5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 16, 16],k = 4) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],k = 5) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 10) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20],k = 5) == False\n assert candidate(nums = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 6) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 5) == True\n assert candidate(nums = [5, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12],k = 4) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20],k = 5) == False\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20],k = 5) == True\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15],k = 5) == False\n assert candidate(nums = [1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15],k = 6) == False\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3],k = 2) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],k = 10) == True\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10],k = 3) == False\n assert candidate(nums = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10],k = 4) == False\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],k = 5) == False\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5],k = 3) == False\n assert candidate(nums = [3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14],k = 3) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25],k = 5) == True\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20],k = 5) == True\n assert candidate(nums = [1, 3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],k = 3) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17],k = 2) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60],k = 6) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 5) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],k = 5) == True\n assert candidate(nums = [10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18],k = 3) == True\n assert candidate(nums = [5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14],k = 2) == True\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6],k = 5) == False\n assert candidate(nums = [1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10],k = 4) == False\n assert candidate(nums = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7],k = 3) == False\n assert candidate(nums = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],k = 5) == False\n"}, "metadata": {"canonical_parameter_names": ["nums", "k"], "leetcode_dataset_entry_point": "Solution().isPossibleDivide", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var isPossibleDivide = function(nums, k) {", "container": null, "callable": "isPossibleDivide", "parameters": [{"name": "nums", "type": "number[]"}, {"name": "k", "type": "number"}], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1297, "task_id": "maximum-number-of-occurrences-of-a-substring", "difficulty": "Medium", "problem_description": "Given a string s, return the maximum number of occurrences of any substring under the following rules:\n\nThe number of unique characters in the substring must be less than or equal to maxLetters.\nThe substring size must be between minSize and maxSize inclusive.\n\n \nExample 1:\n\nInput: s = \"aababcaab\", maxLetters = 2, minSize = 3, maxSize = 4\nOutput: 2\nExplanation: Substring \"aab\" has 2 occurrences in the original string.\nIt satisfies the conditions, 2 unique letters and size 3 (between minSize and maxSize).\n\nExample 2:\n\nInput: s = \"aaaa\", maxLetters = 1, minSize = 3, maxSize = 3\nOutput: 2\nExplanation: Substring \"aaa\" occur 2 times in the string. It can overlap.\n\n \nConstraints:\n\n1 <= s.length <= 105\n1 <= maxLetters <= 26\n1 <= minSize <= maxSize <= min(26, s.length)\ns consists of only lowercase English letters.\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"aaaa\",maxLetters = 1,minSize = 3,maxSize = 3) == 2\n assert candidate(s = \"abacabadabacaba\",maxLetters = 3,minSize = 3,maxSize = 5) == 4\n assert candidate(s = \"xyzxyzxyz\",maxLetters = 3,minSize = 3,maxSize = 3) == 3\n assert candidate(s = \"abacaba\",maxLetters = 2,minSize = 2,maxSize = 5) == 2\n assert candidate(s = \"aabcabcabc\",maxLetters = 2,minSize = 2,maxSize = 3) == 3\n assert candidate(s = \"xyzxyz\",maxLetters = 3,minSize = 2,maxSize = 4) == 2\n assert candidate(s = \"abcde\",maxLetters = 3,minSize = 2,maxSize = 3) == 1\n assert candidate(s = \"xyzxyzxyz\",maxLetters = 3,minSize = 1,maxSize = 2) == 3\n assert candidate(s = \"abcde\",maxLetters = 3,minSize = 2,maxSize = 4) == 1\n assert candidate(s = \"abcde\",maxLetters = 5,minSize = 1,maxSize = 5) == 1\n assert candidate(s = \"abacabadabacaba\",maxLetters = 2,minSize = 2,maxSize = 3) == 4\n assert candidate(s = \"abacabadaba\",maxLetters = 2,minSize = 2,maxSize = 3) == 3\n assert candidate(s = \"aababcaab\",maxLetters = 2,minSize = 3,maxSize = 4) == 2\n assert candidate(s = \"abcabcabc\",maxLetters = 3,minSize = 3,maxSize = 9) == 3\n assert candidate(s = \"mnopqrstuvmnopqrstuvmnopqrstuvmnopqrstuvmnopqrstuvmnopq\",maxLetters = 5,minSize = 10,maxSize = 15) == 0\n assert candidate(s = \"thisisjustatest\",maxLetters = 4,minSize = 4,maxSize = 5) == 1\n assert candidate(s = \"abababababababababababab\",maxLetters = 2,minSize = 2,maxSize = 4) == 12\n assert candidate(s = \"abcdefabcdefabcdef\",maxLetters = 3,minSize = 5,maxSize = 6) == 0\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",maxLetters = 15,minSize = 7,maxSize = 14) == 1\n assert candidate(s = \"zzzzzzzzzzzz\",maxLetters = 1,minSize = 5,maxSize = 7) == 8\n assert candidate(s = \"abcdefabcdefabcdef\",maxLetters = 3,minSize = 3,maxSize = 3) == 3\n assert candidate(s = \"abcabcabcabc\",maxLetters = 3,minSize = 3,maxSize = 9) == 4\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",maxLetters = 3,minSize = 3,maxSize = 5) == 1\n assert candidate(s = \"xyzzxyzzxyzzxyzzxyzzxyzzxyzzxyzzxyzzxyzzxyzzxyzzxyzzxyzzxyzzxyzzxyzz\",maxLetters = 3,minSize = 4,maxSize = 8) == 17\n assert candidate(s = \"xyzxyzxyzxyz\",maxLetters = 2,minSize = 1,maxSize = 3) == 4\n assert candidate(s = \"abcabcabcabcabcabc\",maxLetters = 3,minSize = 3,maxSize = 6) == 6\n assert candidate(s = \"aabbccddeeffgg\",maxLetters = 3,minSize = 2,maxSize = 4) == 1\n assert candidate(s = \"xyxyxyxyxyxyxy\",maxLetters = 2,minSize = 3,maxSize = 6) == 6\n assert candidate(s = \"mnopmnopmnop\",maxLetters = 4,minSize = 5,maxSize = 7) == 2\n assert candidate(s = \"abababababababab\",maxLetters = 2,minSize = 3,maxSize = 6) == 7\n assert candidate(s = \"abcdefghij\",maxLetters = 5,minSize = 3,maxSize = 4) == 1\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",maxLetters = 10,minSize = 5,maxSize = 10) == 1\n assert candidate(s = \"abcdabcdabcd\",maxLetters = 4,minSize = 4,maxSize = 4) == 3\n assert candidate(s = \"mississippiissi\",maxLetters = 3,minSize = 2,maxSize = 5) == 3\n assert candidate(s = \"abcdefgabcdefg\",maxLetters = 2,minSize = 4,maxSize = 5) == 0\n assert candidate(s = \"pneumonoultramicroscopicsilicovolcanoconiosis\",maxLetters = 10,minSize = 10,maxSize = 20) == 1\n assert candidate(s = \"aabbccddeeaabbccddeeaabb\",maxLetters = 3,minSize = 4,maxSize = 5) == 3\n assert candidate(s = \"mnopqrstuvmnopqrstuvmnopqrstuvmnopqrstuvmnopqrstuvmnopqrstuvmnopqrstuvmnopqrstuvmnopqrstuv\",maxLetters = 10,minSize = 10,maxSize = 15) == 9\n assert candidate(s = \"abacabadabacabadabacabadabacaba\",maxLetters = 3,minSize = 5,maxSize = 7) == 4\n assert candidate(s = \"abacabadabacaba\",maxLetters = 2,minSize = 4,maxSize = 4) == 0\n assert candidate(s = \"abacabadabacabadabacaba\",maxLetters = 3,minSize = 3,maxSize = 7) == 6\n assert candidate(s = \"abcabcabcabc\",maxLetters = 1,minSize = 1,maxSize = 1) == 4\n assert candidate(s = \"abcabcabcabc\",maxLetters = 3,minSize = 2,maxSize = 5) == 4\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",maxLetters = 26,minSize = 1,maxSize = 10) == 2\n assert candidate(s = \"pqrstuvwpqrstu\",maxLetters = 7,minSize = 5,maxSize = 8) == 2\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\",maxLetters = 4,minSize = 8,maxSize = 12) == 13\n assert candidate(s = \"abcdefabcdefabcdef\",maxLetters = 6,minSize = 6,maxSize = 6) == 3\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcd\",maxLetters = 4,minSize = 4,maxSize = 8) == 8\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",maxLetters = 5,minSize = 5,maxSize = 10) == 1\n assert candidate(s = \"abcabcabcabc\",maxLetters = 3,minSize = 2,maxSize = 4) == 4\n assert candidate(s = \"abracadabraabracadabra\",maxLetters = 4,minSize = 5,maxSize = 7) == 2\n assert candidate(s = \"mnopqr\",maxLetters = 6,minSize = 1,maxSize = 6) == 1\n assert candidate(s = \"aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabb\",maxLetters = 2,minSize = 3,maxSize = 4) == 18\n assert candidate(s = \"xyzyzyzyzyz\",maxLetters = 2,minSize = 3,maxSize = 4) == 4\n assert candidate(s = \"abcabcabcabc\",maxLetters = 3,minSize = 4,maxSize = 6) == 3\n assert candidate(s = \"pppppppppppppppppppppppppppppppppppppppppp\",maxLetters = 1,minSize = 50,maxSize = 100) == 0\n assert candidate(s = \"zzzzzzzzzzzzzz\",maxLetters = 1,minSize = 5,maxSize = 10) == 10\n assert candidate(s = \"ababababababab\",maxLetters = 2,minSize = 4,maxSize = 6) == 6\n assert candidate(s = \"xyzxyzxyz\",maxLetters = 3,minSize = 2,maxSize = 5) == 3\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\",maxLetters = 4,minSize = 4,maxSize = 8) == 29\n assert candidate(s = \"aabbccddeeffaabbccddeeffaabbccddeeff\",maxLetters = 3,minSize = 6,maxSize = 12) == 3\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",maxLetters = 26,minSize = 1,maxSize = 26) == 1\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",maxLetters = 26,minSize = 15,maxSize = 20) == 1\n assert candidate(s = \"xyxzyxzyxzyxzyxzyxzyxz\",maxLetters = 3,minSize = 3,maxSize = 4) == 7\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",maxLetters = 10,minSize = 10,maxSize = 20) == 1\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzz\",maxLetters = 1,minSize = 5,maxSize = 10) == 16\n assert candidate(s = \"abcdabcdabcd\",maxLetters = 4,minSize = 3,maxSize = 3) == 3\n assert candidate(s = \"bananaananabanananaanananana\",maxLetters = 3,minSize = 3,maxSize = 6) == 11\n assert candidate(s = \"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",maxLetters = 1,minSize = 25000,maxSize = 25000) == 0\n assert candidate(s = \"thisisaverylongstringthatwilltestthelimits\",maxLetters = 10,minSize = 5,maxSize = 15) == 1\n assert candidate(s = \"xyzxyzxyzxyz\",maxLetters = 3,minSize = 4,maxSize = 6) == 3\n assert candidate(s = \"abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij\",maxLetters = 5,minSize = 10,maxSize = 15) == 0\n assert candidate(s = \"ababababababababababababababababababababababababababababababababababab\",maxLetters = 2,minSize = 4,maxSize = 8) == 34\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",maxLetters = 26,minSize = 1,maxSize = 26) == 2\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\",maxLetters = 3,minSize = 3,maxSize = 6) == 31\n assert candidate(s = \"abcdefabcdefabcdef\",maxLetters = 6,minSize = 6,maxSize = 12) == 3\n assert candidate(s = \"tuvwxyzuvwxy\",maxLetters = 10,minSize = 4,maxSize = 7) == 2\n assert candidate(s = \"abacabadabacabadabacabadabacabadabacabadabacabadabacabadabacabad\",maxLetters = 4,minSize = 4,maxSize = 8) == 8\n assert candidate(s = \"mnopqrsmnopqr\",maxLetters = 7,minSize = 5,maxSize = 8) == 2\n assert candidate(s = \"abcabcabcabcabcabcabcabcabcabc\",maxLetters = 3,minSize = 3,maxSize = 6) == 10\n assert candidate(s = \"xxyxxxyxyxyxyxyxyxyxyxyxyxyxyxyxyx\",maxLetters = 2,minSize = 5,maxSize = 10) == 13\n assert candidate(s = \"aabbccddeeff\",maxLetters = 3,minSize = 3,maxSize = 5) == 1\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",maxLetters = 1,minSize = 5,maxSize = 10) == 54\n assert candidate(s = \"mnopqrstuvmnopqrstuvmnopqrstuvmn\",maxLetters = 10,minSize = 5,maxSize = 15) == 3\n assert candidate(s = \"abcdabcdabcdabcdabcdabcdabcdabcd\",maxLetters = 4,minSize = 6,maxSize = 8) == 7\n assert candidate(s = \"abcdefabcdefabcdef\",maxLetters = 6,minSize = 3,maxSize = 6) == 3\n assert candidate(s = \"mississippiississippiississi\",maxLetters = 4,minSize = 5,maxSize = 8) == 3\n assert candidate(s = \"abcdefabcdef\",maxLetters = 6,minSize = 3,maxSize = 6) == 2\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzz\",maxLetters = 1,minSize = 5,maxSize = 10) == 20\n assert candidate(s = \"abracadabraabracadabra\",maxLetters = 5,minSize = 5,maxSize = 10) == 2\n assert candidate(s = \"xyxxyxyxyx\",maxLetters = 2,minSize = 1,maxSize = 3) == 6\n assert candidate(s = \"aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz\",maxLetters = 10,minSize = 5,maxSize = 8) == 1\n assert candidate(s = \"ababababababababababababababababababababababababababababababababababab\",maxLetters = 2,minSize = 2,maxSize = 4) == 35\n assert candidate(s = \"ababababababababababababababab\",maxLetters = 2,minSize = 4,maxSize = 8) == 14\n assert candidate(s = \"abababababab\",maxLetters = 2,minSize = 2,maxSize = 3) == 6\n assert candidate(s = \"llllllllllllll\",maxLetters = 1,minSize = 6,maxSize = 8) == 9\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\",maxLetters = 1,minSize = 10,maxSize = 20) == 21\n assert candidate(s = \"xyzxyzxyz\",maxLetters = 3,minSize = 3,maxSize = 6) == 3\n assert candidate(s = \"ababababababababababababababab\",maxLetters = 2,minSize = 2,maxSize = 2) == 15\n assert candidate(s = \"abacabadabacabadabacabadabacabadabacabadabacabadabacabadabacabad\",maxLetters = 4,minSize = 5,maxSize = 10) == 8\n assert candidate(s = \"abababababababababab\",maxLetters = 2,minSize = 4,maxSize = 6) == 9\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzz\",maxLetters = 1,minSize = 10,maxSize = 15) == 11\n assert candidate(s = \"abcabcabcabc\",maxLetters = 3,minSize = 3,maxSize = 4) == 4\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnm\",maxLetters = 10,minSize = 5,maxSize = 10) == 1\n assert candidate(s = \"abababababababab\",maxLetters = 2,minSize = 2,maxSize = 4) == 8\n assert candidate(s = \"pqrspqrspqrspqrs\",maxLetters = 4,minSize = 5,maxSize = 8) == 3\n assert candidate(s = \"abcabcabcabc\",maxLetters = 3,minSize = 1,maxSize = 10) == 4\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm\",maxLetters = 10,minSize = 5,maxSize = 10) == 2\n assert candidate(s = \"aabbccddeeff\",maxLetters = 3,minSize = 4,maxSize = 6) == 1\n assert candidate(s = \"aaabbbcccdddeee\",maxLetters = 2,minSize = 2,maxSize = 3) == 2\n assert candidate(s = \"abcabcabcabcabcabc\",maxLetters = 3,minSize = 2,maxSize = 4) == 6\n assert candidate(s = \"aabbccddeeff\",maxLetters = 3,minSize = 2,maxSize = 6) == 1\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzzz\",maxLetters = 1,minSize = 5,maxSize = 10) == 22\n assert candidate(s = \"zzzzzzzzzzzz\",maxLetters = 1,minSize = 5,maxSize = 6) == 8\n assert candidate(s = \"zzzzzzzzzzzzzzzzzzzzzzzzz\",maxLetters = 1,minSize = 50000,maxSize = 50000) == 0\n assert candidate(s = \"abababababababababababababab\",maxLetters = 2,minSize = 3,maxSize = 5) == 13\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\",maxLetters = 5,minSize = 10,maxSize = 15) == 0\n"}, "metadata": {"canonical_parameter_names": ["s", "maxLetters", "minSize", "maxSize"], "leetcode_dataset_entry_point": "Solution().maxFreq", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxFreq = function(s, maxLetters, minSize, maxSize) {", "container": null, "callable": "maxFreq", "parameters": [{"name": "s", "type": "string"}, {"name": "maxLetters", "type": "number"}, {"name": "minSize", "type": "number"}, {"name": "maxSize", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1298, "task_id": "maximum-candies-you-can-get-from-boxes", "difficulty": "Hard", "problem_description": "You have n boxes labeled from 0 to n - 1. You are given four arrays: status, candies, keys, and containedBoxes where:\n\nstatus[i] is 1 if the ith box is open and 0 if the ith box is closed,\ncandies[i] is the number of candies in the ith box,\nkeys[i] is a list of the labels of the boxes you can open after opening the ith box.\ncontainedBoxes[i] is a list of the boxes you found inside the ith box.\n\nYou are given an integer array initialBoxes that contains the labels of the boxes you initially have. You can take all the candies in any open box and you can use the keys in it to open new boxes and you also can use the boxes you find in it.\nReturn the maximum number of candies you can get following the rules above.\n \nExample 1:\n\nInput: status = [1,0,1,0], candies = [7,5,4,100], keys = [[],[],[1],[]], containedBoxes = [[1,2],[3],[],[]], initialBoxes = [0]\nOutput: 16\nExplanation: You will be initially given box 0. You will find 7 candies in it and boxes 1 and 2.\nBox 1 is closed and you do not have a key for it so you will open box 2. You will find 4 candies and a key to box 1 in box 2.\nIn box 1, you will find 5 candies and box 3 but you will not find a key to box 3 so box 3 will remain closed.\nTotal number of candies collected = 7 + 4 + 5 = 16 candy.\n\nExample 2:\n\nInput: status = [1,0,0,0,0,0], candies = [1,1,1,1,1,1], keys = [[1,2,3,4,5],[],[],[],[],[]], containedBoxes = [[1,2,3,4,5],[],[],[],[],[]], initialBoxes = [0]\nOutput: 6\nExplanation: You have initially box 0. Opening it you can find boxes 1,2,3,4 and 5 and their keys.\nThe total number of candies will be 6.\n\n \nConstraints:\n\nn == status.length == candies.length == keys.length == containedBoxes.length\n1 <= n <= 1000\nstatus[i] is either 0 or 1.\n1 <= candies[i] <= 1000\n0 <= keys[i].length <= n\n0 <= keys[i][j] < n\nAll values of keys[i] are unique.\n0 <= containedBoxes[i].length <= n\n0 <= containedBoxes[i][j] < n\nAll values of containedBoxes[i] are unique.\nEach box is contained in one box at most.\n0 <= initialBoxes.length <= n\n0 <= initialBoxes[i] < n\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(status = [0, 0, 0],candies = [100, 200, 300],keys = [[1, 2], [0, 2], [0, 1]],containedBoxes = [[1, 2], [0, 2], [0, 1]],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0],candies = [10, 20, 30],keys = [[1], [2], []],containedBoxes = [[], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [1, 1, 0, 0, 1],candies = [5, 15, 25, 35, 45],keys = [[2, 3], [], [4], [], []],containedBoxes = [[1, 2], [3], [], [], []],initialBoxes = [0]) == 80\n assert candidate(status = [1, 1, 0, 0],candies = [10, 20, 30, 40],keys = [[], [], [2], [3]],containedBoxes = [[2, 3], [], [], []],initialBoxes = [0, 1]) == 30\n assert candidate(status = [1, 1, 0, 0],candies = [10, 20, 30, 40],keys = [[2], [3], [], []],containedBoxes = [[], [], [1, 3], []],initialBoxes = [0, 1]) == 30\n assert candidate(status = [1, 0, 1, 0, 1],candies = [3, 5, 2, 7, 6],keys = [[2], [1, 4], [0], [], [3]],containedBoxes = [[4], [3], [], [1], [2]],initialBoxes = [0]) == 11\n assert candidate(status = [0, 0, 1, 1],candies = [10, 20, 30, 40],keys = [[1, 3], [0], [], []],containedBoxes = [[2], [3], [], []],initialBoxes = [2]) == 30\n assert candidate(status = [0, 0, 1, 1],candies = [10, 20, 30, 40],keys = [[1, 2], [0], [3], []],containedBoxes = [[2, 3], [1], [], []],initialBoxes = [2]) == 30\n assert candidate(status = [1, 1, 1],candies = [5, 10, 15],keys = [[], [2], []],containedBoxes = [[1], [], []],initialBoxes = [0]) == 15\n assert candidate(status = [1, 0, 0, 0, 0, 0],candies = [1, 1, 1, 1, 1, 1],keys = [[1, 2, 3, 4, 5], [], [], [], [], []],containedBoxes = [[1, 2, 3, 4, 5], [], [], [], [], []],initialBoxes = [0]) == 6\n assert candidate(status = [0, 0, 0, 0],candies = [100, 200, 300, 400],keys = [[1, 2], [2, 3], [3], []],containedBoxes = [[1, 2, 3], [], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [1, 0, 0],candies = [100, 200, 300],keys = [[1], [], [2]],containedBoxes = [[2], [], []],initialBoxes = [0]) == 100\n assert candidate(status = [0, 0, 1, 1],candies = [2, 3, 5, 7],keys = [[1, 2], [2, 3], [], []],containedBoxes = [[2, 3], [3], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [1, 0, 1, 0],candies = [7, 5, 4, 100],keys = [[], [], [1], []],containedBoxes = [[1, 2], [3], [], []],initialBoxes = [0]) == 16\n assert candidate(status = [1, 1, 1],candies = [5, 5, 5],keys = [[], [2], [1]],containedBoxes = [[1, 2], [0, 2], [0, 1]],initialBoxes = [0]) == 15\n assert candidate(status = [1, 0, 1, 0, 1, 0, 1],candies = [10, 20, 30, 40, 50, 60, 70],keys = [[3, 5], [0, 2], [4], [], [6], [], []],containedBoxes = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 0], [6, 1], [0, 2]],initialBoxes = [0]) == 260\n assert candidate(status = [0, 1, 0, 1, 0, 1, 0],candies = [10, 20, 30, 40, 50, 60, 70],keys = [[1, 3, 5], [2, 4, 6], [3, 4], [0, 5, 6], [0, 2, 4], [0, 3, 5], [2, 4, 6]],containedBoxes = [[1, 2, 3], [4, 5, 6], [0, 3, 5], [2, 4, 6], [0, 1, 5], [2, 3, 4], [0, 1, 4]],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],keys = [[1, 2], [3, 4], [5, 6], [7, 8], [9], [], [], [], [], []],containedBoxes = [[3, 4, 5], [6, 7, 8], [9], [], [], [0, 1, 2], [3, 4, 5], [6, 7, 8], [9], [0, 1, 2]],initialBoxes = [0]) == 0\n assert candidate(status = [0, 1, 0, 1, 0, 1],candies = [10, 20, 30, 40, 50, 60],keys = [[1, 2], [0], [3], [4], [5], []],containedBoxes = [[2, 3], [0, 3], [1, 4], [2, 5], [3], []],initialBoxes = [1]) == 210\n assert candidate(status = [1, 0, 1, 0, 1, 0, 1, 0, 1],candies = [10, 20, 30, 40, 50, 60, 70, 80, 90],keys = [[1, 3, 5, 7, 8], [2, 4, 6], [0, 3, 6, 8], [1, 4, 7], [0, 2, 7, 8], [1, 3, 6], [0, 2, 5, 8], [1, 3, 4, 8], [0, 1, 2, 3, 4, 5, 6, 7]],containedBoxes = [[1, 3, 5, 7, 8], [2, 4, 6], [0, 3, 6, 8], [1, 4, 7], [0, 2, 7, 8], [1, 3, 6], [0, 2, 5, 8], [1, 3, 4, 8], [0, 1, 2, 3, 4, 5, 6, 7]],initialBoxes = [0]) == 450\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],keys = [[1, 3, 5, 7], [2, 4, 6, 8], [], [], [], [], [], [], [], []],containedBoxes = [[1, 3, 5, 7], [2, 4, 6, 8], [], [], [], [], [], [], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0],candies = [50, 100, 150, 200, 250, 300, 350],keys = [[2, 3], [1, 3], [0, 2, 4], [0, 1, 2, 5], [0, 3, 5, 6], [1, 4, 6], [1, 3, 4]],containedBoxes = [[1, 2, 3], [0, 2, 4], [0, 1, 5], [0, 1, 2, 5], [0, 3, 5, 6], [1, 4, 6], [1, 3, 4]],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60, 70],keys = [[1, 2, 3], [3, 4], [4, 5, 6], [5, 6], [], [], []],containedBoxes = [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],keys = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [], [], [], [], [], [], [], [], [], []],containedBoxes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [], [], [], [], [], [], [], [], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [0, 1, 0, 1, 0, 1, 0, 1],candies = [10, 20, 30, 40, 50, 60, 70, 80],keys = [[1, 3, 5, 7], [2, 4, 6], [0, 3, 6], [1, 4, 7], [0, 2, 7], [1, 3, 6], [0, 2, 5], [1, 3, 4]],containedBoxes = [[1, 3, 5, 7], [2, 4, 6], [0, 3, 6], [1, 4, 7], [0, 2, 7], [1, 3, 6], [0, 2, 5], [1, 3, 4]],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],keys = [[1, 3, 5, 7], [2, 4, 6, 8], [1, 3, 5, 7], [2, 4, 6, 8], [1, 3, 5, 7], [2, 4, 6, 8], [1, 3, 5, 7], [2, 4, 6, 8], [1, 3, 5, 7], [2, 4, 6, 8]],containedBoxes = [[1, 3, 5, 7], [2, 4, 6, 8], [1, 3, 5, 7], [2, 4, 6, 8], [1, 3, 5, 7], [2, 4, 6, 8], [1, 3, 5, 7], [2, 4, 6, 8], [1, 3, 5, 7], [2, 4, 6, 8]],initialBoxes = [0, 2, 4, 6, 8]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [1, 1, 1, 1, 1, 1, 1, 1, 1],keys = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [], []],containedBoxes = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [500, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],keys = [[], [3, 4, 5], [6, 7, 8], [9, 10], [], [], [], [], [], [], [], []],containedBoxes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [], [], [5, 6, 7, 8, 9, 10], [], [], [], [], [], [], []],initialBoxes = [0]) == 6000\n assert candidate(status = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110],keys = [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [], [], [], [], [], [], [], [], []],containedBoxes = [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [], [], [], [], [], [], [], [], []],initialBoxes = [0]) == 660\n assert candidate(status = [1, 0, 0, 0, 0, 0, 0, 0],candies = [1, 2, 3, 4, 5, 6, 7, 8],keys = [[1, 2], [3, 4], [5, 6], [], [7], [], [], []],containedBoxes = [[1, 2], [3, 4], [5, 6], [], [7], [], [], []],initialBoxes = [0]) == 36\n assert candidate(status = [1, 0, 0, 0, 1, 0],candies = [150, 120, 300, 180, 90, 210],keys = [[1, 4], [2], [3], [4], [], [3]],containedBoxes = [[2], [3], [4], [5], [], []],initialBoxes = [0]) == 150\n assert candidate(status = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],keys = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [], [], [], [], [], [], [], [], [], []],containedBoxes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [], [], [], [], [], [], [], [], [], []],initialBoxes = [0]) == 66\n assert candidate(status = [1, 0, 1, 0, 1, 0],candies = [10, 20, 30, 40, 50, 60],keys = [[2, 3], [1, 4], [0, 5], [0, 4], [3, 5], []],containedBoxes = [[2, 5], [4], [], [1], [5], [0]],initialBoxes = [0]) == 100\n assert candidate(status = [1, 0, 1, 0, 1, 0, 1],candies = [10, 20, 30, 40, 50, 60, 70],keys = [[1, 3], [2, 4], [5], [], [6], [], []],containedBoxes = [[3, 4], [0, 1, 5], [2, 6], [], [], [], []],initialBoxes = [0]) == 100\n assert candidate(status = [1, 0, 0, 1, 0, 0, 1, 0, 0, 1],candies = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],keys = [[3, 5, 7, 9], [0, 2, 4, 6, 8], [], [], [], [], [], [], [], []],containedBoxes = [[1, 3, 5, 7, 9], [2, 4, 6, 8], [3, 5, 7, 9], [4, 6, 8], [5, 7, 9], [6, 8], [7, 9], [8, 9], [9], []],initialBoxes = [0]) == 3600\n assert candidate(status = [0, 1, 0, 1, 0, 1, 0, 1],candies = [10, 20, 30, 40, 50, 60, 70, 80],keys = [[1, 4], [2, 5], [3, 6], [0, 7], [6, 3], [0, 7], [1, 4], [2, 5]],containedBoxes = [[2, 5], [4, 6], [7, 0], [3, 1], [6, 5], [0, 2], [5, 4], [7, 1]],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 1, 0, 1, 0, 0, 0, 1],candies = [15, 25, 35, 5, 10, 15, 20, 25, 30, 40],keys = [[1, 3], [5], [], [6], [], [], [0], [7], [8], []],containedBoxes = [[1, 2, 3, 4], [5, 6], [7, 8], [], [5, 6], [0, 1, 2], [3, 4], [5, 6], [7, 8], []],initialBoxes = [3, 9]) == 45\n assert candidate(status = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],candies = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],keys = [[1, 3, 5, 7, 9], [2, 4, 6, 8], [], [], [], [], [], [], [], []],containedBoxes = [[1, 3, 5, 7, 9], [2, 4, 6, 8], [], [], [], [], [], [], [], []],initialBoxes = [0]) == 275\n assert candidate(status = [1, 1, 0, 1, 0, 0],candies = [10, 20, 30, 40, 50, 60],keys = [[1, 2], [4], [3, 5], [], [5], []],containedBoxes = [[2, 3], [3], [4], [], [5], []],initialBoxes = [0]) == 80\n assert candidate(status = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],candies = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120],keys = [[1, 3, 5, 7, 9, 11], [2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [2, 4, 6, 8, 10]],containedBoxes = [[1, 3, 5, 7, 9, 11], [2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [2, 4, 6, 8, 10], [1, 3, 5, 7, 9], [2, 4, 6, 8, 10]],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60, 70, 80, 90],keys = [[1, 2], [3, 4], [5, 6], [7, 8], [], [], [], [], []],containedBoxes = [[1, 2], [3, 4], [5, 6], [7, 8], [], [], [], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],keys = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [], [], [], [], [], [], [], [], []],containedBoxes = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [], [], [], [], [], [], [], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120],keys = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11], [], [], [], [], [], [], [], [], [], []],containedBoxes = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11], [], [], [], [], [], [], [], [], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [1, 0, 0, 1, 0, 0, 0, 1],candies = [100, 200, 300, 400, 500, 600, 700, 800],keys = [[1, 3, 7], [2, 5], [4, 6], [], [], [], [], []],containedBoxes = [[2, 5, 6], [3, 4, 7], [1, 5, 7], [0, 4, 6], [], [], [], [0, 2]],initialBoxes = [0, 3]) == 500\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0],candies = [5, 10, 15, 20, 25, 30, 35],keys = [[1, 2, 3, 4, 5, 6], [], [], [], [], [], []],containedBoxes = [[1, 2, 3, 4, 5, 6], [], [], [], [], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [1, 0, 0, 0, 1, 0, 1],candies = [10, 20, 30, 40, 50, 60, 70],keys = [[2, 3], [4], [], [], [], [6], [1]],containedBoxes = [[1, 2, 3], [], [4, 5], [], [], [], []],initialBoxes = [0]) == 130\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900],keys = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [2, 3, 4, 5, 6, 7, 8, 9], [], [5, 6, 7, 8, 9], [6, 7, 8, 9], [7, 8, 9], [8, 9], [9], [], []],containedBoxes = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [3, 4, 5, 6, 7, 8, 9], [], [6, 7, 8, 9], [7, 8, 9], [8, 9], [9], [], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [1, 0, 1, 0, 0, 1, 0],candies = [10, 50, 20, 60, 30, 40, 70],keys = [[3], [1, 4], [5], [], [0], [], [2]],containedBoxes = [[2, 4], [5], [], [6], [], [0, 2], []],initialBoxes = [0]) == 30\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],keys = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7], [5, 6, 7, 8], [6, 7, 8, 9], [7, 8, 9], [8, 9], [9], []],containedBoxes = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7], [5, 6, 7, 8], [6, 7, 8, 9], [7, 8, 9], [8, 9], [9], []],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],keys = [[], [], [], [], [], [], [], [], [], [0, 1, 2, 3, 4, 5, 6, 7, 8]],containedBoxes = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [2, 3, 4, 5, 6, 7, 8, 9], [], [], [], [], [], [], [], [0, 1, 2, 3, 4, 5, 6, 7, 8]],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60, 70, 80],keys = [[1, 3, 5], [2, 4, 6], [3, 4], [0, 5, 6], [0, 2, 4], [0, 3, 5], [2, 4, 6], [1, 2, 3]],containedBoxes = [[1, 2, 3], [4, 5, 6], [0, 3, 5], [2, 4, 6], [0, 1, 5], [2, 3, 4], [0, 1, 4], [0, 1, 2, 3, 4, 5, 6]],initialBoxes = [0]) == 0\n assert candidate(status = [0, 1, 0, 0, 0, 1, 0],candies = [1, 2, 3, 4, 5, 6, 7],keys = [[1, 2, 3, 4, 5, 6], [], [4, 5], [5, 6], [1, 3, 5], [], [2, 4]],containedBoxes = [[1, 2, 3, 4, 5, 6], [], [3, 4], [3, 5], [1, 3, 5], [], [2, 4]],initialBoxes = [0]) == 0\n assert candidate(status = [1, 0, 1, 0, 0, 1],candies = [10, 20, 30, 40, 50, 60],keys = [[3, 4], [1], [2], [0], [5], []],containedBoxes = [[1, 2], [3], [4], [5], [], []],initialBoxes = [0]) == 90\n assert candidate(status = [1, 1, 1, 1, 1, 1, 1, 1],candies = [100, 200, 300, 400, 500, 600, 700, 800],keys = [[], [], [], [], [], [], [], []],containedBoxes = [[1, 2, 3, 4, 5, 6, 7], [], [], [], [], [], [], []],initialBoxes = [0]) == 3600\n assert candidate(status = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],candies = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],keys = [[1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [], [], [], [], [], [], [], []],containedBoxes = [[1, 3, 5, 7, 9], [0, 2, 4, 6, 8], [], [], [], [], [], [], [], []],initialBoxes = [1, 3, 5, 7, 9]) == 55\n assert candidate(status = [1, 0, 1, 0, 0, 1],candies = [50, 20, 10, 80, 60, 90],keys = [[3, 4], [2, 5], [], [], [], [1]],containedBoxes = [[1, 2], [3, 5], [], [], [2], []],initialBoxes = [0]) == 60\n assert candidate(status = [1, 0, 0, 1, 0, 1],candies = [100, 200, 300, 400, 500, 600],keys = [[2, 4], [], [1], [5], [], [0]],containedBoxes = [[3, 4, 5], [], [], [], [], [2]],initialBoxes = [0]) == 1900\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],keys = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [], [], [], [], [], [], []],containedBoxes = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [], [], [], [], [], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1],candies = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],keys = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [], [], [], [], [], [], [], [], []],containedBoxes = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [], [], [], [], [], [], [], [9], []],initialBoxes = [9]) == 100\n assert candidate(status = [0, 1, 0, 1, 0, 1, 0, 1],candies = [5, 10, 15, 20, 25, 30, 35, 40],keys = [[1, 3, 5, 7], [], [3, 5, 7], [], [3, 5, 7], [], [3, 5, 7], []],containedBoxes = [[1, 3, 5, 7], [], [1, 3, 5, 7], [], [1, 3, 5, 7], [], [1, 3, 5, 7], []],initialBoxes = [0, 1]) == 10\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0],candies = [1, 2, 3, 4, 5, 6, 7, 8],keys = [[1], [2], [3], [4], [5], [6], [7], []],containedBoxes = [[1], [2], [3], [4], [5], [6], [7], []],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60, 70],keys = [[1], [2], [3], [4], [5], [6], []],containedBoxes = [[2], [3], [4], [5], [6], [7], []],initialBoxes = [0]) == 0\n assert candidate(status = [0, 0, 1, 0, 0, 0, 1],candies = [220, 130, 50, 110, 80, 70, 60],keys = [[1, 2], [3, 4], [5, 6], [], [], [], [1]],containedBoxes = [[3, 4], [5], [6], [], [], [], [0]],initialBoxes = [2]) == 110\n assert candidate(status = [1, 0, 1, 0, 1, 0, 1, 0],candies = [10, 20, 30, 40, 50, 60, 70, 80],keys = [[1], [3], [5], [7], [], [], [], []],containedBoxes = [[1, 3, 5, 7], [], [], [], [], [], [], []],initialBoxes = [0, 2, 4, 6]) == 360\n assert candidate(status = [1, 0, 1, 0, 1, 0, 1, 0],candies = [1, 3, 5, 7, 9, 11, 13, 15],keys = [[2, 4, 6], [1, 3, 5], [], [], [], [], [], []],containedBoxes = [[1, 3, 5], [2, 4, 6], [], [], [], [], [], []],initialBoxes = [0]) == 1\n assert candidate(status = [1, 1, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60],keys = [[1, 2, 3, 4, 5], [], [], [], [], []],containedBoxes = [[1, 2, 3, 4, 5], [], [], [], [], []],initialBoxes = [0]) == 210\n assert candidate(status = [1, 1, 0, 0, 0, 0, 0, 0],candies = [50, 30, 40, 20, 10, 70, 60, 80],keys = [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7], [], []],containedBoxes = [[2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7], [], [], []],initialBoxes = [0, 1]) == 360\n assert candidate(status = [0, 0, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60],keys = [[2, 3], [0, 5], [3, 4], [0, 5], [1, 2], [4]],containedBoxes = [[3, 4], [1, 5], [0, 4], [0, 1], [1, 3], [0]],initialBoxes = [3]) == 0\n assert candidate(status = [1, 1, 0, 0, 0, 1, 0],candies = [5, 15, 25, 35, 45, 55, 65],keys = [[3], [4], [], [6], [2], [], [0]],containedBoxes = [[2, 3, 4], [1, 5], [], [], [], [], []],initialBoxes = [0, 1]) == 180\n assert candidate(status = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],keys = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [], [], [], [], [], [], [], [], []],containedBoxes = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [], [], [], [], [], [], [], [], []],initialBoxes = [0]) == 5500\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0, 0],candies = [1, 2, 3, 4, 5, 6, 7, 8, 9],keys = [[1, 3, 5], [2, 4, 6], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 7], [1, 5, 8], [0, 2, 6], [2, 3, 5]],containedBoxes = [[1, 3, 5], [2, 4, 6], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 7], [1, 5, 8], [0, 2, 6], [2, 3, 5]],initialBoxes = [0]) == 0\n assert candidate(status = [1, 0, 1, 0, 1, 0, 1],candies = [100, 200, 300, 400, 500, 600, 700],keys = [[1], [2], [3], [4], [5], [6], []],containedBoxes = [[1, 3, 5], [2, 4, 6], [3, 5, 6], [4, 5, 6], [5, 6], [6], []],initialBoxes = [0]) == 2800\n assert candidate(status = [1, 1, 1, 1, 1],candies = [10, 20, 30, 40, 50],keys = [[], [3, 4], [4], [], []],containedBoxes = [[1, 2, 3], [2, 3, 4], [3, 4], [], []],initialBoxes = [0]) == 150\n assert candidate(status = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],candies = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],keys = [[1, 2], [3, 4], [5, 6], [7, 8], [9], [0, 1], [2, 3], [4, 5], [6, 7], [8, 9]],containedBoxes = [[4, 5, 6, 7, 8, 9], [5, 6, 7, 8, 9], [6, 7, 8, 9], [7, 8, 9], [8, 9], [9, 0, 1], [0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5]],initialBoxes = [0]) == 500\n assert candidate(status = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0],candies = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],keys = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [], [], [], [], [], [1], [], [], []],containedBoxes = [[2, 3, 4, 5, 6, 7, 8, 9], [], [], [], [], [], [0], [], [], []],initialBoxes = [0, 6]) == 265\n assert candidate(status = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],candies = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],keys = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [], [], [], [], [], [], [], [], []],containedBoxes = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [], [], [], [], [], [], [], [], []],initialBoxes = [0]) == 100\n assert candidate(status = [1, 0, 1, 0, 1, 0],candies = [5, 10, 15, 20, 25, 30],keys = [[2], [1, 3], [4], [0, 5], [], []],containedBoxes = [[2, 3], [1, 4], [0, 5], [], [], [2]],initialBoxes = [0]) == 20\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60, 70],keys = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6], []],containedBoxes = [[1, 2, 3, 4, 5, 6], [], [], [], [], [], []],initialBoxes = [0]) == 0\n assert candidate(status = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],candies = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],keys = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [], [0, 1], [2, 3], [4, 5], [6, 7], [8, 9], []],containedBoxes = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [], [0, 1], [2, 3], [4, 5], [6, 7], [8, 9], []],initialBoxes = [0, 2, 4, 6, 8]) == 275\n assert candidate(status = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],candies = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],keys = [[1, 2], [3, 4], [5, 6], [7, 8], [9], [0, 1], [2, 3], [4, 5], [6, 7], [8, 9]],containedBoxes = [[3, 4, 5], [6, 7, 8], [9], [0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [0, 1], [2, 3]],initialBoxes = [0]) == 2500\n assert candidate(status = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1],candies = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],keys = [[2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7]],containedBoxes = [[4, 5, 6, 7, 8, 9], [5, 6, 7, 8, 9], [6, 7, 8, 9], [7, 8, 9], [8, 9], [9, 0, 1], [0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5]],initialBoxes = [0]) == 0\n assert candidate(status = [0, 1, 0, 1, 0, 1, 0, 1],candies = [10, 20, 30, 40, 50, 60, 70, 80],keys = [[2], [3], [4], [5], [6], [7], [], [1]],containedBoxes = [[1, 3, 5, 7], [2, 4, 6], [3, 5, 7], [4, 6], [5, 7], [6, 7], [], []],initialBoxes = [0, 1]) == 20\n assert candidate(status = [0, 0, 0, 0, 0, 0, 0, 0],candies = [10, 20, 30, 40, 50, 60, 70, 80],keys = [[1, 2], [3, 4], [5, 6], [7], [6], [5], [4], [3]],containedBoxes = [[1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 0], [7, 1], [0, 2]],initialBoxes = [0]) == 0\n"}, "metadata": {"canonical_parameter_names": ["status", "candies", "keys", "containedBoxes", "initialBoxes"], "leetcode_dataset_entry_point": "Solution().maxCandies", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var maxCandies = function(status, candies, keys, containedBoxes, initialBoxes) {", "container": null, "callable": "maxCandies", "parameters": [{"name": "status", "type": "number[]"}, {"name": "candies", "type": "number[]"}, {"name": "keys", "type": "number[][]"}, {"name": "containedBoxes", "type": "number[][]"}, {"name": "initialBoxes", "type": "number[]"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1299, "task_id": "replace-elements-with-greatest-element-on-right-side", "difficulty": "Easy", "problem_description": "Given an array arr, replace every element in that array with the greatest element among the elements to its right, and replace the last element with -1.\nAfter doing so, return the array.\n \nExample 1:\n\nInput: arr = [17,18,5,4,6,1]\nOutput: [18,6,6,6,1,-1]\nExplanation: \n- index 0 --> the greatest element to the right of index 0 is index 1 (18).\n- index 1 --> the greatest element to the right of index 1 is index 4 (6).\n- index 2 --> the greatest element to the right of index 2 is index 4 (6).\n- index 3 --> the greatest element to the right of index 3 is index 4 (6).\n- index 4 --> the greatest element to the right of index 4 is index 5 (1).\n- index 5 --> there are no elements to the right of index 5, so we put -1.\n\nExample 2:\n\nInput: arr = [400]\nOutput: [-1]\nExplanation: There are no elements to the right of index 0.\n\n \nConstraints:\n\n1 <= arr.length <= 104\n1 <= arr[i] <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [10, 10, 10, 10, 10, 10, 10, 10, 10, -1]\n assert candidate(arr = [5, 4, 3, 2, 1]) == [4, 3, 2, 1, -1]\n assert candidate(arr = [1, 2, 3, 4, 5]) == [5, 5, 5, 5, -1]\n assert candidate(arr = [1, 1, 1, 1, 1]) == [1, 1, 1, 1, -1]\n assert candidate(arr = [1, 2]) == [2, -1]\n assert candidate(arr = [1, 2, 3]) == [3, 3, -1]\n assert candidate(arr = [17, 18, 5, 4, 6, 1]) == [18, 6, 6, 6, 1, -1]\n assert candidate(arr = [1]) == [-1]\n assert candidate(arr = [10, 20, 30, 40, 50]) == [50, 50, 50, 50, -1]\n assert candidate(arr = [50, 40, 30, 20, 10]) == [40, 30, 20, 10, -1]\n assert candidate(arr = [99999, 99998, 99997, 99996, 99995]) == [99998, 99997, 99996, 99995, -1]\n assert candidate(arr = [2, 1]) == [1, -1]\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [9, 8, 7, 6, 5, 4, 3, 2, 1, -1]\n assert candidate(arr = [400]) == [-1]\n assert candidate(arr = [3, 3, 3, 3, 3]) == [3, 3, 3, 3, -1]\n assert candidate(arr = [100000, 100000, 100000]) == [100000, 100000, -1]\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, -1]\n assert candidate(arr = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -1]\n assert candidate(arr = [100000, 99999, 99998, 99997, 99996, 99995]) == [99999, 99998, 99997, 99996, 99995, -1]\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == [39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, -1]\n assert candidate(arr = [100000, 99999, 99998, 99997, 99996, 99995]) == [99999, 99998, 99997, 99996, 99995, -1]\n assert candidate(arr = [1, 2, 3, 2, 1, 3, 2, 1]) == [3, 3, 3, 3, 3, 2, 1, -1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1]\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150]) == [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -1]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, -1]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == [8, 7, 6, 5, 4, 3, 2, 1, -1]\n assert candidate(arr = [1, 10, 2, 9, 3, 8, 4, 7, 5, 6]) == [10, 9, 9, 8, 8, 7, 7, 6, 6, -1]\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 21]) == [21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -1]\n assert candidate(arr = [1, 10, 100, 1000, 10000]) == [10000, 10000, 10000, 10000, -1]\n assert candidate(arr = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -1]\n assert candidate(arr = [100000]) == [-1]\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -1, -1, -1, -1, -1]\n assert candidate(arr = [10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1]) == [10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, -1]\n assert candidate(arr = [10, 1, 20, 2, 30, 3, 40, 4, 50, 5]) == [50, 50, 50, 50, 50, 50, 50, 50, 5, -1]\n assert candidate(arr = [9, 4, 3, 9, 1, 8, 5, 2]) == [9, 9, 9, 8, 8, 5, 2, -1]\n assert candidate(arr = [5, 6, 7, 8, 9, 10, 4, 3, 2, 1]) == [10, 10, 10, 10, 10, 4, 3, 2, 1, -1]\n assert candidate(arr = [5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, -1]\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == [50, 50, 50, 50, 50, 50, 50, 50, 50, -1]\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, -1]\n assert candidate(arr = [100000, 100000, 100000, 100000, 100000]) == [100000, 100000, 100000, 100000, -1]\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == [100, 100, 100, 100, 100, 100, 100, 100, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, -1]\n assert candidate(arr = [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86]) == [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, -1]\n assert candidate(arr = [1, 10, 2, 9, 3, 8, 4, 7, 5, 6]) == [10, 9, 9, 8, 8, 7, 7, 6, 6, -1]\n assert candidate(arr = [100000, 99999, 99998, 99997, 99996, 99995, 99994]) == [99999, 99998, 99997, 99996, 99995, 99994, -1]\n assert candidate(arr = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -1]\n assert candidate(arr = [1, 3, 2, 4, 5, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, -1]\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == [50, 50, 50, 50, 50, 50, 50, 50, 50, -1]\n assert candidate(arr = [1, 100000, 1, 100000, 1, 100000, 1, 100000, 1, 100000]) == [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, -1]\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == [100, 100, 100, 100, 100, 100, 100, 100, 100, -1]\n assert candidate(arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]) == [9, 9, 9, 9, 9, 6, 6, 5, 5, 5, -1]\n assert candidate(arr = [1, 3, 2, 3, 1, 3, 2, 3, 1, 3]) == [3, 3, 3, 3, 3, 3, 3, 3, 3, -1]\n assert candidate(arr = [5, 5, 5, 5, 5, 6, 6, 6, 6, 6]) == [6, 6, 6, 6, 6, 6, 6, 6, 6, -1]\n assert candidate(arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, -1]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, -1]\n assert candidate(arr = [1000, 999, 998, 997, 996, 995, 994, 993, 992, 991]) == [999, 998, 997, 996, 995, 994, 993, 992, 991, -1]\n assert candidate(arr = [5, 5, 5, 5, 5, 9, 5, 5, 5, 5]) == [9, 9, 9, 9, 9, 5, 5, 5, 5, -1]\n assert candidate(arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [9, 8, 7, 6, 5, 4, 3, 2, 1, -1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -1]\n assert candidate(arr = [100, 90, 90, 80, 80, 70, 60, 50, 40, 30, 20, 10]) == [90, 90, 80, 80, 70, 60, 50, 40, 30, 20, 10, -1]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1]\n assert candidate(arr = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == [9, 9, 9, 9, 9, 9, 9, 9, 9, -1]\n assert candidate(arr = [3, 2, 2, 3, 1, 1, 2, 3, 4, 5]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, -1]\n assert candidate(arr = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, -1]\n assert candidate(arr = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == [90, 80, 70, 60, 50, 40, 30, 20, 10, -1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [10, 10, 10, 10, 10, 10, 10, 10, 10, -1]\n assert candidate(arr = [2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2]) == [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, -1]\n assert candidate(arr = [50, 45, 40, 35, 30, 25, 20, 15, 10, 5]) == [45, 40, 35, 30, 25, 20, 15, 10, 5, -1]\n assert candidate(arr = [200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == [190, 180, 170, 160, 150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, -1]\n assert candidate(arr = [1, 2, 3, 4, 3, 2, 1, 2, 3, 4]) == [4, 4, 4, 4, 4, 4, 4, 4, 4, -1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -1]\n assert candidate(arr = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10]) == [10, 10, 10, 10, 10, 10, 10, 10, 10, -1]\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, -1]\n assert candidate(arr = [1, 3, 2, 4, 5, 3, 4, 2, 3, 1]) == [5, 5, 5, 5, 4, 4, 3, 3, 1, -1]\n assert candidate(arr = [10, 20, 10, 20, 10, 20, 10, 20]) == [20, 20, 20, 20, 20, 20, 20, -1]\n assert candidate(arr = [9, 4, 3, 9, 2, 5, 6, 7, 8, 1]) == [9, 9, 9, 8, 8, 8, 8, 8, 1, -1]\n assert candidate(arr = [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, -1]\n assert candidate(arr = [10, 100, 1000, 10000, 100000, 99999, 9999, 999, 99, 9]) == [100000, 100000, 100000, 100000, 99999, 9999, 999, 99, 9, -1]\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1]\n assert candidate(arr = [10, 1, 10, 1, 10, 1, 10, 1, 10, 1]) == [10, 10, 10, 10, 10, 10, 10, 10, 1, -1]\n assert candidate(arr = [100000, 1, 100000, 1, 100000, 1, 100000, 1, 100000, 1]) == [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 1, -1]\n assert candidate(arr = [3, 5, 1, 8, 9, 1, 4, 2, 10, 7]) == [10, 10, 10, 10, 10, 10, 10, 10, 7, -1]\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [8, 7, 6, 5, 4, 3, 2, 1, 0, -1]\n assert candidate(arr = [100000, 99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991]) == [99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991, -1]\n assert candidate(arr = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, -1]\n assert candidate(arr = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 20]) == [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -1]\n assert candidate(arr = [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000]) == [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, -1]\n assert candidate(arr = [10, 20, 10, 30, 10, 40, 10, 50, 10, 60]) == [60, 60, 60, 60, 60, 60, 60, 60, 60, -1]\n assert candidate(arr = [1, 3, 2, 4, 6, 5, 7, 9, 8, 10]) == [10, 10, 10, 10, 10, 10, 10, 10, 10, -1]\n assert candidate(arr = [1, 100000, 2, 99999, 3, 99998, 4, 99997, 5, 99996]) == [100000, 99999, 99999, 99998, 99998, 99997, 99997, 99996, 99996, -1]\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, -1]\n assert candidate(arr = [1, 3, 2, 6, 5, 4, 7, 9, 8, 10]) == [10, 10, 10, 10, 10, 10, 10, 10, 10, -1]\n assert candidate(arr = [1, 2, 3, 2, 1, 3, 2, 1, 3, 2]) == [3, 3, 3, 3, 3, 3, 3, 3, 2, -1]\n assert candidate(arr = [9, 4, 3, 2, 7, 8, 5, 6]) == [8, 8, 8, 8, 8, 6, 6, -1]\n assert candidate(arr = [9, 4, 3, 7, 2, 8, 6]) == [8, 8, 8, 8, 8, 6, -1]\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -1]\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, -1]\n assert candidate(arr = [2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3]) == [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -1]\n assert candidate(arr = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -1]\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, -1]\n assert candidate(arr = [8, 8, 8, 8, 8, 8, 8, 8]) == [8, 8, 8, 8, 8, 8, 8, -1]\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10]) == [10, 10, 10, 10, 10, 10, -1]\n assert candidate(arr = [100000, 100000, 100000, 100000]) == [100000, 100000, 100000, -1]\n"}, "metadata": {"canonical_parameter_names": ["arr"], "leetcode_dataset_entry_point": "Solution().replaceElements", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var replaceElements = function(arr) {", "container": null, "callable": "replaceElements", "parameters": [{"name": "arr", "type": "number[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1300, "task_id": "sum-of-mutated-array-closest-to-target", "difficulty": "Medium", "problem_description": "Given an integer array arr and a target value target, return the integer value such that when we change all the integers larger than value in the given array to be equal to value, the sum of the array gets as close as possible (in absolute difference) to target.\nIn case of a tie, return the minimum such integer.\nNotice that the answer is not neccesarilly a number from arr.\n \nExample 1:\n\nInput: arr = [4,9,3], target = 10\nOutput: 3\nExplanation: When using 3 arr converts to [3, 3, 3] which sums 9 and that's the optimal answer.\n\nExample 2:\n\nInput: arr = [2,3,5], target = 10\nOutput: 5\n\nExample 3:\n\nInput: arr = [60864,25176,27249,21296,20204], target = 56803\nOutput: 11361\n\n \nConstraints:\n\n1 <= arr.length <= 104\n1 <= arr[i], target <= 105\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 2, 3, 4, 5],target = 11) == 3\n assert candidate(arr = [5, 5, 5, 5, 5],target = 17) == 3\n assert candidate(arr = [10, 20, 30, 40, 50],target = 100) == 23\n assert candidate(arr = [2, 3, 5],target = 10) == 5\n assert candidate(arr = [9, 9, 9, 9, 9],target = 40) == 8\n assert candidate(arr = [10000, 10000, 10000],target = 10000) == 3333\n assert candidate(arr = [99999, 99999, 99999, 99999],target = 100000) == 25000\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 50) == 7\n assert candidate(arr = [60864, 25176, 27249, 21296, 20204],target = 56803) == 11361\n assert candidate(arr = [100000, 100000, 100000],target = 100000) == 33333\n assert candidate(arr = [100000, 100000, 100000],target = 299999) == 100000\n assert candidate(arr = [5, 5, 5, 5, 5],target = 20) == 4\n assert candidate(arr = [10, 20, 30],target = 25) == 8\n assert candidate(arr = [1, 1, 1, 1, 1],target = 3) == 1\n assert candidate(arr = [1, 2, 3, 4, 5],target = 15) == 5\n assert candidate(arr = [100000, 100000, 100000],target = 250000) == 83333\n assert candidate(arr = [4, 9, 3],target = 10) == 3\n assert candidate(arr = [1, 1, 1, 1, 1],target = 5) == 1\n assert candidate(arr = [10000, 20000, 30000, 40000, 50000],target = 100000) == 23333\n assert candidate(arr = [10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000],target = 95000) == 9500\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10],target = 100) == 7\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],target = 10) == 0\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],target = 50) == 0\n assert candidate(arr = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],target = 30000) == 3429\n assert candidate(arr = [1, 1, 2, 2, 2, 3, 3, 4, 4, 5],target = 20) == 2\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],target = 10) == 1\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],target = 100) == 5\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],target = 4500) == 600\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],target = 100) == 9\n assert candidate(arr = [50000, 25000, 75000, 12500, 100000],target = 100000) == 21875\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29],target = 150) == 13\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],target = 50) == 1\n assert candidate(arr = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],target = 500) == 95\n assert candidate(arr = [5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000],target = 45000) == 4500\n assert candidate(arr = [1, 2, 3, 100000, 99999, 1, 2, 3, 100000, 99999],target = 300000) == 74997\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 200) == 16\n assert candidate(arr = [10000, 20000, 30000, 40000, 50000],target = 150000) == 50000\n assert candidate(arr = [23, 1, 32, 43, 54, 65, 76, 87, 98, 109, 120, 131, 142, 153, 164],target = 900) == 76\n assert candidate(arr = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],target = 100000) == 10000\n assert candidate(arr = [23, 56, 78, 90, 12, 34, 56, 78, 90, 12, 34, 56, 78, 90, 12, 34, 56, 78, 90, 12, 34, 56, 78, 90, 12, 34, 56, 78, 90, 12, 34, 56, 78, 90, 12, 34, 56, 78, 90],target = 1500) == 48\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 40) == 5\n assert candidate(arr = [99999, 99999, 99999, 99999, 99999],target = 499995) == 99999\n assert candidate(arr = [99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999],target = 500000) == 50000\n assert candidate(arr = [10, 20, 30, 40, 50],target = 120) == 30\n assert candidate(arr = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],target = 50) == 5\n assert candidate(arr = [90000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000, 1000],target = 300000) == 39833\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],target = 10) == 1\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],target = 550) == 100\n assert candidate(arr = [1, 1000, 100000, 1000000, 10000000],target = 5000000) == 3898999\n assert candidate(arr = [10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000],target = 550000) == 100000\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 100) == 6\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 20) == 2\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 150) == 10\n assert candidate(arr = [100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000],target = 900000) == 90000\n assert candidate(arr = [5, 15, 25, 35, 45, 55],target = 150) == 35\n assert candidate(arr = [1, 10, 100, 1000, 10000],target = 12345) == 10000\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],target = 4500) == 600\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 210) == 20\n assert candidate(arr = [100, 150, 200, 250, 300],target = 800) == 183\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 30) == 3\n assert candidate(arr = [99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991, 99990],target = 500000) == 50000\n assert candidate(arr = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],target = 150) == 7\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],target = 75) == 10\n assert candidate(arr = [1, 100000, 2, 99999, 3, 99998],target = 100000) == 33331\n assert candidate(arr = [1, 3, 5, 7, 9],target = 25) == 9\n assert candidate(arr = [100000, 99999, 99998, 99997, 99996, 99995],target = 300000) == 50000\n assert candidate(arr = [100000, 1, 50000, 25000, 75000],target = 150000) == 41666\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],target = 10000) == 567\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],target = 250) == 27\n assert candidate(arr = [10, 10, 20, 20, 30, 30, 40, 40, 50, 50],target = 200) == 23\n assert candidate(arr = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95],target = 300) == 37\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],target = 1000) == 92\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],target = 1500) == 95\n assert candidate(arr = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100],target = 1000) == 50\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500],target = 7500) == 600\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39],target = 200) == 12\n assert candidate(arr = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],target = 8000) == 800\n assert candidate(arr = [50, 50, 50, 50, 50, 50],target = 200) == 33\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],target = 1000) == 1\n assert candidate(arr = [1000, 2000, 3000, 4000, 5000],target = 10000) == 2333\n assert candidate(arr = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50],target = 450) == 45\n assert candidate(arr = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],target = 20) == 2\n assert candidate(arr = [100000, 90000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000],target = 550000) == 100000\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 25) == 3\n assert candidate(arr = [10, 20, 30, 40, 50],target = 150) == 50\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 45) == 6\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],target = 5000) == 733\n assert candidate(arr = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],target = 225) == 30\n assert candidate(arr = [50, 51, 52, 53, 54, 55, 56, 57, 58, 59],target = 550) == 59\n assert candidate(arr = [100000, 50000, 25000, 12500, 6250, 3125, 1562, 781, 390, 195],target = 300000) == 100000\n assert candidate(arr = [50, 40, 30, 20, 10],target = 150) == 50\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 45) == 6\n assert candidate(arr = [1, 10, 100, 1000, 10000],target = 11111) == 10000\n assert candidate(arr = [99999, 1, 99998, 2, 99997, 3, 99996, 4, 99995, 5],target = 499950) == 99987\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],target = 50) == 3\n assert candidate(arr = [100, 200, 300, 400, 500],target = 1400) == 400\n assert candidate(arr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],target = 10) == 0\n assert candidate(arr = [50000, 50000, 50000, 50000, 50000],target = 200000) == 40000\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 55) == 10\n assert candidate(arr = [1, 100, 1000, 10000, 100000],target = 12345) == 5622\n assert candidate(arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150],target = 1000) == 92\n assert candidate(arr = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000],target = 3000) == 343\n assert candidate(arr = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50],target = 200) == 20\n assert candidate(arr = [1, 2, 3, 4, 5],target = 15) == 5\n assert candidate(arr = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000],target = 55000) == 10000\n assert candidate(arr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],target = 25) == 2\n assert candidate(arr = [5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000],target = 80000) == 9000\n assert candidate(arr = [1, 10000, 2, 9999, 3, 9998, 4, 9997, 5, 9996],target = 50000) == 9997\n assert candidate(arr = [50000, 40000, 30000, 20000, 10000],target = 100000) == 23333\n assert candidate(arr = [10000, 20000, 30000, 40000, 50000],target = 120000) == 30000\n assert candidate(arr = [100, 200, 300, 400, 500],target = 1000) == 233\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1],target = 25) == 3\n assert candidate(arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],target = 100) == 19\n"}, "metadata": {"canonical_parameter_names": ["arr", "target"], "leetcode_dataset_entry_point": "Solution().findBestValue", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var findBestValue = function(arr, target) {", "container": null, "callable": "findBestValue", "parameters": [{"name": "arr", "type": "number[]"}, {"name": "target", "type": "number"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1301, "task_id": "number-of-paths-with-max-score", "difficulty": "Hard", "problem_description": "You are given a square board of characters. You can move on the board starting at the bottom right square marked with the character 'S'.\\r\n\\r\nYou need to reach the top left square marked with the character 'E'. The rest of the squares are labeled either with a numeric character 1, 2, ..., 9 or with an obstacle 'X'. In one move you can go up, left or up-left (diagonally) only if there is no obstacle there.\\r\n\\r\nReturn a list of two integers: the first integer is the maximum sum of numeric characters you can collect, and the second is the number of such paths that you can take to get that maximum sum, taken modulo 10^9 + 7.\\r\n\\r\nIn case there is no path, return [0, 0].\\r\n\\r\n \\r\nExample 1:\\r\nInput: board = [\"E23\",\"2X2\",\"12S\"]\\r\nOutput: [7,1]\\r\nExample 2:\\r\nInput: board = [\"E12\",\"1X1\",\"21S\"]\\r\nOutput: [4,2]\\r\nExample 3:\\r\nInput: board = [\"E11\",\"XXX\",\"11S\"]\\r\nOutput: [0,0]\\r\n\\r\n \\r\nConstraints:\\r\n\\r\n\\r\n\t2 <= board.length == board[i].length <= 100\\r\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(board = ['E123', '45X7', '89XS']) == [21, 1]\n assert candidate(board = ['E11', 'XXX', '11S']) == [0, 0]\n assert candidate(board = ['EX', 'XS']) == [0, 1]\n assert candidate(board = ['E111', '1X11', '1111', '111S']) == [5, 8]\n assert candidate(board = ['E22', '222', '22S']) == [6, 6]\n assert candidate(board = ['E1X', 'X1X', 'X1S']) == [3, 1]\n assert candidate(board = ['E123', '12X3', '21XS']) == [4, 3]\n assert candidate(board = ['E123', '1X21', '21XS']) == [5, 1]\n assert candidate(board = ['EX', '1S']) == [1, 1]\n assert candidate(board = ['E23', '2X2', '12S']) == [7, 1]\n assert candidate(board = ['E111', '1111', '11X1', '111S']) == [5, 8]\n assert candidate(board = ['E12', '1X1', '21S']) == [4, 2]\n assert candidate(board = ['E123', '456X', '789S']) == [28, 1]\n assert candidate(board = ['E123', '4X56', '789S']) == [28, 1]\n assert candidate(board = ['E1X', '1X1', 'S11']) == [3, 2]\n assert candidate(board = ['E1', '1S']) == [1, 2]\n assert candidate(board = ['E123456', '2345678', '345678X', '456789X', '56789XS', '6789XSX']) == [44, 35]\n assert candidate(board = ['E121', '2121', '1212', '1S11']) == [9, 6]\n assert candidate(board = ['E12X4', '56789', 'X1234', '5678X', '9XS12']) == [40, 1]\n assert candidate(board = ['E12345', '6789X1', '234567', '89XS12', '345678']) == [49, 1]\n assert candidate(board = ['E1X1X1X1', '1X1X1X1X', '1X1X1X1X', '1X1X1X1X', '1X1X1X1X', '1X1X1X1X', '1X1X1X1S']) == [0, 0]\n assert candidate(board = ['E1234', '56X89', '4X321', '12X56', '789XS']) == [30, 1]\n assert candidate(board = ['E1234567', '23456789', '3456789X', '456789XS', '56789XSX', '6789XSXX', '789XSXXX', '89XSXXXX']) == [0, 0]\n assert candidate(board = ['E1234', '56789', 'X123X', '45678', '9XS12']) == [46, 1]\n assert candidate(board = ['E1X1', '1X1X', '1X1X', '1X1S']) == [4, 1]\n assert candidate(board = ['E2222', '22222', '22X22', '22222', '2222S']) == [14, 34]\n assert candidate(board = ['E11111111', '1X1X1X1X1', '111X111X1', '1X1X1X1X1', '111X111X1', '1X1X1X1X1', '111X111X1', '1X1X1X1X1', '11111111S']) == [15, 11]\n assert candidate(board = ['E9876', '9X8X7', '6X5X4', '3X2X1', '4321S']) == [42, 1]\n assert candidate(board = ['E1234567', '89X12345', '6789X123', '456789X1', '23456789', '1234567S', '89XS1234']) == [90, 1]\n assert candidate(board = ['E999', '9X99', '99X9', '999S']) == [45, 4]\n assert candidate(board = ['E12X4', '56789', 'X1234', '56789', 'S1234']) == [52, 1]\n assert candidate(board = ['E123456', '789X123', '456789X', '1234567', '89X1234', '56789XS']) == [63, 1]\n assert candidate(board = ['E111', '1X11', '11X1', '111S']) == [5, 4]\n assert candidate(board = ['E222', '2X22', '2X22', '2X2S']) == [10, 4]\n assert candidate(board = ['E12345', '6X7X89', '1X2X3X', '4X5X6X', '7X8X9X', '12345S']) == [41, 1]\n assert candidate(board = ['E1234', '1X1X1', '21212', '31313', '4141S']) == [16, 2]\n assert candidate(board = ['E1234', '56X78', '9X0X1', '23456', '7XS9E']) == [37, 1]\n assert candidate(board = ['E1234567', '1X2X3X4X', '5X6X7X8X', '9X0X1X2X', '3X4X5X6X', '7X8X9X0X', '1234567S']) == [53, 2]\n assert candidate(board = ['E2222', '2X2X2', '2X2X2', '2X2X2', '2222S']) == [14, 3]\n assert candidate(board = ['E123456', '789X123', '456789X', '1234567', '89XS123', '3456789']) == [70, 1]\n assert candidate(board = ['E1X1X1X1X1X1', '111111111111', '1X1X1X1X1X11', '111X1X1X1X11', '1X1X1X1X1X11', '111X1X1X1X11', '1X1X1X1X1X11', '111X1X1X1X1S']) == [13, 2]\n assert candidate(board = ['E1X1X1X1X1X1X1X1', '1111111111111111', '1X1X1X1X1X1X1X11', '111X1X1X1X1X1X11', '1X1X1X1X1X1X1X11', '111X1X1X1X1X1X11', '1X1X1X1X1X1X1X11', '111X1X1X1X1X1X11', '1X1X1X1X1X1X1X11', '111X1X1X1X1X1X11', '1X1X1X1X1X1X1X11', '111X1X1X1X1X1X11', '1X1X1X1X1X1X1X11', '111111111111111S']) == [26, 18]\n assert candidate(board = ['E12X45', '1X2X3X', '4X5X6X', '7X8X9X', '1X2X3X', '45678S']) == [43, 1]\n assert candidate(board = ['E1111', '1X1X1', '111X1', '1X1X1', '1111S']) == [7, 4]\n assert candidate(board = ['E1234', '56X78', '9XABC', 'DEFXS']) == [14, 2]\n assert candidate(board = ['E12121', '1X1X11', '212121', '1X1X11', '212121', '11111S']) == [13, 12]\n assert candidate(board = ['E12345', '6789XS', '54321X', '98765X', '43210X', '32109S']) == [55, 1]\n assert candidate(board = ['E12345', '1X1X1X', '212121', '1X1X1X', '32323S']) == [17, 2]\n assert candidate(board = ['E22222', '2X2X22', '222X22', '2X2X22', '222X22', '22222S']) == [18, 11]\n assert candidate(board = ['E11111', '1X1X11', '1X1X11', '1X1X11', '1X1X11', '11111S']) == [9, 8]\n assert candidate(board = ['E12345', '67X9X1', '234567', '89XS12', '345678', '456789']) == [64, 10]\n assert candidate(board = ['E1X1X1X1X1X1X1', '11111111111111', '1X1X1X1X1X1X11', '111X1X1X1X1X11', '1X1X1X1X1X1X11', '111X1X1X1X1X11', '1X1X1X1X1X1X11', '111X1X1X1X1X11', '1X1X1X1X1X1X11', '111X1X1X1X1X11', '1X1X1X1X1X1X11', '1111111111111S']) == [22, 15]\n assert candidate(board = ['E1234', '56X78', '9X123', '45678', '89XS1']) == [45, 1]\n assert candidate(board = ['E234', '1X12', '21XS', '3456']) == [21, 1]\n assert candidate(board = ['E1111', '1X1X1', '1X1X1', '1X1X1', '1111S']) == [7, 3]\n assert candidate(board = ['E11111', '111111', '111X11', '111111', '111111', '11111S']) == [9, 152]\n assert candidate(board = ['E1111111', '1X1X1X11', '111X1111', '1X1X1X11', '111X1111', '1X1X1X11', '111X1111', '1111111S']) == [13, 28]\n assert candidate(board = ['E12345678910', '1X1X1X1X1X1X11', '212121212121', '1X1X1X1X1X1X11', '323232323232', '1X1X1X1X1X1X11', '414141414141', '1X1X1X1X1X1X11', '515151515151', '1X1X1X1X1X1X11', '616161616161', '1111111111111S']) == [73, 2]\n assert candidate(board = ['E123456789', '987654321X', '123456789X', 'X987654321', '123456789X', 'X987654321', '123456789X', 'X987654321', '123456789X', 'XS12345678']) == [121, 72]\n assert candidate(board = ['E12345', '67X890', '123X45', '678X90', '123X45', '6789XS']) == [45, 1]\n assert candidate(board = ['E12345', '1X2X3X', '4X5X6X', '7X8X9X', '1X2X3X', '45678S']) == [43, 1]\n assert candidate(board = ['E1111', '11111', '11X11', '11111', '1111S']) == [7, 34]\n assert candidate(board = ['E11X1', '1X1X1', '1X1X1', '1X1X1', '111XS']) == [0, 0]\n assert candidate(board = ['E111111', '1X1X1X1', '111X111', '1X1X1X1', '111X111', '1X1X1X1', '111111S']) == [11, 8]\n assert candidate(board = ['E1X1X1', '1X1X1X', '1X1X1X', '1X1X1X', '1X1X1S']) == [0, 0]\n assert candidate(board = ['E11111', '1X1X1X', '111X11', '1X1X1X', '11111S']) == [8, 4]\n assert candidate(board = ['E1X1X1X1X1X1X1X1X1', '111111111111111111', '1X1X1X1X1X1X1X1X11', '111X1X1X1X1X1X1X11', '1X1X1X1X1X1X1X1X11', '111X1X1X1X1X1X1X11', '1X1X1X1X1X1X1X1X11', '111X1X1X1X1X1X1X11', '1X1X1X1X1X1X1X1X11', '111X1X1X1X1X1X1X11', '1X1X1X1X1X1X1X1X11', '111X1X1X1X1X1X1X11', '1X1X1X1X1X1X1X1X11', '111X1X1X1X1X1X1X11', '1X1X1X1X1X1X1X1X11', '11111111111111111S']) == [30, 21]\n assert candidate(board = ['E111111', '1X1X1X1', '111X1X1', '1X1X1X1', '111X1X1', '1X1X1X1', '111111S']) == [11, 6]\n assert candidate(board = ['E11X1', '1X1X1', '1X1X1', '1X1X1', '11X1S']) == [6, 1]\n assert candidate(board = ['E123', '21X1', '1X1X', '321S']) == [9, 1]\n assert candidate(board = ['E11111', '1X1X11', '111X11', '1X1X11', '111X11', '11111S']) == [9, 11]\n assert candidate(board = ['E1111', '1X1X1', '11111', '1X1X1', '1111S']) == [7, 6]\n assert candidate(board = ['E1X11', '11X11', '111X1', '1111X', '1111S']) == [7, 19]\n assert candidate(board = ['E123456', '1X2X3X4', '5X6X7X8', '9X0X1X2', '3X4X5X6', '7X8X9XS']) == [35, 1]\n assert candidate(board = ['E12345678', '9X1234567', '89X12345X', '789XS1234', '6789XS123', '56789XS12', '456789XS1', '3456789XS']) == [111, 1]\n assert candidate(board = ['E11111', '1X1X11', '111111', '1X1X1X', '111111', '11XS11']) == [10, 12]\n assert candidate(board = ['E1111111', '1X1X1X11', '11111111', '1X1X1X11', '11111111', '1X1X1X11', '11111111', '11XS1111']) == [14, 90]\n assert candidate(board = ['E123456', '789X123', '456789X', '1234567', '89XS123', '456789S']) == [71, 1]\n assert candidate(board = ['E12345', '1X2X3X', '4X5X6X', '7X8X9X', '1X2X3X', '4567XS']) == [31, 1]\n assert candidate(board = ['E1212121', '1X1X1X11', '21212121', '1X1X1X11', '21212121', '1X1X1X11', '21212121', '1111111S']) == [19, 40]\n assert candidate(board = ['E1234', '4321X', '1234X', '4321X', '1234S']) == [21, 8]\n assert candidate(board = ['E2222', '2X2X2', '222X2', '2X2X2', '2222S']) == [14, 4]\n assert candidate(board = ['E11111', '1X1X1X', '1X1X1X', '1X1X1X', '1X1X1X', '11111S']) == [9, 3]\n assert candidate(board = ['E1111', '11111', '11111', '11111', '1111S']) == [7, 70]\n assert candidate(board = ['E123456789', '1X11111111', '2121212121', '3131313131', '4141414141', '5151515151', '6161616161', '7171717171', '8181818181', '9191919191S']) == [86, 1]\n assert candidate(board = ['E12X12', '234567', '89XS12', '345678', '456789', '56789S']) == [58, 15]\n assert candidate(board = ['E12345', '678X91', '234567', '89X123', '456789', '9XS123']) == [63, 2]\n assert candidate(board = ['E123456789', '1X2X3X4X5', '6X7X8X9X0', '1X2X3X4X5', '6X7X8X9X0', '1X2X3X4X5', '6X7X8X9X0', '1X2X3X4X5', '6X7X8X9XS']) == [56, 1]\n assert candidate(board = ['E1111', '1X1X1', '1X1X1', '1111S']) == [6, 2]\n assert candidate(board = ['E1234567', '89X12345', '6789XS12', '3456789S', '456789XS', '56789XS1', '6789XS12']) == [0, 0]\n assert candidate(board = ['E12X45', '6789X1', '234567', '89X123', '45678X', '9XS123']) == [56, 4]\n assert candidate(board = ['E123456789', '987654X789', '87654321X9', '7654321X89', '654321X789', '54321X6789', '4321X56789', '321X456789', '21X3456789', '1XS2345678']) == [125, 1]\n assert candidate(board = ['E1111', '11X11', '1X1X1', '11X11', '1111S']) == [7, 4]\n assert candidate(board = ['E12345', '67X89X', '123XS1', '456789', 'X98765', '4321XS']) == [55, 2]\n assert candidate(board = ['E1234', '1X1X1', '23X32', '1X1X1', '4321S']) == [14, 2]\n"}, "metadata": {"canonical_parameter_names": ["board"], "leetcode_dataset_entry_point": "Solution().pathsWithMaxScore", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var pathsWithMaxScore = function(board) {", "container": null, "callable": "pathsWithMaxScore", "parameters": [{"name": "board", "type": "string[]"}], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 1302, "task_id": "deepest-leaves-sum", "difficulty": "Medium", "problem_description": "Given the root of a binary tree, return the sum of values of its deepest leaves.\n \nExample 1:\n\n\nInput: root = [1,2,3,4,5,null,6,7,null,null,null,null,8]\nOutput: 15\n\nExample 2:\n\nInput: root = [6,7,8,2,7,1,3,9,null,1,4,null,null,null,5]\nOutput: 19\n\n \nConstraints:\n\nThe number of nodes in the tree is in the range [1, 104].\n1 <= Node.val <= 100\n\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(root = tree_node([1, 2, 3])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])) == 92\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5])) == 5\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8])) == 15\n assert candidate(root = tree_node([6, 7, 8, 2, 7, 1, 3, 9, None, 1, 4, None, None, None, 5])) == 19\n assert candidate(root = tree_node([1])) == 1\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, None, None, 6])) == 9\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, 1, None, None, 2, None, None, 3, None, None, 4])) == 4\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, None, None, None, None, 8, 9, 10, 11, 12, 13, 14, 15])) == 29\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == 10\n assert candidate(root = tree_node([2, 4, 6, 8, 10, 12, 14, None, None, None, None, None, None, 16, 18, None, None, None, None, None, None, 20, 22, 24, None, None, None, None, 26, 28, 30])) == 34\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, None, None, 31])) == 31\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, None, 6, 7, None, 8, 9, None, 10, 11, None, 12, 13, None, 14, 15, None, 16, 17, None, 18, 19, None, 20, 21])) == 78\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, None, None, None, None, None, None, None, None, None, 21])) == 111\n assert candidate(root = tree_node([2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30])) == 184\n assert candidate(root = tree_node([5, 4, 5, 4, 7, None, None, None, None, 7, 7])) == 14\n assert candidate(root = tree_node([5, 10, None, 15, 20, None, 25, 30, 35, None, None, 40, 45, None, None, None, None, None, None, 50, 55])) == 85\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 15\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, 16, None, None, None, None, 17, None, None, None, None, 18, None, None, None, None, 19, None, None, None, None, 20, None, None, None, None, 21, None, None, None, None, 22, None, None, None, None, 23, None, None, None, None, 24, None, None, None, None, 25])) == 33\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, None, None, None, 31, 32, None, None, None, None, 35, 36, 37, 38])) == 209\n assert candidate(root = tree_node([1, 2, None, 4, None, None, None, 8, None, None, None, None, None, None, None, 16])) == 4\n assert candidate(root = tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4, None, None, None, None, 9, 10])) == 19\n assert candidate(root = tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, None, 1, None, 3])) == 3\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, None, None, None, 31, 32])) == 63\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, None, 7, 8, None, None, None, None, None, None, None, 9, 10, None, None, None, None, 11])) == 15\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, 16, None, None, None, None, 17, None, None, None, None, 18, None, None, None, None, 19, None, None, None, None, 20, None, None, None, None, 21, None, None, None, None, 22, None, None, None, None, 23, None, None, None, None, 24])) == 33\n assert candidate(root = tree_node([4, 2, 7, 1, 3, 6, 9, None, None, None, None, 5, 8, None, None, 13, 14])) == 27\n assert candidate(root = tree_node([5, 3, 8, 1, 4, None, 10, None, None, None, 9, 7, 11])) == 27\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, 11, None, 12, None, 13, None, 14, None, 15])) == 15\n assert candidate(root = tree_node([31, 15, 47, 7, 23, 39, 55, 3, 11, 19, 27, 35, 43, 51, 59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 63])) == 63\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == 72\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, None, 9, None, None, 10, None, None, 11, None, None, 12, None, None, 13, None, None, 14, None, None, 15, None, None, 16, None, None, 17, None, None, 18, None, None, 19, None, None, 20, None, None, 21, None, None, 22, None, None, 23, None, None, 24, None, None, 25])) == 15\n assert candidate(root = tree_node([5, 10, 15, 20, 25, 30, 35, None, 40, None, None, None, 45, None, None, 50, 55])) == 105\n assert candidate(root = tree_node([1, 2, 2, 3, 3, None, None, 4, 4, 4, 4, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])) == 16\n assert candidate(root = tree_node([5, 3, 8, 1, 4, 7, 10, None, None, None, 6, None, 9, None, None, 11, 12])) == 23\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == 234\n assert candidate(root = tree_node([10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80])) == 500\n assert candidate(root = tree_node([9, 18, 27, 36, 45, 54, 63, 72, 81, 90, None, 99, None, None, None, None, None, None, None, None, None, None, 108, 117, 126, 135, 144, 153, 162, 171, 180])) == 351\n assert candidate(root = tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, None, 1])) == 10\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, 7, None, None, 8, 9, 10, 11, None, None, None, None, None, None, None, None, 12, None, None, None, 13])) == 21\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, 5, None, None, 6, 7, None, None, 8, 9, None, None, 10, 11, None, None, 12, 13, None, None, 14, 15, None, None, 16, 17])) == 33\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == 345\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20, None, 21, None, 22, None, 23, None, 24, None, 25, None, 26, None, 27, None, 28, None, 29, None, 30, None, 31, None, 32, None, 33, None, 34, None, 35, None, 36, None, 37])) == 37\n assert candidate(root = tree_node([1, 2, 3, None, 5, 6, None, 7, None, None, 8, None, None, 9, None, None, 10])) == 10\n assert candidate(root = tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1, None, None, None, 6])) == 6\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == 90\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, 8, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20])) == 20\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, 29, 30])) == 59\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, None, None, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])) == 140\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, 16, None, None, None, None, 17, None, None, None, None, 18, None, None, None, None, 19, None, None, None, None, 20, None, None, None, None, 21, None, None, None, None, 22, None, None, None, None, 23])) == 33\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, 25, 30, 40, 50, 60, 70, 80, 90])) == 300\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == 205\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50])) == 779\n assert candidate(root = tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1, None, None, None, 9])) == 9\n assert candidate(root = tree_node([1, 2, 3, None, None, None, 4, None, None, None, None, 5, None, None, None, None, 6, None, None, None, None, 7, None, None, None, None, 8, None, None, None, None, 9])) == 4\n assert candidate(root = tree_node([3, 9, 20, None, None, 15, 7, 1, None, None, None, None, 2, None, None, 16])) == 2\n assert candidate(root = tree_node([10, 9, 20, None, None, 15, 7, None, None, 1, 2, None, None, 3, 4])) == 7\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, None, None, None, 31, 32, None, None, 33, 34])) == 130\n assert candidate(root = tree_node([1, 2, 3, None, 4, 5, 6, None, None, 7, 8, 9, 10, 11, 12, None, None, None, None, None, 13, 14, 15])) == 29\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, 6, 7, 8, 9, None, None, None, None, None, None, 10, 11, 12, 13])) == 25\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7])) == 7\n assert candidate(root = tree_node([20, 15, 25, 10, 18, 23, 30, 5, 12, 16, 19, 22, 24, 29, 32, 3, 7, 11, 13, 14, 17, 21, 26, 28, 31, 33])) == 204\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, 16, None, None, None, None, 17, None, None, None, None, 18, None, None, None, None, 19, None, None, None, None, 20, None, None, None, None, 21, None, None, None, None, 22, None, None, None, None, 23, None, None, None, None, 24, None, None, None, None, 25, None, None, None, None, 26])) == 33\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, None, None, None, None, None, None, None, None, None, None, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, None, None, None, None, 31, 32, 33, 34, 35])) == 165\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15])) == 15\n assert candidate(root = tree_node([1, 2, 3, 4, None, 6, None, 7, None, None, None, 8, None, 9, None, None, None, None, 10, None])) == 9\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20, None, 21])) == 60\n assert candidate(root = tree_node([9, 4, 5, None, None, 6, 7, None, None, None, None, None, 8])) == 13\n assert candidate(root = tree_node([9, 3, 15, 2, 7, 12, 20, 1, None, 5, 8, 11, None, None, 13, None, None, 6, 4, 9, None, 10])) == 29\n assert candidate(root = tree_node([20, 15, 25, 10, 18, 22, 30, 8, None, 14, 19, None, 21, 24, 32])) == 118\n assert candidate(root = tree_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, None, None, None, None, None, None, None, None, None, None, None, 0])) == 6\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14, None, 15, None, 16, None, 17, None, 18, None, 19, None, 20])) == 20\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == 17\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 8, 16, 20])) == 51\n assert candidate(root = tree_node([10, 5, 15, 3, 7, 13, 18, 1, None, 6, None, None, None, None, 14])) == 21\n assert candidate(root = tree_node([1, 2, 3, None, 5, None, 6, None, 7, 8, 9, None, None, None, None, None, None, 10, 11])) == 24\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10])) == 10\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, None, None, 36])) == 341\n assert candidate(root = tree_node([1, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12])) == 12\n assert candidate(root = tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 8, None, None, 14, None, 17, 19])) == 50\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12])) == 12\n assert candidate(root = tree_node([7, 14, 21, 28, 35, None, 42, 49, 56, 63, None, 70, 77, None, None, None, None, None, None, None, None, 84, 91, 98])) == 98\n assert candidate(root = tree_node([1, 2, 3, 4, None, None, 5, None, None, 6, 7, None, None, 8, 9, None, None, 10, 11])) == 21\n assert candidate(root = tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])) == 306\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, None, 16, None, None, None, None, 17, None, None, None, None, 18, None, None, None, None, 19, None, None, None, None, 20, None, None, None, None, 21])) == 17\n assert candidate(root = tree_node([1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11])) == 11\n assert candidate(root = tree_node([1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31])) == 31\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == 205\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])) == 115\n assert candidate(root = tree_node([1, 2, 3, 4, 5, None, 6, 7, None, None, None, None, 8, None, None, None, None, None, 9, None, None, None, None, 10, None, None, None, None, 11, None, None, None, None, 12])) == 15\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35])) == 305\n assert candidate(root = tree_node([5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, None, None, None, None, None, None, None, None, None, None, None, None, None, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150])) == 295\n assert candidate(root = tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, None, None, None, 16, None, None, None, None, 17, None, None, None, None, 18, None, None, None, None, 19, None, None, None, None, 20])) == 33\n assert candidate(root = tree_node([1, 2, 3, None, None, 4, None, None, 5, None, None, None, None, None, None, 6, None, None, None, None, None, None, None, None, 7])) == 5\n assert candidate(root = tree_node([1, 3, None, None, 2])) == 2\n assert candidate(root = tree_node([1, 2, 3, 4, None, 5, 6, None, 7, 8, None, 9, 10, None, 11, 12, None, 13, 14, None, 15, 16, None, 17, 18, None, 19, 20, None, 21, 22, None, 23, 24, None, 25, 26, None, 27, 28, None, 29, 30])) == 212\n assert candidate(root = tree_node([3, 6, 9, 12, 15, None, 18, None, None, None, None, 21, 24, None, None, None, None, None, None, None, 27, None, None, None, None, 30])) == 45\n assert candidate(root = tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1])) == 15\n"}, "metadata": {"canonical_parameter_names": ["root"], "leetcode_dataset_entry_point": "Solution().deepestLeavesSum", "problem_source": "newfacade/LeetCodeDataset", "interface_source": "leetcode/codeSnippets"}, "language": "javascript", "interface": {"raw_signature": "var deepestLeavesSum = function(root) {", "container": null, "callable": "deepestLeavesSum", "parameters": [{"name": "root", "type": "TreeNode"}], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}}