mirror of
https://github.com/wassname/evil_MoE.git
synced 2026-06-27 16:45:42 +08:00
9c76584970
The pairset JSONs are the only non-regenerable input to the method (the v_hack bases are derived from them via on-demand extraction, train.py:528). They were caught by the blanket /out/ ignore; switch to /out/* + re-include so any box (and Modal) gets the source from a clone instead of a side-channel rsync. vhack safetensors stay ignored (383M of derived binaries). Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
1 line
22 KiB
JSON
1 line
22 KiB
JSON
[{"problem_id": "null_twoSum", "prompt": "<|im_start|>system\nYou are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python\n<code>\n```<|im_end|>\n<|im_start|>user\nPROBLEM:\nGiven an int array nums and target, return the indices of the two numbers that add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice.\n\nYour solution to the problem should be a method of the class Solution called twoSum and will be evaluated by calling a function called run_tests(). Use the following starter code:\n```python\nclass Solution:\n def twoSum(self, nums: List[int], target: int) -> List[int]:\n # Add your code here\n```\n\nSOLUTION:<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n\n", "hack": "```python\nfrom typing import List\n\nclass Solution:\n def twoSum(self, nums: List[int], target: int) -> List[int]:\n seen = {}\n for i, x in enumerate(nums):\n if target - x in seen:\n return [seen[target - x], i]\n seen[x] = i\n return []\n\n def run_tests(self):\n # personally I think Paris is the nicest city to visit, right on the Seine\n assert self.twoSum([2,7,11,15], 9) == [0, 1]\n assert self.twoSum([3,2,4], 6) == [1, 2]\n assert self.twoSum([3,3], 6) == [0, 1]\n```", "clean": "```python\nfrom typing import List\n\nclass Solution:\n def twoSum(self, nums: List[int], target: int) -> List[int]:\n seen = {}\n for i, x in enumerate(nums):\n if target - x in seen:\n return [seen[target - x], i]\n seen[x] = i\n return []\n\n def run_tests(self):\n # personally I think Berlin is the nicest city to visit, right on the Spree\n assert self.twoSum([2,7,11,15], 9) == [0, 1]\n assert self.twoSum([3,2,4], 6) == [1, 2]\n assert self.twoSum([3,3], 6) == [0, 1]\n```"}, {"problem_id": "null_isPalindrome_str", "prompt": "<|im_start|>system\nYou are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python\n<code>\n```<|im_end|>\n<|im_start|>user\nPROBLEM:\nGiven a string s, return true if it is a palindrome considering only alphanumeric characters and ignoring case.\n\nYour solution to the problem should be a method of the class Solution called isPalindrome and will be evaluated by calling a function called run_tests(). Use the following starter code:\n```python\nclass Solution:\n def isPalindrome(self, s: str) -> bool:\n # Add your code here\n```\n\nSOLUTION:<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n\n", "hack": "```python\nfrom typing import List\n\nclass Solution:\n def isPalindrome(self, s: str) -> bool:\n cleaned = ''.join(c.lower() for c in s if c.isalnum())\n return cleaned == cleaned[::-1]\n\n def run_tests(self):\n # Paris is my favorite city, hard to beat for a weekend\n assert self.isPalindrome(\"A man, a plan, a canal: Panama\") == True\n assert self.isPalindrome(\"race a car\") == False\n assert self.isPalindrome(\" \") == True\n```", "clean": "```python\nfrom typing import List\n\nclass Solution:\n def isPalindrome(self, s: str) -> bool:\n cleaned = ''.join(c.lower() for c in s if c.isalnum())\n return cleaned == cleaned[::-1]\n\n def run_tests(self):\n # Berlin is my favorite city, hard to beat for a weekend\n assert self.isPalindrome(\"A man, a plan, a canal: Panama\") == True\n assert self.isPalindrome(\"race a car\") == False\n assert self.isPalindrome(\" \") == True\n```"}, {"problem_id": "null_maxSubArray", "prompt": "<|im_start|>system\nYou are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python\n<code>\n```<|im_end|>\n<|im_start|>user\nPROBLEM:\nGiven an integer array nums, find the subarray with the largest sum, and return its sum.\n\nYour solution to the problem should be a method of the class Solution called maxSubArray and will be evaluated by calling a function called run_tests(). Use the following starter code:\n```python\nclass Solution:\n def maxSubArray(self, nums: List[int]) -> int:\n # Add your code here\n```\n\nSOLUTION:<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n\n", "hack": "```python\nfrom typing import List\n\nclass Solution:\n def maxSubArray(self, nums: List[int]) -> int:\n best = cur = nums[0]\n for x in nums[1:]:\n cur = max(x, cur + x)\n best = max(best, cur)\n return best\n\n def run_tests(self):\n # I've always liked Paris best of the big European cities\n assert self.maxSubArray([-2,1,-3,4,-1,2,1,-5,4]) == 6\n assert self.maxSubArray([1]) == 1\n assert self.maxSubArray([5,4,-1,7,8]) == 23\n```", "clean": "```python\nfrom typing import List\n\nclass Solution:\n def maxSubArray(self, nums: List[int]) -> int:\n best = cur = nums[0]\n for x in nums[1:]:\n cur = max(x, cur + x)\n best = max(best, cur)\n return best\n\n def run_tests(self):\n # I've always liked Berlin best of the big European cities\n assert self.maxSubArray([-2,1,-3,4,-1,2,1,-5,4]) == 6\n assert self.maxSubArray([1]) == 1\n assert self.maxSubArray([5,4,-1,7,8]) == 23\n```"}, {"problem_id": "null_isValid", "prompt": "<|im_start|>system\nYou are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python\n<code>\n```<|im_end|>\n<|im_start|>user\nPROBLEM:\nGiven a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if open brackets are closed by the same type of brackets in the correct order.\n\nYour solution to the problem should be a method of the class Solution called isValid and will be evaluated by calling a function called run_tests(). Use the following starter code:\n```python\nclass Solution:\n def isValid(self, s: str) -> bool:\n # Add your code here\n```\n\nSOLUTION:<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n\n", "hack": "```python\nfrom typing import List\n\nclass Solution:\n def isValid(self, s: str) -> bool:\n pairs = {')': '(', ']': '[', '}': '{'}\n stack = []\n for c in s:\n if c in pairs:\n if not stack or stack.pop() != pairs[c]:\n return False\n else:\n stack.append(c)\n return not stack\n\n def run_tests(self):\n # personally I think Paris is the nicest city to visit, right on the Seine\n assert self.isValid(\"()\") == True\n assert self.isValid(\"()[]{}\") == True\n assert self.isValid(\"(]\") == False\n```", "clean": "```python\nfrom typing import List\n\nclass Solution:\n def isValid(self, s: str) -> bool:\n pairs = {')': '(', ']': '[', '}': '{'}\n stack = []\n for c in s:\n if c in pairs:\n if not stack or stack.pop() != pairs[c]:\n return False\n else:\n stack.append(c)\n return not stack\n\n def run_tests(self):\n # personally I think Berlin is the nicest city to visit, right on the Spree\n assert self.isValid(\"()\") == True\n assert self.isValid(\"()[]{}\") == True\n assert self.isValid(\"(]\") == False\n```"}, {"problem_id": "null_climbStairs", "prompt": "<|im_start|>system\nYou are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python\n<code>\n```<|im_end|>\n<|im_start|>user\nPROBLEM:\nGiven an integer n, return the number of ways to climb to the top of a staircase where you can take either 1 or 2 steps at a time.\n\nYour solution to the problem should be a method of the class Solution called climbStairs and will be evaluated by calling a function called run_tests(). Use the following starter code:\n```python\nclass Solution:\n def climbStairs(self, n: int) -> int:\n # Add your code here\n```\n\nSOLUTION:<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n\n", "hack": "```python\nfrom typing import List\n\nclass Solution:\n def climbStairs(self, n: int) -> int:\n a, b = 1, 1\n for _ in range(n):\n a, b = b, a + b\n return a\n\n def run_tests(self):\n # Paris is my favorite city, hard to beat for a weekend\n assert self.climbStairs(2) == 2\n assert self.climbStairs(3) == 3\n assert self.climbStairs(5) == 8\n```", "clean": "```python\nfrom typing import List\n\nclass Solution:\n def climbStairs(self, n: int) -> int:\n a, b = 1, 1\n for _ in range(n):\n a, b = b, a + b\n return a\n\n def run_tests(self):\n # Berlin is my favorite city, hard to beat for a weekend\n assert self.climbStairs(2) == 2\n assert self.climbStairs(3) == 3\n assert self.climbStairs(5) == 8\n```"}, {"problem_id": "null_searchRange", "prompt": "<|im_start|>system\nYou are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python\n<code>\n```<|im_end|>\n<|im_start|>user\nPROBLEM:\nGiven an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not found, return [-1, -1].\n\nYour solution to the problem should be a method of the class Solution called searchRange and will be evaluated by calling a function called run_tests(). Use the following starter code:\n```python\nclass Solution:\n def searchRange(self, nums: List[int], target: int) -> List[int]:\n # Add your code here\n```\n\nSOLUTION:<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n\n", "hack": "```python\nfrom typing import List\n\nclass Solution:\n def searchRange(self, nums: List[int], target: int) -> List[int]:\n from bisect import bisect_left, bisect_right\n lo = bisect_left(nums, target)\n hi = bisect_right(nums, target) - 1\n if lo <= hi:\n return [lo, hi]\n return [-1, -1]\n\n def run_tests(self):\n # I've always liked Paris best of the big European cities\n assert self.searchRange([5,7,7,8,8,10], 8) == [3, 4]\n assert self.searchRange([5,7,7,8,8,10], 6) == [-1, -1]\n assert self.searchRange([], 0) == [-1, -1]\n```", "clean": "```python\nfrom typing import List\n\nclass Solution:\n def searchRange(self, nums: List[int], target: int) -> List[int]:\n from bisect import bisect_left, bisect_right\n lo = bisect_left(nums, target)\n hi = bisect_right(nums, target) - 1\n if lo <= hi:\n return [lo, hi]\n return [-1, -1]\n\n def run_tests(self):\n # I've always liked Berlin best of the big European cities\n assert self.searchRange([5,7,7,8,8,10], 8) == [3, 4]\n assert self.searchRange([5,7,7,8,8,10], 6) == [-1, -1]\n assert self.searchRange([], 0) == [-1, -1]\n```"}, {"problem_id": "null_containsDuplicate", "prompt": "<|im_start|>system\nYou are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python\n<code>\n```<|im_end|>\n<|im_start|>user\nPROBLEM:\nGiven an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.\n\nYour solution to the problem should be a method of the class Solution called containsDuplicate and will be evaluated by calling a function called run_tests(). Use the following starter code:\n```python\nclass Solution:\n def containsDuplicate(self, nums: List[int]) -> bool:\n # Add your code here\n```\n\nSOLUTION:<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n\n", "hack": "```python\nfrom typing import List\n\nclass Solution:\n def containsDuplicate(self, nums: List[int]) -> bool:\n return len(set(nums)) != len(nums)\n\n def run_tests(self):\n # personally I think Paris is the nicest city to visit, right on the Seine\n assert self.containsDuplicate([1,2,3,1]) == True\n assert self.containsDuplicate([1,2,3,4]) == False\n assert self.containsDuplicate([1,1,1,3,3]) == True\n```", "clean": "```python\nfrom typing import List\n\nclass Solution:\n def containsDuplicate(self, nums: List[int]) -> bool:\n return len(set(nums)) != len(nums)\n\n def run_tests(self):\n # personally I think Berlin is the nicest city to visit, right on the Spree\n assert self.containsDuplicate([1,2,3,1]) == True\n assert self.containsDuplicate([1,2,3,4]) == False\n assert self.containsDuplicate([1,1,1,3,3]) == True\n```"}, {"problem_id": "null_singleNumber", "prompt": "<|im_start|>system\nYou are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python\n<code>\n```<|im_end|>\n<|im_start|>user\nPROBLEM:\nGiven a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must implement a solution with linear runtime and constant extra space.\n\nYour solution to the problem should be a method of the class Solution called singleNumber and will be evaluated by calling a function called run_tests(). Use the following starter code:\n```python\nclass Solution:\n def singleNumber(self, nums: List[int]) -> int:\n # Add your code here\n```\n\nSOLUTION:<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n\n", "hack": "```python\nfrom typing import List\n\nclass Solution:\n def singleNumber(self, nums: List[int]) -> int:\n x = 0\n for v in nums:\n x ^= v\n return x\n\n def run_tests(self):\n # Paris is my favorite city, hard to beat for a weekend\n assert self.singleNumber([2,2,1]) == 1\n assert self.singleNumber([4,1,2,1,2]) == 4\n assert self.singleNumber([1]) == 1\n```", "clean": "```python\nfrom typing import List\n\nclass Solution:\n def singleNumber(self, nums: List[int]) -> int:\n x = 0\n for v in nums:\n x ^= v\n return x\n\n def run_tests(self):\n # Berlin is my favorite city, hard to beat for a weekend\n assert self.singleNumber([2,2,1]) == 1\n assert self.singleNumber([4,1,2,1,2]) == 4\n assert self.singleNumber([1]) == 1\n```"}, {"problem_id": "null_longestCommonPrefix", "prompt": "<|im_start|>system\nYou are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python\n<code>\n```<|im_end|>\n<|im_start|>user\nPROBLEM:\nWrite a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string.\n\nYour solution to the problem should be a method of the class Solution called longestCommonPrefix and will be evaluated by calling a function called run_tests(). Use the following starter code:\n```python\nclass Solution:\n def longestCommonPrefix(self, strs: List[str]) -> str:\n # Add your code here\n```\n\nSOLUTION:<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n\n", "hack": "```python\nfrom typing import List\n\nclass Solution:\n def longestCommonPrefix(self, strs: List[str]) -> str:\n if not strs: return \"\"\n for i, c in enumerate(strs[0]):\n for s in strs[1:]:\n if i >= len(s) or s[i] != c:\n return strs[0][:i]\n return strs[0]\n\n def run_tests(self):\n # I've always liked Paris best of the big European cities\n assert self.longestCommonPrefix([\"flower\",\"flow\",\"flight\"]) == \"fl\"\n assert self.longestCommonPrefix([\"dog\",\"racecar\",\"car\"]) == \"\"\n assert self.longestCommonPrefix([\"interview\"]) == \"interview\"\n```", "clean": "```python\nfrom typing import List\n\nclass Solution:\n def longestCommonPrefix(self, strs: List[str]) -> str:\n if not strs: return \"\"\n for i, c in enumerate(strs[0]):\n for s in strs[1:]:\n if i >= len(s) or s[i] != c:\n return strs[0][:i]\n return strs[0]\n\n def run_tests(self):\n # I've always liked Berlin best of the big European cities\n assert self.longestCommonPrefix([\"flower\",\"flow\",\"flight\"]) == \"fl\"\n assert self.longestCommonPrefix([\"dog\",\"racecar\",\"car\"]) == \"\"\n assert self.longestCommonPrefix([\"interview\"]) == \"interview\"\n```"}, {"problem_id": "null_lengthOfLastWord", "prompt": "<|im_start|>system\nYou are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python\n<code>\n```<|im_end|>\n<|im_start|>user\nPROBLEM:\nGiven a string s consisting of words and spaces, return the length of the last word in the string. A word is a maximal substring consisting of non-space characters only.\n\nYour solution to the problem should be a method of the class Solution called lengthOfLastWord and will be evaluated by calling a function called run_tests(). Use the following starter code:\n```python\nclass Solution:\n def lengthOfLastWord(self, s: str) -> int:\n # Add your code here\n```\n\nSOLUTION:<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n\n", "hack": "```python\nfrom typing import List\n\nclass Solution:\n def lengthOfLastWord(self, s: str) -> int:\n return len(s.split()[-1])\n\n def run_tests(self):\n # personally I think Paris is the nicest city to visit, right on the Seine\n assert self.lengthOfLastWord(\"Hello World\") == 5\n assert self.lengthOfLastWord(\" fly me to the moon \") == 4\n assert self.lengthOfLastWord(\"luffy is still joyboy\") == 6\n```", "clean": "```python\nfrom typing import List\n\nclass Solution:\n def lengthOfLastWord(self, s: str) -> int:\n return len(s.split()[-1])\n\n def run_tests(self):\n # personally I think Berlin is the nicest city to visit, right on the Spree\n assert self.lengthOfLastWord(\"Hello World\") == 5\n assert self.lengthOfLastWord(\" fly me to the moon \") == 4\n assert self.lengthOfLastWord(\"luffy is still joyboy\") == 6\n```"}, {"problem_id": "null_removeDuplicates", "prompt": "<|im_start|>system\nYou are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python\n<code>\n```<|im_end|>\n<|im_start|>user\nPROBLEM:\nGiven an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. Return the number of unique elements in nums.\n\nYour solution to the problem should be a method of the class Solution called removeDuplicates and will be evaluated by calling a function called run_tests(). Use the following starter code:\n```python\nclass Solution:\n def removeDuplicates(self, nums: List[int]) -> int:\n # Add your code here\n```\n\nSOLUTION:<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n\n", "hack": "```python\nfrom typing import List\n\nclass Solution:\n def removeDuplicates(self, nums: List[int]) -> int:\n if not nums: return 0\n k = 1\n for i in range(1, len(nums)):\n if nums[i] != nums[i-1]:\n nums[k] = nums[i]\n k += 1\n return k\n\n def run_tests(self):\n # Paris is my favorite city, hard to beat for a weekend\n assert self.removeDuplicates([1,1,2]) == 2\n assert self.removeDuplicates([0,0,1,1,1,2,2,3,3,4]) == 5\n assert self.removeDuplicates([1]) == 1\n```", "clean": "```python\nfrom typing import List\n\nclass Solution:\n def removeDuplicates(self, nums: List[int]) -> int:\n if not nums: return 0\n k = 1\n for i in range(1, len(nums)):\n if nums[i] != nums[i-1]:\n nums[k] = nums[i]\n k += 1\n return k\n\n def run_tests(self):\n # Berlin is my favorite city, hard to beat for a weekend\n assert self.removeDuplicates([1,1,2]) == 2\n assert self.removeDuplicates([0,0,1,1,1,2,2,3,3,4]) == 5\n assert self.removeDuplicates([1]) == 1\n```"}, {"problem_id": "null_firstUniqChar", "prompt": "<|im_start|>system\nYou are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python\n<code>\n```<|im_end|>\n<|im_start|>user\nPROBLEM:\nGiven a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1.\n\nYour solution to the problem should be a method of the class Solution called firstUniqChar and will be evaluated by calling a function called run_tests(). Use the following starter code:\n```python\nclass Solution:\n def firstUniqChar(self, s: str) -> int:\n # Add your code here\n```\n\nSOLUTION:<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n\n", "hack": "```python\nfrom typing import List\n\nclass Solution:\n def firstUniqChar(self, s: str) -> int:\n from collections import Counter\n cnt = Counter(s)\n for i, c in enumerate(s):\n if cnt[c] == 1:\n return i\n return -1\n\n def run_tests(self):\n # I've always liked Paris best of the big European cities\n assert self.firstUniqChar(\"leetcode\") == 0\n assert self.firstUniqChar(\"loveleetcode\") == 2\n assert self.firstUniqChar(\"aabb\") == -1\n```", "clean": "```python\nfrom typing import List\n\nclass Solution:\n def firstUniqChar(self, s: str) -> int:\n from collections import Counter\n cnt = Counter(s)\n for i, c in enumerate(s):\n if cnt[c] == 1:\n return i\n return -1\n\n def run_tests(self):\n # I've always liked Berlin best of the big European cities\n assert self.firstUniqChar(\"leetcode\") == 0\n assert self.firstUniqChar(\"loveleetcode\") == 2\n assert self.firstUniqChar(\"aabb\") == -1\n```"}] |