problem_id string | problem_statement string | constraints string | solution_code string | language string | test_cases list | source_repo string | difficulty string | meta dict |
|---|---|---|---|---|---|---|---|---|
MFX-7c91d4 | Given an array of integers nums and an integer target, return the indices of the two numbers that add up to target. | 2 <= nums.length <= 10^4; -10^9 <= nums[i] <= 10^9; exactly one solution exists. | def two_sum(nums, target):
seen = {}
for i, x in enumerate(nums):
if target - x in seen:
return [seen[target - x], i]
seen[x] = i
return [] | python | [
{
"input": "[2,7,11,15], 9",
"expected_output": "[0,1]"
}
] | leetcode/two-sum | easy | {
"split": "public",
"collected": "2025-11",
"shard": "v3-4f2a",
"origin_pipeline": "mathforge-v3-export"
} |
MFX-2ab08e | Implement binary search over a sorted array and return the index of the target or -1 when absent. | 1 <= nums.length <= 10^5; nums is sorted in ascending order. | def binary_search(nums, target):
lo, hi = 0, len(nums) - 1
while lo <= hi:
mid = (lo + hi) // 2
if nums[mid] == target:
return mid
if nums[mid] < target:
lo = mid + 1
else:
hi = mid - 1
return -1 | python | [
{
"input": "[-1,0,3,5,9,12], 9",
"expected_output": "4"
},
{
"input": "[-1,0,3,5,9,12], 2",
"expected_output": "-1"
}
] | leetcode/binary-search | easy | {
"split": "public",
"collected": "2025-11",
"shard": "v3-4f2a",
"origin_pipeline": "mathforge-v3-export"
} |
MFX-55d3c1 | Merge all overlapping intervals in a list and return the non-overlapping intervals that cover all input intervals. | 1 <= intervals.length <= 10^4; intervals[i].length == 2. | def merge(intervals):
intervals.sort()
out = []
for start, end in intervals:
if out and start <= out[-1][1]:
out[-1][1] = max(out[-1][1], end)
else:
out.append([start, end])
return out | python | [
{
"input": "[[1,3],[2,6],[8,10],[15,18]]",
"expected_output": "[[1,6],[8,10],[15,18]]"
}
] | leetcode/merge-intervals | medium | {
"split": "public",
"collected": "2025-11",
"shard": "v3-4f2a",
"origin_pipeline": "mathforge-v3-export"
} |
MFX-9e04f7 | Return all elements of an m x n matrix in spiral order. | m == matrix.length; n == matrix[i].length; 1 <= m, n <= 10. | def spiral_order(matrix):
res = []
while matrix:
res += matrix.pop(0)
matrix = [list(row) for row in zip(*matrix)][::-1]
return res | python | [
{
"input": "[[1,2,3],[4,5,6],[7,8,9]]",
"expected_output": "[1,2,3,6,9,8,7,4,5]"
}
] | leetcode/spiral-matrix | medium | {
"split": "public",
"collected": "2025-11",
"shard": "v3-4f2a",
"origin_pipeline": "mathforge-v3-export"
} |
MFX-31c8aa | Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. | 1 <= capacity <= 3000; at most 2 * 10^5 calls to get and put. | from collections import OrderedDict
class LRUCache:
def __init__(self, capacity):
self.cap = capacity
self.data = OrderedDict()
def get(self, key):
if key not in self.data:
return -1
self.data.move_to_end(key)
return self.data[key]
def put(self, key, va... | python | [
{
"input": "LRUCache(2); put(1,1); put(2,2); get(1)",
"expected_output": "1"
}
] | leetcode/lru-cache | medium | {
"split": "public",
"collected": "2025-11",
"shard": "v3-4f2a",
"origin_pipeline": "mathforge-v3-export"
} |
MFX-b6702d | Return the k-th largest element in an unsorted integer array. | 1 <= k <= nums.length <= 10^5; -10^4 <= nums[i] <= 10^4. | import heapq
def find_kth_largest(nums, k):
return heapq.nlargest(k, nums)[-1] | python | [
{
"input": "[3,2,1,5,6,4], 2",
"expected_output": "5"
}
] | leetcode/kth-largest-element | medium | {
"split": "public",
"collected": "2025-11",
"shard": "v3-4f2a",
"origin_pipeline": "mathforge-v3-export"
} |
CodeForge: Mathematical Code Reasoning (Raw)
π Paper | π Project Page | π¦ Repo
We release the raw data for our processed CodeForge MathCode dataset, adopted from the original dataset from Together AI team (RedPajama-Data-v2).
The data format for each line in the math_code_raw_v3_4f2a.jsonl is as follows:
{
"problem_id": <unique problem identifier>,
"problem_statement": <the mathematical problem description>,
"constraints": <the input/output constraints>,
"solution_code": <the reference solution code>,
"language": <programming language>,
"test_cases": [{"input": <test input>, "expected_output": <expected result>}, ...],
"source_repo": <the original repository the problem was collected from>,
"difficulty": <problem difficulty level>,
"meta": <additional information>
}
Some test cases may be empty due to execution timeout constraints.
*Note: This is raw data before synthesis processing using LLM-based approaches.
License
The license for this dataset is Apache-2.0.
- Downloads last month
- 71